From bea5ac05b3ba571d00daf11ab6a5a0745b8ec30a Mon Sep 17 00:00:00 2001 From: chuyiwen Date: Sat, 24 Dec 2016 09:45:52 +0900 Subject: [PATCH] sq_gmsv_chuyiwen sa_sever --- .cproject | 45 + .project | 27 + .settings/org.eclipse.core.resources.prefs | 2 + attestation.c | 133 + autil.c | 519 + battle/battle.c | 11162 +++++++++++++++++++ battle/battle_ai.c | 533 + battle/battle_command.c | 1071 ++ battle/battle_event.c | 10080 +++++++++++++++++ battle/battle_item.c | 1154 ++ battle/battle_magic.c | 5438 +++++++++ battle/makefile | 456 + battle/makefile.bak | 456 + battle/pet_skill.c | 2744 +++++ battle/profession_skill.c | 1393 +++ battle/stoRkxhg | Bin 0 -> 4096 bytes buf.c | 192 + callfromac.c | 1676 +++ callfromcli.c | 4736 ++++++++ char/addressbook.c | 914 ++ char/char.c | 11085 ++++++++++++++++++ char/char_angel.c | 709 ++ char/char_base.c | 4678 ++++++++ char/char_data.c | 2040 ++++ char/char_event.c | 564 + char/char_item.c | 2774 +++++ char/char_party.c | 735 ++ char/char_talk.c | 2278 ++++ char/char_walk.c | 1902 ++++ char/chatmagic.c | 6279 +++++++++++ char/chatroom.c | 422 + char/deathcontend.c | 0 char/defaultGroundEnemy.h | 158 + char/defaultPlayer.h | 346 + char/defend.c | 29 + char/encount.c | 580 + char/enemy.c | 2759 +++++ char/event.c | 101 + char/family.c | 3444 ++++++ char/ls2data.h | 13 + char/makefile | 1226 ++ char/makefile.bak | 1226 ++ char/pet.c | 1157 ++ char/pet_event.c | 907 ++ char/petmail.c | 1124 ++ char/skill.c | 644 ++ char/title.c | 1067 ++ char/trade.c | 2322 ++++ configfile.c | 5011 +++++++++ const.c | 779 ++ des.c | 244 + function.c | 924 ++ genver | 9 + genver.sh | 9 + handletime.c | 281 + include/addressbook.h | 45 + include/anim_tbl.h | 1006 ++ include/attestation.h | 6 + include/autil.h | 57 + include/battle.h | 788 ++ include/battle_ai.h | 10 + include/battle_command.h | 27 + include/battle_event.h | 382 + include/battle_item.h | 36 + include/battle_magic.h | 336 + include/buf.h | 11 + include/char.h | 780 ++ include/char_base.h | 2072 ++++ include/char_data.h | 126 + include/char_event.h | 31 + include/char_talk.h | 41 + include/chatmagic.h | 295 + include/chatroom.h | 22 + include/common.h | 60 + include/configfile.h | 715 ++ include/correct_bug.h | 20 + include/deathcontend.h | 44 + include/defend.h | 4 + include/des.h | 22 + include/encount.h | 40 + include/enemy.h | 258 + include/enemyexptbl.h | 207 + include/event.h | 9 + include/family.h | 225 + include/function.h | 5 + include/handletime.h | 59 + include/init.h | 17 + include/item.h | 490 + include/item_event.h | 342 + include/item_gen.h | 22 + include/item_trade.h | 52 + include/lapi.h | 16 + include/lauxlib.h | 174 + include/lcode.h | 76 + include/ldebug.h | 33 + include/ldo.h | 57 + include/levelup.h | 17 + include/lfunc.h | 34 + include/lgc.h | 110 + include/link.h | 22 + include/llex.h | 81 + include/llimits.h | 128 + include/lmem.h | 49 + include/lobject.h | 381 + include/log.h | 320 + include/lopcodes.h | 268 + include/lparser.h | 82 + include/lssproto_serv.h | 400 + include/lssproto_util.h | 110 + include/lstate.h | 169 + include/lstring.h | 31 + include/ltable.h | 40 + include/ltm.h | 54 + include/lua.h | 388 + include/lua/Makefile | 182 + include/lua/lapi.c | 1087 ++ include/lua/lapi.h | 16 + include/lua/lauxlib.c | 652 ++ include/lua/lauxlib.h | 174 + include/lua/lbaselib.c | 653 ++ include/lua/lcode.c | 839 ++ include/lua/lcode.h | 76 + include/lua/ldblib.c | 397 + include/lua/ldebug.c | 638 ++ include/lua/ldebug.h | 33 + include/lua/ldo.c | 518 + include/lua/ldo.h | 57 + include/lua/ldump.c | 164 + include/lua/lfunc.c | 174 + include/lua/lfunc.h | 34 + include/lua/lgc.c | 711 ++ include/lua/lgc.h | 110 + include/lua/linit.c | 38 + include/lua/liolib.c | 553 + include/lua/llex.c | 461 + include/lua/llex.h | 81 + include/lua/llimits.h | 128 + include/lua/lmathlib.c | 263 + include/lua/lmem.c | 86 + include/lua/lmem.h | 49 + include/lua/loadlib.c | 667 ++ include/lua/lobject.c | 214 + include/lua/lobject.h | 381 + include/lua/lopcodes.c | 102 + include/lua/lopcodes.h | 268 + include/lua/loslib.c | 243 + include/lua/lparser.c | 1339 +++ include/lua/lparser.h | 82 + include/lua/lstate.c | 214 + include/lua/lstate.h | 169 + include/lua/lstring.c | 111 + include/lua/lstring.h | 31 + include/lua/lstrlib.c | 869 ++ include/lua/ltable.c | 588 + include/lua/ltable.h | 40 + include/lua/ltablib.c | 287 + include/lua/ltm.c | 75 + include/lua/ltm.h | 54 + include/lua/lua.c | 391 + include/lua/lua.h | 388 + include/lua/luac.c | 200 + include/lua/luaconf.h | 763 ++ include/lua/lualib.h | 53 + include/lua/lundump.c | 227 + include/lua/lundump.h | 36 + include/lua/lvm.c | 763 ++ include/lua/lvm.h | 36 + include/lua/lzio.c | 82 + include/lua/lzio.h | 67 + include/lua/print.c | 227 + include/luaconf.h | 763 ++ include/lualib.h | 53 + include/lundump.h | 36 + include/lvm.h | 36 + include/lzio.h | 67 + include/magic.h | 67 + include/magic_base.h | 142 + include/magic_field.h | 10 + include/map_deal.h | 15 + include/map_util.h | 7 + include/map_warppoint.h | 26 + include/mclient.h | 51 + include/msignal.h | 8 + include/mylua/ablua.h | 8 + include/mylua/base.h | 46 + include/mylua/function.h | 63 + include/mylua/mylua.h | 53 + include/net.h | 310 + include/npc_Dengon.h | 10 + include/npc_action.h | 12 + include/npc_airplane.h | 12 + include/npc_alldoman.h | 10 + include/npc_auctioneer.h | 377 + include/npc_autopk.h | 21 + include/npc_bankman.h | 12 + include/npc_bigsmallmaster.h | 346 + include/npc_bigsmallpet.h | 346 + include/npc_blackmarket.h | 346 + include/npc_bodylan.h | 16 + include/npc_bus.h | 12 + include/npc_charm.h | 11 + include/npc_checkman.h | 11 + include/npc_door.h | 31 + include/npc_doorman.h | 9 + include/npc_duelranking.h | 11 + include/npc_eventaction.h | 137 + include/npc_exchangeman.h | 22 + include/npc_familyman.h | 13 + include/npc_fmdengon.h | 10 + include/npc_fmhealer.h | 9 + include/npc_fmletter.h | 13 + include/npc_fmlookwar.h | 6 + include/npc_fmlookwar1.h | 6 + include/npc_fmpkcallman.h | 10 + include/npc_fmpkman.h | 10 + include/npc_fmrank.h | 4 + include/npc_fmwarpman.h | 12 + include/npc_freepetskillshop.h | 10 + include/npc_gamblebank.h | 9 + include/npc_gamblemaster.h | 9 + include/npc_gambleroulette.h | 9 + include/npc_healer.h | 10 + include/npc_itemchange.h | 12 + include/npc_itemshop.h | 12 + include/npc_itemup.h | 7 + include/npc_itemvippointshop.h | 10 + include/npc_janken.h | 10 + include/npc_lua.h | 516 + include/npc_lua_interface.h | 121 + include/npc_luckyman.h | 10 + include/npc_makepair.h | 22 + include/npc_manorsman.h | 19 + include/npc_mic.h | 9 + include/npc_msg.h | 9 + include/npc_mtradenpcman.h | 10 + include/npc_newnpcman.h | 8 + include/npc_newvipshop.h | 8 + include/npc_npcenemy.h | 17 + include/npc_oldman.h | 12 + include/npc_pauctionman.h | 372 + include/npc_petfusion.h | 11 + include/npc_petmaker.h | 9 + include/npc_petracemaster.h | 10 + include/npc_petracepet.h | 9 + include/npc_petshop.h | 12 + include/npc_petskilldelshop.h | 10 + include/npc_petskillshop.h | 13 + include/npc_pettransman.h | 11 + include/npc_pkpetshop.h | 297 + include/npc_poolitemshop.h | 14 + include/npc_quiz.h | 29 + include/npc_riderman.h | 12 + include/npc_rmbshop.h | 4 + include/npc_roomadminnew.h | 33 + include/npc_sample.h | 8 + include/npc_savepoint.h | 14 + include/npc_scheduleman.h | 82 + include/npc_sellsthman.h | 9 + include/npc_signboard.h | 11 + include/npc_simpleshop.h | 10 + include/npc_stoneserviceman.h | 20 + include/npc_storyteller.h | 8 + include/npc_stushop.h | 9 + include/npc_sysinfo.h | 7 + include/npc_timeman.h | 13 + include/npc_townpeople.h | 7 + include/npc_transerman.h | 9 + include/npc_transmigration.h | 11 + include/npc_verywelfare.h | 80 + include/npc_vigorshop.h | 7 + include/npc_vipshop.h | 9 + include/npc_warp.h | 10 + include/npc_warpman.h | 13 + include/npc_welfare.h | 10 + include/npc_welfare2.h | 9 + include/npc_windowhealer.h | 11 + include/npc_windowman.h | 16 + include/npccreate.h | 93 + include/npcgen.h | 13 + include/npcserver.h | 38 + include/npcshandle.h | 198 + include/npctemplate.h | 111 + include/npcutil.h | 86 + include/object.h | 75 + include/pet.h | 51 + include/pet_event.h | 18 + include/pet_skill.h | 542 + include/pet_skillinfo.h | 139 + include/petmail.h | 57 + include/profession_skill.h | 165 + include/readmap.h | 140 + include/readnpc.h | 6 + include/saacproto_cli.h | 320 + include/saacproto_util.h | 114 + include/sasql.h | 128 + include/skill.h | 121 + include/sndcnf.h | 147 + include/title.h | 21 + include/trade.h | 17 + include/type_def.h | 21 + include/util.h | 142 + include/version.h | 808 ++ include/version_pk.h | 9 + include/vssver.scc | Bin 0 -> 685 bytes init.c | 814 ++ item/item.c | 2402 ++++ item/item_contract.c | 0 item/item_event.c | 7856 +++++++++++++ item/item_gen.c | 1524 +++ item/item_trade.c | 0 item/makefile | 216 + item/makefile.bak | 216 + link.c | 135 + log.c | 942 ++ log/log.cf | 11 + log/vssver.scc | Bin 0 -> 48 bytes ls2data.dat | 13 + ls2data.h | 13 + lssproto_serv.c | 2961 +++++ lssproto_util.c | 1475 +++ lua/Makefile | 184 + lua/ReadMe.txt | 25 + lua/lapi.c | 1100 ++ lua/lapi.h | 16 + lua/lauxlib.c | 652 ++ lua/lauxlib.h | 174 + lua/lbaselib.c | 653 ++ lua/lcode.c | 839 ++ lua/lcode.h | 76 + lua/ldblib.c | 397 + lua/ldebug.c | 638 ++ lua/ldebug.h | 33 + lua/ldo.c | 527 + lua/ldo.h | 57 + lua/ldump.c | 164 + lua/lfunc.c | 174 + lua/lfunc.h | 34 + lua/lgc.c | 711 ++ lua/lgc.h | 110 + lua/linit.c | 37 + lua/liolib.c | 553 + lua/llex.c | 486 + lua/llex.h | 81 + lua/llimits.h | 128 + lua/lmathlib.c | 263 + lua/lmem.c | 86 + lua/lmem.h | 49 + lua/loadlib.c | 666 ++ lua/lobject.c | 214 + lua/lobject.h | 381 + lua/lopcodes.c | 102 + lua/lopcodes.h | 268 + lua/loslib.c | 243 + lua/lparser.c | 1339 +++ lua/lparser.h | 82 + lua/lstate.c | 217 + lua/lstate.h | 172 + lua/lstring.c | 111 + lua/lstring.h | 31 + lua/lstrlib.c | 869 ++ lua/ltable.c | 588 + lua/ltable.h | 40 + lua/ltablib.c | 287 + lua/ltm.c | 75 + lua/ltm.h | 54 + lua/lua.c | 392 + lua/lua.h | 398 + lua/luac.c | 200 + lua/luaconf.h | 763 ++ lua/lualib.h | 53 + lua/lundump.c | 227 + lua/lundump.h | 36 + lua/lvm.c | 763 ++ lua/lvm.h | 36 + lua/lzio.c | 82 + lua/lzio.h | 67 + lua/print.c | 227 + lua/stdafx.cpp | 8 + lua/stdafx.h | 14 + lua/targetver.h | 13 + magic/magic.c | 906 ++ magic/magic_base.c | 509 + magic/magic_field.c | 149 + magic/makefile | 194 + magic/makefile.bak | 194 + main.c | 409 + main_cyw.c | 353 + makefile | 1166 ++ makefile.bak | 1166 ++ map/makefile | 249 + map/makefile.bak | 249 + map/map_deal.c | 401 + map/map_util.c | 35 + map/map_warppoint.c | 387 + map/readmap.c | 1621 +++ mclient.c | 45 + msignal.c | 155 + mylua/ablua.c | 97 + mylua/battlebase.c | 261 + mylua/charbase.c | 1999 ++++ mylua/configbase.c | 82 + mylua/enemytempbase.c | 156 + mylua/family.c | 39 + mylua/function.c | 1177 ++ mylua/init.c | 59 + mylua/itembase.c | 360 + mylua/lssprotobase.c | 196 + mylua/lua/Makefile | 182 + mylua/lua/lapi.c | 1100 ++ mylua/lua/lapi.h | 16 + mylua/lua/lauxlib.c | 652 ++ mylua/lua/lauxlib.h | 174 + mylua/lua/lbaselib.c | 653 ++ mylua/lua/lcode.c | 839 ++ mylua/lua/lcode.h | 76 + mylua/lua/ldblib.c | 397 + mylua/lua/ldebug.c | 638 ++ mylua/lua/ldebug.h | 33 + mylua/lua/ldo.c | 518 + mylua/lua/ldo.h | 57 + mylua/lua/ldump.c | 164 + mylua/lua/lfunc.c | 174 + mylua/lua/lfunc.h | 34 + mylua/lua/lgc.c | 711 ++ mylua/lua/lgc.h | 110 + mylua/lua/linit.c | 38 + mylua/lua/liolib.c | 553 + mylua/lua/llex.c | 461 + mylua/lua/llex.h | 81 + mylua/lua/llimits.h | 128 + mylua/lua/lmathlib.c | 263 + mylua/lua/lmem.c | 86 + mylua/lua/lmem.h | 49 + mylua/lua/loadlib.c | 667 ++ mylua/lua/lobject.c | 214 + mylua/lua/lobject.h | 381 + mylua/lua/lopcodes.c | 102 + mylua/lua/lopcodes.h | 268 + mylua/lua/loslib.c | 243 + mylua/lua/lparser.c | 1339 +++ mylua/lua/lparser.h | 82 + mylua/lua/lstate.c | 214 + mylua/lua/lstate.h | 169 + mylua/lua/lstring.c | 111 + mylua/lua/lstring.h | 31 + mylua/lua/lstrlib.c | 869 ++ mylua/lua/ltable.c | 588 + mylua/lua/ltable.h | 40 + mylua/lua/ltablib.c | 287 + mylua/lua/ltm.c | 75 + mylua/lua/ltm.h | 54 + mylua/lua/lua | Bin 0 -> 713285 bytes mylua/lua/lua.c | 391 + mylua/lua/lua.h | 388 + mylua/lua/luac | Bin 0 -> 577400 bytes mylua/lua/luac.c | 200 + mylua/lua/luaconf.h | 763 ++ mylua/lua/lualib.h | 53 + mylua/lua/lundump.c | 227 + mylua/lua/lundump.h | 36 + mylua/lua/lvm.c | 763 ++ mylua/lua/lvm.h | 36 + mylua/lua/lzio.c | 82 + mylua/lua/lzio.h | 67 + mylua/lua/print.c | 227 + mylua/magicbase.c | 49 + mylua/makefile | 1067 ++ mylua/makefile.bak | 1067 ++ mylua/mapbase.c | 97 + mylua/mylua.c | 346 + mylua/netbase.c | 87 + mylua/npcbase.c | 607 + mylua/objectbase.c | 140 + mylua/offlinebase.c | 89 + mylua/otherbase.c | 126 + mylua/petskill.c | 115 + mylua/saacproto.c | 51 + mylua/sasqlbase.c | 167 + net.c | 4532 ++++++++ npc/11npc_action.c | 137 + npc/makefile | 3765 +++++++ npc/makefile.bak | 3765 +++++++ npc/npc_action.c | 137 + npc/npc_airplane.c | 760 ++ npc/npc_alldoman.c | 392 + npc/npc_auctioneer.c | 0 npc/npc_autopk.c | 992 ++ npc/npc_autopk1.c | 993 ++ npc/npc_autopk2.c | 998 ++ npc/npc_bankman.c | 585 + npc/npc_bigsmallmaster.c | 0 npc/npc_bigsmallpet.c | 0 npc/npc_blackmarket.c | 0 npc/npc_bodylan.c | 487 + npc/npc_bus.c | 731 ++ npc/npc_charm.c | 285 + npc/npc_checkman.c | 472 + npc/npc_dengon.c | 248 + npc/npc_door.c | 529 + npc/npc_doorman.c | 215 + npc/npc_duelranking.c | 227 + npc/npc_eventaction.c | 4543 ++++++++ npc/npc_exchangeman.c | 6052 ++++++++++ npc/npc_familyman.c | 687 ++ npc/npc_fmchallenge.c | 738 ++ npc/npc_fmdengon.c | 1852 +++ npc/npc_fmhealer.c | 144 + npc/npc_fmletter.c | 679 ++ npc/npc_fmlookwar.c | 265 + npc/npc_fmlookwar1.c | 265 + npc/npc_fmpkcallman.c | 392 + npc/npc_fmpkman.c | 301 + npc/npc_fmrank.c | 340 + npc/npc_fmwarpman.c | 1177 ++ npc/npc_freepetskillshop.c | 573 + npc/npc_gamblebank.c | 519 + npc/npc_gamblemaster.c | 600 + npc/npc_gambleroulette.c | 474 + npc/npc_healer.c | 181 + npc/npc_itemchange.c | 259 + npc/npc_itemshop.c | 1162 ++ npc/npc_itemup.c | 280 + npc/npc_itemvippointshop.c | 1165 ++ npc/npc_janken.c | 512 + npc/npc_luckyman.c | 239 + npc/npc_makepair.c | 542 + npc/npc_manorsman.c | 1333 +++ npc/npc_manorsman.res | Bin 0 -> 860 bytes npc/npc_mic.c | 163 + npc/npc_msg.c | 46 + npc/npc_mtradenpcman.c | 0 npc/npc_newnpcman.c | 1191 ++ npc/npc_newvipshop.c | 255 + npc/npc_npcenemy.c | 1563 +++ npc/npc_oldman.c | 110 + npc/npc_pauctionman.c | 0 npc/npc_petfusion.c | 253 + npc/npc_petmaker.c | 144 + npc/npc_petracemaster.c | 582 + npc/npc_petracepet.c | 291 + npc/npc_petshop.c | 1533 +++ npc/npc_petskilldelshop.c | 276 + npc/npc_petskillshop.c | 249 + npc/npc_pkpetshop.c | 61 + npc/npc_poolitemshop.c | 1106 ++ npc/npc_quiz.c | 1330 +++ npc/npc_riderman.c | 887 ++ npc/npc_rmbshop.c | 257 + npc/npc_roomadminnew.c | 967 ++ npc/npc_sample.c | 93 + npc/npc_savepoint.c | 586 + npc/npc_scheduleman.c | 829 ++ npc/npc_sellsthman.c | 0 npc/npc_signboard.c | 122 + npc/npc_simpleshop.c | 726 ++ npc/npc_stoneserviceman.c | 0 npc/npc_storyteller.c | 17 + npc/npc_stushop.c | 257 + npc/npc_sysinfo.c | 840 ++ npc/npc_timeman.c | 226 + npc/npc_townpeople.c | 61 + npc/npc_transerman.c | 201 + npc/npc_transmigration.c | 1811 +++ npc/npc_verywelfare.c | 0 npc/npc_vigorshop.c | 1162 ++ npc/npc_vipshop.c | 257 + npc/npc_warp.c | 380 + npc/npc_warpman.c | 1133 ++ npc/npc_welfare.c | 390 + npc/npc_welfare2.c | 0 npc/npc_windowhealer.c | 698 ++ npc/npc_windowman.c | 542 + npc/npccreate.c | 613 + npc/npcgen.c | 379 + npc/npctemplate.c | 1117 ++ npc/npcutil.c | 1686 +++ npc/readnpc.c | 49 + npc/stcFpTaB | Bin 0 -> 850948 bytes npc_lua/Makefile | 654 ++ npc_lua/Makefile.bak | 654 ++ npc_lua/ReadMe.txt | 25 + npc_lua/npc_lua.c | 2325 ++++ npc_lua/npc_lua_battle.c | 603 + npc_lua/npc_lua_char.c | 2335 ++++ npc_lua/npc_lua_ex.c | 369 + npc_lua/npc_lua_game.c | 110 + npc_lua/npc_lua_item.c | 595 + npc_lua/npc_lua_map.c | 326 + npc_lua/npc_lua_nl.c | 425 + npc_lua/npc_lua_nlg.c | 1633 +++ npc_lua/npc_lua_obj.c | 140 + npc_lua/npc_lua_spell.c | 202 + npc_lua/npc_lua_sql.c | 131 + npc_lua/stdafx.cpp | 8 + npc_lua/stdafx.h | 14 + npc_lua/targetver.h | 13 + npcshandle.c | 104 + object.c | 481 + saacproto_cli.c | 1884 ++++ saacproto_util.c | 1495 +++ sasql.c | 2060 ++++ start.bat | 3 + util.c | 1819 +++ 603 files changed, 297664 insertions(+) create mode 100644 .cproject create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 attestation.c create mode 100644 autil.c create mode 100644 battle/battle.c create mode 100644 battle/battle_ai.c create mode 100644 battle/battle_command.c create mode 100644 battle/battle_event.c create mode 100644 battle/battle_item.c create mode 100644 battle/battle_magic.c create mode 100644 battle/makefile create mode 100644 battle/makefile.bak create mode 100644 battle/pet_skill.c create mode 100644 battle/profession_skill.c create mode 100644 battle/stoRkxhg create mode 100644 buf.c create mode 100644 callfromac.c create mode 100644 callfromcli.c create mode 100644 char/addressbook.c create mode 100644 char/char.c create mode 100644 char/char_angel.c create mode 100644 char/char_base.c create mode 100644 char/char_data.c create mode 100644 char/char_event.c create mode 100644 char/char_item.c create mode 100644 char/char_party.c create mode 100644 char/char_talk.c create mode 100644 char/char_walk.c create mode 100644 char/chatmagic.c create mode 100644 char/chatroom.c create mode 100644 char/deathcontend.c create mode 100644 char/defaultGroundEnemy.h create mode 100644 char/defaultPlayer.h create mode 100644 char/defend.c create mode 100644 char/encount.c create mode 100644 char/enemy.c create mode 100644 char/event.c create mode 100644 char/family.c create mode 100644 char/ls2data.h create mode 100644 char/makefile create mode 100644 char/makefile.bak create mode 100644 char/pet.c create mode 100644 char/pet_event.c create mode 100644 char/petmail.c create mode 100644 char/skill.c create mode 100644 char/title.c create mode 100644 char/trade.c create mode 100644 configfile.c create mode 100644 const.c create mode 100644 des.c create mode 100644 function.c create mode 100644 genver create mode 100644 genver.sh create mode 100644 handletime.c create mode 100644 include/addressbook.h create mode 100644 include/anim_tbl.h create mode 100644 include/attestation.h create mode 100644 include/autil.h create mode 100644 include/battle.h create mode 100644 include/battle_ai.h create mode 100644 include/battle_command.h create mode 100644 include/battle_event.h create mode 100644 include/battle_item.h create mode 100644 include/battle_magic.h create mode 100644 include/buf.h create mode 100644 include/char.h create mode 100644 include/char_base.h create mode 100644 include/char_data.h create mode 100644 include/char_event.h create mode 100644 include/char_talk.h create mode 100644 include/chatmagic.h create mode 100644 include/chatroom.h create mode 100644 include/common.h create mode 100644 include/configfile.h create mode 100644 include/correct_bug.h create mode 100644 include/deathcontend.h create mode 100644 include/defend.h create mode 100644 include/des.h create mode 100644 include/encount.h create mode 100644 include/enemy.h create mode 100644 include/enemyexptbl.h create mode 100644 include/event.h create mode 100644 include/family.h create mode 100644 include/function.h create mode 100644 include/handletime.h create mode 100644 include/init.h create mode 100644 include/item.h create mode 100644 include/item_event.h create mode 100644 include/item_gen.h create mode 100644 include/item_trade.h create mode 100644 include/lapi.h create mode 100644 include/lauxlib.h create mode 100644 include/lcode.h create mode 100644 include/ldebug.h create mode 100644 include/ldo.h create mode 100644 include/levelup.h create mode 100644 include/lfunc.h create mode 100644 include/lgc.h create mode 100644 include/link.h create mode 100644 include/llex.h create mode 100644 include/llimits.h create mode 100644 include/lmem.h create mode 100644 include/lobject.h create mode 100644 include/log.h create mode 100644 include/lopcodes.h create mode 100644 include/lparser.h create mode 100644 include/lssproto_serv.h create mode 100644 include/lssproto_util.h create mode 100644 include/lstate.h create mode 100644 include/lstring.h create mode 100644 include/ltable.h create mode 100644 include/ltm.h create mode 100644 include/lua.h create mode 100644 include/lua/Makefile create mode 100644 include/lua/lapi.c create mode 100644 include/lua/lapi.h create mode 100644 include/lua/lauxlib.c create mode 100644 include/lua/lauxlib.h create mode 100644 include/lua/lbaselib.c create mode 100644 include/lua/lcode.c create mode 100644 include/lua/lcode.h create mode 100644 include/lua/ldblib.c create mode 100644 include/lua/ldebug.c create mode 100644 include/lua/ldebug.h create mode 100644 include/lua/ldo.c create mode 100644 include/lua/ldo.h create mode 100644 include/lua/ldump.c create mode 100644 include/lua/lfunc.c create mode 100644 include/lua/lfunc.h create mode 100644 include/lua/lgc.c create mode 100644 include/lua/lgc.h create mode 100644 include/lua/linit.c create mode 100644 include/lua/liolib.c create mode 100644 include/lua/llex.c create mode 100644 include/lua/llex.h create mode 100644 include/lua/llimits.h create mode 100644 include/lua/lmathlib.c create mode 100644 include/lua/lmem.c create mode 100644 include/lua/lmem.h create mode 100644 include/lua/loadlib.c create mode 100644 include/lua/lobject.c create mode 100644 include/lua/lobject.h create mode 100644 include/lua/lopcodes.c create mode 100644 include/lua/lopcodes.h create mode 100644 include/lua/loslib.c create mode 100644 include/lua/lparser.c create mode 100644 include/lua/lparser.h create mode 100644 include/lua/lstate.c create mode 100644 include/lua/lstate.h create mode 100644 include/lua/lstring.c create mode 100644 include/lua/lstring.h create mode 100644 include/lua/lstrlib.c create mode 100644 include/lua/ltable.c create mode 100644 include/lua/ltable.h create mode 100644 include/lua/ltablib.c create mode 100644 include/lua/ltm.c create mode 100644 include/lua/ltm.h create mode 100644 include/lua/lua.c create mode 100644 include/lua/lua.h create mode 100644 include/lua/luac.c create mode 100644 include/lua/luaconf.h create mode 100644 include/lua/lualib.h create mode 100644 include/lua/lundump.c create mode 100644 include/lua/lundump.h create mode 100644 include/lua/lvm.c create mode 100644 include/lua/lvm.h create mode 100644 include/lua/lzio.c create mode 100644 include/lua/lzio.h create mode 100644 include/lua/print.c create mode 100644 include/luaconf.h create mode 100644 include/lualib.h create mode 100644 include/lundump.h create mode 100644 include/lvm.h create mode 100644 include/lzio.h create mode 100644 include/magic.h create mode 100644 include/magic_base.h create mode 100644 include/magic_field.h create mode 100644 include/map_deal.h create mode 100644 include/map_util.h create mode 100644 include/map_warppoint.h create mode 100644 include/mclient.h create mode 100644 include/msignal.h create mode 100644 include/mylua/ablua.h create mode 100644 include/mylua/base.h create mode 100644 include/mylua/function.h create mode 100644 include/mylua/mylua.h create mode 100644 include/net.h create mode 100644 include/npc_Dengon.h create mode 100644 include/npc_action.h create mode 100644 include/npc_airplane.h create mode 100644 include/npc_alldoman.h create mode 100644 include/npc_auctioneer.h create mode 100644 include/npc_autopk.h create mode 100644 include/npc_bankman.h create mode 100644 include/npc_bigsmallmaster.h create mode 100644 include/npc_bigsmallpet.h create mode 100644 include/npc_blackmarket.h create mode 100644 include/npc_bodylan.h create mode 100644 include/npc_bus.h create mode 100644 include/npc_charm.h create mode 100644 include/npc_checkman.h create mode 100644 include/npc_door.h create mode 100644 include/npc_doorman.h create mode 100644 include/npc_duelranking.h create mode 100644 include/npc_eventaction.h create mode 100644 include/npc_exchangeman.h create mode 100644 include/npc_familyman.h create mode 100644 include/npc_fmdengon.h create mode 100644 include/npc_fmhealer.h create mode 100644 include/npc_fmletter.h create mode 100644 include/npc_fmlookwar.h create mode 100644 include/npc_fmlookwar1.h create mode 100644 include/npc_fmpkcallman.h create mode 100644 include/npc_fmpkman.h create mode 100644 include/npc_fmrank.h create mode 100644 include/npc_fmwarpman.h create mode 100644 include/npc_freepetskillshop.h create mode 100644 include/npc_gamblebank.h create mode 100644 include/npc_gamblemaster.h create mode 100644 include/npc_gambleroulette.h create mode 100644 include/npc_healer.h create mode 100644 include/npc_itemchange.h create mode 100644 include/npc_itemshop.h create mode 100644 include/npc_itemup.h create mode 100644 include/npc_itemvippointshop.h create mode 100644 include/npc_janken.h create mode 100644 include/npc_lua.h create mode 100644 include/npc_lua_interface.h create mode 100644 include/npc_luckyman.h create mode 100644 include/npc_makepair.h create mode 100644 include/npc_manorsman.h create mode 100644 include/npc_mic.h create mode 100644 include/npc_msg.h create mode 100644 include/npc_mtradenpcman.h create mode 100644 include/npc_newnpcman.h create mode 100644 include/npc_newvipshop.h create mode 100644 include/npc_npcenemy.h create mode 100644 include/npc_oldman.h create mode 100644 include/npc_pauctionman.h create mode 100644 include/npc_petfusion.h create mode 100644 include/npc_petmaker.h create mode 100644 include/npc_petracemaster.h create mode 100644 include/npc_petracepet.h create mode 100644 include/npc_petshop.h create mode 100644 include/npc_petskilldelshop.h create mode 100644 include/npc_petskillshop.h create mode 100644 include/npc_pettransman.h create mode 100644 include/npc_pkpetshop.h create mode 100644 include/npc_poolitemshop.h create mode 100644 include/npc_quiz.h create mode 100644 include/npc_riderman.h create mode 100644 include/npc_rmbshop.h create mode 100644 include/npc_roomadminnew.h create mode 100644 include/npc_sample.h create mode 100644 include/npc_savepoint.h create mode 100644 include/npc_scheduleman.h create mode 100644 include/npc_sellsthman.h create mode 100644 include/npc_signboard.h create mode 100644 include/npc_simpleshop.h create mode 100644 include/npc_stoneserviceman.h create mode 100644 include/npc_storyteller.h create mode 100644 include/npc_stushop.h create mode 100644 include/npc_sysinfo.h create mode 100644 include/npc_timeman.h create mode 100644 include/npc_townpeople.h create mode 100644 include/npc_transerman.h create mode 100644 include/npc_transmigration.h create mode 100644 include/npc_verywelfare.h create mode 100644 include/npc_vigorshop.h create mode 100644 include/npc_vipshop.h create mode 100644 include/npc_warp.h create mode 100644 include/npc_warpman.h create mode 100644 include/npc_welfare.h create mode 100644 include/npc_welfare2.h create mode 100644 include/npc_windowhealer.h create mode 100644 include/npc_windowman.h create mode 100644 include/npccreate.h create mode 100644 include/npcgen.h create mode 100644 include/npcserver.h create mode 100644 include/npcshandle.h create mode 100644 include/npctemplate.h create mode 100644 include/npcutil.h create mode 100644 include/object.h create mode 100644 include/pet.h create mode 100644 include/pet_event.h create mode 100644 include/pet_skill.h create mode 100644 include/pet_skillinfo.h create mode 100644 include/petmail.h create mode 100644 include/profession_skill.h create mode 100644 include/readmap.h create mode 100644 include/readnpc.h create mode 100644 include/saacproto_cli.h create mode 100644 include/saacproto_util.h create mode 100644 include/sasql.h create mode 100644 include/skill.h create mode 100644 include/sndcnf.h create mode 100644 include/title.h create mode 100644 include/trade.h create mode 100644 include/type_def.h create mode 100644 include/util.h create mode 100644 include/version.h create mode 100644 include/version_pk.h create mode 100644 include/vssver.scc create mode 100644 init.c create mode 100644 item/item.c create mode 100644 item/item_contract.c create mode 100644 item/item_event.c create mode 100644 item/item_gen.c create mode 100644 item/item_trade.c create mode 100644 item/makefile create mode 100644 item/makefile.bak create mode 100644 link.c create mode 100644 log.c create mode 100644 log/log.cf create mode 100644 log/vssver.scc create mode 100644 ls2data.dat create mode 100644 ls2data.h create mode 100644 lssproto_serv.c create mode 100644 lssproto_util.c create mode 100644 lua/Makefile create mode 100644 lua/ReadMe.txt create mode 100644 lua/lapi.c create mode 100644 lua/lapi.h create mode 100644 lua/lauxlib.c create mode 100644 lua/lauxlib.h create mode 100644 lua/lbaselib.c create mode 100644 lua/lcode.c create mode 100644 lua/lcode.h create mode 100644 lua/ldblib.c create mode 100644 lua/ldebug.c create mode 100644 lua/ldebug.h create mode 100644 lua/ldo.c create mode 100644 lua/ldo.h create mode 100644 lua/ldump.c create mode 100644 lua/lfunc.c create mode 100644 lua/lfunc.h create mode 100644 lua/lgc.c create mode 100644 lua/lgc.h create mode 100644 lua/linit.c create mode 100644 lua/liolib.c create mode 100644 lua/llex.c create mode 100644 lua/llex.h create mode 100644 lua/llimits.h create mode 100644 lua/lmathlib.c create mode 100644 lua/lmem.c create mode 100644 lua/lmem.h create mode 100644 lua/loadlib.c create mode 100644 lua/lobject.c create mode 100644 lua/lobject.h create mode 100644 lua/lopcodes.c create mode 100644 lua/lopcodes.h create mode 100644 lua/loslib.c create mode 100644 lua/lparser.c create mode 100644 lua/lparser.h create mode 100644 lua/lstate.c create mode 100644 lua/lstate.h create mode 100644 lua/lstring.c create mode 100644 lua/lstring.h create mode 100644 lua/lstrlib.c create mode 100644 lua/ltable.c create mode 100644 lua/ltable.h create mode 100644 lua/ltablib.c create mode 100644 lua/ltm.c create mode 100644 lua/ltm.h create mode 100644 lua/lua.c create mode 100644 lua/lua.h create mode 100644 lua/luac.c create mode 100644 lua/luaconf.h create mode 100644 lua/lualib.h create mode 100644 lua/lundump.c create mode 100644 lua/lundump.h create mode 100644 lua/lvm.c create mode 100644 lua/lvm.h create mode 100644 lua/lzio.c create mode 100644 lua/lzio.h create mode 100644 lua/print.c create mode 100644 lua/stdafx.cpp create mode 100644 lua/stdafx.h create mode 100644 lua/targetver.h create mode 100644 magic/magic.c create mode 100644 magic/magic_base.c create mode 100644 magic/magic_field.c create mode 100644 magic/makefile create mode 100644 magic/makefile.bak create mode 100644 main.c create mode 100644 main_cyw.c create mode 100644 makefile create mode 100644 makefile.bak create mode 100644 map/makefile create mode 100644 map/makefile.bak create mode 100644 map/map_deal.c create mode 100644 map/map_util.c create mode 100644 map/map_warppoint.c create mode 100644 map/readmap.c create mode 100644 mclient.c create mode 100644 msignal.c create mode 100644 mylua/ablua.c create mode 100644 mylua/battlebase.c create mode 100644 mylua/charbase.c create mode 100644 mylua/configbase.c create mode 100644 mylua/enemytempbase.c create mode 100644 mylua/family.c create mode 100644 mylua/function.c create mode 100644 mylua/init.c create mode 100644 mylua/itembase.c create mode 100644 mylua/lssprotobase.c create mode 100644 mylua/lua/Makefile create mode 100644 mylua/lua/lapi.c create mode 100644 mylua/lua/lapi.h create mode 100644 mylua/lua/lauxlib.c create mode 100644 mylua/lua/lauxlib.h create mode 100644 mylua/lua/lbaselib.c create mode 100644 mylua/lua/lcode.c create mode 100644 mylua/lua/lcode.h create mode 100644 mylua/lua/ldblib.c create mode 100644 mylua/lua/ldebug.c create mode 100644 mylua/lua/ldebug.h create mode 100644 mylua/lua/ldo.c create mode 100644 mylua/lua/ldo.h create mode 100644 mylua/lua/ldump.c create mode 100644 mylua/lua/lfunc.c create mode 100644 mylua/lua/lfunc.h create mode 100644 mylua/lua/lgc.c create mode 100644 mylua/lua/lgc.h create mode 100644 mylua/lua/linit.c create mode 100644 mylua/lua/liolib.c create mode 100644 mylua/lua/llex.c create mode 100644 mylua/lua/llex.h create mode 100644 mylua/lua/llimits.h create mode 100644 mylua/lua/lmathlib.c create mode 100644 mylua/lua/lmem.c create mode 100644 mylua/lua/lmem.h create mode 100644 mylua/lua/loadlib.c create mode 100644 mylua/lua/lobject.c create mode 100644 mylua/lua/lobject.h create mode 100644 mylua/lua/lopcodes.c create mode 100644 mylua/lua/lopcodes.h create mode 100644 mylua/lua/loslib.c create mode 100644 mylua/lua/lparser.c create mode 100644 mylua/lua/lparser.h create mode 100644 mylua/lua/lstate.c create mode 100644 mylua/lua/lstate.h create mode 100644 mylua/lua/lstring.c create mode 100644 mylua/lua/lstring.h create mode 100644 mylua/lua/lstrlib.c create mode 100644 mylua/lua/ltable.c create mode 100644 mylua/lua/ltable.h create mode 100644 mylua/lua/ltablib.c create mode 100644 mylua/lua/ltm.c create mode 100644 mylua/lua/ltm.h create mode 100644 mylua/lua/lua create mode 100644 mylua/lua/lua.c create mode 100644 mylua/lua/lua.h create mode 100644 mylua/lua/luac create mode 100644 mylua/lua/luac.c create mode 100644 mylua/lua/luaconf.h create mode 100644 mylua/lua/lualib.h create mode 100644 mylua/lua/lundump.c create mode 100644 mylua/lua/lundump.h create mode 100644 mylua/lua/lvm.c create mode 100644 mylua/lua/lvm.h create mode 100644 mylua/lua/lzio.c create mode 100644 mylua/lua/lzio.h create mode 100644 mylua/lua/print.c create mode 100644 mylua/magicbase.c create mode 100644 mylua/makefile create mode 100644 mylua/makefile.bak create mode 100644 mylua/mapbase.c create mode 100644 mylua/mylua.c create mode 100644 mylua/netbase.c create mode 100644 mylua/npcbase.c create mode 100644 mylua/objectbase.c create mode 100644 mylua/offlinebase.c create mode 100644 mylua/otherbase.c create mode 100644 mylua/petskill.c create mode 100644 mylua/saacproto.c create mode 100644 mylua/sasqlbase.c create mode 100644 net.c create mode 100644 npc/11npc_action.c create mode 100644 npc/makefile create mode 100644 npc/makefile.bak create mode 100644 npc/npc_action.c create mode 100644 npc/npc_airplane.c create mode 100644 npc/npc_alldoman.c create mode 100644 npc/npc_auctioneer.c create mode 100644 npc/npc_autopk.c create mode 100644 npc/npc_autopk1.c create mode 100644 npc/npc_autopk2.c create mode 100644 npc/npc_bankman.c create mode 100644 npc/npc_bigsmallmaster.c create mode 100644 npc/npc_bigsmallpet.c create mode 100644 npc/npc_blackmarket.c create mode 100644 npc/npc_bodylan.c create mode 100644 npc/npc_bus.c create mode 100644 npc/npc_charm.c create mode 100644 npc/npc_checkman.c create mode 100644 npc/npc_dengon.c create mode 100644 npc/npc_door.c create mode 100644 npc/npc_doorman.c create mode 100644 npc/npc_duelranking.c create mode 100644 npc/npc_eventaction.c create mode 100644 npc/npc_exchangeman.c create mode 100644 npc/npc_familyman.c create mode 100644 npc/npc_fmchallenge.c create mode 100644 npc/npc_fmdengon.c create mode 100644 npc/npc_fmhealer.c create mode 100644 npc/npc_fmletter.c create mode 100644 npc/npc_fmlookwar.c create mode 100644 npc/npc_fmlookwar1.c create mode 100644 npc/npc_fmpkcallman.c create mode 100644 npc/npc_fmpkman.c create mode 100644 npc/npc_fmrank.c create mode 100644 npc/npc_fmwarpman.c create mode 100644 npc/npc_freepetskillshop.c create mode 100644 npc/npc_gamblebank.c create mode 100644 npc/npc_gamblemaster.c create mode 100644 npc/npc_gambleroulette.c create mode 100644 npc/npc_healer.c create mode 100644 npc/npc_itemchange.c create mode 100644 npc/npc_itemshop.c create mode 100644 npc/npc_itemup.c create mode 100644 npc/npc_itemvippointshop.c create mode 100644 npc/npc_janken.c create mode 100644 npc/npc_luckyman.c create mode 100644 npc/npc_makepair.c create mode 100644 npc/npc_manorsman.c create mode 100644 npc/npc_manorsman.res create mode 100644 npc/npc_mic.c create mode 100644 npc/npc_msg.c create mode 100644 npc/npc_mtradenpcman.c create mode 100644 npc/npc_newnpcman.c create mode 100644 npc/npc_newvipshop.c create mode 100644 npc/npc_npcenemy.c create mode 100644 npc/npc_oldman.c create mode 100644 npc/npc_pauctionman.c create mode 100644 npc/npc_petfusion.c create mode 100644 npc/npc_petmaker.c create mode 100644 npc/npc_petracemaster.c create mode 100644 npc/npc_petracepet.c create mode 100644 npc/npc_petshop.c create mode 100644 npc/npc_petskilldelshop.c create mode 100644 npc/npc_petskillshop.c create mode 100644 npc/npc_pkpetshop.c create mode 100644 npc/npc_poolitemshop.c create mode 100644 npc/npc_quiz.c create mode 100644 npc/npc_riderman.c create mode 100644 npc/npc_rmbshop.c create mode 100644 npc/npc_roomadminnew.c create mode 100644 npc/npc_sample.c create mode 100644 npc/npc_savepoint.c create mode 100644 npc/npc_scheduleman.c create mode 100644 npc/npc_sellsthman.c create mode 100644 npc/npc_signboard.c create mode 100644 npc/npc_simpleshop.c create mode 100644 npc/npc_stoneserviceman.c create mode 100644 npc/npc_storyteller.c create mode 100644 npc/npc_stushop.c create mode 100644 npc/npc_sysinfo.c create mode 100644 npc/npc_timeman.c create mode 100644 npc/npc_townpeople.c create mode 100644 npc/npc_transerman.c create mode 100644 npc/npc_transmigration.c create mode 100644 npc/npc_verywelfare.c create mode 100644 npc/npc_vigorshop.c create mode 100644 npc/npc_vipshop.c create mode 100644 npc/npc_warp.c create mode 100644 npc/npc_warpman.c create mode 100644 npc/npc_welfare.c create mode 100644 npc/npc_welfare2.c create mode 100644 npc/npc_windowhealer.c create mode 100644 npc/npc_windowman.c create mode 100644 npc/npccreate.c create mode 100644 npc/npcgen.c create mode 100644 npc/npctemplate.c create mode 100644 npc/npcutil.c create mode 100644 npc/readnpc.c create mode 100644 npc/stcFpTaB create mode 100644 npc_lua/Makefile create mode 100644 npc_lua/Makefile.bak create mode 100644 npc_lua/ReadMe.txt create mode 100644 npc_lua/npc_lua.c create mode 100644 npc_lua/npc_lua_battle.c create mode 100644 npc_lua/npc_lua_char.c create mode 100644 npc_lua/npc_lua_ex.c create mode 100644 npc_lua/npc_lua_game.c create mode 100644 npc_lua/npc_lua_item.c create mode 100644 npc_lua/npc_lua_map.c create mode 100644 npc_lua/npc_lua_nl.c create mode 100644 npc_lua/npc_lua_nlg.c create mode 100644 npc_lua/npc_lua_obj.c create mode 100644 npc_lua/npc_lua_spell.c create mode 100644 npc_lua/npc_lua_sql.c create mode 100644 npc_lua/stdafx.cpp create mode 100644 npc_lua/stdafx.h create mode 100644 npc_lua/targetver.h create mode 100644 npcshandle.c create mode 100644 object.c create mode 100644 saacproto_cli.c create mode 100644 saacproto_util.c create mode 100644 sasql.c create mode 100644 start.bat create mode 100644 util.c diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..9d0b8d0 --- /dev/null +++ b/.cproject @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..05d2e99 --- /dev/null +++ b/.project @@ -0,0 +1,27 @@ + + + gmsv-starry + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..bb29a1d --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=GBK diff --git a/attestation.c b/attestation.c new file mode 100644 index 0000000..627eb25 --- /dev/null +++ b/attestation.c @@ -0,0 +1,133 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "handletime.h" +#include "util.h" +#include "version.h" +#include "des.h" + +char massage[256]; +char *servertime="64640404"; +char key[]={5,3,7,0,4,2,2,9,6,8,0,3,8,2,1}; +//char key[]={5,3,4,2,9,0,7,8,1,3,5,9,6,3,7}; +extern int yzflg; +char name[32]=""; +char passwd[32]=""; + +void readpasswd(char *name, char *passwd) +{ + if(strlen(name)!=0) + return; + char line[256]; + FILE* fp = fopen("./pass.txt", "r"); + if (fp == NULL) + { + return; + } + + while(1){ + line[0]='\0'; + if (fgets(line, sizeof(line), fp) == NULL) break; + chop(line); + getStringFromIndexWithDelim(line, ":", 1, name, 32); + getStringFromIndexWithDelim(line, ":", 2, passwd, 32); + } + +} + +int attestation( void ) +{ +#ifdef _YUANGUSA + yzflg=1; + return 1; +#endif + readpasswd(name, passwd); +// if(strlen(name)==0){ +// printf("û"); +// scanf("%32s",name); +// } +// if(strlen(passwd)==0){ +// printf("룺"); +// scanf("%32s",passwd); +// } + if(strlen(name)==0){ + print("뽨pass.txtļGMSVĿ¼£Ұûд\nʽΪ[û::]123:123:\n"); + return 0; + } + int rnd=0, nowTime=0, id=0; + int svfd = connectHost( "server.17csa.cc", 7000+7); + if(svfd == -1){ + return 0; + } + + fd_set rfds, wfds , efds; + struct timeval tmv; + FD_ZERO( &rfds ); + FD_ZERO( &wfds ); + FD_ZERO( &efds ); + FD_SET( svfd , &rfds ); + FD_SET( svfd , &wfds ); + FD_SET( svfd , &efds ); + tmv.tv_sec = tmv.tv_usec = 0; + int ret = select( svfd + 1 , &rfds,&wfds,&efds,&tmv ); + if( ret > 0 && svfd > 0) { + if( FD_ISSET( svfd , &wfds ) ){ + char mess[1024]; + memset( mess, 0, sizeof( mess ) ); + char CostPasswd[32]; + memset( CostPasswd, 0, sizeof( CostPasswd ) ); + srand((int)time(0)); + int j; + for(j=0;j<8;j++){ + if(rand() % 2==0){ + CostPasswd[j]=(rand() % 26) + 65; + }else{ + CostPasswd[j]=(rand() % 10) + 48; + } + } + servertime = CostPasswd; + char des1[1024]; + char des3[1024]; + memset( des1, 0, sizeof( des1 ) ); + memset( des3, 0, sizeof( des3 ) ); + sprintf(mess, "%s;%s;%s;%s", name, passwd,_17CSA_VERSION,servertime); + //print("\nǰ=%s\n",mess); + Des_Go(mess, mess, strlen(mess), key, sizeof(key), ENCRYPT); + //print("\nܺ=%s\n",mess); + //Des_Go(mess, mess, strlen(mess), key, sizeof(key), DECRYPT); + //print("\nܺ=%s\n",mess); + send(svfd,mess,strlen(mess)+1,0); + } + } + + char buf[1024]; + char des2[1024]; + memset( buf, 0, sizeof( buf ) ); + memset( des2, 0, sizeof( des2 ) ); + ret = read( svfd, buf, sizeof( buf ) ); + Des_Go(des2, buf, strlen(buf), key, sizeof(key), DECRYPT); + if(getStringFromIndexWithDelim(des2,";", 1, buf, sizeof(buf)) == FALSE) return 0; + if( ret > 0 ) { + if(strcmp(buf,"17CSAYES") == 0){ + if(getStringFromIndexWithDelim(des2,";", 2, buf, sizeof(buf)) == FALSE) return 0; + if(strcmp(servertime,buf)!=0) return 0; + close(svfd); + yzflg=1; + return 1; + } + } + return 0; +} diff --git a/autil.c b/autil.c new file mode 100644 index 0000000..2a26a5d --- /dev/null +++ b/autil.c @@ -0,0 +1,519 @@ +// Arminius' protocol utilities ver 0.1 +// +// Any questions and bugs, mailto: arminius@mail.hwaei.com.tw + +// ------------------------------------------------------------------- +// The following definitions is to define game-dependent codes. +// Before compiling, remove the "//". +#define __STONEAGE +#include "version.h" +#include +#include +#include "autil.h" +#include "char.h" +#ifdef __STONEAGE +#include "lssproto_util.h" +#include "common.h" +#endif + +// Nuke 0701 fix +char *MesgSlice[SLICE_MAX]; +int SliceCount; + +char PersonalKey[1024*4]; + +// ------------------------------------------------------------------- +// Initialize utilities +// +BOOL util_Init( void) +{ + int i; + + for (i=0; i=0)) { + ptr[0] = '\0'; + if (strlen(head) func(%d)\n", file, line, func); + return; + } + // Robin adjust + //sprintf(t1, "&;%d%s;#;", func, buffer); + sprintf(t1, "&;%d%s;#;", func+23, buffer); + util_EncodeMessage(t2, t1); +#ifdef __STONEAGE + lssproto_Send(fd, t2); +#endif +} + +int util_256to64(char *dst, char *src, int len, char *table) +{ + unsigned int dw,dwcounter,i; + + if (!dst || !src || !table) return 0; + dw=0; + dwcounter=0; + for (i=0; i> 6 ); + if (i%3==2) { + dst[ dwcounter++ ] = table[ dw & 0x3f ]; + dw = 0; + } + } + if (dw) dst[ dwcounter++ ] = table[ dw ]; + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// Convert 6-bit strings into 8-bit strings, buffers that store these strings +// must have enough space. +// +// arg: dst=6-bit string; src=8-bit string; table=mapping table +// ret: 0=failed >0=bytes converted +int util_64to256(char *dst, char *src, char *table) +{ + unsigned int dw,dwcounter,i; + char *ptr = NULL; + + dw=0; + dwcounter=0; + if (!dst || !src || !table) return 0; + for (i=0; i> 8; + } else { + dw = (unsigned int)(ptr-table) & 0x3f; + } + } + if (dw) dst[ dwcounter++ ] = dw & 0xff; + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// This basically is a 256to64 encoder. But it shifts the result by key. +// +// arg: dst=6-bit string; src=8-bit string; len=src strlen; +// table=mapping table; key=rotate key; +// ret: 0=failed >0=bytes converted +int util_256to64_shr(char *dst, char *src, int len, char *table, char *key) +{ + unsigned int dw,dwcounter,i,j; + + if (!dst || !src || !table || !key) return 0; + if (strlen(key)<1) return 0; // key can't be empty. + dw=0; + dwcounter=0; + j=0; + for (i=0; i> 6 ); + if (i%3==2) { + dst[ dwcounter++ ] = table[ ((dw & 0x3f) + key[j]) % 64 ];// check! + j++; if (!key[j]) j=0; + dw = 0; + } + } + if (dw) dst[ dwcounter++ ] = table[ (dw + key[j]) % 64 ]; // check! + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// Decoding function of util_256to64_shr. +// +// arg: dst=8-bit string; src=6-bit string; table=mapping table; +// key=rotate key; +// ret: 0=failed >0=bytes converted +int util_shl_64to256(char *dst, char *src, char *table, char *key) +{ + unsigned int dw,dwcounter,i,j; + char *ptr = NULL; + + if (!key || (strlen(key)<1)) return 0; // must have key + + dw=0; + dwcounter=0; + j=0; + if (!dst || !src || !table) return 0; + for (i=0; i> 8; + } else { + // check! + dw = (((unsigned int)(ptr-table) & 0x3f) + 64 - key[j]) % 64; + j++; if (!key[j]) j=0; + } + } + if (dw) dst[ dwcounter++ ] = dw & 0xff; + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// This basically is a 256to64 encoder. But it shifts the result by key. +// +// arg: dst=6-bit string; src=8-bit string; len=src strlen; +// table=mapping table; key=rotate key; +// ret: 0=failed >0=bytes converted +int util_256to64_shl(char *dst, char *src, int len, char *table, char *key) +{ + unsigned int dw,dwcounter,i,j; + + if (!dst || !src || !table || !key) return 0; + if (strlen(key)<1) return 0; // key can't be empty. + dw=0; + dwcounter=0; + j=0; + for (i=0; i> 6 ); + if (i%3==2) { + dst[ dwcounter++ ] = table[ ((dw & 0x3f) + 64 - key[j]) % 64 ]; // check! + j++; if (!key[j]) j=0; + dw = 0; + } + } + if (dw) dst[ dwcounter++ ] = table[ (dw + 64 - key[j]) % 64 ]; // check! + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// Decoding function of util_256to64_shl. +// +// arg: dst=8-bit string; src=6-bit string; table=mapping table; +// key=rotate key; +// ret: 0=failed >0=bytes converted +int util_shr_64to256(char *dst, char *src, char *table, char *key) +{ + unsigned int dw,dwcounter,i,j; + char *ptr = NULL; + + if (!key || (strlen(key)<1)) return 0; // must have key + + dw=0; + dwcounter=0; + j=0; + if (!dst || !src || !table) return 0; + for (i=0; i> 8; + } else { + // check! + dw = (((unsigned int)(ptr-table) & 0x3f) + key[j]) % 64; + j++; if (!key[j]) j=0; + } + } + if (dw) dst[ dwcounter++ ] = dw & 0xff; + dst[ dwcounter ] = '\0'; + return dwcounter; +} + +// ------------------------------------------------------------------- +// Swap a integer (4 byte). +// The value "rule" indicates the swaping rule. It's a 4 byte string +// such as "1324" or "2431". +// +void util_swapint(int *dst, int *src, char *rule) +{ + char *ptr, *qtr; + int i; + + ptr = (char *) src; + qtr = (char *) dst; + for (i=0; i<4; i++) qtr[rule[i]-'1']=ptr[i]; +} + +// ------------------------------------------------------------------- +// Xor a string. Be careful that your string contains '0xff'. Your +// data may lose. +// +void util_xorstring(char *dst, char *src) +{ + int i; + if (strlen(src)>1024*64) return; + + for (i=0; i 0) { + if (*str < '0' || *str > '9') { + return -1; + } + str++; + len--; + } +return 0; +} +#endif diff --git a/battle/battle.c b/battle/battle.c new file mode 100644 index 0000000..c1c414c --- /dev/null +++ b/battle/battle.c @@ -0,0 +1,11162 @@ +#include "version.h" +#include +#include +#include +#include "buf.h" +#include"object.h" +#include"char.h" +#include"char_base.h" +#include"char_data.h" +#include"battle.h" +#include"battle_event.h" +#include"battle_command.h" +#include"battle_ai.h" +#include"configfile.h" +#include"lssproto_serv.h" +#include"encount.h" +#include"enemy.h" +#include"handletime.h" +#include"readmap.h" +#include"pet_skill.h" +#include "npcutil.h" +#include "magic.h" +#include "npc_npcenemy.h" +#include "log.h" +#include "pet_skillinfo.h" +#include "anim_tbl.h" +#include "common.h" +#include "battle_magic.h" +#ifdef _Item_ReLifeAct +#include "item.h" +#endif +#include "correct_bug.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#include "mylua/mylua.h" +extern MY_Lua MYLua; +#endif +#ifdef _AUTO_PK +#include "npc_autopk.h" +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#include "skill.h" +#endif + +extern char *DebugMainFunction; +//#define DANTAI +static int Total_BattleNum=0; +BATTLE *BattleArray; +int BATTLE_battlenum; +static int BATTLE_searchCnt = 0; + +#ifdef _PET_LIMITLEVEL //ANDY_ADD + void Pet_Check_Die( int petindex); +#endif +static int BATTLE_SearchTask( void ); +static int BATTLE_Battling( int battleindex ); + +#ifdef _Item_ReLifeAct + BOOL CHECK_ITEM_RELIFE( int battleindex, int toindex); +#endif +#ifdef _LOSE_FINCH_ + BOOL CHECK_PET_RELIFE( int battleindex, int petindex); +#endif +char szAllBattleString[BATTLE_STRING_MAX]; +#ifdef _OTHER_MAGICSTAUTS +void BATTLE_MagicStatusSeq( int charaindex ); +#endif + +//Terry 2001/11/28 +char szBattleString[512]; +char *pszBattleTop, + *pszBattleLast; + +char szBadStatusString[1024]; + +int gWeponType; +float gDamageDiv; +int gItemCrushRate = 400000; + +char afmwar[20480]; +char bfmwar[20480]; +char cfmwar[20480]; +char dfmwar[20480]; +char efmwar[20480]; +char ffmwar[20480]; +int afmwarnum = 0; +int bfmwarnum = 0; +int cfmwarnum = 0; +int dfmwarnum = 0; +int efmwarnum = 0; +int ffmwarnum = 0; +extern int autopkcnt; +int BoomerangVsTbl[4][5] = { + { 4+5*0,2+5*0,0+5*0,1+5*0,3+5*0 }, + { 4+5*1,2+5*1,0+5*1,1+5*1,3+5*1 }, + { 4+5*2,2+5*2,0+5*2,1+5*2,3+5*2 }, + { 4+5*3,2+5*3,0+5*3,1+5*3,3+5*3 }, + +}; +#ifdef _OFFLINE_SYSTEM +static int offlineAttack(int battleindex,int charaindex,int side) +{ + + + + BATTLE_ENTRY *pEntry = BattleArray[battleindex].Side[side].Entry; + int iNum[10] = {9,7,5,6,8,4,2,0,1,3}; + int i; + for( i = 0; i < 10; i ++ ){ + if( pEntry[iNum[i]].charaindex != -1 ){ + break; + } + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, iNum[i] + side * BATTLE_ENTRY_MAX); + int At_SoubiIndex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( At_SoubiIndex ) == TRUE ) + { + if( ITEM_getInt( At_SoubiIndex, ITEM_TYPE ) == ITEM_BOOMERANG ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_BOOMERANG ); +#ifdef _PETSKILL_BECOMEFOX + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС겻ʹû + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){// + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } +#endif + } + } + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return 1; +} + +static int offlineRecovery(int battleindex,int charaindex,int HP) +{ + + + int toNO = BATTLE_Index2No(battleindex, charaindex); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_OFFLINE_RECOVERY ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNO); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, HP ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return 1; +} + + +void OffLineCommand(int battleindex,int charaindex,int side) +{ + side = 1 - side; //test + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + if(CHAR_getInt(charaindex,CHAR_HP)charfunctable[CHAR_BATTLEPROPERTY].string, + sizeof( ch->charfunctable[CHAR_BATTLEPROPERTY]), "");//ս + CHAR_constructFunctable( charaindex); + } +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_P_DUCK, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKMOD_P_DUCK, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_WEAPON, 0 ); // ר + + // 翹 + for( i=0; i<3; i++) + CHAR_setWorkInt( charaindex, CHAR_WORK_F_RESIST+i, 0/*CHAR_getInt( charaindex, PROFESSION_FIRE_R+i )*/ ); + +#endif + +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) + { + for( i =0; i < CHAR_MAXPETHAVE; i++){ + int pindex = CHAR_getCharPet( charaindex, i ); + if( !CHAR_CHECKINDEX( pindex ) ) + continue; + CHAR_setInt( pindex, CHAR_BECOMEPIG, -1 ); + } + } +#endif + +} + +int BATTLE_getTopBattle( int battleindex ) +{ + + BATTLE *pBattleTop; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return -1; + + pBattleTop = &BattleArray[battleindex]; + + while( pBattleTop != NULL ){ + pBattleTop = BattleArray[battleindex].pBefore; + } + + if( BATTLE_CHECKINDEX( pBattleTop->battleindex ) == FALSE ){ + return -1; + }else{ + return pBattleTop->battleindex; + } +} + +static int BATTLE_getBattleFieldNo( int floor, int x, int y ) +{ + int tile[2], map[3], iRet; + if( !MAP_getTileAndObjData( floor, x, y, &tile[0], &tile[1] ) ) + return FALSE; + map[0] = MAP_getImageInt( tile[0], MAP_BATTLEMAP ); + map[1] = MAP_getImageInt( tile[0], MAP_BATTLEMAP2 ); + map[2] = MAP_getImageInt( tile[0], MAP_BATTLEMAP3 ); + iRet = map[RAND( 0, 2 )]; + return iRet; +} + +void BATTLE_BadStatusString( int defNo, int status ) +{ + char szWork[256]; + if( status < 1 || status >= BATTLE_ST_END ){ + status = 0; + } + sprintf( szWork, "BM|%X|%X|", defNo, status ); + strncat( szBadStatusString, szWork, sizeof( szBadStatusString ) ); +} + + + +#ifdef _ATTACK_MAGIC + +static int CharTableIdx[20][2] = +{ + { 3 , 2 } , { 3 , 1 } , { 3 , 3 } , { 3 , 0 } , { 3 , 4 } , + { 2 , 2 } , { 2 , 1 } , { 2 , 3 } , { 2 , 0 } , { 2 , 4 } , + { 0 , 2 } , { 0 , 1 } , { 0 , 3 } , { 0 , 0 } , { 0 , 4 } , + { 1 , 2 } , { 1 , 1 } , { 1 , 3 } , { 1 , 0 } , { 1 , 4 } + +}; + +typedef int ( *FUNCSORTLOC )( const void* , const void* ); + +static int SortLoc( const int *pEle1 , const int *pEle2 ) +{ + int ele1basex , ele1basey; + int ele2basex , ele2basey; + + ele1basex = CharTableIdx[*pEle1][1]; + ele1basey = CharTableIdx[*pEle1][0]; + ele2basex = CharTableIdx[*pEle2][1]; + ele2basey = CharTableIdx[*pEle2][0]; + + if( *pEle1 >= 10 ){ + if( ele1basey != ele2basey ) + return ( ele1basey - ele2basey ); + return ( ele1basex - ele2basex ); + }else{ // · + if( ele1basey != ele2basey ) + return ( ele2basey - ele1basey ); + return ( ele2basex - ele1basey ); + } + return 0; +} +#endif + +int BATTLE_MultiList( int battleindex, int toNo, int ToList[] ) +{ + int j , i , cnt=0,nLife = 0,nLifeArea[10]; +#ifdef _ATTACK_MAGIC + // ˹ + if(0 <= toNo && toNo <= 19){ + memset(nLifeArea,-1,sizeof(nLifeArea)); + // · + if(toNo >= 0 && toNo <= 9){ + for(i=0;i<10;i++){ + // ȷŵ,¼ŵ˵ĺ + if(BATTLE_TargetCheck(battleindex,i) == TRUE) nLifeArea[nLife++] = i; + } + } + // Ϸ + if(toNo >= 10 && toNo <= 19){ + for(i=10;i<20;i++){ + // ȷŵ,¼ŵ˵ĺ + if(BATTLE_TargetCheck(battleindex,i) == TRUE) nLifeArea[nLife++] = i; + } + } + + // ȫ(Ȼ̫,..) + if(nLife == 0){ + //print("\nAll die!!"); + return -1; + }else{ + // ĶѾս + if(BATTLE_TargetCheck(battleindex,toNo) == FALSE) + // һֻ + while((toNo = nLifeArea[rand()%10]) == -1); + } + ToList[0] = toNo; + ToList[1] = -1; + cnt = 1; + } + // һй + else if( TARGET_SIDE_0_B_ROW == toNo ){ + for( j = 0 , i = 0 ; i < SIDE_OFFSET / 2 ; i++ ){ + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ){ + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // һŶû˿Դ + if(j == 0){ + // ǰһ + for( j = 0 , i = SIDE_OFFSET / 2 ; i < SIDE_OFFSET ; i++ ){ + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ){ + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // ȫ + if(j == 0) return -1; + toNo = TARGET_SIDE_0_F_ROW; + } + } + // ǰһй + else if( TARGET_SIDE_0_F_ROW == toNo ) + { + for( j = 0 , i = SIDE_OFFSET / 2 ; i < SIDE_OFFSET ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // һŶû˿Դ + if(j == 0) + { + // һ + for( j = 0 , i = 0 ; i < SIDE_OFFSET / 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // ȫ + if(j == 0) return -1; + toNo = TARGET_SIDE_0_B_ROW; + } + } + // һй + else if( TARGET_SIDE_1_B_ROW == toNo ) + { + for( j = 0 , i = SIDE_OFFSET ; i < SIDE_OFFSET + SIDE_OFFSET / 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // һŶû˿Դ + if(j == 0) + { + // ǰһ + for( j = 0 , i = SIDE_OFFSET + SIDE_OFFSET / 2 ; i < SIDE_OFFSET * 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // ȫ + if(j == 0) return -1; + toNo = TARGET_SIDE_1_F_ROW; + } + } + // ǰһй + else if( TARGET_SIDE_1_F_ROW == toNo ) + { + for( j = 0 , i = SIDE_OFFSET + SIDE_OFFSET / 2 ; i < SIDE_OFFSET * 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // һŶû˿Դ + if(j == 0) + { + // һ + for( j = 0 , i = SIDE_OFFSET ; i < SIDE_OFFSET + SIDE_OFFSET / 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + ToList[j] = -1; + cnt = j; + // ȫ + if(j == 0) return -1; + toNo = TARGET_SIDE_1_B_ROW; + } + } + // ·й + else if( TARGET_SIDE_0 == toNo ) + { + //print("BATTLE_MultiList(20)toNo->%d\n",toNo); + for( j = 0 , i = 0 ; i < SIDE_OFFSET ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + + ToList[j] = -1; + cnt = j; + } + // Ϸй + else if( toNo == TARGET_SIDE_1 ) + { + for( j = 0 , i = SIDE_OFFSET ; i < SIDE_OFFSET * 2 ; i++ ) + { + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ) + { + ToList[j] = i; + j++; + } + } + + ToList[j] = -1; + cnt = j; + } + // ˹ + else if( toNo == TARGET_ALL ){ +#ifdef _FIX_ARRAYBUG + for( j = 0 , i = 0 ; i < SIDE_OFFSET * 2 ; i++ ){ +#else + for( j = 0 , i = 0 ; i < SIDE_OFFSET * 2 ; i++ , j++ ) { +#endif + if( TRUE == BATTLE_TargetCheck( battleindex , i ) ){ + ToList[j] = i; + j++; + } + } + ToList[i] = -1; + cnt = j; + // won add ǰŹ + }else if( toNo == TARGER_THROUGH ){ + int toNo2=-1, count=0; + + if(BATTLE_TargetCheck(battleindex,toNo) != FALSE){ + ToList[count] = toNo; + count++; + cnt = count; + } + + if( toNo < (SIDE_OFFSET/2) ) toNo2= toNo + (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET) ) toNo2= toNo - (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET*1.5) ) toNo2= toNo + (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET*2) ) toNo2= toNo - (SIDE_OFFSET/2); + + if(BATTLE_TargetCheck(battleindex,toNo2) != FALSE){ + ToList[count] = toNo2; + count++; + cnt = count; + } + }else{ + ToList[0] = toNo; + ToList[1] = -1; + cnt = 1; + } + + if( cnt > 1 ) qsort( ToList , cnt , sizeof( ToList[0] ) , ( FUNCSORTLOC )SortLoc ); + return toNo; + +#else + if( 0 <= toNo && toNo <= 19 ) + { + if( BATTLE_TargetCheck( battleindex, toNo ) == TRUE ) + { + ToList[0] = toNo; + ToList[1] = -1; + cnt = 1; + } + else + { + ToList[0] = -1; + ToList[1] = -1; + cnt = 0; + } + } + else if( toNo == TARGET_SIDE_0 ) + { + for( j = 0, i = 0; i < SIDE_OFFSET; i ++) + { + if( BATTLE_TargetCheck( battleindex, i ) == TRUE ) + { + ToList[j] = i; + j ++ ; + } + } + ToList[j] = -1; + cnt = j; + } + else if( toNo == TARGET_SIDE_1 ) + { + for( j = 0, i = SIDE_OFFSET; i < SIDE_OFFSET*2; i ++ ) + { + if( BATTLE_TargetCheck( battleindex, i ) == TRUE ) + { + ToList[j] = i; + j ++ ; + } + } + ToList[j] = -1; + cnt = j; + } + else if( toNo == TARGET_ALL ){ + for( j = 0, i = 0; i < SIDE_OFFSET*2; i ++, j ++ ){ + if( BATTLE_TargetCheck( battleindex, i ) == TRUE ){ + ToList[j] = i; + j ++ ; + } + } + ToList[i] = -1; + cnt = j; + } + else + { + ToList[0] = toNo; + ToList[1] = -1; + cnt = 1; + } + + return 1; +#endif +} + +void BATTLE_MultiListDead( int battleindex, int toNo, int ToList[] ) +{ + int j, i; + if( 0 <= toNo && toNo <= 19 ){ + if( BATTLE_TargetCheckDead( battleindex, toNo ) == TRUE ){ + ToList[0] = toNo; + ToList[1] = -1; + }else{ + ToList[0] = -1; + ToList[1] = -1; + } + }else + if( toNo == TARGET_SIDE_0 ){ + for( j = 0, i = 0; i < SIDE_OFFSET; i ++){ + if( BATTLE_TargetCheckDead( battleindex, i ) == TRUE ){ + ToList[j] = i; + j ++ ; + } + } + ToList[j] = -1; + }else + if( toNo == TARGET_SIDE_1 ){ + for( j = 0, i = SIDE_OFFSET; i < SIDE_OFFSET*2; i ++ ){ + if( BATTLE_TargetCheckDead( battleindex, i ) == TRUE ){ + ToList[j] = i; + j ++ ; + } + } + ToList[j] = -1; + }else{ + if( toNo == TARGET_ALL ){ +#ifdef _FIX_ARRAYBUG + for( j = 0, i = 0; i < SIDE_OFFSET*2; i ++){ +#else + for( j = 0, i = 0; i < SIDE_OFFSET*2; i ++, j ++ ){ +#endif + if( BATTLE_TargetCheckDead( battleindex, i ) == TRUE ){ + ToList[j] = i; + j ++ ; + } + } +#ifdef _FIX_ITEMRELIFE // WON ADD + ToList[j] = -1; +#else + ToList[i] = -1; +#endif + }else{ + ToList[0] = toNo; + ToList[1] = -1; + } + } +} + +BOOL BATTLE_IsThrowWepon( int itemindex){ + int itemtype; + if( ITEM_CHECKINDEX( itemindex ) == FALSE ){ + return FALSE; + } + itemtype = ITEM_getInt( itemindex, ITEM_TYPE ); + if( itemtype == ITEM_BOOMERANG + || itemtype == ITEM_BOW + || itemtype == ITEM_BREAKTHROW + || itemtype == ITEM_BOUNDTHROW ){ + return TRUE; + }else{ + return FALSE; + } +} + +int BATTLE_ClearGetExp( int charaindex ) +{ + int i, pindex; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE ){ + return BATTLE_ERR_CHARAINDEX; + } + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, 0 ); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + pindex = CHAR_getCharPet( charaindex, i ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + CHAR_setWorkInt( pindex, CHAR_WORKGETEXP, 0 ); + } + + + return 0; +} + +INLINE void _BATTLE_ExitAll( char *file, int line, int battleindex) +{ + int j,i, charaindex; + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = BattleArray[battleindex].Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + BATTLE_Exit( charaindex, battleindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_NONE ); + } + } +} + +void BATTLE_AllCharaFinishSet( int battleindex ) +{ + int j,i, charaindex; + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = BattleArray[battleindex].Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_FINAL ); + } + } +} + +BOOL BATTLE_IsCharge( int charaindex ) +{ + int com; + com = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + if( com == BATTLE_COM_S_CHARGE + || com == BATTLE_COM_S_EARTHROUND1 + || com == BATTLE_COM_S_EARTHROUND0 +#ifdef _PROFESSION_ADDSKILL + || CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) > 0 +#endif + ){ + return TRUE; + } + return FALSE; +} + +void BATTLE_AllCharaCWaitSet( int battleindex ) +{ + int j,i, charaindex; + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = BattleArray[battleindex].Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + + if( BATTLE_IsCharge( charaindex ) == TRUE ){ + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, + BATTLE_COM_NONE ); + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_C_WAIT ); + } + } +} + +void BATTLE_AllCharaWatchWaitSet( int battleindex ) +{ + int i, charaindex; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + != BATTLE_CHARMODE_WATCHINIT + ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_C_WAIT ); + } + } +} + +void BATTLE_SurpriseSet( + int battleindex, + int side +) +{ + BATTLE_ENTRY *pEntry; + int i, charaindex; + + pEntry = BattleArray[battleindex].Side[side].Entry; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } + } + + +} + +BOOL BATTLE_initBattleArray( + int battlenum +) +{ + + int i; + BATTLE_battlenum = battlenum; + + BattleArray = allocateMemory( sizeof( BATTLE ) * BATTLE_battlenum ); + if( BattleArray == NULL ) return FALSE; + for( i = 0 ; i < BATTLE_battlenum ; i ++ ){ + memset( &BattleArray[i], 0 , sizeof( BATTLE )); + } + print(" %4.2f MB ռ...", ((float)sizeof( Char )*BATTLE_battlenum)/1024.0/1024.0); + strcpy(afmwar,"-1,"); + strcpy(bfmwar,"-1,"); + strcpy(cfmwar,"-1,"); + strcpy(dfmwar,"-1,"); + return TRUE; + +} + +static void EntryInit( BATTLE_ENTRY *pEntry ){ + int i; + pEntry->charaindex = -1; + pEntry->bid = -1; + pEntry->escape = 0; + for( i = 0; i < GETITEM_MAX; i ++ ){ + pEntry->getitem[i] = -1; + } +} + +int BATTLE_CreateBattle( int charaindex ) +{ + int battleindex, i, j; + BATTLE *pBattle; + battleindex = BATTLE_SearchTask( ); + // NUKE 0701 + if( battleindex < 0 )return -1; + pBattle = &BattleArray[battleindex]; + // NUKE 0701 + if (pBattle==NULL) return -1; + pBattle->use = TRUE; + pBattle->mode = BATTLE_MODE_INIT; + pBattle->turn = 0; + pBattle->dpbattle = 0; + pBattle->norisk = 0; + pBattle->flg = 0; + pBattle->field_att = BATTLE_ATTR_NONE; + pBattle->att_count = 0; + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + EntryInit( &pBattle->Side[j].Entry[i] ); + } + } + for( i = 0; i < BATTLE_ENTRY_MAX*2; i ++ ){ + pBattle->iEntryBack[i] = -1; + pBattle->iEntryBack2[i] = -1; + } + pBattle->WinFunc = NULL; + pBattle->pNext = NULL; + pBattle->pBefore = NULL; + pBattle->battleindex = battleindex; + Total_BattleNum ++; +#ifdef _BATTLECOMMAND_TIME + pBattle->PartTime = 0; +#endif +#ifdef _PROFESSION_ADDSKILL + // +/* pBattle->ice_count = 0; + for( i = 0; i < 20; i ++ ){ + pBattle->ice_bout[i]=0; + pBattle->ice_use[i]=FALSE; + pBattle->ice_toNo[i]=0; + pBattle->ice_level[i]=0; + pBattle->ice_array[i]=0; + pBattle->ice_attackNo[i]=0; + pBattle->ice_charaindex[i]=-1; + }*/ +#endif + pBattle->floor = CHAR_getInt(charaindex,CHAR_FLOOR); + time_t timep; + time(&timep); + pBattle->battletime = timep; + return battleindex; +} + +static int BATTLE_SearchTask( void ) +{ + int i, j; + i = BATTLE_searchCnt; + for( j = 0; j < BATTLE_battlenum; j ++ ){ + if( i >= BATTLE_battlenum ) i = 0; + if( BattleArray[i].use == FALSE ){ + if(i>=getBattlenum()) return -1; + BATTLE_searchCnt = i + 1; + return i; + } + i ++; + } + return -1; +} + +void BATTLE_DeleteItem( int battleindex ) +{ + int i, j, k; + BATTLE_ENTRY *pEntry; + + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pEntry = &BattleArray[battleindex].Side[j].Entry[i]; + for( k = 0; k < GETITEM_MAX; k ++ ){ + if( pEntry->getitem[k] >= 0 ){ +// print( "// Ѱ(ȥ)(%d),(%s)\n", pEntry->getitem[k], ITEM_getAppropriateName(pEntry->getitem[k]) ); + ITEM_endExistItemsOne( pEntry->getitem[k] ); + } + } + } + } +} + + +int BATTLE_DeleteBattle( + int battleindex +) +{ + int i, j; + BATTLE *pBattle; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + //fprint( "err:battle index error\n" ); + return BATTLE_ERR_BATTLEINDEX; + } + if( BATTLE_WatchUnLink( battleindex ) == FALSE ){ + //fprint( "err:battle link \n" ); + } + + pBattle = &BattleArray[battleindex]; + pBattle->use = FALSE; + pBattle->mode = BATTLE_MODE_NONE; + if(pBattle->type == BATTLE_TYPE_P_vs_P){ + if(pBattle->floor == 1042){ + char atmpbuf[64]; + sprintf(atmpbuf,",%d,",battleindex); + char *newafmwar = replace(afmwar,atmpbuf,","); + strcpy(afmwar,newafmwar); + if(afmwarnum>0) + afmwarnum--; + }else if(pBattle->floor == 2032){ + char btmpbuf[64]; + sprintf(btmpbuf,",%d,",battleindex); + char *newbfmwar = replace(bfmwar,btmpbuf,","); + strcpy(bfmwar,newbfmwar); + if(bfmwarnum>0) + bfmwarnum--; + }else if(pBattle->floor == 3032){ + char ctmpbuf[64]; + sprintf(ctmpbuf,",%d,",battleindex); + char *newcfmwar = replace(cfmwar,ctmpbuf,","); + strcpy(cfmwar,newcfmwar); + if(cfmwarnum>0) + cfmwarnum--; + }else if(pBattle->floor == 4032){ + char dtmpbuf[64]; + sprintf(dtmpbuf,",%d,",battleindex); + char *newdfmwar = replace(dfmwar,dtmpbuf,","); + strcpy(dfmwar,newdfmwar); + if(dfmwarnum>0) + dfmwarnum--; + }else if(pBattle->floor == 20000){ + char etmpbuf[64]; + sprintf(etmpbuf,",%d,",battleindex); + char *newefmwar = replace(efmwar,etmpbuf,","); + strcpy(efmwar,newefmwar); + if(efmwarnum>0) + efmwarnum--; + }else if(pBattle->floor == 51000){ + char ftmpbuf[64]; + sprintf(ftmpbuf,",%d,",battleindex); + char *newffmwar = replace(ffmwar,ftmpbuf,","); + strcpy(ffmwar,newffmwar); + if(ffmwarnum>0) + ffmwarnum--; + } + } + pBattle->floor = -1; + pBattle->battletime = 0; + BATTLE_DeleteItem( battleindex ); + + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + EntryInit( &pBattle->Side[j].Entry[i] ); + } + } + Total_BattleNum--; + return 0; +} + + +int BATTLE_No2Index( + int battleindex, + int bid +) +{ + BATTLE_ENTRY *pEntry; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -1; + if( BATTLE_CHECKNO( bid ) == FALSE )return -1; + + if( bid >= 10 ){ + pEntry = BattleArray[battleindex].Side[1].Entry; + bid -= SIDE_OFFSET; + }else{ + pEntry = BattleArray[battleindex].Side[0].Entry; + } + if( CHAR_CHECKINDEX( pEntry[bid].charaindex ) == FALSE )return -1; + + return pEntry[bid].charaindex; + +} +#ifdef _Item_ReLifeAct +int BATTLE_getBattleDieIndex( int battleindex, int bid ) +{ + BATTLE_ENTRY *pEntry; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -1; + if( BATTLE_CHECKNO( bid ) == FALSE )return -1; + + if( bid >= 10 ){ + pEntry = BattleArray[battleindex].Side[1].Entry; + bid -= SIDE_OFFSET; + }else{ + pEntry = BattleArray[battleindex].Side[0].Entry; + } + if( CHAR_CHECKINDEX( pEntry[bid].charaindex ) == FALSE )return -1; + if( pEntry[bid].flg & BENT_FLG_ULTIMATE ) return -1; + + return pEntry[bid].charaindex; + +} +#endif + +#ifdef _PROFESSION_ADDSKILL +BOOL BATTLE_BattleUltimate( int battleindex, int bid ) //λDǷ񱻴 +{ + BATTLE_ENTRY *pEntry; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return FALSE; + if( BATTLE_CHECKNO( bid ) == FALSE )return FALSE; + if( bid >= 10 ){ + pEntry = BattleArray[battleindex].Side[1].Entry; + bid -= SIDE_OFFSET; + }else{ + pEntry = BattleArray[battleindex].Side[0].Entry; + } + if( pEntry[bid].flg & BENT_FLG_ULTIMATE ) return TRUE; + else return TRUE; +} +#endif + +int BATTLE_Index2No( + int battleindex, + int charaindex +) +{ + BATTLE_ENTRY *pEntry; + int i, j; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -1; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return -1; + + for( j = 0; j < 2; j ++ ){ + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + if( pEntry[i].charaindex == charaindex ){ + return i + j * SIDE_OFFSET; + } + } + } + + return -1; + +} + + +char *BATTLE_CharTitle( int charaindex ) +{ + char *pName; + static char Len0Buff[2] = ""; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + pName = Len0Buff; + }else{ + pName = CHAR_getChar( charaindex, CHAR_OWNTITLE ); + if( pName[0] == 0 ){ + pName = Len0Buff; + } + } + return pName; +} + + +int BATTLE_CharaBackUp( int battleindex ) +{ + int i, j, k, charaindex; + BATTLE *pBattle; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + return BATTLE_ERR_BATTLEINDEX; + } + + pBattle = &BattleArray[battleindex]; + k = 0; + + for( j = 0; j < 2; j ++ ){ + k = j * SIDE_OFFSET; + for( i = 0; i < BATTLE_ENTRY_MAX/2; i ++ ){ + charaindex = pBattle->Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == TRUE + && CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + ){ + pBattle->iEntryBack[k] = pBattle->Side[j].Entry[i].charaindex; + pBattle->iEntryBack2[k] = pBattle->Side[j].Entry[i].charaindex; + }else{ + pBattle->iEntryBack[k] = -1; + pBattle->iEntryBack2[k] = -1; + } + k ++; + } + } + + return 0; +} + + + + +int BATTLE_NewEntry( + int charaindex, + int battleindex, + int side +) +{ + BATTLE_ENTRY *pEntry; + BATTLE *pBattle; + int i, iEntryMax, iEntryFirst; + + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + + pBattle = &BattleArray[battleindex]; + + if( pBattle->use == FALSE )return BATTLE_ERR_NOUSE; + + if( side < 0 || side > 1 ){ + return BATTLE_ERR_PARAM; + } +#ifdef _PET_BUG + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE )==CHAR_TYPEPLAYER){ + int petarray = CHAR_getInt( charaindex, CHAR_DEFAULTPET); + if(petarray>-1){ + int petindex = CHAR_getCharPet( charaindex, petarray); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return BATTLE_ERR_PARAM; + } + } +#endif + switch( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) ){ + int work; + + case CHAR_TYPEPLAYER: + if( pBattle->Side[side].type != BATTLE_S_TYPE_PLAYER ){ + return BATTLE_ERR_TYPE; + } + iEntryFirst = 0; + iEntryMax = BATTLE_PLAYER_MAX; + break; + case CHAR_TYPEENEMY: + if( pBattle->Side[side].type != BATTLE_S_TYPE_ENEMY ){ + return BATTLE_ERR_TYPE; + } + iEntryFirst = 0; + iEntryMax = BATTLE_ENTRY_MAX; + break; + case CHAR_TYPEPET: + if( pBattle->Side[side].type != BATTLE_S_TYPE_PLAYER ){ + return BATTLE_ERR_TYPE; + } + + work = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX ); + pEntry = pBattle->Side[side].Entry; + + work = BATTLE_Index2No( battleindex, work ); + work -= side * SIDE_OFFSET; + work += 5; + iEntryFirst = work; + iEntryMax = work+1; + break; +#ifdef _PLAYER_NPC + case CHAR_TYPEPLAYERNPC: + iEntryFirst = 0; + iEntryMax = BATTLE_ENTRY_MAX; + break; + + case CHAR_TYPEPLAYERPETNPC: + work = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX ); + pEntry = pBattle->Side[side].Entry; + + work = BATTLE_Index2No( battleindex, work ); + work -= side * SIDE_OFFSET; + work += 5; + iEntryFirst = work; + iEntryMax = work+1; + break; +#endif + default: + //print( "(%s)(%d)\n", + //CHAR_getUseName( charaindex ), + //CHAR_getInt( charaindex, CHAR_WHICHTYPE ) ); + return BATTLE_ERR_TYPE; + } + + + pEntry = pBattle->Side[side].Entry; + + for( i = iEntryFirst; i < iEntryMax; i ++ ){ + if( pEntry[i].charaindex == -1 )break; + } + + if( i == iEntryMax ){ + return BATTLE_ERR_ENTRYMAX; + } + + EntryInit( &pEntry[i] ); + + pEntry[i].charaindex = charaindex; + + pEntry[i].bid = i + side * SIDE_OFFSET; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, + battleindex ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_INIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKDBATTLEESCAPE, + 0 ); + // shan 2001/12/27 Begin + { + int fd; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPLAYER ){ + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + CONNECT_SetBattleRecvTime( fd, &NowTime); + } + } + // End + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLESIDE, side ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, 0 ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, -1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, -1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM3, -1 ); + + CHAR_setWorkInt( charaindex, CHAR_WORKMODATTACK, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKMODDEFENCE, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKMODQUICK, 0 ); + + CHAR_setWorkInt( charaindex, CHAR_WORKDAMAGEABSROB, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKDAMAGEREFLEC, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKDAMAGEVANISH, 0 ); + + + CHAR_setWorkInt( charaindex, CHAR_WORKMODCAPTURE, 0 ); + + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + + BATTLE_BadStatusAllClr( charaindex ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEWATCH, 0 ); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + CHAR_setWorkInt( charaindex, CHAR_WORKTRAP, 0 ); // + BATTLE_ProfessionStatus_init( battleindex, charaindex ); +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + CHAR_setWorkInt( charaindex, CHAR_WORKACUPUNCTURE, 0 );//Ƥ +#endif + +#ifdef _PETSKILL_RETRACE + CHAR_setWorkInt( charaindex, CHAR_WORKRETRACE, 0 );//׷ +#endif + +#ifdef _PETSKILL_BECOMEFOX //ĻʱΪ-1 + CHAR_setWorkInt( charaindex, CHAR_WORKFOXROUND, -1 ); +#endif +#ifdef _PROFESSION_ADDSKILL + // + CHAR_setWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY, 0 ); + CHAR_setWorkInt( charaindex, CHAR_DOOMTIME, 0 );//ĩռ + CHAR_setWorkInt( charaindex, CHAR_WORK_com1, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_toNo, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_mode, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_skill_level, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_array, 0 ); +#endif + return 0; +} + +INLINE int _BATTLE_Exit( char *file, int line, int charaindex ,int battleindex) +{ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEREVERSE,0); +#ifdef _NPCENEMY_1 + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEHELP,0); +#endif +#ifdef _WARNPC_CTRL + CHAR_setWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME,0); + CHAR_setWorkInt(charaindex,CHAR_WORKNPCBATTLESAMEIP,0); +#endif +#ifdef _BATTLEEND_FIX + if(getBattleEndMode()==1){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) + != CHAR_PARTY_CLIENT ){ + int myfloor=CHAR_getInt(charaindex,CHAR_FLOOR); + if(myfloor==getBattleFloor(1) || + myfloor==getBattleFloor(2) || + myfloor==getBattleFloor(3) || + myfloor==getBattleFloor(4) || + myfloor==getBattleFloor(5) || + myfloor==1042 || + myfloor==2032 || + myfloor==3032 || + myfloor==4032){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep=mktime(p); + CHAR_setWorkInt(charaindex,CHAR_WORKBALLTELENDTIME,timep); + } + } + } +#endif + BATTLE_ENTRY *pEntry; + int i, j, k; + BATTLE *pBattle; + char szPet[32]; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + return BATTLE_ERR_BATTLEINDEX; + } + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ +#ifdef _ALLBLUES_LUA_1_4 + BattleFinish(battleindex, charaindex); +#endif + } + CHAR_setWorkInt(charaindex,CHAR_WORKPETSKILLBT,0); +//#ifdef _PETSKILL_NONO_FIX +// CHAR_setWorkInt(charaindex,CHAR_WORKLISTPAGE,0); +//#endif +#ifdef _PROFESSION_ADDSKILL + CHAR_setWorkInt( charaindex, CHAR_DOOMTIME, 0 );//ĩռ +#endif +#ifdef _PETSKILL_BECOMEFOX // 뿪սʱĻɵıЧ + //print("\nͼ:%s,%d", CHAR_getChar( charaindex, CHAR_NAME), CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)); + + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //С + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER) ); + CHAR_setWorkInt( charaindex, CHAR_WORKFOXROUND, -1); + //print("\nȥ:%d",CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)); + } +#endif + +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 + && CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BECOMEPIG_BBI ) ); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + } +#endif + +#ifdef _MAP_HEAL +{ + int mymap; + int n; + mymap = CHAR_getInt(charaindex,CHAR_FLOOR); + for(n=0;n<10;n++) + { + if(getMapHeal(n)==-1) break; + if(mymap == getMapHeal(n) && CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) + { + NPC_HealerAllHeal(charaindex); + CHAR_talkToCli( charaindex, -1, "Զָ", CHAR_COLORYELLOW); + } + } + +} +#endif + + +#ifdef _MAGIC_NOCAST // :Ĭ + // WON ADD + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) + lssproto_NC_send( getfdFromCharaIndex( charaindex ), 0);//ԭ +#endif + pBattle = &BattleArray[battleindex]; + if( pBattle->use == FALSE ) + return BATTLE_ERR_NOUSE; + + for( j = 0; j < 2; j ++ ){ + pEntry = pBattle->Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + if( pEntry[i].charaindex != charaindex ) + continue; + pEntry[i].charaindex = -1; + pEntry[i].escape = 0; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_FINAL ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, -1 ); +#ifdef _LOSE_FINCH_ + CHAR_setWorkInt( charaindex, CHAR_WORKSPETRELIFE, 0); +#endif + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + CHAR_endCharOneArray( charaindex ); +#ifdef _PLAYER_NPC + }else if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC + || CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERPETNPC ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, -1 ); +{ + CHAR_setInt( charaindex , CHAR_HP ,CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( charaindex , CHAR_MP ,CHAR_getWorkInt( charaindex, CHAR_WORKMAXMP ) ); + for(i = 0 ; i < CHAR_MAXPETHAVE; i ++) { + int petindex = CHAR_getCharPet( charaindex, i); + if( CHAR_CHECKINDEX( petindex) == FALSE ) continue; + CHAR_setFlg( petindex, CHAR_ISDIE, 0); + CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); + } +} + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + CHAR_setFlg( charaindex, CHAR_ISDIE, FALSE ); + } + BATTLE_BadStatusAllClr( charaindex ); + CHAR_complianceParameter( charaindex ); + CHAR_sendBattleEffect( charaindex, OFF); +#endif + }else if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) != 0){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, -1 ); + CHAR_sendBattleEffect( charaindex, OFF); + } +#endif + int petindex = pEntry[i+5].charaindex; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE + || CHAR_getInt( charaindex, CHAR_HP ) == TRUE ) + { + +#ifdef _FIX_SPEED_UPLEVEL // WON ADD + // Robin cancel + //if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + //}else + { + // Robin cancel + //if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1) != BATTLE_COM_ESCAPE ) + { + unsigned int Dtimes; + unsigned int battletime; + int fd = getfdFromCharaIndex( charaindex ); + Dtimes = BattleArray[battleindex].CreateTime; + battletime = (unsigned int)(BattleArray[battleindex].flgTime/100); + + //if( CHAR_getWorkInt( charaindex, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ){ + //}else + { + CheckDefBTime( charaindex, fd, Dtimes, battletime, 10);//lowTimeӳʱ + } + } + } +#endif + CHAR_setFlg( charaindex, CHAR_ISDIE, 0 ); + CHAR_setInt( charaindex, CHAR_HP, 1 ); + // CoolFish: Faily PK 2001/8/3 + CHAR_setWorkInt(charaindex, CHAR_WORKFMPKFLAG, -1); + + }else { +#ifdef _BATTLE_TIMESPEED + // Robin cancel + //if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1) != BATTLE_COM_ESCAPE ) +#ifdef _OFFLINE_SYSTEM + if( CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE) == 0 ) +#endif + { + unsigned int Dtimes; + unsigned int battletime; + + int fd = getfdFromCharaIndex( charaindex ); + Dtimes = BattleArray[battleindex].CreateTime; + battletime = (unsigned int)(BattleArray[battleindex].flgTime/100); + //if( CHAR_getWorkInt( charaindex, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) { + //}else + { + CheckDefBTime( charaindex, fd, Dtimes, battletime, 0);//lowTimeӳʱ + } + } +#endif + } + if( CHAR_CHECKINDEX( petindex ) == TRUE ){ + pEntry[i+5].charaindex = -1; + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE ); + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEINDEX, -1 ); + } + BATTLE_BadStatusAllClr( charaindex ); + CHAR_complianceParameter( charaindex ); + CHAR_Skillupsend( charaindex ); + // Robin 0730 + if( CHAR_getWorkInt( charaindex, CHAR_WORKPETFALL) ) + { + CHAR_setWorkInt( charaindex, CHAR_WORKPETFALL, 0 ); + CHAR_setInt( charaindex, CHAR_RIDEPET, -2 ); + } + CHAR_send_P_StatusString( charaindex , + CHAR_P_STRING_HP|CHAR_P_STRING_EXP| + CHAR_P_STRING_MP|CHAR_P_STRING_DUELPOINT| + CHAR_P_STRING_CHARM | + CHAR_P_STRING_EARTH | + CHAR_P_STRING_WATER | + CHAR_P_STRING_FIRE | + CHAR_P_STRING_WIND | + CHAR_P_STRING_RIDEPET + ); + // Robin 0730 + if( CHAR_getInt( charaindex, CHAR_RIDEPET ) == -2 ){ + CHAR_setInt( charaindex, CHAR_RIDEPET, -1 ); + } + for( k = 0; k < CHAR_MAXPETHAVE; k ++ ){ + petindex = CHAR_getCharPet( charaindex, k ); + if( CHAR_CHECKINDEX( petindex ) == FALSE )continue; + if( CHAR_getInt( petindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE ) continue; + if( CHAR_getFlg( petindex, CHAR_ISDIE ) == TRUE + || CHAR_getInt( petindex, CHAR_HP ) <= 0 ){ + CHAR_setFlg( petindex, CHAR_ISDIE, 0 ); + CHAR_setInt( petindex, CHAR_HP, 1 ); + } + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE ); +#ifdef _LOSE_FINCH_ + CHAR_setWorkInt( charaindex, CHAR_WORKSPETRELIFE, 0); +#endif +#ifdef _VARY_WOLF + if( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) != CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) ) // Robin fix + { + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER)); + sprintf( szPet, "K%d", k); + CHAR_sendStatusString( charaindex , szPet); + } +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + // + if( CHAR_getWorkInt( petindex, CHAR_WORKOBLIVION ) > 0 ) // Robin fix + { + int pet_no = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + CHAR_setWorkInt( petindex, CHAR_WORKOBLIVION, 0 ); + // + sprintf( szPet, "W%d", pet_no); + CHAR_sendStatusString( charaindex , szPet); + } +#endif + BATTLE_BadStatusAllClr( petindex ); + CHAR_complianceParameter( petindex ); + CHAR_send_K_StatusString( charaindex , k, + CHAR_K_STRING_HP|CHAR_K_STRING_EXP| + CHAR_K_STRING_AI| CHAR_K_STRING_MP | + CHAR_K_STRING_ATK | CHAR_K_STRING_DEF | + CHAR_K_STRING_QUICK | + CHAR_K_STRING_EARTH | + CHAR_K_STRING_WATER | + CHAR_K_STRING_FIRE | + CHAR_K_STRING_WIND + ); + } + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + int flg = 0; + CHAR_setFlg( charaindex, CHAR_ISDUEL, 0); + if( CHAR_getFlg( charaindex, CHAR_ISPARTY)) flg |= CHAR_FS_PARTY; + if( CHAR_getFlg( charaindex, CHAR_ISDUEL)) flg |= CHAR_FS_DUEL; + if( CHAR_getFlg( charaindex, CHAR_ISPARTYCHAT)) flg |= CHAR_FS_PARTYCHAT; + if( CHAR_getFlg( charaindex, CHAR_ISTRADECARD)) flg |= CHAR_FS_TRADECARD; +#ifdef _CHANNEL_MODIFY + if( CHAR_getFlg( charaindex, CHAR_ISTELL)) flg |= CHAR_FS_TELL; + if( CHAR_getFlg( charaindex, CHAR_ISFM)) flg |= CHAR_FS_FM; + if( CHAR_getFlg( charaindex, CHAR_ISOCC)) flg |= CHAR_FS_OCC; + if( CHAR_getFlg( charaindex, CHAR_ISCHAT)) flg |= CHAR_FS_CHAT; + if( CHAR_getFlg( charaindex, CHAR_ISSAVE)) flg |= CHAR_FS_SAVE; + if(getSaType()==95){ + if( CHAR_getFlg( charaindex, CHAR_ISWORLD)) flg |= CHAR_FS_WORLD; + } +#endif + lssproto_FS_send( getfdFromCharaIndex(charaindex), flg); + } + + lssproto_XYD_send( getfdFromCharaIndex(charaindex), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), + CHAR_getInt( charaindex, CHAR_DIR ) ); + } + break; + } + } + CHAR_PartyUpdate( charaindex, CHAR_N_STRING_HP ); + +#ifdef _TIME_TICKET + { + int nowtime = time(NULL); + int tickettime = CHAR_getWorkInt( charaindex, CHAR_WORKTICKETTIME); + int totaltime; + char msg[1024]; + if( tickettime > 0 && tickettime < nowtime ) { + //int floor, x, y; + CHAR_talkToCli( charaindex, -1, "ллˡ", CHAR_COLORYELLOW); + if( CHAR_getWorkInt( charaindex, CHAR_WORKTICKETTIMESTART) > 0 ) { + totaltime = nowtime - CHAR_getWorkInt( charaindex, CHAR_WORKTICKETTIMESTART); + sprintf( msg, "볡ʱ%d%d롣", totaltime/60, totaltime%60); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + } + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIME, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIMESTART, 0); + /*if( CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), &floor, &x, &y ) != TRUE ) { + CHAR_warpToSpecificPoint( charaindex, 1006, 15, 15); + } + else { + CHAR_warpToSpecificPoint( charaindex, floor, x, y); + }*/ + CHAR_warpToSpecificPoint( charaindex, 2006, 20, 17); + } + } +#endif + //51000ͼս󷵻ؼ¼ + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && CHAR_getInt( charaindex, CHAR_FLOOR )==51000){ + int floor = 0, x = 0, y = 0; + CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), &floor, &x, &y ); + CHAR_warpToSpecificPoint( charaindex, floor, x, y); + } + lssproto_XYD_send(getfdFromCharaIndex( charaindex ),CHAR_getInt( charaindex, CHAR_X ),CHAR_getInt( charaindex, CHAR_Y ),CHAR_getInt( charaindex, CHAR_DIR ) ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + CHAR_CheckItemTime(charaindex); + } + return BATTLE_ERR_NONE; +} + + +int BATTLE_PetDefaultExit( + int charaindex, + int battleindex +) +{ + int pno, pindex, iRet; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER) return 0; + pno = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + if( pno < 0 )return 0; + pindex = CHAR_getCharPet( charaindex, pno ); + + iRet = BATTLE_Exit( pindex, battleindex ); + + if( iRet ){ + iRet *= -1; + }else{ + return 1; + } + + return iRet; +} + + +int BATTLE_PetDefaultEntry( + int charaindex, + int battleindex, + int side +) +{ + int pindex; + +#if 1 + int pno; + + int ret = 0; + + pno = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + if( pno == -1 ) return 0; + pindex = CHAR_getCharPet( charaindex, pno ); + + if( CHAR_CHECKINDEX( pindex ) && + + !CHAR_getFlg( pindex, CHAR_ISDIE ) && + CHAR_getInt( pindex, CHAR_HP ) > 0 ) + { + if( BATTLE_NewEntry( pindex, battleindex, side ) ){ + }else{ + ret = 0; + } + } + else { +#ifdef _PLAYER_NPC + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYERNPC) +#endif +// if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYERNPC) + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1 ); + } + + return ret; +#else + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + pindex = CHAR_getCharPet( charaindex, i ); + + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + + if( CHAR_getFlg( pindex, CHAR_ISDIE ) == TRUE )continue; + if( CHAR_getInt( pindex, CHAR_HP ) <= 0 )continue; + + if( BATTLE_NewEntry( pindex, battleindex, side ) ){ + }else{ + CHAR_setInt( charaindex, CHAR_DEFAULTPET, i ); + break; + } + } + + if( i == CHAR_MAXPETHAVE ){ + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1 ); + } + return 0; +#endif +} + +int BATTLE_RescueEntry( int charaindex, int toindex ) +{ + int iRet = 0, battleindex, fd, pindex; + char szBuffer[256]=""; + +#ifdef _BATTLE_TIMESPEED + fd = getfdFromCharaIndex( charaindex); + if( CONNECT_getBDTime( fd) > time( NULL) ) { + return 1; + } +#endif + + battleindex = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEINDEX ); + if( !BATTLE_CHECKINDEX( battleindex) ) return 1; + if( ( fd = getfdFromCharaIndex(charaindex) ) < 0 ) return 1; + + //BUG + int pi; + for( pi = 0; pi < CHAR_PARTYMAX; pi ++ ) { + int index = CHAR_getWorkInt( toindex, pi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + if(index == charaindex) return 1; + } + } +#ifdef _PET_BUG + int petarray = CHAR_getInt( charaindex, CHAR_DEFAULTPET); + if(petarray>-1){ + int petindex = CHAR_getCharPet( charaindex, petarray); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return 1; + } +#endif +#ifdef _WARNPC_CTRL + int mapi; + for(mapi=0;mapi<10;mapi++){ + int floorid = getPartyMap(mapi); + if(floorid==-1) break; + if(CHAR_getInt(charaindex,CHAR_FLOOR)==floorid){ + int sameipnum = getMapSameIp(mapi); + int partyi; + unsigned ip=CONNECT_get_userip(getfdFromCharaIndex(charaindex)); + unsigned teseip = ip; + unsigned toip; + int a, b, c, d,ipcnt=1; + char ipstr[32]; + a=(teseip % 0x100); teseip=teseip / 0x100; + b=(teseip % 0x100); teseip=teseip / 0x100; + c=(teseip % 0x100); teseip=teseip / 0x100; + d=(teseip % 0x100); + sprintf(ipstr,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ipstr,getNoAttIp(0))==0 || strcmp(ipstr,getNoAttIp(1))==0 || strcmp(ipstr,getNoAttIp(2))==0 || strcmp(ipstr,getNoAttIp(3))==0 || strcmp(ipstr,getNoAttIp(4))==0) + break; + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + toip=CONNECT_get_userip(getfdFromCharaIndex(toindex)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "˵ͼĵIPѴޡ", CHAR_COLORYELLOW); + return 1; + } + else + break; + } + break; + }else{ + for( partyi = 0; partyi < CHAR_PARTYMAX; partyi ++ ) { + int index = CHAR_getWorkInt( toindex, partyi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + toip = CONNECT_get_userip(getfdFromCharaIndex(index)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "˵ͼĵIPѴޡ", CHAR_COLORYELLOW); + return 1; + } + } + } + } + } + } + } + if(CHAR_getWorkInt(toindex,CHAR_WORKNPCBATTLESAMEIP)>0){ + int sameipnum = CHAR_getWorkInt(toindex,CHAR_WORKNPCBATTLESAMEIP); + int partyi; + unsigned ip=CONNECT_get_userip(getfdFromCharaIndex(charaindex)); + unsigned teseip = ip; + unsigned toip; + int a, b, c, d,ipcnt=1; + char ipstr[32]; + a=(teseip % 0x100); teseip=teseip / 0x100; + b=(teseip % 0x100); teseip=teseip / 0x100; + c=(teseip % 0x100); teseip=teseip / 0x100; + d=(teseip % 0x100); + sprintf(ipstr,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ipstr,getNoAttIp(0))==0 || strcmp(ipstr,getNoAttIp(1))==0 || strcmp(ipstr,getNoAttIp(2))==0 || strcmp(ipstr,getNoAttIp(3))==0 || strcmp(ipstr,getNoAttIp(4))==0){ + }else{ + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + toip=CONNECT_get_userip(getfdFromCharaIndex(toindex)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "ͬIPѴޣ޷ս", CHAR_COLORYELLOW); + return 1; + } + } + }else{ + for( partyi = 0; partyi < CHAR_PARTYMAX; partyi ++ ) { + int index = CHAR_getWorkInt( toindex, partyi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + toip = CONNECT_get_userip(getfdFromCharaIndex(index)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "ͬIPѴޣ޷ս", CHAR_COLORYELLOW); + return 1; + } + } + } + } + } + } + } +#endif + + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_FINAL + || CHAR_getWorkInt( toindex, CHAR_WORKBATTLEINDEX ) == -1 ){ + iRet = 1; + } + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + iRet = 1; + }else{ + iRet = BATTLE_NewEntry( + charaindex, + battleindex, + CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE ) ); + } + + if( iRet == 0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_RESCUE ); + iRet = BATTLE_PetDefaultEntry( + charaindex, + battleindex, + CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE ) + ); + } + + + + if( iRet == 0 ){ + int flg; + if( CHAR_getInt( charaindex, CHAR_DEFAULTPET ) >= 0 ){ + pindex = CHAR_getCharPet( charaindex, CHAR_getInt( charaindex, CHAR_DEFAULTPET ) ); + CHAR_setWorkInt( pindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_RESCUE ); + } + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)ս", + // CHAR_getUseName( charaindex ) ); + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, BattleArray[battleindex].type, BattleArray[battleindex].field_no ); + } + flg = (BattleArray[battleindex].Side[ + CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE)].flg + & BSIDE_FLG_HELP_OK)? TRUE:FALSE; + lssproto_HL_send( fd, flg); + sprintf( szBuffer, "BP|%X|%X|%X", + BATTLE_Index2No( battleindex, charaindex ), BP_FLG_JOIN, CHAR_getInt(charaindex, CHAR_MP ) ); + BATTLE_CommandSend( charaindex, szBuffer ); + }else{ + snprintf( szBuffer, sizeof( szBuffer ), "޷ս" ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORYELLOW); + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, FALSE, BattleArray[battleindex].field_no ); + } + } + BATTLE_ClearGetExp( charaindex ); + return iRet; +} + +BOOL BATTLE_RescueTry( int charaindex) +{ + int x,y; + OBJECT object; + int pfound = FALSE; + int result = FALSE; + int fd; + int i; + int cnt; + + fd = getfdFromCharaIndex( charaindex); + if( fd == -1 ) return FALSE; +#if 1 // òսظս Robin + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) { + CHAR_talkToCli( charaindex, -1, " ظս! ", CHAR_COLORRED); + //print("\n ķ!!ظս!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + //lssproto_EN_send( fd, FALSE, 0 ); + return FALSE; + } +#endif + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { + lssproto_EN_send( fd, FALSE, 0 ); + return FALSE; + } +#ifdef _BATTLE_TIMESPEED + if( CONNECT_getBDTime( fd) > time( NULL) ) { + return FALSE; + } +#endif +#ifdef _PET_BUG + int petarray = CHAR_getInt( charaindex, CHAR_DEFAULTPET); + if(petarray>-1){ + int petindex = CHAR_getCharPet( charaindex, petarray); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return FALSE; + } +#endif + for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) { + CONNECT_setBattlecharaindex(fd,i,-1); + } + CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , + CHAR_getInt( charaindex , CHAR_X ), + CHAR_getInt( charaindex , CHAR_Y ) , + 1 , &x , &y ); + + cnt = 0; + for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int toindex; + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; + toindex = OBJECT_getIndex( objindex); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER +#ifdef _PLAYER_NPC + && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC +#endif + // && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC + ) continue; + pfound = TRUE; + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + continue; + } + if( BattleArray[ CHAR_getWorkInt( toindex, CHAR_WORKBATTLEINDEX)].type + != BATTLE_TYPE_P_vs_E ){ + continue; + } + if( !(BattleArray[CHAR_getWorkInt( toindex,CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE)].flg + & BSIDE_FLG_HELP_OK)){ + continue; + } + CONNECT_setBattlecharaindex( fd, cnt, toindex ); + cnt++; + if( cnt == CONNECT_WINDOWBUFSIZE ) break; + } + if( cnt == 0 ) { + if( pfound == FALSE ) { + CHAR_talkToCli( charaindex, -1, "ûκˡ", + CHAR_COLORYELLOW); + } + lssproto_EN_send( fd, FALSE, 0 ); + }else if( cnt == 1 ) { + if( BATTLE_RescueEntry( charaindex, + CONNECT_getBattlecharaindex(fd,0) ) ){ + CHAR_talkToCli( charaindex, -1, "޷ս", CHAR_COLORYELLOW); + }else { + result = TRUE; + } + }else if( cnt > 1 ) { + int strlength; + char msgbuf[1024]; + char escapebuf[2048]; + strcpysafe( msgbuf,sizeof(msgbuf), "1\n˭սأ\n"); + strlength = strlen( msgbuf); + for( i = 0; + CONNECT_getBattlecharaindex( fd,i ) != -1 + && i< CONNECT_WINDOWBUFSIZE; i ++ ){ + char *a = CHAR_getChar( CONNECT_getBattlecharaindex(fd,i), CHAR_NAME); + char buf[256]; + snprintf( buf, sizeof( buf),"%s\n", a); + if( strlength + strlen( buf) > arraysizeof( msgbuf)){ + //print( "\nerr:%s:%d ӴѶϢ岻\n", + //__FILE__,__LINE__); + break; + } + strcpy( &msgbuf[strlength], buf); + strlength += strlen(buf); + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SELECTBATTLE, + -1, + makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); + + } + + return result; +} + + + + +BOOL BATTLE_RescueParentTry( int charaindex, int pindex) +{ + int result = FALSE; + if( CHAR_getFlg( charaindex, CHAR_ISDIE)) return FALSE; + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1) != pindex ) return FALSE; + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + return FALSE; + } + if( BATTLE_RescueEntry( charaindex, pindex ) ){ + result = FALSE; + }else{ + result = TRUE; + } + if( result == FALSE ) { + CHAR_talkToCli( charaindex, -1, "޷ս", CHAR_COLORYELLOW); + } + return result; +} + +int BATTLE_PartyNewEntry( + int charaindex, + int battleindex, + int side +) +{ + int iRet = 0, i, work; +#if 1 + + iRet = BATTLE_NewEntry( charaindex, battleindex, side ); + if( iRet )return iRet; + CAflush( charaindex ); + CDflush( charaindex ); + iRet = BATTLE_PetDefaultEntry( charaindex, battleindex, side ); + if( iRet )return iRet; + BATTLE_ClearGetExp( charaindex ); +#endif + + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + work = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( work ) == FALSE )continue; + if( CHAR_getWorkInt( work, CHAR_WORKBATTLEMODE ) != 0 ){ + continue; + } + iRet = BATTLE_NewEntry( work, battleindex, side ); + if( iRet )break; + CAflush( work ); + CDflush( work ); + iRet = BATTLE_PetDefaultEntry( work, battleindex, side ); + if( iRet )return iRet; + BATTLE_ClearGetExp( work ); + } + return iRet; +} + + + + + + + + + + + + + + +#if 1 + +int BATTLE_WatchNewEntry( + int charaindex, + int battleindex, + int side +) +{ + BATTLE_ENTRY *pEntry; + BATTLE *pBattle; + int iEntryFirst = 0, iEntryMax = BATTLE_ENTRY_MAX, i; + + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + + pBattle = &BattleArray[battleindex]; + + if( pBattle->use == FALSE )return BATTLE_ERR_NOUSE; + + if( side < 0 || side > 1 ){ + return BATTLE_ERR_PARAM; + } + + switch( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) ){ + + + case CHAR_TYPEPLAYER: + if( pBattle->Side[side].type != BATTLE_S_TYPE_PLAYER ){ + return BATTLE_ERR_TYPE; + } + iEntryFirst = 0; + iEntryMax = BATTLE_PLAYER_MAX; + break; + default: + //print( "(%s)(%d)\n", + //CHAR_getUseName( charaindex ), + //CHAR_getInt( charaindex, CHAR_WHICHTYPE ) ); + return BATTLE_ERR_TYPE; + } + + + pEntry = pBattle->Side[side].Entry; + + for( i = iEntryFirst; i < iEntryMax; i ++ ){ + if( pEntry[i].charaindex == -1 )break; + } + + if( i == iEntryMax ){ + return BATTLE_ERR_ENTRYMAX; + } + + EntryInit( &pEntry[i] ); + + pEntry[i].charaindex = charaindex; + + pEntry[i].bid = i + side * SIDE_OFFSET; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, + battleindex ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_WATCHINIT ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLESIDE, side ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, 0 ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, -1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, -1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM3, -1 ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEWATCH, 1 ); + + return 0; +} + + +int BATTLE_WatchPartyNewEntry( + int charaindex, + int battleindex, + int side +) +{ + int iRet = 0, i, work; +#if 1 + + iRet = BATTLE_WatchNewEntry( charaindex, battleindex, side ); + if( iRet )return iRet; + + CAflush( charaindex ); + + CDflush( charaindex ); + +#endif + + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + + work = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( work ) == FALSE )continue; + + if( CHAR_getWorkInt( work, CHAR_WORKBATTLEMODE ) != 0 ){ + continue; + } + + iRet = BATTLE_WatchNewEntry( work, battleindex, side ); + + if( iRet )break; + + CAflush( work ); + CDflush( work ); + } + return iRet; + +} + + + + +int BATTLE_CreateForWatcher( int charaindex, int topbattleindex ); + +int BATTLE_WatchEntry( + int charaindex, + int toindex + ) +{ + int iRet = 0, battleindex, fd; + char szBuffer[256]=""; + + battleindex = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEINDEX ); + + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_FINAL + || CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE + || CHAR_getWorkInt( toindex, CHAR_WORKBATTLEINDEX ) == -1 + ){ + iRet = 1; + } + + if( iRet == 0 ){ + iRet = BATTLE_CreateForWatcher( charaindex, battleindex ); + } + if( iRet == 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)ʼս", + // CHAR_getUseName( charaindex ) ); + + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, BattleArray[battleindex].type, BattleArray[battleindex].field_no ); + } + + sprintf( szBuffer, "BP|%X|%X|%X", + 20, BP_FLG_JOIN, CHAR_getInt(charaindex, CHAR_MP ) ); + BATTLE_CommandSend( charaindex, szBuffer ); + + }else{ + snprintf( szBuffer, sizeof( szBuffer ), "޷ս" ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORYELLOW); + + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, FALSE, 0 ); + } + } + + return iRet; +} + + + +BOOL BATTLE_WatchTry( int charaindex ) +{ + int x,y; + OBJECT object; + int pfound = FALSE; + int result = FALSE; + int fd; + int i; + int cnt; + + + fd = getfdFromCharaIndex( charaindex); + if( fd == -1 )return FALSE; + + for( i = 0; i < CONNECT_WINDOWBUFSIZE ; i ++ ) { + CONNECT_setBattlecharaindex( fd,i,-1); + } + CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , + CHAR_getInt( charaindex , CHAR_X ), + CHAR_getInt( charaindex , CHAR_Y ) , + 1 , &x , &y ); + + cnt = 0; + /*м 󡼰ƽҷë */ + for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int toindex; + int objindex = GET_OBJINDEX(object); + /* ƽҷԪئ */ + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; + toindex = OBJECT_getIndex( objindex); + /* Ԫئ */ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER +#ifdef _PLAYER_NPC + && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC +#endif + // && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC + ) continue; + pfound = TRUE; + /* ƥئئݳ */ + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + continue; + } + + CONNECT_setBattlecharaindex( fd,cnt, toindex ); + cnt++; + if( cnt == CONNECT_WINDOWBUFSIZE ) break; + } + if( cnt == 0 ) { + if( pfound == FALSE ) { + CHAR_talkToCli( charaindex, -1, "ûκˡ", + CHAR_COLORYELLOW); + } + // ľئʻ + lssproto_EN_send( fd, FALSE, 0 ); + } + /* ƾئ޼ */ + else if( cnt == 1 ) { + if( BATTLE_WatchEntry( charaindex,CONNECT_getBattlecharaindex(fd,0)) ) + { + result = FALSE; + } else { + result = TRUE; + } + } + /* ūëƻ */ + else if( cnt > 1 ) { + int strlength; + char msgbuf[1024]; + char escapebuf[2048]; + strcpysafe( msgbuf,sizeof(msgbuf), "1\nۿ˭սأ\n"); + strlength = strlen( msgbuf); + /* ū + * ƽҷ¼ + */ + for( i = 0; + CONNECT_getBattlecharaindex( fd,i ) != -1 + && i< CONNECT_WINDOWBUFSIZE; + i ++ ) + { + char *a = CHAR_getChar( CONNECT_getBattlecharaindex(fd,i), + CHAR_NAME); + char buf[256]; + snprintf( buf, sizeof( buf),"%s\n", a); + if( strlength + strlen( buf) > arraysizeof( msgbuf)){ + //print( "\nerr:%s:%d ӴѶϢ岻\n", + //__FILE__,__LINE__); + break; + } + strcpy( &msgbuf[strlength], buf); + strlength += strlen(buf); + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SELECTBATTLEWATCH, + -1, + makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); + } + + return result; +} + + +#endif + + + + + + + +#define MAX_DOUJYOUENEMY 64 +static int DoujyouEnemyTbl[10]; // +/*************************************************************** + * ƹñƽҷ + ***************************************************************/ +int *Doujyou_GetEnemy( int meindex, int charaindex ) +{ + int i; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + int ret; + int insert; + int WorkEnemyTbl[MAX_DOUJYOUENEMY]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + /* */ + for( i = 0; i < arraysizeof(WorkEnemyTbl); i ++ ) { + WorkEnemyTbl[i] = -1; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "enemyno", buf, sizeof( buf)) + == NULL ) + { + return NULL; + } + + insert = 0; + /* ¦ѱ̤лؤ³ë޼ */ + for( i = 0; i < MAX_DOUJYOUENEMY; i ++ ) { + int curEnemy; + char data[128]; + + ret = getStringFromIndexWithDelim( buf,",", i + 1,data, sizeof(data)); + if( ret == FALSE) { + break; + } + + curEnemy = ENEMY_getEnemyArrayFromId( atoi( data)); + if( !ENEMY_CHECKINDEX( curEnemy) ) continue; + WorkEnemyTbl[insert] = curEnemy; + insert ++; + } + // ľئվ޷¡ + if( insert <= 0 )return NULL; + + // ¼ĸةɬ + DoujyouEnemyTbl[0] = WorkEnemyTbl[RAND( 0, insert-1 )]; + + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "enemypetno", buf, sizeof( buf)) + == NULL ) + { + // ئ̤ئ + DoujyouEnemyTbl[1] = -1; + }else{ + insert = 0; + /* ¦ѱ̤лؤ³ë޼ */ + for( i = 0; i < MAX_DOUJYOUENEMY; i ++ ) { + int curEnemy; + char data[128]; + + ret = getStringFromIndexWithDelim( buf,",", i + 1,data, sizeof(data)); + if( ret == FALSE) { + break; + } + + curEnemy = ENEMY_getEnemyArrayFromId( atoi( data)); + if( !ENEMY_CHECKINDEX( curEnemy) ) continue; + WorkEnemyTbl[insert] = curEnemy; + insert ++; + } + // ¼ĸةɬ + DoujyouEnemyTbl[1] = WorkEnemyTbl[RAND( 0, insert-1 )]; + } + + // + DoujyouEnemyTbl[2] = -1; + + return DoujyouEnemyTbl; +} + + + +static int DoujyouWeponTbl[] = { + -1, + ITEM_FIST, + ITEM_AXE, + ITEM_CLUB, + ITEM_SPEAR, + ITEM_BOW, + ITEM_BOOMERANG, + ITEM_BOUNDTHROW, + ITEM_BREAKTHROW, +}; +int DoujyouRandomWeponSet( int charaindex ){ + int wepon = -1, itemindex; + int work = RAND( 0, arraysizeof( DoujyouWeponTbl ) - 1 ); + switch( DoujyouWeponTbl[work] ){ + case ITEM_AXE: wepon = 0;break; + case ITEM_CLUB: wepon = 100;break; + case ITEM_SPEAR: wepon = 200;break; + case ITEM_BOW: wepon = 2498;break; + case ITEM_BOOMERANG:wepon = 500;break; + case ITEM_BOUNDTHROW:wepon = 600;break; + case ITEM_BREAKTHROW:wepon = 700;break; + } + itemindex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( itemindex ) == TRUE ){ + ITEM_endExistItemsOne( itemindex ); + } + + if( wepon >= 0 ){ + itemindex = ITEM_makeItemAndRegist( wepon ) ; + CHAR_setItemIndex( charaindex, CHAR_ARM, itemindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charaindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1 ); + } + switch( DoujyouWeponTbl[work] ){ + case -1: + case ITEM_AXE: + case ITEM_CLUB: + case ITEM_SPEAR: + return 0; + } + return 1; + +} + +static int BattleERSkill1[]={ +3, 10, 11, 12, 30, 31, 40, 41, 50, 51, 52, 60, 61, 80, 90, 110, 120, 150, 210, +303, 309, 315, 321, 503, 504, 506, 507, 541, 542, 543, 544, 545, 546, 547, 575, 579, 580, +606, 613, 615 }; + +static int BattleERSkill2[]={ +12, 13, 20, 41, 52, 152, 210, 306, 312, 318, 324, 325, 500, 501, 502, 505, +508, 541, 542, 543, 544, 545, 546, 547, 576, 580, 594, 606, 613, 616 }; + +void BATTLE_EnemyRandowSetSkill( int enemyindex, int skillType) +{ + int i; + switch( skillType){ + case 1: + for( i=0; i<7; i++){ + int skillarray, skillID, Ri; + Ri = RAND( 0, arraysizeof( BattleERSkill1) - 1 ); + skillID = BattleERSkill1[Ri]; + skillarray = PETSKILL_getPetskillArray( skillID); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ){ + CHAR_setPetSkill( enemyindex, i, 1); + //andy_log + //print("ANDY EnemyRandowSetSkill( ) skillID:%d array:%d err \n", + //skillID, skillarray ); + continue; + } + CHAR_setPetSkill( enemyindex, i, skillID); + } + break; + case 2: + for( i=0; i<7; i++){ + int skillarray, skillID, Ri; + Ri = RAND( 0, arraysizeof( BattleERSkill2) - 1 ); + skillID = BattleERSkill2[Ri]; + skillarray = PETSKILL_getPetskillArray( skillID); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ){ + CHAR_setPetSkill( enemyindex, i, 1); + //andy_log + //print("ANDY *EnemyRandowSetSkill( ) skillID:%d array:%d err \n", + //skillID, skillarray ); + continue; + } + CHAR_setPetSkill( enemyindex, i, skillID); + } + break; + default : return; + break; + } + +} + +int BATTLE_CreateVsEnemyNew( int charaindex, int npcindex, int *table ) +{ + int battleindex, iRet = 0, enemyindex, i, pindex; + int fd, field_no, baselevel = 0; + int skillType=0; + int EnemyList[20]; + + int *enemytable = table; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; +#ifdef _PLAYER_NPC + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) +#endif +// if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) +{ +#ifdef _STREET_VENDOR + // ̯вɽս + if( CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) > -1) return BATTLE_ERR_END; +#endif + +#ifdef _ANGEL_SUMMON // װʹﲻ + if( CHAR_getWorkInt(charaindex,CHAR_WORKANGELMODE) == TRUE ) return BATTLE_ERR_END; +#endif +} + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + battleindex = BATTLE_CreateBattle(charaindex); + if( battleindex < 0 )return BATTLE_ERR_NOTASK; + + if( CHAR_CHECKINDEX( npcindex) ){ + skillType = CHAR_getWorkInt( npcindex, CHAR_NPCWORKINT11); + } + + + field_no = BATTLE_getBattleFieldNo( + CHAR_getInt( charaindex, CHAR_FLOOR ) , + CHAR_getInt( charaindex, CHAR_X ) , + CHAR_getInt( charaindex, CHAR_Y ) ); + if( field_no > BATTLE_MAP_MAX || field_no < 0 ){ + field_no = RAND( 0, BATTLE_MAP_MAX ); + } + + BattleArray[battleindex].Side[0].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].Side[1].type = BATTLE_S_TYPE_ENEMY; + BattleArray[battleindex].leaderindex = charaindex; + BattleArray[battleindex].type = BATTLE_TYPE_P_vs_E; + BattleArray[battleindex].createindex = npcindex; + BattleArray[battleindex].field_no = field_no; + BattleArray[battleindex].BattleFloor = CHAR_getInt( charaindex, CHAR_FLOOR ); + + BattleArray[battleindex].Side[0].flg &= ~BSIDE_FLG_HELP_OK; + + if( CHAR_CHECKINDEX( npcindex) ){ + if(CHAR_getInt( npcindex, CHAR_LV )>1){ + baselevel = CHAR_getInt( npcindex, CHAR_LV ); + } + CHAR_setWorkInt( npcindex, CHAR_WORKBATTLEINDEX, battleindex ); + }else if( npcindex == -1 ){ + enemytable = ENEMY_getEnemy( charaindex, + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + } + + BattleArray[battleindex].norisk = 0; + if( enemytable == NULL ) { + iRet = BATTLE_ERR_NOENEMY; + goto BATTLE_CreateVsEnemy_End; + } + + for( i = 0; *(enemytable+i)!= -1 && i < arraysizeof( EnemyList )-1; i ++ ){ + EnemyList[i] = *(enemytable+i); + } + EnemyList[i] = -1; + +#ifdef _BATTLE_TIMESPEED + fd = getfdFromCharaIndex( charaindex ); + BattleArray[battleindex].CreateTime = time(NULL); + BattleArray[battleindex].flgTime = 200; // 1/100 sec +#endif + for( i = 0; EnemyList[i] != -1; i ++ ){ + int work; + enemyindex = ENEMY_createEnemy( EnemyList[i], baselevel ); + + if( !CHAR_CHECKINDEX( enemyindex ) ){ + iRet = BATTLE_ERR_NOENEMY; + goto BATTLE_CreateVsEnemy_End; + } + CHAR_setInt(enemyindex, CHAR_WHICHTYPE, CHAR_TYPEENEMY); + if( skillType > 0 ){ + //int ENEMY_RandomChange( int enemyindex, int tempno ){ + BATTLE_EnemyRandowSetSkill( enemyindex, skillType); + } +#ifdef _ALLBLUES_LUA_1_9 + SetBattleEnmeyFunction(npcindex, enemyindex, i); +#endif + + if( ( iRet = BATTLE_NewEntry( enemyindex, battleindex, 1 ) ) ){ + goto BATTLE_CreateVsEnemy_End; + } + if( CHAR_getInt( enemyindex, CHAR_DUELPOINT ) > 0 ){ + BattleArray[battleindex].dpbattle = 1; + } + work = CHAR_getInt( enemyindex, CHAR_BASEBASEIMAGENUMBER ); + if( 100466 <= work && work <= 100471 ){ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEFLG, + CHAR_getWorkInt( enemyindex, CHAR_WORKBATTLEFLG ) | CHAR_BATTLEFLG_ABIO ); + //print( "(%s)\n", CHAR_getUseName( enemyindex ) ); + } + } + + if( (iRet = BATTLE_PartyNewEntry( charaindex, battleindex, 0 ) ) ){ + goto BATTLE_CreateVsEnemy_End; + } + { + BATTLE_ENTRY *pEntry, EntryWork; + pEntry = BattleArray[battleindex].Side[1].Entry; + for( i = 0; i < 5; i ++ ){ + EntryWork = pEntry[i]; + pEntry[i] = pEntry[i+5]; + pEntry[i+5] = EntryWork; + pEntry[i].bid = i + SIDE_OFFSET; + pEntry[i+5].bid = i + 5 + SIDE_OFFSET; + } + } + +BATTLE_CreateVsEnemy_End:; + fd = getfdFromCharaIndex( charaindex); + if( iRet ){ + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + if( fd != -1 )lssproto_EN_send( fd, FALSE, field_no ); + }else{ +// if(npcindex > -1){ + if( fd != -1 ){ + if( BattleArray[battleindex].dpbattle ){ + lssproto_EN_send( fd, BATTLE_TYPE_DP_BATTLE, field_no ); + }else{ + lssproto_EN_send( fd, BATTLE_TYPE_BOSS_BATTLE, field_no ); + } + } else { +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) == 0) +#endif + { + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + return iRet; + } + } +// } + + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_FINAL ) continue; + fd = getfdFromCharaIndex(pindex); + + if( fd != -1 ){ + lssproto_EN_send( fd, BATTLE_TYPE_BOSS_BATTLE, field_no ); + } + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1); + } + CHAR_sendBattleEffect( charaindex, ON); + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( pindex, CHAR_WORKACTION, -1); + } + + CHAR_sendBattleEffect( pindex, ON); + } + } + + return iRet; +} + +int BATTLE_CreateVsEnemy( int charaindex, int mode, int npcindex ) +{ + int battleindex, iRet = 0, enemyindex, i, pindex; + int *enemytable = NULL, fd, field_no, baselevel = 0; + int skillType=0; + int EnemyList[20]; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + +#ifdef _STREET_VENDOR + // ̯вɽս + if( CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) > -1) return BATTLE_ERR_END; +#endif + +#ifdef _ANGEL_SUMMON // װʹﲻ + if( CHAR_getWorkInt(charaindex,CHAR_WORKANGELMODE) == TRUE ) return BATTLE_ERR_END; +#endif + +#ifdef _PET_BUG + int petarray = CHAR_getInt( charaindex, CHAR_DEFAULTPET); + if(petarray>-1){ + int petindex = CHAR_getCharPet( charaindex, petarray); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return BATTLE_ERR_END; + } +#endif + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } +#ifdef _BATTLEMAP_CTRL + int j; + for(j=0;j<10;j++){ + if(getBattleTimeFloor(j)==-1) break; + if(CHAR_getInt(charaindex,CHAR_FLOOR)==getBattleTimeFloor(j) && CHAR_getPartyNum(charaindex)<=getBattleTimePlayerNum(j)){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep = mktime(p); + if(timep-CHAR_getWorkInt(charaindex,CHAR_WORKBATTLETIME)<=getBattleTimeSec(j)){ + return BATTLE_ERR_END; + }else{ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLETIME,timep); + break; + } + } + } +#endif + battleindex = BATTLE_CreateBattle( charaindex ); + if( battleindex < 0 )return BATTLE_ERR_NOTASK; +#ifdef _WAN_FIX + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEPROTYPE,1); +#endif + if( CHAR_CHECKINDEX( npcindex) ){ + skillType = CHAR_getWorkInt( npcindex, CHAR_NPCWORKINT11); + } + + field_no = BATTLE_getBattleFieldNo( + CHAR_getInt( charaindex, CHAR_FLOOR ) , + CHAR_getInt( charaindex, CHAR_X ) , + CHAR_getInt( charaindex, CHAR_Y ) ); + if( field_no > BATTLE_MAP_MAX || field_no < 0 ){ + field_no = RAND( 0, BATTLE_MAP_MAX ); + } + + BattleArray[battleindex].Side[0].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].Side[1].type = BATTLE_S_TYPE_ENEMY; + BattleArray[battleindex].leaderindex = charaindex; + BattleArray[battleindex].type = BATTLE_TYPE_P_vs_E; + BattleArray[battleindex].createindex = npcindex; + BattleArray[battleindex].field_no = field_no; + //andy_edit 2002/10/23 + /* + if( (iRet = BATTLE_PartyNewEntry( charaindex, battleindex, 0 ) ) ){ + goto BATTLE_CreateVsEnemy_End; + } + */ + BattleArray[battleindex].Side[0].flg &= ~BSIDE_FLG_HELP_OK; + if( mode == 0 ) { + enemytable = ENEMY_getEnemy( charaindex, + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + }else if( mode == 1 ) { + enemytable = NPC_Util_getEnemy( npcindex, charaindex); + }else if( mode == 2 ) { + enemytable = Doujyou_GetEnemy( npcindex, charaindex ); + baselevel = CHAR_getInt( npcindex, CHAR_LV ); + BattleArray[battleindex].norisk = 1; + } + if( enemytable == NULL ) { + iRet = BATTLE_ERR_NOENEMY; + goto BATTLE_CreateVsEnemy_End; + } + + for( i = 0; *(enemytable+i)!= -1 && i < arraysizeof( EnemyList )-1; i ++ ){ + EnemyList[i] = *(enemytable+i); + } + EnemyList[i] = -1; + +#ifdef _BATTLE_TIMESPEED + fd = getfdFromCharaIndex( charaindex ); + BattleArray[battleindex].CreateTime = time(NULL); + BattleArray[battleindex].flgTime = 200; // 1/100 sec +#endif + for( i = 0; EnemyList[i] != -1; i ++ ){ + int work; + enemyindex = ENEMY_createEnemy( EnemyList[i], baselevel ); + if( skillType > 0 ){ + //int ENEMY_RandomChange( int enemyindex, int tempno ){ + BATTLE_EnemyRandowSetSkill( enemyindex, skillType); + } + if( enemyindex < 0 ){ + iRet = BATTLE_ERR_NOENEMY; + goto BATTLE_CreateVsEnemy_End; + } + + if( mode == 2 ){ + if( i == 0 ){ + CHAR_setInt( enemyindex, CHAR_BASEBASEIMAGENUMBER, + CHAR_getInt( npcindex, CHAR_BASEBASEIMAGENUMBER ) ); + CHAR_setInt( enemyindex, CHAR_BASEIMAGENUMBER, + CHAR_getInt( npcindex, CHAR_BASEBASEIMAGENUMBER ) ); + CHAR_setChar( enemyindex, CHAR_NAME, + CHAR_getChar( npcindex, CHAR_NAME ) ); + CHAR_complianceParameter( enemyindex ); + } + } + if( ( iRet = BATTLE_NewEntry( enemyindex, battleindex, 1 ) ) ){ + goto BATTLE_CreateVsEnemy_End; + } + if( CHAR_getInt( enemyindex, CHAR_DUELPOINT ) > 0 ){ + BattleArray[battleindex].dpbattle = 1; + } + work = CHAR_getInt( enemyindex, CHAR_BASEBASEIMAGENUMBER ); + if( 100466 <= work && work <= 100471 ){ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEFLG, + CHAR_getWorkInt( enemyindex, CHAR_WORKBATTLEFLG ) | CHAR_BATTLEFLG_ABIO ); + //print( "(%s)\n", CHAR_getUseName( enemyindex ) ); + } + } + //andy_edit 2002/10/23 + if( (iRet = BATTLE_PartyNewEntry( charaindex, battleindex, 0 ) ) ){ + goto BATTLE_CreateVsEnemy_End; + } + { + BATTLE_ENTRY *pEntry, EntryWork; + pEntry = BattleArray[battleindex].Side[1].Entry; + for( i = 0; i < 5; i ++ ){ + EntryWork = pEntry[i]; + pEntry[i] = pEntry[i+5]; + pEntry[i+5] = EntryWork; + pEntry[i].bid = i + SIDE_OFFSET; + pEntry[i+5].bid = i + 5 + SIDE_OFFSET; + } + } + +BATTLE_CreateVsEnemy_End:; + fd = getfdFromCharaIndex( charaindex); + + if( iRet ){ + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + if( fd != -1 )lssproto_EN_send( fd, FALSE, field_no ); + }else{ + if( fd != -1 ){ + if( BattleArray[battleindex].dpbattle ){ + lssproto_EN_send( fd, BATTLE_TYPE_DP_BATTLE, field_no ); + }else{ + if( mode == 1 ){ + lssproto_EN_send( fd, BATTLE_TYPE_BOSS_BATTLE, field_no ); + }else{ + lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + } + } + }else { +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) == 0) +#endif + { + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + return iRet; + } + } + + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == + BATTLE_CHARMODE_FINAL ) continue; + fd = getfdFromCharaIndex(pindex); + if( fd != -1 ){ + if( mode == 1 ){ + lssproto_EN_send( fd, BATTLE_TYPE_BOSS_BATTLE, field_no ); + }else{ + lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + } + } + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1); + } + CHAR_sendBattleEffect( charaindex, ON); + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( pindex, CHAR_WORKACTION, -1); + } + CHAR_sendBattleEffect( pindex, ON); + } + } + return iRet; +} + +int BATTLE_CreateVsPlayer( int charaindex0, int charaindex1 ) +{ + int battleindex, pindex, field_no, + i, j, charaindex[2], + parent[2], fd, + iRet = 0; + + if( CHAR_CHECKINDEX( charaindex0 ) == FALSE )return BATTLE_ERR_CHARAINDEX; + if( CHAR_CHECKINDEX( charaindex1 ) == FALSE )return BATTLE_ERR_CHARAINDEX; + + if( CHAR_getWorkInt( charaindex0, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex0, -1, "", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + if( CHAR_getWorkInt( charaindex1, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex0, -1, "", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + +#ifdef _BATTLEEND_FIX + if(getBattleEndMode()==1){ + int myfloor=CHAR_getInt(charaindex0,CHAR_FLOOR); + if(myfloor==getBattleFloor(1) || + myfloor==getBattleFloor(2) || + myfloor==getBattleFloor(3) || + myfloor==getBattleFloor(4) || + myfloor==getBattleFloor(5) || + myfloor==1042 || + myfloor==2032 || + myfloor==3032 || + myfloor==4032) + { + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep = mktime(p); + if(CHAR_getWorkInt(charaindex1,CHAR_WORKBALLTELENDTIME)+120>timep){ + char bmsg[256]; + sprintf(bmsg,"Է㱣Уʣʱ䣺%d룬Էƶ",CHAR_getWorkInt(charaindex1,CHAR_WORKBALLTELENDTIME)+120-timep); + CHAR_talkToCli( charaindex0, -1, bmsg, CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + } + } +#endif +#ifdef _PET_BUG + int petindex; + int petarray0 = CHAR_getInt( charaindex0, CHAR_DEFAULTPET); + int petarray1 = CHAR_getInt( charaindex1, CHAR_DEFAULTPET); + if(petarray0>-1){ + petindex = CHAR_getCharPet( charaindex0, petarray0); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return BATTLE_ERR_END; + } + if(petarray1>-1){ + petindex = CHAR_getCharPet( charaindex1, petarray1); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + return BATTLE_ERR_END; + } +#endif + + field_no = BATTLE_getBattleFieldNo( + CHAR_getInt( charaindex0, CHAR_FLOOR ) , + CHAR_getInt( charaindex0, CHAR_X ), + CHAR_getInt( charaindex0, CHAR_Y ) ); + + int tmpi = RAND(1,10); + if(tmpi<=5){ + charaindex[0] = charaindex1; + charaindex[1] = charaindex0; + }else{ + charaindex[0] = charaindex0; + charaindex[1] = charaindex1; + } + charaindex0 = charaindex[0]; + charaindex1 = charaindex[1]; + //charaindex[0] = charaindex0; + //charaindex[1] = charaindex1; + for( j = 0; j < 2; j ++ ){ + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKBATTLEMODE ) != 0 ){ + return BATTLE_ERR_ALREADYBATTLE; + } + } + for( j = 0; j < 2; j ++ ){ + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + parent[j] = charaindex[j]; + }else + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ){ + parent[j] = CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYINDEX1 ); + }else{ + parent[j] = -1; + } + } + if( parent[0] != -1 && parent[0] == parent[1] ){ + return BATTLE_ERR_SAMEPARTY; + } + battleindex = BATTLE_CreateBattle(charaindex0 ); + if( battleindex < 0 )return BATTLE_ERR_NOTASK; + + if(CHAR_getInt(charaindex0,CHAR_FLOOR)==1042){ + sprintf(afmwar,"%s%d,",afmwar,battleindex); + afmwarnum++; + }else if(CHAR_getInt(charaindex0,CHAR_FLOOR)==2032){ + sprintf(bfmwar,"%s%d,",bfmwar,battleindex); + bfmwarnum++; + }else if(CHAR_getInt(charaindex0,CHAR_FLOOR)==3032){ + sprintf(cfmwar,"%s%d,",cfmwar,battleindex); + cfmwarnum++; + }else if(CHAR_getInt(charaindex0,CHAR_FLOOR)==4032){ + sprintf(dfmwar,"%s%d,",dfmwar,battleindex); + dfmwarnum++; + }else if(CHAR_getInt(charaindex0,CHAR_FLOOR)==20000){ + sprintf(efmwar,"%s%d,",efmwar,battleindex); + efmwarnum++; + }else if(CHAR_getInt(charaindex0,CHAR_FLOOR)==51000){ + sprintf(ffmwar,"%s%d,",ffmwar,battleindex); + ffmwarnum++; + } +#ifdef _WAN_FIX + CHAR_setWorkInt(charaindex0,CHAR_WORKBATTLEPROTYPE,1); + CHAR_setWorkInt(charaindex1,CHAR_WORKBATTLEPROTYPE,1); +#endif + BattleArray[battleindex].Side[0].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].Side[1].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].leaderindex = charaindex0; +#ifdef _AUTO_PK + memset(BattleArray[battleindex].leadercdkey, 0, sizeof(BattleArray[battleindex].leadercdkey)); + memset(BattleArray[battleindex].leadername, 0, sizeof(BattleArray[battleindex].leadername)); + memset(BattleArray[battleindex].rivalcdkey, 0, sizeof(BattleArray[battleindex].rivalcdkey)); + memset(BattleArray[battleindex].rivalname, 0, sizeof(BattleArray[battleindex].rivalname)); + strcpysafe(BattleArray[battleindex].leadercdkey,sizeof(BattleArray[battleindex].leadercdkey),CHAR_getChar(charaindex0,CHAR_CDKEY)); + strcpysafe(BattleArray[battleindex].leadername,sizeof(BattleArray[battleindex].leadername),CHAR_getChar(charaindex0,CHAR_NAME)); + BattleArray[battleindex].rivalindex = charaindex1; + strcpysafe(BattleArray[battleindex].rivalcdkey,sizeof(BattleArray[battleindex].rivalcdkey),CHAR_getChar(charaindex1,CHAR_CDKEY)); + strcpysafe(BattleArray[battleindex].rivalname,sizeof(BattleArray[battleindex].rivalname),CHAR_getChar(charaindex1,CHAR_NAME)); +#endif + BattleArray[battleindex].type = BATTLE_TYPE_P_vs_P; + BattleArray[battleindex].dpbattle = 1; + BattleArray[battleindex].field_no = field_no; +#ifdef _BATTLE_TIMESPEED + BattleArray[battleindex].CreateTime = time(NULL); +#endif + for( j = 0; j < 2; j ++ ){ + iRet = BATTLE_PartyNewEntry( charaindex[j], battleindex, j ); + if( iRet ){ + goto BATTLE_CreateVsPlayer_End; + } + BattleArray[battleindex].Side[j].flg &= ~BSIDE_FLG_HELP_OK; + } +BATTLE_CreateVsPlayer_End:; + if( iRet ){ + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + fd = getfdFromCharaIndex(charaindex[0]); + if( fd != -1 )lssproto_EN_send( fd, FALSE, field_no ); + }else{ + for( j = 0; j < 2; j ++ ){ + fd = getfdFromCharaIndex(charaindex[j]); + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex[j], CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( charaindex[j], CHAR_WORKACTION, -1); + + } + CHAR_sendBattleEffect( charaindex[j], ON); + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex[j], i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == + BATTLE_CHARMODE_FINAL ) continue; + + fd = getfdFromCharaIndex(pindex); + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + if( CHAR_getWorkInt( pindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( pindex, CHAR_WORKACTION, -1); + + } + CHAR_sendBattleEffect( pindex, ON ); + } + } + } + return iRet; +} + + +//********************************************************* +// +// ëܰѣݱɬ +// +int BATTLE_WatchLink( int topbattleindex, int battleindex ) +// +// +//********************************************************* +{ + BATTLE *pWork, *pTop; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + //fprint( "err:battle index (%d)\n", battleindex ); + return FALSE; + } + if( BATTLE_CHECKINDEX( topbattleindex ) == FALSE ){ + //fprint( "err:battle index (%d)\n", topbattleindex ); + return FALSE; + } + + pTop = &BattleArray[topbattleindex]; + + if( BATTLE_CHECKADDRESS( pTop ) == FALSE ){ + //fprint( "err:battle address (%p)\n", pTop ); + return FALSE; + } + + + pWork = pTop->pNext; // ʧ + + if( pWork ){ + if( BATTLE_CHECKADDRESS( pWork ) == FALSE ){ + //fprint( "err:battle address (%p)\n", pWork ); + return FALSE; + } + } + + // ë󡼰ݱ + pTop->pNext = &BattleArray[battleindex]; + // мëɬ + BattleArray[battleindex].pBefore = pTop; + // мëɬ + BattleArray[battleindex].pNext = pWork; + // ݼ󡷴 + if( pWork ){ + pWork->pBefore = &BattleArray[battleindex]; + } + return TRUE; +} + +//********************************************************* +// +// ë繴 +// +int BATTLE_WatchUnLink( int battleindex ) +// +// +//********************************************************* +{ + BATTLE *pTop; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + //fprint( "err:battle index (%d)\n", battleindex ); + return FALSE; + } + + // ë󡼰 + pTop = BattleArray[battleindex].pBefore; + + if( pTop ){ + if( BATTLE_CHECKADDRESS( pTop ) == FALSE ){ + //fprint( "err:battle address (%p)\n", pTop ); + }else{ + // ئئ + pTop->pNext = BattleArray[battleindex].pNext; + } + } + if( BattleArray[battleindex].pNext ){ + if( BATTLE_CHECKADDRESS( BattleArray[battleindex].pNext ) == FALSE ){ + //fprint( "err:battle address (%p)\n", BattleArray[battleindex].pNext ); + }else{ + BattleArray[battleindex].pNext->pBefore = pTop; + } + } + // мëɬ + BattleArray[battleindex].pBefore = NULL; + // мﷴ + BattleArray[battleindex].pNext = NULL; + + return TRUE; + +} + + +//********************************************************* +// +// ñë +// +int BATTLE_CreateForWatcher( int charaindex, int topbattleindex ) +// +// Ի BATTLE_ERR +// +//********************************************************* +{ + int battleindex, field_no , pindex, + i, fd, + iRet = 0; + + // ɷ¶ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_CHARAINDEX; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + + // ƥ ƥئо + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != 0 ){ + return BATTLE_ERR_ALREADYBATTLE; + } + + if(CHAR_getInt(charaindex,CHAR_FLOOR)==20000){ + CHAR_talkToCli( charaindex, -1, "PKУڹս", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + + // ë + battleindex = BATTLE_CreateBattle(charaindex ); + if( battleindex < 0 )return BATTLE_ERR_NOTASK;// έƥئ׾޷¡ +#ifdef _WAN_FIX + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEPROTYPE,1); +#endif + // ռɷƥؤ£ + BattleArray[battleindex].Side[0].type = BATTLE_S_TYPE_PLAYER; + // 𵤴ƥؤ£ + BattleArray[battleindex].Side[1].type = BATTLE_S_TYPE_PLAYER; + // ĸë + BattleArray[battleindex].leaderindex = charaindex; + // + BattleArray[battleindex].type = BATTLE_TYPE_WATCH; + BattleArray[battleindex].mode = BATTLE_MODE_WATCHBC; + // ū į + field_no = BattleArray[battleindex].field_no = BattleArray[topbattleindex].field_no; + BattleArray[battleindex].turn = BattleArray[topbattleindex].turn; + + // ͽ + if( BATTLE_WatchLink( topbattleindex, battleindex ) == FALSE ){ + //fprint( "err:battle link error(%d),(%d)\n", + //topbattleindex, battleindex ); + // ޷¡ ƥ GOTO + goto BATTLE_CreateForWatcher_End; + } + + // ɡ ū޼ + iRet = BATTLE_WatchPartyNewEntry( charaindex, battleindex, 0 ); + if( iRet ){ + // ޷¡ ƥ GOTO + goto BATTLE_CreateForWatcher_End; + } + + +// ޷¡ʲ +BATTLE_CreateForWatcher_End:; + + if( iRet ){ // ޷¡ؤ + // 幻 + BATTLE_ExitAll( battleindex ); + // ʹ + BATTLE_DeleteBattle( battleindex ); + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 )lssproto_EN_send( fd, FALSE, field_no ); + }else{ + fd = getfdFromCharaIndex( charaindex ); + /* ޼ ë */ + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + /* к̡˪ */ + if( CHAR_getWorkInt( charaindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1); + } + /* ʧ CA˪ */ + CHAR_sendBattleWatch( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX ), ON); + + // ޱ + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + // ޼ƥ廯ئئ˪ئ + // FINAL 󡼰 έ + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == + BATTLE_CHARMODE_FINAL ) continue; + + fd = getfdFromCharaIndex(pindex); + /* ޼ */ + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + /* к̡˪ */ + if( CHAR_getWorkInt( pindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( pindex, CHAR_WORKACTION, -1); + } + /* ʧ CA˪ */ + CHAR_sendBattleWatch( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX ), ON); + } +/* + print( "(%s)Ϊо֡", + CHAR_getChar( charaindex, CHAR_NAME ) ); +*/ + } + + + return iRet; +} + + + + + + +/*------------------------------------------------------------ + * ë Ӭ + ------------------------------------------------------------*/ +void BATTLE_WatchStop( int charaindex ) +{ + int battleindex; + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return; + // ƽҷ + BATTLE_Exit( charaindex, battleindex ); + // ɡ ū + CHAR_DischargePartyNoMsg( charaindex ); + + CHAR_talkToCli( charaindex, -1, + "սֹ", CHAR_COLORYELLOW ); + + lssproto_B_send( getfdFromCharaIndex( charaindex ), "BU" ); + +} + + + + + + + + + +//************************************************************* +// +// ƥ Ӽɷ¶ëٴƻ +// +void BATTLE_TurnParam( + int charaindex, + int fixkind, + int mod, + int last +) +// +// +//************************************************************* +{ + int modparam, fixparam, lastparam; + + if( fixkind == -1 ){ + fixparam = 0; // 绥 + }else{ + fixparam = CHAR_getWorkInt( charaindex, fixkind ); + } + if( last == -1 ){ + lastparam = 0; + }else{ + lastparam = CHAR_getWorkInt( charaindex, last ); + } + modparam = CHAR_getWorkInt( charaindex, mod ); + // ƥ ëέ + // ëٴƻ + + // ᷴ MODPARAM ëߡӼƻ + modparam *= 0.8; + CHAR_setWorkInt( charaindex, mod, modparam ); + + // + if( last != -1 ){ + CHAR_setWorkInt( + charaindex, + last, + lastparam + modparam * 0.01 ); + } + +} + +void BATTLE_AttReverse( int charaindex ) +{ + int earth, water, fire, wind; + //ttom start because the second had this + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_REVERSE ){ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEREVERSE,1); + // ƻئݳ + }else{ + // ƻئмƥ + return; + } + //ttom end + earth = CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT ); + water = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT ); + fire = CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT ); + wind = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT ); + + CHAR_setWorkInt( charaindex, CHAR_WORKFIXEARTHAT, fire ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWATERAT, wind ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXFIREAT, earth ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWINDAT, water ); +} + +void BATTLE_PreCommandSeq( int battleindex ) +{ + BATTLE_ENTRY *pEntry; + BATTLE *pBattle; + int i, j, charaindex; + BATTLE_CharSendAll( battleindex ); + BATTLE_CharaBackUp( battleindex ); + BattleArray[battleindex].timer = NowTime.tv_sec; + BATTLE_AllCharaCWaitSet( battleindex ); + BATTLE_ActSettingSend( battleindex ); + BattleArray[battleindex].flg |= BATTLE_FLG_FREEDP; + pBattle = &BattleArray[battleindex]; + for( j = 0; j < 2; j ++ ){ + int flg; + pEntry = pBattle->Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pEntry[i].guardian = -1; + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); +//ttom the second only one //flg &= ~CHAR_BATTLEFLG_GUARDIAN; + flg &= ~CHAR_BATTLEFLG_GUARDIAN; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ) continue; + + CHAR_complianceParameter( charaindex ); + BATTLE_TurnParam( charaindex, + CHAR_WORKFIXSTR, // + CHAR_WORKMODATTACK, + CHAR_WORKATTACKPOWER + ); + BATTLE_TurnParam( charaindex, + CHAR_WORKFIXTOUGH, // + CHAR_WORKMODDEFENCE, + CHAR_WORKDEFENCEPOWER + ); + BATTLE_TurnParam( charaindex, + CHAR_WORKFIXDEX, // ٶƽ + CHAR_WORKMODQUICK, + CHAR_WORKQUICK + ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + BATTLE_TurnParam( charaindex, + -1, + CHAR_WORKMODCHARM, // + CHAR_WORKFIXCHARM + ); + } + BATTLE_TurnParam( charaindex, + -1, // + CHAR_WORKMODCHARM, + -1 + ); + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_REVERSE ){ + BATTLE_AttReverse( charaindex ); + } + } + } +} + + +//************************************************** +// +// Ѩг ݼ ľ +// +void BATTLE_PreWatchWaitSeq( int battleindex ) +// +// +//************************************************** +{ + // ƥݶ + BattleArray[battleindex].timer = NowTime.tv_sec; + // 幻ƹëѨ + BATTLE_AllCharaWatchWaitSet( battleindex ); +} +static int BATTLE_Init( int battleindex ) +{ + //DebugMainFunction="BATTLE_Init"; + BATTLE *pBattle; + int iRet = 0; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + pBattle = &BattleArray[battleindex]; + pBattle->mode = BATTLE_MODE_BATTLE; + iRet = BATTLE_SurpriseCheck( battleindex ); + if( iRet == 0 ){ + }else + if( iRet == 1 ){ + BattleArray[battleindex].Side[1].flg |= BSIDE_FLG_SURPRISE; + }else + if( iRet == 2 ){ + BattleArray[battleindex].Side[0].flg |= BSIDE_FLG_SURPRISE; + } + BATTLE_PreCommandSeq( battleindex ); + return 0; +} +int BATTLE_CountEntry( + int battleindex, + int side +) +{ + int i; + BATTLE_ENTRY *pEntry; + int cnt = 0; + + // ɷ¶ + if( BATTLE_CHECKSIDE( side ) == FALSE )return -BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -BATTLE_ERR_BATTLEINDEX; + + // ޼ + pEntry = BattleArray[battleindex].Side[side].Entry; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + if( pEntry[i].charaindex != -1 ){ // ƽҷ» + cnt ++; + } + } + return cnt; +} + +static BOOL BATTLE_CommandWait( int battleindex, int side) +{ + int i, charaindex, BeOk=0; + BATTLE_ENTRY *pEntry; + BOOL iRet = TRUE; + BOOL TimeOut = FALSE; + if( BATTLE_CHECKSIDE( side ) == FALSE )return TRUE;//ֵǷںϷ Χ + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return TRUE; + if( BattleArray[battleindex].Side[side].type == BATTLE_S_TYPE_ENEMY ) return TRUE; + pEntry = BattleArray[battleindex].Side[side].Entry; + +#ifdef _BATTLECOMMAND_TIME + if( BattleArray[battleindex].PartTime > 1 && + BattleArray[battleindex].PartTime < time(NULL) ){ + TimeOut = TRUE; + } +#endif + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + continue; + } +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) == 1){ + //NPC_OffLineCommand( battleindex, charaindex, side ); + OffLineCommand( battleindex, charaindex, side ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER +#ifdef _PLAYER_NPC + ||CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC +#endif +// ||CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC + ){ + int petnum = CHAR_getInt(charaindex,CHAR_DEFAULTPET); + int petindex = CHAR_getCharPet(charaindex,petnum); + if(CHAR_CHECKINDEX(petindex)){ + //NPC_OffLineCommand( battleindex, petindex, side ); + OffLineCommand( battleindex, petindex, side ); + } + } + } +#endif + switch ( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) ){ + case BATTLE_CHARMODE_C_OK: + BeOk++; + case BATTLE_CHARMODE_INIT: + case BATTLE_CHARMODE_RESCUE: + case BATTLE_CHARMODE_WATCHINIT: + break; + case BATTLE_CHARMODE_C_WAIT: + { +#ifdef _BATTLECOMMAND_TIME + if( TimeOut == TRUE ){ + //andy_log + //print("ANDY TimeOut Exit:%d-[%s|%s]\n", + //charaindex, CHAR_getUseName( charaindex), + //CHAR_getChar( charaindex, CHAR_CDKEY) ); + + CHAR_talkToCli( charaindex, -1, "ʱδָǿ뿪ս", CHAR_COLORYELLOW); + + CHAR_DischargeParty( charaindex, 0);//ɢŶ + CHAR_setWorkInt(charaindex, CHAR_WORKFMPKFLAG, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_COMPELESCAPE ); + BATTLE_Exit( charaindex, battleindex ); + lssproto_B_send( getfdFromCharaIndex( charaindex ), "BU" ); +// CONNECT_setCloseRequest( getfdFromCharaIndex( charaindex) , 1 ); + break; + } +#endif + iRet = FALSE; + } + break; + default : + BATTLE_Exit( charaindex, battleindex ); + break; + } + } + + if( BeOk > 0 ){ +#ifdef _BATTLECOMMAND_TIME + if( BattleArray[ battleindex].PartTime <= 0 ){ + //սһִָ, ӳʱΪ120 + int battletimeout = getBattleTimtOut(); + if(battletimeout == 0) battletimeout = 120; + BattleArray[battleindex].PartTime = (int)time(NULL) + battletimeout; + } +#endif + } + return iRet; +} + + +#ifdef _ITEM_ADDEXP //vincent +#ifdef _ITEM_ADDEQUIPEXP +int BATTLE_GetExp( int charaindex, int midx ) +#else +int BATTLE_GetExp( int charaindex ) +#endif +{ + int addexp,i; + int modexp=0, getexp=0; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return 0; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET) { + int ownerindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + if( CHAR_CHECKINDEX( ownerindex) && CHAR_getInt( ownerindex, CHAR_ADDEXPPOWER) > 0){ + modexp = CHAR_getInt( ownerindex, CHAR_ADDEXPPOWER); + } + }else if(CHAR_getInt(charaindex,CHAR_ADDEXPPOWER) > 0){ + modexp = CHAR_getInt(charaindex,CHAR_ADDEXPPOWER); + } + + getexp = CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP ); +#ifdef _ALLBLUES_LUA_2_0 + int exp = getexp; + if (CHAR_getInt(charaindex,CHAR_LV) == getMaxLevel()){ + FreeCharExpSave(charaindex,exp ); + } +#endif +#ifdef _NEWOPEN_MAXEXP + if( getexp > 1000000000 ) getexp = 1000000000; +#endif +#ifdef _BATTLE_GOLD + int gold=CHAR_getInt( charaindex , CHAR_GOLD ); + if((gold+CHAR_getInt( charaindex , CHAR_LV ) * getBattleGold()) > CHAR_getMaxHaveGold(charaindex)) + gold=CHAR_getMaxHaveGold(charaindex); + else + gold+=CHAR_getInt( charaindex , CHAR_LV ) * getBattleGold(); + CHAR_setInt( charaindex , CHAR_GOLD , gold ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_GOLD); +#endif + if( getexp < 0 || CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV)+1)==-1) getexp = 0; + int itemgetexp = CHAR_getWorkInt(charaindex,CHAR_WORKITEMEXP); + int itemaddexp = 0; + if(itemgetexp<0) itemgetexp = 0; + addexp = getexp+((getexp*modexp)/100); + itemaddexp = itemgetexp+((itemgetexp*modexp)/100); +#ifdef _GET_BATTLE_EXP + addexp*=getBattleexp(); + itemaddexp*=getBattleexp(); +#endif +#ifdef _FM_EXP_ADD + int flag=0; + int manor[]={1041,2031,3031,4031,5031,6031,7031,8031,9031,7531}; + int floor=CHAR_getWorkInt( charaindex, CHAR_WORKFMFLOOR); + for( i = 0 ; i < MANORNUM ; i ++ ){ + if(floor==manor[i]){ + flag=1; + break; + } + } + if(flag==1 && CHAR_getInt( charaindex, CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY){ + addexp += getexp * getFmAddExp()*0.1; + } +#endif +#ifdef _TEAM_ADDEXP + int partynum ; + partynum=CHAR_getPartyNum( charaindex); + if (getTeamAddExp()>0) { + addexp+= getexp*(partynum-1)*getTeamAddExp()*0.1; + } +#endif + +#ifdef _ITEM_ADDEQUIPEXP + if( CHAR_CHECKINDEX( midx ) ){ + for( i = 0 ; i < CHAR_EQUIPPLACENUM ; i ++ ){ + int id = CHAR_getItemIndex(midx,i);//id + if( ITEM_CHECKINDEX(id) ){ + char *arg,*P; + arg = ITEM_getChar(id, ITEM_ARGUMENT );//߲ + if( (P = strstr( arg, "EXPUP" )) ){ + if( (P = strstr( arg, "" )) ){//ֻЧ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + addexp += getexp*atoi(P+=2)*0.01; + itemaddexp += itemgetexp*atoi(P+=2)*0.01; + } + } + else if( (P = strstr( arg, "" )) ){//ֻԳЧ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET + && (CHAR_getInt( midx, CHAR_RIDEPET) != charaindex ) ) + addexp += getexp*atoi(P+=2)*0.01; + } + else if( (P = strstr( arg, "" )) ){//ֻЧ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET + && (CHAR_getInt( midx, CHAR_RIDEPET) == charaindex ) ) + addexp += getexp*atoi(P+=2)*0.01; + } + else{ + P = strstr( arg, "EXPUP" ); + addexp += getexp*atoi(P+=5)*0.01; + } + } + } + } + } +#endif +#ifdef _ITEM_ADDPETEXP + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ) + if( CHAR_getInt( charaindex, CHAR_PETID) == 1163 ) + addexp = 0; + +#endif + addexp = (addexp<0)?0:addexp; + if(itemaddexp>0){ + ITEM_ExpLvBase(charaindex,itemaddexp); + CHAR_setWorkInt(charaindex,CHAR_WORKITEMEXP,0); + } + + + if( CHAR_getInt( charaindex, CHAR_LV) >= CHAR_MAXUPLEVEL ) addexp = 0; +#ifdef _VIP_BATTLE_EXP + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + if(CHAR_getInt( charaindex, CHAR_VIPRIDE) > 0 || CHAR_getInt( charaindex, CHAR_NVIPEXP) > 0){ + addexp = addexp * getVipBattleExp(); + } + } + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){ + if(CHAR_getInt( midx, CHAR_VIPRIDE) > 0 || CHAR_getInt( midx, CHAR_NVIPEXP) > 0){ + addexp = addexp * getVipBattleExp(); + } + } +#else + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER + && CHAR_getInt( charaindex, CHAR_VIPRIDE) > 0) addexp = addexp * 2; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET + && CHAR_getInt( midx, CHAR_VIPRIDE) > 0) addexp = addexp * 2; +#endif + + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, addexp );//شCHAR_WORKGETEXP + + CHAR_AddMaxExp( charaindex, addexp); + + return addexp; +} +#else + +#ifdef _ITEM_ADDEQUIPEXP +int BATTLE_GetExp( int charaindex, int midx ) +#else +int BATTLE_GetExp( int charaindex ) +#endif +{ + int addexp, nowexp; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return 0; + nowexp = CHAR_getInt( charaindex, CHAR_EXP ); + addexp = CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP ); + // shan 11/27 10^9 1224160000 + CHAR_AddMaxExp( charaindex, addexp); + return addexp; +} +#endif + +int BATTLE_DpCalc( int battleindex ) +{ + BATTLE_ENTRY *pLooseEntry, *pWinEntry; + int winside, looseside, i, charaindex, dpadd, dpall, num = 0; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + + winside = BattleArray[battleindex].winside; + looseside = 1 - winside; + if( winside != -1 && winside != 1 )return BATTLE_ERR_PARAM; + + // Ͱ + dpall = 0; + + // ë뵤 + pLooseEntry = BattleArray[battleindex].Side[looseside].Entry; + for( i = 0 ; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pLooseEntry[i].charaindex; + // ½ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + // м + dpadd = CHAR_getInt( charaindex, CHAR_DUELPOINT ) * DUELPOINT_RATE; + // 巴 ëѨ̹ϵɬ + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, + CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP) - dpadd ); + // Ͱң + dpall += dpadd; + } + + // ձ Իü ëң + dpall += BattleArray[battleindex].Side[winside].common_dp; + + pWinEntry = BattleArray[battleindex].Side[winside].Entry; + for( num = 0,i = 0 ; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pWinEntry[i].charaindex; + // ½ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + num++; + } + // ئ⾮ ׻õ岾ئ + if( num <= 0 )return BATTLE_ERR_BATTLEINDEX; + dpadd = dpall / num; + if( dpadd <= 0 )dpadd = 1; // ƥ֨෴ܸ + + for( num = 0,i = 0 ; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pWinEntry[i].charaindex; + // ½ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + + // 巴 ëɬ + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, + CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP) + dpadd ); + } + + return 0; +} + +//#define RS_LIST_MAX 4 // ݱо ˪¾ +#define RS_LIST_MAX 5 +typedef struct{ + int num; + int exp; + int levelup; +}RS_LIST; + +int BATTLE_GetDuelPoint( + int battleindex, // ̼͵ + int side, // + int num // з ƽҷ¾ +) +{ + char szBuffer[1024]=""; + int charaindex; + int dpnow, dpadd, vpmin; + int fd; + int fl = 0, x = 0, y = 0; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( num < 0 || num >= BATTLE_ENTRY_MAX )return BATTLE_ERR_PARAM; + charaindex = BattleArray[battleindex].Side[side].Entry[num].charaindex; + int playfloor = CHAR_getInt(charaindex, CHAR_FLOOR); + if(playfloor==11111)vpmin = getBalltePoint(0)*2; + if(playfloor==22222)vpmin = getBalltePoint(1)*2; + if(playfloor==33333)vpmin = getBalltePoint(2)*2; + if(playfloor==44444)vpmin = getBalltePoint(3)*2; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_PARAM; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + return 0; + } + if( BattleArray[battleindex].Side[side].type != BATTLE_S_TYPE_PLAYER ){ + return 0; + } + dpadd = CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP ); + if( dpadd == 0 ){ + dpadd = 0; // + }else + if( dpadd < 0 ){ + dpadd = min( -1, dpadd ); // ئ֨෴յ + }else{ + dpadd = max( 1, dpadd ); // ئ֨෴յ + } + if(playfloor==11111|| + playfloor==22222|| + playfloor==33333|| + playfloor==44444) + { + int fd = getfdFromCharaIndex( charaindex); + char* id = CHAR_getChar( charaindex, CHAR_CDKEY); + dpnow = sasql_vippoint(id,0,0) + dpadd; //PKԱ + dpnow = max( dpnow, 0 ); //ڻԱ + sasql_vippoint( id, dpadd, 1 ); //дԱ + if(dpnow= BATTLE_ENTRY_MAX )return BATTLE_ERR_PARAM; + charaindex = BattleArray[battleindex].Side[side].Entry[num].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return BATTLE_ERR_PARAM; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + return 0; + } + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ +#ifdef _PLAYER_NPC + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC + || CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERPETNPC){ + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE ){ +#ifdef _ITEM_ADDEQUIPEXP + BATTLE_GetExp( charaindex , charaindex ); +#else + BATTLE_GetExp( charaindex ); +#endif + int UpLevel = CHAR_LevelUpCheck( charaindex , -1); + int i; + for( i = 0; i < UpLevel; i ++ ){ + CHAR_PetLevelUp( charaindex ); + CHAR_PetAddVariableAi( charaindex, AI_FIX_PETLEVELUP ); + } + } + } +#endif + return 0; + } + //CAX +/* if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + return 0; + } + if( BattleArray[battleindex].Side[side].type != BATTLE_S_TYPE_PLAYER ){ + return 0; + }*/ + pEntryChara = &BattleArray[battleindex].Side[side].Entry[num]; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE ){ +#ifdef _ITEM_ADDEQUIPEXP + BATTLE_GetExp( charaindex , charaindex ); +#else + BATTLE_GetExp( charaindex ); +#endif + if( getBattleDebugMsg( ) != 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) õ EXP %d", + CHAR_getUseName( charaindex ), + CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP ) + ); + BATTLE_talkToCli( charaindex, szBuffer, CHAR_COLORYELLOW ); + } + + } + UpLevel = CHAR_LevelUpCheck( charaindex , -1); + if( UpLevel > 0 ){ + aRsList[rsCnt].levelup = 1; + }else{ + aRsList[rsCnt].levelup = 0; + } + aRsList[rsCnt].num = -2; + aRsList[rsCnt].exp = CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP ); + rsCnt ++; + if( UpLevel > 0 ){ + int work; + + if( getBattleDebugMsg( ) != 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) %d", + CHAR_getUseName( charaindex ), + CHAR_getInt( charaindex, CHAR_LV ) + ); + BATTLE_talkToCli( charaindex, szBuffer, CHAR_COLORYELLOW ); + } +#ifdef _SKILLUPPOINT_CF + CHAR_setInt( charaindex, CHAR_SKILLUPPOINT, + CHAR_getInt( charaindex, CHAR_SKILLUPPOINT) + UpLevel*getSkup()); +#else + CHAR_setInt( charaindex, CHAR_SKILLUPPOINT, + CHAR_getInt( charaindex, CHAR_SKILLUPPOINT) + UpLevel*3); +#endif + work = CHAR_getInt( charaindex, CHAR_CHARM ); + work += CH_FIX_PLAYERLEVELUP; + CHAR_setInt( charaindex, CHAR_CHARM, min( 100, work ) ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex , + CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP|CHAR_P_STRING_DUELPOINT + ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX ) ); + CHAR_PartyUpdate( charaindex, CHAR_N_STRING_LV ); +#ifndef _NET_REDUCESEND + CHAR_send_DpDBUpdate_AddressBook( charaindex, TRUE ); +#endif + } + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + petindex = CHAR_getCharPet( charaindex, i ); + if( CHAR_CHECKINDEX( petindex ) == FALSE )continue; + if( CHAR_getFlg( petindex, CHAR_ISDIE ) == TRUE )continue; + if( CHAR_getWorkInt( petindex, CHAR_WORKGETEXP ) <= 0 ){ + CHAR_complianceParameter( petindex ); + sprintf( szBuffer, "K%d", i ); + CHAR_sendStatusString( charaindex , szBuffer ); + + continue; + } +#ifdef _ITEM_ADDEQUIPEXP + BATTLE_GetExp( petindex, charaindex ); +#else + BATTLE_GetExp( petindex ); +#endif + if( getBattleDebugMsg( ) != 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) õ EXP %d", + CHAR_getUseName( petindex ), + CHAR_getWorkInt( petindex, CHAR_WORKGETEXP ) + ); + BATTLE_talkToCli( charaindex, szBuffer, CHAR_COLORYELLOW ); + } + UpLevel = CHAR_LevelUpCheck( petindex , charaindex); + if( UpLevel > 0 ){ + if( getBattleDebugMsg( ) != 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) %d", + CHAR_getUseName( petindex ), + CHAR_getInt( petindex, CHAR_LV ) + ); + BATTLE_talkToCli( charaindex, szBuffer, CHAR_COLORYELLOW ); + } + for( j = 0; j < UpLevel; j ++ ){ + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + } + aRsList[rsCnt].levelup = 1; + }else{ + aRsList[rsCnt].levelup = 0; + } + aRsList[rsCnt].num = i; + aRsList[rsCnt].exp = CHAR_getWorkInt( petindex, CHAR_WORKGETEXP ); + rsCnt ++; + CHAR_complianceParameter( petindex ); + if( UpLevel > 0 ){ + sprintf( szBuffer, "K%d", i ); + CHAR_sendStatusString( charaindex , szBuffer ); + + } + + } + szItemString[0] = 0; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE +#ifdef _OFFLINE_SYSTEM + && CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) == 0 +#endif + ){ + for( i = 0; i < GETITEM_MAX; i ++ ){ + int ItemGet = FALSE; + szEscItemString[0] = 0; + itemindex = pEntryChara->getitem[i]; + if( itemindex < 0 ){ + itemindex = -1; + }else if( CHAR_findEmptyItemBox( charaindex ) >= 0 ){ + int ret = CHAR_addItemSpecificItemIndex(charaindex,itemindex); + if( 0 <= ret && ret < CHAR_EQUIPPLACENUM ){ + //print( "itemget err: ﲻȡitem(%s)(%d)(%s)\n", + //CHAR_getUseName( charaindex ), + //ret, + //ITEM_getAppropriateName(itemindex) + //); + } + if( !CHAR_CHECKITEMINDEX( charaindex, ret) ){ + ItemGet = FALSE; + }else{ + ItemGet = TRUE; + itemgroup[itemnum] = ret; + itemnum ++; + } + } + if( ItemGet == TRUE ){ + if( getBattleDebugMsg( ) != 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "ʰ(%s)", + ITEM_getAppropriateName(itemindex) ); + BATTLE_talkToCli( charaindex, szBuffer, CHAR_COLORYELLOW ); + } + +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +//#endif +// "BattleGet(սõĵ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar(itemindex, ITEM_UNIQUECODE),// shan 2001/12/14 +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + makeEscapeString( ITEM_getAppropriateName(itemindex), + szEscItemString, + sizeof( szEscItemString ) ); + strncat( szItemString, szEscItemString, sizeof( szItemString ) ); + pEntryChara->getitem[i] = -1; + }else{ + if( itemindex >= 0 ){ + ITEM_endExistItemsOne(itemindex); + }else{ + } + pEntryChara->getitem[i] = -1; + } + strncat( szItemString, "|", sizeof( szItemString ) ); + } + } + + szBuffer[0] = 0; + for( i = 0; i < RS_LIST_MAX; i ++ ){ + char szWork[256], sz62[64]; + szWork[0] = 0; + if( aRsList[i].exp > 0 || i == 0 ){ + cnv10to62( aRsList[i].exp, sz62, sizeof( sz62 ) ); + snprintf( szWork, sizeof( szWork ), + "%d|%d|%s", aRsList[i].num, + aRsList[i].levelup, + sz62 + ); + } + strncat( szBuffer, szWork, sizeof( szBuffer ) ); + strncat( szBuffer, ",", sizeof( szBuffer ) ); + } + strncat( szBuffer, szItemString, sizeof( szBuffer ) ); + { + int fd; + fd = getfdFromCharaIndex( charaindex ); + lssproto_RS_send( fd, szBuffer ); + } + return 0; +} + +int BATTLE_GetProfit( int battleindex, int side, int num ) +{ + if( BattleArray[battleindex].dpbattle == 1 ){ + return BATTLE_GetDuelPoint( battleindex, side, num ); + }else{ + return BATTLE_GetExpGold( battleindex, side, num ); + } + +} + +int BATTLE_FinishSet( battleindex ) +{ + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + BattleArray[battleindex].mode = BATTLE_MODE_FINISH; + return 0; +} + +static int BATTLE_Finish( int battleindex ) +{ + //DebugMainFunction="BATTLE_Finish"; + BATTLE *pBattle; + BATTLE_ENTRY *pEntry; + int i,charaindex, j; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( BattleArray[battleindex].winside == -1 + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E + && BattleArray[battleindex].WinFunc != NULL){ + BattleArray[battleindex].WinFunc( battleindex, + BattleArray[battleindex].createindex ); + } +#ifdef _ALLBLUES_LUA + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E ){ + if(CHAR_CHECKINDEX( BattleArray[battleindex].createindex ) == TRUE){ + CHAR_setWorkInt( BattleArray[battleindex].createindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE ); + CHAR_sendBattleEffect( BattleArray[battleindex].createindex, OFF); + if( BattleArray[battleindex].winside == -1){ + RunCharBattleOverEvent( BattleArray[battleindex].createindex, battleindex, 1); + }else{ + RunCharBattleOverEvent( BattleArray[battleindex].createindex, battleindex, 0); + } + } + } +#endif +#ifdef _BATTLE_PK + if(CHAR_getInt( BattleArray[battleindex].battleindex, CHAR_BATTLEPK)==TRUE || + CHAR_getInt( BattleArray[battleindex].leaderindex, CHAR_BATTLEPK)==TRUE){ + int winindex,lostindex; + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P){ + if( BattleArray[battleindex].winside == -1 ){ + winindex=BattleArray[battleindex].leaderindex; + lostindex=BattleArray[battleindex].rivalindex; + }else{ + winindex=BattleArray[battleindex].rivalindex; + lostindex=BattleArray[battleindex].leaderindex; + } + + if(CHAR_CHECKINDEX(lostindex) != FALSE){ + int fl = 0, x = 0, y = 0; + CHAR_getElderPosition(CHAR_getInt(lostindex, CHAR_LASTTALKELDER), &fl, &x, &y); + CHAR_warpToSpecificPoint(lostindex, fl, x, y); + CHAR_DischargeParty( lostindex, 0); + CHAR_setInt( winindex, CHAR_BATTLEPK, FALSE); + CHAR_setInt( lostindex, CHAR_BATTLEPK, FALSE); + } + } + } +#endif + +#ifdef _AUTO_PK + if(AutoPk_PKTimeGet()<=0){ + if(CHAR_getInt(BattleArray[battleindex].rivalindex, CHAR_FLOOR)==20000 && + CHAR_getInt(BattleArray[battleindex].leaderindex, CHAR_FLOOR)==20000){ + + if(BattleArray[battleindex].type != BATTLE_TYPE_WATCH + && BattleArray[battleindex].mode != BATTLE_MODE_WATCHBC + && CHAR_getInt(BattleArray[battleindex].leaderindex, CHAR_AUTOPK) != -1 + && CHAR_getInt(BattleArray[battleindex].rivalindex, CHAR_AUTOPK) != -1){ + int winindex,lostindex; + char wincdkey[CDKEYLEN],winname[CHARNAMELEN]; + char lostcdkey[CDKEYLEN],lostname[CHARNAMELEN]; + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P && BattleArray[battleindex].winside == -1 ){ + winindex=BattleArray[battleindex].leaderindex; + strcpysafe(wincdkey,sizeof(wincdkey),BattleArray[battleindex].leadercdkey); + strcpysafe(winname,sizeof(winname),BattleArray[battleindex].leadername); + lostindex=BattleArray[battleindex].rivalindex; + strcpysafe(lostcdkey,sizeof(lostcdkey),BattleArray[battleindex].rivalcdkey); + strcpysafe(lostname,sizeof(lostname),BattleArray[battleindex].rivalname); + }else{ + winindex=BattleArray[battleindex].rivalindex; + strcpysafe(wincdkey,sizeof(wincdkey),BattleArray[battleindex].rivalcdkey); + strcpysafe(winname,sizeof(winname),BattleArray[battleindex].rivalname); + lostindex=BattleArray[battleindex].leaderindex; + strcpysafe(lostcdkey,sizeof(lostcdkey),BattleArray[battleindex].leadercdkey); + strcpysafe(lostname,sizeof(lostname),BattleArray[battleindex].leadername); + } + int i, fl = 0, x = 0, y = 0, num=0; + int playernum = CHAR_getPlayerMaxNum(); + char token[64],token2[128]; + if(CHAR_CHECKINDEX(lostindex) != FALSE){ + CHAR_getElderPosition(CHAR_getInt(lostindex, CHAR_LASTTALKELDER), &fl, &x, &y); + CHAR_warpToSpecificPoint(lostindex, fl, x, y); + CHAR_DischargeParty( lostindex, 0); + } + if(CHAR_CHECKINDEX(winindex) != FALSE){ + CHAR_setInt(winindex,CHAR_AUTOPK,CHAR_getInt(winindex,CHAR_AUTOPK)+1); + sprintf(token,"[ս]%s սʤ %s ս", winname, lostname); + autopkcnt++; + int autopkvigor = getAutoPkVigorPkNum()*CHAR_getInt(lostindex,CHAR_AUTOPK)+getAutoPkVigorPkCnt()*autopkcnt; + CHAR_setInt(lostindex,CHAR_VIGOR,CHAR_getInt(lostindex,CHAR_VIGOR)+autopkvigor); + sprintf(token2,"[ս]%sɱ %d %d û%d",lostname,CHAR_getInt(lostindex,CHAR_AUTOPK),autopkcnt,autopkvigor); + }else{ + sprintf(token,"[ս]%s %s ", winname, lostname); + autopkcnt++; + int autopkvigor = getAutoPkVigorPkNum()*CHAR_getInt(lostindex,CHAR_AUTOPK)+getAutoPkVigorPkCnt()*autopkcnt; + CHAR_setInt(lostindex,CHAR_VIGOR,CHAR_getInt(lostindex,CHAR_VIGOR)+autopkvigor); + sprintf(token2,"[ս]%sɱ %d %d û%d",lostname,CHAR_getInt(lostindex,CHAR_AUTOPK),autopkcnt,autopkvigor); + } + for(i=0;i= 0 ; i -- ){ +#endif + charaindex = pEntry[i].charaindex; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + continue; +#ifdef _ALLBLUES_LUA_1_9 + BattleFinishFunction(charaindex, BattleArray[battleindex].CreateTime, BattleArray[battleindex].turn, BattleArray[battleindex].type); +#endif + BATTLE_GetProfit( battleindex, j, i ); //ȡþֵ + BATTLE_Exit( charaindex, battleindex ); + } + } + if( BattleArray[battleindex].type == BATTLE_TYPE_WATCH ){ + }else{ + pBattle = BattleArray[battleindex].pNext; + for( ;pBattle; pBattle = pBattle->pNext ){ + if( BATTLE_CHECKADDRESS( pBattle ) == FALSE ){ + //fprint( "err:battle address (%p)\n", pBattle ); + break; + } + for( i = BATTLE_ENTRY_MAX-1; i >= 0 ; i -- ){ + charaindex = pBattle->Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + BATTLE_Exit( charaindex, pBattle->battleindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_FINAL ); + } + } + pBattle = BattleArray[battleindex].pNext; + for( ;pBattle; pBattle = pBattle->pNext ){ + if( BATTLE_CHECKADDRESS( pBattle ) == FALSE ){ + //fprint( "err:battle address (%p)\n", pBattle ); + break; + } + BATTLE_DeleteBattle( pBattle->battleindex ); + } + } + BATTLE_DeleteBattle( battleindex ); + return 0; +} + +int BATTLE_StopSet( battleindex ) +{ + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + BattleArray[battleindex].mode = BATTLE_MODE_STOP; + + return 0; +} + +static int BATTLE_Stop( int battleindex ) +{ + //DebugMainFunction="BATTLE_Stop"; + BATTLE_ENTRY *pEntry; + int i, charaindex, j; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + + for( j = 0; j < 2; j ++ ){ + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = BATTLE_ENTRY_MAX-1; i >= 0 ; i -- ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + continue; + BATTLE_GetProfit( battleindex, j, i ); + BATTLE_Exit( charaindex, battleindex ); + } + } + + BATTLE_DeleteBattle( battleindex ); + return 0; +} + +int BATTLE_DefaultAttacker( int battleindex, int side ) +{ + int i, rnd, cnt; + int CharaTbl[BATTLE_ENTRY_MAX]; + + BATTLE_ENTRY *pEntry; + + pEntry = BattleArray[battleindex].Side[side].Entry; + cnt = 0; + + for( i = 0 ; i < BATTLE_ENTRY_MAX; i ++ ){ + CharaTbl[i] = -1; + if( CHAR_CHECKINDEX( pEntry[i].charaindex ) == FALSE ){ + continue; + } + + if( CHAR_getWorkInt( pEntry[i].charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_RESCUE ){ + continue; + } + + if( BATTLE_TargetCheck( battleindex, i + side * SIDE_OFFSET ) == FALSE )continue; + + CharaTbl[cnt] = i + side * SIDE_OFFSET; + cnt ++; + } + + if( cnt == 0 ){ + return -1; + } + + rnd = RAND( 0, cnt-1 ); + return CharaTbl[rnd]; + +} + +//********************************************************* +// +// ؤϷԻ ëң +// +int BATTLE_AddDpAlive( + int battleindex, // ̼͵ + int side, // ( 0 or 1 ) + int dp +) +// +// ԻϷȻ +// ľئľ +// +//********************************************************* +{ + int i, charaindex; + BATTLE_ENTRY *pEntry; + int cnt = 0; + + // ɷ¶ + if( BATTLE_CHECKSIDE( side ) == FALSE )return -BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -BATTLE_ERR_BATTLEINDEX; + + // ޼ + pEntry = BattleArray[battleindex].Side[side].Entry; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) continue; + // ʸ𼰶ئ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) continue; + // Ϸ廯ʣ۵ң + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, + CHAR_getWorkInt( charaindex, CHAR_WORKGETEXP) + dp ); + } + } + + return cnt; +} + +#if 1 +//********************************************************* +// +// ϷȻ¾Ʃ +// +int BATTLE_CountAlive( + int battleindex, // ̼͵ + int side // ( 0 or 1 ) +) +// +// ԻϷȻ +// ľئľ +// +//********************************************************* +{ + int i, charaindex; + BATTLE_ENTRY *pEntry; + int cnt = 0; + + // ɷ¶ + if( BATTLE_CHECKSIDE( side ) == FALSE )return -BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -BATTLE_ERR_BATTLEINDEX; + + // ޼ + pEntry = BattleArray[battleindex].Side[side].Entry; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) continue; + // ʸ𼰶ئ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) continue; + // Ϸ廯ʣ + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE ){ + cnt ++; + } + } + + return cnt; +} +#endif + + +//********************************************************* +// +// ׻ĻϷ廯ؾë +// +int BATTLE_OnlyRescue( + int battleindex, // ̼͵ + int side, // ( 0 or 1 ) + int *pOnlyFlg +) +// +// ԻϷȻ +// ľئľ +// +//********************************************************* +{ + int i, charaindex; + BATTLE_ENTRY *pEntry; + int cnt = 0, OnlyRescue = 1; + + (*pOnlyFlg) = 0; + + // ɷ¶ + if( BATTLE_CHECKSIDE( side ) == FALSE )return -BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return -BATTLE_ERR_BATTLEINDEX; + + // ޼ + pEntry = BattleArray[battleindex].Side[side].Entry; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ){ + continue; + } + // ʸ𼰶ئ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) continue; + // Ϸ廯ʣ + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == FALSE ){ + cnt ++; + // Ϸ廯֧ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_RESCUE ){ + }else{ + OnlyRescue = 0; + } + } +#ifdef _PETSKILL_LER + if(CHAR_getWorkInt(charaindex,CHAR_WORK_RELIFE) > 0) cnt++; +#endif + } + + // Ϸ廯֧лй + if( cnt > 0 && OnlyRescue ){ + // ׷ºë + (*pOnlyFlg) = 1; + }else{ + // лը߱ + (*pOnlyFlg) = 0; + } + + return cnt; +} + +static BOOL BATTLE_TimeOutCheck( int battleindex ) +{ + int i, j, charaindex; + BATTLE *pBattle; + BATTLE_ENTRY *pEntry; + pBattle = &BattleArray[battleindex]; + + if( NowTime.tv_sec > pBattle->timer + BATTLE_TIME_LIMIT ){ + }else{ + return FALSE; + } + //BATTLE_BroadCast( battleindex, "serverʱѵ", CHAR_COLORYELLOW ); + for( j = 0; j < 2; j ++ ){ + pEntry = pBattle->Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + continue; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_C_WAIT ){ + BATTLE_Exit( charaindex, battleindex ); + CHAR_DischargePartyNoMsg( charaindex ); + CHAR_talkToCli( charaindex, -1, + "ʱ䵽ս", CHAR_COLORYELLOW ); + BATTLE_CommandSend( charaindex, "BU" ); + } + } + } + + return TRUE; +} + +int BATTLE_WatchWait( int battleindex ) +{ + //DebugMainFunction="BATTLE_WatchWait"; + BATTLE *pBattle; + BOOL commandflg = TRUE; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + pBattle = &BattleArray[battleindex]; + if( BATTLE_TimeOutCheck( battleindex ) == TRUE ){ + commandflg = TRUE; + } + if( commandflg == FALSE ){ + return 0; + } + pBattle->mode = BATTLE_MODE_WATCHMOVIE; + pBattle->turn ++; + return 0; +} + +int BATTLE_WatchMovie( int battleindex ) +{ + //DebugMainFunction="BATTLE_WatchMovie"; + return 0; + +} + +int BATTLE_WatchAfter( int battleindex ) +{ + //DebugMainFunction="BATTLE_WatchAfter"; + BattleArray[battleindex].mode = BATTLE_MODE_WATCHPRE; + + return 0; + +} + +int BATTLE_WatchBC( int battleindex ) +{ + //DebugMainFunction="BATTLE_WatchBC"; + return 0; +} + +int BATTLE_WatchPre( int battleindex ) +{ + //DebugMainFunction="BATTLE_WatchPre"; + // Ѩг ݼ ľ + BATTLE_PreWatchWaitSeq( battleindex ); + BattleArray[battleindex].mode = BATTLE_MODE_WATCHWAIT; + return 0; +} + +static int BATTLE_Command( int battleindex ) +{ + //DebugMainFunction="BATTLE_Command"; + BATTLE *pBattle, *pWatchBattle; + BOOL commandflg = TRUE, iFinish = FALSE; + int OnlyRescue[2]={0,0}; + int i, j, charaindex; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + pBattle = &BattleArray[battleindex]; + //DebugMainFunction="BATTLE_Command_1"; + + if( BATTLE_CommandWait( battleindex, 0) == FALSE ){ + commandflg = FALSE; + } + //DebugMainFunction="BATTLE_Command_2"; + if( BATTLE_CommandWait( battleindex, 1) == FALSE ){ + commandflg = FALSE; + } + //DebugMainFunction="BATTLE_Command_3"; + pWatchBattle = pBattle->pNext; + //DebugMainFunction="BATTLE_Command_4"; + for( ; pWatchBattle ; pWatchBattle = pWatchBattle->pNext ){ + if( BATTLE_CHECKADDRESS( pWatchBattle ) == FALSE ){ + //fprint( "err:սbattle address(%p)\n", pWatchBattle ); + break; + } + + if( pWatchBattle->mode == BATTLE_MODE_WATCHBC ){ + + BATTLE_MakeCharaString( battleindex, szAllBattleString, + sizeof(szAllBattleString) ); + BATTLE_BpSendToWatch( pWatchBattle, szAllBattleString ); + + pWatchBattle->mode = BATTLE_MODE_WATCHPRE; + commandflg = FALSE; + + }else if( pWatchBattle->mode != BATTLE_MODE_WATCHMOVIE ){ + commandflg = FALSE; + } + } + //DebugMainFunction="BATTLE_Command_5"; + if( BATTLE_TimeOutCheck( battleindex ) == TRUE ){ + commandflg = TRUE; + } + //DebugMainFunction="BATTLE_Command_6"; + if( commandflg == FALSE ){ + return 0; + } + //DebugMainFunction="BATTLE_Command_7"; +#ifdef _BATTLECOMMAND_TIME + BattleArray[battleindex].PartTime = 0; +#endif + //DebugMainFunction="BATTLE_Command_8"; + + pBattle->turn ++;//Լغ + //DebugMainFunction="BATTLE_Command_9"; + BATTLE_ai_all( battleindex, 0, 0); + //DebugMainFunction="BATTLE_Command_10"; + BATTLE_ai_all( battleindex, 1, 0); + //DebugMainFunction="BATTLE_Command_11"; + BATTLE_Battling( battleindex );//ս + //DebugMainFunction="BATTLE_Command_12"; + pBattle->Side[0].flg &= ~BSIDE_FLG_SURPRISE; + //DebugMainFunction="BATTLE_Command_13"; + pBattle->Side[1].flg &= ~BSIDE_FLG_SURPRISE; + //DebugMainFunction="BATTLE_Command_14"; + if( BATTLE_OnlyRescue( battleindex, 0, &OnlyRescue[0] ) == 0 ){ + pBattle->winside = 1; + iFinish = TRUE; + }else + if( BATTLE_OnlyRescue( battleindex, 1, &OnlyRescue[1] ) == 0 ){ + pBattle->winside = -1; + iFinish = TRUE; + } + //DebugMainFunction="BATTLE_Command_15"; + for( j = 0; j < 2; j ++ ){ + if( OnlyRescue[j] != 1 )continue; + for( i = 0; i < BATTLE_ENTRY_MAX/2; i ++ ){ + charaindex = pBattle->Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + continue; + if( CHAR_getInt( charaindex, CHAR_HP ) <= 0 ){ + BATTLE_Exit( charaindex, battleindex ); + } + } + } + //DebugMainFunction="BATTLE_Command_16"; + BATTLE_PreCommandSeq( battleindex ); + //DebugMainFunction="BATTLE_Command_17"; + if( iFinish == TRUE ){ + BATTLE_FinishSet( battleindex ); + } + //DebugMainFunction="BATTLE_Command_18"; + return 0; +} + +extern void BATTLE_changeRideImage( int index ); + +int BATTLE_Loop( void ) +{ + int i, cnt = 0; + rand(); + for( i = 0; i < BATTLE_battlenum; i ++ ){//ս + if( BattleArray[i].use == FALSE )continue; + if( BattleArray[i].type == BATTLE_TYPE_WATCH ){//ǹսģʽ + if( BATTLE_CountAlive( i, 0 ) == 0 ){ + BATTLE_FinishSet( i ); + } + } + + switch( BattleArray[i].mode ){ + case BATTLE_MODE_NONE://δս + break; + case BATTLE_MODE_INIT://սʼ + BATTLE_Init( i ); + break; + case BATTLE_MODE_BATTLE://Serverڲս + BATTLE_Command( i ); + break; + case BATTLE_MODE_FINISH://ս + BATTLE_Finish( i ); + break; + case BATTLE_MODE_STOP://սж + BATTLE_Stop( i ); + break; + case BATTLE_MODE_WATCHBC://ս... + BATTLE_WatchBC( i ); + break; + + case BATTLE_MODE_WATCHPRE: + BATTLE_WatchPre( i ); + break; + case BATTLE_MODE_WATCHWAIT: + BATTLE_WatchWait( i ); + break; + + case BATTLE_MODE_WATCHMOVIE: + BATTLE_WatchMovie( i ); + break; + + case BATTLE_MODE_WATCHAFTER: + BATTLE_WatchAfter( i ); + break; + } + cnt ++; + } + return cnt; +} + + + + + +typedef struct { + int charaindex; // ƽҷ̼͵ + int side; // + int dex; // ٶƽ + int num; // ޼ į + int combo; // ޾ +#ifdef _EQUIT_SEQUENCE + int sequence; +#endif +}BATTLE_CHARLIST; + + +typedef int (*FUNC)( const void *, const void * ); + +//************************************************************ +// +// ٶƽ ʤ +// +// ٶƽ񷴰 ľ£ϴĩƥؤ£ +// +static int EsCmp( + const BATTLE_CHARLIST *pC1, + const BATTLE_CHARLIST *pC2 +) +{ +//#ifdef _EQUIT_SEQUENCE +// return( (pC2->dex+pC2->sequence) - (pC1->dex+pC1->sequence) ); +//#else + return( pC2->dex - pC1->dex ); +//#endif +} + +#ifdef _EQUIT_SEQUENCE +void Replacement_Entry( BATTLE_CHARLIST *temp1, BATTLE_CHARLIST *temp2) +{ + temp1->charaindex = temp2->charaindex; + temp1->combo = temp2->combo; + temp1->dex = temp2->dex; + temp1->num = temp2->num; + temp1->sequence = temp2->sequence; + temp1->side = temp2->side; +} +#endif +static void EntrySort( BATTLE_CHARLIST *EntryList, int listsize) +{ +#ifdef _EQUIT_SEQUENCE +// int i, j; + qsort( EntryList, listsize, sizeof( BATTLE_CHARLIST ), (FUNC)EsCmp ); +/* + for( i=0; i 0 ){ + int maxcheck, now; + BATTLE_CHARLIST temp; + + maxcheck = EntryList[i].sequence/8; + maxcheck = RAND( 1, maxcheck); + maxcheck = ( maxcheck>=i )?(i/3):maxcheck; + maxcheck = ( maxcheck<0)?0:maxcheck; + now = i; + for( j=0; j0; j++){ + if( EntryList[now].sequence > (EntryList[now-1].sequence *0.9) ){ + + Replacement_Entry( &temp, &EntryList[now]); + Replacement_Entry( &EntryList[now], &EntryList[now-1]); + Replacement_Entry( &EntryList[now-1], &temp); + now = now-1; + + +// temp = &EntryList[now]; +// EntryList[now] = EntryList[now-1]; +// EntryList[now-1] = *temp; +// temp = NULL; + + } + } + } + } +*/ +#else + qsort( EntryList, listsize, sizeof( BATTLE_CHARLIST ), (FUNC)EsCmp ); +#endif +} + + + +//************************************************************ +// +// ٶƽëң£ +// +static int BATTLE_DexCalc( + int charaindex +) +// +// Ի ٶƽ +// +//************************************************************ +{ + int dex = 0; + int work, COM; + int petindex = BATTLE_getRidePet( charaindex ); + + // Ѩ + COM = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + +#ifdef _PETSKILL_BECOMEFOX // ˳еݽ20% + if( CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work *0.8;//20% + } +#endif +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( charaindex, CHAR_WORKFEAR ) > 0 ){ + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work*0.8;//20% + } +#endif + // ɧ + switch( COM ){ +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + case BATTLE_COM_S_BLOOD: // Ѫ + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + case BATTLE_COM_S_SIGN: // һѪ +#endif + +#ifdef _BATTLE_NEWPOWER + case BATTLE_COM_JYUJYUTU: + case BATTLE_COM_S_ATTACK_MAGIC: + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; +#ifdef _DEX_FIX + dex = work - RAND( 0, work * 0.01*getDexFixPer() ); +#else + dex = work - RAND( 0, work * 0.3 ); +#endif + break; +#endif + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + case BATTLE_COM_S_FIRE_ENCLOSE: // + case BATTLE_COM_S_ICE_ENCLOSE: // + case BATTLE_COM_S_THUNDER_ENCLOSE: // ׸ + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( work * 0.3, work * 0.5 ); + break; + case BATTLE_COM_S_VOLCANO_SPRINGS:// ɽȪ + case BATTLE_COM_S_SUMMON_THUNDER: // + case BATTLE_COM_S_ICE_ARROW: // + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( 0, work * 0.2 ); + break; + case BATTLE_COM_S_CURRENT: // + case BATTLE_COM_S_FIRE_BALL:// + case BATTLE_COM_S_ICE_CRACK: // + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( 0, work * 0.5 ); + break; + case BATTLE_COM_S_FIRE_SPEAR:// ǹ + case BATTLE_COM_S_STORM: // + case BATTLE_COM_S_ICE_MIRROR: // + case BATTLE_COM_S_ENCLOSE: // + case BATTLE_COM_S_TRANSPOSE: // λλ + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( work * 0.2, work * 0.5 ); + break; + + case BATTLE_COM_S_DOOM: // ĩ + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( 0.3, work * 0.6 ); + break; +#endif + +#ifdef _SKILL_SPEEDY_ATT //vincent 輼:ٹ + case BATTLE_COM_S_SPEEDYATTACK: + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work + work*0.3;//30% + break; +#endif +#ifdef _PETSKILL_DAMAGETOHP //輼:¿(Ѫı) + case BATTLE_COM_S_DAMAGETOHP2: + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work + work*0.2;//20% + break; +#endif + + case BATTLE_COM_ITEM: // ʧ ةë + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work - RAND( 0, work * 0.3 ) + work * 0.15; + break; + default: // ɧ ئ) + // Robin 0727 ride pet + if( petindex == -1 ) + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + else + work = BATTLE_adjustRidePet3A( charaindex, petindex, CHAR_WORKQUICK, ATTACKSIDE )+20; +#ifdef _DEX_FIX + dex = work - RAND( 0, work * 0.01*getDexFixPer()); +#else + dex = work - RAND( 0, work * 0.3 ); +#endif + break; + } + + // Ѩ̹ϵئȻգ + //if( dex <= 0 )dex = 1; //ٷ + if( dex<=0 ) dex = RAND(1,10); //޸ĺ1-5֮ȡ + return dex; +} + + + + + + +//************************************************************* +// +// ؤ¾ +// +static void ComboCheck( + BATTLE_CHARLIST *pEntryList, + int entrynum +) +// +//************************************************************* +{ + + int i, + charaindex, + com, + enemy, + side, + oldside = -3, // ؤԻئа + oldenemy = -3, // ؤԻئа + armtype, + move, + per, + ComboId = 1, // ʾ + start = -1; + for( i = 0; i < entrynum; i ++ ){ + + charaindex = pEntryList[i].charaindex; + com = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + enemy = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + side = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + armtype = 0; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + per = 20; // ķߡ + }else{ + per = 50; // зߡ + } + + // ߾ ئ + if( CHAR_getInt( charaindex, CHAR_HP ) <= 0 + || BATTLE_CanMoveCheck( charaindex ) == FALSE + ){ + move = 0; + }else{ + move = 1; + } + + // տë ئĸ + // ئĸ + if( BATTLE_IsThrowWepon( + CHAR_getItemIndex( charaindex, CHAR_ARM ) ) == TRUE + ){ + armtype = 1; + } + + pEntryList[i].combo = 0; // + + if( start != -1 ){ // + if( com != BATTLE_COM_ATTACK // Ѩƥئ + || enemy != oldenemy // Ȼ³Ļ Ԫƥئ + || side != oldside // ਵ + || armtype == 1 // ƥؤ + || move == 0 // ئ + ){ + start = -1; // + oldside = side; // + }else{ + // ʾɬ + CHAR_setWorkInt( pEntryList[i].charaindex, + CHAR_WORKBATTLECOM1,BATTLE_COM_COMBO ); + pEntryList[i].combo = ComboId; + // ټɱɬ + CHAR_setWorkInt( pEntryList[start].charaindex, + CHAR_WORKBATTLECOM1,BATTLE_COM_COMBO ); + pEntryList[start].combo = ComboId; + } + } + if( start == -1 ){// ƻئ + if( com == BATTLE_COM_ATTACK + && armtype != 1 // ƥئ + && move == 1 // + && RAND( 1, 100 ) <= per + ){ // ɧ ƥؤ + start = i; + oldenemy = enemy; // Ȼ³ë + oldside = side; // + ComboId ++; + } + } + + } + +} + +//************************************************************* +// +// ƥ¾ +//ݼлʾƥԪئ FALSE +// +static BOOL ComboCheck2( + BATTLE_CHARLIST *pEntryList, // ޼ + int nownum, // ػ + int entrynum // ޼ +) +// +// ʾƥ TRUE +// ƥئ FALSE +// +//************************************************************* +{ + + int i, + iRet = FALSE, + ComboId, + charaindex; + + // ʾ + ComboId = pEntryList[nownum].combo; + + charaindex = pEntryList[nownum].charaindex; + + // лպ ƻ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG) & CHAR_BATTLEFLG_AIBAD ) + { +// print( "ҳ϶Ȳʹñɱʧ( %s )\n",CHAR_getUseName( charaindex ) ); + return FALSE; + } + + // ݼлʾ帨ƥ¾ + for( i = nownum+1; i < entrynum; i ++ ){ + charaindex = pEntryList[i].charaindex; + + // ʾ ਵ + if( ComboId != pEntryList[i].combo )break; + + // 帨ƻئݳ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == 0 ) break; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_FINAL ) break; + + if( CHAR_getInt( charaindex, CHAR_HP ) <= 0 + || BATTLE_CanMoveCheck( charaindex ) == FALSE + ){ + }else{ + iRet = TRUE; + break; + } + } +/* + if( iRet == FALSE ){ + print( "ɱʧ( %s )\n", + CHAR_getUseName( pEntryList[nownum].charaindex ) ); + } +*/ + return iRet; + +} + + +void BATTLE_UltimateExtra( + int battleindex, + int charaindex, + int enemyindex +) +{ + char szBuffer[256]=""; + int pindex, pno; + int floor=0, x=0, y=0; + szBuffer[0] = 0; + + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER +#ifdef _PLAYER_NPC + || CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC +#endif +// || CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC + ){ + BATTLE_PetDefaultExit( enemyindex, battleindex ); + + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + int levelflg = 1; + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)Զ", + // CHAR_getUseName( enemyindex ) ); + if( CHAR_getInt( enemyindex, CHAR_LV ) <= 10 ){ + levelflg = 2; + } + + if( BattleArray[battleindex].norisk == 0 ){; + CHAR_AddCharm( enemyindex, CH_FIX_PLAYEULTIMATE/levelflg ); + pno = CHAR_getInt( enemyindex, CHAR_DEFAULTPET ); + if( 0 <= pno && pno < CHAR_MAXPETHAVE ){ + pindex = CHAR_getCharPet( enemyindex, pno ); + if( CHAR_CHECKINDEX( pindex ) == TRUE ){ + CHAR_PetAddVariableAi( pindex, AI_FIX_PLAYERULTIMATE/levelflg ); + } + } + } + if( CHAR_getElderPosition( + CHAR_getInt( enemyindex, CHAR_LASTTALKELDER), &floor, &x, &y ) + != TRUE + ){ + }else{ + CHAR_warpToSpecificPoint( enemyindex, floor, x, y ); + } + } + BATTLE_Exit( enemyindex, battleindex ); + CHAR_DischargePartyNoMsg( enemyindex ); + if( getBattleDebugMsg( ) != 0 ){ + BATTLE_talkToCli( enemyindex, szBuffer, CHAR_COLORYELLOW ); + } + + }else + // ʸئ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int levelflg = 1; + int playerindex = CHAR_getWorkInt( enemyindex, CHAR_WORKPLAYERINDEX ); + + // ìﻥ Ӽ + if( CHAR_getInt( playerindex, CHAR_LV ) <= 10 ){ + levelflg = 2; + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ɡ", + // CHAR_getUseName( enemyindex ) ); + + // DZмɻշ + CHAR_setInt( playerindex, CHAR_DEFAULTPET, -1 ); + + // ب޻ﶯ½ëƱ + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + // ͼ ᆴؤئ ëƱ + if( BattleArray[battleindex].norisk == 0 ){; + CHAR_PetAddVariableAi( enemyindex, AI_FIX_PETULTIMATE/levelflg ); + } + // DZмʸϷּë + CHAR_setInt( playerindex, CHAR_DEADPETCOUNT, + CHAR_getInt( playerindex, CHAR_DEADPETCOUNT ) + 1 ); + } +/* + // ʸվ ն£ + BATTLE_PetDefaultExit( enemyindex, battleindex ); +*/ + + // + BATTLE_Exit( enemyindex, battleindex ); + + }else{ + int flg; + // ľ½ƥʧ ū + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ɡ", + // CHAR_getUseName( enemyindex ) ); + // ƽҷ·ӡƻ +// BATTLE_Exit( enemyindex, battleindex ); + flg = CHAR_getWorkInt( enemyindex, CHAR_WORKBATTLEFLG ); + flg |= CHAR_BATTLEFLG_ULTIMATE; // ʧ ū + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEFLG, flg ); + BATTLE_Exit( enemyindex, battleindex ); + } + + // ú + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + +} + + +//************************************************************* +// +// ɧٱ忢姽 +// +void BATTLE_NormalDeadExtra( + int battleindex, // ̼͵ + int charaindex, // ڽƽҷ¼̼͵ + int enemyindex // ڽľƽҷ¼̼͵ +) +// +// +//************************************************************* +{ + int pindex, pno; + char szBuffer[256]=""; + + szBuffer[0] = 0; + + // ƥ + // 缰 + // ͼ ئ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E + && BattleArray[battleindex].norisk == 0 + ){ + int levelflg = 1; + // м ëƱ + // ì߶Ʊз зƱ + if( CHAR_getInt( enemyindex, CHAR_LV ) <= 10 ){ + levelflg = 2; + } + CHAR_AddCharm( enemyindex, CH_FIX_PLAYERDEAD/levelflg ); + // 帨ƻʸ ëƱ + pno = CHAR_getInt( enemyindex, CHAR_DEFAULTPET ); + if( 0 <= pno && pno < CHAR_MAXPETHAVE ){ + // ʸ̼͵ + pindex = CHAR_getCharPet( enemyindex, pno ); + if( CHAR_CHECKINDEX( pindex ) == TRUE ){ + CHAR_PetAddVariableAi( pindex, AI_FIX_PLAYERDEAD/levelflg ); + } + } + // Ϸƽҷ¼Ѩ٨ľ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + }else + // ʸئ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E + && BattleArray[battleindex].norisk == 0 + ){ + int levelflg = 1; + int playerindex = CHAR_getWorkInt( enemyindex, CHAR_WORKPLAYERINDEX ); + + // DZмì߶Ʊз зƱ + if( CHAR_getInt( playerindex, CHAR_LV ) <= 10 ){ + levelflg = 2; + } + // мëƱ + CHAR_PetAddVariableAi( enemyindex, AI_FIX_PETDEAD/levelflg ); + // DZмʸϷּë + CHAR_setInt( playerindex, CHAR_DEADPETCOUNT, + CHAR_getInt( playerindex, CHAR_DEADPETCOUNT ) + 1 ); + + // Ϸƽҷ¼Ѩ٨ľ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + + }else{ + // ľ½ + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ʧȥʶ", + // CHAR_getUseName( enemyindex ) ); + + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + +} + +#ifndef DANTAI +void BATTLE_EscapeDpSend( int battleindex, int charaindex ) +{ + + int enemyside, cnt, dpadd; + BATTLE_ENTRY *pEntry; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ){ + return; + } + + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + return; + } + if( BattleArray[battleindex].flg & BATTLE_FLG_FREEDP ){ + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, 0 ); + return ; + } + BattleArray[battleindex].flg |= BATTLE_FLG_CHARALOST; + enemyside = 1 - CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + pEntry = BattleArray[battleindex].Side[enemyside].Entry; + cnt = BATTLE_CountAlive( battleindex, enemyside ); + if( cnt == 0 )return; + int indexfloor = CHAR_getInt( charaindex, CHAR_FLOOR); + if(indexfloor==11111) + { + dpadd = getBalltePoint(0); + } + else if(indexfloor==22222) + { + dpadd = getBalltePoint(1); + } + else if(indexfloor==33333) + { + dpadd = getBalltePoint(2); + } + else if(indexfloor==44444) + { + dpadd = getBalltePoint(3); + } + else + { + dpadd = CHAR_getInt( charaindex, CHAR_DUELPOINT ) * DUELPOINT_RATE; + } + if( dpadd < 1 )dpadd = 1; + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, -dpadd*2 ); + dpadd /= cnt; + if( dpadd < 1 )dpadd = 1; + BATTLE_AddDpAlive( battleindex, enemyside, dpadd ); +} +#else +void BATTLE_EscapeDpSend( int battleindex, int charaindex ) +{ + + int enemyside, dpadd; + BATTLE_ENTRY *pEntry; + + // Nuke 0725: Avoid too large number + if ((battleindex<0)||(battleindex>getBattlenum())) return; + // ½ + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + return; + } + + // + enemyside = 1 - CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + + pEntry = BattleArray[battleindex].Side[enemyside].Entry; + + // 촡ë + dpadd = CHAR_getInt( charaindex, CHAR_DUELPOINT ) * DUELPOINT_RATE; + if( dpadd < 1 )dpadd = 1; // ƥ֨ + + // о¦л + CHAR_setWorkInt( charaindex, CHAR_WORKGETEXP, -dpadd*2 ); + + // 촡巴 + BattleArray[battleindex].Side[enemyside].common_dp += dpadd; + + +} +#endif + + +#ifndef DANTAI +int BATTLE_AddDuelPoint( int battleindex, int *pBidList ) +{ + int enemyindex, i, side, num, j, k, + charaindex[BATTLE_ENTRY_MAX+1]; + BATTLE_ENTRY + *pEntryEnemy; + int allnum = 0; + int bid = pBidList[0]; + + if( pBidList < 0 )return BATTLE_ERR_PARAM; + if( bid >= SIDE_OFFSET ){ + num = bid - SIDE_OFFSET; + side = 1; + }else{ + num = bid ; + side = 0; + } + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( num < 0 || num >= BATTLE_ENTRY_MAX )return BATTLE_ERR_PARAM; + + for( i = 0; i < BATTLE_ENTRY_MAX + 1 ; i ++ ){ + charaindex[i] = -1; + } + + for( i = 0; i < BATTLE_ENTRY_MAX && pBidList[i] != -1 ; i ++ ){ + int work; + work = BATTLE_No2Index( battleindex, pBidList[i] ); + if( work < 0 )return BATTLE_ERR_PARAM; + if( CHAR_getInt( work, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + continue; + } + if( CHAR_getInt( work, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + work = CHAR_getWorkInt( work, CHAR_WORKPLAYERINDEX ); + } + if( work < 0 )return BATTLE_ERR_PARAM; + for( k = 0; k < allnum; k ++ ){ + if( charaindex[i] == work )break; + } + if( i < allnum )continue; + charaindex[i] = work; + allnum ++; + } + charaindex[i] = -1; + + for( j = 0; j < 2; j ++ ){ + pEntryEnemy = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + int enemytype = 0; + enemyindex = pEntryEnemy[i].charaindex; + if( CHAR_CHECKINDEX( enemyindex ) == FALSE )continue; + if( CHAR_getInt( enemyindex, CHAR_HP ) <= 0 + && CHAR_getFlg( enemyindex, CHAR_ISDIE ) == FALSE){ + }else{ + continue; + } + enemytype = CHAR_getInt( enemyindex, CHAR_WHICHTYPE ); + if( enemytype == CHAR_TYPEPLAYER ){ + BattleArray[battleindex].flg |= BATTLE_FLG_CHARALOST; + } + if( enemytype == CHAR_TYPEPLAYER || enemytype == CHAR_TYPEENEMY ){ + int dpadd, dpnow; + int indexfloor = CHAR_getInt(enemyindex,CHAR_FLOOR); + if(indexfloor == 11111)dpadd = getBalltePoint(0); + if(indexfloor == 22222)dpadd = getBalltePoint(1); + if(indexfloor == 33333)dpadd = getBalltePoint(2); + if(indexfloor == 44444)dpadd = getBalltePoint(3); + if(indexfloor==11111|| + indexfloor==22222|| + indexfloor==33333|| + indexfloor==44444) //жڵͼ + { +// dpnow = CHAR_getWorkInt( enemyindex, CHAR_WORKVIPPOINT ); +// dpnow -= dpadd; +// CHAR_setWorkInt( enemyindex, CHAR_WORKGETEXP, +// CHAR_getWorkInt( enemyindex, CHAR_WORKGETEXP) - dpadd ); + } + else + { + dpnow = CHAR_getInt( enemyindex, CHAR_DUELPOINT ); + dpadd = dpnow * DUELPOINT_RATE; + dpnow -= dpadd; + CHAR_setWorkInt( enemyindex, CHAR_WORKGETEXP, + CHAR_getWorkInt( enemyindex, CHAR_WORKGETEXP) - dpadd ); + } + if( side != j ){ + for( k = 0; charaindex[k] != -1; k ++ ); + if( k <= 0 )k = 1; + dpadd /= k; + if( dpadd <= 0 ) dpadd = 1; + for( k = 0; charaindex[k] != -1; k ++ ){ + CHAR_setWorkInt( charaindex[k], CHAR_WORKGETEXP, + CHAR_getWorkInt( charaindex[k], CHAR_WORKGETEXP ) + dpadd ); + } + }else{ + int dpdiv = dpadd, alive; + alive = BATTLE_CountAlive( battleindex, 1-j ); + if( alive <= 0 )alive = 1; + dpdiv /= alive; + if( dpdiv <= 0 )dpdiv = 1; + BATTLE_AddDpAlive( battleindex, 1-j, dpdiv ); + } + } + CHAR_setFlg( enemyindex, CHAR_ISDIE, 1 ); + CHAR_setInt( enemyindex, CHAR_DEADCOUNT, + CHAR_getInt( enemyindex, CHAR_DEADCOUNT ) + 1 ); + + if( pEntryEnemy[i].flg & BENT_FLG_ULTIMATE ){ + BATTLE_GetProfit( battleindex, j, i ); + BATTLE_UltimateExtra( battleindex, charaindex[0], enemyindex ); + }else{ + BATTLE_NormalDeadExtra( battleindex, charaindex[0], enemyindex ); + } + } + } + return 0; +} +#else + +int BATTLE_AddDuelPoint( + int battleindex, + int *pBidList ) +{ + int enemyindex, i, otherside, j, + charaindex[BATTLE_ENTRY_MAX+1]; + BATTLE_ENTRY + *pEntryEnemy; + if( pBidList < 0 )return BATTLE_ERR_PARAM; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + for( j = 0; j < 2; j ++ ){ + pEntryEnemy = BattleArray[battleindex].Side[j].Entry; + otherside = 1 - j; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + enemyindex = pEntryEnemy[i].charaindex; + if( CHAR_CHECKINDEX( enemyindex ) == FALSE )continue; + if( CHAR_getInt( enemyindex, CHAR_HP ) <= 0 + && CHAR_getFlg( enemyindex, CHAR_ISDIE ) == FALSE){ + }else{ + continue; + } + + CHAR_setFlg( enemyindex, CHAR_ISDIE, 1 ); + CHAR_setInt( enemyindex, CHAR_DEADCOUNT, + CHAR_getInt( enemyindex, CHAR_DEADCOUNT ) + 1 ); + if( pEntryEnemy[i].flg & BENT_FLG_ULTIMATE ){ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int dpadd, dpnow; + dpnow = CHAR_getInt( enemyindex, CHAR_DUELPOINT ); + dpadd = dpnow * DUELPOINT_RATE; // м + dpnow -= dpadd; + CHAR_setWorkInt( enemyindex, CHAR_WORKGETEXP, + CHAR_getWorkInt( enemyindex, CHAR_WORKGETEXP) - dpadd ); + BattleArray[battleindex].Side[otherside].common_dp += dpadd; + BATTLE_GetProfit( battleindex, j, i ); + } + BATTLE_UltimateExtra( battleindex, charaindex[0], enemyindex ); + }else{ + BATTLE_NormalDeadExtra( battleindex, charaindex[0], enemyindex ); + } + } + } + return 0; +} +#endif + +int BATTLE_ItemDelCheck( int itemindex ) +{ int icnt, jcnt, playernum; + playernum = getFdnum(); + for( icnt = 0; icnt < playernum; icnt ++ ) { + if( CHAR_CHECKINDEX( icnt ) ) { + for( jcnt = 0; jcnt < CHAR_MAXITEMHAVE; jcnt ++ ) { + if( CHAR_getItemIndex( icnt, jcnt ) == itemindex ) { + //print( "err:սƷֵitem(%s)(%s)index(%d)\n", + // CHAR_getUseName(icnt),ITEM_getAppropriateName(itemindex), + // itemindex ); + return FALSE; + } + } + } + } + return TRUE; +} + +int BATTLE_AddExpItem( int battleindex, int *pBidList ) +{ + int enemyindex, i, side, num, proflg = 1, j, exp, k, enemylevel, + charaindex[BATTLE_ENTRY_MAX+1]; + BATTLE_ENTRY + *pEntryEnemy, + *pEntryChara[BATTLE_ENTRY_MAX+1], + *pEntryPlayer[BATTLE_ENTRY_MAX+1]; + int item=0,itemindex,itemloop,allnum = 0; + int bid = pBidList[0]; + if( pBidList[0] < 0 )return BATTLE_ERR_PARAM; + if( bid >= SIDE_OFFSET ){ + num = bid - SIDE_OFFSET; + side = 1; + }else{ + num = bid ; + side = 0; + } + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( num < 0 || num >= BATTLE_ENTRY_MAX )return BATTLE_ERR_PARAM; + for( i = 0; i < BATTLE_ENTRY_MAX + 1 ; i ++ ){ + charaindex[i] = -1; + pEntryPlayer[i] = NULL; + } + if( BattleArray[battleindex].Side[side].type != BATTLE_S_TYPE_PLAYER + || BattleArray[battleindex].Side[1-side].type == BATTLE_S_TYPE_PLAYER){ + proflg = 0; + } +#ifdef _SHARE_EXP //ŶӾ鹲 + if(getExpShare()==1){ + for( i = 0; i < BATTLE_ENTRY_MAX ; i ++ ){ + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E ){ + charaindex[i] = BATTLE_No2Index( battleindex, i); + //if( charaindex[i] < 0 )return BATTLE_ERR_PARAM; + pEntryChara[i] = &BattleArray[battleindex].Side[side].Entry[i]; + pEntryPlayer[i] = pEntryChara[i]; + } + } + }else{ + for( i = 0; i < BATTLE_ENTRY_MAX && pBidList[i] != -1 ; i ++ ) + { + int subnum; + charaindex[i] = BATTLE_No2Index( battleindex, pBidList[i] ); + if( charaindex[i] < 0 )return BATTLE_ERR_PARAM; + subnum = pBidList[i]-side*SIDE_OFFSET; + pEntryChara[i] = &BattleArray[battleindex].Side[side].Entry[subnum]; + if( CHAR_getInt( charaindex[i], CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + pEntryPlayer[i] = &BattleArray[battleindex].Side[side].Entry[subnum-5]; + }else{ + pEntryPlayer[i] = pEntryChara[i]; + } + } + } + +#else + for( i = 0; i < BATTLE_ENTRY_MAX && pBidList[i] != -1 ; i ++ ) + { + int subnum; + charaindex[i] = BATTLE_No2Index( battleindex, pBidList[i] ); + if( charaindex[i] < 0 )return BATTLE_ERR_PARAM; + subnum = pBidList[i]-side*SIDE_OFFSET; + pEntryChara[i] = &BattleArray[battleindex].Side[side].Entry[subnum]; + if( CHAR_getInt( charaindex[i], CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + pEntryPlayer[i] = &BattleArray[battleindex].Side[side].Entry[subnum-5]; + }else{ + pEntryPlayer[i] = pEntryChara[i]; + } + } +#endif + charaindex[i] = -1; + allnum = i; + for( j = 0; j < 2; j ++ ){ + pEntryEnemy = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + enemyindex = pEntryEnemy[i].charaindex; + if( CHAR_CHECKINDEX( enemyindex ) == FALSE )continue; + + if( CHAR_getInt( enemyindex, CHAR_HP ) <= 0 + && CHAR_getFlg( enemyindex, CHAR_ISDIE ) == FALSE ){ + }else{ + continue; + } + if( proflg == 1 && side != j ){ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE ) != CHAR_TYPEENEMY ){ + //print( "\nerr: ȡսƷ(%s:%d)\n", + // __FILE__, __LINE__ ); + } + for(item=CHAR_STARTITEMARRAY; item < CHAR_STARTITEMARRAY+10; item++){ + itemindex = CHAR_getItemIndex( enemyindex, item ); + if(ITEM_CHECKINDEX( itemindex ) == FALSE ){ + continue; + } + if( ITEM_getWorkInt( itemindex, ITEM_WORKCHARAINDEX ) <= getFdnum() ){ + //print( "\nerr: ҵitemսƷ(%s:%d)\n", + // __FILE__, __LINE__ ); + continue; + } + CHAR_setItemIndex( enemyindex, item, -1 ); + k = RAND( 0, (allnum-1) ); + for(itemloop=0;itemloop<3;itemloop++){ + if(pEntryPlayer[k]->getitem[itemloop]==-1){ + pEntryPlayer[k]->getitem[itemloop]=itemindex; + break; + } + } + if( itemloop >= 3 ){ + if( RAND( 0, 1 ) ) { + int olditem; + int randwork = RAND( 0, 2 ); + olditem = pEntryPlayer[k]->getitem[randwork]; + pEntryPlayer[k]->getitem[randwork]=itemindex; + if( BATTLE_ItemDelCheck( olditem ) == TRUE ){ + ITEM_endExistItemsOne(olditem); + } + }else { + ITEM_endExistItemsOne(itemindex); + } + } + + } + +#define EXPGET_MAXLEVEL 5 +#define EXPGET_DIV 15 + exp = CHAR_getInt( enemyindex, CHAR_EXP ); + enemylevel = CHAR_getInt( enemyindex, CHAR_LV ); +#ifdef _SHARE_EXP + for( k = 0; k<10; k ++ ){ + if(charaindex[k]==-1) continue; +#else + for( k = 0; charaindex[k] != -1; k ++ ){ +#endif + int nowexp, b_level; + int ridepet; + b_level = CHAR_getInt( charaindex[k], CHAR_LV ) - enemylevel; + if( b_level <= EXPGET_MAXLEVEL ){// 5 + nowexp = exp; + }else{//춹5 + b_level = EXPGET_MAXLEVEL+EXPGET_DIV - b_level; + if( b_level > EXPGET_DIV ) b_level = EXPGET_DIV; + if( b_level <= 0 ){ + nowexp = 1; + }else{ + nowexp = exp * b_level / EXPGET_DIV; + } + if( nowexp < 1 ) nowexp = 1; + } + CHAR_setWorkInt( charaindex[k], CHAR_WORKGETEXP, + CHAR_getWorkInt( charaindex[k], CHAR_WORKGETEXP ) + nowexp ); + CHAR_setInt( charaindex[k], CHAR_KILLPETCOUNT, + CHAR_getInt( charaindex[k], CHAR_KILLPETCOUNT ) + 1 ); + if( CHAR_getInt( charaindex[k], CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && CHAR_getInt( charaindex[k], CHAR_LV) >= 140 ){ + int toitemindex = -1; + toitemindex = CHAR_getItemIndex( charaindex[k], 9); + if(ITEM_CHECKINDEX(toitemindex)){ + if( strlen(ITEM_getChar( toitemindex, ITEM_USEFUNC))>0 && strcmp(ITEM_getChar( toitemindex, ITEM_USEFUNC),"ITEM_useExpLv")==0 ){ + char* itemarg = ITEM_getChar(toitemindex,ITEM_ARGUMENT); + char buftest[128]; + int itemlv = 0; + if(getStringFromIndexWithDelim(itemarg,"|", 1, buftest, sizeof(buftest)) == TRUE){ + itemlv = atoi(buftest); + b_level = itemlv - enemylevel; + if( b_level <= EXPGET_MAXLEVEL ){// 5 + nowexp = exp; + }else{//춹5 + b_level = EXPGET_MAXLEVEL+EXPGET_DIV - b_level; + if( b_level > EXPGET_DIV ) b_level = EXPGET_DIV; + if( b_level <= 0 ){ + nowexp = 1; + }else{ + nowexp = exp * b_level / EXPGET_DIV; + } + if( nowexp < 1 ) nowexp = 1; + } + CHAR_setWorkInt(charaindex[k],CHAR_WORKITEMEXP,CHAR_getWorkInt(charaindex[k],CHAR_WORKITEMEXP)+nowexp); + } + } + } + } + ridepet = BATTLE_getRidePet( charaindex[k] ); + //andy_edit + if( CHAR_CHECKINDEX( ridepet) ){ + int nowexp, b_level; + b_level = CHAR_getInt( ridepet, CHAR_LV ) - enemylevel; + if( b_level <= EXPGET_MAXLEVEL ){ + nowexp = exp; + }else{ + b_level = EXPGET_MAXLEVEL+EXPGET_DIV - b_level; + if( b_level > EXPGET_DIV ) b_level = EXPGET_DIV; + if( b_level <= 0 ){ + nowexp = 1; + }else{ + nowexp = exp * b_level / EXPGET_DIV; + } + if( nowexp < 1 ) nowexp = 1; + } + nowexp *= 0.6; + CHAR_setWorkInt( ridepet, CHAR_WORKGETEXP, + CHAR_getWorkInt( ridepet, CHAR_WORKGETEXP ) + nowexp ); + CHAR_setInt( ridepet, CHAR_KILLPETCOUNT, + CHAR_getInt( ridepet, CHAR_KILLPETCOUNT ) + 1 ); + } + if( BattleArray[battleindex].norisk == 0 + && CHAR_getInt( charaindex[k], CHAR_WHICHTYPE ) == CHAR_TYPEPET){ + if( CHAR_getInt( enemyindex, CHAR_LV ) > CHAR_getInt( charaindex[k], CHAR_LV ) ){ + CHAR_PetAddVariableAi( charaindex[k], AI_FIX_PETGOLDWIN ); + }else{ + CHAR_PetAddVariableAi( charaindex[k], AI_FIX_PETWIN ); + } + } + } + CHAR_setMaxExp( enemyindex, 0); + } + CHAR_setFlg( enemyindex, CHAR_ISDIE, 1 ); +#ifdef _PET_LIMITLEVEL + Pet_Check_Die( enemyindex ); +#endif + CHAR_setInt( enemyindex, CHAR_DEADCOUNT, + CHAR_getInt( enemyindex, CHAR_DEADCOUNT ) + 1 ); + if( pEntryEnemy[i].flg & BENT_FLG_ULTIMATE ){ + BATTLE_UltimateExtra( battleindex, charaindex[0], enemyindex ); + }else{ + BATTLE_NormalDeadExtra( battleindex, charaindex[0], enemyindex ); + } + } + } + return 0; +} + +#ifdef _PET_LIMITLEVEL +void Pet_Check_Die( int petindex ) +{ + + int LevelUpPoint; + int vital, str, tgh, dex; + float modai; + +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + // ۻԼҳ + if( CHAR_getInt( petindex, CHAR_PETID) == 718 ) { + LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + vital = (( LevelUpPoint >> 24 ) & 0xff); + str = (( LevelUpPoint >> 16 ) & 0xff); + tgh = (( LevelUpPoint >> 8 ) & 0xff); + dex = (( LevelUpPoint >> 0 ) & 0xff); +// enemyindex = pEntryEnemy[i].charaindex; + + //print("\n lvup <<%d %d %d %d>>", vital, str, tgh, dex ); + + vital = vital - RAND( 1, 8); + str = str - RAND( 1, 4); + tgh = tgh - RAND( 1, 4); + dex = dex - RAND( 1, 4); + //print("\n lvup <<%d %d %d %d>>", vital, str, tgh, dex ); + + if( vital < 0 ) vital = 0; + if( str < 0 ) str = 0; + if( tgh < 0 ) tgh = 0; + if( dex < 0 ) dex = 0; + + if( vital > 50 ) vital = 50; + if( str > 50 ) str = 50; + if( tgh > 50 ) tgh = 50; + if( dex > 50 ) dex = 50; + LevelUpPoint = ( vital << 24 ) + ( str << 16 ) + ( tgh << 8 ) + ( dex << 0 ); + CHAR_setInt( petindex, CHAR_ALLOCPOINT , LevelUpPoint ); + //print("\n lvup <<%d %d %d %d>>", vital, str, tgh, dex ); + modai = CHAR_getInt( petindex, CHAR_MODAI ); + modai = modai - ( (modai * 5) / 100 ); + CHAR_setInt( petindex, CHAR_MODAI, modai); + +// LogPetPointChange( +// CHAR_getChar( petindex, CHAR_OWNERCHARANAME), +// CHAR_getChar( petindex, CHAR_OWNERCDKEY), +// CHAR_getChar( petindex, CHAR_NAME), +// petindex, 2, +// CHAR_getInt( petindex, CHAR_LV), +// "battle_die(ս)", +// CHAR_getInt( petindex,CHAR_FLOOR), +// 0, +// 0 +// ); + } + return; + +} +#endif + +int BATTLE_AddProfit( int battleindex, int *pBidList) +{ + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + + if( BattleArray[battleindex].dpbattle == 1 ){ + return BATTLE_AddDuelPoint( battleindex, pBidList ); + }else{ + return BATTLE_AddExpItem( battleindex, pBidList ); + } + +} + +int BATTLE_TargetCheck( + int battleindex, + int defNo +) +{ + int defindex = BATTLE_No2Index( battleindex, defNo ); + + if( CHAR_CHECKINDEX( defindex ) == FALSE + || CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ) == 0 + || CHAR_getFlg( defindex, CHAR_ISDIE ) == TRUE + || CHAR_getInt( defindex, CHAR_HP ) <= 0 + || CHAR_getFlg( defindex, CHAR_ISATTACKED ) == FALSE + || CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_RESCUE + ){ + return FALSE; + } + return TRUE; +} + +int BATTLE_TargetCheckDead( + int battleindex, + int defNo +) +{ + int defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( defindex ) == FALSE + || CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ) == 0 + || CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_RESCUE + || CHAR_getFlg( defindex, CHAR_ISATTACKED ) == FALSE + || CHAR_getFlg( defindex, CHAR_ISDIE ) == FALSE ){ + //BATTLE_CHARMODE_RESCUE 5 +// print("\n [ %d, %d, %d, %d]", +// CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ), +// CHAR_getWorkInt( defindex, CHAR_WORKBATTLEMODE ), +// CHAR_getFlg( defindex, CHAR_ISATTACKED ), +// CHAR_getFlg( defindex, CHAR_ISDIE )); + return FALSE; + } + return TRUE; +} + + + + +int BATTLE_TargetAdjust( int battleindex, int charaindex, int myside ) +{ + int defNo; + + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + + if( BATTLE_TargetCheck( battleindex, defNo ) == FALSE ){ + defNo = BATTLE_DefaultAttacker( battleindex, 1 - myside ); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, defNo ); + + return defNo; +} + +void Compute_Down( int charaindex, int rideindex, int *down1, int *down2, int flg) +{ + int hp=0, pethp=0; + int downs = 0; + + *down1 = 0; + *down2 = 0; + // + downs = + CHAR_getInt( charaindex, CHAR_VITAL ) + + CHAR_getInt( charaindex, CHAR_STR ) + + CHAR_getInt( charaindex, CHAR_DEX ) + + CHAR_getInt( charaindex, CHAR_TOUGH ); + if( (downs = (((downs/100)-20)/4)) < 1 ) + downs = 1; + hp = CHAR_getInt( charaindex, CHAR_HP ); + if( hp <= downs ) downs = hp - 1; + if( downs >= 0 ){ + hp = ((hp-downs)<1)?1:(hp-downs); + CHAR_setInt( charaindex, CHAR_HP, hp ); + *down1 = downs; + } + if( flg == -1 ) { + }else {//˳ + if( !CHAR_CHECKINDEX( rideindex)) return; + downs = + CHAR_getInt( rideindex, CHAR_VITAL ) + + CHAR_getInt( rideindex, CHAR_STR ) + + CHAR_getInt( rideindex, CHAR_DEX ) + + CHAR_getInt( rideindex, CHAR_TOUGH ); + if( (downs = (((downs/100)-20)/4)) < 1 ) + downs = 1; + pethp = CHAR_getInt( rideindex, CHAR_HP ); + if( pethp <= downs ) downs = pethp - 1; + if( downs >= 0 ){ + pethp = ((pethp-downs)<1)?1:(pethp-downs); + + CHAR_setInt( rideindex, CHAR_HP, pethp); + *down2 = downs; + } + } +} + +#ifdef _PET_SKILL_SARS // WON ADD ɷ +void Compute_Down_SARS( int charaindex, int rideindex, int *down1, int *down2, int flg) +{ + int hp=0, pethp=0; + int downs = 0; + + *down1 = 0; + *down2 = 0; + // +/* + downs = + CHAR_getInt( charaindex, CHAR_VITAL ) + + CHAR_getInt( charaindex, CHAR_STR ) + + CHAR_getInt( charaindex, CHAR_DEX ) + + CHAR_getInt( charaindex, CHAR_TOUGH ); + if( (downs = (((downs/100)-20)/4)) < 1 ) + downs = 1; +*/ + + hp = CHAR_getInt( charaindex, CHAR_HP ); + downs = hp * 10 / 100; + + if( hp <= downs ) downs = hp - 1; + if( downs >= 0 ){ + hp = ((hp-downs)<1)?1:(hp-downs); + CHAR_setInt( charaindex, CHAR_HP, hp ); + *down1 = downs; + } + if( flg == -1 ) { + }else {//˳ + if( !CHAR_CHECKINDEX( rideindex)) return; + downs = + CHAR_getInt( rideindex, CHAR_VITAL ) + + CHAR_getInt( rideindex, CHAR_STR ) + + CHAR_getInt( rideindex, CHAR_DEX ) + + CHAR_getInt( rideindex, CHAR_TOUGH ); + if( (downs = (((downs/100)-20)/4)) < 1 ) + downs = 1; + pethp = CHAR_getInt( rideindex, CHAR_HP ); + if( pethp <= downs ) downs = pethp - 1; + if( downs >= 0 ){ + pethp = ((pethp-downs)<1)?1:(pethp-downs); + + CHAR_setInt( rideindex, CHAR_HP, pethp); + *down2 = downs; + } + } +} +#endif + +#ifdef _PROFESSION_ADDSKILL +void WorkIceCrackPlay(int charaindex, int cnt, int workicecracknum ) +{ + char szBuffer[256]=""; + int i,value=0; + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + int defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 );//defNo = BATTLE_Index2No( battleindex, charaindex ); + int ridepet = BATTLE_getRidePet( charaindex ); + int bid = BATTLE_Index2No( battleindex, charaindex ); + value = CHAR_getWorkInt( charaindex, workicecracknum ); + + if( cnt <= 0 && value > 0 ){ + int damage=0, petdamage=0; + + int ToList[SIDE_OFFSET*2+1]; + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, TARGET_SIDE_1, ToList ); + // ħ붯 + analysis_profession_parameter( 2, 4, defNo, charaindex ); + PROFESSION_MAGIC_ATTAIC_Effect( battleindex, bid, ToList, 2); + + if( defNo == 20 || defNo == 25 || defNo == 26 )// + bid = 0; + else + bid = 10; + + + for( i = bid ; i < bid+10 ; i++ ) { + int defType, charaidx, petidx; + charaidx = BATTLE_No2Index( battleindex , i); + if( CHAR_CHECKINDEX( charaidx ) ){ + if( CHAR_getInt( charaidx, CHAR_HP ) > 0 ){ + int hp,pethp = 0; + petidx = BATTLE_getRidePet( charaidx ); + defType = CHAR_getInt(charaidx, CHAR_WHICHTYPE); + CHAR_setWorkInt( charaidx, workicecracknum, 0 ); + + damage = value; + + hp = CHAR_getInt( charaidx, CHAR_HP ); + if( petidx == -1 ) { + hp -= damage; + if( hp < 0 ) hp = 0; + }else { + int defquick=0, petquick=0, playerdamage=0; + pethp = CHAR_getInt( petidx, CHAR_HP ); + defquick = CHAR_getWorkInt( charaidx, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( petidx, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ){ + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else{ + hp -= damage; + } + if( hp < 0 ) hp = 0; + if( pethp < 0 ) pethp = 0; + CHAR_setInt( petidx, CHAR_HP, pethp ); + } + + CHAR_setInt( charaidx, CHAR_HP, hp ); + + if( hp <= 0 ){ + CHAR_setFlg( charaidx, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( charaidx, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + if( pethp <= 0 ){ + CHAR_setFlg( petidx, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( ridepet, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + + if( damage >= 0 ){ + sprintf( szBuffer , "%X|%X|%X|%X|" , i , i ,(int)(damage) , (int)(petdamage)); + BATTLESTR_ADD( szBuffer ); + } + if( petidx != -1 && petdamage >= 0 ){ + + } + } + } + } + sprintf( szBuffer , "%X|" , 0x5711438 ); + BATTLESTR_ADD( szBuffer ); + } +} +#endif + +static int BATTLE_StatusSeq( int charaindex ) +{ + int cnt, i, bid, battleindex, down; + char szBuffer[256]=""; +#ifdef _MAGIC_DEEPPOISON + int defNo,defindex=0; + char szCommand[1024]; +#endif + int ridepet = BATTLE_getRidePet( charaindex ); + int hp=0, pethp=0; + + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + +#ifdef _MAGIC_DEEPPOISON + defNo = BATTLE_Index2No( battleindex, charaindex ); + defindex = BATTLE_No2Index( battleindex, defNo ); +#endif + bid = BATTLE_Index2No( battleindex, charaindex ); + if( BATTLE_CanMoveCheck( charaindex ) == FALSE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + for( i = 1; i < BATTLE_ST_END; i++ ){ + if( ( cnt = CHAR_getWorkInt( charaindex, StatusTbl[i] )) <= 0 )continue; + CHAR_setWorkInt( charaindex, StatusTbl[i], --cnt ); +#ifdef _MAGIC_WEAKEN // + if(CHAR_getWorkInt(charaindex,CHAR_WORKWEAKEN) > 0) + CHAR_setWorkInt( charaindex, StatusTbl[i], cnt+1 ); +#endif +#ifdef _MAGIC_BARRIER// vincent :ħ + if(CHAR_getWorkInt(charaindex,CHAR_WORKBARRIER) > 0) + CHAR_setWorkInt( charaindex, StatusTbl[i], cnt+1 ); +#endif + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( cnt <= 0 && ( StatusTbl[i] != CHAR_WORKICECRACK ) +#ifdef _PROFESSION_ADDSKILL + && ( StatusTbl[i] != CHAR_WORKICECRACK2 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK3 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK4 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK5 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK6 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK7 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK8 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK9 ) + && ( StatusTbl[i] != CHAR_WORKICECRACK10 ) +#endif + ){ // +#else + if( cnt <= 0 ){ +#endif + BATTLE_BadStatusString( bid, 0 ); + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)(%s)ϡ", + // CHAR_getUseName( charaindex ), aszStatusFull[i] ); + // BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; +//Terry del +// sprintf( szBuffer, "BM|%X|%X|", bid, 0 ); +// BATTLESTR_ADD( szBuffer ); +#ifdef _MAGIC_NOCAST + if( StatusTbl[i] == CHAR_WORKNOCAST ){ + lssproto_NC_send( getfdFromCharaIndex( charaindex ), 0);//ԭ + } +#endif + if( StatusTbl[i] == CHAR_WORKDRUNK ){ + if( ridepet != -1 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, + CHAR_getWorkInt( charaindex, CHAR_WORKQUICK ) + + CHAR_getWorkInt( ridepet, CHAR_WORKQUICK ) ); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, + CHAR_getWorkInt( charaindex, CHAR_WORKQUICK ) * 2 ); + } + } + continue; + } + + switch( StatusTbl[i] ){ + + case CHAR_WORKPOISON: + { + int petdown=-1; + Compute_Down( charaindex, ridepet, &down, &petdown, ridepet); + if( down >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // down ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + +#ifdef _NOTRIDE_ + sprintf( szBuffer, "BD|r%X|0|0|%X|", bid, (int)(down) ); + BATTLESTR_ADD( szBuffer ); +#else + sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|", bid, (int)(down), (int)(petdown) ); + BATTLESTR_ADD( szBuffer ); +#endif + } + if( ridepet != -1 && petdown >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], petdown ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + } + break; +#ifdef _MAGIC_DEEPPOISON + case CHAR_WORKDEEPPOISON: + if(CHAR_getInt( defindex, CHAR_HP ) <= 1){ + snprintf( szCommand, sizeof( szCommand ),"Bd|a%X|r%X|f%X|d%X|p%X|FF|",defNo,defNo,BCF_NORMAL,1, 0 ); + BATTLESTR_ADD( szCommand ); + CHAR_setInt( defindex, CHAR_HP,0); + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setFlg( defindex, CHAR_ISDIE, 1 ); + break; + } + + if(CHAR_getWorkInt( defindex, CHAR_WORKDEEPPOISON) <= 1){ + snprintf( szCommand, sizeof( szCommand ),"Bd|a%X|r%X|f%X|d%X|p%X|FF|",defNo,defNo,BCF_NORMAL,CHAR_getInt( charaindex, CHAR_HP), 0 ); + BATTLESTR_ADD( szCommand ); + CHAR_setInt( defindex, CHAR_HP,0); + CHAR_setFlg( defindex, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + sprintf(szBuffer, "%sо綾δ!!", CHAR_getChar( defindex, CHAR_NAME )); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + CHAR_talkToCli( CHAR_getWorkInt(defindex, CHAR_WORKPLAYERINDEX), -1, szBuffer, CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli( defindex, -1, szBuffer, CHAR_COLORYELLOW); + } + break; + } + if( ridepet == -1 ){// Robin 0728 ride Pet + down = + CHAR_getInt( charaindex, CHAR_VITAL ) + + CHAR_getInt( charaindex, CHAR_STR ) + + CHAR_getInt( charaindex, CHAR_DEX ) + + CHAR_getInt( charaindex, CHAR_TOUGH ); + down = ( down / 100 - 20 ) / 4; + if( down < 1 ) down = 1; + hp = CHAR_getInt( charaindex, CHAR_HP ); + if( hp <= down ) down = hp - 1; + if( down >= 0 ){ + CHAR_setInt( charaindex, CHAR_HP, hp - down ); + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // down ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; +#ifdef _NOTRIDE_ + sprintf( szBuffer, "BD|r%X|0|0|%X|", bid, (int)(down) ); + BATTLESTR_ADD( szBuffer ); +#else + sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|", bid, (int)(down), 0 ); + BATTLESTR_ADD( szBuffer ); +#endif + } + break; + }else { + int petdown; + down = + CHAR_getInt( charaindex, CHAR_VITAL ) + + CHAR_getInt( charaindex, CHAR_STR ) + + CHAR_getInt( charaindex, CHAR_DEX ) + + CHAR_getInt( charaindex, CHAR_TOUGH ); + petdown = + CHAR_getInt( ridepet, CHAR_VITAL ) + + CHAR_getInt( ridepet, CHAR_STR ) + + CHAR_getInt( ridepet, CHAR_DEX ) + + CHAR_getInt( ridepet, CHAR_TOUGH ); + down = ( down / 100 - 20 ) / 4; + petdown = ( petdown / 100 - 20 ) /4; + if( down < 1 ) down = 1; + if( petdown < 1 ) petdown = 1; + hp = CHAR_getInt( charaindex, CHAR_HP ); + pethp = CHAR_getInt( ridepet, CHAR_HP ); + if( hp <= down ) down = hp - 1; + if( pethp <= petdown ) petdown = pethp - 1; + if( down >= 0 ){ + CHAR_setInt( charaindex, CHAR_HP, hp - down ); + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // down ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + #ifdef _NOTRIDE_ + sprintf( szBuffer, "BD|r%X|0|0|%X|", bid, (int)(down) ); + BATTLESTR_ADD( szBuffer ); + #else + sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|", bid, (int)(down), (int)(petdown) ); + BATTLESTR_ADD( szBuffer ); + #endif + } + if( petdown >= 0 ){ + CHAR_setInt( ridepet, CHAR_HP, pethp - petdown ); + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // petdown ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + break; + } +#endif +#ifdef _MAGIC_NOCAST // :Ĭ + case CHAR_WORKNOCAST: + lssproto_NC_send( getfdFromCharaIndex( charaindex ), 1);//Ĭ + break; +#endif + case CHAR_WORKCONFUSION: + { int side, pos, defNo, lop; + if( RAND( 1, 100 ) > 80 ){ + break; + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + side = RAND( 0, 1 ); + pos = RAND( 0, 9 ); + for( lop = 0; lop < SIDE_OFFSET; lop ++ ){ + if( ++pos >= SIDE_OFFSET )pos = 0; + defNo = side * SIDE_OFFSET + pos; + if( defNo == bid ) continue; + if( BATTLE_TargetCheck( battleindex, defNo ) == TRUE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, defNo ); + break; + } + } + if( lop >= SIDE_OFFSET ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, -1 ); + } + } + break; +#ifdef _PROFESSION_ADDSKILL + case CHAR_WORKANNEX:// + { int side, pos, defNo, lop; + + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + side = RAND( 0, 1 ); + pos = RAND( 0, 9 ); + for( lop = 0; lop < SIDE_OFFSET; lop ++ ){ + if( ++pos >= SIDE_OFFSET )pos = 0; + defNo = side * SIDE_OFFSET + pos; + if( defNo == bid ) continue; + if( BATTLE_TargetCheck( battleindex, defNo ) == TRUE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, defNo ); + break; + } + } + if( lop >= SIDE_OFFSET ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, -1 ); + } + + } + break; +#endif + case CHAR_WORKDRUNK: + break; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + case CHAR_WORKOBLIVION: // + { + // ָ + if( cnt <= 1 ){ + int defNo = BATTLE_Index2No( battleindex, charaindex ); + int toNo = defNo - 5; + int toNoindex = -1, pet_no = -1; + char msg[20]; + + memset( msg, -1, sizeof(msg) ); + + // index + toNoindex = BATTLE_No2Index( battleindex, toNo ); + CHAR_setWorkInt(charaindex, StatusTbl[BATTLE_ST_OBLIVION], 0 ); + + // + pet_no = CHAR_getInt( toNoindex, CHAR_DEFAULTPET ); + sprintf( msg, "W%d", pet_no ); + CHAR_sendStatusString( toNoindex, msg ); + + + BATTLE_BadStatusString( bid, 0 ); + sprintf( szBuffer, "BM|%X|%X|", bid, 0 ); + BATTLESTR_ADD( szBuffer ); + } + break; + } + case CHAR_WORK_F_ENCLOSE: // + { + int ToList[SIDE_OFFSET*2+1]; + int defNo = BATTLE_Index2No( battleindex, charaindex ); + int old_hp = CHAR_getInt( charaindex, CHAR_HP ); + int dec_hp = 0, hp = 0; + int DAMAGE = 50; + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo, ToList ); + BATTLE_MagicEffect( battleindex, defNo, ToList, 101699, 101699 ); + + // ȡħ˺ֵ + DAMAGE = DAMAGE * cnt; +#ifdef _PROFESSION_ADDSKILL + dec_hp = PROFESSION_MAGIC_GET_DAMAGE( charaindex, charaindex, 1, DAMAGE, 0); +#else + dec_hp = PROFESSION_MAGIC_GET_DAMAGE( charaindex, charaindex, 1, DAMAGE ); +#endif + hp = old_hp - dec_hp; + + if( hp <= 0 ){ + CHAR_setInt( charaindex, CHAR_HP, 0 ); + CHAR_setFlg( charaindex, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + }else{ + CHAR_setInt( charaindex, CHAR_HP, hp ); + } + + sprintf( szCommand, "BD|r%X|0|0|%X|", defNo, dec_hp ); + BATTLESTR_ADD( szCommand ); + + break; + } + case CHAR_WORK_I_ENCLOSE: // + { + int old_dex = CHAR_getInt( charaindex, CHAR_DEX ); + int dex = 0; + int ToList[SIDE_OFFSET*2+1]; + int defNo = BATTLE_Index2No( battleindex, charaindex ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo, ToList ); + BATTLE_MagicEffect( battleindex, defNo, ToList, 27692, 101700 ); + + dex = old_dex * 0.9; + CHAR_setWorkInt(charaindex,CHAR_WORKFIXDEX, dex ); + sprintf( szCommand, "BD|r%X|0|6|%X|", defNo, (-1) * (int)((old_dex * 0.1) / 100) ); + BATTLESTR_ADD( szCommand ); + + break; + } + case CHAR_WORKRESIST_F: // + { + // ָ + if( cnt <= 1 ){ + int add_value = 0; + int old_value = 0; + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_F_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_F ); + + CHAR_setWorkInt( charaindex, CHAR_WORK_F_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "Իָ" , CHAR_COLORYELLOW ); + } + break; + } + case CHAR_WORKRESIST_I: // + { + // ָ + if( cnt <= 1 ){ + int add_value = 0; + int old_value = 0; + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_I_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_I ); + + CHAR_setWorkInt( charaindex, CHAR_WORK_I_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "Իָ" , CHAR_COLORYELLOW ); + } + + break; + } + case CHAR_WORKRESIST_T: // ׿ + { + // ָ + if( cnt <= 1 ){ + int add_value = 0; + int old_value = 0; + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_T_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_T ); + + CHAR_setWorkInt( charaindex, CHAR_WORK_T_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "׿Իָ" , CHAR_COLORYELLOW ); + } + + break; + } +#ifdef _PROFESSION_ADDSKILL +/* case CHAR_WORKERSIST_F_I_T: // ׿ + { + // ָ + if( cnt <= 1 ){ + int add_value = 0; + int old_value = 0; + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_F_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_F ); + CHAR_setWorkInt( charaindex, CHAR_WORK_F_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "Իָ" , CHAR_COLORYELLOW ); + + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_I_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_I ); + CHAR_setWorkInt( charaindex, CHAR_WORK_I_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "Իָ" , CHAR_COLORYELLOW ); + + old_value = CHAR_getWorkInt( charaindex, CHAR_WORK_T_RESIST ); + add_value = CHAR_getWorkInt( charaindex, CHAR_WORKMODRESIST_T ); + CHAR_setWorkInt( charaindex, CHAR_WORK_T_RESIST, old_value - add_value ); + CHAR_talkToCli( charaindex, -1 , "׿Իָ" , CHAR_COLORYELLOW ); + } + + break; + }*/ + case CHAR_WORKFEAR: + if( cnt <= 0 ) + CHAR_talkToCli( charaindex, -1 , "ָ" , CHAR_COLORYELLOW ); + break; +#endif + case CHAR_WORKINSTIGATE: // + { + int side, pos, defNo, lop, rate=0; + if( RAND( 1, 100 ) > 80 ){ + break; + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + side = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + + rate = CHAR_getWorkInt( charaindex, CHAR_WORKMODINSTIGATE); + + CHAR_setWorkInt( charaindex, CHAR_WORKFIXSTR, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR) * (100 - rate) /100 )); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXTOUGH, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH) * (100 - rate) /100 )); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXDEX, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) * (100 - rate) /100 )); + + pos = RAND( 0, 9 ); + for( lop = 0; lop < SIDE_OFFSET; lop ++ ){ + if( ++pos >= SIDE_OFFSET )pos = 0; + defNo = side * SIDE_OFFSET + pos; + if( defNo == bid ) continue; + if( BATTLE_TargetCheck( battleindex, defNo ) == TRUE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, defNo ); + break; + } + } + if( lop >= SIDE_OFFSET ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, -1 ); + } + break; + } +/* + case CHAR_WORK_FOCUS: // רעս + { + if( cnt <= 1 ){ + int atk_to_index = CHAR_getWorkInt( charaindex, CHAR_WORKMOD_FOCUS ); + int atk_to_no = BATTLE_Index2No( battleindex, atk_to_index ); + + if( BATTLE_TargetCheck( battleindex, atk_to_no ) != TRUE ) break; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, atk_to_no ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, 1 ); + } + break; + } +*/ + case CHAR_WORKSIGN: // һѪ + { + // Ѫ + int skill_level = CHAR_getWorkInt( charaindex, CHAR_WORKMODSIGN ); + int old_hp = CHAR_getInt( charaindex, CHAR_HP ); + int old_mp = CHAR_getInt( charaindex, CHAR_MP ); + int to_index = CHAR_getWorkInt( charaindex, CHAR_WORKSIGNID ); + int to_old_hp = CHAR_getInt( to_index, CHAR_HP ); + int to_old_mp = CHAR_getInt( to_index, CHAR_MP ); + int dec_hp=0, dec_mp=0, rate=0, hp=0, mp=0, add_hp=0, add_mp=0; + + if( old_hp <= 0 ) break; + +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ){ + dec_hp = 200; + dec_mp = 30; + }else if( skill_level > 6 ){ + dec_hp = 150; + dec_mp = 20; + }else if( skill_level > 3 ){ + dec_hp = 100; + dec_mp = 15; + }else{ + dec_hp = 50; + dec_mp = 10; + } + // hp + if( skill_level > 8 ) rate = 100; + else if( skill_level > 7 ) rate = 50; + else rate = 0; + add_hp = dec_hp * rate / 100; + + // mp + if( skill_level > 8 ) rate = 100; + else rate = 0; + add_mp = dec_mp * rate / 100; + +#else + if( skill_level >= 10 ){ + dec_hp = 300; + dec_mp = 70; + }else if( skill_level >= 9 ){ + dec_hp = 200; + dec_mp = 50; + }else if( skill_level >= 7 ){ + dec_hp = 150; + dec_mp = 30; + }else if( skill_level >= 4 ){ + dec_hp = 100; + dec_mp = 20; + }else{ + dec_hp = 50; + dec_mp = 10; + } + // hp + if( skill_level >= 9 ) rate = 80; + else if( skill_level >= 7 ) rate = (skill_level - 1 ) * 10; + else if( skill_level >= 4 ) rate = (skill_level - 2 ) * 10; + else rate = skill_level * 10; + add_hp = dec_hp * rate / 100; + + // mp + if( skill_level >= 9 ) rate = 100; + else if( skill_level >= 7 ) rate = (skill_level - 1 ) * 10; + else if( skill_level >= 4 ) rate = (skill_level - 2 ) * 10; + else rate = skill_level * 10; + add_mp = dec_mp * rate / 100; +#endif + + // ѪƵ˼ HP + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + mp = old_mp - dec_mp; + if( mp < 0 ){ + mp = 0; + add_mp=0; + } + CHAR_setInt(charaindex, CHAR_MP, mp); + } + + // ѪƵ˼ HP + if( ridepet == -1 ) { + hp = old_hp - dec_hp; + if( hp < 0 ) hp = 0; + CHAR_setInt(charaindex, CHAR_HP, hp); + sprintf( szCommand, "BD|r%X|0|0|%X|m%X|", bid, dec_hp, dec_mp ); + }else{ + int pet_old_hp = CHAR_getInt( ridepet, CHAR_HP ); + int pet_hp=0; + + dec_hp /= 2; + hp = old_hp - dec_hp; + pet_hp = pet_old_hp - dec_hp; + + if( hp < 0 ) hp = 0; + if( pet_hp < 0 ) pet_hp = 0; + + CHAR_setInt(charaindex, CHAR_HP, hp); + CHAR_setInt(ridepet, CHAR_HP, pet_hp); + if( pet_hp <= 0 ){ + CHAR_setFlg( ridepet, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( ridepet, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + sprintf( szCommand, "BD|r%X|0|0|%X|m%X|p%X|", bid, dec_hp, dec_mp, dec_hp ); + } + + if( hp <= 0 ){ + CHAR_setFlg( charaindex, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + BATTLESTR_ADD( szCommand ); + + // ʹѪƵ˼ HPMP + if( (add_hp > 0) && (to_old_hp > 0) ){ + int to_bid=0, to_hp=0, to_mp=0; + + to_bid = BATTLE_Index2No( battleindex, to_index ); + sprintf( szCommand, "BD|r%X|0|1|%X|m%X|", to_bid, add_hp, add_mp ); + BATTLESTR_ADD( szCommand ); + + to_hp = to_old_hp + add_hp; + if( to_hp > CHAR_getWorkInt( to_index , CHAR_WORKMAXHP ) ) + to_hp = CHAR_getWorkInt( to_index , CHAR_WORKMAXHP ); + + to_mp = to_old_mp + add_mp; + if( to_mp > CHAR_getWorkInt( to_index , CHAR_WORKMAXMP ) ) + to_mp = CHAR_getWorkInt( to_index , CHAR_WORKMAXMP ); + + CHAR_setInt(to_index, CHAR_HP, to_hp); + CHAR_setInt(to_index, CHAR_MP, to_mp); + } + + break; + } + case CHAR_WORKBLOODWORMS: // Ѫ + { + // Ѫ + int skill_level = CHAR_getWorkInt( charaindex, CHAR_WORKMODBLOODWORMS ); + int old_hp = CHAR_getInt( charaindex, CHAR_HP ); + int to_index = CHAR_getWorkInt( charaindex, CHAR_WORKBLOODWORMSID ); + int to_old_hp = CHAR_getInt( to_index, CHAR_HP ); + int dec_hp=0, rate=0, hp=0, add_hp=0; + + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( old_hp <= 0 ) break; + + dec_hp = skill_level * 10 + 30; + if( skill_level >= 10 ) rate = 20; + else if( skill_level >= 7 ) rate = 15; + else if( skill_level >= 5 ) rate = 10; + else rate = 5; + + add_hp = dec_hp * rate / 100; + + // ѪƵ˼ HP + if( ridepet == -1 ) { + hp = old_hp - dec_hp; + if( hp < 0 ) hp = 0; + + CHAR_setInt(charaindex, CHAR_HP, hp); + sprintf( szCommand, "BD|r%X|0|0|%X|", bid, dec_hp ); + }else{ + int pet_old_hp = CHAR_getInt( ridepet, CHAR_HP ); + int pet_hp=0; + + dec_hp /= 2; + hp = old_hp - dec_hp; + pet_hp = pet_old_hp - dec_hp; + + if( hp < 0 ) hp = 0; + if( pet_hp < 0 ) pet_hp = 0; + + CHAR_setInt(charaindex, CHAR_HP, hp); + CHAR_setInt(ridepet, CHAR_HP, pet_hp); + if( pet_hp == 0 ){ + CHAR_setFlg( ridepet, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( ridepet, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + sprintf( szCommand, "BD|r%X|0|0|%X|p%X|", bid, dec_hp, dec_hp ); + } + + if( hp <= 0 ){ + CHAR_setFlg( charaindex, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + BATTLESTR_ADD( szCommand ); + + // ʹѪƵ˼ HP + if( (add_hp > 0) && (to_old_hp > 0) ){ + int to_bid=0, to_hp=0; + + to_bid = BATTLE_Index2No( battleindex, to_index ); + sprintf( szCommand, "BD|r%X|0|1|%X|", to_bid, add_hp ); + BATTLESTR_ADD( szCommand ); + + to_hp = to_old_hp + add_hp; + if( to_hp > CHAR_getWorkInt( to_index , CHAR_WORKMAXHP ) ) + to_hp = CHAR_getWorkInt( to_index , CHAR_WORKMAXHP ); + + CHAR_setInt(to_index, CHAR_HP, to_hp); + } + + break; + } + case CHAR_WORKICEARROW: // + { + // + int dec_dex = CHAR_getWorkInt( charaindex, CHAR_WORKMODICEARROW ); + int old_dex = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX ); + int dex=0; + + dex = old_dex * ( 100 - dec_dex ) / 100; + CHAR_setWorkInt(charaindex,CHAR_WORKFIXDEX, dex); + sprintf( szCommand, "BD|r%X|0|6|%X|", bid, (-1) * dec_dex ); + + BATTLESTR_ADD( szCommand ); + + break; + } + case CHAR_WORKICECRACK: // + { + int value=0; + int defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 );//defNo = BATTLE_Index2No( battleindex, charaindex ); + + value = CHAR_getWorkInt( charaindex, CHAR_WORKMODICECRACK ); + + if( cnt <= 0 && value > 0 ){ + int damage=0, petdamage=0; + + int ToList[SIDE_OFFSET*2+1]; + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, TARGET_SIDE_1, ToList ); + // ħ붯 + analysis_profession_parameter( 2, 4, defNo, charaindex ); + PROFESSION_MAGIC_ATTAIC_Effect( battleindex, bid, ToList, 2); + + if( defNo == 20 || defNo == 25 || defNo == 26 )// + bid = 0; + else + bid = 10; + + + for( i = bid ; i < bid+10 ; i++ ) { + int defType, charaidx, petidx; + charaidx = BATTLE_No2Index( battleindex , i); + if( CHAR_CHECKINDEX( charaidx ) ){ + if( CHAR_getInt( charaidx, CHAR_HP ) > 0 ){ + petidx = BATTLE_getRidePet( charaidx ); + defType = CHAR_getInt(charaidx, CHAR_WHICHTYPE); + CHAR_setWorkInt( charaidx, CHAR_WORKICECRACK, 0 ); + //BATTLE_BadStatusString( bid, 0 ); + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)(%s)ϡ", + // CHAR_getUseName( charaindex ), aszStatusFull[i] ); + // BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //sprintf( szBuffer, "BM|%X|%X|", bid, 0 ); + //BATTLESTR_ADD( szBuffer ); + + damage = value; + + hp = CHAR_getInt( charaidx, CHAR_HP ); + if( petidx == -1 ) { + hp -= damage; + if( hp < 0 ) hp = 0; + } + else{ + int defquick=0, petquick=0, playerdamage=0; + pethp = CHAR_getInt( petidx, CHAR_HP ); + defquick = CHAR_getWorkInt( charaidx, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( petidx, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ){ + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + } + else{ + hp -= damage; + } + if( hp < 0 ) hp = 0; + if( pethp < 0 ) pethp = 0; + CHAR_setInt( petidx, CHAR_HP, pethp ); + } + + CHAR_setInt( charaidx, CHAR_HP, hp ); + + if( hp <= 0 ){ + CHAR_setFlg( charaidx, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( charaidx, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + if( pethp <= 0 ){ + CHAR_setFlg( petidx, CHAR_ISDIE, 1 ); + CHAR_setWorkInt( ridepet, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + if( damage >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // damage ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + sprintf( szBuffer , "%X|%X|%X|%X|" , i , i ,(int)(damage) , (int)(petdamage)); + + //sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|", i, (int)(damage), (int)(petdamage) ); + BATTLESTR_ADD( szBuffer ); + } + if( petidx != -1 && petdamage >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], petdamage ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + } + } + } + sprintf( szBuffer , "%X|" , 0x5711438 ); + BATTLESTR_ADD( szBuffer ); + } + } + //print("\n"); + break; +#ifdef _PROFESSION_ADDSKILL + case CHAR_WORKICECRACK2: // 2 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK2 );print("\n2");break; + case CHAR_WORKICECRACK3: // 3 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK3 );print("\n3");break; + case CHAR_WORKICECRACK4: // 4 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK4 );print("\n4");break; + case CHAR_WORKICECRACK5: // 5 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK5 );print("\n5");break; + case CHAR_WORKICECRACK6: // 6 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK6 );print("\n6");break; + case CHAR_WORKICECRACK7: // 7 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK7 );print("\n7");break; + case CHAR_WORKICECRACK8: // 8 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK8 );print("\n8");break; + case CHAR_WORKICECRACK9: // 9 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK9 );print("\n9");break; + case CHAR_WORKICECRACK10: // 10 + WorkIceCrackPlay( charaindex, cnt, CHAR_WORKICECRACK10 );print("\n10");break; +#endif //_PROFESSION_ADDSKILL + +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + case CHAR_WORKSARS: + { + int j; + int rate = 60; // Ⱦ SARS + + // ܴȾ + { + int petdown=-1; + int dec_mp = 0; + + Compute_Down_SARS( charaindex, ridepet, &down, &petdown, ridepet); + if( down >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], + // down ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + // ҿ MP + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int old_mp = CHAR_getInt( charaindex, CHAR_MP ); + dec_mp = old_mp / 10 ; + if( dec_mp < 0 ) dec_mp = 0; + CHAR_setInt( charaindex, CHAR_MP, old_mp - dec_mp ); + sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|m%X|", bid, (int)(down), (int)(petdown), dec_mp ); + }else + sprintf( szBuffer, "BD|r%X|0|0|%X|p%X|", bid, (int)(down), (int)(petdown) ); + + BATTLESTR_ADD( szBuffer ); + } + if( ridepet != -1 && petdown >= 0 ){ + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)ܵ(%d)ˡ", + // CHAR_getUseName( charaindex ), + // aszStatusFull[i], petdown ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + } + + // ȾߴSARS + if( CHAR_getWorkInt( charaindex, CHAR_WORKMODSARS ) > 0 ){ + int buf2[5], ti=0; + int tibuf[10]={ + 3,1,0,2,4, + 8,6,5,7,9 }; + + memset( buf2, -1, sizeof(buf2)); + + if( defNo > 9 ){ + for( j=0; j<10; j++ ){ + tibuf[j] += 10; + } + } + + for( j=0; j<10; j++){ + if( tibuf[j] != defNo ) continue; + if( j > 4 ){ + if( (j+1) < 10 ) buf2[ti++]=tibuf[j+1]; + if( (j-1) > 4 ) buf2[ti++]=tibuf[j-1]; + //ȱ + if( (j-5+1) < 5 ) buf2[ti++]=tibuf[j-5+1]; + if( (j-5-1) >= 0 ) buf2[ti++]=tibuf[j-5-1]; + if( (j-5) >= 0 ) buf2[ti++]=tibuf[j-5]; + }else{ + if( (j+1) < 5 ) buf2[ti++]=tibuf[j+1]; + if( (j-1) >= 0 ) buf2[ti++]=tibuf[j-1]; + //ȱ + if( (j+5+1) < 10 ) buf2[ti++]=tibuf[j+5+1]; + if( (j+5-1) > 4 ) buf2[ti++]=tibuf[j+5-1]; + if( (j+5) < 10 ) buf2[ti++]=tibuf[j+5]; + } + break; + } + + //print("buf2[%d,%d,%d,%d,%d]\n", buf2[0], buf2[1], buf2[2], buf2[3], buf2[4]); + + for( j=0; j<5; j++ ){ + + int toindex = 0; + if( buf2[j] == -1 ) continue; + + toindex = BATTLE_No2Index( battleindex, buf2[j] ); + + // õsars뿪 + if( CHAR_getWorkInt( toindex,CHAR_WORKSARS ) > 0 ) continue; + + if( RAND( 1, 100 ) <= rate ){ // SARS + if( toindex == charaindex ) continue; + if( CHAR_getInt( toindex, CHAR_HP ) <= 0 ) continue; + + CHAR_setWorkInt( toindex,CHAR_WORKSARS, 3 ); + } + } + } + } + break; +#endif + + default : + //snprintf( szBuffer, sizeof( szBuffer ), + // "(%s)(%s)", CHAR_getUseName( charaindex ), + // aszStatusFull[i] ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + break; + } + } + +#ifdef _SUIT_ITEM + { + int defCode; + int AddHp=0, AddMp=0; +#ifdef _IMPRECATE_ITEM + int nums1, nums2, nums3, delMp=0; +#endif + if( (defCode=CHAR_getWorkInt( charaindex, CHAR_WORKSUITITEM)) > 0){ + AddHp = CHAR_getWorkInt( charaindex, CHAR_WORKROUNDHP); + AddMp = CHAR_getWorkInt( charaindex, CHAR_WORKROUNDMP); + } + +#ifdef _IMPRECATE_ITEM + if( (nums1 = CHAR_getWorkInt( charaindex, CHAR_WORKIMPRECATENUM1)) > 0 ){ + delMp = CHAR_getWorkInt( charaindex, CHAR_WORKHURTMP); + CHAR_setWorkInt( charaindex, CHAR_WORKIMPRECATENUM1, nums1-1); + } + if( (nums2 = CHAR_getWorkInt( charaindex, CHAR_WORKIMPRECATENUM2)) > 0 ){ + AddHp += CHAR_getWorkInt( charaindex, CHAR_WORKWISHESHP); + CHAR_setWorkInt( charaindex, CHAR_WORKIMPRECATENUM2, nums2-1); + } + if( (nums3 = CHAR_getWorkInt( charaindex, CHAR_WORKIMPRECATENUM3)) > 0 ){ + AddMp += CHAR_getWorkInt( charaindex, CHAR_WORKWISHESMP); + CHAR_setWorkInt( charaindex, CHAR_WORKIMPRECATENUM3, nums3-1); + } + AddMp = AddMp - delMp; +#endif + if( AddHp != 0 || AddMp != 0 ) { + int AddPHp=0; + + +#ifdef _TYPE_TOXICATION + if( AddHp != 0 && CHAR_CanCureFlg( charaindex, "FALSE") != FALSE ){ +#else + if( AddHp != 0 ) { +#endif + int MyHp = CHAR_getInt( charaindex, CHAR_HP); + int MaxHp = CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP); + MyHp = ((MyHp+AddHp)>=MaxHp)?MaxHp:(MyHp+AddHp); + MyHp = (MyHp<= 1 )?1:MyHp; + CHAR_setInt( charaindex, CHAR_HP, MyHp); + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)(%d)HP", + // CHAR_getUseName( charaindex ), AddHp ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + if( ridepet != -1 ){ + int PetMaxHp = CHAR_getWorkInt( ridepet, CHAR_WORKMAXHP); + int PetHp = CHAR_getInt( ridepet, CHAR_HP); + AddPHp = AddHp; + PetHp = ((PetHp+AddPHp)>=PetMaxHp)?PetMaxHp:(PetHp+AddPHp); + PetHp = (PetHp<=1)?1:PetHp; + CHAR_setInt( ridepet, CHAR_HP, PetHp); + } + } + if( AddMp != 0 ) { + int MyMp = CHAR_getInt( charaindex, CHAR_MP); + int MaxMp = CHAR_getWorkInt( charaindex, CHAR_WORKMAXMP); + MyMp = ((MyMp+AddMp)>MaxMp)?MaxMp:(MyMp+AddMp); + MyMp = (MyMp<0)?0:MyMp; + CHAR_setInt( charaindex, CHAR_MP, MyMp); +/* +#ifdef _FIXITEMANISHOW + sprintf( szBuffer, "BD|r%X|0|1|%X|p%X|m%X|", bid, AddHp, AddPHp, AddMp); + }else { + sprintf( szBuffer, "BD|r%X|0|1|%X|p%X|", bid, AddHp, AddPHp ); +#else +*/ + sprintf( szBuffer, "BD|r%X|0|2|%X|p%X|m%X|", bid, AddHp, AddPHp, AddMp); + }else { + sprintf( szBuffer, "BD|r%X|0|2|%X|p%X|", bid, AddHp, AddPHp ); +//#endif + } + BATTLESTR_ADD( szBuffer ); + } + } +#endif +#ifdef _PETSKILL_SETDUCK + { + int turns=0, nums=0; + if( (turns=CHAR_getWorkInt( charaindex, CHAR_MYSKILLDUCK)) > 0 ){ + turns--; + if( turns == 0 ){ + nums = CHAR_getWorkInt( charaindex, CHAR_MYSKILLDUCKPOWER); + sprintf( szBuffer, "BD|r%X|0|3|%X|", bid, nums*(-1)); + BATTLESTR_ADD( szBuffer ); + } + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDUCK, turns); + } +#ifdef _MAGICPET_SKILL + if( (turns=CHAR_getWorkInt( charaindex, CHAR_MYSKILLSTR)) > 0 ){ + turns--; + if( turns == 0 ){ + nums = CHAR_getWorkInt( charaindex, CHAR_MYSKILLSTRPOWER); + sprintf( szBuffer, "BD|r%X|0|4|%X|", bid, nums*(-1)); + BATTLESTR_ADD( szBuffer ); + } + CHAR_setWorkInt( charaindex, CHAR_MYSKILLSTR, turns); + } + if( (turns=CHAR_getWorkInt( charaindex, CHAR_MYSKILLTGH)) > 0 ){ + turns--; + if( turns == 0 ){ + nums = CHAR_getWorkInt( charaindex, CHAR_MYSKILLTGHPOWER); + sprintf( szBuffer, "BD|r%X|0|5|%X|", bid, nums*(-1)); + BATTLESTR_ADD( szBuffer ); + } + CHAR_setWorkInt( charaindex, CHAR_MYSKILLTGH, turns); + } + if( (turns=CHAR_getWorkInt( charaindex, CHAR_MYSKILLDEX)) > 0 ){ + turns--; + if( turns == 0 ){ + nums = CHAR_getWorkInt( charaindex, CHAR_MYSKILLDEXPOWER); + sprintf( szBuffer, "BD|r%X|0|6|%X|", bid, nums*(-1)); + BATTLESTR_ADD( szBuffer ); + } + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDEX, turns); + } +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( (turns=CHAR_getWorkInt( charaindex, CHAR_MYSKILLHIT)) > 0 ){ + turns--; + if( turns == 0 ){ + int dec_num = CHAR_getWorkInt( charaindex, CHAR_MYSKILLHIT_NUM); + nums = CHAR_getWorkInt( charaindex, CHAR_WORKHITRIGHT); + nums -= dec_num; + CHAR_setWorkInt( charaindex, CHAR_WORKHITRIGHT, nums); + + CHAR_talkToCli( charaindex, -1, "ָ", CHAR_COLORYELLOW); + //sprintf( szBuffer, "BD|r%X|0|6|%X|", bid, dec_num*(-1)); + //BATTLESTR_ADD( szBuffer ); + } + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT, turns); + } +#endif + +#endif + } +#endif + return 0; + +} + + +BOOL BATTLE_CanMoveCheck( int charaindex ) +{ + + // + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARALYSIS ) > 0 ){ + return FALSE; + } + + // ޼ + if( CHAR_getWorkInt( charaindex, CHAR_WORKSTONE ) > 0 ){ + return FALSE; + } + // Ի + if( CHAR_getWorkInt( charaindex, CHAR_WORKSLEEP ) > 0 ){ + return FALSE; + } +#ifdef _MAGIC_BARRIER + if( CHAR_getWorkInt( charaindex, CHAR_WORKBARRIER ) > 0 ){ + return FALSE; + } +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + // ѣ + if( CHAR_getWorkInt( charaindex, CHAR_WORKDIZZY ) > 0 ){ + return FALSE; + } + // ޵ + if( CHAR_getWorkInt( charaindex, CHAR_WORKDRAGNET ) > 0 ){ + return FALSE; + } + +#ifdef _JOB_FIX + // + if( CHAR_getWorkInt( charaindex, CHAR_WORKICEARROW ) > 0 ){ + return FALSE; + } +#endif +/* + // רעս + if( CHAR_getWorkInt( charaindex, CHAR_WORK_FOCUS ) > 0 ){ + return FALSE; + } +*/ + // ׸ + if( CHAR_getWorkInt( charaindex, CHAR_WORK_T_ENCLOSE ) > 0 ){ + return FALSE; + } +#endif +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) > 0 ){ + return FALSE; + } +#endif + return TRUE; +} + +#ifdef _ITEM_EQUITSPACE +int BATTLE_GetEqShield( int charaindex ) +{ + int iRet = ITEM_FIST, itemindex; + + itemindex = CHAR_getItemIndex( charaindex, CHAR_EQSHIELD ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE ){ + iRet = ITEM_FIST; + }else{ + iRet = ITEM_getInt( itemindex, ITEM_TYPE ); + } + return iRet; +} +#endif + +int BATTLE_GetWepon( int charaindex ) //ȡýɫֳ +{ + int iRet = ITEM_FIST, itemindex; + + itemindex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE ){ + iRet = ITEM_FIST; + }else{ + iRet = ITEM_getInt( itemindex, ITEM_TYPE ); + } + + return iRet; +} + +static int aBowW[50] = +{ + 0, 2, 1, 4, 3, 0, 1, 2, 3, 4, + 1, 0, 3, 2, 4, 1, 3, 0, 2, 4, + 2, 4, 0, 1, 3, 2, 0, 4, 1, 3, + 3, 1, 0, 2, 4, 3, 1, 0, 2, 4, + 4, 2, 0, 1, 3, 4, 2, 0, 1, 3, +}; + +void BATTLE_TargetListSet( int charaindex, int attackNo, int *pList) +{ + int i, j=0, defNo, battleindex=-1; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + +#ifdef _SKILLLIMIT // (ɿ) Syu ADD ùҷ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_FALLRIDE || // + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_WILDVIOLENTATTACK || //񱩹 + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_TIMID || // ս + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_MPDAMAGE || // MP + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_WEAKEN || // + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_DAMAGETOHP || // Ѫ + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_STEALMONEY ) { // + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); +// BATTLE_NoAction( battleindex, attackNo ); + return; + } + } +#endif + + for( i = 0; i < BATTLE_ENTRY_MAX*2; i ++ ){ + pList[i] = defNo; + } +#ifdef _BATTLE_ATTCRAZED // ANDY +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTCRAZED || + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT ){ +#else + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTCRAZED ){ +#endif + int deftop,defsub; + int plive[10]; + int n = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + BATTLE_NoAction( battleindex, attackNo ); + return; + } +#endif + if( 0 <= defNo && defNo <= 9 ){ + defsub = 0; + deftop = 9; + }else if( 10 <= defNo && defNo <= 19 ){ + defsub = 10; + deftop = 19; + }else{ + pList[1] = -1; + return; + } + for( i = defsub; i < deftop; i ++ ){ + if( BATTLE_TargetCheck( battleindex, i) == FALSE ) continue; + plive[j++] = i; + } + if( j == 0 ) return; + for( i=0; i= CHAR_MAXPETSKILLHAVE ) i = 0; + + if( CHAR_getCharHaveSkill( charaindex, i ) == NULL ){ + continue; + } + + pskill_array = PETSKILL_GetArray( charaindex, i ); + skill_type = PETSKILL_getInt( pskill_array, PETSKILL_FIELD ); + + + if( skill_type == PETSKILL_FIELD_BATTLE + || skill_type == PETSKILL_FIELD_ALL + ){ + }else{ + continue; + } + + if( j < iNum ){ + j++; + continue; + } + + if( PETSKILL_Use( charaindex, iNum, toNo, NULL ) == TRUE ){ + + }else{ + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + break; + } + + if( k >= PETSKILLSERCHTIME ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + return 0; +} + + +enum{ + PETAI_MODE_NORMAL, + PETAI_MODE_TARGETRANDOM, + PETAI_MODE_RANDOMACT, + PETAI_MODE_OWNERATTACK, + PETAI_MODE_ENEMYATTACK, + PETAI_MODE_ESCAPE, + PETAI_MODE_NOACT, + PETAI_MODE_END +}; + +static int BATTLE_PetLoyalCheck( int battleindex, int bid, int charaindex ) +{ + int ai, toNo, mode = 0, type, Rand, toSide = 1, flg, i; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPET ){ + return 0; + } + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ) + return 0; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_WAIT ){ + return 0; + } + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); + flg &= ~CHAR_BATTLEFLG_AIBAD; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + if( BATTLE_CanMoveCheck( charaindex ) == FALSE ){ + return 0; + } + toNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + toSide = ( 0 <= toNo && toNo < BATTLE_ENTRY_MAX )?(0):(1); + ai = CHAR_getWorkInt( charaindex, CHAR_WORKFIXAI ); + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + || bid == toNo + ){ + type = 1; + }else{ + type = 0; + } + + Rand = RAND( 1, 100 ); + + mode = 0; // е + if( ai >= 80 ){ // պߡѶ + mode = PETAI_MODE_NORMAL; // 姸 + }else + if( ai >= 70 ){ // պߡѶ + if( Rand < 10 )mode = PETAI_MODE_TARGETRANDOM; // + }else + if( ai >= 60 ){ + if( Rand < 20 )mode = PETAI_MODE_TARGETRANDOM; // + }else + if( ai >= 50 ){ + if( Rand < 35 )mode = PETAI_MODE_TARGETRANDOM; // + }else + if( ai >= 40 ){ + if( Rand < 50 )mode = PETAI_MODE_TARGETRANDOM; // + }else + if( ai >= 30 ){ + if( Rand < 70 )mode = PETAI_MODE_RANDOMACT; // ¼ĸة + }else + if( ai >= 20 ){ + if( Rand < 70 )mode = PETAI_MODE_RANDOMACT; // ¼ĸة + }else + if( ai >= 10 ){ + if( Rand < 80 ){ + mode = PETAI_MODE_OWNERATTACK; // DZ + }else{ + mode = PETAI_MODE_ENEMYATTACK; // + } + }else{ + if( Rand < 60 ){ + mode = PETAI_MODE_OWNERATTACK; // DZ + }else{ + mode = PETAI_MODE_ESCAPE; // + } + } + + + if( mode == PETAI_MODE_NORMAL )return 0; + + for( i = 0; i < CHAR_MAXPETSKILLHAVE;i ++ ){ + if( CHAR_getCharHaveSkill( charaindex, i ) ){ + break; + } + } + if( i >= CHAR_MAXPETSKILLHAVE ){ + mode = PETAI_MODE_NOACT; + } + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); + flg |= CHAR_BATTLEFLG_AIBAD; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + + + switch( mode ){ + case PETAI_MODE_NOACT: + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, + BATTLE_COM_NONE ); + break; + case PETAI_MODE_TARGETRANDOM: + if( type == 1 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, + BATTLE_COM_NONE ); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, + BATTLE_DefaultAttacker( battleindex, toSide ) ); + + } + break; + case PETAI_MODE_RANDOMACT: // ¼ĸة + // Ѩ 󡷴姸ĸ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + return 0; + } + + // ūʧ׷ºë + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); + flg &= ~CHAR_BATTLEFLG_GUARDIAN; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + + if( toNo == bid ){ // ëƥ + // ƥئг + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + }else{ + // ¼ĸة ë + BATTLE_PetRandomSkill( battleindex, charaindex ); + } + break; + + case PETAI_MODE_OWNERATTACK: // DZ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, bid-5 ); + break; + + case PETAI_MODE_ENEMYATTACK: // + { int myside = 0; + if( bid >= BATTLE_ENTRY_MAX ) myside = 1; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + // + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, + BATTLE_DefaultAttacker( battleindex, 1 - myside ) ); + } + break; + + case PETAI_MODE_ESCAPE: // ¹ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_LOSTESCAPE ); + break; + + } + + return 1; + +} + +#ifdef _ATTACK_MAGIC + +#define MAX_MAGIC_NUMBER 25 + +// ÿһħĹ Χ (id,area) +int TargetIndex[MAX_MAGIC_NUMBER][2] = +{ + {301,-1},{302,-1},{303,26},{304,-1},{305,20},{306,20}, + {307,-1},{308,-1},{309,-1},{310,-1},{311,26},{312,20}, + {313,-1},{314,-1},{315,-1},{316,-1},{317,26},{318,20}, + {319,-1},{320,-1},{321,26},{322,-1},{323,26},{324,20},{325,20} +}; + +int magic,toindex,magic_count; + +#endif + +static int BATTLE_Battling( int battleindex ) +{ + //DebugMainFunction="BATTLE_Battling_1"; + BATTLE *pBattle, *pWatchBattle; + BATTLE_ENTRY *pEntry[2]; + char *aszFieldAttr[] = { "", "", "ˮ", "", "" }, + szBuffer[256]="", + szWork[256]; + int i,j,k, + len, + entrynum, + charaindex, + attackNo, + defNo=-1, + aAttackList[BATTLE_ENTRY_MAX*2+1], + aDefList[BATTLE_ENTRY_MAX*2+1], + ComboId, + itemindex, + AllSize = 0; + BATTLE_CHARLIST EntryList[40]; + int ContFlg, attackNoSub, defNoSub; + //DebugMainFunction="BATTLE_Battling_2"; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + //DebugMainFunction="BATTLE_Battling_3"; + pBattle = &BattleArray[battleindex]; + pEntry[0] = pBattle->Side[0].Entry; + pEntry[1] = pBattle->Side[1].Entry; + //DebugMainFunction="BATTLE_Battling_4"; + for( i = 0; i < arraysizeof(EntryList); i ++ ){ + EntryList[i].charaindex = -1; + EntryList[i].combo = 0; + } + //DebugMainFunction="BATTLE_Battling_5"; + sprintf( szBuffer, "ս %d ת %d %s", + battleindex, pBattle->turn, + aszFieldAttr[pBattle->field_att] + ); + //DebugMainFunction="BATTLE_Battling_6"; + entrynum = 0; + + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pEntry[j][i].flg &= ~BENT_FLG_ULTIMATE; + if( pEntry[j][i].charaindex == -1 )continue; + EntryList[entrynum].charaindex = pEntry[j][i].charaindex; + EntryList[entrynum].side = j; + EntryList[entrynum].num = pEntry[j][i].bid; + EntryList[entrynum].dex = BATTLE_DexCalc( pEntry[j][i].charaindex ); // +#ifdef _EQUIT_SEQUENCE + EntryList[entrynum].sequence = CHAR_getWorkInt( pEntry[j][i].charaindex, CHAR_WORKSEQUENCEPOWER); +#endif + BATTLE_talkToCli( pEntry[j][i].charaindex, szBuffer, CHAR_COLORYELLOW ); + entrynum ++; + } + } + //DebugMainFunction="BATTLE_Battling_7"; + szAllBattleString[0] = 0; + k = 0; + for( j = 0; j < 2; j ++ ){ + k = j * SIDE_OFFSET; + for( i = 0; i < BATTLE_ENTRY_MAX/2; i ++ ){ + szBattleString[0] = 0; + if( pBattle->iEntryBack[k] >= 0 + && pBattle->Side[j].Entry[i].charaindex == -1){ + if( pBattle->iEntryBack2[k] >= 0 ){ + sprintf( szBattleString, "BE|et%X|f1|", k ); + //BATTLE_BroadCast( battleindex, "ͻȻ˲ˡ", CHAR_COLORYELLOW ); + }else{ + //print( "ӦIDȷֵerror\n" ); + //BATTLE_BroadCast( battleindex, "IDerror", CHAR_COLORYELLOW ); + } + } + k ++; + strcatsafe( szAllBattleString,sizeof(szAllBattleString), szBattleString ); + } + } + //DebugMainFunction="BATTLE_Battling_8"; + len = strlen( szAllBattleString ); + //DebugMainFunction="BATTLE_Battling_9"; + AllSize += len; + EntrySort( EntryList, entrynum ); + //DebugMainFunction="BATTLE_Battling_10"; + ComboCheck( EntryList, entrynum ); + //DebugMainFunction="BATTLE_Battling_11"; + for( i = 0; i < entrynum; i ++ ){ + int COM, myside, otherside, bi, + attack_flg = 1, + attack_max = 1, + attack_count = 0; + + charaindex = EntryList[i].charaindex; + myside = EntryList[i].side; + otherside = 1-myside; + attackNo = EntryList[i].num; + bi = attackNo - myside * SIDE_OFFSET; + + aAttackList[0] = attackNo; + aAttackList[1] = -1; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE )continue; + szBadStatusString[0] = 0; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + != BATTLE_CHARMODE_C_OK ){ + //sprintf( szBuffer, "ָ벻ȫ(%s)", CHAR_getUseName( charaindex ) ); + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + continue; + } + if( CHAR_getInt( charaindex, CHAR_HP ) <= 0 )continue; + + szBattleString[0] = 0; + pszBattleTop = szBattleString; + pszBattleLast = szBattleString+arraysizeof(szBattleString); + + // WON ADD + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) != TRUE ) + BATTLE_StatusSeq( charaindex ); + //DebugMainFunction="BATTLE_Battling_12"; +#ifdef _OTHER_MAGICSTAUTS + BATTLE_MagicStatusSeq( charaindex ); +#endif + //DebugMainFunction="BATTLE_Battling_13"; +#ifdef _MAGIC_DEEPPOISON // 綾 + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + BATTLE_ProfessionStatusSeq( battleindex, charaindex); +#endif + //DebugMainFunction="BATTLE_Battling_14"; + + if( BATTLE_CanMoveCheck( charaindex ) == FALSE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + //DebugMainFunction="BATTLE_Battling_15"; + gBattleDamageModyfy = 1.0; + gBattleDuckModyfy = 0; + gBattleStausChange = -1; + gBattleStausTurn = 0; + gWeponType = ITEM_FIST; + gWeponType = BATTLE_GetWepon( charaindex ); + //DebugMainFunction="BATTLE_Battling_16"; +#ifdef _PETSKILL_BECOMEFOX + if( CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 //DZС + || CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749) + { + int COM = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + gWeponType = ITEM_FIST; + + if( !(COM == BATTLE_COM_ATTACK + || COM == BATTLE_COM_GUARD + || COM == BATTLE_COM_NONE) ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_talkToCli( charaindex, -1, "Сֻܹʹ", CHAR_COLORYELLOW ); + } + } +#endif + //DebugMainFunction="BATTLE_Battling_17"; +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 // + && (CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) ) + { + int COM = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + gWeponType = ITEM_FIST; + //CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + if( !(COM == BATTLE_COM_ATTACK + || COM == BATTLE_COM_GUARD + || COM == BATTLE_COM_NONE + || COM == BATTLE_COM_ITEM + || COM == BATTLE_COM_ESCAPE + || COM == BATTLE_COM_CAPTURE + || COM == BATTLE_COM_WAIT + || COM == BATTLE_COM_PETIN + || COM == BATTLE_COM_PETOUT) ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_GUARD ); + //CHAR_talkToCli( charaindex, -1, "ֻܹܺʹõߣ", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex, -1, "᲻ʹְҵܣ", CHAR_COLORYELLOW ); + } + } +#endif + //DebugMainFunction="BATTLE_Battling_18"; + gDamageDiv = 1.0; + attack_max = BATTLE_GetAttackCount( charaindex ); + if( attack_max <= 0 ){ + int work, randwork; + work = CHAR_getInt( charaindex, CHAR_LV ); + if( work < 10 || CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + attack_max = 1; + }else{ + int luckwork = CHAR_getInt( charaindex, CHAR_LUCK )*5; + if( luckwork > 5*5 ){ +// print( "\nerr:(%s)(%d)\n", +// CHAR_getUseName( charaindex ), +// CHAR_getInt( charaindex, CHAR_LUCK ) ); + luckwork = 5*5; + } + randwork = RAND( 1, 1000 ); + if( randwork <= 10 + luckwork){ + attack_max = RAND( 5, 10 ); + }else + if( randwork <= 30 + luckwork ){ + attack_max = 3; + }else + if( randwork <= 70 + luckwork ){ + attack_max = 2; + }else{ + attack_max = 1; + } + } + }else{ + if( gWeponType == ITEM_FIST )gDamageDiv = attack_max; + } + if( gWeponType == ITEM_BREAKTHROW ){ + gBattleStausChange = BATTLE_ST_PARALYSIS; + gBattleStausTurn = 1-1; + }else{ + } + + if( BattleArray[battleindex].Side[myside].flg & BSIDE_FLG_SURPRISE ){ + }else{ + if( BATTLE_PetLoyalCheck( battleindex, attackNo, charaindex ) ) { +#ifdef _FIXWOLF // Syu ADD ˱Bug + if ( CHAR_getInt ( charaindex , CHAR_BASEIMAGENUMBER) == 101428 ) { + if( CHAR_getWorkInt ( charaindex , CHAR_WORKTURN ) == 0){ + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex , CHAR_BASEBASEIMAGENUMBER)); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex , CHAR_WORKFIXSTR)); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex , CHAR_WORKFIXDEX)); + } + } +#endif + //DebugMainFunction="BATTLE_Battling_19"; + sprintf( szWork, "BX|%X|", attackNo); + //DebugMainFunction="BATTLE_Battling_20"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_21"; + } + } + +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) > 0 ){ + CHAR_setWorkInt( charaindex, CHAR_DOOMTIME, CHAR_getWorkInt( charaindex, CHAR_DOOMTIME) - 1 ); + } + if( CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) == 0 + && ( CHAR_getWorkInt( charaindex, CHAR_WORK_com1 ) == BATTLE_COM_S_FIRE_SPEAR + || CHAR_getWorkInt( charaindex, CHAR_WORK_com1 ) == BATTLE_COM_S_DOOM ) ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, CHAR_getWorkInt( charaindex, CHAR_WORK_com1 ) ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, CHAR_getWorkInt( charaindex, CHAR_WORK_toNo ) ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, CHAR_getWorkInt( charaindex, CHAR_WORK_mode ) ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, CHAR_getWorkInt( charaindex, CHAR_WORK_skill_level ) ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, CHAR_getWorkInt( charaindex, CHAR_WORK_array ) ); + CHAR_setWorkInt( charaindex, CHAR_WORK_com1, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_toNo, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_mode, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_skill_level, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_array, 0 ); + } + +#endif + COM = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + switch( COM ){ + case BATTLE_COM_ATTACK: + //DebugMainFunction="BATTLE_Battling_22"; + if( gWeponType == ITEM_BOOMERANG ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_BOOMERANG ); + +#ifdef _PETSKILL_BECOMEFOX + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС겻ʹû + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){// + gWeponType = ITEM_FIST; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } +#endif + } + //DebugMainFunction="BATTLE_Battling_23"; + break; + case BATTLE_COM_COMBO: + //DebugMainFunction="BATTLE_Battling_24"; + if( ComboCheck2( EntryList, i, entrynum ) == FALSE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } + //DebugMainFunction="BATTLE_Battling_25"; + break; + + case BATTLE_COM_S_STATUSCHANGE: + gBattleStausChange = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + gBattleStausTurn = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ); + break; + +// case BATTLE_COM_S_GYRATE: +// gBattleStausChange = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM5 ); +// gBattleStausTurn = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM6 ); +// break; + +#ifdef _PETSKILL_HECTOR + case BATTLE_COM_S_HECTOR: + gBattleStausChange = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + gBattleStausTurn = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ); + break; +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + case BATTLE_COM_S_SARS: + gBattleStausChange = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + gBattleStausTurn = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ); + break; +#endif + + case BATTLE_COM_S_CHARGE: + //DebugMainFunction="BATTLE_Battling_26"; + BATTLE_Charge( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_27"; + break; + case BATTLE_COM_S_RENZOKU: + attack_max = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + gDamageDiv = attack_max; + break; + case BATTLE_COM_S_ZIYUN1: + attack_max = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + gDamageDiv = attack_max; + gBattleDuckModyfy = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ); +#ifdef _VARY_WOLF + case BATTLE_COM_S_VARY: + // ò + break; +#endif +#ifdef _SKILL_WILDVIOLENT_ATT + //񱩹 vincent add 2002/05/16 + case BATTLE_COM_S_WILDVIOLENTATTACK: + attack_max = RAND(3,10);// + gDamageDiv = attack_max;//ÿι˺ + gBattleDuckModyfy = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 );// + break; +#endif + case BATTLE_COM_S_EARTHROUND0: + gBattleDamageModyfy = 1.0 + 0.01 * CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM3 ); + break; +#ifdef _BATTLE_ATTCRAZED + case BATTLE_COM_S_ATTCRAZED: + attack_max = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + break; +#endif +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + case BATTLE_COM_S_ATTSHOOT: + attack_max = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + gDamageDiv = attack_max;//ÿι˺ + break; +#endif + case BATTLE_COM_S_MIGHTY: + gBattleDamageModyfy = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ) * 0.01; + gBattleDuckModyfy = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ); // ľĤɧٳ + break; + } + //DebugMainFunction="BATTLE_Battling_28"; + BATTLE_TargetListSet( charaindex, attackNo, aDefList ); + //DebugMainFunction="BATTLE_Battling_29"; + COM = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + ContFlg = FALSE; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_AIBAD + && COM == BATTLE_COM_COMBO ){ + //print( "ҳ϶Ȳʹñɱʧ(%s)\n", CHAR_getUseName( charaindex ) ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } +#ifdef _BATTLE_TIMESPEED//ٶ + { + int flgtime = 0; + switch( COM ){ +#ifdef _BATTLE_ATTCRAZED + case BATTLE_COM_S_ATTCRAZED: + flgtime = 200*3; + break; +#endif +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + case BATTLE_COM_S_ATTSHOOT: + flgtime = 80*attack_max; + break; +#endif + case BATTLE_COM_JYUJYUTU: + case BATTLE_COM_S_ATTACK_MAGIC: + flgtime = 260; // 1/100sec + break; + case BATTLE_COM_COMBO: + flgtime = 200; // 1/100sec + break; + case BATTLE_COM_GUARD: + break; + case BATTLE_COM_WAIT: + default : + flgtime = 150; // 1/100sec + break; + } + BattleArray[battleindex].flgTime += flgtime; + } +#endif + +#ifdef _PETSKILL_BECOMEFOX // Ļṥ 20% + if( CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //С + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.8);//20% + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.8);//20% + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*0.8);//20% + } +#endif + switch( COM ){// + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + //==== ֱӹϵ =============================================================== + case BATTLE_COM_S_BRUST: // + case BATTLE_COM_S_CHAIN_ATK: // + case BATTLE_COM_S_CHAIN_ATK_2: // ˫ع + case BATTLE_COM_S_CAVALRY: // ﹥ + case BATTLE_COM_S_DEAD_ATTACK: // + case BATTLE_COM_S_ATTACK_WEAK: // 㹥 + case BATTLE_COM_S_PLUNDER: // Ӷ + case BATTLE_COM_S_CHAOS: // ҹ + { + // ֹͬӻ + //DebugMainFunction="BATTLE_Battling_30"; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ){ + BATTLE_NoAction( battleindex, attackNo ); break; + } + //DebugMainFunction="BATTLE_Battling_31"; + } + case BATTLE_COM_S_ENRAGE_PET: // ŭ + { + //DebugMainFunction="BATTLE_Battling_32"; + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + battle_profession_attack_fun(battleindex, attackNo, defNo, charaindex); + //change fix ʹְҵò + //BATTLE_AddProfit( battleindex, aAttackList); + //DebugMainFunction="BATTLE_Battling_33"; + } + break; + //==== ħϵ ================================================================ + case BATTLE_COM_S_VOLCANO_SPRINGS: // ɽȪ + case BATTLE_COM_S_FIRE_BALL: // + case BATTLE_COM_S_FIRE_SPEAR: // ǹ + case BATTLE_COM_S_SUMMON_THUNDER: // + case BATTLE_COM_S_CURRENT: // + case BATTLE_COM_S_STORM: // + case BATTLE_COM_S_ICE_ARROW: // + case BATTLE_COM_S_ICE_CRACK: // + case BATTLE_COM_S_ICE_MIRROR: // + case BATTLE_COM_S_DOOM: // ĩ + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + case BATTLE_COM_S_SIGN: // һѪ + case BATTLE_COM_S_ENCLOSE: // + case BATTLE_COM_S_THROUGH_ATTACK: // ᴩ + case BATTLE_COM_S_CONVOLUTE: // + { +#ifdef _PROFESSION_ADDSKILL + /* if( COM == BATTLE_COM_S_DOOM //ĩռ + || COM == BATTLE_COM_S_FIRE_SPEAR){ + if( CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) > 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + sprintf( szWork, "bt|%x|", attackNo ); + BATTLESTR_ADD( szWork ); + break; + } + }*/ +#endif + // ֹͬӻ + //DebugMainFunction="BATTLE_Battling_34"; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ){ + BATTLE_NoAction( battleindex, attackNo ); break; + } + //DebugMainFunction="BATTLE_Battling_35"; + } + case BATTLE_COM_S_BLOOD: // Ѫ + { + //DebugMainFunction="BATTLE_Battling_36"; + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); +#if 1 // Robin fix Ѫ˵Ѫ + if( defNo != attackNo && COM == BATTLE_COM_S_BLOOD ){ + //print("\n ķ!Ѫ˵Ѫ!!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + defNo = attackNo; + + CHAR_talkToCli( charaindex, -1, "쳣ߡ", CHAR_COLORYELLOW); + CONNECT_setCloseRequest( CHAR_getWorkInt( charaindex, CHAR_WORKFD ) , 1 ); + break; + } +#endif + //DebugMainFunction="BATTLE_Battling_37"; +#ifdef _PROFESSION_ADDSKILL + if( COM == BATTLE_COM_S_ICE_CRACK ){ + if( pBattle->ice_count >= 20 ) + pBattle->ice_count = 0; + pBattle->ice_use[pBattle->ice_count] = TRUE; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + pBattle->ice_level[pBattle->ice_count] = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + pBattle->ice_bout[pBattle->ice_count] = 2; + pBattle->ice_toNo[pBattle->ice_count] = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + pBattle->ice_array[pBattle->ice_count] = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + pBattle->ice_charaindex[pBattle->ice_count] = charaindex; + pBattle->ice_attackNo[pBattle->ice_count] = attackNo; + ++pBattle->ice_count; + BATTLE_NoAction( battleindex, attackNo ); + //print("\n"); + break; + } + //DebugMainFunction="BATTLE_Battling_38"; +#endif + battle_profession_attack_magic_fun(battleindex, attackNo, defNo, charaindex); + //DebugMainFunction="BATTLE_Battling_39"; + //change fix ʹְҵò + //BATTLE_AddProfit( battleindex, aAttackList); + break; + } + //==== ϵ ==================================================================== + case BATTLE_COM_S_FOCUS: // רעս + case BATTLE_COM_S_AVOID: // ر + case BATTLE_COM_S_RECOVERY: // Ѫ + case BATTLE_COM_S_SCAPEGOAT: // Ϊ + case BATTLE_COM_S_ENRAGE: // + case BATTLE_COM_S_COLLECT: // ۼ + case BATTLE_COM_S_TRAP: // + case BATTLE_COM_S_TRANSPOSE: // λλ + case BATTLE_COM_S_DOCILE: // ѱ +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_CALL_NATURE: // Ȼ +#endif + { + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_40"; + battle_profession_assist_fun(battleindex, attackNo, defNo, charaindex); + //DebugMainFunction="BATTLE_Battling_41"; + break; + } + //==== иı״̬ϵ ==================================================================== + case BATTLE_COM_S_SHIELD_ATTACK: // ܻ + case BATTLE_COM_S_ENTWINE: // + case BATTLE_COM_S_DRAGNET: // ޵ + case BATTLE_COM_S_TOXIN_WEAPON: // + case BATTLE_COM_S_INSTIGATE: // + case BATTLE_COM_S_OBLIVION: // + { + // ֹͬӻ + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_42"; + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ){ + BATTLE_NoAction( battleindex, attackNo ); + //if( COM == BATTLE_COM_S_TOXIN_WEAPON ) + //printf("\nbug-ͬӻ"); + break; + } + //DebugMainFunction="BATTLE_Battling_43"; + } + case BATTLE_COM_S_RESIST_FIRE: // + case BATTLE_COM_S_RESIST_ICE: // + case BATTLE_COM_S_RESIST_THUNDER: // ׿ +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_RESIST_F_I_T: // Ȼ + case BATTLE_COM_S_BOUNDARY: // Խ +#endif + case BATTLE_COM_S_FIRE_ENCLOSE: // + case BATTLE_COM_S_ICE_ENCLOSE: // + case BATTLE_COM_S_THUNDER_ENCLOSE: // ׸ + { + + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_44"; + battle_profession_status_chang_fun(battleindex, attackNo, defNo, charaindex); + //DebugMainFunction="BATTLE_Battling_45"; + //if( COM == BATTLE_COM_S_TOXIN_WEAPON ) + //printf("\nbug-"); + //DebugMainFunction="BATTLE_Battling_46"; + break; + } + //==================================================================================== +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + case BATTLE_COM_S_ACUPUNCTURE: //Ƥ + CHAR_setWorkInt( charaindex, CHAR_WORKACUPUNCTURE, 1); + //print("\n:%s",CHAR_getChar(charaindex,CHAR_NAME)); +#endif + case BATTLE_COM_S_CHARGE_OK: + case BATTLE_COM_S_POWERBALANCE: + case BATTLE_COM_S_STATUSCHANGE: + case BATTLE_COM_S_EARTHROUND0: + case BATTLE_COM_S_MIGHTY: + if( COM == BATTLE_COM_S_MIGHTY ){ + int def_index = -1; + int i; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 );//ȡñߵλ + if( BATTLE_TargetCheck(battleindex, defNo) == FALSE + || CHAR_getWorkInt( BATTLE_No2Index( battleindex, defNo ), CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + + //һֻ + if( defNo < 10 ){ + for( i=0;i<10;i++ ) + if( BATTLE_TargetCheck(battleindex, i) + && CHAR_getWorkInt( BATTLE_No2Index( battleindex, i ), CHAR_WORKBATTLECOM1 ) != BATTLE_COM_S_EARTHROUND0){ + defNo = i; + break; + } + } + else{ + for( i=10;i<20;i++ ) + if( BATTLE_TargetCheck(battleindex, i) + && CHAR_getWorkInt( BATTLE_No2Index( battleindex, i ), CHAR_WORKBATTLECOM1 ) != BATTLE_COM_S_EARTHROUND0){ + defNo = i; + break; + } + } + if( BATTLE_TargetCheck(battleindex, defNo) == FALSE + || CHAR_getWorkInt( BATTLE_No2Index( battleindex, defNo ), CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ) { + return 0; + } + } + def_index = BATTLE_No2Index( battleindex, defNo );//ȡñߵidx + + // ֹͬӻ + //DebugMainFunction="BATTLE_Battling_47"; + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ){ + BATTLE_NoAction( battleindex, attackNo ); break; + } + //DebugMainFunction="BATTLE_Battling_48"; + if( !CHAR_CHECKINDEX( def_index ) ) break; + //DebugMainFunction="BATTLE_Battling_49"; + if( PROFESSION_BATTLE_StatusAttackCheck( charaindex, def_index, CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM5), CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM7) ) ) + CHAR_setWorkInt( def_index, StatusTbl[CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM5)], CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM6));//趨 + //DebugMainFunction="BATTLE_Battling_50"; + } + + case BATTLE_COM_S_GUARDIAN_ATTACK: + case BATTLE_COM_S_RENZOKU: +#ifdef _BATTLE_ATTCRAZED // ANDY + case BATTLE_COM_S_ATTCRAZED: +#endif +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + case BATTLE_COM_S_ATTSHOOT: +#endif +#ifdef _SKILL_WILDVIOLENT_ATT + case BATTLE_COM_S_WILDVIOLENTATTACK://񱩹 vincent add 2002/05/16 +#endif + +#ifdef _SKILL_SPEEDY_ATT + case BATTLE_COM_S_SPEEDYATTACK: //ٹ vincent add 2002/05/20 +#endif + case BATTLE_COM_ATTACK: +#ifdef _PET_SKILL_SARS // WON ADD ɷ + case BATTLE_COM_S_SARS: +#endif + +#ifdef _PETSKILL_BECOMEFOX + case BATTLE_COM_S_BECOMEFOX: +#endif + +#ifdef _PETSKILL_BECOMEPIG + case BATTLE_COM_S_BECOMEPIG: +#endif + +#ifdef _PETSKILL_SHOWMERCY + case BATTLE_COM_S_SHOWMERCY: +#endif + +#ifdef _PETSKILL_GYRATE + case BATTLE_COM_S_GYRATE: + if( COM == BATTLE_COM_S_GYRATE ){ + int i,j=0,f_num,temp[5]={0}; + char szWork[256]; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + if(defNo < 5) + f_num = 0; + else if(defNo >=5 && defNo < 10) + f_num = 5; + else if(defNo >=10 && defNo < 15) + f_num = 10; + else + f_num = 15; + + // ȡսϴ + for( i=f_num; i= 10 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_75"; + defNo = aDefList[0]; + }else + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 + || defNo == attackNo){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_76"; + if( COM == BATTLE_COM_S_EARTHROUND0 ){ + sprintf( szWork, "BI|a%X|", attackNo ); + //DebugMainFunction="BATTLE_Battling_77"; + }else { +#ifdef _FIXBUG_ATTACKBOW + if( CHAR_getWorkInt( charaindex, CHAR_WORKITEMMETAMO) > 0 || + CHAR_getWorkInt( charaindex, CHAR_WORKNPCMETAMO) > 0 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС + + if( gWeponType == ITEM_BOW || gWeponType == ITEM_BOUNDTHROW || + gWeponType == ITEM_BREAKTHROW || gWeponType == ITEM_BOOMERANG) { + CHAR_talkToCli( charaindex, -1, "޷ʹԶ!!", CHAR_COLORYELLOW); + continue; + } + + } +#endif + //DebugMainFunction="BATTLE_Battling_78"; + if( gWeponType == ITEM_BOW ) sprintf( szWork, "BB|a%X|w0|", attackNo ); + else if( gWeponType == ITEM_BOUNDTHROW ) //Ƕͷ + sprintf( szWork, "BB|a%X|w1|", attackNo ); + else if( gWeponType == ITEM_BREAKTHROW ) + sprintf( szWork, "BB|a%X|w2|", attackNo ); + else sprintf( szWork, "BH|a%X|", attackNo ); + //DebugMainFunction="BATTLE_Battling_79"; + } + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( COM == BATTLE_COM_S_ATTSHOOT ) + sprintf( szWork, "BB|a%X|w0|", attackNo ); +#endif + //DebugMainFunction="BATTLE_Battling_80"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_81"; + if( COM == BATTLE_COM_S_CHARGE_OK || + COM == BATTLE_COM_S_EARTHROUND0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + }else{ + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( CHAR_getWorkInt(charaindex, CHAR_WORKBATTLECOM1) != BATTLE_COM_S_ATTSHOOT) +#endif +#ifdef _PETSKILL_SHOWMERCY + if( CHAR_getWorkInt(charaindex, CHAR_WORKBATTLECOM1) != BATTLE_COM_S_SHOWMERCY) +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1,BATTLE_COM_ATTACK ); + } + for( attack_count = 0, k = 0;; ){ + if( gWeponType == ITEM_BOW ){ + if( BATTLE_TargetCheck( battleindex, defNo ) == FALSE ){ + attack_flg = 0; + }else{ + attack_flg = 1; + } + } + + + if( attack_flg ){ + + + ContFlg = BATTLE_Attack( battleindex, attackNo, defNo ); +#ifdef _PETSKILL_RETRACE + if( Battle_Attack_ReturnData_x.Battle_Attack_ReturnData == BATTLE_RET_DODGE + && COM == BATTLE_COM_S_RETRACE ){ + if( RAND(1,100) < 80 ){ //80%ʷ2ι + //+20% + + CHAR_setWorkInt( BATTLE_No2Index( battleindex, attackNo ), + CHAR_WORKATTACKPOWER, + ( CHAR_getWorkInt( BATTLE_No2Index( battleindex, attackNo ), CHAR_WORKFIXSTR) + ( CHAR_getWorkInt( BATTLE_No2Index( battleindex, attackNo ), CHAR_WORKFIXSTR) * 0.2 ) ) ); + //DebugMainFunction="BATTLE_Battling_82"; + BATTLE_Attack( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_83"; + } + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = 0; + } +#endif + //DebugMainFunction="BATTLE_Battling_84"; + BATTLE_AddProfit( battleindex, aAttackList); + //DebugMainFunction="BATTLE_Battling_85"; + if( ++attack_count >= attack_max ) break; + if( CHAR_getInt( charaindex, CHAR_HP ) <= 0 ) { + ContFlg = FALSE; + break; + } + } + defNo = aDefList[++k]; + if( defNo < 0 ) break; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, defNo ); + if( gWeponType == ITEM_BOW ){ + }else + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + break; + } + if( BATTLE_CountAlive( battleindex, 0) == 0 || BATTLE_CountAlive( battleindex, 1) == 0) { + break; + } + } + gBattleDamageModyfy = 1.0; + gBattleDuckModyfy = 0; + + for( k = 0; k < 5 && ContFlg == TRUE; k ++ ){ + if( ( k & 1 ) == 1 ){ + attackNoSub = attackNo; + defNoSub = defNo; + }else{ + defNoSub = attackNo; + attackNoSub = defNo; + } + //DebugMainFunction="BATTLE_Battling_86"; + ContFlg = BATTLE_Counter(battleindex, attackNoSub, defNoSub ); + //DebugMainFunction="BATTLE_Battling_87"; + aAttackList[0] = attackNoSub; + aAttackList[1] = -1; + BATTLE_AddProfit( battleindex, aAttackList); + //DebugMainFunction="BATTLE_Battling_88"; + } + aAttackList[0] = -1; + //DebugMainFunction="BATTLE_Battling_89"; + BATTLESTR_ADD( "FF|" ); + //DebugMainFunction="BATTLE_Battling_90"; + +#ifdef _PETSKILL_BECOMEFOX // ԷʹĻ + if ( (COM == BATTLE_COM_S_BECOMEFOX ) + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_MISS) //ûmiss + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_DODGE) //ûܹ + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_ALLGUARD) + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_ARRANGE) + && (BATTLE_TargetCheck( battleindex, defNo )) // + && (rand()%100 < 31) + && (CHAR_getInt( BATTLE_No2Index( battleindex, defNo ), CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER) //ֻг(CHAR_TYPEPET)ſԱĻ + && (CHAR_getWorkInt( BATTLE_No2Index( battleindex, defNo ), CHAR_WORK_PETFLG ) != 0 ) +#ifdef _PETSKILL_BECOMEPIG + && (CHAR_getInt( charaindex, CHAR_BECOMEPIG) == -1)//ûд +#endif + ) + { + int ToList[SIDE_OFFSET*2+1]; + int defindex = BATTLE_No2Index( battleindex, defNo ); + //DebugMainFunction="BATTLE_Battling_91"; + BATTLE_MultiList( battleindex, defNo, ToList ); + //DebugMainFunction="BATTLE_Battling_92"; + BATTLE_MagicEffect( battleindex, defNo, ToList, 101120, 101750); + //DebugMainFunction="BATTLE_Battling_93"; + + CHAR_setWorkInt( defindex, CHAR_WORKFOXROUND, pBattle->turn ); + + if( CHAR_getInt( defindex, CHAR_RIDEPET) != -1 ) { //Ҫ + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + //DebugMainFunction="BATTLE_Battling_94"; + BATTLE_changeRideImage( defindex ); + //DebugMainFunction="BATTLE_Battling_95"; + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + } + + CHAR_setInt( defindex, CHAR_BASEIMAGENUMBER, 101749); + } +#endif + //DebugMainFunction="BATTLE_Battling_96"; +#ifdef _PETSKILL_BECOMEPIG // Էʹ + if ( (COM == BATTLE_COM_S_BECOMEPIG ) + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_MISS) //ûmiss + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_DODGE) //ûܹ + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_ALLGUARD) + && (Battle_Attack_ReturnData_x.Battle_Attack_ReturnData != BATTLE_RET_ARRANGE) + && (BATTLE_TargetCheck( battleindex, defNo )) // + && (CHAR_getInt( BATTLE_No2Index( battleindex, defNo ), CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) //ֻҲſԱ + && (BATTLE_CheckSameSide( charaindex, defNo) != 1 ) // ֹͬӻ + && CHAR_getInt( BATTLE_No2Index( battleindex, defNo ), CHAR_BECOMEPIG) < 2000000000 ) //ֹƱ + { + char temp[64]; + int ToList[SIDE_OFFSET*2+1], compute,petrate,pettime,pigbbi=100250; + char *pszOption=NULL; + //DebugMainFunction="BATTLE_Battling_97"; + int defindex = BATTLE_No2Index( battleindex, defNo ); + //DebugMainFunction="BATTLE_Battling_98"; + pszOption = PETSKILL_getChar( CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ), PETSKILL_OPTION ); + //DebugMainFunction="BATTLE_Battling_99"; + if( pszOption == "\0") + sscanf( pszOption, "%d %d %d", &petrate, &pettime, &pigbbi); + else + petrate = 100, pettime = 60, pigbbi = 100250; + //DebugMainFunction="BATTLE_Battling_100"; + if( rand()%100 < petrate ){ + CHAR_setWorkInt( defindex, CHAR_WORKITEMMETAMO, 0);//߱ȡ + CHAR_setWorkInt( defindex, CHAR_WORKNPCMETAMO, 0 );//NPCȡ + CHAR_setWorkInt( defindex, CHAR_WORKFOXROUND, -1);//Ļȡ + //DebugMainFunction="BATTLE_Battling_101"; + BATTLE_MultiList( battleindex, defNo, ToList ); + //DebugMainFunction="BATTLE_Battling_102"; + BATTLE_MagicEffect( battleindex, defNo, ToList, 101120, 101750); + //DebugMainFunction="BATTLE_Battling_103"; + if( CHAR_getInt( defindex, CHAR_RIDEPET) != -1 ){ //Ҫ + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + //DebugMainFunction="BATTLE_Battling_104"; + BATTLE_changeRideImage( defindex ); + //DebugMainFunction="BATTLE_Battling_105"; + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + } + + CHAR_setInt( defindex, CHAR_BECOMEPIG_BBI, pigbbi ); + + compute = CHAR_getInt( defindex, CHAR_BECOMEPIG); + CHAR_setInt( defindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( defindex, CHAR_BECOMEPIG_BBI ) ); + if( compute == -1 )//һ + CHAR_setInt( defindex, CHAR_BECOMEPIG, pettime + 1 + compute ); //ʱ(λ:) + else + CHAR_setInt( defindex, CHAR_BECOMEPIG, pettime + compute ); + sprintf(temp, "ʱ:%d", CHAR_getInt( defindex, CHAR_BECOMEPIG) ); + CHAR_talkToCli( defindex, -1, temp, CHAR_COLORYELLOW); + //DebugMainFunction="BATTLE_Battling_106"; + //print("\nʼ0:%s,round:%d", CHAR_getChar( defindex, CHAR_NAME), CHAR_getWorkInt( defindex, CHAR_WORKFOXROUND)); + } + } +#endif + break; +//´⹥ + case BATTLE_COM_BOOMERANG: + gBattleDamageModyfy = 0.3; + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_107"; + if( defNo < 0 ){ + defNo = BATTLE_DefaultAttacker( battleindex, 1 - myside ); + } + //DebugMainFunction="BATTLE_Battling_108"; + if( 0 <= defNo && defNo <= 19 ){ + defNo /= 5; // + }else{ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_109"; + if( (int)(attackNo / 5 ) == defNo ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_110"; + { + int *pBoomerangTbl = BoomerangVsTbl[defNo]; + for( k = 0; k < 5; k ++ ){ + if( BATTLE_TargetCheck( battleindex, pBoomerangTbl[k] ) == FALSE ){ + continue; + }else{ + break; + } + } + //DebugMainFunction="BATTLE_Battling_111"; + if( k == 5 ){ + defNo = BATTLE_DefaultAttacker( battleindex, 1 - myside ); + if( 0 <= defNo && defNo <= 19 ){ + defNo /= 5; + }else{ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + } + //DebugMainFunction="BATTLE_Battling_112"; + } + sprintf( szWork, "BO|a%X|", attackNo ); + //DebugMainFunction="BATTLE_Battling_113"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_114"; + { + //DebugMainFunction="BATTLE_Battling_115"; + int *pBoomerangTbl = BoomerangVsTbl[defNo]; + //DebugMainFunction="BATTLE_Battling_116"; + if( myside == 1 ){ + k = 4; j = -1; + }else{ + k = 0; j = 1; + } + for( ; ; k += j ){ + if( j > 0 && k > 4 )break; + if( j < 0 && k < 0 )break; + defNo = pBoomerangTbl[k]; + if( BATTLE_TargetCheck( battleindex, defNo ) == FALSE ){ + continue; + } + BATTLE_Attack( battleindex, attackNo, defNo ); + } + } + gBattleDamageModyfy = 1.0; + gBattleDuckModyfy = 0; + //DebugMainFunction="BATTLE_Battling_117"; + BATTLESTR_ADD( "FF|" ); + //DebugMainFunction="BATTLE_Battling_118"; + break; + + //--------------------------------------------- + case BATTLE_COM_CAPTURE: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_119"; + BATTLE_Capture( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_120"; + break; + + //--------------------------------------------- +#ifdef _VARY_WOLF + case BATTLE_COM_S_VARY: + { + int ToList[SIDE_OFFSET*2+1]; + int bk_amn = 0; + + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + bk_amn = (CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER) + 5) + (myside*4); + //DebugMainFunction="BATTLE_Battling_121"; + BATTLE_MultiList( battleindex, defNo, ToList ); + //DebugMainFunction="BATTLE_Battling_122"; + BATTLE_MagicEffect( battleindex, attackNo, ToList, 101120, bk_amn); + //DebugMainFunction="BATTLE_Battling_123"; + } + break; +#endif + case BATTLE_COM_GUARD: + //DebugMainFunction="BATTLE_Battling_124"; + BATTLE_Guard( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_125"; + + break; + case BATTLE_COM_ESCAPE: + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPET ){ + if (BATTLE_Escape(battleindex, attackNo, 0) == TRUE) + { + if (CHAR_getWorkInt(charaindex, CHAR_WORKFMPKFLAG) == 1) + CHAR_setWorkInt(charaindex, CHAR_WORKFMPKFLAG, -1); + } + } + break; + case BATTLE_COM_COMPELESCAPE: //ǿ뿪 + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPET ){ + //DebugMainFunction="BATTLE_Battling_126"; + BATTLE_Escape( battleindex, attackNo, 1); + //DebugMainFunction="BATTLE_Battling_127"; + if (CHAR_getWorkInt(charaindex, CHAR_WORKFMPKFLAG) == 1) + CHAR_setWorkInt(charaindex, CHAR_WORKFMPKFLAG, -1); + } + break; + + case BATTLE_COM_PETIN: + if( CHAR_getInt( charaindex, CHAR_DEFAULTPET ) == -1 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + { + char szWork[256]; + //DebugMainFunction="BATTLE_Battling_128"; + snprintf( szWork, sizeof( szWork ), "K%d", CHAR_getInt( charaindex, CHAR_DEFAULTPET ) ); + //DebugMainFunction="BATTLE_Battling_129"; + CHAR_sendStatusString( charaindex, szWork ); + //DebugMainFunction="BATTLE_Battling_130"; + + } + //DebugMainFunction="BATTLE_Battling_131"; + BATTLE_PetIn( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_132"; + lssproto_KS_send( + getfdFromCharaIndex( charaindex ), + CHAR_getInt( charaindex, CHAR_DEFAULTPET ), 1 ); + break; + case BATTLE_COM_PETOUT: + if( CHAR_getInt( charaindex, CHAR_DEFAULTPET ) != -1 ){ + lssproto_KS_send( + getfdFromCharaIndex( charaindex ), + CHAR_getInt( charaindex, CHAR_DEFAULTPET ), 1 ); + { + char szWork[256]; + snprintf( szWork, sizeof( szWork ), "K%d", CHAR_getInt( charaindex, CHAR_DEFAULTPET ) ); + CHAR_sendStatusString( charaindex, szWork ); + + } + //DebugMainFunction="BATTLE_Battling_133"; + BATTLE_PetIn( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_134"; + } + // shan 2002/01/14 Begin ֻ + { + int attackindex, petNo; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + petNo = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM2 ); +#ifdef _TRANS_7_COLOR //CFǷٻ + if( getpetsummon() == 0 ){ + + if( CHAR_getWorkInt(charaindex, CHAR_WORK_PET0_STAT+petNo) != PET_STAT_SELECT) + break; + } +#endif +/* //CAX +#ifndef _PET_STANDBY + if( CHAR_getWorkInt(charaindex, CHAR_WORK_PET0_STAT+petNo) != PET_STAT_SELECT) + break; +#endif +*/ + } + //DebugMainFunction="BATTLE_Battling_135"; + // shan End + BATTLE_PetOut( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_136"; + lssproto_KS_send( + getfdFromCharaIndex( charaindex ), + CHAR_getInt( charaindex, CHAR_DEFAULTPET ), 1 ); + break; +// Terry add 2001/11/05 +#ifdef _ATTACK_MAGIC + case BATTLE_COM_S_ATTACK_MAGIC: // ħ + magic = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + toindex = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); +// print("magic->%d,toindex->%d\n",magic,toindex); + // жϹ Χ + //DebugMainFunction="BATTLE_Battling_137"; + for(magic_count=0;magic_count= 0 && toindex <= 4) + toindex = TargetIndex[magic_count][1]; + // µǰһ + else + toindex = TargetIndex[magic_count][1]-1; + } + break; + } + } + //DebugMainFunction="BATTLE_Battling_138"; +// print("toindex->%d\n",toindex); + MAGIC_DirectUse(charaindex,magic,toindex,CHAR_GETWORKINT_HIGH(charaindex,CHAR_WORKBATTLECOM3)); + //DebugMainFunction="BATTLE_Battling_139"; + BATTLE_AddProfit( battleindex, aAttackList ); + //DebugMainFunction="BATTLE_Battling_140"; + break; +#endif + case BATTLE_COM_JYUJYUTU: + //DebugMainFunction="BATTLE_Battling_141"; + MAGIC_DirectUse( + charaindex, + CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ), + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ), + CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ) + ); + //DebugMainFunction="BATTLE_Battling_142"; + break; + + case BATTLE_COM_ITEM: + itemindex = CHAR_getItemIndex(charaindex, CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM3 )); + if( ITEM_CHECKINDEX( itemindex ) == FALSE ){ +// print( "\nerr:Ҫʹõitemλ(%s)(%d)\n", +// CHAR_getUseName( charaindex ), CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM3 ) ); + break; + } + +#if 1 // Robin fix սɻƷ +#ifdef _BATTLE_EQUIT_OTHER + if(getBattleEquitOther()!=1) +#endif + { + int itemtype = ITEM_getInt( itemindex, ITEM_TYPE ); + if( itemtype == ITEM_HELM + || itemtype == ITEM_ARMOUR + || itemtype == ITEM_BRACELET + //|| itemtype == ITEM_MUSIC + || itemtype == ITEM_NECKLACE + || itemtype == ITEM_RING + || itemtype == ITEM_BELT + || itemtype == ITEM_EARRING + || itemtype == ITEM_NOSERING + || itemtype == ITEM_AMULET + //|| itemtype == CHAR_HEAD + ) + { + //print("\n ķ!սɻ!!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + break; + } + } +#endif + +#ifdef _FIXBUG_ATTACKBOW + { + if( CHAR_getWorkInt( charaindex, CHAR_WORKITEMMETAMO) > 0 || + CHAR_getWorkInt( charaindex, CHAR_WORKNPCMETAMO) > 0 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС + + int armtype; + int itemindex = CHAR_getItemIndex( charaindex, CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM3 )); + if( !ITEM_CHECKINDEX(itemindex) ) break; + armtype = ITEM_getInt( itemindex, ITEM_TYPE ); + + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( charaindex, -1, "޷ʹԶ", CHAR_COLORYELLOW ); + break; + } + } + } +#endif + //DebugMainFunction="BATTLE_Battling_143"; + CHAR_ItemUse(charaindex,CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ), CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM3 )); + //DebugMainFunction="BATTLE_Battling_144"; + if( ITEM_getEquipPlace( charaindex, itemindex ) == CHAR_ARM ){ + //DebugMainFunction="BATTLE_Battling_145"; + sprintf( szWork, "BN|a%X|%X|", attackNo, + CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER ) ); + //DebugMainFunction="BATTLE_Battling_146"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_147"; +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + // ר + BATTLE_ProfessionStatus_init( battleindex, charaindex ); +#endif + //DebugMainFunction="BATTLE_Battling_148"; + }else{ + } + //DebugMainFunction="BATTLE_Battling_149"; + break; + +#ifdef _PSKILL_FALLGROUND + case BATTLE_COM_S_FALLRIDE:// + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_150"; + ContFlg = BATTLE_S_FallGround( battleindex, attackNo, defNo, BATTLE_COM_S_FALLRIDE); + //DebugMainFunction="BATTLE_Battling_151"; + break; + +#endif +#ifdef _PETSKILL_TIMID + case BATTLE_COM_S_TIMID: + { + int skill; + //DebugMainFunction="BATTLE_Battling_152"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_153"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_TIMID, skill); + //DebugMainFunction="BATTLE_Battling_154"; + } + break; +#endif +#ifdef _PETSKILL_2TIMID + case BATTLE_COM_S_2TIMID: + { + int skill; + //DebugMainFunction="BATTLE_Battling_155"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_156"; + if( BATTLE_CheckSameSide( charaindex, defNo) == 1 ) { + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_157"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_2TIMID, skill); + //DebugMainFunction="BATTLE_Battling_158"; + } + break; +#endif + +#ifdef _PETSKILL_PROPERTY + case BATTLE_COM_S_PROPERTYSKILL: + { + int skill; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_159"; + BATTLE_S_PetSkillProperty( battleindex, attackNo, COM, skill); + //DebugMainFunction="BATTLE_Battling_160"; + BATTLE_NoAction( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_161"; + } + break; +#endif + +#ifdef _BATTLE_LIGHTTAKE + case BATTLE_COM_S_LIGHTTAKE: + { + int skill; + //DebugMainFunction="BATTLE_Battling_162"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_163"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_LIGHTTAKE, skill); + //DebugMainFunction="BATTLE_Battling_164"; + } + break; +#endif + +#ifdef _SKILL_DAMAGETOHP + case BATTLE_COM_S_DAMAGETOHP: //Ѫ + { + int skill; + //DebugMainFunction="BATTLE_Battling_165"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_166"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_DAMAGETOHP, skill); + //DebugMainFunction="BATTLE_Battling_167"; + } + break; +#endif + +#ifdef _PETSKILL_DAMAGETOHP + case BATTLE_COM_S_DAMAGETOHP2: //¿(Ѫı) + { + int skill,attackidxtemp; + //DebugMainFunction="BATTLE_Battling_168"; + attackidxtemp = BATTLE_No2Index( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_169"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_170"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_DAMAGETOHP2, skill); + //DebugMainFunction="BATTLE_Battling_171"; + } + break; +#endif + +#ifdef _Skill_MPDAMAGE + case BATTLE_COM_S_MPDAMAGE: //MP˺ + { + int skill; + //DebugMainFunction="BATTLE_Battling_172"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_173"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_MPDAMAGE, skill); + //DebugMainFunction="BATTLE_Battling_174"; + break; + } + break; +#endif +#ifdef _SKILL_TOOTH + case BATTLE_COM_S_TOOTHCRUSHE: + { + int skill; + //DebugMainFunction="BATTLE_Battling_175"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_176"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_TOOTHCRUSHE, skill); + //DebugMainFunction="BATTLE_Battling_177"; + break; + } + break; +#endif +#ifdef _PSKILL_MODIFY + case BATTLE_COM_S_MODIFYATT: + { + int skill; + //DebugMainFunction="BATTLE_Battling_178"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_179"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_MODIFYATT, skill); + //DebugMainFunction="BATTLE_Battling_180"; + } + break; +#endif +#ifdef _PSKILL_MDFYATTACK + case BATTLE_COM_S_MDFYATTACK: + { + int skill; + //DebugMainFunction="BATTLE_Battling_181"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_182"; + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_MDFYATTACK, skill); + //DebugMainFunction="BATTLE_Battling_183"; + } + break; +#endif + +#ifdef _PETSKILL_TEAR + case BATTLE_COM_S_PETSKILLTEAR: + { + int skill; + //DebugMainFunction="BATTLE_Battling_184"; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_185"; + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_PETSKILLTEAR, skill); + //DebugMainFunction="BATTLE_Battling_186"; + } + break; +#endif + +#ifdef _SONIC_ATTACK // WON ADD + case BATTLE_COM_S_SONIC: + { + int skill, defNo2=-1, index2=-1; + + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + + if( defNo >= 15 && defNo < 20 ) defNo2 = defNo - 5; + else if( defNo >= 5 && defNo < 10 ) defNo2 = defNo - 5; + else defNo2 = -1; + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + index2 = BATTLE_No2Index( battleindex, defNo2 ); + //DebugMainFunction="BATTLE_Battling_187"; + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_SONIC, skill ); + //DebugMainFunction="BATTLE_Battling_188"; + if( index2 >= 0 ){ + if( defNo2 >= 0 ){ + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo2, BATTLE_COM_S_SONIC2, skill ); + } + } + //DebugMainFunction="BATTLE_Battling_189"; + + } + break; +#endif + +#ifdef _PETSKILL_REGRET + case BATTLE_COM_S_REGRET: + { + int skill, defNo2=-1, index2=-1; + + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + + if( defNo >= 15 && defNo < 20 ) defNo2 = defNo - 5; + else if( defNo >= 5 && defNo < 10 ) defNo2 = defNo - 5; + else defNo2 = -1; + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + index2 = BATTLE_No2Index( battleindex, defNo2 ); + //DebugMainFunction="BATTLE_Battling_190"; + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo, BATTLE_COM_S_REGRET, skill ); + //DebugMainFunction="BATTLE_Battling_191"; + if( index2 >= 0 ){ + if( defNo2 >= 0 ){ + ContFlg = BATTLE_S_AttackDamage( battleindex, attackNo, defNo2, BATTLE_COM_S_REGRET2, skill ); + } + } + //DebugMainFunction="BATTLE_Battling_192"; + } + break; +#endif + +#ifdef _MAGIC_SUPERWALL + case BATTLE_COM_S_SUPERWALL: + { + int skill; + defNo = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_193"; + ContFlg = PETSKILL_MagicStatusChange_Battle( battleindex, attackNo, defNo, skill); + //DebugMainFunction="BATTLE_Battling_194"; + } + break; +#endif +#ifdef _PETSKILL_SETDUCK + case BATTLE_COM_S_SETDUCK: + { + int skill; + defNo = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_195"; + ContFlg = PETSKILL_SetDuckChange_Battle( battleindex, attackNo, defNo, skill); + //DebugMainFunction="BATTLE_Battling_196"; + break; + } +#endif +#ifdef _MAGICPET_SKILL + case BATTLE_COM_S_SETMAGICPET: + { + int skill; + defNo = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + skill = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_197"; + ContFlg = PETSKILL_SetMagicPet_Battle( battleindex, attackNo, defNo, skill); + //DebugMainFunction="BATTLE_Battling_198"; + break; + } +#endif +#ifdef _OFFLINE_SYSTEM + case BATTLE_COM_S_OFFLINE_RECOVERY: + { + defNo = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + int HP = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + ContFlg = OFFLINE_MultiRessurect( battleindex, attackNo, defNo, HP, 0); + break; + } +#endif +#ifdef _PRO_BATTLEENEMYSKILL + case BATTLE_COM_S_ENEMYRELIFE: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_199"; + ContFlg =BATTLE_E_ENEMYREFILE( battleindex, attackNo, defNo, BATTLE_COM_S_ENEMYRELIFE); + //DebugMainFunction="BATTLE_Battling_200"; + if( ContFlg == FALSE ) { + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + ContFlg = BATTLE_Attack( battleindex, attackNo, defNo ); + BATTLE_AddProfit( battleindex, aAttackList ); + } + //DebugMainFunction="BATTLE_Battling_201"; + BATTLE_AddProfit( battleindex, aAttackList ); + //DebugMainFunction="BATTLE_Battling_202"; + break; + + case BATTLE_COM_S_ENEMYREHP: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_203"; + ContFlg =BATTLE_E_ENEMYREHP( battleindex, attackNo, defNo, BATTLE_COM_S_ENEMYREHP); + //DebugMainFunction="BATTLE_Battling_204"; + if( ContFlg == FALSE ) { + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + ContFlg = BATTLE_Attack( battleindex, attackNo, defNo ); + BATTLE_AddProfit( battleindex, aAttackList ); + } + //DebugMainFunction="BATTLE_Battling_205"; + BATTLE_AddProfit( battleindex, aAttackList ); + //DebugMainFunction="BATTLE_Battling_206"; + break; + + case BATTLE_COM_S_ENEMYHELP: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + //print("\n BATTLE_NoAction()"); + break; + } + //DebugMainFunction="BATTLE_Battling_207"; + ContFlg =BATTLE_E_ENEMYHELP( battleindex, attackNo, defNo, BATTLE_COM_S_ENEMYREHP); + //DebugMainFunction="BATTLE_Battling_208"; + if( ContFlg == FALSE ) { + CHAR_setFlg( charaindex, CHAR_ISATTACKED, 1 ); + ContFlg = BATTLE_Attack( battleindex, attackNo, defNo ); + BATTLE_AddProfit( battleindex, aAttackList ); + } + //DebugMainFunction="BATTLE_Battling_209"; + BATTLE_AddProfit( battleindex, aAttackList ); + //DebugMainFunction="BATTLE_Battling_210"; + break; +#endif + case BATTLE_COM_S_GBREAK: //Ƴ + + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_211"; + ContFlg = BATTLE_S_GBreak( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_212"; + break; +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 + case BATTLE_COM_S_GBREAK2: + //ȷ + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_213"; + ContFlg = BATTLE_S_GBreak2( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_214"; + break; +#endif + +#ifdef _SKILL_SACRIFICE + case BATTLE_COM_S_SACRIFICE://Ԯ vincent add 2002/05/30 + //ȷ + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_215"; + ContFlg = BATTLE_S_Sacrifice( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_216"; + break; +#endif + +#ifdef _SKILL_REFRESH + case BATTLE_COM_S_REFRESH://״̬ظ vincent add 2002/08/08 + { + int array; + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); +// print("\n vincent--case BATTLE_COM_S_REFRESH:-->defNo:%d",defNo); + //DebugMainFunction="BATTLE_Battling_217"; + ContFlg = BATTLE_S_Refresh( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_218"; + } + break; +#endif + +#ifdef _SKILL_WEAKEN //vincent輼: + case BATTLE_COM_S_WEAKEN: + { + int array; + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //print("\n vincent--case BATTLE_COM_S_WEAKEN:-->defNo:%d",defNo); + //DebugMainFunction="BATTLE_Battling_219"; + ContFlg = BATTLE_S_Weaken( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_220"; + } + break; +#endif + +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 + case BATTLE_COM_S_DEEPPOISON: + { + int array; + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + // DebugMainFunction="BATTLE_Battling_221"; + ContFlg = BATTLE_S_Deeppoison( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_222"; + } + break; +#endif + +#ifdef _SKILL_BARRIER //vincent輼:ħ + case BATTLE_COM_S_BARRIER: + { + int array; + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_223"; + ContFlg = BATTLE_S_Barrier( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_224"; + } + break; +#endif + +#ifdef _SKILL_NOCAST //vincent輼:Ĭ + case BATTLE_COM_S_NOCAST: + { + int array; + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + //DebugMainFunction="BATTLE_Battling_225"; + ContFlg = BATTLE_S_Nocast( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_226"; + } + break; +#endif + +#ifdef _SKILL_ROAR //vincent輼: + case BATTLE_COM_S_ROAR: + { + int array; + //ȷ + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + array = CHAR_GETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_227"; + ContFlg = BATTLE_S_Roar( battleindex, attackNo, defNo ,array); + //DebugMainFunction="BATTLE_Battling_228"; + } + break; +#endif + case BATTLE_COM_S_ABDUCT: + { + int array; + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + array = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + //DebugMainFunction="BATTLE_Battling_229"; + BATTLE_Abduct( battleindex, attackNo, defNo, array); + //DebugMainFunction="BATTLE_Battling_230"; + } + break; + case BATTLE_COM_COMBO: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + gDamageDiv = 1.0; + ComboId = EntryList[i].combo; + aAttackList[0] = EntryList[i].num; // + i ++; // ݼо + k = 1; + for( ; EntryList[i].combo == ComboId && i < entrynum; i ++ ){ + int charmode; + // ¾ + if( CHAR_CHECKINDEX( EntryList[i].charaindex ) == FALSE )continue; + + // 帨ƻئݳ + charmode = CHAR_getWorkInt( EntryList[i].charaindex, CHAR_WORKBATTLEMODE ); + if( charmode == 0 || charmode == BATTLE_CHARMODE_FINAL ){ + continue; + } + + // ټ + //DebugMainFunction="BATTLE_Battling_231"; + BATTLE_StatusSeq( EntryList[i].charaindex ); + //DebugMainFunction="BATTLE_Battling_232"; +#ifdef _OTHER_MAGICSTAUTS + BATTLE_MagicStatusSeq( EntryList[i].charaindex ); +#endif + //DebugMainFunction="BATTLE_Battling_233"; + // ئ + if( BATTLE_CanMoveCheck( EntryList[i].charaindex ) == FALSE ){ + continue; + } + if( CHAR_getInt( EntryList[i].charaindex, CHAR_HP ) <= 0 ){ + continue; + } + aAttackList[k++] = EntryList[i].num; + } + aAttackList[k] = -1; + i--; + if( k == 1 ){ + //print( "\nerr:һcombo bug\n" ); + } + //DebugMainFunction="BATTLE_Battling_234"; + sprintf( szWork, "BY|r%X|", defNo ); + //DebugMainFunction="BATTLE_Battling_235"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_236"; + BATTLE_Combo( battleindex, aAttackList, defNo ); + //DebugMainFunction="BATTLE_Battling_237"; +#ifdef _Item_ReLifeAct + BATTLE_AddProfit( battleindex, aAttackList ); +#endif + //DebugMainFunction="BATTLE_Battling_238"; + // FF ëȹ + BATTLESTR_ADD( "FF|" ); + //DebugMainFunction="BATTLE_Battling_239"; + break; + + //--------------------------------------------- + case BATTLE_COM_WAIT: + case BATTLE_COM_NONE: + BATTLE_NoAction( battleindex, attackNo ); + break; + + //--------------------------------------------- + case BATTLE_COM_S_EARTHROUND1: + //DebugMainFunction="BATTLE_Battling_240"; + BATTLE_EarthRoundHide( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_241"; + break; + + //--------------------------------------------- + case BATTLE_COM_S_LOSTESCAPE: + //DebugMainFunction="BATTLE_Battling_242"; + BATTLE_LostEscape( battleindex, attackNo ); + //DebugMainFunction="BATTLE_Battling_243"; + break; + + case BATTLE_COM_S_STEAL: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_244"; + BATTLE_Steal( battleindex, attackNo, defNo ); + //DebugMainFunction="BATTLE_Battling_245"; + break; + +#ifdef _BATTLESTEAL_FIX + case BATTLE_COM_S_STEALMONEY: + if( (defNo = BATTLE_TargetAdjust( battleindex, charaindex, myside )) < 0 ){ + BATTLE_NoAction( battleindex, attackNo ); + break; + } + //DebugMainFunction="BATTLE_Battling_246"; + BATTLE_StealMoney( battleindex, attackNo, defNo) ; + //DebugMainFunction="BATTLE_Battling_247"; + break; +#endif + case BATTLE_COM_S_NOGUARD: + BATTLE_NoAction( battleindex, attackNo ); + break; + case BATTLE_COM_S_CHARGE: + //DebugMainFunction="BATTLE_Battling_248"; + sprintf( szWork, "bt|%x|", attackNo ); + //DebugMainFunction="BATTLE_Battling_249"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_250"; + break; +#ifdef _PETSKILL_LER + case BATTLE_COM_S_BAT_FLY: + { + if((defNo = BATTLE_TargetAdjust(battleindex,charaindex,myside)) < 0){ + BATTLE_NoAction(battleindex,attackNo); + break; + } + //DebugMainFunction="BATTLE_Battling_251"; + BATTLE_BatFly(battleindex,attackNo,myside); + //DebugMainFunction="BATTLE_Battling_252"; + } + break; + case BATTLE_COM_S_DIVIDE_ATTACK: + { + if((defNo = BATTLE_TargetAdjust(battleindex,charaindex,myside)) < 0){ + BATTLE_NoAction(battleindex,attackNo); + break; + } + //DebugMainFunction="BATTLE_Battling_253"; + BATTLE_DivideAttack(battleindex,attackNo,myside); + //DebugMainFunction="BATTLE_Battling_254"; + } + break; +#endif +#ifdef _PETSKILL_BATTLE_MODEL + case BATTLE_COM_S_BATTLE_MODEL: + //DebugMainFunction="BATTLE_Battling_255"; + BATTLE_BattleModel(battleindex,attackNo,myside); + //DebugMainFunction="BATTLE_Battling_256"; + break; +#endif + //--------------------------------------------- + default: + //print( "\nerr:ֵ(%d:%d:%s)\n", charaindex, COM, + //CHAR_getUseName( charaindex ) ); + //DebugMainFunction="BATTLE_Battling_257"; + sprintf( szWork, "bg|%x|", attackNo ); + //DebugMainFunction="BATTLE_Battling_258"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_259"; + break; + } +#ifdef _VARY_WOLF + if(CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101428) + { + if(CHAR_getWorkInt( charaindex, CHAR_WORKTURN)==0) + CHAR_setWorkInt( charaindex, CHAR_WORKTURN, 1); + else + CHAR_setWorkInt( charaindex, CHAR_WORKTURN, CHAR_getWorkInt( charaindex, CHAR_WORKTURN)+1); + + if(CHAR_getWorkInt( charaindex, CHAR_WORKTURN)>5) + { + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER)); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)); + CHAR_setWorkInt( charaindex, CHAR_WORKTURN, 0); + } + } +#endif + if(CHAR_getWorkInt(charaindex,CHAR_WORKPETSKILLBT)==1){ + CHAR_setWorkInt(charaindex,CHAR_WORKPETSKILLBT,0); + } +//#ifdef _PETSKILL_NONO_FIX +// if(CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)==1 && CHAR_getInt(charaindex,CHAR_WHICHTYPE)==CHAR_TYPEPET){ +// CHAR_setWorkInt(charaindex,CHAR_WORKLISTPAGE,0); +// } +//#endif +#ifdef _WARNPC_CTRL + if(CHAR_getWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME)>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep = mktime(p); + if(CHAR_getWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME)>=timep){ + CHAR_talkToCli( charaindex,-1,"ս",CHAR_COLORYELLOW); + CONNECT_setCloseRequest( getfdFromCharaIndex( charaindex ) , 1 ); + //CONNECT_endOne_debug(getfdFromCharaIndex(charaindex)); + //CHAR_setInt(charaindex,CHAR_MP,0); + } + if(CHAR_getWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME)==1) + CHAR_setWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME,timep+CHAR_getWorkInt(charaindex,CHAR_WORKNPCENEMYTIME)); + else + CHAR_setWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME,0); + } +#endif +#ifdef _PETSKILL_BECOMEFOX // жĻǷѵָĻغ + //if(CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749) //ͼжϵĻ,˱ʱ,ᱻԶĻȥ + if( CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ) //DZС + { + if(CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)!=101749) + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, 101749 ); + + if(pBattle->turn - CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND) > 2) + { + int defNo = BATTLE_Index2No( battleindex, charaindex ); + int toNo = defNo - 5;//˵ı + //print("\nظ:%s,round:%d", CHAR_getChar( charaindex, CHAR_NAME), CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND)); + + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER)); + + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)); + CHAR_setWorkInt( charaindex, CHAR_WORKFOXROUND, -1); + + //Change fix ظļ + //DebugMainFunction="BATTLE_Battling_260"; + sprintf( szWork, "W%d", CHAR_getInt( BATTLE_No2Index( battleindex, toNo ), CHAR_DEFAULTPET ) ); + //DebugMainFunction="BATTLE_Battling_261"; + CHAR_sendStatusString( BATTLE_No2Index( battleindex, toNo ), szWork ); + //DebugMainFunction="BATTLE_Battling_262"; + } + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 + && (CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) ) + { + char pigbuffer[128]; + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BECOMEPIG_BBI ) ); + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > 0 ){ + sprintf(pigbuffer, "ʱ:%d", CHAR_getInt( charaindex, CHAR_BECOMEPIG )); + CHAR_talkToCli( charaindex,-1,pigbuffer,CHAR_COLORWHITE); + } + else{ + sprintf(pigbuffer, " ʱ뿪սɽ:%d ", CHAR_getInt( charaindex, CHAR_BECOMEPIG )); + CHAR_talkToCli( charaindex,-1,pigbuffer,CHAR_COLORWHITE); + } + } +#endif + +#ifdef _PROFESSION_ADDSKILL + { +/* for(i=0;i<20;i++){ + if( pBattle->ice_use[i] ){//׼ + print("\n׼"); + if( pBattle->ice_bout[i] > 0 ){// + print("\n"); + if( --pBattle->ice_bout[i] == 0 ){//ű + print("\nű"); + pBattle->ice_use[i] = FALSE; + if( CHAR_CHECKINDEX(pBattle->ice_charaindex[i]) ){ + int battlecom = CHAR_getWorkInt( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM1 ); + print("\n"); + print("\nbattlecom:%d",battlecom); + CHAR_setWorkInt( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM1, BATTLE_COM_S_ICE_CRACK ); + CHAR_SETWORKINT_HIGH( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM3, pBattle->ice_level[i] ); + CHAR_setWorkInt( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM2, pBattle->ice_toNo[i] ); + CHAR_SETWORKINT_HIGH( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM3, pBattle->ice_level[i] ); + CHAR_SETWORKINT_LOW( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM3, pBattle->ice_array[i] ); + battle_profession_attack_magic_fun(battleindex, pBattle->ice_attackNo[i], pBattle->ice_toNo[i], pBattle->ice_charaindex[i]); + CHAR_setWorkInt( pBattle->ice_charaindex[i], CHAR_WORKBATTLECOM1, battlecom ); + } + } + } + } + }*/ + } + { + int earth_boundary = GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY ) ); + int water_boundary = GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY ) ); + int fire_boundary = GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY ) ); + int wind_boundary = GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY ) ); + int boundary_turn=0; + BOOL boundaryclear = FALSE; + if( earth_boundary > 0 ){//ؽ + //DebugMainFunction="BATTLE_Battling_263"; + boundary_turn = GETLOWVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY ) ) - 1; + //DebugMainFunction="BATTLE_Battling_264"; +// print("\n:%d ",boundary_turn ); + if( boundary_turn <= -1 ) + CHAR_setWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY, 0 ),boundaryclear = TRUE; + else + CHAR_setWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY, MAKE2VALUE(earth_boundary,boundary_turn) ); + + } + if( water_boundary > 0 ){//ˮ + //DebugMainFunction="BATTLE_Battling_265"; + boundary_turn = GETLOWVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY ) ) - 1; + //DebugMainFunction="BATTLE_Battling_266"; +// print("\nˮ:%d ",boundary_turn ); + + if( boundary_turn <= -1 ) + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY, 0 ),boundaryclear = TRUE; + else + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY, MAKE2VALUE(water_boundary,boundary_turn) ); + //DebugMainFunction="BATTLE_Battling_267"; + } + if( fire_boundary > 0 ){// + //DebugMainFunction="BATTLE_Battling_268"; + boundary_turn = GETLOWVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY ) ) - 1; +// print("\n:%d ",boundary_turn ); + //DebugMainFunction="BATTLE_Battling_269"; + if( boundary_turn <= -1 ) + CHAR_setWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY, 0 ),boundaryclear = TRUE; + else + CHAR_setWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY, MAKE2VALUE(fire_boundary,boundary_turn) ); + + } + if( wind_boundary > 0 ){// + //DebugMainFunction="BATTLE_Battling_270"; + boundary_turn = GETLOWVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY ) ) - 1; +// print("\n:%d ",boundary_turn ); + //DebugMainFunction="BATTLE_Battling_271"; + if( boundary_turn <= -1 ) + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY, 0 ),boundaryclear = TRUE; + else + CHAR_setWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY, MAKE2VALUE(wind_boundary,boundary_turn) ); + //DebugMainFunction="BATTLE_Battling_272"; + } + if( GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY ) ) == 0 + && GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY ) ) == 0 + && GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY ) ) == 0 + && GETHIGHVALUE( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY ) ) == 0 + && boundaryclear ){ + int toNo = BATTLE_Index2No( battleindex, charaindex ); + if( toNo < 10 )//ҷ + snprintf( szWork, sizeof( szWork ), "Ba|%X|%X|", 0,1 ); + else + snprintf( szWork, sizeof( szWork ), "Ba|%X|%X|", 0,0 ); + //DebugMainFunction="BATTLE_Battling_273"; + BATTLESTR_ADD( szWork ); + //DebugMainFunction="BATTLE_Battling_274"; + BATTLESTR_ADD( "FF|" ); + //DebugMainFunction="BATTLE_Battling_275"; + } + } +#endif + +#ifdef _Item_ReLifeAct + { + //pEntry + int k, userindex=-1; + // if( BattleArray[ battleindex].type != BATTLE_TYPE_P_vs_P){ + for( k=0; k<20; k++) { + //DebugMainFunction="BATTLE_Battling_276"; + userindex = BATTLE_getBattleDieIndex( battleindex, k); + //DebugMainFunction="BATTLE_Battling_277"; + if( !CHAR_CHECKINDEX( userindex) ) continue; + //Change fix CHECK_ITEM_RELIFEм,ﲻ + //if( CHAR_getFlg( userindex, CHAR_ISDIE ) == FALSE ) + // continue; + if( CHAR_getInt( userindex, CHAR_HP) > 0 ) + continue; + if( CHAR_getInt( userindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + //DebugMainFunction="BATTLE_Battling_278"; + CHECK_ITEM_RELIFE( battleindex, userindex); + //DebugMainFunction="BATTLE_Battling_279"; + } +#ifdef _LOSE_FINCH_ + else if( CHAR_getInt( userindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + //DebugMainFunction="BATTLE_Battling_280"; + CHECK_PET_RELIFE( battleindex, userindex); + //DebugMainFunction="BATTLE_Battling_281"; + } +#endif + } + } +#endif + //DebugMainFunction="BATTLE_Battling_282"; + BATTLESTR_ADD( szBadStatusString ); + //DebugMainFunction="BATTLE_Battling_283"; + BATTLE_AddProfit( battleindex, aAttackList );//ȡþֵ + //DebugMainFunction="BATTLE_Battling_284"; + len = pszBattleTop - szBattleString; + if( AllSize + len >= sizeof( szAllBattleString ) - 1 ){ + // ƥ׾ئ + }else{ + //DebugMainFunction="BATTLE_Battling_285"; + memcpy( szAllBattleString+AllSize, szBattleString, len ); + //DebugMainFunction="BATTLE_Battling_286"; + szAllBattleString[AllSize+len] = 0;// NULL ë + AllSize += len; + } + //DebugMainFunction="BATTLE_Battling_287"; + if( BATTLE_CountAlive( battleindex, 0 ) == 0 || BATTLE_CountAlive( battleindex, 1 ) == 0 ) { + break; + } + //DebugMainFunction="BATTLE_Battling_288"; + } +#ifdef _PETSKILL_LER + { + register int i,dieindex; + for(i=0;i<20;i++){ + dieindex = BATTLE_getBattleDieIndex(battleindex,i); + if(!CHAR_CHECKINDEX(dieindex)) continue; + if(CHAR_getFlg(dieindex,CHAR_ISDIE) == FALSE) continue; + if(CHAR_getInt(dieindex,CHAR_HP) > 0) continue; + // ׶, + if(CHAR_getInt(dieindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(dieindex,CHAR_BASEBASEIMAGENUMBER) == 101814){ + //DebugMainFunction="BATTLE_Battling_289"; + BATTLE_LerChange(battleindex,dieindex,i); + //DebugMainFunction="BATTLE_Battling_290"; + } + } + } +#endif + + szBattleString[0] = 0; + pszBattleTop = szBattleString; + pszBattleLast = szBattleString+arraysizeof(szBattleString); + if( pBattle->field_att != BATTLE_ATTR_NONE ){ + pBattle->att_count--; + if( pBattle->att_count <= 0 ){ + pBattle->field_att = BATTLE_ATTR_NONE; + //snprintf( szBuffer, sizeof(szBuffer), + // "fieldظԡ" + //); + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + //DebugMainFunction="BATTLE_Battling_291"; + BATTLESTR_ADD( "BV|15|0|" ); + //DebugMainFunction="BATTLE_Battling_292"; + } + } + //DebugMainFunction="BATTLE_Battling_293"; + strncat( szAllBattleString, szBattleString, sizeof( szAllBattleString ) ); + //DebugMainFunction="BATTLE_Battling_294"; + for( i = 0; i < entrynum; i ++ ){ + charaindex = EntryList[i].charaindex; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_RESCUE ) + continue; + + if( BATTLE_CommandSend( charaindex, szAllBattleString ) == TRUE ){ + } + } + pWatchBattle = pBattle->pNext; + for( ; pWatchBattle ; pWatchBattle = pWatchBattle->pNext ){ + if( BATTLE_CHECKADDRESS( pWatchBattle ) == FALSE ){ + //print( "err:սbattle address(%p)\n", pWatchBattle ); + break; + } + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pWatchBattle->Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + //DebugMainFunction="BATTLE_Battling_295"; + BATTLE_CommandSend( charaindex, szAllBattleString ); + //DebugMainFunction="BATTLE_Battling_296"; + } + pWatchBattle->mode = BATTLE_MODE_WATCHAFTER; + } + //DebugMainFunction="BATTLE_Battling_297"; + return 0; +} + +#ifdef _Item_ReLifeAct +BOOL CHECK_ITEM_RELIFE( int battleindex, int toindex) +{ + int i, itemindex; + CHAR_EquipPlace ep; + typedef void (*DIERELIFEFUNC)(int,int,int); + DIERELIFEFUNC Drf; + + if( CHAR_getInt( toindex, CHAR_HP) > 0 ) + return FALSE; + +#ifdef _DUMMYDIE + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == FALSE && CHAR_getFlg( toindex, CHAR_ISDUMMYDIE ) == FALSE ) +#else + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == FALSE ) +#endif + return FALSE; + + for( i = 0 ; i < 5 ; i++ ){ + itemindex = CHAR_getItemIndex( toindex , i ); + if( !ITEM_CHECKINDEX( itemindex)) + continue; + ep = ITEM_getEquipPlace( toindex, itemindex ); + if( ep == -1 ) + continue; + Drf=(DIERELIFEFUNC)ITEM_getFunctionPointer(itemindex, ITEM_DIERELIFEFUNC); + if( Drf ) { + Drf( toindex, itemindex, i); + return TRUE; + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + if(RunItemDieReLifeEvent(toindex, itemindex, i) == TRUE) + return TRUE; + } +#endif + } + + return FALSE; + +} +#endif + +#ifdef _LOSE_FINCH_ +BOOL CHECK_PET_RELIFE( int battleindex, int petindex) +{ + int ReceveEffect=-1; + int toNo; + int attackNo=-1; + int WORK_HP=1; + int i; + struct _RePet{ + int petid; + int Effect; + int Addhp; +//Syu Mod +// }rePet[]={{1,SPR_fukkatu3,100},{-1,0,0}}; + }rePet[]={{-1,0,0}}; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) { + return FALSE; + } + if( CHAR_CHECKINDEX( petindex) == FALSE ) + return FALSE; + + if( CHAR_getFlg( petindex, CHAR_ISDIE) == FALSE ) { + //print("\n PET_RELIFE:[ %d, CHAR_ISDIE FALSE] return !", petindex); + return FALSE; + } + if( CHAR_getWorkInt( petindex, CHAR_WORKSPETRELIFE) != 0 ) + return FALSE; + for( i=0;iskill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( skill_level >= 6 ) add_practice = (skill_level-5) * 3 + 10; + else add_practice = skill_level * 2; + if( add_practice > 25 ) add_practice = 25; + + add_practice += old_practice; + // Ϊold_practice=0add_practiceΪ2~25 + + CHAR_setWorkInt( charaindex, CHAR_WORK_F_PROFICIENCY, add_practice ); + + }else + // + if( (strcmp( skill_name , "PROFESSION_ICE_PRACTICE" )) == 0 ){ + int old_practice = CHAR_getInt( charaindex, PROFESSION_ICE_P ); + int add_practice = 0; + int skill_level = 0; + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( skill_level >= 6 ) add_practice = (skill_level-5) * 3 + 10; + else add_practice = skill_level * 2; + if( add_practice > 25 ) add_practice = 25; + + add_practice += old_practice; + + CHAR_setWorkInt( charaindex, CHAR_WORK_I_PROFICIENCY, add_practice ); + + }else + // + if( (strcmp( skill_name , "PROFESSION_THUNDER_PRACTICE" )) == 0 ){ + int old_practice = CHAR_getInt( charaindex, PROFESSION_THUNDER_P ); + int add_practice = 0; + int skill_level = 0; + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( skill_level >= 6 ) add_practice = (skill_level-5) * 3 + 10; + else add_practice = skill_level * 2; + if( add_practice > 25 ) add_practice = 25; + + add_practice += old_practice; + + CHAR_setWorkInt( charaindex, CHAR_WORK_T_PROFICIENCY, add_practice ); + + }else + // ر + if( (strcmp( skill_name , "PROFESSION_AVOID" )) == 0 ){ + int skill_level = 0; + + if( profession_class != PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS) ) return; + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + if( skill_level <=5 ) + value = skill_level * 2; + else + value = (skill_level-5) * 3; + if( value > 25 ) value = 25; + + CHAR_setWorkInt( charaindex, CHAR_WORK_P_DUCK, 1); + CHAR_setWorkInt( charaindex, CHAR_WORKMOD_P_DUCK, value ); + + }else + // + if( (strcmp( skill_name , "PROFESSION_DEFLECT" )) == 0 ){ + int skill_level = 0; + int old_value = 0, add_value = 0; + + if( profession_class != PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS) ) return; + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + old_value = CHAR_getWorkInt( charaindex, CHAR_WORKFIXARRANGE ); + add_value = old_value + skill_level + 10; + + CHAR_setWorkInt( charaindex, CHAR_WORKFIXARRANGE, add_value ); + CHAR_complianceParameter( charaindex ); + + }else + // ר + if( (strcmp( skill_name , "PROFESSION_WEAPON_FOCUS" )) == 0 ){ + int skill_level = 0; + + rate = 0; + if( profession_class != PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS) ) continue; + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + // ܲ + pszOption = PROFESSION_SKILL_getChar( Pskillid, PROFESSION_SKILL_OPTION); + if( pszOption == "\0" ) continue; + + // װ + WeaponType = BATTLE_GetWepon( charaindex ); + + switch( WeaponType ){ + case ITEM_AXE: + if( (pszP=strstr( pszOption, "" ))!=NULL) rate = 1; break; + case ITEM_CLUB: + if( (pszP=strstr( pszOption, "" ))!=NULL) rate = 1; break; + case ITEM_SPEAR: + if( (pszP=strstr( pszOption, "ǹ" ))!=NULL) rate = 1; break; + case ITEM_BOW: + if( (pszP=strstr( pszOption, "" ))!=NULL) rate = 1; break; + case ITEM_BOOMERANG: // + if( (pszP=strstr( pszOption, "" ))!=NULL) rate = 1; break; + case ITEM_BOUNDTHROW: // Ͷͷ + if( (pszP=strstr( pszOption, "Ͷ" ))!=NULL) rate = 1; break; + case ITEM_BREAKTHROW: // Ͷʯ + if( (pszP=strstr( pszOption, "ʯ" ))!=NULL) rate = 1; break; + default: rate = 0; break; + } + + if( rate == 1 ){ + old_value = CHAR_getWorkInt( charaindex, CHAR_MYSKILLSTRPOWER); + + if( skill_level <=5 ) + value = skill_level * 2 + old_value; + else + value = (skill_level-5) * 3 + 10 + old_value; + + if( value > 25 ) value = 25; + + CHAR_setWorkInt( charaindex, CHAR_WORK_WEAPON, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKMOD_WEAPON, value ); + } + } + } + } + return; +} + + +void BATTLE_ProfessionStatusSeq( int battleindex, int charaindex ) +{ + int profession_class=0, i=0, j=0, Pskillid=-1, skillid=-1; + int skill_level=0, value=0, old_value=0; + int bid=-1, hp=0, flag=0; + char *skill_name, szcommand[256]; + CHAR_HaveSkill* hskill; + + + int status_table[9]={ 2, // + 3, //˯ + 4, //ʯ + 12, //ѣ + 13, // + 14, // + 15, // + 17, // + 23, }; //׸ + +#ifdef _PETSKILL_DAMAGETOHP +/* { + char msg[32]={0}; + int pet,pindex; + pet = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + if( pet >= 0 ){ + sprintf( msg, "o%d", pet ); + //if(CHAR_getInt( petindex, CHAR_PETID) == "" //ID + // && CHAR_getInt( petindex, CHAR_HP) ) + CHAR_sendStatusString( charaindex, msg ); + pindex = CHAR_getCharPet( charaindex, pet ); + print("\n:%s",CHAR_getChar( pindex, CHAR_NAME)); + } + else + print("\޳"); + + } */ +#endif + + if ( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + profession_class=CHAR_getInt( charaindex, PROFESSION_CLASS); + if( profession_class <= PROFESSION_CLASS_NONE ) return; + + for( i=0; i 0 ){ + flag=1; + break; + } + } + + if( flag > 0 ){ + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + value = skill_level * 2; + if( value > 20 ) value = 20; + + old_value = CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP); + + value = old_value * value / 100 ; + + hp = CHAR_getInt( charaindex, CHAR_HP); + + if( value + hp > old_value ) + value = old_value - hp; + + if( value < 0 ) value = 0; + + CHAR_setInt( charaindex, CHAR_HP, value + hp ); + + bid = BATTLE_Index2No( battleindex, charaindex ); + sprintf( szcommand, "BD|r%X|0|1|%X|", bid, value ); + BATTLESTR_ADD( szcommand ); + + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_REBACK" ); + } + } + + // + if( (strcmp( skill_name , "PROFESSION_TRAP" )) == 0 ){ + int count=0; + + count = CHAR_getWorkInt( charaindex, CHAR_WORKTRAP); + if( count > 0 ){ + count--; + CHAR_setWorkInt( charaindex, CHAR_WORKTRAP, count ); + }else if( count == 0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKMODTRAP, 0 ); + } + } + } + + return; +} + +#endif + +#ifdef _FM_NPC_LOOK_WAR +int SearchFmWarRandIndex(int charaindex,int fmwarfloor) +{ + int i=1,j,fmwarindex; + int bindex[100]; + bindex[0]=-1; + for( j = 0; j < BATTLE_battlenum; j ++ ){ + if( BattleArray[j].use == FALSE ){ + continue; + }else{ + if(BattleArray[j].floor!=fmwarfloor){ + continue; + }else{ + bindex[i-1]=j; + i++; + continue; + } + } + } + if(bindex[0]>-1){ + fmwarindex = bindex[RAND(1,i)-1]; + if(BATTLE_CHECKINDEX(fmwarindex)==FALSE) + return -1; + else{ + if(BattleArray[fmwarindex].floor!=fmwarfloor) + return -1; + if(BATTLE_CreateForWatcher( charaindex, fmwarindex )==0){ + int fd; + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, BattleArray[fmwarindex].type, BattleArray[fmwarindex].field_no ); + } + char szBuffer[256]; + sprintf( szBuffer, "BP|%X|%X|%X", + 20, BP_FLG_JOIN, CHAR_getInt(charaindex, CHAR_MP ) ); + BATTLE_CommandSend( charaindex, szBuffer ); + return 0; + } + } + } + return -1; +} + +char* SearchFmWar(int charaindex,int fmwarselect) +{ + int fmlistpage = CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE); + int fmwarfloor = -1; + switch(fmwarselect){ + case 1: + fmwarfloor=1042; + break; + case 2: + fmwarfloor=2032; + break; + case 3: + fmwarfloor=3032; + break; + case 4: + fmwarfloor=4032; + break; + case 5: + fmwarfloor=20000; + break; + case 6: + fmwarfloor=51000; + break; + default: + break; + } + if(fmlistpage>0){ + if(fmwarfloor == 1042 && fmlistpage*6+1-6<=afmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( afmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + }else if(fmwarfloor == 2032 && fmlistpage*6+1-6<=bfmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( bfmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + }else if(fmwarfloor == 3032 && fmlistpage*6+1-6<=cfmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( cfmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + }else if(fmwarfloor == 4032 && fmlistpage*6+1-6<=dfmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( dfmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + }else if(fmwarfloor == 20000 && fmlistpage*6+1-6<=efmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( efmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + }else if(fmwarfloor == 51000 && fmlistpage*6+1-6<=ffmwarnum){ + int i=fmlistpage*6+1-6+1; + char fmwarbuff[1024]; + sprintf(fmwarbuff,"2\n ѡҪսĶ项\nӳơ֣ӡӳ"); + char name1[64],name2[64],newname1[64],fmwarindexbuf[32]; + memset(newname1, 0, sizeof(newname1)); + int fmwarindex = -1; + for(;i<=fmlistpage*6+1;i++){ + memset(newname1, 0, sizeof(newname1)); + if(getStringFromIndexWithDelim( ffmwar, ",", i, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + break; + if(strlen(fmwarindexbuf)<1) + break; + fmwarindex = atoi(fmwarindexbuf); + strcpy(name1,BattleArray[fmwarindex].leadername); + strcpy(name2,BattleArray[fmwarindex].rivalname); + int namelen1 = strlen(name1); + int j; + for(j=0;j<16-namelen1;j++){ + if(j==0) + strcpy(newname1," "); + else + strcat(newname1," "); + } + if(strlen(newname1)<1) + sprintf(fmwarbuff,"%s\n%s ֣ %s",fmwarbuff,name1,name2); + else + sprintf(fmwarbuff,"%s\n%s%s ֣ %s",fmwarbuff,newname1,name1,name2); + } + return fmwarbuff; + } + } + return "err"; +} + +int LookFmWarIndex(int charaindex,int fmwarselect) +{ + int listselect = CHAR_getWorkInt(charaindex,CHAR_WORKLISTSELECT); + if(listselect<1 || listselect>6) + return -1; + int fmwarindex = -1; + char fmwarindexbuf[64]; + if(listselect == 1){ + if(getStringFromIndexWithDelim( afmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + }else if(listselect == 2){ + if(getStringFromIndexWithDelim( bfmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + }else if(listselect == 3){ + if(getStringFromIndexWithDelim( cfmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + }else if(listselect == 4){ + if(getStringFromIndexWithDelim( dfmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + }else if(listselect == 5){ + if(getStringFromIndexWithDelim( efmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + }else if(listselect == 6){ + if(getStringFromIndexWithDelim( ffmwar, ",", CHAR_getWorkInt(charaindex,CHAR_WORKLISTPAGE)*6+1-6+fmwarselect, fmwarindexbuf, sizeof(fmwarindexbuf))==FALSE) + return -1; + fmwarindex = atoi(fmwarindexbuf); + } + + if(BATTLE_CHECKINDEX(fmwarindex)==FALSE) + return -1; + if(BATTLE_CreateForWatcher( charaindex, fmwarindex )==0){ + int fd; + if( ( fd = getfdFromCharaIndex(charaindex) ) != -1 ){ + lssproto_EN_send( fd, BattleArray[fmwarindex].type, BattleArray[fmwarindex].field_no ); + } + char szBuffer[256]; + sprintf( szBuffer, "BP|%X|%X|%X", + 20, BP_FLG_JOIN, CHAR_getInt(charaindex, CHAR_MP ) ); + BATTLE_CommandSend( charaindex, szBuffer ); + return 0; + } + return -1; +} +#endif + +#ifdef _ALLBLUES_LUA_1_4 +INLINE BOOL BATTLE_setLUAFunction( int battleindex, int functype, lua_State *L, const char *luafunctable) +{ + if( !BATTLE_CHECKINDEX(battleindex) )return FALSE; + + if( functype < 0 || functype >= BATTLE_FUNCTABLENUM )return FALSE; + + BattleArray[battleindex].lua[functype] = L; + BattleArray[battleindex].luafunctable[functype] = allocateMemory( strlen(luafunctable) ); + memset(BattleArray[battleindex].luafunctable[functype], 0, strlen(luafunctable)); + strcpy(BattleArray[battleindex].luafunctable[functype], luafunctable); + + return TRUE; +} + +INLINE lua_State *BATTLE_getLUAFunction( int battleindex, int functype) +{ + + if( !BATTLE_CHECKINDEX(battleindex) )return NULL; + + if( functype < 0 || functype >= BATTLE_FUNCTABLENUM ) + return NULL; + + if(BattleArray[battleindex].lua[functype] == NULL){ + return NULL; + } + + lua_getglobal( BattleArray[battleindex].lua[functype], BattleArray[battleindex].luafunctable[functype]); + return BattleArray[battleindex].lua[functype]; +} +#endif + +int BATTLE_getType( int battleindex ) +{ + if(battleindex>=BATTLE_battlenum || battleindex<0 )return -1; + + return BattleArray[battleindex].type; +} + +#ifdef _BATTLE_TIMESPEED +int BATTLE_getCreateTime( int battleindex ) +{ + if(battleindex>=BATTLE_battlenum || battleindex<0 )return -1; + + return BattleArray[battleindex].CreateTime; +} +#endif + +int BATTLE_getBattleFloor( int battleindex ) +{ + if(battleindex>=BATTLE_battlenum || battleindex<0 )return -1; + + return BattleArray[battleindex].BattleFloor; +} + + + +void Enemy_setStayLoop(int charaindex) +{ + int fd = getfdFromCharaIndex( charaindex ); + setStayEncount(fd); + { + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, getOfflineBattleTime()); + CHAR_constructFunctable( charaindex); + } +} diff --git a/battle/battle_ai.c b/battle/battle_ai.c new file mode 100644 index 0000000..4795efc --- /dev/null +++ b/battle/battle_ai.c @@ -0,0 +1,533 @@ +#include "version.h" +#include +#include "common.h" +#include "char.h" +#include "char_base.h" +#include "battle.h" +#include "npcutil.h" +#include "pet_skill.h" + +struct B_AI_RESULT { + BATTLE_COM command; /* ë¾ */ + int target; /* */ +}; + +static int BATTLE_ai_normal( int, int, BATTLE_ENTRY *,struct B_AI_RESULT *); + +static int (*functbl[])( int, int, BATTLE_ENTRY *,struct B_AI_RESULT *) = { + NULL, + BATTLE_ai_normal, +}; + +int BATTLE_ai_all( int battleindex, int side, int turn) +{ + int i; + int rc = FALSE; + BATTLE_ENTRY *pEntry; + struct B_AI_RESULT result; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( BATTLE_CHECKSIDE( side ^1) == FALSE )return BATTLE_ERR_PARAM; + if( BattleArray[battleindex].Side[side].type != BATTLE_S_TYPE_ENEMY ) return FALSE; + pEntry = BattleArray[battleindex].Side[side^1].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + int charaindex = BattleArray[battleindex].Side[side].Entry[i].charaindex; + int mode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + + mode = CHAR_getWorkInt( charaindex, CHAR_WORKTACTICS); + if( mode < 0 || mode >= arraysizeof( functbl)){ + //print( "BATTLE_ai_all ,ս߼ģʽ(%s)(%d)\n", + //CHAR_getUseName( charaindex ), mode ); + mode = 1; + } + if( BATTLE_IsCharge( charaindex ) == TRUE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + continue; + } + if( BattleArray[battleindex].Side[side].flg & BSIDE_FLG_SURPRISE) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + }else { + if( functbl[mode] != NULL ) { + rc = functbl[mode]( turn, charaindex, pEntry, &result); + if( BATTLE_CanMoveCheck( charaindex ) == FALSE ){ + result.command = BATTLE_COM_NONE; + } + } + if( rc ) { +#ifdef _BATTLENPC_WARP_PLAYER + if(result.command==BATTLE_COM_WARP){ + for( i=0; icharaindex; + if( !CHAR_CHECKINDEX( tindex ))continue; + if( CHAR_getFlg( tindex, CHAR_ISDIE)) continue; + if( CHAR_getWorkInt( tindex, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_RESCUE ) continue; + if( CHAR_getInt( tindex, CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ + char sBuff[1024]="", sBuff1[1024]=""; + int ss[3]; + int sii; + int rc = 1; + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_ACT_CONDITION), + "wp", sBuff, sizeof( sBuff))!=NULL){ + for( sii=1; sii<=3; sii++){ + if(getStringFromIndexWithDelim( sBuff, ";", sii, sBuff1, sizeof( sBuff1))) + {ss[sii-1]=atoi(sBuff1);} + else + {rc=0;} + } + if(rc){ + CHAR_warpToSpecificPoint( tindex, ss[0], ss[1], ss[2]); + BATTLE_WatchStop( tindex); + } + } + } + } + } +#endif + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, result.command ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, + result.target + (side^1)*SIDE_OFFSET); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + + } + } + } + return TRUE; +} + +int BATTLE_ai_one( int charaindex, int battleindex, int side, int turn) +{ + int rc = FALSE; + BATTLE_ENTRY *pEntry; + struct B_AI_RESULT result; + int mode; + + /* ɷ¶ */ + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + if( BATTLE_CHECKSIDE( side ) == FALSE )return BATTLE_ERR_PARAM; + if( BATTLE_CHECKSIDE( side ^1) == FALSE )return BATTLE_ERR_PARAM; + + /* 浤 */ + /* ƽҷ¶½ */ + if( BattleArray[battleindex].Side[side].type != BATTLE_S_TYPE_ENEMY ) return 0; + + /* */ + pEntry = BattleArray[battleindex].Side[side^1].Entry; + + mode = CHAR_getWorkInt( charaindex, CHAR_WORKTACTICS); + /* ëԻ */ + if( mode < 0 || mode >= arraysizeof( functbl)) return FALSE; + /* ëԻ */ + if( functbl[mode] != NULL ) { + rc = functbl[mode]( turn, charaindex, pEntry, &result); + } + if( rc ) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, result.command ); + if( result.command == BATTLE_COM_ATTACK) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, + result.target + (side^1)*SIDE_OFFSET); + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } + return TRUE; +} + +/* ɧë裻 */ + +#define B_AI_NORMAL_ATTACKOPTION "at" /* */ +#define B_AI_NORMAL_GUARDOPTION "gu" /* */ +#define B_AI_NORMAL_MAGICOPTION "ma" /* */ +#define B_AI_NORMAL_ESCAPEOPTION "es" /* */ +#define B_AI_NORMAL_WAZAOPTION "wa" /* */ +#ifdef _ENEMY_ATTACK_AI +#define B_AI_NORMAL_RANDAOPTION "rn" +#define B_AI_NORMAL_RANDOMOPTIONNUM 1 +#endif + +#define B_AI_NORMAL_ATTACKSUBOPTIONNUM 3 +#define B_AI_NORMAL_GUARDSUBOPTIONNUM 1 +#define B_AI_NORMAL_MAGICSUBOPTIONNUM 1 +#define B_AI_NORMAL_ESCAPESUBOPTIONNUM 1 +#define B_AI_NORMAL_WAZASUBOPTIONNUM 7 + +/* ¦Ѽ ٯ */ +#define B_AI_NORMAL_TARGET_ALL 1 +#define B_AI_NORMAL_TARGET_PLAYER 2 +#define B_AI_NORMAL_TARGET_PET 3 +#ifdef _ENEMY_ATTACK_AI +#define B_AI_NORMAL_TARGET_LEADER 4 +#endif +#define B_AI_NORMAL_SELECT_RANDOM 1 +#define B_AI_NORMAL_SELECT_HP_MAX 2 +#define B_AI_NORMAL_SELECT_HP_MIN 3 +#ifdef _ENEMY_ATTACK_AI +#define B_AI_NORMAL_SELECT_STR_MAX 4 +#define B_AI_NORMAL_SELECT_DEX_MAX 5 +#define B_AI_NORMAL_SELECT_DEX_MIN 6 +#define B_AI_NORMAL_SELECT_ATT_SUBDUE 7 +enum{ + AI_ATT_EARTHAT = 1, + AI_ATT_WATERAT, + AI_ATT_FIREAT, + AI_ATT_WINDAT +}; +int GetSubdueAttribute(int index){ + int s_a = CHAR_getWorkInt( index, CHAR_WORKFIXEARTHAT); + int s_b = CHAR_getWorkInt( index, CHAR_WORKFIXWATERAT); + int s_c = CHAR_getWorkInt( index, CHAR_WORKFIXFIREAT); + int s_d = CHAR_getWorkInt( index, CHAR_WORKFIXWINDAT); + return ((s_a>s_c)?((s_b>s_d)?((s_a>s_b)?(2):(3)):((s_a>s_d)?(2):(1))):((s_b>s_d)?((s_c>s_b)?(4):(3)):((s_c>s_d)?(4):(1)))); +} +#endif + +typedef enum { + B_AI_ATTACKMODE = 1, + B_AI_GURADMODE, + B_AI_MAGICMODE, + B_AI_ESCAPEMODE, + B_AI_WAZAMODE0, + B_AI_WAZAMODE1, + B_AI_WAZAMODE2, + B_AI_WAZAMODE3, + B_AI_WAZAMODE4, + B_AI_WAZAMODE5, + B_AI_WAZAMODE6, +}B_AI_MODE; + +static int BATTLE_ai_normal( int turn, int charaindex, + BATTLE_ENTRY *pEntry, + struct B_AI_RESULT *result) +{ + int at[B_AI_NORMAL_ATTACKSUBOPTIONNUM] = { 0,0,0}; /* */ + int gu[B_AI_NORMAL_GUARDSUBOPTIONNUM] = {0}; /* */ + int ma[B_AI_NORMAL_MAGICSUBOPTIONNUM] = {0}; /* */ + int es[B_AI_NORMAL_ESCAPESUBOPTIONNUM] = {0}; /* */ + int wa[B_AI_NORMAL_WAZASUBOPTIONNUM] = {0,0,0,0, 0,0,0};/* */ +#ifdef _ENEMY_ATTACK_AI + int rn[B_AI_NORMAL_RANDOMOPTIONNUM] = {1}; +#endif + int target[BATTLE_ENTRY_MAX]; + int cnt; + int i; + int r; + int rc; + int mode=0; + char buff[256]; + char buff2[256]; + + if( turn == 1 ) { + //print( "Ӧû¡\n" ); + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_ATTACKOPTION, buff, sizeof( buff)) != NULL ){ + for( i = 1; i < B_AI_NORMAL_ATTACKSUBOPTIONNUM + 1; i ++ ) { + rc = getStringFromIndexWithDelim( buff, ";", i, buff2, sizeof( buff2)); + if( rc != TRUE ) { + //print( "battle_ai.c:Invarid Param [%s]\n", + //CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION)); + return FALSE; + } + at[i-1] = atoi( buff2); + } + } + + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_GUARDOPTION, buff, sizeof( buff)) != NULL ){ + for( i = 1; i < B_AI_NORMAL_GUARDSUBOPTIONNUM + 1; i ++ ) { + rc = getStringFromIndexWithDelim( buff, ";", i, buff2, sizeof( buff2)); + if( rc != TRUE ) { + //print( "battle_ai.c:Invarid Param [%s]\n", + //CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION)); + return FALSE; + } + gu[i-1] = atoi( buff2); + } + } + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_MAGICOPTION, + buff, sizeof( buff)) != NULL ){ + for( i = 1; i < B_AI_NORMAL_MAGICSUBOPTIONNUM + 1; i ++ ) { + rc = getStringFromIndexWithDelim( buff, ";", i, buff2, sizeof( buff2)); + if( rc != TRUE ) { + //print( "battle_ai.c:Invarid Param [%s]\n", + //CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION)); + return FALSE; + } + ma[i-1] = atoi( buff2); + + } + } + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_ESCAPEOPTION, + buff, sizeof( buff)) != NULL ){ + for( i = 1; i < B_AI_NORMAL_ESCAPESUBOPTIONNUM + 1; i ++ ) { + rc = getStringFromIndexWithDelim( buff, ";", i, buff2, sizeof( buff2)); + + if( rc != TRUE ) { + //print( "battle_ai.c:Invarid Param [%s]\n", + //CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION)); + return FALSE; + } + es[i-1] = atoi( buff2); + } + } + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_WAZAOPTION, + buff, sizeof( buff)) != NULL ){ + for( i = 1; i < B_AI_NORMAL_WAZASUBOPTIONNUM + 1; i ++ ) { + rc = getStringFromIndexWithDelim( buff, ";", i, buff2, sizeof( buff2)); + if( rc != TRUE ) { + }else{ + wa[i-1] = atoi( buff2); + } + } + } +#ifdef _ENEMY_ATTACK_AI + if( NPC_Util_GetStrFromStrWithDelim( CHAR_getWorkChar( charaindex, CHAR_WORKBATTLE_TACTICSOPTION), + B_AI_NORMAL_RANDAOPTION, + buff, sizeof( buff))!=NULL){ + for( i=1; icommand = BATTLE_COM_WARP; + return TRUE; + } + } +#endif + if( at[0] == 0 && gu[0] == 0 && ma[0] == 0 && es[0] == 0 ){ + for( i = 0; i < B_AI_NORMAL_WAZASUBOPTIONNUM; i ++ ){ + if( wa[i] != 0 )break; + } + if( i >= B_AI_NORMAL_WAZASUBOPTIONNUM ){ + //print( "ָκεĹʽ\n" ); + return FALSE; + } + } + while( !mode ) { + int work = 0; + work = at[0]+gu[0]+ma[0]+es[0]; + for( i = 0; i < B_AI_NORMAL_WAZASUBOPTIONNUM; i ++ ){ + work += wa[i]; + } + r = RAND( 0, work - 1 ); + if( at[0] != 0 && r < at[0] ) mode = B_AI_ATTACKMODE; + else if( gu[0] != 0 && r < at[0] + gu[0]) mode = B_AI_GURADMODE; + else if( ma[0] != 0 && r < at[0] + gu[0] + ma[0]) mode = B_AI_MAGICMODE; + else if( es[0] != 0 && r < at[0] + gu[0] + ma[0] + es[0] ){ + mode = B_AI_ESCAPEMODE; + } + if( mode ) break; + work = at[0] + gu[0] + ma[0] + es[0]; + for( i = 0; i < B_AI_NORMAL_WAZASUBOPTIONNUM; i ++ ){ + work += wa[i]; + if( wa[i] != 0 && r < work ){ + mode = B_AI_WAZAMODE0+i; + break; + } + } + } + if( mode == B_AI_ATTACKMODE || ( B_AI_WAZAMODE0 <= mode && mode <= B_AI_WAZAMODE6 )){ + while( 1 ) { + for( i = 0 ; i < BATTLE_ENTRY_MAX; i ++ ) { + target[i] = -1; + } + cnt = 0; + for( i = 0; i < BATTLE_ENTRY_MAX ; i ++ ) { + int tindex = (pEntry+i)->charaindex; + if( !CHAR_CHECKINDEX( tindex ))continue; + if( CHAR_getFlg( tindex, CHAR_ISDIE)) continue; + if( CHAR_getWorkInt( tindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_RESCUE ) continue; + switch( at[1]) { + case B_AI_NORMAL_TARGET_PLAYER: + if( CHAR_getInt( tindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + target[cnt++] = i; + } + break; + case B_AI_NORMAL_TARGET_PET: + if( CHAR_getInt( tindex, CHAR_WHICHTYPE) == CHAR_TYPEPET){ + target[cnt++] = i; + } + break; +#ifdef _ENEMY_ATTACK_AI + case B_AI_NORMAL_TARGET_LEADER: + if( CHAR_getWorkInt( tindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER) { + target[cnt++] = i; + }else if(!RAND( 0, 2)) { + target[cnt++] = i; + } + break; +#endif + default: + target[cnt++] = i; + break; + } + } + if( cnt == 0 && at[1] == B_AI_NORMAL_TARGET_ALL ) return FALSE; + if( cnt > 0 ) break; + at[1] = B_AI_NORMAL_TARGET_ALL; + } + result->command = BATTLE_COM_NONE; + if( at[2] == B_AI_NORMAL_SELECT_RANDOM ) { + r = RAND( 0, cnt-1); + result->command = BATTLE_COM_ATTACK; + result->target = target[r]; + }else if( at[2] == B_AI_NORMAL_SELECT_HP_MAX || at[2] == B_AI_NORMAL_SELECT_HP_MIN ){ + int top = 0; + for( i = 0; i < cnt; i ++ ) { + if( i ==0 ) top = target[i]; + else { + int tophp = CHAR_getInt((pEntry+top)->charaindex, CHAR_HP); + int comphp = CHAR_getInt((pEntry+target[i])->charaindex, CHAR_HP); + if( at[2] == B_AI_NORMAL_SELECT_HP_MAX ) { + if( comphp > tophp ) top = target[i]; + } + else { + if( comphp < tophp ) top = target[i]; + } + } + } +#ifdef _ENEMY_ATTACK_AI + if(!RAND( 0, rn[0])) + result->target = target[RAND( 0, cnt-1)]; + else + result->target = top; + result->command = BATTLE_COM_ATTACK; +#else + result->command = BATTLE_COM_ATTACK; + result->target = top; +#endif + } +#ifdef _ENEMY_ATTACK_AI + else if(at[2] == B_AI_NORMAL_SELECT_STR_MAX) { + int top = 0; + for( i=0; icharaindex, CHAR_STR); + int compstr = CHAR_getInt( (pEntry+target[i])->charaindex, CHAR_STR); + if(compstr>topstr) top = target[i]; + } + } + if(!RAND( 0, rn[0])) + result->target = target[RAND( 0, cnt-1)]; + else + result->target = top; + result->command = BATTLE_COM_ATTACK; + } + else if(at[2] == B_AI_NORMAL_SELECT_DEX_MAX || + at[2] == B_AI_NORMAL_SELECT_DEX_MIN) { + int top = 0; + for( i=0; icharaindex, CHAR_DEX); + int compdex = CHAR_getInt( (pEntry+target[i])->charaindex, CHAR_DEX); + if(at[2]==B_AI_NORMAL_SELECT_DEX_MAX) { + if(compdex>topdex) top = target[i]; + }else { + if(compdextarget = target[RAND( 0, cnt-1)]; + else + result->target = top; + result->command = BATTLE_COM_ATTACK; + } + else if(at[2] == B_AI_NORMAL_SELECT_ATT_SUBDUE) { + int top = 0; + for( i=0; icharaindex, CHAR_WORKFIXEARTHAT); + int compatt = CHAR_getWorkInt( (pEntry+target[i])->charaindex, CHAR_WORKFIXEARTHAT); + if(compatt>topatt) top = target[i]; + } + break; + case AI_ATT_WATERAT: + { + int topatt = CHAR_getWorkInt( (pEntry+top)->charaindex, CHAR_WORKFIXWATERAT); + int compatt = CHAR_getWorkInt( (pEntry+target[i])->charaindex, CHAR_WORKFIXWATERAT); + if(compatt>topatt) top = target[i]; + } + break; + case AI_ATT_FIREAT: + { + int topatt = CHAR_getWorkInt( (pEntry+top)->charaindex, CHAR_WORKFIXFIREAT); + int compatt = CHAR_getWorkInt( (pEntry+target[i])->charaindex, CHAR_WORKFIXFIREAT); + if(compatt>topatt) top = target[i]; + } + break; + case AI_ATT_WINDAT: + { + int topatt = CHAR_getWorkInt( (pEntry+top)->charaindex, CHAR_WORKFIXWINDAT); + int compatt = CHAR_getWorkInt( (pEntry+target[i])->charaindex, CHAR_WORKFIXWINDAT); + if(compatt>topatt) top = target[i]; + } + break; + default: + break; + } + } + } + if(!RAND( 0, rn[0])) + result->target = target[RAND( 0, cnt-1)]; + else + result->target = top; + result->command = BATTLE_COM_ATTACK; + } +#endif + else{ + return FALSE; + } + if( B_AI_WAZAMODE0 <= mode && mode <= B_AI_WAZAMODE6 ){ + if( PETSKILL_Use( charaindex, mode - B_AI_WAZAMODE0, result->target,NULL ) == TRUE ){ + result->command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + return TRUE; + }else{ +// print( "δ趨(%s):(%d)\n", +// CHAR_getUseName( charaindex), mode - B_AI_WAZAMODE0 ); + return FALSE; + } + }else + if( mode == B_AI_ATTACKMODE ){ + result->command = BATTLE_COM_ATTACK; + return TRUE; + } + }else if( mode == B_AI_GURADMODE ) { + result->command = BATTLE_COM_GUARD; + return TRUE; + }else if( mode == B_AI_ESCAPEMODE ) { + result->command = BATTLE_COM_ESCAPE; + return TRUE; + } + return FALSE; +} diff --git a/battle/battle_command.c b/battle/battle_command.c new file mode 100644 index 0000000..e7b1605 --- /dev/null +++ b/battle/battle_command.c @@ -0,0 +1,1071 @@ +#include "version.h" +#include +#include +#include"char.h" +#include"char_base.h" +#include "battle.h" +#include "pet_skill.h" +#include "battle_event.h" +#include "battle_command.h" +#include "lssproto_serv.h" +#include "magic.h" +#include "magic_base.h" +#include "handletime.h" + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#endif +int NowBattlerFd; +#if 1 +int BATTLE_MpDown( int charaindex, int down ) +{ + return 0; +} +#else +{ + int mp, battleindex; + // о??? + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return TRUE; + // оԪئ?? + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + return TRUE; + } + + // ??ëӼ¾ + mp = CHAR_getInt( charaindex, CHAR_MP ); + if( mp < down ){ + // Ӽئмƥئ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + // ѨOK϶ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return FALSE; + } + mp -= down; + CHAR_setInt( charaindex, CHAR_MP, mp ); + return TRUE; +} +#endif + + +void BattleCommandDispach( int fd, char *command ) +{ + int endFlg = 0, battleindex; + int EscapeFree = BATTLE_FLG_FREEDP; + int charaindex = CONNECT_getCharaindex(fd); + char szBuffer[256]=""; +#ifdef _FIXWOLF // Syu ADD ˱Bug + int i , j , pindex; + BATTLE_ENTRY *pEntry; +#endif + + NowBattlerFd = fd; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE || + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + + return; + } + + + if( BattleArray[battleindex].flg & BATTLE_FLG_CHARALOST ){ + EscapeFree = 0; + } + + if( strncmp( command, "U", 1 ) == 0 ){ + // shan 2001/12/25 begin + EscapeFree = 0; + if (CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEWATCH )!=TRUE){ + CHAR_talkToCli( charaindex, -1, + "ħʹ㶨ս", CHAR_COLORYELLOW ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_GUARD ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + BATTLE_MpDown( charaindex, 2 ); + }else{ + BATTLE_WatchStop( charaindex ); + } + // shan end + }else + if( strncmp( command, "E", 1 ) == 0 ){ + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + CHAR_setWorkInt( charaindex, CHAR_WORKDBATTLEESCAPE,1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ESCAPE ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + + BATTLE_MpDown( charaindex, 20 ); + + }else + if( strncmp( command, "H|", 2 ) == 0 ){ + int iNum = -1, At_SoubiIndex; + if( sscanf( command+2, "%X", &iNum ) != 1 + || ( iNum < 0 || iNum >= 20 ) + ){ + iNum = -1; + } + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, iNum ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + + At_SoubiIndex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( At_SoubiIndex ) == FALSE ){ + + }else{ + + if( ITEM_getInt( At_SoubiIndex, ITEM_TYPE ) == ITEM_BOOMERANG ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_BOOMERANG ); +#ifdef _PETSKILL_BECOMEFOX + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС겻ʹû + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){// + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } +#endif + } + } + + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, 1 ); + //sprintf( szBuffer, "Command(%s)(ս)", CHAR_getUseName( charaindex ) ); + + endFlg = 1; + + BATTLE_MpDown( charaindex, 5 ); + + }else + if( strncmp( command, "G", 1 ) == 0 ){ + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_GUARD ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + + BATTLE_MpDown( charaindex, 2 ); + + }else + if( strncmp( command, "N", 1 ) == 0 ){ + + EscapeFree = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); +// sprintf( szBuffer, "Command(%s)(serverй)", CHAR_getUseName( charaindex ) ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + + }else + if( strncmp( command, "T|", 2 ) == 0 ){ + int iNum = -1; + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + if( sscanf( command+2, "%X", &iNum ) != 1 + || ( iNum < 0 || iNum >= 20 ) + ){ + iNum = -1; + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, iNum ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_CAPTURE ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + + BATTLE_MpDown( charaindex, 20 ); + + }else + if( strncmp( command, "S|", 2 ) == 0 ){ + int iNum = -1; + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + // shan 2002/01/08 begin + if( sscanf( command+2, "%d", &iNum ) != 1 + || ( iNum < -1 || iNum >= CHAR_MAXPETHAVE ) + || ( CHAR_getInt(charaindex,CHAR_RIDEPET)==iNum) + ){ + iNum = -1; + } + // shan end + +#ifdef _STANDBYPET +#ifndef _PET_STANDBY + if( iNum >= 0) { + if( ! (CHAR_getWorkInt( charaindex, CHAR_WORKSTANDBYPET) & ( 1 << iNum)) ) { + //print("\n ķ!гǴ!!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + iNum = -1; + } + } +#endif +#endif + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, iNum ); + if( iNum < 0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_PETIN ); + //sprintf( szBuffer, "Command(%s)(س)", CHAR_getUseName( charaindex ) ); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_PETOUT ); + //sprintf( szBuffer, "Command(%s)(г)", CHAR_getUseName( charaindex ) ); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + endFlg = 1; + + BATTLE_MpDown( charaindex, 10 ); + + }else + if( strncmp( command, "W|", 2 ) == 0 ){ + int iNum = -1, petskillindex = -1, ToNo = -1, petnum, petindex; + if( sscanf( command+2, "%X|%X", &iNum, &ToNo ) < 1 ){ + iNum = -1; ToNo = -1; + } + petnum = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + petindex = CHAR_getCharPet( charaindex, petnum ); + if( CHAR_CHECKINDEX( petindex ) == FALSE ){ + }else{ + + if( iNum < 0 || iNum >= CHAR_MAXPETSKILLHAVE +#ifdef _PETSKILLBUG //Add By Syu 2002.0805 + || (CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE )|| + (CHAR_getInt( charaindex, CHAR_HP ) <= 0) +#endif + || checkErrorStatus( petindex) + ) + { + //sprintf( szBuffer, "Command(%s)(Զ)", CHAR_getUseName( petindex ) ); + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); +#ifdef _PETSKILLBUG //Add By Syu 2002.0805 + }else if ((CHAR_getInt(petindex, CHAR_TRANSMIGRATION)<1) + && ( iNum>=CHAR_getInt(petindex, CHAR_SLOT) ) ) + { + //sprintf( szBuffer, "Command(%s)(Զ)", CHAR_getUseName( petindex ) ); + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); +#endif + }else{ + petskillindex = PETSKILL_GetArray( petindex, iNum); +#ifdef _FIXWOLF // Syu ADD ˱Bug + if( (CHAR_getPetSkill( petindex , iNum )== 600) && (ToNo == -1)) + { + for( j = 0; j < 2; j ++ ) + { + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ) + { + pindex = pEntry[i].charaindex; + if( pindex == petindex) + { + ToNo=i + ( j * 10 ); + break; + } + } + } + } +#endif + if( petskillindex >= 0 + && PETSKILL_Use( petindex, iNum, ToNo, NULL ) == TRUE + ){ + //sprintf( szBuffer, "Command(%s)(ʯ)", CHAR_getUseName( petindex ) ); + + EscapeFree = 0; + + }else{ + //sprintf( szBuffer, "Command(%s)(Զ)", CHAR_getUseName( petindex ) ); + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } + } + } + endFlg = 1; + BATTLE_MpDown( charaindex, 10 ); + }else + if( strncmp( command, "J|", 1 ) == 0 ){ + int iNum = -1, magicindex = -1, ToNo = -1; + int valid = -1; + int itemindex=-1; + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + if( sscanf( command+2, "%X|%X", &iNum, &ToNo ) != 2 ){ + iNum = -1; ToNo = -1; + } + if( iNum < CHAR_EQUIPPLACENUM && iNum >= CHAR_HEAD ){ + magicindex = MAGIC_GetArrayNo( charaindex, iNum ); + itemindex = CHAR_getItemIndex( charaindex, iNum ); + valid = MAGIC_isTargetValid( magicindex, ToNo); + + if ((valid <0 ) || ( magicindex < 0 ) || (itemindex < 0 )){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + }else{ +#ifdef _ITEM_ATTSKILLMAGIC + char *magicarg="\0"; + int magic_array = -1; + magic_array = MAGIC_getMagicArray( magicindex ); + magicarg = MAGIC_getChar( magic_array, MAGIC_OPTION ); + if( magicarg != "\0" && strstr( magicarg, "SKILL") != NULL ) { + int mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP ); + if( MAGIC_AttSkill( charaindex, ToNo, magic_array, mp) == FALSE ) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } + }else { +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, ToNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_JYUJYUTU ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, magicindex ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, iNum ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); +#ifdef _ITEM_ATTSKILLMAGIC + } +#endif + } + }else{ + EscapeFree = 0; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + } + endFlg = 1; + }else + if( strncmp( command, "I|", 1 ) == 0 ){ + int iNum = -1, ToNo = -1; + int valid = 0, itemindex = -1; + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + if( sscanf( command+2, "%X|%X", &iNum, &ToNo ) != 2 ){ + iNum = -1; ToNo = -1; + } + itemindex = CHAR_getItemIndex( charaindex, iNum ); + if ( !ITEM_CHECKINDEX( itemindex) ) valid=-1; + if (valid >= 0) valid = ITEM_isTargetValid( charaindex, itemindex, ToNo ); + if (valid < 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } else { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, ToNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ITEM ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM3, iNum ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); + endFlg = 1; + } + }else + if( strncmp( command, "@", 1 ) == 0 ){ + //sprintf( szBuffer, "Command(%s)(ͨ)", CHAR_getUseName( charaindex ) ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + endFlg = 1; + + CHAR_setInt( charaindex, CHAR_MP, + min( 100, CHAR_getInt( charaindex, CHAR_MP ) + 30 ) ); + + }else +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( strncmp( command, "P", 1 ) == 0 ){ + int iNum=-1, ToNo=-1; + int skillindex=-1; + int char_pskill=-1, profession_skill=-1, Pskillid=-1; + + if( checkErrorStatus( charaindex) ) { + BattleCommandDispach( fd, "N"); + return; + } + + EscapeFree = 0; + + if( sscanf( command+2, "%X|%X", &iNum, &ToNo ) < 1 ){ + iNum = -1; ToNo = -1; + } + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ +// print("\n\n Ƿ(19001)(%s)(%s)\n\n", CHAR_getChar(charaindex, CHAR_CDKEY), CHAR_getChar(charaindex, CHAR_NAME) ); +#ifdef _PROSKILL_ERR_KICK + CONNECT_setCloseRequest( fd , 1 ); +#endif + return; + } +#ifndef _PROSKILL_OPTIMUM // Robin fix cancel ˴Թְҵ, PROFESSION_SKILL_Use м + // ְҵ + char_pskill = CHAR_getInt( charaindex, PROFESSION_CLASS ); + // ְܵҵ + skillindex = PROFESSION_SKILL_GetArray( charaindex, iNum); + Pskillid = PROFESSION_SKILL_getskillArray( skillindex); + profession_skill = PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS); + + if( (char_pskill > 0) && (char_pskill == profession_skill) ){ +#else + if( 1 ) { +#endif + if( PROFESSION_SKILL_Use( charaindex, iNum, ToNo, NULL ) == 1 ){ + //sprintf( szBuffer, "Command(%s)(ְҵ)", CHAR_getUseName( charaindex ) ); + endFlg = 1; + }else{ +// print("\nְҵʧ!!\n"); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); +#ifdef _PROSKILL_ERR_KICK + CONNECT_setCloseRequest( fd , 1 ); +#endif + } + }else{ +// print("\nķ??ְҵIDȷ:%s:%d:%d \n", CHAR_getChar( charaindex, CHAR_CDKEY), char_pskill, profession_skill); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_WAIT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //sprintf( szBuffer, "Command(%s)()", CHAR_getUseName( charaindex ) ); +#ifdef _PROSKILL_ERR_KICK + CONNECT_setCloseRequest_debug( fd , 1 ); +#endif + } + + EscapeFree = 0; + }else +#endif + + { + //sprintf( szBuffer, "Command(%s)(ʧ)", CHAR_getUseName( charaindex ) ); + endFlg = 2; + } + + + if( endFlg ){ + BATTLE_ActSettingSend( battleindex ); + + if( endFlg==1 ){ + int fd; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPLAYER ){ + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + CONNECT_SetBattleRecvTime( fd, &NowTime); + } + } + } + + { + //if( BATTLE_CHECKINDEX( battleindex ) == TRUE ){ + // BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORWHITE ) ; + //} + } + + if( BattleArray[battleindex].turn == 0 ){ + BattleArray[battleindex].flg |= EscapeFree; + }else{ + BattleArray[battleindex].flg &= EscapeFree; + } +} + + +void BATTLE_ActSettingSend( int battleindex ) +{ + int pindex, k = 0, i, j, charaindex; + int endBit = 0; + char szBA[256]; + BATTLE_ENTRY *pEntry; + BATTLE *pBattle; + + for( j = 0; j < 2; j ++ ){ + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pindex = pEntry[i].charaindex; + // Ѩ ƥ廯 + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_C_OK + ){ + endBit |= 1 << k; // + }else + // ķ姸 + if( CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY || + CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC || + CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERPETNPC ) + { + endBit |= 1 << k; // + } + k ++; + } + } + sprintf( szBA, "BA|%X|%X|", endBit, BattleArray[battleindex].turn ); +// print( "%s\n", szBA ); + //ձ幻ƻ˪ + for( j = 0; j < 2; j ++ ){ + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + // ׻ƽҷ±巴˪ئ + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_RESCUE )continue; + // + if( CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + ){ // Ѩ˪ + BATTLE_CommandSend( pindex, szBA ); + } + } + } + + + // ƻб˪ + pBattle = BattleArray[battleindex].pNext; + for( ; pBattle ; pBattle = pBattle->pNext ){ + + // ʧо + if( BATTLE_CHECKADDRESS( pBattle ) == FALSE ){ + //fprint( "err:սbattle address(%p)\n", pBattle ); + break; + } + // 幻˪ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pBattle->Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + // Ѩ˪ + BATTLE_CommandSend( pindex, szBA ); + } + } +} + + + +BOOL BATTLE_IsHide( int charaindex ){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 + ){ + return TRUE; + } + return FALSE; +} + + + + + +//******************************************************* +// +// PѨëͷʧ˪ +// +BOOL BATTLE_CommandSend( int charaindex, char *pszCommand) +// +//******************************************************** +{ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + if( getfdFromCharaIndex( charaindex ) < 0 )return FALSE; + lssproto_B_send( getfdFromCharaIndex( charaindex ), pszCommand ); + return TRUE; +} + + +BOOL BATTLE_MakeCharaString( + int battleindex, + char *pszCommand, + int size +) +{ + int i, j, iOffset, charaindex, flg; + BATTLE_ENTRY *pEntry; + char szBuffer[4096]="", *pszTop, *pszLast; + char szEscapeName[128], szEscapeTitle[128]; + char szEscapePetName[128]; + int rideflg = 0, petindex = -1, petlevel, pethp, petmaxhp; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return FALSE; + pszTop = pszCommand; + pszLast = pszCommand+size-1; +#if 1 + sprintf( szBuffer, "BC|%X|", BattleArray[battleindex].field_att ); +#else + sprintf( szBuffer, "BC|" ); +#endif + STRCPY_TAIL( pszTop, pszLast, szBuffer ); + + for( j = 0; j < 2; j ++ ){ + if( j == 1 ){ + iOffset = SIDE_OFFSET; // 𵤴µ + }else{ + iOffset = 0; + } + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) + & CHAR_BATTLEFLG_ULTIMATE )continue; + flg = 0; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_INIT ) flg |= BC_FLG_NEW; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_RESCUE ) flg |= BC_FLG_NEW; + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE ){ + flg |= BC_FLG_DEAD; + }else + if( CHAR_getWorkInt( charaindex, CHAR_WORKPOISON ) > 0 ){ + flg |= BC_FLG_POISON; + }else +#ifdef _MAGIC_WEAKEN // + if( CHAR_getWorkInt( charaindex, CHAR_WORKWEAKEN ) > 0 ){ + flg |= BC_FLG_WEAKEN; + }else +#endif +#ifdef _MAGIC_DEEPPOISON // 綾 + if( CHAR_getWorkInt( charaindex, CHAR_WORKDEEPPOISON ) > 0 ){ + flg |= BC_FLG_DEEPPOISON; + }else +#endif +#ifdef _MAGIC_NOCAST // Ĭ + if( CHAR_getWorkInt( charaindex, CHAR_WORKNOCAST ) > 0 ){ + flg |= BC_FLG_NOCAST; + }else +#endif +#ifdef _MAGIC_BARRIER // ħ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBARRIER ) > 0 ){ + flg |= BC_FLG_BARRIER; + }else +#endif + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARALYSIS ) > 0 ){ + flg |= BC_FLG_PARALYSIS; + }else + if( CHAR_getWorkInt( charaindex, CHAR_WORKSLEEP ) > 0 ){ + flg |= BC_FLG_SLEEP; + }else + if( CHAR_getWorkInt( charaindex, CHAR_WORKSTONE ) > 0 ){ + flg |= BC_FLG_STONE; + }else + if( CHAR_getWorkInt( charaindex, CHAR_WORKDRUNK ) > 0 ){ + flg |= BC_FLG_DRUNK; + }else + if( CHAR_getWorkInt( charaindex, CHAR_WORKCONFUSION ) > 0 ){ + flg |= BC_FLG_CONFUSION; + } + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + flg |= BC_FLG_PLAYER; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_REVERSE ){ + flg |= BC_FLG_REVERSE; + } + if( BATTLE_IsHide( charaindex ) == TRUE ){ + flg |= BC_FLG_HIDE; + } +#ifdef _PET_SKILL_SARS // WON ADD ɷ + if( CHAR_getWorkInt( charaindex, CHAR_WORKSARS ) > 0 ){ + flg |= BC_FLG_SARS; + } +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( CHAR_getWorkInt( charaindex, CHAR_WORKDIZZY ) > 0 ){ + flg |= BC_FLG_DIZZY; // ѣ + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKENTWINE ) > 0 ){ + flg |= BC_FLG_ENTWINE; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKDRAGNET ) > 0 ){ + flg |= BC_FLG_DRAGNET; // ޵ + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKICECRACK ) > 0 ){ + // flg |= BC_FLG_ICECRACK; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKOBLIVION ) > 0 ){ + flg |= BC_FLG_OBLIVION; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKICEARROW ) > 0 ){ + flg |= BC_FLG_ICEARROW; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKBLOODWORMS ) > 0 ){ + flg |= BC_FLG_BLOODWORMS; // Ѫ + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKSIGN ) > 0 ){ + flg |= BC_FLG_SIGN; // һѪ + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKINSTIGATE ) > 0 ){ + flg |= BC_FLG_CARY; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORK_F_ENCLOSE ) > 0 ){ + flg |= BC_FLG_F_ENCLOSE; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORK_I_ENCLOSE ) > 0 ){ + flg |= BC_FLG_I_ENCLOSE; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORK_T_ENCLOSE ) > 0 ){ + flg |= BC_FLG_T_ENCLOSE; // ׸ + } +#endif +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( charaindex, CHAR_WORKANNEX ) > 0 ){ + flg |= BC_FLG_T_ENCLOSE; // + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKWATER ) > 0 ){ + flg |= BC_FLG_WATER; // ˮ + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKFEAR ) > 0 ){ + flg |= BC_FLG_FEAR; // ־ + } +#endif +#ifdef _PETSKILL_LER + if(CHAR_getWorkInt(charaindex,CHAR_WORK_RELIFE) > 0){ + flg |= BC_FLG_CHANGE; // ׶ + CHAR_setWorkInt(charaindex,CHAR_WORK_RELIFE,0); + } +#endif + makeEscapeString( CHAR_getUseName( charaindex ), + szEscapeName, + sizeof( szEscapeName ) ); + makeEscapeString( BATTLE_CharTitle( charaindex ), + szEscapeTitle, + sizeof( szEscapeTitle ) ); + // Robin 0728 ride Pet + petindex = BATTLE_getRidePet( charaindex ); + if( petindex != -1 ){ + rideflg = 1; + makeEscapeString( CHAR_getUseName( petindex ), + szEscapePetName, + sizeof( szEscapePetName ) ); + petlevel = CHAR_getInt( petindex, CHAR_LV); + pethp = CHAR_getInt( petindex, CHAR_HP); + petmaxhp = CHAR_getWorkInt( petindex, CHAR_WORKMAXHP); + + }else { + if( CHAR_getWorkInt( charaindex, CHAR_WORKPETFALL ) == 1 ){ + rideflg = -1; +#ifdef _PETSKILL_BECOMEFOX // ĻʱѶϢ Client + if( CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ) + rideflg = -2; //clientжʾ (ӦclientΪp_party[ BattleMyNo ]->onRide) +#endif +#ifdef _PETSKILL_BECOMEPIG // ʱѶϢ Client + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > 120 )// + rideflg = -3; //clientжʾ (ӦclientΪp_party[ BattleMyNo ]->onRide) +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKPETFALL, 0 ); + } + else + rideflg = 0; + szEscapePetName[0] = 0; + petlevel = 0; + pethp = 0; + petmaxhp = 0; + } + + sprintf( szBuffer, "%X|%s|%s|%X|%X|%X|%X|%X|%X|%s|%X|%X|%X|", + pEntry[i].bid, + szEscapeName, + szEscapeTitle, + CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER ), + CHAR_getInt( charaindex, CHAR_LV ), + max( CHAR_getInt( charaindex, CHAR_HP ),0), + CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ), + flg, + rideflg, + szEscapePetName, + petlevel, + pethp, + petmaxhp + ); + STRCPY_TAIL( pszTop, pszLast, szBuffer ); + if( pszTop >= pszLast )return FALSE;// + } + } + + return TRUE; +} + +void BATTLE_BpSendToWatch( + BATTLE *pBattle, // ͼ̼ + char *pszBcString // BC ٯ +) +{ + + char szBp[256]; + int flg = 0, i, charaindex; + +// for( ; pBattle ; pBattle = pBattle->pNext ){ + if( pBattle == NULL )return; + // ʧо + if( BATTLE_CHECKADDRESS( pBattle ) == FALSE ){ + //fprint( "err:սbattle address(%p)\n", pBattle ); + return; + } + + // 幻˪ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = pBattle->Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) + != CHAR_TYPEPLAYER ) continue; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_WATCHINIT){ + flg |= BP_FLG_JOIN; // ޥ + } + flg |= BP_FLG_PLAYER_MENU_OFF; // بئ + // į˪ + sprintf( szBp, "BP|%X|%X|%X", 20, flg, 0 ); + BATTLE_CommandSend( charaindex, szBp ); + // 幻ɧ ˪ + BATTLE_CommandSend( charaindex, pszBcString ); + } + // Ѩг + pBattle->mode = BATTLE_MODE_WATCHPRE; +// } +} + +void BATTLE_CharSendAll( int battleindex ) +{ + int i, j, charaindex, flg, pet, At_SoubiIndex, pindex; + char szBp[256]; + BATTLE *pBattle; + + BATTLE_MakeCharaString( + battleindex, + szAllBattleString, + sizeof(szAllBattleString) + ); + + for( j = 0; j < 2; j ++ ){ + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + charaindex = BattleArray[battleindex].Side[j].Entry[i].charaindex; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )continue; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + flg = 0; + if( BattleArray[battleindex].Side[j].flg & BSIDE_FLG_SURPRISE ){ + flg |= BP_FLG_ENEMY_SURPRISAL; + }else + if( BattleArray[battleindex].Side[1-j].flg & BSIDE_FLG_SURPRISE ){ + flg |= BP_FLG_PLAYER_SURPRISAL; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) + == BATTLE_CHARMODE_RESCUE){ + flg |= BP_FLG_JOIN; // + } + At_SoubiIndex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( At_SoubiIndex ) == FALSE ){ + }else{ + if( ITEM_getInt( At_SoubiIndex, ITEM_TYPE ) == ITEM_BOOMERANG ){ + flg |= BP_FLG_BOOMERANG; + } + } + + pet = CHAR_getInt( charaindex, CHAR_DEFAULTPET ); + if( pet >= 0 ){ + snprintf( szBp, sizeof( szBp ), "K%d", pet ); + CHAR_sendStatusString( charaindex, szBp ); + + pindex = CHAR_getCharPet( charaindex, pet ); + +#ifdef _PETSKILL_DAMAGETOHP + { +/* + ÿ,ÿ~~~~~~~ + qTTr + qsU + tѨTѨs± +*/ + char msg[32]={0}; + //print("\nid:%d",CHAR_getInt( pindex, CHAR_PETID)); + //print("\n:%s",CHAR_getChar( pindex, CHAR_NAME)); + //if( CHAR_getInt( pindex, CHAR_PETID) == 777 ){//ID ˮ˫ͷ + // || CHAR_getInt( pindex, CHAR_PETID) == 146 ) //˫ͷ + // && CHAR_getInt( pindex, CHAR_HP) ){ + sprintf( msg, "o%d", pet ); + CHAR_sendStatusString( charaindex, msg ); + + //} + } +#endif + +#ifdef _PETSKILL_BECOMEFOX // Ļijļ + //if( CHAR_getInt( pindex, CHAR_BASEIMAGENUMBER) == 101749 ){ + if( CHAR_getWorkInt( pindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС + char msg[32]={0}; + sprintf( msg, "a%d", pet ); + CHAR_sendStatusString( charaindex, msg ); + + } +#endif + + if( CHAR_CHECKINDEX( pindex ) == TRUE ){ + if( BATTLE_IsCharge( pindex ) == TRUE){ + flg |= BP_FLG_PET_MENU_OFF; + } + if( BATTLE_CanMoveCheck( pindex ) == FALSE ){ + flg |= BP_FLG_PET_MENU_OFF; + } + if( CHAR_getFlg( pindex, CHAR_ISDIE ) == TRUE ){ + flg |= BP_FLG_PET_MENU_OFF; + } + } + }else{ + flg |= BP_FLG_PET_MENU_OFF; + } + + if( BATTLE_CanMoveCheck( charaindex ) == FALSE + || CHAR_getFlg( charaindex, CHAR_ISDIE ) == TRUE + ){ + flg |= BP_FLG_PLAYER_MENU_OFF; + } + + if( BattleArray[battleindex].Side[j].flg & BSIDE_FLG_SURPRISE ){ + flg |= BP_FLG_PLAYER_MENU_OFF; + flg |= BP_FLG_PET_MENU_OFF; + } + sprintf( szBp, "BP|%X|%X|%X", + i + SIDE_OFFSET * j, + flg, CHAR_getInt( charaindex, CHAR_MP ) + ); + BATTLE_CommandSend( charaindex, szBp ); + BATTLE_CommandSend( charaindex, szAllBattleString ); + } + } + pBattle = BattleArray[battleindex].pNext; + for( ; pBattle ; pBattle = pBattle->pNext ){ + // ʧо + if( BATTLE_CHECKADDRESS( pBattle ) == FALSE ){ + //fprint( "err:սbattle address(%p)\n", pBattle ); + break; + } + + BATTLE_BpSendToWatch( pBattle, szAllBattleString ); + + } + + + +} + +void BattleEncountOut( int charaindex) +{ + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEINDEX, -1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_MODE_NONE ); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX ) ); + CHAR_sendArroundCharaData( charaindex ); + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEWATCH ) == 0 ){ + CHAR_sendBattleEffect( charaindex, OFF); + }else{ + CHAR_sendBattleWatch( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX ), OFF); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEWATCH, 0 ); + } + + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ){ + int pmode/*, battleindex*/; + int pindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1 ); + pmode = CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ); + if( pmode > 0 && pmode != BATTLE_CHARMODE_FINAL ){ + BATTLE_RescueParentTry( charaindex, pindex ); +// print( "μս(%s)\n", CHAR_getUseName( charaindex ) ); + } + } + +} + + +//************************************************** +// +// ɻѨë ľʸ +// +BOOL BATTLE_PetDefaultCommand( int petindex ) +// +//************************************************** +{ + if( CHAR_CHECKINDEX( petindex ) == FALSE )return FALSE; + // 켰϶ + CHAR_setWorkInt( petindex, CHAR_WORKBATTLECOM2, -1 ); + // ɧ ϶ + CHAR_setWorkInt( petindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + // ѨOK϶ + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; +} + +// Robin fix ʯ˯ս +int checkErrorStatus( int charaindex) +{ + //if( BATTLE_CanMoveCheck( charaindex) == FALSE) { + + if( + CHAR_getWorkInt( charaindex, CHAR_WORKPARALYSIS ) > 0 // + || CHAR_getWorkInt( charaindex, CHAR_WORKSTONE ) > 0 // ʯ + || CHAR_getWorkInt( charaindex, CHAR_WORKSLEEP ) > 0 // ˯ + //|| CHAR_getWorkInt( charaindex, CHAR_WORKBARRIER ) > 0 // ħ + || CHAR_getWorkInt( charaindex, CHAR_WORKDIZZY ) > 0 // ѣ + || CHAR_getWorkInt( charaindex, CHAR_WORKDRAGNET ) > 0 // ޵ + //|| CHAR_getWorkInt( charaindex, CHAR_WORK_T_ENCLOSE ) > 0 // ׸ +#ifdef _PROFESSION_ADDSKILL +// || CHAR_getWorkInt( charaindex, CHAR_DOOMTIME ) > 0 //ĩռ +#endif + ) + { + +// char cdkey[128]; +// if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) +// strcpysafe( cdkey,sizeof(cdkey), CHAR_getChar( charaindex, CHAR_CDKEY)); +// else +// strcpysafe( cdkey,sizeof(cdkey), CHAR_getChar( charaindex, CHAR_OWNERCDKEY) ); + +// print("\n ķ!ս״̬!!:%s ", cdkey ); + + return 1; + } + return 0; +} + diff --git a/battle/battle_event.c b/battle/battle_event.c new file mode 100644 index 0000000..6122f88 --- /dev/null +++ b/battle/battle_event.c @@ -0,0 +1,10080 @@ +#include "version.h" +#include +#include +#include "char.h" +#include "char_event.h" +#include "battle.h" +#include "battle_event.h" +#include "configfile.h" +#include "pet.h" +#include "log.h" +#include "lssproto_serv.h" +#include "anim_tbl.h" +#include "battle_magic.h" +#include "util.h" +#include "enemy.h" +#include "pet_skill.h" +#include "char_base.h" +#include "item_event.h" + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#include "item.h" +#include "skill.h" +#endif +#ifdef _PETSKILL_LER +#include "magic_base.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#define DEFENSE_RATE (0.5) +#define DAMAGE_RATE (2.0) +#define CRITICAL_RATE (1.0) +#define KAWASHI_MAX_RATE (75) + +#define AJ_SAME (1.0) + +#define AJ_UP (1.5) +#define AJ_DOWN (0.6) + +#define ATTR_MAX 100 +#define D_ATTR (1.0/(ATTR_MAX*ATTR_MAX)) + +#define D_16 (1.0/16) +#define D_8 (1.0/8) + +float gKawashiPara = 0.02; +float gCounterPara = 0.08; +float gCriticalPara = 0.09; + +float gBattleDamageModyfy; +int gBattleDuckModyfy; +int gBattleStausChange; +int gBattleStausTurn; +float gDuckPer; +int gCriper; + +int gBattleBadStatusTbl[BATTLE_ENTRY_MAX*2]; + +#ifdef _OTHER_MAGICSTAUTS +#ifdef _MAGICSTAUTS_RESIST +char MagicStatus[MAXSTATUSTYPE][36] = { "NULL","ħ","","","翹",""}; +int MagicTbl[] = { -1, CHAR_DEFMAGICSTATUS, CHAR_MAGICSUPERWALL, CHAR_MAGICFIRE, CHAR_MAGICTHUNDER, CHAR_MAGICICE }; +#else +char MagicStatus[MAXSTATUSTYPE][36] = { "NULL","ħ",""}; +int MagicTbl[] = { -1, CHAR_DEFMAGICSTATUS, CHAR_MAGICSUPERWALL }; +#endif //_MAGICSTAUTS_RESIST +#endif + +char *aszStatus[] = { "ȫ", "", "", "", "ʯ", "", "", "", "", "", "Ĭ" +#ifdef _PET_SKILL_SARS // WON ADD ɷ + ,"ɷ" +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,"","","","","","","","","","","˪","","ר","","","","","","" +#endif +#ifdef _PROFESSION_ADDSKILL + ,"" +#endif +}; + +char *aszStatusFull[] = { "ȫ", "", "", "˯", "ʯ", "", "", "", "綾", "ħ", "Ĭ" +#ifdef _PET_SKILL_SARS // WON ADD ɷ + ,"ɷ" +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,"ѣ","","","","","","Ѫ","һѪ","","", + "","׸","רעս","","","׿","","","׸" +#endif +}; + +int StatusTbl[] = { -1, CHAR_WORKPOISON, CHAR_WORKPARALYSIS, + CHAR_WORKSLEEP, CHAR_WORKSTONE, + CHAR_WORKDRUNK, CHAR_WORKCONFUSION, + CHAR_WORKWEAKEN, CHAR_WORKDEEPPOISON, + CHAR_WORKBARRIER, CHAR_WORKNOCAST +#ifdef _PET_SKILL_SARS // WON ADD ɷ + ,CHAR_WORKSARS +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,CHAR_WORKDIZZY, CHAR_WORKENTWINE + ,CHAR_WORKDRAGNET, CHAR_WORKICECRACK + ,CHAR_WORKOBLIVION, CHAR_WORKICEARROW + ,CHAR_WORKBLOODWORMS, CHAR_WORKSIGN + ,CHAR_WORKINSTIGATE, CHAR_WORK_F_ENCLOSE + ,CHAR_WORK_I_ENCLOSE, CHAR_WORK_T_ENCLOSE + ,CHAR_WORK_FOCUS, CHAR_WORKRESIST_F + ,CHAR_WORKRESIST_I, CHAR_WORKRESIST_T + ,CHAR_WORK_F_ENCLOSE_2, CHAR_WORK_I_ENCLOSE_2 + ,CHAR_WORK_T_ENCLOSE_2 +#endif +#ifdef _PROFESSION_ADDSKILL + ,CHAR_WORKERSIST_F_I_T, CHAR_WORKWATER//ˮ + ,CHAR_WORKANNEX// + ,CHAR_WORKFEAR//־ + ,CHAR_WORKICECRACK2 + ,CHAR_WORKICECRACK3 + ,CHAR_WORKICECRACK4 + ,CHAR_WORKICECRACK5 + ,CHAR_WORKICECRACK6 + ,CHAR_WORKICECRACK7 + ,CHAR_WORKICECRACK8 + ,CHAR_WORKICECRACK9 + ,CHAR_WORKICECRACK10 +#endif + }; + +int RegTbl[] = { -1, CHAR_WORKMODPOISON, CHAR_WORKMODPARALYSIS, + CHAR_WORKMODSLEEP, CHAR_WORKMODSTONE, + CHAR_WORKMODDRUNK, CHAR_WORKMODCONFUSION, + CHAR_WORKMODWEAKEN, CHAR_WORKMODDEEPPOISON, + CHAR_WORKMODBARRIER, CHAR_WORKMODNOCAST +#ifdef _PET_SKILL_SARS // WON ADD ɷ + ,CHAR_WORKMODSARS +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,CHAR_WORKMODDIZZY, CHAR_WORKMODENTWINE + ,CHAR_WORKMODDRAGNET, CHAR_WORKMODICECRACK + ,CHAR_WORKMODOBLIVION, CHAR_WORKMODICEARROW + ,CHAR_WORKMODBLOODWORMS, CHAR_WORKMODSIGN + ,CHAR_WORKMODINSTIGATE, CHAR_WORKMOD_F_ENCLOSE + ,CHAR_WORKMOD_I_ENCLOSE, CHAR_WORKMOD_T_ENCLOSE + ,CHAR_WORKMOD_FOCUS, CHAR_WORKMODRESIST_F + ,CHAR_WORKMODRESIST_I, CHAR_WORKMODRESIST_T + ,CHAR_WORKMOD_F_ENCLOSE_2, CHAR_WORKMOD_I_ENCLOSE_2 + ,CHAR_WORKMOD_T_ENCLOSE_2 +#endif + }; + +char *aszMagicDef[] = { "", "", "", "" +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,"" +#endif +#ifdef _PETSKILL_ACUPUNCTURE + ,"" +#endif +}; + + + +char *aszMagicDefFull[] = { "ͨ", "", "", "Ч" +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,"" +#endif +#ifdef _PETSKILL_ACUPUNCTURE + ,"" +#endif +}; + + +int MagicDefTbl[] = { -1, CHAR_WORKDAMAGEABSROB, CHAR_WORKDAMAGEREFLEC, CHAR_WORKDAMAGEVANISH +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + ,CHAR_WORKTRAP +#endif +#ifdef _PETSKILL_ACUPUNCTURE + ,CHAR_WORKACUPUNCTURE +#endif +}; + +char *aszParamChange[] = { "", "", "", "", "", "" }; +char *aszParamChangeFull[] = { "", "", "", "ٶ", "", "" }; +int aParamChangeTbl[] = { -1, CHAR_WORKMODATTACK, CHAR_WORKMODDEFENCE, + CHAR_WORKMODQUICK, CHAR_WORKMODCHARM, CHAR_WORKMODCAPTURE }; + +// Robin 0727 Ride Pet +// ȡindex +int BATTLE_getRidePet( int charaindex ) +{ + int petindex = -1; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER && CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYERNPC ) + return -1; + else + { + int rideIndex = CHAR_getInt( charaindex, CHAR_RIDEPET ); + if( rideIndex == -1 ) + return -1; + petindex = CHAR_getCharPet( charaindex, rideIndex ); + if( !CHAR_CHECKINDEX( petindex ) ) return -1; + + } + + return petindex; + +} + +// ȡʱΧ +float BATTLE_adjustRidePet3A( int charaindex, int petindex, int workindex, int action ) +{ + float ret = CHAR_getWorkInt( charaindex, workindex ); + BOOL throwweapon = BATTLE_IsThrowWepon(CHAR_getItemIndex( charaindex, CHAR_ARM ) ); + + switch( workindex ) { + case CHAR_WORKATTACKPOWER : // + if( throwweapon ) // Ͷ + ret = CHAR_getWorkInt( charaindex, CHAR_WORKATTACKPOWER ) +#ifdef _BATTLE_NEWPOWER //andy 1/24 reEdit + + CHAR_getWorkInt( petindex, CHAR_WORKATTACKPOWER )*0.4; +#else + + CHAR_getWorkInt( petindex, CHAR_WORKATTACKPOWER )*0.2; +#endif + else // ս + ret = CHAR_getWorkInt( charaindex, CHAR_WORKATTACKPOWER )*0.8 + + CHAR_getWorkInt( petindex, CHAR_WORKATTACKPOWER )*0.8; + break; + case CHAR_WORKDEFENCEPOWER : // + ret = CHAR_getWorkInt( charaindex, CHAR_WORKDEFENCEPOWER )*0.7 + + CHAR_getWorkInt( petindex, CHAR_WORKDEFENCEPOWER )*0.7; + break; + case CHAR_WORKQUICK : // + if( action == ATTACKSIDE ) { + if( throwweapon ) { + ret = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )*0.8 + + CHAR_getWorkInt( petindex, CHAR_WORKQUICK )*0.2; + }else { +#ifdef _BATTLE_NEWPOWER //andy 1/24 reEdit + ret = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )*0.2 + + CHAR_getWorkInt( petindex, CHAR_WORKQUICK )*0.8; + +#else + ret = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )*0.5 + + CHAR_getWorkInt( petindex, CHAR_WORKQUICK )*0.5; +#endif + } + }else + if( action == DEFFENCESIDE ){ + ret = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )*0.1 + + CHAR_getWorkInt( petindex, CHAR_WORKQUICK )*0.9; + } + break; + default : + ret = CHAR_getWorkInt( charaindex, workindex ); + } + + //print(" adj3A_Now:%d:%d=%f ", charaindex, workindex, ret); + + return ret; +} + +// Robin 0727 ride Pet ͼ +void BATTLE_changeRideImage( int index ) +{ + int itemindex = CHAR_getItemIndex(index,CHAR_ARM); + int category; + int newimagenumber; + int basebaseimagenumber + = CHAR_getInt(index,CHAR_BASEBASEIMAGENUMBER); + if( !ITEM_CHECKINDEX(itemindex) ) { + category = ITEM_FIST; + }else { + category = ITEM_getInt(itemindex,ITEM_TYPE ); + } + newimagenumber = CHAR_getNewImagenumberFromEquip( + basebaseimagenumber, category); + if( newimagenumber == -1) { + CHAR_setInt( index, CHAR_BASEIMAGENUMBER, basebaseimagenumber); + }else { + CHAR_setInt( index, CHAR_BASEIMAGENUMBER, newimagenumber); + } +} + +void BATTLE_talkToCli( + int charaindex, + char *pszBuffer, + int color +) +{ + if( getBattleDebugMsg( ) != 0 + && CHAR_getFlg( charaindex, CHAR_ISSHOWBATTLEMSG ) + ){ + CHAR_talkToCli( charaindex, -1, pszBuffer, color ); + } +} + + +int BATTLE_BroadCastBase( + int battleindex, + char *pszBuffer, + int color, + int flg +) +{ + int i, j, pindex; + BATTLE_ENTRY *pEntry; + + if( flg != 1 && getBattleDebugMsg( ) == 0 )return 0; + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return BATTLE_ERR_BATTLEINDEX; + + for( j = 0; j < 2; j ++ ){ + pEntry = BattleArray[battleindex].Side[j].Entry; + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + pindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getInt( pindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + if( CHAR_getFlg( pindex, CHAR_ISSHOWBATTLEMSG ) == FALSE ) continue; + CHAR_talkToCli( pindex, -1, pszBuffer, color ); + } + } + + return 0; +} + +// Nuke 20040112 fix for performance +/*int BATTLE_BroadCast( + int battleindex, + char *pszBuffer, + int color +) +{ + return BATTLE_BroadCastBase( battleindex, pszBuffer, color, 0 ); + +} + +int BATTLE_BroadCastOn( + int battleindex, + char *pszBuffer, + int color +) +{ + return BATTLE_BroadCastBase( battleindex, pszBuffer, color, 1 ); +} +*/ + +#ifdef _TAKE_ITEMDAMAGE +int BATTLE_ItemCrushCheck( int charaindex , int flg) +{//flg def 1 att 2 + int EquipTbl[CHAR_EQUIPPLACENUM], itemindex; + int i, rndwork; + int Crushs=0; + //char szBuffer[256]; + + memset( EquipTbl, -1, sizeof( EquipTbl)); + if( flg == 2 ) { + itemindex = CHAR_getItemIndex( charaindex, CHAR_ARM); + if( ITEM_CHECKINDEX( itemindex) == TRUE ) { + return CHAR_ARM; + } + return -1; + }else { + int equipnum; +#ifdef _TAKE_ITEMDAMAGE_FOR_PET + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET){ + equipnum = CHAR_PETITEMNUM; + }else +#endif + equipnum = CHAR_EQUIPPLACENUM; +#ifdef _TAKE_ITEMDAMAGE_FIX + rndwork = rand() % equipnum; +#else + Crushs = rand()%100; + if( Crushs < 50 ) { + rndwork = CHAR_BODY; + }else if( Crushs >= 50 && Crushs < 67 ) { + rndwork = CHAR_HEAD; + }else if( Crushs >= 67 && Crushs < 84 ) { + rndwork = CHAR_DECORATION1; + }else { + rndwork = CHAR_DECORATION2; + } +#endif + for( i = 0; i < equipnum; i ++ ){//CHAR_ARM + itemindex = CHAR_getItemIndex( charaindex, rndwork); + if( ITEM_CHECKINDEX( itemindex) == TRUE && rndwork != CHAR_ARM ){ + return rndwork; + }else { + rndwork++; + rndwork=rndwork%5; + } + } + } + + return -1; +} +#else +int BATTLE_ItemCrushCheck( int charaindex ) +{ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return FALSE; + } + if( RAND( 1, gItemCrushRate ) < CHAR_getInt( charaindex, CHAR_LV ) ){ + return TRUE; + }else{ + return FALSE; + } +} +#endif + +#define BREAK_NAME_WEPON "" +#define BREAK_NAME_AROMER "" +#define BREAK_BRACELET "" +#define BREAK_MUSIC "" +#define BREAK_NECKLACE "ͷ" +#define BREAK_RING "ָ" +#define BREAK_BELT "Ƥ" +#define BREAK_EARRING "" +#define BREAK_NOSERING "ǻ" +#define BREAK_AMULET "" +#define BREAK_OTHER "" + +#ifdef _TAKE_ITEMDAMAGE +static char *aszCrushTbl[] = { "", "", "ٻ" , "ʹ" , "Ƭ" }; +#else +static char *aszCrushTbl[] = { "", "ٻ" }; +#endif + + +#ifdef _TAKE_ITEMDAMAGE +int BATTLE_ItemCrush( int charaindex, int ItemEquip, int Damages, int flg) +{ + int itemindex, breadnums; + int crushlevel, crushenum, maxcrushenum; + char szBuffer[256]=""; + int battleindex, bid; + + itemindex = CHAR_getItemIndex( charaindex, ItemEquip ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE ) + return -1; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + bid = BATTLE_Index2No( battleindex, charaindex ); + + crushlevel = ITEM_getInt( itemindex, ITEM_CRUSHLEVEL); + if( crushlevel < 0 ) crushlevel=0; + + crushenum = ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE); + maxcrushenum = ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE); + if( maxcrushenum < 1 ) return -1; + if( ItemEquip == CHAR_ARM ) { + if( (breadnums = ((Damages-50)/40)) <= 0 ) + breadnums = 1; + }else { + if( Damages >= 200 ) breadnums = 1; + if( (breadnums = ((200 - Damages)/20)) < 0 ) + breadnums = 1; + } + crushenum = crushenum - RAND( breadnums, (breadnums*1.4) ); + ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, crushenum); + + if( crushenum <= 0 ){ //ʧ + crushenum = 0; + sprintf(szBuffer, "%s𻵶ʧ\n", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORYELLOW); + +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "𻵶ʧ", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + CHAR_DelItem( charaindex, ItemEquip); + crushlevel = 4; + }else { //𻵿ֵ + int defs, level=0; + + + defs = (crushenum*100)/maxcrushenum; + + if( defs >= 70 ){ + level = 0; + }else if( defs >= 50 && defs < 70 ) { + level = 1; + }else if( defs >= 30 && defs < 50 ) { + level = 2; + }else if( defs < 30 ) { + level = 3; + } + + if( level != crushlevel && defs < 70 ) { + ITEM_setInt( itemindex, ITEM_CRUSHLEVEL, level); +// for( i = 0; i < arraysizeof( ItemBreakPos ); i ++ ){ +// work = ITEM_getInt( itemindex, ItemBreakPos[i] ); +// if( work <= 0 )continue; +// work *=0.95; +// ITEM_setInt( itemindex, ItemBreakPos[i], work ); +// } + sprintf( szBuffer, "%s%sġ", + ITEM_getChar( itemindex, ITEM_NAME ), aszCrushTbl[level] ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORRED); + //ĵ˵ +// buf1 = ITEM_getChar( itemindex, ITEM_SECRETNAME); +// if( strstr( buf1, "(") != 0 ) { +// char buf5[256]; +// if( getStringFromIndexWithDelim( buf1,"(",1, buf5, sizeof( buf5)) != FALSE ) { +// sprintf( buf1, buf5); +// } +// } +// sprintf( buf2, "%s(%s)", buf1, aszCrushTbl[level]); +// ITEM_setChar( itemindex, ITEM_SECRETNAME, buf2); + } + } + + CHAR_sendItemDataOne( charaindex, ItemEquip ); +#ifdef _ATTREVERSE_FIX + if(getAttReverse()==1){ + //if(CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_REVERSE){ + if(CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEREVERSE)==1){ + CHAR_complianceParameter2(charaindex); + }else{ +#endif + CHAR_complianceParameter( charaindex ); +#ifdef _ATTREVERSE_FIX + } + }else{ + CHAR_complianceParameter( charaindex ); + } +#endif + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_ATK | CHAR_P_STRING_DEF + | CHAR_P_STRING_QUICK | CHAR_P_STRING_CHARM ); + + return TRUE; +} +#else +int BATTLE_ItemCrush( int charaindex ) +{ + int EquipTbl[CHAR_EQUIPPLACENUM], i, itemindex, rndwork, type; + int work, crushlevel, j, ItemEquip; + char szBuffer[256]=""; + + int ItemBreakPos[] = { + ITEM_ATTACKNUM_MIN, + ITEM_ATTACKNUM_MAX, + ITEM_MODIFYATTACK, + ITEM_MODIFYDEFENCE, + ITEM_MODIFYQUICK, + ITEM_MODIFYHP, + ITEM_MODIFYMP, + ITEM_MODIFYLUCK, + ITEM_MODIFYCHARM, + ITEM_MODIFYAVOID, + }; + + for( j = 0, i = 0; i < CHAR_EQUIPPLACENUM; i ++ ){ + itemindex = CHAR_getItemIndex( charaindex, i ); + if( ITEM_CHECKINDEX( itemindex ) == TRUE + && ITEM_getInt( itemindex, ITEM_MERGEFLG ) == 1 ){ + EquipTbl[j] = i; + j ++; + } + } + if( j == 0 )return FALSE; + rndwork = RAND( 0, j-1 ); + ItemEquip = EquipTbl[rndwork]; + itemindex = CHAR_getItemIndex( charaindex, ItemEquip ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE )return FALSE; + crushlevel = ITEM_getInt( itemindex, ITEM_CRUSHLEVEL ); + if( crushlevel > 1 ) return FALSE; + { + if( crushlevel == 1 ){ + sprintf( szBuffer, "CrushLv2(ٻLv2)" ); + }else{ + sprintf( szBuffer, "CrushLv1(ٻLv1)" ); + } +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// szBuffer, +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// +// ); + } + + /*{ int battleindex, bid; + //sprintf( szBuffer, "(%s)(%s)(%s)\n", + // CHAR_getUseName( charaindex ), + // ITEM_getChar( itemindex, ITEM_NAME ), + // aszCrushTbl[crushlevel] ); + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + bid = BATTLE_Index2No( battleindex, charaindex ); + //BATTLE_BroadCast( battleindex, szBuffer, + (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }*/ + + type = ITEM_getInt( itemindex, ITEM_TYPE ); + szBuffer[0] = 0; + switch( type ){ + case ITEM_FIST: + case ITEM_AXE: + case ITEM_CLUB: + case ITEM_SPEAR: + case ITEM_BOW: + case ITEM_BOOMERANG: + case ITEM_BOUNDTHROW: + case ITEM_BREAKTHROW: + sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_NAME_WEPON ); + break; + + case ITEM_HELM: + case ITEM_ARMOUR: + sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_NAME_AROMER ); + break; + + case ITEM_BRACELET: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_BRACELET );break; + case ITEM_MUSIC: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_MUSIC );break; + case ITEM_NECKLACE: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_NECKLACE );break; + case ITEM_RING: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_RING );break; + case ITEM_BELT: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_BELT );break; + case ITEM_EARRING: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_EARRING );break; + case ITEM_NOSERING: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_NOSERING );break; + case ITEM_AMULET: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_AMULET );break; + case ITEM_OTHER: sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_OTHER );break; + default: + sprintf( szBuffer, "%s%s", aszCrushTbl[crushlevel], BREAK_OTHER );break; + break; + } + ITEM_setChar( itemindex, ITEM_SECRETNAME, szBuffer ); + + for( i = 0; i < arraysizeof( ItemBreakPos ); i ++ ){ + work = ITEM_getInt( itemindex, ItemBreakPos[i] ); + if( work <= 0 )continue; + if( crushlevel == 1 ){ + work = 1; + }else{ + work /= 2; + if( work < 1 ) work = 1; + } + ITEM_setInt( itemindex, ItemBreakPos[i], work ); + } + CHAR_sendItemDataOne( charaindex, ItemEquip ); + ITEM_setInt( itemindex, ITEM_CRUSHLEVEL, crushlevel + 1 ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_ATK + | CHAR_P_STRING_DEF + | CHAR_P_STRING_QUICK + | CHAR_P_STRING_CHARM ); + + return TRUE; +} +#endif + +#ifdef _TAKE_ITEMDAMAGE +static int BATTLE_ItemCrushSeq( int attackindex, int charaindex, int Damages) +{ + int iRet = FALSE; + int crushindex=-1, crushpower; + int flg=0;//flg def 1 att 2 + + flg=1; + if( ( crushindex = BATTLE_ItemCrushCheck( charaindex, flg) ) >= 0 ) { + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER +#ifdef _TAKE_ITEMDAMAGE_FOR_PET + || CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPET +#endif + ){ + crushpower = CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER); + BATTLE_ItemCrush( charaindex, crushindex, Damages, flg); + } + } + flg=2; + if( ( crushindex = BATTLE_ItemCrushCheck( attackindex, flg) ) >= 0 ) { + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER +#ifdef _TAKE_ITEMDAMAGE_FOR_PET + || CHAR_getInt( attackindex, CHAR_WHICHTYPE) == CHAR_TYPEPET +#endif + ){ + crushpower = CHAR_getWorkInt( charaindex, CHAR_WORKDEFENCEPOWER); + BATTLE_ItemCrush( attackindex, crushindex, Damages, flg); + } + } + + return iRet; +} + +#else + +static int BATTLE_ItemCrushSeq( int charaindex ) +{ + char szWork[256]; + int iRet = FALSE; + + if( BATTLE_ItemCrushCheck( charaindex ) == TRUE ){ + if( BATTLE_ItemCrush( charaindex ) == TRUE ){ + sprintf( szWork, "BK|%s\tװܵˡ", + CHAR_getUseName( charaindex ) ); + strcatsafe( szBadStatusString,sizeof(szBadStatusString), szWork ); + iRet = TRUE; + } + } + return iRet; +} +#endif + +#ifdef _EQUIT_ARRANGE +static BOOL BATTLE_ArrangeCheck( int attackindex, int defindex) +{ + int DEF_ARR; + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD ){ + return FALSE; + } + if( BATTLE_GetDamageReact( defindex ) > 0 ){ + return FALSE; + } + if( BATTLE_CanMoveCheck( defindex ) == FALSE ){ + return FALSE; + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_NODUCK ){ + return FALSE; + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + return FALSE; + } + if( (DEF_ARR = CHAR_getWorkInt( defindex, CHAR_WORKARRANGEPOWER )) > 0 ){ + int per = (DEF_ARR > 700)?700:DEF_ARR; + if( RAND( 1, 1000 ) <= per ){ + return TRUE; + } + } + + return FALSE; +} +#endif + +//رж +static BOOL BATTLE_DuckCheck( + int attackindex, + int defindex +) +{ + int flg = FALSE; + + int Df_Dex, At_Dex, Df_Luck = 0; + float per, Work, wari, Big, Small; + + gDuckPer = 0; + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD ){ + return FALSE; + } + if( BATTLE_GetDamageReact( defindex ) > 0 ){ + return FALSE; + } + if( BATTLE_CanMoveCheck( defindex ) == FALSE ){ +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( defindex, CHAR_DOOMTIME ) <= 0 )//ʱ(ûд޵Ͷܻ״̬) + return FALSE; + else{ + if( CHAR_getWorkInt( defindex, CHAR_WORKDRAGNET ) == 0 + && CHAR_getWorkInt( defindex, CHAR_WORKDIZZY ) == 0 ){ + } + else{ + return FALSE; + } + } +#else + return FALSE; +#endif + } + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_NODUCK ){ + return FALSE; + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + return FALSE; + } + +#ifdef _PETSKILL_SETDUCK + if( BATTLE_CheckMySkillDuck( defindex ) == TRUE ){ + return TRUE; + } +#endif + + At_Dex = CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX ); + Df_Dex = CHAR_getWorkInt( defindex, CHAR_WORKFIXDEX ); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + Df_Luck = CHAR_getWorkInt( defindex, CHAR_WORKFIXLUCK ); + } + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + At_Dex *= 0.8; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) != CHAR_TYPEENEMY + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + ){ + Df_Dex *= 0.8; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + At_Dex *= 0.6; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + Df_Dex *= 0.6; + } + + if( Df_Dex >= At_Dex ){ + Big = Df_Dex; + Small = At_Dex; + wari = 1.0; + }else{ + Big = At_Dex; + Small = Df_Dex; + if( Big <= 0 ){ + wari = 0.0; + }else{ + wari = Small / Big; + } + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_JYUJYUTU ){ + gKawashiPara = 0.027; + }else{ + gKawashiPara = 0.02; + } + Work = ( Big - Small ) / gKawashiPara; + if( Work <= 0 ) Work = 0; + per = (float)( sqrt( (double)Work ) ); + per *= wari; + per += Df_Luck; + + per += gBattleDuckModyfy; + if( CHAR_getWorkInt( attackindex, CHAR_WORKDRUNK ) > 0 ){ + per += RAND( 20, 30 ); + } + if( gWeponType == ITEM_BOW ){ + per += 20; + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_NOGUARD ){ + per += CHAR_GETWORKINT_HIGH( defindex, CHAR_WORKBATTLECOM3 ); + } + + if( gWeponType == ITEM_BOW ){ + per += 20; + } + + per *= 100; + if( per > KAWASHI_MAX_RATE*100 ) per = KAWASHI_MAX_RATE*100; + if( per <= 0 ) per = 1; + + gDuckPer = per * 0.01; +#ifdef _EQUIT_HITRIGHT + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int AddHit = CHAR_getWorkInt( attackindex, CHAR_WORKHITRIGHT); + per -= RAND( AddHit*0.8, AddHit*1.2); + per = ( per < 0 )?0:per; + } +#endif + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + per = BATTLE_check_profession_duck( defindex, per ); +#endif + +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_CHAOS ){ //ҹʱн + per += (per*0.4); + } +#endif + + if( RAND( 1, 10000 ) <= per ){ + flg = TRUE; +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + // رܼ + if( (CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) ){ + PROFESSION_SKILL_LVEVEL_UP( defindex, "PROFESSION_AVOID" ); + } +#endif + }else{ + flg = FALSE; + } + return flg; +} + +static int BATTLE_AttrCalc( + int My_Fire, + int My_Water, + int My_Earth, + int My_Wind, + int My_None, + int Vs_Fire, + int Vs_Water, + int Vs_Earth, + int Vs_Wind, + int Vs_None +) +{ + int iRet = 0; + My_Fire = My_Fire * Vs_None * AJ_UP + + My_Fire * Vs_Fire * AJ_SAME + + My_Fire * Vs_Water * AJ_DOWN + + My_Fire * Vs_Earth * AJ_SAME + + My_Fire * Vs_Wind * AJ_UP; + My_Water = My_Water * Vs_None * AJ_UP + + My_Water * Vs_Fire * AJ_UP + + My_Water * Vs_Water * AJ_SAME + + My_Water * Vs_Earth * AJ_DOWN + + My_Water * Vs_Wind * AJ_SAME; + + My_Earth = My_Earth * Vs_None * AJ_UP + + My_Earth * Vs_Fire * AJ_SAME + + My_Earth * Vs_Water * AJ_UP + + My_Earth * Vs_Earth * AJ_SAME + + My_Earth * Vs_Wind * AJ_DOWN; + + My_Wind = My_Wind * Vs_None * AJ_UP + + My_Wind * Vs_Fire * AJ_DOWN + + My_Wind * Vs_Water * AJ_SAME + + My_Wind * Vs_Earth * AJ_UP + + My_Wind * Vs_Wind * AJ_SAME; + + My_None = My_None * Vs_None * AJ_SAME + + My_None * Vs_Fire * AJ_DOWN + + My_None * Vs_Water * AJ_DOWN + + My_None * Vs_Earth * AJ_DOWN + + My_None * Vs_Wind * AJ_DOWN; + + iRet = (My_Fire + My_Water + My_Earth + My_Wind + My_None) ; + return (iRet * D_ATTR); +} + +static void BATTLE_GetAttr( int charaindex, int *T_pow ) +{ +#ifdef _BATTLE_NEWPOWER +#else + int petindex = BATTLE_getRidePet( charaindex ); + if( petindex == -1 ){ +#endif + T_pow[0] = CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT ); + T_pow[1] = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT ); + T_pow[2] = CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT ); + T_pow[3] = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT ); +/* + *pAt_Fire = CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT ); + *pAt_Water = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT ); + *pAt_Earth = CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT ); + *pAt_Wind = CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT ); +*/ +#ifdef _BATTLE_NEWPOWER +#else + }else { // Robin 0727 when Ride Pet +#endif +#ifdef _BATTLE_NEWPOWER +#else + T_pow[0] = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXEARTHAT )) /2; + T_pow[1] = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXWATERAT )) /2; + T_pow[2] = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXFIREAT )) /2; + T_pow[3] = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXWINDAT )) /2; +/* + *pAt_Fire = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXFIREAT )) /2; + *pAt_Water = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXWATERAT )) /2; + *pAt_Earth = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXEARTHAT )) /2; + *pAt_Wind = ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT ) + + CHAR_getWorkInt( petindex, CHAR_WORKFIXWINDAT )) /2; +*/ + } +#endif + //print("\n1=%d,ˮ1=%d,1=%d,1=%d\n",T_pow[0],T_pow[1],T_pow[2],T_pow[3]); +#ifdef _PROFESSION_ADDSKILL + //Ͻ + //T_pow[0] += T_pow[0]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXEARTHAT_BOUNDARY )>>16&0x0000ffff) /100 ); + //T_pow[1] += T_pow[1]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY )>>16&0x0000ffff) /100 ); + //T_pow[2] += T_pow[2]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY )>>16&0x0000ffff) /100 ); + //T_pow[3] += T_pow[3]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY )>>16&0x0000ffff) /100 ); +#endif +#ifdef _SUIT_TWFWENDUM + T_pow[0] = (T_pow[0]+CHAR_getWorkInt( charaindex, CHAR_WORK_EA ))>100?100:(T_pow[0]+CHAR_getWorkInt( charaindex, CHAR_WORK_EA )); + T_pow[1] = (T_pow[1]+CHAR_getWorkInt( charaindex, CHAR_WORK_WR ))>100?100:(T_pow[1]+CHAR_getWorkInt( charaindex, CHAR_WORK_EA )); + T_pow[2] = (T_pow[2]+CHAR_getWorkInt( charaindex, CHAR_WORK_FI ))>100?100:(T_pow[2]+CHAR_getWorkInt( charaindex, CHAR_WORK_EA )); + T_pow[3] = (T_pow[3]+CHAR_getWorkInt( charaindex, CHAR_WORK_WI ))>100?100:(T_pow[3]+CHAR_getWorkInt( charaindex, CHAR_WORK_EA )); +#endif + //print("\n2=%d,ˮ2=%d,2=%d,2=%d\n",T_pow[0],T_pow[1],T_pow[2],T_pow[3]); + { + int i, renum=ATTR_MAX; + for( i=0; i<4; i++) { + if( T_pow[ i] < 0 ) T_pow[ i] = 0; + renum -= T_pow[ i]; + } + if( renum < 0 ) renum = 0; + T_pow[ 4] = renum; + } + //print("\n2=%d,ˮ2=%d,2=%d,2=%d\n",T_pow[0],T_pow[1],T_pow[2],T_pow[3]); +/* + if( *pAt_Fire < 0 ) *pAt_Fire = 0; + if( *pAt_Water < 0 ) *pAt_Water = 0; + if( *pAt_Earth < 0 ) *pAt_Earth = 0; + if( *pAt_Wind < 0 ) *pAt_Wind = 0; + *pAt_None = ATTR_MAX - *pAt_Fire - *pAt_Water - *pAt_Earth - *pAt_Wind; + if( *pAt_None < 0 )*pAt_None = 0; +*/ +} + + +float BATTLE_FieldAttAdjust( + int battleindex, + int pAt_Fire, + int pAt_Water, + int pAt_Earth, + int pAt_Wind +) +{ + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return 0.0; +#define AJ_BOTTOM (0.5) +#define AJ_PLUS (0.5) + int att; + float power, a_pow; + att = BattleArray[battleindex].field_att; + a_pow = (float)(BattleArray[battleindex].att_pow); + //print("\natt=%d\n",att); + switch( att ){ + case BATTLE_ATTR_EARTH: + power = AJ_BOTTOM + (pAt_Earth) * a_pow * 0.01 * 0.01 * AJ_PLUS; + break; + case BATTLE_ATTR_WATER: + power = AJ_BOTTOM + (pAt_Water) * a_pow * 0.01 * 0.01 * AJ_PLUS ; + break; + case BATTLE_ATTR_FIRE: + power = AJ_BOTTOM + (pAt_Fire) * a_pow * 0.01 * 0.01 * AJ_PLUS ; + break; + case BATTLE_ATTR_WIND: + power = AJ_BOTTOM + (pAt_Wind) * a_pow * 0.01 * 0.01 * AJ_PLUS ; + break; + default: + power = AJ_BOTTOM; + break; + } + return power; +} + +static int BATTLE_AttrAdjust( + int attackindex, + int defindex, + int damage +) +{ + int At_pow[5]={0,0,0,0,0}; //ˮ + int Dt_pow[5]={0,0,0,0,0}; + int i; + float At_FieldPow, Df_FieldPow; +#ifdef _BATTLE_PROPERTY + int (*loopfunc)(int,int,int*,int*,int)=NULL; +#endif + + BATTLE_GetAttr( attackindex, At_pow); + BATTLE_GetAttr( defindex, Dt_pow); + //print("\n1=%d,ˮ1=%d,1=%d,1=%d\n",At_pow[0],At_pow[1],At_pow[2],At_pow[3]); + //print("\n2=%d,ˮ2=%d,2=%d,2=%d\n",Dt_pow[0],Dt_pow[1],Dt_pow[2],Dt_pow[3]); +#ifdef _PSKILL_MDFYATTACK + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1) == BATTLE_COM_S_MDFYATTACK ) { + int MKind=-1, MODS=0; + MKind = CHAR_GETWORKINT_LOW( attackindex, CHAR_WORKBATTLECOM4); + MODS = CHAR_GETWORKINT_HIGH( attackindex, CHAR_WORKBATTLECOM4); + + for( i=0; i<5; i++) { + At_pow[ i] = 0; + } + + if( MKind >= 0 && MKind <= 4 ){ + At_pow[ MKind] = MODS; + At_pow[ 4] = 0; + } + } +#endif +#ifdef _BATTLE_PROPERTY + loopfunc =(int(*)(int,int,int*,int*,int))CHAR_getFunctionPointer( attackindex, CHAR_BATTLEPROPERTY); + if( loopfunc ){ + loopfunc( attackindex, defindex, &damage, At_pow, 5); + } +#endif +#ifdef _BATTLE_PROPERTY + loopfunc = NULL; + loopfunc =(int(*)(int,int,int*,int*,int))CHAR_getFunctionPointer( defindex, CHAR_BATTLEPROPERTY); + if( loopfunc ){ + loopfunc( defindex, attackindex, &damage, Dt_pow, 5); + } +#endif + //print("\n1=%d,ˮ1=%d,1=%d,1=%d\n",At_pow[0],At_pow[1],At_pow[2],At_pow[3]); + //print("\n2=%d,ˮ2=%d,2=%d,2=%d\n",Dt_pow[0],Dt_pow[1],Dt_pow[2],Dt_pow[3]); + At_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ), At_pow[ 2], At_pow[ 1], At_pow[ 0], At_pow[ 3] ); + Df_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ), Dt_pow[ 2], Dt_pow[ 1], Dt_pow[ 0], Dt_pow[ 3] ); + //print("\nAt_FieldPow=%f,Df_FieldPow=%f\n",At_FieldPow,Df_FieldPow); + for( i=0; i<5; i++) { + At_pow[ i] *= damage; + } +/* + At_Fire *= damage; At_Water *= damage; At_pow[0] *= damage; + At_Wind *= damage; At_none *= damage; +*/ + //print("\ndamage1=%d,",damage); + damage = BATTLE_AttrCalc(//2ˮ103 + At_pow[ 2], At_pow[ 1], At_pow[ 0], At_pow[ 3], At_pow[ 4], + Dt_pow[ 2], Dt_pow[ 1], Dt_pow[ 0], Dt_pow[ 3], Dt_pow[ 4] ); + damage *= (At_FieldPow / Df_FieldPow); + //print("damage2=%d\n",damage); + return damage; +} + +int BATTLE_GuardAdjust( int damage ) +{ + int Rand = RAND( 1, 100 ); + if( Rand <= 25 ){ + damage *= 0.00; + }else{ + if( Rand <= 50 ){ + damage *= 0.10; + }else{ + if( Rand <= 70 ){ + damage *= 0.20; + }else{ + if( Rand <= 85 ){ + damage *= 0.30; + }else{ + if( Rand <= 95 ){ + damage *= 0.40; + }else{ + damage *= 0.50; + } + } + } + } + } + return damage; +} + +//˺ֵ +int BATTLE_DamageCalc( int attackindex, int defindex ) +{ + float attack, defense; + int damage = 0; + int attackpet = BATTLE_getRidePet( attackindex ); + int defpet = BATTLE_getRidePet( defindex ); + + // Robin 0727 Ride Pet + if( attackpet == -1 ) { + attack = CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ); + }else { + attack = BATTLE_adjustRidePet3A( attackindex, attackpet, CHAR_WORKATTACKPOWER, ATTACKSIDE ); + } + if( defpet == -1 ) { +#ifdef _BATTLE_NEWPOWER + defense = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ) * 0.70; +#else + defense = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ) * 0.45; + defense += CHAR_getWorkInt( defindex, CHAR_WORKQUICK ) * 0.2; + defense += CHAR_getWorkInt( defindex, CHAR_WORKFIXVITAL ) * 0.1; +#endif + }else { +#ifdef _BATTLE_NEWPOWER + defense = BATTLE_adjustRidePet3A( defindex, defpet, CHAR_WORKDEFENCEPOWER, DEFFENCESIDE ) * 0.70; +#else + defense = BATTLE_adjustRidePet3A( defindex, defpet, CHAR_WORKDEFENCEPOWER, DEFFENCESIDE ) * 0.45; + defense += BATTLE_adjustRidePet3A( defindex, defpet, CHAR_WORKQUICK, DEFFENCESIDE ) * 0.20; + defense += CHAR_getWorkInt( defindex, CHAR_WORKFIXVITAL ) * 0.05; +#endif + } + +#ifdef _MAGIC_SUPERWALL //ڷ + if( CHAR_getWorkInt( defindex, CHAR_MAGICSUPERWALL ) > 0 ){ + float def = (float)(CHAR_getWorkInt( defindex, CHAR_OTHERSTATUSNUMS )); + def = (def + rand()%20)/100; + defense += defense * def; + } +#endif +#ifdef _NPCENEMY_ADDPOWER //޸Ĺֵ + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + defense += (defense*(rand()%10)+2)/100; + } + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + attack += (attack*(rand()%10)+2)/100; + } +#endif + if( CHAR_getWorkInt( defindex, CHAR_WORKSTONE ) > 0 ) defense *= 2.0; + +#ifdef _PETSKILL_REGRET + //װ + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_REGRET + || CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_REGRET2 ) + defense = CHAR_getWorkInt(defindex,CHAR_WORKFIXTOUGH); +#endif + +#ifdef _EQUIT_NEGLECTGUARD //Ŀ% + if( CHAR_getWorkInt( attackindex, CHAR_WORKNEGLECTGUARD) > 1 ) { + float defp = (float)CHAR_getWorkInt( attackindex, CHAR_WORKNEGLECTGUARD); + defp = 1 - (defp/100); + defense = defense*defp; + } +#endif + + if( defense <= attack && attack < (defense * 8.0/7.0) ){ + damage = (int)(RAND( 0, attack * D_16 )); + }else + if( defense > attack ){ + damage = (int)(RAND( 0, 1 )); + }else + if( attack >= (defense * 8/7) ){ + float K0; + K0 = RAND( 0, attack*D_8 ) - attack*D_16; + damage = (int)(( (attack - defense )*DAMAGE_RATE ) + K0); + } + + // + damage = BATTLE_AttrAdjust( attackindex, defindex, damage ); + +#ifdef _PROFESSION_ADDSKILL + { + // + if( ((CHAR_getWorkInt( defindex, CHAR_WORKFIXEARTHAT_BOUNDARY )>>16) & 0x0000ffff) > 0 ){ + if( CHAR_getWorkInt( attackindex, CHAR_WORKFIXEARTHAT ) > 0 ) + damage -= damage*(float)((CHAR_getWorkInt( attackindex, CHAR_WORKFIXEARTHAT )/200.0)); + }else if( ((CHAR_getWorkInt( defindex, CHAR_WORKFIXWATERAT_BOUNDARY )>>16) & 0x0000ffff) > 0 ){ + if( CHAR_getWorkInt( attackindex, CHAR_WORKFIXWATERAT ) > 0 ) + damage -= damage*(float)((CHAR_getWorkInt( attackindex, CHAR_WORKFIXWATERAT )/200.0)); + }else if( ((CHAR_getWorkInt( defindex, CHAR_WORKFIXFIREAT_BOUNDARY )>>16) & 0x0000ffff) > 0 ){ + if( CHAR_getWorkInt( attackindex, CHAR_WORKFIXFIREAT ) > 0 ) + damage -= damage*(float)((CHAR_getWorkInt( attackindex, CHAR_WORKFIXFIREAT )/200.0)); + }else if( ((CHAR_getWorkInt( defindex, CHAR_WORKFIXWINDAT_BOUNDARY )>>16) & 0x0000ffff) > 0 ){ + if( CHAR_getWorkInt( attackindex, CHAR_WORKFIXWINDAT ) > 0 ) + damage -= damage*(float)((CHAR_getWorkInt( attackindex, CHAR_WORKFIXWINDAT )/200.0)); + } + //T_pow[1] += T_pow[1]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXWATERAT_BOUNDARY )>>16&0x0000ffff) /100 ); + //T_pow[2] += T_pow[2]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXFIREAT_BOUNDARY )>>16&0x0000ffff) /100 ); + //T_pow[3] += T_pow[3]*( (CHAR_getWorkInt( charaindex, CHAR_WORKFIXWINDAT_BOUNDARY )>>16&0x0000ffff) /100 ); + } +#endif + +#ifdef _ADD_DEAMGEDEFC //˺ & ӹ + { + int apower, dpower, otherpower; + apower = CHAR_getWorkInt( attackindex, CHAR_WORKOTHERDMAGE); + dpower = CHAR_getWorkInt( defindex, CHAR_WORKOTHERDEFC); + + otherpower = RAND( apower*0.3, apower) - RAND( dpower*0.3, dpower); + if( otherpower != 0 ) { + damage += otherpower; + } + } + if( damage < 0 ) + damage = 0; +#endif +#ifdef _DAMMAGE_CALC + return damage * getDamageCalc() / 100; +#else + return damage; +#endif +} + +static int BATTLE_CriticalCheckPlayer( int attackindex, int defindex ) +{ + int At_Dex, At_Luck = 0, At_Kiryoku = 0, At_Soubi = 0; + int At_SoubiIndex, Df_Dex, root = 1; + float per, Work, Big, Small, wari, divpara = gCriticalPara; + + // WON REM + //if( gWeponType == ITEM_BOW )return 0; + + At_Dex = CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX ); + Df_Dex = CHAR_getWorkInt( defindex, CHAR_WORKFIXDEX ); + + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + At_Luck = CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ); + } + At_SoubiIndex = CHAR_getItemIndex( attackindex, CHAR_ARM ); + At_Kiryoku = CHAR_getInt( attackindex, CHAR_MP ); + + if( ITEM_CHECKINDEX( At_SoubiIndex ) == TRUE ){ + At_Soubi = ITEM_getInt( At_SoubiIndex, ITEM_CRITICAL ); + } + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY){ + Df_Dex *= 0.8; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET){ + divpara = 10.0; + root = 0; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + divpara = 10.0; + root = 0; + }else + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER){ + Df_Dex *= 0.6; + } + + if( At_Dex >= Df_Dex ){ + Big = At_Dex; + Small = Df_Dex; + wari = 1.0; + }else{ + Big = Df_Dex; + Small = At_Dex; + if( Big <= 0 ){ + wari = 0.0; + }else{ + wari = Small / Big; + } + } + Work = ( Big - Small ) / divpara; + if( Work <= 0 ) Work = 0; + + if( root == 1 ){ + per = (float)( sqrt( (double)Work ) ) + At_Soubi * 0.5; + }else{ + per = (float)Work + At_Soubi * 0.5; + } + per *= wari; + per += At_Luck ; + per *= 100; + if( per < 0 ) per = 1; + if( per > 10000 ) per = 10000; +#ifdef _PETSKILL_LER + // ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) per = 0; +#endif + return (int)per; +} + +static int BATTLE_CounterCalc( int attackindex, int defindex ) +{ + int Df_Dex, At_Dex, Work, root = 1; + float per, Big, Small, wari, divpara = gCounterPara; + + At_Dex = CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX ); + Df_Dex = CHAR_getWorkInt( defindex, CHAR_WORKFIXDEX ); + + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + ){ + divpara = 10; + root = 0; + }else if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + ){ + Df_Dex *= 0.8; + }else if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + ){ + divpara = 10; + root = 0; + }else if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER + ){ + Df_Dex *= 0.6; + } + + if( At_Dex >= Df_Dex ){ + Big = At_Dex; + Small = Df_Dex; + wari = 1.0; + }else{ + Big = Df_Dex; + Small = At_Dex; + if( Big <= 0 ){ + wari = 0.0; + }else{ + wari = Small / Big; + } + } + Work = ( Big - Small ) / divpara; + if( Work <= 0 ) Work = 0; + if( root == 1 ){ + per = (float)( (double)sqrt( Work ) ); + }else{ + per = (float)( Work); + } + per *= wari; + + return per; +} + +static int BATTLE_CriticalCheck( int attackindex, int defindex ) +{ + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + return BATTLE_CriticalCheckPlayer( attackindex, defindex ); + }else{ + return BATTLE_CriticalCheckPlayer( attackindex, defindex ); + } +} + +static int BATTLE_CriDamageCalc( int attackindex, int defindex ) +{ + int damage = 0; + damage = BATTLE_DamageCalc( attackindex, defindex ); + + damage += CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ) + * (float)CHAR_getInt( attackindex, CHAR_LV ) + / (float)CHAR_getInt( defindex, CHAR_LV ) + * 0.5; + return damage; +} + +static int BATTLE_GuardianCheck( int attackindex, int defindex ) +{ + int GuardianIndex, Guardian, battleindex; + int DefSide = 0, i, DefNo; + //char szBuffer[256]=""; + + battleindex = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ); + + DefNo = BATTLE_Index2No( battleindex, defindex ); + i = DefNo; + if( i >= SIDE_OFFSET ){ + i -= SIDE_OFFSET; + DefSide = 1; + } + + if( BattleArray[battleindex].Side[DefSide].Entry[i].guardian == -1 ){ + return -1; + } + + Guardian = BattleArray[battleindex].Side[DefSide].Entry[i].guardian; +// Terry add fix ʹΪ˼ʱ,ʹô˼ܵclientᵱ + if(Guardian == DefNo) return -1; +// end + GuardianIndex = BATTLE_No2Index( battleindex, Guardian ); + + if( CHAR_CHECKINDEX( GuardianIndex ) == FALSE )return -1; + + if( CHAR_getFlg( GuardianIndex, CHAR_ISDIE ) == TRUE )return -1; + + if( CHAR_getWorkInt( GuardianIndex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_GUARDIAN ){ + }else{ + return -1; + } + + if( CHAR_getWorkInt( GuardianIndex, CHAR_WORKSLEEP ) > 0 + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKCONFUSION ) > 0 + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKPARALYSIS ) > 0 + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKSTONE ) > 0 + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKBARRIER ) > 0 + || GuardianIndex == attackindex +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKDIZZY ) > 0 // ѣ + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKDRAGNET ) > 0 // ޵ + || CHAR_getWorkInt( GuardianIndex, CHAR_WORKINSTIGATE ) > 0 // +#endif +#ifdef _PROFESSION_ADDSKILL + || CHAR_getWorkInt( GuardianIndex, CHAR_DOOMTIME ) > 0 //ĩռ +#endif + ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)Ҫס(%s)ûɹ\", + // CHAR_getUseName( GuardianIndex ), + // CHAR_getUseName( defindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (DefNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + return -1; + } + + if( BATTLE_IsThrowWepon( + CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == TRUE + ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)Ҫס(%s)ûɹ\", + // CHAR_getUseName( GuardianIndex ), + // CHAR_getUseName( defindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (DefNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + return -1; + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ס(%s)", + // CHAR_getUseName( GuardianIndex ), + // CHAR_getUseName( defindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (DefNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + return Guardian; +} + + +static int BATTLE_DamageWakeUp( int battleindex, int defindex ) +{ + int bid; + char szBuffer[256]=""; + CHAR_setInt( defindex, CHAR_DAMAGECOUNT, + CHAR_getInt( defindex, CHAR_DAMAGECOUNT ) +1 ); + + if( CHAR_getWorkInt( defindex, CHAR_WORKSLEEP ) > 0 ){ + CHAR_setWorkInt( defindex, CHAR_WORKSLEEP, 0 ); + bid = BATTLE_Index2No( battleindex, defindex ); + //sprintf( szBuffer, "(%s)\n", + // CHAR_getUseName( defindex ) ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (bid >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + sprintf( szBuffer, "BM|%X|%X|", bid, 0 ); + strcatsafe( szBadStatusString,sizeof(szBadStatusString), szBuffer ); + } + return 0; +} + +static int BATTLE_AttackSeq( int attackindex, int defindex, int *pDamage, int *pGuardian, int opt ) +{ + int iRet = 0, perCri = 0; + int GuardianIndex = -1,battleindex; + + battleindex = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ); + + // ˴ + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET + && BattleArray[battleindex].norisk == 0 + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E){ + if( CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX ) == attackindex ){ + CHAR_PetAddVariableAi( defindex, AI_FIX_SEKKAN ); // ҳ϶ + } + } + + // + if( opt != BATTLE_COM_COMBO ){ + if( BATTLE_DuckCheck( attackindex, defindex ) == TRUE ){ + return BATTLE_RET_DODGE; + } +#ifdef _SUIT_ADDPART3 + if( CHAR_getWorkInt( defindex, CHAR_WORKDUCKPOWER) > 0 ){ + if( rand()%100 < CHAR_getWorkInt( defindex, CHAR_WORKDUCKPOWER) ) + return BATTLE_RET_DODGE; + } +#endif + } + + // 鱻ޱȮ + if( *pGuardian == -1 ){ + *pGuardian = BATTLE_GuardianCheck( attackindex, defindex ); + if( *pGuardian != -1 ){ + GuardianIndex = BATTLE_No2Index( battleindex, *pGuardian ); + defindex = GuardianIndex; + } + } + + // һ + perCri = BATTLE_CriticalCheck( attackindex, defindex ); + +#ifdef _PETSKILL_DAMAGETOHP + if( opt == BATTLE_COM_S_DAMAGETOHP2 ){ //¿ (һ30%) && CHAR_getInt( attackindex, CHAR_HP) <= CHAR_getWorkInt( attackindex, CHAR_MAXMP)*0.5 + //print("\n1һ:%d",perCri); + //print("\n1:%d", CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER)); + //print("\n1:%d", CHAR_getWorkInt( attackindex, CHAR_WORKQUICK)); + perCri = perCri + (perCri*0.3); //һ30% + CHAR_setWorkInt( attackindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( attackindex,CHAR_WORKFIXSTR)+CHAR_getWorkInt( attackindex,CHAR_WORKFIXSTR)*0.2);//20% + CHAR_setWorkInt( attackindex, CHAR_WORKQUICK, CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX)+CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX) *0.2 );//20% + //print("\n2һ:%d",perCri); + //print("\n2:%d", CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER)); + //print("\n2:%d", CHAR_getWorkInt( attackindex, CHAR_WORKQUICK)); + } +#endif + + gCriper = perCri; + if( RAND( 1, 10000 ) < perCri ){ + // WON ADD + int gWeponType = BATTLE_GetWepon( attackindex ); + if( gWeponType != ITEM_BOW ){ + (*pDamage) = BATTLE_CriDamageCalc( attackindex, defindex ); + }else{ + (*pDamage) = BATTLE_DamageCalc( attackindex, defindex ); + } + iRet = BATTLE_RET_CRITICAL; + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + // ʿר + PROFESSION_SKILL_WEAPON_FOCUS_LVEVEL_UP( attackindex, "PROFESSION_WEAPON_FOCUS" ); + // ʿ + PROFESSION_SKILL_DUAL_WEAPON_LVEVEL_UP( attackindex, "PROFESSION_DUAL_WEAPON" ); + } + }else{ + (*pDamage) = BATTLE_DamageCalc( attackindex, defindex ); + iRet = BATTLE_RET_NORMAL; + } + + if( opt == BATTLE_COM_S_GBREAK){ + ;; + }else +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 + if( opt == BATTLE_COM_S_GBREAK2){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD){ + (*pDamage) = (*pDamage)*1.3; + }else{ + (*pDamage) = (*pDamage)*0.7; + } + }else +#endif + +#ifdef _PETSKILL_REGRET + if( opt == BATTLE_COM_S_REGRET2 ){// ˺ + (*pDamage) = (*pDamage)*0.8; + }else +#endif +#ifdef _SONIC_ATTACK // WON ADD + if( opt == BATTLE_COM_S_SONIC2 ){// ˺ + (*pDamage) = (*pDamage)*0.5; + }else +#endif + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 ){ + (*pDamage) = BATTLE_GuardAdjust( (*pDamage) ); + } + if( (*pDamage) < 1 ) (*pDamage) = RAND( 0, 1 ); + +#ifdef _PREVENT_TEAMATTACK // ֹͬӻ + if (CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER || + CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + int myside = CHAR_getWorkInt( defindex, CHAR_WORKBATTLESIDE);//attackindex + if( myside == CHAR_getWorkInt( attackindex, CHAR_WORKBATTLESIDE)){ + if( CHAR_getWorkInt( attackindex, CHAR_WORKCONFUSION) > 0 +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + || CHAR_getWorkInt( attackindex, CHAR_WORKINSTIGATE) > 0 // +#endif +#ifdef _PROFESSION_ADDSKILL + || CHAR_getWorkInt( attackindex, CHAR_WORKANNEX) > 0 // +#endif + ){ //쳣 +#ifdef _PETSKILL_TEMPTATION + }else if( CHAR_getWorkInt( attackindex, CHAR_WORKTEMPTATION ) > 0 ){//ˮջ +#endif + }else if( CHAR_getInt( attackindex, CHAR_WHICHTYPE) == CHAR_TYPEPET && + CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEFLG) & CHAR_BATTLEFLG_AIBAD ){ //nono + }else if( CHAR_getInt( defindex, CHAR_WHICHTYPE) == CHAR_TYPEPET && + CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX) == attackindex ){ // ѳ + }else { + int myhp, mymaxhp; + mymaxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP); + myhp = CHAR_getInt( defindex, CHAR_HP ) - *pDamage; + mymaxhp = mymaxhp *0.40; + if( mymaxhp >= myhp || mymaxhp < 40 ){ + *pDamage = 0; + }else { + *pDamage = 1; + } + } + } + } +#endif + +#ifdef _EQUIT_ARRANGE + if( BATTLE_ArrangeCheck( attackindex, defindex) == TRUE ){ + *pDamage *= 0.1; + iRet = BATTLE_RET_ARRANGE; + + // ʿ񵲼 + if( (CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) ) + PROFESSION_SKILL_LVEVEL_UP( defindex, "PROFESSION_DEFLECT" ); + } +#endif + + if( (*pDamage) == 0 ){ + iRet = BATTLE_RET_MISS; + if( GuardianIndex != -1 ){ + iRet = BATTLE_RET_NORMAL; + *pDamage = 1; + }else if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 ){ + iRet = BATTLE_RET_ALLGUARD; + } + } + + (*pDamage) *= gBattleDamageModyfy; + return iRet; +} + +#ifdef _PETSKILL_SETDUCK +BOOL BATTLE_CheckMySkillDuck( int charaindex ) +{ + int SDuck=0,rad=0; + if( !CHAR_CHECKINDEX( charaindex) ) + return FALSE; + if( (SDuck=CHAR_getWorkInt( charaindex, CHAR_MYSKILLDUCK)) > 0 ){ + int duck1 = CHAR_getWorkInt( charaindex, CHAR_MYSKILLDUCKPOWER); + if( (rad = (rand()%100)) > duck1 ){ + return FALSE; + }else {//ر + return TRUE; + } + } + return FALSE; +} +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int BATTLE_check_profession_duck( int charaindex, int per ) +{ + + int SDuck=0; + + if( (SDuck=CHAR_getWorkInt( charaindex, CHAR_WORK_P_DUCK)) > 0 ){ + int duck1 = CHAR_getWorkInt( charaindex, CHAR_WORKMOD_P_DUCK); + per = per * ( 100 + duck1 ) / 100; + } + + return per; +} +#endif + + +int BATTLE_GetDamageReact( int charaindex ) +{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKDAMAGEVANISH ) > 0 ){ + return BATTLE_MD_VANISH; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKDAMAGEABSROB ) > 0 ){ + return BATTLE_MD_ABSROB; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKDAMAGEREFLEC ) > 0 ){ + return BATTLE_MD_REFLEC; + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( CHAR_getWorkInt( charaindex, CHAR_WORKTRAP ) > 0 ){ // + return BATTLE_MD_TRAP; + } +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( CHAR_getWorkInt( charaindex, CHAR_WORKACUPUNCTURE ) > 0 ){ //Ƥ + //print("\n:BATTLE_GetDamageReact"); + return BATTLE_MD_ACUPUNCTURE; + } +#endif + return 0; +} + +int BATTLE_DamageSub( int attackindex, int defindex, int *pDamage, int *pPetDamage, int *pRefrect ) +{ + + int hp = 0, addpoint = 0, maxhp, IsUltimate = 0, react, work, battleindex; + int damage, playerdamage, petdamage; + int attackpet, defpet; + int pethp = 0, petmaxhp = 0; + int defquick = 0, petquick = 0; + + damage = *pDamage; + petdamage = *pPetDamage; + playerdamage = damage; + if( damage <= 0 )return 0; + +#ifdef _PETSKILL_SHOWMERCY + if( CHAR_getInt( defindex, CHAR_HP ) - damage <= 0 + && CHAR_getWorkInt(attackindex, CHAR_WORKBATTLECOM1) == BATTLE_COM_S_SHOWMERCY ){ + damage = CHAR_getInt( defindex, CHAR_HP ) - 1; + *pDamage = damage; + playerdamage = damage; + } +#endif + + attackpet = BATTLE_getRidePet( attackindex ); + defpet = BATTLE_getRidePet( defindex ); + if( defpet != -1 ) { + defquick = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( defpet, CHAR_WORKDEFENCEPOWER ); + } + + if( *pRefrect != -1 ){ + react = BATTLE_GetDamageReact( defindex ); + }else{ + react = BATTLE_MD_NONE; + } + battleindex = CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ); + + if( react == BATTLE_MD_REFLEC ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + *pRefrect = BATTLE_MD_REFLEC; + }else{ + *pRefrect = BATTLE_MD_NONE; + } + }else{ + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ) + *pRefrect = BATTLE_MD_TRAP; + else + *pRefrect = BATTLE_MD_NONE; + } +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + *pRefrect = BATTLE_MD_ACUPUNCTURE; + }else{ + *pRefrect = BATTLE_MD_NONE; + } + } +#endif + + if( react == BATTLE_MD_ABSROB ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet == -1 ) { + hp += damage; + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + playerdamage = (damage*petquick)/(defquick+petquick) +1 ; + petdamage = damage - playerdamage +1 ; + hp += playerdamage; + pethp += petdamage; + + } + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEABSROB ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEABSROB, max( work, 0 ) ); + *pRefrect = BATTLE_MD_ABSROB; + }else + if( *pRefrect == BATTLE_MD_REFLEC ){ +#ifdef _PETSKILL_BATTLE_MODEL + if(CHAR_getWorkInt(defindex,CHAR_NPCWORKINT1) == BATTLE_COM_S_BATTLE_MODEL){ + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max( work, 0 ) ); + hp = CHAR_getInt(defindex,CHAR_HP); + pethp = CHAR_getInt(defpet,CHAR_HP); + } + else +#endif + { + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max( work, 0 ) ); + defindex = attackindex; + defpet = attackpet; + } + }else +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( *pRefrect == BATTLE_MD_TRAP ){ // +#ifdef _PETSKILL_BATTLE_MODEL + if(CHAR_getWorkInt(defindex,CHAR_NPCWORKINT1) == BATTLE_COM_S_BATTLE_MODEL){ + CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( defindex, CHAR_WORKMODTRAP, 0 ); + hp = CHAR_getInt(defindex,CHAR_HP); + pethp = CHAR_getInt(defpet,CHAR_HP); + } + else +#endif + { + int value=0; + value = CHAR_getWorkInt( defindex, CHAR_WORKMODTRAP ); + damage = value; + + playerdamage = damage; + + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + + CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( defindex, CHAR_WORKMODTRAP, 0 ); + + defindex = attackindex; + defpet = attackpet; + } + }else +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( *pRefrect == BATTLE_MD_ACUPUNCTURE ){ //Ƥ + + if( damage%2 != 0 ) + damage+=1; + playerdamage = damage; + + //ȿ۱Ѫ,Ϊ֮ĶǶԹ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + defquick = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( defpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + if(playerdamage%2 != 0) playerdamage+=1; + if(petdamage%2 != 0) petdamage+=1; + hp -= playerdamage; + pethp -= petdamage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + }else{ + hp -= damage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + } + } + + //Change 2003/08/22 + if( (damage) >= CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ) * 1.2 + 20 ){ + int DefSide=0,i; + int defNo = BATTLE_Index2No( battleindex, defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + + //ijΪϢ + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + }else{ + i = defNo; + } + i = defNo-DefSide*SIDE_OFFSET; + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + //ƤܻغΪ0 + CHAR_setWorkInt( defindex, CHAR_WORKACUPUNCTURE, 0); + //if( CHAR_getWorkInt( defindex, CHAR_WORKSLEEP ) > 0 )//޻˯ + // CHAR_setWorkInt( defindex, CHAR_WORKSLEEP, 0); + +#ifdef _PETSKILL_BATTLE_MODEL + if(CHAR_getWorkInt(defindex,CHAR_NPCWORKINT1) != BATTLE_COM_S_BATTLE_MODEL) +#endif + { + //۹Ѫ + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage/2; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + if(playerdamage%2 != 0) playerdamage+=1; + if(petdamage%2 != 0) petdamage+=1; + hp -= playerdamage/2; + pethp -= petdamage/2; + }else + hp -= damage/2; + } + playerdamage /= 2; + + defindex = attackindex; + defpet = attackpet; + } + }else +#endif + if( react == BATTLE_MD_VANISH ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet != -1 ) + pethp = CHAR_getInt( defpet, CHAR_HP ); + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEVANISH, max( work, 0 ) ); + *pRefrect = BATTLE_MD_VANISH; + //andy_log + //print("*pRefrect = BATTLE_MD_VANISH !!\n"); + }else{ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + if( pethp > 0 ) { + //andy_edit 2002/07/31 + defquick = defquick>0?defquick:1; + petquick = petquick>0?petquick:1; + playerdamage = (damage*petquick)/(defquick+petquick)+ 1; + //playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1; + hp -= playerdamage; + pethp -= petdamage; + //print(" def_damage:%d ridepet_damage:%d ", (damage*petquick)/(defquick+petquick), damage - playerdamage); + }else + hp -= damage; + } + *pRefrect = 0; + } + + if( hp < 0 ){ + addpoint = -hp; + hp = 0; + } + + + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + if( defpet != -1 ) { + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + // Robin 0804 + if( pethp <= 0 ) { + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + //print(" defpet_die! "); + } + } + + if( (damage) >= maxhp * 1.2 + 20 ){ + IsUltimate = 2; + }else{ + if( addpoint > 0 ){ + addpoint += CHAR_getWorkInt( defindex, CHAR_WORKULTIMATE ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, addpoint ); + if( addpoint >= maxhp * 1.2 + 20 )IsUltimate = 1; + } + } + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) IsUltimate = 0; +#endif + + if( IsUltimate ){ + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + } + if( playerdamage < 0 ) playerdamage = 0; + if( petdamage < 0 ) petdamage = 0; + *pDamage = playerdamage; + *pPetDamage = petdamage; + + return IsUltimate; +} + +#ifdef _PETSKILL_FIREKILL //ɱר +int BATTLE_DamageSub_FIREKILL( int attackindex, int defindex, int *pDamage, int *pPetDamage, int *pRefrect ) +{ + + int hp, addpoint = 0, maxhp, IsUltimate = 0, react, work, battleindex; + int damage, playerdamage, petdamage; + int attackpet, defpet; + int pethp = 0, petmaxhp = 0; + int defquick = 0, petquick = 0; + damage = *pDamage; + petdamage = *pPetDamage; + playerdamage = damage; + if( damage <= 0 )return 0; + + attackpet = BATTLE_getRidePet( attackindex ); + defpet = BATTLE_getRidePet( defindex ); + if( defpet != -1 ) { + defquick = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( defpet, CHAR_WORKDEFENCEPOWER ); + } + + if( *pRefrect != -1 ){ + react = BATTLE_GetDamageReact( defindex ); + }else{ + react = BATTLE_MD_NONE; + } + + react = BATTLE_MD_NONE; + + battleindex = CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ); + + if( react == BATTLE_MD_REFLEC ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + *pRefrect = BATTLE_MD_REFLEC; + }else{ + *pRefrect = BATTLE_MD_NONE; + } + }else{ + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ) + *pRefrect = BATTLE_MD_TRAP; + else + *pRefrect = BATTLE_MD_NONE; + } +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + *pRefrect = BATTLE_MD_ACUPUNCTURE; + }else{ + *pRefrect = BATTLE_MD_NONE; + } + } +#endif + + if( react == BATTLE_MD_ABSROB ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet == -1 ) { + hp += damage; + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + playerdamage = (damage*petquick)/(defquick+petquick) +1 ; + petdamage = damage - playerdamage +1 ; + hp += playerdamage; + pethp += petdamage; + + } + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEABSROB ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEABSROB, max( work, 0 ) ); + *pRefrect = BATTLE_MD_ABSROB; + }else + if( *pRefrect == BATTLE_MD_REFLEC ){ + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max( work, 0 ) ); + defindex = attackindex; + defpet = attackpet; + + }else +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( *pRefrect == BATTLE_MD_TRAP ){ // + int value=0; + value = CHAR_getWorkInt( defindex, CHAR_WORKMODTRAP ); + damage = value; + + playerdamage = damage; + + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + + CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( defindex, CHAR_WORKMODTRAP, 0 ); + + defindex = attackindex; + defpet = attackpet; + + }else +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( *pRefrect == BATTLE_MD_ACUPUNCTURE ){ //Ƥ + + if( damage%2 != 0 ) + damage+=1; + playerdamage = damage; + + //ȿ۱Ѫ,Ϊ֮ĶǶԹ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + defquick = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( defpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + if(playerdamage%2 != 0) playerdamage+=1; + if(petdamage%2 != 0) petdamage+=1; + hp -= playerdamage; + pethp -= petdamage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + }else{ + hp -= damage; + if(hp<0)hp=0; + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + } + } + + //Change 2003/08/22 + if( (damage) >= CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ) * 1.2 + 20 ){ + int DefSide=0,i; + int defNo = BATTLE_Index2No( battleindex, defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + + //ijΪϢ + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + }else{ + i = defNo; + } + i = defNo-DefSide*SIDE_OFFSET; + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + //ƤܻغΪ0 + CHAR_setWorkInt( defindex, CHAR_WORKACUPUNCTURE, 0); + //if( CHAR_getWorkInt( defindex, CHAR_WORKSLEEP ) > 0 )//޻˯ + // CHAR_setWorkInt( defindex, CHAR_WORKSLEEP, 0); + + //۹Ѫ + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage/2; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + if(playerdamage%2 != 0) playerdamage+=1; + if(petdamage%2 != 0) petdamage+=1; + hp -= playerdamage/2; + pethp -= petdamage/2; + }else + hp -= damage/2; + } + + playerdamage /= 2; + + defindex = attackindex; + defpet = attackpet; + + }else +#endif + if( react == BATTLE_MD_VANISH ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet != -1 ) + pethp = CHAR_getInt( defpet, CHAR_HP ); + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEVANISH, max( work, 0 ) ); + *pRefrect = BATTLE_MD_VANISH; + //andy_log + //print("*pRefrect = BATTLE_MD_VANISH !!\n"); + }else{ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet == -1 ) { + hp -= damage; + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + if( pethp > 0 ) { + //andy_edit 2002/07/31 + defquick = defquick>0?defquick:1; + petquick = petquick>0?petquick:1; + playerdamage = (damage*petquick)/(defquick+petquick)+ 1; + //playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1; + hp -= playerdamage; + pethp -= petdamage; + //print(" def_damage:%d ridepet_damage:%d ", (damage*petquick)/(defquick+petquick), damage - playerdamage); + }else + hp -= damage; + } + *pRefrect = 0; + } + if( hp < 0 ){ + addpoint = -hp; + hp = 0; + } + + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + if( defpet != -1 ) { + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + // Robin 0804 + if( pethp <= 0 ) { + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + //print(" defpet_die! "); + } + } + + if( (damage) >= maxhp * 1.2 + 20 ){ + IsUltimate = 2; + }else{ + if( addpoint > 0 ){ + addpoint += CHAR_getWorkInt( defindex, CHAR_WORKULTIMATE ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, addpoint ); + if( addpoint >= maxhp * 1.2 + 20 )IsUltimate = 1; + } + } + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + } + +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) IsUltimate = 0; +#endif + + if( IsUltimate ){ + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + } + if( playerdamage < 0 ) playerdamage = 0; + if( petdamage < 0 ) petdamage = 0; + *pDamage = playerdamage; + *pPetDamage = petdamage; + + return IsUltimate; +} +#endif + + +// Robin 0910 RidePetDebug +int BATTLE_DamageSub2( int attackindex, int defindex, int *pDamage, int *pPetDamage, int *pRefrect ) +{ + + int hp, addpoint = 0, maxhp, IsUltimate = 0, react, work, battleindex; + int damage, playerdamage, petdamage; + int attackpet, defpet; + int pethp = 0, petmaxhp = 0; + + damage = *pDamage; + petdamage = *pPetDamage; + playerdamage = *pDamage; + + if( damage <= 0 )return 0; + + attackpet = BATTLE_getRidePet( attackindex ); + defpet = BATTLE_getRidePet( defindex ); + + if( *pRefrect != -1 ){ + react = BATTLE_GetDamageReact( defindex ); + }else{ + react = BATTLE_MD_NONE; + } + + if( react == BATTLE_MD_REFLEC ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + *pRefrect = BATTLE_MD_REFLEC; + }else{ + *pRefrect = BATTLE_MD_NONE; + } + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ){ + if( BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ) + *pRefrect = BATTLE_MD_TRAP; + else + *pRefrect = BATTLE_MD_NONE; + } +#endif + + if( react == BATTLE_MD_ABSROB ){ + + hp = CHAR_getInt( defindex, CHAR_HP ); + hp += playerdamage; + if( defpet != -1 ) { + pethp = CHAR_getInt( defpet, CHAR_HP ); + pethp += petdamage; + } + + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEABSROB ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEABSROB, max( work, 0 ) ); + + *pRefrect = BATTLE_MD_ABSROB; + + }else + if( *pRefrect == BATTLE_MD_REFLEC ){ + + hp = CHAR_getInt( attackindex, CHAR_HP ); + hp -= playerdamage; + if( attackpet != -1 ) { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + if( pethp > 0 ) { + pethp -= petdamage; + } + } + + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max( work, 0 ) ); + + defindex = attackindex; + defpet = attackpet; + + }else +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( *pRefrect == BATTLE_MD_TRAP ){ // + + hp = CHAR_getInt( attackindex, CHAR_HP ); + hp -= playerdamage; + if( attackpet != -1 ) { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + if( pethp > 0 ) { + pethp -= petdamage; + } + } + + CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( defindex, CHAR_WORKMODTRAP, 0 ); + + defindex = attackindex; + defpet = attackpet; + + }else +#endif + if( react == BATTLE_MD_VANISH ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet != -1 ) + pethp = CHAR_getInt( defpet, CHAR_HP ); + + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEVANISH, max( work, 0 ) ); + + *pRefrect = BATTLE_MD_VANISH; + + }else{ + hp = CHAR_getInt( defindex, CHAR_HP ); + hp -= playerdamage; + if( defpet != -1 ){ + pethp = CHAR_getInt( defpet, CHAR_HP ); + if( pethp > 0 ) { + pethp -= petdamage; + //print(" def_damage:%d ridepet_damage:%d ", (damage*petquick)/(defquick+petquick), damage - playerdamage); + } + } + *pRefrect = 0; + } + + if( hp < 0 ){ + addpoint = -hp; + hp = 0; + } + + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + + + if( defpet != -1 ) { + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + + // Robin 0804 + if( pethp <= 0 ) { + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + //print(" defpet_die! "); + } + } + + if( (damage) >= maxhp * 1.2 + 20 ){ + IsUltimate = 2; + }else{ + if( addpoint > 0 ){ + addpoint += CHAR_getWorkInt( defindex, CHAR_WORKULTIMATE ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, addpoint ); + if( addpoint >= maxhp * 1.2 + 20 )IsUltimate = 1; + } + } + + battleindex = CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ); + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) IsUltimate = 0; +#endif + + if( IsUltimate ){ + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + } + + //*pDamage = damage; + *pDamage = playerdamage; + *pPetDamage = petdamage; + + return IsUltimate; +} + + + +void BATTLE_DamageSubCale( + int attackindex, + int defindex, + int *pDamage, + int *pPetDamage +) +{ + int pethp; + int damage, playerdamage, petdamage; + int attackpet, defpet; + int defquick = 0, petquick = 0; + + damage = *pDamage; + petdamage = *pPetDamage; + playerdamage = damage; + + attackpet = BATTLE_getRidePet( attackindex ); + defpet = BATTLE_getRidePet( defindex ); + + defquick = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + defquick = ( defquick < 1)?1:defquick; + if( defpet != -1 ) { + petquick = CHAR_getWorkInt( defpet, CHAR_WORKDEFENCEPOWER ); + petquick = ( petquick < 1)?1:petquick; + + pethp = CHAR_getInt( defpet, CHAR_HP ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick); + petdamage = damage - playerdamage; + if( damage > 0 && playerdamage < 1 ) + playerdamage = 1; + } + } + + *pDamage = playerdamage; + *pPetDamage = petdamage; + +} + +int BATTLE_Attack( int battleindex, int attackNo, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, attackindex, toindex, ultimate = 0, + defindex, react = 0, statusDefNo, opt = 0; + int flg = 0, iWork, par, perStatus, i, DefSide = 0, Guardian = -1; + BOOL iRet = TRUE; + int suitpoison=30;//ж% + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = toindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return FALSE; + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return FALSE; + + +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = 0; +#endif + + if( gWeponType == ITEM_BOW ){ + if( toindex < 0 || CHAR_getInt( toindex, CHAR_HP ) <= 0 ){ + snprintf( szCommand, sizeof( szCommand ), "r%X|f0|d0|", defNo ); + BATTLESTR_ADD( szCommand ); + return FALSE; + } + } + + if( CHAR_getInt( toindex, CHAR_HP ) <= 0 ) return FALSE; + + if( CHAR_getInt( attackindex, CHAR_HP ) <= 0 ) return FALSE; + + // ⡢ + if( BATTLE_GetDamageReact( attackindex ) > 0 ) iRet = FALSE; + else if( BATTLE_GetDamageReact( defindex ) > 0 ) iRet = FALSE; + + // ģʽ + iWork = BATTLE_AttackSeq( attackindex, toindex, &damage, &Guardian, opt ); + + if( Guardian >= 0 ) + defindex = BATTLE_No2Index( battleindex, Guardian ); + + if( gDamageDiv != 0.0 && damage > 0 ){ + damage /= gDamageDiv; + if( damage <= 0 ) damage = 1; + } + + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + react = 0; + + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react ); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ){ + defindex = attackindex; + statusDefNo = attackNo; + } +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ + defindex = attackindex; + statusDefNo = attackNo; + } +#endif + if( react == BATTLE_MD_REFLEC ){ + defindex = attackindex; + statusDefNo = attackNo; + }else{ + if( 0 <= Guardian && Guardian <= 19 ){ + statusDefNo = Guardian; + }else{ + statusDefNo = defNo; + } + } + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ //Ƥʱ޷򷽵״̬,԰index + defindex = toindex = BATTLE_No2Index( battleindex, defNo ); + statusDefNo = defNo; + } +#endif + + //˯ʱ,״̬(Ҳ״̬) + if( damage > 0 && ( react != BATTLE_MD_ABSROB ) && ( react != BATTLE_MD_VANISH ) ){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ + defindex = attackindex; + statusDefNo = attackNo; + } +#endif + + switch( iWork ){ + case BATTLE_RET_ALLGUARD: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),׵ر㿪", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + flg |= BCF_NORMAL; +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = BATTLE_RET_ALLGUARD; +#endif + break; + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = BATTLE_RET_MISS; +#endif + break; + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = BATTLE_RET_DODGE; +#endif + break; + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)Ĺ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_NORMAL; + break; + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)(%s)CRITICAL(%d%%)(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // (int)(gCriper*0.01), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_KAISHIN; + iRet = FALSE; + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = BATTLE_RET_ARRANGE; +#endif + break; +#endif + } + + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + flg |= BCF_GUARD; + iRet = FALSE; + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER && flg & BCF_KAISHIN ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } + +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ){ //Ƥᷴ״̬,ҪĻ + defindex = toindex = BATTLE_No2Index( battleindex, defNo ); + statusDefNo = defNo; + } + //ע:֮ҪҪٸĻԭ.......???? +#endif + +#ifdef _SUIT_ADDPART4 + if( gBattleStausChange == -1 && CHAR_getWorkInt( attackindex, CHAR_SUITPOISON ) > 0 )//װ + gBattleStausChange = 1,gBattleStausTurn = 3, suitpoison=CHAR_getWorkInt( attackindex, CHAR_SUITPOISON ); +#endif + + if( damage > 0 && gBattleStausChange >= 0 ){ + if( BATTLE_StatusAttackCheck( + attackindex, + defindex, + gBattleStausChange, + suitpoison, + 40, + 2.0, + &perStatus + ) == TRUE + ){ + CHAR_setWorkInt( defindex, StatusTbl[gBattleStausChange], + gBattleStausTurn + 1 ); + + if( gBattleStausChange == BATTLE_ST_DRUNK ){ + CHAR_setWorkInt( defindex, CHAR_WORKDRUNK, + CHAR_getWorkInt( defindex, CHAR_WORKDRUNK ) / 2 ); + } + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + if( gBattleStausChange == BATTLE_ST_SARS ){ + CHAR_setWorkInt( defindex, CHAR_WORKMODSARS, 1); + } +#endif + + if( gBattleStausChange == BATTLE_ST_PARALYSIS + || gBattleStausChange == BATTLE_ST_SLEEP + || gBattleStausChange == BATTLE_ST_STONE + || gBattleStausChange == BATTLE_ST_BARRIER + ){ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)(%s)(%d%%)", + // CHAR_getUseName( defindex ), + // aszStatusFull[gBattleStausChange], + // perStatus + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + BATTLE_BadStatusString( statusDefNo, gBattleStausChange ); + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)޷ɹ\(%d%%)", + // aszStatusFull[gBattleStausChange], + // perStatus ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + } +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( ( damage > 0 ) && ( CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT ) ) { + if ( RAND ( 1 , 5 ) > 4 ) { + CHAR_setWorkInt( defindex, CHAR_WORKSLEEP , 3 ); //趨˯ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE );//Ϊ趨˻˯,趨޶ + } + } +#endif +#ifdef _PSKILL_GYRATE + if ( ( damage > 0 ) && ( CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_GYRATE ) && (CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM5 ) >0) ) { + if ( RAND ( 1 , 100 ) <= CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM7) ) { + int iEffect = CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM5 ); + CHAR_setWorkInt( defindex, StatusTbl[iEffect] , CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM6 ) ); //趨˯ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE );//Ϊ趨˻˯,趨޶ + } + } +#endif + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( damage > 0 && (CHAR_getInt(attackindex, CHAR_WHICHTYPE)== CHAR_TYPEPLAYER) ){ + int i; + // 𡢱׸ + for( i=0; i<3; i++ ){ + int turn = 0, status = -1; + + turn = CHAR_getWorkInt( attackindex, CHAR_WORK_F_ENCLOSE_2+i ); + + if( turn > 0 ){ + int skill_type = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ); + int perStatus = 0, j = 0; + int skill_level = CHAR_getWorkInt( attackindex, CHAR_WORKMOD_F_ENCLOSE_2+i ); + char pszP[3][10] = { "","˪","" }; + int img1 = 101697, img2 = 101698 + i; + + // ״̬ + for( j = 1; j < BATTLE_ST_END; j ++ ){ + if( strncmp( pszP[i], aszStatus[j], 2 ) == 0 ){ + status = j; + break; + } + } + + // + perStatus = 20 + skill_level * 2; + + // غ + if( skill_level >= 10 ) turn = 3; + else if( skill_level >= 5 ) turn = 2; + else turn = 1; + + // ׸һغ + if( i == 2 ) turn = 1; + + // 𡢱׸帽ӹ +// Terry add fix Ȯbug + if(Guardian >= 0) iRet = BATTLE_PROFESSION_RANG_ATTACK_DAMAGE(attackindex, attackNo, Guardian, skill_type, status, turn, perStatus, 0, img1, img2 ); + else iRet = BATTLE_PROFESSION_RANG_ATTACK_DAMAGE(attackindex, attackNo, defNo, skill_type, status, turn, perStatus, 0, img1, img2 ); + + break; + } + } + } +#endif + + + if( 0 <= Guardian && Guardian <= 19 ){ + iRet = FALSE; + flg |= BCF_GUARDIAN; + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|d%X|p%X|g%X|", + defNo, + flg, + damage, + petdamage, + Guardian ); + }else{ + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|d%X|p%X|", + defNo, + flg, + damage, + petdamage ); + } + + BATTLESTR_ADD( szCommand ); + + defNo = BATTLE_Index2No( battleindex, defindex ); + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + }else{ + i = defNo; + } + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + return iRet; + +} + +#ifdef _PETSKILL_FIREKILL +int BATTLE_Attack_FIREKILL( int battleindex, int attackNo, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, attackindex, toindex, ultimate = 0, + defindex, react = 0, statusDefNo, opt = 0; + int flg = 0, iWork, par, perStatus, i, DefSide = 0, Guardian = -1; + BOOL iRet = TRUE; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = toindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return FALSE; + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return FALSE; + + +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = 0; +#endif + + if( gWeponType == ITEM_BOW ){ + if( toindex < 0 || CHAR_getInt( toindex, CHAR_HP ) <= 0 ){ + snprintf( szCommand, sizeof( szCommand ), "r%X|f0|d0|", defNo ); + BATTLESTR_ADD( szCommand ); + return FALSE; + } + } + + if( CHAR_getInt( toindex, CHAR_HP ) <= 0 ) return FALSE; + + if( CHAR_getInt( attackindex, CHAR_HP ) <= 0 ) return FALSE; + + // ⡢ +// if( BATTLE_GetDamageReact( attackindex ) > 0 ) iRet = FALSE; +// else if( BATTLE_GetDamageReact( defindex ) > 0 ) iRet = FALSE; + + // ģʽ + iWork = BATTLE_AttackSeq( attackindex, toindex, &damage, &Guardian, opt ); + + if( Guardian >= 0 ) + defindex = BATTLE_No2Index( battleindex, Guardian ); + + if( gDamageDiv != 0.0 && damage > 0 ){ + damage /= gDamageDiv; + if( damage <= 0 ) damage = 1; + } + + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + react = 0; + + ultimate = BATTLE_DamageSub_FIREKILL( attackindex, defindex, &damage, &petdamage, &react ); + +//#ifdef _PROFESSION_SKILL // WON ADD ְҵ +// if( react == BATTLE_MD_TRAP ){ +// defindex = attackindex; +// statusDefNo = attackNo; +// } +//#endif +//#ifdef _PETSKILL_ACUPUNCTURE +// if( react == BATTLE_MD_ACUPUNCTURE ){ +// defindex = attackindex; +// statusDefNo = attackNo; +// } +//#endif +// if( react == BATTLE_MD_REFLEC ){ +// defindex = attackindex; +// statusDefNo = attackNo; +// }else{ + if( 0 <= Guardian && Guardian <= 19 ){ + statusDefNo = Guardian; + }else{ + statusDefNo = defNo; + } +// } + +//#ifdef _PETSKILL_ACUPUNCTURE +// if( react == BATTLE_MD_ACUPUNCTURE ){ //Ƥʱ޷򷽵״̬,԰index +// defindex = toindex = BATTLE_No2Index( battleindex, defNo ); +// statusDefNo = defNo; +// } +//#endif + + //˯ʱ,״̬(Ҳ״̬) + if( damage > 0 && ( react != BATTLE_MD_ABSROB ) && ( react != BATTLE_MD_VANISH ) ){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + +//#ifdef _PETSKILL_ACUPUNCTURE +// if( react == BATTLE_MD_ACUPUNCTURE ){ +// defindex = attackindex; +// statusDefNo = attackNo; +// } +//#endif + + switch( iWork ){ + case BATTLE_RET_ALLGUARD: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),׵ر㿪", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + flg |= BCF_NORMAL; + break; + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + break; + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; +#ifdef _PETSKILL_RETRACE + Battle_Attack_ReturnData_x.Battle_Attack_ReturnData = BATTLE_RET_DODGE; +#endif + break; + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)Ĺ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_NORMAL; + break; + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)(%s)CRITICAL(%d%%)(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // (int)(gCriper*0.01), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_KAISHIN; + iRet = FALSE; + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; + break; +#endif + } + + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + flg |= BCF_GUARD; + iRet = FALSE; + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER && flg & BCF_KAISHIN ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + +//#ifdef _PETSKILL_ACUPUNCTURE +// if( react == BATTLE_MD_ACUPUNCTURE ){ //Ƥᷴ״̬,ҪĻ +// defindex = toindex = BATTLE_No2Index( battleindex, defNo ); +// statusDefNo = defNo; +// } +// //ע:֮ҪҪٸĻԭ.......???? +//#endif + + + if( damage > 0 && gBattleStausChange >= 0 ){ + if( BATTLE_StatusAttackCheck( + attackindex, + defindex, + gBattleStausChange, + 30, + 40, + 2.0, + &perStatus + ) == TRUE + ){ + CHAR_setWorkInt( defindex, StatusTbl[gBattleStausChange], + gBattleStausTurn + 1 ); + + if( gBattleStausChange == BATTLE_ST_DRUNK ){ + CHAR_setWorkInt( defindex, CHAR_WORKDRUNK, + CHAR_getWorkInt( defindex, CHAR_WORKDRUNK ) / 2 ); + } + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + if( gBattleStausChange == BATTLE_ST_SARS ){ + CHAR_setWorkInt( defindex, CHAR_WORKMODSARS, 1); + } +#endif + + if( gBattleStausChange == BATTLE_ST_PARALYSIS + || gBattleStausChange == BATTLE_ST_SLEEP + || gBattleStausChange == BATTLE_ST_STONE + || gBattleStausChange == BATTLE_ST_BARRIER + ){ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)(%s)(%d%%)", + // CHAR_getUseName( defindex ), + // aszStatusFull[gBattleStausChange], + // perStatus + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + BATTLE_BadStatusString( statusDefNo, gBattleStausChange ); + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)޷ɹ\(%d%%)", + // aszStatusFull[gBattleStausChange], + // perStatus ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + } +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( ( damage > 0 ) && ( CHAR_getWorkInt( attackindex , CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT ) ) { + if ( RAND ( 1 , 5 ) > 4 ) { + CHAR_setWorkInt( defindex, CHAR_WORKSLEEP , 3 ); //趨˯ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE );//Ϊ趨˻˯,趨޶ + } + } +#endif + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( damage > 0 && (CHAR_getInt(attackindex, CHAR_WHICHTYPE)== CHAR_TYPEPLAYER) ){ + int i; + // 𡢱׸ + for( i=0; i<3; i++ ){ + int turn = 0, status = -1; + + turn = CHAR_getWorkInt( attackindex, CHAR_WORK_F_ENCLOSE_2+i ); + + if( turn > 0 ){ + int skill_type = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ); + int perStatus = 0, j = 0; + int skill_level = CHAR_getWorkInt( attackindex, CHAR_WORKMOD_F_ENCLOSE_2+i ); + char pszP[3][10] = { "","˪","" }; + int img1 = 101697, img2 = 101698 + i; + + // ״̬ + for( j = 1; j < BATTLE_ST_END; j ++ ){ + if( strncmp( pszP[i], aszStatus[j], 2 ) == 0 ){ + status = j; + break; + } + } + + // + perStatus = 20 + skill_level * 2; + + // غ + if( skill_level >= 10 ) turn = 3; + else if( skill_level >= 5 ) turn = 2; + else turn = 1; + + // ׸һغ + if( i == 2 ) turn = 1; + + // 𡢱׸帽ӹ +// Terry add fix Ȯbug + if(Guardian >= 0) iRet = BATTLE_PROFESSION_RANG_ATTACK_DAMAGE(attackindex, attackNo, Guardian, skill_type, status, turn, perStatus, 0, img1, img2 ); + else iRet = BATTLE_PROFESSION_RANG_ATTACK_DAMAGE(attackindex, attackNo, defNo, skill_type, status, turn, perStatus, 0, img1, img2 ); + + break; + } + } + } +#endif + + if( 0 <= Guardian && Guardian <= 19 ){ + iRet = FALSE; + flg |= BCF_GUARDIAN; + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|d%X|p%X|g%X|", + defNo, + flg, + damage, + petdamage, + Guardian ); + }else{ + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|d%X|p%X|", + defNo, + flg, + damage, + petdamage ); + } + + BATTLESTR_ADD( szCommand ); + + defNo = BATTLE_Index2No( battleindex, defindex ); + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + }else{ + i = defNo; + } + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + return iRet; + +} + +#endif + + +enum { + BATTLE_C_NONE = 0, + BATTLE_C_CLAW, + BATTLE_C_AXE, + BATTLE_C_CLUB, + BATTLE_C_SPEAR, + BATTLE_C_BOW, + BATTLE_C_THROU, + BATTLE_C_OTHER, + BATTLE_C_MAX +}; + +static int CounterTbl[] = { + 10, 9, 8, 8, 5, 0, 0, 0 , + 10, 9, 7, 7, 6, 0, 0, 0 , + 9, 8,10,10, 7, 0, 0, 0 , + 8, 8,10,10, 7, 0, 0, 0 , + 6, 6, 8, 8, 9, 0, 0, 0 , + 0, 0, 0, 0, 0, 0, 0, 0 , + 0, 0, 0, 0, 0, 0, 0, 0 , +}; + +static int BATTLE_ItemType2ItemMap( int type ){ + int iRet = BATTLE_C_NONE; + if( type == ITEM_FIST ) iRet = BATTLE_C_CLAW; + if( type == ITEM_AXE ) iRet = BATTLE_C_AXE; + if( type == ITEM_CLUB ) iRet = BATTLE_C_CLUB; + if( type == ITEM_BOW ) iRet = BATTLE_C_BOW; + if( type == ITEM_BOOMERANG ) iRet = BATTLE_C_THROU; + if( type == ITEM_BOUNDTHROW ) iRet = BATTLE_C_THROU; + if( type == ITEM_BREAKTHROW ) iRet = BATTLE_C_THROU; + return iRet; +} + +static BOOL BATTLE_CounterCheckPlayer( int attackindex, int defindex, int *pPar ) +{ + int + At_SoubiIndex, At_SoubiType, + Df_SoubiIndex, Df_SoubiType, + At_Soubi, CriPer, + At_Luck = 0, + flg = FALSE; + + float per; + + CriPer = BATTLE_CounterCalc( attackindex, defindex ); + + At_SoubiIndex = CHAR_getItemIndex( attackindex, CHAR_ARM ); + + if( BATTLE_IsThrowWepon( At_SoubiIndex ) == TRUE ){ + *pPar = 0.0; + return FALSE; + } + + if( ITEM_CHECKINDEX( At_SoubiIndex ) == FALSE ){ + At_SoubiType = ITEM_FIST; + }else{ + At_SoubiType = ITEM_getInt( At_SoubiIndex, ITEM_TYPE ); + } + + At_SoubiIndex = BATTLE_ItemType2ItemMap( At_SoubiType ); + + Df_SoubiIndex = CHAR_getItemIndex( defindex, CHAR_ARM ); + + if( BATTLE_IsThrowWepon( Df_SoubiIndex ) == TRUE ){ + *pPar = 0.0; + return FALSE; + } + + if( ITEM_CHECKINDEX( Df_SoubiIndex ) == FALSE ){ + Df_SoubiType = ITEM_FIST; + }else{ + Df_SoubiType = ITEM_getInt( Df_SoubiIndex, ITEM_TYPE ); + } + + Df_SoubiIndex = BATTLE_ItemType2ItemMap( Df_SoubiType ); + + At_Soubi = CounterTbl[BATTLE_C_MAX * At_SoubiIndex + Df_SoubiIndex]; + + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + At_Luck = CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ); + } + +#ifdef _SUIT_ADDENDUM + per = CriPer * At_Soubi * 0.1 + At_Luck + CHAR_getWorkInt( attackindex, CHAR_WORKCOUNTER ); +#else + per = CriPer * At_Soubi * 0.1 + At_Luck; +#endif + + *pPar = per; + + per *= 100; + if( per <= 0 ){ + per = 1; + *pPar = 0; + } + + if( RAND( 1, 10000 ) < per ){ + flg = TRUE; + }else{ + flg = FALSE; + } + return flg; +} + + +static BOOL BATTLE_CounterCheckPet( int attackindex, int defindex, int *pPer ) +{ + int At_SoubiIndex; + int flg = FALSE, Df_SoubiIndex, iWork; + + float per; + + At_SoubiIndex = CHAR_getItemIndex( attackindex, CHAR_ARM ); + + if( BATTLE_IsThrowWepon( At_SoubiIndex ) == TRUE ){ + *pPer = 0.0; + return FALSE; + } + + + Df_SoubiIndex = CHAR_getItemIndex( defindex, CHAR_ARM ); + + if( BATTLE_IsThrowWepon( Df_SoubiIndex ) == TRUE ){ + *pPer = 0.0; + return FALSE; + } + + per = BATTLE_CounterCalc( attackindex, defindex ); + + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_NOGUARD ){ + iWork = CHAR_GETWORKINT_LOW( attackindex, CHAR_WORKBATTLECOM3 ); + iWork = iWork >> 8; + if( iWork > 127 )iWork *= -1; + per += iWork; + } + + if( per > 100 ) per = 100; + *pPer = per; + per *= 100; + + if( per <= 0 ){ + per = 1; + *pPer = per; + } + + if( RAND( 1, 10000 ) <= per ){ + flg = TRUE; + }else{ + flg = FALSE; + } + return flg; +} + +static BOOL BATTLE_CounterCheck( int attackindex, int defindex, int *pPar ) +{ +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT || + CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT + ) { + return FALSE; + } +#endif + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + return BATTLE_CounterCheckPlayer( attackindex, defindex, pPar ); + }else{ + return BATTLE_CounterCheckPet( attackindex, defindex, pPar ); + } +} + + + +//ж +BOOL BATTLE_Counter( int battleindex, int attackNo, int defNo ) +{ + + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, attackindex, defindex, Guardian = -2, react = 0, ultimate = 0; + int flg = 0, iWork, par, DefSide = 0, i, per = 0; + BOOL iRet = TRUE; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + if ( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ATTSHOOT ) { + return FALSE; + } +#endif + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ) return FALSE; + if( CHAR_getInt( attackindex, CHAR_HP ) <= 0 ) return FALSE; + + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_ATTACK + || CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_NOGUARD){ + ;; + }else{ + return FALSE; + } + + // nono + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ) return FALSE; + + // + if( BATTLE_CounterCheck( attackindex, defindex, &per ) == FALSE ) return FALSE; + + // ⡢ + if( BATTLE_GetDamageReact( attackindex ) > 0 ) + iRet = FALSE; + else if( BATTLE_GetDamageReact( defindex ) > 0 ) + iRet = FALSE; + + gWeponType = BATTLE_GetWepon( attackindex ); + + gDamageDiv = 1.0; + + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, &Guardian, -1 ); + + if( damage <= 0 ){ + damage = 0; + }else{ + damage *= 0.75; + if( damage < 1 ) damage = 1; + } + + react = 0; + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react ); + if( react == BATTLE_MD_REFLEC ) defindex = attackindex; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + + if( damage > 0 && ( react != BATTLE_MD_ABSROB ) && ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + switch( iWork ){ + case BATTLE_RET_MISS: +/* + snprintf( szBuffer, sizeof(szBuffer), + "(%s)(%s),ûС", + CHAR_getUseName( attackindex ), + CHAR_getUseName( defindex ) + ); +*/ + return FALSE; + + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)⹥(%d%%)!(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // per, + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; + break; + + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)ķ!(%d%%)(%d) (%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // per, + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; + + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)CRITICAL(%d%%)(%d) (%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // per, + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_KAISHIN; + iRet = FALSE; + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; + break; +#endif + } + + flg |= BCF_COUNTER; + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER + && flg & BCF_KAISHIN + ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + +#ifdef _NOTRIDE_ + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|counter%X|", + defNo, + flg, + damage ); +#else + snprintf( szCommand, sizeof( szCommand ), + "r%X|f%X|counter%X|p%X|", + defNo, + flg, + damage, + petdamage + ); +#endif + //print(" CounterAttack!:%s ", szCommand ); + + BATTLESTR_ADD( szCommand ); + + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + return iRet; +} + + +static BOOL BATTLE_CaptureCheck( + int attackindex, + int defindex, + float *pPer +) +{ + float + Df_MaxHp = 0, + Df_HpPer = 0, + At_Charm = 0, + At_Level = 0, + At_Dex = 0, + At_Luck = 0, + Df_Level = 0, + Df_Dex = 0, + Df_Ge = 30; + float WorkGet; + + *pPer = 0; + + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) != CHAR_TYPEENEMY ){ + return FALSE; + } + + if( CHAR_getWorkInt( defindex, CHAR_WORK_PETFLG ) == 0 ){ + return FALSE; + } + + if( CHAR_getWorkInt( attackindex, CHAR_PickAllPet) != TRUE ) { + if( CHAR_getInt( attackindex, CHAR_LV ) + 5 < CHAR_getInt( defindex, CHAR_LV )){ + return FALSE; + } + } + + At_Charm = CHAR_getWorkInt( attackindex, CHAR_WORKFIXCHARM ); + At_Level = CHAR_getInt( attackindex, CHAR_LV ); + Df_Level = CHAR_getInt( defindex, CHAR_LV ); + At_Dex = CHAR_getWorkInt( attackindex, CHAR_WORKFIXDEX ); + Df_Dex = CHAR_getWorkInt( defindex, CHAR_WORKFIXDEX ); + Df_Ge = CHAR_getWorkInt( defindex, CHAR_WORKMODCAPTUREDEFAULT ); + At_Luck = CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ); + Df_HpPer = CHAR_getInt( defindex, CHAR_HP ); + Df_MaxHp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + if( Df_MaxHp <= 0 ) Df_MaxHp = 1; + + Df_HpPer = 10 - ( Df_HpPer * Df_HpPer ) / Df_MaxHp; + Df_Level = ( At_Level/2 - Df_Level/2 ); + Df_Dex = At_Dex / 15 - Df_Dex / 15; + + WorkGet = ( Df_HpPer + Df_Level + Df_Dex + ( Df_Ge + At_Luck ) ) * At_Charm / 50; + + WorkGet += CHAR_getWorkInt( attackindex, CHAR_WORKMODCAPTURE ); + + if( CHAR_getWorkInt( defindex, CHAR_WORKSLEEP ) > 0 ){ + WorkGet += 15; + } + + if( WorkGet > 99 ) WorkGet = 99; + + *pPer = WorkGet; + + if( RAND( 1,100 ) < WorkGet ){ + return TRUE; + }else{ + return FALSE; + } + +} +#ifdef _CAPTURE_FREES +#define MAXCAPTRUEFREE 15 + +typedef struct _NeedItemEnemy{ + int EnemyId; + int ItemId[MAXCAPTRUEFREE]; +}NEEDITEMENEMY; +NEEDITEMENEMY NeedEnemy[128] = { + { 524, { 2456, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + // + { 961, {20219, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + { 953, {20223, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + { 962, {20222, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + + { 777, {20253, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + { 796, {20247, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + { 812, {20259, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + + { 1105, {1690, 1691, 1692, -1, -1, -1, -1, -1, -1, -1} }, + { 8, {1810, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, +#ifdef _WOLF_TAKE_AXE // WON ADD ץ˫ͷǵ + { 145, {2236, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, + { 146, {2236, -1, -1, -1, -1, -1, -1, -1, -1, -1} }, +#endif +}; + +#ifdef _NEED_ITEM_ENEMY +int need_item_eneny_init() +{ + FILE* fp; + int i; + int num=0; + char line[128], buf[16]; + fp = fopen("data/needitemeneny.txt", "r"); + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + while(1){ + if (fgets(line, sizeof(line), fp) == NULL) break; + chop(line); + if(line[0]=='#')continue; + + getStringFromIndexWithDelim(line,"|", 1, buf, sizeof(buf)); + NeedEnemy[num].EnemyId=atoi(buf); + for(i=0;i=128)break; + } + fclose(fp); + return TRUE; +} +#endif + +#else +typedef struct _NeedItemEnemy{ + int EnemyId; + int ItemId; +}NEEDITEMENEMY; +NEEDITEMENEMY NeedEnemy[] = { + { 524, 2456 }, + // + { 961, 20219}, + { 953, 20223}, + { 962, 20222}, + + { 777, 20253}, + { 796, 20247}, + { 812, 20259}, + +}; +#endif + +static int IsNeedCaptureItem( int charaindex ) +{ + int i=0; + for( i = 0; i < arraysizeof( NeedEnemy ); i ++ ){ + if( NeedEnemy[i].EnemyId != CHAR_getInt( charaindex, CHAR_PETID ) )continue; +#ifdef _CAPTURE_FREES + return i; +#else + return NeedEnemy[i].ItemId; +#endif + } + return -1; +} + +BOOL BATTLE_CaptureItemCheck( int attackindex, int defindex ) +{ +#ifdef _CAPTURE_FREES + int i; +#endif + int j, ti, itemindex; + + ti = IsNeedCaptureItem( defindex ); + if( ti < 0 ) return TRUE; + +#ifdef _CAPTURE_FREES + for( i=0; i= CHAR_MAXITEMHAVE ) return FALSE; + } + return TRUE; +#else + for( j = CHAR_STARTITEMARRAY; j < CHAR_MAXITEMHAVE; j ++ ){ + itemindex =CHAR_getItemIndex( attackindex, j ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE )continue; + if( ITEM_getInt( itemindex, ITEM_ID ) == ti ){ + return TRUE; + } + } + return FALSE; +#endif + +} + +#ifdef _CAPTURE_FREES +BOOL BATTLE_CaptureItemDelAll( int attackindex, int defindex ) +{ + int i, j, itemindex=-1,ti; + + ti = IsNeedCaptureItem( defindex ); + if( ti < 0 ) return TRUE; + for( i=0; i= 0 ){ + for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) { + itemindex = CHAR_getItemIndex( attackindex, i ); + if( ITEM_CHECKINDEX( itemindex ) == FALSE )continue; + if( ITEM_getInt( itemindex, ITEM_ID ) == needItemId ){ + { + char token[256]; +// LogItem( +// CHAR_getChar( attackindex, CHAR_NAME ), +// CHAR_getChar( attackindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "PetEaten(ʹ)", +// CHAR_getInt( attackindex,CHAR_FLOOR), +// CHAR_getInt( attackindex,CHAR_X ), +// CHAR_getInt( attackindex,CHAR_Y ), +// ITEM_getChar(itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + } + CHAR_DelItem( attackindex, i); + } + } + } +#endif + CHAR_setInt( attackindex, CHAR_GETPETCOUNT, + CHAR_getInt( attackindex, CHAR_GETPETCOUNT ) + 1 ); + + BATTLE_Exit( defindex, battleindex ); + CHAR_complianceParameter( pindex ); + CHAR_setInt( pindex, CHAR_VARIABLEAI, 0 ); + ai = CHAR_DEFAULTMAXAI - CHAR_getWorkInt( pindex, CHAR_WORKFIXAI ); + if( ai < 0 ){ + CHAR_PetAddVariableAi( pindex, ai * 100 ); + CHAR_setWorkInt( pindex, CHAR_WORKFIXAI, + CHAR_getWorkInt( pindex, CHAR_WORKFIXAI ) + ai ); + } + } + } + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + { + char szCommand[1024]; + snprintf( szCommand, sizeof( szCommand ), + "BT|a%X|r%X|f%X|", + attackNo, + defNo, + flg ); + BATTLESTR_ADD( szCommand ); + } + return ( flg )?(TRUE):(FALSE); +} + +void BATTLE_Guard( + int battleindex, + int attackNo +) +{ + char szCommand[128]; + //int attackindex; + sprintf( szCommand, "bg|%x|", attackNo ); + BATTLESTR_ADD( szCommand ); + /*attackindex = BATTLE_No2Index( battleindex, attackNo ); + { + char szBuffer[256]=""; + //snprintf( szBuffer, sizeof(szBuffer), "(%s)סȫ", + // CHAR_getUseName( attackindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }*/ + +} + +BOOL BATTLE_EscapeCheck( int attackindex, int attackNo, int *pPar ) +{ + int Esc = 100; + + int myside, otherside, battleindex; + int mylevel, enemylevel = 0, enemycnt = 0, i, enemyindex, luck, + escape_cnt, rare, SubNo; + BATTLE_ENTRY *pEntry; + + myside = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLESIDE ); + otherside = 1 - myside; + + battleindex = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ); + + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return TRUE; + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P )return TRUE; + + if( attackNo >= SIDE_OFFSET ){ + SubNo = attackNo - SIDE_OFFSET; + }else{ + SubNo = attackNo; + } + + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + rare = CHAR_getInt( attackindex, CHAR_RARE ); + switch( rare ){ + case 0: luck = 1; break; + case 1: luck = 3; break; + default:luck = 5; break; + } + }else{ + luck = min( 5, CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ) ); + luck = max( 1, luck ); + } + + mylevel = CHAR_getInt( attackindex, CHAR_LV ); + pEntry = BattleArray[battleindex].Side[otherside].Entry; + + escape_cnt = BattleArray[battleindex].Side[myside].Entry[SubNo].escape+1; + + for( i = 0; i < BATTLE_ENTRY_MAX; i ++ ){ + enemyindex = pEntry[i].charaindex; + if( CHAR_CHECKINDEX( enemyindex ) == FALSE )continue; + + if( CHAR_getWorkInt( enemyindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ) + enemylevel -= 100; + + enemylevel += CHAR_getInt( enemyindex, CHAR_LV ); + + enemycnt ++; + } + + if( enemycnt <= 0 ){ + enemylevel = 0; + Esc = 100; + }else{ + enemylevel /= enemycnt; + if( luck >= 5 ){ + Esc = 95 * escape_cnt; + }else + if( luck >= 4 ){ + Esc = ( 60 * escape_cnt ) - 2*( enemylevel - mylevel ); + }else + if( luck >= 3 ){ + Esc = ( 50 * escape_cnt ) - 2*( enemylevel - mylevel ); + }else + if( luck >= 2 ){ + Esc = ( 40 * escape_cnt ) - 2*( enemylevel - mylevel ); + }else + if( luck >= 1 ){ + Esc = ( 30 * escape_cnt ) - 2*( enemylevel - mylevel ); + }else{ + Esc = 95 * escape_cnt; + } + } + + if( Esc < 1 )Esc = 1; + + *pPar = Esc; + + if( RAND( 1,100 ) < Esc ){ + return TRUE; + }else{ + return FALSE; + } +} + + +BOOL BATTLE_Escape( int battleindex, int attackNo, int flag) +{ + //char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, flg = FALSE, side, SubNo, iPar; + + sprintf( szCommand, "BE|e%X|", attackNo ); + BATTLESTR_ADD( szCommand ); + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + if( !CHAR_CHECKINDEX( attackindex ) ){ + return FALSE; + } + + if( attackNo >= SIDE_OFFSET ){ + side = 1; SubNo = attackNo - SIDE_OFFSET; + }else{ + side = 0; SubNo = attackNo; + } + + BattleArray[battleindex].Side[side].Entry[SubNo].escape ++; + + if( BATTLE_EscapeCheck( attackindex, attackNo, &iPar ) == FALSE ){ + flg = 0; + }else{ + flg = 1; + } + + if( flg == 1 || flag == 1 ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s)(%d%%)", + // CHAR_getUseName( attackindex ), iPar + //); + //if( getBattleDebugMsg( ) != 0 ){ + // BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P + && CHAR_getInt( attackindex, CHAR_HP ) > 0 ){ + BATTLE_EscapeDpSend( battleindex, attackindex ); + BATTLE_GetDuelPoint( battleindex, side, SubNo ); + } +#ifdef _ALLBLUES_LUA_1_4 + BattleEscape(battleindex, attackindex); +#endif + CHAR_setWorkInt( attackindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_FINAL ); + CHAR_DischargePartyNoMsg( attackindex ); + BATTLE_Exit( attackindex, battleindex ); + }else{ + //if( getBattleDebugMsg( ) != 0 ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s)(%d%%)", + // CHAR_getUseName( attackindex ), iPar + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + } + snprintf( szCommand, sizeof( szCommand ), "f%X|", flg ); + BATTLESTR_ADD( szCommand ); + + return ( flg )?(TRUE):(FALSE); +} + + +int BATTLE_SurpriseCheck( int battleindex ) +{ + int iRet = 0, Rnd, charaindex, luck, a = 0, b = 7; + + if( BattleArray[battleindex].Side[0].type == BATTLE_S_TYPE_PLAYER + && BattleArray[battleindex].Side[1].type == BATTLE_S_TYPE_PLAYER + ){ + return 0; + } + + charaindex = BattleArray[battleindex].Side[0].Entry[0].charaindex; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return 0; + + if( BattleArray[battleindex].WinFunc != NULL )return 0; + + luck = CHAR_getWorkInt( charaindex, CHAR_WORKFIXLUCK ); + + switch( luck ){ + case 5: a = 20; b = 0; break; + case 4: a = 15; b = 2; break; + case 3: a = 10; b = 3; break; + case 2: a = 5; b = 5; break; + default: a = 0; b = 7; break; + } + + Rnd = RAND( 1, 100 ); + + if( Rnd <= a ){ + iRet = 1; + }else + if( Rnd < a + b ){ + iRet = 2; + } + + return iRet; +} + + +int BATTLE_NoAction( int battleindex, int attackNo ) +{ + //char szBuffer[512]=""; + char szCommand[512]; + int attackindex ; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + sprintf( szCommand, "bn|%x|", attackNo ); + BATTLESTR_ADD( szCommand ); + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)ʲҲ", + // CHAR_getUseName( attackindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + return 0; +} + + +int BATTLE_PetIn( int battleindex, int attackNo ) +{ + //char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, petindex ; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + petindex = CHAR_getInt( attackindex, CHAR_DEFAULTPET ); + petindex = CHAR_getCharPet( attackindex, petindex ); +#ifdef _FIXWOLF // Syu ADD ˱Bug + if ( CHAR_getInt ( petindex , CHAR_BASEIMAGENUMBER) == 101428 ) + { + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( petindex , CHAR_BASEBASEIMAGENUMBER)); + CHAR_setWorkInt( petindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( petindex , CHAR_WORKFIXSTR)); + CHAR_setWorkInt( petindex, CHAR_WORKQUICK, CHAR_getWorkInt( petindex , CHAR_WORKFIXDEX)); + } +#endif +#ifdef _PETSKILL_BECOMEFOX // ĻջٷųʱҪָ״̬ + if ( CHAR_getInt ( petindex , CHAR_WORKFOXROUND) != -1 + || CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) == 101749 ){ //DZΪ + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( petindex , CHAR_BASEBASEIMAGENUMBER)); + CHAR_setWorkInt( petindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( petindex , CHAR_WORKFIXSTR)); + CHAR_setWorkInt( petindex, CHAR_WORKQUICK, CHAR_getWorkInt( petindex , CHAR_WORKFIXDEX)); + CHAR_setWorkInt( petindex, CHAR_WORKFOXROUND, -1 ); + } +#endif + if( CHAR_getWorkInt( petindex, CHAR_WORKBATTLEFLG ) + & CHAR_BATTLEFLG_NORETURN + ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s)޷ظ(%s)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( petindex ) + //); + return 0; + } + + BATTLE_PetDefaultExit( attackindex, battleindex ); + CHAR_setInt( attackindex, CHAR_DEFAULTPET, -1 ); + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)ظ(%s)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( petindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + sprintf( szCommand, "BS|s%X|f0|", attackNo ); + BATTLESTR_ADD( szCommand ); + + return 0; + +} + +int BATTLE_PetOut( int battleindex, int attackNo ) +{ + //char szBuffer[512]=""; + char szCommand[1024], szEscapeName[128]; + int attackindex, petindex, petNo, flg = 0,iRet ; + + szCommand[0] = 0; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + petNo = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM2 ); +#ifdef _PET_BUG + petindex = CHAR_getCharPet( attackindex, petNo); + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + CHAR_setInt( attackindex, CHAR_DEFAULTPET, -1 ); + else +#endif + CHAR_setInt( attackindex, CHAR_DEFAULTPET, petNo ); + + iRet = BATTLE_PetDefaultEntry( attackindex, battleindex, + CHAR_getWorkInt( attackindex, CHAR_WORKBATTLESIDE ) ); + + if( iRet < 0 ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s),ûгټ", + // CHAR_getUseName( attackindex ) + //); + }else + if( CHAR_getInt( attackindex, CHAR_DEFAULTPET ) < 0 ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s),ûгټ", + // CHAR_getUseName( attackindex ) + //); + }else{ + flg = 1; + petNo = CHAR_getInt( attackindex, CHAR_DEFAULTPET ); + petindex = CHAR_getCharPet( attackindex, petNo ); + + CHAR_setWorkInt( petindex, CHAR_WORKBATTLEMODE, + BATTLE_CHARMODE_C_OK ); + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)(%s)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( petindex ) + //); + + makeEscapeString( CHAR_getUseName( petindex ), + szEscapeName, + sizeof( szEscapeName ) ); + + sprintf( szCommand, "BS|s%X|f1|g%X|l%X|h%X|%s|m%X|", + attackNo, + CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER), + CHAR_getInt( petindex, CHAR_LV), + CHAR_getInt( petindex, CHAR_HP), + szEscapeName, + CHAR_getWorkInt( petindex, CHAR_WORKMAXHP) + ); + BATTLESTR_ADD( szCommand ); + } + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + return ( flg )?(TRUE):(FALSE); + +} + + +int BATTLE_Magic( int battleindex, int attackNo ) +{ + int attackindex, defindex, defNo; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defNo = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM2 ); + defindex = BATTLE_No2Index( battleindex, defNo ); + + return 0; +} + + +//б𹥻Ƿ +int BATTLE_S_GBreak( int battleindex, int attackNo, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, attackindex, defindex, ultimate = 0; + int flg = 0, iWork, par, i, DefSide = 0, + react = 0, + Guardian = -1; + BOOL iRet = FALSE; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, + &Guardian, BATTLE_COM_S_GBREAK ); + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 + ){ + react = 0; + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react ); + if( react == BATTLE_MD_REFLEC )defindex = attackindex; +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + + }else{ + //зǷdamageΪ0 + damage = 0; + iWork = BATTLE_RET_MISS; + } + + if( damage > 0 + && ( react != BATTLE_MD_ABSROB ) + && ( react != BATTLE_MD_VANISH ) + ){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + switch( iWork ){ + + case BATTLE_RET_ALLGUARD: + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + iRet = TRUE; + break; + + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)չ(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; + iRet = TRUE; + break; + + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)ľ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_NORMAL; + iRet = TRUE; + break; + + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)ܵ(%s)ľCRITICAL(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_KAISHIN; + iRet = FALSE; + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; + break; +#endif + } + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 + ){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + iRet = FALSE; + } + + flg |= BCF_GBREAK; + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + && flg & BCF_KAISHIN + ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + +#ifdef _NOTRIDE_ + snprintf( szCommand, sizeof( szCommand ), + "BH|a%X|r%X|f%X|d%X|FF|", + attackNo, + defNo, + flg, + damage ); +#else + snprintf( szCommand, sizeof( szCommand ), + "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, + defNo, + flg, + damage, + petdamage + ); +#endif + + BATTLESTR_ADD( szCommand ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + return iRet; +} + + +#ifdef _SKILL_SACRIFICE//Ԯ vincent add 2002/05/30 +int BATTLE_S_Sacrifice( int battleindex, int attackNo, int defNo ) +{ + int attackindex, defindex = 0; + int DefSide ,Damage= 0; + BOOL iRet = FALSE; + char szCommand[256]; + int ToList[SIDE_OFFSET*2+1]; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + if( defNo >= SIDE_OFFSET ){ + DefSide = 1; + } + + //HP + CHAR_setInt(attackindex,CHAR_HP,(CHAR_getInt(attackindex,CHAR_HP)*0.5)); + CHAR_setInt(defindex,CHAR_HP,min(CHAR_getInt(attackindex,CHAR_HP)+CHAR_getInt(defindex,CHAR_HP),CHAR_getWorkInt(defindex,CHAR_WORKMAXHP))); + Damage=CHAR_getInt(attackindex,CHAR_HP); + + //ħ + BATTLE_MultiList( battleindex, defNo, ToList ); + //hpıֵ + BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_heal2 ); + snprintf( szCommand, sizeof(szCommand),"BD|r%X|%X|%X|d%X|p%X|", attackNo, BD_KIND_HP, 0, Damage, 0 ); + BATTLESTR_ADD( szCommand ); + snprintf( szCommand, sizeof(szCommand),"BD|r%X|%X|%X|d%X|p%X|", ToList[0], BD_KIND_HP, 1, Damage, 0 ); + BATTLESTR_ADD( szCommand ); + return iRet; +} +#endif + + +#ifdef _SKILL_REFRESH +int BATTLE_S_Refresh( int battleindex, int attackNo, int defNo, int marray ) +{ + BOOL iRet = FALSE; + char *magicarg; + int status = -1, i,charaindex; + int ReceveEffect= 0; + char *pszP; + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + pszP = magicarg; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 0; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return iRet; + charaindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_getWorkInt( charaindex, StatusTbl[status] ) > 0 ){ + ReceveEffect = SPR_tyusya; + iRet = TRUE; + }else{ + ReceveEffect = SPR_hoshi; + } + + BATTLE_MultiStatusRecovery( battleindex, attackNo, defNo, + status, MAGIC_EFFECT_USER, ReceveEffect ); + return iRet; +} +#endif + +#ifdef _SKILL_ROAR //vincent輼: +int BATTLE_S_Roar( int battleindex, int attackNo, int defNo, int marray ) +{ + int masteridx=-1, index2, charaindex; + BOOL iRet = FALSE; + char buf1[256]; + char szWork[128]; + int petid=-1, i=1; + BOOL FINDPET=FALSE; + + char *magicarg; + int flg=0; + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + + index2 = BATTLE_No2Index( battleindex, defNo);//Ŀ֮index + + if( !CHAR_CHECKINDEX( index2) ) return iRet; + if( BATTLE_Index2No( battleindex, charaindex ) == defNo ){// + return iRet; + } + + if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + petid = -1;// + }else if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEPET ) { + masteridx = BATTLE_No2Index(battleindex,defNo-5);//ڳ + if( !CHAR_CHECKINDEX( masteridx) ) return iRet; + petid = CHAR_getInt(index2,CHAR_PETID);//id + }else if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEENEMY ) { + petid = CHAR_getInt(index2,CHAR_PETID); + } + + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + while( getStringFromIndexWithDelim( magicarg,"|", i, buf1, sizeof( buf1)) != FALSE ) { + if( petid == atoi( buf1) ){//б + FINDPET = TRUE; + break; + } + i++; + } + +//ѶϢ + if( FINDPET == TRUE ) {//Ϊ + char buf4[255]; + sprintf( buf4, "%sˣ", CHAR_getChar( index2, CHAR_NAME)); + BATTLE_Exit(index2,battleindex);//뿪ս + if( CHAR_CHECKINDEX( masteridx) ){ + CHAR_setInt(masteridx,CHAR_DEFAULTPET,-1);//޲ս + CHAR_talkToCli( masteridx,-1, buf4, CHAR_COLORYELLOW); + } + + //ǰ + flg |= BCF_ROAR; + sprintf( szWork, "BH|a%X|", attackNo ); + BATTLESTR_ADD( szWork ); + snprintf( szWork, sizeof( szWork ), "r%X|f%X|d%X|p%X|", defNo, flg, 0, 0 ); + + BATTLESTR_ADD(szWork); + BATTLESTR_ADD( "FF|" ); + sprintf(szWork,"BQ|e%X|",defNo);//ܶ + BATTLESTR_ADD(szWork); + CHAR_talkToCli( CHAR_getWorkInt(charaindex, CHAR_WORKPLAYERINDEX),-1, buf4, CHAR_COLORYELLOW); + } + + return iRet; +} +#endif + +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 +int BATTLE_S_GBreak2( int battleindex, int attackNo, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, attackindex, defindex, ultimate = 0; + int flg = 0, iWork, par, i, DefSide = 0, + react = 0, + Guardian = -1; + BOOL iRet = FALSE; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, + &Guardian, BATTLE_COM_S_GBREAK2 ); + react = 0; + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react ); + if( react == BATTLE_MD_REFLEC )defindex = attackindex; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + + + if( damage > 0 + && ( react != BATTLE_MD_ABSROB ) + && ( react != BATTLE_MD_VANISH ) + ){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + switch( iWork ){ + + case BATTLE_RET_ALLGUARD: + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + iRet = TRUE; + break; + + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)չ(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; + iRet = TRUE; + break; + + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)ľ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_NORMAL; + iRet = TRUE; + break; + + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)ܵ(%s)ľCRITICAL(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_KAISHIN; + iRet = FALSE; + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; + break; +#endif + } + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 + ){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + flg |= BCF_GUARD; + flg |= BCF_GBREAK; + iRet = FALSE; + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY && flg & BCF_KAISHIN ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + +#ifdef _NOTRIDE_ + snprintf( szCommand, sizeof( szCommand ), + "BH|a%X|r%X|f%X|d%X|FF|", + attackNo, + defNo, + flg, + damage ); +#else + snprintf( szCommand, sizeof( szCommand ), + "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, + defNo, + flg, + damage, + petdamage + ); +#endif + + BATTLESTR_ADD( szCommand ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + return iRet; + +} +#endif + + +int BATTLE_Charge( int battleindex, int attackNo ) +{ + //char szBuffer[512]=""; + int attackindex, iWork, N, pow; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + iWork = CHAR_GETWORKINT_LOW( attackindex, CHAR_WORKBATTLECOM3 ); + + if( iWork <= 0 ){ + + N = CHAR_GETWORKINT_HIGH( attackindex, CHAR_WORKBATTLECOM3 ); + pow = CHAR_getWorkInt( attackindex, CHAR_WORKFIXSTR ); + pow += pow * N * 0.01; + CHAR_setWorkInt( attackindex, CHAR_WORKATTACKPOWER, + pow + CHAR_getWorkInt( attackindex, CHAR_WORKMODATTACK ) ); + + CHAR_setWorkInt( attackindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_CHARGE_OK ); + return TRUE; + }else{ + + CHAR_SETWORKINT_LOW( attackindex, CHAR_WORKBATTLECOM3, iWork - 1); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)С", + // CHAR_getUseName( attackindex ) + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + BATTLE_NoAction( battleindex, attackNo ); + + return FALSE; + } +} + +//״̬ж +int BATTLE_StatusAttackCheck( + int attackindex, + int defindex, + int status, + int PerOffset, + int Range, + float Bai, + int *pPer +) +{ + + int Df_Reg = 0, level = 0, per = 0, i ; + int battleindex; + if( status >= BATTLE_ST_END || status <= 0 )return FALSE; + for( i = 1; i < BATTLE_ST_END; i++ ){//쳣״̬return + if( CHAR_getWorkInt( defindex, StatusTbl[i] ) > 0 )return FALSE; + } + + if( status == BATTLE_ST_PARALYSIS){ + per = 20; + per -= CHAR_getWorkInt( defindex, RegTbl[status] ); + *pPer = per; + }else{ + float templP = 0.0; + float fVitalP = 0.0; + fVitalP = CHAR_getInt( defindex, CHAR_VITAL ) + + CHAR_getInt( defindex, CHAR_STR ) + + CHAR_getInt( defindex, CHAR_TOUGH ) + + CHAR_getInt( defindex, CHAR_DEX ); + + templP = (float)CHAR_getInt( defindex, CHAR_VITAL ) / (fVitalP); + +#ifdef _PET_SKILL_SARS //andy_add 2003/06/20 + if( status == BATTLE_ST_SARS ){ + templP = (1 - templP)*0.9; + } +#endif + + fVitalP = templP / 0.25; + + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + fVitalP *= 10.0; + }else{ + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + fVitalP *= 10.0; + }else{ + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + fVitalP *= 10.0; + }else{ + fVitalP *= 10.0; + } + } + } + + if( status >= arraysizeof( RegTbl) || status < 0 ) { + Df_Reg = 0; + }else { + Df_Reg = CHAR_getWorkInt( defindex, RegTbl[status] ); + } + + battleindex = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ); + if( BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + level = CHAR_getInt( attackindex, CHAR_LV ) + - CHAR_getInt( defindex, CHAR_LV ); + level *= Bai; + }else{ + level = 0; + } + if( level > Range )level = Range; + if( level < -Range )level = -Range; + +#ifdef _SUIT_ADDENDUM + per = PerOffset + level + CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ) + - Df_Reg - fVitalP - CHAR_getWorkInt( defindex, CHAR_WORKRESIST ); +#else + per = PerOffset + level + CHAR_getWorkInt( attackindex, CHAR_WORKFIXLUCK ) + - Df_Reg - fVitalP; +#endif //_SUIT_ADDENDUM +#ifdef _EQUIT_RESIST + if( status == CHAR_WORKWEAKEN ) + per -= CHAR_getWorkInt( defindex, CHAR_WORKEQUITWEAKEN ); + else if( status == CHAR_WORKBARRIER ) + per -= CHAR_getWorkInt( defindex, CHAR_WORKEQUITBARRIER ); + else if( status == CHAR_WORKNOCAST ) + per -= CHAR_getWorkInt( defindex, CHAR_WORKEQUITNOCAST ); +#endif //_EQUIT_RESIST +#ifdef _SUIT_ADDPART3 + if( status == CHAR_WORKWEAKEN ) + per -= CHAR_getWorkInt( defindex, CHAR_WORKRENOCAST ); +#endif + if( per > 80 )per = 80; + *pPer = per; + } + + if( RAND( 1, 100 ) < per ){ + return TRUE; + }else{ + return FALSE; + } +} + +//ְҵ״̬ж +int PROFESSION_BATTLE_StatusAttackCheck( int charaindex, int toindex, int status, int Success ) +{ + int rand_num = RAND( 1, 100 ); + int i; + + if( status >= BATTLE_ST_END || status <= 0 ) return 0; + if( CHAR_getInt( toindex , CHAR_HP) <= 0 ) return 0; + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == TRUE ) return 0; + +#ifdef _PROFESSION_ADDSKILL + if( status == BATTLE_ST_RESIST_F_I_T ){//Ȼ + if( CHAR_getWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_F] ) > 0 ) return 0; + if( CHAR_getWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_I] ) > 0 ) return 0; + if( CHAR_getWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_T] ) > 0 ) return 0; + return 1; + } + if( status == CHAR_WORKICECRACK + || status == CHAR_WORKICECRACK2 + || status == CHAR_WORKICECRACK3 + || status == CHAR_WORKICECRACK4 + || status == CHAR_WORKICECRACK5 + || status == CHAR_WORKICECRACK6 + || status == CHAR_WORKICECRACK7 + || status == CHAR_WORKICECRACK8 + || status == CHAR_WORKICECRACK9 + || status == CHAR_WORKICECRACK10){ + return 1; + } +#endif + + for( i = 1; i < BATTLE_ST_END; i++ ){//쳣״̬return + if( CHAR_getWorkInt( toindex, StatusTbl[i] ) > 0 ) return 0; + } + + if( rand_num < Success ){ + return 1; + }else{ + return 0; + } +} + + + +int BATTLE_Combo( int battleindex, int *pAttackList, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int damage = 0, petdamage = 0, + attackindex, + toindex, + defindex, + ultimate = 0, + AllDamage = 0, + AllPetDamage = 0, + react = 0, + attackNo; + int flg = 0, iWork, par, i, DefSide = 0, + Guardian = -2; + BOOL iRet = FALSE; + + defindex = toindex = BATTLE_No2Index( battleindex, defNo ); + + //BATTLE_BroadCast( battleindex, "ɱ", + // (pAttackList[0] >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + for( i = 0; pAttackList[i] != -1 && i < BATTLE_ENTRY_MAX; i ++ ){ + attackNo = pAttackList[i]; + + defindex = toindex; + + flg = 0; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + if( CHAR_getInt( toindex, CHAR_HP ) <= 0 ){ + return FALSE; + } + + if( CHAR_getInt( attackindex, CHAR_HP ) <= 0 ){ + return FALSE; + } + + Guardian = -2; + iWork = BATTLE_AttackSeq( attackindex, toindex, &damage, + &Guardian, BATTLE_COM_COMBO ); + Guardian = -1; + if( damage <= 0 )damage = 1; + + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + + react = BATTLE_GetDamageReact( defindex ); + if( ( react == BATTLE_MD_REFLEC +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + || react == BATTLE_MD_TRAP +#endif +#ifdef _PETSKILL_ACUPUNCTURE + || react == BATTLE_MD_ACUPUNCTURE +#endif + ) && BATTLE_IsThrowWepon( CHAR_getItemIndex( attackindex, CHAR_ARM ) ) == FALSE ){ + + int refrect = 0; + BATTLE_DamageSub( attackindex, + defindex, &damage, &petdamage, &refrect ); + }else + if( react == BATTLE_MD_ABSROB + || react == BATTLE_MD_VANISH + ){ + int refrect = 0; + BATTLE_DamageSub( attackindex, + defindex, &damage, &petdamage, &refrect ); + }else{ + + BATTLE_DamageSubCale( attackindex, + defindex, &damage, &petdamage ); + AllDamage += damage; + AllPetDamage += petdamage; + } + + if( pAttackList[i+1] == -1 ){ + int refrect = -1; + ultimate = BATTLE_DamageSub2( attackindex, + defindex, &AllDamage, &AllPetDamage, &refrect ); + } + if( react == BATTLE_MD_REFLEC ){ + defindex = attackindex; + } +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + if( damage > 0 && ( react != BATTLE_MD_ABSROB )&& ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + szBuffer[0] = 0; + switch( iWork ){ + + case BATTLE_RET_MISS: + case BATTLE_RET_ALLGUARD: + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)Ĺ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_NORMAL; + iRet = TRUE; + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; + + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)(%s)CRITICAL(%d%%)(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // (int)(gCriper*0.01), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_KAISHIN; + iRet = FALSE; + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + break; + + } + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 + ){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + flg |= BCF_GUARD; + iRet = FALSE; + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else + + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY + && flg & BCF_KAISHIN + ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } +#ifdef _NOTRIDE_ + if( 0 <= Guardian && Guardian <= 19 ){ + iRet = FALSE; + flg |= BCF_GUARDIAN; + snprintf( szCommand, sizeof( szCommand ), + "a%X|f%X|d%X|g%X|", + attackNo, + flg, + damage, + Guardian ); + }else{ + snprintf( szCommand, sizeof( szCommand ), + "a%X|f%X|d%X|", + attackNo, + flg, + damage ); + } +#else + if( 0 <= Guardian && Guardian <= 19 ){ + iRet = FALSE; + flg |= BCF_GUARDIAN; + snprintf( szCommand, sizeof( szCommand ), + "a%X|f%X|d%X|p%X|g%X|", + attackNo, + flg, + damage, + petdamage, + Guardian ); + }else{ + snprintf( szCommand, sizeof( szCommand ), + "a%X|f%X|d%X|p%X|", + attackNo, + flg, + damage, + petdamage ); + } + +#endif + BATTLESTR_ADD( szCommand ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + defNo = BATTLE_Index2No( battleindex, defindex ); + + if( defNo >= SIDE_OFFSET ){ + iWork = defNo - SIDE_OFFSET; + DefSide = 1; + }else{ + iWork = defNo; + } + + iWork = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[iWork].flg |= BENT_FLG_ULTIMATE; + } + + } + + return iRet; +} + + + +int BATTLE_EarthRoundHide( int battleindex, int attackNo ) +{ + //char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, flg = 0 ; + + szCommand[0] = 0; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + sprintf( szCommand, "BF|%X|", attackNo ); + BATTLESTR_ADD( szCommand ); + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)Ƶȥ", + // CHAR_getUseName( attackindex ) + //); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + CHAR_setFlg( attackindex, CHAR_ISATTACKED, 0 ); + + CHAR_setWorkInt( attackindex, CHAR_WORKBATTLECOM1, + BATTLE_COM_S_EARTHROUND0 ); + + return ( flg )?(TRUE):(FALSE); + +} + + + +BOOL BATTLE_LostEscape( int battleindex, int attackNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, flg = FALSE, side, SubNo, + oyaindex, pno; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + + if( attackNo >= SIDE_OFFSET ){ + side = 1; SubNo = attackNo - SIDE_OFFSET; + }else{ + side = 0; SubNo = attackNo; + } + + oyaindex = CHAR_getWorkInt( attackindex, CHAR_WORKPLAYERINDEX ); + + pno = CHAR_getInt( oyaindex, CHAR_DEFAULTPET ); + if( pno < 0 )return FALSE; + +// print(" nonoϢ "); + + BATTLE_Exit( attackindex, battleindex ); + + CHAR_setInt( oyaindex, CHAR_DEFAULTPET, -1 ); + + CHAR_AddCharm( oyaindex, CH_FIX_PETESCAPE ); + +// LogPet( +// CHAR_getUseName( oyaindex ), +// CHAR_getUseID( oyaindex ), +// CHAR_getChar( attackindex, CHAR_NAME ), +// CHAR_getInt( attackindex, CHAR_LV ), +// +// "EscapeLost(ս߲)", +// +// CHAR_getInt( oyaindex, CHAR_FLOOR ), +// CHAR_getInt( oyaindex, CHAR_X ), +// CHAR_getInt( oyaindex, CHAR_Y ), +// CHAR_getChar( attackindex, CHAR_UNIQUECODE) // shan 2001/12/14 +// ); + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)ߵˡ", + // CHAR_getUseName( attackindex ) + //); + //if( getBattleDebugMsg( ) != 0 ){ + // BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + + sprintf( szCommand, "BQ|e%X|", attackNo ); + BATTLESTR_ADD( szCommand ); + + snprintf( szBuffer, sizeof( szBuffer ), "K%d", pno ); + + CHAR_sendStatusString( oyaindex, szBuffer ); + + + + return ( flg )?(TRUE):(FALSE); + + +} + +BOOL BATTLE_Abduct( + int battleindex, + int attackNo, + int defNo, + int array +) +{ + //char szBuffer[512]=""; + char szCommand[1024]; +#ifdef _BATTLE_ABDUCTII + char *pszP=NULL; +#endif + int attackindex, defindex, per, flg, attackoyaindex, defoyaindex = -1; + int attacklevel, deflevel; + int Attacktype, Deftype; + BOOL iRet = FALSE; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return iRet; + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return iRet; +#ifdef _BATTLE_ABDUCTII + // ȡó\ + pszP = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszP == "\0" ) return iRet; +#endif + + //ANDY_ReEdit + Attacktype = CHAR_getInt( attackindex, CHAR_WHICHTYPE); + if( Attacktype == CHAR_TYPEENEMY ) { + attackoyaindex = -1; + }else if( Attacktype == CHAR_TYPEPET ) { + attackoyaindex = CHAR_getWorkInt( attackindex, CHAR_WORKPLAYERINDEX ); + if( CHAR_CHECKINDEX( attackoyaindex ) == FALSE ) return iRet; + }else { + return iRet; + } + //ANDY_ReEdit + Deftype = CHAR_getInt( defindex, CHAR_WHICHTYPE ); + if( Deftype == CHAR_TYPEPET ){ + defoyaindex = CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX ); + if( CHAR_CHECKINDEX( defoyaindex ) == FALSE ) return iRet; + }else { + defoyaindex = -1; + } + + if( Deftype != CHAR_TYPEPLAYER ){ +#ifdef _BATTLE_ABDUCTII + int AiPer=0; + // ȡó\ + AiPer = atoi( pszP); + if( AiPer <= 0 || Deftype != CHAR_TYPEPET ){ +#endif + attacklevel = CHAR_getInt( attackindex, CHAR_LV ); + deflevel = CHAR_getInt( defindex, CHAR_LV ); + per = ( deflevel - attacklevel ) * 0.6 + 30; + per = max( per, 50 ); +#ifdef _BATTLE_ABDUCTII + }else { + per = 0; + if( CHAR_getWorkInt( defindex, CHAR_WORKFIXAI) < AiPer ){ + per = 200; + } + } +#endif + }else{ + per = 0; + return iRet; + } + if( BattleArray[battleindex].WinFunc != NULL ){ + per = 0; + } +#ifdef _ALLBLUES_LUA + else if( CHAR_getInt( BattleArray[battleindex].createindex, CHAR_WHICHTYPE ) == CHAR_TYPELUANPC ){ + per = 0; + } +#endif + iRet = TRUE; + if( RAND( 1, 100 ) < per ){ + flg = 1; + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)뿪ô(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // per + //); + if( Deftype == CHAR_TYPEPET ){ + BATTLE_PetDefaultExit( defoyaindex, battleindex ); + CHAR_setInt( defoyaindex, CHAR_DEFAULTPET, -1 ); + }else if( Deftype == CHAR_TYPEENEMY ) { + BATTLE_Exit( defindex, battleindex ); + } + }else{ + flg = 0; + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)޷(%s)һĬĬ뿪(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // per + //); + } + + //if( getBattleDebugMsg( ) != 0 ){ + // BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + sprintf( szCommand, "B!|a%X|d%X|f%X|", attackNo, defNo, flg ); + BATTLESTR_ADD( szCommand ); + + //ANDY_ReEdit + if( Attacktype == CHAR_TYPEPET ) { + BATTLE_PetDefaultExit( attackoyaindex, battleindex ); + CHAR_setInt( attackoyaindex, CHAR_DEFAULTPET, -1 ); + }else { + BATTLE_Exit( attackindex, battleindex); + } + return iRet; +} +#ifdef _BATTLESTEAL_FIX +void BATTLE_StealMoney( int battleindex, int attackNo, int defNo) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, defindex, per; + int S_FLG = 0, GOLD = 0; + int LV=0; + char buf1[256]; + int masterindex; + int safeSide=0; + + if( BATTLE_CHECKINDEX( battleindex) == FALSE ) return; + attackindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return; + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return; + masterindex = CHAR_getWorkInt( attackindex, CHAR_WORKPLAYERINDEX ); + if( !CHAR_CHECKINDEX( masterindex ) ) return; + LV = CHAR_getInt( defindex, CHAR_LV ); + per = 0; + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + if( attackNo > 10 ) { + safeSide = 1; + } + if( defNo>=safeSide*SIDE_OFFSET && defNo<((safeSide*SIDE_OFFSET)+SIDE_OFFSET)){//ͬ + per = 0; + }else { //ͬ + per = 50; + per = (((per+LV)/4)+10)>>1; + } + }else if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + per=5; + } + S_FLG = 0; + + + + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + if( CHAR_getInt( masterindex, CHAR_GOLD) >= CHAR_getMaxHaveGold( masterindex) ) + per = 0; + } + + if( RAND( 1, 100 ) < per ){ + S_FLG = 1; + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + GOLD = CHAR_getInt( defindex, CHAR_GOLD ); + GOLD = (int)( (float)GOLD * RAND( 1, 15 ) * 0.01 ); + if( (CHAR_getInt( masterindex, CHAR_GOLD) + GOLD) >= CHAR_getMaxHaveGold( masterindex) ) { + GOLD = CHAR_getMaxHaveGold( masterindex) - CHAR_getInt( masterindex, CHAR_GOLD); + } + }else { + GOLD = RAND( 10, 100); + } + if( GOLD <= 0 ){ + S_FLG = 0; + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%d)STONE(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // GOLD, + // per + // ); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + CHAR_setInt( defindex, CHAR_GOLD, CHAR_getInt( defindex, CHAR_GOLD ) - GOLD ); + CHAR_send_P_StatusString( defindex, CHAR_P_STRING_GOLD ); + } + } + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)û(%s)ö(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // per + //); + } + sprintf( buf1, "͵һЩʯ"); + if( S_FLG) { + sprintf( szBuffer, "BK|%s%s|", CHAR_getUseName( defindex ), buf1 ); + strcatsafe( szBadStatusString,sizeof(szBadStatusString), szBuffer ); + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int attackoyaindex = CHAR_getWorkInt( attackindex, CHAR_WORKPLAYERINDEX ); + if( CHAR_CHECKINDEX( attackoyaindex ) == TRUE ){ + BATTLE_PetDefaultExit( attackoyaindex, battleindex ); + CHAR_setInt( attackoyaindex, CHAR_DEFAULTPET, -1 ); + { + int playergold=CHAR_getInt( attackoyaindex, CHAR_GOLD)+GOLD; + if( playergold > CHAR_getMaxHaveGold( attackoyaindex) ) playergold = CHAR_getMaxHaveGold( attackoyaindex); + CHAR_setInt( attackoyaindex, CHAR_GOLD , playergold); + CHAR_send_P_StatusString( attackoyaindex, CHAR_P_STRING_GOLD ); + } + lssproto_KS_send( getfdFromCharaIndex( attackoyaindex ), + CHAR_getInt( attackoyaindex, CHAR_DEFAULTPET ), 1 ); + } + BATTLE_Exit( attackindex, battleindex ); + }else{ + BATTLE_Exit( attackindex, battleindex ); + } + } + //if( getBattleDebugMsg( ) != 0 ) { + // BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + sprintf( szCommand, "B#|a%X|d%X|f%X|", attackNo, defNo, S_FLG ); + BATTLESTR_ADD( szCommand ); +} +#endif + +void BATTLE_Steal( int battleindex, int attackNo, int defNo ) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, defindex, per, flg, i, j; + int enemytype, stealmode = 0, gold, itemindex; + int itemtbl[CHAR_MAXITEMNUM]; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE )return; + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( defindex ) == FALSE )return; + enemytype = CHAR_getInt( defindex, CHAR_WHICHTYPE ); + if( enemytype == CHAR_TYPEPLAYER ){ + per = 50; + }else{ + per = 0; + } + + if( RAND( 1, 100 ) < per ){ + flg = 1; + if( RAND( 1, 100 ) < 50 ){ + stealmode = 0; + gold = CHAR_getInt( defindex, CHAR_GOLD ); + gold = (int)( (float)gold * RAND( 8, 12 ) * 0.01 ); + if( gold <= 0 ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)޷(%s)STONE(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // per + //); + flg = 0; + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%d)STONE(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gold, + // per + //); + CHAR_setInt( defindex, CHAR_GOLD, + CHAR_getInt( defindex, CHAR_GOLD ) - gold ); + CHAR_send_P_StatusString( defindex, CHAR_P_STRING_GOLD ); + } + }else{ + stealmode = 1; + for( j = 0, i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ){ + itemindex = CHAR_getItemIndex( defindex, i ); + if( ITEM_CHECKINDEX( itemindex ) == TRUE ){ + itemtbl[j++] = i; + } + } + if( j <= 0 ){ + itemindex = -1; + }else{ + itemindex = -1; + i = RAND( 0, j-1 ); + if( i >= 0 ){ + if( 0 <= itemtbl[i] && itemtbl[i] < CHAR_STARTITEMARRAY ){ + fprint( "err:ҪȡװƷ(%d)\n", itemtbl[i] ); + }else{ + itemindex = CHAR_getItemIndex( defindex, itemtbl[i] ); + } + } + } + if( itemindex == - 1 ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)޷(%s)ĵ(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // per + //); + flg = 0; + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // ITEM_getAppropriateName( itemindex ), + // per + //); + CHAR_setItemIndex( defindex, itemtbl[i], -1 ); + CHAR_sendItemDataOne( defindex, itemtbl[i] ); + { +// LogItem( +// CHAR_getChar( defindex, CHAR_NAME ), +// CHAR_getChar( defindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "Stealed(͵Եĵ)", +// CHAR_getInt( defindex,CHAR_FLOOR), +// CHAR_getInt( defindex,CHAR_X ), +// CHAR_getInt( defindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + } + ITEM_endExistItemsOne( itemindex ); + } + } + }else{ + flg = 0; + //snprintf( szBuffer, sizeof(szBuffer), "(%s)û(%s)ö(%d%%)", + // CHAR_getUseName( attackindex ), CHAR_getUseName( defindex ), per ); + } + if( flg == 1 ){ + sprintf( szBuffer, "BK|%s͵һЩ|", + CHAR_getUseName( defindex ) ); + strcatsafe( szBadStatusString,sizeof(strcatsafe), szBuffer ); + if( CHAR_getInt( attackindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int attackoyaindex = CHAR_getWorkInt( attackindex, CHAR_WORKPLAYERINDEX ); + if( CHAR_CHECKINDEX( attackoyaindex ) == TRUE ){ + BATTLE_PetDefaultExit( attackoyaindex, battleindex ); + CHAR_setInt( attackoyaindex, CHAR_DEFAULTPET, -1 ); + }else{ + BATTLE_Exit( attackindex, battleindex ); + } + }else{ + BATTLE_Exit( attackindex, battleindex ); + } + } + //if( getBattleDebugMsg( ) != 0 ){ + // BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + //} + sprintf( szCommand, "B#|a%X|d%X|f%X|", attackNo, defNo, flg ); + BATTLESTR_ADD( szCommand ); +} + +#ifdef _PSKILL_FALLGROUND // +int BATTLE_S_FallGround( int battleindex, int attackNo, int defNo, int skill_type) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, defindex; + int damage=0, petdamage=0, i=0, iWork, Guardian=-1; + int flg = 0, DefSide=0,par,ultimate=0, react=0; + BOOL iRet = FALSE; + attackindex = BATTLE_No2Index( battleindex, attackNo ); //index + defindex = BATTLE_No2Index( battleindex, defNo ); //طindex + + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + react = 0; + react = BATTLE_GetDamageReact( defindex);//й⾵ + //ȡù״̬ + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, + &Guardian, BATTLE_COM_S_FALLRIDE ); + + + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react ); + if( react == BATTLE_MD_REFLEC ) defindex = attackindex; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + if( damage > 0 && ( react != BATTLE_MD_ABSROB )&& ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + + + + switch( iWork ){ + case BATTLE_RET_ALLGUARD: + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + iRet = TRUE; + break; + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)չ(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_DODGE; + iRet = TRUE; + break; + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)ľ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + //andy_edit + flg |= BATTLE_getReactFlg( defindex, react); + flg |= BCF_NORMAL; + iRet = TRUE; + break; + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)ܵ(%s)ľCRITICAL(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + flg |= BCF_KAISHIN; + iRet = FALSE; + flg |= BATTLE_getReactFlg( defindex, react); + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + flg |= BCF_B_ARRANGE; + break; +#endif + } + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 ){ + strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + iRet = FALSE; + } + + if( skill_type == BATTLE_COM_S_FALLRIDE && damage > 0 && react == 0 +#ifdef _PREVENT_TEAMATTACK + && BATTLE_CheckSameSide( attackindex, defNo) == 0 +#endif + ){ // + int fallflg = RAND( 0, 100); + if( +#ifdef _EQUIT_RESIST + fallflg > 50 + CHAR_getWorkInt( defindex, CHAR_WORKEQUITFALLRIDE ) +#else + fallflg > 50 +#endif + ){ + if( CHAR_getInt( defindex , CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { +#ifdef _FIXPETFALL //Syu ADD + if( CHAR_getInt( defindex, CHAR_RIDEPET) >= 0 ) { +#else + if( CHAR_getInt( defindex, CHAR_RIDEPET) > 0 ) { +#endif + flg |= BCF_FALL; + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + } + } +#ifdef _ENEMY_FALLGROUND + else if( CHAR_getInt( defindex , CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + if( CHAR_getInt( defindex, CHAR_RIDEPET) > 0 ) { + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + + CHAR_setInt( defindex, CHAR_STR, CHAR_getInt( defindex, CHAR_STR)*0.7); + CHAR_setInt( defindex, CHAR_TOUGH, CHAR_getInt( defindex, CHAR_TOUGH)*0.7); + CHAR_setInt( defindex, CHAR_VITAL, CHAR_getInt( defindex, CHAR_VITAL)*0.7); + CHAR_complianceParameter( defindex ); + if( CHAR_getInt( defindex , CHAR_HP) > CHAR_getWorkInt( defindex , CHAR_WORKMAXHP ) ) { + CHAR_setInt( defindex , CHAR_HP , CHAR_getWorkInt( defindex , CHAR_WORKMAXHP ) ); + } + } + } +#endif + } + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + ultimate = 1; + }else + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY && flg & BCF_KAISHIN ){ + if( RAND( 1, 100 ) < 50 ){ + ultimate = 1; + } + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) ultimate = 0; +#endif + iRet = FALSE; + flg |= BCF_DEATH; + if( ultimate == 1 ){ + flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( ultimate == 2 ){ + flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + + BATTLESTR_ADD( szCommand ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + return iRet; +} +#endif + +#ifdef _PRO_BATTLEENEMYSKILL +int BATTLE_E_ENEMYREFILE( int battleindex, int attackNo, int defNo, int skill_type ) +{ + int ReceveEffect; + BOOL iRet = FALSE; + int attackindex, defindex, pow, toNo; + + toNo=-1; + attackindex = BATTLE_No2Index( battleindex, attackNo); + + if( !CHAR_CHECKINDEX( attackindex) ) return iRet; + if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + int k=0, j=0, index; + int ToNoList[10]; + int l=0; + memset( ToNoList,-1, sizeof( ToNoList)); + + for( k=10;k<20;k++) { + index = BATTLE_getBattleDieIndex( battleindex, k); + if( !CHAR_CHECKINDEX( index) ) continue; + if( CHAR_getFlg( index, CHAR_ISDIE ) == TRUE ) { + ToNoList[j] = k; + j++; + } + } + if( j == 0 ) return iRet; + toNo = ToNoList[ l=RAND( 0, j-1)]; + if( toNo < 0 || toNo > 20 ) + return iRet; + }else if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + toNo = defNo; + }else { + return iRet; + } + if( !BATTLE_CHECKNO( toNo) ) return iRet; + ReceveEffect = SPR_fukkatu1; + defindex = BATTLE_No2Index( battleindex, toNo); + if( !CHAR_CHECKINDEX( defindex) ) return iRet; + pow = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP)/2; + BATTLE_MultiRessurect( battleindex, attackNo, toNo, + pow, 0, SPR_item3, ReceveEffect ); + iRet = TRUE; + + return iRet; +} + +int BATTLE_E_ENEMYREHP( int battleindex, int attackNo, int defNo, int skill_type) +{ + BOOL iRet=FALSE; + int attackindex, defindex; + int power = 0, per = 0, HealedEffect, toNo=-1; + int kind; + + attackindex = BATTLE_No2Index( battleindex, attackNo); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return iRet; + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_INIT || + !CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEMODE ) ){ + return iRet; + } + + if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + int k=0, j=0, l, index; + int ToNoList[10]; + memset( ToNoList,-1, sizeof( ToNoList)); + for( k=10;k<20;k++) { + index = BATTLE_No2Index( battleindex, k); + if( !CHAR_CHECKINDEX( index) ) continue; + if( CHAR_getInt( index, CHAR_HP) <= 0 ) continue; + if( CHAR_getInt( index, CHAR_HP) < (CHAR_getWorkInt( index, CHAR_WORKMAXHP) *2/3)) { + ToNoList[j] = k; + j++; + } + } + if( j == 0 ) return iRet; + toNo = ToNoList[ l=RAND( 0, j-1)]; + if( toNo < 0 || toNo > 20 ) + return iRet; + + }else if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + toNo = defNo; + }else { + return iRet; + } + defindex = BATTLE_No2Index( battleindex, toNo); + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return iRet; + + kind = 0; + power = RAND( 100, CHAR_getWorkInt( defindex, CHAR_WORKMAXHP)); + HealedEffect = SPR_heal2; + BATTLE_MultiRecovery( battleindex, attackNo, toNo,kind, power, per, SPR_item3, HealedEffect ); + + iRet = TRUE; + return iRet; +} + +int BATTLE_E_ENEMYHELP( int battleindex, int attackNo, int defNo, int skill_type ) +{ + BOOL iRet = FALSE; + int attackindex, enindex, array; + int Side=-1, LV, i, enemynum, PetID; + //char szBuffer[256]=""; + //print("\n BATTLE_E_ENEMYHELP()"); + + attackindex = BATTLE_No2Index( battleindex, attackNo); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return iRet; + if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) != CHAR_TYPEENEMY || + BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P || + CHAR_getInt( attackindex , CHAR_HP) <= 0 ) { + return iRet; + } + + if( CHAR_getInt( attackindex , CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) { + int k=0, index; + int ToNoList[10]; + memset( ToNoList,-1, sizeof( ToNoList)); + for( k=10;k<20;k++) { + index = BATTLE_No2Index( battleindex, k); + if( !CHAR_CHECKINDEX( index) ) { + break; + } + } + if( k == 20 ) return iRet; + } + LV = CHAR_getInt( attackindex, CHAR_LV ); + + PetID = CHAR_getInt( attackindex, CHAR_PETID ); + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + //if( ENEMY_getInt( i, ENEMY_ID ) == PetID ) + if( ENEMY_getInt( i, ENEMY_TEMPNO ) == PetID ) + break; + } + if( i == enemynum ) + return iRet; + array = i; + + Side = CHAR_getWorkInt( attackindex, CHAR_WORKBATTLESIDE ); + enindex = ENEMY_createEnemy( array, RAND( (LV*0.8), LV*1.2)); + if( !CHAR_CHECKINDEX( enindex ) ) return iRet; + if( BATTLE_NewEntry( enindex, battleindex, Side) ) { + //CHAR_setWorkInt( enindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_RESCUE ); + CHAR_setWorkInt( enindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + //snprintf( szBuffer, sizeof( szBuffer ), "(%s)ս", + // CHAR_getUseName( enindex ) ); + //BATTLE_BroadCast( battleindex, szBuffer, CHAR_COLORYELLOW ); + }else { + + } + iRet = TRUE; + return iRet; + +} + +#endif + +int BATTLE_DefineAttack( int attackindex, int defindex, int iWork, + char *szBuffer, int damage, int react, int *flg) +{ + int iRet; + int par; + iRet = TRUE; + par = BATTLE_AttrAdjust( attackindex, defindex, 100 ); + switch( iWork ){ + case BATTLE_RET_ALLGUARD: + case BATTLE_RET_MISS: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s),ûС", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ) + //); + iRet = TRUE; + break; + case BATTLE_RET_DODGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)չ(%s)㿪(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + *flg |= BCF_DODGE; + iRet = TRUE; + break; + case BATTLE_RET_NORMAL: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܵ(%s)ľ(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + + *flg |= BATTLE_getReactFlg( defindex, react); + *flg |= BCF_NORMAL; + iRet = TRUE; + break; + case BATTLE_RET_CRITICAL: + //snprintf( szBuffer, sizeof(szBuffer), + //"(%s)ܵ(%s)ľCRITICAL(%d)(%d:%d:%d%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // damage, + // CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ), + // CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ), + // par + //); + *flg |= BCF_KAISHIN; + iRet = FALSE; + *flg |= BATTLE_getReactFlg( defindex, react); + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE: + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%.2f%%)", + // CHAR_getUseName( attackindex ), + // CHAR_getUseName( defindex ), + // gDuckPer + //); + *flg |= BCF_B_ARRANGE; + break; +#endif + } + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_GUARD + && CHAR_getWorkInt( defindex, CHAR_WORKCONFUSION ) <= 0 ){ + //strncat( szBuffer, "(GUARD)", sizeof( szBuffer ) ); + iRet = FALSE; + } + + return iRet; +} + +int BATTLE_DefDieType( int defindex, int iRet, int *ultimate, int *flg, char *szBuffer) +{ + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO ){ + *ultimate = 1; + }else + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEENEMY && *flg & BCF_KAISHIN ){ + if( RAND( 1, 100 ) < 50 ){ + *ultimate = 1; + } + } + +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) *ultimate = 0; +#endif + iRet = FALSE; + *flg |= BCF_DEATH; + if( *ultimate == 1 ){ + *flg |= BCF_ULTIMATE_1; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + if( *ultimate == 2 ){ + *flg |= BCF_ULTIMATE_2; + strcatsafe( szBuffer,sizeof(szBuffer), "ultimate?" ); + } + } + return iRet; +} + +#ifdef _SKILL_DAMAGETOHP +int BATTLE_S_DamageToHp( int battleindex, int attackindex, int defindex, int Damage, int skill) +{ + char *pszOption; + char buf1[256]; + int A_HP=0, pHP,defi=0; + float def=0.00; + if( Damage < 1 ) return A_HP; + if( BATTLE_GetDamageReact( defindex) > 0 )//й⾵ + return A_HP; + + pszOption = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( pszOption == "\0" ) + return A_HP; + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( pszOption, "|",2, buf1,sizeof( buf1)) == FALSE ) + return A_HP; + + defi = atoi( buf1); + def = ((float)defi)/100; + A_HP = (int)(Damage*def); + if( (A_HP+CHAR_getInt( attackindex, CHAR_HP)) > CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP ) ){ + A_HP = CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP )-CHAR_getInt( attackindex, CHAR_HP); + } + + pHP = CHAR_getInt( attackindex, CHAR_HP) + A_HP; + CHAR_setInt( attackindex, CHAR_HP, min( pHP, CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP ))); + CHAR_send_P_StatusString( attackindex, CHAR_P_STRING_HP); + return A_HP; +} +#endif + +#ifdef _PETSKILL_DAMAGETOHP +int BATTLE_S_DamageToHp2( int battleindex, int attackindex, int defindex, int Damage, int skill) +{ + char *pszOption; + char buf1[256]; + int A_HP=0, pHP,defi=0; + float def=0.00; + if( Damage < 1 ) return A_HP; + if( BATTLE_GetDamageReact( defindex) > 0 )//й⾵ + return A_HP; + + pszOption = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( pszOption == "\0" ) + return A_HP; + memset( buf1, 0, sizeof( buf1)); + sprintf(buf1,"%s",pszOption); + //if( getStringFromIndexWithDelim( pszOption, "|",2, buf1,sizeof( buf1)) == FALSE ) + // return A_HP; + + defi = atoi( buf1); + def = ((float)defi)/100; + A_HP = (int)(Damage*def); + if( (A_HP+CHAR_getInt( attackindex, CHAR_HP)) > CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP ) ){ + A_HP = CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP )-CHAR_getInt( attackindex, CHAR_HP); + } + //print("\n:%d Ѫ:%d",Damage,A_HP); + pHP = CHAR_getInt( attackindex, CHAR_HP) + A_HP; + CHAR_setInt( attackindex, CHAR_HP, min( pHP, CHAR_getWorkInt( attackindex, CHAR_WORKMAXHP ))); + CHAR_send_P_StatusString( attackindex, CHAR_P_STRING_HP); + return A_HP; +} +#endif + +#ifdef _Skill_MPDAMAGE //BATTLE_COM_S_MPDAMAGE +int BATTLE_S_MpDamage( int battleindex, int attackindex, int defindex, int damage, int skill) +{ + char *pszOption; + char buf1[256]; + int D_MP=0,defi=0; + float def=0.00; + if( damage < 1 ) return D_MP; + if( BATTLE_GetDamageReact( defindex) > 0 )//й⾵ + return D_MP; + if( CHAR_getInt( defindex, CHAR_WHICHTYPE) == CHAR_TYPEENEMY || + CHAR_getInt( defindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ) + return D_MP; + if( CHAR_getInt( defindex, CHAR_MP) <= 0 ) return D_MP; + + pszOption = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( pszOption == "\0" ) return D_MP; + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( pszOption, "|",2, buf1,sizeof( buf1)) == FALSE ) + return D_MP; + defi = atoi( buf1); + def = ((float)defi)/100; + D_MP = (int)(CHAR_getInt( defindex, CHAR_MP)*def); + CHAR_setInt( defindex, CHAR_MP, ( CHAR_getInt( defindex, CHAR_MP) - D_MP) ); + CHAR_send_P_StatusString( defindex, CHAR_P_STRING_MP); + return D_MP; +} +#endif +#ifdef _SKILL_TOOTH +void BATTLE_S_ToothCrushe( int battleindex, int attackindex, int defindex, int damage, int skill) +{ + int crushindex, itemindex; //aszCrushTbl + //char *strCrushTbl[] = { "", "", "ٻ" , "ʹ" , "Ƭ" }; + if( CHAR_getInt( defindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER +#ifdef _TAKE_ITEMDAMAGE_FOR_PET + && CHAR_getInt( defindex, CHAR_WHICHTYPE) == CHAR_TYPEPET +#endif + ) + return; +#ifdef _TAKE_ITEMDAMAGE + if( ( crushindex = BATTLE_ItemCrushCheck( defindex, 1) ) >= 0 ) { + int crushenum, maxcrushenum, level=0; + float def=0.00; + itemindex = CHAR_getItemIndex( defindex, crushindex ); + if( ITEM_CHECKINDEX(itemindex) == FALSE ) return; + crushenum = ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE); + maxcrushenum = ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE); + if( maxcrushenum < 1 ) return; + def = ((float)crushenum/maxcrushenum); + if( def >= 1 ) { + level = 1; + def = 0.70; + }else if( def >= 0.50 ){ + level = 2; + def = 0.30; + }else if( def >= 0.30 ){ + level = 3; + def = 0.10; + }else{ + def = 0.00; + } + crushenum = (int)((float)maxcrushenum*def); + ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, crushenum); + + if( crushenum <= 0 ) { + char buf2[256]; + sprintf(buf2, "%s𻵶ʧ\n", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( defindex, -1, buf2, CHAR_COLORYELLOW); + +// LogItem( +// CHAR_getChar( defindex, CHAR_NAME ), +// CHAR_getChar( defindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "𻵶ʧ", +// CHAR_getInt( defindex,CHAR_FLOOR), +// CHAR_getInt( defindex,CHAR_X ), +// CHAR_getInt( defindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + + CHAR_setItemIndex( defindex, crushindex ,-1); + ITEM_endExistItemsOne( itemindex); + + }else { + char buf2[256]; + sprintf( buf2, "%s%sġ", ITEM_getChar( itemindex, ITEM_NAME ), aszCrushTbl[level] ); + CHAR_talkToCli( defindex, -1, buf2, CHAR_COLORYELLOW); + //ĵ˵ +// buf1 = ITEM_getChar( itemindex, ITEM_SECRETNAME); +// if( strstr( buf1, "(") != 0 ) { +// char buf5[256]; +// if( getStringFromIndexWithDelim( buf1,"(",1, buf5, sizeof( buf5)) != FALSE ) { +// sprintf( buf1, buf5); +// } +// } +// sprintf( buf2, "%s(%s)", buf1, aszCrushTbl[level]); +// ITEM_setChar( itemindex, ITEM_SECRETNAME, buf2); + ITEM_setInt( itemindex, ITEM_CRUSHLEVEL, level); + } + CHAR_sendItemDataOne( defindex, crushindex ); + CHAR_complianceParameter( defindex ); + CHAR_send_P_StatusString( defindex, CHAR_P_STRING_ATK | CHAR_P_STRING_DEF + | CHAR_P_STRING_QUICK | CHAR_P_STRING_CHARM ); + + } +#endif +} +#endif + +#ifdef _PSKILL_MODIFY +void BATTLE_S_Modifyattack( int battleindex, int attackindex, int defindex, int *damage, int skill) +{ + int i; + char *pszOption=NULL; + int array = skill; + char buf1[256], buf2[256]; + float def=0.00; + struct tagModKind{ + char szModKind[36]; + int Kind; + }KModKind[5] = { + { "EA", CHAR_EARTHAT}, { "WA", CHAR_WATERAT}, + { "FI", CHAR_FIREAT} , { "WI", CHAR_WINDAT}, + { "ALL",100} + }; + + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return; + + if( getStringFromIndexWithDelim( pszOption, "|", 2, buf2, sizeof( buf1)) == FALSE ) + return; + def = ((float)(atoi( buf2))/100); + + for( i=0; i< 4; i++) { + int ModNum=0; + if( strcmp( KModKind[i].szModKind , buf1)) continue; + if( (ModNum = CHAR_getInt( defindex, KModKind[i].Kind )) > 0 ) { + def += (float)((rand()%(ModNum+5))/100); + *damage += *damage * def; + break; + } + } +} +#endif + +#ifdef _PETSKILL_PROPERTY +int BATTLE_S_PetSkillProperty( int battleindex, int attackNo, int skill_type, int skill) +{ + int attackindex; + BOOL iRet = FALSE; + char *pszP=NULL; + + pszP = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( pszP == "\0" ) return iRet; + + + attackindex = BATTLE_No2Index( battleindex, attackNo ); //index + if( !CHAR_CHECKINDEX( attackindex)) return iRet; + switch( skill_type){ + case BATTLE_COM_S_PROPERTYSKILL: + { + Char *ch; + ch = CHAR_getCharPointer( attackindex); + if( ch == NULL ) return iRet; + strcpysafe( ch->charfunctable[CHAR_BATTLEPROPERTY].string, + sizeof( ch->charfunctable[CHAR_BATTLEPROPERTY]), pszP);//ս + CHAR_constructFunctable( attackindex); + iRet = TRUE; + } + break; + } + return iRet; +} +#endif + +int BATTLE_S_AttackDamage( int battleindex, int attackNo, int defNo, int skill_type, int skill) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, defindex; + int damage=0, petdamage=0, i=0, iWork, Guardian=-1,react; + int flg = 0, DefSide=0,ultimate=0; + int otherdamage=0; + BOOL iRet = FALSE; + int ReactType = 0; + + char *pszP=NULL; + pszP = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( pszP == "\0" ) return iRet; + + react = 0; + attackindex = BATTLE_No2Index( battleindex, attackNo ); //index + defindex = BATTLE_No2Index( battleindex, defNo ); //طindex + if( (ReactType=BATTLE_GetDamageReact( defindex)) > 0 ) { //й⾵ + react = ReactType; +#ifdef _BATTLE_LIGHTTAKE + if( skill_type == BATTLE_COM_S_LIGHTTAKE ){ + int Statustype = -2; + if( strstr( pszP, "VANISH") != 0 ) Statustype = BATTLE_MD_VANISH; + else if( strstr( pszP, "ABSROB") != 0 ) Statustype = BATTLE_MD_ABSROB; + else if( strstr( pszP, "REFLEC") != 0 ) Statustype = BATTLE_MD_REFLEC; + if( ReactType == Statustype ){ + react=0; + }else{ + skill_type=-1; + } + }else{ + skill_type=-1; + } +#else + skill_type=-1; +#endif + } + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + + //ȡù״̬ + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, &Guardian, skill_type ); + + switch( skill_type){ +#ifdef _PSKILL_MODIFY + case BATTLE_COM_S_MODIFYATT: + if( damage > 0 ){ + BATTLE_S_Modifyattack( battleindex, attackindex, defindex, &damage, skill); + } + break; +#endif +#ifdef _PETSKILL_TEAR + case BATTLE_COM_S_PETSKILLTEAR: +#ifdef _PREVENT_TEAMATTACK + if( BATTLE_CheckSameSide( attackindex, defNo) == 1 ){ + }else +#endif + if( iWork != BATTLE_RET_DODGE && react == 0 ){ + int userhp=0, petindex; + float def=0; + userhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP) - CHAR_getInt( defindex, CHAR_HP); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && + (petindex = BATTLE_getRidePet( defindex )) != -1 ){ + userhp += CHAR_getWorkInt( petindex, CHAR_WORKMAXHP) - CHAR_getInt( petindex, CHAR_HP); + } + def = ((float)atoi( pszP))/100; + userhp = userhp * def; + if( userhp <= 0 ) damage = 0; + else damage += userhp; + } + break; +#endif + } + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react); + + if( react == BATTLE_MD_REFLEC ) defindex = attackindex; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + + if( damage > 0 && ( react != BATTLE_MD_ABSROB )&& ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + iRet = BATTLE_DefineAttack( attackindex, defindex, iWork, szBuffer, damage, react, &flg); + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ) + iRet = BATTLE_DefDieType( defindex, iRet, &ultimate, &flg, szBuffer); +#ifdef _PETSKILL_ANTINTER + //ǿƽij + if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ANTINTER + && CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + ultimate = 2; + flg &= (!BCF_ULTIMATE_1); + flg |= BCF_DEATH; + flg |= BCF_ULTIMATE_2; + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + damage=1;//ж damage<=0 skill_type=-1 damageΪ1 + } +#endif + + if( damage > 0 ){ +#ifdef _TAKE_ITEMDAMAGE + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ){ +#else + if( BATTLE_ItemCrushSeq( defindex ) == TRUE ){ +#endif + flg |= BCF_CRUSH; + } + } + + if( damage <= 0 ) { +#ifdef _SONIC_ATTACK // WON ADD + if( skill_type != BATTLE_COM_S_SONIC && skill_type != BATTLE_COM_S_SONIC2 +#ifdef _PETSKILL_REGRET + && skill_type != BATTLE_COM_S_REGRET && skill_type != BATTLE_COM_S_REGRET2 +#endif + ) +#endif + skill_type=-1; + } + + + + + memset( szCommand, 0, sizeof( szCommand)); + switch( skill_type) { + case -1: + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + break; + +#ifdef _PETSKILL_TEAR + case BATTLE_COM_S_PETSKILLTEAR: + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _SKILL_DAMAGETOHP + case BATTLE_COM_S_DAMAGETOHP: + otherdamage = BATTLE_S_DamageToHp( battleindex, attackindex, defindex,damage+petdamage, skill); + snprintf( szCommand, sizeof( szCommand ), "Bh|a%X|r%X|f%X|d%X|p%X|j%X|FF|", + attackNo, defNo, flg, damage, petdamage, otherdamage); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _PETSKILL_DAMAGETOHP + case BATTLE_COM_S_DAMAGETOHP2: + otherdamage = BATTLE_S_DamageToHp2( battleindex, attackindex, defindex,damage+petdamage, skill); + snprintf( szCommand, sizeof( szCommand ), "Bh|a%X|r%X|f%X|d%X|p%X|j%X|FF|", + attackNo, defNo, flg, damage, petdamage, otherdamage); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _Skill_MPDAMAGE + case BATTLE_COM_S_MPDAMAGE: + otherdamage = BATTLE_S_MpDamage( battleindex, attackindex, defindex, damage, skill); + snprintf( szCommand, sizeof( szCommand ), "Bp|a%X|r%X|f%X|d%X|p%X|j%X|FF|", + attackNo, defNo, flg, damage, petdamage, otherdamage); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _SKILL_TOOTH + case BATTLE_COM_S_TOOTHCRUSHE: //ܳ tooth + flg |= BCF_TOOTH; + BATTLE_S_ToothCrushe( battleindex, attackindex, defindex, damage, skill); + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _PSKILL_MDFYATTACK + case BATTLE_COM_S_MDFYATTACK: + flg |= BCF_MODIFY; + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|g%X|FF|", + attackNo, defNo, flg, damage, petdamage, skill); + BATTLESTR_ADD( szCommand ); + break; +#endif +#ifdef _PSKILL_MODIFY + case BATTLE_COM_S_MODIFYATT: + flg |= BCF_ATTDOUBLE; + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|g%X|FF|", + attackNo, defNo, flg, damage, petdamage, skill); + BATTLESTR_ADD( szCommand ); + break; +#endif + +#ifdef _PETSKILL_TIMID + case BATTLE_COM_S_TIMID: + { + int timid = rand()%100; + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + if( timid < 15 && damage > 1 ){//ս + BATTLE_NoAction( battleindex, defNo ); + sprintf( szCommand, "BE|e%X|", defNo ); + BATTLESTR_ADD( szCommand ); + snprintf( szCommand, sizeof( szCommand ), "f%X|", 1); + BATTLESTR_ADD( szCommand ); + + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int defkoyaindex = CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX ); +#ifdef _PETS_SELECTCON + lssproto_PETS_send( getfdFromCharaIndex(defkoyaindex), + CHAR_getInt( defkoyaindex, CHAR_DEFAULTPET), FALSE); + CHAR_setWorkInt( defkoyaindex, + CHAR_WORK_PET0_STAT+CHAR_getInt( defkoyaindex, CHAR_DEFAULTPET), FALSE); +#endif + BATTLE_PetDefaultExit( defkoyaindex, battleindex ); + CHAR_setInt( defkoyaindex, CHAR_DEFAULTPET, -1 ); + + }else { + BATTLE_Exit( defindex, battleindex); + CHAR_DischargePartyNoMsg( defindex);//ɢŶ + } + } + } + break; +#endif +#ifdef _PETSKILL_2TIMID + case BATTLE_COM_S_2TIMID: + { + int timid=0; + char *timidc=NULL; + pszP = PETSKILL_getChar( skill, PETSKILL_OPTION ); + if( ( timidc = strstr( pszP, "%" ) ) != NULL ) + sscanf( timidc+3,"%d", &timid ); + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + if( rand()%100 < timid && damage > 1 ){ + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int defkoyaindex = CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX ); + + snprintf( szCommand, sizeof( szCommand ), "K%d", CHAR_getInt( defkoyaindex, CHAR_DEFAULTPET ) ); + CHAR_sendStatusString( defkoyaindex, szCommand ); + + BATTLE_PetIn( battleindex, defNo-5 ); + lssproto_KS_send( getfdFromCharaIndex( defkoyaindex ), CHAR_getInt( defkoyaindex, CHAR_DEFAULTPET ), 1 ); + + /*BATTLE_NoAction( battleindex, defNo ); + sprintf( szCommand, "BE|e%X|", defNo ); + BATTLESTR_ADD( szCommand ); + snprintf( szCommand, sizeof( szCommand ), "f%X|", 1); + BATTLESTR_ADD( szCommand ); + + BATTLE_PetDefaultExit( defkoyaindex, battleindex ); + CHAR_setInt( defkoyaindex, CHAR_DEFAULTPET, -1 ); + + print("\ndefNo:%d",defNo);*/ + } + } + } + break; +#endif + +#ifdef _PETSKILL_ANTINTER + case BATTLE_COM_S_ANTINTER: + { + pszP = PETSKILL_getChar( skill, PETSKILL_OPTION ); + //flg &= !(BCF_ULTIMATE_1 | BCF_ULTIMATE_2); + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg |= BCF_ANTINTER , 0, 0 ); + BATTLESTR_ADD( szCommand ); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + int defkoyaindex = CHAR_getWorkInt( defindex, CHAR_WORKPLAYERINDEX ); + BATTLE_PetDefaultExit( defkoyaindex, battleindex );//뿪ս + CHAR_setInt( defkoyaindex, CHAR_DEFAULTPET, -1 );//趨޲ս + } + } + break; +#endif + +#ifdef _BATTLE_LIGHTTAKE + case BATTLE_COM_S_LIGHTTAKE: + { + int Typenum = 0; + if( strstr( pszP, "VANISH") != 0 ){ + if( ReactType == BATTLE_MD_VANISH ){ + Typenum = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ); + CHAR_setWorkInt( attackindex, CHAR_WORKDAMAGEVANISH, Typenum); + } + }else if( strstr( pszP, "ABSROB") != 0 ){ + if( ReactType == BATTLE_MD_ABSROB ){ + Typenum = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEABSROB ); + CHAR_setWorkInt( attackindex, CHAR_WORKDAMAGEABSROB, Typenum); + } + }else if( strstr( pszP, "REFLEC") != 0 ){ + if( ReactType == BATTLE_MD_REFLEC ){ + Typenum = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ); + CHAR_setWorkInt( attackindex, CHAR_WORKDAMAGEREFLEC, Typenum); + } + } + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + } + break; +#endif + +#ifdef _SONIC_ATTACK // WON ADD + // ˺ + case BATTLE_COM_S_SONIC: + { + int img2=0; + if( defNo >= 10 ) img2 = 101703; + else img2 = 101704; + + flg |= BCF_B_SKILLACT; //ͼ + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, damage, 0, 0, img2 ); + BATTLESTR_ADD( szCommand ); + + break; + } + // ˺ + case BATTLE_COM_S_SONIC2: + { + sprintf( szCommand, "BD|r%X|0|0|d%X|p%X|", defNo, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + + break; + } +#endif +#ifdef _PETSKILL_REGRET + // ˺ + case BATTLE_COM_S_REGRET: + { + int img2=0,Success=0; + char *psz = NULL; + if( (psz = strstr( pszP, "%" ) ) != NULL ) sscanf( psz+3, "%d", &Success ); + if( (PROFESSION_BATTLE_StatusAttackCheck( attackindex, defindex, 12, Success ) == 0 ) + || (CHAR_getInt( defindex, CHAR_HP ) <= 0 ) ){ + + }else{ + CHAR_setWorkInt( defindex, StatusTbl[12], 2 );//ѣ1غ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + BATTLE_BadStatusString( defNo, 12 ); + } + + if( defNo >= 10 ) img2 = 101418;//101703; + else img2 = 101418;//101704; + + flg |= BCF_B_SKILLACT; //ͼ + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, damage, 0, 0, img2 ); + BATTLESTR_ADD( szCommand ); + break; + } + // ˺ + case BATTLE_COM_S_REGRET2: + { + int Success; + char *psz = NULL; + if( (psz = strstr( pszP, "%" ) ) != NULL ) sscanf( psz+3, "%d", &Success ); + if( (PROFESSION_BATTLE_StatusAttackCheck( attackindex, defindex, 12, Success ) == 0 ) + || (CHAR_getInt( defindex, CHAR_HP ) <= 0 ) ){ + + }else{ + CHAR_setWorkInt( defindex, StatusTbl[12], 2 );//ѣ1غ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + BATTLE_BadStatusString( defNo, 12 ); + } + + sprintf( szCommand, "BD|r%X|0|0|d%X|p%X|", defNo, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + break; + } +#endif + + default: + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", + attackNo, defNo, flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + break; + } + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + return iRet; +} + +#ifdef _MAGIC_SUPERWALL +int PETSKILL_MagicStatusChange_Battle( int battleindex, int attackNo, int toNo, int marray) +{ + char *magicarg; + int status = -1, i, turn = 3, nums=0; + int ReceveEffect, charaindex=-1; + char buf1[256]; + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + if( !CHAR_CHECKINDEX( charaindex)) return FALSE; + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( getStringFromIndexWithDelim( magicarg,"|",1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + for( i=0; i= 20 ) + return FALSE; + } + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + //attackNo = BATTLE_Index2No( battleindex, charaindex ); +/* //ͼž + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; + }else{ + ReceveEffect = SPR_hoshi; + } +*/ + ReceveEffect = SPR_hoshi; + BATTLE_MultiMagicStatusChange( + battleindex, attackNo, toNo, status, + turn, MAGIC_EFFECT_USER, ReceveEffect, nums ); + + return TRUE; +} +#endif + +#ifdef _PETSKILL_SETDUCK +int PETSKILL_SetDuckChange_Battle( int battleindex, int attackNo, int toNo, int marray) +{ + char *skillarg=NULL; + int turn = 3, nums=0; + int charaindex=-1; + char buf1[256]; + + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + if( !CHAR_CHECKINDEX( charaindex)) return FALSE; + if( BATTLE_No2Index( battleindex, toNo ) != charaindex ) return FALSE; + + skillarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( skillarg == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( skillarg,"|",1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + turn = atoi( buf1); + if( getStringFromIndexWithDelim( skillarg,"|",2, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + nums = atoi( buf1); + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + { + int ToList[SIDE_OFFSET*2+1]; + char szBuffer[256]=""; + memset( szBuffer, 0, sizeof( szBuffer)); + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, toNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi ); + if( CHAR_getWorkInt( charaindex, CHAR_MYSKILLDUCK) > 0){ + }else { + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDUCK, turn); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDUCKPOWER, nums ); + sprintf( szBuffer, "BD|r%X|0|3|%X|", toNo, nums); + BATTLESTR_ADD( szBuffer ); + } + } + return TRUE; +} +#endif + +#ifdef _MAGICPET_SKILL +int PETSKILL_SetMagicPet_Battle( int battleindex, int attackNo, int toNo, int marray) +{ + char *skillarg=NULL; + int turn = 3, nums=0; + int charaindex=-1; + char buf1[256]; + + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + if( !CHAR_CHECKINDEX( charaindex)) return FALSE; + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return FALSE; + + skillarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( skillarg == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( skillarg,"|",1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + turn = atoi( buf1); + if( getStringFromIndexWithDelim( skillarg,"|",2, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + nums = atoi( buf1); + if( getStringFromIndexWithDelim( skillarg,"|",3, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + if( strstr( buf1, "HP") != 0 ) { + BATTLE_MultiRecovery( battleindex, attackNo, toNo, + BD_KIND_HP, nums, 0, MAGIC_EFFECT_USER, SPR_heal3 ); + }else{ + int ToList[SIDE_OFFSET*2+1]; + char szBuffer[256]=""; + int todef=0, i; + + memset( szBuffer, 0, sizeof( szBuffer)); + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, toNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi ); + + for( i = 0; ToList[i] != -1; i ++ ){ + int bid; + int toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( !CHAR_CHECKINDEX( toindex ))continue; + + if( CHAR_getWorkInt( toindex, CHAR_MYSKILLDUCK) > 0 || + CHAR_getWorkInt( toindex, CHAR_MYSKILLSTR) > 0 || + CHAR_getWorkInt( toindex, CHAR_MYSKILLTGH) > 0 || + CHAR_getWorkInt( toindex, CHAR_MYSKILLDEX) > 0 ) continue; + + if( strstr( buf1, "STR") != 0 ) { + CHAR_setWorkInt( toindex, CHAR_MYSKILLSTR, turn); + CHAR_setWorkInt( toindex, CHAR_MYSKILLSTRPOWER, nums ); + todef = 4; + }else if( strstr( buf1, "TGH") != 0 ){ + CHAR_setWorkInt( toindex, CHAR_MYSKILLTGH, turn); + CHAR_setWorkInt( toindex, CHAR_MYSKILLTGHPOWER, nums ); + todef = 5; + }else if( strstr( buf1, "DEX") != 0 ){ + CHAR_setWorkInt( toindex, CHAR_MYSKILLDEX, turn); + CHAR_setWorkInt( toindex, CHAR_MYSKILLDEXPOWER, nums ); + todef = 6; + } + bid = BATTLE_Index2No( battleindex, toindex ); + sprintf( szBuffer, "BD|r%X|0|%d|%X|", bid, todef, nums); + BATTLESTR_ADD( szBuffer ); + } + } + return TRUE; +} +#endif + +#ifdef _SKILL_WEAKEN //vincent輼: +int BATTLE_S_Weaken( + int battleindex, + int attackNo, + int defNo, + int marray +) +{ + BOOL iRet = FALSE; + char *magicarg; + int status = -1, i, turn = 3; + int ReceveEffect, Success = 0; + char *pszP; + char szTurn[] = "turn"; + char szSuccess[] = ""; + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return FALSE; + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; + }else{ + ReceveEffect = SPR_hoshi; + } + BATTLE_MultiParamChangeTurn( battleindex, attackNo, defNo, status, + MAGIC_EFFECT_USER, ReceveEffect, turn, Success); + + return iRet; +} +#endif + +#ifdef _PETSKILL_TEMPTATION +BOOL BATTLE_S_Temptation( int battleindex,int attackNo,int defNo, int skill ) +{ + BOOL iRet = FALSE; + char *magicarg; + char szWork[256]; + int attackindex,defindex,defside,flg=0,img2,img1; + int target; + + magicarg = PETSKILL_getChar( skill , PETSKILL_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return iRet; + } + attackindex = BATTLE_No2Index( battleindex, attackNo ); + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE )return iRet; + if( CHAR_CHECKINDEX( defindex ) == FALSE )return iRet; + if( CHAR_getInt( defindex, CHAR_WHICHTYPE) != CHAR_TYPEPET ) return iRet; + if( CHAR_getWorkInt( defindex , CHAR_WORKFIXAI ) <= atoi(magicarg)){ + //ܹ + CHAR_setWorkInt( defindex, CHAR_WORKTEMPTATION , 1 ); //Լ1Ѫ + defside = CHAR_getWorkInt( defindex, CHAR_WORKBATTLESIDE); + target = CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM2 ); + + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_ATTACK ){ + CHAR_setWorkInt( defindex , CHAR_WORKBATTLECOM2, + BATTLE_DefaultAttacker(battleindex,defside)); + }else{ + CHAR_setWorkInt( defindex , CHAR_WORKBATTLECOM2, + BATTLE_DefaultAttacker(battleindex,defside)); + } + img1 = 101505; //鶯101637; //׼ڶ + img2 = 101502; //鶯101645; //ᶯ + flg |= BCF_NO_DAMAGE; + flg |= BCF_B_SKILLACT; //ͼ + snprintf( szWork, sizeof( szWork ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, 0, 0, 1 , img1 , img2 ); + BATTLESTR_ADD( szWork ); + iRet = TRUE; + } + return iRet; + +} +#endif + +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 +int BATTLE_S_Deeppoison( int battleindex, int attackNo, int defNo, int marray ) +{ + BOOL iRet = FALSE; + char *magicarg; + int status = -1, i, turn = 3; + int ReceveEffect, Success = 0; + char *pszP; + char szTurn[] = "turn"; + char szSuccess[] = ""; + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return FALSE; + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; + }else{ + ReceveEffect = SPR_hoshi; + } + + BATTLE_MultiStatusChange( battleindex, attackNo, defNo, + status, turn+2, MAGIC_EFFECT_USER, ReceveEffect, Success ); + + return iRet; +} +#endif + +#ifdef _SKILL_BARRIER //vincent輼:ħ +int BATTLE_S_Barrier( + int battleindex, + int attackNo, + int defNo , + int marray +) +{ + BOOL iRet = FALSE; + int battlemode; + int i,turn,perStatus,charaindex,toindex; + int ToList[SIDE_OFFSET*2+1]; + char *magicarg; + int Success = 0; + char szTurn[] = "turn"; + char szSuccess[] = ""; + char *pszP; + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + //check index + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + + pszP = magicarg; + + //ȡûغ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + // + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + BATTLE_MultiList( battleindex, defNo, ToList ); + + //ʩħЧ + BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi); + + //checkǷս + if( IsBATTLING( charaindex ) == TRUE ) + { + + for( i = 0; ToList[i] != -1; i ++ ) + { + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_BARRIER, Success, 30, 1.0, &perStatus ) == TRUE ) + { + CHAR_setWorkInt( toindex, CHAR_WORKBARRIER, turn+1); + } + } + + } + return iRet; +} +#endif + +#ifdef _SKILL_NOCAST //vincent輼:Ĭ +int BATTLE_S_Nocast( + int battleindex, + int attackNo, + int defNo , + int marray +) +{ + BOOL iRet = FALSE; + int battlemode; + int i,turn,perStatus,charaindex,toindex; + int ToList[SIDE_OFFSET*2+1]; + char *magicarg; + int Success = 0; + char szTurn[] = "turn"; + char szSuccess[] = ""; + char *pszP; + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + //check index + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + magicarg = PETSKILL_getChar( marray, PETSKILL_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + + pszP = magicarg; + + //ȡûغ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + // + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + BATTLE_MultiList( battleindex, defNo, ToList ); + + //ʩħЧ + BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi); + + //checkǷս + if( IsBATTLING( charaindex ) == TRUE ){ + + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_NOCAST, Success, 30, 1.0, &perStatus ) == TRUE + && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET){ + //޷չҳ + lssproto_NC_send( getfdFromCharaIndex( toindex ), 1); + CHAR_setWorkInt( toindex, CHAR_WORKNOCAST, turn ); + BATTLE_BadStatusString( ToList[i], BATTLE_ST_NOCAST ); + } + } + + } + return iRet; +} +#endif + +int BATTLE_getReactFlg( int index, int react) +{ + int flg=0; + if( react == BATTLE_MD_ABSROB )flg |= BCF_ABSORB; + if( react == BATTLE_MD_REFLEC )flg |= BCF_REFRECT; + if( react == BATTLE_MD_VANISH )flg |= BCF_VANISH; +#ifdef _MAGIC_SUPERWALL + if( CHAR_getWorkInt( index, CHAR_MAGICSUPERWALL ) > 0 ){ + flg |= BCF_SUPERWALL; + } +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( react == BATTLE_MD_TRAP ) flg |= BCF_TRAP; +#endif +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) flg |= BCF_ACUPUNCTURE; +#endif + return flg; +} + +#ifdef _PREVENT_TEAMATTACK +int BATTLE_CheckSameSide( int charaindex, int toNo) +{ + int ToList[SIDE_OFFSET*2+1]; + int toindex, i, battleindex; + int MySide; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + MySide = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE); + +//toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( toNo < 20 ){//һĿ + toindex = BATTLE_No2Index( battleindex, toNo); + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE) == MySide ) return 1;//ͬ + }else if( toNo){ + + BATTLE_MultiList( battleindex, toNo, ToList ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( !CHAR_CHECKINDEX( toindex) ) continue; + + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLESIDE) == MySide ) return 1;//ͬ + } + } + return 0; +} +#endif + + +#ifdef _USER_CHARLOOPS +int CHAR_BattleStayLoop( int charaindex) +{ +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charaindex, CHAR_WORK_OFFLINE ) == 1){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE){ + CHAR_setWorkChar( charaindex, CHAR_WORKWALKARRAY,""); + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, getOfflineBattleTime()); + BATTLE_CreateVsEnemy( charaindex,0, -1); + } + return 1; + } +#endif + int fd = getfdFromCharaIndex( charaindex); + if( getStayEncount( fd) ) { + if( CONNECT_getBDTime( fd) < time( NULL) ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE){ + if(getNoStayBattle()==1){ + CHAR_talkToCli(charaindex, -1, "Ϊҵ·ԭ쳣뵽·ԡ", CHAR_COLORYELLOW); + } + lssproto_EN_recv( fd, CHAR_getInt( charaindex,CHAR_X), CHAR_getInt( charaindex,CHAR_Y)); + CONNECT_setBDTime( fd, (int)time( NULL)); + } + } + }else{ + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return 0; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 0); + CHAR_constructFunctable( charaindex); + } + + return 1; +} +#endif + +#ifdef _PETSKILL_PROPERTY +int PET_PetskillPropertyEvent( int Myindex, int defindex, int *damage, int *T_Pow, int size) +{ + int My_Pow[5]={0,0,0,0,0}; + int i, totals=100; + if( !CHAR_CHECKINDEX( Myindex)) return 0; + if( !CHAR_CHECKINDEX( defindex)) return 0; + BATTLE_GetAttr( defindex, My_Pow); + + //ת + for( i=0; i<4; i++) { + int nums = (i+3)%4; + if( My_Pow[i] != 0 ){ + T_Pow[ nums] = My_Pow[i]; + totals -= My_Pow[i]; + }else{ + T_Pow[ nums] = 0; + } + } + T_Pow[ 4] = totals; + return 1; +} +#endif + + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + +// ֱӹʽ +int battle_profession_attack_fun(int battleindex, int attackNo, int defNo, int charaindex) +{ + char szBuffer[512]=""; + char szCommand[1024]; + int attackindex, defindex=-1; + int damage=0, petdamage=0, i=0, iWork, Guardian=-1,react; + int flg = 0, DefSide=0,ultimate=0; + BOOL iRet = FALSE; + int ReactType=0, skill_type=-1, skill=-1; + char *pszP = NULL; + char *pszOption = NULL; + int effect=0, img1=0, img2=0, atk_num=0, skill_level; + + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + skill_type=CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + //index + attackindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE ) return iRet; + + //طindex + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( defindex ) == FALSE ){ + return iRet; + } + + // Ӷ + if( (CHAR_getInt( defindex, CHAR_HP ) <= 0) && (skill_type != BATTLE_COM_S_PLUNDER) ){ + return iRet; + } + + // սʹü + if( !PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_USE_FLAG) ) return iRet; + + // ȡüܲ + pszOption = PROFESSION_SKILL_getChar( skill, PROFESSION_SKILL_OPTION); + if( pszOption == "\0" ) return iRet; + + // ܵȼ + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + // ʽ 0ԭ㶯 1ƶ㶯 + if( (pszP = strstr( pszOption, "Ч%" ) ) != NULL ) sscanf( pszP+3, "%d", &effect ); + + // ׼ڵĶ + img1 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_1 ); + + // Ķ + img2 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_2 ); + + // Ŀһܣ + if( defNo >= 0 && defNo <= 19 ){ + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + return iRet; + } + } + + // ȡܲ + switch( skill_type){ + case BATTLE_COM_S_BRUST: // + { + int str=0, old_str=0; + + // ӹ + old_str = CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR); + str = old_str * ( skill_level * 3 + 100 ) / 100; + + CHAR_setWorkInt( charaindex, CHAR_WORKFIXSTR, str ); + + break; + } + case BATTLE_COM_S_CHAOS: // ҹ + { + int atk = 0; + // 30% + atk = CHAR_getWorkInt( charaindex, CHAR_WORKATTACKPOWER ); + atk = atk * 70 / 100; + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, atk ); + + if( skill_level >= 10 ) atk_num = 5; + else if( skill_level >= 5 ) atk_num = 4; + else atk_num = 3; + + break; + } + case BATTLE_COM_S_CHAIN_ATK: // + { + int rand_num = RAND(1, 100); + int hit; + + if( skill_level % 10 != 0 ) + skill_level += 1; + hit = skill_level * 5 + 15; + + if( rand_num <= hit ) + atk_num=2; // + else + atk_num=0; + + break; + } + case BATTLE_COM_S_ENRAGE_PET: // ŭ + { + // жǷͬ + if( BATTLE_CheckSameSide( charaindex, defNo) != 1 ) return iRet; + + defNo = attackNo; + + // 1 + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, 0 ); + + break; + } + case BATTLE_COM_S_CHAIN_ATK_2: // ˫ع + { + int atkpower = 0; + int absrob_num = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEABSROB ); // + //int reflec_num = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ); // + int evanish_num = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ); // + int trap_num = CHAR_getWorkInt( defindex, CHAR_WORKTRAP ); // + + if( absrob_num > 0 ) CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEABSROB, max(absrob_num - 1, 0) ); + //if( reflec_num > 0 ) CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max(reflec_num - 1, 0) );//þЧ,Ҫõ + if( evanish_num > 0 ) CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEVANISH, max(evanish_num - 1, 0) ); + if( trap_num > 0 ) CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + + // һ¹ 0 + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, 0 ); + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|", + attackNo, defNo, BCF_NO_DAMAGE, 0, 0, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + + // ӹ + atkpower =(int)( CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR) * (skill_level * 2 + 100) /100 ); + + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, atkpower ); + + if( (CHAR_getInt( charaindex, CHAR_HP ) > 0 ) && + (CHAR_getInt( defindex, CHAR_HP ) > 0 ) ){ + BATTLE_Attack( battleindex, attackNo, defNo ); + } + + snprintf( szCommand, sizeof( szCommand ), "FF|"); + BATTLESTR_ADD( szCommand ); + + return iRet; + } + case BATTLE_COM_S_DEAD_ATTACK: // + { + int hit=0, hp=0, old_hp=0, rate=0; + + rate = skill_level * 2 + 10 ; + old_hp = CHAR_getInt(charaindex, CHAR_HP); + hp = old_hp * rate / 100; + + if( old_hp <= 10 ){ + CHAR_talkToCli( charaindex, -1, "HP㣬޷ʹü", CHAR_COLORYELLOW); + return iRet; + } + + hit = skill_level * 2 + 80; + + CHAR_setWorkInt(charaindex,CHAR_WORKHITRIGHT, CHAR_getWorkInt(charaindex,CHAR_WORKHITRIGHT) + hit ); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT, 1); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT_NUM, hit); + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + + sprintf( szCommand, "BD|r%X|0|1|%X|", attackNo, (-1) * (old_hp - hp) ); + BATTLESTR_ADD( szCommand ); + + CHAR_setInt(charaindex, CHAR_HP, hp); + break; + } + case BATTLE_COM_S_ATTACK_WEAK: // 㹥 + { + float str=0.0, dex=0.0; + int whichtype; + + whichtype = CHAR_getInt( defindex, CHAR_WHICHTYPE); + + // ĿΪʱ + if( (whichtype == CHAR_TYPEPET) || (whichtype == CHAR_TYPEENEMY) ){ + str = skill_level * 2 +10 + 100; + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, CHAR_getWorkInt(charaindex,CHAR_WORKATTACKPOWER) * (str/100) ); + } + + // + dex = 100 - ( skill_level + 10 ); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK, CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX) * (dex/100) ); + sprintf( szCommand, "BD|r%X|0|6|%X|", attackNo, (-1) * (skill_level + 10) ); + BATTLESTR_ADD( szCommand ); + + break; + } + case BATTLE_COM_S_PLUNDER: // Ӷ + { + char pBidList[BATTLE_ENTRY_MAX*2+1]; + int item, start = 0; + memset( pBidList, -1, sizeof(pBidList) ); + pBidList[0] = defNo; + + // ӶĿ + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_getInt( defindex, CHAR_WHICHTYPE) != CHAR_TYPEENEMY ) return 1; + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, 0, 0, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + + if( defNo < 10 ) start = 0; + else start = 10; + + for( i = start; i < start+10; i++ ){ + for(item=CHAR_STARTITEMARRAY; item < CHAR_STARTITEMARRAY+10; item++){ + int enemy_index = -1; + int itemindex = -1; + + enemy_index = BATTLE_No2Index( battleindex, i ); + if( !CHAR_CHECKINDEX(enemy_index) ) break; + + itemindex = CHAR_getItemIndex( enemy_index, item ); + + if(ITEM_CHECKINDEX( itemindex ) == TRUE ){ + char msg[64], *item_name; + + CHAR_AddPileItem( charaindex, itemindex); + + item_name = ITEM_getChar( itemindex, ITEM_NAME); + + sprintf( msg, "õ%s", item_name ); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + + CHAR_setItemIndex( enemy_index, item, -1 ); + + BATTLE_Exit( defindex, battleindex ); + + return 1; + } + } + } + + BATTLE_Exit( defindex, battleindex ); + + return 1; + } + default: + break; + } + + + react = 0; + if( (ReactType=BATTLE_GetDamageReact( defindex)) > 0 ) { //й⾵ + react = ReactType; + if( skill_type != BATTLE_COM_S_CHAIN_ATK ){ + react=0; +// skill_type=-1; + } + } + + + if( defNo >= SIDE_OFFSET ){ + i = defNo - SIDE_OFFSET; + DefSide = 1; + } + + //ȡù״̬ + iWork = BATTLE_AttackSeq( attackindex, defindex, &damage, &Guardian, skill_type ); + if( skill_type == BATTLE_COM_S_ENRAGE_PET ){//üŭ\ܲҪĴ + if( CHAR_getInt( defindex, CHAR_HP ) <= damage ){ + damage = 0; + } + } + if( skill_type == BATTLE_COM_S_CAVALRY) // ﹥ + ultimate = BATTLE_PROFESSION_ATK_PET_DamageSub( attackindex, defindex, &damage, &petdamage, &react, skill_level ); + else + ultimate = BATTLE_DamageSub( attackindex, defindex, &damage, &petdamage, &react); + + if( react == BATTLE_MD_REFLEC ) defindex = attackindex; + if( react == BATTLE_MD_TRAP ) defindex = attackindex; +#ifdef _PETSKILL_ACUPUNCTURE + if( react == BATTLE_MD_ACUPUNCTURE ) defindex = attackindex; +#endif + if( damage > 0 && ( react != BATTLE_MD_ABSROB )&& ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + iRet = BATTLE_DefineAttack( attackindex, defindex, iWork, szBuffer, damage, react, &flg); + + // NORMAL CRITICAL flg ij ְҵflg + if( img2 != 0 ){ + if( flg == BCF_NORMAL || flg == BCF_KAISHIN ){ + if( (pszP = strstr( pszOption, "ǰ" ) ) != NULL ) + flg |= BCF_F_SKILLACT; //ǰͼ + else + flg |= BCF_B_SKILLACT; // + } + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ){ + iRet = BATTLE_DefDieType( defindex, iRet, &ultimate, &flg, szBuffer); + } + + if( damage > 0 ){ + if( BATTLE_ItemCrushSeq( attackindex, defindex, damage) == TRUE ) + flg |= BCF_CRUSH; + } + + + memset( szCommand, 0, sizeof( szCommand)); + switch( skill_type){ + case BATTLE_COM_S_BRUST: // + case BATTLE_COM_S_DEAD_ATTACK: // + case BATTLE_COM_S_ATTACK_WEAK: // 㹥 + case BATTLE_COM_S_CAVALRY: // ﹥ + { + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, damage, petdamage, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + break; + } + case BATTLE_COM_S_ENRAGE_PET: // ŭ + { + int str = 0; + int turn = 0; + int pindex = -1; + + + flg |= BCF_NO_DAMAGE; + flg |= BCF_B_SKILLACT; //ͼ + + defNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + + pindex = BATTLE_No2Index( battleindex, defNo ); + + // ǷΪ + if( CHAR_getInt( pindex, CHAR_WHICHTYPE) != CHAR_TYPEPET ) break; + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|FF|", + attackNo, defNo, flg, 0, 0, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + + // ӹ + str = skill_level * 2 + 10; + sprintf( szCommand, "BD|r%X|0|4|%X|", defNo, str); + BATTLESTR_ADD( szCommand ); + CHAR_setWorkInt( pindex, CHAR_MYSKILLSTRPOWER, str); + + if( skill_level >= 10 ) turn=5; + else if( skill_level >= 5 ) turn=4; + else turn=3; + + CHAR_setWorkInt( pindex, CHAR_MYSKILLSTR, turn ); + + break; + } + case BATTLE_COM_S_CHAOS: // ҹ + { + int i=0, j=0, k=0, f_num=0; + int temp[10], chose_temp[10]; + int defNo_index = BATTLE_No2Index( battleindex, defNo ); + + memset( temp, -1, sizeof( temp ) ); + memset( chose_temp, -1, sizeof( chose_temp ) ); + + if( CHAR_getWorkInt( defNo_index, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + break; + } + + if( defNo >= 10 ) f_num = 10; + else f_num = 0; + + // 30% + //CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKATTACKPOWER ) * 70 / 100 ); + + //clientЧ + sprintf( szCommand, "BD|r%X|0|4|%X|", attackNo, -30 ); + BATTLESTR_ADD( szCommand ); + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|", + attackNo, defNo, flg, damage, petdamage, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + + // ȡսϴ + for( i=f_num; i 0 ){ + int atk_to_index = -1; + atk_to_index = BATTLE_No2Index( battleindex, chose_temp[k] ); + + if( ( atk_to_index >= 0 ) && + ( BATTLE_TargetCheck(battleindex, chose_temp[k] ) != FALSE ) && + ( CHAR_getWorkInt( atk_to_index, CHAR_WORKBATTLECOM1 ) != BATTLE_COM_S_EARTHROUND0 ) + ){ + BATTLE_Attack( battleindex, attackNo, chose_temp[k] ); + k++; + atk_num --; + }else{ + + memset( temp, -1, sizeof( temp ) ); + memset( chose_temp, -1, sizeof( chose_temp ) ); + j = 0; k = 0; + + // ȡսϴ + for( i=f_num; i 0 ) && + (CHAR_getInt( defindex, CHAR_HP ) > 0 ) ){ + BATTLE_Attack( battleindex, attackNo, defNo ); + } + + snprintf( szCommand, sizeof( szCommand ), "FF|"); + BATTLESTR_ADD( szCommand ); + + break; + } + } + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + i = defNo-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + return iRet; +} + + +// ħʽ +int battle_profession_attack_magic_fun(int battleindex, int attackNo, int defNo, int charaindex) +{ + int attr=-1, attIdx=0, skill=-1, toindex; + + // ȡID + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + + // Ŀ + // Robin fix + //toindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ); + toindex = defNo; + + + // Χ 0 1 2һȫ + if( toindex < 20 ){ // + attIdx = 0; + }else if( toindex>=23 && toindex<=26 ){ // + attIdx = 1; + }else if( toindex==20 || toindex==21 ){ // һȫ + attIdx = 2; + } + + // Robin fix ս + attr = BattleArray[battleindex].field_att -1; + + PROFESSION_MAGIC_ATTAIC( battleindex, attackNo, toindex, attIdx, attr, skill); + + return TRUE; +} + +// ϵʽ +int battle_profession_assist_fun(int battleindex, int attackNo, int defNo, int charaindex) +{ + int i, skill, skill_type, skill_level, img1, img2, turn=1; + char *pszP = NULL, *pszOption = NULL, szCommand[256]; + BOOL iRet = FALSE; + int ToList[SIDE_OFFSET*2+1]; + + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3); + skill_type = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + // սʹü + if( !PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_USE_FLAG) ) return iRet; + + // ܵIJ + pszOption = PROFESSION_SKILL_getChar( skill, PROFESSION_SKILL_OPTION); + if( pszOption == "\0" ) return iRet; + + // ܵȼ + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + + // ׼ڵĶ + img1 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_1 ); + + // Ķ + img2 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_2 ); + + // ʹûغ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &turn ); + if(turn < 1) turn=1; + + switch(skill_type){ + case BATTLE_COM_S_TRANSPOSE: // λλ + { + int defNo2 = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo2, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + for( i = 0; ToList[i] != -1; i ++ ){ + int avoid=0; + int toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( !CHAR_CHECKINDEX( toindex ))continue; + if( charaindex != toindex ) continue; + + // ر + if( skill_level >= 10 ) avoid = 70; + else if( skill_level >= 9 ) avoid = 60; + else if( skill_level >= 8 ) avoid = 50; + else if( skill_level >= 6 ) avoid = 45; + else if( skill_level >= 5 ) avoid = 30; + else if( skill_level >= 3 ) avoid = 25; + else avoid = 10; + + if( skill_level >= 10 ) turn = 5; + else if( skill_level >= 6 ) turn = 4; + else turn = 3; + + if( CHAR_getWorkInt( toindex, CHAR_MYSKILLDUCK) <= 0){ + CHAR_setWorkInt( toindex, CHAR_MYSKILLDUCK, turn+1); + CHAR_setWorkInt( toindex, CHAR_MYSKILLDUCKPOWER, avoid ); + sprintf( szCommand, "BD|r%X|0|3|%X|", ToList[i], avoid); + BATTLESTR_ADD( szCommand ); + iRet = TRUE; + } + } + break; + } + case BATTLE_COM_S_SCAPEGOAT: // Ϊ + { + int tgh=0, old_tgh=0, flg=0, rate=0; + int pos=0, side=0, ownerpos=0; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + pos = BATTLE_Index2No( battleindex, charaindex ); + side = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + + if( skill_level >= 10 ){ // ҷȫ + for(i=0; i<10; i++){ + if(pos != i ) + BattleArray[battleindex].Side[side].Entry[i].guardian = pos; + } + }else if( skill_level >= 5 ){ // ҷг + for(i=5; i<10; i++){ + if(pos != i ) + BattleArray[battleindex].Side[side].Entry[i].guardian = pos; + } + }else{ // ֮ + ownerpos = pos + 5; + if( ownerpos >= 10 ) ownerpos -= 10; + if( ownerpos < 0 || ownerpos > 19 ){ + }else{ + BattleArray[battleindex].Side[side].Entry[ownerpos].guardian = pos; + } + } + + rate = skill_level * 2; + + tgh = 30 - rate; + sprintf( szCommand, "BD|r%X|0|5|%X|", attackNo, (-1) * tgh ); + BATTLESTR_ADD( szCommand ); + + old_tgh = CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + tgh = (int)( old_tgh * (100-tgh) / 100 ); + CHAR_setWorkInt( charaindex, CHAR_WORKFIXTOUGH, tgh); + + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); + flg |= CHAR_BATTLEFLG_GUARDIAN; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + + iRet = TRUE; + + break; + } + case BATTLE_COM_S_ENRAGE: // + { + int str=0, tgh=0; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, attackNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + // + tgh = skill_level * 2 + 10; + sprintf( szCommand, "BD|r%X|0|5|%X|", attackNo, (-1) * tgh ); + BATTLESTR_ADD( szCommand ); + + CHAR_setWorkInt(charaindex,CHAR_MYSKILLTGHPOWER, (-1) * tgh); + + // ӹ + str = skill_level * 2 + 20; + sprintf( szCommand, "BD|r%X|0|4|%X|", attackNo, str); + BATTLESTR_ADD( szCommand ); + + CHAR_setWorkInt( charaindex, CHAR_MYSKILLSTRPOWER, str); + + if( skill_level >= 10 ) turn=5; + else if( skill_level >= 5 ) turn=4; + else turn=3; + + CHAR_setWorkInt( charaindex, CHAR_MYSKILLSTR, turn ); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLTGH, turn ); + + iRet = TRUE; + break; + } + case BATTLE_COM_S_COLLECT: // ۼ + { + int dex=0, tgh=0; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, attackNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + // + dex = (skill_level * 2) + 10; + sprintf( szCommand, "BD|r%X|0|6|%X|", attackNo, (-1) * dex ); + BATTLESTR_ADD( szCommand ); + CHAR_setWorkInt(charaindex,CHAR_MYSKILLDEXPOWER, dex); + + // ӷ + tgh = (skill_level * 2) + 20; + sprintf( szCommand, "BD|r%X|0|5|%X|", attackNo, tgh); + BATTLESTR_ADD( szCommand ); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLTGHPOWER, tgh); + + if( skill_level >= 10 ) turn=5; + else if( skill_level >= 5 ) turn=4; + else turn=3; + + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDEX, turn ); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLTGH, turn ); + + iRet = TRUE; + break; + } + case BATTLE_COM_S_FOCUS: // רעս + { + int ToList[SIDE_OFFSET*2+1]; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, attackNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT, 2); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLHIT_NUM, 100); + + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + + iRet = TRUE; + break; + } + case BATTLE_COM_S_TRAP: // + { + int value; + int ToList[SIDE_OFFSET*2+1]; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + memset( ToList, -1, sizeof(ToList) ); + ToList[0] = attackNo; + + value = skill_level * 30 + 100; + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + if( skill_level >= 10 ) turn=3; + else if( skill_level >= 5 ) turn=2; + else turn=1; + + CHAR_setWorkInt( charaindex, CHAR_WORKTRAP, turn); + CHAR_setWorkInt( charaindex, CHAR_WORKMODTRAP, value); + + iRet = TRUE; + break; + } + case BATTLE_COM_S_DOCILE: // ѱ + { + int rate = 0; + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + rate = skill_level * 2 + 10; + + BATTLE_MultiCaptureUp( battleindex, attackNo, defNo, rate, img1, img2 ); + + iRet = TRUE; + break; + } +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_CALL_NATURE: // Ȼ + { + int ridepet=0,count=0,addhp=0,toindex=-1; + int ToList[SIDE_OFFSET*2+1]; + BATTLE_MultiList( battleindex, defNo, ToList ); + + if( defNo == 20 || defNo == 25 || defNo == 26 )//ҷ + img1 = 101772; + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( CHAR_CHECKINDEX( toindex ) == FALSE ) continue; + ridepet = BATTLE_getRidePet( toindex ); + if( ridepet == -1 ) + ++count; + else + count += 2; + } + if( skill_level >= 100 ) addhp = 5000/count; + else if( skill_level > 95 ) addhp = 4500/count; + else if( skill_level > 90 ) addhp = 4000/count; + else if( skill_level > 85 ) addhp = 3500/count; + else if( skill_level > 80 ) addhp = 3000/count; + else if( skill_level > 60 ) addhp = 2500/count; + else if( skill_level > 40 ) addhp = 2000/count; + else if( skill_level > 20 ) addhp = 1000/count; + else addhp = 500/count; + if( addhp <= 100 ) + img2 = SPR_heal; + else if( addhp <= 300 ) + img2 = SPR_heal2; + else + img2 = SPR_heal3; + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( CHAR_CHECKINDEX( toindex ) == FALSE ) continue; + ridepet = BATTLE_getRidePet( toindex ); + if( ridepet == -1 ){ + CHAR_setInt( toindex, CHAR_HP, + min( addhp+CHAR_getInt( toindex, CHAR_HP ), CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + } + else{ + CHAR_setInt( toindex, CHAR_HP, + min( addhp+CHAR_getInt( toindex, CHAR_HP ), CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + CHAR_setInt( ridepet, CHAR_HP, + min( addhp+CHAR_getInt( ridepet, CHAR_HP ), CHAR_getWorkInt( ridepet, CHAR_WORKMAXHP ) ) ); + } + snprintf( szCommand, sizeof(szCommand),"BD|r%X|%X|%X|d%X|p%X|", ToList[i], BD_KIND_HP, 1, addhp, ridepet?addhp:0 ); + BATTLESTR_ADD( szCommand ); + + + if( BattleArray[battleindex].norisk == 0 + && CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET) + { + int flg = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEFLG ); + if( flg & CHAR_BATTLEFLG_RECOVERY ) + {} + else + { + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRECOVERY ); + CHAR_setWorkInt( toindex, CHAR_WORKBATTLEFLG, flg | CHAR_BATTLEFLG_RECOVERY ); + } + } + } + + iRet = TRUE; + break; + } +#endif + default: + break; + } + + + return iRet; +} + +#ifdef _PROFESSION_ADDSKILL +extern unsigned int GET_PROFESSION_magic_array(int idx); +#endif + +// иı״̬ϵʽ +extern void BATTLE_TargetListSet( int charaindex, int attackNo, int *pList); +extern int BoomerangVsTbl[4][5]; +int battle_profession_status_chang_fun(int battleindex, int attackNo, int defNo, int charaindex) +{ + int i, skill, skill_type, skill_level, img1=0, img2=0, turn=1, j; + char *pszP = NULL, *pszOption = NULL, szCommand[512]; + float rate=0.0; + BOOL iRet = FALSE; + int defindex; + int damage=0, petdamage=0, iWork, Guardian=-1,react; + int flg=0, DefSide=0,ultimate=0; + int ReactType=0, effect=0; + + skill = CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ); + skill_type=CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1 ); + + // սʹü + if( !PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_USE_FLAG) ) return iRet; + + // ܵIJ + pszOption = PROFESSION_SKILL_getChar( skill, PROFESSION_SKILL_OPTION); + if( pszOption == "\0" ) return iRet; + + // ܵȼ + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + // ܵȼ rate + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%f", &rate ); + + // ׼ڵĶ + img1 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_1 ); + + // Ķ + img2 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_2 ); + + // ʹûغ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &turn ); + if(turn < 1) turn=1; + + // ʽ 0ԭ㶯 1ƶ㶯 + if( (pszP = strstr( pszOption, "Ч%" ) ) != NULL ) sscanf( pszP+3, "%d", &effect ); + + // Ŀһܣ + if( defNo >= 0 && defNo <= 19 ){ + defindex = BATTLE_No2Index( battleindex, defNo ); + if( CHAR_CHECKINDEX( defindex ) == FALSE ) return iRet; + if( CHAR_getWorkInt( defindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + return iRet; // Miss + } + } + + switch(skill_type){ + // ƶ + case BATTLE_COM_S_ENTWINE: // + case BATTLE_COM_S_DRAGNET: // ޵ + case BATTLE_COM_S_INSTIGATE: // + case BATTLE_COM_S_OBLIVION: // + case BATTLE_COM_S_RESIST_FIRE: // + case BATTLE_COM_S_RESIST_ICE: // + case BATTLE_COM_S_RESIST_THUNDER: // ׿ +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_RESIST_F_I_T: // Ȼ +#endif + case BATTLE_COM_S_FIRE_ENCLOSE: // + case BATTLE_COM_S_ICE_ENCLOSE: // + case BATTLE_COM_S_THUNDER_ENCLOSE: // ׸ + { + int perStatus=0, toindex=-1, status=-1, Success=0, dex=0, old_dex; + //char szBuffer[256]=""; + int ToList[SIDE_OFFSET*2+1]; + int defNo2 = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + + // ʹö + if( skill_type == BATTLE_COM_S_RESIST_FIRE || // + skill_type == BATTLE_COM_S_RESIST_ICE || // + skill_type == BATTLE_COM_S_RESIST_THUNDER // ׿ +#ifdef _PROFESSION_ADDSKILL + || skill_type == BATTLE_COM_S_RESIST_F_I_T // Ȼ +#endif + ){ +#ifdef _PROFESSION_ADDSKILL + defNo2 = BATTLE_Index2No( battleindex, charaindex ); +#else + if( defNo2 < 10 ){ + if( skill_level >= 10 ) defNo2 = 20; + else if( skill_level >= 5 ) defNo2 = 25; + }else{ + if( skill_level >= 10 ) defNo2 = 21; + else if( skill_level >= 5 ) defNo2 = 24; + } +#endif + } + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo2, ToList ); + + BATTLE_MagicEffect( battleindex, attackNo, ToList, img1, img2 ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return iRet; + + // ı״̬ + if( ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) || + ((pszP = strstr( pszOption, "" ) ) != NULL ) +#ifdef _PROFESSION_ADDSKILL + || ((pszP = strstr( pszOption, "" ) ) != NULL ) +#endif + ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + break; + } + } + } +#ifdef _BATTLE_NO_WANG + if(CHAR_getInt( defindex, CHAR_PETID) == 1165 || CHAR_getInt( defindex, CHAR_PETID) == 1166 || CHAR_getInt( defindex, CHAR_PETID) == 964) + { + Success = 0; + } + else + { +#endif + // ɹ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &Success ); + Success = Success + skill_level * 5; +#ifdef _BATTLE_NO_WANG + } +#endif + if( skill_type == BATTLE_COM_S_DRAGNET ){ + int DRAGNET=0,dragnet_idx=-1; + int PLAYER=0; + //ҳһߵ + if( attackNo > 9 ){// + for(i=0;i<10;i++){//ұж + dragnet_idx = BATTLE_No2Index( battleindex, i ); + if( CHAR_CHECKINDEX( dragnet_idx ) ){ + PLAYER++; + if( CHAR_getWorkInt( dragnet_idx, CHAR_WORKDRAGNET ) > 0 ) { + ++DRAGNET; + } + } + } + } + else{// + for(i=10;i<20;i++){//ж + dragnet_idx = BATTLE_No2Index( battleindex, i ); + if( CHAR_CHECKINDEX( dragnet_idx ) ){ + PLAYER++; + if( CHAR_getWorkInt( BATTLE_No2Index( battleindex, i ), CHAR_WORKDRAGNET ) > 0 ) { + ++DRAGNET; + } + } + } + } + Success *= (float)((PLAYER-DRAGNET)/10.0); +// if( DRAGNET == 1 ){ +// Success *= 0.64; +// }else if( DRAGNET > 1 ){ +// Success *= 0.4; +// } + } + + perStatus = Success; + + // غ + if( (skill_type == BATTLE_COM_S_INSTIGATE) && (skill_level == 10) ){ // + turn = 4; + }else if( (skill_type == BATTLE_COM_S_RESIST_FIRE) || // + (skill_type == BATTLE_COM_S_RESIST_ICE) || // + (skill_type == BATTLE_COM_S_RESIST_THUNDER) ){ // ׿ + + if( skill_level >= 10 ) turn = 5; + else if( skill_level >= 5 ) turn = 4; + else turn = 3; + }else if( skill_type == BATTLE_COM_S_OBLIVION ){ // + if( skill_level >= 10 ){ turn = 4; + }else if( skill_level >= 5 ){ turn = 3; + }else{ turn = 2; } + } +#ifdef _PROFESSION_ADDSKILL + else if( skill_type == BATTLE_COM_S_RESIST_F_I_T ){ // Ȼ + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + if( skill_level >= 100 ) turn = 5; + else if( skill_level > 80 ) turn = 4; + else turn = 3; + } +#endif + + switch( skill_type ){ + case BATTLE_COM_S_RESIST_FIRE: + CHAR_talkToCli( charaindex, -1 , "" , CHAR_COLORYELLOW ); break; + case BATTLE_COM_S_RESIST_ICE: + CHAR_talkToCli( charaindex, -1 , "" , CHAR_COLORYELLOW ); break; + case BATTLE_COM_S_RESIST_THUNDER: + CHAR_talkToCli( charaindex, -1 , "׿" , CHAR_COLORYELLOW ); break; +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_RESIST_F_I_T: + CHAR_talkToCli( charaindex, -1 , "׿" , CHAR_COLORYELLOW ); break; +#endif + } + + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( CHAR_CHECKINDEX( toindex ) == FALSE ) return iRet; + + // ʩ + if( skill_type == BATTLE_COM_S_INSTIGATE ){ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + CHAR_talkToCli( charaindex, -1, "ʩ", CHAR_COLORYELLOW ); + break; + } + } + + // ״̬м춨 + if( (PROFESSION_BATTLE_StatusAttackCheck( charaindex, toindex, status, Success ) == 0 ) + || (CHAR_getInt( toindex, CHAR_HP ) <= 0 ) ){ + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)޷(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), CHAR_getUseName( toindex ), + // aszStatusFull[status], perStatus ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }else{ +#ifdef _PROFESSION_ADDSKILL + if( status == BATTLE_ST_RESIST_F_I_T ){//Ȼ + CHAR_setWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_F], turn + 1 ); + CHAR_setWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_I], turn + 1 ); + CHAR_setWorkInt( toindex, StatusTbl[BATTLE_ST_RESIST_T], turn + 1 ); + } + else +#endif + CHAR_setWorkInt( toindex, StatusTbl[status], turn + 1 ); + + if( status == BATTLE_ST_PARALYSIS + || status == BATTLE_ST_SLEEP + || status == BATTLE_ST_STONE + || status == BATTLE_ST_BARRIER + || status == BATTLE_ST_DIZZY + || status == BATTLE_ST_ENTWINE + || status == BATTLE_ST_DRAGNET + || status == BATTLE_ST_ICECRACK + || status == BATTLE_ST_ICEARROW ){ + CHAR_setWorkInt( toindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + if( status == BATTLE_ST_DRAGNET ){//޵ + CHAR_setWorkInt( toindex, CHAR_DOOMTIME, 0 );//ĩռ + CHAR_setWorkInt( toindex, CHAR_WORK_com1, 0 ); + CHAR_setWorkInt( toindex, CHAR_WORK_toNo, 0 ); + CHAR_setWorkInt( toindex, CHAR_WORK_mode, 0 ); + CHAR_setWorkInt( toindex, CHAR_WORK_skill_level, 0 ); + CHAR_setWorkInt( toindex, CHAR_WORK_array, 0 ); + } + if( skill_type == BATTLE_COM_S_FIRE_ENCLOSE ){ // + CHAR_setWorkInt( toindex, CHAR_WORKMOD_F_ENCLOSE_2, skill_level ); + // ӻȾֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_FIRE_PRACTICE" ); + }else if(skill_type == BATTLE_COM_S_ICE_ENCLOSE ){ // + CHAR_setWorkInt( toindex, CHAR_WORKMOD_I_ENCLOSE_2, skill_level ); + // ӱȾֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_ICE_PRACTICE" ); + }else if(skill_type == BATTLE_COM_S_THUNDER_ENCLOSE ){ // ׸ + CHAR_setWorkInt( toindex, CHAR_WORKMOD_T_ENCLOSE_2, skill_level ); + // Ⱦֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_THUNDER_PRACTICE" ); + } + + // + if( skill_type == BATTLE_COM_S_OBLIVION ){ + int toNo = -1, toNoindex = -1, pet_no = -1, num = 0; + char msg[20]; + + memset( msg, -1, sizeof(msg) ); + + // index + toNo = ToList[i] - 5; + toNoindex = BATTLE_No2Index( battleindex, toNo ); + + // + pet_no = CHAR_getInt( toNoindex, CHAR_DEFAULTPET ); + + // 輼 + num = skill_level / 2; + if( num < 1 ) num = 1; + CHAR_setWorkInt( toindex, CHAR_WORKMODOBLIVION, num ); + + // client + if( toNoindex != -1 ){ + sprintf( msg, "W%d", pet_no ); + CHAR_sendStatusString( toNoindex, msg ); + + sprintf( msg, "Y%d", pet_no ); + CHAR_sendStatusString( toNoindex, msg ); + + } + } + + // + if(skill_type == BATTLE_COM_S_INSTIGATE ){ + int rate=0; + rate = skill_level * 1 + 10; + CHAR_setWorkInt( toindex, CHAR_WORKMODINSTIGATE, rate); + + sprintf( szCommand, "BD|r%X|0|4|%X|", ToList[i], (-1) * rate); + BATTLESTR_ADD( szCommand ); + sprintf( szCommand, "BD|r%X|0|5|%X|", ToList[i], (-1) * rate); + BATTLESTR_ADD( szCommand ); + sprintf( szCommand, "BD|r%X|0|6|%X|", ToList[i], (-1) * rate ); + BATTLESTR_ADD( szCommand ); + + } + + // + if(skill_type == BATTLE_COM_S_ENTWINE ){ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &dex ); + dex = skill_level * 4 + dex; + old_dex = CHAR_getWorkInt( toindex, CHAR_WORKFIXDEX); + old_dex = old_dex * (100 - dex) / 100; + CHAR_setWorkInt( toindex, CHAR_WORKFIXDEX, old_dex ); + sprintf( szCommand, "BD|r%X|0|6|%X|", ToList[i], (-1) * dex ); + BATTLESTR_ADD( szCommand ); + } + + // + if(skill_type == BATTLE_COM_S_RESIST_FIRE ){ + int old_value = CHAR_getWorkInt( toindex, CHAR_WORK_F_RESIST ); + int up_value = skill_level + 10; + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_F, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_F_RESIST, old_value + up_value ); + + }else + // + if(skill_type == BATTLE_COM_S_RESIST_ICE ){ + int old_value = CHAR_getWorkInt( toindex, CHAR_WORK_I_RESIST ); + int up_value = skill_level + 10; + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_I, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_I_RESIST, old_value + up_value ); + + }else + // ׿ + if(skill_type == BATTLE_COM_S_RESIST_THUNDER ){ + int old_value = CHAR_getWorkInt( toindex, CHAR_WORK_T_RESIST ); + int up_value = skill_level + 10; + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_T, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_T_RESIST, old_value + up_value ); + + } +#ifdef _PROFESSION_ADDSKILL + else + // Ȼ + if(skill_type == BATTLE_COM_S_RESIST_F_I_T ){ + int old_value = CHAR_getWorkInt( toindex, CHAR_WORK_F_RESIST ); + int up_value = 2; //ֵ + + if( skill_level >= 10 ) up_value = 20; + else if( skill_level > 8 ) up_value = 18; + else if( skill_level > 7 ) up_value = 16; + else if( skill_level > 6 ) up_value = 14; + else if( skill_level > 5 ) up_value = 12; + else if( skill_level > 4 ) up_value = 10; + else if( skill_level > 3 ) up_value = 8; + else if( skill_level > 2 ) up_value = 6; + else if( skill_level > 1 ) up_value = 4; + else up_value = 2; + + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_F, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_F_RESIST, old_value + up_value ); + + old_value = CHAR_getWorkInt( toindex, CHAR_WORK_I_RESIST ); + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_I, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_I_RESIST, old_value + up_value ); + + old_value = CHAR_getWorkInt( toindex, CHAR_WORK_T_RESIST ); + CHAR_setWorkInt( toindex, CHAR_WORKMODRESIST_T, up_value ); + CHAR_setWorkInt( toindex, CHAR_WORK_T_RESIST, old_value + up_value ); + + } +#endif + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), aszStatusFull[status], perStatus ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + BATTLE_BadStatusString( ToList[i], status ); + iRet = TRUE; + } + } + break; + } + // ƶ + case BATTLE_COM_S_SHIELD_ATTACK: // ܻ + { + int itmid=-1; + int perStatus, status=-1, Success=-1; + char szBuffer[256]=""; + int ToList[SIDE_OFFSET*2+1]; + int defNo2 = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + + itmid = CHAR_getItemIndex( charaindex, CHAR_EQSHIELD ); + + if( ( itmid < 0 ) || ITEM_WSHIELD != ITEM_getInt( itmid , ITEM_TYPE ) ){ + CHAR_talkToCli( charaindex, -1, "δװƣ޷ʹô˼", CHAR_COLORYELLOW); + iRet = FALSE; + break; + } + + // + if( skill_level != 10 ) + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, (int)(CHAR_getWorkInt(charaindex,CHAR_WORKATTACKPOWER) * 0.5 ) ); + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo2, ToList ); + + // ı״̬ + if( (pszP = strstr( pszOption, "" ) ) != NULL ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + break; + } + } + } + + // ɹ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &Success ); + Success += skill_level * 4; + perStatus = Success; + + if( defNo2 >= SIDE_OFFSET ){ + i = defNo2 - SIDE_OFFSET; + DefSide = 1; + } + + for( i = 0; ToList[i] != -1; i ++ ){ + int hit = -1; + react = 0; + + defindex = BATTLE_No2Index( battleindex, ToList[i] ); //طindex + if( CHAR_CHECKINDEX( defindex ) == FALSE ) continue; + + if( (ReactType=BATTLE_GetDamageReact( defindex)) > 0 ) { //й⾵ + react = ReactType; + skill_type=-1; + } + + //ȡù״̬ + iWork = BATTLE_AttackSeq( charaindex, defindex, &damage, &Guardian, skill_type ); + + ultimate = BATTLE_DamageSub( charaindex, defindex, &damage, &petdamage, &react); + + if( damage > 0 && ( react != BATTLE_MD_ABSROB )&& ( react != BATTLE_MD_VANISH )){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + iRet = BATTLE_DefineAttack( charaindex, defindex, iWork, szBuffer, damage, react, &flg); + + // NORMAL CRITICAL flg ij ְҵflg + if( img2 != 0 ){ + if( flg == BCF_NORMAL || flg == BCF_KAISHIN ){ + hit=1; + if( (pszP = strstr( pszOption, "ǰ" ) ) != NULL ){ + flg |= BCF_F_SKILLACT; //ǰͼ + }else{ + flg |= BCF_B_SKILLACT; //ͼ + } + } + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ) + iRet = BATTLE_DefDieType( defindex, iRet, &ultimate, &flg, szBuffer); + + if( damage > 0 ){ + if( BATTLE_ItemCrushSeq( charaindex, defindex, damage) == TRUE ){ + flg |= BCF_CRUSH; + } + } + + if( hit == 1 ){ + if( (PROFESSION_BATTLE_StatusAttackCheck( charaindex, defindex, status, Success ) == 0 ) + || (CHAR_getInt( defindex, CHAR_HP ) <= 0 ) ){ + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)޷(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), CHAR_getUseName( defindex ), aszStatusFull[status], perStatus ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }else{ + CHAR_setWorkInt( defindex, StatusTbl[status], turn + 1 ); + + if( status == BATTLE_ST_PARALYSIS + || status == BATTLE_ST_SLEEP + || status == BATTLE_ST_STONE + || status == BATTLE_ST_BARRIER + || status == BATTLE_ST_DIZZY + || status == BATTLE_ST_ENTWINE + || status == BATTLE_ST_DRAGNET + || status == BATTLE_ST_ICECRACK + || status == BATTLE_ST_ICEARROW + ){ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( defindex ), + // aszStatusFull[status], + // perStatus + //); + + BATTLE_BadStatusString( ToList[i], status ); + } + } + + snprintf( szCommand, sizeof( szCommand ), "B+|a%X|r%X|f%X|d%X|p%X|e%X|s%X|h%X|FF|", + attackNo, ToList[i], flg, damage, petdamage, effect, img1, img2 ); + BATTLESTR_ADD( szCommand ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + i = defNo2-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[i].flg |= BENT_FLG_ULTIMATE; + } + + iRet = TRUE; + } + break; + + } + case BATTLE_COM_S_TOXIN_WEAPON: // + { + int perStatus, status=-1, Success=-1; + int defNo2 = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return iRet; + + // ı״̬ + if( ((pszP = strstr( pszOption, "" ) ) != NULL ) ){ + + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + break; + } + } + } + + // ɹ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &Success ); + Success += skill_level * 2; + perStatus = Success; + + if( defNo2 >= SIDE_OFFSET ){ + i = defNo2 - SIDE_OFFSET; + DefSide = 1; + } + + { + int gWeponType = BATTLE_GetWepon( charaindex ); + char szCommand[512]; + int i = 0, ReactType = 0, iRet = -1; + int ToList[SIDE_OFFSET*2+1]; + BOOL bChange = FALSE; + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo, ToList ); + + memset( szCommand, -1, sizeof(szCommand) ); + + // ޱ +#ifdef _PETSKILL_BECOMEPIG + if(CHAR_getWorkInt(charaindex, CHAR_WORKFOXROUND) > 0 + || CHAR_getWorkInt(charaindex, CHAR_BECOMEPIG) > 0) bChange = TRUE; +#else + if(CHAR_getWorkInt(charaindex, CHAR_WORKFOXROUND) > 0) bChange = TRUE; +#endif + if(!bChange){ + // ΪԶ + if( gWeponType == ITEM_BOW ){ + sprintf( szCommand, "BB|a%X|w0|", attackNo ); + BATTLESTR_ADD( szCommand ); + memset( ToList, -1, sizeof( ToList)); + BATTLE_TargetListSet(charaindex,attackNo,ToList); + }else if( gWeponType == ITEM_BOUNDTHROW ){ + sprintf( szCommand, "BB|a%X|w1|", attackNo ); + BATTLESTR_ADD( szCommand ); + }else if( gWeponType == ITEM_BREAKTHROW ){ + sprintf( szCommand, "BB|a%X|w2|", attackNo ); + BATTLESTR_ADD( szCommand ); + }else if( gWeponType == ITEM_BOOMERANG){ + sprintf( szCommand, "BO|a%X|", attackNo ); + BATTLESTR_ADD( szCommand ); + memset(ToList,-1,sizeof(ToList)); + for(i=0;i<5;i++) ToList[i] = BoomerangVsTbl[defNo/5][i]; + gBattleDamageModyfy = 0.3; + } + } + + for( i = 0; ToList[i] != -1; i ++ ){ + int defindex = -1, j = -1; + int react = 0; + char szBuffer[256] = ""; + + damage = 0; + petdamage = 0; + flg = 0; + + //memset( szBuffer, 0, sizeof( szBuffer ) ); + + defindex = BATTLE_No2Index( battleindex, ToList[i] ); //طindex + if( CHAR_CHECKINDEX( defindex ) == FALSE ) continue; + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ) continue; + + if( (ReactType=BATTLE_GetDamageReact( defindex)) > 0 ){ //й⾵ + react = ReactType; + skill_type=-1; + } + + //ȡù״̬ + iWork = BATTLE_AttackSeq( charaindex, defindex, &damage, &Guardian, skill_type ); + if(Guardian >= 0) defindex = BATTLE_No2Index( battleindex, Guardian ); + + iRet = BATTLE_DefineAttack( charaindex, defindex, iWork, szBuffer, damage, react, &flg); + + if(damage > 0){ + ultimate = BATTLE_DamageSub( charaindex, defindex, &damage, &petdamage, &react); + + if((react != BATTLE_MD_ABSROB ) && ( react != BATTLE_MD_VANISH ) ){ + BATTLE_DamageWakeUp( battleindex, defindex ); + } + + if( CHAR_getInt( defindex, CHAR_HP ) <= 0 ) + iRet = BATTLE_DefDieType( defindex, iRet, &ultimate, &flg, szBuffer); + + if( BATTLE_ItemCrushSeq( charaindex, defindex, damage) == TRUE ){ + flg |= BCF_CRUSH; + } + + if( (PROFESSION_BATTLE_StatusAttackCheck( charaindex, defindex, status, perStatus ) == 0 ) + || (CHAR_getInt( defindex, CHAR_HP ) <= 0 ) ){ + + //snprintf( szBuffer, sizeof(szBuffer), "(%s)޷(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), CHAR_getUseName( defindex ), aszStatusFull[status], perStatus ); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }else{ + CHAR_setWorkInt( defindex, StatusTbl[status], turn + 1 ); + + if( status == BATTLE_ST_PARALYSIS + || status == BATTLE_ST_SLEEP + || status == BATTLE_ST_STONE + || status == BATTLE_ST_BARRIER + || status == BATTLE_ST_DIZZY + || status == BATTLE_ST_ENTWINE + || status == BATTLE_ST_DRAGNET + || status == BATTLE_ST_ICECRACK + || status == BATTLE_ST_ICEARROW + ){ + CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( defindex ), + // aszStatusFull[status], + // perStatus + //); + + BATTLE_BadStatusString( ToList[i], status ); + } + } + + // ΪԶʱ + + if(((gWeponType == ITEM_BOW) + || (gWeponType == ITEM_BOUNDTHROW) + || (gWeponType == ITEM_BREAKTHROW) + || (gWeponType == ITEM_BOOMERANG)) && !bChange){ + snprintf( szCommand, sizeof( szCommand ), "r%X|f%X|d%X|p%X|", ToList[i], flg, damage, petdamage ); + BATTLESTR_ADD( szCommand ); + }else{ + snprintf( szCommand, sizeof( szCommand ), "BH|a%X|r%X|f%X|d%X|p%X|FF|", attackNo, ToList[i], flg, damage, petdamage); + BATTLESTR_ADD( szCommand ); + } + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + j = ToList[i]-DefSide*SIDE_OFFSET; + if( ultimate > 0 ){ + BattleArray[battleindex].Side[DefSide].Entry[j].flg |= BENT_FLG_ULTIMATE; + } + + iRet = TRUE; + } + + // ΪԶʱ + if((( gWeponType == ITEM_BOW ) || ( gWeponType == ITEM_BOUNDTHROW ) || ( gWeponType == ITEM_BREAKTHROW ) || ( gWeponType == ITEM_BOOMERANG )) && !bChange){ + snprintf( szCommand, sizeof( szCommand ), "FF|" ); + BATTLESTR_ADD( szCommand ); + } + } + if(gWeponType == ITEM_BOOMERANG) gBattleDamageModyfy = 1.0; + break; + } +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_BOUNDARY: // Խ + { + int ToList[SIDE_OFFSET*2+1],status=-1,power=20,toindex=-1,loop=1; + int defNo2 = defNo;//CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM2); + int rand_boundary,rand_boundary2 = RAND( 1, 100 ); + + if( skill_level >= 10 ) turn = 5; + else if( skill_level > 9 ) turn = 4; + else if( skill_level > 8 ) turn = 3; + else if( skill_level > 4 ) turn = 2; + else turn = 1; + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + + if( skill_level >= 100 ) power = 100; + else if( skill_level > 95 ) power = 90; + else if( skill_level > 90 ) power = 80; + else if( skill_level > 85 ) power = 70; + else if( skill_level > 80 ) power = 60; + else if( skill_level > 60 ) power = 50; + else if( skill_level > 40 ) power = 40; + else if( skill_level > 20 ) power = 30; + else power = 20; + + if( ((pszP = strstr( pszOption, "ؽ" ) ) != NULL ) ) + status = CHAR_WORKFIXEARTHAT_BOUNDARY; + else if( ((pszP = strstr( pszOption, "ˮ" ) ) != NULL ) ) + status = CHAR_WORKFIXWATERAT_BOUNDARY; + else if( ((pszP = strstr( pszOption, "" ) ) != NULL ) ) + status = CHAR_WORKFIXFIREAT_BOUNDARY; + else if( ((pszP = strstr( pszOption, "" ) ) != NULL ) ){ + status = CHAR_WORKFIXWINDAT_BOUNDARY; + } + else{//ƽ + status = CHAR_WORKFIXEARTHAT_BOUNDARY; + + if( skill_level >= 100 ) rand_boundary = 100; + else if( skill_level > 80 ) rand_boundary = 80; + else if( skill_level > 40 ) rand_boundary = 70; + else if( skill_level > 20 ) rand_boundary = 60; + else rand_boundary = 50; + if( rand_boundary2 <= rand_boundary ){ + loop = 4; + power=0; + turn=0; + } + else + loop = 0; + } + + if( ((pszP = strstr( pszOption, "ƽ" ) ) != NULL ) ){ + if( defNo2 < 10 )defNo2 = 20; else defNo2 = 21; + } + + memset( ToList, -1, sizeof( ToList)); + BATTLE_MultiList( battleindex, defNo2, ToList ); + + if( ((pszP = strstr( pszOption, "ƽ" ) ) == NULL ) ){//Ȱн + for( j=CHAR_WORKFIXEARTHAT_BOUNDARY; j 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEREFLEC ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEREFLEC, max( work, 0 ) ); + defindex = attackindex; + defpet = attackpet; + + }else + if( *pRefrect == BATTLE_MD_TRAP ){ // + int value=0; + value = CHAR_getWorkInt( defindex, CHAR_WORKMODTRAP ); + damage = value; + + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= damage; + playerdamage = hp; + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= playerdamage; + pethp -= petdamage; + }else + hp -= damage; + } + + CHAR_setWorkInt( defindex, CHAR_WORKTRAP, 0 ); + CHAR_setWorkInt( defindex, CHAR_WORKMODTRAP, 0 ); + defindex = attackindex; + defpet = attackpet; + + }else +#ifdef _PETSKILL_ACUPUNCTURE +/* if( *pRefrect == BATTLE_MD_ACUPUNCTURE ){ + hp = CHAR_getInt( attackindex, CHAR_HP ); + if( attackpet == -1 ) { + hp -= ( damage/2 ? damage/2:1 ); + }else { + pethp = CHAR_getInt( attackpet, CHAR_HP ); + defquick = CHAR_getWorkInt( attackindex, CHAR_WORKDEFENCEPOWER ); + petquick = CHAR_getWorkInt( attackpet, CHAR_WORKDEFENCEPOWER ); + if( pethp > 0 ) { + playerdamage = (damage*petquick)/(defquick+petquick) +1; + petdamage = damage - playerdamage +1 ; + hp -= ( playerdamage/2 ? playerdamage/2:1 ); + pethp -= ( petdamage/2 ? petdamage/2:1 ); + }else + hp -= ( damage/2 ? damage/2:1 ); + } + //work = CHAR_getWorkInt( defindex, CHAR_WORKACUPUNCTURE ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKACUPUNCTURE, 0);//max( work, 0 ) ); + defindex = attackindex; + defpet = attackpet; + }*/ +#endif + if( react == BATTLE_MD_VANISH ){ + hp = CHAR_getInt( defindex, CHAR_HP ); + if( defpet != -1 ) + pethp = CHAR_getInt( defpet, CHAR_HP ); + work = CHAR_getWorkInt( defindex, CHAR_WORKDAMAGEVANISH ) - 1; + CHAR_setWorkInt( defindex, CHAR_WORKDAMAGEVANISH, max( work, 0 ) ); + *pRefrect = BATTLE_MD_VANISH; + }else{ + hp = CHAR_getInt( defindex, CHAR_HP ); + + if( defpet == -1 ) { + hp -= (damage * 0.7); + }else { + pethp = CHAR_getInt( defpet, CHAR_HP ); + if( pethp > 0 ) { + int rate=0; + rate = skill_level * 2 + 60; + + petdamage = damage * rate / 100; + playerdamage = damage - petdamage; + + hp -= playerdamage; + pethp -= petdamage; + + }else + hp -= damage; + } + *pRefrect = 0; + } + if( hp < 0 ){ + addpoint = -hp; + hp = 0; + } + maxhp = CHAR_getWorkInt( defindex, CHAR_WORKMAXHP ); + CHAR_setInt( defindex, CHAR_HP, min( hp, maxhp ) ); + if( defpet != -1 ) { + if( pethp < 0 ) pethp = 0; + petmaxhp = CHAR_getWorkInt( defpet, CHAR_WORKMAXHP ); + CHAR_setInt( defpet, CHAR_HP, min( pethp, petmaxhp ) ); + // Robin 0804 + if( pethp <= 0 ) { + CHAR_setInt( defindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( defindex ); + CHAR_setWorkInt( defindex, CHAR_WORKPETFALL, 1 ); + //print(" defpet_die! "); + } + } + + if( (damage) >= maxhp * 1.2 + 20 ){ + IsUltimate = 2; + }else{ + if( addpoint > 0 ){ + addpoint += CHAR_getWorkInt( defindex, CHAR_WORKULTIMATE ); + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, addpoint ); + if( addpoint >= maxhp * 1.2 + 20 )IsUltimate = 1; + } + } + + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P ){ + } +#ifdef _PETSKILL_LER +// ׶ܱ + if(CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(defindex,CHAR_BASEBASEIMAGENUMBER) == 101814) IsUltimate = 0; +#endif + + if( IsUltimate ){ + CHAR_setWorkInt( defindex, CHAR_WORKULTIMATE, 0 ); + } + if( playerdamage < 0 ) playerdamage = 0; + if( petdamage < 0 ) petdamage = 0; + *pDamage = playerdamage; + *pPetDamage = petdamage; + return IsUltimate; +} + + +// ȡû˺ +int BATTLE_PROFESSION_CONVOLUTE_GET_DAMAGE( int attackindex, int defindex, int skill_level ) +{ + int damage = 0, old_atk = 0, atk = 0; + int rand_num = RAND(1, 10000 ); + // һ + int perCri = BATTLE_CriticalCheck( attackindex, defindex ); + + old_atk = CHAR_getWorkInt( attackindex, CHAR_WORKATTACKPOWER ); + atk = old_atk * (100 -( 50 - skill_level )) / 100; + CHAR_setWorkInt( attackindex, CHAR_WORKATTACKPOWER, atk ); + + if( rand_num < perCri ){ + damage = BATTLE_CriDamageCalc( attackindex, defindex ); + }else{ + //profession fix + if( BATTLE_DuckCheck( attackindex, defindex ) ) + return 0; + damage = BATTLE_DamageCalc( attackindex, defindex ); + } + + return damage; +} + +// ȡùᴩ˺ +int BATTLE_PROFESSION_THROUGH_ATTACK_GET_DAMAGE( int attackindex, int defindex ) +{ + int damage = 0; + int rand_num = RAND(1, 10000 ); + // һ + int perCri = BATTLE_CriticalCheck( attackindex, defindex ); + + if( rand_num < perCri ){ + damage = BATTLE_CriDamageCalc( attackindex, defindex ); + }else{ + //profession fix + if( BATTLE_DuckCheck( attackindex, defindex ) ) + return 0; + damage = BATTLE_DamageCalc( attackindex, defindex ); + } + + return damage; +} + +// 𡢱׸帽ӹ +int BATTLE_PROFESSION_RANG_ATTACK_DAMAGE( int charaindex, int attackNo, int defNo, int skill_type, int status, int turn, int perStatus, int effect, int img1, int img2 ) +{ + int ReactType = 0, iRet = -1,defindex = -1,react = 0; + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + //char szBuffer[256]=""; + + //memset( szBuffer, 0, sizeof( szBuffer ) ); + + defindex = BATTLE_No2Index( battleindex, defNo); //طindex + if( defindex == -1 ) return iRet; + + if( (ReactType=BATTLE_GetDamageReact( defindex)) > 0 ){ //й⾵ + react = ReactType; + skill_type=-1; + } + + if( img1 != 0 ){ + if( (PROFESSION_BATTLE_StatusAttackCheck( charaindex, defindex, status, perStatus ) == 0 ) + || (CHAR_getInt( defindex, CHAR_HP ) <= 0 ) ){ + //snprintf( szBuffer, sizeof(szBuffer), "(%s)޷(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), CHAR_getUseName( defindex ), aszStatusFull[status], perStatus ); + //BATTLE_BroadCast( battleindex, szBuffer,(attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + else{ + CHAR_setWorkInt( defindex, StatusTbl[status], turn + 1 ); + + if( status == BATTLE_ST_PARALYSIS + || status == BATTLE_ST_SLEEP + || status == BATTLE_ST_STONE + || status == BATTLE_ST_BARRIER + || status == BATTLE_ST_DIZZY + || status == BATTLE_ST_ENTWINE + || status == BATTLE_ST_DRAGNET + || status == BATTLE_ST_ICECRACK + || status == BATTLE_ST_ICEARROW + ) CHAR_setWorkInt( defindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( defindex ), + // aszStatusFull[status], + // perStatus + // ); + + BATTLE_BadStatusString( defNo, status ); + iRet = TRUE; + } + //BATTLE_BroadCast( battleindex, szBuffer,(attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + + return iRet; +} + +#endif + +#ifdef _PETSKILL_LER +extern ToCallMagic PROFESSION_magic[3]; +// ׶ - ȺĴ +void BATTLE_BatFly( int battleindex, int attackNo,int myside) +{ + int ToList[SIDE_OFFSET*2+1],i,toindex; + int petidx,addhp = 0,charhp,pethp,charaindex; + char szCommand[1024]; + + charaindex = BATTLE_No2Index(battleindex,attackNo); + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; + + memset(ToList,-1,sizeof(ToList)); + if(myside) BATTLE_MultiList(battleindex,TARGET_SIDE_0,ToList); // + else BATTLE_MultiList(battleindex,TARGET_SIDE_1,ToList); // + + PROFESSION_magic[2].uiSpriteNum = myside ? 101806:101807; + PROFESSION_magic[2].siSx = 320; + PROFESSION_magic[2].siSy = 240; + PROFESSION_magic[2].uiPrevMagicNum = myside ? 101808:101809; // ǰö + PROFESSION_magic[2].uiPostMagicNum = 0xffffffff; // ö + PROFESSION_magic[2].uiShowType = 1; + PROFESSION_magic[2].uiShowBehindChar = 1; + PROFESSION_magic[2].siPrevMagicSx = 0; + PROFESSION_magic[2].siPrevMagicSy = 0; + PROFESSION_MAGIC_ATTAIC_Effect(battleindex,attackNo,ToList,2); + sprintf(szCommand,"%X|",0x5711438); + BATTLESTR_ADD(szCommand); + + for(i=0;i CHAR_getWorkInt(charaindex,CHAR_WORKMAXHP)){ + CHAR_setInt(charaindex,CHAR_HP,CHAR_getWorkInt(charaindex,CHAR_WORKMAXHP)); + addhp = 0; + } + else CHAR_setInt(charaindex,CHAR_HP,CHAR_getInt(charaindex,CHAR_HP) + addhp); + sprintf(szCommand,"BD|r%X|%X|1|d%X|p0|",attackNo,BD_KIND_HP,addhp); + BATTLESTR_ADD(szCommand); +} + +// ׶ - +void BATTLE_DivideAttack( int battleindex, int attackNo,int myside) +{ + int ToList[SIDE_OFFSET*2+1],i,toindex; + int petidx,charhp,charmp,pethp,charaindex; + char szCommand[1024]; + + charaindex = BATTLE_No2Index(battleindex,attackNo); + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; + + memset(ToList,-1,sizeof(ToList)); + if(myside) BATTLE_MultiList(battleindex,TARGET_SIDE_0,ToList); // + else BATTLE_MultiList(battleindex,TARGET_SIDE_1,ToList); // + + PROFESSION_magic[2].uiSpriteNum = myside ? 101798:101800; + PROFESSION_magic[2].siSx = 320; + PROFESSION_magic[2].siSy = 240; + PROFESSION_magic[2].uiPrevMagicNum = myside ? 101808:101809; // ǰö + PROFESSION_magic[2].uiPostMagicNum = 0xffffffff; // ö + PROFESSION_magic[2].uiShowType = 1; + PROFESSION_magic[2].uiShowBehindChar = 0; + PROFESSION_magic[2].siPrevMagicSx = 0; + PROFESSION_magic[2].siPrevMagicSy = 0; + PROFESSION_MAGIC_ATTAIC_Effect(battleindex,attackNo,ToList,2); + sprintf(szCommand,"%X|",0x5711438); + BATTLESTR_ADD(szCommand); + + // ɿMPĶ + for(i=0;i>1)); + charmp >>= 1; + sprintf(szCommand,"BD|r%X|%X|0|d%X|",ToList[i],BD_KIND_MP,charmp); + BATTLESTR_ADD(szCommand); + } + } + for(i=0;i 10 ? 1:0); + } + else if(CHAR_getInt(charaindex,CHAR_BASEBASEIMAGENUMBER) == 101814){ + array = ENEMY_getEnemyArrayFromId(2510); + if(array == -1) return; + newindex = ENEMY_createEnemy(array,300); + if(newindex == -1) return; + CHAR_setWorkInt(newindex,CHAR_WORK_RELIFE,101811); + CHAR_setWorkInt(newindex,CHAR_WORKBATTLESIDE,no > 10 ? 1:0); + } + pBattle = &BattleArray[battleindex]; + pEntry = pBattle->Side[no > 10 ? 1:0].Entry; + pEntry[no > 10 ? no-10:no].charaindex = newindex; +} +#endif + +#ifdef _PETSKILL_BATTLE_MODEL +typedef struct _tsAttackObject{ + int index; // + int target; // Ŀ + int actionNumber; // ͼ +}AttackObject; +// BATTLE_BattleModel õĹʽ +void BATTLE_BattleModel_ATTACK( + int battleindex, + int charaindex, + AttackObject *pAAttackObject, + int iEffect, + int iTurn, + int iEffectHit, + int iType) +{ + int i,iDefindex,iPetindex,iToindex,iDamage,iPetDamage,iGuardian = -1,iDefState,iUltimate = 0,iTemp = 0,iTemp2 = 0,iFlg = 0; + char szCommand[1024]; + + // Ŀ治ڻû + if(!BATTLE_TargetCheck(battleindex,pAAttackObject->target)) return; + iToindex = iDefindex = BATTLE_No2Index(battleindex,pAAttackObject->target); + // dz,ڲڳ + if(CHAR_getInt(iToindex,CHAR_WHICHTYPE ) == CHAR_TYPEPET){ + if(pAAttackObject->target + 5 >= SIDE_OFFSET) iFlg = 1; + i = pAAttackObject->target + 5 - iFlg * SIDE_OFFSET; + if(BattleArray[battleindex].Side[iFlg].Entry[i].flg & BENT_FLG_ULTIMATE) return; + } + iPetindex = BATTLE_getRidePet(iToindex); + // ˺ + iDefState = BATTLE_AttackSeq(charaindex,iToindex,&iDamage,&iGuardian,-1); + // iType & 0x00000004 Ϊ true ʾΪ + if(iType & 0x00000004){ + // Ȯû,趨Ȯ + if(BATTLE_TargetCheck(battleindex,iGuardian)){ + // Ȯ,ѱ趨ΪʹȮܵĽɫ,򱻹ΪԭĿ + if(iGuardian >= 0) iDefindex = BATTLE_No2Index(battleindex,iGuardian); + } + else iGuardian = -1; + } + // 趨 CHAR_NPCWORKINT1 Ϊ BATTLE_COM_S_BATTLE_MODEL BATTLE_DamageSub õ + iTemp2 = CHAR_getWorkInt(iDefindex,CHAR_NPCWORKINT1); + CHAR_setWorkInt(iDefindex,CHAR_NPCWORKINT1,BATTLE_COM_S_BATTLE_MODEL); + // ֮ iDefindex ˵Ŀ + if(gDamageDiv != 0.0 && iDamage > 0){ + iDamage /= gDamageDiv; + if(iDamage <= 0) iDamage = 1; + } + // ûһ,пѪ + if(!(iDefState == BATTLE_RET_DODGE)){ + // Ѫ + // + if(iType & 0x00000004) iUltimate = BATTLE_DamageSub(charaindex,iDefindex,&iDamage,&iPetDamage,&iTemp); + // + else{ + iTemp = -1; + iUltimate = BATTLE_DamageSub(charaindex,iDefindex,&iDamage,&iPetDamage,&iTemp); + } + } + iFlg = 0; + // ش״̬ + switch(iDefState){ + case BATTLE_RET_ALLGUARD:iFlg |= BCF_GUARD;break; + case BATTLE_RET_MISS:iDamage = 0;break; + case BATTLE_RET_DODGE:iDamage = 0;iFlg |= BCF_DODGE;break; + case BATTLE_RET_NORMAL: + iFlg |= BATTLE_getReactFlg(iDefindex,iTemp); + iFlg |= BCF_NORMAL; + break; + case BATTLE_RET_CRITICAL: + iFlg |= BATTLE_getReactFlg(iDefindex,iTemp); + iFlg |= BCF_KAISHIN; + break; +#ifdef _EQUIT_ARRANGE + case BATTLE_RET_ARRANGE:iFlg |= BCF_B_ARRANGE;break; +#endif + } + + //˯ʱ,״̬(Ҳ״̬) + if(iDamage > 0 && (iTemp != BATTLE_MD_ABSROB) && (iTemp != BATTLE_MD_VANISH)) BATTLE_DamageWakeUp(battleindex,iDefindex); + + // ĿǷ + if(CHAR_getInt(iDefindex,CHAR_HP) <= 0){ + if(CHAR_getWorkInt(iDefindex,CHAR_WORKBATTLEFLG ) & CHAR_BATTLEFLG_ABIO) iUltimate = 1; + else if(CHAR_getInt(iDefindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER && (iFlg & BCF_KAISHIN)){ + if(RAND(1,100) < 50) iUltimate = 1; + } +#ifdef _PETSKILL_LER + // ׶ܱ + if(CHAR_getInt(iDefindex,CHAR_BASEBASEIMAGENUMBER) == 101813 || + CHAR_getInt(iDefindex,CHAR_BASEBASEIMAGENUMBER) == 101814) iUltimate = 0; +#endif + iFlg |= BCF_DEATH; + if(iUltimate == 1) iFlg |= BCF_ULTIMATE_1; + if(iUltimate == 2) iFlg |= BCF_ULTIMATE_2; + } + else{ +#ifdef _TAKE_ITEMDAMAGE + if(BATTLE_ItemCrushSeq(charaindex,iDefindex,iDamage) == TRUE) +#else + if(BATTLE_ItemCrushSeq(iDefindex) == TRUE) +#endif + iFlg |= BCF_CRUSH; + // ״̬ж + if(iDamage > 0 && BATTLE_StatusAttackCheck(charaindex,iDefindex,iEffect,iEffectHit,30,1.0,&iTemp)){ + CHAR_setWorkInt(iDefindex,StatusTbl[iEffect],iTurn); + if(iEffect == BATTLE_ST_DRUNK) CHAR_setWorkInt(iDefindex,CHAR_WORKDRUNK,CHAR_getWorkInt(iDefindex,CHAR_WORKDRUNK) >> 1); + // ״̬Ŀûغ֮᲻ж + if(iEffect == BATTLE_ST_PARALYSIS || iEffect == BATTLE_ST_SLEEP || iEffect == BATTLE_ST_STONE || iEffect == BATTLE_ST_BARRIER) + CHAR_setWorkInt(iDefindex,CHAR_WORKBATTLECOM1,BATTLE_COM_NONE); + // شclientһĿҪִ״̬ı + if(iGuardian >= 0) BATTLE_BadStatusString(iGuardian,iEffect); // iGuardian 춵 0 ʾĿʹȮ,Ŀ״̬ı + else BATTLE_BadStatusString(pAAttackObject->target,iEffect); // ԭĿ״̬ı + } + } + + if(iGuardian >= 0){ + iFlg |= BCF_GUARDIAN; + snprintf(szCommand,sizeof(szCommand), + "r%X|i%X|f%X|d%X|p%X|a%X|g%X|", + pAAttackObject->target, + pAAttackObject->index, + iFlg, + iDamage, + iPetDamage, + pAAttackObject->actionNumber, + iGuardian); + }else + snprintf(szCommand,sizeof(szCommand), + "r%X|i%X|f%X|d%X|p%X|a%X|", + pAAttackObject->target, + pAAttackObject->index, + iFlg, + iDamage, + iPetDamage, + pAAttackObject->actionNumber); + + // 봫clientbuffer + BATTLESTR_ADD(szCommand); + + iTemp = BATTLE_Index2No(battleindex,iDefindex); + + // iFlg û,; + iFlg = 0; + if(iTemp >= SIDE_OFFSET) iFlg = 1; + + i = iTemp - iFlg * SIDE_OFFSET; + if(iUltimate > 0) BattleArray[battleindex].Side[iFlg].Entry[i].flg |= BENT_FLG_ULTIMATE; + CHAR_setWorkInt(iDefindex,CHAR_NPCWORKINT1,iTemp2); +} + +void BATTLE_BattleModel(int battleindex,int attackNo,int myside) +{ + int iToList[SIDE_OFFSET*2+1],i,i0,i1,i2,iEffect = -1,iTurn = -1,iEffectHit = 0,iType,iObjectNum,charaindex; + int iActionNumber[4] = {-1,-1,-1,-1},iActionAmount = 0; + char szData[32],szData2[32],*pszOption = NULL; + AttackObject AAttackObject[10]; + + charaindex = BATTLE_No2Index(battleindex,attackNo); + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; + + pszOption = PETSKILL_getChar(CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM3),PETSKILL_OPTION); + + if(pszOption == "\0"){ +// printf("BATTLE_BattleModel: read PETSKILL_OPTION error!!(array:%d,file:%s,line:%d)\n", +// CHAR_getWorkInt(charaindex,CHAR_WORKBATTLECOM3),__FILE__,__LINE__); + return; + } + + // ȡЧ + if(getStringFromIndexWithDelim(pszOption,"|",3,szData,sizeof(szData)) != FALSE){ + for(i=1;i= iActionAmount) i1 = 0; + } + + // 鳡Ŀʣֻ + for(i=0;i= i){ + i0 = i; // ¼Ŀֻ + + for(i=0;i +#include "char.h" +#include "char_base.h" +#include "battle.h" +#include "battle_event.h" +#include "battle_item.h" +#include "battle_magic.h" +#include "item_event.h" +#include "log.h" +#include "anim_tbl.h" +#include "npcutil.h" +#include "magic_base.h" +#include "lssproto_serv.h" + + +int BATTLE_ItemUseDelete( + int charaindex, + int haveitemindex +) +{ + int itemindex; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0; + { +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "BattleUse(սʹõĵ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + + return 0; +} + +#ifdef _IMPRECATE_ITEM +void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex ) +{ + int i; + int battleindex, attackNo,itemindex; + char *arg; + char buf[256]; + + struct tagImprecate { + char fun[256]; + int intfun; + }; + struct tagImprecate ImList[3] ={ + {"",BD_KIND_CURSE},{"",BD_KIND_BESTOW},{"ף",BD_KIND_WISHES} }; + + if( !CHAR_CHECKINDEX( charaindex) ) return; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + if( (attackNo = BATTLE_Index2No( battleindex, charaindex )) < 0 ){ + //print( "ANDY attackNo=%d\n", attackNo); + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( arg == "\0" ){ + //print( "ANDY ITEM id:%d=>arg err\n", ITEM_getInt( itemindex, ITEM_ID)); + return; + } + + for( i=0; i<3; i++) { + if( strstr( arg, ImList[i].fun ) != 0 ) { + char buf1[256]; + int kind,powers, rounds, HealedEffect; + + if( NPC_Util_GetStrFromStrWithDelim( arg, ImList[i].fun, buf, sizeof( buf)) == NULL )continue; + kind = ImList[i].intfun; + if( getStringFromIndexWithDelim( buf,"x", 1, buf1, sizeof( buf1)) == FALSE ) continue; + powers = atoi( buf1); + if( getStringFromIndexWithDelim( buf,"x", 2, buf1, sizeof( buf1)) == FALSE ) continue; + rounds = atoi( buf1); + HealedEffect = SPR_hoshi; + BATTLE_ImprecateRecovery( + battleindex, attackNo, toNo, kind, powers, + rounds, SPR_item3, HealedEffect ); + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne( itemindex ); + break; + } + } +} +#endif + +#ifdef _ITEM_MAGICRECOVERY +void ITEM_useMRecovery_Battle( int charaindex, int toNo, int haveitemindex ) +{ + int battleindex, attackNo, itemindex; + int turn=0, magicid, marray; + char buf1[256]; + char *arg=NULL; + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return; + if( (attackNo = BATTLE_Index2No( battleindex, charaindex )) == -1 ) return; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar( itemindex, ITEM_ARGUMENT ); + + + if( getStringFromIndexWithDelim( arg, ":", 2, buf1, sizeof(buf1)) ==FALSE ) return; + turn = atoi( buf1); + if( getStringFromIndexWithDelim( arg, ":", 1, buf1, sizeof(buf1)) ==FALSE ) return; + + if( strstr( buf1, "ȫ" ) != NULL ){ + }else{ + } + + magicid = ITEM_getInt( itemindex, ITEM_MAGICID); + marray = MAGIC_getMagicArray( magicid); + if( marray == -1 ) return; + + + if( IsBATTLING( charaindex ) == TRUE ){ + int i, status=-1; + char *magicarg=NULL, *pszP=NULL; +#ifdef _CAX_ZHUANGYUAN_QTJ + int floor = CHAR_getInt( charaindex, CHAR_FLOOR ); + int fd; + fd = getfdFromCharaIndex( charaindex); + if( floor == 1042 + || floor == 2032 + || floor == 3032 + || floor == 4032 + || floor == 5032 + || floor == 6032 + || floor == 7032 + || floor == 8032 + || floor == 9032 + || floor == 10032 + || floor == 2000 + || floor == 2005){ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli(charaindex,-1,"˵ͼֹʹþ(ȫξ)",CHAR_COLORYELLOW); + return; + } +#endif +#ifdef _PREVENT_TEAMATTACK //⾵..ʹõз + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + //&& BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P + ){ + if( BATTLE_CheckSameSide( charaindex, toNo) == 0 ){//ͬ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "⾵..ʩҵз", CHAR_COLORYELLOW); + return; + } + } +#endif + + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + pszP = magicarg; + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + if( strncmp( pszP, aszMagicDef[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + if( status == -1 ) return; + + BATTLE_MultiMagicDef( battleindex, attackNo, toNo, + status, turn, MAGIC_EFFECT_USER, SPR_difence ); + +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "BattleUse(սʹõĵ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + } + + CHAR_DelItemMess( charaindex, haveitemindex, 0); +} +#endif + +#ifdef _ITEM_USEMAGIC +void ITEM_useMagic_Battle( int charaindex, int toNo, int haveitemindex ) +{ + int itemindex,itemmaxuse; + char *arg=NULL; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar( itemindex, ITEM_ARGUMENT ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_JYUJYUTU ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, atoi(arg) ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + MAGIC_DirectUse( + charaindex, + CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ), + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ), + CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 ) + ); + + itemmaxuse = ITEM_getInt( itemindex, ITEM_DAMAGEBREAK); + if( itemmaxuse > 0 ) + ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, itemmaxuse-1 ); + else{ +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "BattleUse(սʹõĵ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + + CHAR_DelItemMess( charaindex, haveitemindex, 0); + } +} +#endif + +void ITEM_useRecovery_Battle( int charaindex, int toNo, int haveitemindex ) +{ + int power = 0, per = 0, HealedEffect=0; + int battleindex, attackNo,itemindex, kind = BD_KIND_HP; + char *p = NULL, *arg; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( (p = strstr( arg, "" )) != NULL ) + { + kind = BD_KIND_HP; + } + else if( (p = strstr( arg, "" )) != NULL ) + { + kind = BD_KIND_MP; + } + else +#ifdef _ITEM_UNBECOMEPIG + if( (p = strstr( arg, "" )) != NULL ){ + kind = BD_KIND_UNBECOMEPIG; + HealedEffect = 100608; //Ч + } + else +#endif +#ifdef _ITEM_LVUPUP + if( (p = strstr( arg, "LVUPUP" )) != NULL ){ + return; + } + else +#endif +#ifdef _ITEM_PROPERTY + if( (p = strstr( arg, "PROPERTY" )) != NULL ){ + kind = BD_KIND_PROPERTY; + HealedEffect = 100608; //Ч + if( strstr( arg, "+" ) ) + power = 1; + else if( strstr( arg, "-" ) ) + power = 2; + } + else +#endif +#ifdef _ITEM_ADDPETEXP + if( (p = strstr( arg, "GETEXP" )) != NULL ){ + return; + } + else +#endif + return; + +#ifdef _ITEM_UNBECOMEPIG + if( HealedEffect != 100608 ){ +#endif + if( sscanf( p+2, "%d", &power ) != 1 ) + power = 0; + if( power <= 100 ) + HealedEffect = SPR_heal;//SPR_hoshi + else if( power <= 300 ) + HealedEffect = SPR_heal2; + else + HealedEffect = SPR_heal3; +#ifdef _ITEM_UNBECOMEPIG + } +#endif + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + if( attackNo < 0 )return; + BATTLE_MultiRecovery( battleindex, attackNo, toNo,kind, power, per, SPR_item3, HealedEffect ); + { +// LogItem( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +//#ifdef _add_item_log_name // WON ADD itemlogitem +// itemindex, +//#else +// ITEM_getInt( itemindex, ITEM_ID ), +//#endif +// "BattleUse(սʹõĵ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// ITEM_getChar( itemindex, ITEM_UNIQUECODE), +// ITEM_getChar( itemindex, ITEM_NAME), +// ITEM_getInt( itemindex, ITEM_ID) +// ); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); +} + +void ITEM_useStatusChange_Battle( + int charaindex, + int toNo, + int haveitemindex +){ + int turn = 0, i; + int battleindex, attackNo,itemindex, status = -1, Success = 15; + int ReceveEffect; + char *pszP = NULL, *arg; + char szTurn[] = "turn"; + char szSuccess[] = ""; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + pszP = arg; + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 0; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + if( status == -1 ) return ; + if( ( pszP = strstr( arg, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + if( ( pszP = strstr( arg, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; + }else{ + ReceveEffect = SPR_hoshi; + } + BATTLE_MultiStatusChange( battleindex, attackNo, toNo, + status, turn, SPR_item3, ReceveEffect, Success ); + BATTLE_ItemUseDelete( charaindex, haveitemindex ); +} + +void ITEM_useStatusRecovery_Battle( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +){ + int i; + int battleindex, attackNo,itemindex, status = -1; + int ReceveEffect; + char *pszP = NULL, *arg; + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + // ɷ¶ë + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + pszP = arg; + // ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + // ؤ¼ƥ߾ո + for( i = 0; i < BATTLE_ST_END; i ++ ){ + // + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( status == -1 ) return ; + + //------- ռ ----------- + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + ReceveEffect = SPR_tyusya; // 巴ľ + + // 幻 + BATTLE_MultiStatusRecovery( battleindex, attackNo, toNo, + status, SPR_item3, ReceveEffect ); + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + +} + + + + + + +void ITEM_useMagicDef_Battle( + int charaindex, + int toNo, + int haveitemindex +) +{ + int turn = 0, i; + int battleindex, attackNo,itemindex, status = -1; + char *pszP = NULL, *arg; + + char szTurn[] = "turn"; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + pszP = arg; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + if( strncmp( pszP, aszMagicDef[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return ; + + if( ( pszP = strstr( arg, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + BATTLE_MultiMagicDef( battleindex, attackNo, toNo, + status, turn, SPR_item3, SPR_difence ); + + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + + +} + + + + + + +//-------------------------------------------------------------- +// ɷ¶ ʧ ةë +//-------------------------------------------------------------- +// +void ITEM_useParamChange_Battle( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +) +{ + int i; + int battleindex, attackNo,itemindex; + int pow, par = 0; + int kind = -1; + char *pszP = NULL, *arg; + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + // ɷ¶ë + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + pszP = arg; + // ë + for( ;kind == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + // + if( strncmp( pszP, aszParamChange[i], 2 ) == 0 ){ + kind = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( kind == -1 ) return ; + + + if( strstr( pszP, "%" ) ){ // ѻң + par = 1; + } + + if( sscanf( pszP, "%d", &pow ) != 1 ){ + // Ϻ̼ؤ¾ + pow = 30; + } + + //------- ----------- + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiParamChange( battleindex, attackNo, toNo, + kind, pow, par, SPR_item3, SPR_hoshi ); + + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + + +} + + + + + + +//-------------------------------------------------------------- +// ū ʧ ةë +//-------------------------------------------------------------- +// +void ITEM_useFieldChange_Battle( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +) +{ + int itemindex; + char *pArg; + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + //------- ----------- + // ɷ¶ë + pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + // ɷ¶ мƥ + if( pArg == "\0" )return ; + + BATTLE_FieldAttChange( charaindex, pArg ); + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + +} + + +//-------------------------------------------------------------- +// ʧ ةë +//-------------------------------------------------------------- +// +void ITEM_useAttReverse_Battle( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +) +{ + int itemindex, battleindex, attackNo; + + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + //------- ----------- + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiAttReverse( battleindex, attackNo, toNo, + SPR_item3, SPR_kyu ); + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + + +} + + +//-------------------------------------------------------------- +// 姾ë +//-------------------------------------------------------------- +// +void ITEM_useRessurect( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +) +{ + int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect; + char *pszP = NULL; + + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + //------- ----------- + pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + if( strstr( pszP, "%" ) ){ // ѻң + par = 1; + } + + if( sscanf( pszP, "%d", &pow ) != 1 ){ + // Ϻ̼¾ + pow = 0; // ߼ + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + if( pow <= 0 ){ + ReceveEffect = SPR_fukkatu3; + }else + if( pow <= 100 ){ + ReceveEffect = SPR_fukkatu1; + }else + if( pow <= 300 ){ + ReceveEffect = SPR_fukkatu2; + }else{ + ReceveEffect = SPR_fukkatu3; + } + + // 幻 + BATTLE_MultiRessurect( battleindex, attackNo, toNo, + pow, par, SPR_item3, ReceveEffect ); + + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + +} + + + +//-------------------------------------------------------------- +// Ĥë +//-------------------------------------------------------------- +// +void ITEM_useCaptureUp_Battle( + int charaindex, // м̼͵ + int toNo, // ľм į + int haveitemindex // мʧ ة į +) +{ + int itemindex, battleindex, attackNo, pow = 5, ReceveEffect; + char *pArg; + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + //------- ----------- + // ɷ¶ë + pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + // ɷ¶ мƥ + if( pArg == "\0" )return ; + + if( sscanf( pArg, "%d", &pow ) != 1 ){ + // Ϻ̼¾ + pow = 5; + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + ReceveEffect = SPR_hoshi; + + // 幻 + BATTLE_MultiCaptureUp( battleindex, attackNo, toNo, + pow, SPR_item3, ReceveEffect ); + + // ʧ ةɧ + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + +} +#ifdef _ITEM_CRACKER +void ITEM_useCracker_Effect( charaindex, toindex, haveitemindex) +{ + int itemindex,x,y,tofd; + + itemindex = CHAR_getItemIndex(charaindex,haveitemindex); + // Ʒ + if(!ITEM_CHECKINDEX(itemindex)) return; + + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + CHAR_setMyPosition( charaindex, x, y, TRUE); + CHAR_setWorkInt( charaindex, CHAR_WORKITEM_CRACKER, 1); + CHAR_sendCrackerEffect( charaindex, 101125); + //to client + tofd = getfdFromCharaIndex( charaindex ); + lssproto_IC_send(tofd, x, y); + // + BATTLE_ItemUseDelete(charaindex,haveitemindex); + CHAR_talkToCli(charaindex,-1,"ʧˡ",CHAR_COLORYELLOW); + +} +#endif +#ifdef _ITEM_REFRESH //vincent 쳣״̬ +void ITEM_useRefresh_Effect( charaindex, toindex, haveitemindex) +{ + int i,itemindex,ReceveEffect; + char *arg; +// char szBuffer[128]=""; + int status = -1,attackNo,index2; + int battleindex; + char *pszP; + +//print("\nvincent--ITEM_useRefresh_Effect"); + // Ʒ + itemindex = CHAR_getItemIndex(charaindex,haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + pszP = arg; + // ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + // ྮո + for( i = 1; i < BATTLE_ST_END; i ++ ){ + // + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } +//print("\nvincent-->status:%d",status); + // ئмƥ + if( status == -1 ) return; + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + index2 = BATTLE_No2Index( battleindex, toindex);//Ŀ֮index + attackNo = BATTLE_Index2No( battleindex, charaindex ); +// defNo = BATTLE_Index2No( battleindex, index2 ); +//print("\nvincent-->charaindex:%d,attackNo:%d,index2:%d,defNo:%d,",charaindex,attackNo,index2,defNo); + + /* ƽҷ ջ */ + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex);/* ʧ ةޥ */ +// if( CHAR_getWorkInt( charaindex, StatusTbl[status] ) > 0 ){ +// ReceveEffect = SPR_tyusya; +// }else{ +// ReceveEffect = SPR_hoshi; +// } + ReceveEffect = SPR_tyusya;// + BATTLE_MultiStatusRecovery( battleindex, attackNo, toindex, + status, MAGIC_EFFECT_USER, ReceveEffect ); + /* */ + ITEM_endExistItemsOne( itemindex ); +////////////////////////// +// BATTLE_MultiList( battleindex, defNo, ToList ); +// for( i = 0; ToList[i] != -1; i ++ ){ +// toindex = BATTLE_No2Index( battleindex, ToList[i] ); +// +// } + + + +//////////////////////////// +} +#endif +#ifdef _ITEM_ADDEXP //vincent +void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex) +{ + int itemindex,power,vtime; + //,pindex + char *p = NULL, *arg; + char szBuffer[1024]=""; + + itemindex = CHAR_getItemIndex(charaindex,haveitemindex); + + // Ʒ + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + if( (p = strstr( arg, "" )) != NULL ){ + sscanf( p+2, "%d", &power ); + } + if( (p = strstr( arg, "" )) != NULL ){ + sscanf( p+2, "%d", &vtime ); + } + if( p == NULL )return; +#ifdef CC_ADD_ADDEXPCHECKDEGREE + { + if ( power != (int)(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)) && + 0 != (int)(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)) + ) + { + CHAR_talkToCli( charaindex, -1, "ӵЧͬ,޷ʹ", CHAR_COLORYELLOW); + return; + } + } + #endif +#ifdef _ITEM_ADDEXP2 // ǹʱۼ + { + int point; + point = CHAR_getInt( charaindex, CHAR_ADDEXPPOWER) + * (int)(CHAR_getInt( charaindex, CHAR_ADDEXPTIME)/60); +#ifdef _CAX_ITEM_ADDEXP + if( point >= getexptime()* power) { +#else + if( point >= 7200000) { +#endif + CHAR_talkToCli( charaindex, -1, "ǻ֮ۼʱ估ЧѴޡ", CHAR_COLORYELLOW); + return; + } + + if(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)!=power){ + point = power * vtime; +#ifdef _CAX_ITEM_ADDEXP + point = min( point, getexptime()*power); +#else + point = min( point, 7200000); +#endif + vtime = (int)(point / power); + }else{ + point += (power * vtime); +#ifdef _CAX_ITEM_ADDEXP + point = min( point, getexptime()*power); +#else + point = min( point, 7200000); +#endif + vtime = (int)(point / power); + } + } +#endif + CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power); + CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 ); + + // + BATTLE_ItemUseDelete(charaindex,haveitemindex); + //sprintf(szBuffer, "ѧϰ%d", power); + sprintf(szBuffer, "ѧϰ%dʱЧʣ%dӡ", power, vtime); + CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW); + //int mfd=getfdFromCharaIndex( charaindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} +#endif +//Terry add 2001/12/24 +#ifdef _ITEM_FIRECRACKER +void ITEM_useFirecracker_Battle( charaindex, toindex, haveitemindex) +{ + int itemindex, battleindex, masteridx=-1, index2; + + char szWork[128]; +#ifdef _FIX_FIRECRACKER + int petid=-1, i=1; + BOOL FINDPET=FALSE; + char *buff1; + char token[256], buf1[256]; +#else + int PetEscape = 0; +#endif + + itemindex = CHAR_getItemIndex(charaindex,haveitemindex); + // Ʒ + if(!ITEM_CHECKINDEX(itemindex)) return; + + battleindex = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEINDEX); +#ifdef _FIX_FIRECRACKER + index2 = BATTLE_No2Index( battleindex, toindex); + if( !CHAR_CHECKINDEX( index2) ) return; + { + int attackNo = BATTLE_Index2No( battleindex, charaindex ); + int safeSide = 0; + int MySide_start, MySide_end; + if( attackNo >= 10 ) + safeSide = 1; + + MySide_start = safeSide*SIDE_OFFSET; + MySide_end = ((safeSide*SIDE_OFFSET) + SIDE_OFFSET); + + if( (toindex >= MySide_start) && (toindex= 901 && CHAR_getInt(index2,CHAR_PETID) <= 904){ + // ȡĿ᷽Ľɫindex + masteridx = BATTLE_No2Index(battleindex,toindex-5); + // ս + if(CHAR_getInt(masteridx,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) PetEscape = 1; + else print("\nʱ"); + } + } + + // ըԼ + if(BATTLE_Index2No(battleindex,charaindex) != toindex) + { + sprintf(szWork,"BB|a%X|w3|r%X|f0|d0|p0|FF|",BATTLE_Index2No(battleindex,charaindex),toindex); + BATTLESTR_ADD(szWork); + if(PetEscape) + { + BATTLE_Exit(index2,battleindex); + CHAR_setInt(masteridx,CHAR_DEFAULTPET,-1); + sprintf(szWork,"BQ|e%X|",toindex); + BATTLESTR_ADD(szWork); + CHAR_talkToCli(masteridx,-1,"ޱˣ",CHAR_COLORWHITE); + CHAR_talkToCli(charaindex,-1,"ޱˣ",CHAR_COLORWHITE); + } + } + CHAR_talkToCli(charaindex,-1,"ʲ¶û",CHAR_COLORWHITE); + CHAR_talkToCli(charaindex,-1,"ʧˡ",CHAR_COLORWHITE); + // ʹʧ + BATTLE_ItemUseDelete(charaindex,haveitemindex); +#endif +} +#endif + +//Terry end + + + + +//״̬ظ,Ӹ(,,) ͬħ(,,),ֻս֮ʹ,û +// :ֵ turn 1 +#ifdef _FEV_ADD_NEW_ITEM // FEV ADD Ӹؾ +void ITEM_ResAndDef( int charaindex, int toindex, int haveitemindex ) +{ + int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect; + char *buffer = NULL; + char *magicarg = NULL; + char *magicarg2 = NULL; + char *magicarg3 = NULL; + char magicarg4[200]; + + char *pszP = NULL; + char delim[] = " ";//ЭִֽԪ + + int status = -1, i, turn = 3; + char szTurn[] = "turn"; + + // ʧ ةؤ¾ + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + buffer = ITEM_getChar(itemindex, ITEM_ARGUMENT );//ִ + pszP = strtok(buffer, delim);//һ + magicarg = strtok(NULL, delim);//ڶ + magicarg2 = strtok(NULL, delim);// + magicarg3 = strtok(NULL, delim);//ĸ + sprintf(magicarg4,"%s %s %s",magicarg,magicarg2,magicarg3); + magicarg = (char*)magicarg4; + + //⾵..ʹõз + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + //&& BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P + ){ + if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ){//ͬ + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "⾵..ʩҵз", CHAR_COLORYELLOW); + return; + } + } + + //״̬ظ + if( strstr( pszP, "%" ) ){ + par = 1; + } + + if( sscanf( pszP, "%d", &pow ) != 1 ){ + pow = 0; + } + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + //ѡЧ + if( pow <= 0 ){ + ReceveEffect = SPR_fukkatu3; + }else + if( pow <= 100 ){ + ReceveEffect = SPR_fukkatu1; + }else + if( pow <= 300 ){ + ReceveEffect = SPR_fukkatu2; + }else{ + ReceveEffect = SPR_fukkatu3; + } + + BATTLE_MultiRessurect( battleindex, attackNo, toindex, + pow, par, SPR_item3, ReceveEffect ); + + + //(,,) + + // ë + for( ;status == -1 && magicarg[0] != 0; magicarg++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + // + if( strncmp( magicarg, aszMagicDef[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( status == -1 ) return; + + // ϼ ʽ¾ + if( ( magicarg = strstr( magicarg, szTurn ) ) != NULL){ + magicarg += sizeof( szTurn ); + sscanf( magicarg, "%d", &turn ); + } + + //print(":%d",turn); + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiMagicDef( battleindex, attackNo, toindex, + status, turn, MAGIC_EFFECT_USER, SPR_difence ); + + + BATTLE_ItemUseDelete( charaindex, haveitemindex ); + +} + +#endif + + + + + diff --git a/battle/battle_magic.c b/battle/battle_magic.c new file mode 100644 index 0000000..19de874 --- /dev/null +++ b/battle/battle_magic.c @@ -0,0 +1,5438 @@ +#include "version.h" +#include +#include"char.h" +#include"char_base.h" +#include"battle.h" +#include"battle_event.h" +#include"magic_base.h" +#include"battle_magic.h" +#include"item_event.h" +#include"anim_tbl.h" +#include"common.h" +#include"lssproto_serv.h" + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#include "skill.h" +#endif + +#ifdef _ATTACK_MAGIC + +extern AttMagic *ATTMAGIC_magic; +extern int ATTMAGIC_magicnum; + +#define AJ_SAME (1.0) +#define AJ_UP (1.5) +#define AJ_DOWN (0.6) + +#define ATTR_MAX 100 +#define D_ATTR (1.0/(ATTR_MAX*ATTR_MAX)) +#ifdef _FIX_MAGICDAMAGE +static int BATTLE_getMagicAdjustInt( int attackindex, int defindex, int MagicLv, int flg,int damage ); +void Magic_ComputeAttExp( int charindex, int Mnum, int MagicLv, int Expoint); +void Magic_ComputeDefExp( int charindex, int Mnum, int MagicLv, int Damage); +#endif + +#ifdef _MAGIC_TOCALL +/* +typedef struct tagToCallMagic +{ + unsigned int uiSpriteNum; // Spr_x.binı + unsigned int uiAttackType; // ķʽˣ( ) , ( ) , ( ͬʱ ) , ȫ( ) , ȫ( ͬʱ ) + unsigned int uiSliceTime; // ʱʱ + unsigned int uiShowType; // ʾλ÷ʽ롢ָ + int siSx; // ʾλ - X + int siSy; // ʾλ - Y + unsigned int uiShowBehindChar; // ʾǰ· + unsigned int uiShakeScreen; // Ƿ𶯻 + unsigned int uiShakeFrom; // 𶯻ʼʱ( ) + unsigned int uiShakeTo; // 𶯻Ľʱ( _ + unsigned int uiPrevMagicNum; // ǰ( 0XFFFFFFFFFF ʾǰ ) + int siPrevMagicSx; // ǰʾλ - X + int siPrevMagicSy; // ǰʾλ - Y + int siPrevMagicOnChar; // ǰʾǰ· + unsigned int uiPostMagicNum; // ( 0XFFFFFFFF ʾ ) + int siPostMagicSx; // ʾλ - X + int siPostMagicSy; // ʾλ - Y + int siPostMagicOnChar; // ʾǰ· + int isPostDisappear; // һ㹥ʱǷʧ + int ToCallMagicNo; // ٻı +}ToCallMagic; +*/ + +ToCallMagic TOCALL_magic[3] = { {100354,0,0,0,50,25,1,0,0,0,101120,65528,65485,0,-1,0,0,0,1,0}, + {100354,1,0,0,50,25,1,0,0,0,101120,65528,65485,0,-1,0,0,0,1,1}, + {100354,5,0,0,0,0,1,1,1000,4000,101120,65528,65485,0,-1,0,0,0,0,2}, + }; + +#endif + +// ħȼ辭ֵ +int Magic_Level_Table[101] = +{ + 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, //lv 1~10 + 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, //lv 11~20 + 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, //lv 21~30 + 496, 528, 561, 595, 630, 666, 703, 741, 780, 820, //lv 31~40 + 861, 903, 946, 990,1035,1081,1128,1176,1225,1275, //lv 41~50 + 1326,1378,1431,1485,1540,1596,1653,1711,1770,1830, //lv 51~60 + 1891,1953,2016,2080,2145,2211,2278,2346,2415,2485, //lv 61~70 + 2556,2628,2701,2775,2850,2926,3003,3081,3160,3240, //lv 71~80 + 3321,3403,3486,3570,3655,3741,3828,3916,4005,4095, //lv 81~90 + 4186,4278,4371,4465,4560,4656,4753,4851,4950,5050, //lv 91~100 + 9999 +}; +#endif + +int BATTLE_MagicEffect( int battleindex, int attackNo, int ToList[], int MyEffect, int ToEffect ) +{ + int i; + char szCommand[256]; + int attackindex; + + attackindex = BATTLE_No2Index( battleindex, attackNo ); + if( CHAR_CHECKINDEX( attackindex ) == FALSE )return 0; + + snprintf( szCommand, sizeof(szCommand), + "BJ|a%X|m%X|e%X|e%X|", + attackNo, + CHAR_getInt( attackindex, CHAR_MP ), + MyEffect, + ToEffect + ); + + + BATTLESTR_ADD( szCommand ); + + for( i = 0; ToList[i] != -1; i ++ ){ + snprintf( szCommand, sizeof(szCommand), "r%X|",ToList[i]); + BATTLESTR_ADD( szCommand ); + } + BATTLESTR_ADD( "FF|" ); + + return 0; +} + +#ifdef _ATTACK_MAGIC + +int BATTLE_AttMagicEffect( int battleindex , int attackNo , int ToList[] , int AttackMgcNo ) +{ + int i; + char szcommand[256]; + int attackindex; + + attackindex = BATTLE_No2Index( battleindex , attackNo ); + if( FALSE == CHAR_CHECKINDEX( attackindex ) ) + return 0; + + if( attackNo >= 10 ) + i = AttackMgcNo * 2; + else + i = AttackMgcNo * 2 + 1; + + snprintf( + szcommand , sizeof( szcommand ) , "BJ|a%X|i%X|m%X|%X|%X|%X|s%X|t%X|l%X|%X|%X|%X|%X|%X|%X|o%X|o%X|o%X|s%X|%X|%X|" , + attackNo , 12345678 , CHAR_getInt( attackindex , CHAR_MP ) , + ATTMAGIC_magic[i].uiPrevMagicNum , + ATTMAGIC_magic[i].uiSpriteNum , + ATTMAGIC_magic[i].uiPostMagicNum , + ATTMAGIC_magic[i].uiAttackType , + ATTMAGIC_magic[i].uiSliceTime , + ATTMAGIC_magic[i].uiShowType , + ATTMAGIC_magic[i].siSx , + ATTMAGIC_magic[i].siSy , + ATTMAGIC_magic[i].siPrevMagicSx , + ATTMAGIC_magic[i].siPrevMagicSy , + ATTMAGIC_magic[i].siPostMagicSx , + ATTMAGIC_magic[i].siPostMagicSy , + ATTMAGIC_magic[i].siPrevMagicOnChar , + ATTMAGIC_magic[i].uiShowBehindChar , + ATTMAGIC_magic[i].siPostMagicOnChar , + ATTMAGIC_magic[i].uiShakeScreen , + ATTMAGIC_magic[i].uiShakeFrom , + ATTMAGIC_magic[i].uiShakeTo + ); + + BATTLESTR_ADD( szcommand ); + + for( i = 0 ; ToList[i] != -1 ; i++ ) + { + snprintf( szcommand , sizeof( szcommand ) , "r%X|" , ToList[i] ); + BATTLESTR_ADD( szcommand ); + } + + BATTLESTR_ADD( "FF|" ); + + return 0; +} + +#endif + + +#ifdef _MAGIC_TOCALL + +int BATTLE_ToCallDragonEffect( int battleindex , int attackNo , int ToList[] , int AttackMgcNo ) +{ + int i; + char szcommand[256]; + int attackindex; + + attackindex = BATTLE_No2Index( battleindex , attackNo ); + if( FALSE == CHAR_CHECKINDEX( attackindex ) ) + return 0; +/* + if( attackNo >= 10 ) + i = AttackMgcNo * 2; + else + i = AttackMgcNo * 2 + 1; +*/ + snprintf( + szcommand , sizeof( szcommand ) , "B$|a%X|i%X|m%X|%X|%X|%X|s%X|t%X|l%X|%X|%X|%X|%X|%X|%X|o%X|o%X|o%X|s%X|%X|%X|%X|%X|" , + attackNo , 5711438 , CHAR_getInt( attackindex , CHAR_MP ) , + TOCALL_magic[AttackMgcNo].uiPrevMagicNum , + TOCALL_magic[AttackMgcNo].uiSpriteNum , + TOCALL_magic[AttackMgcNo].uiPostMagicNum , + TOCALL_magic[AttackMgcNo].uiAttackType , + TOCALL_magic[AttackMgcNo].uiSliceTime , + TOCALL_magic[AttackMgcNo].uiShowType , + TOCALL_magic[AttackMgcNo].siSx , + TOCALL_magic[AttackMgcNo].siSy , + TOCALL_magic[AttackMgcNo].siPrevMagicSx , + TOCALL_magic[AttackMgcNo].siPrevMagicSy , + TOCALL_magic[AttackMgcNo].siPostMagicSx , + TOCALL_magic[AttackMgcNo].siPostMagicSy , + TOCALL_magic[AttackMgcNo].siPrevMagicOnChar , + TOCALL_magic[AttackMgcNo].uiShowBehindChar , + TOCALL_magic[AttackMgcNo].siPostMagicOnChar , + TOCALL_magic[AttackMgcNo].uiShakeScreen , + TOCALL_magic[AttackMgcNo].uiShakeFrom , + TOCALL_magic[AttackMgcNo].uiShakeTo , + TOCALL_magic[AttackMgcNo].isPostDisappear , + TOCALL_magic[AttackMgcNo].ToCallMagicNo + ); + + BATTLESTR_ADD( szcommand ); + + for( i = 0 ; ToList[i] != -1 ; i++ ) + { + snprintf( szcommand , sizeof( szcommand ) , "r%X|" , ToList[i] ); + BATTLESTR_ADD( szcommand ); + } + + BATTLESTR_ADD( "FF|" ); + + return 0; +} + +#endif +#ifdef _IMPRECATE_ITEM +void BATTLE_ImprecateRecovery( + int battleindex, int attackNo, int toNo, int kind, int powers, + int rounds, int UseEffect, int RecevEffect ) +{ + int i, toindex, flg; + int ToList[SIDE_OFFSET*2+1]; + //char szBuffer[256]=""; + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, attackNo, ToList, + UseEffect, RecevEffect ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( CHAR_CHECKINDEX( toindex ) == FALSE )continue; + switch( kind ){ +#ifdef _IMPRECATE_ITEM + case BD_KIND_CURSE: + if( CHAR_getWorkInt( toindex, CHAR_WORKIMPRECATENUM1 ) <= 0 && + CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + CHAR_setWorkInt( toindex, CHAR_WORKHURTMP, powers); //˺ MP + CHAR_setWorkInt( toindex, CHAR_WORKIMPRECATENUM1, rounds); + } + break; + case BD_KIND_BESTOW: + if( CHAR_getWorkInt( toindex, CHAR_WORKIMPRECATENUM2 ) <= 0 ){ +#ifdef _TYPE_TOXICATION + if( CHAR_CanCureFlg( toindex, "HP") == FALSE ) break; +#endif + CHAR_setWorkInt( toindex, CHAR_WORKWISHESHP, powers); //ף hp + CHAR_setWorkInt( toindex, CHAR_WORKIMPRECATENUM2, rounds); + } + break; + case BD_KIND_WISHES: + if( CHAR_getWorkInt( toindex, CHAR_WORKIMPRECATENUM3 ) <= 0 && + CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + CHAR_setWorkInt( toindex, CHAR_WORKWISHESMP, powers); //ף MP + CHAR_setWorkInt( toindex, CHAR_WORKIMPRECATENUM3, rounds); + } + break; +#endif + } + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + if( BattleArray[battleindex].norisk == 0 + && CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET){ + flg = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEFLG ); + if( flg & CHAR_BATTLEFLG_RECOVERY ){ + }else{ + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRECOVERY ); + CHAR_setWorkInt( toindex, CHAR_WORKBATTLEFLG, flg | CHAR_BATTLEFLG_RECOVERY ); + } + } + } + return; +} +#endif + +void BATTLE_MultiRecovery( + int battleindex, + int attackNo, + int toNo, + int kind, + int power, + int per, + int UseEffect, + int RecevEffect +) +{ + int i, toindex, UpPoint = 0, workhp, oldhp, flg; + int ToList[SIDE_OFFSET*2+1]; + + //char szBuffer[256]=""; + char szCommand[256]; + + int ridepet, petUpPoint =0; + + + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( battleindex, attackNo, ToList, UseEffect, RecevEffect ); + + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + if( CHAR_CHECKINDEX( toindex ) == FALSE ) continue; + + ridepet = BATTLE_getRidePet( toindex ); + + switch( kind ){ +#ifdef _ITEM_UNBECOMEPIG + case BD_KIND_UNBECOMEPIG: + if( CHAR_getInt( toindex, CHAR_BECOMEPIG ) > -1 ){ + CHAR_setInt( toindex, CHAR_BECOMEPIG, -1 ); + CHAR_setInt( toindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER)); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_talkToCli( toindex,-1,"ʧЧˡ",CHAR_COLORWHITE); + } + break; +#endif +#ifdef _ITEM_PROPERTY + case BD_KIND_PROPERTY: + { + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) + return; + //print("ˮ:%d %d %d %d", CHAR_getInt( toindex, CHAR_EARTHAT ), CHAR_getInt( toindex, CHAR_WATERAT ), CHAR_getInt( toindex, CHAR_FIREAT ), CHAR_getInt( toindex, CHAR_WINDAT ) ); + if( power == 1 ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + } + if( power == 2 ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ); + } + } +#endif + case BD_KIND_HP: +#ifdef _TYPE_TOXICATION + if( CHAR_CanCureFlg( toindex, "HP") == FALSE ) continue; +#endif + // Robin 0728 ride Pet + if( ridepet == -1 ) { + UpPoint = RAND( (power*0.9), (power*1.1) ); +#ifdef _MAGIC_REHPAI +#else + if( per ){ + UpPoint *= CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) * 0.01; + } + UpPoint *= GetRecoveryRate( toindex ); +#endif + workhp = CHAR_getInt( toindex, CHAR_HP ); + oldhp = workhp; + workhp += (int)UpPoint; + CHAR_setInt( toindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + + //snprintf( szBuffer, sizeof(szBuffer), "(%s);ظ(%d)", CHAR_getUseName( toindex ), UpPoint ); + + }else { + int allUpPoint; + UpPoint = RAND( (power*0.9), (power*1.1) ); +#ifdef _MAGIC_REHPAI + allUpPoint = UpPoint; + UpPoint = (allUpPoint * Magic_RideGetHP( toindex, ridepet, 1 ))/100; + petUpPoint = allUpPoint - UpPoint; +#else + petUpPoint = UpPoint; + if( per ){ + UpPoint *= CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) * 0.01; + petUpPoint *= CHAR_getWorkInt( ridepet, CHAR_WORKMAXHP ) * 0.01; + + } + UpPoint *= GetRecoveryRate( toindex ); + petUpPoint *= GetRecoveryRate( ridepet ); +#endif + + + allUpPoint = UpPoint + petUpPoint; +#ifdef _MAGIC_REHPAI +#else + UpPoint = (UpPoint * UpPoint) / allUpPoint; + petUpPoint = (petUpPoint * petUpPoint) / allUpPoint; +#endif + workhp = CHAR_getInt( toindex, CHAR_HP ); + oldhp = workhp; + workhp += (int)UpPoint; + CHAR_setInt( toindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + workhp = CHAR_getInt( ridepet, CHAR_HP ); + oldhp = workhp; + workhp += (int)petUpPoint; + CHAR_setInt( ridepet, CHAR_HP, + min( workhp, CHAR_getWorkInt( ridepet, CHAR_WORKMAXHP ) ) ); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s);ظ(%d),(%s);ظ(%d)", + // CHAR_getUseName( toindex ), + // UpPoint, + // CHAR_getUseName( toindex ), + // petUpPoint + // ); + } + break; + case BD_KIND_MP: + UpPoint = RAND( (power*0.9), (power*1.1) ); + if( per ){ + UpPoint *= CHAR_getWorkInt( toindex, CHAR_WORKMAXMP ) * 0.01; + } + workhp = CHAR_getInt( toindex, CHAR_MP ); + oldhp = workhp; + workhp += (int)UpPoint; + CHAR_setInt( toindex, CHAR_MP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXMP ) ) ); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ظ(%d)", + // CHAR_getUseName( toindex ), + // UpPoint + // ); + break; + } + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + { + int Sign, Damage, petDamage; + Sign = (UpPoint >= 0)?(1):(0); + Damage = ABS( UpPoint ); + petDamage = ABS( petUpPoint ); +#ifdef _NOTRIDE_ + snprintf( szCommand, sizeof(szCommand), + "BD|r%X|%X|%X|d%X|", ToList[i], kind, Sign, Damage ); +#else + snprintf( szCommand, sizeof(szCommand), + "BD|r%X|%X|%X|d%X|p%X|", ToList[i], kind, Sign, Damage, petDamage ); +#endif //_NOTRIDE_ + BATTLESTR_ADD( szCommand ); + } + + if( BattleArray[battleindex].norisk == 0 + && CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET){ + flg = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEFLG ); + if( flg & CHAR_BATTLEFLG_RECOVERY ){ + }else{ + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRECOVERY ); + CHAR_setWorkInt( toindex, CHAR_WORKBATTLEFLG, flg | CHAR_BATTLEFLG_RECOVERY ); + } + } + } + return; +} + +#ifdef _MAGIC_REHPAI +int Magic_RideGetHP( int toindex, int petindex, int flg) +{ + int allDHp=1; + int petDHp=1; + int CharDHp=1; + int ISIZE = 100; + + CharDHp = CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) - CHAR_getInt( toindex, CHAR_HP); + petDHp = CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) - CHAR_getInt( petindex, CHAR_HP); + allDHp = (CharDHp + petDHp); + + if( allDHp <= 0 ) allDHp=1; + if( flg == 1) + return (int)((CharDHp*ISIZE)/allDHp); + else + return (int)((petDHp*ISIZE)/allDHp); +} +#endif + +int MAGIC_Recovery_Battle( int charaindex, int toNo, int marray, int mp ) +{ + char *magicarg; + float power; + int battleindex, attackNo, HealedEffect = 0, per = 0; + int range; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + +#if 1 // Robin fix MagicΧ + range = MAGIC_getInt( marray, MAGIC_TARGET ); + //print(" MAGIC_TARGET:%d toNo:%d ", range, toNo); + if( range == 0 && toNo != attackNo ) { // ֻܶԼʹ +// print("\n ķ!MAGICֻܶԼʹ!!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + return FALSE; + } + if( range == 1 && toNo >= 20 ) { // ֻܶԵʹ +// print("\n ķ!MAGICֻܶԵʹ!!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + return FALSE; + } +#endif + + // shan(ȫʹħbug)޸jinchao+2001/12/07 + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return FALSE; + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + // shan(ȫʹħbug)޸jinchao+2001/12/07 + if (magicarg == "\0") return FALSE; + + power = atoi( magicarg ); + if( strstr( magicarg, "%" ) ){ + per = 1; + } + + if( power <= 100 ){ + HealedEffect = SPR_heal; + }else + if( power <= 300 ){ + HealedEffect = SPR_heal2; + }else{ + HealedEffect = SPR_heal3; + } + BATTLE_MultiRecovery( battleindex, attackNo, toNo,BD_KIND_HP, (int)power, per, MAGIC_EFFECT_USER, HealedEffect ); + return TRUE; +} + +void BATTLE_MultiResAndDef( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int power, // + int per, // Ѿ + int kind, // ܷ + int count, // ϼ ʲ + int UseEffect, // мް + int RecevEffect // ľмް +) +{ + int i, toindex, charaindex, UpPoint = 0, workhp; + int ToList[SIDE_OFFSET*2+1]; + + //char szBuffer[256]=""; + char szCommand[256]; + + + BATTLE_MultiListDead( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + charaindex = BATTLE_No2Index( battleindex, attackNo ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P + && CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + continue; + } + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == FALSE ){ + continue; + } + UpPoint = power; +#ifdef _MAGIC_REHPAI +#else + if( per ){ + UpPoint *= CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) * 0.01; + } +#endif + if( power == 0 ){ + UpPoint = CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ); + }else{ + UpPoint = RAND( (power*0.9), (power*1.1) ); + } + UpPoint = max( 1, UpPoint ); + workhp = CHAR_getInt( toindex, CHAR_HP ) + UpPoint; + CHAR_setInt( toindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + CHAR_setFlg( toindex, CHAR_ISDIE, 0 ); + CHAR_setWorkInt( toindex, MagicDefTbl[kind], count ); + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ָʶ", + // CHAR_getUseName( toindex ) ); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), + // aszMagicDefFull[kind] + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + snprintf( szCommand, sizeof(szCommand), + "BL|r%X|h%X|", ToList[i], CHAR_getInt( toindex, CHAR_HP ) ); + BATTLESTR_ADD( szCommand ); + if( BattleArray[battleindex].norisk == 0 + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E ){ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRESSURECT ); + } + } + } +} + +#ifdef _ATTACK_MAGIC + +static int CharTable[4][5] = +{ + { 13 , 11 , 10 , 12 , 14 } , + { 18 , 16 , 15 , 17 , 19 } , + { 8 , 6 , 5 , 7 , 9 } , + { 3 , 1 , 0 , 2 , 4 } +}; + +static int CharTableIdx[20][2] = +{ + { 3 , 2 } , { 3 , 1 } , { 3 , 3 } , { 3 , 0 } , { 3 , 4 } , + { 2 , 2 } , { 2 , 1 } , { 2 , 3 } , { 2 , 0 } , { 2 , 4 } , + { 0 , 2 } , { 0 , 1 } , { 0 , 3 } , { 0 , 0 } , { 0 , 4 } , + { 1 , 2 } , { 1 , 1 } , { 1 , 3 } , { 1 , 0 } , { 1 , 4 } +}; + + + +typedef int ( *FUNC )( const void* , const void* ); + +static int SortLoc( const int *pEle1 , const int *pEle2 ) +{ + int ele1basex , ele1basey; + int ele2basex , ele2basey; + + ele1basex = CharTableIdx[*pEle1][1]; + ele1basey = CharTableIdx[*pEle1][0]; + ele2basex = CharTableIdx[*pEle2][1]; + ele2basey = CharTableIdx[*pEle2][0]; + + // Ϸ + if( *pEle1 >= 10 ) + { + if( ele1basey != ele2basey ) + return ( ele1basey - ele2basey ); + + return ( ele1basex - ele2basex ); + } + // · + else + { + if( ele1basey != ele2basey ) + return ( ele2basey - ele1basey ); + + return ( ele2basex - ele1basey ); + } + + return 0; +} + + +static void BATTLE_GetAttr( int charaindex , int *pAt_Fire , int *pAt_Water , int *pAt_Earth , int *pAt_Wind , int *pAt_None ) +{ + + int petindex = BATTLE_getRidePet( charaindex ); + + if( petindex == -1 ) + { + *pAt_Fire = CHAR_getWorkInt( charaindex , CHAR_WORKFIXFIREAT ); + *pAt_Water = CHAR_getWorkInt( charaindex , CHAR_WORKFIXWATERAT ); + *pAt_Earth = CHAR_getWorkInt( charaindex , CHAR_WORKFIXEARTHAT ); + *pAt_Wind = CHAR_getWorkInt( charaindex , CHAR_WORKFIXWINDAT ); + } + else + { + *pAt_Fire = ( CHAR_getWorkInt( charaindex , CHAR_WORKFIXFIREAT ) + + CHAR_getWorkInt( petindex , CHAR_WORKFIXFIREAT ) ) / 2; + *pAt_Water = ( CHAR_getWorkInt( charaindex , CHAR_WORKFIXWATERAT ) + + CHAR_getWorkInt( petindex , CHAR_WORKFIXWATERAT ) ) / 2; + *pAt_Earth = ( CHAR_getWorkInt( charaindex , CHAR_WORKFIXEARTHAT ) + + CHAR_getWorkInt( petindex , CHAR_WORKFIXEARTHAT ) ) / 2; + *pAt_Wind = ( CHAR_getWorkInt( charaindex , CHAR_WORKFIXWINDAT ) + + CHAR_getWorkInt( petindex , CHAR_WORKFIXWINDAT ) ) / 2; + } + + if( *pAt_Fire < 0 ) *pAt_Fire = 0; + if( *pAt_Water < 0 ) *pAt_Water = 0; + if( *pAt_Earth < 0 ) *pAt_Earth = 0; + if( *pAt_Wind < 0 ) *pAt_Wind = 0; + + *pAt_None = 100 - *pAt_Fire - *pAt_Water - *pAt_Earth - *pAt_Wind; + + if( *pAt_None < 0 ) + *pAt_None = 0; +} + +static void BATTLE_GetPureAttr( int charaindex , int *pAt_Fire , int *pAt_Water, int *pAt_Earth , int *pAt_Wind ) +{ + *pAt_Fire = CHAR_getWorkInt( charaindex , CHAR_WORKFIXFIREAT ); + *pAt_Water = CHAR_getWorkInt( charaindex , CHAR_WORKFIXWATERAT ); + *pAt_Earth = CHAR_getWorkInt( charaindex , CHAR_WORKFIXEARTHAT ); + *pAt_Wind = CHAR_getWorkInt( charaindex , CHAR_WORKFIXWINDAT ); + + if( *pAt_Fire < 0 ) *pAt_Fire = 0; + if( *pAt_Water < 0 ) *pAt_Water = 0; + if( *pAt_Earth < 0 ) *pAt_Earth = 0; + if( *pAt_Wind < 0 ) *pAt_Wind = 0; +} + + + +int BATTLE_CalAttMagicEffect( int AttEle , int DefPosEleValue , int DefNegEleValue ) +{ + int value; + + value = ( 100 * DefPosEleValue - 100 * DefNegEleValue ) / 1000; + + if( value > 10 ) + return 10; + else if( value < -10 ) + return -10; + + return value; +} + + + +int BATTLE_CalcCharaRatio( int AttEle , int charaidx ) +{ + int petidx , charahurt , pethurt; + int charaattr[4] , petattr[4]; + + // ûг + if( -1 == ( petidx = BATTLE_getRidePet( charaidx ) ) ) + return 10; + + // Nuke 20040330: Fix bug + if ( -1 == AttEle ) + return 5; + + BATTLE_GetPureAttr( charaidx , &charaattr[2] , &charaattr[1] , &charaattr[0], &charaattr[3] ); + BATTLE_GetPureAttr( petidx , &petattr[2] , &petattr[1] , &petattr[0] , &petattr[3] ); + + //print("\nAttEle: %d %d %d %d %d ",AttEle, charaattr[( AttEle + 1 ) % 4], charaattr[AttEle],petattr[( AttEle + 1 ) %4] , petattr[AttEle]); + + charahurt = 20 + BATTLE_CalAttMagicEffect( AttEle , charaattr[( AttEle + 1 ) % 4] , charaattr[AttEle] ); + pethurt = 20 + BATTLE_CalAttMagicEffect( AttEle , petattr[( AttEle + 1 ) %4] , petattr[AttEle] ); + + charahurt = 10 * charahurt / ( charahurt + pethurt ); + + if( charahurt < 2 ) + return 2; + else if( charahurt > 8 ) + return 8; + + return charahurt; +} + +static int BATTLE_AttrCalc( + int My_Fire, // д(ĤҰ»õ) + int My_Water, + int My_Earth, + int My_Wind, + int My_None, + int Vs_Fire, // 촡 + int Vs_Water, + int Vs_Earth, + int Vs_Wind, + int Vs_None +) +{ + int iRet = 0; + + // ܼ £ + My_Fire = My_Fire * Vs_None * AJ_UP // + + My_Fire * Vs_Fire * AJ_SAME // Ԫ + + My_Fire * Vs_Water * AJ_DOWN // + + My_Fire * Vs_Earth * AJ_SAME // Ԫ + + My_Fire * Vs_Wind * AJ_UP; // + + // £ + My_Water = My_Water * Vs_None * AJ_UP // + + My_Water * Vs_Fire * AJ_UP // + + My_Water * Vs_Water * AJ_SAME // Ԫ + + My_Water * Vs_Earth * AJ_DOWN // + + My_Water * Vs_Wind * AJ_SAME; // Ԫ + + // + My_Earth = My_Earth * Vs_None * AJ_UP // + + My_Earth * Vs_Fire * AJ_SAME // Ԫ + + My_Earth * Vs_Water * AJ_UP // + + My_Earth * Vs_Earth * AJ_SAME // Ԫ + + My_Earth * Vs_Wind * AJ_DOWN; // + + // + My_Wind = My_Wind * Vs_None * AJ_UP // + + My_Wind * Vs_Fire * AJ_DOWN // + + My_Wind * Vs_Water * AJ_SAME // Ԫ + + My_Wind * Vs_Earth * AJ_UP // + + My_Wind * Vs_Wind * AJ_SAME; // Ԫ + + // + My_None = My_None * Vs_None * AJ_SAME // Ԫ + + My_None * Vs_Fire * AJ_DOWN // + + My_None * Vs_Water * AJ_DOWN // + + My_None * Vs_Earth * AJ_DOWN // + + My_None * Vs_Wind * AJ_DOWN; // + + // + iRet = (My_Fire + My_Water + My_Earth + My_Wind + My_None) ; + + // ңȾԻƥ ئ׼ƥг + return (iRet * D_ATTR); +} + +extern float BATTLE_FieldAttAdjust(int battleindex,int pAt_Fire,int pAt_Water,int pAt_Earth,int pAt_Wind); +#ifndef _FIX_MAGICDAMAGE +static int BATTLE_AttrAdjust( + int attackindex, + int defindex, + int damage +) +{ + int At_Fire, At_Earth, At_Water, At_Wind, At_none; + int Df_Fire, Df_Earth, Df_Water, Df_Wind, Df_none; + float At_FieldPow, Df_FieldPow; + + BATTLE_GetAttr(attackindex,&At_Fire,&At_Water,&At_Earth,&At_Wind,&At_none); + + At_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ), + At_Fire, At_Water, At_Earth, At_Wind ); + + At_Fire *= damage; At_Water *= damage; At_Earth *= damage; + At_Wind *= damage; At_none *= damage; + BATTLE_GetAttr( defindex, &Df_Fire, &Df_Water, + &Df_Earth,&Df_Wind, &Df_none ); + Df_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ), + Df_Fire, Df_Water, Df_Earth, Df_Wind ); + damage = BATTLE_AttrCalc( + At_Fire, At_Water, At_Earth, At_Wind, At_none, + Df_Fire, Df_Water, Df_Earth, Df_Wind, Df_none ); + damage *= (At_FieldPow / Df_FieldPow); + return damage; +} +#endif +// +// return: 0:û 1: +int BATTLE_MagicDodge(int charindex,int nDefKind,int nFieldAttr) +{ + float fLuck = 0,fResist = 0; +#ifdef _EQUIT_DEFMAGIC + float Dluck=0.0; +#endif + int charType = CHAR_getInt( charindex, CHAR_WHICHTYPE); + // Ƿ + if( charType == CHAR_TYPEPLAYER ){ + fLuck = (float)CHAR_getInt( charindex, CHAR_LUCK) * 3; + fResist = (float)CHAR_getInt( charindex, CHAR_EARTH_RESIST + nFieldAttr) * 0.15; + fLuck += fResist; +#ifdef _EQUIT_DEFMAGIC + Dluck = (float)(CHAR_getWorkInt( charindex, CHAR_EQUITQUIMAGIC)*0.9); + fLuck += Dluck; +#endif + }else {// Ƿdz + fLuck = (float)CHAR_getInt( charindex, CHAR_LV) * 0.2; + if(fLuck > 30) fLuck = 30; + } + if(rand()%100+1 > (int)fLuck) + return 0; + else + return 1; +} + + +#define DEF_MAGIC_NUM 4 + +extern void BATTLE_changeRideImage( int index ); + +#ifdef _FIX_MAGICDAMAGE +void BATTLE_MultiAttMagic( int battleindex, int attackNo, int toNo, + int attIdx ,int FieldAttr ,int Power, int MagicLv) +#else +void BATTLE_MultiAttMagic( int battleindex, int attackNo, int toNo , int attIdx, + int FieldAttr , int Power) +#endif +{ + int list[SIDE_OFFSET * 2 + 1]; + int listidx,i,j,k,z; + int basex , basey , magicattidx,def_is_player[10],def_be_hit[10]; + int att_magic_lv[4]; + int def_magic_resist[DEF_MAGIC_NUM]; + int attvalue , charahp , pethp , charaidx , petidx , charahurt,pet_att_lv = 1,pet_def_lv = 1,charahurt_temp; + char szcommand[256]; + int AttIsPlayer=0,DefIsPlayer=0; + int getexp = 0; + +#ifndef _FIX_MAGICDAMAGE + int att_magic_exp_add,att_magic_exp_sub,def_magic_exp_add,def_magic_exp_sub; + int lv_up_exp,DefFieldAttr = 0; + float temp = 0.0f; +// int attattr[5], defattr[5]; + char msgbuf[64]; + char kind[4][3] = {"","ˮ","",""}; +#else + BOOL TrueMagic=FALSE; +#endif + + // terry + + if((z = BATTLE_MultiList(battleindex,toNo,list)) == -1) + return; + else + { + if(z != toNo) toNo = z; + } + BATTLE_AttMagicEffect( battleindex , attackNo , list , attIdx ); + // 㹥嵥 + if( attackNo < 10 ) + magicattidx = attIdx * 2 + 1; + else + magicattidx = attIdx * 2; + listidx = 0; + memset(def_is_player,-1,sizeof(def_is_player)); + memset(def_be_hit,-1,sizeof(def_be_hit)); + // ˹ + if( toNo < 20 ){ + toNo = list[0]; + basex = CharTableIdx[toNo][1]; + basey = CharTableIdx[toNo][0]; + + for( i = 0 , j = basey - 1 ; j <= basey + 1 ; i++ , j++ ){ + if( toNo < 10 && ( j < 2 || j > 3 ) ) + continue; + else if( toNo >= 10 && ( j < 0 || j > 1 ) ) + continue; + // ЩҪ嵥 + for( k = 0 ; k < 5 ; k++ ){ + if( basex - 2 + k < 0 || basex - 2 + k > 4 ) + continue; + + if( ATTMAGIC_magic[magicattidx].siField[i][k] && TRUE == BATTLE_TargetCheck( battleindex , CharTable[j][basex - 2 + k] ) ) + { + list[listidx] = CharTable[j][basex - 2 + k]; + listidx++; + } + } + } + }else if( 20 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if( ATTMAGIC_magic[magicattidx].siField[i][j] && TRUE == BATTLE_TargetCheck( battleindex , CharTable[i + 2][j] ) ){ + list[listidx] = CharTable[i + 2][j]; + listidx++; + } + } + } + }else if( 21 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if( ATTMAGIC_magic[magicattidx].siField[i][j] && TRUE == BATTLE_TargetCheck( battleindex , CharTable[i][j] ) ){ + list[listidx] = CharTable[i][j]; + listidx++; + } + } + } + } + // ϵһ , ϵڶ , µһ , µڶ + else if( 23 == toNo || 24 == toNo || 25 == toNo || 26 == toNo ){ + basey = toNo - 23; + + for( i = 0 , j = basey - 1 ; j <= basey + 1 ; i++ , j++ ){ + if( ( 25 == toNo || 26 == toNo ) && ( j < 2 || j > 3 ) ) + continue; + else if( ( 23 == toNo || 24 == toNo ) && ( j < 0 || j > 1 ) ) + continue; + + // ЩҪ嵥 + for( k = 0 ; k < 5 ; k++ ){ + if( ATTMAGIC_magic[magicattidx].siField[i][k] && TRUE == BATTLE_TargetCheck( battleindex , CharTable[j][k] ) ) + { + list[listidx] = CharTable[j][k]; + listidx++; + } + } + } + } + + qsort( list , listidx , sizeof( list[0] ) , ( FUNC )SortLoc );// λ + // ȡ(һdz) + //BATTLE_GetAttr( BATTLE_No2Index( battleindex , attackNo ) , &attattr[2] , &attattr[1] , &attattr[0] , &attattr[3] , &attattr[4] ); + // ,ȡħȼħ + { + int attType = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo),CHAR_WHICHTYPE); + int Check=0; + AttIsPlayer=0; + if( attType == CHAR_TYPEPLAYER) { + AttIsPlayer = 1; + for(i=0;i<4;i++){ // att_magic_lv[i]: i = 0: 1:ˮ 2: 3: + att_magic_lv[i] = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_EXP+i); + } + }else if( attType == CHAR_TYPEENEMY ) { + for(i=0;i<4;i++){ + att_magic_lv[i] = (CHAR_getInt(BATTLE_No2Index(battleindex,attackNo), CHAR_LV)*0.9); + } + }else { +#ifdef _FIX_MAGICDAMAGE + AttIsPlayer = 1; +#endif + for(i=0;i<4;i++){ +#ifdef _FIX_MAGICDAMAGE + att_magic_lv[i] = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_EXP+i); +#else + att_magic_lv[i] = 0; +#endif + } + } + Check = rand()%100; +#ifdef _FIX_MAGICDAMAGE + if( Check > att_magic_lv[ FieldAttr] ) TrueMagic = FALSE; + else TrueMagic = TRUE; +#endif + } + pet_att_lv = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo), CHAR_LV); + z = 0; + for(i=0;i 0 ){ + float def = (float)(CHAR_getWorkInt( charaidx, CHAR_OTHERSTATUSNUMS )); + def = def/100; + for(j=0;j 0) { + CHAR_setWorkInt(def_be_hit[i],CHAR_WORKSLEEP,0); + z = BATTLE_Index2No(battleindex,def_be_hit[i]); + sprintf(szcommand,"BM|%X|%X|",z,0); + BATTLESTR_ADD(szcommand); + + } + } +#else + //TrueMagic == FALSE + // ľֵ----------------------------------------------------------------------------- + if(AttIsPlayer){ + // ˵ħ + DefFieldAttr = (FieldAttr+1)%4; + // ȡõħľֵ + att_magic_exp_add = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_ATTMAGIC_EXP+FieldAttr); + // ȡõħıħֵ + att_magic_exp_sub = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_ATTMAGIC_EXP+DefFieldAttr); + // ʹõħӸԵexp,ֻ㼸exp + att_magic_exp_add += getexp; + // ʹõħ۱Եexp,ֻۼexp + att_magic_exp_sub -= getexp; + lv_up_exp = Magic_Level_Table[att_magic_lv[FieldAttr]]; + while(att_magic_exp_add >= lv_up_exp || att_magic_exp_sub < 0){ + // õħľֵڿ + if(att_magic_exp_add >= lv_up_exp){ + // 100 + if(att_magic_lv[FieldAttr] + 1 > 100){ + att_magic_lv[FieldAttr] = 100; + // ֵΪ0 + att_magic_exp_add = 0; + }else{ + att_magic_lv[FieldAttr]++; + // ڵľֵ۵˼õľֵ + att_magic_exp_add -= lv_up_exp; + snprintf(msgbuf,sizeof(msgbuf)," %s ħΪ %d",kind[FieldAttr],att_magic_lv[FieldAttr]); + CHAR_talkToCli(BATTLE_No2Index(battleindex,attackNo),-1,msgbuf,CHAR_COLORRED); + } + } + // õħħľֵڿԽ + if(att_magic_exp_sub < 0 ){ + // ȼѾ1 + if(att_magic_lv[DefFieldAttr] <= 1){ + att_magic_lv[DefFieldAttr] = 1; + // ֵΪ0 + att_magic_exp_sub = 0; + }else{ + att_magic_lv[DefFieldAttr]--; + // һȼľֵ۵ڵľֵ + att_magic_exp_sub = Magic_Level_Table[att_magic_lv[DefFieldAttr]] + att_magic_exp_sub; + snprintf(msgbuf,sizeof(msgbuf)," %s ħȽΪ %d",kind[DefFieldAttr],att_magic_lv[DefFieldAttr]); + CHAR_talkToCli(BATTLE_No2Index(battleindex,attackNo),-1,msgbuf,CHAR_COLORRED); + } + } + lv_up_exp = Magic_Level_Table[att_magic_lv[FieldAttr]]; + } + CHAR_setInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_EXP+FieldAttr,att_magic_lv[FieldAttr]); + CHAR_setInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_ATTMAGIC_EXP+FieldAttr,att_magic_exp_add); + CHAR_setInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_EXP+DefFieldAttr,att_magic_lv[DefFieldAttr]); + CHAR_setInt(BATTLE_No2Index(battleindex,attackNo),CHAR_EARTH_ATTMAGIC_EXP+DefFieldAttr,att_magic_exp_sub); + } + + // طľֵ----------------------------------------------------------------------------- + for(i=0;i= lv_up_exp || def_magic_exp_sub < 0){ + // طҶԴħĿԵľֵڿ + if(def_magic_exp_add >= lv_up_exp){ + // 100 + if(def_magic_resist[FieldAttr] + 1 > 100) def_magic_resist[FieldAttr] = 100; + else { + def_magic_resist[FieldAttr]++; + snprintf(msgbuf,sizeof(msgbuf)," %s ħΪ %d",kind[FieldAttr],def_magic_resist[FieldAttr]); + CHAR_talkToCli(charaidx,-1,msgbuf,CHAR_COLORRED); + } + // ֵΪ0 + def_magic_exp_add = 0; + } + // طҶԴħĿԵħľֵڿԽ + if(def_magic_exp_sub < 0 ) { + // ȼѾ1 + if(def_magic_resist[DefFieldAttr] <= 1) def_magic_exp_sub = 0; // ֵΪ0 + else { + def_magic_resist[DefFieldAttr]--; + // ֵһȼľֵ + def_magic_exp_sub = Magic_Level_Table[def_magic_resist[DefFieldAttr]]; + snprintf(msgbuf,sizeof(msgbuf)," %s ħԽΪ %d",kind[DefFieldAttr],def_magic_resist[DefFieldAttr]); + CHAR_talkToCli(charaidx,-1,msgbuf,CHAR_COLORRED); + } + } + lv_up_exp = Magic_Level_Table[def_magic_resist[FieldAttr]]; + } + CHAR_setInt(charaidx,CHAR_EARTH_RESIST+FieldAttr,def_magic_resist[FieldAttr]); + CHAR_setInt(charaidx,CHAR_EARTH_DEFMAGIC_EXP+FieldAttr,def_magic_exp_add); + CHAR_setInt(charaidx,CHAR_EARTH_RESIST+DefFieldAttr,def_magic_resist[DefFieldAttr]); + CHAR_setInt(charaidx,CHAR_EARTH_DEFMAGIC_EXP+DefFieldAttr,def_magic_exp_sub); + } + // ˯ + if(CHAR_getWorkInt(def_be_hit[i],CHAR_WORKSLEEP) > 0) { + CHAR_setWorkInt(def_be_hit[i],CHAR_WORKSLEEP,0); + z = BATTLE_Index2No(battleindex,def_be_hit[i]); + sprintf(szcommand,"BM|%X|%X|",z,0); + BATTLESTR_ADD(szcommand); + } + } +#endif +} + +#endif + +#ifdef _MAGIC_TOCALL +void BATTLE_MultiToCallDragonMagic( int battleindex, int attackNo, int toNo, + int attIdx ,int FieldAttr ,int Power, int ImageNo) +{ + int list[SIDE_OFFSET * 2 + 1]; + int listidx,i,j,k,z; + int /*basex , */basey , magicattidx,def_is_player[10],def_be_hit[10]; + int attvalue , charahp , pethp , charaidx , petidx , charahurt,charahurt_temp; + char szcommand[256]; + int /*AttIsPlayer = 0,*/DefIsPlayer = 0; + +#ifndef _FIX_MAGICDAMAGE + int att_magic_exp_add,att_magic_exp_sub,def_magic_exp_add,def_magic_exp_sub; + int lv_up_exp,DefFieldAttr = 0; + float temp = 0.0f; + char msgbuf[64]; +#else +#endif + + int icindex, ioindex; + // terry + if((z = BATTLE_MultiList(battleindex,toNo,list)) == -1) + return; + else{ + if(z != toNo) toNo = z; + } + + TOCALL_magic[attIdx].uiSpriteNum = ImageNo; + + BATTLE_ToCallDragonEffect( battleindex , attackNo , list , attIdx); + + // 㹥嵥 + if( attackNo < 10 ) + magicattidx = attIdx * 2 + 1; + else + magicattidx = attIdx * 2; + + + listidx = 0; + memset(def_is_player,-1,sizeof(def_is_player)); + memset(def_be_hit,-1,sizeof(def_be_hit)); + + // ˹ + if( toNo < 20 ){ + toNo = list[0]; + listidx++; + + } else if( 20 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[i + 2][j] ) ){ + list[listidx] = CharTable[i + 2][j]; + listidx++; + } + } + } + } else if( 21 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[i][j] ) ){ + list[listidx] = CharTable[i][j]; + listidx++; + } + } + } + } // ϵһ , ϵڶ , µһ , µڶ + else if( 23 == toNo || 24 == toNo || 25 == toNo || 26 == toNo ){ + basey = toNo - 23; + for( i = 0 , j = basey - 1 ; j <= basey + 1 ; i++ , j++ ){ + if( ( 25 == toNo || 26 == toNo ) && ( j < 2 || j > 3 ) ) + continue; + else if( ( 23 == toNo || 24 == toNo ) && ( j < 0 || j > 1 ) ) + continue; + // ЩҪ嵥 + for( k = 0 ; k < 5 ; k++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[j][k] ) ) + { + list[listidx] = CharTable[j][k]; + listidx++; + } + } + } + } + qsort( list , listidx , sizeof( list[0] ) , ( FUNC )SortLoc );// λ + for( i = 0 ; i < listidx ; i++ ) { + int defType; + charaidx = BATTLE_No2Index( battleindex , list[i] ); + petidx = BATTLE_getRidePet( charaidx ); + defType = CHAR_getInt(charaidx, CHAR_WHICHTYPE); + DefIsPlayer = 0; + if (defType == CHAR_TYPEPLAYER) { + DefIsPlayer = 1; + } + if (CHAR_createCharacter( 100354 /*image no*/, 100, 600, 370, 0, + &icindex, &ioindex, 0) == TRUE) { + +// CHAR_setInt( icindex, CHAR_STR, 100); + CHAR_setInt( icindex, CHAR_LUCK, 1); + CHAR_setWorkInt( icindex, CHAR_WORKATTACKPOWER, + Power ); + CHAR_setWorkInt( icindex, CHAR_WORKOTHERDMAGE, + 0); + + if (BATTLE_MagicDodge(charaidx, DefIsPlayer, FieldAttr)) { +// û + attvalue = 0; + } else { + if( 0 == TOCALL_magic[attIdx].uiAttackType ) {// ˹ + attvalue = BATTLE_DamageCalc(icindex, charaidx); + } + else { + attvalue = BATTLE_DamageCalc(icindex, charaidx); + } + } + CHAR_CharaDelete(icindex); + charahp = CHAR_getInt( charaidx , CHAR_HP ); + if (-1 == petidx || CHAR_getInt(petidx, CHAR_HP) <= 0) { +// û + if( ( charahp -= attvalue ) < 0 ) { + charahp = 0; + } + CHAR_setInt( charaidx , CHAR_HP , charahp ); + pethp = 0; + if( 0 == TOCALL_magic[attIdx].uiAttackType ) {// ˹ + sprintf( szcommand , "%X|%X|%X|%X|" , toNo , list[i] , attvalue , pethp); + } else + sprintf( szcommand , "%X|%X|%X|%X|" , list[i] , list[i] , attvalue , pethp); + }else{ + pethp = CHAR_getInt( petidx , CHAR_HP ); + charahurt = attvalue * BATTLE_CalcCharaRatio( FieldAttr , charaidx ) / 10; + + charahurt_temp = charahurt; + if( ( charahp -= charahurt ) < 0 ) + { + charahurt = charahp; + charahp = 0; + } + + attvalue = attvalue - charahurt; + if( ( pethp -= attvalue ) < 0) + { + pethp = 0; + // ûѪ˳ս + CHAR_setInt(charaidx,CHAR_RIDEPET,-1); + BATTLE_changeRideImage(charaidx); + CHAR_setWorkInt(charaidx,CHAR_WORKPETFALL,1); + } + CHAR_setInt( charaidx , CHAR_HP , charahp ); + CHAR_setInt( petidx , CHAR_HP , pethp ); + + charahurt = charahurt_temp; + + if( 0 == TOCALL_magic[attIdx].uiAttackType ) {// ˹ + sprintf( szcommand , "%X|%X|%X|%X|" , toNo , list[i] , charahurt , attvalue); + } else + sprintf( szcommand , "%X|%X|%X|%X|" , list[i] , list[i] , charahurt , attvalue); + + } + + BATTLESTR_ADD( szcommand ); + } + } + + sprintf( szcommand , "%X|" , 0x5711438 ); + BATTLESTR_ADD( szcommand ); + +} + +#endif + +//*********************************************************** +// +// ܷƥ Ѽƽҷëٽ +// +void BATTLE_MultiRessurect( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int power, // + int per, // Ѿ + int UseEffect, // мް + int RecevEffect // ľмް +) +// +//*********************************************************** +{ + int i, toindex, UpPoint = 0, workhp; + int ToList[SIDE_OFFSET*2+1]; + + //char szBuffer[256]=""; + char szCommand[256]; + + + BATTLE_MultiListDead( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + + // ٽ + for( i = 0; ToList[i] != -1; i ++ ){ + // 켰̼͵ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + // Ϸ߯Ի + if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P + && CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + ){ + continue; + } + + // ƻئľٽئ + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == FALSE ){ + continue; + } + + // ң + UpPoint = power; + + if( per ){ + // ѻң + UpPoint *= CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) * 0.01; + } + + if( power == 0 ){ + // + UpPoint = CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ); + }else{ + // ڱë (ᷴ) + UpPoint = RAND( (power*0.9), (power*1.1) ); + } + // ƥ֨ + UpPoint = max( 1, UpPoint ); + + workhp = CHAR_getInt( toindex, CHAR_HP ) + UpPoint; + + // ëئз + CHAR_setInt( toindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + + // + CHAR_setFlg( toindex, CHAR_ISDIE, 0 ); + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ָʶ", + // CHAR_getUseName( toindex ) ); + + // ú + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + // ()Ѩëľ + snprintf( szCommand, sizeof(szCommand), + "BL|r%X|h%X|", ToList[i], CHAR_getInt( toindex, CHAR_HP ) ); + + // ٯ ܰ + BATTLESTR_ADD( szCommand ); +/* + { int Sign, Damage; + Sign = (UpPoint >= 0)?(1):(0); + Damage = ABS( UpPoint ); + // ( )Ѩëľ + snprintf( szCommand, sizeof(szCommand), + "BD|r%X|%X|%X|d%X|", ToList[i], 0, Sign, Damage ); + } + // ٯ ܰ + BATTLESTR_ADD( szCommand ); +*/ + + // 缰 ƥͻئ + if( BattleArray[battleindex].norisk == 0 + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E + ){ + // ƥʸհëµ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRESSURECT ); + } + } + } + + return; + +} + +#ifdef _Item_ReLifeAct +void BATTLE_MultiReLife( int battleindex, int attackNo, int toNo, + int power, int RecevEffect ) +{ + int i, toindex, UpPoint = 0, workhp; + int ToList[SIDE_OFFSET*2+1]; + //char szBuffer[256]=""; + char szCommand[256]; + char buf1[256]; + + memset(szCommand, 0, sizeof(szCommand)); + BATTLE_MultiListDead( battleindex, toNo, ToList ); + + + //snprintf( szCommand, sizeof(szCommand), "Bj|"); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + //if( BattleArray[battleindex].type == BATTLE_TYPE_P_vs_P + //&& CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + // continue; + //} + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == FALSE ){ + continue; + } + UpPoint = power; + workhp = max( 1, UpPoint ); + + CHAR_setInt( toindex, CHAR_HP, min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + CHAR_setFlg( toindex, CHAR_ISDIE, 0 ); + //snprintf( szBuffer, sizeof(szBuffer), "(%s)ָʶ", CHAR_getUseName( toindex ) ); + snprintf( buf1, sizeof(buf1), + "BJ|a%X|m%X|e%X|e%X|FF|", + ToList[i], + CHAR_getInt( toindex, CHAR_MP ), + RecevEffect, //MyEffect, + 0 //ToEffect + ); + strcatsafe( szCommand,sizeof(szCommand), buf1); + + snprintf( buf1, sizeof(buf1), + "BL|r%X|h%X|", ToList[i], CHAR_getInt( toindex, CHAR_HP ) ); + strcatsafe( szCommand,sizeof(szCommand), buf1); + + if( BattleArray[battleindex].norisk == 0 + && BattleArray[battleindex].type == BATTLE_TYPE_P_vs_E ){ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + CHAR_PetAddVariableAi( toindex, AI_FIX_PETRESSURECT ); + } + } + } + //strcat( szCommand, "FF|"); + BATTLESTR_ADD( szCommand ); + return; +} +#endif + +void BATTLE_MultiStatusChange( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int status, // + int turn, // + int UseEffect, // мް + int RecevEffect, // ľмް + int Success // +) +{ + int i, toindex, charaindex; + int perStatus; + int ToList[SIDE_OFFSET*2+1]; + //char szBuffer[256]=""; + + BATTLE_MultiList( battleindex, toNo, ToList ); + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BATTLE_StatusAttackCheck( charaindex, + toindex, status, Success, 30, 1.0, &perStatus ) == FALSE ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)޷(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), + // aszStatusFull[status], + // perStatus + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + }else{ + CHAR_setWorkInt( toindex, StatusTbl[status], turn ); + + if( status == BATTLE_ST_PARALYSIS + || status == BATTLE_ST_SLEEP + || status == BATTLE_ST_STONE + || status == BATTLE_ST_BARRIER ){ + CHAR_setWorkInt( toindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)(%d%%)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), + // aszStatusFull[status], + // perStatus + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + BATTLE_BadStatusString( ToList[i], status ); + } + } + return; +} + +#ifdef _OTHER_MAGICSTAUTS +void BATTLE_MultiMagicStatusChange( int battleindex, int attackNo, int toNo, int status, int turn, + int UseEffect, int RecevEffect, int nums ) +{ + int i, j, toindex, charaindex; + int ToList[SIDE_OFFSET*2+1]; + + BATTLE_MultiList( battleindex, toNo, ToList ); + BATTLE_MagicEffect( battleindex, attackNo, ToList, UseEffect, RecevEffect ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + for( j=1; j 0 ){ + tostatus = j; + } + } + //======== ƥ ë ý ========== + if( tostatus == 0 ){// + // +// print("\n vincent--ܽ"); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ܽ", + // CHAR_getUseName( toindex ) ); + }else + // ϶ƥҷ + if( ( status == 0 && tostatus != 0 && tostatus <= CHAR_WORKCONFUSION ) // ϶ƥ//ҵ쳣 + || ( status == tostatus ) // ֻѨ + ){ + // + CHAR_setWorkInt( toindex, StatusTbl[tostatus], 0 ); +#ifdef _MAGIC_NOCAST + if( StatusTbl[tostatus] == CHAR_WORKNOCAST ){ + //print("\nvincent-->lssproto_NC_send"); + lssproto_NC_send( getfdFromCharaIndex( toindex ), 0);//Ĭ + } +#endif +// print("\n vincent--:%d",tostatus); + // + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), + // aszStatusFull[tostatus] + //); + // ƥ ٯ Ѩëľ + BATTLE_BadStatusString( ToList[i], 0 );//쳣 + + }else{ +// print("\n vincent--"); + // +/* snprintf( szBuffer, sizeof(szBuffer), + "(%s)(%s)", + CHAR_getUseName( toindex ), + aszStatusFull[status] + ); +*/ + } + // ú + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + + return; +} + +//*********************************************************** +// +// ܷƥ Ѽƽҷë ܷ +// +void BATTLE_MultiMagicDef( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int kind, // ܷ + int count, // + int UseEffect, // мް + int RecevEffect // ľмް +) +// +//*********************************************************** +{ + + int i, toindex, charaindex; + int ToList[SIDE_OFFSET*2+1]; + + //char szBuffer[256]=""; + + + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + CHAR_setWorkInt( toindex, MagicDefTbl[kind], count ); + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%s)", + // CHAR_getUseName( charaindex ), + // CHAR_getUseName( toindex ), + // aszMagicDefFull[kind] + //); + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + } + + return; + + + +} + + +#if 1 + +//*********************************************************** +// +// ܷƥ Ѽƽҷɷ¶ëƱ +// +void BATTLE_MultiParamChange( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int kind, // ɷ¶ + int power, // ̼ + int par, // ѻң + int UseEffect, // мް + int RecevEffect // ľмް +) +// +//*********************************************************** +{ + + int i, toindex, charaindex; + int ToList[SIDE_OFFSET*2+1]; + int res = 0, work; + //char szBuffer[256]=""; + + + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + + // ɷ¶¾ + for( i = 0; ToList[i] != -1; i ++ ){ + + // 켰̼͵ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + switch( kind ){ + case PC_KIND_ATTACK: + if( par ){ + // ѻңئ׻ߨ߷ئ + work = CHAR_getWorkInt( toindex, CHAR_WORKFIXSTR ); + work = work * power; + }else{ + // ңئ׻ߨ߾ + work = power * 100; + } + CHAR_setWorkInt( toindex, CHAR_WORKMODATTACK, + CHAR_getWorkInt( toindex, CHAR_WORKMODATTACK ) + work ); + res = work * 0.01; + break; + case PC_KIND_DEFENSE: + if( par ){ + // ѻңئ׻ߨ߷ئ + work = CHAR_getWorkInt( toindex, CHAR_WORKFIXTOUGH ); + work = work * power; + }else{ + // ңئ׻ߨ߾ + work = power * 100; + } + CHAR_setWorkInt( toindex, CHAR_WORKMODDEFENCE, + CHAR_getWorkInt( toindex, CHAR_WORKMODDEFENCE ) + work ); + res = work * 0.01; + break; + case PC_KIND_QUICK: + if( par ){ + // ѻңئ׻ߨ߷ئ + work = CHAR_getWorkInt( toindex, CHAR_WORKFIXDEX ); + work = work * power; + }else{ + // ңئ׻ߨ߾ + work = power * 100; + } + CHAR_setWorkInt( toindex, CHAR_WORKMODQUICK, + CHAR_getWorkInt( toindex, CHAR_WORKMODQUICK ) + work ); + res = work * 0.01; + break; + case PC_KIND_CHARM: + if( par ){ + // CHARM 100 ľئ׻100м + work = CHAR_getWorkInt( toindex, CHAR_WORKFIXCHARM ); + work = work * power * 0.01; + }else{ + // ң + work = power; + } + CHAR_setWorkInt( toindex, CHAR_WORKMODCHARM, + CHAR_getWorkInt( toindex, CHAR_WORKMODCHARM ) + work ); + res = work; + break; + case PC_KIND_CAPTURE: + // CAPTURE % + work = power; + CHAR_setWorkInt( toindex, CHAR_WORKMODCAPTURE, + CHAR_getWorkInt( toindex, CHAR_WORKMODCAPTURE ) + work ); + res = work; + break; + } + + // ƥ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)(%s)(%+d)", + // CHAR_getUseName( toindex ), + // aszParamChangeFull[kind], + // res + //); + + // ú + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + } + + return; +} + +#endif + + +//*********************************************************** +// +// ܷƥ Ѽ +// +void BATTLE_MultiAttReverse( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int UseEffect, // мް + int RecevEffect // ľмް +) +// +//*********************************************************** +{ + + int i, toindex, charaindex; + int ToList[SIDE_OFFSET*2+1]; + int flg, OnOff; + char szBuffer[256]=""; + + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, // ̼͵ + attackNo, // į( ) + ToList, // ľ į( ) + UseEffect, // оް + RecevEffect // ľоް + ); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + + // ɷ¶¾ + for( i = 0; ToList[i] != -1; i ++ ){ + + // 켰̼͵ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + flg = CHAR_getWorkInt( toindex, CHAR_WORKBATTLEFLG ); + flg ^= CHAR_BATTLEFLG_REVERSE; // + CHAR_setWorkInt( toindex, CHAR_WORKBATTLEFLG, flg ); + OnOff = ( flg & CHAR_BATTLEFLG_REVERSE )?(1):(0); + + // ƥʾ + BATTLE_AttReverse( toindex ); + + if( OnOff ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)Ա෴", + // CHAR_getUseName( toindex ) ); + }else{ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)ظԭԡ", + // CHAR_getUseName( toindex ) ); + } + + // ú + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + // ƥ  ٯ ë˪ + sprintf( szBuffer, "BR|%X|%X|", ToList[i], OnOff ); + BATTLESTR_ADD( szBuffer ); + } + + return; + +} + +void BATTLE_MultiCaptureUp( + int battleindex, + int attackNo, + int toNo, + int power, + int UseEffect, + int RecevEffect +) +{ + int i, toindex, UpPoint = 0, workhp; + int ToList[SIDE_OFFSET*2+1]; + + //char szBuffer[256]=""; + char szCommand[256]; + + BATTLE_MultiList( battleindex, toNo, ToList ); + + BATTLE_MagicEffect( + battleindex, + attackNo, + ToList, + UseEffect, + RecevEffect + ); + + for( i = 0; ToList[i] != -1; i ++ ){ + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + if( CHAR_getInt( toindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + continue; + } + + if( CHAR_getFlg( toindex, CHAR_ISDIE ) == TRUE ){ + continue; + } + + UpPoint = power; + + UpPoint = RAND( (power*0.9), (power*1.1) ); + + workhp = CHAR_getWorkInt( toindex, CHAR_WORKMODCAPTURE ) + UpPoint; + + CHAR_setWorkInt( toindex, CHAR_WORKMODCAPTURE, workhp ); + + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)IJʱ(%d)", + // CHAR_getUseName( toindex ), UpPoint ); + + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + snprintf( szCommand, sizeof( szCommand ), + "B%%|%X|%X|", ToList[i], BFUKI_CAPTUREUP ); + + BATTLESTR_ADD( szCommand ); + } + return; +} + + + + + +//**************************************************************** +// +// ū +// +int BATTLE_FieldAttChange( + int charaindex, // м̼͵ + char *pArg +) +// +// ľ TRUE +// ئ FALSE +// +//**************************************************************** + +{ + + int attr = -1, i, attackNo, turn = 3; + int battleindex, power = 30; + int FieldAttr[] = { BATTLE_ATTR_NONE, BATTLE_ATTR_EARTH, BATTLE_ATTR_WATER, BATTLE_ATTR_FIRE, BATTLE_ATTR_WIND }; + char szCommand[256], + // Robin 03/20 debug + //*pszP, *aszAttr[] = { "", "", "ˮ", "", "" }; + *pszP, *aszAttr[] = { "", "", "ˮ", "", "" }; + // Robin 03/21 debug + //char szTurn[] = ""; + char szTurn[] = "turn"; + + + pszP = pArg; + // ë + for( ;attr == -1 && pszP[0] != 0; pszP++ ){ + for( i = 0; i < 5; i ++ ){ + // + if( strncmp( pszP, aszAttr[i], 2 ) == 0 ){ + attr = i; + pszP +=2; + break; + } + } + } + // мƥ + if( attr == -1 ) + { + return FALSE; + } + + // ľ ʽ¾ + sscanf( pszP, "%d", &power ); + if( power < 0 || power > 100 )power = 30; + + // ʽ¾ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( BATTLE_CHECKINDEX( battleindex ) == FALSE )return FALSE; + // + BattleArray[battleindex].field_att = FieldAttr[attr]; + // Ĥɷ + BattleArray[battleindex].att_pow = power; + // Ĥ + BattleArray[battleindex].att_count = turn; + + // ƥ + if( attr >= 0 ){ + //snprintf( szBuffer, sizeof(szBuffer), + // "(%s)fieldԸΪ(%s)", + // CHAR_getUseName( charaindex ), + // aszAttr[attr] + //); + } + + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // ú + //BATTLE_BroadCast( battleindex, szBuffer, + // (attackNo >= 10)? CHAR_COLORGRAY : CHAR_COLORPURPLE ) ; + + // ƥ ٯ Ѩëľ + sprintf( szCommand, "BV|%X|%X|",attackNo, attr ); + BATTLESTR_ADD( szCommand ); + + return TRUE; + +} + + + + +//**************************************************************** +// +// ū +// +int MAGIC_FieldAttChange_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵( ) + int marray, // magicindex + int mp // MP +) +// ľ TRUE +// ئ FALSE +// +//**************************************************************** + +{ + char *pArg; + + // ɷ¶ë + pArg = MAGIC_getChar( marray, MAGIC_OPTION ); + // ɷ¶ мƥ + if( pArg == "\0" )return FALSE; + + return BATTLE_FieldAttChange( charaindex, pArg ); + +} +//**************************************************************** +// +// ëܸ +// +int MAGIC_StatusChange_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** + +{ + char *magicarg; + int status = -1, i, attackNo, turn = 3; + int battleindex, ReceveEffect, Success = 15; + char *pszP; + char szTurn[] = "turn"; + char szSuccess[] = ""; + + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + pszP = magicarg; + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + if( status == -1 ) return FALSE; + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; // 巴ľ + }else{ + ReceveEffect = SPR_hoshi; // 巴ľ + } + + BATTLE_MultiStatusChange( battleindex, attackNo, toNo, + status, turn, MAGIC_EFFECT_USER, ReceveEffect, Success ); + + + return TRUE; + +} + +#ifdef _MAGIC_DEEPPOISON +int MAGIC_StatusChange_Battle2( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** + +{ + char *magicarg; + int status = -1, i, attackNo, turn = 3; + int battleindex, ReceveEffect, Success = 15; + char *pszP; + char szTurn[] = "turn"; + char szSuccess[] = ""; + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + // ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + // ྮո + for( i = 1; i < BATTLE_ST_END; i ++ ){ + // + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( status == -1 ) return FALSE; + + // ʽ¾ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + // ɬ + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + if( status == BATTLE_ST_NONE ){ + ReceveEffect = SPR_tyusya; // 巴ľ + }else{ + ReceveEffect = SPR_hoshi; // 巴ľ + } + // 幻 + BATTLE_MultiStatusChange( battleindex, attackNo, toNo, + status, turn+2, MAGIC_EFFECT_USER, ReceveEffect, Success ); + return TRUE; +} +#endif +#ifdef _OTHER_MAGICSTAUTS +int MAGIC_MagicStatusChange_Battle( int charaindex, int toNo, int marray, int mp ) +{ + char *magicarg; + int status = -1, i, attackNo, turn = 3, nums=0; + int battleindex, ReceveEffect; + char buf1[256]; + + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + if( getStringFromIndexWithDelim( magicarg,"|",1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + for( i=0; i= 20 ) + return FALSE; + } + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + //ͼž +#define SPR_mic_def 101411 + ReceveEffect = SPR_heal2; + if( status == 1 ) + ReceveEffect = SPR_mic_def; +#ifdef _MAGICSTAUTS_RESIST + else if( status == 3 ) + ReceveEffect = 101802; + else if( status == 4 ) + ReceveEffect = 101804; + else if( status == 5 ) + ReceveEffect = 101803; +#endif + //else{ + // ReceveEffect = SPR_hoshi; + //} + + BATTLE_MultiMagicStatusChange( + battleindex, attackNo, toNo, status, + turn, MAGIC_EFFECT_USER, ReceveEffect, nums ); + + return TRUE; +} +#endif + + +int MAGIC_MagicDef_Battle( + int charaindex, + int toNo, + int marray, + int mp +) +{ + char *magicarg; + int status = -1, i, attackNo, turn = 3; + int battleindex; + char *pszP; + + char szTurn[] = "turn"; + + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + pszP = magicarg; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + if( strncmp( pszP, aszMagicDef[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return FALSE; + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + BATTLE_MultiMagicDef( battleindex, attackNo, toNo, + status, turn, MAGIC_EFFECT_USER, SPR_difence ); + + + return TRUE; +} + + + + + + + +#if 1 + +//**************************************************************** +// +// ɷ¶ ëܸ +// +int MAGIC_ParamChange_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** + +{ + char *magicarg; + int kind = -1, i, attackNo; + int battleindex, pow, par = 0; + + char *pszP; + + // ɷ¶ë //ħ + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + pszP = magicarg; + // ë //ȡøIJ(,,,,,) + for( ;kind == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + // + if( strncmp( pszP, aszParamChange[i], 2 ) == 0 ){ + kind = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( kind == -1 ) return FALSE; + + if( strstr( pszP, "%" ) ){ // ѻң + par = 1; + } + + if( sscanf( pszP, "%d", &pow ) != 1 ){ + // Ϻ̼ؤ¾ + pow = 30; + } + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiParamChange( battleindex, attackNo, toNo, + kind, pow, par, MAGIC_EFFECT_USER, SPR_hoshi ); + + + return TRUE; +} + + + +#endif + + + + + + + +//**************************************************************** +// +// м ëܸ +// +int MAGIC_AttReverse_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** + +{ + int attackNo; + int battleindex; + + // ɷ¶ἰǷ + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiAttReverse( battleindex, attackNo, toNo, + MAGIC_EFFECT_USER, SPR_kyu ); + + + return TRUE; +} + + + +//**************************************************************** +// +// ë +// +int MAGIC_StatusRecovery_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** +{ + char *magicarg; + int status = -1, i, attackNo; + int battleindex, ReceveEffect; + char *pszP; + + // ɷ¶ë + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + pszP = magicarg; + // ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + // ؤ¼ƥ߾ո + for( i = 0; i < BATTLE_ST_END; i ++ ){ + // + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + // ئмƥ + if( status == -1 ) return FALSE; + + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + ReceveEffect = SPR_tyusya; // 巴ľ + + // 幻 + BATTLE_MultiStatusRecovery( battleindex, attackNo, toNo, + status, MAGIC_EFFECT_USER, ReceveEffect ); + + + return TRUE; + +} + + +//**************************************************************** +// +// 姾 +// +int MAGIC_Ressurect_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** +{ + char *magicarg; + int attackNo, ReceveEffect; + int battleindex, pow = 0, par = 0; + + char *pszP; + + // ɷ¶ë + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + pszP = magicarg; + + if( strstr( pszP, "%" ) ){ // ѻң + par = 1; + } + if( sscanf( pszP, "%d", &pow ) != 1 ){ + // Ϻ̼¾ + pow = 0; // ߼ + } + + if( pow <= 0 ){ + ReceveEffect = SPR_fukkatu3; + }else + if( pow <= 100 ){ + ReceveEffect = SPR_fukkatu1; + }else + if( pow <= 300 ){ + ReceveEffect = SPR_fukkatu2; + }else{ + ReceveEffect = SPR_fukkatu3; + } + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiRessurect( battleindex, attackNo, toNo, + pow, par, MAGIC_EFFECT_USER, ReceveEffect ); + + return TRUE; +} + + +int MAGIC_ResAndDef_Battle( + int charaindex, + int toNo, + int marray, + int mp +) +{ + char *magicarg; + int attackNo, i; + int battleindex, pow = 0, par = 0, turn = 3, status = -1; + // Robin 03/21 debug + //char szTurn[] = ""; + char szTurn[] = "turn"; + + char *pszP; + +// Terry add 2004/12/7 + // ..ʹõз + battleindex = CHAR_getWorkInt(charaindex, CHAR_WORKBATTLEINDEX); + if(CHAR_getInt(charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + if(BATTLE_CheckSameSide(charaindex, toNo) == 0) //ͬ + { + battleindex = CHAR_getWorkInt(charaindex, CHAR_WORKBATTLEINDEX); + BATTLE_NoAction(battleindex, BATTLE_Index2No(battleindex, charaindex)); + CHAR_talkToCli(charaindex, -1, "⾵..ʩҵз", CHAR_COLORYELLOW); + return FALSE; + } + } +// end + // ɷ¶ë + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + pszP = magicarg; + + if( strstr( pszP, "%" ) ){ // ѻң + par = 1; + } + if( sscanf( pszP, "%d", &pow ) != 1 ){ + // Ϻ̼¾ + pow = 0; // ߼ + } + + // ܰ ܷ ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_MD_END; i ++ ){ + char *p; + // + p = strstr( pszP, aszMagicDef[i] ); + if( p != NULL ){ + status = i; + pszP = p; + break; + } + } + } + + // ئмƥ + if( status == -1 ) return FALSE; + + // ϼ ʽ¾ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiResAndDef( battleindex, attackNo, toNo, + pow, par, status, turn, MAGIC_EFFECT_USER, SPR_difence ); + + return TRUE; +} + +#ifdef _ATTACK_MAGIC + +int MAGIC_AttMagic_Battle( int charaindex , int toNo , int marray , int mp ) +{ + int attno , attidx , battleindex; + int attr = -1, i , power; + char aszattr[][32] = { "", "ˮ", "", "" }; + char buf1[256]; + char *magicarg; + int magiclv=0; + magicarg = MAGIC_getChar( marray , MAGIC_OPTION ); + if( magicarg == "\0" ) { + print("\n Magic magicarg == NULL "); + return FALSE; + } + + for( i=0; i<4; i++) { + if( strstr( magicarg, aszattr[i]) != NULL ) { + attr = i; + break; + } + } + if( i == 4 ) { + //print("\n not find aszattr !!"); + return FALSE; + } + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( magicarg, "|", 2, buf1, sizeof( buf1)) == FALSE ) return FALSE; + power = atoi( buf1); + + if( getStringFromIndexWithDelim( magicarg, "|", 3, buf1, sizeof( buf1)) == FALSE ) return FALSE; + magiclv = atoi( buf1); + + battleindex = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEINDEX ); + attno = BATTLE_Index2No( battleindex , charaindex ); + attidx = MAGIC_getInt( marray , MAGIC_IDX ); + if( -1 == attidx || attidx >= ATTMAGIC_magicnum ) + return FALSE; +#ifdef _FIX_MAGICDAMAGE + BATTLE_MultiAttMagic( battleindex , attno , toNo , attidx , attr , power, magiclv); +#else + BATTLE_MultiAttMagic( battleindex , attno , toNo , attidx , attr , power ); +#endif + return TRUE; +} + +#endif + + +#ifdef _MAGIC_TOCALL + +int MAGIC_ToCallDragon_Battle( int charaindex , int toNo , int marray , int mp ) +{ + int attno , attidx , battleindex; + int attr = -1,/* i , */power, imageno; +// char aszattr[][32] = { "", "ˮ", "", "" }; + char buf1[256]; + char *magicarg; + //int magiclv=0; + magicarg = MAGIC_getChar( marray , MAGIC_OPTION ); + + if( magicarg == "\0" ) { + //print("\n Magic magicarg == NULL "); + return FALSE; + } +/* + for( i=0; i<4; i++) { + if( strstr( magicarg, aszattr[i]) != NULL ) { + attr = i; + break; + } + } + if( i == 4 ) { + print("\n not find aszattr !!"); + return FALSE; + } +*/ + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( magicarg, "|", 1, buf1, sizeof( buf1)) == FALSE ) return FALSE; + imageno = atoi( buf1); + if( getStringFromIndexWithDelim( magicarg, "|", 2, buf1, sizeof( buf1)) == FALSE ) return FALSE; + power = atoi( buf1); + + battleindex = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEINDEX ); + attno = BATTLE_Index2No( battleindex , charaindex ); + attidx = MAGIC_getInt( marray , MAGIC_IDX ); + if( -1 == attidx || attidx >= ATTMAGIC_magicnum ) + return FALSE; + + BATTLE_MultiToCallDragonMagic( battleindex , attno , toNo , attidx , attr , power, imageno); + + return TRUE; +} + +#endif + +//**************************************************************** +// +// +// +int MAGIC_CaptureUp_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +) +// TRUE +// FALSE +//**************************************************************** +{ + char *magicarg; + int attackNo, ReceveEffect; + int battleindex, pow = 5; + + // ɷ¶ë + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + + if( sscanf( magicarg, "%d", &pow ) != 1 ){ + // Ϻ̼¾ + pow = 5; + } + + ReceveEffect = SPR_hoshi; + + // į + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + + // 幻 + BATTLE_MultiCaptureUp( battleindex, attackNo, toNo, + pow, MAGIC_EFFECT_USER, ReceveEffect ); + + return TRUE; +} +#ifdef _FIX_MAGICDAMAGE +static int BATTLE_getMagicAdjustInt( int attackindex, int defindex, int MagicLv, int flg,int damage ) +{ + int At_Fire, At_Earth, At_Water, At_Wind, At_none; + int Df_Fire, Df_Earth, Df_Water, Df_Wind, Df_none; + float At_FieldPow, Df_FieldPow; + //ȡʩ + BATTLE_GetAttr(attackindex,&At_Fire,&At_Water,&At_Earth,&At_Wind,&At_none); + MagicLv *=10; + switch( flg) { //ûΪħǣ + case 0: + At_Earth = MagicLv+(MagicLv*(At_Earth/50)); + At_Water=0; At_Fire=0; At_Wind=0; + break; + case 1: + At_Water = MagicLv+(MagicLv*(At_Water/50)); + At_Earth=0; At_Fire=0; At_Wind=0; + break; + case 2: + At_Fire = MagicLv+(MagicLv*(At_Fire/50)); + At_Earth=0; At_Water=0; At_Wind=0; + break; + case 3: + At_Wind = MagicLv+(MagicLv*(At_Wind/50)); + At_Earth=0; At_Water=0; At_Fire=0; + break; + } + //ȡøóԼӳ + At_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( attackindex, CHAR_WORKBATTLEINDEX ), + At_Fire, At_Water, + At_Earth, At_Wind ); + At_Fire *= damage; At_Water *= damage; At_Earth *= damage; + At_Wind *= damage; At_none *= damage; + //ȡ÷ط + BATTLE_GetAttr( defindex, &Df_Fire, &Df_Water, + &Df_Earth,&Df_Wind, &Df_none ); + //ȡøóԼӳ + Df_FieldPow = BATTLE_FieldAttAdjust( + CHAR_getWorkInt( defindex, CHAR_WORKBATTLEINDEX ), + Df_Fire, Df_Water, Df_Earth, Df_Wind ); + // + damage = BATTLE_AttrCalc( + At_Fire, At_Water, At_Earth, At_Wind, At_none, + Df_Fire, Df_Water, Df_Earth, Df_Wind, Df_none ); + damage *= (At_FieldPow / Df_FieldPow); + return damage; +} + +void Magic_ComputeAttExp( int charindex, int Mnum, int MagicLv, int Expoint) +{ + int magiclv1, magicex1; + int addEx = (MagicLv * 3) * Expoint; + char MagicStr[][128]={"","ˮ","",""}; + char buf1[256]; + memset( buf1, 0, sizeof( buf1)); + magiclv1 = CHAR_getInt( charindex, CHAR_EARTH_EXP+Mnum); + magicex1 = CHAR_getInt( charindex, CHAR_EARTH_ATTMAGIC_EXP+Mnum); + magicex1 += addEx; + if( magicex1 > 100 ) { + magicex1 = 0; + if( magiclv1 < 100 ) { + magiclv1 += 1; + sprintf( buf1,"%sħΪ%d", MagicStr[Mnum], magiclv1); + CHAR_talkToCli( charindex, -1, buf1, CHAR_COLORYELLOW); + } + } + if( magicex1 < 0 ) magicex1 = 0; + if( magiclv1 < 0 ) magiclv1 = 0; + if( magiclv1 > 100 ) magiclv1 = 100; + CHAR_setInt( charindex, CHAR_EARTH_EXP+Mnum, magiclv1); + CHAR_setInt( charindex, CHAR_EARTH_ATTMAGIC_EXP+Mnum, magicex1); + + Mnum = (Mnum+1)%4; //˵ħ + magiclv1 = CHAR_getInt( charindex, CHAR_EARTH_EXP+Mnum); + magicex1 = CHAR_getInt( charindex, CHAR_EARTH_ATTMAGIC_EXP+Mnum); + if( magiclv1 > 1 ) { + magicex1 -= addEx*0.5; + if( magicex1 < 0 ) { + magicex1 = 0; + magiclv1 -= 1; + if( magiclv1 < 0 ) magiclv1 = 0; + CHAR_setInt( charindex, CHAR_EARTH_EXP+Mnum, magiclv1); + sprintf( buf1,"%sħ½Ϊ%d", MagicStr[Mnum], magiclv1); + CHAR_talkToCli( charindex, -1, buf1, CHAR_COLORYELLOW); + } + CHAR_setInt( charindex, CHAR_EARTH_ATTMAGIC_EXP+Mnum, magicex1); + } + return; +} + +void Magic_ComputeDefExp( int charindex, int Mnum, int MagicLv, int Damage) +{ + int magiclv1; + int magicex1; + int addEx; + char buf1[256]; + char MagicStr[][128]={"","ˮ","",""}; + if( Damage < 200 ) return; + memset( buf1, 0, sizeof( buf1)); + magiclv1 = CHAR_getInt( charindex, CHAR_EARTH_RESIST+Mnum); + magicex1 = CHAR_getInt( charindex, CHAR_EARTH_DEFMAGIC_EXP+Mnum); + addEx = (Damage/20)*(MagicLv*2); + magicex1+=addEx; + if( magiclv1 < 0 ) magiclv1 = 0; + if( magicex1 > 100 ) { + magicex1 = 0; + if( magiclv1 < 100 ) { + magiclv1 +=1; + if( magiclv1 < 0 ) magiclv1 = 0; + if( magiclv1 > 100 ) magiclv1 = 100; + CHAR_setInt( charindex, CHAR_EARTH_RESIST+Mnum, magiclv1); + sprintf( buf1,"%sħֵΪ%d", MagicStr[Mnum], magiclv1); + CHAR_talkToCli( charindex, -1, buf1, CHAR_COLORYELLOW); + } + } + if( magicex1 < 0 ) magicex1 = 0; + CHAR_setInt( charindex, CHAR_EARTH_DEFMAGIC_EXP+Mnum, magicex1); + Mnum = (Mnum+1)%4; //˵ħ + magiclv1 = CHAR_getInt( charindex, CHAR_EARTH_RESIST+Mnum); + magicex1 = CHAR_getInt( charindex, CHAR_EARTH_DEFMAGIC_EXP+Mnum); + if( magiclv1 > 1 ) { + magicex1 -=2; + if( magicex1 < 0 ) { + magicex1 = 90; + magiclv1 -=1; + if( magiclv1 < 0 ) + magiclv1 = 0; + sprintf( buf1,"%sħֵ½Ϊ%d", MagicStr[Mnum], magiclv1); + CHAR_talkToCli( charindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_setInt( charindex, CHAR_EARTH_RESIST+Mnum, magiclv1); + } + CHAR_setInt( charindex, CHAR_EARTH_DEFMAGIC_EXP+Mnum, magicex1); + } + return; +} + +#endif + +#ifdef _MAGIC_WEAKEN +int MAGIC_ParamChange_Turn_Battle( + int charaindex, + int toNo, + int marray, + int mp +) +{ + char *magicarg; + int status = -1, i, attackNo, turn = 3; + int battleindex, Success = 15; + char *pszP; + char szTurn[] = "turn"; + char szSuccess[] = ""; + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + if( magicarg == "\0" ) { + //print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + // ë + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + // ྮո + for( i = 1; i < BATTLE_ST_END; i ++ ){ + // + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( status == -1 ) return FALSE; + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + BATTLE_MultiParamChangeTurn( battleindex, attackNo, toNo, status, MAGIC_EFFECT_USER, SPR_hoshi, turn, Success ); + return TRUE; +} + +void BATTLE_MultiParamChangeTurn( + int battleindex, + int attackNo, + int toNo, + int status, + int UseEffect, + int RecevEffect, + int turn, + int Success +) +{ + + int i, toindex,perStatus,charaindex; + int ToList[SIDE_OFFSET*2+1]; + charaindex = BATTLE_No2Index( battleindex, attackNo ); //index + BATTLE_MultiList( battleindex, toNo, ToList ); + + //ʩħЧ + BATTLE_MagicEffect(battleindex, attackNo, ToList, UseEffect, RecevEffect); + + for( i = 0; ToList[i] != -1; i ++ ) + { + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + + if( BATTLE_StatusAttackCheck( charaindex, + toindex, status, Success, 30, 1.0, &perStatus ) == TRUE ) + { + CHAR_setWorkInt( toindex, CHAR_WORKWEAKEN, turn+1 ); + } + } + return; + +} +#endif + + +/* +typedef struct tagToCallMagic +{ + unsigned int uiSpriteNum; // Spr_x.binı + unsigned int uiAttackType; // ķʽˣ( ) , ( ) , ( ͬʱ ) , ȫ( ) , ȫ( ͬʱ ) + unsigned int uiSliceTime; // ʱʱ + unsigned int uiShowType; // ʾλ÷ʽ롢ָ + int siSx; // ʾλ - X + int siSy; // ʾλ - Y + unsigned int uiShowBehindChar; // ʾǰ· + unsigned int uiShakeScreen; // Ƿ𶯻 + unsigned int uiShakeFrom; // 𶯻ʼʱ( ) + unsigned int uiShakeTo; // 𶯻Ľʱ( _ + unsigned int uiPrevMagicNum; // ǰ( 0XFFFFFFFFFF ʾǰ ) + int siPrevMagicSx; // ǰʾλ - X + int siPrevMagicSy; // ǰʾλ - Y + int siPrevMagicOnChar; // ǰʾǰ· + unsigned int uiPostMagicNum; // ( 0XFFFFFFFF ʾ ) + int siPostMagicSx; // ʾλ - X + int siPostMagicSy; // ʾλ - Y + int siPostMagicOnChar; // ʾǰ· + int isPostDisappear; // һ㹥ʱǷʧ + int ToCallMagicNo; // ٻı +}ToCallMagic; +*/ + +ToCallMagic PROFESSION_magic[3] = { {0,0,0,1,0,0,1,1,0,0,0,65528,65485,0,-1,0,0,0,1,0}, // + {0,3,0,1,0,0,1,1,0,0,0,65528,65485,0,-1,0,0,0,1,1}, // + {0,5,0,1,0,0,1,1,0,0,0,65528,65485,0,-1,0,0,0,0,2}, // ȫ + }; + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +void PROFESSION_MAGIC_ATTAIC( int battleindex, int attackNo, int toNo, int attIdx ,int FieldAttr, int skill) +{ + int list[SIDE_OFFSET * 2 + 1]; + int listidx,i,j,k,z; + int basey, def_is_player[10],def_be_hit[10]; + int attvalue , charahp , pethp , charaidx , petidx , charahurt,charahurt_temp; + char szcommand[256]; + int DefIsPlayer=0, power=0, skill_level; + float hp_power=0, mp_power=0, add_hp=0, add_mp=0, dec_hp=0, dec_mp=0; + int icindex, ioindex; + int charaindex, command, magic_type=0; +#ifdef _PROFESSION_ADDSKILL + int decmplist[]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, decmplistcount=0; +#endif + charaindex = BATTLE_No2Index(battleindex, attackNo); + if( !CHAR_CHECKINDEX(charaindex) ) return; + + if((z = BATTLE_MultiList(battleindex,toNo,list)) == -1) return; + else if(z != toNo){ + toNo = z; +// terry fix for 趨ΪµĿ 2004/02/10 + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM2,toNo); +// end + } + + // + command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1); + + // ܵȼ + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + // ħ붯 + magic_type = analysis_profession_parameter( attIdx, skill, toNo, charaindex ); + PROFESSION_MAGIC_ATTAIC_Effect( battleindex, attackNo, list, attIdx); + + listidx = 0; + memset(def_is_player,-1,sizeof(def_is_player)); + memset(def_be_hit,-1,sizeof(def_be_hit)); + + // ˹ + if( toNo < 20 ){ + toNo = list[0]; + listidx++; + + } else if( 20 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[i + 2][j] ) ){ + list[listidx] = CharTable[i + 2][j]; + listidx++; + } + } + } + } else if( 21 == toNo ){ // ȫ + for( i = 0 ; i < 2 ; i++ ){ + for( j = 0 ; j < 5 ; j++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[i][j] ) ){ + list[listidx] = CharTable[i][j]; + listidx++; + } + } + } + } // ϵһ , ϵڶ , µһ , µڶ + else if( 23 == toNo || 24 == toNo || 25 == toNo || 26 == toNo ){ + basey = toNo - 23; + for( i = 0 , j = basey - 1 ; j <= basey + 1 ; i++ , j++ ){ + if( ( 25 == toNo || 26 == toNo ) && ( j < 2 || j > 3 ) ) + continue; + else if( ( 23 == toNo || 24 == toNo ) && ( j < 0 || j > 1 ) ) + continue; + // ЩҪ嵥 + for( k = 0 ; k < 5 ; k++ ){ + if(TRUE == BATTLE_TargetCheck( battleindex , CharTable[j][k] ) ) + { + list[listidx] = CharTable[j][k]; + listidx++; + } + } + } + } + qsort( list , listidx , sizeof( list[0] ) , ( FUNC )SortLoc );// λ + + // ȡ + PROFESSION_MAGIC_GET_PRACTICE( &hp_power, &mp_power, &dec_hp, &dec_mp, charaindex ); + + + power = hp_power; + + // ȡ list + PROFESSION_MAGIC_TOLIST_SORT( list, &listidx, charaindex ); + + for( i = 0 ; i < listidx ; i++ ) { + int defType; + charaidx = BATTLE_No2Index( battleindex , list[i] ); + petidx = BATTLE_getRidePet( charaidx ); + defType = CHAR_getInt(charaidx, CHAR_WHICHTYPE); + DefIsPlayer = 0; + + if( !CHAR_CHECKINDEX(charaidx) ) continue; + + // ħЧ + if (CHAR_createCharacter( 100354, 777, 45, 45, 0, &icindex, &ioindex, 0) == TRUE){ + + CHAR_setInt( icindex, CHAR_LUCK, 1); + CHAR_setWorkInt( icindex, CHAR_WORKATTACKPOWER, power ); + CHAR_setWorkInt( icindex, CHAR_WORKOTHERDMAGE, 0 ); + + + // ħм춨 + if( PROFESSION_MAGIC_DODGE( charaindex, charaidx, magic_type ) == 1 ){ + // MISS + attvalue = 0; + }else{ + // ȡħ˺ֵ + power = PROFESSION_MAGIC_GET_ICE_MIRROR_DAMAGE( charaindex, charaidx, command, power ); +#ifdef _SUIT_ADDPART4 + if( CHAR_getWorkInt( charaidx, CHAR_WORKUNMPOWER ) > 0 ){//ֿʦħװ + power -= power * (CHAR_getWorkInt( charaidx, CHAR_WORKUNMPOWER )/100.00); +// print("\nWORKUNMPOWER:%d", CHAR_getWorkInt( charaidx, CHAR_WORKUNMPOWER )); + } +#endif + // ȡħ˺ֵ +#ifdef _PROFESSION_ADDSKILL + attvalue = PROFESSION_MAGIC_GET_DAMAGE( charaindex, charaidx, magic_type, power, command ); +#else + attvalue = PROFESSION_MAGIC_GET_DAMAGE( charaindex, charaidx, magic_type, power ); +#endif + // ı״̬ħ + PROFESSION_MAGIC_CHANGE_STATUS( charaindex, attvalue, mp_power, &add_hp, &add_mp ); + + // ⹥ + attvalue = PROFESSION_MAGIC_CHANG_STATUS( command, battleindex, charaindex, charaidx, attvalue, i ); + def_be_hit[i] = charaidx; + +#ifdef _PROFESSION_ADDSKILL + if( command == BATTLE_COM_S_STORM ){// ˮ + if( (PROFESSION_BATTLE_StatusAttackCheck( charaindex, charaidx, BATTLE_ST_WATER, 30 ) == 0 )// ״̬м춨 + || (CHAR_getInt( charaidx, CHAR_HP ) <= 0 ) ){ + + }else{ + int bid = BATTLE_Index2No( battleindex, charaidx ); + int watercount=0; + if( skill_level > 8 ) watercount=5; + else if( skill_level > 6 ) watercount=4; + else if( skill_level > 4 ) watercount=3; + else if( skill_level > 3 ) watercount=2; + else watercount=1; + CHAR_setWorkInt( charaidx, CHAR_WORKWATER, watercount ); + BATTLE_BadStatusString( bid, BATTLE_ST_WATER ); + } + } + + //¼idx + decmplist[decmplistcount++] = list[i]; +#endif + } + + // ħЧ + CHAR_CharaDelete(icindex); + + + charahp = CHAR_getInt( charaidx, CHAR_HP ); + + // û + if( -1 == petidx || CHAR_getInt(petidx, CHAR_HP) <= 0 ){ + if( ( charahp -= attvalue ) < 0 ){ + charahp = 0; + } + CHAR_setInt( charaidx , CHAR_HP , charahp ); + pethp = 0; + if( 0 == PROFESSION_magic[attIdx].uiAttackType ) {// ˹ + sprintf( szcommand , "%X|%X|%X|%X|" , toNo , list[i] , attvalue , pethp); + } else + sprintf( szcommand , "%X|%X|%X|%X|" , list[i] , list[i] , attvalue , pethp); + + }else{ + pethp = CHAR_getInt( petidx , CHAR_HP ); + charahurt = attvalue * BATTLE_CalcCharaRatio( FieldAttr , charaidx ) / 10; + + //µļ,ﱻ,Ѫ۵Ļ,Ὣ˺ۼ + charahurt_temp = charahurt; + if( ( charahp -= charahurt ) < 0 ) + { + charahurt = charahp; + charahp = 0; + } + + attvalue = attvalue - charahurt; + if( ( pethp -= attvalue ) < 0) + { + pethp = 0; + // ûѪ˳ս + CHAR_setInt(charaidx,CHAR_RIDEPET,-1); + BATTLE_changeRideImage(charaidx); + CHAR_setWorkInt(charaidx,CHAR_WORKPETFALL,1); + } + CHAR_setInt( charaidx , CHAR_HP , charahp ); + CHAR_setInt( petidx , CHAR_HP , pethp ); + + charahurt = charahurt_temp; + + if( 0 == PROFESSION_magic[attIdx].uiAttackType ) {// ˹ + sprintf( szcommand , "%X|%X|%X|%X|" , toNo , list[i] , charahurt , attvalue); + } else + sprintf( szcommand , "%X|%X|%X|%X|" , list[i] , list[i] , charahurt , attvalue); + } + + + { + //Change fix õDPֵ + int aAttackList[BATTLE_ENTRY_MAX*2+1]; + aAttackList[0] = attackNo; + aAttackList[1] = -1; + BATTLE_AddProfit( battleindex, aAttackList); + } + //change fix ޿ (зְսᶼòDPֵ,õ,ûϵ) + if( CHAR_getInt( charaidx, CHAR_HP ) <= 0 + && CHAR_getInt( charaidx, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + /*&& !BattleArray[battleindex].dpbattle*/ ) + CHAR_setFlg( charaidx, CHAR_ISDIE, 1 ); + + BATTLESTR_ADD( szcommand ); + } + } + + sprintf( szcommand , "%X|" , 0x5711438 ); + BATTLESTR_ADD( szcommand ); + +#ifdef _PROFESSION_ADDSKILL + //۵зmp + if( (int)mp_power != 0 ){ + for( i=0;i 0 ){ + int mp = CHAR_getInt( BATTLE_No2Index( battleindex , decmplist[i] ), CHAR_MP); + if( mp > 0 ){ + mp = mp_power>mp?mp:mp_power; + sprintf( szcommand, "BD|r%X|1|0|m%X|", decmplist[i], mp ); + BATTLESTR_ADD( szcommand ); + CHAR_setInt(BATTLE_No2Index( battleindex , decmplist[i] ), CHAR_MP, CHAR_getInt( BATTLE_No2Index( battleindex , decmplist[i] ), CHAR_MP) - mp); + } + } + } + } + } + if( command == BATTLE_COM_S_DOOM ){ //ĩ Ч + if( skill_level >= 10 ){ + for( i=0;i 0 ){ + CHAR_setWorkInt( BATTLE_No2Index( battleindex , decmplist[i] ), CHAR_WORKFEAR, 4 ); + BATTLE_BadStatusString( decmplist[i], BATTLE_ST_FEAR ); + sprintf( szcommand, "BD|r%X|0|6|%X|", decmplist[i], -20 );//30% + BATTLESTR_ADD( szcommand ); + // + sprintf( szcommand, "BD|r%X|0|4|%X|", decmplist[i], -10 ); + BATTLESTR_ADD( szcommand ); + // + sprintf( szcommand, "BD|r%X|0|5|%X|", decmplist[i], -10 ); + BATTLESTR_ADD( szcommand ); + } + } + } + } +#endif + if( (int)add_hp != 0 ){ + int hp=0; + + hp = CHAR_getInt( charaindex, CHAR_HP) + add_hp; + + if( hp >= CHAR_getWorkInt(charaindex, CHAR_WORKMAXHP) ){ + hp = CHAR_getWorkInt(charaindex, CHAR_WORKMAXHP); + add_hp = hp - CHAR_getInt( charaindex, CHAR_HP); + }else if ( hp <= 1 ){ + hp = 1; + add_hp = 1 - CHAR_getInt( charaindex, CHAR_HP); + } + CHAR_setInt(charaindex, CHAR_HP, hp); + + sprintf( szcommand, "BD|r%X|0|1|%X|", attackNo, (int)add_hp); + BATTLESTR_ADD( szcommand ); + } + + + if( (int)add_mp != 0 ){ + int mp=0; + + mp = CHAR_getInt( charaindex, CHAR_MP) + add_mp; + + if( mp >= CHAR_getWorkInt(charaindex, CHAR_WORKMAXMP) ){ + mp = CHAR_getWorkInt(charaindex, CHAR_WORKMAXMP); + add_mp = mp - CHAR_getInt( charaindex, CHAR_MP); + }else if ( mp <= 1 ){ + mp = 1; + add_mp = 1 - CHAR_getInt( charaindex, CHAR_MP); + } + + CHAR_setInt(charaindex, CHAR_MP, mp); + + sprintf( szcommand, "BD|r%X|1|1|m%X|", attackNo, (int)add_mp); + + BATTLESTR_ADD( szcommand ); + } +// Terry fix 2003/11/17 ˯˹Է + for(i=0; i 0) { + CHAR_setWorkInt(def_be_hit[i],CHAR_WORKSLEEP,0); + sprintf(szcommand,"BM|%X|%X|",BATTLE_Index2No(battleindex,def_be_hit[i]),0); + BATTLESTR_ADD(szcommand); + } + } +// Terry end +} + + +int PROFESSION_MAGIC_ATTAIC_Effect( int battleindex, int attackNo , int ToList[] , int AttackMgcNo ) +{ + int i; + char szcommand[256]; + int attackindex; + + + attackindex = BATTLE_No2Index( battleindex , attackNo ); + if( FALSE == CHAR_CHECKINDEX( attackindex ) ) + return 0; +#ifdef _PROFESSION_ADDSKILL + //if( CHAR_getWorkInt( attackindex, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_ICE_CRACK ) //Ч + // return 0; +#endif + snprintf( szcommand , sizeof( szcommand ) , "B$|a%X|i%X|m%X|%X|%X|%X|s%X|t%X|l%X|%X|%X|%X|%X|%X|%X|o%X|o%X|o%X|s%X|%X|%X|%X|%X|" , + attackNo , 5711438 , CHAR_getInt( attackindex , CHAR_MP ) , + PROFESSION_magic[AttackMgcNo].uiPrevMagicNum , + PROFESSION_magic[AttackMgcNo].uiSpriteNum , + PROFESSION_magic[AttackMgcNo].uiPostMagicNum , + PROFESSION_magic[AttackMgcNo].uiAttackType , + PROFESSION_magic[AttackMgcNo].uiSliceTime , + PROFESSION_magic[AttackMgcNo].uiShowType , + PROFESSION_magic[AttackMgcNo].siSx , + PROFESSION_magic[AttackMgcNo].siSy , + PROFESSION_magic[AttackMgcNo].siPrevMagicSx , + PROFESSION_magic[AttackMgcNo].siPrevMagicSy , + PROFESSION_magic[AttackMgcNo].siPostMagicSx , + PROFESSION_magic[AttackMgcNo].siPostMagicSy , + PROFESSION_magic[AttackMgcNo].siPrevMagicOnChar , + PROFESSION_magic[AttackMgcNo].uiShowBehindChar , + PROFESSION_magic[AttackMgcNo].siPostMagicOnChar , + PROFESSION_magic[AttackMgcNo].uiShakeScreen , + PROFESSION_magic[AttackMgcNo].uiShakeFrom , + PROFESSION_magic[AttackMgcNo].uiShakeTo , + PROFESSION_magic[AttackMgcNo].isPostDisappear , + PROFESSION_magic[AttackMgcNo].ToCallMagicNo + ); + + BATTLESTR_ADD( szcommand ); + + for( i = 0 ; ToList[i] != -1 ; i++ ){ + snprintf( szcommand , sizeof( szcommand ) , "r%X|" , ToList[i] ); + BATTLESTR_ADD( szcommand ); + } + + BATTLESTR_ADD( "FF|" ); + + return 0; +} + +int analysis_profession_parameter( int attIdx, int skill, int toNo, int charaindex ) +{ + int image_1, image_2, place, place2, shake_s_time; + int shake_e_time, disappear, x, y, i; + char temp[64]; + char *pszOption; + // Robin fix profession magic_type + //char magic[3][5]={"","",""}; + char magic[3][5]={"","",""}; + int magic_type=-1; + + + // ȡüܲ + if( (pszOption=PROFESSION_SKILL_getChar(skill,PROFESSION_SKILL_OPTION)) == "\0" ) return -1; + + // ħ + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",1,temp,sizeof(temp)) ) return -1; + + for( i=0; i<3; i++){ + if( (strcmp( magic[i], temp )) == 0 ) + magic_type = i+1; + } + + switch( magic_type ){ + case 1: + // ӻȾֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_FIRE_PRACTICE" ); + break; + case 2: + // ӱȾֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_ICE_PRACTICE" ); + break; + case 3: + // Ⱦֵ + PROFESSION_SKILL_LVEVEL_UP( charaindex, "PROFESSION_THUNDER_PRACTICE" ); + break; + + } + + // ʾλ÷ʽ 0 1 + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",2,temp,sizeof(temp)) ) return -1; + place = atoi(temp); + PROFESSION_magic[attIdx].uiShowType = place; + + // ʾǰ· + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",3,temp,sizeof(temp)) ) return -1; + place2 = atoi(temp); + PROFESSION_magic[attIdx].uiShowBehindChar = place2; + + // ʾλX + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",4,temp,sizeof(temp)) ) return -1; + x = atoi(temp); + + // ʾλY + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",5,temp,sizeof(temp)) ) return -1; + y = atoi(temp); + + // 𶯻Ŀʼ + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",6,temp,sizeof(temp)) ) return -1; + shake_s_time = atoi(temp); + + // 𶯻Ľ + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",7,temp,sizeof(temp)) ) return -1; + shake_e_time = atoi(temp); + + // һ㹥ʱǷʧ + memset( temp, 0, sizeof(temp) ); + if( !getStringFromIndexWithDelim(pszOption,"|",8,temp,sizeof(temp)) ) return -1; + disappear = atoi(temp); + + // ׼ħͼ + image_1 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_1); + PROFESSION_magic[attIdx].uiPrevMagicNum = image_1; // ǰö + + // սħͼ + image_2 = PROFESSION_SKILL_getInt( skill, PROFESSION_SKILL_IMG_2); + PROFESSION_magic[attIdx].uiSpriteNum = image_2; // ö + + // ʾڻ x,y + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + + // ȡùұߵħͼż + PROFESSION_MAGIC_GET_IMG2( toNo, charaindex, attIdx, pszOption ); + + // ʱ + if( (shake_s_time>0) || (shake_e_time>0) ){ + PROFESSION_magic[attIdx].uiShakeScreen = 1; + PROFESSION_magic[attIdx].uiShakeFrom = shake_s_time; + PROFESSION_magic[attIdx].uiShakeTo = shake_e_time; + }else{ + PROFESSION_magic[attIdx].uiShakeScreen = 0; + PROFESSION_magic[attIdx].uiShakeFrom = 0; + PROFESSION_magic[attIdx].uiShakeTo = 0; + } + + + return magic_type; +} + + +// ȡȵ˺ +void PROFESSION_MAGIC_GET_PRACTICE( + float *hp_power, + float *mp_power, + float *dec_hp, + float *dec_mp, + int charaindex +) +{ + int skill_level=0, critical=0, command=0; + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1); + + critical = RAND( 1,100); + + switch( command ){ + case BATTLE_COM_S_VOLCANO_SPRINGS: // ɽȪ + { + *hp_power = skill_level * 10 + 100; + + if( skill_level >= 10 ){ + if( critical <= 25 ) + *hp_power *= 1.5; + }else{ + if( critical <= (skill_level+12) ) + *hp_power *= 1.5; + } + + break; + } + case BATTLE_COM_S_FIRE_BALL: // + { + if( skill_level >= 10 ) + *hp_power = 360; + else if( skill_level >= 9 ) + *hp_power = 320; + else if( skill_level >= 8 ) + *hp_power = 280; + else if( skill_level >= 7) + *hp_power = 260; + else if( skill_level >= 5) + *hp_power = 220; + else if( skill_level >= 3) + *hp_power = 180; + else + *hp_power = 160; + + break; + } + case BATTLE_COM_S_SUMMON_THUNDER: // + { + *hp_power = skill_level*10 + 200; + break; + } + case BATTLE_COM_S_CURRENT: // + { +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ) + *hp_power = 300; + else if( skill_level > 9 ) + *hp_power = 250; + else if( skill_level > 7 ) + *hp_power = 200; + else if( skill_level > 4 ) + *hp_power = 150; + else if( skill_level > 1 ) + *hp_power = 10; + else + *hp_power = 50; +#else + *hp_power = skill_level*50 + 100; +#endif + break; + } + case BATTLE_COM_S_STORM: // + { +#ifdef _PROFESSION_ADDSKILL + if( skill_level > 9 ) + *hp_power = 200; + else if( skill_level > 7 ) + *hp_power = 180; + else if( skill_level > 5 ) + *hp_power = 160; + else if( skill_level > 3 ) + *hp_power = 140; + else + *hp_power = 120; +#else + *hp_power = skill_level*10 + 100; +#endif + break; + } + case BATTLE_COM_S_ICE_ARROW: // + { + if( skill_level >= 10 ) + *hp_power = 250; + else + *hp_power = skill_level*10 + 130; + break; + } + case BATTLE_COM_S_ICE_CRACK: // + { + if( skill_level >= 10 ) + *hp_power = 400; + else if ( skill_level == 9 ) + *hp_power = 300; + else + *hp_power = skill_level*10 + 210; + + break; + } + case BATTLE_COM_S_DOOM: // ĩ + { + if( skill_level >= 10 ) + *hp_power = 550; + else if( skill_level > 9 ) + *hp_power = 500; + else if( skill_level > 8 ) + *hp_power = 450; + else if( skill_level > 7 ) + *hp_power = 400; + else if( skill_level > 6 ) + *hp_power = 350; + else if( skill_level > 4 ) + *hp_power = 300; + else if( skill_level > 2 ) + *hp_power = 250; + else + *hp_power = 200; + break; + } + case BATTLE_COM_S_FIRE_SPEAR: // ǹ + { +#ifdef _JOB_FIX + if( skill_level > 9 ) + *hp_power = 800 * 2; + else if( skill_level > 8 ) + *hp_power = 450 * 2; + else if( skill_level > 7 ) + *hp_power = 400 * 2; + else if( skill_level > 6 ) + *hp_power = 350 * 2; + else if( skill_level > 5 ) + *hp_power = 300 * 2; + else if( skill_level > 3 ) + *hp_power = 200 * 2; + else + *hp_power = 100 * 2; +#else + if( skill_level >= 10 ) + *hp_power = 550; + else if( skill_level > 9 ) + *hp_power = 500; + else if( skill_level > 8 ) + *hp_power = 450; + else if( skill_level > 7 ) + *hp_power = 400; + else if( skill_level > 6 ) + *hp_power = 350; + else if( skill_level > 4 ) + *hp_power = 300; + else if( skill_level > 2 ) + *hp_power = 250; + else + *hp_power = 200; +#endif + break; + } + + case BATTLE_COM_S_BLOOD: // Ѫ + { + int hp = CHAR_getInt( charaindex, CHAR_HP); + if( hp > 1 ) + *hp_power = CHAR_getInt( charaindex, CHAR_HP) * (skill_level*5 +10) /100; + else + *hp_power = 0; + + break; + } + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + { + *hp_power = skill_level*10+20; + break; + } + case BATTLE_COM_S_SIGN: // һѪ + { +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ){ + *hp_power = 200; + *mp_power = 30; + }else if( skill_level > 6 ){ + *hp_power = 150; + *mp_power = 20; + }else if( skill_level > 3 ){ + *hp_power = 100; + *mp_power = 15; + }else{ + *hp_power = 50; + *mp_power = 10; + } +#else + if( skill_level >= 10 ){ + *hp_power = 300; + *mp_power = 70; + }else if( skill_level >= 9 ){ + *hp_power = 200; + *mp_power = 50; + }else if( skill_level >= 7 ){ + *hp_power = 150; + *mp_power = 30; + }else if( skill_level >= 4 ){ + *hp_power = 100; + *mp_power = 20; + }else{ + *hp_power = 50; + *mp_power = 10; + } +#endif + break; + } + case BATTLE_COM_S_ENCLOSE: // + { +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ) + *hp_power = 400; + else if( skill_level > 9 ) + *hp_power = 300; + else if( skill_level > 7 ) + *hp_power = 250; + else if( skill_level > 4 ) + *hp_power = 200; + else + *hp_power = 150; + break; +#else + if( skill_level >= 10 ) + *hp_power = 300; + else if( skill_level >= 8 ) + *hp_power = 250; + else if( skill_level >= 5 ) + *hp_power = 200; + else + *hp_power = 150; + break; +#endif + } + default: + break; + } + +#ifdef _SUIT_ADDENDUM + *hp_power += *hp_power * (CHAR_getWorkInt( charaindex, CHAR_WORKMPOWER )/100.00); +#endif +#ifdef _SUIT_ADDPART4 + if( rand()%100 < 30 ) + *hp_power += *hp_power * (CHAR_getWorkInt( charaindex, CHAR_WORKMPOWER2 )/100.00);//ǿʦħװ(޶30%) +#endif + + if( *hp_power > 0 ){ + float rand_num = RAND( 98, 102 ); + *hp_power *= rand_num / 100; + }else{ + *hp_power = 0; + } +} + + +// ѡĻ +void PROFESSION_MAGIC_TOLIST_SORT( int *list, int *listidx, int charaindex ) +{ + int j=0, get_num=0, temp[SIDE_OFFSET * 2 + 1]; + int skill_level=-1, command=-1; + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1); + + switch(command){ + case BATTLE_COM_S_CURRENT: // + { +#ifdef _PROFESSION_ADDSKILL + if( skill_level > 9 ) get_num = 10; + else if( skill_level > 8 ) get_num = 9; + else if( skill_level > 7 ) get_num = 8; + else if( skill_level > 6 ) get_num = 7; + else if( skill_level > 5 ) get_num = 6; + else if( skill_level > 4 ) get_num = 5; + else if( skill_level > 3 ) get_num = 4; + else if( skill_level > 2 ) get_num = 3; + else if( skill_level > 1 ) get_num = 2; + else get_num = 1; +#else + if( skill_level >= 9 ) get_num = 5; + else if( skill_level >= 7 ) get_num = 4; + else if( skill_level >= 5 ) get_num = 3; + else if( skill_level >= 3 ) get_num = 2; + else get_num = 1; +#endif + break; + } + case BATTLE_COM_S_STORM: // + { + get_num = skill_level; + break; + } + case BATTLE_COM_S_DOOM: // ĩ + { + if( skill_level >= 8 ) get_num = 10; + else if( skill_level >= 7 ) get_num = 8; + else if( skill_level >= 5 ) get_num = 6; + else if( skill_level >= 3 ) get_num = 4; + else get_num = 2; + break; + } + case BATTLE_COM_S_FIRE_SPEAR: // ǹ + { + /*int miss_rate=0, rand_num=0; + + miss_rate = skill_level * 2 + 10; + rand_num = RAND(0, 100); + + if( rand_num <= miss_rate ){ + memset(list, -1, sizeof(list)); + *listidx = 0; + return; + }else + get_num = skill_level; + + break;*/ + /* + if( skill_level > 9 ) get_num = 10; + else if( skill_level > 8) get_num = 9; + else if( skill_level > 7 ) get_num = 8; + else if( skill_level > 6 ) get_num = 7; + else if( skill_level > 5 ) get_num = 6; + else if( skill_level > 4 ) get_num = 5; + else if( skill_level > 3 ) get_num = 4; + else if( skill_level > 2 ) get_num = 3; + else if( skill_level > 1 ) get_num = 2; + else get_num = 1; + */ + break; + } + case BATTLE_COM_S_SIGN: // һѪ + { +#ifdef _PROFESSION_ADDSKILL + get_num = 10; +#else + if( skill_level >= 10 ) get_num = 5; + else if( skill_level >= 8 ) get_num = 4; + else if( skill_level >= 6 ) get_num = 3; + else if( skill_level >= 3 ) get_num = 2; + else get_num = 1; +#endif + break; + } + case BATTLE_COM_S_CONVOLUTE: // + case BATTLE_COM_S_FIRE_BALL: // + { + int toNo=-1, toNo2=-1, battleindex=-1, i=0, count=0; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + if(battleindex == -1) return; + + toNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2); + memset( temp, -1, sizeof( temp ) ); + + if( toNo == 24 ) toNo2 = 15; + else if( toNo == 23 ) toNo2 = 10; + else if( toNo == 25 ) toNo2 = 5; + else if( toNo == 26 ) toNo2 = 0; + else return; + + for( i=0; i<5; i++ ){ + if(BATTLE_TargetCheck(battleindex,toNo2+i) != FALSE){ + temp[count] = toNo2+i; + count++; + } + } + + memset(list, -1, sizeof(list)); + memcpy( list, temp, sizeof(temp) ); + + *listidx = count; + + return; + } + case BATTLE_COM_S_THROUGH_ATTACK: // ᴩ + { + int toNo = -1, toNo2 = -1, battleindex = -1; + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if(battleindex == -1) return; + + toNo = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2); + memset( temp, -1, sizeof( temp ) ); + temp[0] = toNo; + + if( toNo < (SIDE_OFFSET/2) ) toNo2= toNo + (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET) ) toNo2= toNo - (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET*1.5) ) toNo2= toNo + (SIDE_OFFSET/2); + else if( toNo < (SIDE_OFFSET*2) ) toNo2= toNo - (SIDE_OFFSET/2); + + if(BATTLE_TargetCheck( battleindex, toNo2 ) != FALSE){ + if( toNo2 > toNo ){ + temp[0] = toNo2; + temp[1] = toNo; + }else + temp[1] = toNo2; + + *listidx = 2; + }else + *listidx = 1; + + memset(list, -1, sizeof(list)); + memcpy( list, temp, sizeof(temp) ); + + } + default: + return; + } + + if( get_num == 0 ) return; + + if( get_num >= 10) get_num=10; + + if( get_num >= *listidx ) return; + + memset(temp, -1, sizeof(temp)); + + while( j < get_num ){ + int rand_num=-1, out_num=-1; + + rand_num = RAND(0, *listidx-1); + out_num = list[rand_num]; + list[rand_num] = -1; + + if(out_num > 0){ + temp[j] = out_num; + j++; + } + } + + memset(list, -1, sizeof(list)); + memcpy( list, temp, sizeof(temp) ); + + *listidx = j; + + return; +} + + +// ı״̬ +void PROFESSION_MAGIC_CHANGE_STATUS( + int charaindex, + int hp_power, + float mp_power, + float *add_hp, + float *add_mp +) +{ + int skill_level=0, command=0, critical=0; + critical = RAND( 1,100); + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1); + + switch( command ){ + case BATTLE_COM_S_BLOOD: // Ѫ + { + int rate = 0; + + if( skill_level >= 10 ) rate = 20; + else if( skill_level >= 7 ) rate = 15; + else if( skill_level >= 5 ) rate = 10; + else if( skill_level >= 3 ) rate = 5; + else rate = 0; + + *add_mp += hp_power * ( rate + 40 ) / 100; + + break; + } + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + { + if( skill_level >= 10 ){ + *add_hp += hp_power * 0.2; + break; + }else{ + *add_hp += hp_power * ((skill_level/4)*5 + 5) / 100; + break; + } + break; + } +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_SIGN: // һѪ + { + int success=10; + /*( skill_level >= 10 ) success = 30;//ɹ + else if( skill_level > 9 ) success = 25; + else if( skill_level > 8 ) success = 20; + else if( skill_level > 7 ) success = 15; + else success = 10; + success = 30;*/ + if( RAND(0,100) < success ){ + if( skill_level > 8 ){ + *add_hp += hp_power; + *add_mp += mp_power; + } + else if( skill_level > 7 ){ + *add_hp += hp_power/2; + *add_mp += 0; + } + } + else + { + *add_hp += 0; + *add_mp += 0; + } + break; + } +#endif + default: + break; + } +} + +// ȡλòĶħͼż +void PROFESSION_MAGIC_GET_IMG2( int toNo, int charaindex, int attIdx, char *pszOption ) +{ + int command=0, img2=0, x=0, y=0; + char temp[64]; + int skill_level=0; + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + command = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM1); + + switch( command ){ + case BATTLE_COM_S_BLOOD: // Ѫ + { + int img=0; + + if( skill_level >= 10 ) img = 101689; + else if( skill_level >= 7 ) img = 101690; + else if( skill_level >= 3 ) img = 101691; + else img = 101692; + + PROFESSION_MAGIC_CHANG_IMG2( img, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_VOLCANO_SPRINGS: // ɽȪ + { + int img=0; + + if( skill_level >= 10 ) img = 101686; + else if( skill_level >= 5 ) img = 101687; + else img = 101688; + + if( toNo >= 0 && toNo < 10 ) + PROFESSION_MAGIC_CHANG_IMG2( img, pszOption, attIdx ); + else{ + int x=0, y=0; + char temp[128]; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",11,temp,sizeof(temp)) ) x = atoi(temp); + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",12,temp,sizeof(temp)) ) y = atoi(temp); + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = img; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + } + + return; + } + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 || + ( toNo >= 0 && toNo < SIDE_OFFSET ) ) + PROFESSION_MAGIC_CHANG_IMG2( 101623, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_ICE_MIRROR: // + { + if( toNo >= 0 && toNo < 10 ) + PROFESSION_MAGIC_CHANG_IMG2( 101652, pszOption, attIdx ); + else{ + int x=0, y=0; + char temp[128]; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",11,temp,sizeof(temp)) ) x = atoi(temp); + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",12,temp,sizeof(temp)) ) y = atoi(temp); + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = 101652; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + } + + return; + } + case BATTLE_COM_S_ENCLOSE: // + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 || + ( toNo >= 0 && toNo < SIDE_OFFSET ) ) + PROFESSION_MAGIC_CHANG_IMG2( 101643, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_FIRE_SPEAR: // ǹ + { + // ҷ + //if( toNo == 20 || toNo == 25 || toNo == 26 ) + if( toNo < 10 ) + PROFESSION_MAGIC_CHANG_IMG2( 101642, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_DOOM: // ĩ + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 ) + PROFESSION_MAGIC_CHANG_IMG2( 101639, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_ICE_CRACK: // + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 ) + PROFESSION_MAGIC_CHANG_IMG2( 101650, pszOption, attIdx ); + return; + } + case BATTLE_COM_S_ICE_ARROW: // + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 || + ( toNo >= 0 && toNo < SIDE_OFFSET ) ) + PROFESSION_MAGIC_CHANG_IMG2( 101649, pszOption, attIdx ); + return; + + } + case BATTLE_COM_S_STORM: // + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 ) + PROFESSION_MAGIC_CHANG_IMG2( 101677, pszOption, attIdx ); + return; + } +#ifdef _PROFESSION_ADDSKILL + case BATTLE_COM_S_BOUNDARY: // Խ + { + // ҷ + if( toNo == 20 || toNo == 25 || toNo == 26 ){ + if( getStringFromIndexWithDelim(pszOption,"|",1,temp,sizeof(temp)) ) + { + if( strcmp( "ؽ", temp ) == 0 ) + PROFESSION_MAGIC_CHANG_IMG2( 101786, pszOption, attIdx ); + else if( strcmp( "ˮ", temp ) == 0 ) + PROFESSION_MAGIC_CHANG_IMG2( 101774, pszOption, attIdx ); + else if( strcmp( "", temp ) == 0 ) + PROFESSION_MAGIC_CHANG_IMG2( 101780, pszOption, attIdx ); + else if( strcmp( "", temp ) == 0 ) + PROFESSION_MAGIC_CHANG_IMG2( 101792, pszOption, attIdx ); + else + PROFESSION_MAGIC_CHANG_IMG2( 101770, pszOption, attIdx ); + } + } + return; + } +#endif + case BATTLE_COM_S_CONVOLUTE: // + { + img2=101656; + if( toNo == 25 ){ // 1 + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",9,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",10,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 26 ){ // 2 + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",11,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",12,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 23 ){ // 1 + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",13,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",14,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 24 ){ // 2 + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",15,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",16,temp,sizeof(temp)) ) y = atoi(temp); + }else + return; + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = img2; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + + break; + } + case BATTLE_COM_S_THROUGH_ATTACK: // ᴩ + { + if( (toNo == 13) || (toNo == 18) ){ // 1 + img2=101676; + x = 50; + y = 240; + }else if( (toNo == 11) || (toNo == 16) ){ // 2 + img2=101675; + x = 120; + y = 200; + }else if( (toNo == 10) || (toNo == 15) ){ // 3 + img2=101674; + x = 140; + y = 160; + }else if( (toNo == 12) || (toNo == 17) ){ // 4 + img2=101673; + x = 160; + y = 120; + }else if( (toNo == 14) || (toNo == 19) ){ // 5 + img2=101672; + x = 180; + y = 80; + }else if( (toNo == 3) || (toNo == 8) ){ // 1 + img2=101665; + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",9,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",10,temp,sizeof(temp)) ) y = atoi(temp); + }else if( (toNo == 1) || (toNo == 6) ){ // 2 + img2=101664; + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",11,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",12,temp,sizeof(temp)) ) y = atoi(temp); + }else if( (toNo == 0) || (toNo == 5) ){ // 3 + img2=101663; + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",13,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",14,temp,sizeof(temp)) ) y = atoi(temp); + }else if( (toNo == 2) || (toNo == 7) ){ // 4 + img2=101662; + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",15,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",16,temp,sizeof(temp)) ) y = atoi(temp); + }else if( (toNo == 4) || (toNo == 9) ){ // 5 + img2=101661; + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",17,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",18,temp,sizeof(temp)) ) y = atoi(temp); + }else + return; + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = img2; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + + // ǰö + if( toNo >= 10 ){ + int img1 = 101671; + PROFESSION_magic[attIdx].uiPrevMagicNum = img1; + } + break; + } + case BATTLE_COM_S_FIRE_BALL: // + { + if( toNo == 25 ){ // 1 + img2=101694; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",9,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",10,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 26 ){ // 2 + img2=101694; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",11,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",12,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 23 ){ // 1 + img2=101693; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",13,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",14,temp,sizeof(temp)) ) y = atoi(temp); + }else if( toNo == 24 ){ // 2 + img2=101693; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",15,temp,sizeof(temp)) ) x = atoi(temp); + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",16,temp,sizeof(temp)) ) y = atoi(temp); + }else + return; + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = img2; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; + + break; + } + default: return; + } + +} + + +#define D_16 (1.0/16) +#define D_8 (1.0/8) +// ȡù˺ +#ifdef _PROFESSION_ADDSKILL +int PROFESSION_MAGIC_GET_DAMAGE( int attackindex, int defindex, int magic_type, int power, int command ) +#else +int PROFESSION_MAGIC_GET_DAMAGE( int attackindex, int defindex, int magic_type, int power ) +#endif +{ + int damage = 0; + +#ifdef _FIX_MAGIC_RESIST // WON ADD ħ + int proficiency=0;// + int resist=0;// + int suit=0;//װ + int spirit=0;//ʹþɵĿ + + if( command == BATTLE_COM_S_DOOM ) + magic_type = 1; + + if( magic_type == 1){ // + proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_F_PROFICIENCY); // + resist = CHAR_getWorkInt( defindex, CHAR_WORK_F_RESIST); // +#ifdef _EQUIT_RESIST + suit = CHAR_getWorkInt( defindex, CHAR_WORK_F_SUIT)+CHAR_getWorkInt( defindex, CHAR_WORKEQUITFIRE ); +#else + suit = CHAR_getWorkInt( defindex, CHAR_WORK_F_SUIT); +#endif +#ifdef _MAGICSTAUTS_RESIST + if( CHAR_getWorkInt( defindex, CHAR_MAGICFIRE) > 0 ) + spirit = CHAR_getWorkInt( defindex, CHAR_OTHERSTATUSNUMS ); +#endif + } + + if( command == BATTLE_COM_S_DOOM ){ + damage = power * (1+proficiency/100.0) * (1-(resist/100.0)) * (1-(suit/100.0)) * (1-(spirit/100.0)); + magic_type = 2; + } + + if( magic_type == 2){ // + proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_T_PROFICIENCY); // + resist = CHAR_getWorkInt( defindex, CHAR_WORK_T_RESIST); // 翹 +#ifdef _EQUIT_RESIST + suit = CHAR_getWorkInt( defindex, CHAR_WORK_I_SUIT)+CHAR_getWorkInt( defindex, CHAR_WORKEQUITTHUNDER ); +#else + suit = CHAR_getWorkInt( defindex, CHAR_WORK_I_SUIT); +#endif +#ifdef _MAGICSTAUTS_RESIST + if( CHAR_getWorkInt( defindex, CHAR_MAGICTHUNDER) > 0 ) + spirit = CHAR_getWorkInt( defindex, CHAR_OTHERSTATUSNUMS ); +#endif + } + + if( command == BATTLE_COM_S_DOOM ){ + damage += power * (1+proficiency/100.0) * (1-(resist/100.0)) * (1-(suit/100.0)) * (1-(spirit/100.0)); + magic_type = 3; + } + + if( magic_type == 3){ // + proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_I_PROFICIENCY); // + resist = CHAR_getWorkInt( defindex, CHAR_WORK_I_RESIST); // +#ifdef _EQUIT_RESIST + suit = CHAR_getWorkInt( defindex, CHAR_WORK_T_SUIT)+CHAR_getWorkInt( defindex, CHAR_WORKEQUITICE ); +#else + suit = CHAR_getWorkInt( defindex, CHAR_WORK_T_SUIT); +#endif +#ifdef _MAGICSTAUTS_RESIST + if( CHAR_getWorkInt( defindex, CHAR_MAGICICE) > 0 ) + spirit = CHAR_getWorkInt( defindex, CHAR_OTHERSTATUSNUMS ); +#endif + } + + if( command == BATTLE_COM_S_DOOM ){ + damage += power * (1+proficiency/100.0) * (1-(resist/100.0)) * (1-(suit/100.0)) * (1-(spirit/100.0)); + damage /= 3.0; + } + else + damage = power * (1+proficiency/100.0) * (1-(resist/100.0)) * (1-(suit/100.0)) * (1-(spirit/100.0)); + +#else //_FIX_MAGIC_RESIST + + fire_proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_F_PROFICIENCY); // + electric_proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_T_PROFICIENCY); // + ice_proficiency = CHAR_getWorkInt( attackindex, CHAR_WORK_I_PROFICIENCY); // + fire_resist = CHAR_getWorkInt( defindex, CHAR_WORK_F_RESIST); // + electric_resist = CHAR_getWorkInt( defindex, CHAR_WORK_T_RESIST); // 翹 + ice_resist = CHAR_getWorkInt( defindex, CHAR_WORK_I_RESIST); // + +// print("\n won test 0.0 ==> f(%d) e(%d) i(%d)", fire_proficiency, electric_proficiency, ice_proficiency ); +// print("\n won test 0.1 ==> f(%d) e(%d) i(%d)", fire_resist, electric_resist, ice_resist ); + + if( magic_type == 1){ // + + attack = power * ( 100 + fire_proficiency ) / 100; // ӳ + + if( rand_num < 40){ // ԭ˺ + attack = attack * ( 100 - fire_resist ) / 100; + }else{ // ȡ˺ + rand_num = RAND(-20, 20); + attack = attack * ( 100 - (rand_num + fire_resist) ) / 100; + } +//print( "\nattack:%d ", attack ); + + }else + if( magic_type == 2){ // + + attack = power * ( 100 + electric_proficiency ) / 100; // ӳ + + if( rand_num < 40){ // ԭ˺ + attack = attack * ( 100 - electric_resist ) / 100; + }else{ // ȡ˺ + rand_num = RAND(-20, 20); + attack = attack * ( 100 - (rand_num + electric_resist) ) / 100; + } + }else + if( magic_type == 3){ // + + attack = power * ( 100 + ice_proficiency ) / 100; // ӳ + + if( rand_num < 40){ // ԭ˺ + attack = attack * ( 100 - ice_resist ) / 100; + }else{ // ȡ˺ + rand_num = RAND(-20, 20); + attack = attack * ( 100 - (rand_num + ice_resist) ) / 100; + } + }else{ // + attack = power; + } + + damage = attack; + +#endif + + if( damage < 0 ) + damage = 0; + + return damage; +} + + +// ȡ⹥˺ +int PROFESSION_MAGIC_GET_ICE_MIRROR_DAMAGE( int attackindex, int defindex, int command, int power ) +{ + int damage = power; + + if( command == BATTLE_COM_S_ICE_MIRROR ){ // + float defense = -1; + int rate=0; + int defpet = BATTLE_getRidePet( defindex ); + int skill_level = CHAR_GETWORKINT_HIGH( attackindex, CHAR_WORKBATTLECOM3); + int base_defense = CHAR_getInt( defindex, CHAR_TOUGH ) / 100; + + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( defpet == -1 ) + defense = CHAR_getWorkInt( defindex, CHAR_WORKDEFENCEPOWER ); + else + defense = BATTLE_adjustRidePet3A( defindex, defpet, CHAR_WORKDEFENCEPOWER, DEFFENCESIDE ); +#ifdef _JOB_FIX + if( skill_level >= 10 ){ + rate = 80; + }else{ + rate = skill_level * 5 + 20; + } +#else + if( skill_level >= 10 ){ + rate = 60; + }else{ + rate = skill_level * 5 + 5; + } +#endif + //andy_Edit + damage = 120 + (int)( ( defense * rate / 100 ) + ( ( defense - base_defense ) * rate / 200 ) ); + //ƶnpc˺ + if( CHAR_getInt( defindex , CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ) + damage = damage > 800 ? 800 : damage; + + }else + if( command == BATTLE_COM_S_CONVOLUTE ){ // + int skill_level = CHAR_GETWORKINT_HIGH( attackindex, CHAR_WORKBATTLECOM3); + int hit=0; + + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + hit = skill_level * 2 + 60; + + //if( rand_num <= hit ){ + // ȡû˺ +#ifdef _JOB_FIX + damage = BATTLE_PROFESSION_CONVOLUTE_GET_DAMAGE( attackindex, defindex, skill_level ) * 1.1; +#else + damage = BATTLE_PROFESSION_CONVOLUTE_GET_DAMAGE( attackindex, defindex, skill_level ); +#endif + //}else{ + // damage = 0; + //} + }else + if( command == BATTLE_COM_S_THROUGH_ATTACK ){ // ᴩ + int skill_level = CHAR_GETWORKINT_HIGH( attackindex, CHAR_WORKBATTLECOM3); + + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + if( skill_level != 10 ){ + // ½ + CHAR_setWorkInt( attackindex, CHAR_MYSKILLHIT, 1); + CHAR_setWorkInt( attackindex, CHAR_MYSKILLHIT_NUM, -70); + CHAR_setWorkInt( attackindex, CHAR_WORKHITRIGHT, CHAR_getWorkInt(attackindex,CHAR_WORKHITRIGHT) -50 ); + } + + // ȡùᴩ˺ +#ifdef _JOB_FIX + damage = BATTLE_PROFESSION_THROUGH_ATTACK_GET_DAMAGE( attackindex, defindex ) * 0.80; +#else + damage = BATTLE_PROFESSION_THROUGH_ATTACK_GET_DAMAGE( attackindex, defindex ); +#endif + } +#ifdef _PROFESSION_ADDSKILL + else + if( command == BATTLE_COM_S_CURRENT // + || command == BATTLE_COM_S_SUMMON_THUNDER ){// + if( CHAR_getWorkInt( defindex, CHAR_WORKWATER ) > 0 ){//ˮ + if( RAND(1, 100) < 75 ) + damage *= 3; + } + } +#endif + return damage; +} + + + +// +// return: 0:û 1: +int PROFESSION_MAGIC_DODGE( int atk_index, int def_index, int magic_type ) +{ + float fLuck = 0,fResist = 0, proficiency = 0; + float Dluck=0.0; + int charType = CHAR_getInt( def_index, CHAR_WHICHTYPE); + int rand_num = RAND( 1, 100 ); + int command; + + + // Ŀһܣ + if( CHAR_getWorkInt( def_index, CHAR_WORKBATTLECOM1 ) == BATTLE_COM_S_EARTHROUND0 ){ + return 1; // Miss + } + + // Ƿ + if( charType == CHAR_TYPEPLAYER ){ + + // + fLuck = (float)CHAR_getInt( def_index, CHAR_LUCK) * 3; + + // + if( magic_type != 0 ){ + fResist = (float)(CHAR_getWorkInt( def_index, CHAR_WORK_F_RESIST + magic_type - 1 )) * 0.5; + } + fLuck += fResist; + + // ħװ + Dluck = (float)(CHAR_getWorkInt( def_index, CHAR_EQUITQUIMAGIC)*0.4); + + fLuck += Dluck; + + }else {// Ƿdz + fLuck = (float)CHAR_getInt( def_index, CHAR_LV) * 0.15; + if(fLuck > 20) fLuck = 20; + } + + // + // Robin fix + //if( magic_type != 0 ){ + if( magic_type > 0 ){ + proficiency = (float)CHAR_getWorkInt( atk_index, (CHAR_WORK_F_PROFICIENCY + magic_type - 1) ) * 0.2; + fLuck -= proficiency; + } + +/* print("\n PROFESSION_MAGIC_DODGE atk=%s def=%s magic_type(%d)", + CHAR_getChar( atk_index, CHAR_NAME), + CHAR_getChar( def_index, CHAR_NAME), + magic_type ); + print("\n won test 4 ==> rand_num(%d) lucky(%d) fResist(%f) Dluck(%f) proficiency(%f) fLuck(%f)", + rand_num, + CHAR_getInt( def_index, CHAR_LUCK) * 3, + fResist, + Dluck, + proficiency, + fLuck ); +*/ + if( rand_num > (int)fLuck){ +#ifdef _PROFESSION_ADDSKILL + command = CHAR_getWorkInt( atk_index, CHAR_WORKBATTLECOM1); + switch( command ){ + case BATTLE_COM_S_CURRENT: + case BATTLE_COM_S_STORM: + if( RAND( 1, 100 ) < 75 ) + return 0; + else + return 1; + break; + case BATTLE_COM_S_FIRE_SPEAR: + case BATTLE_COM_S_DOOM: + if( RAND( 1, 100 ) < 90 ) + return 0; + else + return 1; + break; + case BATTLE_COM_S_SIGN: + if( RAND( 1, 100 ) < 50 ) + return 0; + else + return 1; + break; + } +#endif + return 0; // hit + } + else + return 1; // Miss +} + +void PROFESSION_MAGIC_CHANG_IMG2( int img2, char *pszOption, int attIdx ) +{ + int x=0, y=0; + char temp[128]; + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",9,temp,sizeof(temp)) ) x = atoi(temp); + + memset( temp, 0, sizeof(temp) ); + if( getStringFromIndexWithDelim(pszOption,"|",10,temp,sizeof(temp)) ) y = atoi(temp); + + // ö + PROFESSION_magic[attIdx].uiSpriteNum = img2; + + // ö + PROFESSION_magic[attIdx].siSx = x; + PROFESSION_magic[attIdx].siSy = y; +} + + + +int PROFESSION_MAGIC_CHANG_STATUS(int command,int battleindex, int charaindex, int charaidx, int attvalue, int no ) +{ + int i,j; + int skill_level=0; + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + switch( command ){ + case BATTLE_COM_S_THROUGH_ATTACK: // ᴩ + { + int skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + + if( no == 0 ){ // ǰŵ + attvalue = attvalue * (skill_level * 2 + 70) / 100; + }else if( no == 1 ){ // ŵ + attvalue = attvalue * (skill_level * 2 + 50) / 100; + } + + break; + } + case BATTLE_COM_S_ICE_CRACK: // + { + int hit=0, rand_num = RAND( 0, 100 ); + + //for( j = 1; j < BATTLE_ST_END; j++ ){ //쳣״̬return + // if( CHAR_getWorkInt( charaidx, StatusTbl[j] ) > 0 ) return 0; + //} + // + if( skill_level >= 10 ) hit = 80; + else if( skill_level >= 7 ) hit = 70; + else if( skill_level >= 5 ) hit = 80; + else if( skill_level >= 3 ) hit = 90; + else hit = 100; + + hit = 100; + if( rand_num < hit ){ + int damage=0; + + if( skill_level >= 10 ) damage = attvalue * 1.3; + else if( skill_level >= 7 ) damage = attvalue * 1.25; + else if( skill_level >= 4 ) damage = attvalue * 1.2; + else damage = attvalue * 1.1; + + if( damage <= 0 ) break; + + for( i=0; i<10; i++ ){ + if( CHAR_getWorkInt( charaidx, CHAR_WORKICECRACK+i ) <= 0 ){ + CHAR_setWorkInt( charaidx, CHAR_WORKICECRACK+i, 3 ); + CHAR_setWorkInt( charaidx, CHAR_WORKMODICECRACK+i, damage ); + //print("\niceidx:%d",charaidx); + break; + } + } + //BATTLE_BadStatusString( bid, BATTLE_ST_ICECRACK ); + + } + + // һ˺ + attvalue = 0; + + break; + } + case BATTLE_COM_S_ENCLOSE: // + { + for( j = 1; j < BATTLE_ST_END; j++ ) //쳣״̬return + if( CHAR_getWorkInt( charaidx, StatusTbl[j] ) > 0 ) return attvalue; + + { + int success=0, rand_num=0, round=1; + int bid = BATTLE_Index2No( battleindex, charaidx ); + + skill_level = CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3); + + if( skill_level >= 100 ) success = 60; + else if( skill_level > 90 ) success = 50; + else if( skill_level > 80 ) success = 40; + else if( skill_level > 60 ) success = 30; + else if( skill_level > 30 ) success = 25; + else success = 20; + + if( skill_level > 80 ) round = 3; + else if( skill_level > 50 ) round = 2; + else round = 1; + + rand_num = RAND(0,100); + + if( rand_num <= success ){ //ɹʱĿ +#ifdef _PROFESSION_ADDSKILL + CHAR_setWorkInt( charaidx, CHAR_WORKANNEX, round ); +#else + CHAR_setWorkInt( charaidx, CHAR_WORKCONFUSION, 4 ); + CHAR_setWorkInt( charaidx, CHAR_WORKMODCONFUSION, 100 ); +#endif + BATTLE_BadStatusString( bid, BATTLE_ST_CONFUSION ); + } + } + break; + } + case BATTLE_COM_S_ICE_ARROW: // + { + for( j = 1; j < BATTLE_ST_END; j++ ){ //쳣״̬return + if( CHAR_getWorkInt( charaidx, StatusTbl[j] ) > 0 ) return attvalue; + } + { + int success=0, rand_num=0; + int bid = BATTLE_Index2No( battleindex, charaidx ); + + if( skill_level >= 8 ) success = 25; + else if( skill_level >= 5 ) success = 20; + else if( skill_level >= 2 ) success = 15; + else success = 10; + rand_num = RAND(0,100); + + if( rand_num <= success ){ //ɹʱĿ꽵 + int dec_dex=0, turn=0; + + if( skill_level >= 8 ) dec_dex = 25; + else if( skill_level >= 5 ) dec_dex = 20; + else dec_dex = 10; + + if( skill_level >= 10 ){ + success = 15; + turn = 2; + } + else if( skill_level >= 6 ){ + success = 10; + turn = 1; + } + else{ + success = 5; + turn = 0; + } + if(rand_num <= success){ + CHAR_setWorkInt( charaidx, CHAR_WORKICEARROW, turn ); + } + CHAR_setWorkInt( charaidx, CHAR_WORKMODICEARROW, dec_dex ); + + BATTLE_BadStatusString( bid, BATTLE_ST_ICEARROW ); + } + } + break; + } + case BATTLE_COM_S_BLOOD_WORMS: // Ѫ + { + for( j = 1; j < BATTLE_ST_END; j++ ){ //쳣״̬return + if( CHAR_getWorkInt( charaidx, StatusTbl[j] ) > 0 ) return attvalue; + } + { + int turn=0; + int bid = BATTLE_Index2No( battleindex, charaidx ); + + if( skill_level >= 10 ) turn = 5; + else if( skill_level >= 8 ) turn = 4; + else if( skill_level >= 5 ) turn = 3; + else turn = 2; + + CHAR_setWorkInt( charaidx, CHAR_WORKBLOODWORMS, turn + 1 ); + CHAR_setWorkInt( charaidx, CHAR_WORKMODBLOODWORMS, skill_level ); + CHAR_setWorkInt( charaidx, CHAR_WORKBLOODWORMSID, charaindex ); + + BATTLE_BadStatusString( bid, BATTLE_ST_BLOODWORMS ); + + } + break; + } + case BATTLE_COM_S_SIGN: // һѪ + { +#ifdef _PROFESSION_ADDSKILL +#else + for( j = 1; j < BATTLE_ST_END; j++ ){ //쳣״̬return + if( CHAR_getWorkInt( charaidx, StatusTbl[j] ) > 0 ) return attvalue; + } + { + int turn=0, success=0, rand_num=0; + int bid = BATTLE_Index2No( battleindex, charaidx ); + + // 뿪 +// if( CHAR_getInt( charaidx, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return attvalue; + + if( skill_level == 10 ) success = 35; + else if( skill_level >= 8 ) success = (skill_level - 3) * 5; + else if( skill_level >= 6 ) success = 20; + else if( skill_level >= 4 ) success = 15; + else if( skill_level >= 2 ) success = 10; + else success = 5; + + rand_num = RAND(0,100); + + if( rand_num <= success ){ //ɹʱĿѪ + if( skill_level >= 10 ) turn = 5; + else if( skill_level >= 7 ) turn = 4; + else if( skill_level >= 4 ) turn = 3; + else turn = 2; + + CHAR_setWorkInt( charaidx, CHAR_WORKSIGN, turn + 1 ); + CHAR_setWorkInt( charaidx, CHAR_WORKMODSIGN, skill_level ); + CHAR_setWorkInt( charaidx, CHAR_WORKSIGNID, charaindex ); + + BATTLE_BadStatusString( bid, BATTLE_ST_SIGN ); + } + } +#endif + break; + } + case BATTLE_COM_S_DOOM: // ĩ + { +/* int rand_num = RAND( 1, 100 ), work, dex; + char szCommand[64]; + int bid = BATTLE_Index2No( battleindex, charaidx ); + + if( skill_level < 10 ) break; +#ifdef _PROFESSION_ADDSKILL + CHAR_setWorkInt( charaidx, CHAR_WORKFEAR, 2 ); + BATTLE_BadStatusString( bid, BATTLE_ST_FEAR ); + work = CHAR_getWorkInt( charaindex, CHAR_WORKQUICK )+20; + dex = work>>1;//50% + sprintf( szCommand, "BD|r%X|0|6|%X|", bid, (-1) * dex ); + BATTLESTR_ADD( szCommand ); +#endif + // + if( rand_num <= 20 ){ + CHAR_setWorkInt( charaidx, CHAR_WORKPARALYSIS, 3 ); + BATTLE_BadStatusString( bid, BATTLE_ST_PARALYSIS ); + }else{ + rand_num = RAND( 1, 100 ); + if( rand_num <= 10 ){ + CHAR_setWorkInt( charaidx, CHAR_WORKCONFUSION, 3 ); + BATTLE_BadStatusString( bid, BATTLE_ST_CONFUSION ); + } + }*/ + + break; + } + } + + + return attvalue; +} + + +#endif + + +#ifdef _PETSKILL_FIREKILL +/* + . ... ... . + *. .. .* . . + . . .. + .. /\_/\_ . + ??̡ ̡??? + ڿ +*/ +void BATTLE_MultiAttMagic_Fire( int battleindex, int attackNo, int defNo, + int FieldAttr , int Power) + +{ + int list[SIDE_OFFSET * 2 + 1]; + int listidx=0,i,j,z,def_be_hit[10],att_magic_lv[4]; + int def_magic_resist[DEF_MAGIC_NUM]; + int attvalue , charahp , pethp , charaidx , petidx , charahurt,pet_att_lv = 1,pet_def_lv = 1,charahurt_temp; + char szcommand[256]; + int AttIsPlayer=0,DefIsPlayer=0; + int getexp = 0; + +#ifndef _FIX_MAGICDAMAGE + int att_magic_exp_add,att_magic_exp_sub,def_magic_exp_add,def_magic_exp_sub; + int lv_up_exp,DefFieldAttr = 0; + float temp = 0.0f; +// int attattr[5], defattr[5]; + char msgbuf[64]; + char kind[4][3] = {"","ˮ","",""}; +#else + BOOL TrueMagic=FALSE; +#endif + int f_num=0; + int MagicLv=4; + + memset(def_be_hit,-1,sizeof(def_be_hit)); + + if(defNo < 5) + f_num = 0; + else if(defNo >=5 && defNo < 10) + f_num = 5; + else if(defNo >=10 && defNo < 15) + f_num = 10; + else + f_num = 15; + + // ȡսϴ + for( i=f_num; i att_magic_lv[ FieldAttr] ) TrueMagic = FALSE; + else TrueMagic = TRUE; +#endif + } + pet_att_lv = CHAR_getInt(BATTLE_No2Index(battleindex,attackNo), CHAR_LV); + + z = 0; + for(i=0;i 0 ){ + float def = (float)(CHAR_getWorkInt( charaidx, CHAR_OTHERSTATUSNUMS )); + def = def/100; + for(j=0;j 0) { + CHAR_setWorkInt(def_be_hit[i],CHAR_WORKSLEEP,0); + z = BATTLE_Index2No(battleindex,def_be_hit[i]); + sprintf(szcommand,"BM|%X|%X|",z,0); + BATTLESTR_ADD(szcommand); + } + } +} +#endif + +#ifdef _PROFESSION_ADDSKILL +unsigned int GET_PROFESSION_magic_array(int idx) +{ + return PROFESSION_magic[idx].uiSpriteNum; +} +#endif diff --git a/battle/makefile b/battle/makefile new file mode 100644 index 0000000..8a0deda --- /dev/null +++ b/battle/makefile @@ -0,0 +1,456 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libbattle.a + +SRC=battle.c battle_event.c battle_command.c battle_ai.c battle_magic.c pet_skill.c battle_item.c profession_skill.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +battle.o: battle.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/buf.h \ + ../include/common.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/battle.h \ + ../include/battle_event.h ../include/battle_command.h \ + ../include/battle_ai.h ../include/configfile.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/encount.h ../include/enemy.h ../include/handletime.h \ + ../include/readmap.h ../include/pet_skill.h ../include/npcutil.h \ + ../include/magic.h ../include/npc_npcenemy.h ../include/log.h \ + ../include/pet_skillinfo.h ../include/anim_tbl.h ../include/common.h \ + ../include/battle_magic.h ../include/item.h ../include/correct_bug.h \ + ../include/mylua/function.h ../include/mylua/mylua.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/npc_autopk.h \ + ../include/profession_skill.h ../include/skill.h +battle_event.o: battle_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_event.h ../include/battle.h ../include/battle_event.h \ + ../include/configfile.h ../include/pet.h ../include/log.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/anim_tbl.h ../include/battle_magic.h ../include/util.h \ + ../include/enemy.h ../include/pet_skill.h ../include/char_base.h \ + ../include/item_event.h ../include/profession_skill.h ../include/item.h \ + ../include/skill.h ../include/magic_base.h ../include/mylua/function.h +battle_command.o: battle_command.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/pet_skill.h \ + ../include/battle_event.h ../include/battle_command.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/magic.h ../include/magic_base.h ../include/handletime.h \ + ../include/profession_skill.h +battle_ai.o: battle_ai.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/npcutil.h \ + ../include/pet_skill.h +battle_magic.o: battle_magic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/battle_event.h \ + ../include/magic_base.h ../include/battle_magic.h \ + ../include/item_event.h ../include/anim_tbl.h ../include/common.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/profession_skill.h ../include/skill.h +pet_skill.o: pet_skill.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/buf.h ../include/common.h ../include/configfile.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/pet_skill.h \ + ../include/battle.h ../include/battle_event.h ../include/battle_magic.h \ + ../include/item.h ../include/item_gen.h ../include/char_talk.h +battle_item.o: battle_item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/battle_event.h \ + ../include/battle_item.h ../include/battle_magic.h \ + ../include/item_event.h ../include/log.h ../include/anim_tbl.h \ + ../include/npcutil.h ../include/magic_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h +profession_skill.o: profession_skill.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/buf.h \ + ../include/common.h ../include/profession_skill.h ../include/version.h \ + ../include/util.h ../include/skill.h ../include/char_base.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/battle.h ../include/magic_base.h ../include/configfile.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/skill.h diff --git a/battle/makefile.bak b/battle/makefile.bak new file mode 100644 index 0000000..8a0deda --- /dev/null +++ b/battle/makefile.bak @@ -0,0 +1,456 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libbattle.a + +SRC=battle.c battle_event.c battle_command.c battle_ai.c battle_magic.c pet_skill.c battle_item.c profession_skill.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +battle.o: battle.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/buf.h \ + ../include/common.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/battle.h \ + ../include/battle_event.h ../include/battle_command.h \ + ../include/battle_ai.h ../include/configfile.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/encount.h ../include/enemy.h ../include/handletime.h \ + ../include/readmap.h ../include/pet_skill.h ../include/npcutil.h \ + ../include/magic.h ../include/npc_npcenemy.h ../include/log.h \ + ../include/pet_skillinfo.h ../include/anim_tbl.h ../include/common.h \ + ../include/battle_magic.h ../include/item.h ../include/correct_bug.h \ + ../include/mylua/function.h ../include/mylua/mylua.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/npc_autopk.h \ + ../include/profession_skill.h ../include/skill.h +battle_event.o: battle_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_event.h ../include/battle.h ../include/battle_event.h \ + ../include/configfile.h ../include/pet.h ../include/log.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/anim_tbl.h ../include/battle_magic.h ../include/util.h \ + ../include/enemy.h ../include/pet_skill.h ../include/char_base.h \ + ../include/item_event.h ../include/profession_skill.h ../include/item.h \ + ../include/skill.h ../include/magic_base.h ../include/mylua/function.h +battle_command.o: battle_command.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/pet_skill.h \ + ../include/battle_event.h ../include/battle_command.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/magic.h ../include/magic_base.h ../include/handletime.h \ + ../include/profession_skill.h +battle_ai.o: battle_ai.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/npcutil.h \ + ../include/pet_skill.h +battle_magic.o: battle_magic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/battle_event.h \ + ../include/magic_base.h ../include/battle_magic.h \ + ../include/item_event.h ../include/anim_tbl.h ../include/common.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/profession_skill.h ../include/skill.h +pet_skill.o: pet_skill.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/buf.h ../include/common.h ../include/configfile.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/pet_skill.h \ + ../include/battle.h ../include/battle_event.h ../include/battle_magic.h \ + ../include/item.h ../include/item_gen.h ../include/char_talk.h +battle_item.o: battle_item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/battle_event.h \ + ../include/battle_item.h ../include/battle_magic.h \ + ../include/item_event.h ../include/log.h ../include/anim_tbl.h \ + ../include/npcutil.h ../include/magic_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h +profession_skill.o: profession_skill.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/buf.h \ + ../include/common.h ../include/profession_skill.h ../include/version.h \ + ../include/util.h ../include/skill.h ../include/char_base.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/battle.h ../include/magic_base.h ../include/configfile.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/skill.h diff --git a/battle/pet_skill.c b/battle/pet_skill.c new file mode 100644 index 0000000..a532531 --- /dev/null +++ b/battle/pet_skill.c @@ -0,0 +1,2744 @@ +#include "version.h" +#include +#include +#include "common.h" +#include "buf.h" +#include "configfile.h" +#include "char_base.h" +#include "char_data.h" +#include "pet_skill.h" +#include "battle.h" +#include "battle_event.h" +#include "battle_magic.h" +#include "item.h" +#include "item_gen.h" +#include "char_talk.h" +#include "char_talk.h" + +/*======================================================================== + * ʸ 年лĩ ĸʽ + *========================================================================*/ + +static Petskill *PETSKILL_petskill; +static int PETSKILL_petskillnum; + +typedef struct tagPetskill_PetskillFunctionTable +{ + char *functionname; /* ɬð̻̤Ѽ */ + PETSKILL_CALLFUNC func; /* ˱̫ľ */ + int hash; /* hash */ + int status; /* Ѩëʸ϶ִ */ +}PETSKILL_PetskillFunctionTable; + +/* ë ֧ճ */ +static PETSKILL_PetskillFunctionTable PETSKILL_functbl[] = { + { "PETSKILL_None", PETSKILL_None, 0 }, + { "PETSKILL_NormalAttack", PETSKILL_NormalAttack, 0 }, + { "PETSKILL_NormalGuard", PETSKILL_NormalGuard, 0 }, + { "PETSKILL_ContinuationAttack",PETSKILL_ContinuationAttack, 0 }, + { "PETSKILL_ChargeAttack", PETSKILL_ChargeAttack, 0 }, + { "PETSKILL_Guardian", PETSKILL_Guardian, 0 }, + { "PETSKILL_PowerBalance", PETSKILL_PowerBalance, 0 }, + { "PETSKILL_Mighty", PETSKILL_Mighty, 0 }, + { "PETSKILL_StatusChange", PETSKILL_StatusChange, 0 }, + { "PETSKILL_EarthRound", PETSKILL_EarthRound, 0 }, + { "PETSKILL_GuardBreak", PETSKILL_GuardBreak, 0 }, +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 + { "PETSKILL_GuardBreak2", PETSKILL_GuardBreak2, 0 }, +#endif + { "PETSKILL_Abduct", PETSKILL_Abduct, 0 }, + { "PETSKILL_Steal", PETSKILL_Steal, 0 }, + { "PETSKILL_Merge", PETSKILL_Merge, 0 }, +#ifdef _ALCHEMIST + { "PETSKILL_Alchemist", PETSKILL_Merge, 0 }, +#endif + { "PETSKILL_NoGuard", PETSKILL_NoGuard, 0 }, +#ifdef _ITEM_INSLAY + { "PETSKILL_Inslay", PETSKILL_Inslay, 0 }, +#endif +#ifdef _PETSKILL_FIXITEM + { "PETSKILL_Fixitem", PETSKILL_Fixitem, 0 }, +#endif + +#ifdef _MAGIC_SUPERWALL + { "PETSKILL_MagicStatusChange" , PETSKILL_MagicStatusChange, 0}, +#endif + +// Terry add 2001/11/05 +#ifdef _ATTACK_MAGIC + { "PETSKILL_AttackMagic", PETSKILL_AttackMagic,0}, +#endif + +#ifdef _PSKILL_FALLGROUND + { "PETSKILL_FallGround", PETSKILL_FallGround, 0}, +#endif +#ifdef _PETSKILL_EXPLODE + { "PETSKILL_Explode", PETSKILL_Explode, 0}, +#endif +#ifdef _BATTLESTEAL_FIX + { "PETSKILL_StealMoney", PETSKILL_StealMoney, 0 }, +#endif +#ifdef _PRO_BATTLEENEMYSKILL + { "ENEMYSKILL_ReLife", ENEMYSKILL_ReLife, 0}, + { "ENEMYSKILL_ReHP", ENEMYSKILL_ReHP, 0}, + { "ENEMYSKILL_EnemyHelp", ENEMYSKILL_EnemyHelp, 0}, +#endif +#ifdef _SKILL_DAMAGETOHP + { "PETSKILL_DamageToHp", PETSKILL_DamageToHp, 0}, +#endif + +#ifdef _PETSKILL_TIMID + { "PETSKILL_BattleTimid", PETSKILL_BattleTimid, 0}, +#endif +#ifdef _PETSKILL_2TIMID + { "PETSKILL_2BattleTimid", PETSKILL_2BattleTimid, 0}, +#endif +#ifdef _PETSKILL_ANTINTER + { "PETSKILL_AntInter", PETSKILL_AntInter, 0}, +#endif + +#ifdef _PETSKILL_PROPERTY + { "PETSKILL_BattleProperty", PETSKILL_BattleProperty, 0}, +#endif + +#ifdef _PETSKILL_TEAR + { "PETSKILL_BattleTearDamage", PETSKILL_BattleTearDamage, 0}, +#endif + +#ifdef _BATTLE_LIGHTTAKE + { "PETSKILL_Lighttakeed", PETSKILL_Lighttakeed, 0}, +#endif + +#ifdef _BATTLE_ATTCRAZED + { "PETSKILL_AttackCrazed", PETSKILL_AttackCrazed, 0}, +#endif + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + { "PETSKILL_AttackShoot", PETSKILL_AttackShoot, 0}, +#endif + +#ifdef _Skill_MPDAMAGE + { "PETSKILL_MpDamage", PETSKILL_MpDamage, 0}, +#endif + +#ifdef _SKILL_TOOTH + { "PETSKILL_ToothCrushe", PETSKILL_ToothCrushe, 0}, +#endif + +#ifdef _PETSKILL_SETDUCK + { "PETSKILL_SetDuck", PETSKILL_SetDuck, 0}, +#endif +#ifdef _MAGICPET_SKILL + { "PETSKILL_SetMagicPet", PETSKILL_SetMagicPet, 0}, +#endif +#ifdef _PSKILL_MODIFY + { "PETSKILL_Modifyattack", PETSKILL_Modifyattack, 0}, +#endif + +#ifdef _PSKILL_MDFYATTACK + { "PETSKILL_Mdfyattack", PETSKILL_Mdfyattack, 0}, +#endif +#ifdef _VARY_WOLF + { "PETSKILL_Vary", PETSKILL_Vary, 0}, +#endif +#ifdef _PET_BIANSHEN + { "PETSKILL_Set_Vary", PETSKILL_Set_Vary, 0}, +#endif +#ifdef _SKILL_WILDVIOLENT_ATT + { "PETSKILL_WildViolentAttack", PETSKILL_WildViolentAttack, 0},//vincent add 2002/05/16 +#endif + +#ifdef _SKILL_SPEEDY_ATT + { "PETSKILL_SpeedyAttack", PETSKILL_SpeedyAttack, 0},//vincent add 2002/05/20 +#endif +#ifdef _SKILL_SACRIFICE + { "PETSKILL_Sacrifice", PETSKILL_Sacrifice, 0},//vincent add 2002/05/30 +#endif +#ifdef _SKILL_REFRESH + { "PETSKILL_Refresh", PETSKILL_Refresh, 0},//vincent add 2002/08/08 +#endif +#ifdef _SKILL_WEAKEN //vincent輼: + { "PETSKILL_Weaken", PETSKILL_Weaken, 0},//vincent add 2002/07/11 +#endif +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 + { "PETSKILL_Deeppoison", PETSKILL_Deeppoison, 0},//vincent add 2002/07/16 +#endif +#ifdef _SKILL_BARRIER //vincent輼:ħ + { "PETSKILL_Barrier", PETSKILL_Barrier, 0},//vincent add 2002/07/16 +#endif +#ifdef _SKILL_NOCAST //vincent輼:Ĭ + { "PETSKILL_Nocast", PETSKILL_Nocast, 0},//vincent add 2002/07/16 +#endif +#ifdef _SKILL_ROAR //vincent輼: + { "PETSKILL_Roar", PETSKILL_Roar, 0},//vincent add 2002/07/11 +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + { "PETSKILL_Sars", PETSKILL_Sars, 0}, +#endif + +#ifdef _SONIC_ATTACK // WON ADD + { "PETSKILL_Sonic", PETSKILL_Sonic, 0}, +#endif +#ifdef _PETSKILL_REGRET + { "PETSKILL_Regret", PETSKILL_Regret, 0}, +#endif + +#ifdef _PETSKILL_GYRATE + { "PETSKILL_Gyrate", PETSKILL_Gyrate, 0}, +#endif + +#ifdef _PETSKILL_ACUPUNCTURE //Ƥ + { "PETSKILL_Acupuncture", PETSKILL_Acupuncture, 0}, +#endif + +#ifdef _PETSKILL_RETRACE + { "PETSKILL_Retrace", PETSKILL_Retrace, 0}, +#endif + +#ifdef _PETSKILL_HECTOR + { "PETSKILL_Hector", PETSKILL_Hector, 0}, +#endif + +#ifdef _PETSKILL_FIREKILL + { "PETSKILL_Firekill", PETSKILL_Firekill, 0}, +#endif + +#ifdef _PETSKILL_DAMAGETOHP + { "PETSKILL_DamageToHp2", PETSKILL_DamageToHp2, 0}, +#endif + +#ifdef _PETSKILL_BECOMEFOX + { "PETSKILL_BecomeFox", PETSKILL_BecomeFox, 0}, +#endif + +#ifdef _PETSKILL_BECOMEPIG + { "PETSKILL_BecomePig", PETSKILL_BecomePig, 0}, +#endif + +#ifdef _PETSKILL_SHOWMERCY + { "PETSKILL_ShowMercy", PETSKILL_ShowMercy, 0}, +#endif + +#ifdef _PETSKILL_COMBINED + { "PETSKILL_Combined", PETSKILL_Combined, 0}, +#endif +#ifdef _PETSKILL_LER + { "PETSKILL_BatFly", PETSKILL_BatFly, 0}, + { "PETSKILL_DivideAttack", PETSKILL_DivideAttack, 0}, +#endif +#ifdef _PETSKILL_BATTLE_MODEL + { "PETSKILL_BattleModel", PETSKILL_BattleModel, 0}, +#endif + { "PETSKILL_ZiYun1", PETSKILL_ZiYun1, 0}, + +}; + +/*----------------------------------------------------------------------*/ + + +/* ͣʧͱ */ +/*----------------------------------------------------------------------*/ +INLINE BOOL PETSKILL_CHECKINDEX( int index ) +{ + if( PETSKILL_petskillnum<=index || index<0 )return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +static INLINE BOOL PETSKILL_CHECKINTDATAINDEX( int index) +{ + if( PETSKILL_DATAINTNUM <= index || index < 0 ) return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +static INLINE BOOL PETSKILL_CHECKCHARDATAINDEX( int index) +{ + if( PETSKILL_DATACHARNUM <= index || index < 0 ) return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +INLINE int PETSKILL_getInt( int index, PETSKILL_DATAINT element) +{ + return PETSKILL_petskill[index].data[element]; +} +/*----------------------------------------------------------------------*/ +INLINE int PETSKILL_setInt( int index, PETSKILL_DATAINT element, int data) +{ + int buf; + buf = PETSKILL_petskill[index].data[element]; + PETSKILL_petskill[index].data[element]=data; + return buf; +} +/*----------------------------------------------------------------------*/ +INLINE char* PETSKILL_getChar( int index, PETSKILL_DATACHAR element) +{ + if( !PETSKILL_CHECKINDEX( index)) return "\0"; + if( !PETSKILL_CHECKCHARDATAINDEX( element)) return "\0"; + return PETSKILL_petskill[index].string[element].string; +} + +/*----------------------------------------------------------------------*/ +INLINE BOOL PETSKILL_setChar( int index ,PETSKILL_DATACHAR element, char* new ) +{ + if(!PETSKILL_CHECKINDEX(index))return FALSE; + if(!PETSKILL_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( PETSKILL_petskill[index].string[element].string, + sizeof(PETSKILL_petskill[index].string[element].string), + new ); + return TRUE; +} +/*---------------------------------------------------------------------- + * ʸ ë£ + *---------------------------------------------------------------------*/ +int PETSKILL_getPetskillNum( void) +{ + return PETSKILL_petskillnum; +} + +#ifdef _CFREE_petskill +#define PETSKILL_STARTINTNUM 7 //PETSKILL_DATACHARNUM+1 +#else +#define PETSKILL_STARTINTNUM 5 +#endif + +/*---------------------------------------------------------------------- + * ʸ ɬð̻ë //ʼ輼 + *---------------------------------------------------------------------*/ +BOOL PETSKILL_initPetskill( char *filename) +{ + FILE* f; + char line[256]; + int linenum=0; + int petskill_readlen=0; + int i,j; + int max_skillid =0; + + f = fopen(filename,"r"); + if( f == NULL ){ + print( "file open error\n"); + return FALSE; + } + + PETSKILL_petskillnum=0; + + /* ئ滥ϵؤ¾Ʃ *///輼 + while( fgets( line, sizeof( line ), f ) ){ + char token[256]; + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + PETSKILL_petskillnum++; +#ifdef _PETSKILL_OPTIMUM // Robin ȡ輼ID + if( getStringFromIndexWithDelim( line, ",", PETSKILL_STARTINTNUM, token, sizeof(token)) == FALSE ) + continue; + //print("\n 輼ID:%d %s ", atoi( token), line); + max_skillid = max( atoi( token), max_skillid); +#endif + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Ѱʧ\n" ); + fclose(f); + return FALSE; + } + +#ifdef _PETSKILL_OPTIMUM // 輼TableΪ ID +1 + PETSKILL_petskillnum = max_skillid +1; +// print("\n 輼ID = %d\n", max_skillid); +#endif + + PETSKILL_petskill = allocateMemory( sizeof(struct tagPetskill) + * PETSKILL_petskillnum ); + if( PETSKILL_petskill == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(struct tagPetskill)*PETSKILL_petskillnum); + fclose( f ); + return FALSE; + } + + /* */ + for( i = 0; i < PETSKILL_petskillnum; i ++ ) { + for( j = 0; j < PETSKILL_DATAINTNUM; j ++ ) { + PETSKILL_setInt( i,j,-1); + } + for( j = 0; j < PETSKILL_DATACHARNUM; j ++ ) { + PETSKILL_setChar( i,j,""); + } + } + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpysafe( buf,sizeof(buf), &line[i]); + } + if( i != 0 ) { + strcpysafe( line,sizeof(line), buf); + } +} +{ + char token[256]; + int ret; + +#ifdef _PETSKILL_OPTIMUM // ȡг輼ID, ֱԳ輼IDTable index + ret = getStringFromIndexWithDelim( line, ",", PETSKILL_STARTINTNUM, token, sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + petskill_readlen = atoi( token); +#endif + + for( i = 0; i < PETSKILL_DATACHARNUM; i ++ ) { + /* ٯ ͼëέ */ + ret = getStringFromIndexWithDelim( line,",", i + 1, token,sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + PETSKILL_setChar( petskill_readlen, i, token); + } + + /* 4 ϷѰ */ + for( i = PETSKILL_STARTINTNUM; i < PETSKILL_DATAINTNUM+PETSKILL_STARTINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + if( strlen( token) != 0 ) { + PETSKILL_setInt( petskill_readlen, i - PETSKILL_STARTINTNUM, atoi( token)); + } + } + if( i < PETSKILL_DATAINTNUM+PETSKILL_STARTINTNUM ) continue; + +#ifdef _CFREE_petskill + if(line[0]=='E') PETSKILL_setInt( petskill_readlen, PETSKILL_ILLEGAL, 1); +#else + // Robin 2001/02/26 +1 set_illegal_Skill + if(line[0]=='T') PETSKILL_setInt( petskill_readlen, PETSKILL_ILLEGAL, 1); +#endif + //print("Id:%d illegal:%d\n",PETSKILL_getInt(petskill_readlen,PETSKILL_ID),PETSKILL_getInt(petskill_readlen,PETSKILL_ILLEGAL)); + + petskill_readlen ++; +} + + } + fclose(f); + + PETSKILL_petskillnum = petskill_readlen; + + + print( "Ч\ %d...", PETSKILL_petskillnum ); + + /* hash */ + for( i = 0; i < arraysizeof( PETSKILL_functbl); i ++ ) { + PETSKILL_functbl[i].hash = hashpjw( PETSKILL_functbl[i].functionname); + } +/* +#ifdef _CFREE_petskill + for( i=0; i = 0 && petskillid < PETSKILL_petskillnum ) + return PETSKILL_petskill[petskillid].data[PETSKILL_ID]; +#else + int i; + for( i = 0; i < PETSKILL_petskillnum; i ++ ) { + if( PETSKILL_petskill[i].data[PETSKILL_ID] == petskillid ) { + return i; + } + } +#endif + return -1; +} +/*------------------------------------------------------------ + * ʸ պ̼ë߯ + * ¦ + * name char*  + * ߯Ի + * ѳ߼̼ئ巴NULL + ------------------------------------------------------------*/ +PETSKILL_CALLFUNC PETSKILL_getPetskillFuncPointer(char* name ) +{ + int i; + int hash = hashpjw( name ); + for( i = 0 ; i< arraysizeof( PETSKILL_functbl) ; i++ ) { + if( PETSKILL_functbl[i].hash == hash ) { + if( strcmp( PETSKILL_functbl[i].functionname, name ) == 0 ) { + return PETSKILL_functbl[i].func; + } + } + } + return NULL; +} + +int PETSKILL_Use( + int charaindex, + int havepetskill, + int toindex, + char *data + //BOOL isCLI // Robin 2001/02/26 if owner is player +) +{ + int array, petskillid; + int ret; + PETSKILL_CALLFUNC func; + int playcharaindex; + playcharaindex = CHAR_getCharPet(CHAR_getWorkInt(charaindex,CHAR_WORKPLAYERINDEX),CHAR_getInt(CHAR_getWorkInt(charaindex,CHAR_WORKPLAYERINDEX),CHAR_RIDEPET)); + petskillid = CHAR_getPetSkill( charaindex, havepetskill); + if(playcharaindex==charaindex){ + if(petskillid!=0 && petskillid!=1 && petskillid!=2) + petskillid=0; + } +#ifdef _FIXWOLF // Syu ADD ˱Bug + if( petskillid == 600 ){ + if ( CHAR_getInt ( charaindex , CHAR_BASEIMAGENUMBER) == 101428 ) + petskillid = -1; + } +#endif + + array = PETSKILL_getPetskillArray( petskillid); + if( array == -1 ) return FALSE; +#ifndef _OPEN_E_PETSKILL + if(PETSKILL_getInt(array, PETSKILL_ILLEGAL)){ + if( (CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET) ){ + //print(" CHAR_TYPEPET:%d ", charaindex); + return FALSE; + } + } +#endif +#ifdef _PETSKILL_CHECKTYPE +#define _SKILLTYPE_NONE 0x01 +#define _SKILLTYPE_BATTLE 0x02 + if( (CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET) && + (PETSKILL_getInt( array, PETSKILL_USETYPE) & _SKILLTYPE_BATTLE) > 0){ + int masterindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + if( !CHAR_CHECKINDEX( masterindex) ) return FALSE; + if( CHAR_getWorkInt( masterindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + return FALSE; + } + } +#endif + func = PETSKILL_getPetskillFuncPointer( PETSKILL_getChar( array, PETSKILL_FUNCNAME) ); + if( func ) { + ret = func( charaindex, toindex, array, data ); + }else { + ret = FALSE; + } + return ret; +} + + +int _PETSKILL_GetArray( char *file, int line, int charaindex, int havepetskill ) +{ + int petskillid,array; + + petskillid = CHAR_getPetSkill( charaindex, havepetskill); + if( petskillid == -1 ) { + return -1; + } + + array = PETSKILL_getPetskillArray( petskillid); + + return array; +} + + +//---------------------------------------------------------------------- +int PETSKILL_ContinuationAttack( + int charaindex, + int toindex, + int array, + char *data + +) +{ +#ifdef _FIX_ContinuationAttack + if(toindex<0 || toindex>=BATTLE_ENTRY_MAX*2){ + print("err:NιĻĿ쳣 %d ", toindex); + return FALSE; + } +#endif +#ifdef _PETSKILL_NONO_FIX + if(CHAR_getWorkInt(charaindex,CHAR_WORKFIXAI)>=40 && CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)!=BATTLE_CHARMODE_NONE && CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK,CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX)); + } +#endif + char *pszOption; + int N = 1; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_RENZOKU ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( sscanf( pszOption, "%d", &N ) == 1 ){ + if( N < 1 || N > 10 )N = 1; + }else{ + N = 1; + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, N ); + + return TRUE; +} + +int PETSKILL_ChargeAttack( + int charaindex, + int toindex, + int array, + char *data +) +{ + char *pszOption, *pszP; + int N = 1, Per = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_CHARGE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( sscanf( pszOption, "%d", &N ) == 1 ){ + if( N < 1 || N > 10 )N = 1; + }else{ + N = 1; + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%d", &Per ); + } + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, N ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, Per ); + return TRUE; +} + +int PETSKILL_Guardian( + int charaindex, + int toNo, + int array, + char *data +) +{ + char *pszOption, *pszP; + int + battleindex, side, pos, ownerpos, + strdef, flg; + float fPer = 0.01; + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_GUARDIAN_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + flg = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEFLG ); + flg |= CHAR_BATTLEFLG_GUARDIAN; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLG, flg ); + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + + pos = BATTLE_Index2No( battleindex, charaindex ); + + if( (pszP = strstr( pszOption, "COM:" ) ) != NULL + && strstr( pszP+4, "" ) != NULL + ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_GUARD ); + + side = ( toNo >= SIDE_OFFSET )?( 1 ):( 0 ); + ownerpos = toNo - side * SIDE_OFFSET; + + if( 0 <= ownerpos && ownerpos < SIDE_OFFSET ){ + BattleArray[battleindex].Side[side].Entry[ownerpos].guardian = pos; + } + + }else{ + side = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + ownerpos = pos - 5; + ownerpos -= side * SIDE_OFFSET; + + if( ownerpos < 0 || ownerpos > 19 ){ + }else{ + BattleArray[battleindex].Side[side].Entry[ownerpos].guardian = pos; + } + } + + return TRUE; +} + +int PETSKILL_Mighty( + int charaindex, + int toindex, + int array, + char *data +) +{ +#ifdef _PETSKILL_NONO_FIX + if(CHAR_getWorkInt(charaindex,CHAR_WORKFIXAI)>=40 && CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)!=BATTLE_CHARMODE_NONE && CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK,CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX)); + } +#endif + char *pszOption, *pszP; + int iBai = 0, iDuck = 0; + float fBai = 2.00; + float fPer = 0.01; + int strdef,i; + char szTurn[] = "turn"; + char *hetStatus[]={"ȫ", "", "", "", "ʯ", "", "", "", "", "", "Ĭ"}; + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + for(i=0;i<11;i++){ + if((pszP = strstr( pszOption, hetStatus[i] ) ) != NULL) break; + } + if(i == 11) i=0; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM5, i); + if((pszP = strstr( pszOption, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &i ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM6, i); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM6, 1); + } + + if((pszP = strstr( pszOption, "" ) ) != NULL){ + sscanf( pszP+3, "%d", &i ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM7, i); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM7, 60); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_MIGHTY ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + if( (pszP = strstr( pszOption, "" ) ) != NULL ){ + sscanf( pszP+2, "%f", &fBai ); + iBai = (int)(fBai * 100); + } + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, iBai ); + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( ( pszP = strstr( pszOption, "" ) ) != NULL){ + sscanf( pszP+2, "%d", &iDuck ); + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX)+strdef)); + } + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, iDuck ); + return TRUE; +} + + + +int PETSKILL_PowerBalance( + int charaindex, + int toindex, + int array, + char *data +) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int strdef; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_POWERBALANCE); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + print("\n pszOption == NULL "); + return FALSE; + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX)+strdef)); + } + + return TRUE; +} + +//---------------------------------------------------------------------- +int PETSKILL_StatusChange( + int charaindex, + int toindex, + int array, + char *data + +) +{ + char *pszOption, *pszP; + float fPer = 0.01; + int strdef; + int status = -1, i = 0, turn = 3; + char szTurn[] = "turn"; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_STATUSCHANGE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + pszP = pszOption; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, i ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, turn ); + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER, + (CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef) ); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER, + (CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + + return TRUE; + +} + +#ifdef _VARY_WOLF + +int PETSKILL_Vary( int cindex, int tindex, int id, char* data) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int a_dep; + int d_dep; + int i; + int petid[4] = {981,982,983,984}; + + for( i=0; i<4; i++) { + if( CHAR_getInt( cindex, CHAR_PETID) == petid[i] ) break; + } + if( i>= 4 ) return FALSE; + + CHAR_setWorkInt( cindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_VARY); + CHAR_setWorkInt( cindex, CHAR_WORKBATTLECOM2, tindex ); + CHAR_setWorkInt( cindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( id, PETSKILL_OPTION ); + + + if(pszOption=="\0"){ + //print("\n pszOption==NULL"); + return FALSE; + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( cindex, CHAR_SKILLSTRPOWER, fPer); + fPer = fPer / 100; + a_dep = CHAR_getWorkInt( cindex, CHAR_WORKFIXSTR); + a_dep = (int)(a_dep * fPer); + CHAR_setWorkInt( cindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( cindex, CHAR_WORKFIXSTR) + a_dep); + + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( cindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( cindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( cindex, CHAR_WORKQUICK, CHAR_getWorkInt( cindex, CHAR_WORKFIXDEX) + d_dep); + + } + CHAR_setInt( cindex, CHAR_BASEIMAGENUMBER, 101428); + CHAR_setWorkInt( cindex, CHAR_WORKTURN, 0); + + return TRUE; +} +#endif + + +#ifdef _SKILL_WILDVIOLENT_ATT + +int PETSKILL_WildViolentAttack( + int charaindex, + int toindex, + int array, + char *data + +) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int strdef=0; + int iDuck = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_WILDVIOLENTATTACK); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + //print("\n pszOption == NULL "); + return FALSE; + } + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + //ȡֵ + if( ( pszP = strstr( pszOption, "" ) ) != NULL){ + sscanf( pszP+2, "%d", &iDuck ); + } + // Ĥë + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, iDuck ); + + return TRUE; +} +#endif + +#ifdef _SKILL_SACRIFICE +int PETSKILL_Sacrifice( + int charaindex, + int toindex, + int array, + char *data + +) +{ + char buf[256]; + + if(CHAR_getInt(charaindex,CHAR_HP) > CHAR_getWorkInt(charaindex,CHAR_WORKMAXHP)*0.2 ) + { + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SACRIFICE); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + } + else + { + + sprintf(buf, "%s; Ԯʧ!!", CHAR_getChar( charaindex, CHAR_NAME )); + CHAR_talkToCli( CHAR_getWorkInt(charaindex, CHAR_WORKPLAYERINDEX), -1, buf, CHAR_COLORYELLOW); + return FALSE; + } + return TRUE; +} +#endif +#ifdef _SKILL_REFRESH +int PETSKILL_Refresh( + int charaindex, + int toindex, + int array, + char *data + +) +{ + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_REFRESH); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif +#ifdef _SKILL_WEAKEN //vincent輼: +int PETSKILL_Weaken( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_WEAKEN); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 +int PETSKILL_Deeppoison( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_DEEPPOISON); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif + +#ifdef _SKILL_BARRIER //vincent輼:ħ +int PETSKILL_Barrier( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_BARRIER); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif + +#ifdef _SKILL_NOCAST //vincent輼:Ĭ +int PETSKILL_Nocast( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_NOCAST); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif + +#ifdef _SKILL_ROAR //vincent輼: +int PETSKILL_Roar( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ROAR); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + return TRUE; +} +#endif + +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 +int PETSKILL_GuardBreak2( + int charaindex, + int toNo, + int array, + char *data + +) +{ + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_GBREAK2 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; + +} +#endif + +//******************************************************* +int PETSKILL_NormalAttack( + int charaindex, + int toindex, + int array, + char *data + +) +{ +#ifdef _PETSKILL_NONO_FIX + if(CHAR_getWorkInt(charaindex,CHAR_WORKFIXAI)>=40 && CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)!=BATTLE_CHARMODE_NONE && CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)); + CHAR_setWorkInt(charaindex,CHAR_WORKQUICK,CHAR_getWorkInt(charaindex,CHAR_WORKFIXDEX)); + } +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; + +} + +int PETSKILL_NormalGuard( + int charaindex, + int toindex, + int array, + char *data + +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_GUARD ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; + +} + + +int PETSKILL_None( + int charaindex, + int toindex, + int array, + char *data +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; +} + + +int PETSKILL_EarthRound( + int charaindex, + int toNo, + int array, + char *data +) +{ + char *pszOption, *pszP; + float fPer = 0.01; +#ifdef _FIX_EARTHROUND + if(toNo<0 || toNo>=BATTLE_ENTRY_MAX*2){ + print("err:һܹĿ쳣 %d ", toNo); + return FALSE; + } +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_EARTHROUND1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM3, (int)fPer ); + } + + + return TRUE; + +} + + +int PETSKILL_GuardBreak( + int charaindex, + int toNo, + int array, + char *data + +) +{ + char *pszOption, *pszP; + float fPer = 0.01; + int strdef; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_GBREAK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + + return TRUE; + +} +#ifdef _SKILL_SPEEDY_ATT//ٹ vincent add 2002/05/20 +int PETSKILL_SpeedyAttack( + int charaindex, + int toNo, + int array, + char *data + +) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int strdef=0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SPEEDYATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + //print("\n pszOption == NULL "); + return FALSE; + } + + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + return TRUE; + +} +#endif + +int PETSKILL_Abduct( + int charaindex, + int toNo, + int array, + char *data +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ABDUCT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); + + return TRUE; +} + +int PETSKILL_Steal( + int charaindex, + int toNo, + int array, + char *data +) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_STEAL ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return TRUE; +} + +#ifdef _BATTLESTEAL_FIX +int PETSKILL_StealMoney( int charaindex, int toNo, int array, char *data) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_STEALMONEY ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return TRUE; +} +#endif + +//******************************************************* +// -- ʧ ة +// +int PETSKILL_Merge( + int charaindex, + int toNo, + int array, + char *data +) +{ + int ret, ownerindex; + + // Robin 0521 debug + ownerindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + if( CHAR_getWorkInt( ownerindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + print(" Merge_ErrB:fd=%d ", ownerindex); + return FALSE; + } + ret = ITEM_mergeItem_merge( CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX), + CHAR_getInt( charaindex, CHAR_PETID), data, charaindex, 0); + return ret; +} + +#ifdef _ALCHEMIST +int PETSKILL_Alchemist( + int charaindex, + int toNo, + int array, + char *data +) +{ + int ret, ownerindex; + + // Robin 0521 debug + ownerindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + if( CHAR_getWorkInt( ownerindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + //print(" Merge_Alchemist_ErrB:fd=%d ", ownerindex); + return FALSE; + } + ret = ITEM_mergeItem_merge( CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX), + CHAR_getInt( charaindex, CHAR_PETID), data, charaindex, 1); + return ret; +} +#endif + +int PETSKILL_NoGuard( + int charaindex, + int toNo, + int array, + char *data + +) +{ + char *pszOption, *pszP; + int Duck = 0, Counter = 0, Critical = 0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_NOGUARD ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%d", &Duck ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, Duck ); + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%d", &Counter ); + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%d", &Critical ); + } + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, + (Counter << 8) + Critical ); + + return TRUE; +} + +#ifdef _ATTACK_MAGIC + +int PETSKILL_AttackMagic( + int charaindex, + int toindex, + int array, + char *data +) +{ + char *pszP; + char szMagic[] = "magic"; + char szItem[] = "item"; + int magic = 313; // magic idԤΪħȼһ,item indexԤΪ19659 +// int item = 19659; + // ȡó\ + pszP = PETSKILL_getChar( array, PETSKILL_OPTION ); + + // ȡʩŵħmagic id + if((pszP = strstr(pszP,szMagic)) != NULL) + { + pszP += sizeof(szMagic); + sscanf(pszP,"%d",&magic); + } +/* + // ȡдħԵitem index + if((pszP = strstr(pszP,szItem)) != NULL) + { + pszP += sizeof(szItem); + sscanf(pszP,"%d",&item); + } +*/ + // 趨\Ϊħ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM1,BATTLE_COM_S_ATTACK_MAGIC ); + // Ŀ趨 + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM2,toindex); + // 趨ʹõһħ + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3,magic); + // 趨ʹõħĵ +// CHAR_SETWORKINT_HIGH(charaindex,CHAR_WORKBATTLECOM3,item); + // ´ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEMODE,BATTLE_CHARMODE_C_OK ); + + return TRUE; +} + +#endif + +#ifdef _PSKILL_FALLGROUND // +int PETSKILL_FallGround( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption, *pszP; + float fPer = 0.01; + int strdef; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_FALLRIDE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + return TRUE; + +} //BATTLE_COM_S_DAMAGETOHP +#endif + +#ifdef _PRO_BATTLEENEMYSKILL +int ENEMYSKILL_ReLife( int enemyindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ENEMYRELIFE ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return TRUE; +} + +int ENEMYSKILL_ReHP( int enemyindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ENEMYREHP ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return TRUE; +} + +int ENEMYSKILL_EnemyHelp( int enemyindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ENEMYHELP ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( enemyindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + return TRUE; +} + +#endif + +#ifdef _SKILL_DAMAGETOHP //Ѫ { "PETSKILL_DamageToHp", PETSKILL_DamageToHp, 0}, +int PETSKILL_DamageToHp( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption; + char buf1[256]; + int strdef; + float def=0.00; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_DAMAGETOHP ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3, array); //¼ + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + + strdef = CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + def = (atoi( buf1)/100); + strdef = strdef - (int)(strdef*def); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, strdef); + + return TRUE; + +} +#endif + +#ifdef _Skill_MPDAMAGE +int PETSKILL_MpDamage( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption; + char buf1[256]; + int strdef; + float def=0.00; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_MPDAMAGE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3, array); ////¼ + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + + def = (float)(atoi( buf1)/100); + strdef = CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef = strdef - (int)( strdef*def); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, strdef); + + return TRUE; +} +#endif + + +#ifdef _SKILL_TOOTH +int PETSKILL_ToothCrushe( int charaindex, int toNo, int array, char *data ) +{ + //char *pszOption; + //char buf1[256]; + //int strdef; + //float def=0.00; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_TOOTHCRUSHE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ +/* + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + + def = (float)(atoi( buf1)/100); + strdef = CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef = strdef - (int)( strdef*def); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, strdef); +*/ + return TRUE; +} +#endif +#ifdef _PSKILL_MODIFY +int PETSKILL_Modifyattack( int charaindex, int toNo, int array, char *data ) +{ + //char *pszOption; + //char buf1[256]; + //int strdef; + //float def=0.00; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_MODIFYATT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ +/* + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + + def = (float)(atoi( buf1)/100); + strdef = CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef = strdef - (int)( strdef*def); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, strdef); +*/ + return TRUE; +} +#endif + +#ifdef _PSKILL_MDFYATTACK +int PETSKILL_Mdfyattack( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption; + char buf1[256]; + char MNodify[][36]={"EA","WA","FI","WI"}; + int nums, i; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_MDFYATTACK); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + if( getStringFromIndexWithDelim( pszOption, "|", 1, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + for( i=0; i<4; i++) { + if( strcmp( buf1, MNodify[i]) ) continue; + break; + } + if( i == 4 ) return FALSE; + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM4, i);//¼ + if( getStringFromIndexWithDelim( pszOption, "|", 2, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + nums=atoi( buf1); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM4, nums);//¼ֵ + return TRUE; +} +#endif + +#ifdef _ITEM_INSLAY +int PETSKILL_Inslay( int index, int toNo, int array, char *data) +{ + int charaindex, petid; + + int inslayindex=-1, inslayno=-1; + int i, j, itemno; +#define MAXINSLAY 4 + int itemindexs[MAXINSLAY]={-1,-1,-1,-1}; + int itemnos[MAXINSLAY]={-1,-1,-1,-1}; + + if( !CHAR_CHECKINDEX( index) ) return FALSE; + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPET ) return FALSE; + charaindex = CHAR_getWorkInt( index, CHAR_WORKPLAYERINDEX); + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) + return FALSE; + petid = CHAR_getInt( charaindex, CHAR_PETID); + + + for( i = 0; i < 15; i ++ ) { + char buf[256]; + char *buf1; + int itemindex; + if( getStringFromIndexWithDelim( data , "|", i+1, buf, sizeof( buf ) ) == FALSE ) break; + itemno = atoi( buf); + if( !CHAR_CHECKITEMINDEX( charaindex, itemno) ) continue; + itemindex = CHAR_getItemIndex( charaindex, itemno); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + + if( i >= MAXINSLAY ) { + CHAR_talkToCli( charaindex, -1, "ÿֻѡĸƷ", CHAR_COLORYELLOW); + return FALSE; + } + for( j=0; j< MAXINSLAY; j++ ) { + if( itemindexs[j] == itemindex ) { + //print("Ʒindexͬ ERROR !!\n"); + return FALSE; + } + } + if( (buf1 = ITEM_getChar( itemindex, ITEM_TYPECODE)) == "\0" ) { + //print(" ITEM_TYPECODE == NULL !!\n"); + return FALSE; + } + if( !strcmp( buf1, "\0") || !strcmp( buf1, "NULL") ) { + CHAR_talkToCli( charaindex, -1, "ƷʺϾ", CHAR_COLORYELLOW); + return FALSE; + } + if( strstr( buf1, "INSLAY") != 0 ) { + if( !ITEM_CHECKINDEX( inslayindex)) { + inslayindex = itemindex; + inslayno = itemno; + }else { + CHAR_talkToCli( charaindex, -1, "ÿֻѡһߡ", CHAR_COLORYELLOW); + return FALSE; + } + } + itemindexs[i] = itemindex; + itemnos[i] = itemno; + } + + if( !ITEM_CHECKINDEX( inslayindex) ) { + CHAR_talkToCli( charaindex, -1, "ѡһߡ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i=0; i< MAXINSLAY; i++) { + if( !ITEM_CHECKINDEX( itemindexs[i]) )break; + if( inslayindex == itemindexs[i] ) continue; + if( PETSKILL_ITEM_inslay( charaindex, inslayindex, itemindexs[i] ) == FALSE ){ + return FALSE; + } + CHAR_DelItem( charaindex, itemnos[i]); +/* + CHAR_setItemIndex( charaindex, itemnos[i] ,-1); + CHAR_sendItemDataOne( charaindex, itemnos[i] ); + ITEM_endExistItemsOne( itemindexs[i]); +*/ + } + + CHAR_sendItemDataOne( charaindex, inslayno ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_ATK | CHAR_P_STRING_DEF + | CHAR_P_STRING_QUICK | CHAR_P_STRING_CHARM ); + + return TRUE; +} + +#endif + +#ifdef _MAGIC_SUPERWALL +int PETSKILL_MagicStatusChange( int charaindex, int toindex, int array, char *data ) +{ + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SUPERWALL); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toindex ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + return TRUE; +} + +#endif + +#ifdef _PETSKILL_SETDUCK +int PETSKILL_SetDuck( int charaindex, int toNo, int array, char *data ) +{ + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + return FALSE; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SETDUCK); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + + CHAR_setWorkInt( charaindex, CHAR_MAGICPETMP, 0 ); + return TRUE; +} +#endif + +#ifdef _MAGICPET_SKILL +int PETSKILL_SetMagicPet( int charaindex, int toNo, int array, char *data ) +{ + int nums=0; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) + return FALSE; + + nums = CHAR_getWorkInt( charaindex, CHAR_MAGICPETMP); + if( nums >= 3 ){ + int toindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + CHAR_talkToCli( toindex, -1, "˼ܵΡ", CHAR_COLORYELLOW); + return FALSE; + } + CHAR_setWorkInt( charaindex, CHAR_MAGICPETMP, nums ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SETMAGICPET); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_FIXITEM +int PETSKILL_Fixitem( int index, int toNo, int array, char *data) +{ + int charaindex, petid; + + int fixindex=-1, fixno=-1; + int i, j, itemno; +#define MAXFIXITEM 2 + int itemindexs[MAXFIXITEM]={-1,-1}; + int itemnos[MAXFIXITEM]={-1,-1}; + + if( !CHAR_CHECKINDEX( index) ) return FALSE; + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPET ) return FALSE; + charaindex = CHAR_getWorkInt( index, CHAR_WORKPLAYERINDEX); + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) + return FALSE; + petid = CHAR_getInt( charaindex, CHAR_PETID); + + + for( i = 0; i < 15; i ++ ) { + char buf[256]; + int itemtype=-1; + int itemindex; + if( getStringFromIndexWithDelim( data , "|", i+1, buf, sizeof( buf ) ) == FALSE ) break; + itemno = atoi( buf); + if( !CHAR_CHECKITEMINDEX( charaindex, itemno) ) continue; + itemindex = CHAR_getItemIndex( charaindex, itemno); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + + if( i >= MAXFIXITEM ) { + CHAR_talkToCli( charaindex, -1, "޸ÿֻѡƷ", CHAR_COLORYELLOW); + return FALSE; + } + for( j=0; j< MAXFIXITEM; j++ ) { + if( itemindexs[j] == itemindex ) { + //print("޸Ʒindexͬ ERROR !!\n"); + return FALSE; + } + } + itemtype = ITEM_getInt( itemindex, ITEM_TYPE); + if( itemtype == ITEM_DISH ) { + CHAR_talkToCli( charaindex, -1, "޸", CHAR_COLORYELLOW); + return FALSE; + } + + if( (itemtype >= ITEM_FIST && itemtype <= ITEM_AMULET) || + itemtype == ITEM_BOOMERANG || itemtype == ITEM_BOUNDTHROW || itemtype == ITEM_BREAKTHROW +#ifdef _ITEM_EQUITSPACE + || itemtype == ITEM_WBELT + || itemtype == ITEM_WSHIELD + || itemtype == ITEM_WSHOES +#endif +#ifdef _EQUIT_NEWGLOVE + || itemtype == ITEM_WGLOVE +#endif +#ifdef _PET_ITEM +#ifndef _TAKE_ITEMDAMAGE_FOR_PET + || (itemtype >= ITEM_PET_HEAD && itemtype <= ITEM_PET_FEET) +#endif +#endif + ){ + if( !ITEM_CHECKINDEX( fixindex)) { + fixindex = itemindex; + fixno = itemno; + }else { + CHAR_talkToCli( charaindex, -1, "޸ÿֻѡһߡ", CHAR_COLORYELLOW); + return FALSE; + } + } + + itemindexs[i] = itemindex; + itemnos[i] = itemno; + } + + if( !ITEM_CHECKINDEX( fixindex) ) { + CHAR_talkToCli( charaindex, -1, "޸ѡһߡ", CHAR_COLORYELLOW); + return FALSE; + } + + if( PETSKILL_ITEM_FixItem( charaindex, fixindex, itemindexs ) == FALSE ){ + return FALSE; + }else { + for( i=0; i< MAXFIXITEM; i++) { + if( !ITEM_CHECKINDEX( itemindexs[i]) )break; + if( fixindex == itemindexs[i] ) continue; + CHAR_setItemIndex( charaindex, itemnos[i] ,-1); + CHAR_sendItemDataOne( charaindex, itemnos[i] ); + ITEM_endExistItemsOne( itemindexs[i]); + } + } + + CHAR_sendItemDataOne( charaindex, fixno ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_ATK | CHAR_P_STRING_DEF + | CHAR_P_STRING_QUICK | CHAR_P_STRING_CHARM ); + CHAR_talkToCli( charaindex, -1, "޸ɡ", CHAR_COLORYELLOW); + return TRUE; +} +#endif + +#ifdef _PETSKILL_TIMID +int PETSKILL_BattleTimid( int charaindex, int toNo, int array, char *data ) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_TIMID ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.7) ); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.4) ); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*0.8) ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + return TRUE; +} +#endif +#ifdef _PETSKILL_2TIMID +int PETSKILL_2BattleTimid( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption="\0"; + char *pszP; + float fPer=0; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_2TIMID ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + if( (pszP = strstr( pszOption, "-%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*fPer) ); + } + if( (pszP = strstr( pszOption, "+%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)+(CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*fPer) ); + } + if( (pszP = strstr( pszOption, "-%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*fPer) ); + } + if( (pszP = strstr( pszOption, "+%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)+(CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*fPer) ); + } + if( (pszP = strstr( pszOption, "-%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*fPer) ); + } + if( (pszP = strstr( pszOption, "+%" ) ) != NULL ){ + sscanf( pszP+4, "%f", &fPer ); + fPer=(fPer/100); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)+(CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*fPer) ); + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + return TRUE; +} +#endif +#ifdef _PETSKILL_ANTINTER +int PETSKILL_AntInter( int charaindex, int toNo, int array, char* data) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ANTINTER); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_PROPERTY +int PETSKILL_BattleProperty( int charaindex, int toNo, int array, char *data ) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_PROPERTYSKILL ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + +// CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.7) ); +// CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.5) ); +// CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*0.95) ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + + return TRUE; +} +#endif + +#ifdef _PETSKILL_TEAR +int PETSKILL_BattleTearDamage( int charaindex, int toNo, int array, char *data ) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_PETSKILLTEAR ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.9) ); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, ( CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.8) ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + return TRUE; +} +#endif + + +#ifdef _BATTLE_LIGHTTAKE +int PETSKILL_Lighttakeed( int charaindex, int toNo, int array, char *data ) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_LIGHTTAKE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.7) ); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.5) ); +// CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX)*0.95) ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + return TRUE; +} +#endif + +#ifdef _BATTLE_ATTCRAZED +int PETSKILL_AttackCrazed( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption="\0",*pszP; + int attnum,strdef,d_dep; + float fPer = 0.01; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ATTCRAZED ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + +// CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR)*0.8) ); +// CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH)*0.7) ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( charaindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) + d_dep); + } + + if( (pszP = strstr( pszOption, "" ) ) != NULL ){ + sscanf( pszP+3, "%d", &attnum ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, attnum); + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + //CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, atoi(pszOption)); + return TRUE; +} +#endif + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 +int PETSKILL_AttackShoot( int charaindex, int toNo, int array, char *data ) +{ + //int n = RAND ( 3 , 5 ) ; + int n ; + int loyal = CHAR_getWorkInt( charaindex, CHAR_WORKFIXAI ); + char bb1[16] , bb2[16] ; + char *buf = "\0" ; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return FALSE; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ATTSHOOT ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + buf = PETSKILL_getChar( array , PETSKILL_OPTION ) ; + if ( buf == "\0" ) return FALSE; + getStringFromIndexWithDelim( buf , "|", 1 , bb1 , sizeof( bb1 ) ); + getStringFromIndexWithDelim( buf , "|", 2 , bb2 , sizeof( bb2 ) ); + n = RAND ( atoi(bb1) , atoi(bb2) ) ; + if ( loyal >= 100 ) { + if ( RAND ( 1 , 300 ) > 299 ) + n = 8 ; + else if ( (CHAR_getInt( charaindex , CHAR_HP )) < 20 && ( RAND ( 1 , 50 ) > 49 ) ) + n = 8 ; + } +/* + if ( n != 8 ) + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR) * 1.2 / n ) ); + else + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXSTR) * 1.2 / 4 ) ); + CHAR_setWorkInt( charaindex, CHAR_WORKDEFENCEPOWER, (CHAR_getWorkInt( charaindex, CHAR_WORKFIXTOUGH) * 1) ); +*/ + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array);//¼ + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, n); + return TRUE; +} +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ +int PETSKILL_Sars( int charaindex, int toNo, int array, char *data ) +{ + + char *pszOption, *pszP; + int status = -1, i = 0, turn = 3; + char szTurn[] = "turn"; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SARS ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + pszP = pszOption; + + for( ;status == -1 && pszP[0] != 0; pszP++ ){ + for( i = 1; i < BATTLE_ST_END; i ++ ){ + if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){ + status = i; + pszP +=2; + break; + } + } + } + + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, status ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, turn ); + + return TRUE; + + +} +#endif + +#ifdef _SONIC_ATTACK // WON ADD +int PETSKILL_Sonic( int charaindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SONIC ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; + +} +#endif +#ifdef _PETSKILL_REGRET +int PETSKILL_Regret( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption, *pszP; + int strdef,d_dep; + float fPer = 0.01; + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( charaindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) + d_dep); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_REGRET ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; + +} +#endif + +#ifdef _PETSKILL_GYRATE +int PETSKILL_Gyrate( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int strdef=0; + char szTurn[] = "turn"; + int d_dep,i=0; + int randi=0; + //char *hetStatus[]={"ȫ", "", "", "", "ʯ", "", "", "", "", "", "Ĭ"}; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_GYRATE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); // 23,24,25,26 Ϊ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + //print("\n pszOption == NULL "); + return FALSE; + } +#ifdef _PSKILL_GYRATE + for(i=0;ii){ +// CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM5, 0); +// } + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM7, 60); +// randi=RAND(1,100); +// if(randi>60){ +// CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM5, 0); +// } + } +#endif + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } +#ifdef _PSKILL_GYRATE + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( charaindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) + d_dep); + } +#endif + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_ACUPUNCTURE +int PETSKILL_Acupuncture( int charaindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_ACUPUNCTURE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_RETRACE +int PETSKILL_Retrace( int charaindex, int toNo, int array, char *data ) +{ + //char *pszOption="\0", *pszP; + //float fPer = 0.01; + //int strdef=0; + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_RETRACE ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + +/* pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + print("\n pszOption == NULL "); + return FALSE; + } + + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } +*/ + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_HECTOR +int PETSKILL_Hector( int charaindex, int toNo, int array, char *data ) +{ + char *pszOption="\0", *pszP; + float fPer = 0.01; + int strdef; + char szTurn[] = "turn"; + int d_dep,i=0; + char *hetStatus[]={"ȫ", "", "", "", "ʯ", "", "", "", "", "", "Ĭ"}; + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_HECTOR ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) { + //print("\n pszOption == NULL "); + return FALSE; + } + for(i=0;i<11;i++){ + if((pszP = strstr( pszOption, hetStatus[i] ) ) != NULL) break; + } + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM5, i); + if((pszP = strstr( pszOption, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &i ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM6, i); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM6, 1); + } + + if((pszP = strstr( pszOption, "" ) ) != NULL){ + sscanf( pszP+3, "%d", &i ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM7, i); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM7, 60); + } + + //ȡֵ + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( pszOption, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( charaindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) + d_dep); + } + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + + return TRUE; +} +#endif + +#ifdef _PETSKILL_FIREKILL +int PETSKILL_Firekill( int charaindex, int toNo, int array, char *data ) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_FIREKILL ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + + return TRUE; +} +#endif + +#ifdef _PETSKILL_DAMAGETOHP +int PETSKILL_DamageToHp2( int charaindex, int toNo, int array, char *data ) +{ + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_DAMAGETOHP2 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3, array); //¼ +/* pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + + if( pszOption == "\0" ) return FALSE; + + strdef = CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + def = (atoi( pszOption)/100); + strdef = strdef - (int)(strdef*def); + CHAR_setWorkInt( charaindex, CHAR_WORKATTACKPOWER, strdef); +*/ + + return TRUE; + +} +#endif + +#ifdef _PETSKILL_BECOMEFOX +int PETSKILL_BecomeFox( int charaindex, int toNo, int array, char* data) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_BECOMEFOX); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3, array); //¼ + + return TRUE; +} +#endif + +#ifdef _PETSKILL_BECOMEPIG +int PETSKILL_BecomePig( int charaindex, int toNo, int array, char* data) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_BECOMEPIG); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); //¼ + return TRUE; +} +#endif + +#ifdef _PETSKILL_LER +int PETSKILL_BatFly(int charaindex,int toNo,int array,char* data) +{ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM1,BATTLE_COM_S_BAT_FLY); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM2,toNo); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEMODE,BATTLE_CHARMODE_C_OK); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3,array); + return TRUE; +} + +int PETSKILL_DivideAttack( int charaindex, int toNo, int array, char* data) +{ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM1,BATTLE_COM_S_DIVIDE_ATTACK); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM2,toNo); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEMODE,BATTLE_CHARMODE_C_OK); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM3,array); + return TRUE; +} +#endif + +#ifdef _PETSKILL_BATTLE_MODEL +int PETSKILL_BattleModel(int charaindex, int toindex, int array, char* data) +{ + float fPer; + int i,iType,iObjectNum,iValue,strdef,d_dep; + char *pszOption="\0",*pszP,szData[32],szData2[32]; + + pszOption = PETSKILL_getChar(array,PETSKILL_OPTION); + if(pszOption == "\0"){ + //printf("PETSKILL_BattleModel: ȡ PETSKILL_OPTION !!(:%d,ļ:%s,%d)\n",array,__FILE__,__LINE__); + return FALSE; + } + + // ȡù + if(getStringFromIndexWithDelim(pszOption,"|",1,szData,sizeof(szData)) == FALSE){ + //printf("PETSKILL_BattleModel: no type data!!(ļ:%s,%d)\n",__FILE__,__LINE__); + return FALSE; + } + iType = atoi(szData); + // ȡù + if(getStringFromIndexWithDelim(pszOption,"|",2,szData,sizeof(szData)) == FALSE){ + //printf("PETSKILL_BattleModel: no object number data!!(ļ:%s,%d)\n",__FILE__,__LINE__); + return FALSE; + } + iObjectNum = atoi(szData); + if(iObjectNum <= 0) iObjectNum = RAND(1,10); + else if(iObjectNum > 10) iObjectNum = 10; + // ȡ + if(getStringFromIndexWithDelim(pszOption,"|",6,szData,sizeof(szData)) != FALSE){ + // 趨 + if(CHAR_getWorkInt(charaindex,CHAR_WORKPETSKILLBT)==0 && CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEINDEX)>-1){ + //ȡֵ + if( (pszP = strstr( szData, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + + //趨ֵ + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKATTACKPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXSTR)+strdef)); + } +#ifdef _PSKILL_BATTLE_MODEL + if( (pszP = strstr( szData, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + fPer=(fPer/100); + strdef=CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH); + strdef=(int)(strdef * fPer); + CHAR_setWorkInt(charaindex,CHAR_WORKDEFENCEPOWER,(CHAR_getWorkInt(charaindex,CHAR_WORKFIXTOUGH)+strdef)); + } + + if( (pszP = strstr( szData, "%" ) ) != NULL ){ + sscanf( pszP+3, "%f", &fPer ); + CHAR_setWorkInt( charaindex, CHAR_SKILLDEXPOWER, fPer); + fPer = fPer / 100; + d_dep = CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX); + d_dep = (int)(d_dep * fPer); + CHAR_setWorkInt( charaindex, CHAR_WORKQUICK, CHAR_getWorkInt( charaindex, CHAR_WORKFIXDEX) + d_dep); + } +#endif + } + } + CHAR_setWorkInt(charaindex,CHAR_WORKPETSKILLBT,1); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEMODE,BATTLE_CHARMODE_C_OK); + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM1,BATTLE_COM_S_BATTLE_MODEL); + CHAR_SETWORKINT_LOW(charaindex,CHAR_WORKBATTLECOM2,iType); // ¼ + CHAR_SETWORKINT_HIGH(charaindex,CHAR_WORKBATTLECOM2,iObjectNum); // ¼ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLECOM3,array); + return TRUE; +} +#endif + +#ifdef _PETSKILL_SHOWMERCY +int PETSKILL_ShowMercy( int charaindex, int toNo, int array, char* data) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_SHOWMERCY); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return TRUE; +} +#endif + +#ifdef _PETSKILL_COMBINED +int PETSKILL_Combined( int charaindex, int toNo, int array, char* data) +{ + char *pszOption="\0"; + char combined[32]; + int kill[10],count,i; + char killstr[32],countstr[32]; + + pszOption = PETSKILL_getChar( array, PETSKILL_OPTION ); + if( pszOption == "\0" ) return FALSE; + + strcpysafe( combined,sizeof(combined), " " ); + getStringFromIndexWithDelim( pszOption, "|", 1, combined, sizeof( combined)); + if( strcmp( combined, "ۺϷ" ) == 0 ){ + if( getStringFromIndexWithDelim( pszOption, "|", 2, countstr, sizeof( countstr)) == FALSE ) + return FALSE; + count = atoi(countstr); + if( count > 10 ) + count = 10; + for(i=0;i +#include +#include +#include "buf.h" +#include "profession_skill.h" +#include "char_base.h" +#include "battle.h" +#include "magic_base.h" +#include "configfile.h" +#include "char.h" +#include "lssproto_serv.h" +#include "skill.h" + +static Professionskill *PROFESSION_skill; + +typedef struct tagProfessionskill_skillFunctionTable +{ + char *functionname; + PROFESSION_SKILL_CALLFUNC func; + int hash; +// int status; +}PROFESSION_SKILL_skillFunctionTable; + +static PROFESSION_SKILL_skillFunctionTable PROFESSION_SKILL_functbl[] = { + +// ʦ + { "PROFESSION_VOLCANO_SPRINGS", PROFESSION_volcano_springs, 0 }, // ɽȪ + { "PROFESSION_FIRE_BALL", PROFESSION_fire_ball, 0 }, // + { "PROFESSION_FIRE_SPEAR", PROFESSION_fire_spear, 0 }, // ǹ + { "PROFESSION_SUMMON_THUNDER", PROFESSION_summon_thunder, 0 }, // + { "PROFESSION_CURRENT", PROFESSION_current, 0 }, // + { "PROFESSION_STORM", PROFESSION_storm, 0 }, // + { "PROFESSION_ICE_ARROW", PROFESSION_ice_arrow, 0 }, // + { "PROFESSION_ICE_CRACK", PROFESSION_ice_crack, 0 }, // + { "PROFESSION_ICE_MIRROR", PROFESSION_ice_mirror, 0 }, // + { "PROFESSION_DOOM", PROFESSION_doom, 0 }, // ĩ + { "PROFESSION_BLOOD", PROFESSION_blood, 0 }, // Ѫ + { "PROFESSION_BLOOD_WORMS", PROFESSION_blood_worms, 0 }, // Ѫ + { "PROFESSION_SIGN", PROFESSION_sign, 0 }, // һѪ + { "PROFESSION_FIRE_ENCLOSE", PROFESSION_fire_enclose, 0 }, // + { "PROFESSION_ICE_ENCLOSE", PROFESSION_ice_eclose, 0 }, // + { "PROFESSION_THUNDER_ENCLOSE", PROFESSION_thunder_enclose, 0 }, // ׸ + { "PROFESSION_FIRE_PRACTICE", PROFESSION_fire_practice, 0 }, // ħ + { "PROFESSION_ICE_PRACTICE", PROFESSION_ice_practice, 0 }, // ħ + { "PROFESSION_THUNDER_PRACTICE",PROFESSION_thunder_practice,0 }, // ħ + { "PROFESSION_ENCLOSE", PROFESSION_enclose, 0 }, // + { "PROFESSION_TRANSPOSE", PROFESSION_transpose, 0 }, // λλ +// { "PROFESSION_ALCHEMY", PROFESSION_alchemy, 0 }, // + +// ʿ + { "PROFESSION_CHAIN_ATK", PROFESSION_chain_atk, 0 }, // + { "PROFESSION_AVOID", PROFESSION_avoid, 0 }, // ر + { "PROFESSION_WEAPON_FOCUS", PROFESSION_weapon_focus, 0 }, // ר + { "PROFESSION_REBACK", PROFESSION_reback, 0 }, // ״̬ظ + { "PROFESSION_BRUST", PROFESSION_brust, 0 }, // + { "PROFESSION_CHAIN_ATK_2", PROFESSION_chain_atk_2, 0 }, // ˫ع + { "PROFESSION_SCAPEGOAT", PROFESSION_scapegoat, 0 }, // Ϊ + { "PROFESSION_ENRAGE", PROFESSION_enrage, 0 }, // + { "PROFESSION_ENERGY_COLLECT", PROFESSION_energy_collect, 0 }, // ۼ + { "PROFESSION_FOCUS", PROFESSION_focus, 0 }, // רעս + { "PROFESSION_SHIELD_ATTACK", PROFESSION_shield_attack, 0 }, // ܻ + { "PROFESSION_DUAL_WEAPON", PROFESSION_dual_weapon, 0 }, // + { "PROFESSION_DEFLECT", PROFESSION_deflect, 0 }, // + { "PROFESSION_THROUGH_ATTACK", PROFESSION_through_attack, 0 }, // ᴩ + { "PROFESSION_CAVALRY", PROFESSION_cavalry, 0 }, // ﹥ + { "PROFESSION_DEAD_ATTACK", PROFESSION_dead_attack, 0 }, // + { "PROFESSION_CONVOLUTE", PROFESSION_convolute, 0 }, // + { "PROFESSION_CHAOS", PROFESSION_chaos, 0 }, // ҹ + +// + { "PROFESSION_TRACK", PROFESSION_track, 0 }, // ׷Ѱ + { "PROFESSION_ESCAPE", PROFESSION_escape, 0 }, // رս + { "PROFESSION_DOCILE", PROFESSION_docile, 0 }, // ѱ + { "PROFESSION_TRAP", PROFESSION_trap, 0 }, // + { "PROFESSION_ENRAGE_PET", PROFESSION_enrage_pet, 0 }, // ŭ + { "PROFESSION_DRAGNET", PROFESSION_dragnet, 0 }, // ޵ + { "PROFESSION_ENTWINE", PROFESSION_entwine, 0 }, // + { "PROFESSION_AUTARKY", PROFESSION_autarky, 0 }, // Ը + { "PROFESSION_PLUNDER", PROFESSION_plunder, 0 }, // Ӷ + { "PROFESSION_TOXIN_WEAPON", PROFESSION_toxin_weapon, 0 }, // + { "PROFESSION_RESIST_FIRE", PROFESSION_resist_fire, 0 }, // + { "PROFESSION_RESIST_ICE", PROFESSION_resist_ice, 0 }, // + { "PROFESSION_RESIST_THUNDER", PROFESSION_resist_thunder, 0 }, // ׿ +#ifdef _PROFESSION_ADDSKILL + { "PROFESSION_RESIST_F_I_T", PROFESSION_resist_f_i_t, 0 }, // Ȼ + { "PROFESSION_CALL_NATURE", PROFESSION_call_nature, 0 }, // Ȼ + { "PROFESSION_BOUNDARY", PROFESSION_boundary, 0 }, // Խ +#endif + { "PROFESSION_G_RESIST_FIRE", PROFESSION_g_resist_fire, 0 }, // + { "PROFESSION_G_RESIST_ICE", PROFESSION_g_resist_ice, 0 }, // + { "PROFESSION_G_RESIST_THUNDER",PROFESSION_g_resist_thunder,0 }, // ׿ + { "PROFESSION_ATTACK_WEAK", PROFESSION_attack_weak, 0 }, // 㹥 + { "PROFESSION_INSTIGATE", PROFESSION_instigate, 0 }, // + { "PROFESSION_OBLIVION", PROFESSION_oblivion, 0 }, // + +// ͬ + { "PROFESSION_FULL_MP", PROFESSION_full_mp, 0 }, // + { "PROFESSION_STRONG_BACK", PROFESSION_strong_back, 0 }, // + { "PROFESSION_STRENGTHEN", PROFESSION_strengthen, 0 }, // ǿ + +}; + + +static int profession_skill_num; // ְҵ + +// profession.txt +BOOL PROFESSION_initSkill( char *filename) +{ + + FILE* f; + char line[256]; + int linenum=-1; + int skill_readlen=0; + int i, j; + + int max_skillid = 0; + + f = fopen(filename,"r"); + if( f == NULL ){ + print( "file open error\n"); + return FALSE; + } + + profession_skill_num=0; + + while( fgets( line, sizeof( line ), f ) ){ + char token[256]; + + linenum ++; + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + profession_skill_num++; +#ifdef _PROSKILL_OPTIMUM // Robin ȡְID + if( getStringFromIndexWithDelim( line, ",", + PROFESSION_SKILL_DATACHARNUM+PROFESSION_SKILL_ID+1, + token, sizeof(token)) == FALSE ) + continue; + max_skillid = max( atoi( token), max_skillid); +#endif + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Seek Error\n" ); + fclose(f); + return FALSE; + } + +#ifdef _PROSKILL_OPTIMUM // ְTableΪ ID +1 + profession_skill_num = max_skillid +1; + print("ְID = %d ...", max_skillid); +#endif + + PROFESSION_skill = allocateMemory( sizeof(struct tagProfessionkill) * profession_skill_num + 1 ); + + + if( PROFESSION_skill == NULL ){ + fprint( "޷ڴ %d\n", sizeof(struct tagProfessionkill)*profession_skill_num); + fclose( f ); + return FALSE; + } + + // init skill + for( i = 0; i < profession_skill_num; i ++ ) { + for( j = 0; j < PROFESSION_SKILL_DATAINTNUM; j ++ ) + PROFESSION_SKILL_setInt( i,j,-1); + + for( j = 0; j < PROFESSION_SKILL_DATACHARNUM; j ++ ) + PROFESSION_SKILL_setChar( i,j,""); + } + + linenum = -1; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + + chomp( line ); + + replaceString( line, '\t' , ' ' ); + + { + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpysafe( buf,sizeof(buf), &line[i]); + } + + if( i != 0 ) { + strcpysafe( line,sizeof(line), buf); + } + } + { + char token[256]; + int ret; + +#ifdef _PROSKILL_OPTIMUM // ȡְID, ְֱIDTable index + ret = getStringFromIndexWithDelim( line, ",", PROFESSION_SKILL_DATACHARNUM+PROFESSION_SKILL_ID+1, token, sizeof(token)); + if( ret==FALSE ){ + //fprint("Syntax Error file:%s line:%d\n",filename,linenum); + break; + } + skill_readlen = atoi( token); +#endif + for( i = 0; i < PROFESSION_SKILL_DATACHARNUM; i ++ ) { + + ret = getStringFromIndexWithDelim( line,",", i + 1, token,sizeof(token)); + if( ret==FALSE ){ + //fprint("Syntax Error file:%s line:%d\n",filename,linenum); + break; + } + PROFESSION_SKILL_setChar( skill_readlen, i, token); + } + + for( i = 0; i < PROFESSION_SKILL_DATAINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line, ",", i+PROFESSION_SKILL_DATACHARNUM+1, token, sizeof(token)); + + if( ret==FALSE ){ + //fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + if( strlen( token) != 0 ) { + PROFESSION_SKILL_setInt( skill_readlen, i , atoi( token )); + } + } + skill_readlen ++; + } + } + fclose(f); + + profession_skill_num = skill_readlen; + + for( i = 0; i < arraysizeof( PROFESSION_SKILL_functbl); i ++ ){ + PROFESSION_SKILL_functbl[i].hash = hashpjw( PROFESSION_SKILL_functbl[i].functionname ); + } + + return TRUE; + +} + + +// profession.txt +void rePROFESSION_initSkill() +{ + freeMemory( PROFESSION_skill ); + PROFESSION_initSkill(getProfession()); +} + +INLINE BOOL PROFESSION_SKILL_CHECKINDEX( int index ) +{ + if( profession_skill_num < index || index < 0 )return FALSE; + return TRUE; +} + +static INLINE BOOL PROFESSION_SKILL_CHECKINTDATAINDEX( int index) +{ + if( PROFESSION_SKILL_DATAINTNUM < index || index < 0 ) return FALSE; + return TRUE; +} + +static INLINE BOOL PROFESSION_SKILL_CHECKCHARDATAINDEX( int index) +{ + if( PROFESSION_SKILL_DATACHARNUM < index || index < 0 ) return FALSE; + return TRUE; +} + +INLINE int PROFESSION_SKILL_getInt( int index, PROFESSION_SKILL_DATAINT element) +{ + return PROFESSION_skill[index].data[element]; +} + +INLINE int PROFESSION_SKILL_setInt( int index, PROFESSION_SKILL_DATAINT element, int data) +{ + int buf; + buf = PROFESSION_skill[index].data[element]; + PROFESSION_skill[index].data[element]=data; + return buf; +} + +INLINE char* PROFESSION_SKILL_getChar( int index, PROFESSION_SKILL_DATACHAR element) +{ + if( !PROFESSION_SKILL_CHECKINDEX( index)) return "\0"; + if( !PROFESSION_SKILL_CHECKCHARDATAINDEX( element)) return "\0"; + return PROFESSION_skill[index].string[element].string; +} + +INLINE BOOL PROFESSION_SKILL_setChar( int index ,PROFESSION_SKILL_DATACHAR element, char* new ) +{ + if(!PROFESSION_SKILL_CHECKINDEX(index))return FALSE; + if(!PROFESSION_SKILL_CHECKCHARDATAINDEX(element))return FALSE; + + strcpysafe( PROFESSION_skill[index].string[element].string, + sizeof(PROFESSION_skill[index].string[element].string), + new ); + return TRUE; +} + +int PROFESSION_SKILL_getskillNum( void) +{ + return profession_skill_num; +} + + +/*----------------------------------------------------------------------*/ + +int PROFESSION_SKILL_getskillArray( int skillid) +{ +#ifdef _PROSKILL_OPTIMUM // ѯְIDΪʽ + if( skillid >= 0 && skillid < profession_skill_num ) + return PROFESSION_skill[skillid].data[PROFESSION_SKILL_ID]; +#else + int i; + for( i = 0; i <= profession_skill_num; i ++ ) { // Ż + if( PROFESSION_skill[i].data[PROFESSION_SKILL_ID] == skillid ) + return i; + } +#endif + return -1; +} + +PROFESSION_SKILL_CALLFUNC PROFESSION_SKILL_getskillFuncPointer(char* name ) +{ + int i; + int hash = hashpjw( name ); + + for( i = 0; i< arraysizeof( PROFESSION_SKILL_functbl); i++ ){ + if( PROFESSION_SKILL_functbl[i].hash == hash ){ + if( strcmp( PROFESSION_SKILL_functbl[i].functionname, name ) == 0 ){ + return PROFESSION_SKILL_functbl[i].func; + } + } + } + + return NULL; +} + +int _PROFESSION_SKILL_GetArray( char *file, int line, int charaindex, int skill ) +{ + int skillid,array; + + skillid = CHAR_getCharSkill( charaindex, skill); + + if( skillid < 0 ) return -1; + + array = PROFESSION_SKILL_getskillArray( skillid ); + + return array; +} + + +/*----------------------------------------------------------------------*/ + +// ʹְҵ +int PROFESSION_SKILL_Use( int charaindex, int skill, int toNo, char *data ) +{ + int Pskillid, skillid; + int ret=-1, skill_level; + PROFESSION_SKILL_CALLFUNC func; + CHAR_HaveSkill* hskill; + int char_pskill, profession_skill; + + skillid = CHAR_getCharSkill( charaindex, skill); + Pskillid = PROFESSION_SKILL_getskillArray( skillid); + //print("\n skillid:%d Pskillid:%d ", skillid, Pskillid); // Robin log + if( Pskillid == -1 ) { +// printf("\n ķ??Ҳְ! "); + return ret; + } + +#ifdef _PROSKILL_OPTIMUM // Robin fix ְҵǷ + char_pskill = CHAR_getInt( charaindex, PROFESSION_CLASS ); + profession_skill = PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS); + if( (char_pskill <=0) || (char_pskill != profession_skill) ) { +// print("\n ķ??ְְҵȷ!:%d:%d ", char_pskill, profession_skill); + return ret; + } +#endif + + // ѰӦ function + func = PROFESSION_SKILL_getskillFuncPointer( PROFESSION_SKILL_getChar( Pskillid, PROFESSION_SKILL_FUNCNAME) ); + + // жǷΪ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) return ret; + + + if( func ){ + // \ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, skill ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + + // MP + if( PROFESSION_SKILL_DEC_COST_MP( charaindex, skill, Pskillid, skill_level ) != 1 ) { +// print("\n Error:ְMP:%d:%d:%d ", skill, Pskillid, skill_level); + return ret; + } + + // ʹְҵ + ret = func( charaindex, toNo, Pskillid, data, skill_level ); + if( ret == -1 ){ + int rands = rand()%10; + //andy_log +// print("ret = %d, rands:%d \n", ret, rands); + if( rands > 5 ) return ret; + } + + if( Pskillid == 57 //ŭ ѡоֵ + && CHAR_getInt( BATTLE_No2Index( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toNo ), CHAR_WHICHTYPE) != CHAR_TYPEPET ) + return ret; + + // һ㼼 + PROFESSION_NORMAL_SKILL_LEVLE_UP( &hskill->skill, Pskillid, charaindex ); + } + else { + //print("\n !Ҳְfunc "); + } + + return ret; +} + +// ⼼ +void PROFESSION_SKILL_LVEVEL_UP( int charaindex, char *name ) +{ + int skill=-1; + int skillid=0, Pskillid=0, i; + char *skill_name="\0"; + CHAR_HaveSkill* hskill; + + for( i=0; i CHAR_SKILLMAXHAVE) ) return; + + skillid = CHAR_getCharSkill( charaindex, skill); + Pskillid = PROFESSION_SKILL_getskillArray( skillid); + if( Pskillid == -1 ) return; + + // \ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, skill ); + + // һ㼼 + PROFESSION_NORMAL_SKILL_LEVLE_UP( &hskill->skill, Pskillid, charaindex ); + + return; +} + +// +void PROFESSION_SKILL_DUAL_WEAPON_LVEVEL_UP( int charaindex, char *name ) +{ + int skill=-1, arm = 0, shield = 0; + int skillid=0, Pskillid=0, i; + char *skill_name="\0"; + CHAR_HaveSkill* hskill; + + // װ + for( i = 0 ; i < CHAR_EQUIPPLACENUM ; i ++ ){ + int id = CHAR_getItemIndex(charaindex,i); + if( ITEM_CHECKINDEX(id) ){ + if( i == CHAR_ARM ) arm = 1; + else if( i == CHAR_EQSHIELD ) shield = 1; + } + } + + if( arm != 1 || shield != 1 ) return; + + for( i=0; i CHAR_SKILLMAXHAVE) ) return; + + skillid = CHAR_getCharSkill( charaindex, skill); + Pskillid = PROFESSION_SKILL_getskillArray( skillid); + if( Pskillid == -1 ) return; + + // \ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, skill ); + + // һ㼼 + PROFESSION_NORMAL_SKILL_LEVLE_UP( &hskill->skill, Pskillid, charaindex ); + + return; +} + + +// ר +void PROFESSION_SKILL_WEAPON_FOCUS_LVEVEL_UP( int charaindex, char *name ) +{ + int skill = -1; + int skillid=0, Pskillid = 0, i; + char *skill_name="\0", *pszOption="\0", *pszP, diff[20]; + int WeaponType = -1; + CHAR_HaveSkill* hskill; + + memset( diff, -1, sizeof(diff) ); + // װ + WeaponType = BATTLE_GetWepon( charaindex ); + + switch( WeaponType ){ + case ITEM_AXE: + sprintf( diff, "" ); break; + case ITEM_CLUB: + sprintf( diff, "" ); break; + case ITEM_SPEAR: + sprintf( diff, "ǹ" ); break; + case ITEM_BOW: + sprintf( diff, "" ); break; + case ITEM_BOOMERANG: // + sprintf( diff, "" ); break; + case ITEM_BOUNDTHROW: // Ͷͷ + sprintf( diff, "Ͷ" ); break; + case ITEM_BREAKTHROW: // Ͷʯ + sprintf( diff, "ʯ" ); break; + default: + sprintf( diff, "" ); break; + } + + for( i=0; i CHAR_SKILLMAXHAVE) ) return; + + skillid = CHAR_getCharSkill( charaindex, skill); + Pskillid = PROFESSION_SKILL_getskillArray( skillid); + if( Pskillid == -1 ) return; + + // \ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, skill ); + + // һ㼼 + PROFESSION_NORMAL_SKILL_LEVLE_UP( &hskill->skill, Pskillid, charaindex ); + + return; +} + +// MP +int PROFESSION_SKILL_DEC_COST_MP( int charaindex, int skill, int Pskillid, int skill_level ) +{ + + if(skill_level > 0){ + int dec_mp; + int old_mp = CHAR_getInt( charaindex, CHAR_MP ); + int mp=0; + // ȡ MP + if( (dec_mp = PROFESSION_MAGIC_COST_MP( charaindex, skill )) == -1 ) + dec_mp = PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_COST_MP ); + // MP + if( old_mp < dec_mp ) return -1; + // Ѫ + if( Pskillid != 11 +#ifdef _PROFESSION_ADDSKILL + // && Pskillid != 2 //Բ MP +#endif + ) + if( dec_mp <= 0 ) return -1; + // ۵ MP + mp = old_mp - dec_mp; + if( mp < 0 ) mp = 0; + CHAR_setInt( charaindex , CHAR_MP , mp ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP); + return 1; + } + return -1; +} + + + +// һ㼼 +void PROFESSION_NORMAL_SKILL_LEVLE_UP(Skill *skill, int Pskillid, int charaindex ) +{ + int skill_level = 0, up_fix_value = 0; + int rand_num = RAND( 0, 10000 ), rand_num2 = 0; + + // ܵȼ޲ + skill_level = SKILL_getRealInt( skill, SKILL_LEVEL); + if( skill_level >= PROFESSION_SKILL_MAX_LEVEL * 100 ) return; + + // ֵ + up_fix_value = PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_FIX_VALUE) * 100; + rand_num2 = RAND( 0, up_fix_value); + + // 춨 + if( rand_num > skill_level + rand_num2){ + // + skill_level += PROFESSION_SKILL_ADD_POINT; + SKILL_setInt( skill, SKILL_LEVEL, skill_level ); + + if( ( skill_level % 100 ) == 0 ){ + char msg[256]; + sprintf( msg, "%sΪ%d", PROFESSION_SKILL_getChar( Pskillid, PROFESSION_SKILL_NAME), skill_level/100 ); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + CHAR_sendStatusString( charaindex , "S"); + + // ְҵֵ + PROFESSION_LEVEL_CHECK_UP( charaindex ); + } + } + return; +} + + +void PROFESSION_LEVEL_CHECK_UP( int charaindex ) +{ + int skill_level_add = 0, skill_level_sum = 0, i = 0; + int old_level = CHAR_getInt( charaindex, PROFESSION_LEVEL ); + int next_level_need_point = 9999999; + CHAR_HaveSkill* hskill; + + // һְҵ + next_level_need_point = old_level * 70 * 100; + + for( i=0; iskill, SKILL_IDENTITY); + if( skillID <= 0 ) continue; + + // ͨ 50 + if( (skillID == 63) || (skillID == 64) || (skillID == 65) ){ + skill_level_add = 50*100; + }else{ + skill_level_add = SKILL_getRealInt( &hskill->skill, SKILL_LEVEL); + } + + skill_level_sum += skill_level_add; + } + +// print("\n ==> ǰȵ(%d) һ(%d)", skill_level_sum, next_level_need_point ); + + // ȴﵽһְҵʱְҵȼ + if( skill_level_sum >= next_level_need_point ){ + int old_skill_point = CHAR_getInt( charaindex, PROFESSION_SKILL_POINT ); + int next_skill_point = old_skill_point+1; + char msg[64]; + +// print("\nְҵȼ ==> ǰְҵȼ(%d) һְҵȼ(%d)", old_skill_point, next_skill_point ); + + CHAR_setInt( charaindex, PROFESSION_LEVEL, old_level + 1 ); + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, next_skill_point ); + CHAR_sendStatusString( charaindex , "P"); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + + sprintf( msg, "ְҵȼΪ%dܵ", old_level + 1 ); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + } +} + +// Ӽ +int PROFESSION_SKILL_ADDSK( int charaindex, int skill, int level ) +{ + int i; + + CHAR_HaveSkill *pSkil; + + if( level > 100 ) level = 100; + else if( level < 1 ) level = 1; + + for( i = 0; i < CHAR_SKILLMAXHAVE; i ++ ){ + int skill_id = -1; + + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + skill_id = SKILL_getInt( &pSkil->skill, SKILL_IDENTITY); + if( skill == skill_id && skill_id != -1 ){ + CHAR_talkToCli(charaindex,-1, "Ѿѧϰ˼", CHAR_COLORYELLOW); + return -1; + } + + if( pSkil == (CHAR_HaveSkill*)NULL )continue; + if( pSkil->use != 0 )continue; + break; + } + if( i >= CHAR_SKILLMAXHAVE ){ + CHAR_talkToCli(charaindex,-1, "Ѵ", CHAR_COLORYELLOW); + return -1; + }else{ + level *= 100; + SKILL_makeSkillData( &pSkil->skill, skill, level); + pSkil->use = TRUE; + } + + CHAR_sendStatusString( charaindex , "S"); + + + return 1; +} + +void profession_common_fun( int charaindex, int toNo, int skill_level, int array, int com1 ) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, com1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, skill_level); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, array); +#ifdef _PROFESSION_ADDSKILL + if( com1 == BATTLE_COM_S_DOOM + /*&& CHAR_getWorkInt( charaindex, CHAR_DOOMTIME) == 0*/ ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORK_com1, com1 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_toNo, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORK_mode, BATTLE_CHARMODE_C_OK ); + CHAR_setWorkInt( charaindex, CHAR_WORK_skill_level, skill_level ); + CHAR_setWorkInt( charaindex, CHAR_WORK_array, array ); + CHAR_setWorkInt( charaindex, CHAR_DOOMTIME, 3); + } + else if( com1 == BATTLE_COM_S_FIRE_SPEAR + /*&& CHAR_getWorkInt( charaindex, CHAR_DOOMTIME) == 0*/ ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + CHAR_setWorkInt( charaindex, CHAR_WORK_com1, com1 ); + CHAR_setWorkInt( charaindex, CHAR_WORK_toNo, toNo ); + CHAR_setWorkInt( charaindex, CHAR_WORK_mode, BATTLE_CHARMODE_C_OK ); + CHAR_setWorkInt( charaindex, CHAR_WORK_skill_level, skill_level ); + CHAR_setWorkInt( charaindex, CHAR_WORK_array, array ); + CHAR_setWorkInt( charaindex, CHAR_DOOMTIME, 2); + } +#endif +} + +/*----------------------------------------------------------------------*/ +// Ϊְҵ + +// ʦ-ɽȪ +int PROFESSION_volcano_springs( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_VOLCANO_SPRINGS ); + return TRUE; +} + +// ʦ- +int PROFESSION_fire_ball( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo<21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_FIRE_BALL ); + return TRUE; +} + +// ʦ-ǹ +int PROFESSION_fire_spear( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_FIRE_SPEAR ); + return TRUE; +} + +// ʦ- +int PROFESSION_summon_thunder( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_SUMMON_THUNDER ); + return TRUE; +} + +// ʦ- +int PROFESSION_current( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CURRENT ); + return TRUE; +} + +// ʦ- +int PROFESSION_storm( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_STORM ); + return TRUE; +} + +// ʦ- +int PROFESSION_ice_arrow( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ICE_ARROW ); + return TRUE; +} + +// ʦ- +int PROFESSION_ice_crack( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ICE_CRACK ); + return TRUE; +} + +// ʦ- +int PROFESSION_ice_mirror( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ICE_MIRROR ); + return TRUE; +} + +// ʦ-ĩ +int PROFESSION_doom( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_DOOM ); + return TRUE; +} + +// ʦ-Ѫ +int PROFESSION_blood( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_BLOOD ); + return TRUE; +} + +// ʦ-Ѫ +int PROFESSION_blood_worms( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_BLOOD_WORMS ); + return TRUE; +} + +// ʦ-һѪ +int PROFESSION_sign( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_SIGN ); + return TRUE; +} + +// ʦ- +int PROFESSION_fire_enclose( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_FIRE_ENCLOSE ); + return TRUE; +} + +// ʦ- +int PROFESSION_ice_eclose( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ICE_ENCLOSE ); + return TRUE; +} + +// ʦ-׸ +int PROFESSION_thunder_enclose( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_THUNDER_ENCLOSE ); + return TRUE; +} + +// ʦ-ħ +int PROFESSION_fire_practice( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ʦ-ħ +int PROFESSION_ice_practice( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ʦ-ħ +int PROFESSION_thunder_practice( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ʦ- +int PROFESSION_enclose( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ENCLOSE ); + return TRUE; +} + +// ʦ-λλ +int PROFESSION_transpose( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_TRANSPOSE ); + return TRUE; +} + + +/*----------------------------------------------------------------------*/ + +// ʿ- +int PROFESSION_brust( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_BRUST ); + return TRUE; +} + +// ʿ- +int PROFESSION_chain_atk( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CHAIN_ATK ); + return TRUE; +} + +// ʿ-ر +int PROFESSION_avoid( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_AVOID ); + return TRUE; +} + +// ʿ-Ѫ +int PROFESSION_recovery( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_RECOVERY ); + return TRUE; +} + +// ʿ-ר +int PROFESSION_weapon_focus( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ʿ-״̬ظ +int PROFESSION_reback( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_REBACK ); + return TRUE; +} + +// ʿ-˫ع +int PROFESSION_chain_atk_2( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CHAIN_ATK_2 ); + return TRUE; +} + +// ʿ-Ϊ +int PROFESSION_scapegoat( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_SCAPEGOAT ); + return TRUE; +} + +// ʿ- +int PROFESSION_enrage( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ENRAGE ); + return TRUE; +} + +// ʿ-ۼ +int PROFESSION_energy_collect( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_COLLECT ); + return TRUE; +} + +// ʿ-רעս +int PROFESSION_focus( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_FOCUS ); + return TRUE; +} + +// ʿ-ܻ +int PROFESSION_shield_attack( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_SHIELD_ATTACK ); + return TRUE; +} + +// ʿ- +int PROFESSION_dual_weapon( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ʿ- +int PROFESSION_deflect( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_DEFLECT ); + return TRUE; +} + +// ʿ-ᴩ +int PROFESSION_through_attack( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_THROUGH_ATTACK ); + return TRUE; +} + +// ʿ-﹥ +int PROFESSION_cavalry( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CAVALRY ); + return TRUE; +} + +// ʿ- +int PROFESSION_dead_attack( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_DEAD_ATTACK ); + return TRUE; +} + +// ʿ- +int PROFESSION_convolute( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo<21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CONVOLUTE ); + return TRUE; +} + +// ʿ-ҹ +int PROFESSION_chaos( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CHAOS ); + return TRUE; +} + +/*----------------------------------------------------------------------*/ + +// ˼- +int PROFESSION_trap( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_TRAP ); + return TRUE; +} + +// ˼-ѱ +int PROFESSION_docile( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_DOCILE ); + return TRUE; +} + +// ˼-ŭ +int PROFESSION_enrage_pet( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ENRAGE_PET ); + return TRUE; +} + +// ˼-޵ +int PROFESSION_dragnet( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_DRAGNET ); + return TRUE; +} + +// ˼- +int PROFESSION_entwine( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ENTWINE ); + return TRUE; +} + +// ˼-Ը +int PROFESSION_autarky( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +// ˼-Ӷ +int PROFESSION_plunder( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_PLUNDER ); + return TRUE; +} + +// ˼- +int PROFESSION_toxin_weapon( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_TOXIN_WEAPON ); + return TRUE; +} + +// ˼- +int PROFESSION_resist_fire( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_RESIST_FIRE ); + return TRUE; +} + +// ˼- +int PROFESSION_resist_ice( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_RESIST_ICE ); + return TRUE; +} + +// ˼-׿ +int PROFESSION_resist_thunder( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_RESIST_THUNDER ); + return TRUE; +} + +#ifdef _PROFESSION_ADDSKILL +// ˼-Ȼ +int PROFESSION_resist_f_i_t( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_RESIST_F_I_T ); + return TRUE; +} +// ˼-Ȼ +int PROFESSION_call_nature( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_CALL_NATURE ); + return TRUE; +} +// ˼-Խ +int PROFESSION_boundary( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_BOUNDARY ); + return TRUE; +} +#endif + +// ˼- +int PROFESSION_g_resist_fire( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_G_RESIST_FIRE ); + return TRUE; +} + +// ˼- +int PROFESSION_g_resist_ice( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_G_RESIST_ICE ); + return TRUE; +} + +// ˼-׿ +int PROFESSION_g_resist_thunder( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo!=20 && toNo!=21) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_G_RESIST_THUNDER ); + return TRUE; +} + +// ˼-㹥 +int PROFESSION_attack_weak( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_ATTACK_WEAK ); + return TRUE; +} + +// ˼- +int PROFESSION_instigate( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_INSTIGATE ); + return TRUE; +} + +// ˼- +int PROFESSION_oblivion( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + if(toNo>19) + toNo=0; + profession_common_fun( charaindex, toNo, skill_level, array, BATTLE_COM_S_OBLIVION ); + return TRUE; +} + + +/*----------------------------------------------------------------------*/ +// ս + +// ˼-׷Ѱ +int PROFESSION_track( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + char *pszP = NULL, *pszOption = "\0", msg[20]; + int per=0, rate=0, img1, ret = 1; + skill_level /= 10; + + if( CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM) >= (int)time(NULL) ){ + ret = -1; + } + + // ܵIJ + pszOption = PROFESSION_SKILL_getChar( array, PROFESSION_SKILL_OPTION); + + // ܵȼ rate + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &rate ); + per = skill_level * rate; + + // ׼ڵĶ + img1 = PROFESSION_SKILL_getInt( array, PROFESSION_SKILL_IMG_1 ); + + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, per); + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORRED); + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_NUM, (int)time(NULL) + (60 * 3) ); + + sprintf( msg, "%d", img1); + lssproto_BATTLESKILL_send ( getfdFromCharaIndex(charaindex), msg ) ; + + return ret; +} + +// ˼-رս +int PROFESSION_escape( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + char *pszP = NULL, *pszOption = "\0", msg[20]; + int per=0, rate=0, img1, ret =1; + skill_level /= 10; + + if( CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM) >= (int)time(NULL) ){ + ret = -1; + } + + // ܵIJ + pszOption = PROFESSION_SKILL_getChar( array, PROFESSION_SKILL_OPTION); + + // ܵȼ rate + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &rate ); + per = skill_level * rate; + + // ׼ڵĶ + img1 = PROFESSION_SKILL_getInt( array, PROFESSION_SKILL_IMG_1 ); + + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, (-1) * per); + CHAR_talkToCli( charaindex, -1, "½", CHAR_COLORGREEN); + + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_NUM, (int)time(NULL) + (60 * 3) ); + + sprintf( msg, "%d", img1); + lssproto_BATTLESKILL_send ( getfdFromCharaIndex(charaindex), msg ) ; + + return ret; +} + + + +// ͬ- +int PROFESSION_full_mp( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} +// ͬ- +int PROFESSION_strong_back( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + char *pszP = NULL, *pszOption = "\0"; + int rate=0; + // ܵIJ + pszOption = PROFESSION_SKILL_getChar( array, PROFESSION_SKILL_OPTION); + if( (pszP = strstr( pszOption, "%" ) ) != NULL ) sscanf( pszP+3, "%d", &rate ); + int pile = CHAR_getWorkInt( charaindex, CHAR_WORKATTACHPILE); + pile = pile * rate; + CHAR_setWorkInt( charaindex, CHAR_WORKATTACHPILE,pile); + return TRUE; +} +// ͬ-ǿ +int PROFESSION_strengthen( int charaindex, int toNo, int array, char *data, int skill_level ) +{ + return TRUE; +} + +#endif + diff --git a/battle/stoRkxhg b/battle/stoRkxhg new file mode 100644 index 0000000000000000000000000000000000000000..7077e133e02d58caa1e815784332abb422bc8dcd GIT binary patch literal 4096 zcmeHIL2leO6lII10dj^ersx5haqUHcqJTz{<3YymK$7E40hQ5wOUy{5LQ(ciPSC@2 z*<e~HAo<6RRS%Y$^pb2H)RS8u<7D6;2DKB4j+3T7tf-GCb z`GRgzMOEJgbsg5y!Iyol*ot+^0U4DgsIY=!>!2|v0=jXa7w5x_Gqs>f)euNY_b&Ri zfq37L_Z)^2kheW>A4E{YF?K^$QC;&D<0G}OqLMCXvAu5HmsfBfb0x>rYbkD_>zLs7 z{kf({@}Vs84mZQ!33NpdlaDQwdACui_QxpU zfQmUZBal$O5zP&>_y!p1nhOrzCX&S3)+l)+(I9aaYh5qBaFSCJi>52h``gP^g`VDw^*Ie#8o*Py?E@+2w`kQ4!%qkmOj~ zOzc=e6&mwm>@SWUEZ1}tjFW5nnq`+&QrsJ+P6=TRR1VVg9gY=qA$t7jp>d95psT!+ zFFTEwI6tlIU0`@anco_R8`mD4rM+w=>%hC#4l<*z;o>WCVmmqP@y+(ZsJY33MV;gw zFB5WdCEQ-K&KM3{2cUKaZ~4Q`L;dM!t%iOFuDmg49*5`$W?iZdn#SfQa0jwG5Rl*% zXB-)!?*3#TVyCqF4ior6Q*YR8|EpH#+q7bEn1l!!75@biTBnx) literal 0 HcmV?d00001 diff --git a/buf.c b/buf.c new file mode 100644 index 0000000..6a81f8b --- /dev/null +++ b/buf.c @@ -0,0 +1,192 @@ +#define __BUF_C__ +#include "version.h" +#include +#include +#include + +#include "buf.h" +#include "handletime.h" + +static int UNIT; +static int UNITNUMBER; +static int memconfig; +static int readblock; +static int NowMemory; +static struct timeval AllocOldTime; + +typedef struct tagMemory +{ + char* pointer; + BOOL used; + + unsigned int nsize; +}Memory; +static Memory *mem; + + +void memEnd( void ) +{ + if( mem != NULL && mem[0].pointer != NULL ){ + free(mem[0].pointer); + free(mem); + } +} + +BOOL configmem( int unit , int unitnumber ) +{ + if( memconfig == TRUE ) + return FALSE; + UNIT = unit; + UNITNUMBER = unitnumber; + if( UNIT <= 0 || UNITNUMBER <= 0 ) + return memconfig = FALSE; + return memconfig = TRUE; +} + +BOOL memInit( void ) +{ + int i; + if( memconfig == FALSE ) + return FALSE; + mem = calloc( 1, sizeof( Memory ) * UNITNUMBER ); + if( mem == NULL ){ + print( "memInit: Can't alloc memory: %d\n" , + sizeof(Memory)*UNITNUMBER ); + return FALSE; + } + + memset( mem , 0 , sizeof( Memory )* UNITNUMBER ); + for( i = 0 ; i < UNITNUMBER ; i ++ ){ + mem[i].pointer = NULL; + mem[i].used = FALSE; + mem[i].nsize = 0; + } + mem[0].pointer = calloc( 1, UNIT*UNITNUMBER ); + if( mem[0].pointer == NULL ){ + print( "ɷ %d byte\n" , UNIT*UNITNUMBER ); + free( mem ); + return FALSE; + } + memset( mem[0].pointer , 0 , sizeof( UNIT*UNITNUMBER )); + print( "ڴѷ %.2f MB..." ,UNIT*UNITNUMBER/1024.0/1024.0); +#ifdef DEBUG + print( "Allocate %d byte( %.2fK byte %.2fM byte )\n" , + UNIT*UNITNUMBER, + UNIT*UNITNUMBER/1024.0, + UNIT*UNITNUMBER/1024.0/1024.0 + ); +#endif + readblock = 0; + for( i = 0 ; i < UNITNUMBER ; i ++ ) + mem[i].pointer = mem[0].pointer + i * UNIT; + + NowMemory = 0; + AllocOldTime.tv_sec = NowTime.tv_sec; + AllocOldTime.tv_usec = NowTime.tv_usec; + + return TRUE; +} + +void* allocateMemory( const unsigned int nbyte ) +{ + int i; + int arrayAllocSize; + BOOL flg = FALSE; + void *ret; + int first = 0; + + arrayAllocSize = nbyte/UNIT + ( nbyte%UNIT ? 1 : 0 ); + if( arrayAllocSize == 0 )return NULL; +#ifdef DEBUG + debug( arrayAllocSize , d ); + printf("(%.2f KB)\n",nbyte/1024.0); +#endif + i = readblock; + while( 1 ) { + if( i > UNITNUMBER - arrayAllocSize) { + i = 0; + } + if( mem[i].used != FALSE ){ + i += mem[i].nsize; + }else{ + int j; + BOOL found = TRUE; + for( j = i; j < i + arrayAllocSize; j ++ ) { + if( mem[j].used != FALSE ){ + i = j + mem[j].nsize; + found = FALSE; + if( first == 0 ) first = 1; + break; + } + } + if( found ) { + mem[i].used=TRUE; + mem[i].nsize = arrayAllocSize; + readblock = i + arrayAllocSize; + ret = mem[i].pointer; + break; + } + } + if( ( i >= readblock || i > UNITNUMBER - arrayAllocSize ) + && flg == TRUE ) { + ret = NULL; + break; + } + if( i > UNITNUMBER - arrayAllocSize) { + i = 0; + flg = TRUE; + } + + } + if( ret == NULL ) { + print( "Can't Allocate %d byte .remnants:%4.2f\n" , nbyte, (float)(NowMemory/UNITNUMBER)); + }else { + NowMemory += arrayAllocSize; + + if( NowTime.tv_sec > AllocOldTime.tv_sec +10 ) { + print( "\n"); + if( NowMemory > (double)UNITNUMBER * 0.9) { + print( "Warning!! Memory use rate exceeded 90%% .remnants:%d\n", UNITNUMBER-NowMemory); + }else if( NowMemory > (double)UNITNUMBER * 0.8) { + print( "Warning!! Memory use rate exceeded 80%% .remnants:%d\n", UNITNUMBER-NowMemory); + }else if( NowMemory > (double)UNITNUMBER * 0.7) { + print( "Memory use rate exceeded 70%% .remnants:%d\n", UNITNUMBER-NowMemory); + } + memcpy( &AllocOldTime, &NowTime, sizeof( AllocOldTime)); + } + //print( "NowMemory.remnants:%4.2f\n", (float)(UNITNUMBER-NowMemory)/UNITNUMBER); + } + + return ret; +} + + + +/*------------------------------------------------------------ + * ¦ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void freeMemory( void* freepointer ) +{ + int arrayindex; + char* toppointer; + toppointer = mem[0].pointer; + if( freepointer == NULL )return; + arrayindex = ((int)freepointer-(int)toppointer)/UNIT; + if( arrayindex < readblock) { + readblock = arrayindex; + } + mem[arrayindex].used = FALSE; + + NowMemory -= mem[arrayindex].nsize; + +} + +void showMem( char *buf) +{ + sprintf( buf, "NowMemory.remnants:%d%%", ((UNITNUMBER-NowMemory)*100)/UNITNUMBER); + printf( "\n" ); + printf( buf ); +} + diff --git a/callfromac.c b/callfromac.c new file mode 100644 index 0000000..e64968c --- /dev/null +++ b/callfromac.c @@ -0,0 +1,1676 @@ +#include +#include "version.h" +#include "common.h" +#include "saacproto_cli.h" +#include "lssproto_serv.h" +#include "net.h" +#include "char.h" +#include "object.h" +#include "readmap.h" +#include "msignal.h" +#include "map_deal.h" +#include "npc_duelranking.h" +#include "npc_warpman.h" +#include "handletime.h" +#include "npc_scheduleman.h" +#include "configfile.h" +#include "chatroom.h" +#include "npc_eventaction.h" +// CoolFish: Family 2001/5/24 +#include "family.h" +#include "log.h" +#include "buf.h" +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC +#include "npc_alldoman.h" +#endif +#include "enemy.h" +time_t initTime =0; + +extern BOOL bNewServer; +extern int i_shutdown_time;//ttom +extern int manorflag[10]; +extern char manorname[10][32]; +#ifdef _ANGEL_SUMMON +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; +#endif + +char question[64]; +char answer[64]; +int questionstarttime=0; +int questionman=0; +#ifdef _ALL_ITEM +int allnum1=0; +int allnum2=0; +int allnum3=0; +int allnum4=0; +int allnum5=0; +#endif + +void saacproto_ACGmsvDownRequest_recv( int fd, int min) +{ + char buff[32]; + int i; + int playernum = CHAR_getPlayerMaxNum(); + + snprintf( buff, sizeof( buff),"%s档",getGameserverID()); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, buff, CHAR_COLORYELLOW); + } + } + SERVSTATE_setLimittime(min); + SERVSTATE_setShutdown( NowTime.tv_sec ); + SERVSTATE_setDsptime( 0 ); + +} +//Ƿкac,Լ +void saacproto_ACServerLogin_recv (int fd, char* result,char* data) +{ + if( strcmp( result , SUCCESSFUL ) != 0 ){ + print( "ACʧ!˳...[%s][%s]\n", + result,data ); + shutdownProgram( ); + exit(1); + } + print("ACӳɹ\n"); + time(&initTime); +/* + print("ͣ"); + if( bNewServer ) + print("·! \n"); + else + print("ɷ! \n"); +*/ +#ifdef _SERVER_NUMS + print(" !\n\n"); +#endif + + printf( "GMSV汾: <%s %s>\n" , SERVER_VERSION, "Ѱ"); + printf( "GMSVʱ: %s %s \n" , __DATE__ , __TIME__ ); + + printf( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ); + printf( "~ ~\n" ); + printf( "~ ~\n" ); + printf( "~ ΪѷˡϽҵ;,ɵĺге ~\n" ); + printf( "~ ~\n" ); + printf( "~ ~\n" ); + printf( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ); + // Robin 0530 + //saacproto_ACShowFMList_send( acfd ); + print("\nʼ..."); + FAMILY_Init(); + print("\n"); +#ifdef _ANGEL_SUMMON + print("ʼٻ..."); + saacproto_ACMissionTable_send( acfd, -1, 1, "", ""); + print("\n"); + + +#endif +} + +void saacproto_ACCharList_recv(int fd, char* result, char* data,int retfd) +{ + int clifd = getfdFromFdid(retfd); + + if( CONNECT_checkfd(clifd) == FALSE ) + return; + + lssproto_CharList_send( clifd, result , data ); + CONNECT_setState( clifd, NOTLOGIN ); +} + +void saacproto_ACCharLoad_recv(int fd , char* result,char* data,int retfd,int saveindex) +{ + int clifd = getfdFromFdid(retfd); + if( CONNECT_checkfd( clifd ) == FALSE )return; + if(( strcmp( result , SUCCESSFUL ) == 0 )&&(data[0])) { + CHAR_login( clifd,data,saveindex ); + }else{ + char cdkey[64]; +#ifndef _FIX_MESSAGE // WON ADD ޸WORKER + data = ""; +#endif + CONNECT_getCdkey( clifd, cdkey , sizeof( cdkey )); + print(" (%s)ACCharLoad:%s ", cdkey, data); + lssproto_CharLogin_send( clifd, result ,data ); + CONNECT_setState( clifd, NOTLOGIN ); + } +} + +void saacproto_ACCharSave_recv(int fd ,char* result, char* data,int retfd) +{ + int clifd = getfdFromFdid(retfd) , fdid; + char cdkey[CDKEYLEN], passwd[PASSWDLEN], charname[CHARNAMELEN]; + + if( CONNECT_checkfd( clifd )== FALSE ) return; + + CONNECT_getCdkey( clifd, cdkey, sizeof( cdkey )); + CONNECT_getPasswd( clifd, passwd, sizeof( passwd)); + + CONNECT_getCharname( clifd, charname, sizeof( charname )); + fdid = CONNECT_getFdid( clifd ); + unsigned long ip; + int a,b,c,d; + switch( CONNECT_getState( clifd ) ){ + case WHILECREATE: + /* ľëͷʧе( )*/ + if( strcmp(result,FAILED) ==0 ) data =""; + lssproto_CreateNewChar_send( clifd , result , data); + CONNECT_setState( clifd, NOTLOGIN ); + break; + + case WHILELOGOUTSAVE: + if( strcmp( result , SUCCESSFUL ) == 0 ) + lssproto_CharLogout_send( clifd, result , "success" ); + else + /* ޷¡֧ */ + lssproto_CharLogout_send( clifd, result , "Cannot save" ); + CONNECT_setState( clifd, NOTLOGIN ); + CONNECT_setCharaindex( clifd, -1 ); + break; + + case WHILELOSTCHARSAVE: + ip=CONNECT_get_userip(clifd); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + char userip[32]; + sprintf(userip,"%d.%d.%d.%d",a,b,c,d); + saacproto_ACCharDelete_send( acfd, cdkey,passwd,charname,"",fdid,userip ); + CONNECT_setState( clifd, WHILELOSTCHARDELETE ); + CONNECT_setCharaindex( clifd, -1 ); + break; + + case WHILECLOSEALLSOCKETSSAVE: + CONNECT_setState( clifd, NOTLOGIN ); + // Arminius debug + // CONNECT_endOne_debug(clifd); + CONNECT_setUse( clifd , FALSE); + + SERVSTATE_decrementCloseallsocketnum(); + if( SERVSTATE_getCloseallsocketnum() == 0 ) { + SERVSTATE_SetAcceptMore( -1 ); + print( "浵\n" ); + print("\n رշʱ =%d",i_shutdown_time);//ttom + if(i_shutdown_time==1){ + system( "ر" ); + sigshutdown( 0 ); + } + } + default: + break; + } +} + + +void saacproto_ACCharDelete_recv(int fd,char* result,char* data,int retfd) +{ + int clifd = getfdFromFdid(retfd); + if( CONNECT_checkfd( clifd ) == FALSE )return; + + switch( CONNECT_getState(clifd) ){ + case WHILELOSTCHARDELETE: + /* ئ */ + CONNECT_setState(clifd, NOTLOGIN ); + CONNECT_setCharaindex( clifd, -1 ); + break; + case WHILECHARDELETE: + /* ˪ */ + if( strcmp(result,FAILED) == 0)data=""; + lssproto_CharDelete_send( clifd, result , data ); + CONNECT_setState( clifd, NOTLOGIN ); + CONNECT_setCharaindex( clifd, -1 ); + break; + default: + break; + } +} + +/* + */ +void saacproto_ACLock_recv(int fd , char* result, char* data ,int retfd) +{ + int clifd = getfdFromFdid(retfd); + char cdkey[CDKEYLEN]; + int cindex = getCharindexFromFdid(retfd); + + if( CONNECT_checkfd(clifd) == FALSE) return; + + // Arminius 7.25 GM unlock test + if (strncmp(data, "USRLOCKED", 9)==0) { + char buf[4096]; + sprintf(buf, "%s", &data[10]); + CHAR_talkToCli(cindex, -1, buf, CHAR_COLORYELLOW); + return; + } else if (strncmp(data, "USRUNLOCKED", 11)==0) { + CHAR_talkToCli(cindex, -1, "User not locked.", CHAR_COLORYELLOW); + return; + } else if (strncmp(data, "GMUNLOCKSUCCESS", 15)==0) { + CHAR_talkToCli(cindex, -1, "User unlock success", CHAR_COLORYELLOW); + return; + } else if (strncmp(data, "GMUNLOCKFAIL", 12)==0) { + CHAR_talkToCli(cindex, -1, "User unlock failed", CHAR_COLORYELLOW); + return; + } else if (strncmp(data, "GMUNLOCKALL", 11)==0) { + CHAR_talkToCli(cindex, -1, "Server unlocked", CHAR_COLORYELLOW); + return; + } + + CONNECT_getCdkey( clifd, cdkey , sizeof( cdkey )); + + switch( CONNECT_getState( clifd ) ){ + case WHILECANNOTLOGIN: + if( strcmp( result , SUCCESSFUL ) == 0 ){ + CONNECT_setState( clifd, NOTLOGIN ); + + }else{ + /* + * ëέ + */ + char mesg[128]; + snprintf( mesg ,sizeof( mesg ), "%s hasn't been locked" ,cdkey); + if( strcmp( data , mesg ) == 0 ){ + /* + */ + CONNECT_setState( clifd, NOTLOGIN ); + }else{ + /* + * պݩƷ + */ + saacproto_ACLock_send(fd, cdkey , + UNLOCK, CONNECT_getFdid( clifd) ); + } + } + + break; + default: + break; + } +} + +void saacproto_ACUCheck_recv( int fd , char *cd ) +{ + int conind; + int flag = 0; + conind = getfdFromCdkeyWithLogin( cd ); + flag = ( conind >= 0 ) ? 1 : 0; + saacproto_ACUCheck_send( fd , cd , flag ); +} + + +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBUpdateEntryInt_recv( int fd,char* result, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBUpdateEntryInt\n"); + return; + } +} +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBUpdateEntryString_recv( int fd,char* result, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBUpdateEntryString\n"); + return; + } +} + +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBGetEntryRank_recv( int fd,char* result,int rank,int count, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBGetEntryRank\n"); + return; + } + if( strcmp( table, DB_DUELPOINT) == 0 ) { + if( CHAR_getInt( OBJECT_getIndex( msgid2), CHAR_WHICHTYPE) == CHAR_TYPEDUELRANKING){ + NPC_Duelranking_CallMyRanking( count, msgid, msgid2); + }else { + NPC_GetDuelRank( rank, msgid, msgid2); + } + } +} + +void saacproto_DBDeleteEntryInt_recv( int fd,char* result, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBDeleteEntryInt\n"); + return; + } + +} +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBDeleteEntryString_recv( int fd,char* result, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBDeleteEntryString\n"); + return; + } + +} + + +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBGetEntryInt_recv( int fd,char* result,int value, + char* table,char* key,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBGetEntryInt\n"); + return; + } +} +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBGetEntryString_recv( int fd,char* result,char *value, + char* table,char* key,int msgid,int msgid2 ) +{ + char cdkey[32]; + char charaname[32]; + + if( strcmp( table, DB_ADDRESSBOOK) == 0 ){ + int mode = 1; + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + mode = 0; + } + makeStringFromEscaped( key); + if( !getStringFromIndexWithDelim( key, "_", 1, cdkey, sizeof( cdkey)) ){ + return; + } + if( !getStringFromIndexWithDelim( key, "_", 2, charaname, sizeof( charaname)) ){ + return; + } + ADDRESSBOOK_DispatchMessage( cdkey, charaname, value, mode); + }else { + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBGetEntryString\n"); + return; + } + } +} + +void saacproto_DBGetEntryByRank_recv( int fd,char* result,char* list, + char* table,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBGetEntryByRank\n"); + return; + } +} +/* --------------------------------------------- + * --------------------------------------------*/ +void saacproto_DBGetEntryByCount_recv( int fd,char* result,char* list, + char* table,int count_start,int msgid,int msgid2 ) +{ + if( strcmp( result, NET_STRING_FAILED) == 0 ) { + print( "failed: DBGetEntryByCount\n"); + return; + } + if( strcmp( table, DB_DUELPOINT) == 0 ) { + NPC_Duelranking_PrintRanking( list, count_start, msgid, msgid2); + } +} +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC +void saacproto_UpdataStele_recv( int fd , char *token) +{ + NPC_AlldomanWriteStele( token ); +} +void saacproto_S_UpdataStele_recv( int i , char *ocdkey , char *oname , char *ncdkey , + char *nname , char *title , int level , int trns , int floor ) +{ + print("\nSyu log յSingle=> %s , %s , %s , %s ",ocdkey , oname , ncdkey , nname); + NPC_Alldoman_S_WriteStele( ocdkey , oname , ncdkey , nname , title , level , trns , floor ) ; +} + +#endif +/* --------------------------------------------- + * ƤƽҵⰾԻ + * --------------------------------------------*/ +void saacproto_Broadcast_recv( int fd,char* id,char* charname,char *message ) +{ + if( strstr( message, "online") == 0 || + strstr( message, "offline") == 0 || + strstr( message, "param") == 0 || + strstr( message, "chardelete") == 0 ){ + char buff[512]; + char escapebuf[1024]; + + snprintf( buff, sizeof( buff),"%s_%s", id, charname ); + makeEscapeString( buff, escapebuf, sizeof(escapebuf)); + + saacproto_DBGetEntryString_send( acfd, DB_ADDRESSBOOK, escapebuf, 0,0); + } +} + +void saacproto_Message_recv( int fd,char* id_from,char* charname_from, + char* id_to,char* charname_to, + char* message,int option,int mesgid ) +{ + BOOL ret; + ret = ADDRESSBOOK_sendMessage_FromOther( id_from, charname_from, + id_to, charname_to, + message, option + ); + if( ret == TRUE) { + saacproto_MessageAck_send( acfd, id_to, charname_to, + "successful",mesgid); + } +} + +/* --------------------------------------------- + * CoolFish: Family 2001/5/9 + * --------------------------------------------*/ +void saacproto_ACAddFM_recv(int fd, char *result, int fmindex, int charfdid, + int index) +{ + int ret; + int clifd = getfdFromFdid(charfdid); +// print("ACAddFM_0\n"); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; +// print("ACAddFM_1 clifd:%d ret:%d fmindex:%d index:%d\n", +// clifd, ret, fmindex, index); + ACAddFM(clifd, ret, fmindex, index); +} +void saacproto_ACJoinFM_recv(int fd, char *result, int recv, int charfdid) +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACJoinFM(clifd, ret, recv); +} +void saacproto_ACLeaveFM_recv(int fd, char *result, int resultflag, int charfdid) +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACLeaveFM(clifd, ret, resultflag); + + print(" ACLeaveFM_%d ", ret ); +} +void saacproto_ACChangeFM_recv(int fd, char *result, int charfdid) +{ +} +void saacproto_ACDelFM_recv(int fd, char *result, int charfdid) +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + + ACDelFM(clifd, ret); + + print(" ACDelFM_%d ", ret); +} +void saacproto_ACShowFMList_recv(int fd, char *result, int fmnum, char *data) +{ + int ret; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACShowFMList(ret, fmnum, data); +} + +void saacproto_ACShowMemberList_recv(int fd, char *result, int index, int fmmemnum, + int fmacceptflag, int fmjoinnum, char *data) +{ + int ret; + // fmmemnum -1:޴ֵ, -2:޸ else:ʾ˼ + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACShowMemberList(ret, index, fmmemnum, fmacceptflag, fmjoinnum, data); +} +void saacproto_ACFMDetail_recv(int fd, char *result, char *data, int charfdid) +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACFMDetail(ret, data, clifd ); +} +void saacproto_ACMemberJoinFM_recv(int fd, char *result, char *data, int charfdid) +{ + +} +void saacproto_ACMemberLeaveFM_recv(int fd, char *result, char *data, int charfdid) +{ + +} +#ifdef _PERSONAL_FAME // Arminius: +void saacproto_ACFMCharLogin_recv(int fd, char *result, int index, int floor, + int fmdp, int joinflag, int fmsetupflag, int flag, int charindex, + int charfame, int charfdid +#ifdef _NEW_MANOR_LAW + ,int momentum +#endif + ) +#else +void saacproto_ACFMCharLogin_recv(int fd, char *result, int index, int floor, + int fmdp, int joinflag, int fmsetupflag, int flag, int charindex, + int charfdid) +#endif +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if (CONNECT_checkfd(clifd) == FALSE) return; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; +// print("Login fd:%d result:%s index:%d floor:%d fmdp:%d joinflag:%d setup:%d charfdid:%d\n", +// fd, result, index, floor, fmdp, joinflag, fmsetupflag, charfdid); +#ifdef _PERSONAL_FAME // Arminius: +// print("Login charfame:%d\n", charfame); + ACFMCharLogin(clifd, ret, index, floor, fmdp, joinflag, fmsetupflag, + flag, charindex, charfame + #ifdef _NEW_MANOR_LAW + ,momentum + #endif + ); +#else + ACFMCharLogin(clifd, ret, index, floor, fmdp, joinflag, fmsetupflag, + flag, charindex); +#endif +} +void saacproto_ACFMCharLogout_recv(int fd, char *result, int charfdid) +{ +} +void saacproto_ACFMReadMemo_recv(int fd, char *result, int index, int num, + int dataindex, char *data) +{ + int ret; + // index( WORK )num(ϱ35) + // dataindex(µ)data() + // עnum -1:޴ֵ, -2:޸ else:ʾ˼ + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACShowFMMemo(ret, index, num, dataindex, data); +} +void saacproto_ACFMWriteMemo_recv(int fd, char *result, int index) +{ +} +void saacproto_ACFMPointList_recv(int fd, char *result, char *data) +{ + int ret; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACShowPointList(ret, data); +} + + +void saacproto_ACSetFMPoint_recv(int fd, char *result, int r, int charfdid) +{ + int ret; + int clifd = getfdFromFdid(charfdid); + if( CONNECT_checkfd(clifd) == FALSE )return; + if (strcmp(result, SUCCESSFUL) == 0){ + ret = 1; + }else{ + ret = 0; + } + ACSetFMPoint(ret, r, clifd); + +} +void saacproto_ACFixFMPoint_recv(int fd, char *result, int r) +{ +} +void saacproto_ACFMAnnounce_recv(int fd, char *result, char *fmname, + int fmindex, int index, int kindflag, char *data, int color) +{ + int ret; + if (strcmp(result, SUCCESSFUL) == 0){ + ret = 1; + }else{ + ret = 0; + } + ACFMAnnounce(ret, fmname, fmindex, index, kindflag, data, color); +} +#ifdef _NEW_MANOR_LAW +extern void SortManorSchedule(); +#endif +void saacproto_ACShowTopFMList_recv(int fd, char *result, int kindflag, int num, char *data) +{ + int ret; + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + ACShowDpTop(ret, num, data, kindflag); +#ifdef _NEW_MANOR_LAW + SortManorSchedule(); +#endif +} +#ifdef _NEW_MANOR_LAW +extern struct FMS_DPTOP fmdptop; +#endif +void saacproto_ACFixFMData_recv(int fd, char *result, int kindflag, char *data1, + char *data2, int charfdid) +{ + int ret; + int intdata; + int clifd = getfdFromFdid(charfdid); + int charaindex = CONNECT_getCharaindex( clifd ); + if( CONNECT_checkfd(clifd) == FALSE )return; + + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + + if( !CHAR_CHECKINDEX(charaindex) ) return; + if( kindflag == FM_FIX_FMRULE ){ + CHAR_talkToCli( charaindex , -1, "ּ޸ģϣˣ", CHAR_COLORWHITE); + }else if( kindflag == FM_FIX_FMGOLD ) { + intdata = atoi( data1 ); + if( ret == 0 ) { + if( atoi(data1) > 0 ) { + CHAR_setInt( charaindex, CHAR_GOLD, CHAR_getInt( charaindex, CHAR_GOLD ) +atoi(data1) ); + } + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_GOLD); + return; + }else { + if( atoi(data1) < 0 ) { + CHAR_setInt( charaindex, CHAR_GOLD, CHAR_getInt( charaindex, CHAR_GOLD ) -atoi(data1) ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_GOLD); + } + LogStone( + atoi(data2), + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + -intdata, + CHAR_getInt( charaindex, CHAR_GOLD ), + "FMBank()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ) + ); + } + }else if( kindflag == FM_FIX_FMLEADERCHANGE ){ + ACFMJob( clifd, ret, data1, data2 ); + } + // CoolFish: 2001/10/03 + else if (kindflag == FM_FIX_FMADV || kindflag == FM_FIX_FMFEED + || kindflag == FM_FIX_FMSYNTHESIZE || kindflag == FM_FIX_FMDEALFOOD) + { + char tmpbuf[1024], flag[128]; +#ifdef _NEW_MANOR_LAW + int i; +#endif + if (kindflag == FM_FIX_FMADV) strcpy(flag, "ADV"); + else if (kindflag == FM_FIX_FMFEED) strcpy(flag, "FEED"); + else if (kindflag == FM_FIX_FMSYNTHESIZE) strcpy(flag, "SYN"); + else if (kindflag == FM_FIX_FMDEALFOOD) strcpy(flag, "FOOD"); + sprintf(tmpbuf, "%s::%d %s %s", flag, + CHAR_getInt(charaindex, CHAR_FMINDEX), + CHAR_getChar(charaindex, CHAR_FMNAME), data1); + // print("ACFixFMData tmpbuf:%s\n", tmpbuf); + LogFMPOP(tmpbuf); +#ifdef _NEW_MANOR_LAW + for(i=0;i= FAMILY_MAXNUM ){ + print(" fmindex:%d if FALSE !!\n", fmindex); + return; + } + familyTax[ fmindex] = data; + sprintf( buf, "B|T|%d", data ); + lssproto_FM_send( clifd, buf ); + } + +} +void saacproto_ACFMClearPK_recv(int fd, char *result, char *fmname, int fmindex, + int index) +{ + int ret, i = 0; + + if (strcmp(result, SUCCESSFUL) == 0) ret = 1; + else ret = 0; + for (i = 0; i < MAX_SCHEDULEMAN * MAX_SCHEDULE; i++) + { + { + if (fmpks[i].flag == -1) continue; + if (fmpks[i].host_index == index + || fmpks[i].guest_index == index) + { + fmpks[i].host_index = -1; + strcpy(fmpks[i].host_name, ""); + fmpks[i].guest_index = -1; + strcpy(fmpks[i].guest_name, ""); + fmpks[i].prepare_time = -1; + fmpks[i].max_player = -1; + fmpks[i].win = -1; + fmpks[i].flag = -1; + } + } + } +} + +#ifdef _ACFMPK_LIST +void saacproto_ACSendFmPk_recv( int fd, int toindex, int flg) +{ + char buf[256]; + if( flg == 0){ + sprintf( buf, "ׯ԰ս¼ʧܣ"); + CHAR_talkToCli( toindex, -1, buf, CHAR_COLORRED); + }else{ + sprintf( buf, "ׯ԰ս¼ȷOKú׼"); + CHAR_talkToCli( toindex, -1, buf, CHAR_COLORYELLOW); + } +} + +void saacproto_ACLoadFmPk_recv(int fd, char *data) +{ + char buf[10], fm_pk_data[128]; + char token[256], skip[256]; + int fm_pk_num , fmpks_pos=-1; + easyGetTokenFromString( data , 1 , buf , sizeof(buf)); + fm_pk_num = atoi(buf); + sprintf(fm_pk_data , "%s", data+2 ); + if( ((fmpks_pos=fm_pk_num*MAX_SCHEDULE)== -1) || (fm_pk_num > FMPOINTNUM) ){ + print("\n err fm_pk_num(%d)", fm_pk_num ); + return; + } + // ʱ + if (getStringFromIndexWithDelim(data,"|",2,token,sizeof(token))) { + fmpks[fmpks_pos+1].dueltime=atoi(token); + } + // familyindex + if (getStringFromIndexWithDelim(data,"|",3,token,sizeof(token))) { + fmpks[fmpks_pos+1].host_index=atoi(token); + } + // + if (getStringFromIndexWithDelim(data,"|",4,token,sizeof(token))) { + strcpy(fmpks[fmpks_pos+1].host_name,makeStringFromEscaped(token)); + } + // Ͷ familyindex + if (getStringFromIndexWithDelim(data,"|",5,token,sizeof(token))) { + fmpks[fmpks_pos+1].guest_index=atoi(token); + } + // Ͷ + if (getStringFromIndexWithDelim(data,"|",6,token,sizeof(token))) { + strcpy(fmpks[fmpks_pos+1].guest_name,makeStringFromEscaped(token)); + } + // ׼ʱ + if (getStringFromIndexWithDelim(data,"|",7,token,sizeof(token))) { + fmpks[fmpks_pos+1].prepare_time=atoi(token); + } + // + if (getStringFromIndexWithDelim(data,"|",8,token,sizeof(token))) { + int maxnum = atoi( token); +#ifdef _FMWAR_PLAYERNUM + if( maxnum < getFmWarPlayerNum() ) maxnum = getFmWarPlayerNum(); +#else + if( maxnum < 50 ) maxnum = 50; +#endif + fmpks[fmpks_pos+1].max_player = maxnum; + } + // + if (getStringFromIndexWithDelim(data,"|",9,token,sizeof(token))) { + fmpks[fmpks_pos+1].flag=atoi(token); + } + if( fmpks[fmpks_pos+1].flag == FMPKS_FLAG_MANOR_OTHERPLANET ){ + // ս + if (getStringFromIndexWithDelim(data,"|",10,token,sizeof(token))) { + strcpy(fmpks[fmpks_pos+2].host_name,makeStringFromEscaped(token)); + strcpy(skip, makeStringFromEscaped(token)); + if (strcmp(getGameserverID(), skip)==0) { + fmpks[fmpks_pos+1].flag=8; + }else if( fmpks[fmpks_pos+1].flag == 8) { + fmpks[fmpks_pos+1].flag=10; + } + } + }else{ + strcpy( fmpks[fmpks_pos+2].host_name, ""); + } +} +#endif + + +void saacproto_ACManorPKAck_recv(int fd, char *data) +{ + // server ׯ԰ pk scheduleman + int i; + char token[256], skip[256]; + int char_max=CHAR_getCharNum(); + + print("ACManorPKAck_recv: %s\n",data); + + for (i=0; iindexOfExistDepotItems = allocateMemory( sizeof( int ) * CHAR_MAXDEPOTITEMHAVE ); + if( ch->indexOfExistDepotItems == NULL ) return; + for( i=0; iindexOfExistDepotItems[i] = -1; + + if( CHAR_makeDepotItemStringToChar( charaindex, data) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ֿ߲϶ȡʧܣ", CHAR_COLORYELLOW); + CHAR_removeDepotItem( charaindex); + return; + } + if( !CHAR_CHECKINDEX( meindex) ) return; + if( clifd != -1 ) { + char message[1024]; + char buf[1024]; + strcpy( message, + "3\n\n" + " ʹõֿ߲\n\n" + " ŵߣ\n" + " ȡصߣ\n" + ); + lssproto_WN_send( clifd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + 311, //CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf)) ); + } + +} + +#endif// + + +#ifdef _CHAR_POOLPET +void saacproto_ACCharSavePoolPet_recv(int fd ,char* result, char* data,int retfd) +{ + int charaindex = getCharindexFromFdid( retfd); + if( !CHAR_CHECKINDEX(charaindex) ) return; + if( strstr( result, FAILED ) != NULL ){ + CHAR_talkToCli( charaindex, -1, "ֿϴ浵ʧܣ", CHAR_COLORYELLOW); + return; + + } +} + +void saacproto_ACCharGetPoolPet_recv(int fd ,char* result, char* data,int retfd, int meindex) +{ + Char* ch = NULL; + int i, clifd, charaindex; + + if( strcmp( result , SUCCESSFUL ) != 0 ) return; + charaindex = getCharindexFromFdid(retfd); + if( !CHAR_CHECKINDEX( charaindex) ) return; + clifd = getfdFromCharaIndex( charaindex); + if( CHAR_CheckDepotPet( charaindex) ) return;//ֿѴ + + if( (ch = CHAR_getCharPointer( charaindex)) == NULL ) return; + ch->indexOfExistDepotPets = allocateMemory( sizeof( int ) * CHAR_MAXDEPOTPETHAVE ); + if( ch->indexOfExistDepotPets == NULL ) return; + for( i=0; iindexOfExistDepotPets[i] = -1; + + if( CHAR_makeDepotPetStringToChar( charaindex, data) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ֿ϶ȡʧܣ", CHAR_COLORYELLOW); + CHAR_removeDepotPet( charaindex); + return; + } + if( !CHAR_CHECKINDEX( meindex) ) return; + if( clifd != -1 ) { + char message[1024]; + char buf[1024]; + strcpy( message, + "3\n\n" + " رע⣺𽫹س빫ֿ\n﹫ֿ⡻\n" + " ų \n" + " ȡس \n" + ); + lssproto_WN_send( clifd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf)) ); + } + +} + +#endif + +#ifdef _ANGEL_SUMMON +//void saacproto_ACMissionTable_recv( int fd, int num, int type, char *data, int charaindex) +void saacproto_ACMissionTable_recv( int fd, int num, int type, char *data, char* angelinfo) +{ + char msg[1024]; + + if( type == 1 ) { // get data list + //if( num == -1) // get all data + { + int di, ti; + char onedata[1024], token[1024]; + + if( num == -1 ) { + print("оٻ!!\n"); + memset( missiontable, 0, sizeof(missiontable)); + } + else + print("һ!!:%s\n", data); + + for( di =1; di = MAXMISSIONTABLE) continue; + getStringFromIndexWithDelim( onedata, "|", 2, token, sizeof(token)); + strcpy( missiontable[ti].angelinfo, token); + getStringFromIndexWithDelim( onedata, "|", 3, token, sizeof(token)); + strcpy( missiontable[ti].heroinfo, token); + getStringFromIndexWithDelim( onedata, "|", 4, token, sizeof(token)); + missiontable[ti].mission = atoi( token); + getStringFromIndexWithDelim( onedata, "|", 5, token, sizeof(token)); + missiontable[ti].flag = atoi( token); + getStringFromIndexWithDelim( onedata, "|", 6, token, sizeof(token)); + missiontable[ti].time = atoi( token); + getStringFromIndexWithDelim( onedata, "|", 7, token, sizeof(token)); + missiontable[ti].limittime = atoi( token); + } + } + } + else if( type == 2 ) { // add data return + int angelindex =-1, i, maxChar; + char nameinfo[128], msgbuf[1024]; + + if( num == -1) { + sprintf( msg, "\n"); + print( msg); + LogAngel( msg); + return; + } + + sprintf( msgbuf, "յACӦ(add data) num=%d nameinfo=%s ", num, angelinfo); + print( msgbuf); + LogAngel( msgbuf); + + maxChar = CHAR_getPlayerMaxNum(); + for( i =0; i = MAXMISSIONTABLE) return; + + sprintf( msg, " AC :%d %s %s ", num, missiontable[num].angelinfo, missiontable[num].heroinfo); + print( msg); + LogAngel( msg); + + strcpy( missiontable[num].angelinfo, ""); + strcpy( missiontable[num].heroinfo, ""); + missiontable[num].mission = 0; + missiontable[num].flag = 0; + missiontable[num].time = 0; + missiontable[num].limittime = 0; + + } + +} + +#endif + +#ifdef _TEACHER_SYSTEM +void saacproto_ACCheckCharacterOnLine_recv( int acfd, int charaindex, int iOnline,char *data,int flag) +{ + switch(flag){ + case R_F_TEACHER_SYSTEM: + CHAR_Teacher_system_View(charaindex,iOnline,data); + break; + default:printf("saacproto_ACCheckCharacterOnLine_recv(): error flag type!!(%d)\n",flag); + } +} +#endif + +void saacproto_ACCharLogin_recv(int fd , int clifd, int flag) +{ + if(flag==1) + lssproto_ClientLogin_send( clifd , "ok" ); + else{ + lssproto_ClientLogin_send( clifd , "no" ); + CONNECT_endOne_debug(clifd); + } +} + +void saacproto_QuerySafePasswd_recv( int fd, char* id, int res, int charaindex ) +{ + if(res == 1) + { + CHAR_setWorkInt( charaindex, CHAR_WORKSAFEMODE, 1); + CHAR_talkToCli( charaindex, -1, "İȫȷϵͳɹ", CHAR_COLORRED); + } + if(res == 2) + { + CHAR_talkToCli( charaindex, -1, "İȫϵͳ޷", CHAR_COLORRED); + } + if(res == 3) + { + CHAR_talkToCli( charaindex, -1, "ûðȫ룬뾡ã", CHAR_COLORRED); + CHAR_AddSafePassword(charaindex); + } + if(res == 4) + { + CHAR_setWorkInt( charaindex, CHAR_WORKSAFEMODE, 1); + CHAR_talkToCli( charaindex, -1, "İȫȷϵͳɹ", CHAR_COLORRED); + CHAR_talkToCli( charaindex, -1, "ʾ1˺źͰȫƣΪ˺Űȫ뾡޸İȫ룡", CHAR_COLORRED); + CHAR_talkToCli( charaindex, -1, "ʾ2Ϊȷ˺Űȫδ޸İȫǰ޷ɾ", CHAR_COLORRED); + } +} + +void saacproto_AddSafePasswd_recv( int fd, char* id, int res, int charaindex ) +{ + if(res == 1) + { + CHAR_talkToCli( charaindex, -1, "Ѿɹõİȫ룡", CHAR_COLORRED); + } +} + +void saacproto_PointCardSucces_recv( int fd, char* id, int res, int point, int charaindex ) +{ + char msgtmp[256]; + if(res > 0) + { + sprintf(msgtmp, "%dԱֵɹڵĻԱΪ%d",res,point); + CHAR_talkToCli( charaindex, -1, msgtmp, CHAR_COLORYELLOW); + } +} + +void saacproto_PointCardErr_recv( int fd, char* id, int res, int charaindex ) +{ + if(res == -1) + { + CHAR_talkToCli( charaindex, -1, "óֵѾʹãظʹãлл", CHAR_COLORRED); + } + else if(res == -2) + { + CHAR_talkToCli( charaindex, -1, "ֵдд", CHAR_COLORRED); + } +} + +void saacproto_LoginTime_recv( int fd, char* id, char* res, int charaindex ) +{ + char timemsg[256]; + sprintf(timemsg,"ϴε½ʱΪ%s",res); + CHAR_talkToCli( charaindex, -1, timemsg, CHAR_COLORYELLOW); + +} + +#ifdef _ONLINE_SHOP +void saacproto_ACShop_recv( int fd, int charaindex, int shopnum, int vippoint, int piece, int pieces, int shopflag, char* res ) +{ + int clifd = getfdFromCharaIndex( charaindex); + lssproto_SHOP_send(clifd,shopnum,vippoint,piece,pieces,shopflag,res); + +} + +void saacproto_ACShopBuy_recv( int charaindex, int shopflag, int shopno, int buynum ) +{ + if(shopflag==1) + { + int ret; + char msgbuf[64], buf1[8], buf2[10]; + int enemynum; + int i,j,k; + int petindex, petindex2; + for( k =1 ; k<=buynum ; k++ ) + { + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charaindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + return; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == shopno) { + break; + } + } + + if( i == enemynum ) + return; + + ret = ENEMY_createPetFromEnemyIndex( charaindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charaindex, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( charaindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(charaindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charaindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + } + } + } + else + { + + int emptyitemindexinchara, itemindex; + int i; + char msgbuf[128]; + + if( buynum <= 0 ) buynum = 1; + + { + for( i = 0; i < buynum; i ++ ) { + emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex ); + + if( emptyitemindexinchara < 0 ){ + sprintf( msgbuf, "Ʒλ㡣" ); + + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + + return; + } + + itemindex = ITEM_makeItemAndRegist( shopno ); + + if( itemindex != -1 ){ + CHAR_setItemIndex( charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + snprintf( msgbuf, sizeof( msgbuf), "õ%s", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1,msgbuf, CHAR_COLORYELLOW); + } + } + } + } +} +#endif + +#ifdef _QUESTION_ONLINE +void saacproto_ACQuestion_recv(char* res) +{ + if( getStringFromIndexWithDelim( res, ";", 1, question, sizeof( question)) == FALSE ) + return; + if( getStringFromIndexWithDelim( res, ";", 2, answer, sizeof( answer)) == FALSE ) + return; + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + questionstarttime = timep; + int playnum = CHAR_getPlayerMaxNum(); + int i; + char questionres[256]; + sprintf(questionres,"\n⣺%s\n𰸣",question); + for(i=0;i 0) + CHAR_setInt( ret, CHAR_VITAL, vital); + if(str > 0) + CHAR_setInt( ret, CHAR_STR, str * 80); + if(tough > 0) + CHAR_setInt( ret, CHAR_TOUGH, tough * 80); + if(dex > 0) + CHAR_setInt( ret, CHAR_DEX, dex * 100); + + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret, CHAR_VARIABLEAI, 10000); + } + + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + + + }else if(data[0]=='1'){ + int emptyitemindexinchara, itemindex; + int itemid; + getStringFromIndexWithDelim(data,"|", 2, buf, sizeof(buf)); + itemid = atoi( buf); + emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex ); + + if( emptyitemindexinchara < 0 ){ + CHAR_talkToCli( charaindex, -1, "Ʒ", CHAR_COLORYELLOW); + return; + } + + itemindex = ITEM_makeItemAndRegist( itemid ); + + if( itemindex != -1 ){ + CHAR_setItemIndex( charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + + snprintf( token, sizeof( token), "ȡƷ %s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli( charaindex, -1, "Ʒڣ뱾Աϵ", CHAR_COLORYELLOW); + } + + }else if(data[0]=='2'){ + getStringFromIndexWithDelim(data,"|", 2, buf, sizeof(buf)); + int gold = atoi(buf); + CHAR_setInt( charaindex , CHAR_GOLD , CHAR_getInt( charaindex , CHAR_GOLD ) + gold); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_GOLD); + sprintf( token, "ȡ %d ʯң", gold); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORGREEN ); + }else{ + CHAR_talkToCli( charaindex, -1, data, CHAR_COLORGREEN); + } +} +#endif + +void saacproto_ACFmPkOnlineSn_recv(int manorindex,char* gsname, int flag) +{ + if(flag == 1){ + sprintf(manorname[manorindex],"%s",gsname); + }else{ + sprintf(manorname[manorindex],"\O"); + } + manorflag[manorindex] = flag; +} + +void saacproto_ACSystemAllTalk_recv(char* data) +{ + if(strlen(data)<1) return; + int playnum = CHAR_getPlayerMaxNum(); + int i; + for(i=0;i%s˵%s",playername,data); + int playnum = CHAR_getPlayerMaxNum(); + int i; + for(i=0;i +#include +#include +#include "common.h" +#include "util.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_exchangeman.h" +#include "net.h" +#include "char.h" +#include "object.h" +#include "readmap.h" +#include "addressbook.h" +#include "handletime.h" +#include "configfile.h" +#include "event.h" +#include "pet.h" +#include "battle.h" +#include "battle_command.h" +#include "magic.h" +#include "petmail.h" +#include "item_gen.h" +#include "pet_skill.h" +#include "log.h" //add this because the second had it +#include "map_deal.h" // CoolFish: 2001/4/18 +#include "trade.h" // CoolFish: Trade 2001/4/18 +#include "family.h" // CoolFish: Family 2001/5/24 +#include "item_event.h" // shan: blackmarket +#include "npc_petshop.h" +#include "enemy.h" +#include "char_base.h" +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +#include "chatroom.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +BOOL checkStringErr( char * ); + +#ifdef _AVOIEDamageCharName +int +dbKeyHasDamageChar( char* key) +{ + if( strstr(key , "'") != NULL ) + { + printf("test . key damage\n"); + return 1; + } + return 0; +} +#endif + +// shan add +extern struct FM_PKFLOOR fmpkflnum[FAMILY_FMPKFLOOR]; +extern char question[64]; +extern char answer[64]; +extern int questionstarttime; +extern int questionman; +#ifdef _UNTEXT_TALK +extern int textcnt; +#endif +extern int sameipnum; +extern int player_online; +extern int autopkcnt; +char mmcdkey[10][32]={"","","","","","","","","",""}; +char mmcdkeybuf[10][64]={"-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1","-1.-1.-1",}; +//static unsigned long cdkeycount=0; +//static unsigned long cdkeymaxnum=100000; +//static char** playcdkey=NULL; +//static unsigned long* cdkeylogintime=0; +//static int* cdkeylogincount=0; +/* ----------------------------------------------------------------------- + * ----------------------------------------------------------------------*/ +static int Callfromcli_Util_getTargetCharaindex( int fd, int toindex) +{ + int to_charaindex = -1; + int fd_charaindex = CONNECT_getCharaindex( fd ); + + /* з */ + if( toindex == 0 ) { + to_charaindex = fd_charaindex; + } + else if( toindex > 0 && toindex < 6 ) { + to_charaindex = CHAR_getCharPet( fd_charaindex, toindex-1); + if( !CHAR_CHECKINDEX( to_charaindex)) { + to_charaindex = -1; + } + } + else if( toindex > 5 && toindex < 11 ) { + to_charaindex = CHAR_getPartyIndex( fd_charaindex, toindex - 6); + } + return to_charaindex; +} + +#ifdef _MO_LOGINCHECK +#define MX (z>>5^y<<2) + (y>>3^z<<4)^(sum^y) + (k[p&3^e]^z); +long btea(long* v, long n, long* k) { + unsigned long z=v[n-1], y=v[0], sum=0, e, DELTA=0x9e3779b9; + long p, q ; + if (n > 1) { /* Coding Part */ + q = 6 + 52/n; + while (q-- > 0) { + sum += DELTA; + e = (sum >> 2) & 3; + for (p=0; p> 2) & 3; + for (p=n-1; p>0; p--) z = v[p-1], y = v[p] -= MX; + z = v[n-1]; + y = v[0] -= MX; + sum -= DELTA; + } + return 0; + } + return 1; +} +#endif +int check_jqm(char *jqm){ + int i; + int len = strlen(jqm); + for(i=0;i47&&jqm[i]<58) || (jqm[i]>64 &&jqm[i]<91) || (jqm[i]>98 &&jqm[i]<123)) + { + continue; + } + return -1; + } + return 1; +} + +//int cdkeyinit(void){ +// playcdkey = (char**)calloc(cdkeymaxnum, sizeof(char*)); +// int tempi; +// for(tempi=0;tempi0 && sasql_onlinenum(cdkey,ip) >= getSameIpNum() ){ + //printf("ͬһIP%sֹͬʱ½%d!\n",ip,sameipnum); + lssproto_ClientLogin_send( fd , "no" ); + CONNECT_endOne_debug(fd); + return; + } + } + res=sasql_query(cdkey,passwd); + if (res==3){ + if(getNoCdkeyPlayer()>0 && fd-player_online>=getNoCdkeyPlayer() && getNoCdkeyMode()!=0){ + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if(getNoCdkeyType()==0){ + //if(sasql_query_online_ip(ip)==0 && sasql_check_lockip(ip,getFengType())<1){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),2)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + //} + } + }else{ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + } + } + } + if(!sasql_register(cdkey,passwd)) + {//˺ûע + lssproto_ClientLogin_send( fd , "no" ); +// if(getSaType()==8018) +// CONNECT_endOne_debug(fd); + return; + } + }else if (res!=1){ + if(getNoCdkeyPlayer()>0 && fd-player_online>=getNoCdkeyPlayer() && getNoCdkeyMode()==2){ + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if(getNoCdkeyType()==0){ + //if(sasql_query_online_ip(ip)==0 && sasql_check_lockip(ip,getFengType())<1){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),2)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + //} + } + }else{ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + } + } + } + lssproto_ClientLogin_send( fd , "no" );; +// if(getSaType()==8018) +// CONNECT_endOne_debug(fd); + return; + } + if(sasql_cdkey_online(cdkey)>0){ + saacproto_ACKick_send(acfd,cdkey,-1,1); + lssproto_ClientLogin_send( fd , "no" ); + sasql_online(cdkey,NULL,NULL,NULL,NULL,0); + CONNECT_endOne_debug(fd); + return; + } + CONNECT_setCtype( fd, CLI ); + lssproto_ClientLogin_send( fd , "ok" ); + sasql_online(cdkey,NULL,ip,NULL,NULL,4); + } + +} +void lssproto_ClientLoginJqm_recv( int fd,char* cdkey, char* passwd, char* jqm +#ifdef _CAX_NEWMAC_LOGIN +,char* mac +#endif +#ifdef _MO_LOGINCHECK +,char* szdata +#endif + ) +{ + /* 2ֱľľ¼ */ + {//ttom avoid the restore 2001/01/09 + if(CONNECT_isNOTLOGIN(fd)==FALSE){ + print("\n the Client had Logined fd=%d",fd); + return; + } + } +// print("\n fd: %d",fd); +// print("\n cdkey: %s",cdkey); +// print("\n password: %s",passwd); +// print("\n jqm: %s",jqm); + // print("\n 1-mac: %s",mac); + + char* newjqm[128]; + int logintype = -1; + char buftest[128]; + memset(newjqm,0,sizeof(newjqm)); + memset(buftest,0,sizeof(buftest)); + strcpy(newjqm,jqm); + if(strstr(jqm,"|")!=NULL){ + if(getStringFromIndexWithDelim(jqm,"|", 1, buftest, sizeof(buftest)) == FALSE) + strcpy(newjqm,jqm); + else + strcpy(newjqm,buftest); + if(getStringFromIndexWithDelim(jqm,"|", 2, buftest, sizeof(buftest)) == FALSE) + logintype = -1; + else + logintype = atoi(buftest); + } + jqm = newjqm; + + // print("\n logintype : %d",logintype); + // print("\n jqm 2 : %s",jqm); + + /* if(check_jqm(jqm)==-1){ + lssproto_ClientLogin_send( fd , "¼µ¼" ); + return; + }*/ + + //print( "CliLogin cdkey=%s\n" , cdkey ); + /* connect */ + CONNECT_setCdkey( fd, cdkey ); + CONNECT_setPasswd( fd, passwd ); + CONNECT_setPcid(fd, jqm); +#ifdef _CAX_NEWMAC_LOGIN + CONNECT_setMAC(fd, mac); +#endif + + if (sasql_check_lockmac(mac)>0||sasql_check_lockpcid(jqm)>0){ + lssproto_ClientLogin_send( fd , "ӳʱϵGM" ); + CONNECT_endOne_debug(fd); + } + +#ifdef _MO_LOGINCHECK + long n = XXTEA_ROUND; + long k[4] = {XXTEA_KEY_1,XXTEA_KEY_2,XXTEA_KEY_3,XXTEA_KEY_4}; + char data[1024] = ""; + int datalen = 0; + int j = 0; + char demac[20]; + char detime[20]; + long recvtime; + //ת + //printf("Hex data: %s\n", szdata); + datalen = strlen(szdata); + + for(j = 0; j < datalen/2; j++){ + int temp; + sscanf(&szdata[2 * j], "%02X", &temp); + data[j] = (char)temp; + } + data[datalen/2] = '\0'; + //printf("Bin data: \n %s\n", data); + btea((long*)data, -n, k); // + //printf( "Decrypt Data:\n %s\n", data); + + sscanf(data,"%[^=]=%[^\n]",&demac,&detime); + //printf("\n demac=%s,mac=%s\n",demac, mac); + if(strstr(demac,mac)==NULL){ + lssproto_ClientLogin_send( fd , "¼֤ϵGM" ); + CONNECT_endOne_debug(fd); + return; + } + recvtime=atoi(detime); + //ȡϵͳʱ + time_t timep; + struct tm *p; + timep = time (NULL); + p = localtime ( &timep ); + if(abs(timep-recvtime)>86400){ + lssproto_ClientLogin_send( fd , "ӳʱϵGM" ); + CONNECT_endOne_debug(fd); + return; + } +#endif + + + //CONNECT_setCtype( fd, CLI ); + if(getLoginType()>0){ + if(logintype == -1){ + lssproto_ClientLogin_send( fd , "¿ͻ˺¼·" ); + return; + }else if(logintype!=0 && logintype!=1){ + lssproto_ClientLogin_send( fd , "·ֻ֧һSTWҵ¼" ); + return; + } + } + + unsigned long tmpip; + int a,b,c,d,i; + char ip[32]; + tmpip=CONNECT_get_userip(fd); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + //print( "\n½˺=%s =%s =%s\n",cdkey,passwd,ip); + { + int res; + + if (strlen(cdkey)==0 || strlen(passwd)==0 || strlen(ip)==0){ + //printf("½Ϣд\n"); + lssproto_ClientLogin_send( fd , "no" ); + CONNECT_endOne_debug(fd); + return; + } + if (sasql_chehk_lock(jqm)){ + //printf("˺%sֹ½!\n",cdkey); + lssproto_ClientLogin_send( fd , "ΥΪѱ޷½Ϸ" ); + //CONNECT_endOne_debug(fd); + return; + } + if (sasql_chehk_lock(ip)){ + //printf("IP%sֹ½!\n",ip); + lssproto_ClientLogin_send( fd , "no" ); + CONNECT_endOne_debug(fd); + return; + } + + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if ( getSameIpNum()>0 && sasql_onlinenum(cdkey,ip) >= getSameIpNum() ){ + //printf("ͬһIP%sֹͬʱ½%d!\n",ip,sameipnum); + //lssproto_ClientLogin_send( fd , "no" ); + //char tmpbuf[128]; + //sprintf(tmpbuf,"ĵ¼Ѵޣ%dID޷Ϸ",getSameIpNum()); + lssproto_ClientLogin_send( fd , "ĵ¼Ѵޣ޷Ϸ" ); + //CONNECT_endOne_debug(fd); + return; + } + } + if( getSameJqmNum()>0 && sasql_onlinejqmnum(jqm,1) >= getSameJqmNum() ){ + //lssproto_ClientLogin_send( fd , "no" ); + //CONNECT_endOne_debug(fd); + //char tmpbuf[128]; + //sprintf(tmpbuf,"ڸߵĵ¼Ѵﵽޣ%dID볢Ե½·",getSameJqmNum()); + lssproto_ClientLogin_send( fd , "ڸߵĵ¼Ѵﵽޣ볢Ե½·" ); + //printf("ͬһIP%sֹͬʱ½%d!\n"); + return; + } + if( getSameJqmAllNum()>0 && sasql_onlinejqmnum(jqm,2) >= getSameJqmAllNum() ){ + //lssproto_ClientLogin_send( fd , "no" ); + //CONNECT_endOne_debug(fd); + //char tmpbuf[128]; + //sprintf(tmpbuf,"ĵ¼Ѵޣ%dID޷Ϸ",getSameJqmAllNum()); + lssproto_ClientLogin_send( fd , "ĵ¼Ѵޣ޷Ϸ" ); + //printf("ĵ¼Ѵޣ޷Ϸ\n"); + return; + } + res=sasql_query(cdkey,passwd); + // print("\n res 2 : %d",res); + if (res==3){ + if(getNoCdkeyPlayer()>0 && fd-player_online>=getNoCdkeyPlayer() && getNoCdkeyMode()!=0){ + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if(getNoCdkeyType()==0){ + //if(sasql_query_online_ip(ip)==0 && sasql_check_lockip(ip,getFengType())<1){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),2)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + //} + } + }else{ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + } + } + } + if(!sasql_register(cdkey,passwd)) + {//˺ûע + //lssproto_ClientLogin_send( fd , "no" ); + lssproto_ClientLogin_send( fd , "˺Ųڣδעᣬ뵽ٷվעᡣ" ); +// if(getSaType()==8018) +// CONNECT_endOne_debug(fd); + return; + } + }else if (res!=1){ + if(getNoCdkeyPlayer()>0 && fd-player_online>=getNoCdkeyPlayer() && getNoCdkeyMode()==2){ + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if(getNoCdkeyType()==0){ + //if(sasql_query_online_ip(ip)==0 && sasql_check_lockip(ip,getFengType())<1){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),2)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + //} + } + }else{ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongCdkey(ip); + } +#endif + CONNECT_endOne_debug(fd); + return; + } + } + } + // + //lssproto_ClientLogin_send( fd , "no" ); + lssproto_ClientLogin_send( fd , "ϸȷϺ½" ); +// if(getSaType()==8018) +// CONNECT_endOne_debug(fd); + return; + } + if(sasql_cdkey_online(cdkey)>0){ + saacproto_ACKick_send(acfd,cdkey,-1,1); + lssproto_ClientLogin_send( fd , "no" ); + sasql_online(cdkey,NULL,NULL,NULL,NULL,0); + CONNECT_endOne_debug(fd); + return; + } + CONNECT_setCtype( fd, CLI ); + char* oldpcid = NULL; + oldpcid = sasql_query_jqm(cdkey); +#ifdef _CAX_NEWMAC_LOGIN + char* oldmac = NULL; + oldmac = sasql_query_mac(cdkey); +#endif + + +/* if(strlen(oldpcid)<10){ + CONNECT_setOldPcid(fd,jqm); + }else{ + CONNECT_setOldPcid(fd,oldpcid); + }*/ + + lssproto_ClientLogin_send( fd , "ok" ); + + //print("\n jqm: %s",jqm); + sasql_online_jqm(cdkey,jqm,ip,logintype); +#ifdef _CAX_NEWMAC_LOGIN + sasql_online_mac(cdkey,mac,ip,logintype); +#endif + } + +} + +void lssproto_CreateNewChar_recv( int fd,int dataplacenum,char* charname, + int imgno,int faceimgno, + int vital,int str,int tgh,int dex, + int earth,int water,int fire,int wind, + int hometown ) +{ + char cdkey[CDKEYLEN]; + + if( CONNECT_isCLI( fd ) == FALSE )return; + + if( CONNECT_isNOTLOGIN(fd) == FALSE ){ + lssproto_CreateNewChar_send( fd, FAILED, "Not NOTLOGIN State\n" ); + return; + } + if( strlen( charname ) == 0 ){ + lssproto_CreateNewChar_send(fd,FAILED, "ֹ̣޷\n"); + return; +#ifdef _AVOIEDamageCharName + }else if ( dbKeyHasDamageChar(charname)){ + lssproto_CreateNewChar_send(fd,FAILED, "ֹֽʹ\n"); + return; +#endif + }else if( strlen(charname) >= 32 ){ + lssproto_CreateNewChar_send(fd,FAILED, "ֹ޷\n"); + return; + // Nuke start 0711: Avoid naming as WAEI + }else if (strstr(charname,"") +// WON ADD + || strstr(charname,"gm") || strstr(charname,"GM") + || strstr(charname,"Gm") || strstr(charname,"gM") + || strstr(charname,"") || strstr(charname,"ǣ") + || strstr(charname,"ǣ") || strstr(charname,"") + || strstr(charname," ") || strstr(charname,"=") || strstr(charname,",") +#ifdef _UNREG_NEMA + || (strstr(charname,getUnregname(0)) && strlen(getUnregname(0))>0) + || (strstr(charname,getUnregname(1)) && strlen(getUnregname(1))>0) + || (strstr(charname,getUnregname(2)) && strlen(getUnregname(2))>0) + || (strstr(charname,getUnregname(3)) && strlen(getUnregname(3))>0) + || (strstr(charname,getUnregname(4)) && strlen(getUnregname(4))>0) + || (strstr(charname,getUnregname(5)) && strlen(getUnregname(5))>0) + || (strstr(charname,getUnregname(6)) && strlen(getUnregname(6))>0) + || (strstr(charname,getUnregname(7)) && strlen(getUnregname(7))>0) + || (strstr(charname,getUnregname(8)) && strlen(getUnregname(8))>0) +#endif + || strstr(charname,"") +// WON END + ) { + + unsigned ip=CONNECT_get_userip(fd); + int a, b, c, d, ck; + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + + ck= ( + ( (a== 10) && (b==0) && (c==0) ) || + ( (a==211) && (b==76) && (c==176) && (d==21) ) || // ̨wayi + ( (a==210) && (b==64) && (c==97) && ((d>=21)&&(d<=25)) ) || + ( (a==61) && (b==222) && (c==142) && (d==66)) || + ( (a==172) && (b==16) && (c==172) && (d==29) ) + ); + + print(" name_WAEI_IP:%d.%d.%d.%d ck:%d ",a,b,c,d,ck ); + + if( !ck ) { + lssproto_CreateNewChar_send(fd,FAILED, "Ƿ֣޷\n"); + return; + } + } + { + // Nuke start 0801,0916: Avoid strange name + int i,ach; + for (i=0,ach=0;i=0x7f)&& + ((unsigned char)charname[i]<=0xa0)) { ach=1; break; } // Force no 0x7f~0xa0 + if ((unsigned char)charname[i]<=0x20) { ach=1; break; } // Force greater than 0x20 + if (ach) { + if ((((unsigned char)charname[i]>=0x40)&&((unsigned char)charname[i]<=0x7e))|| + (((unsigned char)charname[i]>=0xa1)&&((unsigned char)charname[i]<=0xfe))) ach=0; + } else { + if (((unsigned char)charname[i]>=0xa1)&&((unsigned char)charname[i]<=0xfe)) ach=1; + } + } + if (ach) { lssproto_CreateNewChar_send(fd,FAILED, "Ƿ֣޷\n"); return; } + // Nuke end + } + // Nuke end + + + CONNECT_getCdkey( fd, cdkey, sizeof( cdkey )); + CHAR_createNewChar( fd, dataplacenum, charname ,imgno, faceimgno, + vital, str, tgh, dex, + earth, water, fire, wind, + hometown , cdkey ); +} + +void lssproto_CharLogin_recv( int fd,char* charname ) +{ + char cdkey[CDKEYLEN], passwd[PASSWDLEN]; + + if( CONNECT_isCLI( fd ) == FALSE )return; + print( "\nԵ½: =%s\n", charname); + if( charname[0] == '\0' ){ + lssproto_CharLogin_send( fd, FAILED, "Can't access char have no name\n" ); + return; + } + if( CONNECT_isNOTLOGIN(fd) == FALSE ){ + lssproto_CharLogin_send( fd, FAILED, "Already Logged in\n" ); + return; + } + if( strstr(charname,",")!=NULL ){ + CONNECT_endOne_debug(fd); + return; + } + CONNECT_setCharname( fd, charname ); + CONNECT_getCdkey( fd, cdkey, sizeof( cdkey )); + CONNECT_getPasswd( fd, passwd, sizeof(passwd)); + unsigned long tmpip; + int a,b,c,d; + char ip[32]; + tmpip=CONNECT_get_userip(fd); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + int res; + res = sasql_load_query( cdkey, passwd); + if(res!=1){ + lssproto_CharLogin_send( fd ,FAILED, "޷¼\n" ); + //CONNECT_endOne_debug(fd); + return; + } + saacproto_ACCharLoad_send( acfd, cdkey,passwd, charname,1,"", + CONNECT_getFdid(fd),ip ); + CONNECT_setState( fd, WHILELOGIN ); +} + +#ifdef _ITEM_CHECKDROPATLOGOUT +BOOL CheckDropatLogout(int charaindex ) +{ + int i; + for( i=0 ; i= 0 ) + { + CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), &fl, &x, &y ); + +#ifdef _CHAR_NEWLOGOUT + if( flg == 1 ){//ؼ¼ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + CHAR_talkToCli( charaindex, -1, "ս޷ؼ¼㣡", CHAR_COLORYELLOW); + return; + } +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "Я޷ʹá", CHAR_COLORYELLOW); + return; + } +#endif +#ifdef _TEAM_WARP + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ){ + CHAR_talkToCli( charaindex, -1, "Ŷ޷ؼ¼㣡", CHAR_COLORYELLOW); + return; + } + + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + int i; + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + int subindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1+i ); + if( CHAR_CHECKINDEX( subindex ) == FALSE ) continue; + CHAR_talkToCli( subindex, -1, "ȫ˲У", CHAR_COLORWHITE); + ITEM_WarpDelErrorItem( subindex ); + CHAR_warpToSpecificPoint( subindex, fl, x, y ); + } + return; + } +#endif + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE ){ +#ifdef _PLAYER_NPC + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + int pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex)){ + if(CHAR_getInt( pindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC)break; + } + } + if(i < CHAR_MAXPETHAVE) +#endif + { + CHAR_talkToCli( charaindex, -1, "Ŷ޷ؼ¼㣡", CHAR_COLORYELLOW); + return; + } + } +#ifdef _ITEM_CHECKDROPATLOGOUT + if( CheckDropatLogout( charaindex ) ){ + CHAR_talkToCli( charaindex, -1, "ЯƷʹ޷ؼ¼㣡", CHAR_COLORYELLOW); + return; + } +#endif +#ifdef _AUTO_PK + if(CHAR_getInt(charaindex,CHAR_FLOOR)==20000 + && CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE + && CHAR_getInt(charaindex,CHAR_AUTOPK)!=-1 ){ + char buf[64]; + int i,num=0,winindex; + int playernum = CHAR_getPlayerMaxNum(); +#ifndef _YUANGUSA + sprintf(buf, "С%s˳ǰ",CHAR_getChar(charaindex,CHAR_NAME)); + AutoPk_PKSystemTalk( buf, buf ); +#endif + if(AutoPk_PKTimeGet()<=0){ + for(i=0;i1)||(i_diff_y>1) ){ + // Robin 0518 + //CHAR_talkToCli(fd_charaindex, -1, "·ߡ", CHAR_COLORYELLOW); + + //return; + x = ix; + y = iy; + } + } + if(!(MAP_walkAble(fd_charaindex,CHAR_getInt(fd_charaindex, CHAR_FLOOR),x,y))){ + // Robin 03/14 + x = ix; + y = iy; + }else{ + } + CHAR_walk_init( fd, x, y, direction, TRUE); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_W2_recv( int fd,int x,int y,char* direction ) +{ + //ttom +3 + int fd_charaindex, ix, iy, i_fl,wx,wy,w_fl,warfd; + char workxyd[30]; + char workbuf[20]; + char w_d[5]; + //Char *chwk;// CoolFish: Rem 2001/4/18 + fd_charaindex = CONNECT_getCharaindex( fd ); + + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + i_fl=CHAR_getInt(fd_charaindex, CHAR_FLOOR); + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; +#ifdef _BATTLEEND_FIX + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKBALLTELENDTIME)>0) + CHAR_setWorkInt(fd_charaindex,CHAR_WORKBALLTELENDTIME,0); +#endif +#ifdef _NO_QUICK_WAR + if( strlen(direction)==1 && strstr("abcdefgh",direction)!=NULL ){ + if(strlen(CHAR_getWorkChar(fd_charaindex,CHAR_WARWORKXYD))!=0){ + strcpy(workxyd,CHAR_getWorkChar(fd_charaindex,CHAR_WARWORKXYD)); + if(getStringFromIndexWithDelim(workxyd,"|", 1, workbuf, sizeof(workbuf)) == FALSE) + w_fl=-1; + w_fl=atoi(workbuf); + if(getStringFromIndexWithDelim(workxyd,"|", 2, workbuf, sizeof(workbuf)) == FALSE) + wx=-1; + wx=atoi(workbuf); + if(getStringFromIndexWithDelim(workxyd,"|", 3, workbuf, sizeof(workbuf)) == FALSE) + wy=-1; + wy=atoi(workbuf); + if(getStringFromIndexWithDelim(workxyd,"|", 4, workbuf, sizeof(workbuf)) == FALSE) + strcpy(w_d,"z"); + strcpy(w_d,workbuf); + if(i_fl==w_fl && x == wx && y == wy && (strcmp(w_d,direction)==0 || (strcmp(w_d,"c")==0 && strcmp(direction,"g")==0) || (strcmp(w_d,"g")==0 && strcmp(direction,"c")==0)) ){ + if(getStayEncount(fd)==1){ + return; + } + setStayEncount(fd); + { + Char *ch; + ch = CHAR_getCharPointer( fd_charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( fd_charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( fd_charaindex); + } + return; + } + sprintf(workxyd,"%d|%d|%d|%s",i_fl,x,y,direction); + CHAR_setWorkChar(fd_charaindex,CHAR_WARWORKXYD,workxyd); + } + sprintf(workxyd,"%d|%d|%d|%s",i_fl,x,y,direction); + CHAR_setWorkChar(fd_charaindex,CHAR_WARWORKXYD,workxyd); + }else if(strcmp(direction,"gcgcgcgcgc")==0 || strcmp(direction,"gcgc")==0){ + if(getStayEncount(fd)==1){ + return; + } + setStayEncount(fd); + { + Char *ch; + ch = CHAR_getCharPointer( fd_charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( fd_charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( fd_charaindex); + } + return; + } +#endif + //ttom avoid the warp at will 11/6 + { + int i_diff_x,i_diff_y; + //ix=CHAR_getInt(fd_charaindex, CHAR_X); + //iy=CHAR_getInt(fd_charaindex, CHAR_Y); + //i_fl=CHAR_getInt(fd_charaindex, CHAR_FLOOR); + i_diff_x=abs(ix-x); + i_diff_y=abs(iy-y); + if( (i_diff_x>1)||(i_diff_y>1) ){//2 + //print("\nWarp Error!!!!!!!!!"); + //print("\nthe origion->fd=%d,x=%d,y=%d",fd,ix,iy); + //print("\nthe modify-->fd=%d,X=%d,Y=%d,dir=%s",fd,x,y,direction); + x=ix; + y=iy; + // Robin 03/14 + //return; + } + //if((i_fl==117)&&(ix==225)&&(iy==13)) goto END_w; + }//ttom + if(!(MAP_walkAble(fd_charaindex,CHAR_getInt(fd_charaindex, CHAR_FLOOR),x,y))){ +// print("\n the map is invaild(f:%d,x:%d,y:%d)",CHAR_getInt(fd_charaindex, CHAR_FLOOR),x,y); + x = ix; + y = iy; + } + CHAR_walk_init( fd, x, y, direction, FALSE); +} + +void lssproto_SKD_recv( int fd,int dir, int index) +{ + CHECKFDANDTIME; +} + +void lssproto_ID_recv( int fd,int x,int y,int haveitemindex,int toindex ) +{ + int to_charaindex; + int fd_charaindex; + + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + //ttom avoid the warp at will 12/5 + { + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + x=ix; + y=iy; + } +// if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) + 1 == toindex ){ +// CHAR_talkToCli( fd_charaindex , -1, "޷ʹøƷʹã", CHAR_COLORRED); +// return; +// } + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + to_charaindex = Callfromcli_Util_getTargetCharaindex( fd, toindex); + CHAR_ItemUse( fd_charaindex, to_charaindex, haveitemindex ); +} + + +/*------------------------------------------------------------ + * įë + ------------------------------------------------------------*/ +void lssproto_ST_recv( int fd,int titleindex ) +{ + CHECKFDANDTIME; + CHAR_selectTitle( CONNECT_getCharaindex( fd) , titleindex ); +} +/*------------------------------------------------------------ + * įë + ------------------------------------------------------------*/ +void lssproto_DT_recv( int fd,int titleindex ) +{ + CHECKFDANDTIME; + CHAR_deleteTitle( CONNECT_getCharaindex(fd) , titleindex ); +} + + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_FT_recv( int fd,char* data ) +{ + CHECKFDANDTIME; + + // Robin 04/23 debug + if( strlen(data) > 12 ) return; + + if( checkStringErr(data) ) return; + + CHAR_inputOwnTitle( CONNECT_getCharaindex(fd) , data); +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_PI_recv( int fd,int x, int y, int dir ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + {//ttom avoid warp at will + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + //print("\n--Error!!!!"); + //print("\norigion x=%d,y=%d",ix,iy); + //print("\nmodify X=%d,Y=%d",x,y); + x=ix; + y=iy; + } + }//ttom end + + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + CHAR_PickUpItem( fd_charaindex, dir); +} + +void lssproto_DI_recv( int fd,int x, int y, int itemindex ) +{ + int charaindex; + CHECKFDANDTIME; + charaindex = CONNECT_getCharaindex( fd ); + + if( CHAR_getWorkInt(charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return; + if( CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + + CHAR_setMyPosition( charaindex , + CHAR_getInt( charaindex, CHAR_X), CHAR_getInt( charaindex, CHAR_Y), TRUE); + CHAR_DropItem( charaindex, itemindex ); +} + +void lssproto_DP_recv( int fd,int x, int y, int petindex ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + { + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + x=ix; + y=iy; + } + CHAR_setMyPosition( fd_charaindex , x,y,TRUE); + if( CHAR_getWorkInt( fd_charaindex , CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + PET_dropPet( fd_charaindex, petindex); +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_DG_recv( int fd,int x, int y, int amount ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + //ttom avoid the warp at will 12/15 + { + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + x=ix; + y=iy; + } + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + CHAR_DropMoney( fd_charaindex, amount ); +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_MI_recv( int fd,int fromindex,int toindex ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + CHAR_moveEquipItem( fd_charaindex, fromindex, toindex ); + +} + +#ifdef _PET_ITEM +void lssproto_PETITEM_recv( int fd,int x,int y,int petindex,int fromindex,int toindex ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + + /* ºƥľ¦Ⱦµ ؤԻ */ + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + CHAR_movePetItem( fd_charaindex, petindex, fromindex, toindex ); +} +#endif + + + +/*------------------------------------------------------------ + * ƽʧ + ------------------------------------------------------------*/ +void lssproto_SKUP_recv( int fd,int skillid ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex(fd); + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + CHAR_SkillUp(fd_charaindex,skillid); +} + +/*------------------------------------------------------------ + * 嶪ë˪ + ------------------------------------------------------------*/ +void lssproto_MSG_recv( int fd,int index,char* message, int color ) +{ + int fd_charaindex; + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd); + ADDRESSBOOK_sendMessage( fd_charaindex, index,message, color ); + +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_AB_recv( int fd ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + ADDRESSBOOK_sendAddressbookTable( fd_charaindex ); +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_DAB_recv( int fd , int index) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + ADDRESSBOOK_deleteEntry( fd_charaindex ,index); +} + +void lssproto_AAB_recv( int fd , int x, int y) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + { + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + x=ix; + y=iy; + } + } + CHAR_setMyPosition( fd_charaindex , x,y,TRUE); + ADDRESSBOOK_addEntry( fd_charaindex ); +} + +void lssproto_L_recv( int fd, int dir ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + CHAR_Look( fd_charaindex ,dir ); +} + + +/*------------------------------------------------------------ + * ö⼰˪ + ------------------------------------------------------------*/ +void lssproto_TK_recv( int fd,int x, int y,char* message,int color, int area ) +{ + int fd_charaindex,ix,iy;//ttom+2 + int fmindex, channel; + int i; + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd ); + fmindex = CHAR_getInt( fd_charaindex, CHAR_FMINDEX ); + channel = CHAR_getWorkInt( fd_charaindex, CHAR_WORKFMCHANNEL ); + + {// Robin 0629 silent + int silentSec, talkCount; + silentSec = CHAR_getInt(fd_charaindex,CHAR_SILENT); + if( silentSec > 0 ) { + int loginTime; + char buf[256]; + int leftSec; + loginTime = CHAR_getWorkInt(fd_charaindex, CHAR_WORKLOGINTIME ); + // ֹʱ˷ᡡ쳣 Robin 20040817 + if( (int)NowTime.tv_sec < loginTime) { + CHAR_setInt(fd_charaindex, CHAR_SILENT, 0 ); + return; + } + if( ((int)NowTime.tv_sec -loginTime) > silentSec ) { + CHAR_setInt(fd_charaindex, CHAR_SILENT, 0 ); + return; + } + silentSec += 10; //10 + + leftSec = silentSec - ((int)NowTime.tv_sec - loginTime); + sprintf(buf, "!!%d룬ٽ10ӡ", leftSec ); + CHAR_talkToCli(fd_charaindex, -1, buf, color); + CHAR_setInt(fd_charaindex, CHAR_SILENT, silentSec ); + return; + } + + talkCount = CHAR_getWorkInt(fd_charaindex, CHAR_WORKTALKCOUNT ); + talkCount ++; + CHAR_setWorkInt( fd_charaindex, CHAR_WORKTALKCOUNT, talkCount); + if( talkCount > 40 ) { + int lastTalkTime = CHAR_getWorkInt(fd_charaindex, CHAR_WORKTALKTIME ); + if( (int)NowTime.tv_sec - lastTalkTime < 10 ) { + CHAR_setInt( fd_charaindex,CHAR_SILENT, 60 ); + CHAR_setWorkInt( fd_charaindex, CHAR_WORKLOGINTIME, (int)NowTime.tv_sec ); + CHAR_talkToCli( fd_charaindex, -1, "̫໰ࡣϢһӰɣ", color); + CHAR_setWorkInt(fd_charaindex, CHAR_WORKTALKCOUNT, 0 ); + return; + }else { + CHAR_setWorkInt( fd_charaindex, CHAR_WORKTALKTIME, (int)NowTime.tv_sec ); + CHAR_setWorkInt(fd_charaindex, CHAR_WORKTALKCOUNT, 0 ); + } + } + + } + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + x=ix; + y=iy; + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + if(!CONNECT_get_shutup(fd)){ //ttom add the shut up function +#ifdef _UNTEXT_TALK + for(i=0;i 7) { + fx = CHAR_getInt(fd_charaindex, CHAR_X); + fy = CHAR_getInt(fd_charaindex, CHAR_Y); + }else { + CHAR_getCoordinationDir( dir, CHAR_getInt(fd_charaindex, CHAR_X), + CHAR_getInt(fd_charaindex, CHAR_Y),1,&fx,&fy); + } + rc = EVENT_main(fd_charaindex, event,fx,fy); + lssproto_EV_send( fd, seqno, rc); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_EN_recv( int fd , int x,int y ) +{ + int ret = FALSE, err = 0; + int fd_charaindex; + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd); +#ifdef _ALLBLUES_LUA_1_7 + if( CHAR_getInt( fd_charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + if(CharVsEnemyFunction( fd_charaindex ) == TRUE)return; + } + } +#endif + //print(" EN_recv "); + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_CLIENT){ + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + CHAR_setWorkChar( fd_charaindex, CHAR_WORKWALKARRAY,""); + err = BATTLE_CreateVsEnemy( fd_charaindex,0, -1); + if( err != 0 ){ + ret = FALSE; + }else{ + ret = TRUE; + } + } +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_DU_recv( int fd , int x,int y ) +{ + int fd_charaindex; + fd_charaindex = CONNECT_getCharaindex( fd ); +// if(CHAR_getWorkInt(fd_charaindex, CHAR_WORKSAFEMODE)==0) +// { +// lssproto_EN_send( fd, FALSE, 0 ); +// CHAR_SafePassword(fd_charaindex); +// return; +// } + if(CHAR_getInt(fd_charaindex,CHAR_FLOOR)==20000){ + lssproto_EN_send( fd, FALSE, 0 ); + return; + } + if(CHAR_getInt(fd_charaindex,CHAR_FLOOR)==getNoPkMap()){ + CHAR_talkToCli( fd_charaindex, -1, "õͼֹPK", CHAR_COLORYELLOW); + lssproto_EN_send( fd, FALSE, 0 ); + return; + } + OBJECT object; + + int ret = FALSE, charaindex = -1, enemyindex; + int frontx,fronty; + int cnt = 0; + BOOL found = FALSE; + CHECKFDANDTIME; + + + {//ttom avoid warp at will + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + //print("\n--Error!!!!"); + //print("\norigion x=%d,y=%d",ix,iy); + //print("\nmodify X=%d,Y=%d",x,y); + x=ix; + y=iy; + } + } + + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE) + != CHAR_PARTY_CLIENT) + { + int i; + // м̼͵ + charaindex = fd_charaindex; + CHAR_setMyPosition( charaindex, x,y,TRUE); + /* WALKARRAYëʧ */ + CHAR_setWorkChar( charaindex, CHAR_WORKWALKARRAY,""); + + + /* */ + for( i = 0; i < CONNECT_WINDOWBUFSIZE ; i ++ ) { + CONNECT_setDuelcharaindex( fd, i, -1 ); + } + + CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , + CHAR_getInt( charaindex , CHAR_X ), + CHAR_getInt( charaindex , CHAR_Y ) , + 1 , &frontx , &fronty ); + + for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR), + frontx,fronty) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int toindex; + int objindex = GET_OBJINDEX(object); + /* ƽҷԪئ */ + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; + toindex = OBJECT_getIndex( objindex); + /* Ԫئ */ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER +#ifdef _PLAYER_NPC + && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC +#endif +// && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC + ) continue; + found = TRUE; + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE )continue; + int floor = CHAR_getInt( charaindex, CHAR_FLOOR ); + + if(!CHAR_getFlg( toindex, CHAR_ISDUEL) +#ifdef _BATTLE_FLOOR + && (!strcmp(getBattleFloorCF(),"") + && floor!=getBattleFloor(1) + && floor!=getBattleFloor(2) + && floor!=getBattleFloor(3) + && floor!=getBattleFloor(4) + && floor!=getBattleFloor(5)) +#endif + )continue; +#ifdef _ALLBLUES_LUA_1_5 + int flg = FreeVsPlayer(charaindex, toindex); + if( flg == 1){ + lssproto_EN_send( fd, FALSE, 0 ); + return; + }else if( flg == 2){ + return; + }else +#endif +#ifdef _AUTO_PK + if(!CHAR_getFlg( toindex, CHAR_ISDUEL)){ + if(AutoPk_PKTimeGet()>0)continue; + if(floor!=20000)continue; + if(CHAR_getInt( charaindex, CHAR_AUTOPK ) == -1)continue; + if(CHAR_getInt( toindex, CHAR_AUTOPK ) == -1)continue; + } +#endif + // shan begin + { + int i; + for( i=0; i 1 ) { + int strlength; + char msgbuf[1024]; + char escapebuf[2048]; + strcpy( msgbuf, "1\nҪ˭ս\n"); + strlength = strlen( msgbuf); + for( i = 0; + CONNECT_getDuelcharaindex( fd,i) != -1 + && i< CONNECT_WINDOWBUFSIZE; + i ++ ) + { + char *a = CHAR_getChar( + CONNECT_getDuelcharaindex( fd,i) , CHAR_NAME); + char buf[256]; + snprintf( buf, sizeof( buf),"%s [%s]\n", a, + CHAR_getWorkInt( + CONNECT_getDuelcharaindex(fd,i), + CHAR_WORKPARTYMODE ) + != CHAR_PARTY_NONE ? "": ""); + if( strlength + strlen( buf) > arraysizeof( msgbuf)){ + print( "%s:%dӴѶϢbuffer㡣\n", + __FILE__,__LINE__); + break; + } + strcpy( &msgbuf[strlength], buf); + strlength += strlen(buf); + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SELECTDUEL, + -1, + makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); + ret = TRUE; + } + } + + +lssproto_DU_recv_Err:; + if( ret == FALSE ) { + /* ˪ */ + lssproto_EN_send( fd, FALSE, 0 ); + if( cnt > 0 ) CHAR_talkToCli( charaindex, -1, "ʧܣ", CHAR_COLORYELLOW); + else if( found ) CHAR_talkToCli( charaindex, -1, "˿Զս", CHAR_COLORYELLOW); + else CHAR_talkToCli( charaindex, -1, "ûκˡ", CHAR_COLORYELLOW); + } +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_EO_recv( int fd, int dummy ) +{ + int fd_charaindex; + int battle_index;//ttom++ + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd ); + BattleEncountOut( fd_charaindex ); + // Nuke start 0827 : Battle acceleration + battle_index=CHAR_getWorkInt(fd_charaindex,CHAR_WORKBATTLEINDEX); + if( BATTLE_CHECKINDEX( battle_index ) == FALSE ){ + return; + } + if(BattleArray[battle_index].type != BATTLE_TYPE_P_vs_P){ + if(CONNECT_get_watchmode(fd)) { + //print("fd= %d Watching the battle __ lssprot_EO_recv \n",fd);//for debug + CONNECT_set_watchmode(fd,FALSE); + return; + } + else if (checkBEOTime( fd ) < 0) { + //CHAR_talkToCli(fd_charaindex, -1, "ม", CHAR_COLORYELLOW); + } + } + // Nuke end +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_BU_recv( int fd, int dummy) +{ + int fd_charaindex; + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd ); + // shan 2001/12/25 + //BATTLE_WatchStop( fd_charaindex ); +} + +void lssproto_B_recv( int fd, char *command ) +{ +// if(strlen(command)<3 && strstr(command,"&")!=NULL) +// return; + int fd_charaindex; + int battle_index;//ttom++ + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd ); +#ifdef _NOJOB_PK + if(CHAR_getInt(fd_charaindex,CHAR_FLOOR)==getNoJobPkMap() && strncmp( command, "P", 1 ) == 0 ) + sprintf(command,"G"); +#endif + BattleCommandDispach( fd, command ); + // Nuke +1 0827: Battle acceleration + battle_index=CHAR_getWorkInt(fd_charaindex,CHAR_WORKBATTLEINDEX); + if( BATTLE_CHECKINDEX( battle_index ) == FALSE ){ + return; + } + if(BattleArray[battle_index].type != BATTLE_TYPE_P_vs_P){ + if(BattleArray[battle_index].type == BATTLE_TYPE_WATCH) { + CONNECT_set_watchmode(fd,TRUE); + return; + } + } + //Nuke end +} + +void lssproto_FS_recv( int fd,int flg ) +{ + int fd_charaindex; + CHECKFDANDTIME; + + fd_charaindex = CONNECT_getCharaindex( fd ); + /* ڱ幫׷ºޥ */ + if(CHAR_getWorkInt( fd_charaindex, CHAR_WORKSAFEMODE)==0) + { + if((flg & CHAR_FS_TRADE ) ==32 ) + { + CHAR_SafePassword(fd_charaindex); + return; + } + } + CHAR_setFlg( fd_charaindex, CHAR_ISPARTY, + (flg & CHAR_FS_PARTY )? TRUE:FALSE); + //CHAR_setFlg( fd_charaindex, CHAR_ISBATTLE, + // (flg & CHAR_FS_BATTLE )? TRUE:FALSE); + CHAR_setFlg( fd_charaindex, CHAR_ISDUEL, + (flg & CHAR_FS_DUEL )? TRUE:FALSE); + CHAR_setFlg( fd_charaindex, CHAR_ISPARTYCHAT, + (flg & CHAR_FS_PARTYCHAT )? TRUE:FALSE); + CHAR_setFlg( fd_charaindex, CHAR_ISTRADECARD, + (flg & CHAR_FS_TRADECARD )? TRUE:FALSE); +#ifdef _CHANNEL_MODIFY + //Ƶ + CHAR_setFlg(fd_charaindex,CHAR_ISTELL,(flg & CHAR_FS_TELL )? TRUE:FALSE); + //Ƶ + CHAR_setFlg(fd_charaindex,CHAR_ISFM,(flg & CHAR_FS_FM )? TRUE:FALSE); + //ְҵƵ + CHAR_setFlg(fd_charaindex,CHAR_ISOCC,(flg & CHAR_FS_OCC )? TRUE:FALSE); + // + CHAR_setFlg(fd_charaindex,CHAR_ISCHAT,(flg & CHAR_FS_CHAT )? TRUE:FALSE); + //Ի + CHAR_setFlg(fd_charaindex,CHAR_ISSAVE,(flg & CHAR_FS_SAVE )? TRUE:FALSE); + //Ƶ + if(getSaType()==95){ + CHAR_setFlg(fd_charaindex,CHAR_ISWORLD,(flg & CHAR_FS_WORLD )? TRUE:FALSE); + if(CHAR_getFlg(fd_charaindex,CHAR_ISWORLD)==FALSE) + CHAR_setWorkInt( fd_charaindex , CHAR_WORKALLTALKTYPE, 1); + else if(CHAR_getFlg(fd_charaindex,CHAR_ISWORLD)==TRUE) + CHAR_setWorkInt( fd_charaindex , CHAR_WORKALLTALKTYPE, 0); + } +#endif + // CoolFish: Trade 2001/4/18 + CHAR_setFlg( fd_charaindex, CHAR_ISTRADE, + (flg & CHAR_FS_TRADE )? TRUE:FALSE); + /* + if (CHAR_getFlg(fd_charaindex, CHAR_ISTRADECARD) == TRUE) + CHAR_setFlg(fd_charaindex, CHAR_ISTRADE, FALSE); + if (CHAR_getFlg(fd_charaindex, CHAR_ISTRADE) == TRUE) + CHAR_setFlg(fd_charaindex, CHAR_ISTRADECARD, FALSE); + */ + + lssproto_FS_send( fd, flg); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_PR_recv( int fd,int x, int y, int request ) +{ + int result = FALSE; + int fd_charaindex; + CHECKFDANDTIME; + + fd_charaindex = CONNECT_getCharaindex( fd ); + +#if 1 // ֹ + if( request == 1 ) + { + int nowFloor; + nowFloor = CHAR_getInt( fd_charaindex, CHAR_FLOOR); + if( nowFloor == 31706 + || nowFloor == 10204 + || (10601 <= nowFloor && nowFloor <= 10605 ) + || nowFloor == 10919 || nowFloor == 10920 + || nowFloor == 20711 || nowFloor == 20712 + || nowFloor == 1008 || nowFloor == 1021 + || nowFloor == 3008 || nowFloor == 3021 + || ( nowFloor <= 8213 && nowFloor >= 8200 ) + || ( nowFloor >= 30017 && nowFloor <= 30021 ) +#ifdef _TIME_TICKET + || check_TimeTicketMap(nowFloor) +#endif + ){ + //print("\n ķ!ֹ!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); + return; + } + } +#endif + + {//ttom avoid warp at will + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + //print("\n--Error!!!!"); + //print("\norigion x=%d,y=%d",ix,iy); + //print("\nmodify X=%d,Y=%d",x,y); + x=ix; + y=iy; + } + } + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + + if( request == 0 ) { +#ifdef _PLAYER_NPC + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + int i; + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int pindex = CHAR_getWorkInt( fd_charaindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( pindex) ) { + if(CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC){ + CHAR_setWorkInt( fd_charaindex, i + CHAR_WORKPARTYINDEX1, -1); + CHAR_CharaDelete(pindex); + continue; + } + } + } + } +#endif + /* */ + result = CHAR_DischargeParty(fd_charaindex, 0); + } + else if( request == 1 ) { + result = CHAR_JoinParty(fd_charaindex); + } +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_KS_recv( int fd,int petarray ) +{ + int ret , fd_charaindex,petindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); +#ifdef _PET_BUG + petindex = CHAR_getCharPet( fd_charaindex, petarray); + if( CHAR_CHECKINDEX( petindex ) == TRUE ){ + if(CHAR_getInt(petindex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100){ + lssproto_KS_send( fd, petarray, FALSE); + return; + } + } +#endif + if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == petarray ) + lssproto_KS_send( fd, petarray, FALSE); + + + ret = PET_SelectBattleEntryPet( fd_charaindex, petarray); + lssproto_KS_send( fd, petarray, ret); +} + +#ifdef _STANDBYPET +void lssproto_SPET_recv( int fd, int standbypet ) +{ + int fd_charaindex; + int i, s_pet =0, cnt =0; + + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE + && standbypet >= CHAR_getWorkInt( fd_charaindex, CHAR_WORKSTANDBYPET) ) { + //print("\n ķ!??սSPETӴ!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); + return; + } + + //if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == petarray ) { + // lssproto_SPET_send( fd, petarray, FALSE); + //} + + for( i =0; i < CHAR_MAXPETHAVE; i++) { + if( standbypet & ( 1 << i ) ) { + + //if( CHAR_getInt( fd_charaindex, CHAR_RIDEPET) == i ) + // continue; + + cnt++; + if( cnt > 3 ) { + //print("\n ķ!賬!!:%s ", CHAR_getChar( fd_charaindex, CHAR_CDKEY) ); + //lssproto_SPET_send( fd, s_pet, FALSE); + break; + } + + s_pet |= ( 1 << i ); + } + } + CHAR_setWorkInt( fd_charaindex, CHAR_WORKSTANDBYPET, s_pet); + + lssproto_SPET_send( fd, s_pet, TRUE); +} +#endif + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_AC_recv( int fd,int x, int y,int actionno ) +{ + int fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + {//ttom avoid the warp at will + Char *ch; + ch = CHAR_getCharPointer( fd_charaindex); + // CoolFish: +1 2001/11/05 + if (!ch) return; + + if((ch->data[CHAR_X]!=x)||(ch->data[CHAR_Y]!=y)){ + return; + } + } + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + CHAR_sendAction( fd_charaindex, actionno, FALSE); + return; +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_MU_recv( int fd,int x,int y,int array,int toindex ) +{ + int to_charaindex = -1, fd_charaindex; + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + {//ttom avoid warp at will + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + //print("\n--Error!!!!"); + //print("\norigion x=%d,y=%d",ix,iy); + //print("\nmodify X=%d,Y=%d",x,y); + x=ix; + y=iy; + } + } + + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + to_charaindex = Callfromcli_Util_getTargetCharaindex( fd, toindex); + MAGIC_Use( fd_charaindex, array, to_charaindex); +} + +void lssproto_JB_recv( int fd,int x,int y ) +{ + int charaindex, floor; + + CHECKFDANDTIME; + charaindex = CONNECT_getCharaindex( fd ); + { + int ix,iy; + ix=CHAR_getInt(charaindex, CHAR_X); + iy=CHAR_getInt(charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + x=ix; + y=iy; + } + } + + CHAR_setMyPosition( charaindex, x,y,TRUE); + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + floor = CHAR_getInt( charaindex, CHAR_FLOOR ); + if( floor == 1007 + || floor == 2007 + || floor == 3007 + || floor == 4007 + || floor == 130 + || floor == 40001 + || floor == 40002 + || floor == 40003 + || floor == 40004 + || floor == 40005 + || floor == 40006 + || floor == 40007 + || floor == 40008 + || floor == 40009 + || floor == 40010 +#ifdef _AUTO_PK + || (floor == 20000 && CHAR_getInt( charaindex, CHAR_AUTOPK ) == -1) +#endif +#ifdef _WATCH_FLOOR + || floor == getWatchFloor(1) + || floor == getWatchFloor(2) + || floor == getWatchFloor(3) + || floor == getWatchFloor(4) + || floor == getWatchFloor(5) + || !strcmp(getWatchFloorCF(),"") +#endif + ){ + BATTLE_WatchTry( charaindex ); + }else{ + BATTLE_RescueTry( charaindex ); + } +} + +void lssproto_KN_recv( int fd,int havepetindex,char* data ) +{ + int fd_charaindex; + CHECKFD; + fd_charaindex = CONNECT_getCharaindex( fd ); + + // Robin 04/26 debug + if( strlen(data) > 16 ) return; + + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + if( checkStringErr(data) ) return; +#ifdef _CHANGE_PETNAME_FIX + if(strstr(data,"|")!=NULL){ + CHAR_talkToCli( fd_charaindex, -1, "벻ҪзǷַ", CHAR_COLORRED); + return; + } +#endif + + CHAR_inputUserPetName( fd_charaindex, havepetindex, data); + +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_WN_recv( int fd,int x,int y,int seqno, + int objindex,int select, char* data ) +{ +// printf("fd=%d\n",fd); +// printf("x=%d\n",x); +// printf("y=%d\n",y); +// printf("seqno=%d\n",seqno); +// printf("objindex=%d\n",objindex); +// printf("select=%d\n",select); +// printf("data=%s\n",data); +// if ( seqno == 285 && strlen(data) == 0 ) return; + + int fd_charaindex; + + CHECKFDANDTIME; + + if( checkStringErr(data) ) return; +#ifdef _NO_WARP + { + if(seqno!=CONNECT_get_seqno(fd)){ +// printf("get_seqno=%d\n",CONNECT_get_seqno(fd)); + return; + } + if( !( (select)&(CONNECT_get_selectbutton(fd)) ) && select ){ + if( CONNECT_get_seqno(fd)==CHAR_WINDOWTYPE_QUIZ_MAIN ){ + }else if( ( (CONNECT_get_seqno(fd)==CHAR_WINDOWTYPE_SCHEDULEMAN_START) + || (CONNECT_get_seqno(fd)==CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT) ) + && (select==1) ){ + }else{ + return ; + } + } + } // shan End +#endif + fd_charaindex = CONNECT_getCharaindex( fd ); + +#ifdef _AVOIDATTACK_IN_lssproto_WN_recv_dataToLong + if( strlen(data) > 2048 ) + return ; +#endif +// if(seqno == 285 && CHAR_getWorkInt(fd_charaindex,CHAR_WORKWNKEY) == 285 ) return; +// CHAR_setWorkInt(fd_charaindex,CHAR_WORKWNKEY,seqno); + // CoolFish: Prevent Trade Cheat 2001/4/18 + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) { + return; + } + // Robin + if( checkStringErr(data) ) return; + + +#ifdef _ANGEL_SUMMON + if( seqno == CHAR_WINDOWTYPE_ANGEL_ASK ) + { + print("\n CHAR_WINDOWTYPE_ANGEL_ASK objindex:%d select:%d data:%s ", + objindex, select, data ); + + if(select==WINDOW_BUTTONTYPE_YES ) { + if( AngelCreate( fd_charaindex) == FALSE ) { + sendAngelCleanToCli( fd ); + } + } + else if(select==WINDOW_BUTTONTYPE_NO ) { + int mindex; + char nameinfo[64]; + mindex = checkIfAngel( fd_charaindex); + print(" ====ٻ==== "); + getMissionNameInfo( fd_charaindex, nameinfo); + saacproto_ACMissionTable_send( acfd, mindex, 3, nameinfo, ""); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + "ź\nİħΣ½ˡ" ); + + //CHAR_talkToCli( fd_charaindex, -1, "֮ǿϧѵõĻѽ", CHAR_COLORYELLOW); + + sendAngelCleanToCli( fd ); + } + } +#endif + +#ifdef _SAFE_PASSWORD + if( seqno == CHAR_WINDOWTYPE_SAFE_PASSWORD1 ) + { + char *cdkey; + cdkey = CHAR_getChar(fd_charaindex, CHAR_CDKEY); + if(strlen(data)>5 && strlen(data)<13) + { + saacproto_QuerySafePasswd_recv(NULL,cdkey,sasql_query_safepasswd(cdkey,data),fd_charaindex); + } + else + { + CHAR_talkToCli( fd_charaindex, -1, "İȫС6λ12λ룡", CHAR_COLORRED); + } + } + if( seqno == CHAR_WINDOWTYPE_SAFE_PASSWORD2 ) + { + char *cdkey; + cdkey = CHAR_getChar(fd_charaindex, CHAR_CDKEY); + if (strlen(data)<6 || strlen(data)>12) + { + CHAR_talkToCli( fd_charaindex, -1, "İȫС6λ12λ룡", CHAR_COLORRED); + } + else + { + saacproto_AddSafePasswd_recv( NULL, cdkey, sasql_add_safepasswd(cdkey,data), fd_charaindex ); + } + } + if( seqno == CHAR_WINDOWTYPE_SAFE_PASSWORD3 ) + { + char *cdkey; + cdkey = CHAR_getChar(fd_charaindex, CHAR_CDKEY); + if(strlen(data)>5 && strlen(data)<13) + { + int res = sasql_query_safepasswd(cdkey,data); + if(res == 1) + { + CHAR_setWorkInt( fd_charaindex, CHAR_WORKSAFEMODE, 1); + CHAR_setInt( fd_charaindex, CHAR_LOCK, 1); + CHAR_talkToCli( fd_charaindex, -1, "İȫȷϵͳɹý", CHAR_COLORRED); + } + if(res == 2) + { + CHAR_talkToCli( fd_charaindex, -1, "İȫϵͳ޷", CHAR_COLORRED); + } + if(res == 3) + { + CHAR_talkToCli( fd_charaindex, -1, "ûðȫ룬뾡ã", CHAR_COLORRED); + CHAR_AddSafePassword(fd_charaindex); + } + } + else + { + CHAR_talkToCli( fd_charaindex, -1, "İȫС6λ12λ룡", CHAR_COLORRED); + } + } +#endif + +#ifdef _POINT_CARD + if( seqno == CHAR_WINDOWTYPE_POINT_CARD ) + { + char *cdkey; + cdkey = CHAR_getChar(fd_charaindex, CHAR_CDKEY); + CHAR_talkToCli( fd_charaindex, -1, "ڲѯóֵϢԺ", CHAR_COLORRED); + sasql_query_card(cdkey,data,fd_charaindex); + } +#endif +#ifdef _SQL_BUY_FUNC + if( seqno == CHAR_WINDOWTYPE_ONLINE_BUY ){ + char *ondata = sasql_OnlineBuy( CHAR_getChar(fd_charaindex, CHAR_CDKEY), data ); + //saacproto_OnlineBuy_send(getfdFromCharaIndex( charaindex), CHAR_getChar(charaindex, CHAR_CDKEY), data); + CHAR_talkToCli( fd_charaindex, -1, "żУԺ...", CHAR_COLORYELLOW); + saacproto_OnlineBuy_recv(getfdFromCharaIndex( fd_charaindex),ondata); + } +#endif + if( seqno == CHAR_WINDOWTYPE_RAND_WARP ) + { + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER || CHAR_getWorkInt( fd_charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT) + { + CHAR_talkToCli( fd_charaindex, -1, "˵ֻԵʹã", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int haveitemindex,pass,fltest,xtest,ytest; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + pass = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + fltest = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + xtest = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 5, buftest, sizeof(buftest)) == FALSE) + return; + ytest = atoi(buftest); + + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "֤룡", CHAR_COLORRED); + return; + } + if(pass!=atoi(data)) + { + CHAR_talkToCli( fd_charaindex, -1, "֤벻ȷ룡", CHAR_COLORRED); + return; + } + CHAR_warpToSpecificPoint(fd_charaindex, fltest, xtest, ytest); + CHAR_DelItem( fd_charaindex, haveitemindex); + } + + if( seqno == CHAR_WINDOWTYPE_RAND_MSG ) + { + char *arg; + char buftest[255]; + int haveitemindex,pass; + char *itemmsg; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + pass = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + itemmsg = buftest; + + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "֤룡", CHAR_COLORRED); + return; + } + if(pass!=atoi(data)) + { + CHAR_talkToCli( fd_charaindex, -1, "֤벻ȷ룡", CHAR_COLORRED); + return; + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_ITEM_MSG, + -1, + itemmsg); + } + if( seqno == CHAR_STREETVENDOR_SELECT ) + { + if(strlen(data)<1) return; + if(atoi(data)>6 || atoi(data)<1) return; + if(atoi(data)==4 && getJiFenBaiTan()==1){ + CHAR_talkToCli( fd_charaindex, -1, "·ְ̯", CHAR_COLORRED); + return; + } + CHAR_setWorkInt(fd_charaindex,CHAR_WORKTRADETYPE,(atoi(data)-1)); + lssproto_STREET_VENDOR_send(fd,"O|"); + } +#ifdef _QUESTION_ONLINE + if( seqno == CHAR_WINDOWTYPE_QUESTIONONLINE ) + { + if(strlen(data)<1) return; + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(questionstarttime == 0){ + CHAR_talkToCli( fd_charaindex, -1, "ߴѽδʼ", CHAR_COLORYELLOW); + return; + } + if(timep - questionstarttime > 30 || questionman>=3){ + CHAR_talkToCli( fd_charaindex, -1, "ʱѹ", CHAR_COLORYELLOW); + return; + } + if(strcmp(data,answer)==0) + { + if(questionman<3) + { + questionman++; + int itemindex,playnum,itemret; + itemindex = ITEM_makeItemAndRegist( getQuestionItem(questionman)); + itemret = CHAR_addItemSpecificItemIndex(fd_charaindex,itemindex); + if( itemret < 0 || itemret >= CHAR_MAXITEMHAVE ) + { + ITEM_endExistItemsOne( itemindex); + } + char questionbuf[256]; + sprintf(questionbuf,"ϲϲ%s%dԱ⣡",CHAR_getChar(fd_charaindex,CHAR_NAME),questionman); + int i,playmaxnum; + playmaxnum=CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playmaxnum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, questionbuf, CHAR_COLORRED); + } + } + } + } + } +#endif +#ifdef _PET_RESET + if( seqno == CHAR_WINDOWTYPE_RESETPET ) + { + if(select == WINDOW_BUTTONTYPE_YES){ + int petworkindex,petindex,i; + petworkindex = CHAR_getWorkInt(fd_charaindex,CHAR_WORKRESETPETINDEX); + int petpoint = sasql_resetpet_point(CHAR_getInt(petworkindex, CHAR_PETENEMYID)); + int mypoint = sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),0,0); + if(petpoint<0)return; + if(mypoint1000000){ + CHAR_talkToCli( fd_charaindex, -1, "֧ƱΪ100W㣬޷ǩ", CHAR_COLORYELLOW); + return; + } + char zhipiaomsg[256]; + int vippoint = atoi(data)*getZhiPiao()/100; + if(vippoint<10) vippoint = vippoint+1; + sprintf(zhipiaomsg,"\nǩ֧ƱҪȡٷ֮%d˰\n\n֧ƱǩҪ۳%dԱ\n\nȷҪô",getZhiPiao(),vippoint+atoi(data)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_ZHIPIAO_2, + -1, + zhipiaomsg); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKZHIPIAOPOINT,atoi(data)); + return; + }else + return; + } + if( seqno == CHAR_WINDOWTYPE_ZHIPIAO_2 ){ + if(select == WINDOW_BUTTONTYPE_OK){ + int mypoint = sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),0,0); + int itempoint = CHAR_getWorkInt(fd_charaindex,CHAR_WORKZHIPIAOPOINT); + int kvippoint = itempoint/100*getZhiPiao(); + if(kvippoint<10) kvippoint = kvippoint+1; + int vippoint = itempoint+kvippoint; + if(mypoint0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + int zhipiaotime = timep + 60*60*24*getPiaoTime(); + timep = zhipiaotime; + p=localtime(&timep); + sprintf(zhipiaomsg,"%d",zhipiaotime); + ITEM_setChar(itemindex,ITEM_ARGUMENT,zhipiaomsg); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + sprintf(zhipiaomsg,"Ч:%d.%s.%s/%s:%s:%s ֧Ʊֵ%d",year,monbuf,datebuf,hourbuf,minbuf,secbuf,itempoint); + }else{ + ITEM_setChar(itemindex,ITEM_ARGUMENT,"1"); + sprintf(zhipiaomsg,"֧Ʊֵ%d",itempoint); + } + ITEM_setChar(itemindex,ITEM_EFFECTSTRING,zhipiaomsg); + CHAR_sendItemDataOne( fd_charaindex, CHAR_getWorkInt(fd_charaindex,CHAR_WORKZHIPIAOITEM)); + CHAR_talkToCli( fd_charaindex, -1, "֧Ʊɹ", CHAR_COLORRED); + CHAR_charSaveFromConnect(fd_charaindex, FALSE); + CHAR_talkToCli(fd_charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return; + }else{ + return; + } + } + }else{ + return; + } + } + if( seqno == CHAR_WINDOWTYPE_ZHIPIAO_3 ){ + if(select == WINDOW_BUTTONTYPE_OK){ + int itemindex = CHAR_getItemIndex(fd_charaindex,CHAR_getWorkInt(fd_charaindex,CHAR_WORKZHIPIAOITEM)); + char* petno = ITEM_getChar(itemindex,ITEM_UNIQUECODE); + int vippoint = sasql_zhipiao_query(ITEM_getChar(itemindex,ITEM_UNIQUECODE)); + if(vippoint>0){ + if(sasql_zhipiao_update(CHAR_getChar(fd_charaindex,CHAR_CDKEY),petno,0)==1){ + sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),vippoint,1); + char msgbuf[128]; + snprintf( msgbuf,sizeof( msgbuf), "֧Ʊ֧ȡɹ%dԱ㡣", + vippoint); + CHAR_talkToCli( fd_charaindex, -1, msgbuf, CHAR_COLORRED); + CHAR_DelItem(fd_charaindex,CHAR_getWorkInt(fd_charaindex,CHAR_WORKZHIPIAOITEM)); + CHAR_charSaveFromConnect(fd_charaindex, FALSE); + CHAR_talkToCli(fd_charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return; + }else{ + return; + } + }else{ + return; + } + }else{ + return; + } + } +#endif +#ifdef _NO_DROPITEM + if( seqno == CHAR_WINDOWTYPE_DROPITEM){ + if(select == WINDOW_BUTTONTYPE_OK){ + int itemcharaindex = CHAR_getWorkInt(fd_charaindex,CHAR_DROPITEMCHARAINDEX); + if(itemcharaindex>-1){ + CHAR_DropItem(fd_charaindex,itemcharaindex); + return; + }else{ + return; + } + }else{ + return; + } + } +#endif +#ifdef _ITEM_RESET + if( seqno == CHAR_WINDOWTYPE_RESETITEM){ + if(select == WINDOW_BUTTONTYPE_OK){ + int fromindex = CHAR_getWorkInt(fd_charaindex,CHAR_WORKFROMITEMINDEX); + int toindex = CHAR_getWorkInt(fd_charaindex,CHAR_WORKTOITEMINDEX); + int resetpoint,mypoint; + int itemid = ITEM_getInt(CHAR_getItemIndex( fd_charaindex, toindex),ITEM_ID); + resetpoint = sasql_itemreset_query(itemid); + if(resetpoint<0) return; + mypoint = sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),0,0); + if(mypoint-1){ + CHAR_DelItem(fd_charaindex,fromindex); + CHAR_DelItem(fd_charaindex,toindex); + int newitemindex,ret; + newitemindex = ITEM_makeItemAndRegist( itemid); + ret = CHAR_addItemSpecificItemIndex( fd_charaindex, newitemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( newitemindex); + return; + } + CHAR_sendItemDataOne( fd_charaindex, ret); + CHAR_charSaveFromConnect(fd_charaindex, FALSE); + CHAR_talkToCli(fd_charaindex, -1, "ϲ¯߳ɹϵͳԶΪ浵", CHAR_COLORRED); + return; + }else{ + return; + } + } + }else{ + return; + } + } + if( seqno == CHAR_WINDOWTYPE_DELITEM){ + if(select == WINDOW_BUTTONTYPE_OK){ + int fromindex = CHAR_getWorkInt(fd_charaindex,CHAR_WORKFROMITEMINDEX); + int toindex = CHAR_getWorkInt(fd_charaindex,CHAR_WORKTOITEMINDEX); + int delpoint,mypoint; + int itemid = ITEM_getInt(CHAR_getItemIndex( fd_charaindex, toindex),ITEM_ID); + delpoint = sasql_itemdel_query(itemid); + if(delpoint<0) return; + mypoint = sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),0,0); + { + if(sasql_vippoint(CHAR_getChar(fd_charaindex,CHAR_CDKEY),delpoint,1)>-1){ + CHAR_DelItem(fd_charaindex,fromindex); + CHAR_DelItem(fd_charaindex,toindex); + CHAR_charSaveFromConnect(fd_charaindex, FALSE); + CHAR_talkToCli(fd_charaindex, -1, "ϲյ߳ɹϵͳԶΪ浵", CHAR_COLORRED); + return; + }else{ + return; + } + } + }else{ + return; + } + } +#endif +#ifdef _ALL_RANDMODE + if( seqno == CHAR_WINDOWTYPE_RAND1_EDITBASE ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int haveitemindex,itemindex,ret,toindex; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDEDITBASE); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + toindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "ļȷ룡", CHAR_COLORRED); + return; + } + if(itemindex!=CHAR_getItemIndex( fd_charaindex, haveitemindex)){ + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int i; + int work[4]; + int num=-1,type; + int LevelUpPoint,petrank; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + if( !CHAR_CHECKINDEX( fd_charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; +//#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_getInt( toindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( toindex, CHAR_PETID) == 401 +#endif + ){ + + int maxnums=50; + + if( CHAR_getInt( toindex,CHAR_LV ) < 74 ) { + sprintf(buf1,"ҵ𣿺ร˱仯"); + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + num = ITEM_MODIFYATTACK; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( toindex, CHAR_PETRANK ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + for( i=0; i<4; i++) { + type = ITEM_getInt( itemindex, (num + i)); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + else + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + } + } + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( toindex, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_setInt( toindex, CHAR_PETRANK, petrank); + LogPetPointChange( + CHAR_getChar( fd_charaindex, CHAR_NAME ), + CHAR_getChar( fd_charaindex, CHAR_CDKEY ), + CHAR_getChar( fd_charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( fd_charaindex, CHAR_FLOOR), + CHAR_getInt( fd_charaindex, CHAR_X ), + CHAR_getInt( fd_charaindex, CHAR_Y ) + ); + } + + }else { + sprintf(buf1,""); + } + CHAR_DelItem( fd_charaindex, haveitemindex); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND2_EDITBASE ) + { + if(strlen(data)<1) + { + return; + } + if(atoi(data)<1 || atoi(data)>5) return; + char *arg; + char buftest[255]; + int haveitemindex,itemindex,ret,toindex; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDEDITBASE); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + toindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "źѡļԺԡ", CHAR_COLORRED); + return; + } + if(itemindex!=CHAR_getItemIndex( fd_charaindex, haveitemindex)){ + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲѡļȷ", CHAR_COLORRED); + int i; + int work[4]; + int num=-1,type; + int LevelUpPoint,petrank; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + if( !CHAR_CHECKINDEX( fd_charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; +//#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_getInt( toindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( toindex, CHAR_PETID) == 401 +#endif + ){ + + int maxnums=50; + + if( CHAR_getInt( toindex,CHAR_LV ) < 74 ) { + sprintf(buf1,"ҵ𣿺ร˱仯"); + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + num = ITEM_MODIFYATTACK; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( toindex, CHAR_PETRANK ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + for( i=0; i<4; i++) { + type = ITEM_getInt( itemindex, (num + i)); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + else + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + } + } + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( toindex, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_setInt( toindex, CHAR_PETRANK, petrank); + LogPetPointChange( + CHAR_getChar( fd_charaindex, CHAR_NAME ), + CHAR_getChar( fd_charaindex, CHAR_CDKEY ), + CHAR_getChar( fd_charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( fd_charaindex, CHAR_FLOOR), + CHAR_getInt( fd_charaindex, CHAR_X ), + CHAR_getInt( fd_charaindex, CHAR_Y ) + ); + } + + }else { + sprintf(buf1,""); + } + CHAR_DelItem( fd_charaindex, haveitemindex); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND3_EDITBASE ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int haveitemindex,itemindex,toindex; + char ret[255]; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDEDITBASE); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + toindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + strcpy(ret,buftest); + if(strcmp(ret,data)!=0){ + CHAR_talkToCli( fd_charaindex, -1, "Ľȷ룡", CHAR_COLORRED); + return; + } + if(itemindex!=CHAR_getItemIndex( fd_charaindex, haveitemindex)){ + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int i; + int work[4]; + int num=-1,type; + int LevelUpPoint,petrank; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + if( !CHAR_CHECKINDEX( fd_charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; +//#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_getInt( toindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( toindex, CHAR_PETID) == 401 +#endif + ){ + + int maxnums=50; + + if( CHAR_getInt( toindex,CHAR_LV ) < 74 ) { + sprintf(buf1,"ҵ𣿺ร˱仯"); + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + num = ITEM_MODIFYATTACK; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( toindex, CHAR_PETRANK ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + for( i=0; i<4; i++) { + type = ITEM_getInt( itemindex, (num + i)); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + else + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + } + } + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( toindex, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_setInt( toindex, CHAR_PETRANK, petrank); + LogPetPointChange( + CHAR_getChar( fd_charaindex, CHAR_NAME ), + CHAR_getChar( fd_charaindex, CHAR_CDKEY ), + CHAR_getChar( fd_charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( fd_charaindex, CHAR_FLOOR), + CHAR_getInt( fd_charaindex, CHAR_X ), + CHAR_getInt( fd_charaindex, CHAR_Y ) + ); + } + + }else { + sprintf(buf1,""); + } + CHAR_DelItem( fd_charaindex, haveitemindex); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND4_EDITBASE ) + { + if(strlen(data)<1) + { + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0) return; + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int haveitemindex,itemindex,ret,toindex; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDEDITBASE); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + toindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + haveitemindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + //sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),14); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + if(itemindex!=CHAR_getItemIndex( fd_charaindex, haveitemindex)){ + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + int i; + int work[4]; + int num=-1,type; + int LevelUpPoint,petrank; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + if( !CHAR_CHECKINDEX( fd_charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; +//#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_getInt( toindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( toindex, CHAR_PETID) == 401 +#endif + ){ + + int maxnums=50; + + if( CHAR_getInt( toindex,CHAR_LV ) < 74 ) { + sprintf(buf1,"ҵ𣿺ร˱仯"); + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + num = ITEM_MODIFYATTACK; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( toindex, CHAR_PETRANK ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + for( i=0; i<4; i++) { + type = ITEM_getInt( itemindex, (num + i)); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + else + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( fd_charaindex, toindex, buf1, CHAR_COLORWHITE); + } + } + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( toindex, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_setInt( toindex, CHAR_PETRANK, petrank); + LogPetPointChange( + CHAR_getChar( fd_charaindex, CHAR_NAME ), + CHAR_getChar( fd_charaindex, CHAR_CDKEY ), + CHAR_getChar( fd_charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( fd_charaindex, CHAR_FLOOR), + CHAR_getInt( fd_charaindex, CHAR_X ), + CHAR_getInt( fd_charaindex, CHAR_Y ) + ); + } + + }else { + sprintf(buf1,""); + } + CHAR_DelItem( fd_charaindex, haveitemindex); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } +#endif +#ifdef _MM_NO_JIAOBEN + if( seqno == CHAR_WINDOWTYPE_RAND1_DROPMM ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "ļȷ룡", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + PET_dropPetFLXY(fd_charaindex, havepetindex, -1,-1,-1); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND2_DROPMM ) + { + if(strlen(data)<1) + { + return; + } + if(atoi(data)<1 || atoi(data)>5) return; + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "źѡļԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲѡļȷ", CHAR_COLORRED); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + PET_dropPetFLXY(fd_charaindex, havepetindex, -1,-1,-1); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND3_DROPMM ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int havepetindex; + char ret[255]; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + strcpy(ret,buftest); + if(strcmp(ret,data)!=0){ + CHAR_talkToCli( fd_charaindex, -1, "Ľȷ룡", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + PET_dropPetFLXY(fd_charaindex, havepetindex, -1,-1,-1); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND4_DROPMM ) + { + if(strlen(data)<1) + { + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0) return; + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + //sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),14); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + PET_dropPetFLXY(fd_charaindex, havepetindex, -1,-1,-1); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND1_FLLOWMM ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "ļȷ룡", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + if( !PET_dropPetFollow( fd_charaindex, havepetindex, -1, -1, -1 ) ) { + CHAR_talkToCli( fd_charaindex, -1, "ʧܣ", CHAR_COLORWHITE ); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND2_FLLOWMM ) + { + if(strlen(data)<1) + { + return; + } + if(atoi(data)<1 || atoi(data)>5) return; + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "źѡļԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲѡļȷ", CHAR_COLORRED); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + if( !PET_dropPetFollow( fd_charaindex, havepetindex, -1, -1, -1 ) ) { + CHAR_talkToCli( fd_charaindex, -1, "ʧܣ", CHAR_COLORWHITE ); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND3_FLLOWMM ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int havepetindex; + char ret[255]; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + strcpy(ret,buftest); + if(strcmp(ret,data)!=0){ + CHAR_talkToCli( fd_charaindex, -1, "Ľȷ룡", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + if( !PET_dropPetFollow( fd_charaindex, havepetindex, -1, -1, -1 ) ) { + CHAR_talkToCli( fd_charaindex, -1, "ʧܣ", CHAR_COLORWHITE ); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_RAND4_FLLOWMM ) + { + if(strlen(data)<1) + { + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0) return; + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int havepetindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKDROPMM); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + havepetindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + //sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),14); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + int petindex; + petindex = CHAR_getCharPet(fd_charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return; + if(CHAR_getInt(petindex,CHAR_PETID)!=718 && CHAR_getInt(petindex,CHAR_PETID)!=401) return; + if( !PET_dropPetFollow( fd_charaindex, havepetindex, -1, -1, -1 ) ) { + CHAR_talkToCli( fd_charaindex, -1, "ʧܣ", CHAR_COLORWHITE ); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } +#endif +#ifdef _DP_ZHIPIAO_ITEM + if( seqno == CHAR_WINDOWTYPE_DPZHIPIAO_1 ) + { + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + if(atoi(data)!=CHAR_getWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAORAND)){ + CHAR_talkToCli( fd_charaindex, -1, "ļȷ룡", CHAR_COLORRED); + return; + } + char buf[255]; + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DPZHIPIAO_2, + -1, + makeEscapeString( "ҪһDP\n", buf, sizeof(buf))); + } + if( seqno == CHAR_WINDOWTYPE_DPZHIPIAO_2 ){ + if(select == WINDOW_BUTTONTYPE_OK){ + if(strlen(data)<1) return; + if(atoi(data)<100){ + CHAR_talkToCli( fd_charaindex, -1, "С֧ƱΪ100DP޷ǩ", CHAR_COLORYELLOW); + return; + } + if(atoi(data)>10000000){ + CHAR_talkToCli( fd_charaindex, -1, "֧ƱΪ1000WDP޷ǩ", CHAR_COLORYELLOW); + return; + } + char zhipiaomsg[256]; + int dppoint = atoi(data)*CHAR_getWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAOSHUI)/100; + if(dppoint<10) dppoint = dppoint+1; + sprintf(zhipiaomsg,"\nǩ֧ƱҪȡٷ֮%d˰\n\n֧ƱǩҪ۳%dDP\n\nȷҪô",CHAR_getWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAOSHUI),dppoint+atoi(data)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DPZHIPIAO_3, + -1, + zhipiaomsg); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAOPOINT,atoi(data)); + return; + }else + return; + } + if( seqno == CHAR_WINDOWTYPE_DPZHIPIAO_3 ){ + if(select == WINDOW_BUTTONTYPE_OK){ + int mypoint = CHAR_getInt(fd_charaindex,CHAR_DUELPOINT); + int itempoint = CHAR_getWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAOPOINT); + int kdppoint = itempoint/100*CHAR_getWorkInt(fd_charaindex,CHAR_WORKDPZHIPIAOSHUI); + if(kdppoint<10) kdppoint =kdppoint+1; + int dppoint = itempoint+kdppoint; + if(mypoint5) return; + char *arg; + char buftest[255]; + int npcindex,ret; + char *szmsg; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + ret = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + npcindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + szmsg = buftest; + if(atoi(data)!=ret){ + CHAR_talkToCli( fd_charaindex, -1, "źѡļԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲѡļȷ", CHAR_COLORRED); + NPC_TypeCheck( npcindex, fd_charaindex, szmsg); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + if( seqno == CHAR_WINDOWTYPE_NPC_RAND3_MSG ){ + if(select == WINDOW_BUTTONTYPE_OK){ + if(strlen(data)<1) + { + CHAR_talkToCli( fd_charaindex, -1, "", CHAR_COLORRED); + return; + } + char *arg; + char buftest[255]; + int npcindex; + char ret[255]; + char *szmsg; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + strcpy(ret,buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + npcindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + szmsg = buftest; + if(strcmp(ret,data)!=0){ + CHAR_talkToCli( fd_charaindex, -1, "Ľȷ룡", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + NPC_TypeCheck( npcindex, fd_charaindex, szmsg); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + }else + return; + } + if( seqno == CHAR_WINDOWTYPE_NPC_RAND4_MSG ){ + if(strlen(data)<1) + { + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int npcindex,ret; + char *szmsg; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + ret = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + npcindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + szmsg = buftest; + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + //sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),14); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + NPC_TypeCheck( npcindex, fd_charaindex, szmsg); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + + if( seqno == CHAR_WINDOWTYPE_NPCENEMY_RAND_MSG ){ + if(strlen(data)<1) + { + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int npcindex,ret; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + ret = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + npcindex = atoi(buftest); + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,0); + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + NPC_NPCEnemy_Encount( npcindex, fd_charaindex, 1); + //CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDTYPE,0); + return; + } + + if( seqno == CHAR_WINDOWTYPE_LUANPC_RANDMSG ){ + if(strlen(data)<1) + { + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + //if(atoi(data)getRandMax()) return; + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKLUANPCINT)!=0){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + CHAR_setWorkInt(fd_charaindex,CHAR_WORKLUANPCINT,1); + int cdkeynum; + for(cdkeynum=9;cdkeynum>0;cdkeynum--){ + strcpy(mmcdkey[cdkeynum],mmcdkey[cdkeynum-1]); + strcpy(mmcdkeybuf[cdkeynum],mmcdkeybuf[cdkeynum-1]); + } + strcpy(mmcdkey[0],CHAR_getChar(fd_charaindex,CHAR_CDKEY)); + sprintf(mmcdkeybuf[0],"%d.%d.%d",CHAR_getInt(fd_charaindex,CHAR_FLOOR),CHAR_getInt(fd_charaindex,CHAR_X),CHAR_getInt(fd_charaindex,CHAR_Y)); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + CHAR_setWorkInt(fd_charaindex,CHAR_WORKRANDEDITBASETIME,timep); + char *arg; + char buftest[255]; + int npcindex,talkindex,ret,flag; + arg = CHAR_getWorkChar(fd_charaindex,CHAR_WORKRANDMSG); + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + ret = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + npcindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + talkindex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + return; + } + flag = atoi(buftest); + if(atoi(data)!=ret){ + if(ret>=1 && ret<=5){ + if(atoi(data)>=10000){ + sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),15); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + }else{ + if(atoi(data)>=1 && atoi(data)<=5){ + //sasql_cdkey_lock(CHAR_getChar(fd_charaindex,CHAR_CDKEY),14); + CONNECT_setCloseRequest( fd , 1 ); + return; + } + } + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,""); + CHAR_talkToCli( fd_charaindex, -1, "źĽԺԡ", CHAR_COLORRED); + return; + } + sprintf(buftest,"%d|%d|%d|%d",ret,npcindex,talkindex,1); + CHAR_setWorkChar(fd_charaindex,CHAR_WORKRANDMSG,buftest); + CHAR_setChar(fd_charaindex,CHAR_RANDTYPE,""); + CHAR_talkToCli( fd_charaindex, -1, "ϲĽȷ", CHAR_COLORRED); + NPC_Lua_TalkedCallBack(npcindex,fd_charaindex,"hi",0,-1); + return; + } +#endif + {//ttom avoid the warp at will + Char *ch; + ch = CHAR_getCharPointer( fd_charaindex); + // CoolFish: +1 2001/11/05 + if (!ch) return; + if((ch->data[CHAR_X]!=x)||(ch->data[CHAR_Y]!=y)){ + // Robin 04/20 test + return; + x=ch->data[CHAR_X]; + y=ch->data[CHAR_Y]; + } + //ttom avoid WN at will + if(seqno==CHAR_WINDOWTYPE_NPCENEMY_START){ + //print("12121212\n"); +// Char *ch; + OBJECT object; + int ix,iy,ifloor,i,j; + int whichtype= -1; + int enemy=0; + int enemy_index; + if(!CHECKOBJECT(objindex)){ + goto FIRST; + } + enemy_index=OBJECT_getIndex(objindex);//ttom 11/15/2000 + ix =ch->data[CHAR_X]; + iy =ch->data[CHAR_Y]; + ifloor=ch->data[CHAR_FLOOR]; + for(i=iy-1;i<=iy+1;i++){ + for(j=ix-1;j<=ix+1;j++){ + for( object = MAP_getTopObj(ifloor,j,i) ; object ; + object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + whichtype = CHAR_getInt( OBJECT_getIndex( objindex), CHAR_WHICHTYPE); + if( whichtype == CHAR_TYPENPCENEMY){ + int i_ene_temp; + i_ene_temp=OBJECT_getIndex( objindex); + //print("\n--enetemp=%d",i_ene_temp); + if(i_ene_temp== enemy_index){ + goto START_WN; + }else{ + enemy=0; + } + } + break; + case OBJTYPE_ITEM: + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + } + } + } + if(enemy==0){ +FIRST: + + lssproto_EN_send( fd, FALSE, 0 ); + CHAR_talkToCli(fd_charaindex, -1, "¼", CHAR_COLORYELLOW); + goto END_WN; + } + } + } + //ttom end +START_WN: + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(seqno==CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN){ + if(!CONNECT_get_first_warp(fd)){ + select=1; + } + } + CHAR_processWindow( fd_charaindex, seqno, + select, objindex, makeStringFromEscaped(data)); + +//#ifdef _NO_WARP +// if (CONNECT_get_seqno(fd)==CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN) +// { +// CONNECT_set_seqno(fd,-1); +// CONNECT_set_selectbutton(fd,1); +// } +//#endif + } +//ttom+1 +END_WN: + return; + //CONNECT_set_pass(fd,TRUE);//ttom +} + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_HL_recv( int fd,int flg ) +{ + char msgbuf[128]; + int i, fd_charaindex; + CHECKFD; + + fd_charaindex = CONNECT_getCharaindex( fd ); + if( CHAR_getWorkInt( fd_charaindex, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE) + { + return; + } +#ifdef _LOCKHELP_OK // (ɿ) Syu ADD ɼս + if((CHAR_getInt(fd_charaindex,CHAR_FLOOR) >= 8200 && CHAR_getInt(fd_charaindex,CHAR_FLOOR) <= 8213) || + (CHAR_getInt(fd_charaindex,CHAR_FLOOR) >= 30017 && CHAR_getInt(fd_charaindex,CHAR_FLOOR) <= 30021) + || CHAR_getInt(fd_charaindex,CHAR_FLOOR) == 20000 + ){ + return ; + } +#endif +#ifdef _NPCENEMY_1 + if(CHAR_getWorkInt(fd_charaindex,CHAR_WORKBATTLEHELP)==1) return; +#endif + if( flg == TRUE ) { + BattleArray[CHAR_getWorkInt( fd_charaindex, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( fd_charaindex, + CHAR_WORKBATTLESIDE)].flg |= BSIDE_FLG_HELP_OK; + + snprintf( msgbuf, sizeof( msgbuf), + "%s ȣ", + CHAR_getChar( fd_charaindex, CHAR_NAME)); + } + else { + BattleArray[CHAR_getWorkInt( fd_charaindex, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( fd_charaindex, + CHAR_WORKBATTLESIDE)].flg &= ~BSIDE_FLG_HELP_OK; + + snprintf( msgbuf, sizeof( msgbuf), + "%s ܾ", + CHAR_getChar( fd_charaindex, CHAR_NAME)); + } + + for( i = 0; i < 5; i ++ ) { + int toindex = BattleArray[CHAR_getWorkInt( + fd_charaindex, CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( fd_charaindex, + CHAR_WORKBATTLESIDE)].Entry[i].charaindex; + if( CHAR_CHECKINDEX( toindex)) { + int tofd = getfdFromCharaIndex( toindex ); + if( tofd != -1 ) { + lssproto_HL_send( tofd, flg); + } + /* ˪ */ + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_sendBattleEffect( toindex, ON); + } + } +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_ProcGet_recv( int fd ) +{ + outputNetProcLog( fd, 1); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_PlayerNumGet_recv( int fd ) +{ + int i; + int clicnt =0; + int playercnt = 0; + for( i = 0; i < ConnectLen; i ++ ) { + if( CONNECT_getUse_debug(i,1017) ){ + if( CONNECT_getCtype(i) == CLI) { + clicnt ++; + if( CONNECT_getCharaindex(i) >= 0 ) playercnt++; + } + } + } + lssproto_PlayerNumGet_send( fd, clicnt, playercnt); +} + + +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_LB_recv( int fd,int x,int y ) +{ + int fd_charaindex; + + CHECKFDANDTIME; + fd_charaindex = CONNECT_getCharaindex( fd ); + {//ttom avoid warp at will + int ix,iy; + ix=CHAR_getInt(fd_charaindex, CHAR_X); + iy=CHAR_getInt(fd_charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + //print("\n--Error!!!!"); + //print("\norigion x=%d,y=%d",ix,iy); + //print("\nmodify X=%d,Y=%d",x,y); + x=ix; + y=iy; + } + } + CHAR_setMyPosition( fd_charaindex, x,y,TRUE); + /* ɱƥ¾ƻɱ */ + BATTLE_WatchTry( fd_charaindex ); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_Shutdown_recv( int fd,char* passwd,int min ) +{ + char buff[32]; + if( strcmp( passwd, "hogehoge") == 0 ) { + int i; + int playernum = CHAR_getPlayerMaxNum(); + snprintf( buff, sizeof( buff),"%s档",getGameserverID()); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, buff, CHAR_COLORYELLOW); + } + } + SERVSTATE_setLimittime(min); + SERVSTATE_setShutdown( NowTime.tv_sec ); + SERVSTATE_setDsptime( 0 ); + } +} +void lssproto_PMSG_recv( int fd,int index,int petindex,int itemindex, + char* message,int color ) +{ + + // CoolFish: Prevent Trade Cheat 2001/4/18 + int fd_charaindex; + fd_charaindex = CONNECT_getCharaindex(fd); + if (CHAR_getWorkInt(fd_charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) + return; + if( CHAR_getWorkInt(fd_charaindex,CHAR_WORKSTREETVENDOR)!=-1) return; + PETMAIL_sendPetMail( CONNECT_getCharaindex( fd ), + index, petindex, itemindex, message, color); + +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_PS_recv( int fd, int havepetindex, int havepetskill, int toindex, char* data ) +{ + int to_charaindex = Callfromcli_Util_getTargetCharaindex( fd, toindex); + int charaindex = CONNECT_getCharaindex( fd ); + int petindex; + BOOL ret; + petindex = CHAR_getCharPet( charaindex, havepetindex); + if( !CHAR_CHECKINDEX( petindex)) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE && strlen(data)>0) return; + ret = PETSKILL_Use( petindex, havepetskill, to_charaindex, data ); + lssproto_PS_send( fd, ret, havepetindex, havepetskill, toindex); +} +/*------------------------------------------------------------ + ------------------------------------------------------------*/ +void lssproto_SP_recv( int fd,int x,int y, int dir ) +{ + int fd_charaindex; + + fd_charaindex = CONNECT_getCharaindex( fd ); + {//ttom avoid the warp at will + int i_x,i_y; + i_x=CHAR_getInt(fd_charaindex, CHAR_X); + i_y=CHAR_getInt(fd_charaindex, CHAR_Y); + + if((i_x!=x)||(i_y!=y)){ + x=i_x; + y=i_y; + } + }//ttom + + CHAR_setMyPosition_main( fd_charaindex, x,y,dir,TRUE); + +} + +/*------------------------------------------------------------ + * CoolFish: Trade Command 2001/4/18 + ------------------------------------------------------------*/ +void lssproto_TD_recv( int fd, char* message ) +{ + int fd_charaindex; + CHECKFDANDTIME; + + fd_charaindex = CONNECT_getCharaindex( fd ); +// print(" MAP_TRADEPICKUP_check0 "); + + CHAR_Trade(fd, fd_charaindex, message); +} + +/*------------------------------------------------------------ + * CoolFish: Family Command 2001/5/24 + ------------------------------------------------------------*/ +void lssproto_FM_recv( int fd, char* message ) +{ + int fd_charaindex; + struct timeval recvtime; + CHECKFDANDTIME; + + // add code by shan + CONNECT_getLastrecvtime( fd, &recvtime); + if( time_diff( NowTime, recvtime) < 0.5 ){ + return; + } + CONNECT_setLastrecvtime(fd, &NowTime); + + fd_charaindex = CONNECT_getCharaindex( fd ); + + if( checkStringErr( message ) ) return; + + CHAR_Family(fd, fd_charaindex, message); + +} + +// shan 2002/01/10 +void lssproto_PETST_recv( int fd, int nPet, int sPet ) +{ + if(nPet<0 || nPet>4) return; + int charaindex; + int i, nums=0; + CHECKFDANDTIME; + + charaindex = CONNECT_getCharaindex( fd ); + if (!CHAR_CHECKINDEX( charaindex ) ) return; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return ; + + for( i=0; i<5; i++) { + if( CHAR_getWorkInt( charaindex, CHAR_WORK_PET0_STAT+i) == TRUE ) + nums++; + } + if( nums <= 3 ) + CHAR_setWorkInt( charaindex, CHAR_WORK_PET0_STAT+nPet, sPet); +// if( nums ==3 && CHAR_getWorkInt(charaindex,CHAR_WORK_PET0_STAT+nPet)==0){ +// CHAR_setWorkInt( charaindex, CHAR_WORK_PET0_STAT+nPet, 1); +// lssproto_SPET_recv(fd,nPet+1); +// } +} + +#ifdef _MIND_ICON +void lssproto_MA_recv(int fd, int x, int y, int nMind) +{ + int charaindex; + CHECKFDANDTIME; + + charaindex = CONNECT_getCharaindex( fd); + if(!CHAR_CHECKINDEX( charaindex)) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + + { + int i_x, i_y; + i_x = CHAR_getInt( charaindex, CHAR_X); + i_y = CHAR_getInt( charaindex, CHAR_Y); + + if((i_x!=x)||(i_y!=y)){ + x = i_x; + y = i_y; + } + } + + //print("\nshan------------------>mind action->%d x->%d y->%d", nMind, x, y); + CHAR_setMyPosition( charaindex, x, y, TRUE); + CHAR_setWorkInt( charaindex, CHAR_MIND_NUM, nMind); + CHAR_sendMindEffect( charaindex, CHAR_getWorkInt( charaindex, CHAR_MIND_NUM)); + if(CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101290 && + CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101294 && + CHAR_getWorkInt( charaindex, CHAR_MIND_NUM) != 101288 ) + CHAR_setWorkInt( charaindex, CHAR_MIND_NUM, 0); + //print("\nshan------------------>end"); + + return; +} +#endif +BOOL checkStringErr( char *checkstring ) +{ + int i,ach; + for (i=0,ach=0;i=0x40)&&((unsigned char)checkstring[i]<=0x7e))|| + (((unsigned char)checkstring[i]>=0xa1)&&((unsigned char)checkstring[i]<=0xfe))) ach=0; + } else { + if (((unsigned char)checkstring[i]>=0xa1)&&((unsigned char)checkstring[i]<=0xfe)) ach=1; + } + } + if (ach) + { + print(" StringDog! "); + return TRUE; + } + + return FALSE; + +} + +#ifdef _TEAM_KICKPARTY +void lssproto_KTEAM_recv( int fd, int si) +{ + int charaindex=-1, pindex; + if( si < 0 || si > 5 ) return; + charaindex = CONNECT_getCharaindex( fd ); + if( !CHAR_CHECKINDEX( charaindex) ) return; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_LEADER ) return; + + pindex = CHAR_getWorkInt( charaindex, si + CHAR_WORKPARTYINDEX1); + if( !CHAR_CHECKINDEX( pindex) ) return; + if( CHAR_getWorkInt( pindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) return; + + if( CHAR_DischargeParty( pindex, 0) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "߳ʧܣ", CHAR_COLORYELLOW); + }else{ + char buf1[256]; + sprintf( buf1, "ӳ[%s]߳", CHAR_getUseName( charaindex )); + CHAR_talkToCli( pindex, -1, buf1, CHAR_COLORYELLOW); + sprintf( buf1, "[%s]߳Ŷӣ", CHAR_getUseName( pindex )); + CHAR_talkToCli( charaindex, -1, buf1, CHAR_COLORYELLOW); + } +} +#endif + +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +void lssproto_CHATROOM_recv (int fd , char *data) +{ + ChatRoom_recvall ( fd , data ) ; +} +#endif + +#ifdef _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ +void lssproto_RESIST_recv (int fd ) +{ + int charindex = -1 ; + + char token[256]; + charindex = CONNECT_getCharaindex( fd ); + if( !CHAR_CHECKINDEX( charindex) ) return; + sprintf ( token , "%d|%d|%d|%d|%d|%d|%d|%d" , + CHAR_getInt( charindex, CHAR_EARTH_RESIST ) , + CHAR_getInt( charindex, CHAR_WATER_RESIST ) , + CHAR_getInt( charindex, CHAR_FIRE_RESIST ) , + CHAR_getInt( charindex, CHAR_WIND_RESIST ) , + CHAR_getInt( charindex, CHAR_EARTH_EXP ) , + CHAR_getInt( charindex, CHAR_WATER_EXP ) , + CHAR_getInt( charindex, CHAR_FIRE_EXP ) , + CHAR_getInt( charindex, CHAR_WIND_EXP ) + ); + lssproto_RESIST_send ( fd , token ) ; +} +#endif + +#ifdef _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol +void lssproto_BATTLESKILL_recv (int fd, int iNum) +{ + int charaindex = CONNECT_getCharaindex( fd ); +#ifndef _PROSKILL_OPTIMUM + int skillindex=-1,char_pskill=-1,profession_skill=-1; +#endif + + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) return; + +#ifndef _PROSKILL_OPTIMUM // Robin fix cancel ˴Թְҵ, PROFESSION_SKILL_Use м + // ְҵ + char_pskill = CHAR_getInt( charaindex, PROFESSION_CLASS ); + + skillindex = PROFESSION_SKILL_GetArray( charaindex, iNum); + int Pskillid = skillindex; + // ְܵҵ + profession_skill = PROFESSION_SKILL_getInt( Pskillid, PROFESSION_SKILL_PROFESSION_CLASS); + + if( (char_pskill > 0) && (char_pskill == profession_skill) ){ +#else + if( 1 ){ +#endif + if( PROFESSION_SKILL_Use( charaindex, iNum, 0, NULL ) != 1 ){ + if(CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM)-(int)time(NULL)>0){ +// print("\n (%s)ʹüܴ!", CHAR_getUseName( charaindex ) ); +#ifdef _PROSKILL_ERR_KICK + CONNECT_setCloseRequest( fd , 1 ); +#endif + } + } + } + +} + +#endif + +#ifdef _STREET_VENDOR +void lssproto_STREET_VENDOR_recv(int fd,char *message) +{ + int charaindex = CONNECT_getCharaindex(fd); + if(!CHAR_CHECKINDEX(charaindex)) return; + if(CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return; + if(CHAR_getWorkInt(charaindex,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + CHAR_talkToCli(charaindex,-1,"״̬²ܽ",CHAR_COLORYELLOW); + return; + } + if (CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(charaindex); + return; + } + CHAR_sendStreetVendor(charaindex,message); +} +#endif + +#ifdef _RIGHTCLICK +void lssproto_RCLICK_recv(int fd, int type, char* data) +{ + print("\n RCLICK_recv( type=%d data=%s) ", type, data); +} +#endif + +#ifdef _JOBDAILY +void lssproto_JOBDAILY_recv(int fd,char *data) +{ + int charaindex = CONNECT_getCharaindex(fd); + if(!CHAR_CHECKINDEX(charaindex)) return; + + CHAR_JobDaily(charaindex,data); +} +#endif + +#ifdef _TEACHER_SYSTEM +void lssproto_TEACHER_SYSTEM_recv(int fd,char *data) +{ + int charaindex = CONNECT_getCharaindex(fd); + + if(!CHAR_CHECKINDEX(charaindex)) return; + CHAR_Teacher_system(charaindex,data); +} +#endif + +#ifdef _ONLINE_SHOP +void lssproto_SHOP_recv(int fd,int shopflag,int piece) +{ + int charaindex = CONNECT_getCharaindex(fd); + + if(!CHAR_CHECKINDEX(charaindex)) return; + char *mycdkey=CHAR_getChar(charaindex,CHAR_CDKEY); + //saacproto_ACShop_send(fd,mycdkey,charaindex,shopflag,piece); + char dataname[20]; + char res[2048]; + int rownum=0,pieces=0,shopnum=0,startrow,vippoint=0; + sprintf(dataname,"OnlineShop%d",shopflag); + vippoint=sasql_vippoint(mycdkey,0,0); + rownum=sasql_chehk_shop(dataname); + if(rownum>0) + { + pieces=rownum/8+1; + shopnum=rownum-8*(piece-1); + if(shopnum>8) shopnum=8; + startrow=8*(piece-1); + char* shopres; + shopres=sasql_query_shop(dataname,startrow,shopnum); + lssproto_SHOP_send(fd,shopnum,vippoint,piece,pieces,shopflag,shopres); + } +} + +void lssproto_SHOPBUY_recv(int fd,int shopflag,int piece,int shopno,int buynum) +{ + int charaindex = CONNECT_getCharaindex(fd); + int i,petindex; + if(!CHAR_CHECKINDEX(charaindex)) return; + if (CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(charaindex); + return; + } + if(shopflag==1) + { + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charaindex, i); + if( petindex == -1 ) + break; + } + + if( i+buynum > CHAR_MAXPETHAVE ) { + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + return; + } + } + else + { + if(buynum>CHAR_findSurplusItemBox(charaindex)){ + CHAR_talkToCli( charaindex, -1, "Ʒλ㡣", CHAR_COLORYELLOW); + + return; + } + } + char *mycdkey=CHAR_getChar(charaindex,CHAR_CDKEY); + char dataname[20]; + int rownum=0,pieces=0,shopnum=0,startrow,vippoint=0; + sprintf(dataname,"OnlineShop%d",shopflag); + vippoint=sasql_vippoint(mycdkey,0,0); + rownum=sasql_chehk_shop(dataname); + if(rownum>0) + { + pieces=rownum/8+1; + shopnum=rownum-8*(piece-1); + if(shopnum>8) shopnum=8; + startrow=8*(piece-1); + char* shopres; + shopres=sasql_query_shop(dataname,startrow,shopnum); + int pvippoint = - sasql_buy_shop(dataname,startrow,shopnum,shopno) * buynum; + vippoint=sasql_vippoint(mycdkey,pvippoint,1); + //saacproto_ACShopBuy_send(fd, charaindex,0,vippoint,piece,pieces,shopflag,shopres,shopno,buynum); + } + //saacproto_ACShopBuy_send(fd,mycdkey,charaindex,shopflag,piece,shopno,buynum); +} +#endif diff --git a/char/addressbook.c b/char/addressbook.c new file mode 100644 index 0000000..ea7530e --- /dev/null +++ b/char/addressbook.c @@ -0,0 +1,914 @@ +#define __ADDRESSBOOK_C_ +#include "version.h" + +#include +#include +#include +#include + +#include "addressbook.h" +#include "char.h" +#include "handletime.h" +#include "buf.h" +#include "net.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "object.h" +#include "battle.h" +#include "configfile.h" +#include "npcutil.h" +#include "pet.h" +#include "petmail.h" +#include "log.h" + +/*ö⼰ ӮӮƱƥ ٯ Ӯ + ľƱ³*/ +#define ADDRESSBOOK_FIXEDMESSAGE_MAXLEN 128 + +/* м岾ئ׼ƥʧƤͱܰƥئ + 弰ö */ +#define ADDRESSBOOK_CANTADD "ûκˡ" +#define ADDRESSBOOK_CANTADD2 "޷Ƭ" + +/* ë³绥ƥб˪¶*/ +#define ADDRESSBOOK_ADDED "%sƬ " + +/* ӿëľ */ +#define ADDRESSBOOK_BEINGADDED "%sƬ " + +/* ޼з弰 */ +#define ADDRESSBOOK_MYTABLEFULL "Ƭϻ" + +/* 켰޼з弰 */ +#define ADDRESSBOOK_HISTABLEFULL "ԷƬϻ" + + +/* ë˪¼ */ +#define ADDRESSBOOK_SENT "Ÿ%s " + +/* ë˪¼ */ +#define ADDRESSBOOK_UNSENT "޷Ÿ%s " + +/* ë׻ȱ崴 */ +#define ADDRESSBOOK_ALREADYADDED "Ѿ%sƬˡ " + +/* ͭë */ +#define ADDRESSBOOK_GIVEADDRESS "%sõƬ" + +/* ͭë ؤ */ +#define ADDRESSBOOK_TAKEADDRESS1 "%sԼƬ" +/* ͭë ؤ */ +#define ADDRESSBOOK_TAKEADDRESS2 "Ϊ%sҪƬԽƬˡ" + +#define ADDRESSBOOK_RETURNED1 \ +"%sżû%sƬֽż˻ء" + +#define ADDRESSBOOK_RETURNED2 \ +"ż%s%s ûƬżֱ˻ˡ" + +#define PETMAIL_RETURNED1 \ +"%s޷ż" + + +/* staticƥã а*/ +char ADDRESSBOOK_returnstring[25*128]; + + + +static int ADDRESSBOOK_findBlankEntry( int cindex ); +static BOOL ADDRESSBOOK_makeEntryFromCharaindex( int charaindex, + ADDRESSBOOK_entry* ae); + +/*------------------------------------------------------------ + * ʧƤͼë˪ + * MSGᆴչľ£ + * + * ֧³練connectioncdkeyƥƻƽҷ + * գ MSG_send£۹м + * 켰ئئе֣ + * ¦ + * cindex int ƽҷ¼index + * aindex int ʧƤͼindex + * text char* ˪ ٯ + * color int + * ߯Ի + * ̼ƽҷ±嶪ë˪TRUE , + * ׷̼ FALSEë + ------------------------------------------------------------*/ +BOOL ADDRESSBOOK_sendMessage( int cindex, int aindex, char* text , int color ) +{ + int i ; + char tmpmsg[256]; + char textbuffer[2048]; + char *mycd; + char *mycharaname = CHAR_getChar(cindex,CHAR_NAME ); + struct tm tm1; + ADDRESSBOOK_entry *ae; + int playernum = CHAR_getPlayerMaxNum(); + + if( !CHAR_CHECKINDEX(cindex) )return FALSE; + + ae = CHAR_getAddressbookEntry( cindex , aindex ); + if( ae == NULL )return FALSE; +#ifdef _AVOIDATTACK_IN_ADDRESSBOOK_sendMessage_textToLong + if( strlen(text) > 256 ) + return FALSE; +#endif + //getcdkeyFromCharaIndex(cindex, mycd,sizeof(mycd) ); + mycd = CHAR_getChar( cindex, CHAR_CDKEY); + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + snprintf( textbuffer, sizeof( textbuffer), + "%2d/%02d %2d:%02d|%s|-1", + tm1.tm_mon +1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, + text); + + /* ӡ */ + for( i = 0 ; i < playernum ; i ++){ + if( CHAR_CHECKINDEX( i) && + strcmp( CHAR_getChar( i, CHAR_CDKEY), ae->cdkey) == 0 && + strcmp( CHAR_getChar( i, CHAR_NAME), ae->charname) == 0 ) + { + /* + * CDKEY ƽҷ ף۹ƽҷ + * ʧƤͱм ؤ¾Ʃͻ + * գMSG£ + */ + int index_to_my_info = + ADDRESSBOOK_getIndexInAddressbook( i , + mycd, mycharaname); + + int fd; + if( index_to_my_info < 0 ){ + /* + * 컥ëƻȻ£ + * ɱ бݶﻥ ɧ£ + */ + //snprintf( tmpmsg, sizeof( tmpmsg), + // ADDRESSBOOK_RETURNED1, + // ae->charname + // ); + + //CHAR_talkToCli( CONNECT_getCharaindex(i), -1, + // tmpmsg , CHAR_COLORYELLOW ); + + snprintf( tmpmsg, sizeof( tmpmsg), + ADDRESSBOOK_RETURNED2, + CHAR_getChar( i, CHAR_NAME), + CHAR_getChar( i, CHAR_NAME)); + + /* ˪ԻDZֶ */ + CHAR_talkToCli( cindex, -1, + tmpmsg , CHAR_COLORYELLOW ); + return FALSE; + } + + fd = getfdFromCharaIndex( i); + if( fd != -1 ) { + lssproto_MSG_send( fd , index_to_my_info , textbuffer , color ); + /* Ի */ + printl( LOG_TALK, "CD=%s\tNM=%s\tT=%s" , mycd, mycharaname, textbuffer ); + + } + + snprintf( tmpmsg , sizeof( tmpmsg),ADDRESSBOOK_SENT, + ae->charname ); + CHAR_talkToCli(cindex,-1, tmpmsg , color ); + + // WON ADD snprintfᵼµbug + { + char tmp[1000]; + sprintf( tmp , "ADDRESSBOOK_sendMessage:" + "Send MSG to: %s %s\n", + ae->cdkey , ae->charname ); + // print( tmp ); + } + + CHAR_setInt( cindex, CHAR_SENDMAILCOUNT, + CHAR_getInt( cindex, CHAR_SENDMAILCOUNT)+1); + return TRUE; + } + } + /* έئݷʧӡ˪ */ + saacproto_Message_send( acfd, mycd, mycharaname, + ae->cdkey, ae->charname, textbuffer, color); + CHAR_setInt( cindex, CHAR_SENDMAILCOUNT, + CHAR_getInt( cindex, CHAR_SENDMAILCOUNT)+1); + + + snprintf( tmpmsg , sizeof( tmpmsg),ADDRESSBOOK_SENT,ae->charname ); + CHAR_talkToCli( cindex,-1, tmpmsg , CHAR_COLORWHITE ); + + return FALSE; +} +/*------------------------------------------------------------ + * ʧƤͼë˪ + * saac msg ëȻͷʧ̵£ + * + * ߯Ի + ------------------------------------------------------------*/ +BOOL ADDRESSBOOK_sendMessage_FromOther( char *fromcdkey, char *fromcharaname, + char *tocdkey, char *tocharaname, + char* text , int color ) +{ +#define ADDRESSBOOK_SYSTEM "system" + + int i ; + char tmpmsg[256]; + int playernum = CHAR_getPlayerMaxNum(); + + /* ӡ ë */ + for( i = 0 ; i < playernum ; i ++){ + if( CHAR_CHECKINDEX( i) && + strcmp( CHAR_getChar( i, CHAR_CDKEY), tocdkey) == 0 && + strcmp( CHAR_getChar( i, CHAR_NAME), tocharaname) == 0) + { + int index_to_my_info; + /* + * CDKEY ƽҷ ף۹ƽҷ + * ʧƤͱм ؤ¾Ʃͻ + * գMSG£ + */ + + /* ˵ ة⻥Ȼ */ + if( strcmp( fromcdkey, ADDRESSBOOK_SYSTEM) == 0 && + strcmp( fromcharaname, ADDRESSBOOK_SYSTEM ) == 0 ) + { + /* ˵ ةë */ + CHAR_talkToCli( i, -1, text , color ); + break; + } + + index_to_my_info = + ADDRESSBOOK_getIndexInAddressbook( i , + fromcdkey, fromcharaname); + if( index_to_my_info < 0 ){ + /* + * 컥ëƻȻ£ + */ + + snprintf( tmpmsg, sizeof( tmpmsg), ADDRESSBOOK_RETURNED2, + tocharaname, tocharaname); + + /* ˪ԻDZֶ */ + saacproto_Message_send( acfd, ADDRESSBOOK_SYSTEM , ADDRESSBOOK_SYSTEM, + fromcdkey, fromcharaname, tmpmsg, CHAR_COLORYELLOW); + + } + else { + int fd = getfdFromCharaIndex( i); + if( fd != -1 ) { + lssproto_MSG_send( fd , index_to_my_info , text , color ); + /* Ի */ + printl( LOG_TALK, "CD=%s\tNM=%s\tT=%s" , fromcdkey, + fromcharaname, text ); + } + } + break; + } + } + if( i == playernum ) return FALSE; + return TRUE; +} + +int ADDRESSBOOK_getIndexInAddressbook(int cindex , char *cdkey, + char *charname) +{ + int i ; + + if( !CHAR_CHECKINDEX( cindex ) ) return -1; + + for( i = 0 ; i < ADDRESSBOOK_MAX ; i++){ + ADDRESSBOOK_entry *ae = CHAR_getAddressbookEntry( cindex , i ); + if( ae && ae->use && strcmp( ae->cdkey, cdkey )==0 && + strcmp( ae->charname , charname ) == 0 ){ + return i; + } + } + return -1; +} + +BOOL ADDRESSBOOK_deleteEntry( int meindex ,int index ) +{ + ADDRESSBOOK_entry ent; + BOOL ret; + if( !CHAR_CHECKINDEX( meindex ) ) return FALSE; + + memset( &ent ,0, sizeof( ADDRESSBOOK_entry )); + ret = CHAR_setAddressbookEntry( meindex , index , &ent ); + if( ret == TRUE ){ + ADDRESSBOOK_sendAddressbookTable( meindex ); + return TRUE; + } + return FALSE; +} + +BOOL ADDRESSBOOK_addEntry( int meindex ) +{ + int objbuf[20]; + int found_count; + int front_x , front_y; + int i; + int cnt = 0; + int fd; + char *mycd , *tocd; + BOOL found = FALSE; + + if( !CHAR_CHECKINDEX( meindex ) )return FALSE; + + fd = getfdFromCharaIndex( meindex); + if( fd == -1 ) return FALSE; + + if( ADDRESSBOOK_findBlankEntry( meindex ) < 0) { + CHAR_talkToCli( meindex , -1,ADDRESSBOOK_MYTABLEFULL,CHAR_COLORWHITE ); + return FALSE; + } + + for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) { + CONNECT_setTradecardcharaindex( fd,i,-1); + } + + CHAR_getCoordinationDir( CHAR_getInt( meindex, CHAR_DIR ) , + CHAR_getInt( meindex , CHAR_X ), + CHAR_getInt( meindex , CHAR_Y ) , + 1 , &front_x , &front_y ); + + found_count = CHAR_getSameCoordinateObjects( objbuf, + arraysizeof( objbuf), + CHAR_getInt(meindex,CHAR_FLOOR), + front_x,front_y ); + if( found_count == 0 ){ + CHAR_talkToCli( meindex, -1, ADDRESSBOOK_CANTADD, CHAR_COLORWHITE); + return FALSE; + } + for( i = 0 ; i < found_count; i++ ){ + int objindex = objbuf[i]; + int index = OBJECT_getIndex( objindex); + if( OBJECT_getType(objindex) != OBJTYPE_CHARA ) { + continue; + } + if( CHAR_getInt( index,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + continue; + } + if( index == meindex ) { + continue; + } + found = TRUE; + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) { + continue; + } + if(!CHAR_getFlg( index, CHAR_ISTRADECARD)) { + continue; + } + if( ADDRESSBOOK_findBlankEntry( index ) < 0 ) { + continue; + } + tocd = CHAR_getChar( index, CHAR_CDKEY); + mycd = CHAR_getChar( meindex, CHAR_CDKEY); + if( ADDRESSBOOK_getIndexInAddressbook( meindex, tocd, + CHAR_getChar( index, CHAR_NAME)) >= 0 && + ADDRESSBOOK_getIndexInAddressbook( index, mycd, + CHAR_getChar(meindex, CHAR_NAME) ) >= 0 ) { + continue; + } + + CONNECT_setTradecardcharaindex( fd,cnt,index); + cnt ++; + if( cnt == CONNECT_WINDOWBUFSIZE ) break; + } + + if( cnt == 0 ) { + if( found ) { + CHAR_talkToCli( meindex, -1, ADDRESSBOOK_CANTADD2, CHAR_COLORWHITE); + }else { + CHAR_talkToCli( meindex, -1, ADDRESSBOOK_CANTADD, CHAR_COLORWHITE); + } + return FALSE; + } + if( cnt == 1 ) { + ADDRESSBOOK_addAddressBook( meindex, + CONNECT_getTradecardcharaindex(fd,0) ); + return TRUE; + }else if( cnt > 1 ) { + int strlength; + char msgbuf[1024]; + char escapebuf[2048]; + strcpy( msgbuf, "1\n˭Ƭأ\n"); + strlength = strlen( msgbuf); + for( i = 0; + CONNECT_getTradecardcharaindex(fd,i) != -1 + && i< CONNECT_WINDOWBUFSIZE; i ++ ){ + char *a = CHAR_getChar( CONNECT_getTradecardcharaindex(fd,i), + CHAR_NAME); + char buf[256]; + snprintf( buf, sizeof( buf),"%s\n", a); + if( strlength + strlen( buf) > arraysizeof( msgbuf)){ + print( "%s:%dӴѶϢbuffer㡣\n", + __FILE__,__LINE__); + break; + } + strcpy( &msgbuf[strlength], buf); + strlength += strlen(buf); + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SELECTTRADECARD, + -1, + makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); + return TRUE; + } + + return FALSE; +} + +static int ADDRESSBOOK_findBlankEntry( int cindex ) +{ + int i; + + if( CHAR_CHECKINDEX( cindex ) == FALSE )return -1; + + for( i=0 ; iuse == FALSE ) { + return i; + } + } + return -1; +} + +static BOOL ADDRESSBOOK_makeEntryFromCharaindex( int charaindex, + ADDRESSBOOK_entry* ae) +{ + char *cdkey; + + if( !CHAR_CHECKINDEX(charaindex) ) return FALSE; + + memset( ae,0,sizeof(ADDRESSBOOK_entry) ); + cdkey = CHAR_getChar( charaindex, CHAR_CDKEY); + if( cdkey == "\0" || cdkey == NULL ){ + print( "ADDRESSBOOK_makeEntryFromCharaindex:" + " strange! getcdkeyFromCharaIndex returns NULL!" + " charaindex: %d\n" , charaindex ); + return FALSE; + } + strcpysafe( ae->cdkey , sizeof( ae->cdkey ),cdkey); + + strcpysafe( ae->charname,sizeof( ae->charname), + CHAR_getChar(charaindex,CHAR_NAME) ); + ae->level = CHAR_getInt( charaindex , CHAR_LV ); + ae->duelpoint = CHAR_getInt( charaindex, CHAR_DUELPOINT); + ae->graphicsno = CHAR_getInt( charaindex , CHAR_FACEIMAGENUMBER ); + ae->online = getServernumber(); + ae->use = TRUE; + ae->transmigration = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); + + return TRUE; +} + +void ADDRESSBOOK_notifyLoginLogout( int cindex , int flg ) +{ + int i; + char *cd=NULL; + char *nm = CHAR_getChar( cindex , CHAR_NAME ); + int playernum = CHAR_getPlayerMaxNum(); + + if( !CHAR_CHECKINDEX( cindex ) )return; + cd = CHAR_getChar( cindex, CHAR_CDKEY); + + CHAR_send_DpDBUpdate_AddressBook( cindex, flg ); + + for( i = 0 ; i < playernum ; i++){ + if( CHAR_CHECKINDEX( i) && i != cindex ) { + int j; + for( j = 0 ; juse == TRUE && + strcmp( ae->cdkey , cd ) == 0 && + strcmp( ae->charname, nm ) == 0 ){ + + ae->online = (flg == 0 ) ? 0: getServernumber(); + ae->level = CHAR_getInt( cindex , CHAR_LV ); + ae->duelpoint = CHAR_getInt( cindex, CHAR_DUELPOINT); + ae->graphicsno = CHAR_getInt( cindex, CHAR_FACEIMAGENUMBER ); + ae->transmigration = CHAR_getInt( cindex, CHAR_TRANSMIGRATION); + + ADDRESSBOOK_sendAddressbookTableOne( i,j ); + + break; + } + } + } + } + + if( flg == 0 ){ + saacproto_Broadcast_send( acfd,cd, nm, "offline", 1); + }else if( flg == 1 ) { + for( i = 0 ; i < ADDRESSBOOK_MAX; i++ ){ + int j; + ADDRESSBOOK_entry* ae; + ae = CHAR_getAddressbookEntry( cindex, i ); + if( ae->use == 0 )continue; + ae->online = 0; + for( j=0 ; j < playernum ; j++ ) { + if( CHAR_CHECKINDEX( j) && + strcmp( ae->cdkey, CHAR_getChar( j, CHAR_CDKEY)) == 0 && + strcmp( ae->charname, CHAR_getChar( j, CHAR_NAME) )== 0){ + ae->level = CHAR_getInt( j, CHAR_LV ); + ae->graphicsno = CHAR_getInt( j, CHAR_FACEIMAGENUMBER ); + ae->online = getServernumber(); + ae->transmigration = CHAR_getInt( j, CHAR_TRANSMIGRATION); + break; + } + } + if( j == playernum) { + char buff[512]; + char escapebuf[1024]; + ae->online = 0; + snprintf( buff, sizeof(buff), "%s_%s", ae->cdkey, ae->charname); + makeEscapeString( buff, escapebuf, sizeof(escapebuf)); + saacproto_DBGetEntryString_send( acfd, DB_ADDRESSBOOK, escapebuf, 0,0); + } + } + ADDRESSBOOK_sendAddressbookTable(cindex); + saacproto_Broadcast_send( acfd,cd, nm, "online", 1); + saacproto_MessageFlush_send( acfd, cd, nm); + } +} + +BOOL ADDRESSBOOK_sendAddressbookTable( int cindex ) +{ + int stringlen=0; + int i; + + if( !CHAR_CHECKINDEX( cindex ) )return FALSE; + + for( i=0 ; iuse ){ + char tmp[CHARNAMELEN+32]; + char charname_escaped[CHARNAMELEN*2]; + makeEscapeString( ae->charname, charname_escaped , + sizeof(charname_escaped )); + /* ð׷º| |ì|̰|׷º */ + snprintf( tmp , sizeof( tmp ), + "%d|%s|%d|%d|%d|%d|%d|0|" , + ae->use, + charname_escaped , ae->level , + ae->duelpoint,ae->online,ae->graphicsno, + ae->transmigration); + strcpysafe ( ADDRESSBOOK_returnstring + stringlen , + sizeof(ADDRESSBOOK_returnstring) - stringlen, + tmp ); + stringlen += strlen( tmp ); + if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) { + break; + } + }else{ + /*Ȼئзֳ߼ƥ˪ */ + char tmp[32]; + snprintf( tmp , sizeof( tmp ), "||||||||" ); + strcpysafe ( ADDRESSBOOK_returnstring + stringlen , + sizeof(ADDRESSBOOK_returnstring) - stringlen, + tmp ); + stringlen += strlen( tmp ); + if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) { + break; + } + } + } + + dchop( ADDRESSBOOK_returnstring, "|" ); + + { + int fd; + fd = getfdFromCharaIndex( cindex ); + if( fd == -1 ) return FALSE; + lssproto_AB_send( fd, ADDRESSBOOK_returnstring ); + } + return TRUE; +} + +BOOL ADDRESSBOOK_sendAddressbookTableOne( int cindex, int num ) +{ + int stringlen=0; + ADDRESSBOOK_entry *ae; + + if( !CHAR_CHECKINDEX( cindex ) )return FALSE; + if( num < 0 || num > ADDRESSBOOK_MAX) return FALSE; + + ae = CHAR_getAddressbookEntry( cindex , num ); + + if( ae && ae->use ){ + char tmp[CHARNAMELEN+32]; + char charname_escaped[CHARNAMELEN*2]; + makeEscapeString( ae->charname, charname_escaped , + sizeof(charname_escaped )); + snprintf( tmp , sizeof( tmp ), + "%d|%s|%d|%d|%d|%d|%d|0|" , + ae->use, + charname_escaped , ae->level , + ae->duelpoint,ae->online,ae->graphicsno, + ae->transmigration); + strcpysafe ( ADDRESSBOOK_returnstring + stringlen , + sizeof(ADDRESSBOOK_returnstring) - stringlen, + tmp ); + stringlen += strlen( tmp ); + if( stringlen >= sizeof(ADDRESSBOOK_returnstring) ) { + return FALSE; + } + }else{ + char tmp[32]; + snprintf( tmp , sizeof( tmp ), "||||||||" ); + strcpysafe ( ADDRESSBOOK_returnstring + stringlen , + sizeof(ADDRESSBOOK_returnstring) - stringlen, + tmp ); + stringlen += strlen( tmp ); + if( stringlen >= sizeof(ADDRESSBOOK_returnstring)) { + return FALSE; + } + } + + { + int fd; + fd = getfdFromCharaIndex( cindex ); + if( fd == -1 ) return FALSE; + lssproto_ABI_send( fd, num, ADDRESSBOOK_returnstring ); + } + return TRUE; +} + +/*------------------------------------------------------------ + * 繴ʧƤ;޼ë ٯ ئʣ + * ľƽҷئƥͷʧ˪·ԻֿҸ + * ئּƥؤ ۢؤ£ + * ¦ + * a ADDRESSBOOK_entry* ٯ հ ߼̼ + * ߯Ի + * char * + ------------------------------------------------------------*/ +char *ADDRESSBOOK_makeAddressbookString( ADDRESSBOOK_entry *a ) +{ + char work1[256], work2[256]; + + if( a->use == 0 ){ + /* ޼ ٯ */ + ADDRESSBOOK_returnstring[0] = '\0'; + return ADDRESSBOOK_returnstring; + } + + makeEscapeString( a->cdkey, work1, sizeof( work1 )); + makeEscapeString( a->charname , work2 , sizeof( work2 )); + snprintf( ADDRESSBOOK_returnstring, + sizeof( ADDRESSBOOK_returnstring ), + "%s|%s|%d|%d|%d|%d", + work1, work2, a->level, a->duelpoint, a->graphicsno,a->transmigration); + + return ADDRESSBOOK_returnstring; + +} + +/*------------------------------------------------------------ + * ٯ ľʧƤ;޼ëհ ئʣ + * հ use½ ձئ£ + * ¦ + * in char* ٯ + * a ADDRESSBOOK_entry* ë谻 + * ߯Ի + * ѱTRUE + ------------------------------------------------------------*/ +BOOL ADDRESSBOOK_makeAddressbookEntry( char *in , ADDRESSBOOK_entry *a ) +{ + char work1[256], work2[256] , work3[256] , work4[256],work5[256],work6[256]; + int ret; + if( strlen( in ) == 0 ){ + memset( a,0,sizeof(ADDRESSBOOK_entry) ); + a->use = 0; + return TRUE; + } + + getStringFromIndexWithDelim( in, "|" , 1 , work1 , sizeof( work1 )); + getStringFromIndexWithDelim( in, "|" , 2 , work2 , sizeof( work2 )); + getStringFromIndexWithDelim( in, "|" , 3 , work3 , sizeof( work3 )); + getStringFromIndexWithDelim( in, "|" , 4 , work4 , sizeof( work4 )); + getStringFromIndexWithDelim( in, "|" , 5 , work5 , sizeof( work5 )); + work6[0] = '\0'; + ret = getStringFromIndexWithDelim( in, "|" , 6 , work6 , sizeof( work6 )); + if( ret == FALSE ) { + a->transmigration = 0; + } + else { + a->transmigration = atoi( work6); + } + a->use = 1; + + makeStringFromEscaped( work1 ); + makeStringFromEscaped( work2 ); + + strcpysafe( a->cdkey , sizeof(a->cdkey) , work1 ); + strcpysafe( a->charname , sizeof(a->charname), work2 ); + + a->level = atoi( work3 ); + a->duelpoint = atoi( work4 ); + a->graphicsno = atoi( work5 ); + + return FALSE; +} + +void ADDRESSBOOK_addAddressBook( int meindex, int toindex) +{ + char tmpstring[CHARNAMELEN + + ADDRESSBOOK_FIXEDMESSAGE_MAXLEN]; + + int hisblank; + int myblank; + int myaddindex, toaddindex; + int dir; + char *cdkey; + + hisblank = ADDRESSBOOK_findBlankEntry( toindex ); + if( hisblank < 0 ) { + CHAR_talkToCli( meindex, -1, ADDRESSBOOK_HISTABLEFULL, CHAR_COLORWHITE); + return ; + } + myblank = ADDRESSBOOK_findBlankEntry( meindex ); + if( myblank < 0 ){ + CHAR_talkToCli( meindex , -1, ADDRESSBOOK_MYTABLEFULL, CHAR_COLORWHITE ); + return ; + } + + cdkey = CHAR_getChar( toindex, CHAR_CDKEY); + myaddindex = ADDRESSBOOK_getIndexInAddressbook( meindex, cdkey, + CHAR_getChar( toindex, CHAR_NAME)); + cdkey = CHAR_getChar( meindex, CHAR_CDKEY); + toaddindex = ADDRESSBOOK_getIndexInAddressbook( toindex, cdkey, + CHAR_getChar(meindex, CHAR_NAME)); + if( myaddindex < 0 ){ + ADDRESSBOOK_entry hisentry; + + if( ADDRESSBOOK_makeEntryFromCharaindex(toindex,&hisentry) == FALSE ){ + return ; + } + CHAR_setAddressbookEntry( meindex, myblank,&hisentry ); + + snprintf( tmpstring, sizeof( tmpstring), + toaddindex < 0 ? ADDRESSBOOK_ADDED: ADDRESSBOOK_GIVEADDRESS, + hisentry.charname); + CHAR_talkToCli( meindex , -1,tmpstring, CHAR_COLORWHITE ); + ADDRESSBOOK_sendAddressbookTableOne( meindex, myblank); + }else{ + snprintf( tmpstring, sizeof( tmpstring), ADDRESSBOOK_TAKEADDRESS1, + CHAR_getChar( toindex, CHAR_NAME)); + CHAR_talkToCli( meindex, -1, tmpstring, CHAR_COLORWHITE); + + } + if( toaddindex < 0 ) { + ADDRESSBOOK_entry meae; + if( ADDRESSBOOK_makeEntryFromCharaindex(meindex,&meae) == FALSE) { + return; + } + CHAR_setAddressbookEntry( toindex, hisblank,&meae ); + snprintf( tmpstring , sizeof( tmpstring), + myaddindex < 0 ? ADDRESSBOOK_ADDED : ADDRESSBOOK_GIVEADDRESS, + CHAR_getChar( meindex, CHAR_NAME ) ); + CHAR_talkToCli( toindex, -1, tmpstring, CHAR_COLORWHITE); + ADDRESSBOOK_sendAddressbookTableOne( toindex , hisblank); + }else { + if( myaddindex < 0 ) { + snprintf( tmpstring , sizeof( tmpstring), + ADDRESSBOOK_TAKEADDRESS2, + CHAR_getChar( meindex, CHAR_NAME ) ); + CHAR_talkToCli( toindex, -1, tmpstring, CHAR_COLORWHITE); + } + } + dir = NPC_Util_GetDirCharToChar( toindex, meindex, 0); + if( dir != -1) { + + if( CHAR_getInt( toindex, CHAR_DIR) != dir) { + CHAR_setInt( toindex, CHAR_DIR, dir); + } + CHAR_sendWatchEvent( CHAR_getWorkInt( toindex, CHAR_WORKOBJINDEX), + CHAR_ACTNOD,NULL,0,TRUE); + CHAR_setWorkInt( toindex, CHAR_WORKACTION, CHAR_ACTNOD); + CHAR_sendWatchEvent( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + CHAR_ACTNOD,NULL,0,TRUE); + CHAR_setWorkInt( meindex, CHAR_WORKACTION, CHAR_ACTNOD); + } + return; +} + + +void ADDRESSBOOK_DispatchMessage( char *cd, char *nm, char *value, int mode) +{ + int i; + char work[256]; + int online,level,duelpoint, faceimagenumber, transmigration; + int playernum = CHAR_getPlayerMaxNum(); + int ret; + + getStringFromIndexWithDelim( value, "|" , 1 , work , sizeof( work )); + online = atoi( work); + getStringFromIndexWithDelim( value, "|" , 2 , work , sizeof( work )); + level = atoi( work); + getStringFromIndexWithDelim( value, "|" , 3 , work , sizeof( work )); + duelpoint = atoi( work); + getStringFromIndexWithDelim( value, "|" , 4 , work , sizeof( work )); + faceimagenumber = atoi( work); + ret = getStringFromIndexWithDelim( value, "|" , 5 , work , sizeof( work )); + if( ret ) { + transmigration = atoi( work); + } + else { + transmigration = 0; + } + + if( online == getServernumber()) { + for( i = 0 ; i < playernum ; i++) { + if( CHAR_CHECKINDEX( i )) { + char *c = CHAR_getChar( i, CHAR_CDKEY); + char *n = CHAR_getChar( i, CHAR_NAME); + if( c == "\0" || n == "\0" ) continue; + if( c == NULL || n == NULL ) continue; + if( strcmp( c , cd ) == 0 && strcmp( n, nm ) == 0 ) { + break; + } + } + } + if( i == playernum ) { + online = 0; + saacproto_Broadcast_send( acfd,cd, nm, "offline", 1); + } + } + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_CHECKINDEX( i )) { + int j; + for( j = 0 ; j < ADDRESSBOOK_MAX ; j++) { + ADDRESSBOOK_entry *ae; + ae = CHAR_getAddressbookEntry( i ,j ); + if( ae && ae->use == TRUE && + strcmp( ae->cdkey , cd ) == 0 && + strcmp( ae->charname, nm ) == 0 ) + { + if( mode == 0 ) { + ae->use = FALSE; + }else { + ae->online = online; + ae->level = level; + ae->duelpoint = duelpoint; + ae->graphicsno = faceimagenumber; + ae->transmigration = transmigration; + } + ADDRESSBOOK_sendAddressbookTableOne( i,j ); + + break; + } + } + } + } +} + +#ifdef _ANGLE_EMAIL +BOOL ADDRESSBOOK_AutoaddAddressBook( int meindex, int toindex) +{ + int hisblank; + int myblank; + int myaddindex, toaddindex; + + char *cdkey; + + myblank = ADDRESSBOOK_findBlankEntry( meindex ); + hisblank = ADDRESSBOOK_findBlankEntry( toindex ); + + //myblank = 79; + //hisblank = 79; + + if( hisblank < 0 || myblank < 0) { //"Ƭϻ" + return FALSE; + } + + cdkey = CHAR_getChar( toindex, CHAR_CDKEY); + myaddindex = ADDRESSBOOK_getIndexInAddressbook( meindex, cdkey, + CHAR_getChar( toindex, CHAR_NAME)); + cdkey = CHAR_getChar( meindex, CHAR_CDKEY); + toaddindex = ADDRESSBOOK_getIndexInAddressbook( toindex, cdkey, + CHAR_getChar(meindex, CHAR_NAME)); + if( myaddindex < 0 ){ + ADDRESSBOOK_entry meae; + ADDRESSBOOK_entry hisentry; + if( ADDRESSBOOK_makeEntryFromCharaindex(toindex,&hisentry) == FALSE || + ADDRESSBOOK_makeEntryFromCharaindex(meindex,&meae) == FALSE ){ + return FALSE; + } + CHAR_setAddressbookEntry( meindex, myblank,&hisentry ); + CHAR_setAddressbookEntry( toindex, hisblank,&meae ); + ADDRESSBOOK_sendAddressbookTableOne( meindex, myblank); + ADDRESSBOOK_sendAddressbookTableOne( toindex , hisblank); + } + return TRUE; +} +#endif + diff --git a/char/char.c b/char/char.c new file mode 100644 index 0000000..73c6370 --- /dev/null +++ b/char/char.c @@ -0,0 +1,11085 @@ +#include "version.h" +#include +#include +#include +#include // shan +#include +#include +#include +#include +#include "net.h" +#include "common.h" +#include "char_base.h" +#include "char_data.h" +#include "char.h" +#include "lssproto_serv.h" +#include "item.h" +#include "item_event.h" +#include "buf.h" +#include "object.h" +#include "map_deal.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "handletime.h" +#include "char_event.h" +#include "npccreate.h" +#include "addressbook.h" +#include "item_event.h" +#include "magic_base.h" +#include "magic.h" +#include "chatmagic.h" +#include "configfile.h" +#include "log.h" +#include "anim_tbl.h" +#include "encount.h" +#include "battle.h" +#include "pet_skill.h" +#include "util.h" +#include "enemy.h" +#include "npcutil.h" +#include "pet.h" +#include "family.h" +#include "defend.h" +#include "correct_bug.h" +#ifdef _JOBDAILY +#include "npc_checkman.h" +#endif + +#ifdef _CHAR_PROFESSION // WON ADD ְҵλ +#include "profession_skill.h" +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +#include "chatroom.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +extern int channelMember[FAMILY_MAXNUM][FAMILY_MAXCHANNEL][FAMILY_MAXMEMBER]; +extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; + +extern tagRidePetTable ridePetTable[296]; +extern int BATTLE_getRidePet( int charaindex ); + +#ifdef _CHANNEL_MODIFY +extern int InitOccChannel(void); +#endif + +#ifdef _ANGEL_SUMMON +extern int checkIfAngelByName( char* nameinfo); +extern char* getMissionNameInfo( int charaindex, char* nameinfo); +extern void CHAR_sendAngelMark( int objindex, int flag); +extern int checkIfOnlyAngel( int charaindex); +extern void selectAngel( int charaindex, int heroindex, int mission, int gm_cmd); +#endif +int CharaData( int sockfd, Char* ch ); +extern void GOLD_DeleteTimeCheckOne( int objindex); +extern int autopkstart; +extern int playeronlinenum; +extern int autopkcnt; +// WON ADD ߵ趨 +void fix_item_bug(int charaindex, int i); + + +/*====================ƽҷ¼====================*/ +/*------------------------------------------------------------ + * ݼëɬƷ£ + * ¦ + * ch Char* ɬƼƽҷ¼ + * option char* ͷʧ· + * ߯Ի + * TRUE + * FALSE + ------------------------------------------------------------*/ +static BOOL CHAR_makeCharFromOptionAtCreate( Char* ch , + int vital, int str, int tgh, int dex, + int earth, int water, int fire, int wind) +{ + + /* 뼰ë浤 */ + int para[4]; + int attr[4]; + int i; + int parasum,attrsum; + int cnt; + + para[0] = vital; + para[1] = str; + para[2] = tgh; + para[3] = dex; + + attr[0] = earth; + attr[1] = water; + attr[2] = fire; + attr[3] = wind; + +#define MAXPARAMETER 20 +#define PKMAXPARAMETER 300 + parasum = 0; + /* + * ͻ - ؤȻئئ + * ؤľëл ئ + */ + + for( i = 0; i < arraysizeof( para); i ++ ) { + if( para[i] < 0 || para[i] > MAXPARAMETER )return FALSE; + parasum += para[i]; + } +#ifdef _NEW_PLAYER_CF //ֳ + if( parasum > MAXPARAMETER ) return FALSE; +#else + if( parasum != MAXPARAMETER ) return FALSE; +#endif + +#undef MAXPARAMETER + + +#define MAXATTRIBUTE 10 + cnt = 0; + attrsum = 0; + /* 뼰ë */ + for( i = 0; i < arraysizeof( para); i ++ ) { + if( attr[i] < 0 || attr[i] > MAXATTRIBUTE )return FALSE; + attrsum += attr[i]; + if( attr[i] > 0 ) cnt ++; + } + /* Ͱ10 */ + if( attrsum != MAXATTRIBUTE ) return FALSE; + + /* 2ԻԻ񲻯ľ */ + if( cnt > 2 ) return FALSE; + + /* 뷴Ի񲻯ľئ */ + if( attr[0] > 0 && attr[2] > 0 ) return FALSE; + if( attr[1] > 0 && attr[3] > 0 ) return FALSE; + +#undef MAXATTRIBUTE + + /* */ + ch->data[CHAR_VITAL] = vital*100; + ch->data[CHAR_STR] = str*100; + ch->data[CHAR_TOUGH] = tgh*100; + ch->data[CHAR_DEX] = dex*100; + + ch->data[CHAR_EARTHAT] = attr[0] * 10; + ch->data[CHAR_WATERAT] = attr[1] * 10; + ch->data[CHAR_FIREAT] = attr[2] * 10; + ch->data[CHAR_WINDAT] = attr[3] * 10; +#ifdef _NEWOPEN_MAXEXP + ch->data[CHAR_OLDEXP] = 0; +#endif + ch->data[CHAR_EXP] = 0; + + +#ifdef _NEW_PLAYER_CF //ֳ + ch->data[CHAR_TRANSMIGRATION] = getNewplayertrans(); + ch->data[CHAR_GOLD] = getNewplayergivegold();; + ch->data[CHAR_LV] = getNewplayerlv(); +#ifdef _VIP_SERVER + ch->data[CHAR_AMPOINT] = getNewplayergivevip(); +#endif +// ch->data[CHAR_LEARNRIDE] = 200; +// ch->data[CHAR_LASTTALKELDER] = (rand()%10)>5?35:36;//34; +// ch->data[CHAR_SKILLUPPOINT] = 616;//600; +#ifdef _NEW_RIDEPETS + //ch->data[CHAR_LOWRIDEPETS] = 0xffffffff; +#endif +#endif + +#ifdef _PETSKILL_BECOMEPIG + ch->data[CHAR_BECOMEPIG] = -1; + ch->data[CHAR_BECOMEPIG_BBI] = 100250; +#endif + + ch->data[CHAR_LASTLEAVETIME] = 0; + + return TRUE; +} + +#ifdef _HELP_NEWHAND +void CHAR_loginAddItemForNew( int charindex ) +{ + int emptyitemindexinchara, itemindex; + int i; + char msgbuf[128]; + + for( i = 0; i < 15; i ++ ) { + emptyitemindexinchara = CHAR_findEmptyItemBox( charindex ); + + if( emptyitemindexinchara < 0 ){ + sprintf( msgbuf, "ռλ㡣" ); + + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + return; + } +#ifdef _NEW_PLAYER_CF + if(getNewplayergiveitem(i)==-1)continue; + itemindex = ITEM_makeItemAndRegist( getNewplayergiveitem(i) ); +#endif + if( itemindex != -1 ){ + CHAR_setItemIndex( charindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charindex); + CHAR_sendItemDataOne( charindex, emptyitemindexinchara); + } + } + print("Get New Hand Item"); +} +#endif + +void CHAR_createNewChar( int clifd, int dataplacenum, char* charname , + int imgno,int faceimgno, + int vital,int str,int tgh,int dex, + int earth,int water,int fire,int wind, + int hometown , char *cdkey ) +{ + + Char ch, *chwk; + int charaindex, petindex; + int enemyarray; + char szKey[256]; + +#ifdef _NEW_PLAYER_CF //ֳ + int add_pet[]={0,0,0,0,0}; +#endif + + memset(&ch,0,sizeof(Char)); + + if( !CHAR_checkPlayerImageNumber( imgno)) { + lssproto_CreateNewChar_send( clifd ,FAILED, "" ); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } + if( !CHAR_checkFaceImageNumber( imgno, faceimgno)) { + lssproto_CreateNewChar_send( clifd ,FAILED, "" ); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } + CHAR_getDefaultChar(&ch,imgno); + ch.data[CHAR_WALKINTERVAL] = getWalksendinterval(); + + if( CHAR_getInitElderPosition( &ch ,hometown) == FALSE ){ + lssproto_CreateNewChar_send( clifd ,FAILED, "" ); + CONNECT_setState( clifd, NOTLOGIN ); + return; + + }else if( MAP_checkCoordinates( ch.data[CHAR_FLOOR], ch.data[CHAR_X], + ch.data[CHAR_Y] ) == FALSE ){ + lssproto_CreateNewChar_send( clifd ,FAILED, ""); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } + strcpysafe( ch.string[CHAR_NAME].string , + sizeof(ch.string[CHAR_NAME].string), + charname); + + if( CHAR_getNewImagenumberFromEquip( imgno,0) == -1 ){ + lssproto_CreateNewChar_send( clifd ,FAILED, ""); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } + ch.data[CHAR_BASEIMAGENUMBER] = imgno; + ch.data[CHAR_BASEBASEIMAGENUMBER] = imgno; + ch.data[CHAR_FACEIMAGENUMBER] = faceimgno; + ch.data[CHAR_DATAPLACENUMBER] = dataplacenum; + +#ifdef _FM_JOINLIMIT + ch.data[CHAR_FMTIMELIMIT] = 0; +#endif + +#ifdef _NEWSAVE + ch.data[CHAR_SAVEINDEXNUMBER] = -1; +#endif + ch.data[CHAR_HP] = 0x7fffffff; + + ch.data[CHAR_CHARM] = 60; + ch.data[CHAR_MAXMP] = ch.data[CHAR_MP] = 100; + strcpysafe( ch.string[CHAR_CDKEY].string, + sizeof( ch.string[CHAR_CDKEY].string), cdkey ); + + // Robin 0724 + ch.data[CHAR_RIDEPET] = -1; +#ifdef _NEW_PLAYER_CF + ch.data[CHAR_LEARNRIDE] = getRidePetLevel(); +#endif +#ifdef _NEW_RIDEPETS + ch.data[CHAR_LOWRIDEPETS] = 0; +#endif + +#ifdef _PERSONAL_FAME // Arminius: + ch.data[CHAR_FAME] = 0; +#endif +#ifdef _NEW_MANOR_LAW + ch.data[CHAR_MOMENTUM] = 0; // +#endif +#ifdef _TEACHER_SYSTEM + ch.data[CHAR_TEACHER_FAME] = 0; // ʦ쵼 +#endif + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + ch.data[PROFESSION_CLASS] = 0; + ch.data[PROFESSION_LEVEL] = 0; +// ch.data[PROFESSION_EXP] = 0; + ch.data[PROFESSION_SKILL_POINT] = 0; + ch.data[ATTACHPILE] = 0; +#endif + +#ifdef _TEACHER_SYSTEM + memset(ch.string[CHAR_TEACHER_ID].string,0,sizeof(STRING128)); + memset(ch.string[CHAR_TEACHER_NAME].string,0,sizeof(STRING128)); +#endif + +#ifdef _ITEM_SETLOVER + memset(ch.string[CHAR_LOVERID].string,0,sizeof(STRING128)); + memset(ch.string[CHAR_LOVERNAME].string,0,sizeof(STRING128)); +#endif + +#ifdef _PETSKILL_BECOMEPIG + ch.data[CHAR_BECOMEPIG] = -1; + ch.data[CHAR_BECOMEPIG_BBI] = 100250; +#endif + + strcpysafe( ch.string[CHAR_FMNAME].string, + sizeof( ch.string[CHAR_FMNAME].string), "\0" ); + ch.data[CHAR_FMINDEX] = -1; +#ifdef _OFFLINE_SYSTEM + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int mon=1+p->tm_mon; + int date=p->tm_mday; + char offbuf[64]; + sprintf(offbuf,"%d-%d-%d",mon,date,0); + strcpysafe( ch.string[CHAR_OFFBUF].string, + sizeof( ch.string[CHAR_OFFBUF].string), offbuf ); + //ch.data[CHAR_OFFTIME] = 18000; + ch.data[CHAR_OFFTIME] = 1; +#endif + if( CHAR_makeCharFromOptionAtCreate( &ch, + vital,str,tgh,dex, + earth,water,fire,wind ) == FALSE ) + { + lssproto_CreateNewChar_send( clifd ,FAILED, + "option data is invalid\n"); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } + { + int mp=ch.data[CHAR_MAXMP]; + int str=ch.data[CHAR_STR]; + int tough=ch.data[CHAR_TOUGH]; + + ch.data[CHAR_INITDATA] = 2*100*100*100*100 /*+ hp*100*100*100*/ + + mp*100*100 + str* 100 + tough; + } + + charaindex = CHAR_initCharOneArray( &ch ); + if( charaindex == -1 ) { + lssproto_CreateNewChar_send( clifd ,FAILED, "޷"); + CONNECT_setState( clifd, NOTLOGIN ); + return; + } +#ifdef _ALLBLUES_LUA_1_5 + FreeCharCreate(charaindex); +#endif +#ifdef _NEW_PLAYER_CF //ֳ + int petNum=0; + int k=0; + int mylevel,level; + if(getNewplayergivepet(0)==-1){ + if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER) == 1 )//˿ + setNewplayergivepet(0,2); + else if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER) == 2 )//Ӽ + setNewplayergivepet(0,3); + else if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER) == 3 )//³ + setNewplayergivepet(0,4); + else + setNewplayergivepet(0,1); + } +#ifdef _NEW_PLAYER_RIDE + if(!strstr( getPlayerRide(), "")) + CHAR_PlayerRide(charaindex); +#endif + for( petNum=0; petNum<5; petNum++) { + if(getNewplayergivepet(petNum)==0)continue; + enemyarray = ENEMY_getEnemyArrayFromId( getNewplayergivepet(petNum)); //׻ + petindex = ENEMY_createPetFromEnemyIndex( charaindex, enemyarray); + if( petindex == -1 ) { + continue; + } + add_pet[petNum]=petindex; + mylevel = CHAR_getInt( petindex, CHAR_LV); + level = getNewplayerpetlv()-mylevel; + if(level<1)level=1; + for( k = 1; k < level; k ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + CHAR_setInt( petindex , CHAR_VARIABLEAI , 10000 ); + CHAR_complianceParameter( petindex ); + CHAR_setInt( petindex , CHAR_HP , CHAR_getWorkInt( petindex , CHAR_WORKMAXHP ) ); + } + setNewplayergivepet(0,-1); +#endif + +#ifdef _HELP_NEWHAND + CHAR_loginAddItemForNew(charaindex); +#endif + +#if 1 + if( CHAR_makeDBKey( charaindex, szKey, sizeof( szKey ) ) != FALSE ){ + int dp; + char info[512]; + snprintf( info, sizeof( info), + "%d,%d,%d,%d,%d,%d", + CHAR_getInt( charaindex, CHAR_LV), + CHAR_getInt( charaindex, CHAR_DUELBATTLECOUNT), + CHAR_getInt( charaindex, CHAR_DUELWINCOUNT), + CHAR_getInt( charaindex, CHAR_DUELLOSECOUNT), + CHAR_getInt( charaindex, CHAR_DUELSTWINCOUNT), + CHAR_getInt( charaindex, CHAR_DUELMAXSTWINCOUNT)); + dp = CHAR_getInt( charaindex, CHAR_DUELPOINT ); + saacproto_DBUpdateEntryInt_send( + acfd, + DB_DUELPOINT, + szKey, + (max(dp,0)), + info, + CONNECT_getFdid(clifd ),0 ); + } +#endif + chwk = CHAR_getCharPointer( charaindex); + + CHAR_charSaveFromConnectAndChar( clifd,chwk ,FALSE ); + + CHAR_endCharData(&ch); + CHAR_endCharOneArray( charaindex); +#ifdef _NEW_PLAYER_CF //ֳ + { + int k=0; + for( k=0;kcharfunctable[i].string, + sizeof( ch->charfunctable[i]), + tmp[i]); + } +} + +void CHAR_loginAddItem( int charaindex ) +{ +/* + int emptyindex, itemindex, id; + int itemID[10]={ 20128, 20130, 20171, 20176, 20296, + 20287, 20288, 20289, 20290, 20291}; + + { + int trn_num=0; + trn_num=CHAR_getInt(charaindex,CHAR_TRANSMIGRATION); + CHAR_setInt( charaindex, CHAR_MAXPOOLITEMHAVELIMIT, 10 + (trn_num * 4) ) ; + CHAR_setInt( charaindex, CHAR_MAXPOOLPETHAVELIMIT , 5 + (trn_num * 2) ); + } + while( 1){ + emptyindex = CHAR_findEmptyItemBox( charaindex ); + if( emptyindex == -1 ) break; + id = rand()%10; + itemindex = ITEM_makeItemAndRegist( itemID[id] ); + if( !ITEM_CHECKINDEX( itemindex) ) break; + CHAR_setItemIndex( charaindex, emptyindex, itemindex); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charaindex); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + //andy_log + print("@:%d.", emptyindex); + } + while( 1){ + emptyindex = CHAR_findEmptyPoolItemBox( charaindex ); + if( emptyindex == -1 ) break; + id = rand()%10; + itemindex = ITEM_makeItemAndRegist( itemID[id] ); + if( !ITEM_CHECKINDEX( itemindex) ) break; + + CHAR_setPoolItemIndex( charaindex, emptyindex, itemindex); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charaindex); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + //andy_log + print("&:%d.", emptyindex); + } +*/ +} + +void CHAR_loginCheckUserItem( int charaindex) +{ + typedef void (*ATTACHFUNC)(int,int); + int i, j, itemindex; + int ID1,ID2; + char* delbuf; + char delitembuf[10]; + delbuf = getDelItem(); + int myviptype = CHAR_getInt(charaindex,CHAR_VIPRIDE); + for( i=0; i=23228 && ID1<=23307){ + if(strstr(ITEM_getChar(itemindex,ITEM_EFFECTSTRING),"")==NULL){ + ITEM_setChar(itemindex,ITEM_EFFECTSTRING,"[ԣ]뵽峤(13.5)Ҹʦ"); + } + } + if(((ID1>=3000 && ID1<=11719) || (ID1>=14001 && ID1<=18530)) && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE)<1){ + int maxcrushe = ITEMTBL_getInt(ID1,ITEM_MAXDAMAGECRUSHE); + ITEM_setInt(itemindex,ITEM_MAXDAMAGECRUSHE,maxcrushe); + ITEM_setInt(itemindex,ITEM_DAMAGECRUSHE,maxcrushe); + } +#endif + if(myviptype==0){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP")!=NULL){ + CHAR_setItemIndex( charaindex , i, -1); + } + }else if(myviptype==1){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP2]")!=NULL || strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL){ + CHAR_setItemIndex( charaindex , i, -1); + } + }else if(myviptype==2){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL ){ + CHAR_setItemIndex( charaindex , i, -1); + } + } +#ifdef _JK_CF_DELPETITEM //ɾCFָƷ + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delitembuf, sizeof(delitembuf)) == FALSE) + break; + ID2 = atoi(delitembuf); + if(ID2 == -1)break; + if( ID1 == ID2){ + CHAR_setItemIndex( charaindex , i, -1); + LogItem(CHAR_getChar( charaindex, CHAR_NAME ), // + CHAR_getChar( charaindex, CHAR_CDKEY ), //ʺ +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "CFƷ", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_talkToCli( charaindex, -1, "ϵͳϵĵ", CHAR_COLORWHITE ); + } + } +#endif + +#ifdef _ANGEL_SUMMON + if( ITEM_getInt( itemindex, ITEM_ID) == ANGELITEM + || ITEM_getInt( itemindex, ITEM_ID) == HEROITEM ) { + int mindex, mission; + // Ƿ + mindex = checkIfAngelByName( ITEM_getChar( itemindex, ITEM_ANGELINFO)); + mission = atoi( ITEM_getChar( itemindex, ITEM_ANGELMISSION)); + if( mindex < 0 || mission != missiontable[mindex].mission ) { + CHAR_setItemIndex( charaindex, i, -1 ); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( charaindex, i); + continue; + } + + if( ITEM_getInt( itemindex, ITEM_ID) == ANGELITEM ) { + char nameinfo[128]; + getMissionNameInfo( charaindex, nameinfo); + // ʹװ + if( !strcmp( ITEM_getChar( itemindex, ITEM_ANGELINFO), nameinfo) ) { + //CHAR_setWorkInt( charaindex, CHAR_WORKANGELMODE, TRUE); + CHAR_sendAngelMark( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), 1); + } + } + } +#endif + //Change fix 2004/07/05 + //ְҵϵĵ////////////////// + if( ITEM_getInt( charaindex, ITEM_NEEDPROFESSION) != 0 ){ + if( CHAR_getInt( charaindex, PROFESSION_CLASS ) != ITEM_getInt( itemindex, ITEM_NEEDPROFESSION) + && ITEM_getInt( itemindex, ITEM_NEEDPROFESSION) > 0 ){ + if( (ti = CHAR_findEmptyItemBox( charaindex )) != -1 ){ + CHAR_setItemIndex( charaindex , i, -1); + CHAR_setItemIndex( charaindex , ti, itemindex); + } + continue; + } + } + //////////////////////////////////////////// + + + if( (i == ITEM_getEquipPlace( charaindex, itemindex )) || + i == CHAR_DECORATION1 || i == CHAR_DECORATION2 ){ + char category[256]; + ATTACHFUNC atf; + atf=(ATTACHFUNC)ITEM_getFunctionPointer(itemindex,ITEM_ATTACHFUNC); + if( atf ){ + atf( charaindex, itemindex ); + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + RunItemAttachEvent(charaindex, itemindex ); + } +#endif + + if( ITEM_canuseMagic( itemindex)) { + snprintf( category, sizeof( category), "J%d",i); + CHAR_sendStatusString( charaindex, category ); + } + }else{ + if( (ti = CHAR_findEmptyItemBox( charaindex )) == -1 ) continue; + CHAR_setItemIndex( charaindex , i, -1); + CHAR_setItemIndex( charaindex , ti, itemindex); + } + + } + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ //Я + itemindex = CHAR_getItemIndex( charaindex , i ); + if( !ITEM_CHECKINDEX( itemindex)) continue; + ITEM_reChangeItemName( itemindex); +#ifdef _ITEM_PILENUMS + ITEM_reChangeItemToPile( itemindex); +#endif + + ID1 = ITEM_getInt( itemindex, ITEM_ID); +#ifdef _YUANGUSA + if(ID1>=23228 && ID1<=23307){ + if(strstr(ITEM_getChar(itemindex,ITEM_EFFECTSTRING),"")==NULL){ + ITEM_setChar(itemindex,ITEM_EFFECTSTRING,"[ԣ]뵽峤(13.5)Ҹʦ"); + } + } + if(((ID1>=3000 && ID1<=11719) || (ID1>=14001 && ID1<=18530)) && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE)<1){ + int maxcrushe = ITEMTBL_getInt(ID1,ITEM_MAXDAMAGECRUSHE); + ITEM_setInt(itemindex,ITEM_MAXDAMAGECRUSHE,maxcrushe); + ITEM_setInt(itemindex,ITEM_DAMAGECRUSHE,maxcrushe); + } +#endif + if(myviptype==0){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP")!=NULL){ + CHAR_setItemIndex( charaindex , i, -1); + } + }else if(myviptype==1){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP2]")!=NULL || strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL){ + CHAR_setItemIndex( charaindex , i, -1); + } + }else if(myviptype==2){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL ){ + CHAR_setItemIndex( charaindex , i, -1); + } + } +#ifdef _JK_CF_DELPETITEM //ɾCFָƷ + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delitembuf, sizeof(delitembuf)) == FALSE) + break; + ID2 = atoi(delitembuf); + if(ID2 == -1)break; + if( ID1 == ID2){ + CHAR_setItemIndex( charaindex , i, -1); + LogItem(CHAR_getChar( charaindex, CHAR_NAME ), // + CHAR_getChar( charaindex, CHAR_CDKEY ), //ʺ +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "CFƷ", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_talkToCli( charaindex, -1, "ϵͳϵĵ", CHAR_COLORWHITE ); + } + } +#endif + +#ifdef _ANGEL_SUMMON + if( ITEM_getInt( itemindex, ITEM_ID) == ANGELITEM + || ITEM_getInt( itemindex, ITEM_ID) == HEROITEM ) { + int mindex, mission; + // Ƿ + mindex = checkIfAngelByName( ITEM_getChar( itemindex, ITEM_ANGELINFO)); + mission = atoi( ITEM_getChar( itemindex, ITEM_ANGELMISSION)); + if( mindex < 0 || mission != missiontable[mindex].mission ) { + CHAR_setItemIndex( charaindex, i, -1 ); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( charaindex, i); + continue; + } + } +#endif + ITEM_setItemUniCode( itemindex); + + } + //ķŵ + for( i = 0 ; i < CHAR_MAXPOOLITEMHAVE ; i++ ){ + itemindex = CHAR_getPoolItemIndex( charaindex , i ); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + + ITEM_reChangeItemName( itemindex); +#ifdef _ITEM_PILENUMS + ITEM_reChangeItemToPile( itemindex); +#endif + + ID1 = ITEM_getInt( itemindex, ITEM_ID); +#ifdef _YUANGUSA + if(ID1>=23228 && ID1<=23307){ + if(strstr(ITEM_getChar(itemindex,ITEM_EFFECTSTRING),"")==NULL){ + ITEM_setChar(itemindex,ITEM_EFFECTSTRING,"[ԣ]뵽峤(13.5)Ҹʦ"); + } + } + if(((ID1>=3000 && ID1<=11719) || (ID1>=14001 && ID1<=18530)) && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE)<1){ + int maxcrushe = ITEMTBL_getInt(ID1,ITEM_MAXDAMAGECRUSHE); + ITEM_setInt(itemindex,ITEM_MAXDAMAGECRUSHE,maxcrushe); + ITEM_setInt(itemindex,ITEM_DAMAGECRUSHE,maxcrushe); + } +#endif + if(myviptype==0){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP")!=NULL){ + CHAR_setPoolItemIndex( charaindex , i, -1); + } + }else if(myviptype==1){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP2]")!=NULL || strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL){ + CHAR_setPoolItemIndex( charaindex , i, -1); + } + }else if(myviptype==2){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL ){ + CHAR_setPoolItemIndex( charaindex , i, -1); + } + } +#ifdef _JK_CF_DELPETITEM //ɾCFָƷ + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delitembuf, sizeof(delitembuf)) == FALSE) + break; + ID2 = atoi(delitembuf); + if(ID2 == -1)break; + if( ID1 == ID2){ + CHAR_setPoolItemIndex( charaindex , i, -1); + LogItem(CHAR_getChar( charaindex, CHAR_NAME ), // + CHAR_getChar( charaindex, CHAR_CDKEY ), //ʺ +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "CFƷ", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_talkToCli( charaindex, -1, "ϵͳķŵĵ", CHAR_COLORWHITE ); + } + } +#endif + +#ifdef _ANGEL_SUMMON + if( ITEM_getInt( itemindex, ITEM_ID) == ANGELITEM + || ITEM_getInt( itemindex, ITEM_ID) == HEROITEM ) { + int mindex, mission; + // Ƿ + mindex = checkIfAngelByName( ITEM_getChar( itemindex, ITEM_ANGELINFO)); + mission = atoi( ITEM_getChar( itemindex, ITEM_ANGELMISSION)); + if( mindex < 0 || mission != missiontable[mindex].mission ) { + CHAR_setPoolItemIndex( charaindex, i, -1 ); + ITEM_endExistItemsOne( itemindex); + continue; + } + } +#endif + + ITEM_setItemUniCode( itemindex); + } + + // WON ADD ߵ趨 + if(!NPC_EventCheckFlg( charaindex,134)){ + for (i = 0; i < CHAR_MAXITEMHAVE; i ++) { + itemindex = CHAR_getItemIndex(charaindex, i); + fix_item_bug(charaindex, itemindex); + } + for (i = 0; i < CHAR_MAXPOOLITEMHAVE; i++) { + itemindex = CHAR_getPoolItemIndex(charaindex, i); + fix_item_bug(charaindex, itemindex); + } + NPC_EventSetFlg(charaindex, 134); + } +} +void CHAR_LoginBesideSetWorkInt( int charaindex, int clifd) +{ + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYMODE, CHAR_PARTY_NONE); + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX1, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX2, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX3, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX4, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX5, -1); + + CHAR_setWorkInt( charaindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CHAR_setWorkInt( charaindex, CHAR_WORKFMINDEXI, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMCHANNEL, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMCHANNELQUICK, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMFLOOR, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMDP, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKFMPKFLAG, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMSETUPFLAG, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMMANINDEX, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFMCHARINDEX, -1); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEFLAG, -1); + CHAR_setWorkInt( charaindex, CHAR_WORK_PET0_STAT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORK_PET1_STAT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORK_PET2_STAT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORK_PET3_STAT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORK_PET4_STAT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKEFFECT, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKFD, clifd); + + + if( CHAR_getInt( charaindex, CHAR_SILENT) > 100000000 ) + CHAR_setInt( charaindex, CHAR_SILENT, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKLOGINTIME, (int)NowTime.tv_sec); + CHAR_setWorkInt( charaindex, CHAR_WORKTALKCOUNT, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKTALKTIME, (int)NowTime.tv_sec); + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1); + CHAR_setWorkInt( charaindex, CHAR_LASTCHARSAVETIME, (int)NowTime.tv_sec); +#ifdef _STATUS_WATERWORD //ˮ״̬ + if( MAP_getMapFloorType( CHAR_getInt( charaindex, CHAR_FLOOR)) == 1 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKMAPFLOORTYPE, 1); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKMAPFLOORTYPE, 0); + } +#endif +#ifdef _NEWOPEN_MAXEXP + if( CHAR_getInt( charaindex, CHAR_OLDEXP) > 0 || CHAR_getInt( charaindex, CHAR_OLDEXP) < 0 ){ + CHAR_ChangeExp( charaindex); + } +#endif +#ifdef _PETSKILL_BECOMEFOX + CHAR_setWorkInt( charaindex, CHAR_WORKFOXROUND, -1 ); +#endif +#ifdef _MAP_TIME + CHAR_setWorkInt(charaindex,CHAR_WORK_MAP_TIME,0); +#endif +#ifdef _PETSKILL_LER + CHAR_setWorkInt(charaindex,CHAR_WORK_RELIFE,0); +#endif +#ifdef _NO_DROPITEM + CHAR_setWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX,-1); +#endif +} + +void CHAR_CheckProfessionSkill( int charaindex) +{ + int i, Pclass, skpoint=0, mynum=0; + CHAR_HaveSkill *pSkil; + + if( NPC_EventCheckFlg( charaindex, 155) ) return; + + Pclass = CHAR_getInt( charaindex, PROFESSION_CLASS ); + skpoint = CHAR_getInt( charaindex, PROFESSION_SKILL_POINT); + if( Pclass == PROFESSION_CLASS_NONE )return; + + + for( i=0; iskill, 0, 0 ); + pSkil->use = 0; + break; + case 64: + CHAR_setInt( charaindex, CHAR_MAXMP, 100); + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, skpoint+1 ); + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + break; + case 65: + CHAR_setInt( charaindex, ATTACHPILE, 0); + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, skpoint+1 ); + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + break; + } + } + { + int myskillpoint, myskillnum=0, myskilllevel; + int mysknum=0; + + myskillpoint= CHAR_getInt( charaindex, PROFESSION_SKILL_POINT ); + myskilllevel= CHAR_getInt( charaindex, PROFESSION_LEVEL ); + + for( i=0; i 0 ){ + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, myskillpoint + mysknum ); + }else if( mysknum < 0 ){ + int defsknum = (myskillpoint + myskillnum)-myskilllevel; + while( 1){ + if( defsknum<= 0 || + (myskillpoint= CHAR_getInt( charaindex, PROFESSION_SKILL_POINT )) <= 0 ) break; + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, myskillpoint-1); + defsknum--; + } + } + } + + NPC_EventSetFlg( charaindex, 155); +} + +void CHAR_ResetPoolPetEgg( int charaindex) +{ + int levelup, vital, str, tgh, dex; + int raise, petindex, i; + + + if( NPC_EventCheckFlg( charaindex, 157) ) return; + + for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { + petindex = CHAR_getCharPoolPet( charaindex, i); + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) != 1 || + CHAR_getInt( petindex, CHAR_FUSIONRAISE) <= 0 ) continue; + + raise = CHAR_getInt( petindex, CHAR_FUSIONRAISE); + raise--; + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time(NULL)+PETFEEDTIME); + if( raise < 1 ) raise = 1; + if( raise >= 40 ) raise = 30; + CHAR_setInt( petindex, CHAR_FUSIONRAISE, raise); + + levelup = CHAR_getInt( petindex, CHAR_ALLOCPOINT); + vital = ((levelup>>24) & 0xFF) + 4; + str = ((levelup>>16) & 0xFF) + 4; + tgh = ((levelup>> 8) & 0xFF) + 4; + dex = ((levelup>> 0) & 0xFF) + 4; + if( vital < 0 ) vital = 0; + if( str < 0 ) str = 0; + if( tgh < 0 ) tgh = 0; + if( dex < 0 ) dex = 0; + // + levelup = (vital<<24) + (str<<16) + (tgh<<8) + (dex<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, levelup); + } + NPC_EventSetFlg( charaindex, 157); +} + +// Robin add 走ιʱ +void CHAR_ResetPetEggFusionTime(int charaindex) +{ + int i, petindex; + int nowTime =0; + //int leaveTime =0; + //int lastFeedTime =0; + //int anhour = PETFEEDTIME; + + //if( NPC_EventCheckFlg( charaindex, 157) ) return; + + nowTime = (int)time(NULL); + //leaveTime = CHAR_getInt( charaindex, CHAR_LASTLEAVETIME); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + petindex = CHAR_getCharPet( charaindex, i); + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) != 1 || + CHAR_getInt( petindex, CHAR_FUSIONRAISE) <= 0 ) continue; + + //lastFeedTime = CHAR_getInt( petindex, CHAR_FUSIONTIMELIMIT); + //if( leaveTime > 0) { + // CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, nowTime- (leaveTime-lastFeedTime)); + //} + //else + // CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, nowTime); + + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, nowTime); + + } + + //NPC_EventSetFlg( charaindex, 157); + +} + + +BOOL CHAR_CheckProfessionEquit( int toindex) +{ + int i, j, itemindex, newindex; + int FixItem[16]={ + 2028,2029,2030,2031,2032,2033,2034,2035, + 2036,2037,2038,2039,2040,2041,2042,2043 + }; + CHAR_HaveSkill *pSkil; + + if(!NPC_EventCheckFlg( toindex, 149)){ + for (i = 0; i < CHAR_MAXITEMHAVE; i ++) { + itemindex = CHAR_getItemIndex( toindex, i); + if( !ITEM_CHECKINDEX( itemindex)) continue; + + for( j=0; j<16; j++){ + if( ITEM_getInt( itemindex, ITEM_ID) == FixItem[j] ){ + CHAR_setItemIndex( toindex, i, -1 ); + ITEM_endExistItemsOne( itemindex); + newindex = ITEM_makeItemAndRegist( FixItem[j]); + if( !ITEM_CHECKINDEX( newindex) ) break; + CHAR_setItemIndex( toindex , i, newindex); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, toindex); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + + CHAR_sendItemDataOne( toindex, i); + + } + } + } + + for (i = 0; i < CHAR_MAXPOOLITEMHAVE; i++){ + int itemindex = CHAR_getPoolItemIndex(toindex, i); + if( !ITEM_CHECKINDEX( itemindex)) continue; + for( j=0; j<16; j++){ + if( ITEM_getInt( itemindex, ITEM_ID) == FixItem[j] ){ + CHAR_setPoolItemIndex( toindex, i, -1); + ITEM_endExistItemsOne( itemindex); + + newindex = ITEM_makeItemAndRegist( FixItem[j]); + if( !ITEM_CHECKINDEX( newindex) ) break; + CHAR_setPoolItemIndex( toindex , i, newindex); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, toindex); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + + } + } + } + + NPC_EventSetFlg( toindex, 149); + } + + + if( NPC_EventCheckFlg( toindex, 156) ) return TRUE; + + // WON ADD + for( i=0; i 0 ) continue; + + pSkil = CHAR_getCharHaveSkill( toindex, i ); + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + } + { + int myskillpoint= CHAR_getInt( toindex, PROFESSION_SKILL_POINT ); + int myskilllevel= CHAR_getInt( toindex, PROFESSION_LEVEL ); + int myskillnum = 0, mysknum = 0; + + for( i=0; i 0 ){ + CHAR_setInt( toindex, PROFESSION_SKILL_POINT, myskillpoint + mysknum ); + } + } + + { + Skill work1[PROFESSION_MAX_LEVEL]; + int cnt=0; + for( i=0; iuse = 0; + if( work1[i].data[SKILL_IDENTITY] == -1 ) continue; + SKILL_makeSkillData( &pSkil->skill, work1[i].data[SKILL_IDENTITY], work1[i].data[SKILL_LEVEL] ); + pSkil->use = 1; + } + } + + NPC_EventSetFlg( toindex, 156); + + return TRUE; +} + +static void CHAR_setLuck( int charaindex); + +#ifdef _CHANNEL_MODIFY +extern int *piOccChannelMember; +#endif +void CHAR_login( int clifd, char* data, int saveindex ) +{ + int charaindex,objindex; + Char ch; + int per; +// char c_temp2[4096]; + if( CHAR_makeCharFromStringToArg( data , &ch ) == FALSE ){ + fprint ("\n"); + goto MAKECHARDATAERROR; + } + CHAR_setCharFuncTable( &ch); + charaindex = CHAR_initCharOneArray( &ch ); + if( charaindex == -1 ){ + fprint ("\n"); + CHAR_endCharData(&ch); + goto MAKECHARDATAERROR; + } +#ifdef _NEWSAVE + CHAR_setInt( charaindex, CHAR_SAVEINDEXNUMBER, saveindex); + print("浵װ:%d\n", CHAR_getInt( charaindex, CHAR_SAVEINDEXNUMBER) ); +#endif + + char cdkey[16]; + char passwd[16]; + CONNECT_getCdkey( clifd, cdkey, sizeof( cdkey )); + CONNECT_getPasswd( clifd, passwd, sizeof(passwd)); + + if(strcmp(cdkey,CHAR_getChar( charaindex, CHAR_CDKEY))!=0){ +// print( "˺%s=>%s\n",CHAR_getChar( charaindex, CHAR_CDKEY),cdkey); +// CHAR_setChar( charaindex, CHAR_CDKEY, cdkey); + print( "˺%s뵵˺%sͬ",cdkey,CHAR_getChar( charaindex, CHAR_CDKEY)); + goto DELETECHARDATA; + } + if(CHAR_getInt(charaindex,CHAR_LOCK)==1 && strstr(cdkey,passwd)!=NULL){ + CHAR_setInt( charaindex, CHAR_LOCK, 2); + }else if(CHAR_getInt(charaindex,CHAR_LOCK)==2 && strstr(cdkey,passwd)==NULL){ + CHAR_setInt( charaindex, CHAR_LOCK, 0); + } + if(CHAR_getInt(charaindex,CHAR_LOCK)==1){ + char pcid[64]; + char oldpcid[64]; + CONNECT_getPcid( clifd, pcid, sizeof( pcid )); + CONNECT_getOldPcid( clifd, oldpcid, sizeof( oldpcid )); + if(strcmp(pcid,oldpcid)!=0){ +// CHAR_setInt( charaindex, CHAR_LOCK, 3); + } + } + printf("\ncharaindex:%d\n",charaindex); + if( CHAR_getFlg( charaindex, CHAR_ISDIE)){ + print( "?data? ISDIE flg is standing.\n"); + CHAR_setFlg( charaindex, CHAR_ISDIE, FALSE); + } +#ifdef _ALLBLUES_LUA_1_5 + FreeCharLogin(charaindex); +#endif + +#ifndef _FIX_UNNECESSARY + // Arminius 7.9 airplane logout + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { + int oyaindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( oyaindex)) { + if (CHAR_getInt( oyaindex, CHAR_WHICHTYPE ) == CHAR_TYPEBUS) { + if ((CHAR_getInt( oyaindex, CHAR_BASEIMAGENUMBER) !=100355) && + (CHAR_getInt( oyaindex, CHAR_BASEIMAGENUMBER) !=100461)) { + + if(CHAR_getWorkInt(oyaindex,CHAR_NPCWORKINT5)==1) { + if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER)>=0){ + int fl,x,y; + CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), &fl, &x, &y ); + CHAR_setInt(charaindex,CHAR_FLOOR,fl); + CHAR_setInt(charaindex,CHAR_X,x); + CHAR_setInt(charaindex,CHAR_Y,y); + } + } + } + } + } + } +#endif + +// Nuke 20040420: CHECK MAX POINT + +#if 1 + { + if(CHAR_getInt(charaindex,CHAR_SUPER)==0) + { + int lv,vi,str,tou,dx,skup,trn,teq,quest,level,total,max; + float table[]={437,490,521,550,578,620,700,800,900}; //תߵ(10) + //float table[]={620,660,700,740,780,820}; //תߵ(10) + lv = CHAR_getInt(charaindex,CHAR_LV); + vi = CHAR_getInt(charaindex,CHAR_VITAL); + str = CHAR_getInt(charaindex,CHAR_STR); + tou = CHAR_getInt(charaindex,CHAR_TOUGH); + dx = CHAR_getInt(charaindex,CHAR_DEX); + trn = CHAR_getInt(charaindex,CHAR_TRANSMIGRATION); + teq = CHAR_getInt(charaindex,CHAR_TRANSEQUATION); + skup = CHAR_getInt(charaindex,CHAR_SKILLUPPOINT); + quest=(teq >> 16)& 0xFF; + level=teq & 0xFFF; + total=(vi+str+tou+dx)/100+skup; +// max=(trn==0)?(lv-1)*3+20+10: // 0ת447 +// (lv-1)*3+table[trn-1]/12.0+quest/4.0+(level-trn*85)/4.0+10+1+10+trn*10; +/* + print(":%d\n",(lv-1)*getSkup()); + print("̳е:%f\n",(table[trn-1]/12.0)); + print("ʷ:%f\n",quest/4.0); + print("ʷȼ:%f\n",(level-trn*85)/4.0); + print("ʷȼ:%d/%d\n",level,trn*85); + print("תǰף:%d\n",getTransPoint(trn)); + print("1:%d\n",1); + print("תף:%d\n",getTransPoint(trn)); + print("ת:%d\n",trn*10); +*/ +#ifdef _REVLEVEL + if (strcmp(getRevLevel(),"")==0){ + if(trn>=getChartrans()){ + if(lv>getMaxLevel()){ + lv=getMaxLevel(); + print("[%s:%s]lv:%d->%d", + CHAR_getChar(charaindex,CHAR_CDKEY), + CHAR_getChar(charaindex,CHAR_NAME), + CHAR_getInt(charaindex,CHAR_LV), + getMaxLevel()); + } + }else if(lv>getYBLevel()){ + lv=getYBLevel(); + print("[%s:%s]lv:%d->%d", + CHAR_getChar(charaindex,CHAR_CDKEY), + CHAR_getChar(charaindex,CHAR_NAME), + CHAR_getInt(charaindex,CHAR_LV), + getMaxLevel()); + } + CHAR_setInt(charaindex,CHAR_LV,lv); + } +#endif + float jxds=(level-trn*85)/4.0; + if(jxds<0)jxds=0; +#ifdef _SKILLUPPOINT_CF + max=(trn==0)?getTransPoint(trn)+(lv-1)*getSkup()+20: + getTransPoint(trn)+(lv-1)*getSkup()+table[trn-1]/12.0+quest/4.0+jxds+getTransPoint(trn)+ trn*10+1; +// max=getTransPoint(trn); +#else + max=(trn==0)?(lv-1)*3+20+10: // 0ת447 + (lv-1)*3+table[trn-1]/12.0+quest/4.0+(level-trn*85)/4.0+10+1+10+trn*10; +#endif +/* 1ת=+̳е+ʷ+ʷȼ+תǰף+1+תף+ת */ +// if (trn==6) max=max-20; /* תʱûתǰףתף */ +#ifdef _REVLEVEL + if (total>max && strcmp(getPoint(),"")==0) +#else + if (total>max ) +#endif + { + print("\nص[%s:%s]:%d->%d ", + CHAR_getChar(charaindex,CHAR_CDKEY), + CHAR_getChar(charaindex,CHAR_NAME), + total,max); + CHAR_setInt(charaindex,CHAR_VITAL,1000); + CHAR_setInt(charaindex,CHAR_STR,0); + CHAR_setInt(charaindex,CHAR_TOUGH,0); + CHAR_setInt(charaindex,CHAR_DEX,0); + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT,max-10); + } + // ת֮ +/* if ((trn==6) && (total < max)) + { + print("\n[%s:%s]:%d->%d ", + CHAR_getChar(charaindex,CHAR_CDKEY), + CHAR_getChar(charaindex,CHAR_NAME), + total,max); + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT, + CHAR_getInt(charaindex,CHAR_SKILLUPPOINT)+(max-total)); + }*/ + } +#ifdef _SUPERMAN_FIX + else{ + if(getSuperManPoint()>-1){ + int superpoint; + superpoint = (CHAR_getInt(charaindex,CHAR_VITAL)+CHAR_getInt(charaindex,CHAR_STR)+CHAR_getInt(charaindex,CHAR_TOUGH)+CHAR_getInt(charaindex,CHAR_DEX))/100 + CHAR_getInt(charaindex,CHAR_SKILLUPPOINT); + if(superpoint < getSuperManPoint()){ + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT,CHAR_getInt(charaindex,CHAR_SKILLUPPOINT)+(getSuperManPoint()-superpoint)); + }else if(superpoint > getSuperManPoint()){ + CHAR_setInt(charaindex,CHAR_VITAL,1000); + CHAR_setInt(charaindex,CHAR_STR,0); + CHAR_setInt(charaindex,CHAR_TOUGH,0); + CHAR_setInt(charaindex,CHAR_DEX,0); + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT,getSuperManPoint()-10); + } + } + } +#endif + } +#endif + + { + int EQ_BBI=-1, EQ_ARM=-1, EQ_NUM=-1, EQ_BI=-1; + int CH_BI = CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER); + + EQ_BBI = CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER); + if(CH_BI != EQ_BBI){ + EQ_ARM = CHAR_getItemIndex(charaindex,CHAR_ARM); + EQ_NUM=ITEM_FIST; + if ( ITEM_CHECKINDEX( EQ_ARM)) { + EQ_NUM=ITEM_getInt(EQ_ARM,ITEM_TYPE); + } + + EQ_BI=CHAR_getNewImagenumberFromEquip( EQ_BBI, EQ_NUM); + + if( CHAR_getInt( charaindex, CHAR_RIDEPET) == -1 ) { // + if( EQ_BI != CH_BI ) { + print("\n %d [%d=>%d]", charaindex, + CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER), + EQ_BI ); + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, EQ_BI); + } + } + } + } + { + int x,y; + if( CHAR_isAppearPosition( CHAR_getInt( charaindex, CHAR_FLOOR),&x, &y )) { + int flelder, xelder, yelder; + CHAR_getElderPosition(CHAR_getInt(charaindex, CHAR_LASTTALKELDER), + &flelder, &xelder, &yelder); + CHAR_setInt(charaindex, CHAR_FLOOR, flelder); + CHAR_setInt(charaindex, CHAR_X, xelder); + CHAR_setInt(charaindex, CHAR_Y, yelder); + } + } + +#ifdef _FIX_GAMBLENUM + { + if( CHAR_getInt(charaindex, CHAR_GAMBLENUM) < 0){ + CHAR_setInt(charaindex, CHAR_GAMBLENUM, 0); + } + } +#endif + +#ifdef _MAP_NOEXIT + { + int exfloor=-1,ex_X=-1,ex_Y=-1; + int map_type=0; + unsigned int point; + point = MAP_getExFloor_XY( CHAR_getInt(charaindex, CHAR_FLOOR) , &map_type); + if( point > 0 ) { + if( CHAR_getInt( charaindex, CHAR_LASTTALKELDER) >= 0 ) { + CHAR_getElderPosition(CHAR_getInt(charaindex, CHAR_LASTTALKELDER), + &exfloor, &ex_X, &ex_Y); + } + if( map_type >= 0 ) { // map_type >= 0 Ȼؼ¼ + if( exfloor == map_type && exfloor >= 0 ) {//ؼ¼ + }else { + exfloor = (point>>16)&0xffffff; + ex_X = (point>>8)&0xff; + ex_Y = (point>>0)&0xff; + } + } + if( CHECKFLOORID( exfloor) ) { //鷿 + CHAR_setInt(charaindex, CHAR_FLOOR, exfloor); + CHAR_setInt(charaindex, CHAR_X, ex_X); + CHAR_setInt(charaindex, CHAR_Y, ex_Y); + } + } + } +#endif + if( CHAR_getInt(charaindex,CHAR_X) < 0 || CHAR_getInt(charaindex,CHAR_Y) < 0 ){ + CHAR_setInt(charaindex,CHAR_X,1); + CHAR_setInt(charaindex,CHAR_Y,1); + } +#ifdef _MAP_TIME + // ĵͼЩŵĻ,ص + if(CHAR_getInt(charaindex,CHAR_FLOOR) >= 30017 && CHAR_getInt(charaindex, CHAR_FLOOR) <= 30021){ + CHAR_setInt(charaindex,CHAR_FLOOR,30008); + CHAR_setInt(charaindex,CHAR_X,39); + CHAR_setInt(charaindex,CHAR_Y,38); + } +#endif +//LUA + CHAR_setInt(charaindex,CHAR_LUASAVE_WORKINT_1,0);// + CHAR_setInt(charaindex,CHAR_LUASAVE_WORKINT_2,0);// + CHAR_setInt(charaindex,CHAR_LUASAVE_WORKINT_3,0);// +#ifdef _FM_METAMO + if( CHAR_getInt( charaindex , CHAR_BASEIMAGENUMBER)>=100700 && CHAR_getInt( charaindex , CHAR_BASEIMAGENUMBER)<100819 + && (CHAR_getInt( charaindex, CHAR_FMLEADERFLAG ) == FMMEMBER_NONE || CHAR_getInt( charaindex, CHAR_FMLEADERFLAG ) == FMMEMBER_APPLY)){ + switch( CHAR_getWorkInt( charaindex, CHAR_WORKFMFLOOR) ){ + case 1041: + case 2031: + case 3031: + case 4031: + case 5031: + case 6031: + case 7031: + case 8031: + case 9031: + case 10031: + break; + default: + CHAR_ReMetamo(charaindex); + } + } +#endif +#ifdef _AUTO_PK + int exfloor=-1,ex_X=-1,ex_Y=-1; + if( CHAR_getInt(charaindex, CHAR_FLOOR) == 20000 ){ + CHAR_getElderPosition(CHAR_getInt(charaindex, CHAR_LASTTALKELDER), &exfloor, &ex_X, &ex_Y); + CHAR_setInt(charaindex, CHAR_FLOOR, exfloor); + CHAR_setInt(charaindex, CHAR_X, ex_X); + CHAR_setInt(charaindex, CHAR_Y, ex_Y); + } + CHAR_setInt(charaindex, CHAR_AUTOPK, 0); +#endif + if( CHAR_getInt(charaindex, CHAR_FLOOR) == 10032 ){ + CHAR_setInt(charaindex, CHAR_FLOOR, 10030); + CHAR_setInt(charaindex, CHAR_X, 52); + CHAR_setInt(charaindex, CHAR_Y, 36); + } + + objindex = initObjectFromObjectMember(OBJTYPE_CHARA,charaindex, + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + CHAR_getInt(charaindex,CHAR_FLOOR)); + if( objindex == -1 ){ + fprint ("ʼ\n"); + goto DELETECHARDATA; + } + + CHAR_setWorkInt( charaindex,CHAR_WORKOBJINDEX,objindex ); + CONNECT_setState( clifd, LOGIN ); + //print("\n¼1111111111111111\n"); + CONNECT_setCharaindex( clifd, charaindex ); + CHAR_LoginBesideSetWorkInt( charaindex, clifd); + + CHAR_complianceParameter( charaindex ); + // + { + int i,j; +// char *petstring; + int ID1,ID2; + char* delbuf; + char delpetbuf[10]; + delbuf = getDelPet(); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int petindex = CHAR_getCharPet(charaindex,i); + if( CHAR_CHECKINDEX( petindex) ) { +/* + if(CHAR_getInt( petindex, CHAR_FUSIONBEIT )==1 + && CHAR_getInt( petindex, CHAR_TRANSMIGRATION )<2) + CHAR_setInt( petindex, CHAR_FUSIONBEIT, 0 ); + + if(CHAR_getInt( petindex, CHAR_FUSIONBEIT )==1 + && CHAR_getInt( petindex, CHAR_TRANSMIGRATION )>2){ + int vital=CHAR_getInt( petindex, CHAR_VITAL); + int str=CHAR_getInt( petindex, CHAR_STR); + int tough=CHAR_getInt( petindex, CHAR_TOUGH); + int dex=CHAR_getInt( petindex, CHAR_DEX); + int lv=CHAR_getInt( petindex, CHAR_LV); + int LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + int work[4]; + float fRand, cvitl, cstr, ctough, cdex; + float rnd=(rand()%5+95)/100.0; + float Param[4] = { 0.0, 0.0, 0.0, 0.0 }; + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + struct _RankRandTbl{ + int min; + int max; + }RankRandTbl[] = { + { 450, 500 }, + { 470, 520 }, + { 490, 540 }, + { 510, 560 }, + { 530, 580 }, + { 550, 600 }, + }; + int petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + if( petrank < 0 || petrank > 5 ) petrank = 0; + + printf("\n.........................\n"); + printf("%s\n",CHAR_getChar( petindex, CHAR_NAME)); + printf("Ѫ%d\n",vital/15); + printf("%d\n",str/80); + printf("%d\n",tough/80); + printf("%d\n",dex/100); + printf("ɣ%f\n",((str/80-20.0)/lv+(tough/80-15.0)/lv+(dex/100-15.0)/lv)); + printf(".........................\n"); + + while(((str/80-20.0)/lv+(tough/80-15.0)/lv+(dex/100-15.0)/lv)>8.5){ + vital*=rnd; + str*=rnd; + tough*=rnd; + dex*=rnd; + rnd=(rand()%5+95)/100.0; + } + + for(i=0;i<160;i++){ + fRand = (float)RAND( RankRandTbl[petrank].min, RankRandTbl[petrank].max ) * 0.01; + cvitl += (float)work[3] * fRand + Param[0] * fRand; + cstr += (float)work[0] * fRand + Param[1] * fRand; + ctough += (float)work[1] * fRand + Param[2] * fRand; + cdex += (float)work[2] * fRand + Param[3] * fRand; + } + rnd=(cstr/80/160.0+ctough/80/160.0+cdex/100/160.0); + + printf("Ѫ%d\n",work[3]); + printf("%d\n",work[0]); + printf("%d\n",work[1]); + printf("%d\n",work[2]); + printf("ɣ%f\n",rnd); + + if(rnd>8.5){ + work[3]*=(8.5/rnd); + work[0]*=(8.5/rnd); + work[1]*=(8.5/rnd); + work[2]*=(8.5/rnd); + } + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + + CHAR_setInt( petindex, CHAR_VITAL, vital); + CHAR_setInt( petindex, CHAR_STR, str); + CHAR_setInt( petindex, CHAR_TOUGH, tough); + CHAR_setInt( petindex, CHAR_DEX, dex); + + CHAR_setInt( petindex, CHAR_FUSIONBEIT, 2 ); + CHAR_setInt( petindex, CHAR_TRANSMIGRATION,3 ); + printf("\n.........................\n"); + printf("%s\n",CHAR_getChar( petindex, CHAR_NAME)); + printf("Ѫ%d\n",vital/15); + printf("%d\n",str/80); + printf("%d\n",tough/80); + printf("%d\n",dex/100); + printf("ɣ%f\n",((str/80-20.0)/lv+(tough/80-15.0)/lv+(dex/100-15.0)/lv)); + printf(".........................\n"); + printf("Ѫ%d\n",work[3]); + printf("%d\n",work[0]); + printf("%d\n",work[1]); + printf("%d\n",work[2]); + } +*/ + +#ifdef _UNIQUE_P_I + // CoolFish: 2001/10/11 Set Pet Unicode + CHAR_setPetUniCode(petindex); +#endif +#ifdef _NEWOPEN_MAXEXP + if( CHAR_getInt( petindex, CHAR_OLDEXP) > 0 || CHAR_getInt( charaindex, CHAR_OLDEXP) < 0 ){ + CHAR_ChangeExp( petindex); + } +#endif + ID1=CHAR_getInt( petindex, CHAR_PETID); + /* + if(CHAR_getInt(petindex,CHAR_BEATITUDE)>0 && strstr(CHAR_getChar(petindex,CHAR_NAME),"+")==NULL){ + char btmpname[128]; + sprintf(btmpname,"%s+",CHAR_getChar(petindex,CHAR_NAME)); + CHAR_setChar(petindex,CHAR_NAME,btmpname); + } + */ +// petstring = CHAR_makePetStringFromPetIndex( petindex); +#ifdef _JK_CF_DELPETITEM //ɾCFָ + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delpetbuf, sizeof(delpetbuf)) == FALSE) + break; + ID2 = atoi(delpetbuf); + if(ID2 == -1)break; + if( ID1 == ID2 ){ + CHAR_setCharPet( charaindex, i, -1);//ܵĽɫ + LogPet( CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "login(CFõij)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + CHAR_talkToCli(charaindex,-1,"ϵͳϵij",CHAR_COLORWHITE); + } + } +#endif +#ifdef _REEDIT_PETBBIS + if( ID1 == 1133 ){ + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, 101578); + CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, 101578); + //print("PET:%s fix BBI\n", CHAR_getUseName(petindex)); + } +#endif +#ifdef _YUANGUSA + if( ID1 == 10247 ){ + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, 130088); + CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, 130088); + CHAR_setChar( petindex, CHAR_NAME, "-"); + //print("PET:%s fix BBI\n", CHAR_getUseName(petindex)); + } +#endif + // WON ADD ׻߼ + if( ID1 == 777 )CHAR_setInt( petindex, CHAR_SLOT, 7); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + // 輼ֵ-1 Robin 20040803 + if( CHAR_getInt( petindex, CHAR_SLOT) < 0 ) { + int j; + for( j=0; j= 0) + CHAR_setInt( petindex, CHAR_SLOT, j+1); + } + //print(" 輼MAX-16 "); + } + + CHAR_complianceParameter( petindex ); +#ifdef _FIX_GP_PET_SKILL // WON ADD gp + if( ID1 == 1133){ + int j; + for( j=0; j 0 || + CHAR_getInt( charaindex, CHAR_OLDEXP) < 0 ){ + CHAR_ChangeExp( petindex); + } +#endif + b_find=FALSE; + ID1=CHAR_getInt( petindex, CHAR_PETID); +/* + if(CHAR_getInt(petindex,CHAR_BEATITUDE)>0 && strstr(CHAR_getChar(petindex,CHAR_NAME),"+")==NULL){ + char btmpname[128]; + sprintf(btmpname,"%s+",CHAR_getChar(petindex,CHAR_NAME)); + CHAR_setChar(petindex,CHAR_NAME,btmpname); + } +*/ +#ifdef _JK_CF_DELPETITEM //ɾCFָ + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delpetbuf, sizeof(delpetbuf)) == FALSE) + break; + ID2 = atoi(delpetbuf); + if(ID2 == -1)break; + if( ID1 == ID2 ){ + CHAR_setCharPoolPet( charaindex, i, -1);//ܵĽɫ + LogPet( CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "login(CFõij)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + CHAR_talkToCli(charaindex,-1,"ϵͳij",CHAR_COLORWHITE); + } + } +#endif +#ifdef _REEDIT_PETBBIS + if( ID1 == 1133 ){ + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, 101578); + CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, 101578); + } +#endif +#ifdef _YUANGUSA + if( ID1 == 10247 ){ + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, 130088); + CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, 130088); + CHAR_setChar( petindex, CHAR_NAME, "-"); + //print("PET:%s fix BBI\n", CHAR_getUseName(petindex)); + } +#endif +/* + tran_no=CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); + petstring = CHAR_makePetStringFromPetIndex( petindex); + c_ptr_index=strstr(petstring,"name:"); + getStringFromIndexWithDelim(c_ptr_index,":",2,c_temp,sizeof(c_temp)); + c_ptr_index=c_temp; + getStringFromIndexWithDelim(c_ptr_index,"|",1,c_temp1,sizeof(c_temp1)); + + if(b_find){//ttom + CHAR_setCharPoolPet( charaindex, i, -1); + print("\nKill pool pet ID=%d name=%s",ID1,c_temp1); + sprintf(c_temp2,"Kill pool pet ID=%d name=%s",ID1,c_temp1); + LogKill(CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + c_temp2); + }else{//ttom +*/ + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_complianceParameter( petindex ); +// }//ttom + } + } + } + +// CHAR_ResetPoolPetEgg( charaindex); +// CHAR_CheckProfessionEquit( charaindex); + CHAR_CheckProfessionSkill( charaindex); + /*{ + int i=0; + int skidx[]={2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,3,3,3,3,3,3,3}; + //20040702 Change fix + //Ƿְҵеļܲɾ + for( i = CHAR_SKILLMAXHAVE-1; i >= 0; i -- ){ + CHAR_HaveSkill *pSkil; + Skill* skill; + + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + skill = &pSkil->skill; + if( pSkil == NULL )continue; + if( pSkil->use == 0 )continue; + if( skidx[skill->data[SKILL_IDENTITY]] != CHAR_getInt( charaindex, PROFESSION_CLASS ) + && skidx[skill->data[SKILL_IDENTITY]] != 4 ){//ͨɾ + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + } + } + }*/ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); +#ifdef _VIP_ANNOUNCE //VIPϵͳԶ + + if(CHAR_getInt( charaindex,CHAR_VIPRIDE )>0) + { +//#ifdef _YUANGUSA +// if(CHAR_getInt(charaindex,CHAR_VIPRIDE)==1 && CHAR_getInt(charaindex,CHAR_VIPTIME)==0){ +// CHAR_setInt(charaindex,CHAR_VIPTIME,timep+60*60*24*30); +// } +//#endif + int viptype,viptime; + viptime = CHAR_getInt( charaindex,CHAR_VIPTIME ); + viptype = CHAR_getInt( charaindex,CHAR_VIPRIDE ); + int vipmsgtype = getVipMsgType(); + if(viptime > 0) + { + viptime = viptime - timep; + } + if(viptime < 0) + { + CHAR_setInt( charaindex,CHAR_VIPRIDE,0 ); + CHAR_setInt( charaindex,CHAR_VIPTIME,0 ); + viptype = CHAR_getInt( charaindex,CHAR_VIPRIDE ); + } + if(viptype>0 && vipmsgtype>0 && viptype>=vipmsgtype) + { + int i; + int playernum = CHAR_getPlayerMaxNum(); + char VipMsg[256]; + char *MyName = CHAR_getChar( charaindex,CHAR_NAME ); + if(vipmsgtype == 1) + { +#ifdef _TEST_SERVER + if(viptype == 1) + sprintf( VipMsg, "%sĻԱ%sˣһӭ", "һʯ", MyName ); + else if(viptype == 2) + sprintf( VipMsg, "%sĻƽԱ%sˣһӭ", "һʯ", MyName ); + else if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", "һʯ", MyName ); +#else + if(viptype == 1) + sprintf( VipMsg, "%sĻԱ%sˣһӭ", getGameservername(), MyName ); + else if(viptype == 2) + sprintf( VipMsg, "%sĻƽԱ%sˣһӭ", getGameservername(), MyName ); + else if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", getGameservername(), MyName ); +#endif + } + else if(vipmsgtype == 2) + { +#ifdef _TEST_SERVER + if(viptype == 2) + sprintf( VipMsg, "%sĻƽԱ%sˣһӭ", "һʯ", MyName ); + else if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", "һʯ", MyName ); +#else + if(viptype == 2) + sprintf( VipMsg, "%sĻƽԱ%sˣһӭ", getGameservername(), MyName ); + else if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", getGameservername(), MyName ); +#endif + } + else if(vipmsgtype == 3) + { +#ifdef _TEST_SERVER + if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", "һʯ", MyName ); +#else + if(viptype == 3) + sprintf( VipMsg, "%sʯԱ%sˣһӭ", getGameservername(), MyName ); +#endif + } + for( i = 0 ; i < playernum ; i++) + { + CHAR_talkToCli( i, -1, VipMsg, CHAR_COLORPURPLE); + } + } + } +#endif +#ifdef _OFFLINE_SYSTEM + if(strlen(CHAR_getChar(charaindex,CHAR_OFFBUF))<1){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int mon=1+p->tm_mon; + int date=p->tm_mday; + char offbuf[64]; + sprintf(offbuf,"%d-%d-%d",mon,date,0); + CHAR_setChar(charaindex,CHAR_OFFBUF,offbuf); + CHAR_setInt(charaindex,CHAR_OFFTIME,172800); + } +#endif +//22222222222222222222222222222222 + + CHAR_loginCheckUserItem( charaindex); + CHAR_complianceParameter( charaindex ); + + // Robin add 走 ʱ + CHAR_ResetPetEggFusionTime( charaindex); + +#ifdef _PROFESSION_FIX_LEVEL // WON ADD ְҵֵ + { + int i=0; + for( i = 0 ; i < CHAR_SKILLMAXHAVE ; i ++ ){ + CHAR_HaveSkill* hskill; + + hskill = CHAR_getCharHaveSkill( charaindex, i ); + + if( hskill != NULL && hskill->use == TRUE ){ + int skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + if( skill_level < 10 ){ + SKILL_setInt( &hskill->skill, SKILL_LEVEL, 10* 100 ); + } + } + } + } +#endif + +#ifdef _CHANNEL_MODIFY + if(CHAR_getInt(charaindex,PROFESSION_CLASS) > 0){ + int i,pclass = CHAR_getInt(charaindex,PROFESSION_CLASS) - 1,Empty = -1; + // ɵְҵƵ¼м¼ھ,ûмƵ + for(i=0;i MAX_PERSONAL_MOMENTUM) CHAR_setInt(charaindex,CHAR_MOMENTUM,MAX_PERSONAL_MOMENTUM); +#endif + +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){ + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BECOMEPIG_BBI ) ); + } + //change fix ܴʱ + else{ + CHAR_setInt( charaindex, CHAR_BECOMEPIG, -1 ); + } +#endif + + + lssproto_CharLogin_send( clifd, SUCCESSFUL,"" ); + per = ENCOUNT_getEncountPercentMin( charaindex, + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + if( per != -1) { + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, per); + } + per = ENCOUNT_getEncountPercentMax( charaindex, + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + if( per != -1) { + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, per); + } + + CHAR_setLuck( charaindex); + { + int i; + char* statuscat[]={"C","P","I","S","D","E","F"}; + for( i=0 ; i=1 ) + CHAR_Skillupsend(charaindex); + CHAR_checkEffect( charaindex); + // CoolFish: Family 2001/5/30 + if ((CHAR_getChar(charaindex, CHAR_FMNAME)!=NULL) && + (CHAR_getInt(charaindex, CHAR_FMINDEX) >= 0) && + (strcmp(CHAR_getChar(charaindex, CHAR_FMNAME), "") != 0)) + { +#ifdef _FMVER21 + int eventflag = 0; + // Ƿ峤ʸ + if (CheckLeaderQ(charaindex) >= 0) + eventflag = 1; + if (CHAR_getInt(charaindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) + SetFMPetVarInit(charaindex); + saacproto_ACFMCharLogin_send( + acfd, + CHAR_getChar(charaindex, CHAR_FMNAME), + CHAR_getInt(charaindex, CHAR_FMINDEX), + CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), + CHAR_getInt(charaindex, CHAR_LV), eventflag, + CONNECT_getFdid(clifd) +#ifdef _FM_MODIFY + ,getServernumber() +#endif + ); + } +#ifdef _FMVER21 + else + SetFMVarInit(charaindex); +#endif + +#endif + + AnnounceToPlayerWN( clifd ); + +#ifdef _ANGEL_SUMMON + { + int mindex; + mindex = checkIfOnlyAngel( charaindex); + if( mindex != -1 ) { + if( missiontable[mindex].flag == MISSION_WAIT_ANSWER ) { + lssproto_WN_send( clifd, WINDOW_MESSAGETYPE_ANGELMESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_ANGEL_ASK, + -1, + "ĿǰħŰҪİæǰѰЩħ壬ǷԸæ" ); + } + } + } +#endif + + print("\n½:%s ", CHAR_getChar(charaindex, CHAR_NAME ) ); + + + unsigned long ip; + char ipstr[512]; + ip=CONNECT_get_userip(clifd); + sprintf(ipstr,"%d.%d.%d.%d", + ((unsigned char *)&ip)[0], + ((unsigned char *)&ip)[1], + ((unsigned char *)&ip)[2], + ((unsigned char *)&ip)[3]); + +#ifdef _RECORD_IP + CHAR_setWorkInt(charaindex, CHAR_WORK_RECORD_IP, CONNECT_get_userip(clifd)); +#endif + +// CHAR_setChar(charaindex,CHAR_CHARPLAYIP,ipstr); + char pcid[64]; + memset( pcid, 0 , sizeof( pcid ) ); + CONNECT_getPcid( clifd, pcid, sizeof( pcid )); + LogLogin( + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( charaindex, CHAR_NAME), + saveindex, ipstr,pcid + ); + +#ifdef _VIGOR_SYS + CHAR_setWorkInt(charaindex,CHAR_WORKVIGORTIME,timep); +#endif + +#ifdef _TEACHER_SYSTEM + // ѧ֪ͨʦ + if(strlen(CHAR_getChar(charaindex,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(charaindex,CHAR_TEACHER_NAME)) > 0){ + int iPlayernum = CHAR_getPlayerMaxNum(),i; + char szMsg[128]; + + for(i=0;i 0 && + strlen(CHAR_getChar(charaindex,CHAR_LOVERID))>0 && + strlen(CHAR_getChar(charaindex,CHAR_LOVERNAME))>0){ + int iPlayernum = CHAR_getPlayerMaxNum(),i; + char szMsg[128]; + for(i=0;i0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(CHAR_getInt(charaindex,CHAR_JOBPKTIME)-timep<=0){ + CHAR_setInt(charaindex,CHAR_JOBPKTIME,0); + CHAR_setInt(charaindex,CHAR_JOBPKMODE,0); + }else{ + char jobbuf[256]; + if(CHAR_getInt(charaindex,CHAR_JOBPKMODE)==1){ + sprintf(jobbuf,"һӭԶŰʿϯӡ%sߣ",CHAR_getChar(charaindex,CHAR_NAME)); + }else if(CHAR_getInt(charaindex,CHAR_JOBPKMODE)==2){ + sprintf(jobbuf,"һӭԶ鷨ʦϯӡ%sߣ",CHAR_getChar(charaindex,CHAR_NAME)); + }else{ + sprintf(jobbuf,"һӭԶ׷ߡϯӡ%sߣ",CHAR_getChar(charaindex,CHAR_NAME)); + } + int i; + int playernum = CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playernum ; i++) + { + CHAR_talkToCli( i, -1, jobbuf, CHAR_COLORRED); + } + } + } +#endif + { + sasql_online(cdkey,CHAR_getChar(charaindex,CHAR_NAME),ipstr,CHAR_getInt(charaindex,CHAR_FAME),CHAR_getInt(charaindex,CHAR_VIGOR),1); + } + { + if(CHAR_getInt(charaindex,CHAR_WALKINTERVAL) != getWalksendinterval()) + CHAR_setInt(charaindex,CHAR_WALKINTERVAL,getWalksendinterval()); + } +#ifdef _PET_ITEM + if( CHAR_CHECKINDEX( CHAR_getCharPet( charaindex, 0) ) ){ + CHAR_sendPetItemData(charaindex,0); + } + if( CHAR_CHECKINDEX( CHAR_getCharPet( charaindex, 1) ) ){ + CHAR_sendPetItemData(charaindex,1); + } + if( CHAR_CHECKINDEX( CHAR_getCharPet( charaindex, 2) ) ){ + CHAR_sendPetItemData(charaindex,2); + } + if( CHAR_CHECKINDEX( CHAR_getCharPet( charaindex, 3) ) ){ + CHAR_sendPetItemData(charaindex,3); + } + if( CHAR_CHECKINDEX( CHAR_getCharPet( charaindex, 4) ) ){ + CHAR_sendPetItemData(charaindex,4); + } +#endif + if(CHAR_getInt(charaindex,CHAR_LV)>10 || CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)>0){ + sasql_online_ip(cdkey,ipstr); + } + + CHAR_setWorkInt(charaindex,CHAR_WORKALLTALKTYPE,0); + + return; + +DELETECHARDATA: + CHAR_endCharOneArray( charaindex ); +MAKECHARDATAERROR: + { + int i; + char cdkey[CDKEYLEN]; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_CHECKINDEX(ch.unionTable.indexOfPet[i] ) ) { + CHAR_endCharOneArray( ch.unionTable.indexOfPet[i] ); + } + } + CONNECT_getCdkey( clifd, cdkey, sizeof(cdkey )); + saacproto_ACLock_send( acfd, cdkey, UNLOCK, CONNECT_getFdid(clifd) ); + } + CONNECT_setState(clifd, WHILECANNOTLOGIN ); + CONNECT_setCharaindex( clifd, -1 ); + lssproto_CharLogin_send( clifd, FAILED, "볢Ե½·Ժԡ"); +} + +BOOL CHAR_charSaveFromConnectAndChar( int fd, Char* ch, BOOL unlock ) +{ + char* chardata; + char cdkey[CDKEYLEN]; + + chardata = CHAR_makeStringFromCharData( ch ); + if( chardata == "\0" )return FALSE; +// CONNECT_getCdkey( fd, cdkey, sizeof(cdkey)); +// +// if(strcmp(cdkey,ch->string[CHAR_CDKEY].string)!=0){ +// printf(":%s˺:%sϣ浵",cdkey,ch->string[CHAR_CDKEY].string); +// return FALSE; +// } +#ifdef _DBSAVE_CHAR + else{ + if(ch->data[CHAR_SAVEINDEXNUMBER]!=-1) + CharaData( fd, ch ); + } +#endif + +#ifdef _NEWSAVE + +// print("saveindex_save:%d\n",ch->data[CHAR_SAVEINDEXNUMBER]); + saacproto_ACCharSave_send( acfd, ch->string[CHAR_CDKEY].string, + ch->string[CHAR_NAME].string, + CHAR_makeOptionString( ch ), chardata, + unlock, CONNECT_getFdid(fd), ch->data[CHAR_SAVEINDEXNUMBER] ); +#else + + saacproto_ACCharSave_send( acfd, cdkey, + ch->string[CHAR_NAME].string, + CHAR_makeOptionString( ch ), chardata, + unlock, CONNECT_getFdid(fd) ); +#endif + if(unlock) sasql_online(ch->string[CHAR_CDKEY].string,NULL,NULL,NULL,NULL,0); + return TRUE; +} + +BOOL CHAR_charSaveFromConnect( int charaindex , BOOL unlock) +{ + Char* ch; + int fd = getfdFromCharaIndex(charaindex); + if( CHAR_CHECKINDEX( charaindex ) == FALSE)return FALSE; + ch = CHAR_getCharPointer( charaindex ); + if( !ch )return FALSE; +#ifdef _CHAR_POOLITEM + if( CHAR_SaveDepotItem( charaindex) == TRUE ){ + print("saveDepotItem:%d \n", charaindex); + } +#endif +#ifdef _CHAR_POOLPET + if( CHAR_SaveDepotPet( charaindex) == TRUE ){ + print("saveDepotPet:%d \n", charaindex); + } +#endif + + return CHAR_charSaveFromConnectAndChar( fd, ch, unlock ); +} + + +/*------------------------------------------------------------ + * ʧݱ ʧƥئʧ ةë + * + * ¦ + * charaindex int ƽҷ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +static void CHAR_dropItemAtLogout( int charaindex ) +{ + int i; + for( i=0 ; i= 0 ){ + BATTLE_EscapeDpSend( battleindex, charindex ); + CHAR_setInt( charindex, CHAR_DUELPOINT, + CHAR_getInt( charindex, CHAR_DUELPOINT ) + + CHAR_getWorkInt( charindex, CHAR_WORKGETEXP ) ); + CHAR_setWorkInt( charindex, CHAR_WORKDBATTLEESCAPE, 1); + BATTLE_Exit( charindex, battleindex ); + } + + CHAR_dropItemAtLogout( charindex ); + CHAR_DischargeParty( charindex, 0); + if(CHAR_getChar(charindex, CHAR_FMNAME) != NULL ) { + if(strlen(CHAR_getChar(charindex, CHAR_FMNAME)) > 0 && + strlen(CHAR_getChar(charindex, CHAR_FMNAME)) < sizeof( STRING32) ) + if( (CHAR_getInt(charindex, CHAR_FMINDEX) >= 0) && + (strcmp(CHAR_getChar(charindex, CHAR_FMNAME), "") != 0) ) { + saacproto_ACFMCharLogout_send(acfd, + CHAR_getChar(charindex, CHAR_FMNAME), + CHAR_getInt(charindex, CHAR_FMINDEX), + CHAR_getChar(charindex, CHAR_NAME), + CHAR_getChar(charindex, CHAR_CDKEY), + CHAR_getInt(charindex, CHAR_LV), + CHAR_getWorkInt(charindex, CHAR_WORKFMINDEXI), + CONNECT_getFdid(clifd)); + } + } + +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ + if ( CHAR_getWorkInt ( charindex , CHAR_WORKCHATROOMTYPE ) != 0 ) { + ChatRoom_Leave ( charindex ) ; + } +#endif +#ifdef _STREET_VENDOR + // ڽ + if(CHAR_getWorkInt(charindex,CHAR_WORKSTREETVENDOR) == 2){ + // ȡ׵ + toindex = CHAR_getWorkInt(charindex,CHAR_WORKSTREETVENDOR_WHO); + if(toindex > -1 && CHAR_CHECKINDEX(toindex)){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,-1); + lssproto_STREET_VENDOR_send(getfdFromCharaIndex(toindex),"C|"); + CHAR_talkToCli(toindex,-1,"ȡ",CHAR_COLORYELLOW); + } + } + // + else if(CHAR_getWorkInt(charindex,CHAR_WORKSTREETVENDOR) == 3){ + // ȡ + toindex = CHAR_getWorkInt(charindex,CHAR_WORKSTREETVENDOR_WHO); + if(toindex > -1 && CHAR_CHECKINDEX(toindex)){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,1); + } + } +#endif + + // Robin 0606 channel + fmindexi = CHAR_getWorkInt(charindex, CHAR_WORKFMINDEXI); + channel = CHAR_getWorkInt(charindex, CHAR_WORKFMCHANNEL); + i = 0; + if( (fmindexi > 0) && (channel >= 0) && (fmindexi < FAMILY_MAXNUM) && (channel < FAMILY_MAXCHANNEL)) { + while( i < FAMILY_MAXMEMBER ) { + if( channelMember[fmindexi][channel][i] == charindex ) { + channelMember[fmindexi][channel][i] = -1; + break; + } + i++; + } + } +#ifdef _CHANNEL_MODIFY + if(CHAR_getInt(charindex,PROFESSION_CLASS) > 0){ + int i,pclass = CHAR_getInt(charindex,PROFESSION_CLASS) - 1; + for(i=0;i 0) && (fmindexi < FAMILY_MAXNUM)){ + if( familyMemberIndex[fmindexi][i] == charindex ) + familyMemberIndex[fmindexi][i] = -1; + } + } + // Robin 0629 silent + if( CHAR_getInt( charindex, CHAR_SILENT) > 0 ){ + int silent_t, login_t; + login_t = CHAR_getWorkInt(charindex, CHAR_WORKLOGINTIME); + silent_t = CHAR_getInt( charindex, CHAR_SILENT); + silent_t = silent_t - ( (int)NowTime.tv_sec-login_t); + if( silent_t<0 ) silent_t = 0; + CHAR_setInt( charindex, CHAR_SILENT, silent_t); + } + + + +#ifdef _ITEM_ADDEXP2 + if( CHAR_getInt( charindex, CHAR_ADDEXPPOWER) > 0 ) { + // ʱǹЧԶ90 + CHAR_setInt( charindex, CHAR_ADDEXPTIME, + CHAR_getInt( charindex, CHAR_ADDEXPTIME) - 90 ); + if( CHAR_getInt( charindex, CHAR_ADDEXPTIME) <= 0 ) { + CHAR_setInt( charindex, CHAR_ADDEXPTIME, 0); + CHAR_setInt( charindex, CHAR_ADDEXPPOWER, 0); + } + } +#endif + +#ifdef _VIP_BATTLE_EXP + if( CHAR_getInt( charindex, CHAR_NVIPTIME) <= 0 ) { + CHAR_setInt( charindex, CHAR_NVIPTIME, 0); + CHAR_setInt( charindex, CHAR_NVIPEXP, 0); + } +#endif + +#ifdef _TIME_TICKET + if( check_TimeTicketMap( CHAR_getInt( charindex, CHAR_FLOOR)) ) { + CHAR_warpToSpecificPoint( charindex, 2006, 20, 17); + } +#endif + +#ifdef _AUTO_PK + if(CHAR_getInt(charindex,CHAR_FLOOR)==20000 && CHAR_getInt(charindex,CHAR_AUTOPK)!=-1 && autopkstart == 1){ + char buf[64]; + int i,num=0,winindex; + int playernum = CHAR_getPlayerMaxNum(); +#ifndef _YUANGUSA + sprintf(buf, "С%s˳ǰ",CHAR_getChar(charindex,CHAR_NAME)); + AutoPk_PKSystemTalk( buf, buf ); +#endif + if(CHAR_getWorkInt( charindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(AutoPk_PKTimeGet()<=0){ + for(i=0;i0 && getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))>0){ + if(CHAR_getInt(charindex,CHAR_VIGOR)=getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION)) && getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))>0 && CHAR_getWorkInt(charindex,CHAR_WORKVIGORTIME)>0 ){ + CHAR_setInt(charindex,CHAR_VIGOR,min(CHAR_getInt(charindex,CHAR_VIGOR)+(int)(curtime/getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))*2),getVigorMax())); + //CHAR_setWorkInt(charindex,CHAR_WORKVIGORTIME,CHAR_getWorkInt(charindex,CHAR_WORKVIGORTIME)+(int)(curtime/getVigorTime(1))*getVigorTime(1)); + CHAR_setWorkInt(charindex,CHAR_WORKVIGORTIME,timep); + } + } + }else if(CHAR_getInt(charindex,CHAR_VIPRIDE)<=0 && getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))>0){ + if(CHAR_getInt(charindex,CHAR_VIGOR)=getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION)) && getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))>0 && CHAR_getWorkInt(charindex,CHAR_WORKVIGORTIME)>0){ + CHAR_setInt(charindex,CHAR_VIGOR,min(CHAR_getInt(charindex,CHAR_VIGOR)+(int)(curtime/getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))),getVigorMax())); + //CHAR_setWorkInt(charindex,CHAR_WORKVIGORTIME,CHAR_getWorkInt(charindex,CHAR_WORKVIGORTIME)+(int)(curtime/getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION)))*getVigorTime(CHAR_getInt(charindex,CHAR_TRANSMIGRATION))); + CHAR_setWorkInt(charindex,CHAR_WORKVIGORTIME,timep); + } + } + } +#ifdef _ONLINE_TIME + if (CHAR_getInt(charindex,CHAR_TRANSMIGRATION)>=0) + { + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + int curtime = timep-CHAR_getWorkInt(charindex,CHAR_WORKVIGORTIME); + CHAR_setInt(charindex,CHAR_ONLINE_TIME,CHAR_getInt(charindex,CHAR_ONLINE_TIME)+curtime); +#ifdef _REGISTRATION_TIME + // CHAR_setInt(charindex,CHAR_REGISTRATION_ONLINE_TIME,CHAR_getInt(charindex,CHAR_REGISTRATION_ONLINE_TIME)+curtime); +#endif + } +#endif + } +#endif +//1111111111111111111111111111111111111 + + + + + if(CHAR_getInt(charindex,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(charindex,CHAR_FMNAME),""))){ + char tempbuf[256]; + sprintf(tempbuf,"%d",CHAR_getInt(charindex,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(charindex,CHAR_FMNAME), + CHAR_getInt(charindex,CHAR_FMINDEX), + CHAR_getWorkInt(charindex,CHAR_WORKFMINDEXI), + FM_FIX_FAME,tempbuf,"", + CHAR_getWorkInt(charindex,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(clifd)); + } +#ifdef _ALLBLUES_LUA_1_4 + RunCharLogOutEvent(charindex); +#endif + if( save ){ + CHAR_charSaveFromConnect( charindex ,TRUE); + } +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( charindex, CHAR_WORK_OFFLINE )!=0) + playeronlinenum--; +#endif + + ADDRESSBOOK_notifyLoginLogout(charindex,0); + CHAR_CharaDeleteHavePet( charindex); + CHAR_CharaDelete( charindex ); + + return ret; +} +/*------------------------------------------------------------ + * watchìë˪¾ + * ¦ + * objindex int ìëƳƽҷ¼Ƥ + * ̼͵ + * index int ìëƳƽҷ¼̼͵ + * recvindex int ìëƽҷ¼index + * chac int ʧ + * ߯Ի TRUE: ˪Ȼз + * FALSE: + ------------------------------------------------------------*/ +static BOOL CHAR_sendWatchEvent_sendCheck( int objindex, int index, + int recvindex, int chac) +{ + /* лNPCƥNPC */ + if( OBJECT_getType( objindex) == OBJTYPE_CHARA && + CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER && + CHAR_getInt(recvindex, CHAR_WHICHTYPE ) + != CHAR_TYPEPLAYER ) + { + return FALSE; + } + /* ƽҷ¶½watch Ʊީ */ + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) { + return TRUE; + } + /* + * г߼弰 Ʊ + */ + if( index == recvindex && chac == CHAR_ACTWALK ) { + return FALSE; + } + + if( CHAR_getInt( recvindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + /* б巴 ͷ־˪ئ */ + if( CHAR_getWorkInt( recvindex,CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + { + return FALSE; + } + /* ʧԪ */ + if( CHAR_getWorkInt( index, CHAR_WORKACTION) == -1 ) { + if( OBJECT_getType(objindex) == OBJTYPE_CHARA) { + /* Ԫɡ ū + * ʶ½ְë˪ئ + */ + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE ) + == CHAR_PARTY_CLIENT && + CHAR_getWorkInt( recvindex, CHAR_WORKPARTYMODE) + != CHAR_PARTY_NONE && + chac == CHAR_ACTWALK ) + { + int found = FALSE; + int loop; + /* ëƩ */ + for( loop = 1; loop < CHAR_PARTYMAX; loop ++ ) { + int partycharaindex = CHAR_getPartyIndex( recvindex, loop); + /* ƽҷ»мɡ ūҷ */ + if( partycharaindex == index ) { + found = TRUE; + break; + } + } + if( found ) return FALSE; + } + /* ʷҼSTANDë˪ئ */ + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) + == CHAR_PARTY_CLIENT && + CHAR_getWorkInt( recvindex, CHAR_WORKPARTYMODE) + == CHAR_PARTY_LEADER && + chac == CHAR_ACTSTAND) + { + int found = FALSE; + int loop; + /* ëƩ */ + for( loop = 1; loop < CHAR_PARTYMAX; loop ++ ) { + int partycharaindex + = CHAR_getWorkInt( recvindex, + CHAR_WORKPARTYINDEX1+loop); + /* STANDƽҷ»мɡ ūҷ */ + if( partycharaindex == index ) { + found = TRUE; + break; + } + } + if( found ) return FALSE; + } + } + } + } + return TRUE; +} + +void CHAR_sendWatchEvent( int objindex, int chac, int* opt, + int optlen,BOOL myflg ) +{ + int i; + int j; + int x=0,y=0,dir=0; + int floor; + int watchopt[32]; + int watchoptlen=0; + typedef void (*WATCHF)(int,int,CHAR_ACTION,int,int,int,int*,int); + int index; + + if( !CHECKOBJECTUSE(objindex) )return; + index = OBJECT_getIndex( objindex); + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + for( i=0; i= 4 ){ + return; + } + // ɷ¶ʧƥ¾ + cnt = CHAR_getInt(charaindex,CHAR_SKILLUPPOINT); + if( cnt <= 0 )return; + +#ifdef _CHAR_PROFESSION // WON ADD ְҵλ + { + int p_class = CHAR_getInt( charaindex, PROFESSION_CLASS ); + int fd=-1; + + switch( p_class ){ + case PROFESSION_CLASS_FIGHTER: + // ʿ200 + if( SkUpTbl[skillid] == CHAR_DEX ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 200 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + break; + case PROFESSION_CLASS_WIZARD: + // ʦ200 + if( SkUpTbl[skillid] == CHAR_STR ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 200 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + // ʦ200 + if( SkUpTbl[skillid] == CHAR_TOUGH ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 200 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + break; + case PROFESSION_CLASS_HUNTER: + // 200 + if( SkUpTbl[skillid] == CHAR_STR ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 200 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + // 200 + if( SkUpTbl[skillid] == CHAR_TOUGH ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 200 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + // 400 + if( SkUpTbl[skillid] == CHAR_DEX ){ + if( CHAR_getInt( charaindex, SkUpTbl[skillid] ) >= 400 * 100 ){ + CHAR_talkToCli(charaindex, -1, "ֵѴ", CHAR_COLORYELLOW ); + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt ); + return; + } + } + break; + default: break; + } + + fd = getfdFromCharaIndex(charaindex); + if( fd != -1 ) lssproto_SKUP_send( fd, cnt-1 ); + } +#endif + + CHAR_setInt( charaindex,CHAR_SKILLUPPOINT,cnt-1); + CHAR_setInt( charaindex, SkUpTbl[skillid], CHAR_getInt( charaindex, SkUpTbl[skillid] ) + 1*100 ); + + CHAR_complianceParameter(charaindex); + CHAR_send_P_StatusString( charaindex, SendTbl[skillid]); + +#ifdef _ANGEL_SUMMON // ӵʱʸ + if( cnt-1 == 0 ) + //selectAngel( charaindex); + selectAngel( charaindex, -1, -1 , FALSE); + +#endif + } + CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MAXHP ); + +} + +INLINE void CHAR_getDXDY( int dir , int* dx, int* dy ) +{ + static POINT CHAR_dxdy[8]= + { + { 0,-1}, /* */ + { 1,-1}, /* */ + { 1, 0}, /* */ + { 1, 1}, /* */ + { 0, 1}, /* */ + {-1, 1}, /* */ + {-1, 0}, /* */ + {-1,-1}, /* */ + }; + VALIDATEDIR(dir); + + if( dx )*dx = CHAR_dxdy[dir].x; + if( dy )*dy = CHAR_dxdy[dir].y; +} +INLINE int CHAR_getDX( int dir ) +{ + int tmp; + CHAR_getDXDY( dir,&tmp,NULL); + return tmp; +} +INLINE int CHAR_getDY( int dir ) +{ + int tmp; + CHAR_getDXDY( dir,NULL,&tmp); + return tmp; +} + +/*------------------------------------------------------------ + * ԪѨƽҷë £ + * ¦ + * objbuf int* object ƥ index ëҽ + * + * siz int objbuf + * ff int ׷ʧ + * fx int x + * fy int y + * ߯Ի + * ƽҷ»¾ + ------------------------------------------------------------*/ +int CHAR_getSameCoordinateObjects(int* objbuf, int siz,int ff, int fx, int fy) +{ + OBJECT object; + int findobjnum=0; + + for( object = MAP_getTopObj(ff,fx,fy) ; object ; + object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + + if( siz <= findobjnum )break; + if( OBJECT_getType(objindex) != OBJTYPE_NOUSE ) + objbuf[findobjnum++] = objindex; + } + return findobjnum; +} + + +/*====================ƽҷ¼ ë ̼====================*/ +/* ٯ ë*/ +static char CHAR_optiondataString[STRINGBUFSIZ]; +/*------------------------------------------------------------ + * ü ٯ ë£ + * level, showstring , ۼ , į ϼԷ̼׾ + * ͷµ + * ¦ + * ch Char* ƽҷ· + * ߯Ի + * char* static ئ ë߯ʼƥݼԼ̫Ƽݱ巴 + * ʽľ£¦ëئǣ + ------------------------------------------------------------*/ +char* CHAR_makeOptionString( Char* ch ) +{ + char escapeshowstring[256]; + char *showstr = MAP_getfloorShowstring(ch->data[CHAR_FLOOR]); + if( ! showstr ){ + CHAR_optiondataString[0] = '\0'; + return CHAR_optiondataString; + } else { + +#if 0 /* ƱLS2 ƥؤ */ + snprintf( CHAR_optiondataString, + sizeof( CHAR_optiondataString ), + "%d|%s|1|%d|%d", + ch->data[CHAR_LV], + makeEscapeString( showstr , + escapeshowstring,sizeof(escapeshowstring) ), + ch->data[CHAR_BASEIMAGENUMBER], + ch->data[CHAR_LOGINCOUNT]); +#endif + + /* ƱStoneAge ƥؤ£ + + dataplace|faceimg|level|hp|str|def|dex|charm|dp|earth|water|fire|wind|login|Name|Place + ئ£ + */ + { + snprintf( CHAR_optiondataString, + sizeof( CHAR_optiondataString ), + "%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%s", + ch->data[CHAR_DATAPLACENUMBER], + ch->data[CHAR_FACEIMAGENUMBER], + ch->data[CHAR_LV], + ch->workint[CHAR_WORKMAXHP], + ch->workint[CHAR_WORKATTACKPOWER], + ch->workint[CHAR_WORKDEFENCEPOWER], + ch->workint[CHAR_WORKQUICK], + ch->workint[CHAR_WORKFIXCHARM], + ch->data[CHAR_DUELPOINT], /* dp, FIXME */ + ch->workint[CHAR_WORKFIXEARTHAT], + ch->workint[CHAR_WORKFIXWATERAT], + ch->workint[CHAR_WORKFIXFIREAT], + ch->workint[CHAR_WORKFIXWINDAT], + ch->data[CHAR_LOGINCOUNT], + ch->string[CHAR_NAME].string, + makeEscapeString( showstr , + escapeshowstring, + sizeof(escapeshowstring) ) + ); + } + } + return CHAR_optiondataString; +} + +static char CHAR_statusSendBuffer[STRINGBUFSIZ]; + +char* CHAR_makeStatusString( int index, char* category ) +{ + char c = tolower( category[0] ); + int strlength=0; + + if( !CHAR_CHECKINDEX( index ) ) return "\0"; + + if( category == "\0" ){ + CHAR_statusSendBuffer[0] = '\0'; + return CHAR_statusSendBuffer; + } + switch( c ){ + case 'p': + { + int i; + int getCharDataArray[]= { + CHAR_NAME, + CHAR_OWNTITLE, + //CHAR_FMNAME, + }; + int exp = CHAR_getInt(index,CHAR_EXP ); + int maxexp = CHAR_GetLevelExp( index, CHAR_getInt( index, CHAR_LV ) + 1); + int attr[4]; + + for( i = 0; i < 4; i ++ ) { + attr[i] = CHAR_getWorkInt( index, CHAR_WORKFIXEARTHAT + i); + if( attr[i] < 0 ) attr[i] = 0; + } + int mytrans = CHAR_getInt( index, CHAR_TRANSMIGRATION); + //if(mytrans > 6) mytrans = 0; + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "P1|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|", + CHAR_getInt(index,CHAR_HP), + CHAR_getWorkInt(index,CHAR_WORKMAXHP), + CHAR_getInt(index,CHAR_MP), + CHAR_getWorkInt(index,CHAR_WORKMAXMP), + CHAR_getInt(index,CHAR_VITAL)/100, + CHAR_getInt(index,CHAR_STR)/100, + CHAR_getInt(index,CHAR_TOUGH)/100, + CHAR_getInt(index,CHAR_DEX)/100, + exp, maxexp, + CHAR_getInt(index,CHAR_LV), + CHAR_getWorkInt(index,CHAR_WORKATTACKPOWER), + CHAR_getWorkInt(index,CHAR_WORKDEFENCEPOWER), + CHAR_getWorkInt( index, CHAR_WORKQUICK), + CHAR_getWorkInt( index, CHAR_WORKFIXCHARM), + CHAR_getWorkInt( index, CHAR_WORKFIXLUCK), + attr[0], + attr[1], + attr[2], + attr[3], + CHAR_getInt(index,CHAR_GOLD), + CHAR_getInt(index,CHAR_INDEXOFEQTITLE), + CHAR_getInt(index,CHAR_DUELPOINT), + mytrans, + CHAR_getInt(index,CHAR_RIDEPET), + CHAR_getInt(index,CHAR_LEARNRIDE), + CHAR_getInt(index,CHAR_BASEBASEIMAGENUMBER) +#ifdef _NEW_RIDEPETS + ,CHAR_getInt( index, CHAR_LOWRIDEPETS) +#endif + + ); + strlength = strlen( CHAR_statusSendBuffer ); + for( i = 0 ; i < arraysizeof( getCharDataArray ) ; i ++ ){ + char token[256]; + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( CHAR_getChar(index, getCharDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer ) ) + return CHAR_statusSendBuffer; + } + return CHAR_statusSendBuffer; + break; + } +#ifdef _NEW_RIDEPETS + case 'x': + { + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), "X0|%d", + CHAR_getInt( index, CHAR_LOWRIDEPETS)); + return CHAR_statusSendBuffer; + break; + } +#endif + case 'f': + { + int big4fm =0; +#ifndef _NEW_RIDEPETS + switch( CHAR_getWorkInt( index, CHAR_WORKFMFLOOR) ) + { + case 1041: + big4fm = 1; + break; + case 2031: + big4fm = 2; + break; + case 3031: + big4fm = 3; + break; + case 4031: + big4fm = 4; + break; + default: + big4fm = 0; + } +#endif +#ifdef _FIX_FMNAME_RULE // WON ADD δʾ + if( CHAR_getWorkInt(index, CHAR_WORKFMSETUPFLAG)==1 ){ + snprintf( CHAR_statusSendBuffer, + sizeof( CHAR_statusSendBuffer ), + "F%s|%d|%d|%d|%d", + "()", + CHAR_getInt( index, CHAR_FMLEADERFLAG), + CHAR_getWorkInt( index, CHAR_WORKFMCHANNEL), + CHAR_getInt( index, CHAR_FMSPRITE), big4fm ); + }else +#endif + + snprintf( CHAR_statusSendBuffer, + sizeof( CHAR_statusSendBuffer ), + "F%s|%d|%d|%d|%d", + CHAR_getChar( index, CHAR_FMNAME), + CHAR_getInt( index, CHAR_FMLEADERFLAG), + CHAR_getWorkInt( index, CHAR_WORKFMCHANNEL), + CHAR_getInt( index, CHAR_FMSPRITE), big4fm ); + return CHAR_statusSendBuffer; + break; + } + case 'c': + { + int floor,xsiz,ysiz; + floor = CHAR_getInt(index,CHAR_FLOOR); + xsiz = MAP_getfloorX(floor); + ysiz = MAP_getfloorY(floor); + snprintf( CHAR_statusSendBuffer, + sizeof( CHAR_statusSendBuffer ), + "C%d|%d|%d|%d|%d", + CHAR_getInt(index,CHAR_FLOOR), + xsiz, ysiz, + CHAR_getInt(index,CHAR_X), + CHAR_getInt(index,CHAR_Y) ); + return CHAR_statusSendBuffer; + break; + } + case 'i': + { + int i; + CHAR_statusSendBuffer[0] = 'I'; + strlength = 1; + for( i = 0 ; i < CHAR_MAXITEMHAVE ; i ++ ){ + char token[512]; + int itemindex; + itemindex = CHAR_getItemIndex( index, i ); + if( itemindex >= 0 ) { + int itemtime = 0; + itemtime = ITEM_getInt(itemindex,ITEM_TIME); + if(itemtime>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(itemtime<=timep){ + char itemname[128]; + sprintf(itemname,"ĵ:%sʱЧѵϵͳջء",ITEM_getChar(itemindex,ITEM_NAME)); + CHAR_talkToCli( index, -1, itemname, CHAR_COLORYELLOW ); + CHAR_setItemIndex( index, i ,-1); + itemindex = -1; + } + } +// char itembuf[512]; +// sprintf(itembuf,"%s",ITEM_getChar(itemindex,ITEM_EFFECTSTRING)); +// if(strstr(itembuf,"Ч")!=NULL){ +// char itemtempbuf[64]; +// int year=3000,mon=13,date=32,hour=25,min=70,sec=70; +// if(getStringFromIndexWithDelim(itembuf," ", 1, itemtempbuf, sizeof(itemtempbuf)) != FALSE){ +// char itemtempbuf2[64]; +// char itemtempbuf3[64]; +// char itemtempbuf4[32]; +// if(getStringFromIndexWithDelim(itemtempbuf,"/", 1, itemtempbuf2, sizeof(itemtempbuf2)) != FALSE){ +// if(getStringFromIndexWithDelim(itemtempbuf2,":", 2, itemtempbuf3, sizeof(itemtempbuf3)) != FALSE){ +// if(getStringFromIndexWithDelim(itemtempbuf3,".", 1, itemtempbuf4, sizeof(itemtempbuf4)) != FALSE) +// year = atoi(itemtempbuf4); +// if(getStringFromIndexWithDelim(itemtempbuf3,".", 2, itemtempbuf4, sizeof(itemtempbuf4)) != FALSE) +// mon = atoi(itemtempbuf4); +// if(getStringFromIndexWithDelim(itemtempbuf3,".", 3, itemtempbuf4, sizeof(itemtempbuf4)) != FALSE) +// date = atoi(itemtempbuf4); +// } +// } +// if(getStringFromIndexWithDelim(itemtempbuf,"/", 2, itemtempbuf2, sizeof(itemtempbuf2)) != FALSE){ +// if(getStringFromIndexWithDelim(itemtempbuf2,":", 1, itemtempbuf3, sizeof(itemtempbuf3)) != FALSE) +// hour = atoi(itemtempbuf3); +// if(getStringFromIndexWithDelim(itemtempbuf2,":", 2, itemtempbuf3, sizeof(itemtempbuf3)) != FALSE) +// min = atoi(itemtempbuf3); +// if(getStringFromIndexWithDelim(itemtempbuf2,":", 3, itemtempbuf3, sizeof(itemtempbuf3)) != FALSE) +// sec = atoi(itemtempbuf3); +// } +// time_t timep; +// struct tm *p; +// time(&timep); +// p=localtime(&timep); +// int itemtype = 0; +// if(year<(1900+p->tm_year)) +// itemtype = 1; +// else if(year==(1900+p->tm_year)){ +// if(mon<(1+p->tm_mon)) +// itemtype = 1; +// else if(mon==(1+p->tm_mon)){ +// if(date<(p->tm_mday)) +// itemtype = 1; +// else if(date==(p->tm_mday)){ +// if(hour<(p->tm_hour)) +// itemtype = 1; +// else if(hour==(p->tm_hour)){ +// if(min<(p->tm_min)) +// itemtype = 1; +// else if(min==(p->tm_min)){ +// if(sec<(p->tm_sec)) +// itemtype = 1; +// } +// } +// } +// } +// } +// if(itemtype>0){ +// CHAR_setItemIndex( index, i ,-1); +// itemindex = -1; +// //CHAR_sendItemDataOne( charaindex, i); +// //ITEM_endExistItemsOne(itemindex); +// } +// } +// } + } + if( itemindex >= 0 ) { + snprintf( token ,sizeof(token),"%s|" ,ITEM_makeItemStatusString( -1, itemindex ) ); + }else { + snprintf( token ,sizeof(token),"%s|" , ITEM_makeItemFalseString() ); + } + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) return CHAR_statusSendBuffer; + } + dchop( CHAR_statusSendBuffer , "|" ); + return CHAR_statusSendBuffer; + break; + } + case 's': + { + int i; + CHAR_statusSendBuffer[0] = 'S'; + strlength = 1; + + for( i = 0 ; i < CHAR_SKILLMAXHAVE ; i ++ ){ + char token[256]; + CHAR_HaveSkill* hskill; + + hskill = CHAR_getCharHaveSkill( index, i ); + + if( hskill != NULL && hskill->use == TRUE ){ +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + snprintf( token , sizeof(token), "%s|", SKILL_makeSkillStatusString(&hskill->skill, index, i) ); +#else + snprintf( token , sizeof(token), "%s|", SKILL_makeSkillStatusString(&hskill->skill) ); +#endif + }else{ + snprintf( token , sizeof(token), "%s|", SKILL_makeSkillFalseString() ); + } + + strcpysafe( CHAR_statusSendBuffer + strlength, sizeof(CHAR_statusSendBuffer)-strlength, token ); + + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) + return CHAR_statusSendBuffer; + } + + dchop( CHAR_statusSendBuffer , "|" ); + return CHAR_statusSendBuffer; + break; + } + case 't': + { + int i; + CHAR_statusSendBuffer[0] = 'T'; + strlength = 1; + for( i = 0 ; i < CHAR_TITLEMAXHAVE ; i ++ ){ + char token[256]; + char escape[256]; + snprintf( token , sizeof(token), "%s|" , + makeEscapeString( TITLE_makeTitleStatusString(index, + i ), + escape,sizeof(escape) ) ); + + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) + return CHAR_statusSendBuffer; + } + dchop( CHAR_statusSendBuffer , "|" ); + return CHAR_statusSendBuffer; + break; + } + case 'd': + snprintf( CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "D%d|%ld",CHAR_getWorkInt(index,CHAR_WORKOBJINDEX), + NowTime.tv_sec ); + return CHAR_statusSendBuffer; + break; + case 'm': + snprintf( CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "M%d|%d|%d", + CHAR_getInt( index,CHAR_HP ), + CHAR_getInt( index,CHAR_MP ), + CHAR_getInt( index,CHAR_EXP ) ); + return CHAR_statusSendBuffer; + break; + case 'e': + return "\0"; + + case 'n': + { + int num; + + int i, nindex = -1; + int getCharDataArray[]= { + CHAR_NAME + }; + num = tolower( category[1] ) - '0'; + + if( num < 0 || num >= CHAR_PARTYMAX ){ + print( "ģʽʧ (%c)%d \n", num, num ); + break; + } + + nindex = CHAR_getPartyIndex( index, num); + + if( nindex == -1 ){ + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "N%d|0|", num ); + return CHAR_statusSendBuffer; + }else{ + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "N%d|1|%d|%d|%d|%d|%d|", + num, + CHAR_getWorkInt( nindex, CHAR_WORKOBJINDEX), + CHAR_getInt( nindex, CHAR_LV), + CHAR_getWorkInt( nindex, CHAR_WORKMAXHP), + CHAR_getInt( nindex, CHAR_HP), + CHAR_getInt( nindex, CHAR_MP) + + ); + } + strlength = strlen( CHAR_statusSendBuffer ); + + for( i = 0 ; i < arraysizeof( getCharDataArray ) ; i ++ ){ + char token[256]; + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( CHAR_getChar(nindex, + getCharDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer ) ) + return CHAR_statusSendBuffer; + } + + return CHAR_statusSendBuffer; + break; + } + case 'k': + { + int num; + int i, pindex; + int getCharDataArray[]= { + CHAR_NAME, + CHAR_USERPETNAME, + }; + num = tolower( category[1] ) - '0'; + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ģʽʧ (%c)%d \n", num, num ); + break; + } + pindex = CHAR_getCharPet( index, num ); + if( pindex == -1 ){ + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "K%d|0|", num ); + return CHAR_statusSendBuffer; + }else{ + int attr[4]; + BOOL changenameflg = FALSE; + char *mycdkey; + char *cdkey = NULL; + for( i = 0; i < 4; i ++ ) { + attr[i] = CHAR_getWorkInt( pindex, CHAR_WORKFIXEARTHAT + i); + if( attr[i] < 0 ) attr[i] = 0; + } + mycdkey = CHAR_getChar( index, CHAR_CDKEY); + { + cdkey = CHAR_getChar( pindex, CHAR_CDKEY); + if( cdkey == "\0" ) { + print( "can't get CDKEY\n"); + }else { + + if( strlen( cdkey) == 0 || + strcmp( cdkey, mycdkey) == 0 ){ + changenameflg = TRUE; + } + } + } + + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), +// Syu ADD ı佻ʱתɫ +#ifdef _SHOW_FUSION + "K%d|1|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|", +#else + "K%d|1|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|", +#endif + num, + CHAR_getInt(pindex,CHAR_BASEIMAGENUMBER), + CHAR_getInt(pindex,CHAR_HP), + CHAR_getWorkInt(pindex,CHAR_WORKMAXHP), + CHAR_getInt(pindex,CHAR_MP), + CHAR_getWorkInt(pindex,CHAR_WORKMAXMP), + CHAR_getInt(pindex,CHAR_EXP ), + CHAR_GetLevelExp( pindex,CHAR_getInt( pindex, CHAR_LV ) + 1), + CHAR_getInt(pindex,CHAR_LV), + CHAR_getWorkInt(pindex, CHAR_WORKATTACKPOWER), + CHAR_getWorkInt(pindex, CHAR_WORKDEFENCEPOWER), + CHAR_getWorkInt( pindex, CHAR_WORKQUICK), + CHAR_getWorkInt( pindex, CHAR_WORKFIXAI), + attr[0], + attr[1], + attr[2], + attr[3], + CHAR_getInt( pindex, CHAR_SLOT), +// Syu ADD ı佻ʱתɫ + changenameflg, + CHAR_getInt( pindex,CHAR_TRANSMIGRATION) +#ifdef _SHOW_FUSION + ,CHAR_getInt ( pindex, CHAR_FUSIONBEIT) +#endif + ); + + } + strlength = strlen( CHAR_statusSendBuffer ); + for( i = 0 ; i < arraysizeof( getCharDataArray ) ; i ++ ){ + char token[256]; + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( CHAR_getChar(pindex, + getCharDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer ) ) + return CHAR_statusSendBuffer; + } + return CHAR_statusSendBuffer; + break; + } + + case 'j': +{ + + int num; + int i, itemindex; + int getMagicDataArray[]= { + MAGIC_NAME, + MAGIC_COMMENT, + }; + num = tolower( category[1] ) - '0'; + + if( num < 0 || num >= CHAR_EQUIPPLACENUM ){ + break; + } + + itemindex = CHAR_getItemIndex( index, num ); + if( !ITEM_CHECKINDEX( itemindex) ) { + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "J%d|0|", num ); + return CHAR_statusSendBuffer; + }else{ + int magicindex = MAGIC_getMagicArray( ITEM_getInt( itemindex, ITEM_MAGICID)); + if( magicindex == -1 ) { + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "J%d|0|", num ); + return CHAR_statusSendBuffer; + } + int magicmp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP); + if(CHAR_getInt(index,CHAR_LV)<100 && CHAR_getInt(index,CHAR_TRANSMIGRATION)<1){ //CFָ0ת100֮ǰ + char magictmpbuf[32]; + sprintf(magictmpbuf,",%d,",ITEM_getInt( itemindex, ITEM_MAGICID)); + if(strstr(getNoMpMagic(),magictmpbuf)!=NULL){ + magicmp = 0; + } + } + snprintf(CHAR_statusSendBuffer,sizeof(CHAR_statusSendBuffer), + "J%d|1|%d|%d|%d|", + num, + magicmp, + MAGIC_getInt( magicindex, MAGIC_FIELD), + MAGIC_getInt( magicindex, MAGIC_TARGET)); + strlength = strlen( CHAR_statusSendBuffer ); + + for( i = 0 ; i < arraysizeof( getMagicDataArray ) ; i ++ ){ + char token[256]; + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( MAGIC_getChar(magicindex, + getMagicDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer ) ) + return CHAR_statusSendBuffer; + } + return CHAR_statusSendBuffer; + } + } + break; + + case 'w': +{ + int num; + int i,petskillloop, pindex; + char tmp[16]; + int getPetSkillDataArray[]= { + PETSKILL_NAME, + PETSKILL_COMMENT, + }; + + num = tolower( category[1] ) - '0'; + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ؼʧ (%c)%d \n", num, num ); + break; + } + + pindex = CHAR_getCharPet( index, num ); + if( !CHAR_CHECKINDEX(pindex)){ + return "\0"; + } + snprintf( tmp, sizeof( tmp), "W%d|", num); + strcpysafe( CHAR_statusSendBuffer, sizeof( CHAR_statusSendBuffer), + tmp); + strlength += strlen( tmp); + if( strlength >= arraysizeof( CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + for( petskillloop = 0; petskillloop < CHAR_MAXPETSKILLHAVE; petskillloop ++ ) { + int skillid = CHAR_getPetSkill( pindex, petskillloop); + int petskillindex = PETSKILL_getPetskillArray( skillid ); + if( PETSKILL_CHECKINDEX( petskillindex) ) { + char token[256]; + snprintf( token, sizeof( token), + "%d|%d|%d|", + + PETSKILL_getInt( petskillindex, PETSKILL_ID), + PETSKILL_getInt( petskillindex, PETSKILL_FIELD), + PETSKILL_getInt( petskillindex, PETSKILL_TARGET) + ); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer)) { + return CHAR_statusSendBuffer; + } + + for( i = 0 ; i < arraysizeof( getPetSkillDataArray ) ; i ++ ){ + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( + PETSKILL_getChar(petskillindex, + getPetSkillDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer )) { + return CHAR_statusSendBuffer; + } + } + } + else { + char token[256]; + snprintf( token, sizeof( token),"|||||"); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + } + } + return CHAR_statusSendBuffer; +} + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + case 'y': +{ + int num = 0, f_num = 0; + int i,petskillloop, pindex; + char tmp[16]; + int getPetSkillDataArray[]= { + PETSKILL_NAME, + PETSKILL_COMMENT, + }; + + num = tolower( category[1] ) - '0'; + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ؼʧ (%c)%d \n", num, num ); + break; + } + + pindex = CHAR_getCharPet( index, num ); + if( !CHAR_CHECKINDEX(pindex)){ + return "\0"; + } + snprintf( tmp, sizeof( tmp), "W%d|", num); + strcpysafe( CHAR_statusSendBuffer, sizeof( CHAR_statusSendBuffer), + tmp); + strlength += strlen( tmp); + if( strlength >= arraysizeof( CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + + if( CHAR_getWorkInt( pindex, CHAR_WORKOBLIVION) > 0 ) + f_num = CHAR_getWorkInt( pindex, CHAR_WORKMODOBLIVION ) + 1;// 輼 + + for( petskillloop = 0; petskillloop < CHAR_MAXPETSKILLHAVE; petskillloop ++ ) { + int skillid = CHAR_getPetSkill( pindex, petskillloop); + int petskillindex = PETSKILL_getPetskillArray( skillid ); + if( PETSKILL_CHECKINDEX( petskillindex) ) { + char token[256]; + int field = -1, target = -1; + int oblivion = CHAR_getWorkInt( pindex, CHAR_WORKOBLIVION ); + int p_id = PETSKILL_getInt( petskillindex, PETSKILL_ID); + int rand_num = RAND( 0, 100 ); + + // + if( (oblivion > 0) && ( f_num > 0 ) && ( rand_num <= 60 ) && ( p_id != 1 ) ){ + field = PETSKILL_FIELD_MAP; + target = PETSKILL_TARGET_NONE; + f_num --; + }else{ + field = PETSKILL_getInt( petskillindex, PETSKILL_FIELD); + target = PETSKILL_getInt( petskillindex, PETSKILL_TARGET); + } + + snprintf( token, sizeof( token),"%d|%d|%d|", +// PETSKILL_getInt( petskillindex, PETSKILL_ID), + p_id, + field, target + ); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer)) { + return CHAR_statusSendBuffer; + } + + for( i = 0 ; i < arraysizeof( getPetSkillDataArray ) ; i ++ ){ + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( + PETSKILL_getChar(petskillindex, + getPetSkillDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer )) { + return CHAR_statusSendBuffer; + } + } + } + else { + char token[256]; + snprintf( token, sizeof( token),"|||||"); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + } + } + return CHAR_statusSendBuffer; +} +#endif + +#ifdef _PETSKILL_DAMAGETOHP +//սзͼܷ + case 'o': +{ + int getPetSkillDataArray[]= { + PETSKILL_NAME, + PETSKILL_COMMENT, + }; + int i,petskillloop, pindex=index; + int num = 0;//, f_num = 0; + char tmp[16]; + + num = tolower( category[1] ) - '0'; + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ؼʧ (%c)%d \n", num, num ); + break; + } + + pindex = CHAR_getCharPet( index, num ); + if( !CHAR_CHECKINDEX(pindex)){ + return "\0"; + } +#ifdef _WAN_FIX + if(CHAR_getWorkInt(index,CHAR_WORKBATTLEINDEX)>-1){ + return "\0"; + } +#endif + snprintf( tmp, sizeof( tmp), "W%d|", num); + strcpysafe( CHAR_statusSendBuffer, sizeof( CHAR_statusSendBuffer), + tmp); + strlength += strlen( tmp); + if( strlength >= arraysizeof( CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + + for( petskillloop = 0; petskillloop < CHAR_MAXPETSKILLHAVE; petskillloop ++ ) { + int skillid = CHAR_getPetSkill( pindex, petskillloop); + int petskillindex = PETSKILL_getPetskillArray( skillid ); + if( PETSKILL_CHECKINDEX( petskillindex) ) { + char token[256]; + int field = -1, target = -1; + //int oblivion = CHAR_getWorkInt( pindex, CHAR_WORKOBLIVION ); + int p_id = PETSKILL_getInt( petskillindex, PETSKILL_ID); + + //50%ҼΪ ԡѪϮ ܲѡ + if( ( CHAR_getInt( pindex, CHAR_HP ) > CHAR_getWorkInt( pindex, CHAR_WORKMAXHP )*0.5 + && strcmp(PETSKILL_getChar( petskillindex, PETSKILL_NAME),"ԡѪϮ" ) == 0 ) + ){ + field = PETSKILL_FIELD_MAP; + target = PETSKILL_TARGET_NONE; + }else{ + field = PETSKILL_getInt( petskillindex, PETSKILL_FIELD); + target = PETSKILL_getInt( petskillindex, PETSKILL_TARGET); + } + + snprintf( token, sizeof( token),"%d|%d|%d|", +// PETSKILL_getInt( petskillindex, PETSKILL_ID), + p_id, + field, target + ); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer)) { + return CHAR_statusSendBuffer; + } + + for( i = 0 ; i < arraysizeof( getPetSkillDataArray ) ; i ++ ){ + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( + PETSKILL_getChar(petskillindex, + getPetSkillDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer )) { + return CHAR_statusSendBuffer; + } + } + } + else { + char token[256]; + snprintf( token, sizeof( token),"|||||"); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + } + } + return CHAR_statusSendBuffer; +} +#endif + +#ifdef _PETSKILL_BECOMEFOX + case 'a': +{ + int getPetSkillDataArray[]= { + PETSKILL_NAME, + PETSKILL_COMMENT, + }; + int i,petskillloop, pindex=index; + int num = 0;//, f_num = 0; + char tmp[16]; + + num = tolower( category[1] ) - '0'; + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ؼʧ (%c)%d \n", num, num ); + break; + } + print( "ؼ" ); + pindex = CHAR_getCharPet( index, num ); + if( !CHAR_CHECKINDEX(pindex)){ + return "\0"; + } + snprintf( tmp, sizeof( tmp), "W%d|", num); + strcpysafe( CHAR_statusSendBuffer, sizeof( CHAR_statusSendBuffer), + tmp); + strlength += strlen( tmp); + if( strlength >= arraysizeof( CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + + for( petskillloop = 0; petskillloop < CHAR_MAXPETSKILLHAVE; petskillloop ++ ) { + int skillid = CHAR_getPetSkill( pindex, petskillloop); + int petskillindex = PETSKILL_getPetskillArray( skillid ); + if( PETSKILL_CHECKINDEX( petskillindex) ) { + char token[256]; + int field = -1, target = -1; + //int oblivion = CHAR_getWorkInt( pindex, CHAR_WORKOBLIVION ); + int p_id = PETSKILL_getInt( petskillindex, PETSKILL_ID); + + //Ϊ ܲѡ + print("\n:%s",PETSKILL_getChar( petskillindex, PETSKILL_NAME)); + if( strcmp(PETSKILL_getChar( petskillindex, PETSKILL_NAME),"" ) == 0 + || strcmp(PETSKILL_getChar( petskillindex, PETSKILL_NAME),"" ) == 0 + || strcmp(PETSKILL_getChar( petskillindex, PETSKILL_NAME),"" ) == 0){ + field = PETSKILL_getInt( petskillindex, PETSKILL_FIELD); + target = PETSKILL_getInt( petskillindex, PETSKILL_TARGET); + }else{ + field = PETSKILL_FIELD_MAP; + target = PETSKILL_TARGET_NONE; + } + + snprintf( token, sizeof( token),"%d|%d|%d|", +// PETSKILL_getInt( petskillindex, PETSKILL_ID), + p_id, + field, target + ); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer)) { + return CHAR_statusSendBuffer; + } + + for( i = 0 ; i < arraysizeof( getPetSkillDataArray ) ; i ++ ){ + char escapebuffer[128]; + snprintf( token, + sizeof( token ), + "%s" STATUSSENDDELIMITER, + makeEscapeString( + PETSKILL_getChar(petskillindex, + getPetSkillDataArray[i]), + escapebuffer,sizeof(escapebuffer) + )); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof( CHAR_statusSendBuffer ) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= sizeof( CHAR_statusSendBuffer )) { + return CHAR_statusSendBuffer; + } + } + } + else { + char token[256]; + snprintf( token, sizeof( token),"|||||"); + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, + token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) { + return CHAR_statusSendBuffer; + } + } + } + return CHAR_statusSendBuffer; +} +#endif + + default: + break; + } + + CHAR_statusSendBuffer[0] = '\0'; + return CHAR_statusSendBuffer; +} + +//BOOL CHAR_sendStatusString( int charaindex, char* category ) +BOOL _CHAR_sendStatusString( int charaindex, char* category, char* file, int line ) +{ + char* string; + + //print("\nsend_S:%s:%d ", file, line); + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + string = CHAR_makeStatusString( charaindex, category ); + + if( string != "\0" ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} + +void CHAR_inputOwnTitle( int index ,char* name ) +{ + if( !CHAR_CHECKINDEX( index ) ) return; + + if( CHAR_getFlg( index,CHAR_ISDIE ) )return; + + CHAR_setChar( index, CHAR_OWNTITLE ,name); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( index, CHAR_WORKOBJINDEX) ); + + CHAR_send_P_StatusString( index, CHAR_P_STRING_OWNTITLE ); +} + + +void CHAR_selectTitle( int index, int titleindex ) +{ + if( !CHAR_CHECKINDEX( index ) )return; + + if( CHAR_getFlg( index,CHAR_ISDIE ) )return; + + if( titleindex == -1 ){ + CHAR_setInt( index, CHAR_INDEXOFEQTITLE, titleindex); + }else if( titleindex < 0 || titleindex >= CHAR_TITLEMAXHAVE ) { + return; + } + else{ + + int title = CHAR_getCharHaveTitle( index,titleindex ); + + if( TITLE_getTitleIndex( title) != -1 ){ + CHAR_setInt( index, CHAR_INDEXOFEQTITLE, titleindex); + } + } + + CHAR_sendStatusString( index, "T" ); + CHAR_send_P_StatusString( index, CHAR_P_STRING_TITLE ); +} + + +void CHAR_deleteTitle( int index, int titleindex ) +{ + int title; + + if( !CHAR_CHECKINDEX( index ) )return; + /* ƥݷֻ */ + if( CHAR_getFlg( index,CHAR_ISDIE ) )return; + + if( titleindex < 0 || titleindex >= CHAR_TITLEMAXHAVE )return; + title = CHAR_getCharHaveTitle( index,titleindex ); + /*if( TITLE_CHECKTABLEINDEX( title ) == FALSE )*/ + if( TITLE_getTitleIndex( title) == -1 ) { + return; + } + CHAR_setCharHaveTitle( index,titleindex,-1 ); + + /* лȻ֧ئɣľئƱ */ + if( CHAR_getInt(index, CHAR_INDEXOFEQTITLE) == titleindex ) + CHAR_setInt(index, CHAR_INDEXOFEQTITLE, -1 ); + + /* + * ë˪£ + */ + CHAR_sendStatusString( index, "T" ); + CHAR_send_P_StatusString( index, CHAR_P_STRING_TITLE ); +} + +static void CHAR_initcharWorkInt( index ) +{ + float hp; + static struct substitutionTable{ + CHAR_WORKDATAINT workindex; + CHAR_DATAINT intindex; + }subtbl[]={ + { CHAR_WORKMAXMP, CHAR_MAXMP }, + { CHAR_WORKFIXFIREAT, CHAR_FIREAT }, + { CHAR_WORKFIXWATERAT, CHAR_WATERAT}, + { CHAR_WORKFIXEARTHAT, CHAR_EARTHAT}, + { CHAR_WORKFIXWINDAT, CHAR_WINDAT }, + { CHAR_WORKFIXCHARM, CHAR_CHARM }, + { CHAR_WORKFIXLUCK, CHAR_LUCK }, + { CHAR_WORKFIXLUCK, CHAR_LUCK }, + { CHAR_WORKMODPOISON, CHAR_POISON }, + { CHAR_WORKMODPARALYSIS,CHAR_PARALYSIS }, + { CHAR_WORKMODSLEEP, CHAR_SLEEP }, + { CHAR_WORKMODSTONE, CHAR_STONE }, + { CHAR_WORKMODDRUNK, CHAR_DRUNK }, + { CHAR_WORKMODCONFUSION, CHAR_CONFUSION } + }; + + int i; + for( i=0 ; i 0 ){ + CHAR_setWorkInt( index, CHAR_WORKFIXEARTHAT + (i + 2) % 4, attr * -1); + } + } + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + { + // 翹 + //for( i=0; i<3; i++) + // CHAR_setWorkInt( index, CHAR_WORK_F_RESIST+i, CHAR_getInt( index, PROFESSION_FIRE_R+i ) ); + } +#endif + + + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, + CHAR_getInt( index, CHAR_DEX) * 0.01 ); + CHAR_setWorkInt( index, CHAR_WORKFIXVITAL, + CHAR_getInt( index, CHAR_VITAL) * 0.01 ); + + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, + CHAR_getInt( index, CHAR_STR) * 0.01 * 1.0 +//#ifdef _BATTLE_NEWPOWER +// + CHAR_getInt( index, CHAR_DEX) * 0.01 * 0.05 +// + CHAR_getInt( index, CHAR_VITAL) * 0.01 * 0.05 ); // +//#else + + CHAR_getInt( index, CHAR_TOUGH) * 0.01 * 0.1 + + CHAR_getInt( index, CHAR_VITAL) * 0.01 * 0.1 + + CHAR_getInt( index, CHAR_DEX) * 0.01 * 0.05 ); +//#endif + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, + CHAR_getInt( index, CHAR_TOUGH) * 0.01 * 1.0 +//#ifdef _BATTLE_NEWPOWER +// + CHAR_getInt( index, CHAR_DEX) * 0.01 * 0.05 +// + CHAR_getInt( index, CHAR_VITAL) * 0.01 * 0.05 ); // +//#else + + CHAR_getInt(index,CHAR_STR) * 0.01 * 0.1 + + CHAR_getInt(index,CHAR_VITAL) * 0.01 * 0.1 + + CHAR_getInt(index,CHAR_DEX) * 0.01 * 0.05 ); +//#endif + +#ifdef _ITEMSET5_TXT + { + CHAR_setWorkInt( index, CHAR_WORKFIXARRANGE, 0); + CHAR_setWorkInt( index, CHAR_WORKFIXSEQUENCE, 0); + CHAR_setWorkInt( index, CHAR_WORKATTACHPILE, 0); + CHAR_setWorkInt( index, CHAR_WORKHITRIGHT, 0); + } +#endif + + + +#ifdef _ITEMSET6_TXT + { + CHAR_setWorkInt( index, CHAR_WORKNEGLECTGUARD, 0); + } +#endif + + + hp = ( CHAR_getInt(index,CHAR_VITAL) * 4 + + CHAR_getInt(index,CHAR_STR) * 1 + + CHAR_getInt(index,CHAR_TOUGH) * 1 + + CHAR_getInt(index,CHAR_DEX) * 1 ) * 0.01; + + CHAR_setWorkInt( index, CHAR_WORKMAXHP, (int)hp ); + CHAR_setWorkInt( index, CHAR_WORKMAXMP, CHAR_getInt( index, CHAR_MAXMP)); + + int fmfloor = CHAR_getWorkInt( index, CHAR_WORKFMFLOOR); +#ifdef _FM_WELFARE + if( fmfloor !=-1 && CHAR_getInt( index, CHAR_FMLEADERFLAG ) != FMMEMBER_NONE + && CHAR_getInt( index, CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY && CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + char* fmbuf=NULL; + char* pszP=NULL; + int fPer; + switch(fmfloor){ + case 1041: + fmbuf = getFmWelfare(0); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 2031: + fmbuf = getFmWelfare(1); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 3031: + fmbuf = getFmWelfare(2); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 4031: + fmbuf = getFmWelfare(3); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 5031: + fmbuf = getFmWelfare(4); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 6031: + fmbuf = getFmWelfare(5); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 7031: + fmbuf = getFmWelfare(6); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 8031: + fmbuf = getFmWelfare(7); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 9031: + fmbuf = getFmWelfare(8); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + case 10031: + fmbuf = getFmWelfare(9); + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXSTR,CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXTOUGH,CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKFIXDEX,CHAR_getWorkInt(index,CHAR_WORKFIXDEX)+fPer); + break; + } + if( (pszP = strstr( fmbuf, "" ) ) != NULL ){ + sscanf( pszP+2, "%d", &fPer ); + + //趨ֵ + CHAR_setWorkInt(index,CHAR_WORKMAXHP,CHAR_getWorkInt(index,CHAR_WORKMAXHP)+fPer); + break; + } + break; + default: + break; + } + } +#endif +#ifdef _FMZUZHANG_MSG + if(fmfloor>0 && CHAR_getInt(index, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER && CHAR_getWorkInt( index, CHAR_WORKLOGININTYPE) == 0){ + char floorbuf[10]; + sprintf(floorbuf,"%d",fmfloor); + if(strstr(getFmZuzhang(),floorbuf)){ + char zuzhangmsg[256]; + int i,playernum; + playernum = CHAR_getPlayerMaxNum(); + sprintf(zuzhangmsg,"%sׯ%sҿȥΧۣ",MAP_getFloorName(fmfloor-1),CHAR_getChar(index,CHAR_NAME)); + CHAR_setWorkInt( index, CHAR_WORKLOGININTYPE,1); + for( i = 0 ; i < playernum ; i++) + { + CHAR_talkToCli( i, -1, zuzhangmsg, CHAR_COLORRED); + } + } + } +#endif + + CHAR_setWorkInt( index, CHAR_WORKATTACKPOWER, + CHAR_getWorkInt(index,CHAR_WORKFIXSTR) ); + CHAR_setWorkInt( index, CHAR_WORKDEFENCEPOWER, + CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH) ); + CHAR_setWorkInt( index, CHAR_WORKQUICK, + CHAR_getWorkInt( index, CHAR_WORKFIXDEX)); +#ifdef _ADD_DEAMGEDEFC + CHAR_setWorkInt( index, CHAR_WORKOTHERDMAGE, 0); + CHAR_setWorkInt( index, CHAR_WORKOTHERDEFC, 0); +#endif + + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPET) { + int hostindex; + CHAR_setWorkInt( index, CHAR_WORKFIXAI, 0); + hostindex = CHAR_getWorkInt( index, CHAR_WORKPLAYERINDEX); + if( CHAR_CHECKINDEX( hostindex)) { + int ai; + int modai = CHAR_getInt( index, CHAR_MODAI); + double R; + if( modai <= 0 ) modai = 100; + R = 1.10; + ai = ( (CHAR_getInt( hostindex, CHAR_LV) + * CHAR_getWorkInt( hostindex, CHAR_WORKFIXCHARM ) + * R) + / + (CHAR_getInt( index, CHAR_LV)* modai) * 100 ) ; + if( ai > 100 ) ai = 100; + + ai += CHAR_getInt( index, CHAR_VARIABLEAI) * 0.01; + if( CHAR_getInt( hostindex, CHAR_TRANSMIGRATION ) > 0 ){ + // shan 120 -> 140 + ai += ( CHAR_GetLevel() - CHAR_getInt( hostindex, CHAR_LV ) ) / 2; + } + if( ai < 0 ) ai = 0; + if( ai > 100 ) ai = 100; + CHAR_setWorkInt( index, CHAR_WORKFIXAI, ai); + } + } +} + +int _CHAR_complianceParameter( int index, char *FILE, int LINE) +{ + //print("\ncompPara:%s:%d", FILE, LINE); + + if( !CHAR_CHECKINDEX( index)) return 0; +//CAX + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER + && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEENEMY + && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPET +#ifdef _ALLBLUES_LUA + && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPELUANPC +#endif +#ifdef _PLAYER_NPC + && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERNPC + && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYERPETNPC +#endif + ){ + return 0; + } + CHAR_initcharWorkInt( index ); + ITEM_equipEffect( index ); + + CHAR_setWorkInt(index, CHAR_WORKATTACKPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXSTR ) ); + CHAR_setWorkInt(index, CHAR_WORKDEFENCEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH ) ); + CHAR_setWorkInt(index, CHAR_WORKQUICK, + CHAR_getWorkInt( index, CHAR_WORKFIXDEX ) ); + +#ifdef _ITEMSET5_TXT + CHAR_setWorkInt(index, CHAR_WORKARRANGEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXARRANGE ) ); + CHAR_setWorkInt(index, CHAR_WORKSEQUENCEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXSEQUENCE ) ); +#endif + + Other_DefcharWorkInt( index); + CHAR_setInt( index, CHAR_HP, min( CHAR_getInt(index,CHAR_HP), CHAR_getWorkInt( index, CHAR_WORKMAXHP))); + CHAR_setInt( index, CHAR_MP, min( CHAR_getInt(index,CHAR_MP), CHAR_getWorkInt( index, CHAR_WORKMAXMP))); + + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + if( CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW ) != -1 ){ + int petindex = CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW ); + if( !CHAR_CHECKINDEX( petindex) ){ + CHAR_setWorkInt( index, CHAR_WORKPETFOLLOW, -1); + }else{ + if( CHAR_getInt( petindex, CHAR_WHICHTYPE) == CHAR_TYPEPET && + !CHAR_CHECKINDEX( CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX)) ){ + CHAR_setWorkInt( index, CHAR_WORKPETFOLLOW, petindex); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, index); + } + } + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + { + int i; + + for( i=0; i NowTime.tv_sec +#ifdef _NPCCHANGE_PLAYERIMG + || CHAR_getWorkInt( index, CHAR_WORKNPCMETAMO) > 0 +#endif +#ifdef _PETSKILL_BECOMEPIG + || CHAR_getInt( index, CHAR_BECOMEPIG) > -1 +#endif + ){ + newimagenumber = oldimagenumber; //ָԭͼ + } +#endif + // Arminius 8.9 airplane + if (oldimagenumber==100259) newimagenumber=100259; +#ifdef _VARY_WOLF + if( (CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPET) && + (CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) && + oldimagenumber == 101428 ){ + newimagenumber = 101428; + } +#endif + +#ifdef _ENEMY_FALLGROUND + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEENEMY ) { + return 0; + }else { +#endif + if(CHAR_getInt(index, CHAR_RIDEPET) == -1){ + if( newimagenumber == -1 ){ + CHAR_setInt(index,CHAR_BASEIMAGENUMBER, basebaseimagenumber); + }else { + CHAR_setInt(index,CHAR_BASEIMAGENUMBER,newimagenumber); + } + } + +#ifdef _ENEMY_FALLGROUND + } +#endif +#ifdef _NEW_RIDEPETS + if( (CHAR_getWorkInt(index, CHAR_WORKITEMMETAMO)>NowTime.tv_sec) + || (CHAR_getWorkInt(index,CHAR_WORKNPCMETAMO)>0)){ + return 0; + } +#endif + } + return 1; +} + +int CHAR_complianceParameter2( int index) +{ + //print("\ncompPara:%s:%d", FILE, LINE); + + if( !CHAR_CHECKINDEX( index)) return 0; + + //CHAR_initcharWorkInt( index ); + //ITEM_equipEffect( index ); + + CHAR_setWorkInt(index, CHAR_WORKATTACKPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXSTR ) ); + CHAR_setWorkInt(index, CHAR_WORKDEFENCEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH ) ); + CHAR_setWorkInt(index, CHAR_WORKQUICK, + CHAR_getWorkInt( index, CHAR_WORKFIXDEX ) ); + +#ifdef _ITEMSET5_TXT + CHAR_setWorkInt(index, CHAR_WORKARRANGEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXARRANGE ) ); + CHAR_setWorkInt(index, CHAR_WORKSEQUENCEPOWER, + CHAR_getWorkInt( index, CHAR_WORKFIXSEQUENCE ) ); +#endif + + Other_DefcharWorkInt( index); + CHAR_setInt( index, CHAR_HP, min( CHAR_getInt(index,CHAR_HP), CHAR_getWorkInt( index, CHAR_WORKMAXHP))); + CHAR_setInt( index, CHAR_MP, min( CHAR_getInt(index,CHAR_MP), CHAR_getWorkInt( index, CHAR_WORKMAXMP))); + + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + if( CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW ) != -1 ){ + int petindex = CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW ); + if( !CHAR_CHECKINDEX( petindex) ){ + CHAR_setWorkInt( index, CHAR_WORKPETFOLLOW, -1); + }else{ + if( CHAR_getInt( petindex, CHAR_WHICHTYPE) == CHAR_TYPEPET && + !CHAR_CHECKINDEX( CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX)) ){ + CHAR_setWorkInt( index, CHAR_WORKPETFOLLOW, petindex); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, index); + } + } + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + { + int i; + + for( i=0; i NowTime.tv_sec +#ifdef _NPCCHANGE_PLAYERIMG + || CHAR_getWorkInt( index, CHAR_WORKNPCMETAMO) > 0 +#endif +#ifdef _PETSKILL_BECOMEPIG + || CHAR_getInt( index, CHAR_BECOMEPIG) > -1 +#endif + ){ + newimagenumber = oldimagenumber; //ָԭͼ + } +#endif + // Arminius 8.9 airplane + if (oldimagenumber==100259) newimagenumber=100259; +#ifdef _VARY_WOLF + if( (CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPET) && + (CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) && + oldimagenumber == 101428 ){ + newimagenumber = 101428; + } +#endif + +#ifdef _ENEMY_FALLGROUND + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEENEMY ) { + return 0; + }else { +#endif + if(CHAR_getInt(index, CHAR_RIDEPET) == -1){ + if( newimagenumber == -1 ){ + CHAR_setInt(index,CHAR_BASEIMAGENUMBER, basebaseimagenumber); + }else { + CHAR_setInt(index,CHAR_BASEIMAGENUMBER,newimagenumber); + } + } + +#ifdef _ENEMY_FALLGROUND + } +#endif +#ifdef _NEW_RIDEPETS + if( (CHAR_getWorkInt(index, CHAR_WORKITEMMETAMO)>NowTime.tv_sec) + || (CHAR_getWorkInt(index,CHAR_WORKNPCMETAMO)>0)){ + return 0; + } +#endif + } + return 1; +} + +/*====================================================================== + ƽҷ¼ʧ ةë + ======================================================================*/ + +/*====================έ====================*/ +/*------------------------------------------------------------ + * ϶ƥ ƽҷέìë Ϸ + * ¦ + * charaindex int ƽҷ̼͵ + * dir int + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_Look( int charaindex, int dir ) +{ + int fl ,x,y; + OBJECT object; + + /* ̼͵ */ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + + if( dir < 0 ) { + dir = CHAR_getInt(charaindex,CHAR_DIR); + } + VALIDATEDIR(dir); + if( CHAR_getInt( charaindex, CHAR_DIR) != dir ) { + CHAR_setInt(charaindex,CHAR_DIR,dir); + /* ʧë˪ */ + CHAR_sendWatchEvent(CHAR_getWorkInt(charaindex,CHAR_WORKOBJINDEX), + CHAR_ACTTURN,NULL,0,TRUE); + } + + fl = CHAR_getInt(charaindex,CHAR_FLOOR); + CHAR_getCoordinationDir( CHAR_getInt(charaindex,CHAR_DIR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + 1, &x, &y ); + + //CHAR_talkToCli( charaindex, -1, "ܻ", CHAR_COLORWHITE ); + + for( object=MAP_getTopObj(fl,x,y) ; object ; + object = NEXT_OBJECT(object) ){ + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + typedef void (*LOOKF)(int,int); + LOOKF lf; + lf = (LOOKF)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex),CHAR_LOOKEDFUNC); + if( lf ) lf(OBJECT_getIndex(objindex),charaindex); +#ifdef _ALLBLUES_LUA + else{ + RunCharTalkedEvent(OBJECT_getIndex(objindex),charaindex,"hi",1, -1); + } +#endif + } + } +} + +BOOL _CHAR_makeObjectCString( char *file, int line, int objindex,char* buf, int buflen ) +{ + char objindexbuf[64]; + if( CHECKOBJECT(objindex) == FALSE ) return FALSE; + + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_NOUSE: + return FALSE; + break; + case OBJTYPE_CHARA: + { + int charaindex = OBJECT_getIndex(objindex); + char escapename[256]; + char escapetitle[256]; + // shan add +1 + char tmp[256]; + int namecolor; +#ifdef _TRANS_6 +#ifdef _TRANS_7 + int namecolortbl[] = { CHAR_COLORWHITE, CHAR_COLORYELLOW, CHAR_COLORGREEN, + CHAR_COLORCYAN, CHAR_COLORRED, CHAR_COLORPURPLE, CHAR_COLORBLUE2,CHAR_COLORGREEN2,CHAR_COLORBLACK};//תɫ +#else + int namecolortbl[] = { CHAR_COLORWHITE, CHAR_COLORYELLOW, CHAR_COLORGREEN, + CHAR_COLORCYAN, CHAR_COLORRED, CHAR_COLORPURPLE, CHAR_COLORBLUE2};//תɫ +#endif +#else + int namecolortbl[] = { CHAR_COLORWHITE, CHAR_COLORYELLOW, CHAR_COLORGREEN, + CHAR_COLORCYAN, CHAR_COLORRED, CHAR_COLORPURPLE}; +#endif + int ridepet = BATTLE_getRidePet( charaindex ); + char petname[64] = ""; + char escapepetname[256]; + int petlevel = 0; + + if( !CHAR_getFlg(charaindex,CHAR_ISVISIBLE) )return FALSE; + namecolor = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); +#ifdef _TRANS_6 +#ifdef _TRANS_7 + if( namecolor > 8 ) namecolor = 8; +#else + if( namecolor > 6 ) namecolor = 6; +#endif +#else + if( namecolor > 5 ) namecolor = 5; +#endif + if( namecolor < 0 ) namecolor = 0; + + // shan add begin +#ifdef _NEW_NAME //Զƺ + char* szNewName = CHAR_getChar( charaindex, CHAR_NEWNAME); +#endif + +#ifdef _SHOW_VIP_CF + char VipName[32]=""; + if(getShowVip()!=0) + if(CHAR_getInt( charaindex,CHAR_VIPRIDE )>0) + sprintf(VipName, "VIP-"); +#endif +#ifdef _ITEM_SETLOVER + char LoveName[32]=""; + if(strlen( CHAR_getChar( charaindex, CHAR_LOVE)) > 0 && + strlen(CHAR_getChar(charaindex,CHAR_LOVERID))>0 && + strlen(CHAR_getChar(charaindex,CHAR_LOVERNAME))>0) + sprintf(LoveName, "%s",CHAR_getChar( charaindex, CHAR_LOVERNAME)); +#endif + + if( CHAR_getWorkInt(charaindex, CHAR_WORKFMINDEXI) >= 0 + && CHAR_getWorkInt(charaindex, CHAR_WORKFMINDEXI) < FAMILY_MAXNUM + && CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER + && CHAR_getWorkInt(charaindex, CHAR_WORKFMSETUPFLAG)==1 +// ||CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYERNPC) +#ifdef _PLAYER_NPC + ||CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYERNPC +#endif + ) +#ifdef _SHOW_VIP_CF + if(getShowVip()==1) + sprintf(tmp, "%s%s%s",VipName,CHAR_getChar( charaindex, CHAR_FMNAME),LoveName); + else +#endif +#ifdef _ITEM_SETLOVER + sprintf(tmp, "%s%s",CHAR_getChar( charaindex, CHAR_FMNAME),LoveName); + else + if(strlen(LoveName)>0) + sprintf(tmp, "%s",LoveName); + else + strcpy(tmp, ""); +#else + sprintf(tmp, "%s",CHAR_getChar( charaindex, CHAR_FMNAME)); + else + strcpy(tmp, ""); +#endif +#ifdef _SHOW_VIP_CF + char Name[64]; + if(getShowVip()==2) + sprintf(Name, "%s%s",VipName,makeEscapeString( CHAR_getChar( charaindex,CHAR_NAME ), escapename, sizeof(escapename))); + else + sprintf(Name, "%s",CHAR_getChar( charaindex,CHAR_NAME )); +#endif + + char szNewTemp[512]; + if(szNewName!=0 && strlen(szNewName) > 0) + sprintf( szNewTemp, "<%s>%s", szNewName, tmp); + else + sprintf( szNewTemp, "%s", tmp); + + + // Robin 0730 + if( ridepet >= 0 ){ + if( ! strcmp( CHAR_getChar( ridepet, CHAR_USERPETNAME), "") ) + strcpy( petname, CHAR_getChar( ridepet, CHAR_NAME )); + else + strcpy( petname, CHAR_getChar( ridepet, CHAR_USERPETNAME )); + petlevel = CHAR_getInt( ridepet, CHAR_LV); + } + + int whichtype = CHAR_getInt( charaindex, CHAR_WHICHTYPE); +#ifdef _PLAYER_NPC + if(whichtype == CHAR_TYPEPLAYERNPC){ + whichtype = CHAR_TYPEPLAYER; + }else{ + + } +#endif +/* + if(whichtype == CHAR_TYPEPLAYERNPC){ + whichtype = CHAR_TYPEPLAYER; + }else{ + + } +*/ +#ifdef _OBJSEND_C + #ifdef _CHAR_PROFESSION // WON ADD ְҵ + #ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + snprintf( buf, buflen, "%d|%d|%s|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%d|%s|%s|%d|%d|%d|%d|%d", + #else + snprintf( buf, buflen, "%d|%d|%s|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%d|%s|%s|%d|%d|%d|%d", + #endif + #else + snprintf( buf, buflen, "%d|%d|%s|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%d|%s|%s|%d", + #endif + OBJTYPE_CHARA, +#else + snprintf( buf, buflen, "%d|%s|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%d|%s|%s|%d", +#endif + whichtype, + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), + OBJECT_getY(objindex), + CHAR_getInt( charaindex, CHAR_DIR), + CHAR_getInt( charaindex,CHAR_BASEIMAGENUMBER ), + CHAR_getInt( charaindex,CHAR_LV ), + namecolortbl[namecolor], +//#ifdef _NEW_SHOW_VIP_LOVE +// FMandName, +//#else +#ifdef _SHOW_VIP_CF + Name, +#else + makeEscapeString( CHAR_getChar( charaindex,CHAR_NAME ), escapename, sizeof(escapename)), +#endif +//#endif + makeEscapeString(CHAR_getChar(charaindex,CHAR_OWNTITLE), escapetitle,sizeof(escapetitle)), + CHAR_getFlg( charaindex,CHAR_ISOVERED ), + CHAR_getFlg( charaindex,CHAR_HAVEHEIGHT ), + CHAR_getInt( charaindex, CHAR_POPUPNAMECOLOR), + szNewTemp, + makeEscapeString( petname, escapepetname, sizeof(escapepetname)), + petlevel +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + ,CHAR_getInt( charaindex, PROFESSION_CLASS) // ְҵ + ,CHAR_getInt( charaindex, PROFESSION_LEVEL) // ְҵȼ +// ,CHAR_getInt( charaindex, PROFESSION_EXP) // ְҵֵ + ,CHAR_getInt( charaindex, PROFESSION_SKILL_POINT) // ܵ +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + ,CHAR_getInt( charaindex, CHAR_HEROFLOOR ) // Ӣս¥ +#endif + +#ifdef _PETSKILL_BECOMEPIG + // ,CHAR_getInt(charaindex, CHAR_BECOMEPIG) +#endif + ); + break; + } + case OBJTYPE_ITEM: + { + int itemindex = OBJECT_getIndex(objindex); + int nameint; + int leaklevel; + int color; + char bufbuf[256]; + char *temp; + leaklevel = ITEM_getInt( itemindex,ITEM_LEAKLEVEL ); + + nameint = ITEM_SECRETNAME; +// if( leaklevel >=1 ) { +// nameint = ITEM_SECRETNAME; +// }else { +// nameint = ITEM_NAME; +// } + color = CHAR_COLORWHITE; + if (ITEM_getChar( itemindex, ITEM_CDKEY) == "\0"){ + return FALSE; + break; + } + temp=ITEM_getChar( itemindex, ITEM_CDKEY); + if( temp && strlen( temp ) ) { + color = CHAR_COLORGREEN; + }else { + if( ITEM_getInt( itemindex, ITEM_MERGEFLG) ) { + color = CHAR_COLORYELLOW; + } + } +#ifdef _OBJSEND_C + snprintf( buf, buflen, "%d|%s|%d|%d|%d|%d|%s", + OBJTYPE_ITEM, +#else + snprintf( buf, buflen, "%s|%d|%d|%d|%d|%s", +#endif + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), OBJECT_getY(objindex), + ITEM_getInt( itemindex,ITEM_BASEIMAGENUMBER ), + color, + makeEscapeString( ITEM_getChar( itemindex,nameint), bufbuf, sizeof(bufbuf)) + ); + break; + } + case OBJTYPE_GOLD: +#ifdef _OBJSEND_C + snprintf( buf, buflen, "%d|%s|%d|%d|%d", + OBJTYPE_GOLD, +#else + snprintf( buf, buflen, "%s|%d|%d|%d", +#endif + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex),OBJECT_getY(objindex), + OBJECT_getIndex(objindex) ); + break; +#ifdef _OBJSEND_C +#endif + default: + return FALSE; + break; + } + return TRUE; +} + +void CHAR_sendCSpecifiedObjindex( int fd, int index) +{ + char introduction[512]; + if( CHECKOBJECTUSE( index ) + && CHAR_makeObjectCString( index, introduction, + sizeof(introduction) ) ){ + lssproto_C_send( fd,introduction ); + }else{ + char mesg[32]; + cnv10to62( index, mesg, sizeof( mesg)); + lssproto_C_send( fd, mesg ); + } +} + +void CHAR_sendSpecifiedobjindexCToCharaindex(int charaindex,int objindex) +{ + int fd; + fd = getfdFromCharaIndex(charaindex); + if( fd == -1)return; + CHAR_sendCSpecifiedObjindex(fd,objindex); +} + +void CHAR_sendCToArroundCharacter( int objindex ) +{ + char introduction[512]; + int x,y,fl; + int i,j; + + if( CHAR_makeObjectCString( objindex,introduction, sizeof(introduction) ) == FALSE ) return; + + x = OBJECT_getX(objindex); + y = OBJECT_getY(objindex); + fl =OBJECT_getFloor(objindex); + + for( i = x - CHAR_DEFAULTSEESIZ/2 ; + i <= x +CHAR_DEFAULTSEESIZ/2 ; i ++ ){ + for( j = y - CHAR_DEFAULTSEESIZ/2; + j <= y + CHAR_DEFAULTSEESIZ/2; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj( fl, i,j); + object; + object = NEXT_OBJECT(object) ){ + int objindexwk = GET_OBJINDEX( object); + if( OBJECT_getType(objindexwk) == OBJTYPE_CHARA ){ + int index = OBJECT_getIndex(objindexwk); + if( CHAR_getInt( index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int fd; + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) continue; + fd = getfdFromCharaIndex( index); + if( fd == -1 )continue; + lssproto_C_send( fd,introduction ); + } + } + } + } + } +} + +void CHAR_sendCDArroundChar_Main( int fl, int x, int y, int objindex, BOOL mode ) +{ +#define CHAR_CDSEESIZ CHAR_DEFAULTSEESIZ+10 + + int i,j; + char cdmsg[64*2]; + cnv10to62( objindex,cdmsg, sizeof(cdmsg)); + for( i = x - CHAR_CDSEESIZ/2 ; i <= x +CHAR_CDSEESIZ/2 ; i ++ ){ + for( j = y - CHAR_CDSEESIZ/2; j <= y + CHAR_CDSEESIZ/2; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj( fl, i,j); object; + object = NEXT_OBJECT(object) ){ + + int objindexwk = GET_OBJINDEX( object); + if( OBJECT_getType(objindexwk) == OBJTYPE_CHARA ){ + int index = OBJECT_getIndex( objindexwk); + if( CHAR_getInt( index,CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER) { + if( objindexwk != objindex ) { + int fd; + fd = getfdFromCharaIndex(index); + if( fd == -1 )continue; + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE ) + { + CONNECT_appendCDbuf( fd, cdmsg, strlen( cdmsg)); + CDflush( index); + } + } + } + } + } + } + } +} + +void CHAR_sendCDArroundChar( int fl, int x, int y, int objindex ) +{ + CHAR_sendCDArroundChar_Main( fl,x,y,objindex,FALSE); +} + + +void CHAR_sendArroundCharaData( int charaindex ) +{ + int fd; + int i,j,x, y,fl; + char introduction[512*2]; + char c_msg[5][1024*6]; + int strpos[5] = {0,0,0,0,0}; + char cabuf[128*2]; + fd = getfdFromCharaIndex( charaindex ); + if( fd == -1 )return; + memset(c_msg[0], 0, sizeof(c_msg[0])); + memset(c_msg[1], 0, sizeof(c_msg[1])); + memset(c_msg[2], 0, sizeof(c_msg[2])); + memset(c_msg[3], 0, sizeof(c_msg[3])); + memset(c_msg[4], 0, sizeof(c_msg[4])); + c_msg[0][0] = '\0'; + c_msg[1][0] = '\0'; + c_msg[2][0] = '\0'; + c_msg[3][0] = '\0'; + c_msg[4][0] = '\0'; + fl = CHAR_getInt( charaindex, CHAR_FLOOR); + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + for( i = x-CHAR_DEFAULTSEESIZ/2 ; i <= x+CHAR_DEFAULTSEESIZ/2 ; i++ ){ + for( j = y-CHAR_DEFAULTSEESIZ/2 ; j <= y+CHAR_DEFAULTSEESIZ/2 ; j ++ ) { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; object ; object = NEXT_OBJECT(object ) ){ + int introlen; + int objindex = GET_OBJINDEX(object); + int c_index = OBJECT_getIndex( objindex); + + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && + !CHAR_getFlg(OBJECT_getIndex(objindex), CHAR_ISVISIBLE) ){ + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + } + continue; + } + if( OBJECT_getType( objindex) == OBJTYPE_CHARA) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER +#ifdef _ALLBLUES_LUA + || CHAR_getInt( c_index, CHAR_WHICHTYPE ) >= CHAR_TYPELUANPC +#endif + ){ + /* έƽҷ»弰ئĸ CAë˪ */ + if( CHAR_getWorkInt( c_index, CHAR_WORKPARTYMODE )== CHAR_PARTY_LEADER ){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTLEADER,1 )) { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + // Robin 0611 trade + /* ɫ */ + if( CHAR_getWorkInt( c_index, CHAR_WORKTRADEMODE ) != CHAR_TRADE_FREE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTTRADE,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + +#ifdef _ANGEL_SUMMON + if( CHAR_getWorkInt( c_index, CHAR_WORKANGELMODE ) == TRUE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTANGEL,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif + +#ifdef _MIND_ICON + //print("\nshan--->(batlmode)->%d", CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE )); + if(CHAR_getWorkInt( c_index, CHAR_MIND_NUM) && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_MIND, CHAR_getWorkInt( c_index, CHAR_MIND_NUM))){ + CONNECT_appendCAbuf( fd, cabuf, strlen(cabuf)); + //print("\nshan---->(1)cabuf-->%s", cabuf); + } + } +#endif + +#ifdef _STREET_VENDOR + if(CHAR_getWorkInt(c_index,CHAR_WORKSTREETVENDOR) == 1 && + CHAR_getWorkInt(c_index,CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(CHAR_makeCAOPTString(objindex,cabuf,sizeof(cabuf), + CHAR_STREETVENDOR_OPEN,CHAR_getWorkChar(c_index,CHAR_STREETVENDOR_NAME))){ + CONNECT_appendCAbuf(fd,cabuf,strlen(cabuf)); + } + } +#endif + +#ifdef _ITEM_CRACKER + if(CHAR_getWorkInt( c_index, CHAR_WORKITEM_CRACKER)&& + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE) + { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ITEM_CRACKER, CHAR_getWorkInt( c_index, CHAR_WORKITEM_CRACKER))) + { + CONNECT_appendCAbuf( fd, cabuf, strlen(cabuf)); + } + } +#endif + if( CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + if( CHAR_getWorkInt( c_index, CHAR_WORKBATTLEWATCH) == TRUE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTBATTLEWATCH, 1)) { + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + } + }else { + int battleno = CHAR_getWorkInt( c_index, CHAR_WORKBATTLEINDEX); + int sideno = CHAR_getWorkInt( c_index, CHAR_WORKBATTLESIDE); + int helpno = FALSE; + if( BATTLE_CHECKINDEX( battleno ) == FALSE ){ + }else { + helpno = (BattleArray[ battleno].Side[ + CHAR_getWorkInt( c_index, CHAR_WORKBATTLESIDE)].flg & BSIDE_FLG_HELP_OK)?TRUE:FALSE; + } + if( CHAR_makeCAOPT3String( objindex, cabuf, sizeof( cabuf), CHAR_ACTBATTLE, + battleno,sideno,helpno)){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + + } + } + } + if( CHAR_getWorkInt( c_index, CHAR_WORKACTION ) != -1 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + + } + } + }else if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + if( CHAR_getWorkInt( c_index, CHAR_WORKACTION ) != -1 ){ + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + } +#ifdef _ADD_ACTION + else { //npc + + if( CHAR_CHECKINDEX( c_index) ) { + if( CHAR_getWorkInt( c_index, CHAR_WORKACTION ) > 0 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))) { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + + } + } + } + } +#endif + } + if( c_index == charaindex) continue; + if( CHAR_makeObjectCString( objindex, introduction, sizeof( introduction))){ + introlen = strlen( introduction); + introduction[introlen] = ','; + introduction[introlen+1] = '\0'; + if(strpos[0]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[0][strpos[0]], sizeof( c_msg[0]) - strpos[0], + introduction); + strpos[0] += strlen( introduction); + }else if(strpos[1]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[1][strpos[1]], sizeof( c_msg[0]) - strpos[1], + introduction); + strpos[1] += strlen( introduction); + }else if(strpos[2]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[2][strpos[2]], sizeof( c_msg[2]) - strpos[2], + introduction); + strpos[2] += strlen( introduction); + }else if(strpos[3]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[3][strpos[3]], sizeof( c_msg[3]) - strpos[3], + introduction); + strpos[3] += strlen( introduction); + }else if(strpos[4]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[4][strpos[4]], sizeof( c_msg[4]) - strpos[4], + introduction); + strpos[4] += strlen( introduction); + } + } + } + } + } + dchop( c_msg[0], "," ); + dchop( c_msg[1], "," ); + dchop( c_msg[2], "," ); + dchop( c_msg[3], "," ); + dchop( c_msg[4], "," ); + if( strlen( c_msg[0]) == 0 ) return; + //print("\nc_msg[0]=%s,strpos[0]=%d\n",c_msg[0],strpos[0]); + lssproto_C_send( fd, c_msg[0]); + if(strlen( c_msg[1]) > 0){ + //print("\nc_msg[1]=%s,strpos[1]=%d\n",c_msg[1],strpos[1]); + lssproto_C_send( fd, c_msg[1]); + } + if(strlen( c_msg[2]) > 0){ + //print("\nc_msg[2]=%s,strpos[2]=%d\n",c_msg[2],strpos[2]); + lssproto_C_send( fd, c_msg[2]); + } + if(strlen( c_msg[3]) > 0){ + //print("\nc_msg[3]=%s,strpos[3]=%d\n",c_msg[3],strpos[3]); + lssproto_C_send( fd, c_msg[3]); + } + if(strlen( c_msg[4]) > 0){ + //print("\nc_msg[4]=%s,strpos[4]=%d\n",c_msg[4],strpos[4]); + lssproto_C_send( fd, c_msg[4]); + }//޸˶ر +} + +BOOL _CHAR_warpToSpecificPoint( char *file, int line, int charaindex, int floor, int x, int y) +{ + int objindex; + int per; + objindex = CHAR_getWorkInt(charaindex,CHAR_WORKOBJINDEX); + if( !MAP_IsValidCoordinate( floor, x, y )) { +// print( "error: invalid Coordinate fl[%d] x[%d] y[%d] %s:%d from %s:%d\n", +// floor, x, y, __FILE__, __LINE__, file, line); + return FALSE; + } + CHAR_sendCDArroundChar_Main( OBJECT_getFloor(objindex), + OBJECT_getX(objindex), + OBJECT_getY(objindex), + objindex, TRUE ); + + CHAR_setInt( charaindex,CHAR_FLOOR,floor); + CHAR_setInt( charaindex,CHAR_X,x); + CHAR_setInt( charaindex,CHAR_Y,y); + { + int of,ox,oy; + of = OBJECT_setFloor(objindex,floor); + ox = OBJECT_setX(objindex,x); + oy = OBJECT_setY(objindex,y); + if( !MAP_objmove( objindex,of,ox,oy,floor,x,y ) ){ + fprint( "ERROR MAP_OBJMOVE objindex=%d\n",objindex ); + return FALSE; + } + } + per = ENCOUNT_getEncountPercentMin( charaindex, floor,x,y); + if( per != -1 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, per); + } + per = ENCOUNT_getEncountPercentMax( charaindex, floor,x,y); + if( per != -1 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, per); + } + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, 0); +#endif + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + CAflush( charaindex ); + { + int i; + char* statuscat[]={"C","E",}; + for( i=0 ; i -1) && (CHAR_CHECKINDEX( petindex )) ) + + CHAR_warpToSpecificPoint( petindex, floor, x, y ); + } +#ifdef _STATUS_WATERWORD //ˮ״̬ + if( MAP_getMapFloorType( floor) == 1 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKMAPFLOORTYPE, 1); + }else { + CHAR_setWorkInt( charaindex, CHAR_WORKMAPFLOORTYPE, 0); + } +#endif +#ifdef _MAP_TIME + // ĵͼЩŵĻ,趨 + if(floor >= 30017 && floor <= 30021){ + if(CHAR_getWorkInt(charaindex,CHAR_WORK_MAP_TIME) <= 0) CHAR_setWorkInt(charaindex,CHAR_WORK_MAP_TIME,60); + } + // ĵͼ + else CHAR_setWorkInt(charaindex,CHAR_WORK_MAP_TIME,0); +#endif + +#ifdef _ANGEL_SUMMON + if( CHAR_getWorkInt( charaindex, CHAR_WORKANGELMODE ) == TRUE ) { + CHAR_sendAngelMark( objindex, 1); + } +#endif + + }else if( OBJECT_getType( objindex) == OBJTYPE_CHARA ){ + MAP_sendArroundChar( charaindex ); + } + + return TRUE; +} + +static void CHAR_walk_check( int charaindex ) +{ + if( strlen( CHAR_getWorkChar( charaindex ,CHAR_WORKWALKARRAY ) ) != 0 ){ + struct timeval old; + old.tv_sec = CHAR_getWorkInt(charaindex,CHAR_WORKWALKSTARTSEC); + old.tv_usec = CHAR_getWorkInt(charaindex,CHAR_WORKWALKSTARTMSEC); + if( time_diff_us(NowTime,old) >= CHAR_getInt(charaindex,CHAR_WALKINTERVAL)*1000.0 ) { + CHAR_walkcall( charaindex ); + } + } +} + +static BOOL CHAR_callLoop( int charaindex ) +{ + unsigned int timediff_us; + struct timeval old; + int loopinterval, iRet = FALSE; + loopinterval = CHAR_getInt(charaindex,CHAR_LOOPINTERVAL); + if( loopinterval <= 0 )return FALSE; + + //print("\n CHAR_callLoop:%d", charaindex); + + old.tv_sec = CHAR_getWorkInt(charaindex,CHAR_WORKLOOPSTARTSEC); + old.tv_usec = CHAR_getWorkInt(charaindex,CHAR_WORKLOOPSTARTMSEC); + timediff_us = time_diff_us( NowTime , old ); + + if( timediff_us >= loopinterval*500.0 ){ + int (*loopfunc)(int)=NULL; + loopfunc =(int(*)(int))CHAR_getFunctionPointer( charaindex, CHAR_LOOPFUNC); + if( loopfunc ){ + loopfunc(charaindex); + iRet = TRUE; + } +#ifdef _ALLBLUES_LUA + else{ + RunCharLoopEvent(charaindex); + iRet = TRUE; + } +#endif +#ifdef _USER_CHARLOOPS + loopfunc =(int(*)(int))CHAR_getFunctionPointer( charaindex, CHAR_LOOPFUNCTEMP1); + if( loopfunc ){ + loopfunc(charaindex); + iRet = TRUE; + } +#endif + if( iRet == FALSE ){ + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 0); + } + + CHAR_setWorkInt(charaindex,CHAR_WORKLOOPSTARTSEC, NowTime.tv_sec); + CHAR_setWorkInt(charaindex,CHAR_WORKLOOPSTARTMSEC, NowTime.tv_usec); + } + return iRet; +} + +int EnemyMoveNum = 10; +void CHAR_Loop( void ) +{ + int charnum=CHAR_getCharNum(); + int playernum = CHAR_getPlayerMaxNum(); + int petnum = CHAR_getPetMaxNum(); + static int charcnt = 0; + int i, movecnt=0; + + + if( charcnt == -1 ) { + charcnt = CHAR_getCharNum(); + } + + // õloop + for( i=0 ; i< playernum ; i++ ){ + if( CHAR_getCharUse(i) == FALSE )continue; + CHAR_walk_check( i ); + CHAR_callLoop( i ); + +#ifdef _TEACHER_SYSTEM + // лõʦ + if(CHAR_getWorkInt(i,CHAR_WORK_GET_TEACHER_FAME) > 0){ + int iAddTFame = CHAR_getInt(i,CHAR_TEACHER_FAME) + CHAR_getWorkInt(i,CHAR_WORK_GET_TEACHER_FAME); + int iAddFame = CHAR_getInt(i,CHAR_FAME) + CHAR_getWorkInt(i,CHAR_WORK_GET_TEACHER_FAME); + + // ӵʦ(ʦֵ͸ֵһ) + if(iAddTFame > MAX_PERSONALFAME) iAddTFame = MAX_PERSONALFAME; + else if(iAddTFame < 0) iAddTFame = 0; + CHAR_setInt(i,CHAR_TEACHER_FAME,iAddTFame); + // + if(iAddFame > MAX_PERSONALFAME) iAddFame = MAX_PERSONALFAME; + else if(iAddFame < 0) iAddFame = 0; + CHAR_setInt(i,CHAR_FAME,iAddFame); + // Ϊ 0 + CHAR_setWorkInt(i,CHAR_WORK_GET_TEACHER_FAME,0); + // м,ϴacֶͬ + if(CHAR_getInt(i,CHAR_FMLEADERFLAG) > 0 && CHAR_getInt(i,CHAR_FMLEADERFLAG) != FMMEMBER_APPLY){ + char tmpbuf1[16]; + + sprintf(tmpbuf1,"%d",iAddFame); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(i,CHAR_FMNAME), + CHAR_getInt(i,CHAR_FMINDEX), + CHAR_getWorkInt(i,CHAR_WORKFMINDEXI), + FM_FIX_FMFEED, + "0", // ֻΪͬ,Ϊ0, + tmpbuf1, // ͬ + CHAR_getWorkInt(i,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(getfdFromCharaIndex(i)) + ); + } + } +#endif + } +#ifdef _FIX_CHAR_LOOP + static int petcnt = 0; + static int othercnt = 0; + for( i = 0, movecnt = 0; i < CHAR_getPetMaxNum() ; i++, petcnt++ ){ + if( petcnt >= petnum )petcnt = playernum ; + if( CHAR_getCharUse(petcnt) == FALSE )continue; + if( CHAR_callLoop(petcnt) == TRUE ){ + if( ++movecnt >= EnemyMoveNum )break; + }else{ + continue; + } + } + for( i = 0, movecnt = 0; i < CHAR_getOthersMaxNum() ; i++, othercnt++ ){ + if( othercnt >= charnum )othercnt = petnum ; + if( CHAR_getCharUse(othercnt) == FALSE )continue; + if( CHAR_callLoop(othercnt) == TRUE ){ + if( ++movecnt >= 50 )break; + }else{ + continue; + } + } +#else + // Objectõloop + for( i = 0, movecnt = 0 ; i < (petnum/2) ; i++, charcnt++ ){ + if( charcnt >= charnum )charcnt = playernum ; + if( CHAR_getCharUse(charcnt) == FALSE )continue; + if( CHAR_callLoop(charcnt) == TRUE ){ + if( ++movecnt >= EnemyMoveNum )break; + }else{ + continue; + } + } +#endif +} + +char* CHAR_appendNameAndTitle( int charaindex, char* src, char* buf, + int buflen ) +{ + if( buflen > 0 ){ + if( CHAR_CHECKINDEX(charaindex) == FALSE ) + snprintf( buf,buflen,"%s",src ); + else{ + int titleindex = CHAR_getInt(charaindex,CHAR_INDEXOFEQTITLE); + char indexname[128]; + strcpy(indexname,CHAR_getChar(charaindex,CHAR_NAME)); +#ifdef _NO_DAOLUAN + if(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)<1){ + if(CHAR_getInt(charaindex,CHAR_LV)<=getTalkLv()){ + if(CHAR_getInt(charaindex,CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ + strcpy(indexname,getTalkName()); + } + } + } +#endif + if( titleindex == -1 ) + snprintf( buf,buflen, "%s%s", + indexname, src ); + else + snprintf( buf,buflen, "%s(%s)%s", + indexname, + TITLE_makeTitleStatusString(charaindex, + titleindex), src ); + } + } + return buf; +} + +void CHAR_getCoordinationDir( int dir , int x, int y ,int c, + int *xout , int *yout ) +{ + *xout = x + CHAR_getDX(dir) * c; + *yout = y + CHAR_getDY(dir) * c; +} + +BOOL CHAR_createCharacter( int type, int floor, int x, int y,int dir, + int* charaindex, int* objindex, BOOL seemap ) +{ + Char ch; + Object ob; + if( !CHAR_getDefaultChar( &ch,type ) )return FALSE; + + ch.data[CHAR_FLOOR] = floor; + ch.data[CHAR_X] = x; + ch.data[CHAR_Y] = y; + ch.data[CHAR_DIR] = dir; + + *charaindex = CHAR_initCharOneArray( &ch ); + if( *charaindex == -1 )return FALSE; + + ob.type = OBJTYPE_CHARA; + ob.index = *charaindex; + ob.floor = floor; + ob.x = x; + ob.y = y; + + if( seemap && MAP_walkAble( *charaindex, floor,x,y ) == FALSE ){ + CHAR_endCharOneArray( *charaindex ); + return FALSE; + } + + *objindex = initObjectOne( &ob ); + if( *objindex == -1 ){ + CHAR_endCharOneArray(*charaindex); + return FALSE; + } + CHAR_setWorkInt( *charaindex,CHAR_WORKOBJINDEX,*objindex); + + /* ë浤 */ + + CHAR_sendWatchEvent( *objindex,CHAR_ACTSTAND,NULL,0,TRUE); + + return TRUE; +} + +void CHAR_ObjectDelete( int objindex ) +{ + CHAR_sendCDArroundChar( OBJECT_getFloor(objindex), + OBJECT_getX(objindex), + OBJECT_getY(objindex), + objindex ); +#ifdef _MAP_WARPPOINT + if( OBJECT_getType( objindex) == OBJTYPE_WARPPOINT ){ +// print("Delete OBJTYPE_WARPPOINT endObjectOne( %d) [%d,%d,%d] \n ", objindex, +// OBJECT_getFloor(objindex), OBJECT_getX(objindex), +// OBJECT_getY(objindex) ); + } +#endif + endObjectOne(objindex); +} + +/*------------------------------------------------------------ + * ƽҷë£Ƥִ£ + * ͼ֧Իëئ׻ּ + * ¦ + * charaindex int ƽҷ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_CharaDelete( int charaindex ) +{ + /* Ƥë */ + CHAR_ObjectDelete( CHAR_getWorkInt( charaindex,CHAR_WORKOBJINDEX ) ); + /* ƽҷ¼ */ + CHAR_endCharOneArray( charaindex ); +} +/*------------------------------------------------------------ + * Ȼʸë + ------------------------------------------------------------*/ +void CHAR_CharaDeleteHavePet( int charaindex) +{ + int i; + int pindex; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + pindex = CHAR_getCharPet( charaindex, i); + if( CHAR_CHECKINDEX( pindex)) { + CHAR_endCharOneArray( pindex ); + } + } + for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { + pindex = CHAR_getCharPoolPet( charaindex, i); + if( CHAR_CHECKINDEX( pindex)) { + CHAR_endCharOneArray( pindex ); + } + } +} +/*------------------------------------------------------------ + * ئë £ + * mode int 0: б巴CA˪ئ + * 1: бCA˪ + ------------------------------------------------------------*/ +int CHAR_sendAction( int charaindex, int action, int mode) +{ + /* ˪ľ ʧCAë۽ Ƥ */ + static int table[] = { + CHAR_ACTATTACK,CHAR_ACTDAMAGE,CHAR_ACTDOWN,CHAR_ACTACTIONSTAND, + CHAR_ACTACTIONWALK,CHAR_ACTSIT,CHAR_ACTHAND,CHAR_ACTPLEASURE, + CHAR_ACTANGRY,CHAR_ACTSAD,CHAR_ACTGUARD, CHAR_ACTNOD, CHAR_ACTTHROW + }; + if( action < 0 || action >= arraysizeof( table)) return FALSE; + + /* Իʧë˪ */ + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + table[action], + NULL,0,mode); + + /* ʧ */ + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, table[action]); + + return TRUE; +} +/*------------------------------------------------------------ + * л ƥؤеë˪£ + ------------------------------------------------------------*/ +void CHAR_sendBattleEffect( int charaindex, int onoff) +{ + int opt[3]; + + if( onoff == 1) { + opt[0] = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX); + opt[1] = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE); + opt[2] = (BattleArray[CHAR_getWorkInt( charaindex, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( charaindex, + CHAR_WORKBATTLESIDE)].flg & BSIDE_FLG_HELP_OK) ? TRUE:FALSE; + } + else { + opt[0] = -1; + opt[1] = -1; + opt[2] = 0; + } + + CHAR_sendWatchEvent( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTBATTLE,opt,arraysizeof(opt),TRUE); +} + +/*------------------------------------------------------------ + * дѶϢ add code Shan 2001/06/30 + ------------------------------------------------------------*/ +void CHAR_sendTradeEffect( int charaindex, int onoff) +{ + int opt[1]; + + if( onoff == 1) { + opt[0] = 1; + } + else { + opt[0] = -1; + } + CHAR_sendWatchEvent( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTTRADE,opt,arraysizeof(opt),TRUE); +} + +#ifdef _ANGEL_SUMMON +void CHAR_sendAngelEffect( int charaindex, int onoff) +{ + int opt[1]; + + if( onoff == 1) { + opt[0] = 1; + } + else { + opt[0] = -1; + } + CHAR_sendWatchEvent( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ACTANGEL,opt,arraysizeof(opt),TRUE); +} +#endif + +#ifdef _MIND_ICON +void CHAR_sendMindEffect( int charaindex, int onoff) +{ + int opt[1]; + + if(onoff>0){ + opt[0] = onoff; + } + else{ + opt[0] = 0; + } + CHAR_sendWatchEvent( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_MIND, opt, arraysizeof(opt), FALSE); +} +#endif +#ifdef _ITEM_CRACKER +void CHAR_sendCrackerEffect( int charaindex, int onoff) +{ + int opt[1]; + opt[0] = onoff; + CHAR_sendWatchEvent( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + CHAR_ITEM_CRACKER, opt, arraysizeof(opt), FALSE); +} +#endif + +void CHAR_inputUserPetName( int index , int havepetindex, char* name ) +{ + int petindex; + //char category[3]; + char *mycdkey=NULL, *cdkey = NULL; + BOOL changenameflg = FALSE; + + if( !CHAR_CHECKINDEX( index ) ) return; + + petindex = CHAR_getCharPet( index, havepetindex); + if( !CHAR_CHECKINDEX( petindex)) return; + + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(index, -1, "ػ޷޸֣", CHAR_COLORYELLOW); + return; + } + + mycdkey = CHAR_getChar( index, CHAR_CDKEY); + cdkey = CHAR_getChar( petindex, CHAR_CDKEY); + if( cdkey == "\0" ) { + print( "can't get CDKEY\n"); + }else { + if( strlen( cdkey) == 0 || strcmp( cdkey, mycdkey) == 0 ) { + changenameflg = TRUE; + } + } + if( !changenameflg) { + CHAR_talkToCli( index, -1, "޷Ϊ", CHAR_COLORYELLOW ); + return; + } + + CHAR_setChar( petindex, CHAR_USERPETNAME ,name); + + if( strlen( name ) == 0 || + strcmp( CHAR_getChar( petindex, CHAR_NAME), name) == 0 ){ + CHAR_setChar( petindex, CHAR_CDKEY, ""); + }else { + CHAR_setChar( petindex, CHAR_CDKEY, mycdkey); + } + CHAR_send_K_StatusString( index, havepetindex, CHAR_K_STRING_USERPETNAME); +} + +static void CHAR_setLuck( int charaindex) +{ + LSTIME nowlstime; + LSTIME mylstime; + struct { + int prob; + int luck; + }lucktbl[] = { + { 60, 1 }, /* 40% */ + { 30, 2 }, /* 30% */ + { 10, 3 }, /* 20% */ + { 3, 4 }, /* 7% */ + { 0, 5 } /* 3% */ + }; + + if( !CHAR_CHECKINDEX( charaindex)) return; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + RealTimeToLSTime( CHAR_getInt( charaindex, CHAR_LASTTIMESETLUCK), &mylstime); + + /* LSƥ ȻľCHAR_LUCKëޥ */ + if( nowlstime.day != mylstime.day || nowlstime.year != mylstime.year ) { + int i,r; + r = RAND( 0, 99); + for( i = 0; i < arraysizeof( lucktbl); i ++ ) { + if( r >= lucktbl[i].prob ) { + CHAR_setInt( charaindex, CHAR_LUCK, lucktbl[i].luck); + CHAR_setInt( charaindex, CHAR_LASTTIMESETLUCK, NowTime.tv_sec); + return; + } + } + } +} +void CHAR_JoinBattle_WindowResult( int charaindex, int select, char *data) +{ + int ret = FALSE; + int fd = getfdFromCharaIndex( charaindex); + +#if 1 // òսظս Robin + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) { + CHAR_talkToCli( charaindex, -1, " ظս! ", CHAR_COLORRED); + print("\n ķ!!ظս!:%s ", CHAR_getChar( charaindex, CHAR_CDKEY) ); + //lssproto_EN_send( fd, FALSE, 0 ); + return; + } +#endif + if( select != WINDOW_BUTTONTYPE_CANCEL && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ){ + while( 1 ) { + int selected; + int bcharaindex; + if( fd == -1 ) break; + selected = atoi( data)-1; + + if( !CHAR_CHECKINDEX( CONNECT_getBattlecharaindex(fd,selected))) { + break; + } + if( CHAR_getWorkInt( CONNECT_getBattlecharaindex(fd,selected), + CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + break; + } + if( BattleArray[ CHAR_getWorkInt( + CONNECT_getBattlecharaindex( fd,selected), + CHAR_WORKBATTLEINDEX)].type != BATTLE_TYPE_P_vs_E ){ + break; + } + bcharaindex = CONNECT_getBattlecharaindex( fd,selected); + if( !(BattleArray[CHAR_getWorkInt( bcharaindex, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( bcharaindex, + CHAR_WORKBATTLESIDE)].flg + & BSIDE_FLG_HELP_OK)){ + break; + } + if(NPC_Util_CharDistance( charaindex, + CONNECT_getBattlecharaindex( + fd,selected) )> 1){ + break; + } + if( BATTLE_RescueEntry( charaindex, + CONNECT_getBattlecharaindex(fd,selected) )){ + CHAR_talkToCli( charaindex, -1, "޷ս", + CHAR_COLORYELLOW); + }else { + ret = TRUE; + } + + break; + } + } + if( ret == FALSE ) { + if( fd != -1 ) { + lssproto_EN_send( fd, FALSE, 0 ); + } + } +} +void CHAR_JoinDuel_WindowResult( int charaindex, int select, char *data) +{ + int ret = FALSE; + int fd = getfdFromCharaIndex( charaindex); + /* ֵպ */ + if( select != WINDOW_BUTTONTYPE_CANCEL && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_CLIENT ) + { + /* мƥպë */ + while( 1 ) { + int selected; + int enemyindex; + + if( fd == -1 ) break; + selected = atoi( data)-1; + /* ئindex */ + if( !CHAR_CHECKINDEX( CONNECT_getDuelcharaindex(fd,selected)) ) { + break; + } + /* */ + if( CHAR_getWorkInt( CONNECT_getDuelcharaindex(fd,selected), + CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + { + break; + } + /* duelھ */ + if( !CHAR_getFlg( CONNECT_getDuelcharaindex(fd,selected), + CHAR_ISDUEL)) + { + break; + } + /* ڶ ¾(ūƥ ƻޱ ¿) */ + if(NPC_Util_CharDistance( charaindex, + CONNECT_getDuelcharaindex(fd,selected) ) + > 1) + { + break; + } + // 󡼰ƽҷ¼̼͵ + enemyindex = CONNECT_getDuelcharaindex( fd,selected); + print("\nenemyindex=%d\n",enemyindex); + // 컥ئչ޼» + // Ҽئëƥ + if( CHAR_getWorkInt( enemyindex, CHAR_WORKPARTYMODE ) + == CHAR_PARTY_CLIENT ) + { + enemyindex = CHAR_getWorkInt( enemyindex, CHAR_WORKPARTYINDEX1 ); + // ئ⾮ʻئ + if( enemyindex < 0 ){ + break; + } + } + /* 컥ƥئؤ */ + if( CHAR_getInt( enemyindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ + break; + } + ret = BATTLE_CreateVsPlayer( charaindex, enemyindex ); + if( ret != 0 ){ + CHAR_talkToCli( charaindex, -1, + "ʧܣ", CHAR_COLORYELLOW); + ret = FALSE; + } + else { + ret = TRUE; + } + break; + } + } + if( ret == FALSE ) { + /* ˪ */ + if( fd != -1 ) { + lssproto_EN_send( fd, FALSE, 0 ); + } + } +} +void CHAR_SelectCard_WindowResult( int charaindex, int select, char *data) +{ + if( select != WINDOW_BUTTONTYPE_CANCEL ){ + while( 1 ) { + int selected; + int fd; + fd = getfdFromCharaIndex( charaindex); + if( fd == -1 ) break; + selected = atoi( data)-1; + if( !CHAR_CHECKINDEX( + CONNECT_getTradecardcharaindex(fd,selected))) { + break; + } + if( CHAR_getWorkInt( CONNECT_getTradecardcharaindex(fd,selected), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + break; + } + if(!CHAR_getFlg( CONNECT_getTradecardcharaindex(fd,selected), + CHAR_ISTRADECARD)){ + break; + } + if( NPC_Util_CharDistance( charaindex, + CONNECT_getTradecardcharaindex + (fd,selected) ) > 1){ + break; + } + ADDRESSBOOK_addAddressBook( charaindex, + CONNECT_getTradecardcharaindex( + fd,selected)); + break; + } + } +} + +void CHAR_JoinParty_WindowResult( int charaindex , int select, char *data) +{ + int ret = FALSE; + int fd = getfdFromCharaIndex( charaindex); + /* ֵպ */ + if( select != WINDOW_BUTTONTYPE_CANCEL && + /* лɡ ū׬ƥ */ + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) + { + /* мƥպë */ + while( 1 ) { + int parray; + int selected; + int toindex = -1; + if( fd == -1 ) break; + selected = atoi( data)-1; + + /* ئindex + * (ۢūƥ ƻޱ + * ئindexئµ 뻥ؤ) + */ + if( !CHAR_CHECKINDEX( + CONNECT_getJoinpartycharaindex(fd,selected))) { + break; + } + /* ʻ¦ȽԻ */ + if( CHAR_getWorkInt( CONNECT_getJoinpartycharaindex( + fd,selected), CHAR_WORKPARTYMODE) + == CHAR_PARTY_NONE ) + { + toindex = CONNECT_getJoinpartycharaindex( fd,selected ); + } + else { + toindex = CHAR_getPartyIndex( + CONNECT_getJoinpartycharaindex(fd,selected), 0); + if( !CHAR_CHECKINDEX( toindex) ) { + print( " %s:%d err\n", __FILE__, __LINE__); + break; + } + } + /* ڶ ¾(ūƥ ƻޱ ¿) */ + if( NPC_Util_CharDistance( charaindex, toindex ) > 1) { + break; + } + /* ֻ */ + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + { + break; + } + /* ޸ƹ */ + if( !CHAR_getFlg( toindex, CHAR_ISPARTY)) { + break; + } + + /* ɡ ūѷ */ + parray = CHAR_getEmptyPartyArray( toindex) ; + if( parray == -1 ) break; + /* ɡ ū */ + CHAR_JoinParty_Main( charaindex, toindex); + ret = TRUE; + break; + } + } + if( ret == FALSE ) { + CHAR_talkToCli( charaindex, -1, "޷Ŷӡ", + CHAR_COLORYELLOW); + } + /* ˪ */ + if( fd != -1 ) { + lssproto_PR_send( fd, 1, ret); + } +} +void CHAR_JoinBattleWatch_WindowResult( int charaindex, int select, char *data) +{ + int ret = FALSE; + int fd = getfdFromCharaIndex( charaindex); + /* ֵպ */ + if( select != WINDOW_BUTTONTYPE_CANCEL ) { + /* мƥպë */ + while( 1 ) { + int selected; + if( fd == -1 ) break; + selected = atoi( data)-1; + + /* ئindex + * (ۢūƥ ƻޱ + * ئindexئµ 뻥ؤ) + */ + if( !CHAR_CHECKINDEX( CONNECT_getBattlecharaindex(fd,selected))) { + break; + } + /* */ + if( CHAR_getWorkInt( CONNECT_getBattlecharaindex(fd,selected), + CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE) + { + break; + } + /* ڶ ¾(ūƥ ƻޱ ¿) */ + if(NPC_Util_CharDistance( charaindex, + CONNECT_getBattlecharaindex( + fd,selected) ) + > 1) + { + break; + } + /* ޼ */ + if( BATTLE_WatchEntry( charaindex, + CONNECT_getBattlecharaindex(fd,selected) + )) + { + CHAR_talkToCli( charaindex, -1, "޷ս", + CHAR_COLORYELLOW); + } + else { + ret = TRUE; + } + + break; + } + } + if( ret == FALSE ) { + /* ˪ */ + if( fd != -1 ) { + lssproto_EN_send( fd, FALSE, 0 ); + } + } +} + +#ifdef _FM_MODIFY +extern void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); +#endif + +void CHAR_processWindow(int charaindex, int seqno, int select, + int objindex, char* data ) +{ + if( CHECKOBJECTUSE(objindex)) { + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + typedef void (*WINDF)(int,int,int, int,char*); + WINDF windowtalkedfunc=NULL; + windowtalkedfunc = (WINDF)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex),CHAR_WINDOWTALKEDFUNC); + if( windowtalkedfunc ) { + windowtalkedfunc( OBJECT_getIndex(objindex), charaindex, + seqno, select, data); + } +#ifdef _ALLBLUES_LUA + else{ + RunCharWindowTalked( OBJECT_getIndex(objindex), charaindex, + seqno, select, data); + } +#endif + } + }else { + if( seqno == CHAR_WINDOWTYPE_SELECTBATTLE) { + CHAR_JoinBattle_WindowResult( charaindex, select, data); + }else if( seqno == CHAR_WINDOWTYPE_SELECTDUEL) { + CHAR_JoinDuel_WindowResult( charaindex, select, data); + }else if( seqno == CHAR_WINDOWTYPE_SELECTTRADECARD) { + CHAR_SelectCard_WindowResult( charaindex, select, data); + }else{ + if( seqno == CHAR_WINDOWTYPE_SELECTPARTY) { + CHAR_JoinParty_WindowResult( charaindex, select, data); + }else { + if( seqno == CHAR_WINDOWTYPE_SELECTBATTLEWATCH) { + CHAR_JoinBattleWatch_WindowResult( charaindex, select, data); + }else if( seqno >= CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE1 && + seqno <= CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME_ATTENTION ){ + ITEM_useRenameItem_WindowResult( charaindex, seqno, select, data); + } +#ifdef _PETSKILL_CANNEDFOOD + else if( seqno == ITEM_WINDOWTYPE_SELECTPETSKILL_SELECT ){ + ITEM_usePetSkillCanned_WindowResult( charaindex, seqno, select, data); + } +#endif +#ifdef _NULL_CHECK_ITEM + else if( seqno == CHAR_WINDOWTYPE_NULL_CHECK ){ + int value=atoi(data); + if(value<0){ + CHAR_talkToCli( charaindex, -1, "֧ƱֵС,ٷ,װл!", CHAR_COLORYELLOW ); + return; + } + + if(CHAR_getInt( charaindex , CHAR_AMPOINT)0){ + LogAmPoint(CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + -value, + CHAR_getInt( charaindex, CHAR_AMPOINT ), + "(֧Ʊ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y )); + } +#endif + + + sprintf(buf, "%d", value); + ITEM_setChar(itemindex, ITEM_ARGUMENT, buf); + + sprintf( buf, "֧Ʊ%8d.00ǩ: %s", value, CHAR_getChar(charaindex, CHAR_NAME)); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, buf); + CHAR_sendItemDataOne( charaindex, haveitemindex); + + sprintf( buf, "˽˻֧Ʊע%dֵ㣡", value); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli( charaindex, -1, "ʧܣ벻Ҫ֧ƱʱƶϵƷ", CHAR_COLORYELLOW); + } + } + } +#endif + } + } +#ifdef _FM_MODIFY + if(seqno >= CHAR_WINDOWTYPE_FM_DENGON || seqno <= CHAR_WINDOWTYPE_FM_DPSELECT) + NPC_FmDengonWindowTalked(0,charaindex,seqno,select,data); +#endif + } +} + +void CHAR_PartyUpdate( int charaindex, int senddata ){ + int i, ownerindex, mode, pindex, pno; + mode = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ); + if( mode == CHAR_PARTY_NONE )return; + if( mode == CHAR_PARTY_LEADER ){ + ownerindex = charaindex; + }else{ + ownerindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1 ); + } + + for( pno = 0; pno < CHAR_PARTYMAX; pno ++ ){ + pindex = CHAR_getWorkInt( ownerindex, CHAR_WORKPARTYINDEX1+pno ); + if( pindex == charaindex )break; + } + if( pno == CHAR_PARTYMAX )return; + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( ownerindex, CHAR_WORKPARTYINDEX1+i ); + if( pindex == charaindex )continue; + if( pindex < 0 )continue; + CHAR_send_N_StatusString( pindex, pno, senddata ); + } +} + +static int CHAR_getObjectByPosition( int myobjindex, int fl, int x, int y, + int *objbuf, int objbuflen) +{ + int i,j; + int cnt = 0; + + for( i = x-CHAR_DEFAULTSEESIZ/2 ; i <= x+CHAR_DEFAULTSEESIZ/2 ; i++ ){ + for( j = y-CHAR_DEFAULTSEESIZ/2 ; j <= y+CHAR_DEFAULTSEESIZ/2 ; + j ++ ) + { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType( objindex) == OBJTYPE_CHARA && + !CHAR_getFlg( OBJECT_getIndex( objindex), CHAR_ISVISIBLE)) + { + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + } + continue; + } + /* зз */ + if( objindex == myobjindex) continue; + + objbuf[cnt] = objindex; + cnt ++; + if( cnt >= objbuflen) return cnt; + } + } + } + return cnt; +} +static void CHAR_setMyPosition_sendData( int charaindex,int prev_x, int prev_y, int x, int y) +{ + int CurrentObjCollection[CHAR_DEFAULTSEESIZ*CHAR_DEFAULTSEESIZ*10]; + int PrevObjCollection[CHAR_DEFAULTSEESIZ*CHAR_DEFAULTSEESIZ*10]; + int curcnt,prevcnt; + int objindex; + int fl; + char introduction[512]; + char c_msg[1024*96]; + char buf[64]; + int strpos; + int fd; + int i,j; + char cabuf[128]; + char myintroduction[512]; + char cd_msg[128]; + + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + if( fd == -1 )return; + + objindex = CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX); + fl = CHAR_getInt( charaindex, CHAR_FLOOR); + + curcnt = CHAR_getObjectByPosition( objindex, fl,x,y, CurrentObjCollection, sizeof(CurrentObjCollection)); + prevcnt = CHAR_getObjectByPosition( objindex, fl, prev_x, prev_y, PrevObjCollection, sizeof(PrevObjCollection)); + strpos = 0; + c_msg[0] = '\0'; + if( !CHAR_makeObjectCString( objindex, myintroduction,sizeof( myintroduction))){ + myintroduction[0] = '\0'; + } + + for( i = 0 ; i < curcnt; i ++ ) { + int findflg = FALSE; + for( j = 0; j < prevcnt; j ++ ) { + if( CurrentObjCollection[i] == PrevObjCollection[j] ) { + findflg = TRUE; + break; + } + } + if( !findflg ) { + int introlen; + int c_index = OBJECT_getIndex( CurrentObjCollection[i]); + if( CHAR_makeObjectCString( CurrentObjCollection[i], introduction, + sizeof( introduction))) + { + introlen = strlen( introduction); + introduction[introlen] = ','; + introduction[introlen+1] = '\0'; + + strcpysafe( &c_msg[strpos], sizeof( c_msg) - strpos, + introduction); + strpos += strlen( introduction); + if( strpos >= sizeof( c_msg)) break; + } + if( strlen( myintroduction) != 0 ) { + if( OBJECT_getType( CurrentObjCollection[i] ) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + int tofd = getfdFromCharaIndex( c_index ); + CDsend( tofd); + lssproto_C_send( tofd, myintroduction); + } + } + } + if( OBJECT_getType( CurrentObjCollection[i]) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKPARTYMODE ) + == CHAR_PARTY_LEADER ){ + if( CHAR_makeCAOPT1String( CurrentObjCollection[i], cabuf, sizeof( cabuf), + CHAR_ACTLEADER,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + + // Robin 0611 trade + /* ɫ */ + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKTRADEMODE ) != CHAR_TRADE_FREE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTTRADE,1 )) + { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + +#ifdef _ANGEL_SUMMON + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKANGELMODE ) == TRUE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTANGEL,1 )) + { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif + +#ifdef _MIND_ICON + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE && + CHAR_getWorkInt( c_index, CHAR_MIND_NUM)) + { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_MIND, CHAR_getWorkInt( c_index, CHAR_MIND_NUM))) + { + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + //print("\nshan---->(2)cabuf-->%s", cabuf); + } + } +#endif +#ifdef _STREET_VENDOR + if(CHAR_getWorkInt(c_index,CHAR_WORKSTREETVENDOR) == 1 && + CHAR_getWorkInt(c_index,CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(CHAR_makeCAOPTString(objindex,cabuf,sizeof(cabuf), + CHAR_STREETVENDOR_OPEN,CHAR_getWorkChar(c_index,CHAR_STREETVENDOR_NAME))) + CONNECT_appendCAbuf(fd,cabuf,strlen(cabuf)); + } +#endif +#ifdef _ITEM_CRACKER + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE && + CHAR_getWorkInt( c_index, CHAR_WORKITEM_CRACKER)) + { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ITEM_CRACKER, CHAR_getWorkInt( c_index, CHAR_WORKITEM_CRACKER))) + { + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + } + } +#endif + /* лƥ컥 ƥئئĸ CAë˪ */ + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) + == CHAR_PARTY_LEADER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE) + { + int tofd = getfdFromCharaIndex( c_index ); + if( tofd != -1 ) { + if( CHAR_makeCAOPT1String( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + cabuf, sizeof( cabuf), + CHAR_ACTLEADER,1 )) + { + CONNECT_appendCAbuf( tofd,cabuf,strlen(cabuf)); + } + } + } + /* έƽҷ» ئվ ʧ ë˪ */ +#ifdef _ALLBLUES_LUA + if( (CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + || CHAR_getInt( c_index, CHAR_WHICHTYPE ) >= CHAR_TYPELUANPC) + && CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE )!= BATTLE_CHARMODE_NONE ) +#else + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) + != BATTLE_CHARMODE_NONE ) +#endif + { + /* CA */ + if( CHAR_getWorkInt( c_index, CHAR_WORKBATTLEWATCH) == TRUE ) { + if( CHAR_makeCAOPT1String( CurrentObjCollection[i], cabuf, + sizeof( cabuf), + CHAR_ACTBATTLEWATCH, + 1)) + { + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + } + } + else { + int battleno = CHAR_getWorkInt( c_index, + CHAR_WORKBATTLEINDEX); + int sideno = CHAR_getWorkInt( c_index, + CHAR_WORKBATTLESIDE); + int helpno = (BattleArray[CHAR_getWorkInt( c_index, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( c_index, + CHAR_WORKBATTLESIDE)].flg & BSIDE_FLG_HELP_OK) ? TRUE:FALSE; + /* HelpNo = 1 */ + if( CHAR_makeCAOPT3String( CurrentObjCollection[i], cabuf, sizeof( cabuf), + CHAR_ACTBATTLE, + battleno,sideno,helpno + )) + { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + } + /* έƽҷ»Ͼʧëƻľ˪£ */ + if( ( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER || + CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) && + CHAR_getWorkInt( c_index, CHAR_WORKACTION ) != -1 ) + { + if( CHAR_makeCADefaultString( CurrentObjCollection[i], cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))) + { + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + } + } + } + dchop( c_msg, "," ); + if( strlen( c_msg) != 0 ) { + lssproto_C_send( fd, c_msg); + } + + /* мCD */ + cnv10to62( objindex,cd_msg, sizeof(cd_msg)); + + for( i = 0 ; i < prevcnt; i ++ ) { + int findflg = FALSE; + /* 󡼰 Ƥƥػ ئ + * ƤئƤ + */ + for( j = 0; j < curcnt; j ++ ) { + if( PrevObjCollection[i] == CurrentObjCollection[j] ) { + findflg = TRUE; + break; + } + } + if( !findflg ) { + cnv10to62( PrevObjCollection[i], buf, sizeof( buf)); + CONNECT_appendCDbuf( fd, buf, strlen( buf)); + + /* ˪ */ + if( OBJECT_getType( PrevObjCollection[i]) == OBJTYPE_CHARA ) { + int tocharaindex = OBJECT_getIndex( PrevObjCollection[i]); + if( CHAR_getInt( tocharaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + int tofd = CHAR_getWorkInt( tocharaindex, CHAR_WORKFD); + if( tofd != -1 ) { + CONNECT_appendCDbuf( tofd, cd_msg, strlen( cd_msg)); + CDsend( tofd); + } + } + } + } + } + CDsend( fd); + + +} +BOOL CHAR_setMyPosition( int index, int x, int y, BOOL CAFlg) +{ + return CHAR_setMyPosition_main( index,x,y,-1,CAFlg); +} + +BOOL CHAR_setMyPosition_main( int index, int x, int y, int setdir, BOOL CAFlg) +{ + int objindex; + int prev_x,prev_y; + int fl; + + prev_x = CHAR_getInt( index, CHAR_X); + prev_y = CHAR_getInt( index, CHAR_Y); + if( prev_x == x && prev_y == y ) { + return FALSE; + } + + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT) { + return FALSE; + } + + if( CHAR_getFlg( index, CHAR_ISWARP)) return FALSE; + + objindex = CHAR_getWorkInt(index,CHAR_WORKOBJINDEX); + fl = CHAR_getInt( index, CHAR_FLOOR); + + if( !MAP_IsValidCoordinate( fl, x, y )) { + print( "error: invalid Coordinate fl[%d] x[%d] y[%d] %s:%d\n", + fl, x, y, __FILE__, __LINE__); + CONNECT_setCloseRequest( CHAR_getWorkInt( index, CHAR_WORKFD), 1); + return FALSE; + } + + if( ABS( x - prev_x) > CHAR_DEFAULTSEESIZ/2 || + ABS( y - prev_y) > CHAR_DEFAULTSEESIZ/2 ) + { + CHAR_sendCDArroundChar( fl,prev_x,prev_y,objindex ); + } + + if( ABS( x - prev_x) <= 1 && ABS( y - prev_y ) <= 1){ + POINT start,end; + int dir; + start.x = CHAR_getInt( index, CHAR_X); + start.y = CHAR_getInt( index, CHAR_Y); + end.x = x; + end.y = y; + dir = NPC_Util_getDirFromTwoPoint( &start, &end); + if( dir != -1 ) { + CHAR_walk( index, dir, 0); + } + } + else { + CHAR_setInt( index, CHAR_X,x); + CHAR_setInt( index, CHAR_Y,y); + if( setdir >= 0 && setdir < 8) CHAR_setInt( index, CHAR_DIR, setdir); + { + int of,ox,oy; + of = OBJECT_setFloor(objindex,fl); + ox = OBJECT_setX(objindex,x); + oy = OBJECT_setY(objindex,y); + + if( !MAP_objmove( objindex,of,ox,oy,fl,x,y ) ){ + fprint( "ERROR MAP_OBJMOVE objindex=%d\n",objindex ); + return FALSE; + } + } + if( ABS( x - prev_x) > CHAR_DEFAULTSEESIZ/2 || + ABS( y - prev_y) > CHAR_DEFAULTSEESIZ/2 ) + { + CHAR_sendWatchEvent(objindex,CHAR_ACTWARP,NULL,0,FALSE); + } + else if( CAFlg == TRUE ) { + CHAR_sendWatchEvent(objindex,CHAR_ACTWARP,NULL,0,FALSE); + } + } + + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + if( ABS( x - prev_x) <= 1 && ABS( y - prev_y ) <= 1){ + int i; + int prevparty_x = prev_x; + int prevparty_y = prev_y; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( index, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(toindex) ) { + int client_x = prevparty_x; + int client_y = prevparty_y; + int dir; + POINT start, end; + + prevparty_x = CHAR_getInt( toindex, CHAR_X); + prevparty_y = CHAR_getInt( toindex, CHAR_Y); + start.x = prevparty_x; + start.y = prevparty_y; + + end.x = client_x; + end.y = client_y; + + dir = NPC_Util_getDirFromTwoPoint( &start, &end); + if( dir != - 1 ) { + CHAR_walk( toindex, dir, 0); + } + } + } + } + + else if( ABS( x - prev_x) > CHAR_DEFAULTSEESIZ/2 || + ABS( y - prev_y) > CHAR_DEFAULTSEESIZ/2 ) + { + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( index, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(toindex) ) { + CHAR_warpToSpecificPoint( toindex,fl , x,y); + } + } + } + } + + if( ABS( x - prev_x) <= CHAR_DEFAULTSEESIZ/2 && + ABS( y - prev_y) <= CHAR_DEFAULTSEESIZ/2 ) + { + CHAR_setMyPosition_sendData( index, prev_x, prev_y, x, y); + } + + return TRUE; +} + + +static char CHAR_P_statusSendBuffer[STRINGBUFSIZ]; + + + +static char *CHAR_make_P_StatusString( int charaindex, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + char buf[64]; + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_P_STRING_HP, CHAR_HP, 0 }, + { CHAR_P_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_P_STRING_MP, CHAR_MP, 0 }, + { CHAR_P_STRING_MAXMP, CHAR_WORKMAXMP, 1 }, + { CHAR_P_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_P_STRING_LV, CHAR_LV, 0 }, + { CHAR_P_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_P_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_P_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_P_STRING_CHARM, CHAR_WORKFIXCHARM, 1 }, + { CHAR_P_STRING_LUCK, CHAR_WORKFIXLUCK, 1 }, + { CHAR_P_STRING_GOLD, CHAR_GOLD, 0 }, + { CHAR_P_STRING_TITLE, CHAR_INDEXOFEQTITLE, 0 }, + { CHAR_P_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_P_STRING_OWNTITLE, CHAR_OWNTITLE, 2 }, + { CHAR_P_STRING_VITAL, CHAR_VITAL, 10 }, + { CHAR_P_STRING_STR, CHAR_STR, 10 }, + { CHAR_P_STRING_TOUGH, CHAR_TOUGH, 10 }, + { CHAR_P_STRING_DEX, CHAR_DEX, 10 }, + { CHAR_P_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11 }, + { CHAR_P_STRING_WATER, CHAR_WORKFIXWATERAT, 11 }, + { CHAR_P_STRING_FIRE, CHAR_WORKFIXFIREAT, 11 }, + { CHAR_P_STRING_WIND, CHAR_WORKFIXWINDAT, 11 }, + { CHAR_P_STRING_DUELPOINT, CHAR_DUELPOINT, 0 }, + { CHAR_P_STRING_TRANSMIGRATION, CHAR_TRANSMIGRATION, 0}, + { CHAR_P_STRING_RIDEPET, CHAR_RIDEPET, 0}, + { CHAR_P_STRING_LEARNRIDE, CHAR_LEARNRIDE, 0}, + { CHAR_P_STRING_BASEBASEIMAGENUMBER, CHAR_BASEBASEIMAGENUMBER, 0}, + { CHAR_P_STRING_SKYWALKER, CHAR_WORKSKYWALKER, 1}, + { CHAR_P_STRING_DEBUGMODE, CHAR_WORKDEBUGMODE, 1}, + }; + + + snprintf( CHAR_P_statusSendBuffer, sizeof( CHAR_P_statusSendBuffer), + "P%s|", cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_P_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( charaindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( charaindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( charaindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_P_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_P_statusSendBuffer[ strlength], + sizeof( CHAR_P_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_P_statusSendBuffer ) ) { + return CHAR_P_statusSendBuffer; + } + } + } + } + return CHAR_P_statusSendBuffer; +} + +static char *CHAR_make_P_StatusString_Point( int charaindex, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + char buf[64]; + + int vippoint = sasql_vippoint(CHAR_getChar(charaindex,CHAR_CDKEY),0,0); + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_P_STRING_HP, CHAR_HP, 0 }, + { CHAR_P_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_P_STRING_MP, CHAR_MP, 0 }, + { CHAR_P_STRING_MAXMP, CHAR_WORKMAXMP, 1 }, + { CHAR_P_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_P_STRING_LV, CHAR_LV, 0 }, + { CHAR_P_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_P_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_P_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_P_STRING_CHARM, CHAR_WORKFIXCHARM, 1 }, + { CHAR_P_STRING_LUCK, CHAR_WORKFIXLUCK, 1 }, + { CHAR_P_STRING_GOLD, vippoint, 3 }, + { CHAR_P_STRING_TITLE, CHAR_INDEXOFEQTITLE, 0 }, + { CHAR_P_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_P_STRING_OWNTITLE, CHAR_OWNTITLE, 2 }, + { CHAR_P_STRING_VITAL, CHAR_VITAL, 10 }, + { CHAR_P_STRING_STR, CHAR_STR, 10 }, + { CHAR_P_STRING_TOUGH, CHAR_TOUGH, 10 }, + { CHAR_P_STRING_DEX, CHAR_DEX, 10 }, + { CHAR_P_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11 }, + { CHAR_P_STRING_WATER, CHAR_WORKFIXWATERAT, 11 }, + { CHAR_P_STRING_FIRE, CHAR_WORKFIXFIREAT, 11 }, + { CHAR_P_STRING_WIND, CHAR_WORKFIXWINDAT, 11 }, + { CHAR_P_STRING_DUELPOINT, CHAR_DUELPOINT, 0 }, + { CHAR_P_STRING_TRANSMIGRATION, CHAR_TRANSMIGRATION, 0}, + { CHAR_P_STRING_RIDEPET, CHAR_RIDEPET, 0}, + { CHAR_P_STRING_LEARNRIDE, CHAR_LEARNRIDE, 0}, + { CHAR_P_STRING_BASEBASEIMAGENUMBER, CHAR_BASEBASEIMAGENUMBER, 0}, + { CHAR_P_STRING_SKYWALKER, CHAR_WORKSKYWALKER, 1}, + { CHAR_P_STRING_DEBUGMODE, CHAR_WORKDEBUGMODE, 1}, + }; + + snprintf( CHAR_P_statusSendBuffer, sizeof( CHAR_P_statusSendBuffer), + "P%s|", cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_P_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 3 ) { + ret = vippoint; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( charaindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( charaindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( charaindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_P_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_P_statusSendBuffer[ strlength], + sizeof( CHAR_P_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_P_statusSendBuffer ) ) { + return CHAR_P_statusSendBuffer; + } + } + } + } + return CHAR_P_statusSendBuffer; +} + +static char *CHAR_make_P_StatusString_Fame( int charaindex, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + char buf[64]; + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_P_STRING_HP, CHAR_HP, 0 }, + { CHAR_P_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_P_STRING_MP, CHAR_MP, 0 }, + { CHAR_P_STRING_MAXMP, CHAR_WORKMAXMP, 1 }, + { CHAR_P_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_P_STRING_LV, CHAR_LV, 0 }, + { CHAR_P_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_P_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_P_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_P_STRING_CHARM, CHAR_WORKFIXCHARM, 1 }, + { CHAR_P_STRING_LUCK, CHAR_WORKFIXLUCK, 1 }, + { CHAR_P_STRING_GOLD, CHAR_FAME, 12 }, + { CHAR_P_STRING_TITLE, CHAR_INDEXOFEQTITLE, 0 }, + { CHAR_P_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_P_STRING_OWNTITLE, CHAR_OWNTITLE, 2 }, + { CHAR_P_STRING_VITAL, CHAR_VITAL, 10 }, + { CHAR_P_STRING_STR, CHAR_STR, 10 }, + { CHAR_P_STRING_TOUGH, CHAR_TOUGH, 10 }, + { CHAR_P_STRING_DEX, CHAR_DEX, 10 }, + { CHAR_P_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11 }, + { CHAR_P_STRING_WATER, CHAR_WORKFIXWATERAT, 11 }, + { CHAR_P_STRING_FIRE, CHAR_WORKFIXFIREAT, 11 }, + { CHAR_P_STRING_WIND, CHAR_WORKFIXWINDAT, 11 }, + { CHAR_P_STRING_DUELPOINT, CHAR_DUELPOINT, 0 }, + { CHAR_P_STRING_TRANSMIGRATION, CHAR_TRANSMIGRATION, 0}, + { CHAR_P_STRING_RIDEPET, CHAR_RIDEPET, 0}, + { CHAR_P_STRING_LEARNRIDE, CHAR_LEARNRIDE, 0}, + { CHAR_P_STRING_BASEBASEIMAGENUMBER, CHAR_BASEBASEIMAGENUMBER, 0}, + { CHAR_P_STRING_SKYWALKER, CHAR_WORKSKYWALKER, 1}, + { CHAR_P_STRING_DEBUGMODE, CHAR_WORKDEBUGMODE, 1}, + }; + + snprintf( CHAR_P_statusSendBuffer, sizeof( CHAR_P_statusSendBuffer), + "P%s|", cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_P_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( charaindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( charaindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 12 ) { + ret = (int)(CHAR_getInt( charaindex, chk[j].intdataindex)/100); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( charaindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_P_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_P_statusSendBuffer[ strlength], + sizeof( CHAR_P_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_P_statusSendBuffer ) ) { + return CHAR_P_statusSendBuffer; + } + } + } + } + return CHAR_P_statusSendBuffer; +} + + +static char *CHAR_make_P_StatusString_AMPOINT( int charaindex, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + char buf[64]; + int ampoint = sasql_ampoint(CHAR_getChar(charaindex,CHAR_CDKEY),0,0); + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_P_STRING_HP, CHAR_HP, 0 }, + { CHAR_P_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_P_STRING_MP, CHAR_MP, 0 }, + { CHAR_P_STRING_MAXMP, CHAR_WORKMAXMP, 1 }, + { CHAR_P_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_P_STRING_LV, CHAR_LV, 0 }, + { CHAR_P_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_P_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_P_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_P_STRING_CHARM, CHAR_WORKFIXCHARM, 1 }, + { CHAR_P_STRING_LUCK, CHAR_WORKFIXLUCK, 1 }, + { CHAR_P_STRING_GOLD, ampoint, 3 }, + { CHAR_P_STRING_TITLE, CHAR_INDEXOFEQTITLE, 0 }, + { CHAR_P_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_P_STRING_OWNTITLE, CHAR_OWNTITLE, 2 }, + { CHAR_P_STRING_VITAL, CHAR_VITAL, 10 }, + { CHAR_P_STRING_STR, CHAR_STR, 10 }, + { CHAR_P_STRING_TOUGH, CHAR_TOUGH, 10 }, + { CHAR_P_STRING_DEX, CHAR_DEX, 10 }, + { CHAR_P_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11 }, + { CHAR_P_STRING_WATER, CHAR_WORKFIXWATERAT, 11 }, + { CHAR_P_STRING_FIRE, CHAR_WORKFIXFIREAT, 11 }, + { CHAR_P_STRING_WIND, CHAR_WORKFIXWINDAT, 11 }, + { CHAR_P_STRING_DUELPOINT, CHAR_DUELPOINT, 0 }, + { CHAR_P_STRING_TRANSMIGRATION, CHAR_TRANSMIGRATION, 0}, + { CHAR_P_STRING_RIDEPET, CHAR_RIDEPET, 0}, + { CHAR_P_STRING_LEARNRIDE, CHAR_LEARNRIDE, 0}, + { CHAR_P_STRING_BASEBASEIMAGENUMBER, CHAR_BASEBASEIMAGENUMBER, 0}, + { CHAR_P_STRING_SKYWALKER, CHAR_WORKSKYWALKER, 1}, + { CHAR_P_STRING_DEBUGMODE, CHAR_WORKDEBUGMODE, 1}, + }; + + snprintf( CHAR_P_statusSendBuffer, sizeof( CHAR_P_statusSendBuffer), + "P%s|", cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_P_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 3 ) { + ret = ampoint; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( charaindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( charaindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( charaindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_P_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_P_statusSendBuffer[ strlength], + sizeof( CHAR_P_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_P_statusSendBuffer ) ) { + return CHAR_P_statusSendBuffer; + } + } + } + } + return CHAR_P_statusSendBuffer; +} + +#ifdef _VIGOR_SYS +static char *CHAR_make_P_StatusString_VIGOR( int charaindex, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + char buf[64]; + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_P_STRING_HP, CHAR_HP, 0 }, + { CHAR_P_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_P_STRING_MP, CHAR_MP, 0 }, + { CHAR_P_STRING_MAXMP, CHAR_WORKMAXMP, 1 }, + { CHAR_P_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_P_STRING_LV, CHAR_LV, 0 }, + { CHAR_P_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_P_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_P_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_P_STRING_CHARM, CHAR_WORKFIXCHARM, 1 }, + { CHAR_P_STRING_LUCK, CHAR_WORKFIXLUCK, 1 }, + { CHAR_P_STRING_GOLD, CHAR_VIGOR, 0 }, + { CHAR_P_STRING_TITLE, CHAR_INDEXOFEQTITLE, 0 }, + { CHAR_P_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_P_STRING_OWNTITLE, CHAR_OWNTITLE, 2 }, + { CHAR_P_STRING_VITAL, CHAR_VITAL, 10 }, + { CHAR_P_STRING_STR, CHAR_STR, 10 }, + { CHAR_P_STRING_TOUGH, CHAR_TOUGH, 10 }, + { CHAR_P_STRING_DEX, CHAR_DEX, 10 }, + { CHAR_P_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11 }, + { CHAR_P_STRING_WATER, CHAR_WORKFIXWATERAT, 11 }, + { CHAR_P_STRING_FIRE, CHAR_WORKFIXFIREAT, 11 }, + { CHAR_P_STRING_WIND, CHAR_WORKFIXWINDAT, 11 }, + { CHAR_P_STRING_DUELPOINT, CHAR_DUELPOINT, 0 }, + { CHAR_P_STRING_TRANSMIGRATION, CHAR_TRANSMIGRATION, 0}, + { CHAR_P_STRING_RIDEPET, CHAR_RIDEPET, 0}, + { CHAR_P_STRING_LEARNRIDE, CHAR_LEARNRIDE, 0}, + { CHAR_P_STRING_BASEBASEIMAGENUMBER, CHAR_BASEBASEIMAGENUMBER, 0}, + { CHAR_P_STRING_SKYWALKER, CHAR_WORKSKYWALKER, 1}, + { CHAR_P_STRING_DEBUGMODE, CHAR_WORKDEBUGMODE, 1}, + }; + + snprintf( CHAR_P_statusSendBuffer, sizeof( CHAR_P_statusSendBuffer), + "P%s|", cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_P_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( charaindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( charaindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( charaindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + }else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( charaindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_P_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( charaindex, CHAR_getInt( charaindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_P_statusSendBuffer[ strlength], + sizeof( CHAR_P_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_P_statusSendBuffer ) ) { + return CHAR_P_statusSendBuffer; + } + } + } + } + return CHAR_P_statusSendBuffer; +} +#endif +BOOL CHAR_send_P_StatusString( int charaindex, unsigned int indextable ) +{ + char* string; + //if( indextable >= ( CHAR_P_STRING_BASEBASEIMAGENUMBER << 1)) { + if( indextable >= ( CHAR_P_STRING_SKYWALKER << 1)) { + //if( indextable >= ( CHAR_P_STRING_DEBUGMODE << 1)) { + print( "send_P invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + + string = CHAR_make_P_StatusString( charaindex, indextable ); + + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} +BOOL CHAR_send_P_StatusString_Point( int charaindex, unsigned int indextable ) +{ + char* string; + //if( indextable >= ( CHAR_P_STRING_BASEBASEIMAGENUMBER << 1)) { + if( indextable >= ( CHAR_P_STRING_SKYWALKER << 1)) { + //if( indextable >= ( CHAR_P_STRING_DEBUGMODE << 1)) { + print( "send_P invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + + string = CHAR_make_P_StatusString_Point( charaindex, indextable ); + + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} +BOOL CHAR_send_P_StatusString_Fame( int charaindex, unsigned int indextable ) +{ + char* string; + //if( indextable >= ( CHAR_P_STRING_BASEBASEIMAGENUMBER << 1)) { + if( indextable >= ( CHAR_P_STRING_SKYWALKER << 1)) { + //if( indextable >= ( CHAR_P_STRING_DEBUGMODE << 1)) { + print( "send_P invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + + string = CHAR_make_P_StatusString_Fame( charaindex, indextable ); + + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} + +BOOL CHAR_send_P_StatusString_AMPOINT( int charaindex, unsigned int indextable ) +{ + char* string; + //if( indextable >= ( CHAR_P_STRING_BASEBASEIMAGENUMBER << 1)) { + if( indextable >= ( CHAR_P_STRING_SKYWALKER << 1)) { + //if( indextable >= ( CHAR_P_STRING_DEBUGMODE << 1)) { + print( "send_P invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + + string = CHAR_make_P_StatusString_AMPOINT( charaindex, indextable ); + + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} +#ifdef _VIGOR_SYS +BOOL CHAR_send_P_StatusString_VIGOR( int charaindex, unsigned int indextable ) +{ + char* string; + //if( indextable >= ( CHAR_P_STRING_BASEBASEIMAGENUMBER << 1)) { + if( indextable >= ( CHAR_P_STRING_SKYWALKER << 1)) { + //if( indextable >= ( CHAR_P_STRING_DEBUGMODE << 1)) { + print( "send_P invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + + string = CHAR_make_P_StatusString_VIGOR( charaindex, indextable ); + + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} +#endif +static char CHAR_N_statusSendBuffer[STRINGBUFSIZ]; +/*------------------------------------------------------------ + * ͷʧ˪ ٯ ë£ + * ¦ + * charaindex int ƽҷ̼ + * indextable int P ë˪ɷ¶ + *------------------------------------------------------------*/ +static char *CHAR_make_N_StatusString( int charaindex, int num, unsigned int indextable ) +{ + int i,j; + int nindex = -1; + int ret = 0; + int strlength; + char buf[64]; + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_N_STRING_OBJINDEX, CHAR_WORKOBJINDEX, 1 }, + { CHAR_N_STRING_LV, CHAR_LV, 0 }, + { CHAR_N_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_N_STRING_HP, CHAR_HP, 0 }, + { CHAR_N_STRING_MP, CHAR_MP, 0 }, + { CHAR_N_STRING_NAME, CHAR_NAME, 2 }, + + + }; + /* ޵ */ + /* */ + if( num < 0 || num >= CHAR_PARTYMAX ){ + print( "ģʽʧ (%c)%d \n", num, num ); + return "\0"; + } + /* ޼̼͵ë */ + nindex = CHAR_getPartyIndex( charaindex, num); + + if( nindex == -1 ){ + /* ֧ snprintf */ + snprintf( CHAR_N_statusSendBuffer,sizeof(CHAR_N_statusSendBuffer), + "N%d|0|", num ); + return CHAR_N_statusSendBuffer; + } + + snprintf( CHAR_N_statusSendBuffer, sizeof( CHAR_N_statusSendBuffer), + "N%d|%s|", num,cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_N_statusSendBuffer ); + + /* indextable ƥ Ȼë Ʃ */ + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + /* Ȼchk¾Ʃ */ + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + /* ׼ƥë */ + /* Ѱ̼ */ + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( nindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( nindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( nindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( nindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + /* ٯ ̼ */ + else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( nindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + found = TRUE; + break; + } + } + /* ְ󼰷ľئ */ + if( !found) { + /* շ๴๴ */ + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + } + else { + strcpysafe( &CHAR_N_statusSendBuffer[ strlength], + sizeof( CHAR_N_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_N_statusSendBuffer ) ) { + return CHAR_N_statusSendBuffer; + } + } + } + } + return CHAR_N_statusSendBuffer; +} +/*------------------------------------------------------------ + * S P ë˪£¼ƥƥئʻУ + * ¦ + * charaindex int ƽҷ̼ + * num int į + * indextable int P ë˪ɷ¶ + * ߯Ի + * ˪ףTRUE(1) + * ˪ľئףFALSE(0) + *------------------------------------------------------------*/ +BOOL CHAR_send_N_StatusString( int charaindex, int num, unsigned int indextable ) +{ + char* string; + + if( indextable >= (CHAR_N_STRING_NAME << 1)) { + print( "send_N invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + string = CHAR_make_N_StatusString( charaindex, num, indextable ); + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} + +static char CHAR_K_statusSendBuffer[STRINGBUFSIZ]; +static char *CHAR_make_K_StatusString( int charaindex, int num, unsigned int indextable ) +{ + int i,j; + int ret = 0; + int strlength; + int pindex; + char buf[64]; + struct { + unsigned int kind; + int intdataindex; + int gettype; + }chk[] = { + { CHAR_K_STRING_BASEIMAGENUMBER, CHAR_BASEIMAGENUMBER, 0 }, + { CHAR_K_STRING_HP, CHAR_HP, 0 }, + { CHAR_K_STRING_MAXHP, CHAR_WORKMAXHP, 1 }, + { CHAR_K_STRING_MP, CHAR_MP, 0 }, + { CHAR_K_STRING_MAXHP, CHAR_WORKMAXMP, 1 }, + { CHAR_K_STRING_EXP, CHAR_EXP, 0 }, + { CHAR_K_STRING_LV, CHAR_LV, 0 }, + { CHAR_K_STRING_ATK, CHAR_WORKATTACKPOWER, 1 }, + { CHAR_K_STRING_DEF, CHAR_WORKDEFENCEPOWER, 1 }, + { CHAR_K_STRING_QUICK, CHAR_WORKQUICK, 1 }, + { CHAR_K_STRING_AI, CHAR_WORKFIXAI, 1 }, + { CHAR_K_STRING_EARTH, CHAR_WORKFIXEARTHAT, 11}, + { CHAR_K_STRING_WATER, CHAR_WORKFIXWATERAT, 11}, + { CHAR_K_STRING_FIRE, CHAR_WORKFIXFIREAT, 11}, + { CHAR_K_STRING_WIND, CHAR_WORKFIXWINDAT, 11}, + { CHAR_K_STRING_SLOT, CHAR_SLOT, 0 }, + { CHAR_K_STRING_NAME, CHAR_NAME, 2 }, + { CHAR_K_STRING_USERPETNAME, CHAR_USERPETNAME, 2 }, + + }; + /* */ + if( num < 0 || num >= CHAR_MAXPETHAVE ){ + print( "ģʽʧ (%c)%d \n", num, num ); + return "\0"; + } + /* ʸ̼͵ë */ + pindex = CHAR_getCharPet( charaindex, num ); + if( pindex == -1 ){ + /* ֧ snprintf */ + snprintf(CHAR_K_statusSendBuffer,sizeof(CHAR_K_statusSendBuffer), + "K%d|0|", num ); + return CHAR_K_statusSendBuffer; + } + + snprintf( CHAR_K_statusSendBuffer, sizeof( CHAR_K_statusSendBuffer), + "K%d|%s|", num, cnv10to62( indextable, buf,sizeof(buf))); + strlength = strlen( CHAR_K_statusSendBuffer ); + + for( i = 1; i < sizeof( int) * 8; i ++ ){ + if( indextable & (1 << i) ) { + char tmp[256]; + BOOL found = FALSE; + for( j = 0; j < arraysizeof( chk); j ++ ) { + if( chk[j].kind == 1 << i ) { + if( chk[j].gettype == 0 ) { + ret = CHAR_getInt( pindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 1 ) { + ret = CHAR_getWorkInt( pindex,chk[j].intdataindex); + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 10 ) { + ret = CHAR_getInt( pindex, chk[j].intdataindex)/100; + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + else if( chk[j].gettype == 11 ) { + ret = CHAR_getWorkInt( pindex, chk[j].intdataindex); + if( ret < 0) ret = 0; + snprintf( tmp, sizeof( tmp), "%d|", ret); + } + /* ٯ ̼ */ + else if( chk[j].gettype == 2 ) { + char escapebuffer[128]; + char *a = CHAR_getChar( pindex, chk[j].intdataindex); + + snprintf( tmp,sizeof( tmp ), + "%s|", + makeEscapeString( a, escapebuffer, + sizeof(escapebuffer) + )); + } + found = TRUE; + break; + } + } + if( !found) { + if( indextable & CHAR_K_STRING_NEXTEXP ) { + ret = CHAR_GetLevelExp( pindex, CHAR_getInt( pindex, CHAR_LV ) + 1); + snprintf( tmp, sizeof( tmp), "%d|", ret); + found = TRUE; + } + if( indextable & CHAR_K_STRING_CHANGENAMEFLG ) { + BOOL changenameflg = FALSE; + char *mycdkey, *cdkey = NULL; + mycdkey = CHAR_getChar( charaindex, CHAR_CDKEY); + { + cdkey = CHAR_getChar( pindex, CHAR_CDKEY); + if( cdkey == "\0" ) { + print( "can't get CDKEY\n"); + }else { + if( strlen( cdkey) == 0 || + strcmp( cdkey, mycdkey) == 0 ){ + changenameflg = TRUE; + } + } + } + snprintf( tmp, sizeof( tmp), "%d|", changenameflg); + found = TRUE; + } + } + if( !found) { + print( "ҲָIJ[%d]\n",indextable); + }else { + strcpysafe( &CHAR_K_statusSendBuffer[ strlength], + sizeof( CHAR_K_statusSendBuffer) - strlength, + tmp); + + strlength += strlen( tmp ); + if( strlength >= sizeof( CHAR_K_statusSendBuffer ) ) { + return CHAR_K_statusSendBuffer; + } + } + } + } + return CHAR_K_statusSendBuffer; +} +/*------------------------------------------------------------ + * S K ë˪£¼ƥƥئʻУ + * ¦ + * charaindex int ƽҷ̼ + * indextable int P ë˪ɷ¶ + * ߯Ի + * ˪ףTRUE(1) + * ˪ľئףFALSE(0) + *------------------------------------------------------------*/ +BOOL CHAR_send_K_StatusString( int charaindex, int num, unsigned int indextable ) +{ + char* string; + + if( indextable >= (CHAR_K_STRING_USERPETNAME << 1)) { + print( "send_K invalid index[%d]\n", indextable); + return FALSE; + } + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return FALSE; + } + string = CHAR_make_K_StatusString( charaindex, num, indextable ); + if( string != NULL ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_S_send( fd, string ); + return TRUE; + } + } + return FALSE; +} + + + +//------------------------------------------------------------ +// ëң +//------------------------------------------------------------ +void CHAR_AddCharm( int charaindex, int iValue ) +{ + int iWork; + iWork = CHAR_getInt( charaindex, CHAR_CHARM ) + iValue; + iWork = max( 0, iWork ); // + iWork = min( 100, iWork ); // ߨ + CHAR_setInt( charaindex, CHAR_CHARM, iWork ); +} + +//------------------------------------------------------------ +// ʸպ ëң£ +//------------------------------------------------------------ +void CHAR_PetAddVariableAi( int petindex, int iValue ) +{ + int iWork; + iWork = CHAR_getInt( petindex, CHAR_VARIABLEAI ) + iValue; + iWork = min( CHAR_MAXVARIABLEAI, iWork ); + iWork = max( CHAR_MINVARIABLEAI, iWork ); + CHAR_setInt( petindex, CHAR_VARIABLEAI, iWork ); + +} + +//------------------------------------------------------------ +// ì ƽ ë£ +//------------------------------------------------------------ +int CHAR_makeDBKey( int charaindex, char *pszBuffer, int size ){ + + char *cdkey; + char buff[512]; + char escapebuf[1024]; + + pszBuffer[0] = 0; // + cdkey = CHAR_getChar( charaindex, CHAR_CDKEY); + if( cdkey == "\0" )return FALSE; // ƥئ + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + // ƽ cdkey_ + snprintf( buff, sizeof(buff), + "%s_%s", cdkey, CHAR_getChar( charaindex, CHAR_NAME ) ); + makeEscapeString( buff, escapebuf, sizeof(escapebuf)); + strcpysafe( pszBuffer, size, escapebuf); + + return TRUE; +} + + +//------------------------------------------------------------ +// +// ì ëޥ +// +// DuelPoint DBUpdateEntryë˪ +//------------------------------------------------------------ +BOOL CHAR_send_DpDBUpdate( int charaindex ) +{ + int fd,dp; + char szKey[256]; + if( CHAR_makeDBKey( charaindex, szKey, sizeof( szKey ) ) == FALSE ){ + return FALSE; + } + dp = CHAR_getInt( charaindex, CHAR_DUELPOINT ); + fd = getfdFromCharaIndex( charaindex); + if( fd != -1 ) { + char info[512]; + //char escapebuff[1024]; + /* "ȼսʤܣʤʤ" */ + snprintf( info, sizeof( info), + "%d,%d,%d,%d,%d,%d", + CHAR_getInt( charaindex, CHAR_LV), + CHAR_getInt( charaindex, CHAR_DUELBATTLECOUNT), + CHAR_getInt( charaindex, CHAR_DUELWINCOUNT), + CHAR_getInt( charaindex, CHAR_DUELLOSECOUNT), + CHAR_getInt( charaindex, CHAR_DUELSTWINCOUNT), + CHAR_getInt( charaindex, CHAR_DUELMAXSTWINCOUNT)); + saacproto_DBUpdateEntryInt_send( + acfd, DB_DUELPOINT, szKey, max(dp,0), info, + CONNECT_getFdid( fd ) ,0 ); + } + + return TRUE; +} + +char *CHAR_getUseName( int charaindex ) +{ + char *pName=NULL; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + pName = CHAR_getChar( charaindex, CHAR_USERPETNAME ); + if( pName[0] == 0 ){ + pName = CHAR_getChar( charaindex, CHAR_NAME ); + } + }else{ +// if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) +// pName = CHAR_getChar( charaindex, CHAR_OWNTITLE ); +// if( pName == "\0" || strlen(pName) <= 0 ) + pName = CHAR_getChar( charaindex, CHAR_NAME ); + } + return pName; +} + +// Robin extend_of_CHAR_getUseName() 2001/02/15 +char *CHAR_getUseID( int charaindex ) +{ + char *pName; + // ʸհة + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + pName = "NO_USER"; + }else{ + pName = CHAR_getChar( charaindex, CHAR_CDKEY ); + } + return pName; +} + +BOOL CHAR_send_DpDBUpdate_AddressBook( int charaindex, int mode ) +{ + int fd; + char szKey[256]; + if( CHAR_makeDBKey( charaindex, szKey, sizeof( szKey ) ) == FALSE ){ + return FALSE; + } + + fd = getfdFromCharaIndex( charaindex); + if( fd != -1 ) { + char msgbuf[512]; + int mytrans = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); +#ifdef _ASSA_TOP + if(mytrans>6) mytrans = 0; +#endif + snprintf( msgbuf, sizeof( msgbuf), + "%d|%d|%d|%d|%d|", + (mode == 0 ) ? 0 : getServernumber(), + CHAR_getInt( charaindex, CHAR_LV), + CHAR_getInt( charaindex, CHAR_DUELPOINT), + CHAR_getInt( charaindex, CHAR_FACEIMAGENUMBER), + mytrans ); + + saacproto_DBUpdateEntryString_send( + acfd, DB_ADDRESSBOOK, szKey, msgbuf, CONNECT_getFdid( fd ),0 ); + + saacproto_Broadcast_send( acfd, CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( charaindex, CHAR_NAME), "param", 0); + + } + return TRUE; +} + +void CHAR_sendBattleWatch( int objindex, int onoff) +{ + int opt[1]; + opt[0] = onoff; + CHAR_sendWatchEvent( objindex,CHAR_ACTBATTLEWATCH,opt,1,TRUE); +} +/*------------------------------------------------------------ + * ϶ýľ ëĪԻбʸPë£ + * ¦ + * charaindex int chara ƥ̼ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_sendPMEToArroundCharacterFLXY( int petindex, int fl, int x, int y, + int dir, int flg, int no ) +{ + int i,j; + int objindex; + int graphicsno; + char buff[2048]; + + objindex = CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX); + graphicsno = CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER); + if( CHAR_makeObjectCString( objindex, buff, sizeof( buff)) == FALSE ) { + buff[0] = '\0'; + } + + for( i = x - CHAR_DEFAULTSEESIZ/2 ; + i <= x +CHAR_DEFAULTSEESIZ/2 ; i ++ ){ + for( j = y - CHAR_DEFAULTSEESIZ/2; + j <= y + CHAR_DEFAULTSEESIZ/2; j ++ ){ + + OBJECT object; + for( object = MAP_getTopObj( fl, i,j); + object; + object = NEXT_OBJECT(object) ){ + int objindexwk = GET_OBJINDEX( object); + if( OBJECT_getType(objindexwk) == OBJTYPE_CHARA ){ + int index = OBJECT_getIndex(objindexwk); + if( CHAR_getInt( index,CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int fd; + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) continue; + fd = getfdFromCharaIndex( index); + if( fd == -1 )continue; + lssproto_PME_send( fd, objindex, graphicsno, + x,y, dir,flg,no,buff + ); + } + } + } + } + } +} +/*------------------------------------------------------------ + * charaindex ƥ϶ýľ ëĪԻбʸPë£ + * ¦ + * charaindex int chara ƥ̼ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_sendPMEToArroundCharacter( int charaindex, int petindex, int flg, int no ) +{ + int dirx[9],diry[9]; + int i; + int fl,x,y; + int dir; + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + diry[i+2] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + + fl = CHAR_getInt( charaindex,CHAR_FLOOR ); + dir = CHAR_getInt( charaindex, CHAR_DIR); + + /* */ + for( i = 0 ; i < 9 ; i ++ ){ + int x = CHAR_getInt( charaindex, CHAR_X) + dirx[i]; + int y = CHAR_getInt( charaindex, CHAR_Y) + diry[i]; + /* ʸë Ʃ */ + if( PET_isPutPoint( fl, x, y ) == TRUE ) { + break; + } + } + /* ئľ */ + if( i == 9 ) i = 1; + + x = CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + y = CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + + CHAR_sendPMEToArroundCharacterFLXY( petindex, + fl, x, y, dir, flg, no); +} +/*------------------------------------------------------------ + * SEë ʣ + * ë ұέ ˪ + * ¦ + * fl,x,y 缰 + * senumber įsndcnf.hë徼 + * sw ʾ¾ 0 : 1 : + ------------------------------------------------------------*/ +void CHAR_sendSEoArroundCharacter( int fl, int x, int y, int senumber, int sw ) +{ + int i,j; + + for( i = x - CHAR_DEFAULTSEESIZ/2 ; + i <= x +CHAR_DEFAULTSEESIZ/2 ; i ++ ){ + for( j = y - CHAR_DEFAULTSEESIZ/2; + j <= y + CHAR_DEFAULTSEESIZ/2; j ++ ){ + + OBJECT object; + for( object = MAP_getTopObj( fl, i,j); + object; + object = NEXT_OBJECT(object) ){ + int objindexwk = GET_OBJINDEX( object); + if( OBJECT_getType(objindexwk) == OBJTYPE_CHARA ){ + int index = OBJECT_getIndex(objindexwk); + if( CHAR_getInt( index,CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + int fd; + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) continue; + fd = getfdFromCharaIndex( index); + if( fd == -1 )continue; + lssproto_SE_send( fd,x, y, senumber, sw ); + } + } + } + } + } +} +/*====================ɬ====================*/ + + +#ifndef _SEND_EFFECT // WON ADD ACѩЧ + +#define CHAR_EFFECT_SETTINGBUFFER 256 +typedef struct tagCHAR_effectsetting +{ + int floor; // ׷ʧ + int effect; // į + int level; // 뼰ì ؼ۽ + int sendflg; // ްë˪׾ + char month[CHAR_EFFECT_SETTINGBUFFER]; // » + char day[CHAR_EFFECT_SETTINGBUFFER]; // + char hour[CHAR_EFFECT_SETTINGBUFFER]; // + char min[CHAR_EFFECT_SETTINGBUFFER]; // + char expire[CHAR_EFFECT_SETTINGBUFFER]; // ƻӮ( + +}CHAR_effectsetting; + +CHAR_effectsetting* CHAR_effect; +int CHAR_effectnum; + +#endif + + + +/*------------------------------------------------------------ + * ɬüë£ + * ¦ + * filename char* ɬð̻ + * ߯Ի + * TRUE(1) + * FALSE(0) + *------------------------------------------------------------*/ +BOOL CHAR_initEffectSetting( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + + int effectreadlen=0; + + f = fopen(filename,"r"); + if( f == NULL ){ + errorprint; + return FALSE; + } + + CHAR_effectnum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + CHAR_effectnum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Seek Error\n" ); + fclose(f); + return FALSE; + } + + CHAR_effect = allocateMemory( sizeof(CHAR_effectsetting) + * CHAR_effectnum ); + if( CHAR_effect == NULL ){ + fprint( "Can't allocate Memory %d\n" , + sizeof(CHAR_effectsetting)*CHAR_effectnum); + fclose( f ); + return FALSE; + } + /* */ +{ + int i; + for( i = 0; i < CHAR_effectnum; i ++ ) { + CHAR_effect[i].floor = 0; + CHAR_effect[i].effect = 0; + CHAR_effect[i].level = 0; + CHAR_effect[i].sendflg = 0; + CHAR_effect[i].month[0] = '\0'; + CHAR_effect[i].day[0] = '\0'; + CHAR_effect[i].hour[0] = '\0'; + CHAR_effect[i].min[0] = '\0'; + CHAR_effect[i].expire[0] = '\0'; + + } +} + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* " " ë繴 */ + deleteSequentChar( line, " " ); + + /* ƥƻ ʸ */ + /* ئ */ + if( line[0] == ' ' )continue; + + { + char token[256]; + int ret; + + /* 繴ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",1,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + CHAR_effect[effectreadlen].floor = atoi(token); + + /* 2ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",2,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + + CHAR_effect[effectreadlen].effect = atoi( token ); + + /* 3ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",3,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + + CHAR_effect[effectreadlen].level = atoi( token ); + + /* 4ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",4,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + strcpysafe( CHAR_effect[effectreadlen].month, + sizeof( CHAR_effect[effectreadlen].month), + token); + + /* 5ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",5,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + strcpysafe( CHAR_effect[effectreadlen].day, + sizeof( CHAR_effect[effectreadlen].day), + token); + + /* 6ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",6,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + strcpysafe( CHAR_effect[effectreadlen].hour, + sizeof( CHAR_effect[effectreadlen].hour), + token); + + /* 7ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",7,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + strcpysafe( CHAR_effect[effectreadlen].min, + sizeof( CHAR_effect[effectreadlen].min), + token); + + /* 8ͼëέ */ + ret = getStringFromIndexWithDelim( line," ",8,token, + sizeof(token)); + if( ret ==FALSE){ + fprint("ļ:%s %d\n",filename,linenum); + continue; + } + strcpysafe( CHAR_effect[effectreadlen].expire, + sizeof( CHAR_effect[effectreadlen].expire), + token); + + effectreadlen ++; + } + } + fclose(f); + + CHAR_effectnum = effectreadlen; + + print( "Ч %d...", CHAR_effectnum ); +#ifdef DEBUG + + { + int i; + for( i=0; i tim && NowTime.tv_sec < tim+atoi(CHAR_effect[num].expire)) { + flg = TRUE; + break; + } + } + if( !flg ) break; + } + } + // л϶ ƷֵOK + + returnflg = TRUE; + break; + } + return returnflg; +} +//------------------------------------------------------------------------- +// ƽҷ ë +// ްë˪ ۢؤľ˪ +//------------------------------------------------------------------------- +void CHAR_checkEffect( int charaindex) +{ + int i; + int fl = CHAR_getInt( charaindex, CHAR_FLOOR); + int fd = getfdFromCharaIndex( charaindex); + + // ް + lssproto_EF_send( fd, 0, 0, ""); + CHAR_setWorkInt( charaindex, CHAR_WORKEFFECT, 0); + + for( i = 0; i < CHAR_effectnum; i ++){ + // ׷ʧݷ + if( CHAR_effect[i].floor == fl) { + // ëƩʣ + if( CHAR_checkEffectTime( i)){ + // ްë˪ + lssproto_EF_send( fd, CHAR_effect[i].effect, CHAR_effect[i].level, ""); + if( CHAR_effect[i].level == 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKEFFECT, + CHAR_getWorkInt( charaindex, CHAR_WORKEFFECT) & + ~CHAR_effect[i].effect); + } + else { + CHAR_setWorkInt( charaindex, CHAR_WORKEFFECT, + CHAR_getWorkInt( charaindex, CHAR_WORKEFFECT) | + CHAR_effect[i].effect); + } + } + } + } +} + +void CHAR_checkEffectLoop( void) +{ + int i,j; + int playernum = CHAR_getPlayerMaxNum(); + int player; + int efnum = 0; + + struct { + int floor; + int effect; + BOOL on; + BOOL off; + } ef[2048]; + + memset( &ef, 0, sizeof( ef)); + + for( i = 0; i < CHAR_effectnum; i ++){ + + if( CHAR_checkEffectTime( i)){ + if( !CHAR_effect[i].sendflg) { + + for( player = 0 ; player < playernum; player ++ ) { + if( CHAR_getInt( player, CHAR_FLOOR) == CHAR_effect[i].floor ) { + int fd = getfdFromCharaIndex( player); + lssproto_EF_send( fd, CHAR_effect[i].effect, CHAR_effect[i].level, ""); + if( CHAR_effect[i].level == 0 ) { + CHAR_setWorkInt( player, CHAR_WORKEFFECT, + CHAR_getWorkInt( player, CHAR_WORKEFFECT) & + ~CHAR_effect[i].effect); + } + else { + CHAR_setWorkInt( player, CHAR_WORKEFFECT, + CHAR_getWorkInt( player, CHAR_WORKEFFECT) | + CHAR_effect[i].effect); + } + } + } + CHAR_effect[i].sendflg = TRUE; + + } + + for( j = 0; j < efnum; j ++ ) { + if( ef[j].floor == CHAR_effect[i].floor && + ef[j].effect == CHAR_effect[i].effect) + { + ef[j].on = TRUE; + break; + } + } + if( j == efnum ) { + ef[j].floor = CHAR_effect[i].floor; + ef[j].effect = CHAR_effect[i].effect; + ef[j].on = TRUE; + efnum++; + if( efnum >= arraysizeof( ef)) { + print( "err buffer over %s:%d\n", __FILE__, __LINE__); + efnum --; + } + } + } + else { + if( CHAR_effect[i].sendflg) { + + for( j = 0; j < efnum; j ++ ) { + if( ef[j].floor == CHAR_effect[i].floor && + ef[j].effect == CHAR_effect[i].effect) + { + ef[j].off = TRUE; + break; + } + } + if( j == efnum ) { + ef[j].floor = CHAR_effect[i].floor; + ef[j].effect = CHAR_effect[i].effect; + ef[j].off = TRUE; + efnum++; + if( efnum >= arraysizeof( ef)) { + print( "err buffer over %s:%d\n", __FILE__, __LINE__); + efnum --; + } + } + CHAR_effect[i].sendflg = FALSE; + } + } + } + + for( i = 0; i < efnum; i ++ ) { + if( ef[i].on == FALSE && ef[i].off == TRUE ) { + + for( player = 0 ; player < playernum; player ++ ) { + if( CHAR_getInt( player, CHAR_FLOOR) == ef[i].floor ) { + int fd = getfdFromCharaIndex( player); + lssproto_EF_send( fd, 0, 0, ""); + CHAR_setWorkInt( player, CHAR_WORKEFFECT, 0); + } + } + } + } +} + +float GetRecoveryRate( int charaindex ){ + float fBai = 1.0; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + fBai = 1.0 + 0.00010 * CHAR_getInt( charaindex, CHAR_VITAL ); + }else{ + + fBai = 1.0 + 0.00005 * CHAR_getInt( charaindex, CHAR_VITAL ); + } + return fBai; + +} + + +#define CHARDATASIZE (1024*256) +#define SPACESTRING "|" + +static int makeSaveCharString( char *out , int outlen , + char *nm , char *opt , char *info ) +{ + char nmwork[256]; + char optwork[512]; + char infowork[CHARDATASIZE]; + char outwork[CHARDATASIZE]; + char *nmwork_p , *optwork_p , *infowork_p; + int l; + + strncpy( nmwork , nm , sizeof( nmwork )); + nmwork[strlen( nm)]=0; + + strncpy( optwork , opt , sizeof( optwork )); + optwork[strlen(opt)]=0; + + strncpy( infowork , info , sizeof( infowork )); + infowork[strlen(info)]=0; + + nmwork_p = makeEscapeString( nm , nmwork ,sizeof( nmwork )); + optwork_p = makeEscapeString( opt , optwork , sizeof( optwork )); + infowork_p = makeEscapeString( info , infowork , sizeof( infowork )); + + snprintf( outwork ,sizeof( outwork ) , + "%s" SPACESTRING "%s" SPACESTRING "%s" , + nmwork_p , optwork_p , infowork_p ); + + l = strlen( outwork ); + outwork[ strlen( outwork)+1] = 0; + if( l >= (outlen-1)){ + return -1; + } + + memcpy( out , outwork , l + 1 ); + + return 0; +} + +#ifdef _STORECHAR +int storeCharaData( void ){ + int i, charamax; + FILE *fp; + struct tm *pLtime; + char szFileName[256], *chardata; + char outbuff[CHARDATASIZE]; + Char* ch; + + print("\nе"); + + pLtime = localtime( &NowTime.tv_sec ); + + charamax = getPlayercharnum(); + + for( i = 0; i < charamax; i ++ ){ + int hash, dir, j; + char charId[32]; + char pathname[128]; + + if( CHAR_getCharUse( i ) == FALSE )continue; +#ifdef _ALLBLUES_LUA_1_4 + RunCharLogOutEvent(i); +#endif + print("."); + + strcpy( charId, CHAR_getChar( i, CHAR_CDKEY ) ); +// print("˺:%s", charId); + + hash = 0; + for( j=0; jtm_year+1900, + pLtime->tm_mon+1, + pLtime->tm_mday, + pLtime->tm_hour, + pLtime->tm_min + ); + + fp = fopen( szFileName, "w" ); + if( fp == NULL )continue; + + ch = CHAR_getCharPointer( i ); + if( !ch )continue; + + chardata = CHAR_makeStringFromCharData( ch ); + + if( makeSaveCharString( outbuff , sizeof( outbuff ), + CHAR_getChar( i, CHAR_NAME ), + CHAR_makeOptionString( ch ), + chardata ) == 0 + ){ + + fprintf( fp, outbuff ); + }else{ + fprintf( fp, "Ƥ \n" ); + } + + fclose( fp ); + } + return 0; +} + +#endif + + +#ifdef _FIX_METAMORIDE +BOOL CHAR_CHECKJOINENEMY( int index) +{ + int masterindex=-1; + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { + masterindex = CHAR_getWorkInt( index, CHAR_WORKPARTYINDEX1); + if( !CHAR_CHECKINDEX( masterindex) ) { + print( "err masterindex:%d %s:%d !!\n", masterindex,__FILE__, __LINE__); + return FALSE; + } + if( CHAR_getInt( masterindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS) { + return TRUE; //JOIN ENEMY + } + } + + return FALSE; +} +#endif + + // WON ADD ߵ趨 +void fix_item_bug(int charaindex, int itemindex) +{ + + if (ITEM_CHECKINDEX(itemindex)){ + switch( ITEM_getInt(itemindex,ITEM_ID) ){ + case 19700: ITEM_setChar( itemindex, ITEM_ARGUMENT, "KPET:901_902_903_904"); break; // + case 20242: ITEM_setChar( itemindex, ITEM_ARGUMENT, "KPET:957_958_959_960"); break; // ۻƾ + case 1292: ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); break; // + case 19646: ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); break; // + case 1478: ITEM_setChar( itemindex, ITEM_ARGUMENT, "HP:30"); break; // ˷ + case 20282: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, "+25 +25 -4 +5"); ITEM_setInt( itemindex, ITEM_MODIFYQUICK, -4 ); break; // ǹ1 + case 20283: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, "+50 +50 -10 +10"); ITEM_setInt( itemindex, ITEM_MODIFYQUICK, -10 ); break; // ǹ2 + case 20284: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, "+100 +100 -20 +15"); ITEM_setInt( itemindex, ITEM_MODIFYQUICK, -20 ); break; // ǹ3 + case 1210: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, " +4 -4 +4 +2"); break; // ʯֻ + case 1203: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, " +2 +2 -2 +1"); break; // Ƥֻ() + case 1204: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, " -2 +2 +2 +1"); break; // Ƥֻ() + case 1205: ITEM_setChar( itemindex, ITEM_EFFECTSTRING, " +2 -2 +2 +1"); break; // Ƥֻ() + case 1483: ITEM_setInt( itemindex, ITEM_MODIFYCHARM, 5); break; // ɳŽ + case 20147: ITEM_setChar(itemindex,ITEM_INGNAME0,"ľ"); ITEM_setChar(itemindex,ITEM_INGNAME1,""); ITEM_setInt(itemindex,ITEM_INGVALUE0, 1125 ); ITEM_setInt(itemindex,ITEM_INGVALUE1, 1125 ); break; // ˫ͷ + default: + break; + } + } +} + +#ifdef _PET_LOSTPET +BOOL CHAR_CharSaveLostPet( int petindex, int type)//0 1 2 +{ + int lv, cost=0; + char* CdKey=NULL; + char* Uniquecode; + char* petname; + + char lostpetstring[1024*2]; + char *petstring; + + if( !CHAR_CHECKINDEX( petindex) ) return FALSE; +// + petstring = CHAR_makePetStringFromPetIndex( petindex); + if( petstring == "\0" ) return FALSE; + CdKey = CHAR_getChar( petindex, CHAR_OWNERCDKEY); + if( CdKey == "\0" ) return FALSE; + Uniquecode = CHAR_getChar( petindex, CHAR_UNIQUECODE); + if( Uniquecode == "\0" ) return FALSE; + lv = CHAR_getInt( petindex, CHAR_LV); + petname = CHAR_getChar( petindex, CHAR_NAME); + + if( type == 1 ){ + cost = lv*300; + }else if( type == 2){ + cost = lv*1000; + }else{ + cost = lv*10000; + } + + sprintf( lostpetstring, "%s|%s|%d|%d|%s|%d#%s#%d", + CdKey, petname, lv, cost, Uniquecode, (int)time( NULL), petstring, + type); + +// print(":%s-%d\n", lostpetstring, strlen(lostpetstring)); + { + char buf[10][2048]={"","","","","","","","","",""}; + char line[2048]; + int count=0, i, start=0; + FILE *fp=NULL; + char filename[256]; + +/* + sprintf( filename, "lostpet/%s.txt", CdKey); + if( (fp=fopen( filename, "a+")) != NULL ){ + fprintf( fp, "%s\n", petstring); + fclose( fp); + }else{ + print("Can't Add %s \n", filename); + } + +*/ + + + sprintf( filename, "lostpet/%s.txt", CdKey); + if( (fp=fopen( filename, "r")) != NULL ){ + while( fgets( line , sizeof( line ) , fp ) && count < 7){ + if( strlen(line) <= 0 ) continue; + strcpy( buf[ count++] , line); + } + fclose( fp); + }else{ + print("Can't Read %s \n", filename); + } + + if( (fp=fopen( filename, "w+")) == NULL ){ + print("Can't Write %s \n", filename); + return FALSE; + } + if( strlen( buf[ 6]) > 0 ){ + start=2; + } + for( i=start; i<7; i++){ + if( strlen( buf[i]) > 0 ) { + print("Write %s \n", buf[i]); + fprintf( fp, "%s", buf[i]); + } + } + fprintf( fp, "%s\n", lostpetstring); + + fclose( fp); + } + return TRUE; +} +/* +while( fgets( line , sizeof( line ) , fp ) && count < 7){ +*/ +#endif + +#ifdef _ALLDOMAN +void InitHeroList( void) +{ + saacproto_UpdataStele_send ( acfd , "FirstLoad", "LoadHerolist" , "" , 0 , 0 , 0 , 999 ) ; +} +#endif + +#ifdef _STREET_VENDOR +void CHAR_sendStreetVendor(int charaindex,char *message) +{ + char szAction[2],szTemp[21],szMessage[4]; + int count = 0,i,j,iItemIndex = 0,iPetIndex = 0,iPileNum = 0,iMaxPileNum = 0; + int ix,iy,iPlayerNum = 0,tofd = -1,objbuf[16]; + float TradeTax; + TradeTax = getTradeTax()/100; + if(CHAR_getInt(charaindex,CHAR_FLOOR)==11111 || CHAR_getInt(charaindex,CHAR_FLOOR)==22222 || CHAR_getInt(charaindex,CHAR_FLOOR)==33333 || CHAR_getInt(charaindex,CHAR_FLOOR)==44444) + return; +#ifdef _NO_STREET_MAP + int mapi; + for(mapi=1;mapi<=5;mapi++){ + if(CHAR_getInt(charaindex,CHAR_FLOOR)==getNoStreetMap(mapi)){ + CHAR_talkToCli(charaindex,-1,"˵ͼ԰̯!",CHAR_COLORRED); + return; + } + } +#endif + if(!getStringFromIndexWithDelim(message,"|",1,szAction,sizeof(szAction))) return; + // ̯ + if(szAction[0] == 'O'){ + CHAR_getCoordinationDir(CHAR_getInt(charaindex,CHAR_DIR),CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y),1,&ix,&iy); + // ȡǰ + iPlayerNum = CHAR_getSameCoordinateObjects(objbuf,arraysizeof(objbuf),CHAR_getInt(charaindex,CHAR_FLOOR),ix,iy); + // û + if(iPlayerNum == 0){ + // ԼվûҲڰ̯ + iPlayerNum = CHAR_getSameCoordinateObjects(objbuf,arraysizeof(objbuf), + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y)); + // ֻԼһ + if(iPlayerNum > 1){ + // ûа̯ + for(i=0;i 0){ + if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) == 1){ + // ޸δ̯ + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_sendStreetVendorDataToCli(charaindex,charaindex); + } + // ڽеҪ,رնԷӴ + else if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) == 2){ + int toindex = CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO); + + if(toindex != -1 && CHAR_CHECKINDEX(toindex)){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + lssproto_STREET_VENDOR_send(getfdFromCharaIndex(toindex),"C|"); + CHAR_talkToCli(toindex,-1,"ȡ",CHAR_COLORYELLOW); + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO,-1); + // ͼʾ + CHAR_send_P_StatusString(charaindex,CHAR_P_STRING_GOLD); + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + CHAR_sendTradeEffect(charaindex,0); + CHAR_sendTradeEffect(toindex,0); +#ifdef _LOOK_STREET_TIME + CHAR_setWorkInt(toindex,CHAR_LOOKSTREETTIME,0); +#endif + } + // ޸,δ̯ + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_sendStreetVendorDataToCli(charaindex,charaindex); + } + return; + } + // ԷǷ + for(j=0;j 0){ + if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) == 1){ + // ޸δ̯ + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_sendStreetVendorDataToCli(charaindex,charaindex); + } + // ڽеҪ,رնԷӴ + else if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) == 2){ + int toindex = CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO); + + if(toindex != -1 && CHAR_CHECKINDEX(toindex)){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + lssproto_STREET_VENDOR_send(getfdFromCharaIndex(toindex),"C|"); + CHAR_talkToCli(toindex,-1,"ȡ",CHAR_COLORYELLOW); + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO,-1); + // ͼʾ + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + CHAR_sendTradeEffect(charaindex,0); + CHAR_sendTradeEffect(toindex,0); +#ifdef _LOOK_STREET_TIME + CHAR_setWorkInt(toindex,CHAR_LOOKSTREETTIME,0); +#endif + } + // ޸,δ̯ + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_sendStreetVendorDataToCli(charaindex,charaindex); + } + } + // 趨ɰ̯ + else{ +#ifdef _LOOK_STREET_TIME + if(CHAR_getWorkInt(toindex,CHAR_WORKSTREETVENDOR) == 2){ + int buyindex = CHAR_getWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO); + if(buyindex != -1 && CHAR_CHECKINDEX(buyindex)){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(timep-CHAR_getWorkInt(buyindex,CHAR_LOOKSTREETTIME)>getLookStreetTime()){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,1); + CHAR_setWorkInt(buyindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkInt(buyindex,CHAR_WORKSTREETVENDOR_WHO,-1); + lssproto_STREET_VENDOR_send(getfdFromCharaIndex(buyindex),"C|"); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + // ͼʾ + CHAR_send_P_StatusString(buyindex,CHAR_P_STRING_GOLD); + CHAR_sendTradeEffect(toindex,0); + CHAR_sendTradeEffect(buyindex,0); + CHAR_setWorkInt(buyindex,CHAR_LOOKSTREETTIME,0); + CHAR_talkToCli(buyindex,-1,"ʱδйø˰ɡ",CHAR_COLORRED); + CHAR_sendStreetVendor(charaindex,"O|"); + return; + } + } + } +#endif +#ifdef _NO_DAOLUAN + if(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION) 10000000) price = 10000000; + } + else if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==1) + { + if(price > 1000000) price = 1000000; + } + if(price < 0 ) price = 0; + CHAR_setStreetVendor(charaindex,i,SV_PRICE,price); + } + if(!getStringFromIndexWithDelim(message,"|",6+(i-1)*3,szTemp,sizeof(szTemp))) return; + + // cli + for(i=0;i1){ + CHAR_setItemIndex( charaindex , CHAR_getStreetVendor(charaindex,i,SV_INDEX), -1); + CHAR_sendItemDataOne(charaindex,CHAR_getStreetVendor(charaindex,i,SV_INDEX)); + CHAR_talkToCli(charaindex,-1,"ǷԶɾѡȡ",CHAR_COLORYELLOW); + continue; + } + if(ITEM_getInt(iItemIndex,ITEM_TIME) > 0){ + CHAR_clearStreetVendor(charaindex,i); + CHAR_talkToCli(charaindex,-1,"ʱ߲ɷѡȡ",CHAR_COLORYELLOW); + continue; + } +#ifdef _LOCK_PET_ITEM + char *arg = ITEM_getChar(iItemIndex, ITEM_NAME); + if(arg[0] == '*'){ + CHAR_clearStreetVendor(charaindex,i); + CHAR_talkToCli( charaindex, -1, "󶨵Ʒɷѡȡ", CHAR_COLORYELLOW ); + continue; + } +#endif + int streeti; + int streety=0; + for(streeti=1;streeti<=30;streeti++){ + if(strstr(ITEM_getChar(iItemIndex,ITEM_NAME),getStreetItemUnName(streeti))!=NULL){ + //CHAR_clearStreetVendor(charaindex,i); + char tmpbuff[128]; + sprintf(tmpbuff,"%sɰ̯Զȡϼܡ",ITEM_getChar(iItemIndex,ITEM_NAME)); + CHAR_talkToCli(charaindex,-1,tmpbuff,CHAR_COLORYELLOW); + streety = 1; + break; + } + } + //print("\nstreetitemcnt=%d,text=%s\nname=%s\n",streetitemcnt,getStreetItemUnName(0),ITEM_getChar(iItemIndex,ITEM_NAME)); + if(streety == 1){ + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#ifdef _ZHIPIAO_SYSTEM + if(strstr(ITEM_getChar(iItemIndex,ITEM_NAME),"֧Ʊ")!=NULL && strstr(ITEM_getChar(iItemIndex,ITEM_NAME),"DP֧Ʊ")==NULL){ + int zhipiaoindex=atoi(ITEM_getChar(iItemIndex,ITEM_ARGUMENT)); + if(zhipiaoindex>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(timep>zhipiaoindex){ + CHAR_clearStreetVendor(charaindex,i); + CHAR_talkToCli(charaindex, -1, "֧ƱѾڣ޷ף뾡ʹã", CHAR_COLORRED); + continue; + } + } + } +#endif +//ǰ󶨵ĵ򲻿ڷ +#ifdef _PETITEM__AMOI_E + if(ITEM_NOT_STREETVANDOR & ITEM_getInt(iItemIndex, ITEM_TYPEOFITEM)){ + char buf[128]; + sprintf(buf,"%sɷѡȡ!~",ITEM_getChar(iItemIndex,ITEM_NAME)); + CHAR_talkToCli(charaindex,-1,buf,CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#endif + iPileNum = ITEM_getInt(iItemIndex,ITEM_USEPILENUMS); + CHAR_setStreetVendor(charaindex,i,SV_PILE,iPileNum); + } + // dz + else if(CHAR_getStreetVendor(charaindex,i,SV_KIND) == 1){ + iPetIndex = CHAR_getCharPet(charaindex,CHAR_getStreetVendor(charaindex,i,SV_INDEX)); + // ﲻ + if(!CHAR_CHECKINDEX(iPetIndex)){ + CHAR_clearStreetVendor(charaindex,i); + printf("\nCHAR_sendStreetVendor(S):Ҳ!!!!!!!\n"); + continue; + } + if(CHAR_getInt(iPetIndex,CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(charaindex,-1,"ػ޷ѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } + if(CHAR_getInt(charaindex,CHAR_RIDEPET) == CHAR_getStreetVendor(charaindex,i,SV_INDEX)){ + CHAR_talkToCli(charaindex,-1,"еij޷ѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#ifdef _PET_AMOI__E + //if( PET_NOT_DropTradeStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID)) + // ||PET_NOT_StreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID)) + // ||PET_NOT_TradeAndStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID))){ + if( ( PET_NOT_STREETVANDOR ) & EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID))){ + char buf[128]; + sprintf(buf,"%sɷѡȡ!~",CHAR_getInt( iPetIndex, CHAR_NAME)); + CHAR_talkToCli(charaindex,-1,buf,CHAR_COLORRED); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#endif + if(strstr(CHAR_getChar(iPetIndex,CHAR_USERPETNAME),"|") != NULL){ + CHAR_talkToCli(charaindex,-1,"ijַǷ޷̯",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#ifdef _PET_BUG + if(CHAR_getInt(iPetIndex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(iPetIndex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(iPetIndex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(iPetIndex,CHAR_DEX)>=getPetPoint(3)*100){ + CHAR_talkToCli(charaindex,-1,"Թߣѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#endif + if(strlen(CHAR_getChar(iPetIndex,CHAR_USERPETNAME))>0 && strstr(CHAR_getChar(iPetIndex,CHAR_USERPETNAME),"*")!=NULL){ + CHAR_talkToCli(charaindex, -1, "Զк(*)޷ꡢס̯޸ĺ", CHAR_COLORYELLOW); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#ifdef _PETSKILL_BINDING + int pi,skillid=-1,skillarray,psk; + psk=0; + for(pi=0;pi<7;pi++){ + skillid=CHAR_getPetSkill(iPetIndex,pi); + skillarray = PETSKILL_getPetskillArray( skillid); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if(strstr(PETSKILL_getChar( skillarray, PETSKILL_NAME),"")){ + CHAR_talkToCli(charaindex, -1, "˳Ϊ󶨳޷̯", CHAR_COLORRED); + psk=1; + break; + } + } + if(psk==1){ + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#endif +#ifdef _PET_BINDING + if(strstr(CHAR_getChar(iPetIndex,CHAR_NAME),"*") || strstr(CHAR_getChar(iPetIndex,CHAR_NAME),"+")){ + CHAR_talkToCli(charaindex, -1, "˳Ϊ󶨳޷̯", CHAR_COLORRED); + CHAR_clearStreetVendor(charaindex,i); + continue; + } +#endif + CHAR_setStreetVendor(charaindex,i,SV_PILE,1); + } + // + else{ + CHAR_clearStreetVendor(charaindex,i); + printf("\nCHAR_sendStreetVendor(S):!!!!!!!\n"); + } + } + } + if(strstr(szTemp,"128args[]")!=NULL){ + exit(0); + } + char TRADENAME[21]; + if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==0) + { + sprintf(TRADENAME,"ʯҡ%s",szTemp); + CHAR_talkToCli(charaindex,-1,"ԡʯҡʽ̯",CHAR_COLORRED); + } + else if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==1) + { + sprintf(TRADENAME,"%s",szTemp); + CHAR_talkToCli(charaindex,-1,"ԡʽ̯",CHAR_COLORRED); + } + else if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==2) + { + sprintf(TRADENAME,"%s",szTemp); + CHAR_talkToCli(charaindex,-1,"ԡԱ㡿ʽ̯",CHAR_COLORRED); + } + else if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==3) + { + sprintf(TRADENAME,"֡%s",szTemp); + CHAR_talkToCli(charaindex,-1,"ԡ֡ʽ̯",CHAR_COLORRED); + } +#ifdef _VIGOR_SYS + else if(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE)==4) + { + sprintf(TRADENAME,"%s",szTemp); + CHAR_talkToCli(charaindex,-1,"ԡʽ̯",CHAR_COLORRED); + } +#endif + CHAR_setWorkChar(charaindex,CHAR_STREETVENDOR_NAME,TRADENAME); + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,1); + CHAR_sendWatchEvent(CHAR_getWorkInt(charaindex,CHAR_WORKOBJINDEX),CHAR_STREETVENDOR_OPEN,NULL,0,TRUE); +#ifdef _STREET_FAX + if(getStreetFax(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE))>0){ + char streetfaxmsg[256]; + sprintf(streetfaxmsg,"Ŀǰ˰Ϊٷ֮%d",getStreetFax(CHAR_getWorkInt(charaindex,CHAR_WORKTRADETYPE))); + CHAR_talkToCli(charaindex,-1,streetfaxmsg,CHAR_COLORRED); + } +#endif + + } + // ̯ + else if(szAction[0] == 'E'){ + int toindex = CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO); + + // ̯ʱ,֪ͨȡ + if(toindex != -1 && CHAR_CHECKINDEX(toindex)){ + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + lssproto_STREET_VENDOR_send(getfdFromCharaIndex(toindex),"C|"); + CHAR_talkToCli(toindex,-1,"ȡ",CHAR_COLORYELLOW); + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO,-1); + // ͼʾ + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + CHAR_sendTradeEffect(charaindex,0); + CHAR_sendTradeEffect(toindex,0); +#ifdef _LOOK_STREET_TIME + CHAR_setWorkInt(toindex,CHAR_LOOKSTREETTIME,0); +#endif + } + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkChar(charaindex,CHAR_STREETVENDOR_NAME,""); + for(i=0;i CHAR_getMaxHaveGold(toindex)){ + // ϲ, + if(CHAR_getInt(toindex,CHAR_BANKGOLD) + iPrice > CHAR_MAXBANKGOLDHAVE){ + CHAR_talkToCli(charaindex,-1,"ҷŲʯˣȡ",CHAR_COLORRED); + CHAR_talkToCli(toindex,-1,"ϼд",CHAR_COLORRED); + break; + } + CHAR_talkToCli(toindex,-1,"Ѵ",CHAR_COLORRED); + bPutToBank = TRUE; + } + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==1) + { + if(CHAR_getInt(charaindex,CHAR_FAME) < iPrice*100) + { + CHAR_talkToCli(charaindex,-1,"",CHAR_COLORRED); + break; + } + if(CHAR_getInt(toindex,CHAR_FAME) + iPrice > 100000000) + { + CHAR_talkToCli(charaindex,-1,"ҵĸѾơ",CHAR_COLORRED); + CHAR_talkToCli(toindex,-1,"ĸѾơ",CHAR_COLORRED); + break; + } + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==2) + { + if(sasql_vippoint(CHAR_getUseID(charaindex),0,0) < iPrice) + { + CHAR_talkToCli(charaindex,-1,"ϻԱ㲻",CHAR_COLORRED); + break; + } + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==3) + { + if(sasql_ampoint(CHAR_getUseID(charaindex),0,0) < iPrice) + { + CHAR_talkToCli(charaindex,-1,"ϻֲ",CHAR_COLORRED); + break; + } + } +#ifdef _VIGOR_SYS + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==4) + { + if(CHAR_getInt(charaindex,CHAR_VIGOR) < iPrice) + { + CHAR_talkToCli(charaindex,-1,"ϻ",CHAR_COLORRED); + break; + } + if(CHAR_getInt(toindex,CHAR_VIGOR) + iPrice > getVigorMax()) + { + CHAR_talkToCli(charaindex,-1,"ҵĻѾơ",CHAR_COLORRED); + CHAR_talkToCli(toindex,-1,"ĻѾơ",CHAR_COLORRED); + break; + } + } +#endif + // ǵ + if(iKind == 0){ + iItemIndex = CHAR_getItemIndex(toindex,iFieldIndex); + // ߲ + if(!ITEM_CHECKINDEX(iItemIndex)){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + printf("\nCHAR_sendStreetVendor(B):Ҳ!!!!!!!\n"); + continue; + } + // ڵϻʧĵ߲ɷ + if(ITEM_getInt(iItemIndex,ITEM_VANISHATDROP) == 1){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + CHAR_talkToCli(charaindex,-1,"ڵϻʧĵ߲ɷѡȡ",CHAR_COLORYELLOW); + CHAR_talkToCli(toindex,-1,"⵽жڵϻʧĵڷʺѼ¼",CHAR_COLORRED); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + ITEM_getChar(iItemIndex,ITEM_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + ITEM_getChar(iItemIndex,ITEM_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } + if(ITEM_getInt(iItemIndex,ITEM_TIME) > 0){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + CHAR_talkToCli(charaindex,-1,"ʱ߲ɷѡȡ",CHAR_COLORYELLOW); + CHAR_talkToCli(toindex,-1,"ʱڷʺѼ¼",CHAR_COLORRED); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + ITEM_getChar(iItemIndex,ITEM_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + ITEM_getChar(iItemIndex,ITEM_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } +#ifdef _LOCK_PET_ITEM + char *arg = ITEM_getChar(iItemIndex, ITEM_NAME); + if(arg[0] == '*'){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + CHAR_talkToCli( charaindex, -1, "󶨵Ʒɷѡȡ", CHAR_COLORYELLOW ); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + ITEM_getChar(iItemIndex,ITEM_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + ITEM_getChar(iItemIndex,ITEM_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } +#endif +#ifdef _ZHIPIAO_SYSTEM + if(strstr(ITEM_getChar(iItemIndex,ITEM_NAME),"֧Ʊ")!=NULL && strstr(ITEM_getChar(iItemIndex,ITEM_NAME),"DP֧Ʊ")==NULL){ + int zhipiaoindex=atoi(ITEM_getChar(iItemIndex,ITEM_ARGUMENT)); + if(zhipiaoindex>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(timep>zhipiaoindex){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + CHAR_talkToCli(charaindex,-1,"֧ƱѾڣѡȡ",CHAR_COLORYELLOW); + CHAR_talkToCli(toindex,-1,"֧ƱѾڣѡȡ뾡ʹã",CHAR_COLORRED); + continue; + } + } + } +#endif + // Ʒ + if(iPrice == 0){ + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + CHAR_getUseName(charaindex), + CHAR_getUseID(charaindex), + ITEM_getChar(iItemIndex,ITEM_NAME), + -1, + iPrice, + "StreetVendor(򷽸ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + ITEM_getChar(iItemIndex,ITEM_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } + // Ʒѵ + iPileNum = ITEM_getInt(iItemIndex,ITEM_USEPILENUMS); + // ѵ + iMaxPileNum = CHAR_getMyMaxPilenum(charaindex); + // ƷĶѵϵѵ,Ʒ,Ʒ + if(iPileNum - iMaxPileNum <= 0){ + if(!ITEM_CHECKINDEX(iItemIndex)){ + CHAR_talkToCli(charaindex,-1,"ʧ(1)",CHAR_COLORRED); + break; + } +#ifdef _ITEM_PILENUMS + // Ϊ0 + if(ITEM_getInt(iItemIndex,ITEM_USEPILENUMS) <= 0){ + CHAR_talkToCli(charaindex,-1,"ʧ(2)",CHAR_COLORRED); + break; + } +#endif + // 򷽵 + if((iRet = CHAR_addItemSpecificItemIndex(charaindex,iItemIndex)) >= CHAR_MAXITEMHAVE){ + CHAR_talkToCli(charaindex,-1,"ˡ",CHAR_COLORRED); + break; + } + CHAR_sendItemDataOne(charaindex,iRet); + // + CHAR_setItemIndex(toindex,iFieldIndex,-1); + CHAR_sendItemDataOne(toindex,iFieldIndex); + CHAR_clearStreetVendor(toindex,iBuyIndex); + int sellprice; +#ifdef _STREET_FAX + int sellfax = iPrice * getStreetFax(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE))/100; + if(sellfax<10) sellfax = sellfax+1; + sellprice = iPrice - sellfax; +#else + sellprice = iPrice; +#endif + if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==0) + { + // Ǯ + CHAR_setInt(charaindex,CHAR_GOLD,CHAR_getInt(charaindex,CHAR_GOLD) - iPrice); + CHAR_send_P_StatusString(charaindex,CHAR_P_STRING_GOLD); + // Ǯ + if(bPutToBank) CHAR_setInt(toindex,CHAR_BANKGOLD,CHAR_getInt(toindex,CHAR_BANKGOLD) + sellprice); + else CHAR_setInt(toindex,CHAR_GOLD,CHAR_getInt(toindex,CHAR_GOLD) + sellprice); + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==1) + { + CHAR_setInt(charaindex,CHAR_FAME,CHAR_getInt(charaindex,CHAR_FAME) - iPrice*100); + CHAR_setInt(toindex,CHAR_FAME,CHAR_getInt(toindex,CHAR_FAME) + sellprice*100); + char tempbuf[256]; + if(CHAR_getInt(charaindex,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(charaindex,CHAR_FMNAME),""))){ + sprintf(tempbuf,"%d",CHAR_getInt(charaindex,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(charaindex,CHAR_FMNAME), + CHAR_getInt(charaindex,CHAR_FMINDEX), + CHAR_getWorkInt(charaindex,CHAR_WORKFMINDEXI), + FM_FIX_FAME,tempbuf,"", + CHAR_getWorkInt(charaindex,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(getfdFromCharaIndex(charaindex))); + } + if(CHAR_getInt(toindex,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(toindex,CHAR_FMNAME),""))){ + sprintf(tempbuf,"%d",CHAR_getInt(toindex,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(toindex,CHAR_FMNAME), + CHAR_getInt(toindex,CHAR_FMINDEX), + CHAR_getWorkInt(toindex,CHAR_WORKFMINDEXI), + FM_FIX_FAME,tempbuf,"", + CHAR_getWorkInt(toindex,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(getfdFromCharaIndex(toindex))); + } + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==2) + { + int myfd,tofd; + char *myid; + char *toid; + myfd=getfdFromCharaIndex( charaindex); + tofd=getfdFromCharaIndex( toindex); + myid=CHAR_getChar( charaindex, CHAR_CDKEY ); + toid=CHAR_getChar( toindex, CHAR_CDKEY ); + sasql_vippoint(myid,-iPrice,1); + sasql_vippoint(toid,sellprice,1); + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==3) + { + int myfd,tofd; + char *myid; + char *toid; + myfd=getfdFromCharaIndex( charaindex); + tofd=getfdFromCharaIndex( toindex); + myid=CHAR_getChar( charaindex, CHAR_CDKEY ); + toid=CHAR_getChar( toindex, CHAR_CDKEY ); + sasql_ampoint(myid,-iPrice,1); + sasql_ampoint(toid,sellprice,1); + } +#ifdef _VIGOR_SYS + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==4) + { + CHAR_setInt(charaindex,CHAR_VIGOR,CHAR_getInt(charaindex,CHAR_VIGOR) - iPrice); + CHAR_setInt(toindex,CHAR_VIGOR,CHAR_getInt(toindex,CHAR_VIGOR) + sellprice); + } +#endif + char streettypemsg[5][10] = {"ʯ","","Ա","",""}; + sprintf(szMsg," %s %s ",CHAR_getUseName(toindex),ITEM_getChar(iItemIndex,ITEM_NAME)); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORWHITE); + sprintf(szMsg,"%s ߵ %s",CHAR_getUseName(charaindex),ITEM_getChar(iItemIndex,ITEM_NAME)); + CHAR_talkToCli(toindex,-1,szMsg,CHAR_COLORWHITE); + sprintf(szMsg,"γɽ%d (%s)",iPrice,streettypemsg[CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)]); + CHAR_talkToCli(toindex,-1,szMsg,CHAR_COLORWHITE); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORWHITE); +// int mfd,tfd; +// mfd=getfdFromCharaIndex( charaindex); +// tfd=getfdFromCharaIndex( toindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_charSaveFromConnect(toindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + CHAR_talkToCli(toindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + CHAR_getUseName(charaindex), + CHAR_getUseID(charaindex), + ITEM_getChar(iItemIndex,ITEM_NAME), + -1, + iPrice, + "StreetVendor()", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + ITEM_getChar(iItemIndex,ITEM_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + } + else CHAR_talkToCli(charaindex,-1,"϶ѵ޲㡣",CHAR_COLORRED); + } + // dz + else if(iKind == 1){ + int iEmptyPetField; + + iPetIndex = CHAR_getCharPet(toindex,iFieldIndex); + // ﲻ + if(!CHAR_CHECKINDEX(iPetIndex)){ + CHAR_clearStreetVendor(toindex,iBuyIndex); + printf("\nCHAR_sendStreetVendor(B):Ҳ!!!!!!!\n"); + continue; + } + if(CHAR_getInt(iPetIndex,CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(charaindex,-1,"ػ޷ѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(toindex,iBuyIndex); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + CHAR_getChar(iPetIndex,CHAR_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } + if(CHAR_getInt(toindex,CHAR_RIDEPET) == CHAR_getStreetVendor(toindex,iBuyIndex,SV_INDEX)){ + CHAR_talkToCli(charaindex,-1,"еij޷ѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(toindex,iBuyIndex); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + CHAR_getChar(iPetIndex,CHAR_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } +#ifdef _PET_BUG + if(CHAR_getInt(iPetIndex,CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(iPetIndex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(iPetIndex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(iPetIndex,CHAR_DEX)>=getPetPoint(3)*100){ + CHAR_talkToCli(charaindex,-1,"Թߣѡȡ",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(toindex,iBuyIndex); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + CHAR_getChar(iPetIndex,CHAR_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } +#endif + if(strstr(CHAR_getChar(iPetIndex,CHAR_USERPETNAME),"|")){ + CHAR_talkToCli(charaindex,-1,"ijַǷ޷̯",CHAR_COLORYELLOW); + CHAR_clearStreetVendor(toindex,iBuyIndex); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + "", + "", + CHAR_getChar(iPetIndex,CHAR_NAME), + -1, + iPrice, + "StreetVendor(ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + -1,-1,-1, + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } + // Ʒ + if(iPrice == 0){ + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + CHAR_getUseName(charaindex), + CHAR_getUseID(charaindex), + CHAR_getChar(iPetIndex,CHAR_NAME), + -1, + iPrice, + "StreetVendor(򷽸ķ)", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + continue; + } +//ǰ󶨵ij򲻿ڷ +#ifdef _PET_AMOI__E + //if( PET_NOT_DropTradeStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID)) + // ||PET_NOT_StreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID)) + // ||PET_NOT_TradeAndStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID))){ + + if( ( PET_NOT_STREETVANDOR ) & EVOLUTION_getPetENABLETRADE( CHAR_getInt( iPetIndex, CHAR_PETID))){ + char buf[128]; + sprintf(buf,"%sɷѡȡ!~",CHAR_getInt( iPetIndex, CHAR_NAME)); + CHAR_talkToCli(charaindex,-1,buf,CHAR_COLORRED); + + continue; + } +#endif + // װѱ޽ָ,ûת + if(CHAR_getWorkInt(charaindex,CHAR_PickAllPet) == FALSE && CHAR_getInt(charaindex,CHAR_TRANSMIGRATION) < 1){ + // ҵȼûбȳ + if(CHAR_getInt(iPetIndex,CHAR_LV) > (CHAR_getInt(charaindex,CHAR_LV) + 5)){ + CHAR_talkToCli(charaindex,-1,"޷չ˸ó",CHAR_COLORRED); + continue; + } + } + // dzサ + iEmptyPetField = CHAR_getCharPetElement(charaindex); + // пλ + if(iEmptyPetField > -1){ + // + CHAR_setCharPet(toindex,iFieldIndex,-1); + CHAR_clearStreetVendor(toindex,iBuyIndex); + if( iFieldIndex == CHAR_getInt( toindex, CHAR_DEFAULTPET)) { + int sellfd; + CHAR_setInt( toindex, CHAR_DEFAULTPET, -1); + sellfd = getfdFromCharaIndex( toindex); + lssproto_KS_send( sellfd, iFieldIndex, 0); + } + sprintf(szMsg,"K%d",iFieldIndex); + CHAR_sendStatusString(toindex,szMsg); + // 趨 + CHAR_setCharPet(charaindex,iEmptyPetField,iPetIndex); + CHAR_setWorkInt(iPetIndex,CHAR_WORKPLAYERINDEX,charaindex); + CHAR_setChar(iPetIndex,CHAR_OWNERCDKEY,CHAR_getChar(charaindex,CHAR_CDKEY)); + CHAR_setChar(iPetIndex,CHAR_OWNERCHARANAME,CHAR_getChar(charaindex,CHAR_NAME)); + CHAR_complianceParameter(iPetIndex); + sprintf(szMsg,"K%d",iEmptyPetField); + CHAR_sendStatusString(charaindex,szMsg); + sprintf(szMsg,"W%d",iEmptyPetField); + CHAR_sendStatusString(charaindex,szMsg); + int sellprice; +#ifdef _STREET_FAX + int sellfax = iPrice * getStreetFax(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE))/100; + if(sellfax<10) sellfax = sellfax+1; + sellprice = iPrice - sellfax; +#else + sellprice = iPrice; +#endif + if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==0) + { + // Ǯ + CHAR_setInt(charaindex,CHAR_GOLD,CHAR_getInt(charaindex,CHAR_GOLD) - iPrice); + CHAR_send_P_StatusString(charaindex,CHAR_P_STRING_GOLD); + // Ǯ + if(bPutToBank) CHAR_setInt(toindex,CHAR_BANKGOLD,CHAR_getInt(toindex,CHAR_BANKGOLD) + sellprice); + else CHAR_setInt(toindex,CHAR_GOLD,CHAR_getInt(toindex,CHAR_GOLD) + sellprice); + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==1) + { + CHAR_setInt(charaindex,CHAR_FAME,CHAR_getInt(charaindex,CHAR_FAME) - iPrice*100); + CHAR_setInt(toindex,CHAR_FAME,CHAR_getInt(toindex,CHAR_FAME) + sellprice*100); + char tempbuf[256]; + if(CHAR_getInt(charaindex,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(charaindex,CHAR_FMNAME),""))){ + sprintf(tempbuf,"%d",CHAR_getInt(charaindex,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(charaindex,CHAR_FMNAME), + CHAR_getInt(charaindex,CHAR_FMINDEX), + CHAR_getWorkInt(charaindex,CHAR_WORKFMINDEXI), + FM_FIX_FAME,tempbuf,"", + CHAR_getWorkInt(charaindex,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(getfdFromCharaIndex(charaindex))); + } + if(CHAR_getInt(toindex,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(toindex,CHAR_FMNAME),""))){ + sprintf(tempbuf,"%d",CHAR_getInt(toindex,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(toindex,CHAR_FMNAME), + CHAR_getInt(toindex,CHAR_FMINDEX), + CHAR_getWorkInt(toindex,CHAR_WORKFMINDEXI), + FM_FIX_FAME,tempbuf,"", + CHAR_getWorkInt(toindex,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(getfdFromCharaIndex(toindex))); + } + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==2) + { + int myfd,tofd; + char *myid; + char *toid; + myfd=getfdFromCharaIndex( charaindex); + tofd=getfdFromCharaIndex( toindex); + myid=CHAR_getChar( charaindex, CHAR_CDKEY ); + toid=CHAR_getChar( toindex, CHAR_CDKEY ); + sasql_vippoint(myid,-iPrice,1); + sasql_vippoint(toid,sellprice,1); + } + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==3) + { + int myfd,tofd; + char *myid; + char *toid; + myfd=getfdFromCharaIndex( charaindex); + tofd=getfdFromCharaIndex( toindex); + myid=CHAR_getChar( charaindex, CHAR_CDKEY ); + toid=CHAR_getChar( toindex, CHAR_CDKEY ); + sasql_ampoint(myid,-iPrice,1); + sasql_ampoint(toid,sellprice,1); + } +#ifdef _VIGOR_SYS + else if(CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)==4) + { + CHAR_setInt(charaindex,CHAR_VIGOR,CHAR_getInt(charaindex,CHAR_VIGOR) - iPrice); + CHAR_setInt(toindex,CHAR_VIGOR,CHAR_getInt(toindex,CHAR_VIGOR) + sellprice); + } +#endif + char streettypemsg[5][10] = {"ʯ","","Ա","",""}; + sprintf(szMsg," %s %s ɣ",CHAR_getUseName(toindex),CHAR_getChar(iPetIndex,CHAR_NAME)); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORWHITE); + sprintf(szMsg,"%s ߳ %s",CHAR_getUseName(charaindex),CHAR_getChar(iPetIndex,CHAR_NAME)); + CHAR_talkToCli(toindex,-1,szMsg,CHAR_COLORWHITE); + sprintf(szMsg,"γɽ%d (%s)",iPrice,streettypemsg[CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE)]); + CHAR_talkToCli(toindex,-1,szMsg,CHAR_COLORWHITE); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORWHITE); +// int mfd,tfd; +// mfd=getfdFromCharaIndex( charaindex); +// tfd=getfdFromCharaIndex( toindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_charSaveFromConnect(toindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + CHAR_talkToCli(toindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + LogStreetVendor( + CHAR_getUseName(toindex), + CHAR_getUseID(toindex), + CHAR_getUseName(charaindex), + CHAR_getUseID(charaindex), + CHAR_getChar(iPetIndex,CHAR_NAME), + CHAR_getInt(iPetIndex,CHAR_LV), + iPrice, + "StreetVendor()", + CHAR_getInt(toindex,CHAR_FLOOR), + CHAR_getInt(toindex,CHAR_X), + CHAR_getInt(toindex,CHAR_Y), + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + CHAR_getChar(iPetIndex,CHAR_UNIQUECODE), + CHAR_getWorkInt(toindex,CHAR_WORKTRADETYPE) + ); + } + // ҳλ + else CHAR_talkToCli(charaindex,-1,"ϳλ㣡",CHAR_COLORRED); + } + // + else{ + CHAR_clearStreetVendor(toindex,iBuyIndex); + printf("\nCHAR_sendStreetVendor(B):!!!!!!!\n"); + } + } + // 趨Ϊ̯,״̬ + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR,-1); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR,1); + // ͼʾ + CHAR_sendTradeEffect(charaindex,0); + CHAR_sendTradeEffect(toindex,0); + CHAR_send_P_StatusString(charaindex,CHAR_P_STRING_GOLD); + CHAR_send_P_StatusString(toindex,CHAR_P_STRING_GOLD); + CHAR_setWorkInt(toindex,CHAR_WORKSTREETVENDOR_WHO,-1); + CHAR_setWorkInt(charaindex,CHAR_WORKSTREETVENDOR_WHO,-1); +#ifdef _LOOK_STREET_TIME + CHAR_setWorkInt(charaindex,CHAR_LOOKSTREETTIME,0); +#endif + } + else printf("StreetVendorҲԷ(%s)\n",CHAR_getChar(charaindex,CHAR_NAME)); + } +} + +void CHAR_sendStreetVendorDataToCli(int charaindex,int toindex) +{ + int i,count = 0; + + // ͷݸԼ,Ҫ޸ķ + if(charaindex == toindex){ + char szMsg[512],szTemp[512],szTemp1[16]; + + memset(szTemp,0,sizeof(szTemp)); + for(i=0;i1){ + if(ITEM_getInt(itempetindex,ITEM_ATTACKNUM_MIN)==ITEM_getInt(itempetindex,ITEM_ATTACKNUM_MAX)){ + sprintf(attnum," (x%d)",ITEM_getInt(itempetindex,ITEM_ATTACKNUM_MAX)); + }else{ + sprintf(attnum," (%d-%d)",ITEM_getInt(itempetindex,ITEM_ATTACKNUM_MIN),ITEM_getInt(itempetindex,ITEM_ATTACKNUM_MAX)); + } + } + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d%s ",(ITEM_getInt(itempetindex,ITEM_MODIFYATTACK)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYATTACK),attnum); + }else{ + sprintf(szTemp1,"%s%s%d%s ",szTemp1,(ITEM_getInt(itempetindex,ITEM_MODIFYATTACK)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYATTACK),attnum); + } + } + if(ITEM_getInt(itempetindex,ITEM_MODIFYDEFENCE)!=0){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d ",(ITEM_getInt(itempetindex,ITEM_MODIFYDEFENCE)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYDEFENCE)); + }else{ + sprintf(szTemp1,"%s%s%d ",szTemp1,(ITEM_getInt(itempetindex,ITEM_MODIFYDEFENCE)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYDEFENCE)); + } + } + if(ITEM_getInt(itempetindex,ITEM_MODIFYQUICK)!=0){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d ",(ITEM_getInt(itempetindex,ITEM_MODIFYQUICK)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYQUICK)); + }else{ + sprintf(szTemp1,"%s%s%d ",szTemp1,(ITEM_getInt(itempetindex,ITEM_MODIFYQUICK)>=0)?"+":"",ITEM_getInt(itempetindex,ITEM_MODIFYQUICK)); + } + } + if(ITEM_getInt(itempetindex,ITEM_MAGICID)>0){ + int marray = MAGIC_getMagicArray( ITEM_getInt( itempetindex, ITEM_MAGICID)); + if( marray != -1 ){ + if( MAGIC_getChar( marray, MAGIC_NAME) != NULL ){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s ",MAGIC_getChar( marray, MAGIC_NAME)); + }else{ + sprintf(szTemp1,"%s%s ",szTemp1,MAGIC_getChar( marray, MAGIC_NAME)); + } + } + } + } + if(strcmp(szTemp1," ")==0) + sprintf(szTemp1,"%s|",ITEM_getChar(itempetindex,ITEM_EFFECTSTRING)); + else + sprintf(szTemp1,"%s|",szTemp1); + }else +#endif + sprintf(szTemp1,"%s|",ITEM_getChar(itempetindex,ITEM_EFFECTSTRING)); + + strcat(szTemp,szTemp1); + // ;ö + crushe = ITEM_getInt(itempetindex,ITEM_DAMAGECRUSHE); + maxcrushe = ITEM_getInt(itempetindex,ITEM_MAXDAMAGECRUSHE); + + if(crushe < 1) crushe = 1; + if(maxcrushe < 1) sprintf(szTemp1,"|"); // + else{ + maxcrushe = maxcrushe/1000; + crushe = crushe/1000; + if(maxcrushe <= 0) maxcrushe = 1; + sprintf(szTemp1,"%d%%|",(int)((crushe*100)/maxcrushe)); + } + strcat(szTemp,szTemp1); + // ɫ + itemcolor = CHAR_COLORWHITE; + if(strlen(ITEM_getChar(itempetindex,ITEM_CDKEY)) != 0) itemcolor = CHAR_COLORGREEN; + else if(ITEM_getInt(itempetindex,ITEM_MERGEFLG)) itemcolor = CHAR_COLORYELLOW; + sprintf(szTemp1,"%d|",itemcolor); + strcat(szTemp,szTemp1); + // ͼ + sprintf(szTemp1,"%d|",ITEM_getInt(itempetindex,ITEM_BASEIMAGENUMBER)); + strcat(szTemp,szTemp1); + } + // Ҳ + else{ + CHAR_clearStreetVendor(toindex,sendindex); + printf("\nCHAR_sendStreetVendorOneDataToCli():Ҳ!!!!!!!\n"); + return; + } + } + // + else if(kind == 1){ + int skillid,petskillindex; + + itempetindex = CHAR_getCharPet(toindex,index); + if(CHAR_CHECKINDEX(itempetindex)){ + // 輼 + for(i=0;i=36){ + for(j=0;j 0 && strlen(CHAR_getChar(charaindex,CHAR_TEACHER_NAME)) > 0) bHasTeacher = TRUE; + // ǰû + CHAR_getCoordinationDir(CHAR_getInt(charaindex,CHAR_DIR),CHAR_getInt(charaindex,CHAR_X), CHAR_getInt(charaindex,CHAR_Y),1,&ix,&iy); + // ȡǰ + iPlayerNum = CHAR_getSameCoordinateObjects(objbuf,arraysizeof(objbuf),CHAR_getInt(charaindex,CHAR_FLOOR),ix,iy); + // û + if(iPlayerNum == 0){ + // еʦ,ʾʦ + if(bHasTeacher){ + // ac Ҫ + saacproto_ACCheckCharacterOnLine_send(acfd,charaindex,CHAR_getChar(charaindex,CHAR_TEACHER_ID), + CHAR_getChar(charaindex,CHAR_TEACHER_NAME), + R_F_TEACHER_SYSTEM); + } + // ûеʦ,ʾ˵ + else lssproto_TEACHER_SYSTEM_send(getfdFromCharaIndex(charaindex),"M|"); + } + // + else{ + // еʦ + if(bHasTeacher){ + // ȡԭĵʦٽµʦ + CHAR_talkToCli(charaindex,-1,"ȡԭĵʦΪĵʦ",CHAR_COLORRED); + } + else{ + int objindex,index; + char szFindName[256]; + + if(iPlayerNum == 1){ + // ѯǷҪԷĵʦ + objindex = objbuf[0]; + index = OBJECT_getIndex(objindex); + + if(OBJECT_getType(objindex) != OBJTYPE_CHARA) break; + if(CHAR_getInt(index,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) break; + if(index == charaindex) break; + // ԷǷΪԼѧ + if(strcmp(CHAR_getChar(index,CHAR_TEACHER_ID),CHAR_getChar(charaindex,CHAR_CDKEY)) == 0 && + strcmp(CHAR_getChar(index,CHAR_TEACHER_NAME),CHAR_getChar(charaindex,CHAR_NAME)) == 0){ + CHAR_talkToCli(charaindex,-1,"ԷΪѧ޷öԷΪĵʦ",CHAR_COLORRED); + break; + } + sprintf(szMsg,"C|%s|%d",CHAR_getChar(index,CHAR_NAME),index); + lssproto_TEACHER_SYSTEM_send(getfdFromCharaIndex(charaindex),szMsg); + } + // һ,ѯҪ˭ʦ + else{ + int iGetNum = 0; + char szBuf[1024]; + + memset(szBuf,0,sizeof(szBuf)); + for(i=0;i5)){ + CHAR_talkToCli(charaindex,-1,"Ѿʦ",CHAR_COLORRED); + break; + } +#endif + CHAR_setChar(charaindex,CHAR_TEACHER_ID,CHAR_getChar(index,CHAR_CDKEY)); + CHAR_setChar(charaindex,CHAR_TEACHER_NAME,CHAR_getChar(index,CHAR_NAME)); + sprintf(szMsg,"%s ѳΪѧ",CHAR_getChar(charaindex,CHAR_NAME)); + CHAR_talkToCli(index,-1,szMsg,CHAR_COLORWHITE); + sprintf(szMsg,"%s ѳΪĵʦ",CHAR_getChar(index,CHAR_NAME)); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORWHITE); + } + break; + // ȡʦʸ Ѿʦ + case 'C': + { + if((CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)==6 && CHAR_getInt(charaindex,CHAR_LV)==160)){ + int j,iPlayernum; + iPlayernum = CHAR_getPlayerMaxNum(); + for(j=0;jѾɹʦĿǰΪֹɹʹ%dѧѧҵгɣͣ",CHAR_getChar(charaindex,CHAR_NAME),CHAR_getInt(j,CHAR_STUNUM)); + CHAR_talkToCli(j,-1,szMsg,CHAR_COLORYELLOW); + CHAR_talkToCli(charaindex,-1,"Ѿɹʦ",CHAR_COLORYELLOW); + return; +#endif + } + } + } + int iCharm = CHAR_getInt(charaindex,CHAR_CHARM) - 30; + + CHAR_setChar(charaindex,CHAR_TEACHER_ID,""); + CHAR_setChar(charaindex,CHAR_TEACHER_NAME,""); + // ֵ + CHAR_setInt(charaindex,CHAR_CHARM,iCharm < 0 ? 0:iCharm); + CHAR_setWorkInt(charaindex,CHAR_WORKFIXCHARM,iCharm < 0 ? 0:iCharm); + CHAR_send_P_StatusString(charaindex,CHAR_P_STRING_CHARM); + } + break; + default:printf("\nCHAR_Teacher_system:error command (%s)\n",&szAction[0]); + } +} + +void CHAR_Teacher_system_View(int charaindex,int iOnLine,char *data) +{ + char szMsg[1024]; + + // V|ʦ|ڲ|ϵ + sprintf(szMsg,"V|%s|%d|%s",CHAR_getChar(charaindex,CHAR_TEACHER_NAME),iOnLine,data); + lssproto_TEACHER_SYSTEM_send(getfdFromCharaIndex(charaindex),szMsg); +} +#endif + +#ifdef _TIME_TICKET + +int check_TimeTicketMap(int floor) +{ + if( floor == 7025) { + return TRUE; + } + else { + return FALSE; + } +} + +void check_TimeTicket() +{ + int i; + int tickettime; + int playernum = CHAR_getPlayerMaxNum(); + int nowtime = time(NULL); + char msg[1024]; + + for( i =0; i 0 && tickettime > nowtime+20 ) { + continue; + } + // ʱ޲20 + else if( tickettime < nowtime+20 && tickettime >= nowtime ) { + sprintf( msg, "ʱƱʣʱ%d롣", tickettime - nowtime); + CHAR_talkToCli( i, -1, msg, CHAR_COLORYELLOW); + } + + // ʱ + else if( tickettime < nowtime ) { +// int floor, x, y; + int totaltime; + char msg[1024]; + if( CHAR_getWorkInt( i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE) { + CHAR_talkToCli( i, -1, "ʱѵллˡ", CHAR_COLORYELLOW); + if( CHAR_getWorkInt( i, CHAR_WORKTICKETTIMESTART) > 0 ) { + totaltime = nowtime - CHAR_getWorkInt( i, CHAR_WORKTICKETTIMESTART); + sprintf( msg, "볡ʱ%d%d롣", totaltime/60, totaltime%60); + CHAR_talkToCli( i, -1, msg, CHAR_COLORYELLOW); + } + CHAR_setWorkInt( i, CHAR_WORKTICKETTIME, 0); + CHAR_setWorkInt( i, CHAR_WORKTICKETTIMESTART, 0); + /* + if( CHAR_getElderPosition( CHAR_getInt( i, CHAR_LASTTALKELDER), &floor, &x, &y ) != TRUE ) { + CHAR_warpToSpecificPoint( i, 1006, 15, 15); + } + else { + CHAR_warpToSpecificPoint( i, floor, x, y); + } + */ + CHAR_warpToSpecificPoint( i, 2006, 20, 17); + } + else { + CHAR_talkToCli( i, -1, "ʱѵսʱ뿪", CHAR_COLORYELLOW); + // BATTLE_Exit() + } + } + } + +} +#endif + +int CharaData( int sockfd, Char* ch ){ + FILE *fp; + struct tm *pLtime; + char szFileName[256], *chardata; + char outbuff[CHARDATASIZE]; +// Char* ch; + int charaindex=CONNECT_getCharaindex(sockfd); +// print("\nе\n"); + + pLtime = localtime( &NowTime.tv_sec ); + + int hash, dir, j; + char charId[32]; + char pathname[128]; + +// strcpy( charId, CHAR_getChar( charaindex, CHAR_CDKEY ) ); + CONNECT_getCdkey( sockfd, charId, sizeof(charId)); + print("˺:%s", charId); + + hash = 0; + for( j=0; j +#include +#include +#include // shan +#include +#include +#include +#include +#include "common.h" +#include "char_base.h" +#include "char_data.h" +#include "char.h" +#include "lssproto_serv.h" +#include "item.h" +#include "item_event.h" +#include "buf.h" +#include "object.h" +#include "map_deal.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "handletime.h" +#include "char_event.h" +#include "npccreate.h" +#include "addressbook.h" +#include "item_event.h" +#include "magic_base.h" +#include "magic.h" +#include "chatmagic.h" +#include "configfile.h" +#include "log.h" +#include "anim_tbl.h" +#include "encount.h" +#include "battle.h" +#include "pet_skill.h" +#include "util.h" +#include "enemy.h" +#include "npcutil.h" +#include "pet.h" +#include "family.h" + +struct MissionInfo missionlist[MAXMISSION]; +int mission_num =0; +struct MissionTable missiontable[MAXMISSIONTABLE]; + +//#define ANGELITEM 2884 //20701 //ʹߵ ߱ +//#define HEROITEM 2885 //20702 //ߵ ߱ + +extern int AngelReady; + +char* getMissionNameInfo( int charaindex, char* nameinfo) +{ + sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) ); + return nameinfo; +} + +int checkIfAngel( int charaindex) +{ + int i; + char nameinfo[512]; + + //sprintf( nameinfo, "%s:%s", CHAR_getChar( charaindex, CHAR_CDKEY), CHAR_getChar( charaindex, CHAR_NAME) ); + getMissionNameInfo( charaindex, nameinfo); + for( i =0; i + +// CoolFish: 2001/10/12 _UNIQUE_P_I +#include + + +#include "char_base.h" +#include "char_data.h" +#include "item.h" +#include "buf.h" +#include "magic.h" +#include "function.h" +#include "npccreate.h" +#include "configfile.h" +#include "title.h" +#include "pet.h" +#include "pet_skill.h" +#include "anim_tbl.h" +#include "enemy.h" +#include "saacproto_cli.h" + +// CoolFish: 2001/10/29 +#include "log.h" + +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif + +Char* CHAR_chara; + +static int CHAR_charanum; +static int CHAR_playernum; +static int CHAR_petnum; +static int CHAR_othersnum; + +// CoolFish: 2001/10/11 +#ifdef _UNIQUE_P_I +#define MAX_UNIQUE_P_I 1000 +static int unique_p = 0; +static int unique_i = 0; +#endif + +typedef struct tagINITCHARCOUNTER{ + int startcnt; + int cnt; + int endcnt; +}INITCHARCOUNTER; +static INITCHARCOUNTER initCharCounter[3] = { + {-1,-1,-1},{-1,-1,-1},{-1,-1,-1} +}; + + +tagRidePetTable ridePetTable[296] = +{ + { 101000, 100000, 100352, 331 }, + { 101001, 100005, 100352, 331 }, + { 101002, 100010, 100352, 331 }, + { 101003, 100015, 100352, 331 }, + { 101004, 100000, 100329, 309 }, + { 101005, 100005, 100327, 307 }, + { 101006, 100010, 100330, 310 }, + { 101007, 100015, 100328, 308 }, +// { 101008, 100700, 100372, 351 }, +// { 101009, 100705, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101000, 100700, 100352, 331 }, + { 101001, 100700, 100352, 331 }, + { 101002, 100700, 100352, 331 }, + { 101003, 100700, 100352, 331 }, + { 101004, 100700, 100329, 309 }, + { 101005, 100700, 100327, 307 }, + { 101006, 100700, 100330, 310 }, + { 101007, 100700, 100328, 308 }, + { 101000, 100705, 100352, 331 }, + { 101001, 100705, 100352, 331 }, + { 101002, 100705, 100352, 331 }, + { 101003, 100705, 100352, 331 }, + { 101004, 100705, 100329, 309 }, + { 101005, 100705, 100327, 307 }, + { 101006, 100705, 100330, 310 }, + { 101007, 100705, 100328, 308 }, +#endif + + { 101010, 100020, 100396, 483 }, + { 101011, 100025, 100396, 483 }, + { 101012, 100030, 100396, 483 }, + { 101013, 100035, 100396, 483 }, + { 101014, 100020, 100328, 308 }, + { 101015, 100025, 100329, 309 }, + { 101016, 100030, 100327, 307 }, + { 101017, 100035, 100330, 310 }, +// { 101018, 100710, 100372, 351 }, +// { 101019, 100715, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101010, 100710, 100396, 483 }, + { 101011, 100710, 100396, 483 }, + { 101012, 100710, 100396, 483 }, + { 101013, 100710, 100396, 483 }, + { 101014, 100710, 100328, 308 }, + { 101015, 100710, 100329, 309 }, + { 101016, 100710, 100327, 307 }, + { 101017, 100710, 100330, 310 }, + { 101010, 100715, 100396, 483 }, + { 101011, 100715, 100396, 483 }, + { 101012, 100715, 100396, 483 }, + { 101013, 100715, 100396, 483 }, + { 101014, 100715, 100328, 308 }, + { 101015, 100715, 100329, 309 }, + { 101016, 100715, 100327, 307 }, + { 101017, 100715, 100330, 310 }, +#endif + + { 101020, 100040, 100351, 330 }, + { 101021, 100045, 100351, 330 }, + { 101022, 100050, 100351, 330 }, + { 101023, 100055, 100351, 330 }, + { 101024, 100040, 100328, 308 }, + { 101025, 100045, 100330, 310 }, + { 101026, 100050, 100327, 307 }, + { 101027, 100055, 100329, 309 }, +// { 101028, 100720, 100372, 351 }, +// { 101029, 100725, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101020, 100720, 100351, 330 }, + { 101021, 100720, 100351, 330 }, + { 101022, 100720, 100351, 330 }, + { 101023, 100720, 100351, 330 }, + { 101024, 100720, 100328, 308 }, + { 101025, 100720, 100330, 310 }, + { 101026, 100720, 100327, 307 }, + { 101027, 100720, 100329, 309 }, + { 101020, 100725, 100351, 330 }, + { 101021, 100725, 100351, 330 }, + { 101022, 100725, 100351, 330 }, + { 101023, 100725, 100351, 330 }, + { 101024, 100725, 100328, 308 }, + { 101025, 100725, 100330, 310 }, + { 101026, 100725, 100327, 307 }, + { 101027, 100725, 100329, 309 }, +#endif + + { 101030, 100060, 100353, 332 }, + { 101031, 100065, 100353, 332 }, + { 101032, 100070, 100353, 332 }, + { 101033, 100075, 100353, 332 }, + { 101034, 100060, 100329, 309 }, + { 101035, 100065, 100327, 307 }, + { 101036, 100070, 100330, 310 }, + { 101037, 100075, 100328, 308 }, +// { 101038, 100730, 100372, 351 }, +// { 101039, 100735, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101030, 100730, 100353, 332 }, + { 101031, 100730, 100353, 332 }, + { 101032, 100730, 100353, 332 }, + { 101033, 100730, 100353, 332 }, + { 101034, 100730, 100329, 309 }, + { 101035, 100730, 100327, 307 }, + { 101036, 100730, 100330, 310 }, + { 101037, 100730, 100328, 308 }, + { 101030, 100735, 100353, 332 }, + { 101031, 100735, 100353, 332 }, + { 101032, 100735, 100353, 332 }, + { 101033, 100735, 100353, 332 }, + { 101034, 100735, 100329, 309 }, + { 101035, 100735, 100327, 307 }, + { 101036, 100735, 100330, 310 }, + { 101037, 100735, 100328, 308 }, +#endif + + { 101040, 100080, 100396, 483 }, + { 101041, 100085, 100396, 483 }, + { 101042, 100090, 100396, 483 }, + { 101043, 100095, 100396, 483 }, + { 101044, 100080, 100328, 308 }, + { 101045, 100085, 100327, 307 }, + { 101046, 100090, 100330, 310 }, + { 101047, 100095, 100329, 309 }, +// { 101048, 100740, 100372, 351 }, +// { 101049, 100745, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101040, 100740, 100396, 483 }, + { 101041, 100740, 100396, 483 }, + { 101042, 100740, 100396, 483 }, + { 101043, 100740, 100396, 483 }, + { 101044, 100740, 100328, 308 }, + { 101045, 100740, 100327, 307 }, + { 101046, 100740, 100330, 310 }, + { 101047, 100740, 100329, 309 }, + { 101040, 100740, 100396, 483 }, + { 101041, 100740, 100396, 483 }, + { 101042, 100740, 100396, 483 }, + { 101043, 100740, 100396, 483 }, + { 101044, 100740, 100328, 308 }, + { 101045, 100740, 100327, 307 }, + { 101046, 100740, 100330, 310 }, + { 101047, 100740, 100329, 309 }, +#endif + + { 101050, 100100, 100353, 332 }, + { 101051, 100105, 100353, 332 }, + { 101052, 100110, 100353, 332 }, + { 101053, 100115, 100353, 332 }, + { 101054, 100100, 100329, 309 }, + { 101055, 100105, 100328, 308 }, + { 101056, 100110, 100330, 310 }, + { 101057, 100115, 100327, 307 }, +// { 101058, 100750, 100372, 351 }, +// { 101059, 100755, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101050, 100750, 100353, 332 }, + { 101051, 100750, 100353, 332 }, + { 101052, 100750, 100353, 332 }, + { 101053, 100750, 100353, 332 }, + { 101054, 100750, 100329, 309 }, + { 101055, 100750, 100328, 308 }, + { 101056, 100750, 100330, 310 }, + { 101057, 100750, 100327, 307 }, + { 101050, 100755, 100353, 332 }, + { 101051, 100755, 100353, 332 }, + { 101052, 100755, 100353, 332 }, + { 101053, 100755, 100353, 332 }, + { 101054, 100755, 100329, 309 }, + { 101055, 100755, 100328, 308 }, + { 101056, 100755, 100330, 310 }, + { 101057, 100755, 100327, 307 }, +#endif + + { 101060, 100120, 100354, 333 }, + { 101061, 100125, 100354, 333 }, + { 101062, 100130, 100354, 333 }, + { 101063, 100135, 100354, 333 }, + { 101064, 100120, 100327, 307 }, + { 101065, 100125, 100330, 310 }, + { 101066, 100130, 100328, 308 }, + { 101067, 100135, 100329, 309 }, +// { 101068, 100760, 100372, 351 }, +// { 101069, 100765, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101060, 100760, 100354, 333 }, + { 101061, 100760, 100354, 333 }, + { 101062, 100760, 100354, 333 }, + { 101063, 100760, 100354, 333 }, + { 101064, 100760, 100327, 307 }, + { 101065, 100760, 100330, 310 }, + { 101066, 100760, 100328, 308 }, + { 101067, 100760, 100329, 309 }, + { 101060, 100765, 100354, 333 }, + { 101061, 100765, 100354, 333 }, + { 101062, 100765, 100354, 333 }, + { 101063, 100765, 100354, 333 }, + { 101064, 100765, 100327, 307 }, + { 101065, 100765, 100330, 310 }, + { 101066, 100765, 100328, 308 }, + { 101067, 100765, 100329, 309 }, +#endif + + { 101070, 100140, 100354, 333 }, + { 101071, 100145, 100354, 333 }, + { 101072, 100150, 100354, 333 }, + { 101073, 100155, 100354, 333 }, + { 101074, 100140, 100327, 307 }, + { 101075, 100145, 100329, 309 }, + { 101076, 100150, 100330, 310 }, + { 101077, 100155, 100328, 308 }, +// { 101078, 100770, 100372, 351 }, +// { 101079, 100775, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101070, 100770, 100354, 333 }, + { 101071, 100770, 100354, 333 }, + { 101072, 100770, 100354, 333 }, + { 101073, 100770, 100354, 333 }, + { 101074, 100770, 100327, 307 }, + { 101075, 100770, 100329, 309 }, + { 101076, 100770, 100330, 310 }, + { 101077, 100770, 100328, 308 }, + { 101070, 100775, 100354, 333 }, + { 101071, 100775, 100354, 333 }, + { 101072, 100775, 100354, 333 }, + { 101073, 100775, 100354, 333 }, + { 101074, 100775, 100327, 307 }, + { 101075, 100775, 100329, 309 }, + { 101076, 100775, 100330, 310 }, + { 101077, 100775, 100328, 308 }, +#endif + + { 101080, 100160, 100352, 331 }, + { 101081, 100165, 100352, 331 }, + { 101082, 100170, 100352, 331 }, + { 101083, 100175, 100352, 331 }, + { 101084, 100160, 100330, 310 }, + { 101085, 100165, 100329, 309 }, + { 101086, 100170, 100327, 307 }, + { 101087, 100175, 100328, 308 }, +// { 101088, 100780, 100372, 351 }, +// { 101089, 100785, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101080, 100780, 100396, 483 }, + { 101081, 100780, 100396, 483 }, + { 101082, 100780, 100396, 483 }, + { 101083, 100780, 100396, 483 }, + { 101084, 100780, 100328, 308 }, + { 101085, 100780, 100327, 307 }, + { 101086, 100780, 100330, 310 }, + { 101087, 100780, 100329, 309 }, + { 101080, 100785, 100352, 331 }, + { 101081, 100785, 100352, 331 }, + { 101082, 100785, 100352, 331 }, + { 101083, 100785, 100352, 331 }, + { 101084, 100785, 100330, 310 }, + { 101085, 100785, 100329, 309 }, + { 101086, 100785, 100327, 307 }, + { 101087, 100785, 100328, 308 }, +#endif + + { 101090, 100180, 100351, 330 }, + { 101091, 100185, 100351, 330 }, + { 101092, 100190, 100351, 330 }, + { 101093, 100195, 100351, 330 }, + { 101094, 100180, 100328, 308 }, + { 101095, 100185, 100330, 310 }, + { 101096, 100190, 100329, 309 }, + { 101097, 100195, 100327, 307 }, +// { 101098, 100790, 100372, 351 }, +// { 101099, 100795, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101090, 100790, 100351, 330 }, + { 101091, 100790, 100351, 330 }, + { 101092, 100790, 100351, 330 }, + { 101093, 100790, 100351, 330 }, + { 101094, 100790, 100328, 308 }, + { 101095, 100790, 100330, 310 }, + { 101096, 100790, 100329, 309 }, + { 101097, 100790, 100327, 307 }, + { 101090, 100795, 100351, 330 }, + { 101091, 100795, 100351, 330 }, + { 101092, 100795, 100351, 330 }, + { 101093, 100795, 100351, 330 }, + { 101094, 100795, 100328, 308 }, + { 101095, 100795, 100330, 310 }, + { 101096, 100795, 100329, 309 }, + { 101097, 100795, 100327, 307 }, +#endif + + { 101100, 100200, 100353, 332 }, + { 101101, 100205, 100353, 332 }, + { 101102, 100210, 100353, 332 }, + { 101103, 100215, 100353, 332 }, + { 101104, 100200, 100329, 309 }, + { 101105, 100205, 100328, 308 }, + { 101106, 100210, 100327, 307 }, + { 101107, 100215, 100330, 310 }, +// { 101108, 100800, 100372, 351 }, +// { 101109, 100805, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101100, 100800, 100353, 332 }, + { 101101, 100800, 100353, 332 }, + { 101102, 100800, 100353, 332 }, + { 101103, 100800, 100353, 332 }, + { 101104, 100800, 100329, 309 }, + { 101105, 100800, 100328, 308 }, + { 101106, 100800, 100327, 307 }, + { 101107, 100800, 100330, 310 }, + { 101100, 100805, 100353, 332 }, + { 101101, 100805, 100353, 332 }, + { 101102, 100805, 100353, 332 }, + { 101103, 100805, 100353, 332 }, + { 101104, 100805, 100329, 309 }, + { 101105, 100805, 100328, 308 }, + { 101106, 100805, 100327, 307 }, + { 101107, 100805, 100330, 310 }, +#endif + + { 101110, 100220, 100396, 483 }, + { 101111, 100225, 100396, 483 }, + { 101112, 100230, 100396, 483 }, + { 101113, 100235, 100396, 483 }, + { 101114, 100220, 100330, 310 }, + { 101115, 100225, 100327, 307 }, + { 101116, 100230, 100329, 309 }, + { 101117, 100235, 100328, 308 }, +// { 101118, 100810, 100372, 351 }, +// { 101119, 100815, 100373, 352 }, +#ifdef _GM_METAMO_RIDE + { 101110, 100810, 100396, 483 }, + { 101111, 100810, 100396, 483 }, + { 101112, 100810, 100396, 483 }, + { 101113, 100810, 100396, 483 }, + { 101114, 100810, 100330, 310 }, + { 101115, 100810, 100327, 307 }, + { 101116, 100810, 100329, 309 }, + { 101117, 100810, 100328, 308 }, + { 101110, 100815, 100396, 483 }, + { 101111, 100815, 100396, 483 }, + { 101112, 100815, 100396, 483 }, + { 101113, 100815, 100396, 483 }, + { 101114, 100815, 100330, 310 }, + { 101115, 100815, 100327, 307 }, + { 101116, 100815, 100329, 309 }, + { 101117, 100815, 100328, 308 }, +#endif + + { 101179, 101177, 101178, 1804}, + { 101179, 101178, 101177, 1926}, + +//#ifndef _RIDEMODE_20 +#ifndef _GM_METAMO_RIDE + { 100420, 100710, 100369, 348 }, + { 100425, 100710, 100370, 349 }, + { 100445, 100710, 100904, 1642 }, + + { 100420, 100715, 100369, 348 }, + { 100425, 100715, 100370, 349 }, + { 100445, 100715, 100904, 1642 }, +#endif +//#endif +}; + +#ifdef _FM_LEADER_RIDE +tagFmLeaderRide FmLeaderRide[] = { + { 1041, {-1, -1, -1, -1, -1, -1 }}, + { 2031, {-1, -1, -1, -1, -1, -1 }}, + { 3031, {-1, -1, -1, -1, -1, -1 }}, + { 4031, {-1, -1, -1, -1, -1, -1 }}, + { 5031, {-1, -1, -1, -1, -1, -1 }}, + { 6031, {-1, -1, -1, -1, -1, -1 }}, + { 7031, {-1, -1, -1, -1, -1, -1 }}, + { 8031, {-1, -1, -1, -1, -1, -1 }}, + { 9031, {-1, -1, -1, -1, -1, -1 }}, + { 10031, {-1, -1, -1, -1, -1, -1 }} +}; +#endif + +#ifdef _NEW_RIDEPETS +#ifdef _RIDE_CF +tagRideCodeMode RideCodeMode[] = { + { 100374, -1, RIDE_PET0 }, /**/ + { 100358, -1, RIDE_PET1 }, /*Ħ˹*/ + { 100362, -1, RIDE_PET2 }, /*˹*/ + { 100279, -1, RIDE_PET3 }, /*³*/ + { 100288, -1, RIDE_PET4 }, /*˹*/ + { 100283, -1, RIDE_PET5 }, /*迨³˹*/ + { 100346, -1, RIDE_PET6 }, /*迨*/ + { 100310, -1, RIDE_PET7 }, /**/ + { 100372, -1, RIDE_PET8 }, /*˹*/ + { 100373, -1, RIDE_PET9 }, /*Ͷ*/ + { 101532, -1, RIDE_PET10 }, /*ʷ³*/ + { 101576, -1, RIDE_PET11 }, /*޶*/ + { 100370, -1, RIDE_PET12 }, /*汦*/ + { 100369, -1, RIDE_PET13 }, /**/ + { 100904, -1, RIDE_PET14 }, /**/ + { -1, -1, RIDE_PET15 }, + { -1, -1, RIDE_PET16 }, + { -1, -1, RIDE_PET17 }, + { -1, -1, RIDE_PET18 }, + { -1, -1, RIDE_PET19 }, + { -1, -1, RIDE_PET20 }, + { -1, -1, RIDE_PET21 }, + { -1, -1, RIDE_PET22 }, + { -1, -1, RIDE_PET23 }, + { -1, -1, RIDE_PET24 }, + { -1, -1, RIDE_PET25 }, + { -1, -1, RIDE_PET26 }, + { -1, -1, RIDE_PET27 }, + { -1, -1, RIDE_PET28 }, + { -1, -1, RIDE_PET29 }, + { -1, -1, RIDE_PET30 }, + { -1, -1, RIDE_PET31 }, + { 100374, -1, RIDE_PET0 }, /**/ + { 100358, -1, RIDE_PET1 }, /*Ħ˹*/ + { 100362, -1, RIDE_PET2 }, /*˹*/ + { 100279, -1, RIDE_PET3 }, /*³*/ + { 100288, -1, RIDE_PET4 }, /*˹*/ + { 100283, -1, RIDE_PET5 }, /*迨³˹*/ + { 100346, -1, RIDE_PET6 }, /*迨*/ + { 100310, -1, RIDE_PET7 }, /**/ + { 100372, -1, RIDE_PET8 }, /*˹*/ + { 100373, -1, RIDE_PET9 }, /*Ͷ*/ + { 101532, -1, RIDE_PET10 }, /*ʷ³*/ + { 101576, -1, RIDE_PET11 }, /*޶*/ + { 100370, -1, RIDE_PET12 }, /*汦*/ + { 100369, -1, RIDE_PET13 }, /**/ + { 100904, -1, RIDE_PET14 }, /**/ + { -1, -1, RIDE_PET15 }, + { -1, -1, RIDE_PET16 }, + { -1, -1, RIDE_PET17 }, + { -1, -1, RIDE_PET18 }, + { -1, -1, RIDE_PET19 }, + { -1, -1, RIDE_PET20 }, + { -1, -1, RIDE_PET21 }, + { -1, -1, RIDE_PET22 }, + { -1, -1, RIDE_PET23 }, + { -1, -1, RIDE_PET24 }, + { -1, -1, RIDE_PET25 }, + { -1, -1, RIDE_PET26 }, + { -1, -1, RIDE_PET27 }, + { -1, -1, RIDE_PET28 }, + { -1, -1, RIDE_PET29 }, + { -1, -1, RIDE_PET30 }, + { -1, -1, RIDE_PET31 }, + { 100374, -1, RIDE_PET0 }, /**/ + { 100358, -1, RIDE_PET1 }, /*Ħ˹*/ + { 100362, -1, RIDE_PET2 }, /*˹*/ + { 100279, -1, RIDE_PET3 }, /*³*/ + { 100288, -1, RIDE_PET4 }, /*˹*/ + { 100283, -1, RIDE_PET5 }, /*迨³˹*/ + { 100346, -1, RIDE_PET6 }, /*迨*/ + { 100310, -1, RIDE_PET7 }, /**/ + { 100372, -1, RIDE_PET8 }, /*˹*/ + { 100373, -1, RIDE_PET9 }, /*Ͷ*/ + { 101532, -1, RIDE_PET10 }, /*ʷ³*/ + { 101576, -1, RIDE_PET11 }, /*޶*/ + { 100370, -1, RIDE_PET12 }, /*汦*/ + { 100369, -1, RIDE_PET13 }, /**/ + { 100904, -1, RIDE_PET14 }, /**/ + { -1, -1, RIDE_PET15 }, + { -1, -1, RIDE_PET16 }, + { -1, -1, RIDE_PET17 }, + { -1, -1, RIDE_PET18 }, + { -1, -1, RIDE_PET19 }, + { -1, -1, RIDE_PET20 }, + { -1, -1, RIDE_PET21 }, + { -1, -1, RIDE_PET22 }, + { -1, -1, RIDE_PET23 }, + { -1, -1, RIDE_PET24 }, + { -1, -1, RIDE_PET25 }, + { -1, -1, RIDE_PET26 }, + { -1, -1, RIDE_PET27 }, + { -1, -1, RIDE_PET28 }, + { -1, -1, RIDE_PET29 }, + { -1, -1, RIDE_PET30 }, + { -1, -1, RIDE_PET31 }, +}; +#else +tagRideCodeMode RideCodeMode[] = { + { 100374, RIDE_PET0 }, /**/ + { 100358, RIDE_PET1 }, /*Ħ˹*/ + { 100362, RIDE_PET2 }, /*˹*/ + { 100279, RIDE_PET3 }, /*³*/ + { 100288, RIDE_PET4 }, /*˹*/ + { 100283, RIDE_PET5 }, /*迨³˹*/ + { 100346, RIDE_PET6 }, /*迨*/ + { 100310, RIDE_PET7 }, /**/ + { 100372, RIDE_PET8 }, /*˹*/ + { 100373, RIDE_PET9 }, /*Ͷ*/ + { 101532, RIDE_PET10 }, /*ʷ³*/ + { 101576, RIDE_PET11 }, /*޶*/ + { 100370, RIDE_PET12 }, /*汦*/ + { 100369, RIDE_PET13 }, /**/ + { 100904, RIDE_PET14 }, /**/ +}; +#endif +#ifdef _RIDE_CF +tagRideNoList RideNoList[] = { + {{ 101305, 101306, 101307, 101308, 101309, 101310, 101311, 101312, 101008, 101009, 101978, 101989,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //С + {{ 101313, 101314, 101315, 101316, 101317, 101318, 101319, 101320, 101018, 101019, 101986, 101988,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, // + {{ 101321, 101322, 101323, 101324, 101325, 101326, 101327, 101328, 101028, 101029, 101975, 101965,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //к + {{ 101329, 101330, 101331, 101332, 101333, 101334, 101335, 101336, 101038, 101039, 101976, 101966,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, // + {{ 101337, 101338, 101339, 101340, 101341, 101342, 101343, 101344, 101048, 101049, 101984, 101973,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //Ƥ + {{ 101345, 101346, 101347, 101348, 101349, 101350, 101351, 101352, 101058, 101059, 101985, 101974,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, // + {{ 101353, 101354, 101355, 101356, 101357, 101358, 101359, 101360, 101068, 101069, 101977, 101967,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //С + {{ 101361, 101362, 101363, 101364, 101365, 101366, 101367, 101368, 101078, 101079, 101979, 101968,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //Ƥ + {{ 101369, 101370, 101371, 101372, 101373, 101374, 101375, 101376, 101088, 101089, 101981, 101970,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //ñ + {{ 101377, 101378, 101379, 101380, 101381, 101382, 101383, 101384, 101098, 101099, 101980, 101969,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //̷ + {{ 101385, 101386, 101387, 101388, 101389, 101390, 101391, 101392, 101108, 101109, 101983, 101972,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, //Ů + {{ 101393, 101394, 101395, 101396, 101397, 101398, 101399, 101400, 101118, 101119, 101982, 101971,100425,100420,100445,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},0}, // +}; +#else +tagRideNoList RideNoList[] = { + {{ 101305, 101306, 101307, 101308, 101309, 101310, 101311, 101312, 101008, 101009, 101978, 101989,100425,100420,100445},0}, //С + {{ 101313, 101314, 101315, 101316, 101317, 101318, 101319, 101320, 101018, 101019, 101986, 101988,100425,100420,100445},0}, // + {{ 101321, 101322, 101323, 101324, 101325, 101326, 101327, 101328, 101028, 101029, 101975, 101965,100425,100420,100445},0}, //к + {{ 101329, 101330, 101331, 101332, 101333, 101334, 101335, 101336, 101038, 101039, 101976, 101966,100425,100420,100445},0}, // + {{ 101337, 101338, 101339, 101340, 101341, 101342, 101343, 101344, 101048, 101049, 101984, 101973,100425,100420,100445},0}, //Ƥ + {{ 101345, 101346, 101347, 101348, 101349, 101350, 101351, 101352, 101058, 101059, 101985, 101974,100425,100420,100445},0}, // + {{ 101353, 101354, 101355, 101356, 101357, 101358, 101359, 101360, 101068, 101069, 101977, 101967,100425,100420,100445},0}, //С + {{ 101361, 101362, 101363, 101364, 101365, 101366, 101367, 101368, 101078, 101079, 101979, 101968,100425,100420,100445},0}, //Ƥ + {{ 101369, 101370, 101371, 101372, 101373, 101374, 101375, 101376, 101088, 101089, 101981, 101970,100425,100420,100445},0}, //ñ + {{ 101377, 101378, 101379, 101380, 101381, 101382, 101383, 101384, 101098, 101099, 101980, 101969,100425,100420,100445},0}, //̷ + {{ 101385, 101386, 101387, 101388, 101389, 101390, 101391, 101392, 101108, 101109, 101983, 101972,100425,100420,100445},0}, //Ů + {{ 101393, 101394, 101395, 101396, 101397, 101398, 101399, 101400, 101118, 101119, 101982, 101971,100425,100420,100445},0}, // +}; +#endif +tagRidePetList RPlistMode[] = { + { 100000, 0, 1 }, { 100005, 0, 1 }, { 100010, 0, 1 }, { 100015, 0, 1 }, { 100700, 0, 1 }, { 100705, 0, 1 }, // + { 100020, 1, 1 }, { 100025, 1, 1 }, { 100030, 1, 1 }, { 100035, 1, 1 }, { 100710, 1, 1 }, { 100715, 1, 1 },// + { 100040, 2, 1 }, { 100045, 2, 1 }, { 100050, 2, 1 }, { 100055, 2, 1 }, { 100720, 2, 1 }, { 100725, 2, 1 }, //к + { 100060, 3, 1 }, { 100065, 3, 1 }, { 100070, 3, 1 }, { 100075, 3, 1 }, { 100730, 3, 1 }, { 100735, 3, 1 }, // + { 100080, 4, 1 }, { 100085, 4, 1 }, { 100090, 4, 1 }, { 100095, 4, 1 }, { 100740, 4, 1 }, { 100745, 4, 1 }, //Ƥ + { 100100, 5, 1 }, { 100105, 5, 1 }, { 100110, 5, 1 }, { 100115, 5, 1 }, { 100750, 5, 1 }, { 100755, 5, 1 }, // + { 100120, 6, 2 }, { 100125, 6, 2 }, { 100130, 6, 2 }, { 100135, 6, 2 }, { 100760, 6, 2 }, { 100765, 6, 2 }, // + { 100140, 7, 2 }, { 100145, 7, 2 }, { 100150, 7, 2 }, { 100155, 7, 2 }, { 100770, 7, 2 }, { 100775, 7, 2 }, //Ƥ + { 100160, 8, 2 }, { 100165, 8, 2 }, { 100170, 8, 2 }, { 100175, 8, 2 }, { 100780, 8, 2 }, { 100785, 8, 2 }, //ñ + { 100180, 9, 2 }, { 100185, 9, 2 }, { 100190, 9, 2 }, { 100195, 9, 2 }, { 100790, 9, 2 }, { 100795, 9, 2 }, //̷ + { 100200, 10, 2 }, { 100205, 10, 2 }, { 100210, 10, 2 }, { 100215, 10, 2 }, { 100800, 10, 2 }, { 100805, 10, 2 }, //Ů + { 100220, 11, 2 }, { 100225, 11, 2 }, { 100230, 11, 2 }, { 100235, 11, 2 }, { 100810, 11, 2 }, { 100815, 11, 2 }, // +}; + +int RIDEPET_getNOindex( int baseNo) +{ + int i; + for( i=0; i< sizeof(RPlistMode)/sizeof(tagRidePetList); i++ ) { + if( RPlistMode[i].charNo == baseNo ) { + return RPlistMode[i].Noindex; + } + } + return -1; +} + +#ifdef _RIDE_CF +int RIDEPET_getPETindex( int PetNo, unsigned int learnCode, unsigned int learnCode1, unsigned int learnCode2 ) +{ + int i; + int max=sizeof(RideCodeMode)/sizeof(tagRideCodeMode); + //print( "RIDEPET_getPETindex128:debug: max = %d, learnCode = %d, learnCode1 = %d, learnCode2 = %d, learnCode4 = %d. \n", max, learnCode, learnCode1, learnCode2, learnCode3 ); + for( i=0; i< max; i++ ) + { + //print( "debug: PetNo = %d, PetNo = %d. \n", PetNo, RideCodeMode[i].petNo ); + if( RideCodeMode[i].petNo == PetNo ){ + if( i < 32 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode) + { + return i; + } + } + else if( i < 64 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode1) + { + return i; + } + } + else if( i < 96 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode2) + { + return i; + } + } + } + } + + return -1; +} +int CHAR_CheckLearnCode(int charindex, int ridno) +{ + int i; + int max=sizeof(RideCodeMode)/sizeof(tagRideCodeMode); + unsigned int learnCode,learnCode1,learnCode2; + learnCode = CHAR_getInt( charindex, CHAR_LOWRIDEPETS); + learnCode1 = CHAR_getInt( charindex, CHAR_LOWRIDEPETS1); + learnCode2 = CHAR_getInt( charindex, CHAR_HIGHRIDEPETS2); + //print( "RIDEPET_getPETindex128:debug: max = %d, learnCode = %d, learnCode1 = %d, learnCode2 = %d, learnCode4 = %d. \n", max, learnCode, learnCode1, learnCode2, learnCode3 ); + for( i=0; i< max; i++ ) + { + //print( "debug: PetNo = %d, PetNo = %d. \n", PetNo, RideCodeMode[i].petNo ); + if( RideCodeMode[i].petNo == ridno ){ + if( i < 32 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode) + { + return i; + } + } + else if( i < 64 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode1) + { + return i; + } + } + else if( i < 96 ) + { +#ifdef _NO_RIDE_ID + if(strlen(getNoRideId())>0){ + char ridetmp[32]; + sprintf(ridetmp,",%d,",i); + if(strstr(getNoRideId(),ridetmp)!=NULL) + return i; + } +#endif + if(RideCodeMode[i].learnCode & learnCode2) + { + return i; + } + } + } + } + + return -1; +} +#else +int RIDEPET_getPETindex( int PetNo, unsigned int learnCode ) +{ + int i; + for( i=0; i< sizeof(RideCodeMode)/sizeof(tagRideCodeMode); i++ ){ + if( RideCodeMode[i].petNo == PetNo && + (RideCodeMode[i].learnCode & learnCode) ) { + return i; + } + + } + return -1; +} +#endif + +int RIDEPET_getRIDEno( int index, int ti) +{ + if( index < 0 || index >= sizeof( RideNoList)/sizeof( tagRideNoList) ) + return -1; + if( ti < 0 || ti >= MAXNOINDEX ) + return -1; + + return RideNoList[index].RideNo[ti]; +} +#endif + +#ifdef _EMENY_CHANCEMAN +int CHAR_getSexInt( int baseNo ) +{ + int i; + for( i=0; i< sizeof(RPlistMode)/sizeof(tagRidePetList); i++ ) { + if( RPlistMode[i].charNo == baseNo ) { + return RPlistMode[i].sex; + } + } + return -1; +} +#endif + +#ifdef _PET_EVOLUTION +#define MAXTABLE_X 29 +#define MAXTABLE_Y 29 +int PetTable[MAXTABLE_X][MAXTABLE_Y]={ + //0 4 9 14 19 24 + { 1, 2, 5, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 5, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5}, + { 2, 5, 1, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1}, + { 5, 1, 2, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2}, + { 1, 2, 5, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5}, + { 2, 5, 1, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1}, + + { 2, 1, 2, 1, 2, 2, 2, 5, 5, 1, 2, 5, 2, 1, 2, 1, 2, 5, 2, 1, 2, 1, 2, 5, 2, 5, 2, 1, 2}, + { 1, 2, 5, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 1}, + { 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, 6, 4, 6, 4, 9, 4, 9, 4, 6, 4, 6, 4, 9, 4, 9, 4, 6, 4, 6, 4, 9, 4, 9, 4, 6, 4, 9, 4}, + + { 8, 3, 8, 3, 8,10, 8,10, 8, 3, 8, 3, 8,10, 8,10, 8, 3, 8, 3, 8,10, 8,10, 8, 3, 8,10, 8}, + { 8,10, 3, 8,10, 3, 8,10,10, 3, 8,10, 3, 8,10, 3,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10}, + { 1, 2, 5, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5}, + { 0, 4, 0, 4, 0, 6, 0, 6, 0, 4, 0, 4, 0, 6, 0, 6, 0, 4, 0, 4, 0, 6, 0, 4, 0, 6, 0, 4, 0}, + { 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2, 5, 1, 2}, + + { 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8}, + {10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3, 8,10, 3}, + { 2, 1, 2, 1, 5, 1, 5, 1, 2, 1, 2, 1, 5, 1, 5, 1, 2, 1, 2, 1, 5, 1, 5, 1, 2, 1, 2, 5, 1}, + { 6, 9, 6, 9, 6, 0, 6, 0, 6, 9, 6, 9, 6, 0, 6, 0, 6, 9, 6, 9, 6, 0, 6, 0, 6, 9, 6, 0, 6} +}; + +int PropertyTable[4][4]={ + { 0, 4, 5, 6}, + { 7, 1, 8, 9}, + {10,11, 2,12}, + {13,14,15, 3}, +}; +#define MAXFTABLE_X 11 +#define MAXFTABLE_Y 16 +int FusionTable[MAXFTABLE_X][MAXFTABLE_Y]={ + { 989, 990, 991, 992, 989, 992, 989, 990, 990, 990, 991, 991, 991, 992, 989, 992}, + {1001,1002,1003,1004,1001,1001,1004,1001,1002,1002,1003,1003,1003,1004,1004,1003}, + {1005,1006,1007,1008,1005,1005,1005,1006,1006,1006,1007,1006,1007,1008,1008,1008}, + {1021,1025,1023,1024,1025,1021,1021,1022,1022,1022,1023,1023,1023,1021,1024,1024}, + {1030,1031,1032,1033,1030,1030,1030,1031,1031,1031,1032,1031,1032,1030,1033,1033}, + {1017,1018,1019,1020,1018,1017,1017,1018,1019,1018,1019,1019,1020,1017,1020,1020}, + {1009,1010,1011,1012,1010,1009,1009,1010,1010,1010,1011,1011,1011,1012,1012,1011}, + { 993, 994, 995, 996, 994, 993, 993, 994, 995, 994, 995, 993, 996, 993, 996, 996}, + {1026,1027,1028,1029,1026,1026,1026,1026,1028,1027,1028,1028,1029,1029,1029,1029}, + { 997, 998, 999, 999,1000, 997, 997,1000, 998, 998,1000, 998, 999, 999, 999, 999}, + {1013,1014,1015,1016,1013,1013,1016,1013,1015,1014,1015,1015,1015,1016,1016,1016}, +}; + +int EVOLUTION_getPetFusionCode( int petid) +{ + int petarray = ENEMYTEMP_getEnemyTempArrayFromTempNo( petid); + return ENEMYTEMP_getInt( petarray, E_T_FUSIONCODE); +} + +#ifdef _PET_AMOI__E +int EVOLUTION_getPetENABLETRADE( int petid) +{ + int petarray = ENEMYTEMP_getEnemyTempArrayFromTempNo( petid); + return ENEMYTEMP_getInt( petarray, E_T_ENABLETRADE); +} + +int EVOLUTION_getPETTYPE( int petid) +{ + int petarray = ENEMYTEMP_getEnemyTempArrayFromTempNo( petid); + return ENEMYTEMP_getInt( petarray, E_T_PETTYPE); +} + +int EVOLUTION_getPETTYPESUB( int petid) +{ + int petarray = ENEMYTEMP_getEnemyTempArrayFromTempNo( petid); + return ENEMYTEMP_getInt( petarray, E_T_PETTYPESUB); +} +#endif + +int EVOLUTION_getPetTable( int charaindex, int petindex1, int petindex2) +{ + int table1,table2; + + if( !CHAR_CHECKINDEX( petindex1) ) return -1; + if( !CHAR_CHECKINDEX( petindex2) ) return -1; + + table2 = EVOLUTION_getPetFusionCode( CHAR_getInt( petindex1, CHAR_PETID)); + table1 = EVOLUTION_getPetFusionCode( CHAR_getInt( petindex2, CHAR_PETID)); + + if( table1 < 0 || table1 >= MAXTABLE_X ) return -1; + if( table2 < 0 || table2 >= MAXTABLE_Y ) return -1; + return PetTable[table1][table2]; +} + +int EVOLUTION_getPropertyTable( int charaindex, int petindex1, int petindex2) +{ + int i, k1=0, k2=0; + int table1,table2; + int Property1[4]={-1,-1,-1,-1}; + int Property2[4]={-1,-1,-1,-1}; + + if( !CHAR_CHECKINDEX( petindex1) ) return -1; + if( !CHAR_CHECKINDEX( petindex2) ) return -1; + + for( i=0; i<4; i++) { + if( CHAR_getInt( petindex1, CHAR_EARTHAT+i) > 0 ){ + Property1[k1] = i; + k1++; + } + if( CHAR_getInt( petindex2, CHAR_EARTHAT+i) > 0 ){ + Property2[k2] = i; + k2++; + } + } + if( k1 == 0 || k2 == 0 ) return -1; + + if( k1 <= 1 ) { + table1 = Property1[ 0]; + }else{ + table1 = Property1[ (rand()%(k1-1)) ]; + } + if( k2 <= 1 ) { + table2 = Property2[ 0]; + }else { + table2 = Property2[ (rand()%(k2-1)) ]; + } + + if( table1 < 0 || table1 >= 4 ) return -1; + if( table2 < 0 || table2 >= 4 ) return -1; + + return PropertyTable[table1][table2]; +} + +int EVOLUTION_getFusionTable( int charaindex, int px, int py) +{ + if( px >= MAXFTABLE_X || px < 0 ) return -1; + if( py >= MAXFTABLE_Y || py < 0 ) return -1; + return FusionTable[px][py]; +} +#endif + +#ifdef _CHAR_FIXDATADEF +/* +typedef struct _tagPetSetIntData{ + char com[256]; + int type; +}PetSetIntData; + +PetSetIntData PET_SetIntData[ ]={ +}; +*/ +#endif + +static char* CHAR_setintdata[CHAR_DATAINTNUM]={ + /* dci , PLAYER, */ + "pn", /* CHAR_DATAPLACENUMBER */ + "bi", /* CHAR_BASEIMAGENUMBER */ + "bbi", /* CHAR_BASEBASEIMAGENUMBER */ + "fb", /* CHAR_FACEIMAGENUMBER */ + "fl", /* CHAR_FLOOR */ + "x", /* CHAR_X */ + "y", /* CHAR_Y */ + "dir", /* CHAR_DIR 12ë0ݻԻ */ + "lv", /* CHAR_LV */ + "gld", /* CHAR_GOLD */ + + "hp", /* CHAR_HP */ + "mp", /* CHAR_MP */ + "mmp", /* CHAR_MAXMP */ + + "vi", /* CHAR_VITAL */ + "str", /* CHAR_STR */ + "tou", /* CHAR_TOUGH */ + "dx", /* CHAR_DEX */ + + "chr", /* CHAR_CHARM */ + "luc", /* CHAR_LUCK */ + "aea", /* */ + "awa", /* */ + "afi", /* */ + "awi", /* */ + + "slt", /* CHAR_SLOT */ + "cr", /* CHAR_CRITIAL */ + "cou", /* CHAR_COUNTER */ + "rar", /* CHAR_RARE */ + "rst", /* CHAR_RADARSTRLENGTH */ + "cvo", /* CHAR_CHATVOLUME */ + "ml", /* CHAR_MERCHANTLEVEL */ + "hl", /* CHAR_HEALERLEVEL */ + "di", /* CHAR_DETERMINEITEM */ + "ieqt", /* CHAR_INDEXOFEQTITLE */ + "poi", /* CHAR_POISON */ + "par", /* CHAR_PARALYSIS */ + "sil", /* CHAR_SILENCE */ + "sto", /* CHAR_STONE */ + "dar", /* CHAR_DARKNESS */ + "con", /* CHAR_CONFUSION */ + "loc", /* CHAR_LOGINCOUNT */ + "dc", /* CHAR_DEADCOUNT */ + "wc", /* CHAR_WALKCOUNT */ + "tc", /* CHAR_TALKCOUNT */ + "dmc", /* CHAR_DAMAGECOUNT */ + "gpc", /* CHAR_GETPETCOUNT */ + "kpc", /* CHAR_KILLPETCOUNT */ + "dpc", /* CHAR_DEADPETCOUNT */ + "smc", /* CHAR_SENDMAILCOUNT */ + "mic", /* CHAR_MERGEITEMCOUNT */ + "dbc", /* CHAR_DUELBATTLECOUNT */ + "dwc", /* CHAR_DUELWINCOUNT */ + "dlc", /* CHAR_DUELLOSECOUNT */ + "dswc", /* CHAR_DUELSTWINCOUNT */ + "dmswc", /* CHAR_DUELMAXSTWINCOUNT */ + "wht", /* CHAR_WHICHTYPE */ + "wint", /* CHAR_WALKNTERVAL */ + "lint", /* CHAR_LOOPINTERVAL */ +#ifdef _NEWOPEN_MAXEXP + "exp", /* CHAR_OLDEXP */ + "nexp", /* CHAR_EXP */ +#else + "exp", /* CHAR_EXP */ +#endif + "lte", /* CHAR_LASTTALKELDER */ + "skup", /* CHAR_SKILLUPPOINT */ + "lvup", /* CHAR_LEVELUPPOINT */ + "ity", /* CHAR_IMAGETYPE */ + "nc", /* CHAR_NAMECOLOR */ + "pnc", /* CHAR_POPUPNAMECOLOR */ + "llt", /* CHAR_LASTTIMESETLUCK */ + "duel", /* CHAR_DUELPOINT */ + "evt", /* CHAR_EVENT */ + "evt2", /* CHAR_EVENT2 */ + "evt3", /* CHAR_EVENT3 */ +#ifdef _NEWEVENT + "evt4", /* CHAR_EVENT4 */ + "evt5", /* CHAR_EVENT5 */ + "evt6", /* CHAR_EVENT6 */ +#endif +#ifdef _ADD_NEWEVENT // WON + "evt7", /* CHAR_EVENT7 */ + "evt8", // CHAR_ENDEVENT8, 224~255 ٻר + "evt9", + "evt10", + "evt11", + "evt12", + "evt13", + "evt14", + "evt15", + "evt16", +#endif + + "nev", /* CHAR_NOWEVENT */ + "nev2", /* CHAR_NOWEVENT2 */ + "nev3", /* CHAR_NOWEVENT3 */ +#ifdef _NEWEVENT + "nev4", /* CHAR_NOWEVENT4 */ + "nev5", /* CHAR_NOWEVENT5 */ + "nev6", /* CHAR_NOWEVENT6 */ +#endif +#ifdef _ADD_NEWEVENT // WON + "nev7", /* CHAR_NOWEVENT7 */ + "nev8", // CHAR_NOWEVENT8, 224~255 ٻר + "nev9", + "nev10", + "nev11", + "nev12", + "nev13", + "nev14", + "nev15", + "nev16", +#endif + "trn", /* CHAR_TRANSMIGRATION */ + "teq", /* CHAR_TRANSEQUATION */ + + "ini", /* CHAR_INITDATA */ + "silent", /* CHAR_SILENT */ + "fmi", // CoolFish: Family 2001/5/24 index + "fmlf", // CoolFish: Family 2001/5/24 ǷΪ峤 + "fmspr", // CoolFish: Family 2001/7/13 ػ + "bankgld", /* CHAR_BANKGOLD */ + "ridepet", /* CHAR_RIDEPET */ + "learnride", /* CHAR_LEARNRIDE */ +#ifdef _NEW_RIDEPETS + "lowridepet", //CHAR_LOWRIDEPETS +#endif + "limitlv", // Arminius 7.30 pet limit level +#ifdef _PET_FUSION + "fusioncode", //CHAR_FUSIONCODE + "fusionindex", //CHAR_FUSIONINDEX + "fusionraise", //CHAR_FUSIONRAISE + "fusionbe", //CHAR_FUSIONBEIT + "futimelimit", //CHAR_FUSIONTIMELIMIT +#endif + +#ifdef _PERSONAL_FAME // Arminius 8.30: + "fame", +#endif + +#ifdef _NEWSAVE + "sindex", /* CHAR_SAVEINDEXNUMBER */ +#endif + +#ifdef _ATTACK_MAGIC + "earth_exp", // ҵĵħ + "water_exp", // ҵˮħ + "fire_exp", // ҵĻħ + "wind_exp", // ҵķħ + "earth_resist", // ҵĵħ + "water_resist", // ҵˮħ + "fire_resist", // ҵĻħ + "wind_resist", // ҵķħ + "earth_attmagic_exp", // ҵĵħȾֵ + "water_attmagic_exp", // ҵˮħȾֵ + "fire_attmagic_exp", // ҵĻħȾֵ + "wind_attmagic_exp", // ҵķħȾֵ + "earth_defmagic_exp", // ҵĵħԾֵ + "water_defmagic_exp", // ҵˮħԾֵ + "fire_defmagic_exp", // ҵĻħԾֵ + "wind_defmagic_exp", // ҵķħԾֵ +#endif + +#ifdef _GAMBLE_BANK // + "personaglod", //CHAR_PERSONAGOLD, +#endif +#ifdef _DROPSTAKENEW + "gamblenums", //CHAR_GAMBLENUM +#endif +#ifdef _ADD_ACTION //npc + "actsty", //CHAR_ACTIONSTYLE +#endif +#ifdef _PET_EVOLUTION + "evbasevtl",// CHAR_EVOLUTIONBASE, + "evbasestr",// CHAR_EVOLUTIONBASE, + "evbasetgh",// CHAR_EVOLUTIONBASE, + "evbasedex",// CHAR_EVOLUTIONBASE, +#endif + +#ifdef _FM_JOINLIMIT + "fmtimelimit", // CHAR_FMTIMELIMIT, +#endif + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + "profession_class", + "profession_level", +// "profession_exp", + "profession_skill_point", + "attachpile", + "profession_fire_p", + "profession_ice_p", + "profession_thunder_p", + "profession_fire_r", + "profession_ice_r", + "profession_thunder_r", +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + "herofloor", +#endif +#ifdef _PETSKILL_BECOMEPIG + "becomepig", + "becomepig_bbi", +#endif + "leavetime", // CHAR_LASTLEAVETIME +#ifdef _NEW_MANOR_LAW + "momentum", // CHAR_MOMENTUM +#endif + +#ifdef _ITEM_ADDEXP2 + "aexp", // CHAR_ADDEXPPOWER + "aexpt", // CHAR_ADDEXPTIME +#endif + +#ifdef _VIP_BATTLE_EXP + "nvipexp", // CHAR_NVIPEXP + "nviptime", // CHAR_NVIPTIME +#endif + +#ifdef _ANGEL_SUMMON + "herocnt", // CHAR_HEROCNT +#endif +#ifdef _TEACHER_SYSTEM + "tsf", // CHAR_TEACHER_FAME, // ʦ쵼 +#endif + +#ifdef _GM_ITEM + "gmtime", // GM +#endif +#ifdef _VIP_SERVER + "memberpoint", // Ա +#endif +#ifdef _VIP_RIDE + "vipride", // Աڼ + "viptime", // Աʱ +#endif +#ifdef _AUTO_PK + "autopk", // ԶPK +#endif +#ifdef _BATTLE_PK + "battlepk", +#endif + +#ifdef _PET_BEATITUDE + "beatitude", +#endif + +#ifdef _RIDE_CF + "lowridepet1", //CHAR_LOWRIDEPETS + "highridepet2", // +#endif +#ifdef _SUPER_MAN_ITEM + "super", //Ʒ +#endif +#ifdef _EV_NUM + "evnum", + "evitem", +#endif +#ifdef _JOB_AUTOPK + "jobpkm", + "jobpkt", +#endif +#ifdef _VIGOR_SYS + "vigor", +#endif +#ifdef _STU_SYS + "stun", +#endif +#ifdef _ALL_TALK + "atdate", + "atcnt", +#endif +#ifdef _SAFE_PASSWORD + "lock", +#endif + "npctime", +#ifdef _OFFLINE_SYSTEM + "offtime", +#endif +#ifdef _CAMEO_MONEY + "cameo", +#endif +#ifdef _MISSION_TRAIN + "mt", + "mttime", +#endif +#ifdef _PET_EVOLVE + "evolve", +#endif +#ifdef _FLOOR_DIFI_FIELD + "fdt", +#endif +#ifdef _MISSION_TIME + "mtime", +#endif +#ifdef _PLAYER_TITLE + "titlelv", + "titletime", +#endif +#ifdef _COWRIE + "bj", +#endif +#ifdef _ONLINE_TIME + "onlinetime", +#endif + "luasave_workint_1", //CHAR_LUASAVE_WORKINT_1, + "luasave_workint_2", //CHAR_LUASAVE_WORKINT_2, + "luasave_workint_3", //CHAR_LUASAVE_WORKINT_3, + "luasave_int_1", //CHAR_LUASAVE_INT_1, + "luasave_int_2", //CHAR_LUASAVE_INT_1, + "luasave_int_3", //CHAR_LUASAVE_INT_1, +#ifdef _CAX_ESC_REPORT + "report",//CHAR_REPORT ÿǩ +#endif +#ifdef _CAX_Mercenary + "yongb",//CHAR_MERCENARY Ӷֶ +#endif +#ifdef _REGISTRATION_TIME + "regtime", + "regcount", + "regoltime", +#endif +}; + +static char* CHAR_setchardata[CHAR_DATACHARNUM]={ + /* dcc , PLAYER */ + "name" , /* CHAR_NAME */ + "ownt" , /* CHAR_OWNTITLE*/ + "arg", /* CHAR_NPCARGUMENT */ + "ocd", /* CHAR_OWNERCDKEY */ + "ocn", /* CHAR_OWNERCHARANAME */ + "fmname", // CoolFish: Family 2001/5/24 CHAR_FMNAME +#ifdef _UNIQUE_P_I + "ucode", // CoolFish: 2001/10/11 UNIQUE_P_I CHAR_UNIQUECODE +#endif + +#ifdef _TEACHER_SYSTEM + "tsi", // ʦʺ + "tsn", // ʦ +#endif + +#ifdef _ITEM_SETLOVER + "love", // ж + "lovrrid", // ʺ + "lovrrneme", // +#endif + +#ifdef _GM_ITEM + "gmfunction", // GM +#endif +#ifdef _NEW_NAME + "newname", //Զƺ +#endif +#ifdef _EV_NUM + "evcode", +#endif +#ifdef _ALL_RANDMODE + "randtype", +#endif +#ifdef _OFFLINE_SYSTEM + "offbuf", +#endif + // "playip",//CHAR_CHARPLAYIP,IP +}; + +INLINE BOOL _CHAR_CHECKINDEX( char *file, int line, int index ) +{ + if( CHAR_charanum<=index || index<0 ) { + return FALSE; + } + if( CHAR_chara[(index)].use == FALSE ) { + return FALSE; + } + return TRUE; +} + +INLINE BOOL CHAR_CHECKINTDATAINDEX(int index) +{ + if( CHAR_DATAINTNUM<=index || index<0 )return FALSE; + return TRUE; +} + +INLINE BOOL CHAR_CHECKCHARDATAINDEX(int index) +{ + if( CHAR_DATACHARNUM<=index || index<0 )return FALSE; + return TRUE; +} + +INLINE BOOL CHAR_CHECKFLGDATAINDEX( int index ) +{ + if( CHAR_FLGNUM<=index || index<0 )return FALSE; + return TRUE; +} + +INLINE BOOL CHAR_CHECKCHARWORKDATAINDEX(int index) +{ + if( CHAR_WORKDATACHARNUM<=index || index<0 )return FALSE; + return TRUE; +} + +INLINE BOOL CHAR_CHECKCHARFUNCTABLEINDEX(int index) +{ + if( CHAR_FUNCTABLENUM <= index || index < 0 )return FALSE; + return TRUE; +} + +INLINE BOOL _CHAR_CHECKITEMINDEX( char *file, int line, int charaindex, int ti ) +{ + if( 0 <= ti && ti < CHAR_MAXITEMHAVE ) return TRUE; + return FALSE; +} + +INLINE BOOL CHAR_CHECKSKILLINDEX( int skillindex ) +{ + if( skillindex<0 || CHAR_SKILLMAXHAVE <= skillindex )return FALSE; + return TRUE; +} +INLINE BOOL CHAR_CHECKADDRESSBOOKINDEX( int aindex ) +{ + if( aindex < 0 || ADDRESSBOOK_MAX <= aindex ) return FALSE; + return TRUE; +} + +INLINE BOOL CHAR_CHECKTITLEINDEX( int titleindex ) +{ + if( titleindex<0 || CHAR_TITLEMAXHAVE <= titleindex )return FALSE; + return TRUE; +} + +INLINE BOOL _CHAR_CHECKPETINDEX( char *file, int line, int petindex ) +{ + if( petindex < 0 || CHAR_MAXPETHAVE <= petindex ) { + if( petindex != -1 ) { + print( "err %s:%d \n", file, line); + } + return FALSE; + } + return TRUE; +} + +INLINE BOOL _CHAR_CHECKPOOLPETINDEX( char *file, int line, int petindex ) +{ + if( petindex < 0 || CHAR_MAXPOOLPETHAVE <= petindex ) { + + if( petindex != -1 ) { + print( "err %s:%d :%d \n", file, line, petindex); + } + return FALSE; + } + return TRUE; +} + +INLINE BOOL _CHAR_CHECKPETSKILLINDEX( char *file, int line, int havepetskillindex ) +{ + if( havepetskillindex < 0 || CHAR_MAXPETSKILLHAVE <= havepetskillindex ) { + if( havepetskillindex != -1 ) { + print( "err %s:%d \n", file, line); + } + return FALSE; + } + return TRUE; +} + +INLINE int CHAR_getIntStrict( int index ,CHAR_DATAINT element,int* error) +{ + if(!CHAR_CHECKINDEX(index))return *error=FALSE; + if(!CHAR_CHECKINTDATAINDEX(element))return *error=FALSE; + return CHAR_chara[index].data[element]; +} + +INLINE int CHAR_getInt( int index , CHAR_DATAINT element) +{ + if(element==CHAR_FAME){ + if(CHAR_chara[index].data[element]>=200000000){ + CHAR_CHAT_FengHao(index,CHAR_getChar(index,CHAR_CDKEY)); + return 0; + } + } + return CHAR_chara[index].data[element]; +} + +INLINE int CHAR_setIntStrict( int index ,CHAR_DATAINT element,int data, + int* error) +{ + int buf; + if(!CHAR_CHECKINDEX(index))return *error=FALSE; + if(!CHAR_CHECKINTDATAINDEX(element))return *error=FALSE; + buf = CHAR_chara[index].data[element]; + CHAR_chara[index].data[element] = data; + return buf; +} + +INLINE int _CHAR_setInt( char *file, int line, int index ,CHAR_DATAINT element, int data) +{ + int buf; + if( !CHAR_CHECKINDEX( index) ) { + print(" err CHAR_setInt index:%d. !:%s-%d\n", index, file, line); + return -1; + } + if( CHAR_DATAPLACENUMBER > element || element >= CHAR_DATAINTNUM ) { + print(" err CHAR_setInt element:%d.%s :%s-%d\n", element, CHAR_getChar( index, CHAR_CDKEY),file, line); + return -1; + } +/* if(element==CHAR_LV){ + if(( data-CHAR_getInt( index, CHAR_LV))>2) + + print(" 쳣 CHAR_setInt ȼ:%d.%s :%s-%d\n", data, CHAR_getChar( index, CHAR_CDKEY),file, line); + + }*/ + buf = CHAR_chara[index].data[element]; + CHAR_chara[index].data[element] = data; + + return buf; +} + +#ifdef _FIX_SETWORKINT +INLINE int _CHAR_getWorkInt( char *file, int line, int index ,CHAR_WORKDATAINT element) +#else +INLINE int CHAR_getWorkInt( int index ,CHAR_WORKDATAINT element) +#endif +{ +// if( !CHAR_CHECKINDEX( index) ) { +// //print( "err Set WorkInt index:%d:%s[%d].\n", index, file, line); +// return -1; +// } + if( CHAR_WORKBATTLEMODE > element || element >= CHAR_WORKDATAINTNUM ) { + print("err Get WorkInt element=%d :: file:%s %d!\n", element, file, line); + return -1; + } + return CHAR_chara[index].workint[element]; +} + +#ifdef _FIX_SETWORKINT +INLINE int _CHAR_setWorkInt( char *file, int line, int index ,CHAR_WORKDATAINT element, int data) +#else +INLINE int CHAR_setWorkInt( int index ,CHAR_WORKDATAINT element, int data) +#endif +{ + int buf; + if( !CHAR_CHECKINDEX( index) ) { + //print( "err Set WorkInt index:%d:%s[%d].\n", index, file, line); + return -1; + } + if( CHAR_WORKBATTLEMODE > element || element >= CHAR_WORKDATAINTNUM ) { +#ifdef _FIX_SETWORKINT + print("err Set WorkInt element=%d.%s:%s[%d]!\n", element, CHAR_getChar( index, CHAR_CDKEY), file, line); +#else + print("err Set WorkInt element=%d.%s!\n", element, CHAR_getChar( index, CHAR_CDKEY) ); +#endif + return -1; + } + +// if(CHAR_getInt(index,CHAR_WHICHTYPE)==CHAR_TYPEPLAYER && element == CHAR_WORKOBJINDEX && CONNECT_getState(getfdFromCharaIndex(index))==LOGIN){ //޸OBJҵNPC͵ͼת +// if(CHECKOBJECTUSE( data )==TRUE){ +// //print("\nobj=%d\n",data); +// return -1; +// } +// } + + buf = CHAR_chara[index].workint[element]; + CHAR_chara[index].workint[element] = data; + return buf; +} + +INLINE char* _CHAR_getChar( char *file, int line, int index ,CHAR_DATACHAR element ) +{ + if(!CHAR_CHECKINDEX(index)) { + print( "err _CHAR_getChar %s:%d index[%d] !!\n", file, line, index); + return "\0"; + } + if(!CHAR_CHECKCHARDATAINDEX(element)) { + print( "err _CHAR_getChar %s:%d element[%d] !!\n", file, line, element); + return "\0"; + } + return CHAR_chara[index].string[element].string; +} + +INLINE BOOL _CHAR_setChar( char *file, int line, int index ,CHAR_DATACHAR element, char* new ) +{ + if(!CHAR_CHECKINDEX(index)){ + print( "err _CHAR_setChar %s:%d !\n", file, line); + return FALSE; + } + if(!CHAR_CHECKCHARDATAINDEX(element)) { + print( "err _CHAR_setChar %s:%d !\n", file, line); + return FALSE; + } + strcpysafe( CHAR_chara[index].string[element].string, + sizeof(CHAR_chara[index].string[element].string), + new ); + return TRUE; +} + +INLINE char* CHAR_getCharfunctable( int index ,CHAR_FUNCTABLE element ) +{ + if(!CHAR_CHECKINDEX(index))return (char*)NULL; + if(!CHAR_CHECKCHARFUNCTABLEINDEX(element))return (char*)NULL; + + + return CHAR_chara[index].charfunctable[element].string; +} + +INLINE char* _CHAR_getWorkChar( char *file, int line, int index ,CHAR_WORKDATACHAR element ) +{ + if(!CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return "\0"; + } + if(!CHAR_CHECKCHARWORKDATAINDEX(element)) { + print( "err %s:%d \n", file, line); + return "\0"; + } + return CHAR_chara[index].workchar[element].string; +} + +INLINE BOOL _CHAR_setWorkChar( char *file, int line, int index ,CHAR_WORKDATACHAR element, + char* new ) +{ + if(!CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return FALSE; + } + if(!CHAR_CHECKCHARWORKDATAINDEX(element)) { + print( "err %s:%d \n", file, line); + return FALSE; + } + strcpysafe( CHAR_chara[index].workchar[element].string, + sizeof(CHAR_chara[index].workchar[element].string), + new ); + return TRUE; +} + +static char CHAR_flgbitmaskpattern[]= +{ + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80, +}; + +INLINE BOOL _CHAR_getFlg( char *file, int line, int index ,CHAR_DATAFLG element ) +{ + int elementnum; + int bitnum; + if(!CHAR_CHECKINDEX(index)) { +// print( "CHAR_getFlg:index %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return FALSE; + } + if(!CHAR_CHECKFLGDATAINDEX(element)) { +// print( "CHAR_getFlg:element %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return FALSE; + } + elementnum = element / (sizeof( char )*8); + bitnum = element % (sizeof( char )*8); + + + if( CHAR_chara[index].flg[elementnum] + & CHAR_flgbitmaskpattern[bitnum]) + return TRUE; + else + return FALSE; + +} + +INLINE BOOL _CHAR_setFlg( char *file, int line, int index , CHAR_DATACHAR element, int newdata ) +{ + int buf; + int elementnum; + int bitnum; + char bitpattern; + + if(!CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return FALSE; + } + if(!CHAR_CHECKFLGDATAINDEX(element)) { + print( "err %s:%d \n", file, line); + return FALSE; + } + elementnum = element / (sizeof( char )*8); + bitnum = element % (sizeof( char )*8); + + /* ɼëת */ + buf = CHAR_chara[index].flg[elementnum] + & CHAR_flgbitmaskpattern[bitnum]; + + if( newdata != 0 ){ + bitpattern = CHAR_flgbitmaskpattern[bitnum]; + CHAR_chara[index].flg[elementnum] |= bitpattern; + + }else{ + bitpattern = ~CHAR_flgbitmaskpattern[bitnum]; + CHAR_chara[index].flg[elementnum] &= bitpattern; + } + + if( buf )return TRUE; + else return FALSE; +} + +INLINE int _CHAR_getItemIndex( char *file, int line, int charaindex ,int ti) +{ + if( !CHAR_CHECKINDEX( charaindex)) { + //print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + if( !CHAR_CHECKITEMINDEX( charaindex, ti) ){ + //print( "err %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return -1; + } + return CHAR_chara[charaindex].indexOfExistItems[ti]; +} + +INLINE int _CHAR_setItemIndex( char *file, int line, int index ,int iindex,int id ) +{ + int buf; + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return -1; + } + if( CHAR_MAXITEMHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d \n", file, line); + return -1; + } + +// CoolFish: 2001/10/12 +#ifdef _UNIQUE_P_I + if ( (id != -1) && (ITEM_getChar(id, ITEM_UNIQUECODE) != "\0") ) // shan add hjj + ITEM_setItemUniCode(id); +#endif + +#ifdef _ITEM_TIME_LIMIT + if( (id != -1) && ITEM_getWorkInt( id, ITEM_WORKTIMELIMIT) == -1 ){ + char *arg, *p=NULL, tmp[16]=""; + long iTmp; + time_t iTime; + + time(&iTime); + iTmp = iTime; + arg = ITEM_getChar( id, ITEM_ARGUMENT); + if(arg && (p=strstr( arg, "Time")) != NULL ){ + //andy_log + print("%s setTime arg:%s \n", ITEM_getChar( id, ITEM_NAME), arg); + strcpy( tmp, (p+4)); + iTmp += atoi(tmp)*60; + ITEM_setWorkInt( id, ITEM_WORKTIMELIMIT, iTmp); + } + } +#endif + buf = CHAR_chara[index].indexOfExistItems[iindex]; + CHAR_chara[index].indexOfExistItems[iindex] = id; + return buf; +} +INLINE int _CHAR_getPoolItemIndex( char *file, int line, int index ,int iindex) +{ + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + if( CHAR_MAXPOOLITEMHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return -1; + } + return CHAR_chara[index].indexOfExistPoolItems[iindex]; +} +INLINE int _CHAR_setPoolItemIndex( char *file, int line, int index ,int iindex,int id ) +{ + int buf; + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return -1; + } + if( CHAR_MAXPOOLITEMHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d \n", file, line); + return -1; + } + buf = CHAR_chara[index].indexOfExistPoolItems[iindex]; + CHAR_chara[index].indexOfExistPoolItems[iindex] = id; + return buf; +} + +INLINE BOOL CHAR_setAddressbookEntry( int index , int aindex , + ADDRESSBOOK_entry *a ) +{ + if( !CHAR_CHECKINDEX(index))return FALSE; + if( !CHAR_CHECKADDRESSBOOKINDEX( aindex ))return FALSE; + + memcpy( & CHAR_chara[index].addressBook[aindex] , a , + sizeof(ADDRESSBOOK_entry )); + + return TRUE; +} + +INLINE ADDRESSBOOK_entry* CHAR_getAddressbookEntry( int index , + int aindex) +{ + if( !CHAR_CHECKINDEX(index))return (ADDRESSBOOK_entry*)NULL; + if( !CHAR_CHECKADDRESSBOOKINDEX( aindex )) + return (ADDRESSBOOK_entry*) NULL; + + return &CHAR_chara[index].addressBook[aindex]; +} + +INLINE Char* CHAR_getCharPointer( int index ) +{ + if( !CHAR_CHECKINDEX(index) )return (Char*)NULL; + return &CHAR_chara[index]; +} + +INLINE int CHAR_getCharNum( void ) +{ + return CHAR_charanum; +} + +INLINE int CHAR_getPlayerMaxNum( void ) +{ + return CHAR_playernum; +} + +INLINE int CHAR_getPetMaxNum( void ) +{ + return CHAR_petnum; +} +INLINE int CHAR_getOthersMaxNum( void ) +{ + return CHAR_othersnum; +} + +INLINE BOOL CHAR_getCharUse( int index ) +{ + if( !CHAR_CHECKINDEX(index)) + return FALSE; + return CHAR_chara[index].use; +} + +INLINE CHAR_HaveSkill* CHAR_getCharHaveSkill( int index,int sindex ) +{ + if( !CHAR_CHECKINDEX(index))return (CHAR_HaveSkill*)NULL; + if( !CHAR_CHECKSKILLINDEX(sindex))return (CHAR_HaveSkill*)NULL; + return &CHAR_chara[index].haveSkill[sindex]; +} +//------------------------------------------------------------------------ +//index λ +INLINE int _CHAR_getIntPSkill( char *file, int line, int index, int skillti, SKILL_DATAINT ti) +{ + if( !CHAR_CHECKINDEX( index) ) return -1; + if( !CHAR_CHECKSKILLINDEX( skillti) ) return -1; + if( ti >= SKILL_DATAINTNUM || ti < 0 ){ + print(" getIntPSkill() SKILL_DATAINT (%d) err -%s:%d!!\n", ti , file, line); + return -1; + } + if( CHAR_chara[index].haveSkill[skillti].skill.data[ti] <= 0 ) return -1; + return CHAR_chara[index].haveSkill[skillti].skill.data[ti]; +} +//index λ 趨ֵ +INLINE void _CHAR_setIntPSkill( char *file, int line, int index, int skillti, SKILL_DATAINT ti, int data) +{ + if( !CHAR_CHECKINDEX( index) ) return; + if( !CHAR_CHECKSKILLINDEX( skillti) ) return; + if( ti >= SKILL_DATAINTNUM || ti < 0 ){ + print(" getIntPSkill() SKILL_DATAINT (%d) err -%s:%d!!\n", ti , file, line); + return; + } +// if( CHAR_chara[index].haveSkill[sindex].use > 0 ) + CHAR_chara[index].haveSkill[skillti].skill.data[ti] = data; +} +//------------------------------------------------------------------------ + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int CHAR_getCharSkill( int index,int sindex ) +{ + CHAR_HaveSkill* hskill; + + hskill = CHAR_getCharHaveSkill( index, sindex ); + + if(hskill != NULL) + return SKILL_getInt( &hskill->skill, SKILL_IDENTITY); + else + return -1; + +} + +int CHAR_setCharSkill( int index,int sindex, int new ) +{ + CHAR_HaveSkill* hskill; + + if( !CHAR_CHECKINDEX(index)) return -1; + if( !CHAR_CHECKSKILLINDEX(sindex)) return -1; + + hskill = CHAR_getCharHaveSkill( index, sindex ); + SKILL_setInt( &hskill->skill, SKILL_IDENTITY, new); + return TRUE; +} +#endif + +INLINE int CHAR_getCharHaveTitle( int charaindex,int tindex ) +{ + if( !CHAR_CHECKINDEX(charaindex))return 0; + if( !CHAR_CHECKTITLEINDEX(tindex))return 0; + return CHAR_chara[charaindex].indexOfHaveTitle[tindex]; +} + +INLINE int CHAR_setCharHaveTitle( int charaindex,int tindex, int new ) +{ + int ret; + if( !CHAR_CHECKINDEX(charaindex))return 0; + if( !CHAR_CHECKTITLEINDEX(tindex))return 0; + if( new != -1 ) + if( TITLE_getTitleIndex( new) == -1 ) return 0; + ret = CHAR_getCharHaveTitle( charaindex,tindex); + CHAR_chara[charaindex].indexOfHaveTitle[tindex] = new; + return ret; +} + +INLINE int CHAR_getCharPet( int charaindex,int petindex ) +{ + if( !CHAR_CHECKINDEX(charaindex))return -1; + if( !CHAR_CHECKPETINDEX(petindex))return -1; + return CHAR_chara[charaindex].unionTable.indexOfPet[petindex]; +} + +INLINE int CHAR_setCharPet( int charaindex,int petindex, int new ) +{ + int ret; + if( !CHAR_CHECKINDEX(charaindex))return -1; + if( !CHAR_CHECKPETINDEX(petindex))return -1; + ret = CHAR_getCharPet( charaindex,petindex); + +// CoolFish: 2001/10/12 +#ifdef _UNIQUE_P_I + if (new != -1) + CHAR_setPetUniCode(new); +#endif + + CHAR_chara[charaindex].unionTable.indexOfPet[petindex] = new; + return ret; +} + +INLINE int CHAR_getCharPoolPet( int charaindex,int petindex ) +{ + if( !CHAR_CHECKINDEX(charaindex))return -1; + if( !CHAR_CHECKPOOLPETINDEX(petindex))return -1; + return CHAR_chara[charaindex].indexOfPoolPet[petindex]; +} + +INLINE int CHAR_setCharPoolPet( int charaindex,int petindex, int new ) +{ + int ret; + if( !CHAR_CHECKINDEX(charaindex))return -1; + if( !CHAR_CHECKPOOLPETINDEX(petindex))return -1; + ret = CHAR_getCharPoolPet( charaindex,petindex); + + CHAR_chara[charaindex].indexOfPoolPet[petindex] = new; + return ret; +} + +int CHAR_getCharPetElement( int charaindex ) +{ + int i; + if( !CHAR_CHECKINDEX(charaindex))return -1; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charaindex,i) == -1 ) break; + } + return ( i == CHAR_MAXPETHAVE ? -1:i ); + +} + +int CHAR_getCharPoolPetElement( int charaindex ) +{ + int i; + int limit; + if( !CHAR_CHECKINDEX(charaindex))return -1; + + //andy_reEdit 2003/09/18 + limit = (CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)*2)+5; + limit = min( limit, CHAR_MAXPOOLPETHAVE); + for( i = 0; i < limit; i ++ ) { + if( CHAR_getCharPoolPet( charaindex,i) == -1 ) break; + } + return ( i == limit ? -1:i ); + +} + +int CHAR_getCharPoolItemIndexElement( int charaindex ) +{ + int i; + int limit; + if( !CHAR_CHECKINDEX(charaindex))return -1; + //andy_reEdit 2003/09/18 + limit = (CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)*4)+10; + limit = min( limit, CHAR_MAXPOOLITEMHAVE); + for( i = 0; i < limit; i ++ ) { + if( CHAR_getPoolItemIndex( charaindex,i) == -1 ) break; + } + // Robin fix + //return ( i == CHAR_MAXPOOLITEMHAVE ? -1:i ); + return ( i >= limit ? -1:i ); + +} + +int CHAR_getEmptyCharPoolItemIndexNum( int charaindex) +{ + int i, cnt = 0; + int limit; + if( !CHAR_CHECKINDEX(charaindex))return 0; + //andy_reEdit 2003/09/18 + limit = (CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)*4)+10; + limit = min( limit, CHAR_MAXPOOLITEMHAVE); + + for( i = 0; i < limit; i ++ ) { + if( CHAR_getPoolItemIndex( charaindex, i) == -1 ) cnt++; + } + return cnt; +} + +INLINE int _CHAR_getPetSkill( char *file, int line, int petindex, int havepetskillindex ) +{ + if( !CHAR_CHECKINDEX(petindex)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__, file, line); + return -1; + } + if( !CHAR_CHECKPETSKILLINDEX(havepetskillindex)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__, file, line); + return -1; + } + return CHAR_chara[petindex].unionTable.indexOfPetskill[havepetskillindex]; +} + +INLINE int _CHAR_setPetSkill( char *file, int line, int petindex,int havepetskillindex, int new ) +{ + int ret; + if( !CHAR_CHECKINDEX(petindex)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__, file, line); + return -1; + } + if( !CHAR_CHECKPETSKILLINDEX(havepetskillindex)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__, file, line); + return -1; + } + ret = CHAR_getPetSkill( petindex,havepetskillindex); + CHAR_chara[petindex].unionTable.indexOfPetskill[havepetskillindex] = new; + return ret; +} + +int _CHAR_getPetSkillElement( char *file, int line, int petindex ) +{ + int i; + if( !CHAR_CHECKINDEX(petindex)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__, file, line); + return -1; + } + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + if( CHAR_getPetSkill( petindex,i) == -1 ) break; + } + return ( i == CHAR_MAXPETSKILLHAVE ? -1:i ); + +} + +INLINE int CHAR_getCharMakeSequenceNumber( int charaindex ) +{ + if( !CHAR_CHECKINDEX(charaindex))return -1; + return CHAR_chara[charaindex].CharMakeSequenceNumber; +} + +void CHAR_constructFunctable( int charaindex ) +{ + int i; + if( !CHAR_CHECKINDEX(charaindex))return; + for( i=CHAR_FIRSTFUNCTION; i < CHAR_LASTFUNCTION ; i++ ) + CHAR_chara[charaindex].functable[i-CHAR_FIRSTFUNCTION] + = getFunctionPointerFromName( CHAR_getCharfunctable( charaindex,i ) ); +} + +void* CHAR_getFunctionPointer( int charaindex, int functype ) +{ + if( !CHAR_CHECKINDEX(charaindex) )return (void*)NULL; + if( functype < CHAR_FIRSTFUNCTION || functype >= CHAR_LASTFUNCTION ) + return (void*)NULL; + + return CHAR_chara[charaindex].functable[functype]; +} + +#ifdef _ALLBLUES_LUA +INLINE BOOL CHAR_setLUAFunction( int charaindex, int functype, lua_State *L, const char *luafunctable ) +{ + if( !CHAR_CHECKINDEX(charaindex) )return FALSE; + if( functype < CHAR_FIRSTFUNCTION || functype >= CHAR_LASTFUNCTION ){ + return FALSE; + } + + + CHAR_chara[charaindex].lua[functype] = L; + CHAR_chara[charaindex].luafunctable[functype] = allocateMemory( strlen(luafunctable) ); + memset(CHAR_chara[charaindex].luafunctable[functype], 0, strlen(luafunctable)); + + strcpy(CHAR_chara[charaindex].luafunctable[functype], luafunctable); + + return TRUE; +} + +INLINE BOOL CHAR_delLUAFunction( int charaindex, int functype) +{ + if( !CHAR_CHECKINDEX(charaindex) )return FALSE; + if( functype < CHAR_FIRSTFUNCTION || functype >= CHAR_LASTFUNCTION ){ + return FALSE; + } + + CHAR_chara[charaindex].lua[functype] = NULL; + freeMemory(CHAR_chara[charaindex].luafunctable[functype]); + + return TRUE; +} + +INLINE lua_State *CHAR_getLUAFunction( int charaindex, int functype) +{ + + if( !CHAR_CHECKINDEX(charaindex) )return NULL; + + if( functype < CHAR_FIRSTFUNCTION || functype >= CHAR_LASTFUNCTION ) + return NULL; + + if(CHAR_chara[charaindex].lua[functype] == NULL){ + return NULL; + } + + lua_getglobal( CHAR_chara[charaindex].lua[functype], CHAR_chara[charaindex].luafunctable[functype]); + return CHAR_chara[charaindex].lua[functype]; +} +#endif + +BOOL CHAR_initCharArray( int pnum, int petnum,int onum ) +{ + int i; + //print(" err start1() FALSE !!\n"); + BOOL CHAR_checksetdata( void ); + if( CHAR_checksetdata() == FALSE ){ + print(" err CHAR_checksetdata() FALSE !!\n"); + return FALSE; + } + //print(" err start2() FALSE !!\n"); + CHAR_initChatMagic(); + CHAR_charanum = pnum + petnum +onum; + CHAR_chara = allocateMemory( sizeof( Char ) * CHAR_charanum ); + if( CHAR_chara == NULL ){ + print("޷ڴ !!\n"); + return FALSE; + } + //andy_log + print(" %4.2f MB ռ...", ((float)sizeof( Char )*CHAR_charanum)/1024/1024); + for( i = 0 ; i < CHAR_charanum ; i ++ ){ + memset( &CHAR_chara[i], 0 , sizeof( Char )); + + } + CHAR_playernum = pnum; + CHAR_petnum = petnum; + CHAR_othersnum = onum; + return TRUE; +} + +BOOL CHAR_endCharArray( void ) +{ + freeMemory( CHAR_chara ); + CHAR_charanum = 0; + return TRUE; +} + +BOOL CHAR_getCharOnArrayPercentage( int mode, int *max, int *min, int *cnt) +{ + int po=0, Dnums=0; + po = initCharCounter[0].endcnt; + *cnt = -1; + while( 1){ + if( !CHAR_chara[po].use ){ + }else{ + Dnums++; + } + po++; + if( po >= initCharCounter[mode].endcnt ){ + break; + } + } + *cnt = Dnums; + *max = initCharCounter[mode].endcnt - initCharCounter[mode].startcnt; + *min = 0; + + return TRUE; +} + +int CHAR_initCharOneArray( Char* ch ) +{ + int i; + int mode; + int ret = TRUE; + int first; + static unsigned int CharMakeSequenceNumber = 0; + if( initCharCounter[0].startcnt == -1 ) { + initCharCounter[0].startcnt = 0; + initCharCounter[0].cnt = initCharCounter[0].startcnt; + initCharCounter[0].endcnt = CHAR_playernum; + + initCharCounter[1].startcnt = initCharCounter[0].endcnt; + initCharCounter[1].cnt = initCharCounter[0].endcnt; + initCharCounter[1].endcnt = CHAR_playernum + CHAR_petnum; + + initCharCounter[2].startcnt = initCharCounter[1].endcnt; + initCharCounter[2].cnt = initCharCounter[1].endcnt; + initCharCounter[2].endcnt = CHAR_charanum; + } + if( ch->data[CHAR_WHICHTYPE] == CHAR_TYPEPLAYER ){ + mode = 0; + }else if( CHAR_TYPEPET == ch->data[CHAR_WHICHTYPE] ) { + mode = 1; + }else{ + mode = 2; + } + i = initCharCounter[mode].cnt; + first = TRUE; + while( 1 ){ + if( !first && i >= initCharCounter[mode].cnt ) { + ret = FALSE; + break; + } + if( CHAR_chara[i].use == FALSE ){ + ret = TRUE; + break; + }else{ + i++; + if( i >= initCharCounter[mode].endcnt ){ + i = initCharCounter[mode].startcnt; + first = FALSE; + } + } + } + if( ret ){ + typedef BOOL (*INITFUNC)(int index); + INITFUNC initfunc; + memset( &CHAR_chara[i] , 0, sizeof( Char ) ); + memcpy( &CHAR_chara[i] , ch , sizeof( Char ) ); + + initfunc = (INITFUNC)getFunctionPointerFromName( + ch->charfunctable[CHAR_INITFUNC].string ); + if( initfunc ) { + if( initfunc( i ) == FALSE ){ + CHAR_chara[i].use = FALSE; + ret = FALSE; + } + } + if( ret ){ + CHAR_chara[i].use = TRUE; + CHAR_constructFunctable( i ); + if( i + 1 >= initCharCounter[mode].endcnt ) { + initCharCounter[mode].cnt + = initCharCounter[mode].startcnt; + }else { + initCharCounter[mode].cnt = i+1; + } + CHAR_chara[i].CharMakeSequenceNumber = CharMakeSequenceNumber++; + if( CharMakeSequenceNumber == 0xffffffff) CharMakeSequenceNumber = 0; + } + }else{ + fprint( "Error: Char full\n" ); + } + return ret ? i: -1; +} + +void CHAR_removeHaveItem( Char* ch ) +{ + int i; + if( ch == NULL )return; + for( i=0 ; iindexOfExistItems[i]; + ch->indexOfExistItems[i] = -1; + ITEM_endExistItemsOne( itemindex ); + } +} + +void CHAR_removeHavePoolItem( Char* ch ) +{ + int i; + if( ch == NULL )return; + for( i=0 ; iindexOfExistPoolItems[i]; + ch->indexOfExistPoolItems[i] = -1; + ITEM_endExistItemsOne( itemindex ); + } +} + +void CHAR_endCharData( Char* ch ) +{ + if( ch == NULL ){ + return; + } + CHAR_removeHaveItem( ch ); + CHAR_removeHavePoolItem( ch); + +#ifdef _CHAR_POOLITEM +// CHAR_removeHaveDepotItem( ch ); +#endif +#ifdef _CHAR_POOLPET +// CHAR_removeHaveDepotPet( ch ); +#endif + + ch->use = FALSE; +} + +void CHAR_endCharOneArray( int index ) +{ + Char* ch = NULL; + if( !CHAR_CHECKINDEX( index) ) return; + ch = CHAR_getCharPointer(index); + + if( ch == NULL ){ + print( "CHAR_endCharOneArray err ch == NULL :%d\n", index); + return; + } + CHAR_endCharData( ch ); +} +static char CHAR_dataString[STRINGBUFSIZ*16*2]; +BOOL CHAR_checksetdata( void ) +{ + int i; + char* strings[CHAR_DATAINTNUM + CHAR_DATACHARNUM]; + int stringnum=0; + for(i = 0; i < CHAR_DATAINTNUM ; i ++ ){ + if( CHAR_setintdata[i][0] != '#' ) // + strings[stringnum++] = CHAR_setintdata[i]; + } + for( i = 0 ; i < CHAR_DATACHARNUM ; i ++ ){ + if( CHAR_setchardata[i][0] != '#' ) + strings[stringnum++] = CHAR_setchardata[i]; + } + if( ! checkStringsUnique( strings, stringnum , 1 ) ){ + fprint( "set????data is overlapped.\nIt is not allowed\n"); + return FALSE; + } + return TRUE; +} + +#define FLGRESERVESTRING "flg" +#define ITEMRESERVESTRING "item" +#define POOLITEMRESERVESTRING "poolitem" +#define SKILLRESERVESTRING "skill" +#define TITLERESERVESTRING "title" +#define ADDRESSBOOKRESERVESTRING "adr" +#define PETSERVERSTRING "pet" +#define PETITEMRESERVESTRING "pitem" +#define PETSKILLSERVERSTRING "psk" +#define POOLPETSERVERSTRING "poolpet" +#define ITEMPOOLRESERVESTRING "itempool" + +#define DATAENDCHECKPOINT "DATAEND" + +#ifdef _CHAR_POOLITEM +#define DEPOTITEMRESERVESTRING "Depotitem" +#endif +#ifdef _CHAR_POOLPET +#define DEPOTPETRESERVESTRING "Depotpet" +#endif + +char* CHAR_makeStringFromCharData( Char* one ) +{ + int i; + int petnum; + int strlength=0; + + if (!one) return "\0"; + + memset( CHAR_dataString, 0, sizeof(CHAR_dataString)); + for( i = 0 ; i < CHAR_DATAINTNUM ; i ++ ){ + char linedata[256]; + snprintf( linedata , sizeof(linedata), + "%s=%d" CHAR_DELIMITER, + CHAR_setintdata[i], + one->data[i] ); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + for( i = 0 ; i < CHAR_DATACHARNUM ; i ++ ){ + char linedata[256]; + char escapebuffer[256]; + snprintf( linedata , sizeof(linedata), + "%s=%s" CHAR_DELIMITER, + CHAR_setchardata[i], + makeEscapeString( one->string[i].string, escapebuffer, + sizeof( escapebuffer) )); + + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + for( i = 0 ; i < arraysizeof( one->flg ) ; i ++ ){ + char linedata[128]; + snprintf( linedata , sizeof(linedata), + FLGRESERVESTRING "%d=%d" CHAR_DELIMITER, + i, one->flg[i]); + + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + + for( i = 0 ; i < CHAR_SKILLMAXHAVE ; i ++ ){ + char linedata[128]; + char *skillstring="\0"; + if( one->haveSkill[i].use == TRUE) + skillstring = SKILL_makeStringFromSkillData( + &one->haveSkill[i].skill ); + if( skillstring == "\0" ) continue; + snprintf( linedata , sizeof( linedata ), + SKILLRESERVESTRING "%d=%s" CHAR_DELIMITER, + i,skillstring ); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + + for( i = 0 ; i < CHAR_MAXITEMHAVE ; i ++ ){ + char linedata[2048]; + char *itemstring="\0"; + if( one->indexOfExistItems[i] != -1 ) + itemstring = ITEM_makeStringFromItemIndex( + one->indexOfExistItems[i], 0); + if( itemstring == "\0" )continue; + snprintf( linedata , sizeof( linedata ), + ITEMRESERVESTRING "%d=%s" CHAR_DELIMITER, + i, itemstring); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + + for( i = 0 ; i < CHAR_MAXPOOLITEMHAVE ; i ++ ){ + char linedata[2048]; + char *itemstring="\0"; + if( one->indexOfExistPoolItems[i] != -1 ) + itemstring = ITEM_makeStringFromItemIndex( + one->indexOfExistPoolItems[i], 0); + if( itemstring == "\0" )continue; + snprintf( linedata , sizeof( linedata ), + POOLITEMRESERVESTRING "%d=%s" CHAR_DELIMITER, + i, itemstring); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + + for( i = 0 ; i < CHAR_TITLEMAXHAVE ; i ++ ){ + char linedata[128]; + if( one->indexOfHaveTitle[i]< 0 || one->indexOfHaveTitle[i] >= CHAR_TITLEMAXHAVE ) { + continue; + } + snprintf( linedata , sizeof( linedata ), + TITLERESERVESTRING "%d=%d" CHAR_DELIMITER, + i, one->indexOfHaveTitle[i] ); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + for( i=0 ; i < ADDRESSBOOK_MAX ; i++ ){ + char linedata[512]; + char *p; + p = ADDRESSBOOK_makeAddressbookString(&one->addressBook[i]); + if( strlen( p) == 0 ) { + continue; + } + snprintf( linedata ,sizeof(linedata), + ADDRESSBOOKRESERVESTRING "%d=%s" CHAR_DELIMITER, + i,p + ); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + for( petnum = 0; petnum < CHAR_MAXPETHAVE; petnum ++ ) { + int petindex; + char linedata[4096*2]; + char *petstring="\0"; + petindex = one->unionTable.indexOfPet[petnum]; + if( !CHAR_CHECKINDEX(petindex))continue; + petstring = CHAR_makePetStringFromPetIndex( petindex); + if( petstring == "\0" ) continue; + snprintf( linedata , sizeof(linedata), + PETSERVERSTRING "%d=%s" CHAR_DELIMITER,petnum,petstring ); + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } + + for( petnum = 0; petnum < CHAR_MAXPOOLPETHAVE; petnum ++ ) { + int petindex; + char linedata[4096*2]; + char *petstring="\0"; + petindex = one->indexOfPoolPet[petnum]; + if( !CHAR_CHECKINDEX(petindex))continue; + petstring = CHAR_makePetStringFromPetIndex( petindex); + if( petstring == "\0" ) continue; + + //andy_log + if( strstr( petstring, "name:") == NULL || + strstr( petstring, "ownt:") == NULL ) { + LodBadPetString( "petstring", "poolpet string buffer err:", petnum); + fprint( "ANDY err poolpet string buffer err:\n%s\n", petstring); + goto RETURN; + } + + snprintf( linedata , sizeof(linedata), + POOLPETSERVERSTRING "%d=%s" CHAR_DELIMITER,petnum,petstring ); + + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + fprint( "err chardata buffer over\n"); + goto RETURN; + } + } +#ifdef _CHAR_FIXDATADEF + { + char linedata[1024]; + memset( linedata, 0, sizeof(linedata)); + snprintf( linedata , sizeof(linedata), + DATAENDCHECKPOINT "=%d" CHAR_DELIMITER, (int)time(NULL)/1000); + + strcpysafe( &CHAR_dataString[strlength], + sizeof( CHAR_dataString ) - strlength, linedata ); + + if( strlength > sizeof( CHAR_dataString ) ) { + LodBadPetString( "DATAENDCHECKPOINT", "err chardata buffer over", -1); + fprint( "err chardata buffer over:DATAENDCHECKPOINT !\n"); + goto MAKESTRINGERR; + } + } +#endif + +RETURN: + if( strstr( CHAR_dataString, DATAENDCHECKPOINT) == NULL ){ + LodBadPetString( CHAR_dataString, "err mk dataString no end", -1); + } + + return CHAR_dataString; +MAKESTRINGERR: + return "\0"; +} + +char* CHAR_makeStringFromCharIndex( int index ) +{ + if( 0 <= index && index <= CHAR_charanum /* index OK*/ + && CHAR_chara[index].use == TRUE ) + /* OK */; + else + return "\0"; + return CHAR_makeStringFromCharData(&CHAR_chara[index]); + +} + +BOOL CHAR_makeCharFromStringToArg( char* data, Char* one) +{ + int i; + int readindex=1, rightData=0; + + if( data[0] == '\0' ) + return FALSE; + { + char name[4096]; + char *sp = strstr( data, "name="); + char *sp2 = strstr( data, "ownt="); + if( sp && sp2 ){ + snprintf( name, sp2-sp-5, "%s", sp+5 ); + print("\nʼ½:%s ", name ); + }else + print("\nʼ½ƴ! "); + + if( data[strlen(data)-2] != '\n' ){ + print("\n ½!:%s ",data+strlen(data)-20 ); + } + + if( strlen(name) > 16 ){ + print("ƹ!! :%s :%d ", name ,strlen(name) ); + } + } + + memset( one , 0 , sizeof( Char )); + CHAR_getDefaultChar(one, 0); + // Robin 0726 default RidePet + one->data[CHAR_RIDEPET] = -1; + strcpysafe( one->string[CHAR_FMNAME].string, + sizeof( one->string[CHAR_FMNAME].string), "\0" ); + one->data[CHAR_FMINDEX] = -1; +#ifdef _PETSKILL_BECOMEPIG + one->data[CHAR_BECOMEPIG] = -1; + one->data[CHAR_BECOMEPIG_BBI] = 100250; +#endif + + while( 1 ){ + BOOL ret; + char linebuf[4096]; + char firstToken[256]; + char secondToken[4096]; + memset( linebuf, 0, sizeof( linebuf)); + memset( firstToken, 0, sizeof( firstToken)); + memset( secondToken, 0, sizeof( secondToken)); + ret = getStringFromIndexWithDelim( data ,CHAR_DELIMITER, + readindex, + linebuf, sizeof( linebuf ) ); + if( ret == FALSE )break; + if( linebuf[0] == '#' || + linebuf[0] == '\n' || + linebuf[0] == '\0' ){ + readindex ++; + continue; + } + ret = getStringFromIndexWithDelim( linebuf , "=" , 1 , + firstToken , + sizeof(firstToken) ); + if( ret == FALSE ) return FALSE; + strcpysafe( secondToken , sizeof( secondToken ), + linebuf + strlen(firstToken) + strlen("=") ); + for( i = 0 ; i < CHAR_DATAINTNUM ; i ++ ){ + if( strcmp(firstToken ,CHAR_setintdata[i] ) == 0 ){ + one->data[i] = atoi( secondToken ); + goto NEXT; + } + } + for( i = 0 ; i < CHAR_DATACHARNUM ; i ++ ){ + if( strcmp( firstToken ,CHAR_setchardata[i] ) == 0 ){ + strcpysafe( one->string[i].string, + sizeof(one->string[i].string), + makeStringFromEscaped(secondToken) ); + if( strlen( one->string[i].string ) > 128 ){ + print(" CHARDATA_to_long!!:%s:%d ", one->string[i].string, strlen( one->string[i].string ) ); + one->string[i].string[0]=0; + } + goto NEXT; + } + } + if( strncmp( firstToken , FLGRESERVESTRING, + strlen( FLGRESERVESTRING ) ) == 0 ){ + int flgindex; + flgindex = atoi( firstToken+strlen(FLGRESERVESTRING) ); + if( flgindex < 0 || arraysizeof( one->flg ) <= flgindex ) + ; + else + one->flg[flgindex] = atoi( secondToken ); + + goto NEXT; + } + if( strncmp( firstToken , ITEMRESERVESTRING, + strlen( ITEMRESERVESTRING ) ) == 0 ){ + int itemindex; + if( strcmp( secondToken, NULLITEM) == 0 ) + goto NEXT; + itemindex = atoi( firstToken+strlen(ITEMRESERVESTRING) ); + if( itemindex < 0 || CHAR_MAXITEMHAVE <= itemindex + || one->indexOfExistItems[itemindex] != -1 ){ + ; + }else{ + ITEM_Item itmone; + BOOL ret; + + ret = ITEM_makeExistItemsFromStringToArg( secondToken, &itmone, 0); + + if( ret == TRUE ){ + int existitemindex; + existitemindex = ITEM_initExistItemsOne( &itmone ); + one->indexOfExistItems[itemindex] = existitemindex; + } + } + goto NEXT; + } + if( strncmp( firstToken , POOLITEMRESERVESTRING, + strlen( POOLITEMRESERVESTRING ) ) == 0 ){ + int itemindex; + if( strcmp( secondToken, NULLITEM) == 0 ) + goto NEXT; + itemindex = atoi( firstToken+strlen(POOLITEMRESERVESTRING) ); + if( itemindex < 0 || CHAR_MAXPOOLITEMHAVE <= itemindex + || one->indexOfExistPoolItems[itemindex] != -1 ){ + ; + }else{ + ITEM_Item itmone; + BOOL ret; + ret = ITEM_makeExistItemsFromStringToArg( secondToken , &itmone, 0 ); + + if( ret == TRUE ){ + int existitemindex; + existitemindex = ITEM_initExistItemsOne( &itmone ); + one->indexOfExistPoolItems[itemindex] = existitemindex; + } + } + goto NEXT; + } + if( strncmp( firstToken , SKILLRESERVESTRING, + strlen( SKILLRESERVESTRING ) ) == 0 ){ + int skillindex; + if( strcmp( secondToken, NULLSKILL) == 0 ) + goto NEXT; + skillindex =atoi( firstToken+strlen(SKILLRESERVESTRING) ); + if( skillindex < 0 || CHAR_SKILLMAXHAVE <= skillindex + || one->haveSkill[skillindex].use == TRUE ){ + }else{ + BOOL ret; + Skill skillone; + ret=SKILL_makeSkillFromStringToArg(secondToken,&skillone); + + if( ret == TRUE ){ + memcpy( &one->haveSkill[skillindex].skill , &skillone, + sizeof( Skill )); + one->haveSkill[skillindex].use = TRUE; + } + } + goto NEXT; + } + if( strncmp( firstToken , TITLERESERVESTRING, + strlen( TITLERESERVESTRING ) ) == 0 ){ + int titlenumber=atoi(firstToken+strlen(TITLERESERVESTRING)); + if( titlenumber < 0 || CHAR_TITLEMAXHAVE <= titlenumber ){ + }else{ + int titleindex = atoi( secondToken ); + if( TITLE_getTitleIndex( titleindex) != -1) + one->indexOfHaveTitle[titlenumber] = titleindex; + } + goto NEXT; + } + if( strncmp( firstToken , ADDRESSBOOKRESERVESTRING, + strlen( ADDRESSBOOKRESERVESTRING ) ) == 0 ){ + int addressnumber = atoi( firstToken + +strlen(ADDRESSBOOKRESERVESTRING)); + if( addressnumber < 0 || ADDRESSBOOK_MAX <= addressnumber ){ + }else{ + ADDRESSBOOK_makeAddressbookEntry( secondToken, + &one + ->addressBook[ + addressnumber]); + } + goto NEXT; + } + if( strncmp( firstToken , PETSERVERSTRING, + strlen( PETSERVERSTRING ) ) == 0 ){ + Char ch; + int ret; + int petnumber = atoi( firstToken+strlen(PETSERVERSTRING)); + if( !CHAR_CHECKPETINDEX( petnumber)) goto NEXT; + ret = CHAR_makePetFromStringToArg(secondToken,&ch, petnumber); + if( ret == TRUE ){ + int petindex = PET_initCharOneArray( &ch ); + if( petindex < 0 ){ + print( "ʧܡ\n"); + } + one->unionTable.indexOfPet[petnumber] = petindex; + goto NEXT; + }else{ + LodBadPetString( data, "ܼ", petnumber); + + fprint( " ַ ޷\n"); + return FALSE; + } + } + if( strncmp( firstToken , POOLPETSERVERSTRING, strlen( POOLPETSERVERSTRING ) ) == 0 ){ + + Char ch; + int ret; + int petnumber = atoi( firstToken+strlen(POOLPETSERVERSTRING)); + if( !CHAR_CHECKPOOLPETINDEX( petnumber)) goto NEXT; + ret = CHAR_makePetFromStringToArg( secondToken, &ch, petnumber); + if( ret == TRUE ) { + int petindex = PET_initCharOneArray( &ch ); + if( petindex < 0 ) { + fprint( " ޷\n"); + } + one->indexOfPoolPet[petnumber] = petindex; + goto NEXT; + }else{ + LodBadPetString( data, "err *total", petnumber); + fprint( " ϳɳַ ޷\n"); + return FALSE; + } + } + + if( strncmp( firstToken , DATAENDCHECKPOINT, strlen( DATAENDCHECKPOINT ) ) == 0 ){ + rightData=1; + goto NEXT; + } + + + print( "??? : %s[%s]\n" , linebuf, firstToken ); + NEXT: + readindex++; + } + // Robin 0913 bad_chardata + { + char name[4096]; + char* sp = strstr( data, "name="); + // shan add + char *sp2 = strstr( data, "ownt="); + if( sp && sp2 ){ + snprintf( name, sp2-sp-5, "%s", sp+5 ); + print("\n½ɹ :%s ", name ); + } + else + print("\n½ɹ ƴ! "); + + if( data[strlen(data)-2] != '\n' ){ + print("\nҵ½! "); + return FALSE; + } + } +// if( rightData != 1 ){ +// return FALSE; +// } + return TRUE; +} +static char CHAR_petdataString[4096]; + +char* CHAR_makePetStringFromPetIndex( int petindex) +{ + int i; + int strlength = 0; + + memset( CHAR_petdataString, 0, sizeof(CHAR_petdataString)); + + for( i = 0 ; i < CHAR_DATAINTNUM ; i ++ ){ + char linedata[512]; + +#ifdef _SIMPLIFY_PETSTRING + if( CHAR_getInt( petindex, i) == 0 ) continue; +#endif + snprintf( linedata , sizeof(linedata), + "%s:%d" NONCHAR_DELIMITER, CHAR_setintdata[i], CHAR_getInt( petindex,i) ); + strcpysafe( &CHAR_petdataString[strlength], + sizeof( CHAR_petdataString ) - strlength, linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_petdataString ) ) { + fprint( "err petdata buffer over\n"); + return "\0"; + } + } + + for( i = 0 ; i < CHAR_DATACHARNUM ; i ++ ){ + char linedata[512]; + char escapebuffer[512]; +#ifdef _SIMPLIFY_PETSTRING + if( CHAR_getChar( petindex, i) == "\0" + && strcmp( CHAR_setchardata[i], "name") + && strcmp( CHAR_setchardata[i], "ownt") ) + continue; +#endif + snprintf( linedata , sizeof(linedata), + "%s:%s" NONCHAR_DELIMITER, + CHAR_setchardata[i], + makeEscapeString( CHAR_getChar(petindex, i), escapebuffer, + sizeof( escapebuffer) )); + + strcpysafe( &CHAR_petdataString[strlength], + sizeof( CHAR_petdataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_petdataString ) ) { + fprint( " ݻ岻\n"); + return "\0"; + } + } + + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + int petskillid; + char linedata[512]; + petskillid = CHAR_getPetSkill( petindex, i); + if( PETSKILL_getPetskillArray( petskillid) == -1 ) continue; + snprintf( linedata , sizeof(linedata), + PETSKILLSERVERSTRING "%d:%d" NONCHAR_DELIMITER,i ,petskillid ); + strcpysafe( &CHAR_petdataString[strlength], + sizeof( CHAR_petdataString ) - strlength, linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_petdataString ) ) { + fprint( " ݻ岻\n"); + return "\0"; + } + } + +#ifdef _PET_ITEM + for( i = 0 ; i < CHAR_MAXPETITEMHAVE ; i ++ ){ + char linedata[2048]; + char *itemstring="\0"; + if( CHAR_getItemIndex( petindex, i) != -1 ) + itemstring = ITEM_makeStringFromItemIndex(CHAR_getItemIndex( petindex, i), 1); + if( itemstring == "\0" )continue; + snprintf( linedata , sizeof( linedata ), PETITEMRESERVESTRING "%d:%s" NONCHAR_DELIMITER, i, itemstring); + strcpysafe( &CHAR_petdataString[strlength], sizeof( CHAR_petdataString ) - strlength, linedata ); + + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_petdataString ) ) { + fprint( " ݻ岻\n"); + return "\0"; + } + } +#endif + + if( strstr( CHAR_petdataString, "name:") == NULL || + strstr( CHAR_petdataString, "ownt:") == NULL ){ + LodBadPetString( CHAR_petdataString, "string name err", -1); + } + return CHAR_petdataString; +} +void LodBadPetString( char *data, char *err, int ti) +{ + FILE *fp=NULL; + if( data == NULL || strlen( data) == 0 ) return; + if( (fp=fopen( "badpetstring.txt", "a+")) == NULL ) return; + fprintf( fp, "ti:%d %s:%s\n", ti, err, data); + + fclose( fp); +} +int CHAR_makePetFromStringToArg( char *src, Char *ch, int ti) +{ + int readnum = 1; + int rc; + BOOL found; + char buff[4096]; + char petfirstToken[256]; + char petsecondToken[4096]; + int i, findE=0; + + memset( ch, 0, sizeof( Char)); + CHAR_getDefaultChar(ch, 31010); + + if( strstr( src, "name:") == NULL || + strstr( src, "ownt:") == NULL ){//findE + LodBadPetString( src, "make name err", ti); + fprint( "err PetString make name err\n"); + return -1; + } + + while( 1 ) { + rc = getStringFromIndexWithDelim( src, NONCHAR_DELIMITER, readnum, buff, sizeof( buff )); + if( rc == TRUE ) { + if( buff[0] == '#' || buff[0] == '\n' || buff[0] == '\0' ){ + readnum ++; + continue; + } + } + if( rc == TRUE ) { + readnum ++; + rc = getStringFromIndexWithDelim( buff , ":" , 1 , + petfirstToken , + sizeof(petfirstToken) ); + if( rc == FALSE ) break; + strcpysafe( petsecondToken , sizeof( petsecondToken ), + buff + strlen(petfirstToken) + strlen(":") ); +// rc = getStringFromIndexWithDelim( buff , ":" , 2 , +// petsecondToken , +// sizeof(petsecondToken) ); + found = FALSE; + for( i = 0 ; i < CHAR_DATAINTNUM ; i ++ ){ + if( strcmp(petfirstToken ,CHAR_setintdata[i] ) == 0 ){ + ch->data[i] = atoi( petsecondToken ); + found = TRUE; + break; + } + } + if( !found ) { + for( i = 0 ; i < CHAR_DATACHARNUM ; i ++ ){ + if( strcmp( petfirstToken ,CHAR_setchardata[i] ) == 0 ){ + strcpysafe( ch->string[i].string, + sizeof(ch->string[i].string), + makeStringFromEscaped(petsecondToken) ); + found = TRUE; + findE = 1; + break; + } + } + } + if( !found) { +#ifdef _PET_ITEM + if( strncmp( petfirstToken , PETITEMRESERVESTRING, strlen( PETITEMRESERVESTRING ) ) == 0 ) + { + int itemindex; + itemindex = atoi( petfirstToken+strlen(PETITEMRESERVESTRING) ); + if( itemindex < 0 || CHAR_MAXPETITEMHAVE <= itemindex || ch->indexOfExistItems[itemindex] != -1 ){ + ; + }else{ + ITEM_Item itmone; + BOOL ret; + + ret = ITEM_makeExistItemsFromStringToArg( petsecondToken , &itmone,1); + if( ret == TRUE ){ + int existitemindex; + existitemindex = ITEM_initExistItemsOne( &itmone ); + ch->indexOfExistItems[itemindex] = existitemindex; + found = TRUE; + } + } + } +#endif + + } + if( !found ) { + if( strncmp( petfirstToken , PETSKILLSERVERSTRING, + strlen( PETSKILLSERVERSTRING ) ) == 0 ){ + int petskillnum = atoi( petfirstToken + strlen( PETSKILLSERVERSTRING)); + if( CHAR_CHECKPETSKILLINDEX( petskillnum) ) { + int petskillid = atoi( petsecondToken ); + if( PETSKILL_getPetskillArray(petskillid) != -1) { + ch->unionTable.indexOfPetskill[petskillnum] = petskillid; + found = TRUE; + } + } + } + } + if( !found) { + fprint( "makePetFromString err?: %s : %s [%s] \n" , src, buff, petfirstToken ); + } + }else { + break; + } + } + + if( findE == 0 ){//findE + LodBadPetString( src, "make charstr err", ti); + fprint( "err PetString make charstr err\n"); + return -1; + } + + return TRUE; +} + +#ifdef _PERSONAL_FAME // Arminius 8.30: + +void CHAR_earnFame(int index, int fame) +{ + int oldfame=CHAR_getInt(index, CHAR_FAME)+fame; +#ifdef _NEW_MANOR_LAW + int momentum = CHAR_getInt(index,CHAR_MOMENTUM) + fame; +#endif + + if (oldfame>MAX_PERSONALFAME) oldfame=MAX_PERSONALFAME; + if (oldfame<0) oldfame=0; + CHAR_setInt(index, CHAR_FAME, oldfame); +#ifdef _NEW_MANOR_LAW + if(momentum > MAX_PERSONAL_MOMENTUM) momentum = MAX_PERSONAL_MOMENTUM; + else if(momentum < 0) momentum = 0; + CHAR_setInt(index,CHAR_MOMENTUM,momentum); +#endif +} +#endif + +// CoolFish: 2001/10/11 Unique Pet Code +#ifdef _UNIQUE_P_I +void CHAR_setPetUniCode(int petindex) +{ + if( strcmp( CHAR_getChar(petindex, CHAR_UNIQUECODE), "" ) == 0 || + strstr( CHAR_getChar(petindex, CHAR_UNIQUECODE), "_" ) != NULL || + strstr( CHAR_getChar(petindex, CHAR_UNIQUECODE), UNIQUE_KEYCODEPET ) == NULL ){ + char petbuf[256]; + time_t t1; + time(&t1); + sprintf(petbuf, "%ld%s%d%d", t1, UNIQUE_KEYCODEPET, getServernumber(), unique_p); + unique_p++; + if (unique_p >= MAX_UNIQUE_P_I) + unique_p = 0; + CHAR_setChar(petindex, CHAR_UNIQUECODE, petbuf); + } +} + +void ITEM_setItemUniCode(int itemindex) +{ + if( strcmp( ITEM_getChar(itemindex, ITEM_UNIQUECODE), "") == 0 || + strstr( ITEM_getChar(itemindex, ITEM_UNIQUECODE), "_") != NULL ){ + char itembuf[256]; + time_t t1; + time(&t1); + + sprintf(itembuf, "%ld%s%d%d%d", t1, "i", unique_i, getServernumber(), UNIQUE_KEYCODEITEM); + + unique_i++; + if (unique_i >= MAX_UNIQUE_P_I) + unique_i = 0; + ITEM_setChar(itemindex, ITEM_UNIQUECODE, itembuf); + } +} + +void CHAR_DetainSameItem( int charaindex, int itemindex) +{ + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, 100000); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + + LogItem( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "SysDeleteSame(ϵͳɾظ)", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); +// ITEM_endExistItemsOne( itemindex); +} + +void CHAR_DetainSamePet( int charaindex, int petindex) +{ + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, 100000); + CHAR_setChar( petindex, CHAR_OWNERCDKEY, "SYS"); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, "SYS"); + CHAR_complianceParameter( petindex ); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "SysDeleteSame(ɾظ)", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); +// CHAR_endCharOneArray( petindex ); +} + +void CHAR_DetainSameUCodePet( int charaindex, int petindex, int Ti) +{ + if( Ti == -1 ){ + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i++ ) { + int pindex = CHAR_getCharPet( charaindex, i); + if( !CHAR_CHECKINDEX( pindex) ) continue; + if( pindex == petindex ) break; + } + if( i >= CHAR_MAXPETHAVE ) return; + CHAR_setCharPet( charaindex, i, -1); + }else{ + CHAR_setCharPet( charaindex, Ti, -1); + } + CHAR_DetainSamePet( charaindex, petindex); +} + +void CHAR_DetainSameUCodePoolPet( int charaindex, int petindex, int Ti) +{ + if( Ti == -1 ){ + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i++ ) { + int pindex = CHAR_getCharPet( charaindex, i); + if( !CHAR_CHECKINDEX( pindex) ) continue; + if( pindex == petindex ) break; + } + if( i >= CHAR_MAXPETHAVE ) return; + CHAR_setCharPoolPet( charaindex, i, -1); + }else{ + CHAR_setCharPoolPet( charaindex, Ti, -1); + } + CHAR_DetainSamePet( charaindex, petindex); +} + +void CHAR_DetainSameUCodeItem( int charaindex, int itemindex, int Ti) +{ + if( Ti == -1 ){ + int i; + for( i = 0; i < CHAR_MAXITEMHAVE; i++ ) { + int iindex = CHAR_getItemIndex( charaindex, i); + if( !ITEM_CHECKINDEX( iindex) ) continue; + if( iindex == itemindex ) break; + } + if( i >= CHAR_MAXITEMHAVE ) return; + CHAR_setItemIndex( charaindex, i, -1); + }else{ + CHAR_setItemIndex( charaindex, Ti, -1); + } + CHAR_DetainSameItem( charaindex, itemindex); +} + +void CHAR_DetainSameUCodePoolItem( int charaindex, int itemindex, int Ti) +{ + if( Ti == -1 ){ + int i; + for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i++ ) { + int iindex = CHAR_getPoolItemIndex( charaindex, i); + if( !ITEM_CHECKINDEX( iindex) ) continue; + if( iindex == itemindex ) break; + } + if( i >= CHAR_MAXPOOLITEMHAVE ) return; + CHAR_setPoolItemIndex( charaindex, i, -1); + }else{ + CHAR_setPoolItemIndex( charaindex, Ti, -1); + } + CHAR_DetainSameItem( charaindex, itemindex); +} +#endif + +// Arminius 12.15 жǷʿ +int IsMale(int charindex) { + int bbi=CHAR_getInt(charindex, CHAR_BASEBASEIMAGENUMBER); + + if ((bbi==SPR_001em)||(bbi==SPR_002em)||(bbi==SPR_003em)||(bbi==SPR_004em)|| + (bbi==SPR_011em)||(bbi==SPR_012em)||(bbi==SPR_013em)||(bbi==SPR_014em)|| + (bbi==SPR_021em)||(bbi==SPR_022em)||(bbi==SPR_023em)||(bbi==SPR_024em)|| + (bbi==SPR_031em)||(bbi==SPR_032em)||(bbi==SPR_033em)||(bbi==SPR_034em)|| + (bbi==SPR_041em)||(bbi==SPR_042em)||(bbi==SPR_043em)||(bbi==SPR_044em)|| + (bbi==SPR_051em)||(bbi==SPR_052em)||(bbi==SPR_053em)||(bbi==SPR_054em)) + { + return 1; + } + + return 0; +} + +// Arminius 12.15 жǷŮʿ +int IsFemale(int charindex) { + int bbi=CHAR_getInt(charindex, CHAR_BASEBASEIMAGENUMBER); + + if ((bbi==SPR_061em)||(bbi==SPR_062em)||(bbi==SPR_063em)||(bbi==SPR_064em)|| + (bbi==SPR_071em)||(bbi==SPR_072em)||(bbi==SPR_073em)||(bbi==SPR_074em)|| + (bbi==SPR_081em)||(bbi==SPR_082em)||(bbi==SPR_083em)||(bbi==SPR_084em)|| + (bbi==SPR_091em)||(bbi==SPR_092em)||(bbi==SPR_093em)||(bbi==SPR_094em)|| + (bbi==SPR_101em)||(bbi==SPR_102em)||(bbi==SPR_103em)||(bbi==SPR_104em)|| + (bbi==SPR_111em)||(bbi==SPR_112em)||(bbi==SPR_113em)||(bbi==SPR_114em)) + { + return 1; + } + + return 0; +} + +#ifdef _TYPE_TOXICATION +BOOL CHAR_CanCureFlg( int charaindex, char *arg) +{ + int fd = getfdFromCharaIndex( charaindex ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) return TRUE; + if( getToxication( fd) == 1 ){ + if( strstr( arg, "FALSE") == 0 ) { + char buf[256]; + sprintf( buf,"ж޷%s", arg); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + } + return FALSE; + } + return TRUE; +} +#endif + +INLINE int CHAR_AddMaxExp( int charaindex, int addexp) +{ + int Myexp = CHAR_getInt( charaindex, CHAR_EXP); + Myexp = min( Myexp + addexp, 1224160000 ); + CHAR_setInt( charaindex, CHAR_EXP, Myexp ); + return addexp; +} + +INLINE int CHAR_setMaxExpFromLevel( int charaindex, int level) +{ +#ifdef _NEWOPEN_MAXEXP + CHAR_setInt( charaindex, CHAR_EXP, 0); + return 0; +#else + int LVexp; + if( (LVexp = CHAR_GetLevelExp( charaindex, level+1)) < 0 )return -1; + CHAR_setInt( charaindex, CHAR_EXP, LVexp); + return LVexp; +#endif +} + +INLINE int CHAR_setMaxExp( int charaindex, unsigned long int Setexp) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return -1; + CHAR_setInt( charaindex, CHAR_EXP, Setexp); + return Setexp; +} +#ifdef _NEWOPEN_MAXEXP +INLINE int CHAR_ChangeExp( int charaindex ) +{ + int level, defexp, Myexp; + if( !CHAR_CHECKINDEX( charaindex) ) return -1; + + level = CHAR_getInt( charaindex, CHAR_LV); + if( (defexp = CHAR_GetOldLevelExp( level)) < 0 ) return -1; + Myexp = CHAR_getInt( charaindex, CHAR_OLDEXP); + + if( Myexp > CHAR_GetOldLevelExp( level+1) ){ + Myexp = 0; + }else if( Myexp >= defexp ){ + Myexp = Myexp - defexp; + } + if( Myexp < 0 ) Myexp = 0; + + CHAR_setInt( charaindex, CHAR_EXP, Myexp); + CHAR_setInt( charaindex, CHAR_OLDEXP, 0); + + CHAR_send_P_StatusString( charaindex ,CHAR_P_STRING_EXP|CHAR_P_STRING_LV); + return Myexp; +} + +INLINE int CHAR_HandleExp( int charaindex ) +{ + int needexp, level, Myexp; + if( !CHAR_CHECKINDEX( charaindex) ) return -1; + level = CHAR_getInt( charaindex, CHAR_LV); + Myexp = CHAR_getInt( charaindex, CHAR_EXP); + if( (needexp = CHAR_GetLevelExp( charaindex, level+1)) == -1 ) return -1; + Myexp = Myexp - needexp; + if ( Myexp > 0){ + CHAR_earnFame(charaindex, needexp / 20000); + } + if( Myexp < 0 ) Myexp = 0; + CHAR_setInt( charaindex, CHAR_EXP, Myexp); + return Myexp; +} +#endif + +INLINE int _CHAR_AddPileItem( char *file, int line, int charaindex, int itemindex) +{ +#ifdef _ITEM_PILENUMS + int itempile , mypile, surplus, ret=-1; + + surplus = CHAR_findSurplusItemBox( charaindex); + itempile = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + mypile = CHAR_getMyMaxPilenum( charaindex); + + if( itempile > (surplus*mypile) || itempile <= 0 ){ + return -1; + } + + if( mypile >= itempile ){ + ret = CHAR_addItemSpecificItemIndex( charaindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + return -1; + } + CHAR_sendItemDataOne( charaindex, ret); + }else{ + int newindex[10]={ -1,-1,-1,-1,-1, + -1,-1,-1,-1,-1}; + int i, ti=0, ItemID, MaxPile; + MaxPile = itempile; + ItemID = ITEM_getInt( itemindex, ITEM_ID); + while( MaxPile > 0 ){ + if( ti >= 10 ) return -1; + newindex[ti] = ITEM_makeItemAndRegist( ItemID); + if( !ITEM_CHECKINDEX( newindex[ti]) ) return -1; + if( mypile > MaxPile ) mypile = MaxPile; + ITEM_setInt( newindex[ti], ITEM_USEPILENUMS, mypile); + ti++; + MaxPile -= mypile; + if( MaxPile < 0 ) return -1; + } + for( i=0; i<10; i++ ){ + if( newindex[i] == -1 ) break; + ret = CHAR_addItemSpecificItemIndex( charaindex, newindex[i]); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( newindex[i]); + return -1; + } + CHAR_sendItemDataOne( charaindex, ret); + } + ITEM_endExistItemsOne( itemindex); + } + return ret; +#endif +} + + +INLINE int _CHAR_DelItem( char *file, int line, int charaindex, int ti, int num, int flg) +{ +// char token[256]; + int pilenum; + int itemindex = CHAR_getItemIndex( charaindex , ti ); + if( !ITEM_CHECKINDEX(itemindex) ) return 0; +#ifdef _ITEM_PILENUMS + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + if( pilenum < num ) return FALSE; + pilenum = pilenum - num; + ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum); + if( pilenum <= 0 ){ +#endif +/* + if( flg == 1 ){ + sprintf( token, "%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } +*/ + CHAR_setItemIndex( charaindex, ti, -1); + ITEM_endExistItemsOne( itemindex); +#ifdef _ITEM_PILENUMS + } +#endif + CHAR_sendItemDataOne( charaindex, ti); + + return 1; +} + +int CHAR_getMaxHaveGold( int charaindex) +{ + int MaxGold; +#ifdef _FIX_MAX_GOLD // WON ADD Ǯ + int trans = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); + switch(trans){ + case 0: + MaxGold = 1000000; + break; + case 1: + MaxGold = 2000000; + break; + case 2: + MaxGold = 5000000; + break; + case 3: + MaxGold = 10000000; + break; + case 4: + MaxGold = 50000000; + break; + default: + MaxGold = 100000000; + break; + } +#else + MaxGold = CHAR_MAXGOLDHAVE; +#endif + + return MaxGold; +} + +INLINE int _CHAR_AddGold( char *file, int line, int charaindex, int gold) +{ + char token[256]; + int MyGold, MaxGold; + + MaxGold = CHAR_getMaxHaveGold( charaindex); + MyGold = CHAR_getInt( charaindex, CHAR_GOLD); + MyGold = (MyGold>MaxGold)?MaxGold:MyGold; + gold = (gold>MaxGold)?MaxGold:gold; + sprintf( token, "õ%dʯ", gold); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + MyGold += gold; + + if( MyGold > MaxGold ){ + int reGolds=0; + int MyGBGold = CHAR_getInt( charaindex, CHAR_PERSONAGOLD); + reGolds = MyGold - MaxGold; + MyGBGold += reGolds; + MyGBGold = (MyGBGold > CHAR_MAXPERSONAGOLD)?CHAR_MAXPERSONAGOLD:MyGBGold; + CHAR_setInt( charaindex, CHAR_PERSONAGOLD, MyGBGold); + sprintf( token,"%d ʣࣺ%d ", reGolds, CHAR_getInt( charaindex, CHAR_PERSONAGOLD )); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + LogBankStone( CHAR_getChar( charaindex, CHAR_NAME ), CHAR_getChar( charaindex, CHAR_CDKEY ), + charaindex, reGolds, + "GB_Bank_save()", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X ), CHAR_getInt( charaindex, CHAR_Y ), + CHAR_getInt( charaindex, CHAR_GOLD ), + CHAR_getInt( charaindex, CHAR_PERSONAGOLD ) + ); + MyGold = MaxGold; + } + CHAR_setInt( charaindex, CHAR_GOLD, MyGold); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + + return 1; +} + +INLINE int _CHAR_DelGold( char *file, int line, int charaindex, int gold) +{ + char token[256]; + int MyGold, MaxGold; + + MaxGold = CHAR_getMaxHaveGold( charaindex); + MyGold = CHAR_getInt( charaindex, CHAR_GOLD); + MyGold = (MyGold>MaxGold)?MaxGold:MyGold; + gold = (gold>MaxGold)?MaxGold:gold; + + if( MyGold < gold ){ + sprintf( token, "û㹻ʯң(%dʯ)", gold); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return 0; + } + MyGold -= gold; + MyGold = ( MyGold < 0 )?0:MyGold; + CHAR_setInt( charaindex, CHAR_GOLD, MyGold); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + return 1; +} + + +#ifdef _CHAR_POOLITEM +INLINE int _CHAR_getDepotItemIndex( char *file, int line, int index ,int iindex) +{ + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + if( CHAR_MAXDEPOTITEMHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return -1; + } + + if( !CHAR_CheckDepotItem( index) ){ + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + + return CHAR_chara[index].indexOfExistDepotItems[iindex]; +} + +INLINE int _CHAR_setDepotItemIndex( char *file, int line, int index ,int iindex,int id ) +{ + int buf; + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return -1; + } + if( CHAR_MAXDEPOTITEMHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d \n", file, line); + return -1; + } + if( !CHAR_CheckDepotItem( index) ){ + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + buf = CHAR_chara[index].indexOfExistDepotItems[iindex]; + CHAR_chara[index].indexOfExistDepotItems[iindex] = id; + return buf; +} +void CHAR_removeHaveDepotItem( Char* ch ) +{ + if( ch == NULL )return; + if( ch->indexOfExistDepotItems == NULL ) return; + freeMemory( ch->indexOfExistDepotItems ); + ch->indexOfExistDepotItems = NULL; +} + +void CHAR_removeDepotItem( int charaindex) +{ + int i,itemindex; + Char* ch = NULL; + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( !CHAR_CheckDepotItem( charaindex) ) return; //ֿδ + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ){ + print( "removeDepotItem err ch == NULL :%d\n", charaindex); + return; + } + + for( i=0; iindexOfExistDepotItems[i]; + if( !ITEM_CHECKINDEX( itemindex) ) continue; + itemstring = ITEM_makeStringFromItemIndex( ch->indexOfExistDepotItems[i], 0); + if( itemstring == "\0" )continue; + + snprintf( linedata , sizeof( linedata ), + DEPOTITEMRESERVESTRING "%d=%s" CHAR_DELIMITER, i, itemstring); + + strcpysafe( &CHAR_dataString[strlength], sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + return "\0"; + } + } + return CHAR_dataString; +} + +BOOL CHAR_makeDepotItemStringToChar( int charaindex, char* data) +{ + int readindex=1, itemindex; + Char* ch = NULL; + BOOL ret; + char firstToken[256], secondToken[4096], linebuf[4096]; + + if( data[0] == '\0' ) + return -1; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ){ + print( "makeDepotItem err ch == NULL :%d\n", charaindex); + return FALSE; + } + + while( 1 ){ + memset( linebuf, 0, sizeof( linebuf)); + memset( firstToken, 0, sizeof( firstToken)); + memset( secondToken, 0, sizeof( secondToken)); + ret = getStringFromIndexWithDelim( data ,CHAR_DELIMITER, + readindex, linebuf, sizeof( linebuf ) ); + if( ret == FALSE )break; + if( linebuf[0] == '#' || linebuf[0] == '\n' || linebuf[0] == '\0' ){ + goto NEXT; + } + if( (ret=getStringFromIndexWithDelim( linebuf , "=" , 1 , + firstToken, sizeof(firstToken) )) == FALSE ) return FALSE; + strcpysafe( secondToken , sizeof( secondToken ), + linebuf + strlen( firstToken) + strlen("=") ); + + if( strncmp( firstToken, DEPOTITEMRESERVESTRING, strlen( DEPOTITEMRESERVESTRING)) == 0 ){ + if( strcmp( secondToken, NULLITEM) == 0 ) goto NEXT; + itemindex = atoi( firstToken+strlen(DEPOTITEMRESERVESTRING) ); + if( itemindex < 0 || CHAR_MAXDEPOTITEMHAVE <= itemindex + || ch->indexOfExistDepotItems[itemindex] != -1 ){ + ; + }else{ + ITEM_Item itmone; + ret = ITEM_makeExistItemsFromStringToArg( secondToken , &itmone, 0 ); + if( ret == TRUE ){ + int existitemindex; + existitemindex = ITEM_initExistItemsOne( &itmone ); + ch->indexOfExistDepotItems[itemindex] = existitemindex; + } + } + goto NEXT; + } + print( "??? : %s[%s]\n" , linebuf, firstToken ); +NEXT: + readindex++; + } + return TRUE; +} + +void CHAR_ShowMyDepotItems( int charaindex) +{ + int i, itemindex; + + print( "\nShowMyDepotItems:\n"); + if( !CHAR_CheckDepotItem( charaindex) ) return; + for( i=0; iindexOfExistDepotItems == NULL ) return FALSE; + return TRUE; +} + +#endif + + +#ifdef _CHAR_POOLPET +INLINE int _CHAR_getDepotPetIndex( char *file, int line, int index ,int iindex) +{ + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d from %s:%d,%d\n", __FILE__, __LINE__,file, line,index); + return -1; + } + if( CHAR_MAXDEPOTPETHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d from %s:%d \n", __FILE__, __LINE__,file, line); + return -1; + } + + if( !CHAR_CheckDepotPet( index) ){ + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + + return CHAR_chara[index].indexOfExistDepotPets[iindex]; +} + +INLINE int _CHAR_setDepotPetIndex( char *file, int line, int index ,int iindex,int id ) +{ + int buf; + if( !CHAR_CHECKINDEX(index)) { + print( "err %s:%d \n", file, line); + return -1; + } + if( CHAR_MAXDEPOTPETHAVE <= iindex || iindex < 0 ) { + print( "err %s:%d \n", file, line); + return -1; + } + if( !CHAR_CheckDepotPet( index) ){ + print( "err %s:%d from %s:%d\n", __FILE__, __LINE__,file, line); + return -1; + } + buf = CHAR_chara[index].indexOfExistDepotPets[iindex]; + CHAR_chara[index].indexOfExistDepotPets[iindex] = id; + return buf; +} +void CHAR_removeHaveDepotPet( Char* ch ) +{ + if( ch == NULL )return; + if( ch->indexOfExistDepotPets == NULL ) return; + freeMemory( ch->indexOfExistDepotPets ); + ch->indexOfExistDepotPets = NULL; +} + +void CHAR_removeDepotPet( int charaindex) +{ + int i,petindex; + Char* ch = NULL; + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( !CHAR_CheckDepotPet( charaindex) ) return; //ֿδ + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ){ + print( "removeDepotPet err ch == NULL :%d\n", charaindex); + return; + } + + for( i=0; iindexOfExistDepotPets[i]; + if( !CHAR_CHECKINDEX( petindex) ) continue; + petstring = CHAR_makePetStringFromPetIndex( ch->indexOfExistDepotPets[i]); + if( petstring == "\0" )continue; + + snprintf( linedata , sizeof( linedata ), + DEPOTPETRESERVESTRING "%d=%s" CHAR_DELIMITER, i, petstring); + + strcpysafe( &CHAR_dataString[strlength], sizeof( CHAR_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( CHAR_dataString ) ) { + return "\0"; + } + } + return CHAR_dataString; +} + +BOOL CHAR_makeDepotPetStringToChar( int charaindex, char* data) +{ + int readindex=1, petindex; + Char* ch = NULL; + BOOL ret; + char firstToken[256], secondToken[4096], linebuf[4096]; + + if( data[0] == '\0' ) + return -1; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ){ + print( "makeDepotPet err ch == NULL :%d\n", charaindex); + return FALSE; + } + + while( 1 ){ + memset( linebuf, 0, sizeof( linebuf)); + memset( firstToken, 0, sizeof( firstToken)); + memset( secondToken, 0, sizeof( secondToken)); + ret = getStringFromIndexWithDelim( data ,CHAR_DELIMITER, + readindex, linebuf, sizeof( linebuf ) ); + if( ret == FALSE )break; + if( linebuf[0] == '#' || linebuf[0] == '\n' || linebuf[0] == '\0' ){ + goto NEXT; + } + if( (ret=getStringFromIndexWithDelim( linebuf , "=" , 1 , + firstToken, sizeof(firstToken) )) == FALSE ) return FALSE; + strcpysafe( secondToken , sizeof( secondToken ), + linebuf + strlen( firstToken) + strlen("=") ); + + if( strncmp( firstToken, DEPOTPETRESERVESTRING, strlen( DEPOTPETRESERVESTRING)) == 0 ){ + if( strcmp( secondToken, NULLITEM) == 0 ) goto NEXT; + petindex = atoi( firstToken+strlen(DEPOTPETRESERVESTRING) ); + if( petindex < 0 || CHAR_MAXDEPOTPETHAVE <= petindex + || ch->indexOfExistDepotPets[petindex] != -1 ){ + ; + }else{ + Char petone; + ret = CHAR_makePetFromStringToArg( secondToken , &petone, 0 ); + if( ret == TRUE ){ + int existpetindex; + existpetindex = PET_initCharOneArray( &petone ); + ch->indexOfExistDepotPets[petindex] = existpetindex; + CHAR_setWorkInt( existpetindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_complianceParameter( existpetindex); + } + } + goto NEXT; + } + print( "??? : %s[%s]\n" , linebuf, firstToken ); +NEXT: + readindex++; + } + return TRUE; +} + +void CHAR_ShowMyDepotPets( int charaindex) +{ + int i, petindex; + + print( "\nShowMyDepotPets:\n"); + if( !CHAR_CheckDepotPet( charaindex) ) return; + for( i=0; iindexOfExistDepotPets == NULL ) return FALSE; + return TRUE; +} + +#endif + +#ifdef _STREET_VENDOR +BOOL CHAR_setStreetVendor(int charindex,int index,int set,int num) +{ + if(!CHAR_CHECKINDEX(charindex)) return FALSE; + if(index < 0 || index > MAX_SELL_ITEM) return FALSE; + switch(set){ + case SV_PILE: + CHAR_chara[charindex].StreetVendor[index].pile = num; + break; + case SV_PRICE: + CHAR_chara[charindex].StreetVendor[index].price = num; + break; + case SV_INDEX: + CHAR_chara[charindex].StreetVendor[index].index = num; + break; + case SV_KIND: + CHAR_chara[charindex].StreetVendor[index].kind = num; + break; + } + CHAR_chara[charindex].StreetVendor[index].usage = TRUE; + return TRUE; +} + +INLINE void CHAR_clearStreetVendor(int charindex,int index) +{ + if(!CHAR_CHECKINDEX(charindex)) return; + if(index < 0 || index > MAX_SELL_ITEM) return; + CHAR_chara[charindex].StreetVendor[index].index = -1; + CHAR_chara[charindex].StreetVendor[index].price = 0; + CHAR_chara[charindex].StreetVendor[index].pile = 0; + CHAR_chara[charindex].StreetVendor[index].kind = -1; + CHAR_chara[charindex].StreetVendor[index].usage = FALSE; +} + +int CHAR_getStreetVendor(int charindex,int index,int set) +{ + if(!CHAR_CHECKINDEX(charindex)) return -1; + if(index < 0 || index > MAX_SELL_ITEM) return -1; + switch(set){ + case SV_PILE: + return CHAR_chara[charindex].StreetVendor[index].pile; + case SV_PRICE: + return CHAR_chara[charindex].StreetVendor[index].price; + case SV_INDEX: + return CHAR_chara[charindex].StreetVendor[index].index; + case SV_KIND: + return CHAR_chara[charindex].StreetVendor[index].kind; + case SV_USAGE: + return CHAR_chara[charindex].StreetVendor[index].usage; + } + return -1; +} +#endif + +#ifdef _CHAR_POOLPET +int CHAR_getCharDepotPetElement( int charaindex ) +{ + int i; + int limit; + if( !CHAR_CHECKINDEX(charaindex))return -1; + + //andy_reEdit 2003/09/18 + //limit = (CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)*2)+5; + //limit = min( limit, CHAR_MAXPOOLPETHAVE); + limit = CHAR_MAXDEPOTPETHAVE; + for( i = 0; i < limit; i ++ ) { + if( CHAR_getDepotPetIndex( charaindex,i) == -1 ) break; + } + return ( i == limit ? -1:i ); +} +#endif + +#ifdef _RIDE_CF +int CHAR_Ride_CF_init() +{ + FILE* fp; + int i=0; + fp = fopen("data/ride.txt", "r"); + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + BOOL ride=FALSE; + while(1){ + char line[1024], buf[16]; + if (fgets(line, sizeof(line), fp) == NULL)break; + chop(line); + if(line[0]=='#')continue; + getStringFromIndexWithDelim(line,",", 1, buf, sizeof(buf)); + if(!strcmp(buf, " ")){ + for(i=0;i= 0 ) { +// printf("ti:%d\n",ti); + if( (index = RIDEPET_getNOindex( playerNo)) >= 0 ){ +// printf("index:%d\n",index); + if( (image = RIDEPET_getRIDEno( index,ti)) >= 0 ){ +// printf("image:%d\n",image); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , image ); + } + } + } + + if(image!=-1){ + CHAR_setInt( meindex , CHAR_RIDEPET, pet ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex, CHAR_P_STRING_RIDEPET ); + return 1; + } + } + } + return 0; +} +#endif + +#ifdef _SAFE_PASSWORD +void CHAR_SafePassword(int charaindex) +{ + int fd = getfdFromCharaIndex( charaindex); + if(CHAR_getInt(charaindex,CHAR_LOCK)==2){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SAFE_PASSWORD1, + -1, + " ʾ˺źƣ\nϵͳΪ˺ŰȫԶ\n뾡޸룡\n\nİȫ룬ȷ󷽿ɽ"); + }else if(CHAR_getInt(charaindex,CHAR_LOCK)==3){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SAFE_PASSWORD3, + -1, + "ʾε¼ַһ\nΪİȫǣϵͳȫԶ\n\nİȫ룬ɹý"); + }else if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SAFE_PASSWORD1, + -1, + "İȫ룬ȷ󷽿ɽ"); + } +} + +void CHAR_AddSafePassword(int charaindex) +{ + int fd = getfdFromCharaIndex( charaindex); + if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SAFE_PASSWORD2, + -1, + "Ҫõİȫ룬ʹ6-32λ6λּĸлл"); + } +} + +void CHAR_UnSafePassword(int charaindex) +{ + int fd = getfdFromCharaIndex( charaindex); + if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SAFE_PASSWORD3, + -1, + "İȫ룬ȷ󷽿ý"); + }else{ + CHAR_setInt(charaindex,CHAR_LOCK,1); + CHAR_talkToCli( charaindex, -1, "ϵͳɹý", CHAR_COLORRED); + } +} +#endif + +char *replace_s(char *str, char *str1, char *str2, char *strretu) +{ + char *str_temp = str; + char *str1_temp = str1; + char *str2_temp = str2; + char *strretu_temp = NULL; + + unsigned long char_size = (unsigned long)sizeof(char); + /*ַ*/ + unsigned long i,j,rep_acc = 0; + unsigned long str_len = strlen(str); + unsigned long str1_len = strlen(str1)-1; + unsigned long str2_len = strlen(str2); + + /*ҳStrмطҪ滻*/ + for(; str_temp - str < str_len; ) + { + for(i = 0; i < str1_len; i++) + { + if(*str_temp++ != *str1_temp++) + { + str1_temp = str1; + break; + } + else + { + if(i == str1_len - 1) + { + str1_temp = str1; + rep_acc++; + } + } + } + } + str1_temp = str1; + str_temp = str; + + /*ڴ*/ + strretu = strretu_temp = malloc(((str_len - str1_len * rep_acc) + str2_len * rep_acc + 1) * char_size); + /*滻*/ + for(; str_temp - str < str_len; ) + { + + for(i = 0; i < str1_len; i++) + { + *strretu_temp++ = *str_temp; + + if(*str_temp++ != *str1_temp++) + { + str1_temp = str1; + break; + } + else + { + + if(i == str1_len - 1) + { + strretu_temp = strretu_temp - str1_len; + + for(i = 0; i < str2_len; i++) + { + *strretu_temp++ = *str2_temp++; + } + str2_temp = str2; + str1_temp = str1; + } + } + } + } + *strretu_temp = '\0'; + str1_temp = str1; + str_temp = str; + str2_temp = str2; + + return(strretu); +} + +char *str_ganrao(char *oldstr) +{ + char* newrandquestion = NULL; + newrandquestion = strstr(oldstr,"["); + if(newrandquestion!=NULL){ + char *newrandquestion2 = NULL; + char *newrandquestion5 = NULL; + char newrandquestion3[64],newrandquestion4[64]; + memset(newrandquestion3, 0, sizeof(newrandquestion3)); + memset(newrandquestion4, 0, sizeof(newrandquestion4)); + int qnum1,qnum2; + newrandquestion2 = strstr(oldstr,"]"); + qnum1 = strlen(newrandquestion); + qnum2 = strlen(newrandquestion2); + int qi; + for(qi=1;qi25){ + if(qi==0){ + sprintf(newrandquestion4,"%s%c",grbuff[RAND(1,100)-1],newrandquestion3[qi]); + } + else{ + sprintf(newrandquestion4,"%s%s%c",newrandquestion4,grbuff[RAND(1,100)-1],newrandquestion3[qi]); + } + } + } + sprintf(newrandquestion4,"%s%s",newrandquestion4,grbuff[RAND(1,100)-1]); + newrandquestion5 = replace_s(oldstr,newrandquestion3,newrandquestion4,newrandquestion5); + char kbuf1[7][5] = {"","","","","","",""}; + char kbuf2[7][5] = {"","","","","","",""}; + char *newrandquestion6 = NULL; + char *newrandquestion7 = NULL; + int krandnum = RAND(1,7); + char houmsg[64]; + memset(houmsg, 0, sizeof(houmsg)); + sprintf(houmsg,"%s%s",grbuff[RAND(1,100)-1],kbuf2[krandnum-1]); + newrandquestion6 = replace_s(newrandquestion5,"[\O",kbuf1[krandnum-1],newrandquestion6); + newrandquestion7 = replace_s(newrandquestion6,"]\O",houmsg,newrandquestion7); + return newrandquestion7; + } + return oldstr; +} + +char *str_ganraoan(char *oldstr) +{ + char* newrandquestion = NULL; + newrandquestion = strstr(oldstr,"["); + if(newrandquestion!=NULL){ + char *newrandquestion2 = NULL; + char *newrandquestion5 = NULL; + char newrandquestion3[64],newrandquestion4[64]; + memset(newrandquestion3, 0, sizeof(newrandquestion3)); + memset(newrandquestion4, 0, sizeof(newrandquestion4)); + int qnum1,qnum2; + newrandquestion2 = strstr(oldstr,"]"); + qnum1 = strlen(newrandquestion); + qnum2 = strlen(newrandquestion2); + int qi; + for(qi=1;qi25){ + if(qi==0){ + sprintf(newrandquestion4,"%s%c",grbuff[RAND(1,60)-1],newrandquestion3[qi]); + } + else{ + sprintf(newrandquestion4,"%s %c",newrandquestion4,newrandquestion3[qi]); + } + } + } + sprintf(newrandquestion4,"%s ",newrandquestion4); + newrandquestion5 = replace_s(oldstr,newrandquestion3,newrandquestion4,newrandquestion5); + char kbuf1[7][5] = {"","","","","","",""}; + char kbuf2[7][5] = {"","","","","","",""}; + char *newrandquestion6 = NULL; + char *newrandquestion7 = NULL; + int krandnum = RAND(1,7); + char houmsg[64]; + memset(houmsg, 0, sizeof(houmsg)); + sprintf(houmsg,"%s]",grbuff[RAND(1,60)-1]); + newrandquestion6 = replace_s(newrandquestion5,"[\O","[",newrandquestion6); + newrandquestion7 = replace_s(newrandquestion6,"]\O",houmsg,newrandquestion7); + return newrandquestion7; + } + return oldstr; +} + +char *str_hanzi_ganrao(char *tmpbuff1,char *tmpbuff2,char *tmpbuff3,char *tmpbuff4,int flg,int rand1,int rand2,int rand3,int rand4,int rand5) +{ + char newstr[128]; + memset(newstr, 0, sizeof(newstr)); + char grbuff[100][5] = {".","","","","","`","","","p","-","","*","^","~","","","","","","","","","","","",",",",",",",",",",",",",",",",",",",",", + "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", + " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","","","","",""}; + char kbuf1[7][5] = {"","","","","","",""}; + char kbuf2[7][5] = {"","","","","","",""}; + if(flg==0){ + int kuangnum = RAND(1,7)-1; + sprintf(newstr,"%s%s%s%s%s%s%s%s%s%s%s",kbuf1[kuangnum],grbuff[RAND(1,100)-1],tmpbuff1,grbuff[RAND(1,100)-1],tmpbuff2,grbuff[RAND(1,100)-1],tmpbuff3,grbuff[RAND(1,100)-1],tmpbuff4,grbuff[RAND(1,100)-1],kbuf2[kuangnum]); + }else{ + sprintf(newstr,"%s%s%s%s%s%s%s%s%s%s%s",kbuf1[3],grbuff[rand1],tmpbuff1,grbuff[rand2],tmpbuff2,grbuff[rand3],tmpbuff3,grbuff[rand4],tmpbuff4,grbuff[rand5],kbuf2[3]); + } + return newstr; +} + +#ifdef _CAX_LNS_CHARSUOXU +int CHAR_getEmptyPetBoxNum(int charaindex) +{ + if( !CHAR_CHECKINDEX(charaindex)) + return -1; + + int i = 0 ; + int EmptyNum = 0; + + for( ; i +#include +#ifdef _REDHAT_V9 +#include +#endif + +#include "readmap.h" +#include "common.h" +#include "util.h" +#include "anim_tbl.h" +#include "battle.h" +#include "char.h" +#include "char_data.h" +#include "buf.h" +#include "item.h" +#include "log.h" +#include "pet.h" +#include "enemy.h" +#ifdef _PERSONAL_FAME // Arminius: +#include "char_base.h" +#include "configfile.h" +#endif + + +#include "defaultPlayer.h" + +#include "ls2data.dat" + +// CoolFish: Family 2001/7/28 +#include "family.h" +#include "saacproto_cli.h" + +#ifdef _PET_LIMITLEVEL +void CHAR_CheckPetDoLimitlevel( int petindex , int toindex, int level); +#endif + + +typedef struct tagdefaultCharcterGet +{ + int imagenumber; + Char* initchardata; + LevelUpPattern* lvpattern; + CHAR_ImageType imgtype; +}defaultCharacterGet; + +static defaultCharacterGet CHAR_defaultCharacterGet[]= +{ + /* CHAR_DEFAULTPLAYER */ +//Ҽɨ + {SPR_001em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDBOY}, + {SPR_002em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDBOY}, + {SPR_003em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDBOY}, + {SPR_004em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDBOY}, + +// + {SPR_011em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_012em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_013em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_014em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + +// + {SPR_021em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_022em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_023em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_024em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + +// + {SPR_031em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_032em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_033em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + {SPR_034em,&player,&lvplayer00,CHAR_IMAGETYPE_BOY}, + +// + {SPR_041em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_042em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_043em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_044em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + +// + {SPR_051em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_052em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_053em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + {SPR_054em,&player,&lvplayer00,CHAR_IMAGETYPE_MAN}, + +//ҼԨ + {SPR_061em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDGIRL}, + {SPR_062em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDGIRL}, + {SPR_063em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDGIRL}, + {SPR_064em,&player,&lvplayer00,CHAR_IMAGETYPE_CHILDGIRL}, + +//Ԩ + {SPR_071em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_072em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_073em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_074em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + +//Ԩ + {SPR_081em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_082em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_083em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_084em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + +//Ԩ + {SPR_091em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_092em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_093em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + {SPR_094em,&player,&lvplayer00,CHAR_IMAGETYPE_GIRL}, + +// + {SPR_101em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_102em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_103em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_104em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + +// + {SPR_111em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_112em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_113em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + {SPR_114em,&player,&lvplayer00,CHAR_IMAGETYPE_WOMAN}, + + {SPR_pet001,&player,&lvplayer00,CHAR_IMAGETYPE_DOG}, + {SPR_pet002,&player,&lvplayer00,CHAR_IMAGETYPE_DOG}, + {SPR_pet003,&player,&lvplayer00,CHAR_IMAGETYPE_DOG}, + {SPR_pet004,&player,&lvplayer00,CHAR_IMAGETYPE_DOG}, + {SPR_pet011,&player,&lvplayer00,CHAR_IMAGETYPE_DOG}, +}; + +BOOL CHAR_getDefaultChar( Char* nc , int imagenumber ) +{ + int i, j; + int defcharaindex; + + Char* defaultchar; + defaultchar = CHAR_defaultCharacterGet[arraysizeof(CHAR_defaultCharacterGet) - 1].initchardata; + + memset( nc,0,sizeof(Char) ); + defcharaindex = 0; + for( i = 0 ; i < arraysizeof( CHAR_defaultCharacterGet ) ; i ++ ){ + if( CHAR_defaultCharacterGet[i].imagenumber == imagenumber ){ + defaultchar = CHAR_defaultCharacterGet[i].initchardata; + defcharaindex = i; + break; + } + } + nc->data[CHAR_IMAGETYPE] = CHAR_defaultCharacterGet[defcharaindex].imgtype; + nc->use = TRUE; + +#ifdef _CHAR_FIXDATADEF + for( j = 0 ; j < CHAR_DATAINTNUM ; j ++ ){ + if( j < CHAR_INITDATA ) nc->data[j] = defaultchar->data[j]; + else nc->data[j] = 0; + } +#else + for( j = 0 ; j < CHAR_DATAINTNUM ; j ++ ) + nc->data[j] = defaultchar->data[j]; +#endif + for( j = 0 ; j < arraysizeof( nc->flg ) ; j ++ ) + nc->flg[j] = defaultchar->flg[j]; + + for( j = 0 ; j < CHAR_DATACHARNUM ; j ++ ) + nc->string[j].string[0] = '\0'; + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j ++ ) + nc->indexOfExistItems[j] = -1; + for( j = 0 ; j < CHAR_MAXPOOLITEMHAVE ; j ++ ) + nc->indexOfExistPoolItems[j] = -1; + for( j = 0 ; j < CHAR_MAXPETSKILLHAVE ; j ++ ) + nc->unionTable.indexOfPetskill[j] = -1; + for( j = 0 ; j < CHAR_MAXPOOLPETHAVE ; j ++ ) + nc->indexOfPoolPet[j] = -1; + for( j = 0 ; j < CHAR_SKILLMAXHAVE ; j ++ ) + nc->haveSkill[j].use = FALSE; + for( j = 0 ; j < CHAR_TITLEMAXHAVE ; j ++ ) + nc->indexOfHaveTitle[j] = -1; + for( j=0 ; jaddressBook[j],0,sizeof(nc->addressBook[j]) ); + for( j = 0 ; j < CHAR_WORKDATAINTNUM ; j ++ ) + nc->workint[j] = 0; + for( j = 0 ; j < CHAR_WORKDATACHARNUM ; j ++ ) + nc->workchar[j].string[0] = '\0'; + nc->workint[CHAR_WORKFD] = -1; + nc->workint[CHAR_WORKCHATROOMNUM] = -1; + + return TRUE; +} + +static int CHAR_playerImageNumber[]= +{ + /* CHAR_DEFAULTPLAYER */ + SPR_001em,SPR_002em,SPR_003em,SPR_004em,SPR_011em,SPR_012em, + SPR_013em,SPR_014em,SPR_021em,SPR_022em,SPR_023em,SPR_024em, + SPR_031em,SPR_032em,SPR_033em,SPR_034em,SPR_041em,SPR_042em, + SPR_043em,SPR_044em,SPR_051em,SPR_052em,SPR_053em,SPR_054em, + SPR_061em,SPR_062em,SPR_063em,SPR_064em,SPR_071em,SPR_072em, + SPR_073em,SPR_074em,SPR_081em,SPR_082em,SPR_083em,SPR_084em, + SPR_091em,SPR_092em,SPR_093em,SPR_094em,SPR_101em,SPR_102em, + SPR_103em,SPR_104em,SPR_111em,SPR_112em,SPR_113em,SPR_114em +}; + +BOOL CHAR_checkPlayerImageNumber( int imagenumber) +{ + int i; + for( i = 0; i < arraysizeof( CHAR_playerImageNumber); i ++ ) { + if( imagenumber == CHAR_playerImageNumber[i] ) break; + } + if( i == arraysizeof( CHAR_playerImageNumber)) return FALSE; + else return TRUE; +} +/*------------------------------------------------------------ + * ӿ į + * + * ӿ įƱɡѨƥȻ + * number = + * CG_CHR_MAKE_FACE + (number*100) + ( number * 25) + ( į * 5 ) + į + * + ------------------------------------------------------------*/ +BOOL CHAR_checkFaceImageNumber( int imagenumber, int faceimagenumber) +{ + int image = imagenumber - SPR_001em; + int number; + int color; + number = (faceimagenumber - CG_CHR_MAKE_FACE)/ 100*20; + color = ((faceimagenumber - CG_CHR_MAKE_FACE)% 100) / 25*5; + if( image != number + color ) return FALSE; + return TRUE; +} +// ƽҷ Ƥۨ ؤԻ +int CHAR_eqimagetbl[][5]={ + // ƥ + { SPR_001em,SPR_001ax,SPR_001cl,SPR_001sp,SPR_001bw }, + { SPR_002em,SPR_002ax,SPR_002cl,SPR_002sp,SPR_002bw }, + { SPR_003em,SPR_003ax,SPR_003cl,SPR_003sp,SPR_003bw }, + { SPR_004em,SPR_004ax,SPR_004cl,SPR_004sp,SPR_004bw }, + { SPR_011em,SPR_011ax,SPR_011cl,SPR_011sp,SPR_011bw }, + { SPR_012em,SPR_012ax,SPR_012cl,SPR_012sp,SPR_012bw }, + { SPR_013em,SPR_013ax,SPR_013cl,SPR_013sp,SPR_013bw }, + { SPR_014em,SPR_014ax,SPR_014cl,SPR_014sp,SPR_014bw }, + { SPR_021em,SPR_021ax,SPR_021cl,SPR_021sp,SPR_021bw }, + { SPR_022em,SPR_022ax,SPR_022cl,SPR_022sp,SPR_022bw }, + { SPR_023em,SPR_023ax,SPR_023cl,SPR_023sp,SPR_023bw }, + { SPR_024em,SPR_024ax,SPR_024cl,SPR_024sp,SPR_024bw }, + { SPR_021em,SPR_021ax,SPR_021cl,SPR_021sp,SPR_021bw }, + { SPR_031em,SPR_031ax,SPR_031cl,SPR_031sp,SPR_031bw }, + { SPR_032em,SPR_032ax,SPR_032cl,SPR_032sp,SPR_032bw }, + { SPR_033em,SPR_033ax,SPR_033cl,SPR_033sp,SPR_033bw }, + { SPR_034em,SPR_034ax,SPR_034cl,SPR_034sp,SPR_034bw }, + { SPR_041em,SPR_041ax,SPR_041cl,SPR_041sp,SPR_041bw }, + { SPR_042em,SPR_042ax,SPR_042cl,SPR_042sp,SPR_042bw }, + { SPR_043em,SPR_043ax,SPR_043cl,SPR_043sp,SPR_043bw }, + { SPR_044em,SPR_044ax,SPR_044cl,SPR_044sp,SPR_044bw }, + + { SPR_051em,SPR_051ax,SPR_051cl,SPR_051sp,SPR_051bw }, + { SPR_052em,SPR_052ax,SPR_052cl,SPR_052sp,SPR_052bw }, + { SPR_053em,SPR_053ax,SPR_053cl,SPR_053sp,SPR_053bw }, + { SPR_054em,SPR_054ax,SPR_054cl,SPR_054sp,SPR_054bw }, + + { SPR_061em,SPR_061ax,SPR_061cl,SPR_061sp,SPR_061bw }, + { SPR_062em,SPR_062ax,SPR_062cl,SPR_062sp,SPR_062bw }, + { SPR_063em,SPR_063ax,SPR_063cl,SPR_063sp,SPR_063bw }, + { SPR_064em,SPR_064ax,SPR_064cl,SPR_064sp,SPR_064bw }, + + { SPR_071em,SPR_071ax,SPR_071cl,SPR_071sp,SPR_071bw }, + { SPR_072em,SPR_072ax,SPR_072cl,SPR_072sp,SPR_072bw }, + { SPR_073em,SPR_073ax,SPR_073cl,SPR_073sp,SPR_073bw }, + { SPR_074em,SPR_074ax,SPR_074cl,SPR_074sp,SPR_074bw }, + + { SPR_081em,SPR_081ax,SPR_081cl,SPR_081sp,SPR_081bw }, + { SPR_082em,SPR_082ax,SPR_082cl,SPR_082sp,SPR_082bw }, + { SPR_083em,SPR_083ax,SPR_083cl,SPR_083sp,SPR_083bw }, + { SPR_084em,SPR_084ax,SPR_084cl,SPR_084sp,SPR_084bw }, + + { SPR_091em,SPR_091ax,SPR_091cl,SPR_091sp,SPR_091bw }, + { SPR_092em,SPR_092ax,SPR_092cl,SPR_092sp,SPR_092bw }, + { SPR_093em,SPR_093ax,SPR_093cl,SPR_093sp,SPR_093bw }, + { SPR_094em,SPR_094ax,SPR_094cl,SPR_094sp,SPR_094bw }, + + { SPR_101em,SPR_101ax,SPR_101cl,SPR_101sp,SPR_101bw }, + { SPR_102em,SPR_102ax,SPR_102cl,SPR_102sp,SPR_102bw }, + { SPR_103em,SPR_103ax,SPR_103cl,SPR_103sp,SPR_103bw }, + { SPR_104em,SPR_104ax,SPR_104cl,SPR_104sp,SPR_104bw }, + + { SPR_111em,SPR_111ax,SPR_111cl,SPR_111sp,SPR_111bw }, + { SPR_112em,SPR_112ax,SPR_112cl,SPR_112sp,SPR_112bw }, + { SPR_113em,SPR_113ax,SPR_113cl,SPR_113sp,SPR_113bw }, + { SPR_114em,SPR_114ax,SPR_114cl,SPR_114sp,SPR_114bw }, + + { SPR_091em,SPR_091ax,SPR_091cl,SPR_091sp,SPR_091bw }, + { SPR_092em,SPR_092ax,SPR_092cl,SPR_092sp,SPR_092bw }, + + { SPR_pet001,SPR_pet001,SPR_pet001,SPR_pet001,SPR_pet001}, + { SPR_pet002,SPR_pet002,SPR_pet002,SPR_pet002,SPR_pet002}, + { SPR_pet003,SPR_pet003,SPR_pet003,SPR_pet003,SPR_pet003}, + { SPR_pet004,SPR_pet004,SPR_pet004,SPR_pet004,SPR_pet004}, + + { SPR_pet011,SPR_pet011,SPR_pet011,SPR_pet011,SPR_pet011}, + + { SPR_121em,SPR_121ax,SPR_121cl,SPR_121sp,SPR_121bw }, + { SPR_122em,SPR_122ax,SPR_122cl,SPR_122sp,SPR_122bw }, + + { SPR_131em,SPR_131ax,SPR_131cl,SPR_131sp,SPR_131bw }, + { SPR_132em,SPR_132ax,SPR_132cl,SPR_132sp,SPR_132bw }, + { SPR_133em,SPR_133ax,SPR_133cl,SPR_133sp,SPR_133bw }, + + { SPR_141em,SPR_141ax,SPR_141cl,SPR_141sp,SPR_141bw }, + { SPR_142em,SPR_142ax,SPR_142cl,SPR_142sp,SPR_142bw }, + + { SPR_151em,SPR_151ax,SPR_151cl,SPR_151sp,SPR_151bw }, + { SPR_152em,SPR_152ax,SPR_152cl,SPR_152sp,SPR_152bw }, + + { SPR_161em,SPR_161ax,SPR_161cl,SPR_161sp,SPR_161bw }, + { SPR_162em,SPR_162ax,SPR_162cl,SPR_162sp,SPR_162bw }, + +}; + +/*------------------------------------------------------------ + * įޥ įë £ + * ¦ + * basebaseimagenumber int ئ į + * category ITEM_CATEGORY ʧ ة + * ߯Ի + * ޥ į۾޷¡ݷ-1 + ------------------------------------------------------------*/ +int CHAR_getNewImagenumberFromEquip( int basebaseimagenumber, + ITEM_CATEGORY category ) +{ + int i; + /* ITEM_CATEGORY */ + if( category < 0 || category > arraysizeof(CHAR_eqimagetbl[0]) ) + return -1; + for( i=0 ; i rx )swap(lx,rx); + if( ly > ry )swap(ly,ry); + + CHAR_invarea[invreadlen].area.x = lx; + CHAR_invarea[invreadlen].area.y = ly; + CHAR_invarea[invreadlen].area.width = rx-lx; + CHAR_invarea[invreadlen].area.height= ry-ly; + invreadlen ++; + } + } + fclose(f); + CHAR_invareanum = invreadlen; + print( "ЧսЧ %d...", CHAR_invareanum ); + +#ifdef DEBUG + { + int i; + for( i=0; i 3 ) { + return FALSE; + } + index=hometown; + + if( index >= arraysizeof( elders ) ){ + return FALSE; + } + + ch->data[CHAR_FLOOR] = elders[index].floor; + ch->data[CHAR_X] = elders[index].x; + ch->data[CHAR_Y] = elders[index].y; + ch->data[CHAR_LASTTALKELDER] = index; + point = ch->data[CHAR_SAVEPOINT]; + + point = point | (1<data[CHAR_SAVEPOINT] = point; + + if( MAP_checkCoordinates( ch->data[CHAR_FLOOR], ch->data[CHAR_X], + ch->data[CHAR_Y] ) == FALSE ){ + return FALSE; + } + + return TRUE; +} + +/*------------------------------------------------------------ + * ޻ĸë + * ¦ + * elderindex int ޻ĸ̼͵ + * fl int* ׷ʧë + * x int* xë + * y int* yë + * ¦ + * TRUE(1) + * FALSE(0) + ------------------------------------------------------------*/ +BOOL CHAR_getElderPosition( int elderindex, int* fl, int* x, int* y ) +{ + if( elderindex<0 || arraysizeof(elders)<=elderindex )return FALSE; + + *fl = elders[elderindex].floor; + *x = elders[elderindex].x; + *y = elders[elderindex].y; + return TRUE; +} +/*------------------------------------------------------------ + * Ӯ NPCмӮ ̤꼰֣ + * ׻̵̼ + * ¦ + * index int ƥ FALSE ë + * fl int + * x int + * y int + * NPCľ¼֣ + ------------------------------------------------------------*/ +BOOL CHAR_ElderSetPosition( int elderindex ,int fl,int x ,int y) +{ + if( elderindex < ELDERINDEXSTART || + elderindex >= MAXELDERS ){ + return FALSE; + } + + elders[elderindex].floor = fl; + elders[elderindex].x = x; + elders[elderindex].y = y; + return TRUE; +} + + +void CHAR_setInitValues( Char* ch ) +{ + +#ifndef _PROFESSION_SKILL // WON ADD ְҵ + + static int CHAR_titleindextbl[] ={ 0,1,2,3,4,5,6 }; + int elderindex; + int i; + BOOL magician=FALSE; + BOOL priest=FALSE; + + elderindex = ch->data[CHAR_LASTTALKELDER]; + if( 0 <= elderindex + && elderindex < arraysizeof( CHAR_titleindextbl ) ) + ch->indexOfHaveTitle[0] = CHAR_titleindextbl[elderindex]; + + + for( i=0 ; ihaveSkill[i].use ){ + int j; + int skindex=ch->haveSkill[i].skill.data[SKILL_IDENTITY]; + + for( j=0 ; jdata[CHAR_GOLD] = 20; + + if( skindex == SKILL_MAGICIAN ) + magician = TRUE; + else if( skindex == SKILL_PRIEST ) + priest = TRUE; + + } + } + + if( magician || priest ) CHAR_addItemToChar( ch, 802 ); + +#endif +} + + +#if 1 +static int EnemyExpTbl[]={ +0, // 0 +2, // 1 +4, // 2 +6, // 3 +8, // 4 +10, // 5 +12, // 6 +14, // 7 +16, // 8 +18, // 9 +20, // 10 +26, // 11 +32, // 12 +38, // 13 +44, // 14 +50, // 15 +60, // 16 +70, // 17 +80, // 18 +90, // 19 +100, // 20 +115, // 21 +130, // 22 +145, // 23 +160, // 24 +175, // 25 +190, // 26 +205, // 27 +220, // 28 +235, // 29 +250, // 30 +270, // 31 +290, // 32 +310, // 33 +330, // 34 +350, // 35 +375, // 36 +400, // 37 +425, // 38 +450, // 39 +475, // 40 +500, // 41 +525, // 42 +550, // 43 +575, // 44 +600, // 45 +625, // 46 +650, // 47 +675, // 48 +700, // 49 +725, // 50 +750, // 51 +775, // 52 +800, // 53 +825, // 54 +850, // 55 +875, // 56 +900, // 57 +925, // 58 +950, // 59 +980, // 60 +1010, // 61 +1040, // 62 +1070, // 63 +1100, // 64 +1130, // 65 +1160, // 66 +1190, // 67 +1220, // 68 +1250, // 69 +1280, // 70 +1310, // 71 +1345, // 72 +1380, // 73 +1415, // 74 +1450, // 75 +1485, // 76 +1520, // 77 +1555, // 78 +1590, // 79 +1630, // 80 +1670, // 81 +1710, // 82 +1750, // 83 +1790, // 84 +1830, // 85 +1870, // 86 +1910, // 87 +1950, // 88 +1990 // 89 +}; // 90 + + + + + + + + + + + + + + + + +// öئң +int GetEnemyExp( int level ){ +/* + int exp = 0; + if( level < 5 ){ + exp = 2 * level; + }else + if( level < 10 ){ + exp = 10 * level; + }else + if( level < 20 ){ + exp = 15 * level; + }else + if( level < 30 ){ + exp = 30 * level; + }else + if( level < 40 ){ + exp = 50 * level; + }else + if( level < 50 ){ + exp =60 * level; + }else + if( level < 60 ){ + exp =60 * level; + }else{ + exp =70 * level; + } +*/ + if( level >= arraysizeof( EnemyExpTbl ) )level = arraysizeof( EnemyExpTbl )-1; + return EnemyExpTbl[level]; +} +#endif + +#ifdef _NEWOPEN_MAXEXP +/*static int NeedLevelUpTbls[] = { + 0, 0, + 2, 6, 18, 37, 67, 110, 170, + 246, 344, 464, 610, 782, 986, 1221, + 1491, 1798, 2146, 2534, 2968, 3448, 3978, + 4558, 5194, 5885, 6635, 7446, 8322, 9262, + 10272, 11352, 12506, 13734, 15042, 16429, 17899, + 19454, 21098, 22830, 24656, 26576, 28594, 30710, + 32930, 35253, 37683, 40222, 42874, 45638, 48520, + 51520, 54642, 57886, 61258, 64757, 68387, 72150, + 76050, 80086, 84264, 106110, 113412, 121149, 129352, + 138044, 147256, 157019, 167366, 178334, 189958, 202282, + 215348, 229205, 243901, 259495, 276041, 293606, 312258, + 332071, 353126, 375511, 399318, 424655, 451631, 480370, + 511007, 543686, 578571, 615838, 655680, 698312, 743971, + 792917, 845443, 901868, 962554, 1027899, 1098353, 1174420, + 1256663, 1345723, 1442322, 1547281, 1661531, 1786143, 1922340, + 2071533, 2235351, 2415689, 2614754, 2835137, 3079892, 3352633, + 3657676, 4000195, 4386445, 4824041, 5322323, 5892866, 6550125, + 12326614, 15496114, 20025638, 26821885, 37698249, 56734876, 68097265, + 68290815, 68487425, 68687119, 68889921, 69095855, 69304945, 69517215, + 69732689, 69951391, 70173345, 70398575, 70627105, 70858959, 71244161, + 71342735, 71584705, 71830095, 72078929, 72331231, 72587025, 72846335, + 73109185, 73615599, 73655601, 73929215, 74206465, 74487375, 74771969, + 75060271, 75352305, 75648095, 75947665, 76421039, 76563241, 76874295, + 77189225, 77508055, 77830809, 78157511, 78488185, 78822855, 79161545, + 79724279, 79856081, 80206975, 80561985, 80921135, 81284449, 81651951, + 82023665, 82399615, 82779825, 83434319, 83558121, 83951255, 84348745, + 84750615, 85156889, 85567591, 85982745, 86402375, 86826505, 87575159, + 87693361, 88131135, 88573505, 89020495, 89472129, 89928431, 90389425, + 90855135, 91325585, 91800799 +}; +*/ +#endif +static int LevelUpTbl[] = { // ֵ ȼ +0, // 0 EX=(lv^4)/10 +0, // 1 + 2, 8, 25, 62, 129, + 240, 409, 656, 1000, 1464, // 11 + 2073, 2856, 3841, 5062, 6553, // 16 + 8352, 10497, 13032, 16000, 19448, 23425, // 22 + 27984, 33177, 39062, 45697, 53144, 61465, // 28 + 70728, 81000, 92352, 104857, 118592, 133633, // 34 + 150062, 167961, 187416, 208513, 231344, 256000, // 40 + 282576, 311169, 341880, 374809, 410062, 447745, // 46 + 487968, 530841, 576480, 625000, 676520, 731161, // 52 + 789048, 850305, 915062, 983449, 1055600, 1131649, // 58 + 1211736, 1296000, + 1402110, // 61 EX=(lv^4)/(10-0.125*(lv-60)) + 1515521, 1636671, 1766022, 1904066, 2051322, 2208342, // 67 + 2375708, 2554041, 2744000, 2946281, 3161630, 3390834, // 73 + 3634736, 3894230, 4170272, 4463878, 4776136, 5108207, // 79 + 5461333, 5836843, 6236162, 6660816, 7112448, 7592818, // 85 + 8103824, 8647511, 9226082, 9841920, 10497600, 11195912, // 91 + 11939882, 12732800, 13578242, 14480111, 15442664, 16470563, // 97 + 17568917, 18743336, 20000000, 21345723, 22788045, 24335325, // 103 + 25996856, 27783000, 29705340, 31776872, 34012224, 36427912, // 109 + 39042666, 41877804, 44957696, 48310329, 51968004, 55968200, // 115 + 60354645, 65178685, 70501009, 76393874, 82944000, + + 95270613, // 121 Nuke 0624 EX=(lv^4)/(2.5-0.25*(lv-120)) + 110766728, 130792366, 157614250, 195312500, // 125 + 252047376, // 126 EX=lv^4+60000000*(lv-126)^2 Nuke 0816 + 320144641, 388435456, 456922881, 525610000, 594499921, 663595776, // 132 + 732900721, 802417936, 872150625, 942102016,1012275361,1082673936, // 138 + 1153301041,1224160000 // 140 +}; + +int CHAR_GetLevel() +{ + return arraysizeof( LevelUpTbl )-1; +} +int CHAR_GetLevelExp( int charaindex, int level) +{ +#ifdef _NEWOPEN_MAXEXP +#ifdef _USER_EXP_CF + if(level>getMaxLevel()){ + if(level>CHAR_getInt(charaindex, CHAR_LIMITLEVEL)) + return -1; + }else if(level>getYBLevel()){ + if ((CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET || CHAR_getInt( charaindex, CHAR_FUSIONBEIT ) == 1)) { + if(getPettrans() != -1 ){ + if(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)>=getPettrans()) + return getNeedLevelUpTbls(level); + }else{ + if(level<=CHAR_getInt(charaindex, CHAR_LIMITLEVEL)) + return getNeedLevelUpTbls(level); + } + return -1; + } +#ifdef _PLAYER_NPC + else if (CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC + || CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERPETNPC){ + return -1; + } +#endif + else{ + if(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)= arraysizeof( NeedLevelUpTbls ) ){ + return -1; + } + return NeedLevelUpTbls[level];*/ +#else + if( level >= arraysizeof( LevelUpTbl ) ){ + return -1; + } + return LevelUpTbl[level]; +#endif +} + +int CHAR_GetOldLevelExp( int level) +{ + if( level >= arraysizeof( LevelUpTbl ) ){ + return -1; + } + return LevelUpTbl[level]; +} + +int CHAR_LevelUpCheck( int charaindex , int toindex) +{ + int exp, level, nextexp, iRet = FALSE; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return 0; + exp = CHAR_getInt( charaindex, CHAR_EXP ); + while( 1 ){ + level = CHAR_getInt( charaindex, CHAR_LV ); + nextexp = CHAR_GetLevelExp( charaindex, level+1); + if( nextexp < 0 ) + break; + // Arminius 7.30 pet limit lv + if (CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPET || + CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC || + CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERPETNPC) { + + if (level >= CHAR_getInt(charaindex, CHAR_LIMITLEVEL) && + CHAR_getInt(charaindex, CHAR_LIMITLEVEL) > 0 ) { +#ifdef _NEWOPEN_MAXEXP + CHAR_setInt( charaindex, CHAR_EXP , 0); +#else +#ifdef _PET_LIMITLEVEL + if( CHAR_getInt( charaindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( charaindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( charaindex, CHAR_PETID) == getMMPETID2() +#endif + ) { + nextexp = CHAR_GetLevelExp( charaindex, CHAR_getInt(charaindex, CHAR_LIMITLEVEL)); + CHAR_setInt( charaindex, CHAR_EXP , nextexp ); + } +#endif +#endif + break; + } + } + if( exp >= nextexp ){ + iRet ++; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ +#ifdef _DP_140_160_MODE + if(getNewDpMode()==1){ + if(level+1==140) + CHAR_setInt( charaindex, CHAR_DUELPOINT,CHAR_getInt( charaindex, CHAR_DUELPOINT)+100000 ); + else if(level+1==160) + CHAR_setInt( charaindex, CHAR_DUELPOINT,CHAR_getInt( charaindex, CHAR_DUELPOINT)+1000000 ); + }else{ + CHAR_setInt( charaindex, CHAR_DUELPOINT, + CHAR_getInt( charaindex, CHAR_DUELPOINT) + (level+1)*10 ); + } +#else + CHAR_setInt( charaindex, CHAR_DUELPOINT, + CHAR_getInt( charaindex, CHAR_DUELPOINT) + (level+1)*10 ); +#endif + } +#ifdef _PET_LIMITLEVEL + else { + CHAR_CheckPetDoLimitlevel( charaindex, toindex, level ); + } +#endif + +#ifdef _NEWOPEN_MAXEXP + if( level >= CHAR_MAXUPLEVEL ){ + }else{ + if( CHAR_HandleExp( charaindex) != -1 ){ + exp = CHAR_getInt( charaindex, CHAR_EXP ); + CHAR_setInt( charaindex, CHAR_LV, level+1 ); + } + } +#else + CHAR_setInt( charaindex, CHAR_LV, level+1 ); +#endif + }else{ + break; + } + } + return iRet; +} + +#ifdef _PET_LIMITLEVEL +void CHAR_CheckPetDoLimitlevel( int petindex , int toindex, int level) +{ + int LevelUpPoint,vital,str,tgh,dex; + int j,k; + char token[56]; +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + + if( CHAR_getInt( petindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( petindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( petindex, CHAR_PETID) == getMMPETID2() +#endif + ) { + LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + vital = (int )(( LevelUpPoint >> 24 ) & 0xFF); + str = (int)(( LevelUpPoint >> 16 ) & 0xFF); + tgh = (int)(( LevelUpPoint >> 8 ) & 0xFF); + dex = (int)(( LevelUpPoint >> 0 ) & 0xFF); + + if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( toindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( toindex, CHAR_NAME) )){ + sprintf(token,"Ҳʶѽһˣ"); + //andy 1/11 reEdit + vital -= RAND(2,10); if (vital<0) vital=0; + str -= RAND(2,10); if (str<0) str=0; + tgh -= RAND(2,10); if (tgh<0) tgh=0; + dex -= RAND(2,10); if (dex<0) dex=0; + LevelUpPoint = (vital<<24)+(str<<16)+(tgh<<8)+(dex<<0); + + CHAR_setInt( petindex, CHAR_ALLOCPOINT , LevelUpPoint); + CHAR_talkToCli( toindex, petindex, token, CHAR_COLORWHITE); + + LogPetPointChange( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + petindex, 2, + CHAR_getInt( petindex, CHAR_LV), + "No_master(ٲ)", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ) + ); + } + + if( ( level % 20 ) == 0 ) { + for( j=0; j < 3; j++) { + k = RAND( 0, 3); + if( k == 0 ) + vital--; + if( k == 1 ) + str--; + if( k == 2 ) + tgh--; + if( k == 3 ) + dex--; + } + if( vital < 0 ) vital =0; + if( str < 0 ) str =0; + if( tgh < 0 ) tgh =0; + if( dex < 0 ) dex =0; + LevelUpPoint = (vital<<24)+(str<<16)+(tgh<<8)+(dex<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT , LevelUpPoint); + //print("\n << ( level % 20 ) == 0 >> "); + LogPetPointChange( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + petindex,3, + CHAR_getInt( petindex, CHAR_LV), + "level%20", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ) + ); + } + } +} +#endif + +int CHAR_PetTakeDrop( int petindex, int floor, int ox, int oy) //ǿƶ +{ + int x, y, objindex; + + x = rand()%10; + y = rand()%10; + + //³ CHAR_endCharOneArray + objindex = PET_dropPetAbsolute( petindex,floor,x,y, FALSE ); + if( objindex == -1 ) { + return -1; + } + CHAR_setWorkInt( petindex,CHAR_WORKOBJINDEX,objindex ); + CHAR_setInt( petindex, CHAR_FLOOR, floor); + CHAR_setInt( petindex, CHAR_X, x); + CHAR_setInt( petindex, CHAR_Y, y); + CHAR_sendCToArroundCharacter( objindex); + + return floor; +} + +int CHAR_PetTakeLevelUp( int petindex, int lv)//ǿƳ +{ + int k; + for( k = 1; k < lv; k ++ ){ + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + + CHAR_complianceParameter( petindex ); + return k; +} + +#ifdef _NEW_MANOR_LAW +extern struct FM_POINTLIST fmpointlist; +#endif + +int CHAR_PetLevelUp( int petindex ) +{ + struct _RankRandTbl{ + int min; + int max; + }RankRandTbl[] = { + { 450, 500 }, + { 470, 520 }, + { 490, 540 }, + { 510, 560 }, + { 530, 580 }, + { 550, 600 }, + }; + + float Param[4] = { 0.0, 0.0, 0.0, 0.0 }; + int LevelUpPoint, petrank; + float str, vital, dex, tgh, fRand, i; +#ifdef _TEACHER_SYSTEM + int iGetFame = 0; +#endif + // ¦ + if( CHAR_CHECKINDEX( petindex ) == FALSE ) return -1; + if( CHAR_getInt( petindex, CHAR_WHICHTYPE ) != CHAR_TYPEPET && + CHAR_getInt( petindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYERNPC && + CHAR_getInt( petindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYERPETNPC)return -1; + + LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + + // ʸ¼ + petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + if( petrank < 0 || petrank > 5 ) petrank = 0; + + // + vital = (float)(( LevelUpPoint >> 24 ) & 0xFF); + str = (float)(( LevelUpPoint >> 16 ) & 0xFF); + tgh = (float)(( LevelUpPoint >> 8 ) & 0xFF); + dex = (float)(( LevelUpPoint >> 0 ) & 0xFF); + + // ߼Ԩ ëȻ + for( i = 0; i < 10; i ++ ){ + Param[RAND( 0, 3 )] += 1.0; + } + + // ¼ͱ巽 ¼ĸة + fRand = (float)RAND( RankRandTbl[petrank].min, RankRandTbl[petrank].max ) + * 0.01; + + // ԻԻ̼Իң + vital = (float)vital * fRand + Param[0] * fRand; + str = (float)str * fRand + Param[1] * fRand; + tgh = (float)tgh * fRand + Param[2] * fRand; + dex = (float)dex * fRand + Param[3] * fRand; + + // ң + CHAR_setInt( petindex, CHAR_VITAL, + CHAR_getInt( petindex, CHAR_VITAL ) + (int)vital ); + CHAR_setInt( petindex, CHAR_STR, + CHAR_getInt( petindex, CHAR_STR ) + (int)str ); + CHAR_setInt( petindex, CHAR_TOUGH, + CHAR_getInt( petindex, CHAR_TOUGH ) + (int)tgh ); + CHAR_setInt( petindex, CHAR_DEX, + CHAR_getInt( petindex, CHAR_DEX ) + (int)dex ); + + // CoolFish: + { + int level = CHAR_getInt(petindex, CHAR_LV); + int exp1 = 0, exp2 = 0; + if (level > 30){ + char tmpbuf[128]; +#ifdef _NEW_MANOR_LAW + char tmpbuf1[16]; +#endif + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); +#ifdef _FMVER21 +#else + if (CHAR_getInt(ownerindex, CHAR_FMINDEX) < 0) return 0; + if (CHAR_getInt(ownerindex, CHAR_FMLEADERFLAG) <= 0 ) return 0; + if (strcmp(CHAR_getChar(ownerindex, CHAR_FMNAME), "") == 0) return 0; +#endif + if (CHAR_CHECKINDEX(ownerindex)){ + exp1 = CHAR_GetLevelExp( petindex, level); + exp2 = CHAR_GetLevelExp( petindex, level - 1); + +//#ifdef _PERSONAL_FAME // Arminius 8.30: +// feedpoint = (exp1 - exp2) / 20000; // +//#else +// feedpoint = (exp1 - exp2) / 10000; +//#endif + if ( exp1 - exp2 > 0 && CHAR_getWorkInt(petindex,CHAR_WORKJILU)==0){ + int feedpoint; + // CoolFish: 2001/10/03 + int fd = getfdFromCharaIndex(ownerindex); +#ifdef _PERSONAL_FAME // Arminius 8.30: +#ifdef _PETUP_GET_EXP + if(getPetUpGetExp()==1){ + if(level>=131){ + int myfame = (20+(level-131)*5)*100; + if(level==138) myfame = 6000; + else if(level==139) myfame = 9000; + else if(level==140) myfame = 16000; + CHAR_earnFame(ownerindex, myfame); + sprintf(tmpbuf, "%d", myfame); + }else if(level<=130 && level>=126){ + CHAR_earnFame(ownerindex, exp2 / 30000); + sprintf(tmpbuf, "%d", exp2 / 30000); + }else{ + CHAR_earnFame(ownerindex, exp2 / 60000); + sprintf(tmpbuf, "%d", exp2 / 60000); + } + }else if(getPetUpGetExp()==0){ + CHAR_earnFame(ownerindex, exp2 / 20000); + sprintf(tmpbuf, "%d", exp2 / 20000); + }else{ + CHAR_earnFame(ownerindex, 0); // + sprintf(tmpbuf, "%d", 0); // + } +#else + CHAR_earnFame(ownerindex, exp2 / 20000); + sprintf(tmpbuf, "%d", exp2 / 20000); +#endif +#endif +#ifdef _PETUP_GET_EXP + if(getPetUpGetExp()==1){ + if(level>=131){ + int myfame = (20+(level-131)*5)*100; + if(level==138) myfame = 6000; + else if(level==139) myfame = 9000; + else if(level==140) myfame = 16000; + feedpoint = myfame; + }else if(level<=130 && level>=126){ + feedpoint=exp2 / 30000; + }else{ + feedpoint=exp2 / 60000; + } + }else if(getPetUpGetExp()==0){ + feedpoint=exp2 / 20000; + }else{ + feedpoint=0; + } +#else + feedpoint=exp2 / 20000; +#endif +#ifdef _NEW_MANOR_LAW + sprintf(tmpbuf1, "%d", CHAR_getInt(ownerindex,CHAR_FAME)); +#endif +#ifdef _FMVER21 + if (CHAR_getInt(ownerindex, CHAR_FMLEADERFLAG) > 0 + && CHAR_getInt(ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_APPLY){ + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(ownerindex, CHAR_FMNAME), + CHAR_getInt(ownerindex, CHAR_FMINDEX), + CHAR_getWorkInt(ownerindex, CHAR_WORKFMINDEXI), + FM_FIX_FMFEED, tmpbuf, +#ifndef _NEW_MANOR_LAW + "", +#else + tmpbuf1, +#endif + // CoolFish: 2001/10/03 + CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + // CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), 0); +#ifdef _NEW_MANOR_LAW + { + int i; + for(i=0;i 0){ + // ûеʦ + if(strlen(CHAR_getChar(ownerindex,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(ownerindex,CHAR_TEACHER_NAME)) > 0){ + int iPlayernum = CHAR_getPlayerMaxNum(),i; + char szMsg[128]; + + // 鵼ʦڲ + for(i=0;i 0 )return 0;//ǷΪںϳ + for( i=0; i<4; i++) { + work[i] = 0; + } + if( PET_getBaseAndSkill( charaindex, Subindex1, base, petskill, 0) == FALSE ) + return 0; + if( CHAR_getInt( Subindex1, CHAR_LV) < 80 ){//ȼ + for( i=0; i<4; i++) { + base[i] = base[i]*0.8; + } + } + for( i=0; i<4; i++) { + work[i] = base[i]; + } + for( i=0; i<7; i++) { + skill[i] = petskill[i]; + } + if( !CHAR_CHECKINDEX( Subindex2)) return 1; + if( EVOLUTION_getPetFusionCode( CHAR_getInt( Subindex2, CHAR_PETID) ) < 0 ){ + return 0; + } + + if( CHAR_getInt( Subindex2, CHAR_FUSIONBEIT) == 1 || + CHAR_getInt( Subindex2, CHAR_FUSIONRAISE) > 0 )return 0;//ǷΪںϳ + + if( PET_getBaseAndSkill( charaindex, Subindex2, base, NULL, 0) == FALSE ) + return 0; + if( CHAR_getInt( Subindex2, CHAR_LV) < 80 ){//ȼ + for( i=0; i<4; i++) { + base[i] = base[i]*0.8; + } + } + for( i=0; i<4; i++) { + work[i] += base[i]; + } + return 2; +} + +BOOL PETFUSION_FusionPetMain( int charaindex, int Mainindex, int *work, int *skill) +{ + int i; + int base[4]={0,0,0,0}; + int petskill[7]={-1,-1,-1,-1,-1,-1,-1}; + if( !CHAR_CHECKINDEX( Mainindex)) return FALSE; + if( EVOLUTION_getPetFusionCode( CHAR_getInt( Mainindex, CHAR_PETID) ) < 0 ){ + return 0; + } + if( CHAR_getInt( Mainindex, CHAR_FUSIONBEIT) == 1 || + CHAR_getInt( Mainindex, CHAR_FUSIONRAISE) > 0 )return FALSE;//ǷΪںϳ + + if( PET_getBaseAndSkill( charaindex, Mainindex, base, petskill, 0) == FALSE ) + return -1; + if( CHAR_getInt( Mainindex, CHAR_LV) < 80 ){//ȼ + for( i=0; i<4; i++) { + base[i] = base[i]*0.8; + } + } + for( i=0; i<4; i++) { + work[i] += base[i]*0.6; + } + for( i=0; i<7; i++) { + skill[i] = petskill[i]; + } + + return TRUE; +} + +BOOL PETFUSION_DelPet( int toindex, int Mainindex, int Subindex1, int Subindex2, int flg) +{ + int i, j, cnt=0; + int petindex[3]; + + + petindex[0] = Mainindex; + petindex[1] = Subindex1; + petindex[2] = Subindex2; + + for( i=0; i<3; i++) { + if( !CHAR_CHECKINDEX( petindex[i] ) ) continue; + for( j=0; j= CHAR_MAXPETHAVE){ + + }else { + char szPet[256]; + char msgbuf[256]; + CHAR_setCharPet( toindex, j, -1); + snprintf( szPet, sizeof( szPet ), "K%d", j); + CHAR_sendStatusString( toindex, szPet ); + + snprintf( msgbuf,sizeof( msgbuf), "%s", CHAR_getChar( petindex[i], CHAR_NAME)); + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORYELLOW); + LogPet( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex[i], CHAR_NAME), + CHAR_getInt( petindex[i], CHAR_LV), + "TenseiDel", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( petindex[i], CHAR_UNIQUECODE) // shan 2001/12/14 + ); + } + CHAR_endCharOneArray( petindex[i] ); + cnt++; + } + if( cnt >= flg ) + return TRUE; + return FALSE; +} + +int PETFUSION_Evolution( int charaindex, int petindex) +{ + char buf[256], buf1[256]; + int newindex=-1; + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, -1); + + sprintf( buf, "%s", CHAR_getChar( petindex, CHAR_NAME)); + newindex = EVOLUTION_createPetFromEnemyIndex( charaindex, petindex, 0); + if( !CHAR_CHECKINDEX( newindex) ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + return -1; + } + sprintf( buf1, "%s", CHAR_getChar( newindex, CHAR_NAME)); + strcat( buf, buf1); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + + LogPetFeed( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( petindex, CHAR_NAME), + petindex, + CHAR_getInt( petindex, CHAR_LV), + buf, // Key + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + CHAR_getChar( petindex, CHAR_UNIQUECODE) ); + + return newindex; +} +#endif + +#ifdef _PET_TRANS +int PETTRANS_getPetBase( int petindex, int *work, int *petrank) +{ + int i, total=-1; + if( !CHAR_CHECKINDEX( petindex) ){ + total = 0; + *petrank = 1; + for( i=0; i<4; i++) { + work[i] = 50; + total += work[i]; + } + }else{ + int LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + *petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + work[0] = (float)(( LevelUpPoint >> 24 ) & 0xFF); + work[1] = (float)(( LevelUpPoint >> 16 ) & 0xFF); + work[2] = (float)(( LevelUpPoint >> 8 ) & 0xFF); + work[3] = (float)(( LevelUpPoint >> 0 ) & 0xFF); + total = ( work[0] + work[1] + work[2] + work[3] ); + if( total > 150 ) total = 150; + if( total < 0 ) total = 0; + } + return total; +} + +#ifdef _PET_2TRANS +int NPC_PetTransManGetAns( int total1, int total2, int LV, int rank, int tran ) +#else +int NPC_PetTransManGetAns( int total1, int total2, int LV, int rank ) +#endif +{ + int ans=0 , TransLV = 100; + float total = 0.00; + int Fx=1; +#if _ATTESTAION_ID == 1 + if( LV > 130 ) LV = 130; +#else + if( LV > 140 ) LV = 140; +#endif + total = ( (float)total1/100 ); // total1=200 + total = total*total*total*total*total; + if( total < 1 ) total = 0; + else total= total*1.3; // total=41.6 С=0 + Fx = (int)((5-rank)*1.2)+5; // rank=0~6 Fx=11(rank=0)С=4(rank=6) + ans = (int)total + total2 + ((LV-TransLV)/Fx); //42+150+30/11=194 + +#ifdef _PET_2TRANS +#ifdef _PET_TRANS_ABILITY + if( tran == 0 ){ + if( ans > getPetTransAbility1() ) + ans = getPetTransAbility1(); + } + else +#ifdef _PET_3TRANS + if( tran == 1 ) +#endif + { + if( ans > getPetTransAbility2() ) + ans = getPetTransAbility2() ; + } +#ifdef _PET_3TRANS + else{ + if( ans > getPetTransAbility3() ) + ans = getPetTransAbility3(); + } +#endif +#else + if( tran == 0 ){ + if( ans > 150 ) + ans = 150; + } + else{ + if( ans > 200 ) + ans = 200; + } +#endif +#else + if( ans > 150 ) { + ans = 150; + } +#endif + return ans; +} + +int PETTRANS_PetTransManStatus( int toindex, int petindex1, int petindex2) +{ + int petrank=0,i; + int total1,total2,total,petLV,ans; + int petID,enemynum,ret=-1; + int work[4]={0,0,0,0}; + int base[4]={0,0,0,0}; + +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + total1 = PETTRANS_getPetBase( petindex1, work, &petrank); + total2 = PETTRANS_getPetBase( petindex2, base, &petrank); + petLV = CHAR_getInt( petindex2, CHAR_LV); +#ifdef _PET_2TRANS + ans = NPC_PetTransManGetAns( total1, total2, petLV, petrank, CHAR_getInt( petindex2, CHAR_TRANSMIGRATION ) ); +#else + ans = NPC_PetTransManGetAns( total1, total2, petLV, petrank ); +#endif + total = total1 + (total2*4); + total2 = 0; + for( i=0; i<4; i++) { + work[i] = work[i]*4; + total2 += work[i]; + } + total = total1 + total2; + for( i=0; i<4; i++) { + base[i] = (ans * (base[i]+work[i])) /total; + } + enemynum = ENEMY_getEnemyNum(); + petID = CHAR_getInt( petindex2, CHAR_PETID); + for( i=0; i CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP) ){ + Myhp = CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP); + } + CHAR_setInt( charaindex, CHAR_HP, Myhp); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP); + for( i=0; i CHAR_getWorkInt( petindex, CHAR_WORKMAXHP) ){ + Myhp = CHAR_getWorkInt( petindex, CHAR_WORKMAXHP); + } + CHAR_setInt( petindex, CHAR_HP, Myhp); + CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP|CHAR_K_STRING_AI); + } + break; + case 2://MP + Myhp = CHAR_getInt( charaindex, CHAR_MP); + dnums = CHAR_getWorkInt( charaindex, CHAR_WORKCHIKULAMP); + Myhp += dnums; + if( Myhp > CHAR_getWorkInt( charaindex, CHAR_WORKMAXMP) ){ + Myhp = CHAR_getWorkInt( charaindex, CHAR_WORKMAXMP); + } + CHAR_setInt( charaindex, CHAR_MP, Myhp); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_MP); + break; + } +} +#endif + +#ifdef _STATUS_WATERWORD //ˮ״̬ +void CHAR_CheckWaterStatus( int charaindex) +{ + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER) == -1 ){ + return; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER) > 0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKSTATUSWATER, + CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER) -1 ); + + if( CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER) != 0 && + CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER)%10 == 0 ){ + char buf1[256]; + sprintf( buf1, "ˮкʱʣ%d֡", + CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER)); + CHAR_talkToCli( charaindex, -1, buf1, CHAR_COLORYELLOW); + } + } + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){ + return; + } + if( CHAR_getWorkInt( charaindex, CHAR_WORKMAPFLOORTYPE) == 1 && + CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER) <= 0 ){//ˮ + char token[256]; + int defhp=0; + int maxhp = CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP); + int myhp = CHAR_getInt( charaindex, CHAR_HP); + defhp = (maxhp*0.033); + if( defhp <= 0 ) defhp = 1; + myhp = myhp - defhp; + sprintf( token, "޷%d HP", defhp); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + + if( myhp <= 0 ){ + myhp = 1; + if(CHAR_getInt(charaindex,CHAR_FLOOR) == 151 || CHAR_getInt(charaindex,CHAR_FLOOR) == 160 + || CHAR_getInt(charaindex,CHAR_FLOOR) == 161 ) CHAR_warpToSpecificPoint(charaindex,702,213,27); + else CHAR_warpToSpecificPoint( charaindex, 200,102,1021); + } + CHAR_setInt( charaindex, CHAR_HP, myhp); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP); + } + +} +#endif + +int CHAR_findSurplusPetBox( int charaindex ) +{ + int i, remnants=0; + for( i=0; i=100700 && oldMetamo<100819){ + int newMetamo; + int hbMetamo[]={ + 100000,100010,100025,100035,100055,100045, + 100060,100070,100095,100090,100100,100110, + 100135,100125,100145,100150,100165,100160, + 100190,100185,100200,100210,100230,100220, + }; + newMetamo=hbMetamo[(oldMetamo-100700)/5]; + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , newMetamo ); + CHAR_setInt( charaindex , CHAR_BASEBASEIMAGENUMBER , newMetamo ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_complianceParameter( charaindex ); + } +} +#endif + +#ifdef _NEW_PLAYER_RIDE +void CHAR_PlayerRide( int charaindex ) +{ + int i,j; + int MetamoList[5][13]={ + /*{ С к Ƥ С Ƥ ñ ̷ Ů }, Ϊ˵ */ + { 100000, 100025, 100055, 100060, 100095, 100100, 100135, 100145, 100165, 100190, 100200, 100230, 309}, // + { 100005, 100030, 100050, 100065, 100085, 100115, 100120, 100140, 100170, 100195, 100210, 100225, 307}, // + { 100010, 100035, 100045, 100070, 100090, 100110, 100125, 100150, 100160, 100185, 100215, 100220, 310}, // + { 100015, 100020, 100040, 100075, 100080, 100105, 100130, 100155, 100175, 100180, 100205, 100235, 308}, // + { 331 , 483 , 330 , 332 , 483 , 332 , 333 , 333 , 331 , 330 , 332 , 483 , 0 }, // + }; + for(i=0;i<4;i++) + for(j=0;j<12;j++) + if(CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == MetamoList[i][j]){ + if(strstr( getPlayerRide(), "ͻ")){ + setNewplayergivepet(3,MetamoList[i][12]); + setNewplayergivepet(4,MetamoList[4][j]); + }else if(strstr( getPlayerRide(), "")){ + setNewplayergivepet(4,MetamoList[4][j]); + }else if(strstr( getPlayerRide(), "ͻ")){ + setNewplayergivepet(4,MetamoList[i][12]); + } + break; + } +} +#endif diff --git a/char/char_event.c b/char/char_event.c new file mode 100644 index 0000000..7a15e66 --- /dev/null +++ b/char/char_event.c @@ -0,0 +1,564 @@ +#include "version.h" +#include + +#include "common.h" +#include "char.h" +#include "item_event.h" +#include "net.h" +#include "item.h" +#include "object.h" +#include "lssproto_serv.h" +#include "util.h" +#include "char_data.h" +#include "readmap.h" +#include "map_deal.h" +#include "item.h" +#include "saacproto_cli.h" +#include "npccreate.h" +#include "handletime.h" +#include "anim_tbl.h" +#include "family.h" + +#define SPR_kmydam CG_HIT_MARK_00 +BOOL CHAR_allprewalk( int index,int* dir,int* mode) +{ + int poisonvalue; + poisonvalue = CHAR_getInt(index, CHAR_POISON ); + if( poisonvalue >= 1 ){ + CHAR_setInt(index,CHAR_HP , CHAR_getInt(index,CHAR_HP) + - poisonvalue ); + CHAR_setWorkInt(index,CHAR_WORKLASTATTACKCHARAINDEX,-2); + { + int opt[2] = { SPR_kmydam,poisonvalue}; + CHAR_sendWatchEvent( CHAR_getWorkInt(index,CHAR_WORKOBJINDEX), + CHAR_ACTDAMAGE,opt,2,TRUE); + + CHAR_sendStatusString( index,"M"); + } + poisonvalue--; + if( poisonvalue <= 0)poisonvalue = 1; + CHAR_setInt(index,CHAR_POISON,poisonvalue); + } + if( CHAR_getInt(index,CHAR_CONFUSION) != 0 ) + *dir = RAND(0,7); + if( CHAR_getInt(index,CHAR_STONE) != 0 ) + return FALSE; + return TRUE; +} + +void CHAR_allpostwalk( int index ) +{ + return; +} + +BOOL CHAR_makeCADefaultString( int objindex,char* buf,int buflen, int act ) +{ + char objindexbuf[64]; + /* */ + if( CHECKOBJECT(objindex) == FALSE ) return FALSE; + if( OBJECT_getType(objindex) != OBJTYPE_CHARA ) return FALSE; + snprintf( buf,buflen,"%s|%d|%d|%d|%d", + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), OBJECT_getY(objindex), + act, + CHAR_getInt(OBJECT_getIndex(objindex),CHAR_DIR)); + return TRUE; +} + +static void CHAR_makeCADAMAGEStringFromSpecifiedCoordinate( + int x , int y, char* buf,int buflen,int ef1,int damagevalue ) +{ + snprintf( buf,buflen,"%d|%d|%d|%d|%d|%d|%d", + -1,x,y, CHAR_ACTDAMAGE,0, ef1,damagevalue); +} + +BOOL CHAR_makeCAOPT1String( int objindex,char* buf, int buflen, int act,int opt1 ) +{ + char objindexbuf[64]; + if( CHECKOBJECT(objindex) == FALSE ) return FALSE; + if( OBJECT_getType(objindex) != OBJTYPE_CHARA ) return FALSE; + snprintf( buf,buflen,"%s|%d|%d|%d|%d|%d", + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), OBJECT_getY(objindex), + act, + CHAR_getInt(OBJECT_getIndex(objindex),CHAR_DIR), opt1); + return TRUE; +} + +#ifdef _STREET_VENDOR +BOOL CHAR_makeCAOPTString(int objindex,char* buf,int buflen,int act,char *string) +{ + char objindexbuf[64]; + + if(CHECKOBJECT(objindex) == FALSE ) return FALSE; + if(OBJECT_getType(objindex) != OBJTYPE_CHARA ) return FALSE; + snprintf( buf,buflen,"%s|%d|%d|%d|%d|%s", + cnv10to62(objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), OBJECT_getY(objindex),act, + CHAR_getInt(OBJECT_getIndex(objindex),CHAR_DIR),string); + return TRUE; +} +#endif + +BOOL CHAR_makeCAOPT3String( int objindex,char* buf, int buflen, int act,int opt1,int opt2,int opt3 ) +{ + char objindexbuf[64]; + + if( CHECKOBJECT(objindex) == FALSE ) return FALSE; + if( OBJECT_getType(objindex) != OBJTYPE_CHARA ) return FALSE; + snprintf( buf,buflen,"%s|%d|%d|%d|%d|%d|%d|%d", + cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)), + OBJECT_getX(objindex), OBJECT_getY(objindex), + act, + CHAR_getInt(OBJECT_getIndex(objindex),CHAR_DIR), + opt1,opt2,opt3); + return TRUE; +} + +void CHAR_playerWatchfunc( int objmeindex, int objmoveindex, + CHAR_ACTION act, int x, int y, int dir, int* opt, int optlen ) +{ + int fd; + int meindex; + if( !CHECKOBJECTUSE(objmeindex) )return; + if( !CHECKOBJECTUSE(objmoveindex))return; + if( OBJECT_getType(objmeindex) != OBJTYPE_CHARA )return; + + meindex = OBJECT_getIndex(objmeindex); + if( CHAR_getInt( meindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )return; + + fd = getfdFromCharaIndex( meindex ); + if( fd == -1 )return; + switch( OBJECT_getType(objmoveindex) ){ + case OBJTYPE_CHARA: + { + char buf[128]; + if( !CHAR_getFlg( OBJECT_getIndex(objmoveindex),CHAR_ISVISIBLE) ) + return; + + switch( act ){ + case CHAR_ACTSTAND: + case CHAR_ACTWALK: + case CHAR_ACTATTACK: + case CHAR_ACTDEAD: + case CHAR_ACTMAGIC: + case CHAR_ACTITEM: + case CHAR_ACTDOWN: + case CHAR_ACTSIT: + case CHAR_ACTHAND: + case CHAR_ACTPLEASURE: + case CHAR_ACTANGRY: + case CHAR_ACTSAD: + case CHAR_ACTDAMAGE: + case CHAR_ACTGUARD: + case CHAR_ACTTURN: + case CHAR_ACTWARP: + case CHAR_ACTACTIONWALK: + case CHAR_ACTNOD: + case CHAR_ACTTHROW: + case CHAR_ACTACTIONSTAND: + if( CHAR_makeCADefaultString(objmoveindex,buf,sizeof(buf),act) ) { + CONNECT_appendCAbuf( fd,buf,strlen(buf)); + } + break; + // shan begin + case CHAR_ACTTRADE: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String( objmoveindex, buf, + sizeof( buf), act, opt[0] ) ) + CONNECT_appendCAbuf( fd, buf, strlen(buf)); + break; + +#ifdef _ANGEL_SUMMON + case CHAR_ACTANGEL: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String( objmoveindex, buf, + sizeof( buf), act, opt[0] ) ) + CONNECT_appendCAbuf( fd, buf, strlen(buf)); + break; +#endif + + // shan end +#ifdef _MIND_ICON + case CHAR_MIND: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String( objmoveindex, buf, + sizeof(buf), act, opt[0])) + CONNECT_appendCAbuf( fd, buf, strlen(buf)); + break; +#endif +#ifdef _STREET_VENDOR + case CHAR_STREETVENDOR_OPEN: + if(CHAR_makeCAOPTString(objmoveindex,buf,sizeof(buf), + act,CHAR_getWorkChar(OBJECT_getIndex(objmoveindex),CHAR_STREETVENDOR_NAME))) + CONNECT_appendCAbuf(fd,buf,strlen(buf)); + break; + case CHAR_STREETVENDOR_CLOSE: + if(CHAR_makeCAOPTString(objmoveindex,buf,sizeof(buf), + act,CHAR_getWorkChar(OBJECT_getIndex(objmoveindex),CHAR_STREETVENDOR_NAME))) + CONNECT_appendCAbuf(fd,buf,strlen(buf)); + break; +#endif +#ifdef _ITEM_CRACKER + case CHAR_ITEM_CRACKER: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String( objmoveindex, buf, + sizeof(buf), act, opt[0])) + CONNECT_appendCAbuf( fd, buf, strlen(buf)); + break; +#endif + case CHAR_ACTEFFECT: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String(objmoveindex,buf, + sizeof(buf),act,opt[0] ) ) + CONNECT_appendCAbuf( fd,buf,strlen(buf)); + break; + case CHAR_ACTPOPUPNAME: + case CHAR_ACTLEADER: + case CHAR_ACTBATTLEWATCH: + if( optlen == 1 ) + if( CHAR_makeCAOPT1String(objmoveindex,buf, + sizeof(buf),act,opt[0] ) ) + CONNECT_appendCAbuf( fd,buf,strlen(buf)); + break; + case CHAR_ACTBATTLE: + if( optlen == 3 ) + if( CHAR_makeCAOPT3String( objmoveindex,buf, sizeof(buf), + act,opt[0],opt[1],opt[2] ) ) + CONNECT_appendCAbuf( fd,buf,strlen(buf)); + break; + default: + break; + } + + break; + } + case OBJTYPE_ITEM: + case OBJTYPE_GOLD: + CHAR_sendSpecifiedobjindexCToCharaindex(meindex,objmoveindex); + break; + default: + break; + } + +} + +void CHAR_sendWallDamage( int charaindex,int x, int y, int damage ) +{ + int fd; + char cabuf[256]=""; + + fd = getfdFromCharaIndex(charaindex); + if( fd == -1 )return; + + CHAR_makeCADAMAGEStringFromSpecifiedCoordinate( + x,y,cabuf,sizeof(cabuf),SPR_kmydam,damage ); + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); +} + + + +static struct ParamShow +{ + int paramindex; /* ɷ¶̼͵ */ + char* offmessage; /* ݼ ٯ */ +}pShow[]={ + {CHAR_PARALYSIS, CHAR_RECOVERPARALYSISSTRING}, + {CHAR_SLEEP, CHAR_RECOVERSILENCESTRING}, + {CHAR_STONE, CHAR_RECOVERSTONESTRING}, + {CHAR_DRUNK, CHAR_RECOVERDARKNESSSTRING}, + {CHAR_CONFUSION, CHAR_RECOVERCONFUSIONSTRING}, +}; + +void CHAR_recoveryStatus( int charaindex ) +{ + int i; + int cure=FALSE; + if( !CHAR_CHECKINDEX(charaindex) )return; + + for( i=0 ; i < arraysizeof(pShow) ; i ++ ){ + if( CHAR_getInt(charaindex,pShow[i].paramindex) > 0 ){ + int old; + old = CHAR_setInt(charaindex,pShow[i].paramindex, + CHAR_getInt(charaindex, + pShow[i].paramindex) - 1 ); + if( old == 1 ){ + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + CHAR_talkToCli( charaindex,-1, pShow[i].offmessage, + CHAR_COLORWHITE ); + } + cure = TRUE; + } + } + } + if( cure ){ + CHAR_sendStatusString( charaindex, "P" ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( + charaindex, CHAR_WORKOBJINDEX) ); + } +} + +static BOOL CHAR_clairvoyance_gold(int objindex,char* buf ) +{ + if( OBJECT_getType( objindex ) == OBJTYPE_GOLD ){ + *buf = 'G'; + return TRUE; + } + return FALSE; +} + +static BOOL CHAR_clairvoyance_item(int objindex,char* buf ) +{ + if( OBJECT_getType( objindex ) == OBJTYPE_ITEM){ + *buf = 'I'; + return TRUE; + } + return FALSE; +} + +static BOOL CHAR_clairvoyance_player(int objindex,char* buf ) +{ + if( OBJECT_getType( objindex ) == OBJTYPE_CHARA + && CHAR_getInt(OBJECT_getIndex(objindex),CHAR_WHICHTYPE) + == CHAR_TYPEPLAYER ){ + *buf = 'P'; + return TRUE; + } + return FALSE; +} + +static BOOL CHAR_clairvoyance_enemy(int objindex,char* buf ) +{ + if( OBJECT_getType( objindex ) == OBJTYPE_CHARA + && CHAR_getInt(OBJECT_getIndex(objindex),CHAR_WHICHTYPE) + == CHAR_TYPEENEMY ){ + *buf = 'E'; + return TRUE; + } + return FALSE; +} + +static char CHAR_clairvoyanceString[STRINGBUFSIZ]; + +static void CHAR_clairvoyance( int charaindex ) +{ + char onebuf[128]; + int stringlen=0; + int clairvoyancelevel; + int centerx,centery,fl; + int i,j; + BOOL sendclairvoyance=FALSE; + +#define CHAR_CLAIRVOYANCEWIDTH 81 + BOOL (*clairvoyancefunc[])(int,char*) ={ + CHAR_clairvoyance_gold, + CHAR_clairvoyance_item, + CHAR_clairvoyance_player, + CHAR_clairvoyance_enemy, + }; + if( CHAR_getWorkInt( charaindex, CHAR_WORKLOOPSTARTSEC)%10 != 0 ) + return; + + clairvoyancelevel = CHAR_getInt(charaindex,CHAR_RADARSTRENGTH ); + + if( clairvoyancelevel <= 0 )return; + if( clairvoyancelevel > arraysizeof( clairvoyancefunc ) ) + clairvoyancelevel = arraysizeof( clairvoyancefunc ); + + centerx = CHAR_getInt(charaindex,CHAR_X); + centery = CHAR_getInt(charaindex,CHAR_Y); + fl = CHAR_getInt(charaindex,CHAR_FLOOR); + + + for( i = centerx - CHAR_CLAIRVOYANCEWIDTH/2 ; + i < centerx + CHAR_CLAIRVOYANCEWIDTH/2 ; i ++ ){ + for( j = centery - CHAR_CLAIRVOYANCEWIDTH/2 ; + j < centery + CHAR_CLAIRVOYANCEWIDTH/2 ; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; object ; + object = NEXT_OBJECT( object ) ){ + int objindex = GET_OBJINDEX(object); + int loop; + + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE )continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA + && OBJECT_getIndex(objindex) == charaindex) continue; + for( loop = 0 ; loop < clairvoyancelevel ; loop ++ ){ + BOOL ret; + char id; + ret = clairvoyancefunc[loop](objindex,&id); + if( ret == TRUE ){ + sendclairvoyance=TRUE; + snprintf( onebuf,sizeof(onebuf), + "%d|%d|%c|",i,j,id ); + strcpysafe( CHAR_clairvoyanceString + stringlen, + sizeof(CHAR_clairvoyanceString) + - stringlen, onebuf); + stringlen += strlen(onebuf); + if( stringlen > sizeof(CHAR_clairvoyanceString) ) + goto RETURN; + } + } + } + } + } + +RETURN: + if( stringlen >= 1 ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + dchop( CHAR_clairvoyanceString, "|" ); + if( fd != -1 ) + lssproto_R_send( fd, CHAR_clairvoyanceString ); + }else if( !sendclairvoyance ){ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ) + lssproto_R_send( fd, "" ); + } +} + +void CHAR_loopFunc( int charaindex ) +{ + CHAR_recoveryStatus( charaindex ); + CHAR_clairvoyance( charaindex ); +} + +void CHAR_playerresurrect( int charaindex, int hp ) +{ + CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER, + CHAR_getInt(charaindex,CHAR_BASEBASEIMAGENUMBER)); + CHAR_setFlg(charaindex,CHAR_ISDIE, 0); + CHAR_setFlg(charaindex,CHAR_ISATTACKED, 1); + CHAR_setFlg(charaindex,CHAR_ISOVERED, 0); + if( hp >= CHAR_getWorkInt(charaindex,CHAR_WORKMAXHP) ) + hp = CHAR_getWorkInt(charaindex,CHAR_WORKMAXHP); + else if( hp <= 0 ) + hp = 1; + CHAR_setInt(charaindex,CHAR_HP, hp); +} + +int CHAR_die( int charaindex ) +{ + CHAR_DischargeParty( charaindex, 0); + { + int bymonster = 0; + int attackindex = CHAR_getWorkInt(charaindex, + CHAR_WORKLASTATTACKCHARAINDEX); + if( attackindex == -2 ) + bymonster = 0; + else if( CHAR_CHECKINDEX(attackindex) == TRUE ){ + if( CHAR_getInt(attackindex,CHAR_WHICHTYPE) + == CHAR_TYPEENEMY ){ + bymonster = 1; + }else{ + bymonster = 2; + } + } + if( bymonster == 0 || bymonster == 1 ){ + int i; + for( i=0 ; i= 1 ){ + int randomindex = RAND(0,itemhavenum-1); + CHAR_DropItem(charaindex,eqindex[randomindex]); + + } + } + + CHAR_DropMoney(charaindex, + CHAR_getInt(charaindex,CHAR_GOLD)/2 ); + CHAR_setInt(charaindex,CHAR_GOLD,0); + } + CHAR_complianceParameter(charaindex); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt(charaindex, CHAR_WORKOBJINDEX) ); + CHAR_setInt(charaindex,CHAR_DEADCOUNT, + CHAR_getInt(charaindex,CHAR_DEADCOUNT)+1); + { + int i; + BOOL old=FALSE; + for( i=0 ; i 0 ){ + old = TRUE; + } + if( CHAR_setInt( charaindex, CHAR_POISON, 0 ) > 0 )old=TRUE; + if( old ) + CHAR_sendCToArroundCharacter( CHAR_getInt(charaindex, CHAR_WORKOBJINDEX)); + } + CHAR_sendStatusString( charaindex, "P"); + CHAR_sendStatusString( charaindex, "I"); + CHAR_setFlg(charaindex,CHAR_ISDIE,1); + CHAR_setFlg(charaindex,CHAR_ISATTACKED,0); + return 0; +} + +void CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, int color, int channel ) +{ + int fd; + char lastbuf[4096]; + char mesgbuf[4096]; + char escapebuf[4096]; + int fmindex = CHAR_getInt( charaindex, CHAR_FMINDEX ); + fd = getfdFromCharaIndex( charaindex ); + if( fd == -1 )return; + if( (channel>-1) && (fmindex>0) ){ + if( channel == 0 ){ +#ifndef _CHANNEL_MODIFY + snprintf( lastbuf,sizeof(lastbuf),"P|[]%s", +#else + snprintf( lastbuf,sizeof(lastbuf),"P|F|[]%s", +#endif + makeEscapeString( CHAR_appendNameAndTitle(talkindex, message, mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); + } +#ifdef _FMVER21 + else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){ +#else + else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( talkindex, CHAR_FMLEADERFLAG ) == 1 ){ +#endif +#ifndef _CHANNEL_MODIFY + snprintf( lastbuf,sizeof(lastbuf),"P|[峤㲥]%s", +#else + snprintf( lastbuf,sizeof(lastbuf),"P|F|[峤㲥]%s", +#endif + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); + }else{ + snprintf( lastbuf,sizeof(lastbuf),"P|[%d]%s",channel, + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); + } + }else{ +#ifdef _CHANNEL_MODIFY + if(CHAR_getFlg(talkindex,CHAR_ISPARTYCHAT) && (CHAR_getWorkInt(talkindex,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE)) + snprintf( lastbuf,sizeof(lastbuf),"P|T|[]%s", + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); + else +#ifdef _FONT_SIZE + snprintf( lastbuf,sizeof(lastbuf),"P|P|%s|%d", + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) ), CHAR_getWorkInt( talkindex, CHAR_WORKFONTSIZE) ); +#else + snprintf( lastbuf,sizeof(lastbuf),"P|P|%s", + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); +#endif + +#else + snprintf( lastbuf,sizeof(lastbuf),"P|%s", + makeEscapeString(CHAR_appendNameAndTitle(talkindex, message,mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); +#endif + } + lssproto_TK_send( fd, CHAR_getWorkInt( talkindex, CHAR_WORKOBJINDEX ),lastbuf, color); +} diff --git a/char/char_item.c b/char/char_item.c new file mode 100644 index 0000000..1964a9f --- /dev/null +++ b/char/char_item.c @@ -0,0 +1,2774 @@ +#include "version.h" +#include + +#include "configfile.h" +#include "readmap.h" +#include "map_deal.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "item.h" +#include "lssproto_serv.h" +#include "handletime.h" +#include "log.h" +#include "item_event.h" +#include "battle.h" +#include "petmail.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#ifdef _ANGEL_SUMMON +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; +#endif + +extern int itemLine; + +#ifdef _DROPSTAKENEW +#define CASINOTOKENID 20121 // ֳȯ +#define MAXCASINOMAPNUM 150 // ֳͼ +#define MAXACCUMULATION 1000000 // +typedef struct tagCasinoMapTable +{ + int casinofl; // ֳͼ + int casinox; // ֳ + int casinoy; // ֳ + int casinotype; // ע + int dropflag; // Ƿע flag + char casinoinfo[64]; // ע˵ + int accumulation; // + int stakenum; // ȯ +}CasinoMapTable; +CasinoMapTable casinomap[MAXCASINOMAPNUM] = +{ + { 7008, 13, 13, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 14, 13, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 15, 13, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 16, 13, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 17, 13, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 13, 14, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 14, 14, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 15, 14, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 16, 14, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 17, 14, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 13, 15, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 14, 15, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 15, 15, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 16, 15, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 17, 15, DICE_BIG, 1, "ӣ", 1, 0}, + { 7008, 8, 13, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 9, 13, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 10, 13, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 11, 13, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 12, 13, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 8, 14, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 9, 14, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 10, 14, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 11, 14, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 12, 14, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 8, 15, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 9, 15, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 10, 15, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 11, 15, DICE_SMALL, 1, "ӣС", 1, 0}, + { 7008, 12, 15, DICE_SMALL, 1, "ӣС", 1, 0}, + + { 7005, 22, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 23, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 24, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 25, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 26, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 27, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 28, 21, PET_RACE1, 1, "ٳ", 2, 0}, + { 7005, 22, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 23, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 24, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 25, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 26, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 27, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 28, 24, PET_RACE2, 1, "ٳ", 2, 0}, + { 7005, 22, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 23, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 24, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 25, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 26, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 27, 27, PET_RACE3, 1, "ٳ", 2, 0}, + { 7005, 28, 27, PET_RACE3, 1, "ٳ", 2, 0}, + + { 7003, 21, 15, ROULETTE1, 1, "̺죱", 1, 0}, { 7003, 17, 15, ROULETTE3, 1, "̺죳", 1, 0}, + { 7003, 13, 15, ROULETTE5, 1, "̺죵", 1, 0}, { 7003, 21, 21, ROULETTE6, 1, "̺죶", 1, 0}, + { 7003, 17, 21, ROULETTE8, 1, "̺죸", 1, 0}, { 7003, 15, 21, ROULETTE9, 1, "̺죹", 1, 0}, + { 7003, 13, 21, ROULETTE10, 1, "̺죱", 1, 0}, { 7003, 13, 18, ROULETTE13, 1, "̺죱", 1, 0}, + { 7003, 9, 21, ROULETTE17, 1, "̺죱", 1, 0}, { 7003, 21, 18, ROULETTE18, 1, "̺죱", 1, 0}, + + { 7003, 19, 15, ROULETTE22, 1, "̣", 1, 0}, { 7003, 15, 15, ROULETTE24, 1, "̣", 1, 0}, + { 7003, 19, 21, ROULETTE27, 1, "̣", 1, 0}, { 7003, 11, 15, ROULETTE31, 1, "̣", 1, 0}, + { 7003, 9, 15, ROULETTE32, 1, "̣", 1, 0}, { 7003, 11, 18, ROULETTE34, 1, "̣", 1, 0}, + { 7003, 9, 18, ROULETTE35, 1, "̣", 1, 0}, { 7003, 11, 21, ROULETTE36, 1, "̣", 1, 0}, + { 7003, 19, 18, ROULETTE39, 1, "̣", 1, 0}, { 7003, 17, 18, ROULETTE40, 1, "̣", 1, 0}, + { 7003, 17, 24, ROULETTE41, 1, "̺", 1, 0}, { 7003, 16, 24, ROULETTE41, 1, "̺", 1, 0}, + { 7003, 17, 25, ROULETTE41, 1, "̺", 1, 0}, { 7003, 16, 25, ROULETTE41, 1, "̺", 1, 0}, + { 7003, 14, 24, ROULETTE42, 1, "", 1, 0}, { 7003, 13, 24, ROULETTE42, 1, "", 1, 0}, + { 7003, 14, 25, ROULETTE42, 1, "", 1, 0}, { 7003, 13, 25, ROULETTE42, 1, "", 1, 0}, + + // WON ADD ͼϵ˫Ĵ + { 7003, 11, 24, ROULETTE43, 1, "̵", 1, 0}, { 7003, 10, 24, ROULETTE43, 1, "̵", 1, 0}, + { 7003, 11, 25, ROULETTE43, 1, "̵", 1, 0}, { 7003, 10, 25, ROULETTE43, 1, "̵", 1, 0}, + { 7003, 20, 24, ROULETTE44, 1, "˫", 1, 0}, { 7003, 19, 24, ROULETTE44, 1, "˫", 1, 0}, + { 7003, 20, 25, ROULETTE44, 1, "˫", 1, 0}, { 7003, 19, 25, ROULETTE44, 1, "˫", 1, 0}, + + + + { 7003, 20, 15, (ROULETTE1<<16)+ROULETTE22, 1, "˫ź죱̣", 1, 0}, + { 7003, 18, 15, (ROULETTE3<<16)+ROULETTE22, 1, "˫ź죳̣", 1, 0}, + { 7003, 16, 15, (ROULETTE3<<16)+ROULETTE24, 1, "˫ź죳̣", 1, 0}, + { 7003, 14, 15, (ROULETTE5<<16)+ROULETTE24, 1, "˫ź죵̣", 1, 0}, + { 7003, 12, 15, (ROULETTE5<<16)+ROULETTE31, 1, "˫ź죵̣", 1, 0}, + { 7003, 10, 15, (ROULETTE32<<16)+ROULETTE31, 1, "˫̣̣", 1, 0}, + + { 7003, 20, 18, (ROULETTE18<<16)+ROULETTE39, 1, "˫ź죱̣", 1, 0}, + { 7003, 18, 18, (ROULETTE40<<16)+ROULETTE39, 1, "˫̣̣", 1, 0}, + { 7003, 16, 18, (ROULETTE40<<16)+ROULETTE45, 1, "˫̣ڣ", 1, 0}, + { 7003, 14, 18, (ROULETTE13<<16)+ROULETTE45, 1, "˫ź죱ڣ", 1, 0}, + { 7003, 12, 18, (ROULETTE13<<16)+ROULETTE34, 1, "˫ź죱̣", 1, 0}, + { 7003, 10, 18, (ROULETTE35<<16)+ROULETTE34, 1, "˫̣̣", 1, 0}, + + { 7003, 20, 21, (ROULETTE6<<16) +ROULETTE27, 1, "˫ź죶̣", 1, 0}, + { 7003, 18, 21, (ROULETTE8<<16) +ROULETTE27, 1, "˫ź죸̣", 1, 0}, + { 7003, 16, 21, (ROULETTE8<<16) + ROULETTE9, 1, "˫ź죸죹", 1, 0}, + { 7003, 14, 21, (ROULETTE10<<16)+ ROULETTE9, 1, "˫ź죱죹", 1, 0}, + { 7003, 12, 21, (ROULETTE10<<16)+ROULETTE36, 1, "˫ź죱̣", 1, 0}, + { 7003, 10, 21, (ROULETTE17<<16)+ROULETTE36, 1, "˫ź죱̣", 1, 0}, + { 7003, 8, 15, ROULETTE51, 1, "У", 1, 0}, // + { 7003, 8, 18, ROULETTE52, 1, "У", 1, 0}, + { 7003, 8, 21, ROULETTE53, 1, "У", 1, 0}, + { 7003, 6, 15, ROULETTE61, 1, "룱", 1, 0}, //110 + { 7003, 5, 15, ROULETTE61, 1, "룱", 1, 0}, + { 7003, 6, 16, ROULETTE61, 1, "룱", 1, 0}, + { 7003, 5, 16, ROULETTE61, 1, "룱", 1, 0}, + { 7003, 24, 15, ROULETTE62, 1, "룱", 1, 0}, //1011 + { 7003, 23, 15, ROULETTE62, 1, "룱", 1, 0}, + { 7003, 24, 16, ROULETTE62, 1, "룱", 1, 0}, + { 7003, 23, 16, ROULETTE62, 1, "룱", 1, 0}, + { 7003, 15, 18, ROULETTE45, 1, "()", 1, 0}, + +}; +#endif + + +static char CHAR_sendItemBuffer[STRINGBUFSIZ]; +BOOL CHAR_sendItemDataOne( int charaindex, int haveitemindex) +{ + int itemgrp[1]; + itemgrp[0] = haveitemindex; + return CHAR_sendItemData( charaindex, itemgrp, 1); +} + +BOOL CHAR_sendItemData( int charaindex, int *itemgroup, int num) +{ + int i; + int strlength = 0; + int fd; + + if( num <= 0 || num > CHAR_MAXITEMHAVE) return FALSE; + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) { + return FALSE; + } + + for( i = 0; i < num; i ++ ) { + char token[512]; + int itemindex; + if( !CHAR_CHECKITEMINDEX( charaindex, itemgroup[i])) { + continue; + } + itemindex = CHAR_getItemIndex( charaindex, itemgroup[i] ); + if( itemindex >= 0 ) { + snprintf( token ,sizeof(token),"%d|%s|" ,itemgroup[i], ITEM_makeItemStatusString( -1,itemindex ) ); + if(ITEM_getInt( itemindex, ITEM_CANBEPILE)!=1 && ITEM_getInt( itemindex, ITEM_USEPILENUMS)>1) + { + CHAR_setItemIndex( charaindex , itemgroup[i], -1); + snprintf( token ,sizeof(token),"%s|" , ITEM_makeItemFalseStringWithNum( itemgroup[i]) ); + } + }else { + snprintf( token ,sizeof(token),"%s|" , ITEM_makeItemFalseStringWithNum( itemgroup[i]) ); + } + strcpysafe( CHAR_sendItemBuffer + strlength, sizeof(CHAR_sendItemBuffer) - strlength, token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_sendItemBuffer) ) { + break; + } + } + dchop( CHAR_sendItemBuffer , "|" ); + fd = getfdFromCharaIndex( charaindex ); + if( fd != -1 ){ + lssproto_I_send( fd, CHAR_sendItemBuffer ); + return TRUE; + } + return FALSE; +} + +static void CHAR_sendItemDetachEvent( int charaindex,int itemid ) +{ + char mesg[256]; + + snprintf( mesg, sizeof( mesg), "ж%s ", ITEM_getAppropriateName(itemid) ); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); +#ifdef _ITEM_METAMO + if( ITEM_getEquipPlace( charaindex, itemid) == CHAR_BODY + && CHAR_getWorkInt( charaindex, CHAR_WORKITEMMETAMO) != 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKNPCMETAMO, 0 ); //npcԻıҲҪ + CHAR_complianceParameter( charaindex); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_talkToCli( charaindex, -1, "ʧЧˣ", CHAR_COLORWHITE); + } +#endif +#ifdef _ITEM_RIDE + if(CHAR_getInt( charaindex , CHAR_RIDEPET ) != -1 ){ + if( !strcmp( ITEM_getChar( itemid, ITEM_USEFUNC), "ITEM_RIDE") ) { + char ridemetamo[12]; + char *itemarg = ITEM_getChar( itemid, ITEM_ARGUMENT); + getStringFromIndexWithDelim( itemarg, "|", 2, ridemetamo, sizeof(ridemetamo)); + if(CHAR_getInt( charaindex , CHAR_BASEIMAGENUMBER )==atoi(ridemetamo)){ + CHAR_setInt( charaindex , CHAR_RIDEPET, -1 ); + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , CHAR_getInt( charaindex , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_RIDEPET); + } + } + } +#endif + { + typedef void (*DETACHFUNC)(int,int); + DETACHFUNC def; + def=(DETACHFUNC)ITEM_getFunctionPointer(itemid,ITEM_DETACHFUNC); + if( def ) { + def( charaindex,itemid ); + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + RunItemDetachEvent(charaindex,itemid ); + } +#endif + } +} + +static void CHAR_sendItemAttachEvent( int charaindex,int itemid ) +{ + char mesg[256]; + snprintf( mesg, sizeof( mesg), "װ%s ", + ITEM_getAppropriateName(itemid) ); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); + { + typedef void (*ATTACHFUNC)(int,int); + ATTACHFUNC atf; + atf=(ATTACHFUNC)ITEM_getFunctionPointer(itemid,ITEM_ATTACHFUNC); + if( atf ){ + atf( charaindex,itemid ); + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + RunItemAttachEvent(charaindex, itemid ); + } +#endif + } +} + + +int CHAR_findSurplusItemBox( int charaindex ) +{ + int i, remnants=0, itemindex; + for(i=CHAR_STARTITEMARRAY; i< CHAR_MAXITEMHAVE; i++){ + itemindex = CHAR_getItemIndex( charaindex , i ); + if( itemindex == -1 ) remnants++; + } + return remnants; +} + + +static int CHAR_findEmptyItemBoxFromChar( Char* ch ) +{ + int i; + + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i ++ ){ + int itemindex; + itemindex = ch->indexOfExistItems[i]; + if( itemindex == -1 )return i; + } + + return -1; +} + +static int CHAR_findEmptyPoolItemBoxFromChar( Char* ch ) +{ + int i; + for( i=0; iindexOfExistPoolItems[i]; + if( itemindex == -1 ) return i; + } + return -1; +} + +int CHAR_findEmptyPoolItemBox( int index ) +{ + Char* ch; + if( !CHAR_CHECKINDEX( index ) )return -1; + ch = CHAR_getCharPointer(index); + if( ch != NULL ) + return CHAR_findEmptyPoolItemBoxFromChar( ch ); + else + return -1; +} + +int CHAR_findEmptyItemBox( int index ) +{ + Char* ch; + + if( !CHAR_CHECKINDEX( index ) )return -1; + ch = CHAR_getCharPointer(index); + if( ch != NULL ) + return CHAR_findEmptyItemBoxFromChar( ch ); + else + return -1; + +} + +#define LACKOFCLASS {CHAR_talkToCli(index,-1,"޷װ",CHAR_COLORWHITE);} +#define CANNOTEQUIP {CHAR_talkToCli(index,-1,"޷װƷ",CHAR_COLORWHITE);} +#define CANNOTEQUIP2 {CHAR_talkToCli(index,-1,"޷ͬʱװͬƷ",CHAR_COLORWHITE);} +#define CANNOTEXCHANGE {CHAR_talkToCli(index,-1,"޷Ʒ",CHAR_COLORWHITE);} +#define CANNOTMOVE {CHAR_talkToCli(index,-1,"޷ƶƷ",CHAR_COLORWHITE);} + +static BOOL CHAR_sendSIToCli( int charindex , int from , int to ) +{ + int fd = getfdFromCharaIndex( charindex ); + if( fd != -1 ){ + lssproto_SI_send( fd , from, to ); + return TRUE; + } + return FALSE; +} + +static BOOL CHAR_moveItemFromItemBoxToEquip( int index, int fromindex, + int toindex ) +{ + int fromid,toid; + int fromeqplace; + BOOL flg = FALSE; + + if( !CHAR_CHECKINDEX( index ) )return FALSE; + + fromid = CHAR_getItemIndex(index,fromindex); + toid = CHAR_getItemIndex(index,toindex); + if( !ITEM_CHECKINDEX( fromid) ) + return FALSE; + + if( CHAR_getInt( index, CHAR_TRANSMIGRATION ) <= 0 ){ + if( ITEM_getInt(fromid,ITEM_LEVEL) > CHAR_getInt(index,CHAR_LV) ){ + LACKOFCLASS; + return FALSE; + } + } +#ifdef _ITEMSET4_TXT + if( CHAR_getInt( index, CHAR_STR) < ITEM_getInt( fromid, ITEM_NEEDSTR) ) return FALSE; + if( CHAR_getInt( index, CHAR_DEX) < ITEM_getInt( fromid, ITEM_NEEDDEX) ) return FALSE; + if( CHAR_getInt( index, CHAR_TRANSMIGRATION) < ITEM_getInt( fromid, ITEM_NEEDTRANS) ) return FALSE; +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + if( ITEM_getInt( fromid, ITEM_NEEDPROFESSION) != 0 ){ + if( CHAR_getInt( index, PROFESSION_CLASS ) != ITEM_getInt( fromid, ITEM_NEEDPROFESSION) ) + return FALSE; + } +#endif +#endif + +#ifdef _FIXBUG_ATTACKBOW + { + if( CHAR_getWorkInt( index, CHAR_WORKITEMMETAMO) > 0 || + CHAR_getWorkInt( index, CHAR_WORKNPCMETAMO) > 0 + || CHAR_getWorkInt( index, CHAR_WORKFOXROUND ) != -1){ //DZС + + int armtype = ITEM_getInt( fromid, ITEM_TYPE ); + + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( index, -1, "޷ʹԶ", CHAR_COLORYELLOW ); + return FALSE; + } + } + } +#endif + +#ifdef _ANGEL_SUMMON + //if( !strcmp( ITEM_getChar( fromid, ITEM_USEFUNC), "ITEM_AngelToken") ) { + if( ITEM_getInt( fromid, ITEM_ID) == ANGELITEM ) { + int mindex; + char nameinfo[64]; + + mindex = checkIfAngel( index); + getMissionNameInfo( index, nameinfo); + if( mindex < 0 || + strcmp( ITEM_getChar( fromid, ITEM_ANGELINFO), missiontable[mindex].angelinfo) || + strcmp( ITEM_getChar( fromid, ITEM_HEROINFO), missiontable[mindex].heroinfo) || + strcmp( ITEM_getChar( fromid, ITEM_ANGELINFO), nameinfo) ) { + + CHAR_talkToCli( index, -1, "Ⲣ޷װ", CHAR_COLORYELLOW ); + return FALSE; + } + } +#endif + + fromeqplace = ITEM_getEquipPlace( index, fromid ); + if( fromeqplace == -1 ){ + CANNOTEQUIP; + return FALSE; + } + //if( BATTLE_GetWepon( charaindex ) != ITEM_BOW ) + + if( fromeqplace == CHAR_DECORATION1 ) { + int checkplace = ( toindex == CHAR_DECORATION1) + ? CHAR_DECORATION2:CHAR_DECORATION1; + int otheritemindex; + + if( toindex == CHAR_DECORATION1 || toindex == CHAR_DECORATION2 ) { + otheritemindex = CHAR_getItemIndex( index, checkplace); + if( ITEM_CHECKINDEX( otheritemindex )) { + int otheritemtype = ITEM_getInt( otheritemindex, ITEM_TYPE); + int myitemtype = ITEM_getInt( CHAR_getItemIndex( index, fromindex) , ITEM_TYPE); + if( otheritemtype == myitemtype) { + if( toid < 0 ) { + CANNOTEQUIP2; + }else { + CANNOTEXCHANGE; + } + return FALSE; + } + } + flg = TRUE; + } + }else { + if( toindex == fromeqplace) flg = TRUE; + } + if( flg ){ + CHAR_setItemIndex(index,toindex,fromid); + CHAR_setItemIndex(index,fromindex,toid); + if( toid != -1 ) { + CHAR_sendItemDetachEvent( index, toid ); + } + CHAR_sendItemAttachEvent( index, fromid ); + CHAR_sendSIToCli( index, fromindex,toindex ); + }else { + CANNOTEQUIP; + return FALSE; + } + return TRUE; +} + +static BOOL CHAR_moveItemFromEquipToItemBox(int index, int fromindex, + int toindex) +{ + int fromid,toid; + + if( !CHAR_CHECKINDEX( index )) return FALSE; + + fromid = CHAR_getItemIndex(index,fromindex); + toid = CHAR_getItemIndex(index,toindex); + if( fromid < 0 ) + return FALSE; + else if( toid < 0 ){ + CHAR_setItemIndex(index,toindex,fromid); + CHAR_setItemIndex(index,fromindex,-1); + CHAR_sendItemDetachEvent( index,fromid ); + CHAR_sendSIToCli( index,fromindex,toindex); + return TRUE; + } + + return CHAR_moveItemFromItemBoxToEquip(index, toindex,fromindex); +} + +#ifdef _ITEM_PILENUMS +int CHAR_getMyMaxPilenum( int charaindex) +{ + int maxpile; + int transnum = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION); + if(CHAR_getInt(charaindex,CHAR_VIPRIDE)>1) + { + maxpile=100; + } + else + { + if(transnum <= 5) + { + maxpile = transnum + + (transnum/5) * 2 + 3; + } + else if(transnum > 5) + { + maxpile = 50; + } + } + +/* +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + maxpile += CHAR_getInt( charaindex, ATTACHPILE ); +#endif +*/ + +#ifdef _EQUIT_ADDPILE + maxpile += CHAR_getWorkInt( charaindex, CHAR_WORKATTACHPILE); + maxpile = (maxpile<0)?0:maxpile; +#endif + return maxpile; +} + +BOOL CHAR_PileItemFromItemBoxToItemBox( int charaindex, int fromindex, int toindex) +{ + int maxpile, fromid, toid; + if( !CHAR_CHECKINDEX( charaindex) ) return FALSE; + fromid = CHAR_getItemIndex( charaindex, fromindex); + toid = CHAR_getItemIndex( charaindex, toindex); + + maxpile = CHAR_getMyMaxPilenum( charaindex); + + if( ITEM_CHECKINDEX( toid) && ITEM_CHECKINDEX( fromid) && + (ITEM_getInt( toid, ITEM_ID) == ITEM_getInt( fromid, ITEM_ID)) && + (ITEM_getInt( toid, ITEM_CANBEPILE) == 1) && + (ITEM_getInt( toid, ITEM_USEPILENUMS) < maxpile) && + (ITEM_getInt( fromid, ITEM_USEPILENUMS) < maxpile) ){ + int formpilenum , pilenum, defpilenum; + + pilenum = ITEM_getInt( toid, ITEM_USEPILENUMS); + formpilenum = ITEM_getInt( fromid, ITEM_USEPILENUMS); + defpilenum = ((maxpile-pilenum)>formpilenum)? formpilenum:(maxpile-pilenum); + formpilenum = formpilenum - defpilenum; + pilenum = pilenum + defpilenum; + ITEM_setInt( toid, ITEM_USEPILENUMS, pilenum); + ITEM_setInt( fromid, ITEM_USEPILENUMS, formpilenum); + + if( formpilenum <= 0 ){ + CHAR_setItemIndex( charaindex, fromindex ,-1); + ITEM_endExistItemsOne( fromid); + } + return TRUE; + } + return FALSE; +} +#endif + +static BOOL CHAR_moveItemFromItemBoxToItemBox( int index, int fromindex, int toindex) +{ + int fromid, toid; + + if( !CHAR_CHECKINDEX( index ) ) return FALSE; +#ifdef _ITEM_PILENUMS + if( CHAR_PileItemFromItemBoxToItemBox( index, fromindex, toindex) == TRUE ){ + CHAR_sendItemDataOne( index, toindex); + CHAR_sendItemDataOne( index, fromindex); + return TRUE; + } +#endif + fromid = CHAR_getItemIndex( index, fromindex); + toid = CHAR_getItemIndex( index, toindex); +#ifdef _ITEM_RESET + char *itemarg = NULL; + itemarg = ITEM_getChar(fromid,ITEM_ARGUMENT); + if(strlen(itemarg)>0){ + int itemid; + int playfd = getfdFromCharaIndex(index); + if(strcmp(itemarg,"ITEMRESET")==0){ + itemid = ITEM_getInt(toid,ITEM_ID); + int resetpoint = sasql_itemreset_query(itemid); + if(resetpoint>=0){ + char resetmsg[256]; + sprintf(resetmsg,"\nȷҪԭ%sô\n\nԭƷҪ%d\n\nȷĻOK\n",ITEM_getChar(toid,ITEM_NAME),resetpoint); + lssproto_WN_send( playfd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_RESETITEM, + -1, + resetmsg); + CHAR_setWorkInt(index,CHAR_WORKFROMITEMINDEX,fromindex); + CHAR_setWorkInt(index,CHAR_WORKTOITEMINDEX,toindex); + return FALSE; + }else{ + if(itemid>=0){ + lssproto_WN_send( playfd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_CANCEL, + -1, + -1, + "˵߲ܻԭ"); + } + } + }else if(strcmp(itemarg,"ITEMDEL")==0){ + itemid = ITEM_getInt(toid,ITEM_ID); + int resetpoint = sasql_itemdel_query(itemid); + if(resetpoint>=0){ + char resetmsg[256]; + sprintf(resetmsg,"\nȷҪա%sô\n\nƷտɵá%d\n\nȷĻOK\n",ITEM_getChar(toid,ITEM_NAME),resetpoint); + lssproto_WN_send( playfd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DELITEM, + -1, + resetmsg); + CHAR_setWorkInt(index,CHAR_WORKFROMITEMINDEX,fromindex); + CHAR_setWorkInt(index,CHAR_WORKTOITEMINDEX,toindex); + return FALSE; + }else{ + if(itemid>=0){ + lssproto_WN_send( playfd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_CANCEL, + -1, + -1, + "˵߲ܻգ"); + } + } + } + } +#endif + CHAR_setItemIndex(index,toindex, CHAR_setItemIndex( index, fromindex, toid)); + CHAR_sendSIToCli( index,fromindex,toindex); + + return TRUE; +} + +void CHAR_moveEquipItem( int index, int fromindex, int toindex ) +{ +#define MOVEITEM_NONE 0 +#define MOVEITEM_EQUIPTOITEM 1 << 0 +#define MOVEITEM_ITEMTOEQUIP 1 << 1 +#define MOVEITEM_ITEMTOITEM 1 << 2 + + int fromid; /* item ƥ̼͵ */ + + + unsigned int moved_any = 0; + while( 1) { + if( !CHAR_CHECKINDEX( index ) )break; + if( CHAR_getFlg( index,CHAR_ISDIE ) )break; + if( fromindex < 0 || fromindex >= CHAR_MAXITEMHAVE || + toindex < 0 || toindex >= CHAR_MAXITEMHAVE ) + break; + + fromid = CHAR_getItemIndex(index,fromindex); + if( fromid == -1 || fromid == -2 )break; + if( fromindex == toindex )break; + if( fromindex < CHAR_EQUIPPLACENUM ){ + if( toindex < CHAR_EQUIPPLACENUM ){ + if( CHAR_getItemIndex(index,toindex) < 0 ){ + CANNOTMOVE; + }else{ + CANNOTEXCHANGE; + } + + }else { + moved_any |= CHAR_moveItemFromEquipToItemBox( + index, fromindex, toindex ) + ? MOVEITEM_EQUIPTOITEM : MOVEITEM_NONE; + if( moved_any & MOVEITEM_EQUIPTOITEM) { + char category[3]; + snprintf( category,sizeof( category),"J%d", fromindex); + CHAR_sendStatusString( index , category); + } + } + }else{ + if( toindex < CHAR_EQUIPPLACENUM ) { + moved_any |= CHAR_moveItemFromItemBoxToEquip( + index, fromindex , toindex ) + ? MOVEITEM_ITEMTOEQUIP : MOVEITEM_NONE; + if( moved_any & MOVEITEM_ITEMTOEQUIP) { + char category[3]; + snprintf( category,sizeof( category),"J%d", toindex); + CHAR_sendStatusString( index , category); + } + }else { + moved_any |= CHAR_moveItemFromItemBoxToItemBox( index,fromindex,toindex ) + ? MOVEITEM_ITEMTOITEM : MOVEITEM_NONE; + } + } + CHAR_complianceParameter( index ); + CHAR_sendCToArroundCharacter(CHAR_getWorkInt(index, CHAR_WORKOBJINDEX)); + break; + } + + if( (moved_any & MOVEITEM_EQUIPTOITEM) || (moved_any & MOVEITEM_ITEMTOEQUIP)){ + int i; + CHAR_send_P_StatusString( index, + CHAR_P_STRING_HP|CHAR_P_STRING_MAXHP| + CHAR_P_STRING_MP|CHAR_P_STRING_MAXMP| + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_QUICK|CHAR_P_STRING_CHARM| + CHAR_P_STRING_LUCK|CHAR_P_STRING_EARTH| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND + ); +/* + if( CHAR_getWorkInt( index,CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int petindex = CHAR_getCharPet( index, i); + if( CHAR_CHECKINDEX( petindex) ) { + char category[3]; + CHAR_complianceParameter( petindex ); + snprintf( category, sizeof( category), "K%d",i); + CHAR_sendStatusString( index, category ); + } + } + } +*/ + } + if( !moved_any ) { + CHAR_sendSIToCli( index,-1,-1); + } +} + +int CHAR_addItemToChar( Char* ch, int itemid ) +{ + int itembox; + itembox = CHAR_findEmptyItemBoxFromChar( ch ); + if( itembox == -1 )return -1; + + return ch->indexOfExistItems[itembox]=ITEM_makeItemAndRegist(itemid); +} + +int CHAR_addItem( int charaindex, int itemid ) +{ + Char* ch; + ch = CHAR_getCharPointer(charaindex); + if( ch != NULL ){ + int ret = CHAR_addItemToChar( ch,itemid ); + if( ret == -1 )return ret; + ITEM_setWorkInt(ret,ITEM_WORKCHARAINDEX,charaindex); + ITEM_setWorkInt(ret,ITEM_WORKOBJINDEX,-1); + return ret; + }else + return -1; +} + + +void CHAR_ItemUse( int charaindex, int to_charaindex, int haveitemindex ) +{ + void (*usefunc)(int,int,int)=NULL; + int itemindex; + if( !CHAR_CHECKINDEX( charaindex ) ){ + print( "ANDY charaindex=%d err\n", charaindex); + return; + } + if( CHAR_CHECKITEMINDEX( charaindex, haveitemindex) == FALSE ){ + print( "ANDY haveitemindex=%d err\n", haveitemindex); + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ){ +// print( "ANDY itemindex=%d err\n", itemindex); + return; + } + int myviptype = CHAR_getInt(charaindex,CHAR_VIPRIDE); + if(myviptype==0){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP")!=NULL){ + CHAR_talkToCli( charaindex, -1, "Աȼ޷ʹôװ", CHAR_COLORYELLOW ); + return; + } + }else if(myviptype==1){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP2]")!=NULL || strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL){ + CHAR_talkToCli( charaindex, -1, "Աȼ޷ʹôװ", CHAR_COLORYELLOW ); + return; + } + }else if(myviptype==2){ + if(strstr(ITEM_getChar(itemindex,ITEM_NAME),"[VIP3]")!=NULL){ + CHAR_talkToCli( charaindex, -1, "Աȼ޷ʹôװ", CHAR_COLORYELLOW ); + return; + } + } + if( CHAR_getFlg( charaindex, CHAR_ISDIE ) ){ + print( "ANDY charaindex=%d is CHAR_ISDIE err\n", charaindex); + return; + } +#ifdef _STREET_VENDOR + // ̯вʹõ + if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) > -1){ + print("StreetVendor use item charaindex=%d,name=%s\n",charaindex,CHAR_getChar(charaindex,CHAR_NAME)); + return; + } +#endif + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ) { + if( CHAR_getInt( to_charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + int action = ITEM_getInt( itemindex, ITEM_USEACTION); + if( action != -1 ) { + CHAR_sendAction( to_charaindex, action, TRUE); + } + } + } + // + if( ITEM_getInt( itemindex,ITEM_TYPE) != ITEM_OTHER && + ITEM_getInt( itemindex,ITEM_TYPE) != ITEM_DISH ) { + CHAR_EquipPlace ep; + + ep = ITEM_getEquipPlace( charaindex, itemindex ); + if( ep == -1 )return; + if( ep == CHAR_DECORATION1 ) { + int flg = FALSE; + int toitemindex1 = CHAR_getItemIndex( charaindex, ep); + int toitemindex2 = CHAR_getItemIndex( charaindex, CHAR_DECORATION2); + int searchindex = -1; + int fromitemtype = ITEM_getInt( itemindex, ITEM_TYPE); + + if( !ITEM_CHECKINDEX( toitemindex1)) searchindex = toitemindex2; + else if(!ITEM_CHECKINDEX( toitemindex2)) searchindex = toitemindex1; + if( searchindex != -1 ) { + if( fromitemtype != ITEM_getInt( searchindex, ITEM_TYPE)) { + flg = TRUE; + ep = ( searchindex == toitemindex1) + ? CHAR_DECORATION2:CHAR_DECORATION1; + } + } + if( !flg) { + if( fromitemtype != ITEM_getInt( toitemindex2, ITEM_TYPE)) { + ep = CHAR_DECORATION1; + }else if( fromitemtype != ITEM_getInt( toitemindex1, ITEM_TYPE)) { + ep = CHAR_DECORATION2; + }else { + ep = CHAR_DECORATION1; + } + } + } + CHAR_moveEquipItem( charaindex, haveitemindex,ep ); + return; + } + + usefunc = (void(*)(int,int,int))ITEM_getFunctionPointer( itemindex,ITEM_USEFUNC ); + if( usefunc ){ + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ’o */ + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ̷ة?į */ +#endif + "Use(ʹõ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + usefunc(charaindex, to_charaindex, haveitemindex); + }else{ +#ifdef _ALLBLUES_LUA_1_2 + if(RunItemUseEvent(itemindex, charaindex, to_charaindex, haveitemindex) == FALSE ) +#endif +{ + char ansmsg[256]; + strcpysafe( ansmsg, sizeof(ansmsg), + "ʲҲûз"); + CHAR_talkToCli( charaindex, -1, ansmsg, CHAR_COLORWHITE ); + } + } +} + +BOOL CHAR_DropItemFXY( int charaindex, int itemcharaindex, int fl, + int x, int y, int* objindex ) +{ + int itemindex; + itemindex = CHAR_getItemIndex(charaindex,itemcharaindex); + if( ITEM_CHECKINDEX(itemindex) == FALSE )return -3; + if( MAP_walkAbleFromPoint( fl,x,y, FALSE ) == FALSE ){ + return -2; + } + + { + OBJECT object; + for( object=MAP_getTopObj(fl,x,y) ; object; object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_NOUSE: + break; + case OBJTYPE_ITEM: +#ifdef _DROPSTAKENEW + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID) + { + int i = 0; + int dropflag = 0; + ITEM_Item *itm; + for(i = 0; i < arraysizeof(casinomap); i++){ + if(CHAR_getInt(charaindex, CHAR_FLOOR) == casinomap[i].casinofl){ + if(x == casinomap[i].casinox && y == casinomap[i].casinoy){ + dropflag = 1; + break; + } + } + } + if(dropflag == 1){ + if( (itm = ITEM_getItemPointer( itemindex)) == NULL ) return -1; + strcpysafe( itm->string[ITEM_WATCHFUNC].string, + sizeof(itm->string[ITEM_WATCHFUNC].string), "ITEM_DeleteTimeWatched" ); + + break; + }else{ + + return -1; + } + } +#endif + case OBJTYPE_GOLD: + { + + return -1; + } + case OBJTYPE_CHARA: + { + typedef BOOL (*ITEMPUTFUNC)(int,int); + ITEMPUTFUNC ipfunc; + ipfunc = (ITEMPUTFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex),CHAR_ITEMPUTFUNC) ; + + if( ipfunc && ipfunc(OBJECT_getIndex(objindex), + itemindex) == TRUE) + return -3; + break; + } + default: + break; + } + } + + *objindex = CHAR_DropItemAbsolute( itemindex,fl,x,y, FALSE ); + + if( *objindex == -1 ) + return -3; + { + char tmpbuf[256]; + sprintf(tmpbuf," %s (ʧʱ%d)",ITEM_getChar( itemindex, ITEM_NAME),getItemdeletetime()); + CHAR_talkToCli( charaindex, -1, tmpbuf, CHAR_COLORYELLOW ); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +#endif + "Drop()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + return 0; + } +} + + +#ifdef _ITEM_PILENUMS //andy_edit 2003/04/01 + +void CHAR_SendDropItem_Stats( int charaindex, int itemindex, int itemcharaindex, int flg) +{ + if( flg == 1 ){ + CHAR_setItemIndex( charaindex, itemcharaindex , -1); + } + CHAR_sendItemDataOne( charaindex, itemcharaindex); + + if( CHAR_complianceParameter( charaindex ) ){ + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX)); + } + + if( 0 <= itemcharaindex && itemcharaindex < CHAR_STARTITEMARRAY && + CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ //Ϊװ + if( ITEM_CHECKINDEX( itemindex) ) + CHAR_sendItemDetachEvent( charaindex, itemindex ); + + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_HP|CHAR_P_STRING_MAXHP| + CHAR_P_STRING_MP|CHAR_P_STRING_MAXMP| + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_QUICK|CHAR_P_STRING_CHARM| + CHAR_P_STRING_LUCK|CHAR_P_STRING_EARTH| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND ); + } +} +#ifdef _DROPSTAKENEW +void CHAR_DropStakeByDropItem( int charaindex, int itemcharaindex, int itemindex, int fl, int x, int y) +{ + int j, k, casinoflag = 0, dropflag; + char tmpbuf[256]; + dropflag = CHAR_getWorkInt( charaindex, CHAR_WORKSTAKEFLAG); + if( dropflag >= MAXSTAKENUM){ + snprintf( tmpbuf, sizeof( tmpbuf), "Ѿעˣ޷ע"); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORYELLOW); + return; + } + for (j = 0; j < arraysizeof( casinomap); j++){ + if( CHAR_getInt( charaindex, CHAR_FLOOR) != casinomap[j].casinofl ) continue; + if( x != casinomap[j].casinox || y != casinomap[j].casinoy ) continue; + if( casinomap[j].dropflag == 0 ){ + CHAR_talkToCli( charaindex, -1, "޷ע", CHAR_COLORYELLOW); + return; + }else{ + int objindex; + objindex = CHAR_DropItemAbsolute( itemindex, fl, x, y, FALSE ); + if( objindex == -1 ) return; + ITEM_setInt( itemindex, ITEM_PUTTIME, NowTime.tv_sec+30*60); + CHAR_sendWatchEvent( objindex, CHAR_ACTSTAND, NULL, 0, TRUE); + casinoflag = 1; + snprintf(tmpbuf, sizeof(tmpbuf), " %s עһŲȯ", casinomap[j].casinoinfo); + for(k = 0; k < MAXSTAKENUM; k++){//ע趨 + if(CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + k) != 0) continue; + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + k, casinomap[j].casinotype); + dropflag++; + break; + } + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORYELLOW); +#ifdef _FIX_GAMBLENUM + if (dropflag <= MAXSTAKENUM){ //۵Ķ + int nAcc = CHAR_getInt(charaindex, CHAR_GAMBLENUM); + nAcc -= casinomap[j].accumulation; + CHAR_setInt(charaindex, CHAR_GAMBLENUM, nAcc); + } +#endif + dropflag = ( dropflag >= MAXSTAKENUM )?MAXSTAKENUM:dropflag; + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, dropflag); + break; + } + } + + if( casinoflag == 0) return; + LogItem(CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt(itemindex, ITEM_ID), +#endif + "StakeDrop(ȯ)", + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + ITEM_getChar(itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_SendDropItem_Stats( charaindex, itemindex, itemcharaindex, 1); + +} +#endif + +BOOL CHAR_FindAroundUsabilitySpace( int charaindex, int itemindex, int *fl, int *x, int *y) +{ + int dropx, dropy, i; + BOOL Find = FALSE; + int myfl = CHAR_getInt( charaindex, CHAR_FLOOR); + + for( i = 0 ; i < 8 ; i ++ ){ + OBJECT object; + Find = FALSE; + dropx = CHAR_getInt( charaindex, CHAR_X) + CHAR_getDX( CHAR_getInt( charaindex, CHAR_DIR) + i); + dropy = CHAR_getInt( charaindex, CHAR_Y) + CHAR_getDY( CHAR_getInt( charaindex, CHAR_DIR) + i); + if( MAP_walkAbleFromPoint( myfl, dropx, dropy, FALSE ) == FALSE ) continue; + for( object = MAP_getTopObj( myfl, dropx, dropy) ; object ; object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + if( !CHECKOBJECTUSE( objindex)) continue; + if( OBJECT_getType( objindex) == OBJTYPE_CHARA ){ + typedef BOOL (*ITEMPUTFUNC)(int,int); + ITEMPUTFUNC ipfunc; + ipfunc = (ITEMPUTFUNC)CHAR_getFunctionPointer( OBJECT_getIndex(objindex),CHAR_ITEMPUTFUNC) ; + if( ipfunc && ipfunc( OBJECT_getIndex( objindex), itemindex) == TRUE) + return FALSE; + }else{ + Find = TRUE; + break; + } + } + if( Find == FALSE ){ + *fl = myfl; + *x = dropx; + *y = dropy; + return TRUE; + } + } + return FALSE; +} + +void CHAR_DropItem( int charaindex, int itemcharaindex ) +{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(charaindex); + return; + } + int itemindex, fl, x, y, ret, objindex, beDropOne = 1; + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex, -1, "ս״̬޷װ", CHAR_COLORYELLOW ); + return; + } +#ifdef _AVID_TRADETRYBUG //װ + if( CHAR_getWorkInt(charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE){ + CHAR_talkToCli( charaindex, -1, "״̬޷װ", CHAR_COLORYELLOW ); + return; + } +#endif + + itemindex = CHAR_getItemIndex( charaindex, itemcharaindex); + if( !ITEM_CHECKINDEX( itemindex)) return; +#ifdef _LOCK_PET_ITEM + char *arg = ITEM_getChar(itemindex, ITEM_NAME); + if(arg[0] == '*'){ + CHAR_talkToCli( charaindex, -1, "󶨵Ʒܶ", CHAR_COLORYELLOW ); + return; + } +#endif +#ifdef _NO_DROPITEM + if( strstr(ITEM_getChar(itemindex,ITEM_EFFECTSTRING),"")){ + if(CHAR_getWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX)!=itemcharaindex){ + char dropmsg[256]; + sprintf(dropmsg,"\n%sΪƷ\n\nֱʧ\n\nȷҪôȷ밴[OK]\n",ITEM_getChar(itemindex,ITEM_NAME)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DROPITEM, + -1, + dropmsg); + CHAR_setWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX,itemcharaindex); + return; + }else{ + CHAR_setWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX,-1); + } + } +#endif + if(ITEM_getInt(itemindex,ITEM_TIME)>0){ + if(CHAR_getWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX)!=itemcharaindex){ + char dropmsg[256]; + sprintf(dropmsg,"\n%sΪʱƷ\n\nֱʧ\n\nȷҪôȷ밴[OK]\n",ITEM_getChar(itemindex,ITEM_NAME)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DROPITEM, + -1, + dropmsg); + CHAR_setWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX,itemcharaindex); + return; + }else{ + CHAR_setWorkInt(charaindex,CHAR_DROPITEMCHARAINDEX,-1); + } + } + if( ITEM_getInt( itemindex, ITEM_ID) == CASINOTOKENID && + ( CHAR_getInt( charaindex, CHAR_FLOOR ) == 7008 || + CHAR_getInt( charaindex, CHAR_FLOOR ) == 7005 || + CHAR_getInt( charaindex, CHAR_FLOOR ) == 7003 ) ){ + + int dropx, dropy, dropfl; + dropfl = CHAR_getInt( charaindex, CHAR_FLOOR); + dropx = CHAR_getInt( charaindex, CHAR_X) + CHAR_getDX( CHAR_getInt( charaindex, CHAR_DIR)); + dropy = CHAR_getInt( charaindex, CHAR_Y) + CHAR_getDY( CHAR_getInt( charaindex, CHAR_DIR)); + CHAR_DropStakeByDropItem( charaindex, itemcharaindex, itemindex, dropfl, dropx, dropy); + return; + } +#ifdef _PETITEM__AMOI_E + //print ("\n%d,%d,%d\n",ITEM_NOT_DROP,ITEM_getInt(itemindex, ITEM_TYPEOFITEM),ITEM_NOT_DROP & ITEM_getInt(itemindex, ITEM_TYPEOFITEM)); + if(ITEM_NOT_DROP & ITEM_getInt(itemindex, ITEM_TYPEOFITEM)){ + char buf[256]; + sprintf( buf, "%s޷", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORRED); + return ; + } +#endif + //ҳΧռ + if( CHAR_FindAroundUsabilitySpace( charaindex, itemindex, &fl, &x, &y) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ΧĵѾˡ", CHAR_COLORYELLOW ); + return; + } + +#ifdef _ITEM_PILENUMS + if( ITEM_getInt( itemindex, ITEM_CANBEPILE) == 1 && + ITEM_getInt( itemindex, ITEM_USEPILENUMS) > 1 ){ + int ret; + int nums = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + ret = ITEM_makeItemAndRegist( ITEM_getInt( itemindex, ITEM_ID) ); + if( !ITEM_CHECKINDEX( ret)) return; + ITEM_setInt( itemindex, ITEM_USEPILENUMS, nums -1 ); + itemindex = ret; + beDropOne = 0; + } +#endif + //ҵռ + ret = ITEM_eventDrop( itemindex, charaindex, itemcharaindex ); + if( ret == 1 || ITEM_getInt(itemindex,ITEM_TIME)>0){ //-1 Ʒ 1 ʧ 0 һƷ + CHAR_SendDropItem_Stats( charaindex, itemindex, itemcharaindex, beDropOne); + return; + }else { + objindex = CHAR_DropItemAbsolute( itemindex, fl, x, y, FALSE ); + if( objindex == -1 ) return; + ITEM_setInt( itemindex, ITEM_PUTTIME, NowTime.tv_sec); +#ifdef _PICKUP_ITEM_OTHER + if(getPickupItem()==1){ + ITEM_setChar(itemindex,ITEM_FROMCDKEY,CHAR_getChar( charaindex, CHAR_CDKEY )); + } +#endif + { + char tmpbuf[256]; + sprintf(tmpbuf," %s (ʧʱ%d)",ITEM_getChar( itemindex, ITEM_NAME),getItemdeletetime()); + CHAR_talkToCli( charaindex, -1, tmpbuf, CHAR_COLORYELLOW ); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +#endif + "Drop()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + CHAR_sendWatchEvent( objindex, CHAR_ACTSTAND, NULL, 0, TRUE); + } + CHAR_SendDropItem_Stats( charaindex, itemindex, itemcharaindex, beDropOne); +} +#else +void CHAR_DropItem( int charaindex, int itemcharaindex ) +{ + int dirx[9],diry[9]; + int i, j; + int floor, objindex=-1; + int droped =0; + int count_item =0, count_chara =0; + int fl, x, y; + int itemindex = CHAR_getItemIndex(charaindex,itemcharaindex); + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !ITEM_CHECKINDEX( itemindex) ) return; +#ifdef _AVID_TRADETRYBUG //װ + if( CHAR_getWorkInt(charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE){ + CHAR_talkToCli( charaindex, -1, "״̬޷װ", CHAR_COLORYELLOW ); + return; + } +#endif + +#ifdef _DROPCHECK2 + fl = CHAR_getInt( charaindex, CHAR_FLOOR); + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + for( i = x-CHAR_DEFAULTSEESIZ/2 ; i <= x+CHAR_DEFAULTSEESIZ/2 ; i++ ){ + for( j = y-CHAR_DEFAULTSEESIZ/2 ; j <= y+CHAR_DEFAULTSEESIZ/2 ; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj(fl,i,j); object ; object = NEXT_OBJECT(object ) ) { + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_ITEM || OBJECT_getType(objindex) == OBJTYPE_GOLD ) { + count_item++; + } + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + count_chara++; + } + } + } + +#ifdef _DROPSTAKENEW + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID){ + int k = 0; + int casinodropflag = 0; + for(k = 0; k < arraysizeof(casinomap); k++){ + if(fl == casinomap[k].casinofl){ + if(x >= casinomap[k].casinox - 1 && x <= casinomap[k].casinox + 1){ + if(y >= casinomap[k].casinoy - 1 && y <= casinomap[k].casinoy + 1){ + casinodropflag = 1; + break; + } + } + } + } + if(casinodropflag == 0){ +#endif + if( count_item > 80 || count_chara > 80 ) { + CHAR_talkToCli( charaindex, -1, "ƷѾ̫ˣٶˡ", CHAR_COLORYELLOW ); + return; + } +#ifdef _DROPSTAKENEW + } + } +#endif + } +#endif + + for( i = 1 ; i < 8 ; i ++ ){ + dirx[i] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR) + i); + diry[i] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR) + i); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[8] = 0; + diry[8] = 0; + floor = CHAR_getInt( charaindex,CHAR_FLOOR ); + { + int ret; + if( 0 <= itemcharaindex && itemcharaindex < CHAR_STARTITEMARRAY ){ //Ϊװ + CHAR_sendItemDetachEvent( charaindex, itemindex ); + } + ret = ITEM_eventDrop( itemindex, charaindex, itemcharaindex ); + if( ret == 1 ){ //-1 Ʒ 1 ʧ 0 һƷ + itemindex = -1; + goto END; + }else if( ret == -1 ){ + print( "%s:%d err\n", __FILE__,__LINE__); + return; + }else{ + ; + } + } + + droped = 0; + for( i = 0 ; i < 9 ; i ++ ){ + int x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + int y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; +#ifdef _DROPSTAKENEW + // жƷǷΪȯ + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID){ + int j = 0, k = 0; + int bdropstake = 0; + int casinoflag = 0; + for (j = 0; j < arraysizeof(casinomap); j++){ + if (CHAR_getInt(charaindex, CHAR_FLOOR) == casinomap[j].casinofl){ + if (x == casinomap[j].casinox && y == casinomap[j].casinoy){ + char tmpbuf[256]; + int dropflag = CHAR_getWorkInt(charaindex, CHAR_WORKSTAKEFLAG); + casinoflag = 1; + if(casinomap[j].dropflag == 0){ + CHAR_talkToCli(charaindex, -1, "޷ע", CHAR_COLORYELLOW); + return; + }else{ + snprintf(tmpbuf, sizeof(tmpbuf), " %s עһŲȯ", casinomap[j].casinoinfo); + if(dropflag >= MAXSTAKENUM){ + snprintf(tmpbuf, sizeof(tmpbuf), "Ѿעˣ޷ע"); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORYELLOW); + return; + } + for(k = 0; k < MAXSTAKENUM; k++){ + if(CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + k) == 0){ + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + k, casinomap[j].casinotype); + casinomap[j].stakenum = casinomap[j].stakenum + 1; + if(casinomap[j].stakenum >= 100000000) + casinomap[j].stakenum = 100000000; + dropflag++; + if(casinomap[j].stakenum <= 1) + bdropstake = 1; + break; + } + } + } + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORYELLOW); +#ifdef _FIX_GAMBLENUM + //۵Ķ + if (dropflag <= MAXSTAKENUM){ + int nAcc = CHAR_getInt(charaindex, CHAR_GAMBLENUM); + nAcc -= casinomap[j].accumulation; + CHAR_setInt(charaindex, CHAR_GAMBLENUM, nAcc); + } +#endif + if (dropflag >= MAXSTAKENUM){ + dropflag = 0; + for (k = 0; k < MAXSTAKENUM ; k++){ + if (CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + k) > 0) + dropflag++; + } + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, dropflag); + }else{ + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, dropflag); + } + continue; + } + } + } + + // ˵طIJȯһ + if(bdropstake == 0 && casinoflag != 0){ + CHAR_setItemIndex(charaindex, itemcharaindex ,-1); + CHAR_sendItemDataOne(charaindex, itemcharaindex); + LogItem(CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt(itemindex, ITEM_ID), +#endif + "StakeDrop(ȯ)", + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + ITEM_getChar(itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + return; + } + } +#endif + { + int ret = CHAR_DropItemFXY( charaindex,itemcharaindex, + CHAR_getInt(charaindex,CHAR_FLOOR), x, y, &objindex ); + switch( ret ){ + case 0: + droped = 1; +#ifdef _ITEM_ORNAMENTS // WON FIX + if( ITEM_getWorkInt( itemindex, ITEM_CANPICKUP) > 0 ){ + ITEM_setInt( itemindex, ITEM_PUTTIME, NowTime.tv_sec + 60*5); + }else{ + ITEM_setInt( itemindex, ITEM_PUTTIME, NowTime.tv_sec); + } +#else + ITEM_setInt( itemindex, ITEM_PUTTIME, NowTime.tv_sec); +#endif + goto END; + break; + case -1: + case -2: + break; + case -3: + default: + return; + break; + } +#ifdef _DROPSTAKENEW + } +#endif + } +#ifdef _DROPCHECK + if( droped != 1 ) { + CHAR_talkToCli( charaindex, -1, "ΧĵѾˡ", CHAR_COLORYELLOW ); + return; + } +#endif +END: + CHAR_sendWatchEvent( objindex, CHAR_ACTSTAND, NULL, 0, TRUE); + CHAR_setItemIndex( charaindex, itemcharaindex ,-1); +{ + char category[3]; + snprintf( category,sizeof( category),"J%d", itemcharaindex); + CHAR_sendStatusString( charaindex , category); +} + if( CHAR_complianceParameter( charaindex ) ){ + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX) ); + } + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_HP|CHAR_P_STRING_MAXHP| + CHAR_P_STRING_MP|CHAR_P_STRING_MAXMP| + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_QUICK|CHAR_P_STRING_CHARM| + CHAR_P_STRING_LUCK|CHAR_P_STRING_EARTH| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND + ); + CHAR_sendItemDataOne( charaindex, itemcharaindex); + } + return; +} +#endif + +int CHAR_DropItemAbsolute( int itemindex, int floor, int x, int y, + BOOL net) +{ + Object object; + int objindex; + + if( !ITEM_CHECKINDEX( itemindex) )return FALSE; + + object.type = OBJTYPE_ITEM; + object.index = itemindex; + object.x = x; + object.y = y; + object.floor = floor; + objindex = initObjectOne( &object ); + ITEM_setWorkInt( itemindex,ITEM_WORKOBJINDEX, objindex ); + ITEM_setWorkInt( itemindex,ITEM_WORKCHARAINDEX, -1 ); + if( net ) + CHAR_sendWatchEvent( objindex,CHAR_ACTSTAND,NULL,0,TRUE); + + return objindex; +} + +int CHAR_addItemSpecificItemIndex( int charaindex, int itemindex ) +{ + int emptyindex; + if( CHAR_CHECKINDEX( charaindex) == FALSE) return -1; + if( ITEM_CHECKINDEX( itemindex) == FALSE) return -1; + emptyindex = CHAR_findEmptyItemBox( charaindex ); + if( emptyindex == -1 ){ + return CHAR_MAXITEMHAVE; + }else{ + CHAR_setItemIndex( charaindex, emptyindex, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charaindex); + CHAR_sendItemDataOne( charaindex, emptyindex); + } + return emptyindex; +} + +static int CHAR_PickUpItemFXY( int charaindex, int fl ,int x , int y , + int* contents,int* objindex ) +{ + OBJECT object; + + for( object=MAP_getTopObj(fl,x,y) ; object ; object = NEXT_OBJECT(object ) ){ + int index = GET_OBJINDEX(object); + int objtype = OBJECT_getType(index); + if( objtype == OBJTYPE_NOUSE )continue; + else if( objtype == OBJTYPE_ITEM ){ + int ret; + int itemindex = OBJECT_getIndex( index); +#ifdef _ITEM_ORNAMENTS + if( ITEM_getWorkInt( itemindex, ITEM_CANPICKUP) > 0 ){ + return -1; + } +#endif +#ifdef _DROPSTAKENEW + // жƷǷΪȯ + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID){ + int i = 0; + int bdropstake = 0, casinoflag = 0, emptyitemindexinchara = -1; + for(i = 0; i < arraysizeof(casinomap); i++){ + if(fl == casinomap[i].casinofl){ + if(x == casinomap[i].casinox && y == casinomap[i].casinoy){ + int j = 0, stakeflag = 0; + int pickupflag = 0; + casinoflag = 1; + if(casinomap[i].dropflag == 0){ + CHAR_talkToCli(charaindex, -1, "Ѿ޷ȡעȯˣ", CHAR_COLORYELLOW); + return -1; + } + stakeflag = CHAR_getWorkInt(charaindex, CHAR_WORKSTAKEFLAG); + if(stakeflag == 0){ + CHAR_talkToCli(charaindex, -1, "ûע޷ȡزȯ", CHAR_COLORYELLOW); + return -1; + } + for(j = 0; j < MAXSTAKENUM; j++){ + if(CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + j) == casinomap[i].casinotype){ + emptyitemindexinchara = CHAR_findEmptyItemBox(charaindex); + if(emptyitemindexinchara < 0) return -2; + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + j, 0); + casinomap[i].stakenum = casinomap[i].stakenum - 1; + stakeflag--; + pickupflag = 1; +#ifdef _FIX_GAMBLENUM + //ӵĶ + { + int nAcc = CHAR_getInt(charaindex, CHAR_GAMBLENUM); + nAcc += casinomap[i].accumulation; + CHAR_setInt(charaindex, CHAR_GAMBLENUM, nAcc); + } +#endif + if(casinomap[i].stakenum <= 0){ + bdropstake = 1; + casinomap[i].stakenum = 0; + } + break; + } + } + if(stakeflag < 0){ + stakeflag = 0; + for(j = 0; j < MAXSTAKENUM; j++){ + if(CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + j) > 0) + stakeflag++; + } + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, stakeflag); + }else + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, stakeflag); + if(pickupflag == 0){ + CHAR_talkToCli(charaindex, -1, "ûڴע޷ȡزȯ", CHAR_COLORYELLOW); + return -1; + } + } + } + } + + if(bdropstake == 0 && casinoflag != 0){// ˵طIJȯһ + char tmpbuf[256]; + if(emptyitemindexinchara != -1){ + int itemid=-1, ret=-1; + itemid = ITEM_makeItemAndRegist(CASINOTOKENID); + if(itemid == -1) return -1; + ret = CHAR_addItemSpecificItemIndex( charaindex, itemid); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemid ); + return -1; + } + } + CHAR_sendItemDataOne(charaindex, emptyitemindexinchara); + snprintf(tmpbuf, sizeof(tmpbuf), "ʰ%sѽעȡ", + ITEM_getChar(itemindex, ITEM_NAME)); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORWHITE); + // ¼ؼ¼ + LogItem(CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt(itemindex, ITEM_ID), +#endif + "StakePickUp(ȯ)", + CHAR_getInt(charaindex,CHAR_FLOOR), + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y), + ITEM_getChar(itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + return -1; + } + } +#endif +#ifdef _PICKUP_ITEM_OTHER + if(getPickupItem()==1){ + char pickupchar[16]; + sprintf(pickupchar,",%d,",ITEM_getInt(itemindex,ITEM_ID)); + if(ITEM_getChar(itemindex,ITEM_FROMCDKEY)!=NULL && strstr(getPickItemId(),pickupchar)==NULL){ + if(strcmp(CHAR_getChar(charaindex,CHAR_CDKEY),ITEM_getChar(itemindex,ITEM_FROMCDKEY))!=0){ + CHAR_talkToCli(charaindex, -1, "˵߲У޷ʰȡ", CHAR_COLORWHITE); + return -1; + } + } + } +#endif + ret = CHAR_addItemSpecificItemIndex( charaindex, itemindex ); + if(ret == CHAR_MAXITEMHAVE ){ + return -2; + }else if( ret != -1 ) { + typedef void (*PICKUPFUNC)( int, int); + PICKUPFUNC pickupfunc = NULL; + pickupfunc = (PICKUPFUNC)ITEM_getFunctionPointer( + itemindex, ITEM_PICKUPFUNC); + if( pickupfunc){ + pickupfunc( charaindex, itemindex); + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + RunItemPickupEvent(charaindex, itemindex ); + } +#endif + *contents = OBJECT_getIndex(index); + *objindex = index; +// CHAR_sendItemDataOne( charaindex, ret); + return 0; + } + }else if( objtype == OBJTYPE_GOLD ){ + int MaxGold; + long dropgoldamount = 0, newamountgold = 0, Minus = 0, newgold = 0; + long mygold = (long) CHAR_getInt( charaindex, CHAR_GOLD ); + MaxGold = CHAR_getMaxHaveGold( charaindex); + if ((mygold <0) || (mygold > MaxGold))return -2; + dropgoldamount = OBJECT_getIndex(index); + newamountgold = (unsigned int) CHAR_getInt( charaindex,CHAR_GOLD ) + dropgoldamount; + Minus = newamountgold - MaxGold; + if( Minus > 0 ) { + newgold = Minus; + *contents = dropgoldamount - Minus; + }else { + newgold = 0; + *contents = dropgoldamount; + } + OBJECT_setIndex( index, newgold); + CHAR_setInt( charaindex, CHAR_GOLD, min( newamountgold, MaxGold ) ); + *objindex = index; + return 1; + }else if( objtype == OBJTYPE_CHARA ) { + int pindex = OBJECT_getIndex( index); + if( !CHAR_CHECKINDEX( pindex) ) continue; + if( CHAR_getInt( pindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ) { + int havepetindex = CHAR_getCharPetElement( charaindex); + if( havepetindex == -1 ) { + if( CHAR_getWorkInt( pindex, CHAR_WORKPETFOLLOWMODE) != CHAR_PETFOLLOW_NOW ) + return -3; + } + if( CHAR_getWorkInt( charaindex, CHAR_PickAllPet) != TRUE ) { + if( (CHAR_getInt( pindex, CHAR_LV) - CHAR_getInt( charaindex, CHAR_LV) > 5 ) + && (CHAR_getInt( charaindex, CHAR_TRANSMIGRATION ) <= 0 )) { + return -4; + } + } +#ifdef _PET_UP + if( getPetup() != 1 && CHAR_getInt(charaindex,CHAR_FLOOR)!=getPetup() ) +#endif + { + if( !strcmp( CHAR_getChar( pindex, CHAR_OWNERCDKEY), "SYSTEM_WAYI" ) && + !strcmp( CHAR_getChar( pindex, CHAR_OWNERCHARANAME), "SYSTEM_WAYI" ) ){ + }else{ + if( strcmp( CHAR_getChar( pindex, CHAR_OWNERCDKEY), CHAR_getChar( charaindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( pindex, CHAR_OWNERCHARANAME), CHAR_getChar( charaindex, CHAR_NAME) )){ + return -5; + } + } + } + if( CHAR_getWorkInt( pindex, CHAR_WORKPETFOLLOWMODE) == CHAR_PETFOLLOW_NOW ){ + CHAR_pickupFollowPet( charaindex, pindex ); + return -1; + } + if( CHAR_getInt( pindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE){ + if( strcmp( CHAR_getChar( pindex, CHAR_OWNERCDKEY), + CHAR_getChar( charaindex, CHAR_CDKEY)) != 0 || + strcmp( CHAR_getChar( pindex, CHAR_OWNERCHARANAME), + CHAR_getChar( charaindex, CHAR_NAME))!= 0 ){ + return -5; + }else if( CHAR_getInt( pindex, CHAR_MAILMODE) != CHAR_PETMAIL_IDLE5){ + return -5; + } + } + if( CHAR_getInt( pindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE){ + Char *ch; + CHAR_setInt( pindex, CHAR_MAILMODE, CHAR_PETMAIL_NONE); + CHAR_setInt( pindex, CHAR_PETMAILIDLETIME, 0); + PETMAIL_delPetMailTotalnums( 1); //ֶmail PET + ch = CHAR_getCharPointer( pindex); + if( ch != NULL ) { + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), ""); + CHAR_constructFunctable( pindex); + } + } + CHAR_setWorkInt( pindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetindex, pindex); +#ifndef _FIX_COPY_MM_BUG +#ifdef _PET_TALK + if( CHAR_getInt( pindex, CHAR_PETID) != 718 ) { +#endif +#endif + CHAR_setChar( pindex, CHAR_OWNERCDKEY, + CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( pindex, CHAR_OWNERCHARANAME, + CHAR_getChar( charaindex, CHAR_NAME)); +#ifndef _FIX_COPY_MM_BUG +#ifdef _PET_TALK + } +#endif +#endif +#ifdef _PET_ITEM + CHAR_sendPetItemData( charaindex, havepetindex); +#endif + CHAR_complianceParameter( pindex); +{ + char category[3]; + snprintf( category,sizeof( category),"K%d",havepetindex); + CHAR_sendStatusString( charaindex, category); + snprintf( category,sizeof( category),"W%d",havepetindex); + CHAR_sendStatusString( charaindex, category); +} + CHAR_setInt( pindex, CHAR_PUTPETTIME, 0); + *contents = pindex; + *objindex = index; + return 2; + } + } + } + return -1; +} + +void CHAR_PickUpItem( int charaindex, int dir ) +{ + if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) > 0) + { + return; + } + int i; + int dirx[2],diry[2]; + int searchloopcount=0; + + if( !CHAR_CHECKINDEX(charaindex) )return; + if( CHAR_getFlg( charaindex,CHAR_ISDIE ) )return; + if( CHAR_getWorkInt( charaindex,CHAR_WORKBATTLEMODE ) )return; + if( dir < 0 ){ + searchloopcount = 1; + dirx[0] = 0; + diry[0] = 0; + }else{ + if( dir != CHAR_getInt( charaindex, CHAR_DIR)) { + VALIDATEDIR(dir); + CHAR_setInt(charaindex,CHAR_DIR,dir); + CHAR_sendWatchEvent(CHAR_getWorkInt(charaindex,CHAR_WORKOBJINDEX), + CHAR_ACTSTAND,NULL,0,FALSE); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + searchloopcount=2; + } + for( i = 0 ; i < searchloopcount ; i ++ ){ + int contents,objindex; + int fl = CHAR_getInt(charaindex,CHAR_FLOOR); + + int y = CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + int x = CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + int ret = CHAR_PickUpItemFXY( charaindex,fl,x,y,&contents, &objindex); + switch( ret ){ + case 0: + CHAR_ObjectDelete(objindex); + { + char mesg[256]; +#ifdef _DROPSTAKENEW + int j = 0; + int dropflag = 0; + for(j = 0; j < arraysizeof(casinomap); j++) + { + if(CHAR_getInt(charaindex, CHAR_FLOOR) == casinomap[j].casinofl) + { + if(x == casinomap[j].casinox && y == casinomap[j].casinoy) + { + dropflag = 1; + break; + } + } + } + if(ITEM_getInt(contents, ITEM_ID) == CASINOTOKENID && dropflag == 1) + snprintf( mesg,sizeof(mesg), "ʰ%sѽעȡ", + ITEM_getAppropriateName(contents)); + else +#endif + snprintf( mesg,sizeof(mesg), "ʰ %s", + ITEM_getAppropriateName(contents) ); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); + } + + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + contents, +#else + ITEM_getInt(contents, ITEM_ID), +#endif + "PickUp()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( contents, ITEM_UNIQUECODE), + ITEM_getChar( contents, ITEM_NAME), + ITEM_getInt( contents, ITEM_ID) + ); + } + + return; + break; + case 1: + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + + if( OBJECT_getIndex( objindex) == 0 ) { + CHAR_ObjectDelete(objindex); + }else { + CHAR_sendWatchEvent(objindex,CHAR_ACTSTAND,NULL,0,TRUE); + } + { + char mesg[256]; + if( contents == 0 ) { + snprintf( mesg,sizeof(mesg), "޷ʰStoneˡ" ); + }else { + snprintf( mesg,sizeof(mesg), "ʰ %d Stone",contents ); + } + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); + } + if( contents != 0 ){ + LogStone( + -1, + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + contents, + CHAR_getInt( charaindex, CHAR_GOLD ), + "PickUp(ʰǮ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ) + ); + } + return; + break; + case 2: // + CHAR_ObjectDelete(objindex); + CHAR_setWorkInt( contents, CHAR_WORKOBJINDEX, -1); + { + char mesg[256]; + char *p = NULL; + p = CHAR_getChar( contents, CHAR_USERPETNAME); + if( strlen( p) == 0 ) { + p = CHAR_getChar( contents, CHAR_NAME); + } + + snprintf( mesg,sizeof(mesg), "ʰ %s", p); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); + } + // ʸë׷ + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( contents, CHAR_NAME), + CHAR_getInt( contents, CHAR_LV), + "PickUp()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( contents, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + return; + break; + // Robin 0701 petFollow + case 3: + + /* Իľëе */ + CHAR_ObjectDelete(objindex); + CHAR_setWorkInt( contents, CHAR_WORKOBJINDEX, -1); + { + char mesg[256]; + char *p = NULL; + p = CHAR_getChar( contents, CHAR_USERPETNAME); + if( strlen( p) == 0 ) { + p = CHAR_getChar( contents, CHAR_NAME); + } + + snprintf( mesg,sizeof(mesg), "ʰ %s", p); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORWHITE); + } + // ʸë׷ + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( contents, CHAR_NAME), + CHAR_getInt( contents, CHAR_LV), + "FollowPickUp(ջ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( contents, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + return; + break; + case -1: + break; + case -2: + CHAR_talkToCli( charaindex,-1,"", CHAR_COLORYELLOW); + break; + case -3: + CHAR_talkToCli( charaindex,-1,"", CHAR_COLORYELLOW); + break; + case -4: + CHAR_talkToCli( charaindex,-1,"޷չ˸ó", CHAR_COLORYELLOW); + break; + case -5: + CHAR_talkToCli( charaindex,-1,"޷ʰó", CHAR_COLORYELLOW); + break; + case -6: + CHAR_talkToCli( charaindex,-1,"޷ʰõߡ", CHAR_COLORYELLOW); + break; + default: + return; + } + } + return; +} + +/*------------------------------------------------------------ + * ë ϶ƥ £CHAR_DropMoneyռƥǣ + * ¦ + * charaindex int ƽҷ̼͵ + * itemindex int ʧ ة̼͵(ƽҷ· ƥ) + * fl int ׷ʧ + * x int x + * y int y + * force BOOL 𼰰ҷ + * objindex int* ʧ ة Object ƥ̼ + * ߯Ի + * (ئë Ȼئ) -1 + * (߶ֻ) -2 + * ľ½ -3 + * (巴ڼŷʿ) -4 + * ƥְʧ ة л -5 + * ڻ ƥ -6 + * 0 + ------------------------------------------------------------*/ +static BOOL CHAR_DropMoneyFXY( int charaindex, int amount, int fl , int x, + int y, BOOL force, int* objindex ) +{ + OBJECT object; + int MaxGold; + int mygold = CHAR_getInt( charaindex, CHAR_GOLD ); + if( amount <= 0 )return -6; + if( amount > mygold ) + return -1; + + MaxGold = CHAR_getMaxHaveGold( charaindex); + if ((mygold <0) || (mygold > MaxGold)) return -1; + + if( MAP_walkAbleFromPoint( fl,x,y,FALSE ) == FALSE )return -2; + for( object=MAP_getTopObj(fl,x,y) ; object; + object = NEXT_OBJECT(object) ){ + int index = GET_OBJINDEX(object); + int objtype = OBJECT_getType(index); + + if( objtype == OBJTYPE_NOUSE ) continue; + else if( objtype == OBJTYPE_GOLD ){ + long tmpamount = OBJECT_getIndex(index) + amount; + if( tmpamount > MaxGold ) + return -4; + OBJECT_setIndex(index,tmpamount); + CHAR_setInt(charaindex,CHAR_GOLD, + (unsigned int)CHAR_getInt(charaindex, + CHAR_GOLD ) + - amount ); + *objindex = index; +#ifdef _DEL_DROP_GOLD + OBJECT_setTime( index, NowTime.tv_sec); +#endif + if( amount >= 100 ){ /* ë ׷ */ + LogStone(-1,CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), /* ǡID */ + amount, /* ź */ + CHAR_getInt( charaindex, CHAR_GOLD ), + "Drop(ýǮ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ) + ); + } + return 0; + }else if( objtype == OBJTYPE_ITEM ){ + if( force==TRUE ) + continue; + else + /* ƥʧ ةؤ¼ƥֻ */ + return -5; + } + } + + /* ƥеǷޥ */ + { + Object one; + one.type = OBJTYPE_GOLD; + one.x = x; + one.y = y; + one.floor = fl; + + if( amount > MaxGold ) + return -4; + + one.index = amount; + *objindex = initObjectOne( &one ); + /* Ƥ */ + if( *objindex == -1 ) + /* */ + return -3; + + /*ëӼ*/ + CHAR_setInt(charaindex,CHAR_GOLD, + (unsigned int)CHAR_getInt(charaindex,CHAR_GOLD ) + - amount ); +#ifdef _DEL_DROP_GOLD + OBJECT_setTime( *objindex, NowTime.tv_sec); +#endif + if( amount >= 100 ){ /* ë ׷ */ + LogStone(-1,CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), /* ǡID */ + amount, /* ź */ + CHAR_getInt( charaindex, CHAR_GOLD ), + "Drop(ýǮ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ) + ); + } + return 0; + } +} + +/*------------------------------------------------------------ + * ë ѣ 󡾮 ʣ + * ¦ + * charaindex int ƽҷ̼͵ + * amount int ż + * + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_DropMoney( int charaindex, int amount ) +{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(charaindex); + return; + } + if(CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR) > 0) + { + return; + } + int dirx[9],diry[9]; + int ret; + int i; + int objindex, MaxGold; + + if( !CHAR_CHECKINDEX( charaindex ) )return; + +#ifdef _AVID_TRADETRYBUG //ʯ + if( CHAR_getWorkInt( charaindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_TRADING ){ + CHAR_talkToCli( charaindex, -1, "״̬޷ʯҡ", CHAR_COLORYELLOW ); + return; + } +#endif + + MaxGold = CHAR_getMaxHaveGold( charaindex); + if( CHAR_getFlg( charaindex,CHAR_ISDIE ) )return; + + //ANDY_ADD 12/28 + { + int money=0; + money = CHAR_getInt( charaindex, CHAR_GOLD ); + if( money < 0 ) { + CHAR_setInt( charaindex, CHAR_GOLD, 0); + return; + } + if( (amount > money) || (money > MaxGold)) { + if( money > MaxGold ) { + CHAR_setInt( charaindex, CHAR_GOLD, 0 ); + print("\n ERR: %s(stone%d) dropMoney%d > CHAR_MAXGOLDHAVE !!", + CHAR_getChar(charaindex, CHAR_CDKEY), money, amount); + }else { + print("\n ERR: %s dropMoney > CHAR_GOLD !!", CHAR_getChar(charaindex, CHAR_CDKEY)); + } + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + return; + } + } + //ANDY_END + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX( CHAR_getInt(charaindex,CHAR_DIR) + i+1 ); + diry[i+2] = CHAR_getDY( CHAR_getInt(charaindex,CHAR_DIR) + i+1 ); + } + + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + + for( i = 0 ; i < 9 ; i ++ ){ + int x = CHAR_getInt(charaindex,CHAR_X) + dirx[i]; + int y = CHAR_getInt(charaindex,CHAR_Y) + diry[i]; + +// CoolFish 2002/04/06 עɶʯ +#ifdef _DROPSTAKENEW + { + int j = 0; + for(j = 0; j < arraysizeof(casinomap); j++) + { + if(CHAR_getInt(charaindex, CHAR_FLOOR) == casinomap[j].casinofl) + { + if (x == casinomap[j].casinox && y == casinomap[j].casinoy) + { + CHAR_talkToCli(charaindex, -1, "ﲻܷʯң", CHAR_COLORYELLOW); + return; + } + } + } + } +#endif + ret = CHAR_DropMoneyFXY( charaindex,amount, + CHAR_getInt(charaindex,CHAR_FLOOR), + x,y, FALSE, &objindex ); + switch( ret ){ + case 0: + goto END; + break; + case -1: + return; + break; + case -3: + return; + break; + case -2: + case -4: + case -5: + case -6: + break; + default: + break; + } + } + + { + int x = CHAR_getInt(charaindex,CHAR_X) + dirx[1]; + int y = CHAR_getInt(charaindex,CHAR_Y) + diry[1]; + + ret = CHAR_DropMoneyFXY( charaindex,amount, + CHAR_getInt(charaindex,CHAR_FLOOR), + x,y, TRUE, &objindex ); + switch( ret ){ + case 0: + goto END; + break; + case -1: + break; + case -3: + return; + break; + case -2: + case -4: + case -5: + break; + default: + break; + } + return; + } + +END: + CHAR_sendWatchEvent(objindex,CHAR_ACTSTAND,NULL,0,TRUE ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + return; +} + +static int CHAR_findEmptyItemBoxNoFromChar( Char* ch ) +{ + int i, j=0;; + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i ++ ){ + int itemindex; + itemindex = ch->indexOfExistItems[i]; + if( itemindex == -1 ) j++; + } + return j; +} + +int CHAR_findEmptyItemBoxNo( int index ) +{ + Char* ch; + + if( !CHAR_CHECKINDEX( index ) )return -1; + ch = CHAR_getCharPointer(index); + if( ch != NULL ) + return CHAR_findEmptyItemBoxNoFromChar( ch ); + else + return -1; + +} + +// CoolFish: Trade 2001/4/4 +int CHAR_findTotalEmptyItem( int index ) +{ + int i, totaleptitem = 0; + Char* ch; + + if( !CHAR_CHECKINDEX( index ) )return -1; + ch = CHAR_getCharPointer(index); + if( ch != NULL ){ + for (i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i++){ + int itemindex = 0; + itemindex = ch->indexOfExistItems[i]; + if (itemindex == -1) totaleptitem++; + } + return totaleptitem; + } + + return -1; +} + +// Robin 0707 petFollow +int CHAR_pickupFollowPet( int charaindex, int pickupindex ) +{ + int petindex; + int objindex; + int havepetindex; + char category[3]; + + if( !CHAR_CHECKINDEX( charaindex ) ) return FALSE; + + if( pickupindex != -1 ) + petindex = pickupindex; + else + petindex = CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW ); + + if( !CHAR_CHECKINDEX( petindex ) ) + { + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 ); + return FALSE; + } + + havepetindex = CHAR_getCharPetElement( charaindex); + if( havepetindex == -1 ) { + CHAR_talkToCli(charaindex,-1,"޷ʰأ",CHAR_COLORYELLOW); + return FALSE; + } + + objindex = CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX ); + print(" objindex02:%d ", objindex); + + if( (pickupindex == -1) || (pickupindex == CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW ) ) ) + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 ); + + /* CDKEY ƽҷ ئ巴ئ */ + if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( charaindex, CHAR_CDKEY)) != 0 || + strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( charaindex, CHAR_NAME)) != 0 ) + { + //CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 ); + + return FALSE; + } + + + //CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1 ); + + CHAR_ObjectDelete(objindex); + + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NONE ); + + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetindex, petindex); + +#ifndef _FIX_COPY_MM_BUG +#ifdef _PET_TALK + if( CHAR_getInt( petindex, CHAR_PETID) != 718 ) { +#endif +#endif + CHAR_setChar( petindex, CHAR_OWNERCDKEY, CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( charaindex, CHAR_NAME)); +#ifndef _FIX_COPY_MM_BUG +#ifdef _PET_TALK + } +#endif +#endif + + snprintf( category,sizeof( category),"K%d",havepetindex); + CHAR_sendStatusString( charaindex, category); + snprintf( category,sizeof( category),"W%d",havepetindex); + CHAR_sendStatusString( charaindex, category); + + CHAR_setInt( petindex, CHAR_PUTPETTIME, 0); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0); + + + CHAR_setWorkInt( petindex, CHAR_WORKOBJINDEX, -1); + + { + char mesg[256]; + char *p = NULL; + p = CHAR_getChar( petindex, CHAR_USERPETNAME); + if( strlen( p) == 0 ) { + p = CHAR_getChar( petindex, CHAR_NAME); + } + snprintf( mesg,sizeof(mesg), "ʰ %s", p); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORYELLOW); + } + // ʸë׷ + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "FollowPickUp(ջ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + return TRUE; + +} +#ifdef _GAMBLE_ROULETTE +int NPC_MAPCLEANGOLD( int meindex , int floor) +{ + OBJECT object; + int x,y,fl; + int End_type; + fl = floor; + + for( End_type = 0; End_type < arraysizeof(casinomap) ; End_type++ ) { + if( floor != casinomap[ End_type].casinofl ) + continue; + x = casinomap[ End_type].casinox; + y = casinomap[ End_type].casinoy; + + for( object=MAP_getTopObj(fl,x,y) ; object ; object = NEXT_OBJECT(object ) ) { + int index = GET_OBJINDEX(object); + int objtype = OBJECT_getType(index); + int itemindex = OBJECT_getIndex( index); + + if( objtype == OBJTYPE_NOUSE )continue; + if( objtype == OBJTYPE_ITEM ){ + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID) { + ITEM_endExistItemsOne( itemindex); + OBJECT_setIndex( index, 0); + CHAR_ObjectDelete(index); // + print(" clean( %d )", index ); + } + break; + } + } + casinomap[End_type].stakenum = 0; + } + return 1; +} +#endif + +#ifdef _DROPSTAKENEW +// casinotype : flg = 0 typetype趨 +// mapdropflag : TRUE = ע; +int SetCasinoMap(int npcindex, int casinotype, int mapdropflag) +{ + int npcfloor = CHAR_getInt(npcindex, CHAR_FLOOR); + int i = 0; + if (casinotype < 0 || mapdropflag < 0) + return -1; + for (i = 0; i < arraysizeof(casinomap); i++) + { + if (npcfloor == casinomap[i].casinofl) + { + if (casinotype != 0) + { + if (casinomap[i].casinotype == casinotype) + casinomap[i].dropflag = mapdropflag; + } + else + casinomap[i].dropflag = mapdropflag; + } + } + return 1; +} + +// +int CasinoAccumulation(int charindex, int npcindex, int floor, int wincasinotype) +{ + int i = 0; + int accumulation = CHAR_getInt(charindex, CHAR_GAMBLENUM); + char tmpbuf[256]; + for (i = 0; i < MAXSTAKENUM; i++) + { + if (CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i) == wincasinotype) + { + int j = 0; + for (j = 0; j < arraysizeof(casinomap); j++) + { + if (casinomap[j].casinotype == wincasinotype) + { +#ifdef _FIX_GAMBLENUM + // ԭּWIN + accumulation = accumulation + casinomap[j].accumulation * 2; +#else + accumulation += casinomap[j].accumulation; +#endif + CHAR_setWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i, 0); + break; + } + } + } + + else if (CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i) != 0) + { + int j = 0; + for (j = 0; j < arraysizeof(casinomap); j++) + { + if (casinomap[j].casinotype == CHAR_getWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i)) + { +#ifndef _FIX_GAMBLENUM + accumulation -= casinomap[j].accumulation; +#endif + CHAR_setWorkInt(charindex, CHAR_WORKSTAKETYPE1 + i, 0); + break; + } + } + } + } + CHAR_setWorkInt(charindex, CHAR_WORKSTAKEFLAG, 0); + if (accumulation < 0) + accumulation = 0; + else if (accumulation > MAXACCUMULATION) + accumulation = MAXACCUMULATION; + CHAR_setInt(charindex, CHAR_GAMBLENUM, accumulation); + snprintf(tmpbuf, sizeof(tmpbuf), "ܹ%4dֳ", accumulation); + CHAR_talkToCli(charindex, npcindex, tmpbuf, CHAR_COLORWHITE); + return 1; +} + +int CasinoPay(int npcindex, int wincasinotype) +{ + int npcfloor = CHAR_getInt(npcindex, CHAR_FLOOR); + int i = 0; + int playernum = CHAR_getPlayerMaxNum(); + if (wincasinotype < 0) return FALSE; + for (i = 0; i < playernum; i++) + { + if (CHAR_getCharUse(i) == FALSE) continue; + if (!CHAR_CHECKINDEX(i)) continue; + if (CHAR_getInt(i, CHAR_FLOOR) == npcfloor) + { + // ѯǷע + if (CHAR_getWorkInt(i, CHAR_WORKSTAKEFLAG) == 0) + continue; + // + CasinoAccumulation(i, npcindex, npcfloor, wincasinotype); + } + } + // ˲ȯ + for (i = 0; i < arraysizeof(casinomap); i++) + { + OBJECT object; + if (casinomap[i].casinofl != npcfloor) continue; + for (object = MAP_getTopObj(casinomap[i].casinofl, casinomap[i].casinox, + casinomap[i].casinoy); object; object = NEXT_OBJECT(object)) + { + int index = GET_OBJINDEX(object); + int objtype = OBJECT_getType(index); + int itemindex = OBJECT_getIndex( index); + if (objtype == OBJTYPE_NOUSE) continue; + else if (objtype == OBJTYPE_ITEM) + { + if(ITEM_getInt(itemindex, ITEM_ID) == CASINOTOKENID) + { + OBJECT_setIndex(index, 0); + CHAR_ObjectDelete(index); + } + } + } + casinomap[i].stakenum = 0; + } + return TRUE; +} +#endif + +#ifdef _PET_ITEM +void CHAR_sendPetItemData( int charaindex, int petid) +{ + int i; + char CHAR_statusSendBuffer[1024]; + int strlength = 2; + int petindex = CHAR_getCharPet( charaindex, petid); + int fd = getfdFromCharaIndex( charaindex ); + snprintf( CHAR_statusSendBuffer ,sizeof(CHAR_statusSendBuffer),"B%d" , petid); + for( i = 0 ; i < CHAR_MAXPETITEMHAVE ; i ++ ){ + char token[512]; + int itemindex; + itemindex = CHAR_getItemIndex( petindex, i ); + if( itemindex >= 0 ) { + snprintf( token ,sizeof(token),"%s|" ,ITEM_makeItemStatusString( -1, itemindex ) ); + }else { + snprintf( token ,sizeof(token),"%s|" , ITEM_makeItemFalseString() ); + } + strcpysafe( CHAR_statusSendBuffer + strlength, + sizeof(CHAR_statusSendBuffer) - strlength, token ); + strlength += strlen( token ); + if( strlength >= arraysizeof(CHAR_statusSendBuffer) ) lssproto_S_send(fd, CHAR_statusSendBuffer); + } + dchop( CHAR_statusSendBuffer , "|" ); + lssproto_S_send(fd, CHAR_statusSendBuffer); +} + +void CHAR_movePetItem( int charaindex, int petid, int fromindex, int toindex ) +{ + if( !CHAR_CHECKINDEX( charaindex ) )return; + if( CHAR_getFlg( charaindex,CHAR_ISDIE ) )return; + int petindex = CHAR_getCharPet( charaindex, petid); + char token[512]; + if(toindex == -1 && fromindex >= CHAR_EQUIPPLACENUM && fromindex < CHAR_MAXITEMHAVE){ + int itemindex = CHAR_getItemIndex( charaindex, fromindex ); + toindex=ITEM_getInt( itemindex, ITEM_TYPE)-ITEM_PET_HEAD; + }else if(toindex == -2){ + if(fromindex=0 && toindex< CHAR_MAXPETITEMHAVE){//toindex ǵ + //CHAR_talkToCli( charaindex, -1, "޷װƷ", CHAR_COLORWHITE ); + //return; + INT_petfesion = 28;// + } + //µģ + /* + int itemindexi;// + itemindexi = CHAR_getItemIndex( charaindex , toindex );//ȡװ + if(itemindexi >= 0){ + CHAR_talkToCli( charaindex, -1, "޷װƷ", CHAR_COLORWHITE ); + return; + }*/ + + } + //print("\nINT_petfesion %d = \n", INT_petfesion ); + allowpetitemtype = ITEM_getChar(itemindex,ITEM_PETEQUITALLOW);//װ + forbitpetitemtype= ITEM_getChar(itemindex,ITEM_PETEQUITFORBIT);//װ + //print("\allowpetitemtype len %d = \n", arraysizeof(allowpetitemtype) ); + //print("\forbitpetitemtype len %d = \n", arraysizeof(forbitpetitemtype) ); + { //װ + int tokenNo = 1 ; + char tokenBuf[3]; + BOOL ISCATFLG = FALSE; + BOOL UseFisrtTokenFlg = TRUE; + BOOL UseSecondTokenFlg = TRUE; + BOOL FindFisrtTokenFlg = FALSE; + + tokenNo = 1 ; + + if(!(atoi(allowpetitemtype)== 0 && atoi(forbitpetitemtype)== 0 ) ){ + while( getStringFromIndexWithDelim(allowpetitemtype," ",tokenNo,tokenBuf,sizeof(tokenBuf))){ + //print("\n tokenBuf %d = \n",atoi(tokenBuf)); + if(-1 == atoi(tokenBuf)) { + UseFisrtTokenFlg = FALSE; + break; + } + if(INT_petfesion == atoi(tokenBuf)) { + FindFisrtTokenFlg = TRUE; + break; + } + tokenNo++; + } + if(UseFisrtTokenFlg){//ʹ޶ + if(!FindFisrtTokenFlg){//ֿʹ + //if(!getStringFromIndexWithDelim(allowpetitemtype," ",tokenNo,tokenBuf,sizeof(tokenBuf))){ + CHAR_talkToCli( charaindex, -1, "޷װƷ", CHAR_COLORWHITE ); + return; + //} + } + }else{//ʹų + FindFisrtTokenFlg = FALSE; + tokenNo = 1; + while( getStringFromIndexWithDelim(forbitpetitemtype," ",tokenNo,tokenBuf,sizeof(tokenBuf))){ + if(-1 == atoi(tokenBuf)) { + UseSecondTokenFlg = FALSE; + break; + } + if(INT_petfesion == atoi(tokenBuf)) { + FindFisrtTokenFlg = TRUE; + break; + } + tokenNo++; + } + if(UseSecondTokenFlg){ + if(FindFisrtTokenFlg){//ֲʹ + CHAR_talkToCli( charaindex, -1, "޷װƷ3", CHAR_COLORWHITE ); + return; + } + } + } + } + } + } +#endif + if( (fromindex >=0 && fromindex < CHAR_PETITEMNUM && toindex >= CHAR_EQUIPPLACENUM && toindex < CHAR_MAXITEMHAVE) + || (toindex >=0 && toindex < CHAR_PETITEMNUM && fromindex >= CHAR_EQUIPPLACENUM && fromindex < CHAR_MAXITEMHAVE)){ + if(fromindex >= CHAR_EQUIPPLACENUM){ + int charitemindex = CHAR_getItemIndex( charaindex, fromindex ); + int petitemindex = CHAR_getItemIndex( petindex, toindex ); + int type=ITEM_getInt( charitemindex, ITEM_TYPE); + if(CHAR_getInt(petindex, CHAR_VARIABLEAI) < 100){ + CHAR_talkToCli( charaindex, -1, "޷ѵװƷ", CHAR_COLORRED ); + return; + } + if(typeITEM_PET_FEET || (type-ITEM_PET_HEAD) != toindex){ + CHAR_talkToCli( charaindex, -1, "޷װƷ", CHAR_COLORWHITE ); + return; + } + if( CHAR_getInt( petindex, CHAR_LV) < ITEM_getInt( charitemindex, ITEM_LEVEL)){ + CHAR_talkToCli( charaindex, -1, "ȼδװƷ", CHAR_COLORYELLOW ); + return; + } + if( ITEM_CHECKINDEX( petitemindex)){ + sprintf( token, "%s ж%s", CHAR_getChar( petindex, CHAR_NAME), ITEM_getChar( petitemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE ); + } + sprintf( token, "%s װ%s", CHAR_getChar( petindex, CHAR_NAME), ITEM_getChar( charitemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE ); + CHAR_setItemIndex( charaindex, fromindex, petitemindex ); + CHAR_setItemIndex( petindex, toindex, charitemindex ); + CHAR_sendItemDataOne( charaindex, fromindex); + CHAR_sendPetItemData( charaindex, petid); + }else{ + int charitemindex = CHAR_getItemIndex( charaindex, toindex ); + int petitemindex = CHAR_getItemIndex( petindex, fromindex ); + int type=ITEM_getInt( charitemindex, ITEM_TYPE); + sprintf( token, "%s ж%s", CHAR_getChar( petindex, CHAR_NAME), ITEM_getChar( petitemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE ); + if( ITEM_CHECKINDEX( charitemindex)){ + if(CHAR_getInt(petindex, CHAR_VARIABLEAI) < 100){ + CHAR_talkToCli( charaindex, -1, "޷ѵװƷ", CHAR_COLORRED ); + return; + } + if(typeITEM_PET_FEET || (type-ITEM_PET_HEAD) != toindex){ + CHAR_talkToCli( charaindex, -1, "޷װƷ", CHAR_COLORWHITE ); + return; + } + if( CHAR_getInt( petindex, CHAR_LV) < ITEM_getInt( charitemindex, ITEM_LEVEL)){ + CHAR_talkToCli( charaindex, -1, "ȼδװƷ", CHAR_COLORYELLOW ); + return; + } + sprintf( token, "%s װ%s", CHAR_getChar( petindex, CHAR_NAME), ITEM_getChar( charitemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE ); + } + CHAR_setItemIndex( charaindex, toindex, petitemindex ); + CHAR_setItemIndex( petindex, fromindex, charitemindex ); + CHAR_sendItemDataOne( charaindex, toindex); + CHAR_sendPetItemData( charaindex, petid); + } + } + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( charaindex, token ); +} + +void CHAR_sendPetItemEmpty( int charaindex, int petid) +{ + int fd = getfdFromCharaIndex( charaindex ); + char CHAR_statusSendBuffer[16]; + sprintf(CHAR_statusSendBuffer,"B%d|",petid); + lssproto_S_send(fd, CHAR_statusSendBuffer); +} + +#endif + +void CHAR_CheckItemTime( int charaindex ){ + int i; + for( i = 0 ; i < CHAR_MAXITEMHAVE ; i ++ ){ + int itemindex = CHAR_getItemIndex( charaindex, i ); + if( itemindex >= 0 ) { + int itemtime = 0; + itemtime = ITEM_getInt(itemindex,ITEM_TIME); + if(itemtime>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(itemtime<=timep){ + char itemname[128]; + sprintf(itemname,"ĵ:%sʱЧѵϵͳջء",ITEM_getChar(itemindex,ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, itemname, CHAR_COLORYELLOW ); + CHAR_setItemIndex( charaindex, i ,-1); + CHAR_sendItemDataOne( charaindex, i); + ITEM_endExistItemsOne(itemindex); + } + } + } + } +} + diff --git a/char/char_party.c b/char/char_party.c new file mode 100644 index 0000000..412426b --- /dev/null +++ b/char/char_party.c @@ -0,0 +1,735 @@ +#include "version.h" +#include + +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "battle.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "npc_bus.h" +#include "npc_airplane.h" // Arminius 7.10 Airplane +#include "family.h" // shan + +#ifdef _ITEM_QUITPARTY +#include "init.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +// shan add +extern struct FM_PKFLOOR fmpkflnum[FAMILY_FMPKFLOOR]; + +/*------------------------------------------------------------ + * ɡ ū ĩ + ------------------------------------------------------------*/ + +/*------------------------------------------------------------ + * лɡ ū ë + * ئľ-1ë߯ʣ + ------------------------------------------------------------*/ +int CHAR_getEmptyPartyArray( int charaindex) +{ + int i = -1; + int rc = FALSE; + int toindex; + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + toindex = charaindex; + } + else { + toindex = CHAR_getPartyIndex( charaindex, 0); + } + if( CHAR_CHECKINDEX( toindex)){ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + if( CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1) == -1 ) { + rc = TRUE; + break; + } + } + } + return( rc ? i: -1); +} + +int CHAR_getPartyNum( int charaindex) +{ + int i = -1; + int rc = FALSE; + int toindex; + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + return 1; + } + else { + toindex = CHAR_getPartyIndex( charaindex, 0); + } + if( CHAR_CHECKINDEX( toindex)){ + for( i = 1; i <= CHAR_PARTYMAX; i ++ ) { + if(i==CHAR_PARTYMAX) return i; + if( CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1) == -1 ) { + return i; + } + } + } + return i; +} +/*------------------------------------------------------------ + * ˱ɡ ū + * + * charaindex int + * targetindex int 켰 + ------------------------------------------------------------*/ +BOOL CHAR_JoinParty_Main( int charaindex, int targetindex) +{ + int firstflg = FALSE; + int i; + char c[3]; + char buf[64]; + int toindex; + int parray; + + /* ʻ¦ȽԻ */ + if( CHAR_getWorkInt( targetindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + toindex = targetindex; + } + else { + toindex = CHAR_getPartyIndex( targetindex, 0); + if( !CHAR_CHECKINDEX( toindex) ) { + print( " %s:%d err\n", __FILE__, __LINE__); + return; + } + } + +#ifdef _ALLBLUES_LUA_1_5 + if(FreePartyJoin(charaindex, toindex) == FALSE){ + return FALSE; + } +#endif + /* ɡ ūѷ */ + parray = CHAR_getEmptyPartyArray( toindex) ; + if( parray == -1 ) { + print( "%s : %d err\n", __FILE__,__LINE__); + return; + } + + //BUG + int pi; + for( pi = 0; pi < CHAR_PARTYMAX; pi ++ ) { + int index = CHAR_getWorkInt( toindex, pi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + if(index == charaindex) return; //BUG + } + } +#ifdef _WARNPC_CTRL + int mapi; + for(mapi=0;mapi<10;mapi++){ + int floorid = getPartyMap(mapi); + if(CHAR_getInt(charaindex,CHAR_FLOOR)==floorid){ + int sameipnum = getMapSameIp(mapi); + int partyi; + unsigned ip=CONNECT_get_userip(getfdFromCharaIndex(charaindex)); + unsigned teseip = ip; + unsigned toip; + int a, b, c, d,ipcnt=1; + char ipstr[32]; + a=(teseip % 0x100); teseip=teseip / 0x100; + b=(teseip % 0x100); teseip=teseip / 0x100; + c=(teseip % 0x100); teseip=teseip / 0x100; + d=(teseip % 0x100); + sprintf(ipstr,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ipstr,getNoAttIp(0))==0 || strcmp(ipstr,getNoAttIp(1))==0 || strcmp(ipstr,getNoAttIp(2))==0 || strcmp(ipstr,getNoAttIp(3))==0 || strcmp(ipstr,getNoAttIp(4))==0) + break; + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + toip=CONNECT_get_userip(getfdFromCharaIndex(toindex)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "˵ͼĵIPѴޣ޷롣", CHAR_COLORYELLOW); + return; + } + else + break; + } + break; + }else{ + for( partyi = 0; partyi < CHAR_PARTYMAX; partyi ++ ) { + int index = CHAR_getWorkInt( toindex, partyi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + toip = CONNECT_get_userip(getfdFromCharaIndex(index)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameipnum){ + CHAR_talkToCli( charaindex, -1, "˵ͼĵIPѴޣ޷롣", CHAR_COLORYELLOW); + return; + } + } + } + } + } + } + } +#endif +#ifdef _FLOOR_PARTY_CTRL + int mapj; + for(mapj=1;mapj<=5;mapj++){ + int floorid = getPartyFloor(mapj); + if(CHAR_getInt(charaindex,CHAR_FLOOR)==floorid){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int day=p->tm_wday; + int hour=p->tm_hour; + if(hour < 2) day = day - 1; + if(day>5 || day<1) day = 5; + int partyi,partycnt=1; + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + partycnt++; + if(partycnt>day){ + CHAR_talkToCli( charaindex, -1, "ͼѴޣһΪ1ˣܶΪ2ˣΪ3ˣΪ4ˣơ", CHAR_COLORYELLOW); + return; + } + else + break; + }else{ + for( partyi = 0; partyi < CHAR_PARTYMAX; partyi ++ ) { + int index = CHAR_getWorkInt( toindex, partyi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + partycnt++; + if(partycnt>day){ + CHAR_talkToCli( charaindex, -1, "ͼѴޣһΪ1ˣܶΪ2ˣΪ3ˣΪ4ˣơ", CHAR_COLORYELLOW); + return; + } + } + } + } + } + } +#endif + /* ʼݷʱئCAë˪ */ + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + CHAR_sendLeader( CHAR_getWorkInt( toindex, CHAR_WORKOBJINDEX), 1); + /* 켰ؼ̤徧 */ + /* ʱئ */ + CHAR_setWorkInt( toindex, CHAR_WORKPARTYMODE, 1); + CHAR_setWorkInt( toindex, CHAR_WORKPARTYINDEX1, toindex); + firstflg = TRUE; + } + CHAR_setWorkInt( toindex, parray + CHAR_WORKPARTYINDEX1, charaindex); + + CHAR_setWorkChar( charaindex, CHAR_WORKWALKARRAY, ""); + + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYMODE, CHAR_PARTY_CLIENT); + + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX1, toindex); + + if( firstflg ) { + CHAR_sendStatusString( toindex, "N0"); + } + + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + snprintf( c, sizeof(c), "N%d", i); + CHAR_sendStatusString( charaindex, c); + } + } + + snprintf( buf,sizeof( buf), "%s Ŷӣ", + CHAR_getChar( charaindex, CHAR_NAME)); + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + if( index != charaindex ) { + snprintf( c, sizeof(c), "N%d", parray); + CHAR_sendStatusString( index, c); + CHAR_talkToCli( index, -1, buf, CHAR_COLORYELLOW); + } + else { + CHAR_talkToCli( index, -1, "Ŷӣ", CHAR_COLORYELLOW); + } + } + } +} +/*------------------------------------------------------------ + * ɡ ū Ƿ£ + ------------------------------------------------------------*/ +BOOL CHAR_JoinParty( int charaindex ) +{ + + int result = -1; + int x,y; + OBJECT object; + int found = FALSE; + int fd; + int cnt; + int i; + + fd = getfdFromCharaIndex( charaindex ); + if( fd == -1 ) { + print( "%s : %d err\n", __FILE__, __LINE__); + return FALSE; + } + + /* лɡ ū׬ƥ */ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { + lssproto_PR_send( fd, 1, FALSE); + return FALSE; + } + + /* 󡼰 ë */ + CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) , + CHAR_getInt( charaindex , CHAR_X ), + CHAR_getInt( charaindex , CHAR_Y ) , + 1 , &x , &y ); + + /* */ + for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) { + CONNECT_setJoinpartycharaindex(fd,i,-1); + } + cnt = 0; + + /*м 󡼰ƽҷë */ + + for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int toindex; + int parray; + int objindex = GET_OBJINDEX(object); + int targetindex = -1; + + /* ƽҷԪئ */ + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue; + toindex = OBJECT_getIndex( objindex); + + // shan begin + if( CHAR_getInt(charaindex, CHAR_FMINDEX) > 0 && CHAR_getInt(toindex, CHAR_FMINDEX) >0){ + for( i = 0; i < FAMILY_FMPKFLOOR; i++){ + if( fmpkflnum[i].fl == CHAR_getInt( charaindex, CHAR_FLOOR) ) + if( CHAR_getInt(charaindex, CHAR_FMINDEX) != CHAR_getInt(toindex, CHAR_FMINDEX) ){ + lssproto_PR_send( fd, 1, FALSE); + return FALSE; + } + } + } + // shan end + + /* */ + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER || CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYERNPC){ + found = TRUE; + /* 컥ҷë¦ȽԻ */ + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { + targetindex = CHAR_getWorkInt( toindex, CHAR_WORKPARTYINDEX1); + if( !CHAR_CHECKINDEX( targetindex) ) { + print( " %s:%d err\n", __FILE__, __LINE__); + continue; + } + if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS) { + continue; + } + } + else { + targetindex = toindex; + } + + /* ڶ ¾ */ + if( NPC_Util_CharDistance( charaindex, targetindex ) > 1) { + continue; + } + + /* ƥئǣ*/ + if( CHAR_getWorkInt( targetindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){ + continue; + } + /* ޸ƹ */ + if( !CHAR_getFlg( targetindex, CHAR_ISPARTY) ) continue; + +#ifdef _ANGEL_SUMMON + if( CHAR_getWorkInt( targetindex, CHAR_WORKANGELMODE) == TRUE) { + CHAR_talkToCli( charaindex, -1, "ʹ߲Եӡ", CHAR_COLORYELLOW); + continue; + } +#endif + } + /* Ѩƹﵩݷ޷Ի£ */ + else if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) { + targetindex = toindex; + cnt = 0; + if( !NPC_BusCheckJoinParty( toindex, charaindex, TRUE)) { + /* ë ׽ئף ¼δ£޼ ئУ + * ֧֧мƥ + */ + break; + } + { // Arminius 7.10 Airplane + int busimg=CHAR_getInt(toindex, CHAR_BASEIMAGENUMBER); + if ((busimg!=100355) && (busimg!=100461)) { + CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER,busimg); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , + CHAR_WORKOBJINDEX )); + // Robin debug 01/11/21 + if( CHAR_getInt( charaindex, CHAR_RIDEPET) != -1 ) { + CHAR_setInt( charaindex, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET); + } + /* + CHAR_sendPMEToArroundCharacterFLXY(charaindex, + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + 0,1,CHAR_getInt( charaindex, CHAR_PETMAILEFFECT) + ); + */ + } + } + } + /* 跴Ѩƹﵩ½ */ + else { + continue; + } + + /* ɡ ūѷ */ + parray = CHAR_getEmptyPartyArray( targetindex) ; + if( parray == -1 ) continue; + + /* ƥľ */ + CONNECT_setJoinpartycharaindex( fd,cnt,toindex); + cnt++; + if( cnt == CONNECT_WINDOWBUFSIZE ) break; + + /* Ѩƹﵩ έƷУݻë £ */ + if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) break; + + } + + if( cnt == 0 ) { + if( found == TRUE) { + CHAR_talkToCli( charaindex, -1, "޷Ŷӡ", CHAR_COLORYELLOW); + } + result = FALSE; + }else if( cnt == 1 ) { +#ifdef _AUTO_PK + if(CHAR_getInt(charaindex,CHAR_FLOOR)==20000){ + CHAR_talkToCli( charaindex, -1, "Pϵͳֹ!", CHAR_COLORYELLOW); + result = FALSE; + }else +#endif + { + CHAR_JoinParty_Main( charaindex, CONNECT_getJoinpartycharaindex(fd,0)); + result = TRUE; + } + }else { + int strlength; + char msgbuf[1024]; + char escapebuf[2048]; + strcpy( msgbuf, "1\n˭Ŷأ\n"); + strlength = strlen( msgbuf); + for( i = 0; + CONNECT_getJoinpartycharaindex( fd,i ) != -1 + && i< CONNECT_WINDOWBUFSIZE; + i ++ ){ + char *a = CHAR_getChar( + CONNECT_getJoinpartycharaindex(fd,i) , CHAR_NAME); + char buf[256]; + snprintf( buf, sizeof( buf),"%s\n", a); + if( strlength + strlen( buf) > arraysizeof( msgbuf)){ + print( "%s:%dӴѶϢbuffer㡣\n", + __FILE__,__LINE__); + break; + } + strcpy( &msgbuf[strlength], buf); + strlength += strlen(buf); + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SELECTPARTY, + -1, + makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf))); + + + } + + if( result != -1 ) { + lssproto_PR_send( fd, 1, result); + } + + return result; +} + +static BOOL CHAR_DischargePartySub( int charaindex, int msgflg) +{ + char buf[64], c[3]; + int toindex,flg,i; +#ifdef _ITEM_QUITPARTY + int j = 0,k; +#endif + + + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + int pindex, airplaneflag=0; + // Arminius 7.10 Airplane + if( CHAR_getInt(charaindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) { + if ((CHAR_getInt(charaindex, CHAR_BASEIMAGENUMBER) !=100355) && + (CHAR_getInt(charaindex, CHAR_BASEIMAGENUMBER) !=100461)){ + airplaneflag=1; + } + } + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + pindex = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( pindex) ) { + int fd = getfdFromCharaIndex( pindex ); +#ifdef _PLAYER_NPC + if(CHAR_getInt( pindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYERNPC){ + CHAR_CharaDelete(pindex); + continue; + } +#endif + CHAR_setWorkInt( pindex, CHAR_WORKPARTYINDEX1, -1); + CHAR_setWorkInt( pindex, CHAR_WORKPARTYMODE, CHAR_PARTY_NONE); + if( msgflg ){ + CHAR_talkToCli( pindex, -1, "Ŷѽɢ", CHAR_COLORYELLOW); +#ifdef _ITEM_QUITPARTY + // won fix + for( j=0;j=0){ + int fl,x,y; + CHAR_getElderPosition( CHAR_getInt( charaindex, CHAR_LASTTALKELDER), + &fl, &x, &y ); + CHAR_warpToSpecificPoint(charaindex, fl, x, y); + } + } + } + } + CHAR_setWorkInt( charaindex, CHAR_WORKPARTYINDEX1, -1); + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( toindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index) ){ + if( index == charaindex) { + myarray = i; + break; + } + } + } + if( myarray == CHAR_PARTYMAX) { + print( "DischargeParty(): ֣"); + return FALSE; + } + CHAR_setWorkInt( toindex, CHAR_WORKPARTYINDEX1 + myarray, -1); + snprintf( buf,sizeof( buf), "%s Ŷӣ", + CHAR_getChar( charaindex, CHAR_NAME)); + if( msgflg ){ + CHAR_talkToCli( charaindex, -1, "Ŷӣ", CHAR_COLORYELLOW); +#ifdef _ITEM_QUITPARTY + // won fix + for( i=0;i 1) { + int parent_dir; + start.x = CHAR_getInt( index, CHAR_X); + start.y = CHAR_getInt( index, CHAR_Y); + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + end = start; + if( parent_dir != -1 ) { + CHAR_walk( index, parent_dir, 0); + } + } + previndex = index; + } + } + } + + } + + return TRUE; +} +BOOL CHAR_DischargeParty( int charaindex, int flg) +{ + return CHAR_DischargePartySub( charaindex, 1); +} + +BOOL CHAR_DischargePartyNoMsg( int charaindex) +{ + return CHAR_DischargePartySub( charaindex, 0); +} + + +/*------------------------------------------------------------ + * лĸë˪£ + ------------------------------------------------------------*/ +void CHAR_sendLeader( int objindex, int leader) +{ + int opt[1]; + opt[0] = leader; + CHAR_sendWatchEvent( objindex,CHAR_ACTLEADER,opt,1,TRUE); +} +/*------------------------------------------------------------ + * ë CHAR_WORKPARTYINDEX)϶ƥƽҷindexë¦Ƚ£ + * лƥֺƥ + ------------------------------------------------------------*/ +int CHAR_getPartyIndex( int index, int num) +{ + int nindex = -1; + + /* ޼̼͵ë */ + /* ʼ */ + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + nindex = CHAR_getWorkInt( index, CHAR_WORKPARTYINDEX1 + num ); + } + /* Ҽ */ + else { + int oyaindex = CHAR_getWorkInt( index, CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( oyaindex)) { + nindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1+num); + } + } + return nindex; +} +/*------------------------------------------------------------ + * ë˪£ + * ޻ľɹޱֶë˪£ + ------------------------------------------------------------*/ +void CHAR_talkToCliAndParty( int talkedcharaindex,int talkcharaindex, + char* message, CHAR_COLOR color ) +{ + int i; + /* ڷ */ + CHAR_talkToCli( talkedcharaindex, talkcharaindex, message, color); + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getPartyIndex( talkedcharaindex, i); + if( CHAR_CHECKINDEX( index) && + index != talkedcharaindex) + { + CHAR_talkToCli( index, talkcharaindex, message, color); + } + } +} + diff --git a/char/char_talk.c b/char/char_talk.c new file mode 100644 index 0000000..1d7582c --- /dev/null +++ b/char/char_talk.c @@ -0,0 +1,2278 @@ +#include "version.h" +#include +#include +#include +#include +#include +#include "handletime.h" +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "char_talk.h" +#include "chatmagic.h" +#include "battle.h" +#include "log.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "family.h" +#ifdef _CHAR_PROFESSION +#include "profession_skill.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#include "net.h" + + +extern int channelMember[FAMILY_MAXNUM][FAMILY_MAXCHANNEL][FAMILY_MAXMEMBER]; + +#ifdef _CHANNEL_MODIFY +int *piOccChannelMember = NULL; +#endif + +#ifdef _TALK_ACTION +void TalkAction(int charaindex, char *message); +#endif + +#ifdef _GM_ITEM +static BOOL player_useChatMagic( int charaindex, char* data, BOOL isDebug); +#endif +extern int playeronlinenum; +static int pojietype = 0; +/*------------------------------------------------------------ + * ĩ + ------------------------------------------------------------*/ +#define DEBUGCDKEYNUM 100 +struct tagDebugCDKey { + int use; + char cdkey[9]; +}; +static struct tagDebugCDKey DebugCDKey[DEBUGCDKEYNUM]; + +/*==================== ܷ====================*/ +typedef void (*CHATMAGICFUNC)(int,char*); +typedef struct tagCHAR_ChatMagicTable +{ + char* magicname; + CHATMAGICFUNC func; + BOOL isdebug; + int hash; + int level; + char* usestring; +}CHAR_ChatMagicTable; + +static CHAR_ChatMagicTable CHAR_cmtbl[]={ + //ʦר + { "programming_engineer", CHAR_CHAT_DEBUG_engineer, TRUE, 0, 3, ""}, + { "petlevelup", CHAR_CHAT_DEBUG_petlevelup, TRUE, 0, 2, " ȼ (˺)"}, + { "petexpup", CHAR_CHAT_DEBUG_petexpup, TRUE, 0, 2, " (˺)"}, + { "help", CHAR_CHAT_DEBUG_help, TRUE, 0, 1, "ָ/all"}, +#ifdef _EQUIT_NEGLECTGUARD + { "setneguard", CHAR_CHAT_DEBUG_setneguard, TRUE, 0, 3, "waei"}, +#endif + // + { "info", CHAR_CHAT_DEBUG_info, TRUE, 0, 1, "ֵ"}, + { "level", CHAR_CHAT_DEBUG_level, TRUE, 0, 2, "ֵ (˺)"}, + { "settrans", CHAR_CHAT_DEBUG_setTrans, TRUE, 0, 2, "ֵ (˺)"}, + { "exp", CHAR_CHAT_DEBUG_exp, TRUE, 0, 2, "ֵ (˺)"}, + { "hp", CHAR_CHAT_DEBUG_hp, TRUE, 0, 2, "ֵ (˺)"}, + { "mp", CHAR_CHAT_DEBUG_mp, TRUE, 0, 2, "ֵ (˺)"}, + { "setmp", CHAR_CHAT_DEBUG_setmp, TRUE, 0, 2, "ֵ (˺)"}, + { "str", CHAR_CHAT_DEBUG_str, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "dex", CHAR_CHAT_DEBUG_dex, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "tgh", CHAR_CHAT_DEBUG_tgh, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "vital", CHAR_CHAT_DEBUG_vital, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "luck", CHAR_CHAT_DEBUG_luck, TRUE, 0, 2, "ֵ (˺)"}, + { "superman", CHAR_CHAT_DEBUG_superman, TRUE, 0, 2, "(˺)"}, + { "dp", CHAR_CHAT_DEBUG_dp, TRUE, 0, 2, "ֵ (˺)"}, +#ifdef _EQUIT_ARRANGE + { "arrange", CHAR_CHAT_DEBUG_arrange, TRUE, 0, 3, "ֵ"}, +#endif + +#ifdef _EQUIT_SEQUENCE + { "sequence", CHAR_CHAT_DEBUG_sequence, TRUE, 0, 3, "ֵ"}, +#endif + + //ϵͳ + { "announce", CHAR_CHAT_DEBUG_announce, TRUE, 0, 1, ""}, + { "loginannounce", CHAR_CHAT_DEBUG_loginannounce, TRUE, 0, 1, ""}, + { "sysinfo", CHAR_CHAT_DEBUG_sysinfo, TRUE, 0, 1, ""}, + { "effect", CHAR_CHAT_DEBUG_effect, TRUE, 0, 1, "alloff/ͼ Ч"}, + { "reset", CHAR_CHAT_DEBUG_reset, TRUE, 0, 2, "enemy/encount/magic/warppoint/petskill/pettalk/npc/all"}, + { "clean_floor", CHAR_CHAT_DEBUG_cleanfloor, TRUE, 0, 3, "ͼ"}, + { "printcount", CHAR_CHAT_printcount, TRUE, 0, 1, ""}, + { "enemyrestart", CHAR_CHAT_DEBUG_enemyrestart, TRUE, 0, 3, ""}, + { "cleanfreepet", CHAR_CHAT_DEBUG_cleanfreepet, TRUE, 0, 3, ""}, + { "laba", CHAR_CHAT_DEBUG_laba, TRUE, 0, 1, ""}, // С + { "dalaba", CHAR_CHAT_DEBUG_dalaba, TRUE, 0, 1, ""}, +#ifdef _GMRELOAD + { "gmreload", CHAR_CHAT_DEBUG_gmreload, TRUE, 0, 3, "all/cdkey level"}, +#endif + + { "waeikickall", CHAR_CHAT_DEBUG_waeikickall, TRUE, 0, 3, "Сڵڵȼ"}, + { "checktrade", CHAR_CHAT_DEBUG_checktrade, TRUE, 0, 3, "waei"}, + // GM + { "debug", CHAR_CHAT_DEBUG_debug, TRUE, 0, 1, "on/off"}, + { "metamo", CHAR_CHAT_DEBUG_metamo, TRUE, 0, 1, "ͼ (˺)"}, + { "checklock", CHAR_CHAT_DEBUG_checklock, TRUE, 0, 1, "ʺ"}, + { "shutup", CHAR_CHAT_DEBUG_shutup, TRUE, 0, 1, "ʺ ON/OFF"}, +#ifdef _WAEI_KICK + { "gmkick", CHAR_CHAT_DEBUG_gmkick, TRUE, 0, 1, "ʺ LSLOCK/KICK/DEUNLOCK/UNLOCKALL/LOCK/TYPE/UNLOCK"}, +#endif + { "battlein", CHAR_CHAT_DEBUG_battlein, TRUE, 0, 1, ""}, + { "battleout", CHAR_CHAT_DEBUG_battleout, TRUE, 0, 1, ""}, + { "battlewatch", CHAR_CHAT_DEBUG_battlewatch, TRUE, 0, 1, ""}, + { "getuser", CHAR_CHAT_DEBUG_getuser, TRUE, 0, 1, " ͼ (npc)"}, + { "warp", CHAR_CHAT_DEBUG_warp, TRUE, 0, 1, "ͼ x y"}, + { "waeikick", CHAR_CHAT_DEBUG_waeikick, TRUE, 0, 1, "ʺ"}, + { "jail", CHAR_CHAT_DEBUG_jail, TRUE, 0, 1, "ʺ"}, + { "send", CHAR_CHAT_DEBUG_send, TRUE, 0, 1, "floor x y ʺ"}, +#ifdef _SendTo + { "sendto", CHAR_CHAT_DEBUG_Sendto, TRUE, 0, 1, "ʺ"}, +#endif + { "noenemy", CHAR_CHAT_DEBUG_noenemy, TRUE, 0, 1, "on/off"}, + { "watchevent", CHAR_CHAT_DEBUG_watchevent, TRUE, 0, 1, ""}, +#ifdef _SEND_EFFECT // WON ADD ACѩЧ + { "sendeffect", CHAR_CHAT_DEBUG_sendeffect, TRUE, 0, 1, ""}, +#endif + { "silent", CHAR_CHAT_DEBUG_silent, TRUE, 0, 2, "ʺ "},// + { "unlock", CHAR_CHAT_DEBUG_unlock, TRUE, 0, 2, "ʺ"}, + { "eventclean", CHAR_CHAT_DEBUG_eventclean, TRUE, 0, 2, "all/ ʺ "}, + { "eventsetend", CHAR_CHAT_DEBUG_eventsetend, TRUE, 0, 2, "all/ ʺ "}, + { "eventsetnow", CHAR_CHAT_DEBUG_eventsetnow, TRUE, 0, 2, "all/ ʺ "}, + + { "playerspread", CHAR_CHAT_DEBUG_playerspread, TRUE, 0, 3, "waei"}, + { "shutupall", CHAR_CHAT_DEBUG_shutupall, TRUE, 0, 3, ""}, + { "unlockserver", CHAR_CHAT_DEBUG_unlockserver, TRUE, 0, 3, ""}, + { "shutdown", CHAR_CHAT_DEBUG_shutdown, TRUE, 0, 3, "()"}, + + //Ƴ + { "delitem", CHAR_CHAT_DEBUG_delitem, TRUE, 0, 1, "all/λ"}, + { "delpet", CHAR_CHAT_DEBUG_deletepet, TRUE, 0, 1, "all/λ"}, + { "additem", CHAR_CHAT_DEBUG_additem, TRUE, 0, 2, "ID (() (˺))"}, + { "petmake", CHAR_CHAT_DEBUG_petmake, TRUE, 0, 2, "ID ((ȼ) (˺))"}, + { "gold", CHAR_CHAT_DEBUG_gold, TRUE, 0, 2, " (˺)"}, + + //幤 + { "manorpk", CHAR_CHAT_DEBUG_manorpk, TRUE, 0, 2, "allpeace/peace ׯ԰"}, + { "fixfmleader", CHAR_CHAT_DEBUG_fixfmleader, TRUE, 0, 2, "ʺ 1"}, + { "fixfmpk", CHAR_CHAT_DEBUG_fixfmpk, TRUE, 0, 3, ""}, + { "fixfmdata", CHAR_CHAT_DEBUG_fixfmdata, TRUE, 0, 2, ""}, + { "setfmpk", CHAR_CHAT_DEBUG_setfmpk, TRUE, 0, 3, ""}, + // + + +#ifdef _CHAR_POOLITEM + { "saveditem", CHAR_CHAT_DEBUG_saveditem, TRUE, 0, 3, ""}, + { "insertditem", CHAR_CHAT_DEBUG_insertditem, TRUE, 0, 3, ""}, + { "showdepot", CHAR_CHAT_DEBUG_ShowMyDepotItems, TRUE, 0, 3, ""}, + { "insidedepot", CHAR_CHAT_DEBUG_InSideMyDepotItems, TRUE, 0, 3, ""}, +#endif + +#ifdef _CHAR_POOLPET + { "savedpet", CHAR_CHAT_DEBUG_savedpet, TRUE, 0, 3, ""}, + { "insertdpet", CHAR_CHAT_DEBUG_insertdpet, TRUE, 0, 3, ""}, + { "showdepotpet", CHAR_CHAT_DEBUG_ShowMyDepotPets, TRUE, 0, 3, ""}, + { "insidedepotpet", CHAR_CHAT_DEBUG_InSideMyDepotPets, TRUE, 0, 3, ""}, +#endif + + +#ifdef _TEST_DROPITEMS + { "dropmypet", CHAR_CHAT_DEBUG_dropmypet, TRUE, 0, 3, ""}, + { "dropmyitem", CHAR_CHAT_DEBUG_dropmyitem, TRUE, 0, 2, "߱/(0/1)"}, +#endif +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + { "addsk", CHAR_CHAT_DEBUG_addsk, TRUE, 0, 2, ""}, + { "delsk", CHAR_CHAT_DEBUG_delsk, TRUE, 0, 2, ""}, +#endif + { "checktime", CHAR_CHAT_DEBUG_checktime, TRUE, 0, 3, ""}, + +#ifdef _GAMBLE_BANK + { "setgamblenum", CHAR_CHAT_DEBUG_setgamblenum, TRUE, 0, 3, "ֵ"}, +#endif + // WON ADD ָ + { "crash", CHAR_CHAT_DEBUG_crash, TRUE, 0, 3, ""}, +#ifdef _PETSKILL_SETDUCK + { "setDuck", CHAR_CHAT_DEBUG_SetDuck, TRUE, 0, 3, ""}, +#endif + +#ifdef _TYPE_TOXICATION + { "setTox", CHAR_CHAT_DEBUG_Toxication, TRUE, 0, 3, ""}, +#endif + { "showMem", CHAR_CHAT_DEBUG_showMem, TRUE, 0, 2, ""}, +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + { "profession", CHAR_CHAT_DEBUG_show_profession,TRUE, 0, 2, ""}, + { "set_regist", CHAR_CHAT_DEBUG_set_regist, TRUE, 0, 1, ""}, +#endif + { "samecode", CHAR_CHAT_DEBUG_samecode, TRUE, 0, 3, "pet/item/set "}, + +#ifdef _NEW_MANOR_LAW + // 趨 + { "set_momentum",CHAR_CHAT_DEBUG_set_momentum,TRUE,0,2," ֵ"}, + // 趨ӵׯ԰ + { "set_manor_owner",CHAR_CHAT_DEBUG_set_manor_owner,TRUE,0,2,"ׯ԰ID 0/1 ID"}, + // 趨ׯ԰սʱ,趨ʱΪĿǰÿսʱڵľʱ(λ:),ex:ս,ҪŻ + // ս,ָ趨Ϊ 5 ,ĵȴڱֻ + { "set_schedule_time",CHAR_CHAT_DEBUG_set_schedule_time,TRUE,0,2,"ʱ ׯ԰ID "}, +#endif + +#ifdef _ANGEL_SUMMON + { "angelinfo", CHAR_CHAT_DEBUG_angelinfo, TRUE, 0, 2, ""}, + { "angelclean", CHAR_CHAT_DEBUG_angelclean, TRUE, 0, 2, ""}, + { "angelcreate", CHAR_CHAT_DEBUG_angelcreate, TRUE, 0, 2, ""}, + { "missionreload", CHAR_CHAT_DEBUG_missionreload, TRUE, 0, 2, ""}, +#endif + + { "itemreload", CHAR_CHAT_DEBUG_itemreload, TRUE, 0, 2, ""}, + + { "skywalker", CHAR_CHAT_DEBUG_skywalker, TRUE, 0, 1, ""}, +#ifdef _ITEM_ADDEXP + { "itemaddexp", CHAR_CHAT_DEBUG_itemaddexp, TRUE, 0, 1, ""}, +#endif + +#ifdef _DEF_GETYOU + { "getyou", CHAR_CHAT_DEBUG_getyou, TRUE, 0, 1, " 1~3"}, +#endif +#ifdef _DEF_NEWSEND + { "newsend", CHAR_CHAT_DEBUG_newsend, TRUE, 0, 1, "floor x y ʺ /Ҫ˵Ļ"}, +#endif +#ifdef _DEF_SUPERSEND + { "supersend", CHAR_CHAT_DEBUG_supersend, TRUE, 0, 3, "floor x y /Ҫ˵Ļ"}, +#endif +#ifdef _FONT_SIZE + { "fsize", CHAR_CHAT_DEBUG_fsize, TRUE, 0, 1, "ֺ"}, +#endif +#ifdef _JOBDAILY + { "rejobdaily", CHAR_CHAT_DEBUG_rejobdaily, TRUE, 0, 3, ""}, +#endif +#ifdef _CREATE_MM_1_2 + { "MM", CHAR_CHAT_DEBUG_MM, TRUE, 0, 3, "MM 1/2 (˺)"}, +#endif +//#ifdef _GM_ITEM +// { "gmfunction", CHAR_CHAT_DEBUG_GMFUNCTION, TRUE, 0, 3, " (˺)"}, +//#endif + +#ifdef _GM_RIDE + { "setride", CHAR_CHAT_DEBUG_SETRIDE, TRUE, 0, 3, " (˺)"}, + { "mvride", CHAR_CHAT_DEBUG_MVRIDE, TRUE, 0, 3, " (˺)"}, +#endif + +#ifdef _LOCK_IP + { "addlock", CHAR_CHAT_DEBUG_ADD_LOCK, TRUE, 0, 3, "flag ˺/IP IP"}, + { "dellock", CHAR_CHAT_DEBUG_DEL_LOCK, TRUE, 0, 3, "flag ˺/IP IP"}, + { "showip", CHAR_CHAT_DEBUG_SHOWIP, TRUE, 0, 3, "˺"}, +#endif + { "setfame", CHAR_CHAT_DEBUG_SET_FAME, TRUE, 0, 3, "˺ ֵ"}, + +#ifdef _AUTO_PK + { "pktime", CHAR_CHAT_DEBUG_SET_AUTOPK, TRUE, 0, 3, ""}, +#endif + +#ifdef _PLAYER_NUM + { "playernum", CHAR_CHAT_DEBUG_SET_PLAYERNUM, TRUE, 0, 3, ""}, +#endif + +#ifdef _RELOAD_CF + { "reloadcf", CHAR_CHAT_DEBUG_SET_RELOADCF, TRUE, 0, 3, ""}, +#endif +#ifdef _JZ_NEWSCRIPT_LUA + { "luainit", CHAR_CHAT_DEBUG_LUA_INIT, TRUE, 0, 3, "LUAλ"}, + { "luaclose", CHAR_CHAT_DEBUG_LUA_CLOSE, TRUE, 0, 3, ""}, +#endif +#ifdef _TRANS + { "trans", CHAR_CHAT_DEBUG_Trans, TRUE, 0, 3, "(˺)"}, +#endif +#ifdef _FUSIONBEIT_FIX + { "fusionbeit", CHAR_CHAT_DEBUG_fusionbeit, TRUE, 0, 3, " (˺)"}, +#endif +#ifdef _MAKE_PET_CF + { "petmakecf", CHAR_CHAT_DEBUG_petmakecf, TRUE, 0, 3, " ת/ȼ/ɳ"}, +#endif +#ifdef _MAKE_PET_ABILITY + { "petmakeabi", CHAR_CHAT_DEBUG_petmakeabi, TRUE, 0, 3, " Ѫ "}, +#endif + { "zynetwork", CHAR_CHAT_DEBUG_zynetwork, TRUE, 0, 3, ""}, +#ifdef _ALL_ITEM + { "setallnum", CHAR_CHAT_DEBUG_setallnum, TRUE, 0, 3, ""}, +#endif +#ifdef _MAKE_MAP + { "delmap", CHAR_CHAT_DelMap, TRUE, 0, 3, ""}, + { "getmap", CHAR_CHAT_GetMap, TRUE, 0, 3, ""}, + { "map", CHAR_CHAT_Map, TRUE, 0, 3, ""}, + { "tile", CHAR_CHAT_Fixtile, TRUE, 0, 3, ""}, + { "obj", CHAR_CHAT_Fixobj, TRUE, 0, 3, ""}, + { "fenghao", CHAR_CHAT_FengHao, TRUE, 0, 3, ""}, + { "ɾͼ", CHAR_CHAT_GetMap, TRUE, 0, 3, ""}, + { "ȡͼ", CHAR_CHAT_GetMap, TRUE, 0, 3, ""}, + { "ͼƬ", CHAR_CHAT_Map, TRUE, 0, 3, ""}, + { "ͼƬ", CHAR_CHAT_Fixtile, TRUE, 0, 3, ""}, + { "", CHAR_CHAT_Fixobj, TRUE, 0, 3, ""}, +// { "fukuwa", CHAR_CHAT_Fukuwa, TRUE, 0, 3, ""}, +#endif +#ifdef _UNTEXT_TALK + { "untextreload", CHAR_CHAT_UnTextReload, TRUE, 0, 3, ""}, +#endif +#ifdef _NO_FULLPLAYER_ATT + { "nofullplayer", CHAR_CHAT_NoFullPlayer, TRUE, 0, 3, ""}, +#endif + { "delfm", CHAR_CHAT_DelFm, TRUE, 0, 3, " "}, + { "expbase", CHAR_CHAT_ExpBase, TRUE, 0, 3, "鱶"}, + { "jilu", CHAR_CHAT_DEBUG_jilu, TRUE, 0, 3, "¼"}, + { "mmcdkey", CHAR_CHAT_DEBUG_MMCDKEY, TRUE, 0, 3, "ʾιMM¼"}, + { "reloadride", CHAR_CHAT_DEBUG_RELOADRIDE, TRUE, 0, 3, "ضRIDEļ"}, +#ifdef _FIX_TRADE_COPYPET + { "cleancopypet", CHAR_CHAT_DEBUG_CLEANCOPYPET, TRUE, 0, 3, "Ƴ"}, + { "Ƴ", CHAR_CHAT_DEBUG_CLEANCOPYPET, TRUE, 0, 3, "Ƴ"}, +#endif + +///////////////////////////////////////////////////////////////////////// + //ʦר +// { "programming_engineer", CHAR_CHAT_DEBUG_engineer, TRUE, 0, 3, ""}, + { "ȼ", CHAR_CHAT_DEBUG_petlevelup, TRUE, 0, 2, " ȼ (˺)"}, + { "ᆳ", CHAR_CHAT_DEBUG_petexpup, TRUE, 0, 2, " (˺)"}, + { "", CHAR_CHAT_DEBUG_help, TRUE, 0, 1, "ָ/all"}, +#ifdef _EQUIT_NEGLECTGUARD +// { "setneguard", CHAR_CHAT_DEBUG_setneguard, TRUE, 0, 3, "waei"}, +#endif + // + { "Ϣ", CHAR_CHAT_DEBUG_info, TRUE, 0, 1, "ֵ"}, + { "ȼ", CHAR_CHAT_DEBUG_level, TRUE, 0, 2, "ֵ (˺)"}, + { "ת", CHAR_CHAT_DEBUG_setTrans, TRUE, 0, 2, "ֵ (˺)"}, + { "", CHAR_CHAT_DEBUG_exp, TRUE, 0, 2, "ֵ (˺)"}, + { "Ѫ", CHAR_CHAT_DEBUG_hp, TRUE, 0, 2, "ֵ (˺)"}, + { "ħ", CHAR_CHAT_DEBUG_mp, TRUE, 0, 2, "ֵ (˺)"}, + { "ħ", CHAR_CHAT_DEBUG_setmp, TRUE, 0, 2, "ֵ (˺)"}, + { "", CHAR_CHAT_DEBUG_str, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "", CHAR_CHAT_DEBUG_dex, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "", CHAR_CHAT_DEBUG_tgh, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "", CHAR_CHAT_DEBUG_vital, TRUE, 0, 2, "ֵ*100 (˺)"}, + { "", CHAR_CHAT_DEBUG_luck, TRUE, 0, 2, "ֵ (˺)"}, + { "", CHAR_CHAT_DEBUG_superman, TRUE, 0, 2, "(˺)"}, + { "dp", CHAR_CHAT_DEBUG_dp, TRUE, 0, 2, "ֵ (˺)"}, +#ifdef _EQUIT_ARRANGE + { "", CHAR_CHAT_DEBUG_arrange, TRUE, 0, 3, "ֵ"}, +#endif + +#ifdef _EQUIT_SEQUENCE + { "˳", CHAR_CHAT_DEBUG_sequence, TRUE, 0, 3, "ֵ"}, +#endif + + //ϵͳ + { "", CHAR_CHAT_DEBUG_announce, TRUE, 0, 1, ""}, + { "½", CHAR_CHAT_DEBUG_loginannounce, TRUE, 0, 1, ""}, + { "ϵͳϢ", CHAR_CHAT_DEBUG_sysinfo, TRUE, 0, 1, ""}, + { "ͼЧ", CHAR_CHAT_DEBUG_effect, TRUE, 0, 1, "alloff/ͼ Ч"}, + { "ض", CHAR_CHAT_DEBUG_reset, TRUE, 0, 2, "enemy/encount/magic/warppoint/petskill/pettalk/npc/all"}, + { "ͼƷ", CHAR_CHAT_DEBUG_cleanfloor, TRUE, 0, 3, "ͼ"}, + { "ͳ", CHAR_CHAT_printcount, TRUE, 0, 1, ""}, + { "ض", CHAR_CHAT_DEBUG_enemyrestart, TRUE, 0, 3, ""}, + { "ϳ", CHAR_CHAT_DEBUG_cleanfreepet, TRUE, 0, 3, ""}, + { "С", CHAR_CHAT_DEBUG_laba, TRUE, 0, 1, ""}, // С + { "", CHAR_CHAT_DEBUG_dalaba, TRUE, 0, 3, ""}, +#ifdef _GMRELOAD + { "ȡGM", CHAR_CHAT_DEBUG_gmreload, TRUE, 0, 3, "all/cdkey level"}, +#endif + + { "߳", CHAR_CHAT_DEBUG_waeikickall, TRUE, 0, 3, ""}, +// { "checktrade", CHAR_CHAT_DEBUG_checktrade, TRUE, 0, 3, "waei"}, + // GM + { "", CHAR_CHAT_DEBUG_debug, TRUE, 0, 1, " on/off"}, + { "", CHAR_CHAT_DEBUG_metamo, TRUE, 0, 1, "ͼ (˺)"}, + { "ʺ", CHAR_CHAT_DEBUG_checklock, TRUE, 0, 1, "ʺ"}, + { "", CHAR_CHAT_DEBUG_shutup, TRUE, 0, 1, "ʺ ON/OFF"}, +#ifdef _WAEI_KICK + { "gm", CHAR_CHAT_DEBUG_gmkick, TRUE, 0, 1, "ʺ LSLOCK/KICK/DEUNLOCK/UNLOCKALL/LOCK/TYPE/UNLOCK"}, +#endif + { "ս", CHAR_CHAT_DEBUG_battlein, TRUE, 0, 1, ""}, + { "ս", CHAR_CHAT_DEBUG_battleout, TRUE, 0, 1, ""}, + { "ս", CHAR_CHAT_DEBUG_battlewatch, TRUE, 0, 1, ""}, + { "ʾϢ", CHAR_CHAT_DEBUG_getuser, TRUE, 0, 1, " ͼ (npc)"}, + { "Լ", CHAR_CHAT_DEBUG_warp, TRUE, 0, 1, "ͼ x y"}, + { "߳", CHAR_CHAT_DEBUG_waeikick, TRUE, 0, 1, "ʺ"}, + { "", CHAR_CHAT_DEBUG_jail, TRUE, 0, 1, "ʺ"}, + { "", CHAR_CHAT_DEBUG_send, TRUE, 0, 1, "ͼ x y ʺ"}, +#ifdef _SendTo + { "͵", CHAR_CHAT_DEBUG_Sendto, TRUE, 0, 1, "ʺ"}, +#endif + { "", CHAR_CHAT_DEBUG_noenemy, TRUE, 0, 1, "on/off"}, + { "ʾ", CHAR_CHAT_DEBUG_watchevent, TRUE, 0, 1, ""}, +#ifdef _SEND_EFFECT // WON ADD ACѩЧ + { "Ч", CHAR_CHAT_DEBUG_sendeffect, TRUE, 0, 1, ""}, +#endif + { "", CHAR_CHAT_DEBUG_silent, TRUE, 0, 2, "ʺ "},// + { "", CHAR_CHAT_DEBUG_unlock, TRUE, 0, 2, "ʺ"}, + { "", CHAR_CHAT_DEBUG_eventclean, TRUE, 0, 2, "all/ ʺ "}, + { "", CHAR_CHAT_DEBUG_eventsetend, TRUE, 0, 2, "all/ ʺ "}, + { "", CHAR_CHAT_DEBUG_eventsetnow, TRUE, 0, 2, "all/ ʺ "}, + + { "ʾ", CHAR_CHAT_DEBUG_playerspread, TRUE, 0, 3, "waei"}, +// { "shutupall", CHAR_CHAT_DEBUG_shutupall, TRUE, 0, 3, ""}, + { "", CHAR_CHAT_DEBUG_unlockserver, TRUE, 0, 3, ""}, + { "ط", CHAR_CHAT_DEBUG_shutdown, TRUE, 0, 3, ""}, + + //Ƴ + { "ɾƷ", CHAR_CHAT_DEBUG_delitem, TRUE, 0, 1, "all/λ"}, + { "ɾ", CHAR_CHAT_DEBUG_deletepet, TRUE, 0, 1, "all/λ"}, + { "Ʒ", CHAR_CHAT_DEBUG_additem, TRUE, 0, 2, "ID (() (˺))"}, + { "", CHAR_CHAT_DEBUG_petmake, TRUE, 0, 2, "ID ((ȼ) (˺))"}, + { "Ǯ", CHAR_CHAT_DEBUG_gold, TRUE, 0, 2, " (˺)"}, + + //幤 +// { "manorpk", CHAR_CHAT_DEBUG_manorpk, TRUE, 0, 2, "allpeace/peace ׯ԰"}, + { "޸峤", CHAR_CHAT_DEBUG_fixfmleader, TRUE, 0, 2, "ʺ 1"}, + { "޸PK", CHAR_CHAT_DEBUG_fixfmpk, TRUE, 0, 3, ""}, + { "޸", CHAR_CHAT_DEBUG_fixfmdata, TRUE, 0, 2, ""}, + + // + + +#ifdef _CHAR_POOLITEM + { "Ʒ", CHAR_CHAT_DEBUG_saveditem, TRUE, 0, 3, ""}, + { "Ʒ", CHAR_CHAT_DEBUG_insertditem, TRUE, 0, 3, ""}, + { "ʾֿĿ", CHAR_CHAT_DEBUG_ShowMyDepotItems, TRUE, 0, 3, ""}, + { "ֿĿ", CHAR_CHAT_DEBUG_InSideMyDepotItems, TRUE, 0, 3, ""}, +#endif + +#ifdef _CHAR_POOLPET + { "", CHAR_CHAT_DEBUG_savedpet, TRUE, 0, 3, ""}, + { "", CHAR_CHAT_DEBUG_insertdpet, TRUE, 0, 3, ""}, + { "ʾֿ", CHAR_CHAT_DEBUG_ShowMyDepotPets, TRUE, 0, 3, ""}, + { "insidedepotpet", CHAR_CHAT_DEBUG_InSideMyDepotPets, TRUE, 0, 3, ""}, +#endif + + +#ifdef _TEST_DROPITEMS + { "س", CHAR_CHAT_DEBUG_dropmypet, TRUE, 0, 3, ""}, + { "Ʒ", CHAR_CHAT_DEBUG_dropmyitem, TRUE, 0, 3, "߱/(0/1)"}, +#endif +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + { "Ӽ", CHAR_CHAT_DEBUG_addsk, TRUE, 0, 2, ""}, + { "ɾ", CHAR_CHAT_DEBUG_delsk, TRUE, 0, 2, ""}, +#endif + { "ʾʱ", CHAR_CHAT_DEBUG_checktime, TRUE, 0, 3, ""}, + +#ifdef _GAMBLE_BANK + { "", CHAR_CHAT_DEBUG_setgamblenum, TRUE, 0, 3, "ֵ"}, +#endif + // WON ADD ָ + { "", CHAR_CHAT_DEBUG_crash, TRUE, 0, 3, ""}, +#ifdef _PETSKILL_SETDUCK +// { "setDuck", CHAR_CHAT_DEBUG_SetDuck, TRUE, 0, 3, ""}, +#endif + +#ifdef _TYPE_TOXICATION + { "ж", CHAR_CHAT_DEBUG_Toxication, TRUE, 0, 3, ""}, +#endif + { "ʾڴ", CHAR_CHAT_DEBUG_showMem, TRUE, 0, 2, ""}, +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + { "ְҵ", CHAR_CHAT_DEBUG_show_profession,TRUE, 0, 2, "restart/0/1 ְҵ ȼ"}, + { "", CHAR_CHAT_DEBUG_set_regist, TRUE, 0, 1, ""}, +#endif + { "", CHAR_CHAT_DEBUG_samecode, TRUE, 0, 3, "pet/item/set "}, + +#ifdef _NEW_MANOR_LAW + // 趨 + { "",CHAR_CHAT_DEBUG_set_momentum,TRUE,0,2,"[ <> <ֵ>]"}, + // 趨ӵׯ԰ + { "ׯ԰",CHAR_CHAT_DEBUG_set_manor_owner,TRUE,0,2,"[ׯ԰ <ׯ԰id> <0 or 1> < or ID>]"}, + // 趨ׯ԰սʱ,趨ʱΪĿǰÿսʱڵľʱ(λ:),ex:ս,ҪŻ + // ս,ָ趨Ϊ 5 ,ĵȴڱֻ + { "ׯ԰սʱ",CHAR_CHAT_DEBUG_set_schedule_time,TRUE,0,2,"[set_schedule_time ]"}, +#endif + +#ifdef _ANGEL_SUMMON + { "ٻ", CHAR_CHAT_DEBUG_angelinfo, TRUE, 0, 2, ""}, + { "ٻ", CHAR_CHAT_DEBUG_angelclean, TRUE, 0, 2, ""}, + { "ٻ", CHAR_CHAT_DEBUG_angelcreate, TRUE, 0, 2, "ʹ˺ ˺ "}, + { "ضʹ", CHAR_CHAT_DEBUG_missionreload, TRUE, 0, 2, ""}, +#endif + + { "ȡƷ", CHAR_CHAT_DEBUG_itemreload, TRUE, 0, 2, ""}, + + { "", CHAR_CHAT_DEBUG_skywalker, TRUE, 0, 1, ""}, +#ifdef _ITEM_ADDEXP + { "ȡƷ", CHAR_CHAT_DEBUG_itemaddexp, TRUE, 0, 1, ""}, +#endif +#ifdef _DEF_GETYOU + { "ȡ˺", CHAR_CHAT_DEBUG_getyou, TRUE, 0, 1, " 1~3"}, +#endif +#ifdef _DEF_NEWSEND + { "", CHAR_CHAT_DEBUG_newsend, TRUE, 0, 1, "ͼ x y ʺ /Ҫ˵Ļ"}, +#endif +#ifdef _DEF_SUPERSEND + { "Ⱥ崫", CHAR_CHAT_DEBUG_supersend, TRUE, 0, 3, "ͼ x y /Ҫ˵Ļ"}, +#endif +#ifdef _FONT_SIZE + { "С", CHAR_CHAT_DEBUG_fsize, TRUE, 0, 1, "ֺ"}, +#endif +#ifdef _JOBDAILY + { "־", CHAR_CHAT_DEBUG_rejobdaily, TRUE, 0, 3, ""}, +#endif +//#ifdef _GM_ITEM +// { "Ȩ", CHAR_CHAT_DEBUG_GMFUNCTION, TRUE, 0, 3, " (˺)"}, +//#endif + +#ifdef _GM_RIDE + { "", CHAR_CHAT_DEBUG_SETRIDE, TRUE, 0, 3, " (˺)"}, + { "Ƴ", CHAR_CHAT_DEBUG_MVRIDE, TRUE, 0, 3, " (˺)"}, +#endif + +#ifdef _LOCK_IP + { "", CHAR_CHAT_DEBUG_ADD_LOCK, TRUE, 0, 3, "flag ˺/IP IP"}, + { "", CHAR_CHAT_DEBUG_DEL_LOCK, TRUE, 0, 3, "flag ˺/IP IP"}, + { "ʾIP", CHAR_CHAT_DEBUG_SHOWIP, TRUE, 0, 3, "˺"}, +#endif + { "", CHAR_CHAT_DEBUG_SET_FAME, TRUE, 0, 3, "˺ ֵ"}, +#ifdef _AUTO_PK + { "pkʱ", CHAR_CHAT_DEBUG_SET_AUTOPK, TRUE, 0, 3, ""}, +#endif + +#ifdef _PLAYER_NUM + { "", CHAR_CHAT_DEBUG_SET_PLAYERNUM, TRUE, 0, 3, ""}, +#endif +#ifdef _RELOAD_CF + { "ȡ", CHAR_CHAT_DEBUG_SET_RELOADCF, TRUE, 0, 3, ""}, +#endif +#ifdef _TRANS + { "߼ת", CHAR_CHAT_DEBUG_Trans, TRUE, 0, 3, "(˺)"}, +#endif +#ifdef _FUSIONBEIT_FIX + { "ںϳ", CHAR_CHAT_DEBUG_fusionbeit, TRUE, 0, 3, " (˺)"}, +#endif +#ifdef _MAKE_PET_CF + { "ɳ", CHAR_CHAT_DEBUG_petmakecf, TRUE, 0, 3, " ת/ȼ/ɳ"}, +#endif +#ifdef _ALLBLUES_LUA + { "reloadlua", CHAR_CHAT_DEBUG_ReLoadLua, TRUE, 0, 3, "" }, + { "newloadlua", CHAR_CHAT_DEBUG_NewLoadLua, TRUE, 0, 3, "" }, +#endif +#ifdef _CARD_PRODUCTION + { "card", CHAR_CHAT_DEBUG_card, TRUE, 0, 3, "㿨 /"}, +#endif +#ifdef _CAX_GM_RERIDE + { "reride", CHAR_CHAT_DEBUG_reride, TRUE, 0, 3, ""}, +#endif +#ifdef _CAX_GM_RESKILLCODE + { "reskillcode", CHAR_CHAT_DEBUG_reskillcode, TRUE, 0, 3, ""}, +#endif +#ifdef _CAX_GM_RELEADERRIDE + { "rereleaderride", CHAR_CHAT_DEBUG_releaderride, TRUE, 0, 3, ""}, +#endif +#ifdef _GM_SAVE_ALL_CHAR + { "GmSaveAllChar", CHAR_CHAT_DEBUG_GmSaveAllChar, TRUE, 0, 3, "" }, +#endif +}; + +void CHAR_initDebugChatCdkey( void) +{ + int i; + for( i = 0; i < DEBUGCDKEYNUM; i ++ ) { + DebugCDKey[i].use = FALSE; + DebugCDKey[i].cdkey[0] = '\0'; + } +} +/*------------------------------------------------------------ + * ܷ˦بë£ + * ¦ѣ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_initChatMagic(void) +{ + int i; + for( i=0 ; i 8 ) { + return -1; + } + for( i = 0; i < DEBUGCDKEYNUM; i ++ ) { + if( DebugCDKey[i].use == FALSE) { + if( mode == 0 ) { + DebugCDKey[i].use = TRUE; + strcpysafe( DebugCDKey[i].cdkey, sizeof( DebugCDKey[i].cdkey), cdkey); + found = TRUE; + break; + } + } + else { + if( mode == 1 ) { + if( strcmp( DebugCDKey[i].cdkey, cdkey) == 0 ) { + DebugCDKey[i].use = FALSE; + DebugCDKey[i].cdkey[0] = '\0'; + found = TRUE; + } + } + } + + } + if( !found ) return -1; + return i; +} + +static CHATMAGICFUNC CHAR_getChatMagicFuncPointer(char* name, BOOL isDebug) +{ + int i; + int hash = hashpjw( name ); + for( i=0 ; i= arraysizeof( CHAR_cmtbl) ) return -1; + if( CHAR_cmtbl[ ti].isdebug == isDebug && + CHAR_cmtbl[ ti].level <= level ){ + sprintf( name,"%s", CHAR_cmtbl[ ti].magicname ); + sprintf( usestring, "%s", CHAR_cmtbl[ ti].usestring ); + return 1; + } + return 0; +} + +int CHAR_getChatMagicFuncMaxNum( void) +{ + return arraysizeof( CHAR_cmtbl); +} + +#ifdef _ALLBLUES_LUA_1_2 +MAGIC_LuaFunc MAGIC_luaFunc; + +BOOL MAGIC_addLUAListFunction(lua_State *L, const char *luafuncname, const char *luafunctable, int gmlevel, char *usestring ) +{ + MAGIC_LuaFunc *luaFunc = &MAGIC_luaFunc; + + while(luaFunc->next != NULL){ + luaFunc = luaFunc->next; + } + + memset( luaFunc, 0 , sizeof(MAGIC_luaFunc) ); + luaFunc->lua = L; + luaFunc->luafuncname = allocateMemory( strlen(luafuncname) ); + strcpy(luaFunc->luafuncname, luafuncname); + luaFunc->luafunctable = allocateMemory( strlen(luafunctable) ); + strcpy(luaFunc->luafunctable, luafunctable); + luaFunc->usestring = allocateMemory( strlen(usestring) ); + strcpy(luaFunc->usestring, usestring); + + luaFunc->gmlevel = gmlevel; + + luaFunc->next = allocateMemory( sizeof(MAGIC_luaFunc) ); + memset( luaFunc->next, 0 , sizeof(MAGIC_luaFunc) ); + if(luaFunc->next == NULL)return FALSE; + luaFunc = luaFunc->next; + luaFunc->next=NULL; + + return TRUE; +} + +BOOL MAGIC_getLUAListFunction( char *luafuncname, int gmlevel, int charaindex, char *data ) +{ + MAGIC_LuaFunc *luaFunc = &MAGIC_luaFunc; + + while(luaFunc->next != NULL){ + if(strcmp(luaFunc->luafuncname, luafuncname) == 0){ + if( gmlevel >= luaFunc->gmlevel ){ + lua_getglobal( luaFunc->lua, luaFunc->luafunctable); + return RunUseChatMagic(charaindex, data, luaFunc->lua); + }else{ + return FALSE; + } + } + luaFunc = luaFunc->next; + } + return FALSE; +} +#endif + +/*------------------------------------------------------------ + * ܷ + * ¦ + * charaindex int ƽҷ̼͵ + * message char* + * isDebug BOOL ܷ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +static BOOL CHAR_useChatMagic( int charaindex, char* data, BOOL isDebug) +{ + char magicname[256]; + int ret; + int i; + int gmLevel = 0, magicLevel; + + CHATMAGICFUNC func; + +#ifdef _GMRELOAD + extern struct GMINFO gminfo[GMMAXNUM]; +#else +#endif + char *p = CHAR_getChar( charaindex, CHAR_CDKEY); + if( !p ) { + fprint( "err nothing cdkey\n"); + return FALSE; + } + + if( getChatMagicCDKeyCheck() == 1 ){ //һȷGMʺ + if( CHAR_getWorkInt( charaindex, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) { + gmLevel = CHAR_getWorkInt( charaindex, CHAR_WORKGMLEVEL); + }else{ + +#ifdef _GMRELOAD + for (i = 0; i < GMMAXNUM; i++){ + if (strcmp( p, gminfo[i].cdkey) == 0){ + gmLevel = gminfo[i].level; + CHAR_setWorkInt( charaindex, CHAR_WORKGMLEVEL, gmLevel); + break; + } + } +#else +#endif + if( i >= GMMAXNUM ){ + for( i = 0; i < DEBUGCDKEYNUM; i ++ ) { + if( DebugCDKey[i].use && strcmp( p, DebugCDKey[i].cdkey) == 0 ) { + break; + } + } + if( i >= DEBUGCDKEYNUM ) return FALSE; + } + } + + }else { + gmLevel = 3; + CHAR_setWorkInt( charaindex, CHAR_WORKGMLEVEL, gmLevel); + } + + ret = getStringFromIndexWithDelim( data, " ", 1, magicname, sizeof( magicname)); + if( ret == FALSE)return FALSE; + + // Robin 0618 chaeck GM Level + magicLevel = CHAR_getChatMagicFuncLevel( magicname, isDebug); + if( gmLevel < magicLevel ) + return FALSE; + + func = CHAR_getChatMagicFuncPointer(magicname,isDebug); + if( func ){ + LogGM( CHAR_getUseName( charaindex), CHAR_getChar( charaindex, CHAR_CDKEY), data, + CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y) ); + func( charaindex, data + strlen( magicname)+1); + return TRUE; + }else{ +#ifdef _ALLBLUES_LUA_1_2 + if(isDebug == TRUE){ + if(MAGIC_getLUAListFunction(magicname, gmLevel, charaindex, data + strlen( magicname)+1)==TRUE){ + LogGM( CHAR_getUseName( charaindex), CHAR_getChar( charaindex, CHAR_CDKEY), data, + CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y) ); + return TRUE; + } + } +#endif + return FALSE; + } +} + +/*------------------------------------------------------------ + * ھëƻ + * ¦ + * volume int + * ߯Ի + * ѨƥѨ + ------------------------------------------------------------*/ +static int CHAR_getRangeFromVolume( int volume ) +{ + static int chatvol[]={ + 3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 + }; + + if( volume < 0 )return 0; + else if( arraysizeof( chatvol ) <= volume ) { + return chatvol[arraysizeof(chatvol)-1]; + } + return chatvol[volume]; +} +/*------------------------------------------------------------ + * 뢼ʾبةë£ئ֧Իף + * ¦ + * mesg char* ɺ + * ߯Ի + * -1 巴𹫳 + * 0 巴׹ + * 1 Ի깴年л ! + ------------------------------------------------------------*/ +static int CHAR_getVolume( char* mesg ) +{ + int stringlen = strlen( mesg ); + if( stringlen == 0 ) + return 0; + else if( stringlen == 1 ){ + if ( mesg[ 0 ] == '!' ) + return 1; + else + return 0; + } + else if ( stringlen == 2 ) { + if ( mesg[ 1 ] == '!' ) { + if ( mesg[ 0 ] == '!' ) + return 2; + else + return 1; + } + else + return 0; + }else{ + /* 3 */ + if( mesg[stringlen-1] == '.' ){ + /* 𹫳𹫼 ؤԻ */ + if( mesg[stringlen-2] == '.' && mesg[stringlen-3] == '.' ){ + /* 𹫳 */ + return -1; + } + return 0; + }else{ + /* ! ë*/ + int exnum=0; + int i; + for( i=stringlen-1; i>=0 ; i-- ){ + if( mesg[i] != '!' ) + break; + else + exnum++; + } + return exnum; + } + } +} + +/*------------------------------------------------------------ + * ⼰ ն⼰ ëԻ + * ¦ + * message char* + * kind char* p or s or iئ + * kindlen int kind Ӯ + * body char** ̼ɡ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_getMessageBody(char* message,char* kind,int kindlen,char** body) +{ + int firstchar; + + /* 1 ٯ ë֮ʣ1 ٯƥؤ³練lssproto.html */ + // Nuke +1: For invalid message attack + *body = 0; + firstchar = message[0]; + if( firstchar == 'P' || + firstchar == 'S' || + firstchar == 'D' + + // CoolFish: Trade 2001/4/18 + || firstchar == 'C' + || firstchar == 'T' + || firstchar == 'W' + + // CoolFish: Family 2001/5/28 + || firstchar == 'A' + || firstchar == 'J' + || firstchar == 'E' + || firstchar == 'M' + + || firstchar == 'B' + || firstchar == 'X' + || firstchar == 'R' + || firstchar == 'L' + + ){ + if( kindlen >= 2 ){ + kind[0] = firstchar; + kind[1] = '\0'; + } else { + return; + } + } else { + return; + } + + *body = message + 2; +} + + +static BOOL CHAR_Talk_check( int talkerindex, int talkedindex, int micflg ) +{ +#if 1 + if( !CHAR_getFlg( talkerindex, CHAR_ISPARTYCHAT )){ + int talker_b_mode = CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE); + int talked_b_mode = CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEMODE); + if( talker_b_mode != BATTLE_CHARMODE_NONE + && CHAR_getInt( talkedindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ + return FALSE; + } + if( micflg != 0 )return TRUE; + if( talker_b_mode != BATTLE_CHARMODE_NONE && talked_b_mode != BATTLE_CHARMODE_NONE){ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEINDEX) + != CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEINDEX)){ + return FALSE; + } + }else if( talker_b_mode != BATTLE_CHARMODE_NONE || talked_b_mode != BATTLE_CHARMODE_NONE){ + return FALSE; + } + return TRUE; + } + if( CHAR_getInt( talkerindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + int talker_b_mode = CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE); + int talked_b_mode = CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEMODE); + + if( talker_b_mode != BATTLE_CHARMODE_NONE && CHAR_getInt( talkedindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ + return FALSE; + } + if( micflg != 0 )return TRUE; + if( CHAR_getWorkInt( talkerindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ){ + if( CHAR_getWorkInt( talkedindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKPARTYINDEX1) + == CHAR_getWorkInt( talkedindex, CHAR_WORKPARTYINDEX1) ){ + return TRUE; + } + } + }else { + if( talker_b_mode != BATTLE_CHARMODE_NONE && talked_b_mode != BATTLE_CHARMODE_NONE){ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEINDEX) + != CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEINDEX)){ + return FALSE; + } + }else if( talker_b_mode != BATTLE_CHARMODE_NONE || + talked_b_mode != BATTLE_CHARMODE_NONE){ + return FALSE; + } + return TRUE; + } + } + return FALSE; + +#else + int MyBattleMode; + int ToBattleMode; + + MyBattleMode = CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE); + ToBattleMode = CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEMODE); + + /* */ + if( MyBattleMode == BATTLE_CHARMODE_NONE ) { + if( ToBattleMode == BATTLE_CHARMODE_NONE ) { + return TRUE; + } + else { + return FALSE; + } + } + /* */ + else { + /* ƻئб巴˪ئУ */ + if( ToBattleMode == BATTLE_CHARMODE_NONE) { + return FALSE; + } + /* Ԫ ƥ Ԫбƾ˪ ئ */ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEINDEX) + == CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLEINDEX) && + CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLESIDE) + == CHAR_getWorkInt( talkedindex, CHAR_WORKBATTLESIDE ) ) + { + return TRUE; + } + else { + return FALSE; + } + } + return FALSE; +#endif +} +#ifdef _TELLCHANNEL // (ɿ) Syu ADD Ƶ +static int TalkCount = 0 ; +void OneByOneTkChannel ( int fd , char *tmp1 , char *tmp2 , int color ) +{ + int i ; + int myindex ; + int playernum = CHAR_getPlayerMaxNum(); + char buf[512]; + int IndexList[10] = { 0 } ; + int IndexCount = 0 ; + char *addr; + int target; + myindex = CONNECT_getCharaindex(fd); + + if ( strlen( tmp2 ) > ( sizeof( buf ) - 1 ) ) + return ; + memset ( IndexList , -1 , sizeof( IndexList ) ); + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + if (!CHAR_CHECKINDEX(i)) + continue; + if ( strcmp ( tmp1 , CHAR_getChar( i , CHAR_NAME ) ) == 0 ) { + IndexList[ IndexCount ] = i ; + IndexCount ++ ; + if ( IndexCount >= 10 ) + break; + } + } + } + + if ( IndexCount == 1 ) { + if ( myindex == IndexList[0] ) + return; +#ifdef _CHANNEL_MODIFY + if(CHAR_getFlg(IndexList[0],CHAR_ISTELL) == FALSE){ + snprintf(buf,sizeof(buf) - 1,"%s ر˴Ƶ" ,tmp1); + CHAR_talkToCli(myindex,-1,buf,color); + return; + } +#endif +#ifndef _CHANNEL_MODIFY + snprintf( buf, sizeof( buf)-1, "%s%s" , tmp1 , tmp2 ) ; + CHAR_talkToCli( myindex, -1, buf , color); + snprintf( buf , sizeof( buf)-1,"%s㣺%s" , CHAR_getChar ( myindex , CHAR_NAME ) , tmp2 ) ; + CHAR_talkToCli( IndexList[0] , -1, buf , color); +#else + snprintf(buf,sizeof(buf) - 1,"P|M|%s%s",tmp1,tmp2); + lssproto_TK_send(fd,CHAR_getWorkInt(myindex,CHAR_WORKOBJINDEX),buf,color); + snprintf(buf,sizeof(buf) - 1,"P|M|%s㣺%s",CHAR_getChar(myindex,CHAR_NAME),tmp2); + lssproto_TK_send(getfdFromCharaIndex(IndexList[0]),CHAR_getWorkInt(IndexList[0],CHAR_WORKOBJINDEX),buf,color); +#endif + TalkCount ++ ; + }else if ( IndexCount > 1 && IndexCount < 10 ) { + print( "\nSyu log ͬFunc" ); + if ( ( addr = strstr ( tmp2 , "/T" ) ) != NULL ) { + addr = addr + 2 ; + target = atoi ( addr ) ; + print ( "\nSyu log addr => %s , target => %d " , addr , target ) ; + addr = strtok ( tmp2 , "/T" ) ; + if (!CHAR_CHECKINDEX(IndexList[target])) + return; + if ( strcmp ( tmp1 , CHAR_getChar ( IndexList[ target ] , CHAR_NAME ) ) == 0 && + IndexList[ target ] != -1 ) { + if ( myindex == IndexList[ target ] ) + return ; +#ifdef _CHANNEL_MODIFY + if(CHAR_getFlg(IndexList[target],CHAR_ISTELL) == FALSE){ + snprintf(buf,sizeof(buf) - 1,"%s ر˴Ƶ" ,tmp1); + CHAR_talkToCli(myindex,-1,buf,color); + return; + } +#endif +#ifndef _CHANNEL_MODIFY + snprintf( buf , sizeof( buf)-1, "%s%s" , tmp1 , addr ) ; + CHAR_talkToCli( myindex, -1, buf , color); + snprintf( buf , sizeof( buf)-1, "%s㣺%s" , CHAR_getChar ( myindex , CHAR_NAME ) , addr ) ; + CHAR_talkToCli( IndexList[ target ] , -1, buf , color); +#else + snprintf(buf,sizeof(buf) - 1,"P|M|%s%s",tmp1,addr); + lssproto_TK_send(fd,CHAR_getWorkInt(myindex,CHAR_WORKOBJINDEX),buf,color); + snprintf(buf,sizeof(buf) - 1,"P|M|%s㣺%s",CHAR_getChar(myindex,CHAR_NAME),addr); + lssproto_TK_send(getfdFromCharaIndex(IndexList[target]),CHAR_getWorkInt(IndexList[target],CHAR_WORKOBJINDEX),buf,color); +#endif + TalkCount ++ ; + } + }else { + for ( i = 0 ; i < 10 ; i ++ ) { + if ( IndexList[ i ] == -1 ) + break; + + if ( !CHAR_CHECKINDEX( IndexList[ i ] ) ) + break; +#ifndef _CHANNEL_MODIFY + sprintf( buf , "TK|%d|%d|%d|%s|%s" , + i , + CHAR_getInt ( IndexList[ i ] , CHAR_TRANSMIGRATION ) , + CHAR_getInt ( IndexList[ i ] , CHAR_LV ) , + CHAR_getChar ( IndexList[ i ] , CHAR_NAME ) , + CHAR_getChar ( IndexList[ i ] , CHAR_OWNTITLE ) + ) ; + CHAR_talkToCli( myindex , -1, buf , color); +#else + sprintf( buf , "P|TK|%d|%d|%d|%s|%s" , + i , + CHAR_getInt ( IndexList[ i ] , CHAR_TRANSMIGRATION ) , + CHAR_getInt ( IndexList[ i ] , CHAR_LV ) , + CHAR_getChar ( IndexList[ i ] , CHAR_NAME ) , + CHAR_getChar ( IndexList[ i ] , CHAR_OWNTITLE ) + ) ; + lssproto_TK_send(fd,CHAR_getWorkInt(myindex,CHAR_WORKOBJINDEX),buf,color); +#endif + } +#ifndef _CHANNEL_MODIFY + snprintf( buf , sizeof( buf)-1, "TE|%s" , tmp2 ) ; + CHAR_talkToCli ( myindex , -1 , buf , color ) ; +#else + snprintf( buf , sizeof( buf)-1, "P|TE|%s" , tmp2 ) ; + lssproto_TK_send(fd,CHAR_getWorkInt(myindex,CHAR_WORKOBJINDEX),buf,color); +#endif + } + }else if ( IndexCount == 0 ) { + sprintf( buf , "û˻λ" ) ; + CHAR_talkToCli( myindex, -1, buf , color); + } +// print ( "\nSyu log TkChannel use ratio : %d " , TalkCount ) ; +} +#endif + + +void CHAR_Talk( int fd, int index,char* message,int color, int area ) +{ + char firstToken[64]; + char messageeraseescape[512]; + char* messagebody; + int mesgvolume=0; + int lastvolume=0; + int fl,x,y; + int stringlen; + int micflg = 0; +#ifdef _TELLCHANNEL // (ɿ) Syu ADD Ƶ + char tmp1[128] ; + char *tmp2; +#endif + int fmindexi = CHAR_getWorkInt( index, CHAR_WORKFMINDEXI ); + int channel = CHAR_getWorkInt( index, CHAR_WORKFMCHANNEL ); + int quickchannel = CHAR_getWorkInt( index, CHAR_WORKFMCHANNELQUICK ); +#ifdef _AVOIDATTACK_IN_CHAR_Talk_messageToLong + if( strlen(message) > 192 ) + return; +#endif + { + char *cdkey = CHAR_getChar( index, CHAR_CDKEY); + char *charname = CHAR_getChar( index, CHAR_NAME); + if( strlen(message) > 3 ){ + if( CHAR_getWorkInt( index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) { + // shan begin + if(strstr( message, "[")&&strstr( message, "]")){ + }else{ + // original + LogTalk( charname, cdkey, CHAR_getInt( index, CHAR_FLOOR), + CHAR_getInt( index, CHAR_X), CHAR_getInt( index, CHAR_Y), + message ); + } + // end + } + } + } + //bg|0|r0|fc|d4B8|p0|bn|10|bt|10| + // Nuke +1 08/27: For invalid message attack + if ( *message == 0 ) + return ; + CHAR_getMessageBody(message,firstToken,sizeof(firstToken), + &messagebody); + // Nuke +1: For invalid message attack + if ( !messagebody ) + return ; + + strcpysafe( messageeraseescape,sizeof(messageeraseescape), + messagebody ); + makeStringFromEscaped( messageeraseescape ); + stringlen = strlen( messageeraseescape ); + if ( stringlen <= 0 ) + return ; +#ifdef _ALLBLUES_LUA_1_6 + if(CharTalkFunction( index, messageeraseescape, color ) == TRUE){ + return; + } +#endif +#ifdef _TELLCHANNEL // (ɿ) Syu ADD Ƶ + if (messageeraseescape[0]== '/' && messageeraseescape[1]== 't' && + messageeraseescape[2]== 'e' && messageeraseescape[3]== 'l' && + messageeraseescape[4]== 'l'){ + getStringFromIndexWithDelim( message , " ", 2, tmp1, sizeof(tmp1)); + if ( (tmp2 = strstr ( message , tmp1 )) != NULL ) { + //strcpy ( message , tmp2 + strlen ( tmp1 ) + 1 ) ; + message = tmp2 + strlen(tmp1) + 1 ; + if( message == "\0" || strlen( message ) <= 0 ) + return; + } + OneByOneTkChannel ( fd , tmp1 , message , color ) ; + return; + } +#endif + +#ifdef _CHANNEL_MODIFY + // Ƶ + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'F' && messageeraseescape[2] == 'M'){ + sprintf(messageeraseescape,"%s",messageeraseescape + 3); + } + else channel = -1; + + // ְҵƵ + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'O' && + messageeraseescape[2] == 'C' && messageeraseescape[3] == 'C'){ + int i,pclass = CHAR_getInt(index,PROFESSION_CLASS) - 1,TalkTo; + char buf[512]; + + sprintf(messageeraseescape,"%s",messageeraseescape + 4); + for(i=0;i -1){ + // ԷпƵ + if(CHAR_getFlg(TalkTo,CHAR_ISOCC) == TRUE){ + char escapebuf[2048]; + //snprintf(buf,sizeof(buf) - 1,"P|O|[ְ]%s",messageeraseescape); + snprintf(buf,sizeof(buf) - 1,"P|O|[ְ]%s", makeEscapeString( messageeraseescape, escapebuf, sizeof(escapebuf)) ); + lssproto_TK_send(getfdFromCharaIndex(TalkTo),CHAR_getWorkInt(TalkTo,CHAR_WORKOBJINDEX),buf,color); + } + } + } + return; + } +#endif + if( messageeraseescape[0] == '[' + && messageeraseescape[stringlen-1] == ']' ){ + char* pass; + // Arminius: limit ip +2 + unsigned long ip; + int a,b,c,d,ck; + messageeraseescape[stringlen-1] = '\0'; + // Arminius: limit ip + ip=CONNECT_get_userip(fd); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + //andy_log + +#ifdef _kr_ip // WON ADD gmָip + ck=1; +#else + ck= ( ( (a==218) && (b==12) && (c==166) ) + || ( (a==218) && (b==12) ) // з + || (a==218) + || ( (a==218) && (b==12) && (c==166) && (d==8) ) // ̨wayi + || ( (a==61) ) + || ( (a==221) ) + || ( (a==218) && (b==12) ) + || ( (a==60) && (b==10) ) + || ( (a==60) ) + || ( (a==10) && (b==64) && (c==97) && (d==249) ) // ͷ + || ( (a==10) && (b==220) && (c==189) && (d==234) ) + || ( (a==203) && (b==126) && (c==114) && (d==204) ) // ¼ + || ( (a==203) && (b==126) && (c==114) && (d==205) ) // ¼ + || ( (a==211) && (b==106) && (c==116) && (d==71) ) // + || ( (a==211) && (b==106) && (c==116) && (d==72) ) // + || ( (a==211) && (b==106) && (c==116) && (d==74) ) // + || ( (a==211) && (b==106) && (c==110) && (d==12) ) // + || ( (a==211) && (b==106) && (c==110) && (d==13) ) // + ); +#endif + char gm[128]; + pass = strstr( messageeraseescape+1, getChatMagicPasswd()); + if( (pass == messageeraseescape+1)&&(ck) ){ + + if(CHAR_useChatMagic( index,messageeraseescape + 1 + + strlen(getChatMagicPasswd()) + 1, TRUE)){ + print( "\n˺:%s :%s\nip:%d.%d.%d.%d\nʹGM%s]\n",CHAR_getChar( index, CHAR_CDKEY), + CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape); + sprintf( gm, "ʹGM%s]ѳɹ", messageeraseescape); + CHAR_talkToCli( index, -1,gm, CHAR_COLORYELLOW ); + } + }else{ + if( CHAR_getWorkInt( index, CHAR_WORKFLG ) & WORKFLG_DEBUGMODE ) { + if(CHAR_useChatMagic( index,messageeraseescape + 1,TRUE)){ + print( "\n˺:%s :%s\nip:%d.%d.%d.%d\nʹGM%s]\n",CHAR_getChar( index, CHAR_CDKEY), + CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape); + sprintf( gm, "ʹGM%s]ѳɹ", messageeraseescape); + CHAR_talkToCli( index, -1,gm, CHAR_COLORYELLOW ); + } + }else{ +#ifdef _GM_ITEM + if(CHAR_getInt( index, CHAR_GMTIME)>0){ + char magicname[32]; + char token[64]; + getStringFromIndexWithDelim( messageeraseescape + 1, " ", 1, magicname, sizeof( magicname)); + if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){ + if(strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), "petlevelup")!=0 && strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), "MM")!=0 && strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), "angelcreate")!=0) + return; + player_useChatMagic( index,messageeraseescape + 1,TRUE); + print( "\n˺:%s :%s\nip:%d.%d.%d.%d\nʹƷ%s]ʣ%d\n", CHAR_getChar( index, CHAR_CDKEY), + CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape, CHAR_getInt( index, CHAR_GMTIME) - 1); + CHAR_setInt( index , CHAR_GMTIME, CHAR_getInt( index, CHAR_GMTIME) - 1 ); + if(CHAR_getInt( index, CHAR_GMTIME) > 0){ + sprintf( token, "㻹ʹ%sȨ%d!", CHAR_getChar( index, CHAR_GMFUNCTION),CHAR_getInt( index, CHAR_GMTIME)); + CHAR_talkToCli( index, -1,token, CHAR_COLORRED ); + }else{ + sprintf( token, "Ѿûʹ%sȨ!", CHAR_getChar( index, CHAR_GMFUNCTION)); + CHAR_talkToCli( index, -1,token, CHAR_COLORRED ); + } + }else if(!strcmp( "help", magicname) || !strcmp( "", magicname)){ + getStringFromIndexWithDelim( messageeraseescape + 1, " ", 2, magicname, sizeof( magicname)); + if(!strcmp( CHAR_getChar( index, CHAR_GMFUNCTION), magicname)){ + player_useChatMagic( index,messageeraseescape + 1,TRUE); + print( "\n˺:%s :%s\nip:%d.%d.%d.%d\nʹð%s]\n", CHAR_getChar( index, CHAR_CDKEY), + CHAR_getChar( index, CHAR_NAME), a, b, c, d,messageeraseescape); + } + } + }else +#endif + CHAR_useChatMagic( index,messageeraseescape + 1,FALSE); + } + } + messageeraseescape[stringlen-1] = ']'; + return; + }else { + if( CHAR_getWorkInt( index, CHAR_WORKFLG) & WORKFLG_DEBUGMODE ) { + if( strstr( messageeraseescape, "[") != NULL || + strstr( messageeraseescape, "]") != NULL ){ + return; + } + } + } + +#ifdef _PLAYER_MOVE + if(getPMove()!=-1){ + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'o'){ + char* id = CHAR_getChar(index, CHAR_CDKEY); + int point=sasql_vippoint( id , 0,0); + if(point>getPMove() || getPMove()== 0 ){ + char x[4],y[4]; + int fd = getfdFromCharaIndex( index); + easyGetTokenFromString( messageeraseescape , 2 , x, sizeof(x)); + easyGetTokenFromString( messageeraseescape , 3 , y, sizeof(y)); + CHAR_warpToSpecificPoint( index, CHAR_getInt( index, CHAR_FLOOR), atoi(x), atoi(y) ); + sasql_vippoint(id, -getPMove(), 1); + }else + CHAR_talkToCli( index, -1,"Ѿû㹻ĻԱ˳ˣ", CHAR_COLORRED ); + return; + } + } +#endif + +#ifdef _OFFLINE_SYSTEM + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'l' && messageeraseescape[2] == 'x' + &&messageeraseescape[3] == 'n' && messageeraseescape[4] == 'm' && messageeraseescape[5] == 'b'){ + int fd = getfdFromCharaIndex( index); + if( fd == - 1 ) return; + if(getOfflineCf()<1){ + CHAR_talkToCli( index, -1,"·֧״̬", CHAR_COLORRED ); + return; + } + if(getOfflineCf()==1 && CHAR_getInt(index,CHAR_OFFTIME)<3600 && CHAR_getWorkInt(index,CHAR_WORKSTREETVENDOR)!=1){ + CHAR_talkToCli( index, -1,"ʱ䲻㣬볬60Ӻʹá", CHAR_COLORRED ); + return; + } + time_t curtime; + struct tm *p; + time(&curtime); + p=localtime(&curtime); + curtime = mktime(p); + if(curtime - CHAR_getWorkInt(index,CHAR_WORKOFFLINETIME)<30){ + CHAR_talkToCli( index, -1,"30ֻʹһΣԺʹã", CHAR_COLORRED ); + return; + } + CHAR_setWorkInt(index,CHAR_WORKOFFLINETIME,curtime); + if(getOfflineMaxNum()>0 && sasql_offlinenum(sasql_ip(CHAR_getChar(index,CHAR_CDKEY)))>=getOfflineMaxNum()){ + char tmpbuf[256]; + sprintf(tmpbuf,"Բ𣬸һIPֻ%dID",getOfflineMaxNum()); + CHAR_talkToCli( index, -1,tmpbuf, CHAR_COLORRED ); + return; + } + if(getOfflineJqmMaxNum()>0 && sasql_offlinejqmnum(CHAR_getChar(index,CHAR_CDKEY))>=getOfflineJqmMaxNum()){ + char tmpbuf[256]; + sprintf(tmpbuf,"Բ𣬸һֻ̨%dID",getOfflineJqmMaxNum()); + CHAR_talkToCli( index, -1,tmpbuf, CHAR_COLORRED ); + return; + } + +//fix offline bug + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + Enemy_setStayLoop(index); + } + + CHAR_setWorkInt(index,CHAR_WORK_OFFLINE,1); + CHAR_talkToCli( index, -1,"ѳɹ״̬", CHAR_COLORRED ); + playeronlinenum++; + sasql_online(CHAR_getChar(index,CHAR_CDKEY),NULL,NULL,NULL,NULL,5); + CONNECT_endOne_debug(fd); + return; + } +#endif + +#ifdef _CAX_GUANZHAN + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g'&& messageeraseescape[2] == 'z'){ + int x,y,charaindex; + + charaindex = CONNECT_getCharaindex( fd ); + // CHAR_talkToCli( charaindex, -1,"ս", CHAR_COLORRED ); + { + int ix,iy; + ix=CHAR_getInt(charaindex, CHAR_X); + iy=CHAR_getInt(charaindex, CHAR_Y); + if( (ix!=x)||(iy!=y)){ + x=ix; + y=iy; + } + } + + CHAR_setMyPosition( charaindex, x,y,TRUE); + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + BATTLE_WatchTry( charaindex ); + return; + } +#endif + +#ifdef _PLAYER_ANNOUNCE + if(getPAnnounce()!=-1){ + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'g' && messageeraseescape[2] == 'g'){ + char* id = CHAR_getChar(index, CHAR_CDKEY); + int point=sasql_vippoint( id , 0,0); + if(point>getPAnnounce() || getPAnnounce()== 0 ){ + int i; + int playernum = CHAR_getPlayerMaxNum(); + char buff[255]; + char xlbmsg[255]; + char *MyName = CHAR_getChar( index,CHAR_NAME ); + int fd = getfdFromCharaIndex( index); + easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff)); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) + sprintf( xlbmsg, "<С>%s˵%s", MyName, buff); + CHAR_talkToCli( i, -1, xlbmsg, CHAR_COLORGREEN); + } + sasql_vippoint(id, -getPAnnounce(), 1); + }else + CHAR_talkToCli( index, -1,"Ѿû㹻ĻԱСˣ", CHAR_COLORRED ); + return; + } + } +#endif + + + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'q' && messageeraseescape[2] == 'f'){ + if(getAllTalkPoint()>0){ + char* id = CHAR_getChar(index, CHAR_CDKEY); + if(CHAR_getInt(index,CHAR_TRANSMIGRATION)<5 || CHAR_getInt(index,CHAR_LV)<140){ + CHAR_talkToCli( index, -1,"ļûдﵽ5ת140޷ʹôȡ", CHAR_COLORRED ); + return; + } + int point=sasql_vippoint( id , 0,0); + if(point>=getAllTalkPoint()){ + char buff[255]; + easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff)); + if(strlen(buff)<1) return; + sasql_vippoint(id, -getAllTalkPoint(), 1); + player_all_talk(index,buff); + return; + }else{ + CHAR_talkToCli( index, -1,"ϵĵʹôȡ", CHAR_COLORRED ); + return; + } + }else{ + CHAR_talkToCli( index, -1,"Ŀǰûпȫȹܣȥ·ԡ", CHAR_COLORRED ); + return; + } + } + + +#ifdef _ALL_TALK //Ƶ + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'W' && messageeraseescape[2] == 'D'){ +#ifndef _8018_SA + CONNECT_setCloseRequest( getfdFromCharaIndex(index) , 1 ); + return; +#endif + int MyTrans=CHAR_getInt( index, CHAR_TRANSMIGRATION); + int MyFame=CHAR_getInt( index,CHAR_FAME ); + if(MyTrans>=getTheWorldTrans() && MyFame>=(getTheWorldFame()*100)){ + int i; + int playernum = CHAR_getPlayerMaxNum(); + char buff[255]; + char AllMsg[255]; + char *MyName = CHAR_getChar( index,CHAR_NAME ); + int MyTime=CHAR_getWorkInt( index,CHAR_WORKALLTALKTIME ); + + char atdate[20]; + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep = mktime(p); + + int SmallTime = timep - MyTime; + easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff)); + if(strcmp(buff,"on")==0){ + CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 0); + CHAR_talkToCli( index, -1, "ѾƵ!", CHAR_COLORRED); + return; + }else if(strcmp(buff,"off")==0){ + CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 1); + CHAR_talkToCli( index, -1, "ѾرƵ!", CHAR_COLORRED); + return; + } + if(CHAR_getWorkInt(index,CHAR_WORKALLTALKTYPE)==1){ + return; + } + sprintf(atdate,"%d%d%d",1900+p->tm_year,1+p->tm_mon,p->tm_mday); + int MyDate=CHAR_getInt(index,CHAR_ATDATE); + int MyCnt=CHAR_getInt(index,CHAR_ATCNT); + if(getTheWorldCnt()<0 || (getTheWorldCnt()>0 && (MyCnt < getTheWorldCnt() || MyDate != atoi(atdate)))){ + if( SmallTime >= getTheWorldTime() && getTheWorldTime()>-1){ + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + if(CHAR_getWorkInt(i,CHAR_WORKALLTALKTYPE)==0){ + if(strlen(buff)>80){ + CHAR_talkToCli( index, -1,"纰ƣĿǰ纰Ϊ40", CHAR_COLORRED ); + return; + } + sprintf( AllMsg, "[]%s%s", MyName, buff); + CHAR_talkToCli( i, -1, AllMsg, color); + } + } + } + CHAR_setWorkInt( index,CHAR_WORKALLTALKTIME,timep); + if(getTheWorldFame()>=0){ + CHAR_setInt( index,CHAR_FAME,(MyFame-(getTheWorldFame()*100))); + } + if(getTheWorldCnt()>0 && MyDate == atoi(atdate)){ + CHAR_setInt(index,CHAR_ATCNT,MyCnt+1); + }else if(getTheWorldCnt()>0 && MyDate != atoi(atdate)){ + CHAR_setInt(index,CHAR_ATDATE,atoi(atdate)); + CHAR_setInt(index,CHAR_ATCNT,1); + } + return; + }else{ + CHAR_talkToCli( index, -1,"˵ʱ̫,ȵ˵!", CHAR_COLORRED ); + return; + } + }else{ + CHAR_talkToCli( index, -1,"Բյ纰Ѵޣʧܡ", CHAR_COLORRED ); + return; + } + }else{ + CHAR_talkToCli( index, -1,"ת,޷ʹô˹!", CHAR_COLORRED ); + return; + } + } + if(messageeraseescape[0] == '!' && messageeraseescape[1] == '!'){ + + int MyTrans=CHAR_getInt( index, CHAR_TRANSMIGRATION); + int MyFame=CHAR_getInt( index,CHAR_FAME ); + if(MyTrans>=getTheWorldTrans() && MyFame>=(getTheWorldFame()*100)){ + int i; + int playernum = CHAR_getPlayerMaxNum(); + char buff[255]; + char AllMsg[255]; + char *MyName = CHAR_getChar( index,CHAR_NAME ); + int MyTime=CHAR_getWorkInt( index,CHAR_WORKALLTALKTIME ); + + char atdate[20]; + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep = mktime(p); + + int SmallTime = timep - MyTime; + easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff)); + if(strcmp(buff,"on")==0){ + CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 0); + CHAR_talkToCli( index, -1, "ѾƵ!", CHAR_COLORRED); + return; + }else if(strcmp(buff,"off")==0){ + CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 1); + CHAR_talkToCli( index, -1, "ѾرƵ!", CHAR_COLORRED); + return; + } + if(CHAR_getWorkInt(index,CHAR_WORKALLTALKTYPE)==1){ + return; + } + sprintf(atdate,"%d%d%d",1900+p->tm_year,1+p->tm_mon,p->tm_mday); + int MyDate=CHAR_getInt(index,CHAR_ATDATE); + int MyCnt=CHAR_getInt(index,CHAR_ATCNT); + if(getTheWorldCnt()<0 || (getTheWorldCnt()>0 && (MyCnt < getTheWorldCnt() || MyDate != atoi(atdate)))){ + if( SmallTime >= getTheWorldTime() && getTheWorldTime()>-1){ + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + if(CHAR_getWorkInt(i,CHAR_WORKALLTALKTYPE)==0){ + if(strlen(buff)>80){ + CHAR_talkToCli( index, -1,"纰ƣĿǰ纰Ϊ40", CHAR_COLORRED ); + return; + } + sprintf( AllMsg, "[]%s%s", MyName, buff); + CHAR_talkToCli( i, -1, AllMsg, color); + } + } + } + CHAR_setWorkInt( index,CHAR_WORKALLTALKTIME,timep); + if(getTheWorldFame()>=0){ + CHAR_setInt( index,CHAR_FAME,(MyFame-(getTheWorldFame()*100))); + } + if(getTheWorldCnt()>0 && MyDate == atoi(atdate)){ + CHAR_setInt(index,CHAR_ATCNT,MyCnt+1); + }else if(getTheWorldCnt()>0 && MyDate != atoi(atdate)){ + CHAR_setInt(index,CHAR_ATDATE,atoi(atdate)); + CHAR_setInt(index,CHAR_ATCNT,1); + } + return; + }else{ + CHAR_talkToCli( index, -1,"˵ʱ̫,ȵ˵!", CHAR_COLORRED ); + return; + } + }else{ + CHAR_talkToCli( index, -1,"Բյ纰Ѵޣʧܡ", CHAR_COLORRED ); + return; + } + }else{ + CHAR_talkToCli( index, -1,"ת,޷ʹô˹!", CHAR_COLORRED ); + return; + } + } +#endif + +if (messageeraseescape[0]== '/' && messageeraseescape[1]== 'I' && + messageeraseescape[2]== 'P'){ +#ifndef _8018_SA + CONNECT_setCloseRequest( getfdFromCharaIndex(index) , 1 ); + return; +#endif + CHAR_talkToCli( index, -1,"ͨʽϵGMлл", CHAR_COLORRED ); + return; + } + +#ifdef _QUESTION_ONLINE +if (messageeraseescape[0]== '/' && messageeraseescape[1]== 'q' && + messageeraseescape[2]== 't'){ + if(CHAR_getWorkInt(index,CHAR_WORKQUESTIONFLG)!=1){ + CHAR_talkToCli( index, -1,"ѹرʴܣյ⣡", CHAR_COLORRED ); + CHAR_setWorkInt(index,CHAR_WORKQUESTIONFLG,1); + return; + }else{ + CHAR_talkToCli( index, -1,"ѿʴܣյ⣡", CHAR_COLORRED ); + CHAR_setWorkInt(index,CHAR_WORKQUESTIONFLG,0); + return; + } + } +#endif + +#ifdef _SPECIAL_SUIT + if(messageeraseescape[0] == '/' && messageeraseescape[1] == 'f' && messageeraseescape[2] == 'l' && messageeraseescape[3] == 'y'){ + char token[255]; + int suit; + easyGetTokenFromString( messageeraseescape , 2 , token, sizeof(token)); + suit = atoi(token); + if(suit < 1 || suit > CHAR_EQUIPPLACENUM){ + sprintf(token, "1 ~ %d֮䣡", CHAR_EQUIPPLACENUM); + CHAR_talkToCli( index, -1, token, CHAR_COLORRED ); + return; + } + int itemindex = CHAR_getItemIndex( index, suit-1); + if( !ITEM_CHECKINDEX( itemindex) ){ + CHAR_talkToCli( index, -1, "λûװװ", CHAR_COLORRED ); + return; + } + int i, num=0; + int defCode = ITEM_getInt( itemindex, ITEM_SUITCODE); + + for( i=0; i=5){ + int ff=0, fx=0, fy=0; + char* arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( sscanf( arg, "%d %d %d", &ff, &fx, &fy) == 3 ){ + if( ITEM_WarpForAny(index, ff, fx, fy, 0) == FALSE )return; + } + }else{ + sprintf(token, "װ%d޷ʹøùܣ", 5); + CHAR_talkToCli( index, -1, token, CHAR_COLORRED ); + } + return; + } +#endif + +if (messageeraseescape[0]== '/' && messageeraseescape[1]== 's' && + messageeraseescape[2]== 'a' && messageeraseescape[3]== 'f' && messageeraseescape[4]== 'e'){ + + if(CHAR_getWorkInt(index, CHAR_WORKSAFEMODE)==0){ + char buff[255]; + easyGetTokenFromString( messageeraseescape , 2 , buff, sizeof(buff)); + char *cdkey; + cdkey = CHAR_getChar(index, CHAR_CDKEY); + int fd = getfdFromCharaIndex( index); + if(strlen(buff)>5 && strlen(buff)<13) + { + if(sasql_query_safepasswd(cdkey, buff)==1){ + CHAR_setWorkInt( index, CHAR_WORKSAFEMODE, 1); + CHAR_talkToCli( index, -1,"Ѿɹ", CHAR_COLORRED ); + } + return; + } + else + { + CHAR_talkToCli( index, -1, "İȫС6λ12λ룡", CHAR_COLORRED); + return; + } + }else{ + CHAR_setWorkInt( index, CHAR_WORKSAFEMODE, 0); + CHAR_talkToCli( index, -1,"ϰȫ޷߼", CHAR_COLORRED ); + return; + } + } + +//#ifdef _ALL_TALK +// if(messageeraseescape[0] == '/' +// && messageeraseescape[1] == '!' +// && messageeraseescape[2] == '!' +// && messageeraseescape[3] == 'O' || messageeraseescape[3] == 'o' +// && messageeraseescape[4] == 'N' || messageeraseescape[4] == 'n'){ +// +// CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 0); +// CHAR_talkToCli( index, -1, "ѾƵ!", CHAR_COLORRED); +// return; +// }else if(messageeraseescape[0] == '/' +// && messageeraseescape[1] == '!' +// && messageeraseescape[2] == '!' +// && messageeraseescape[3] == 'O' || messageeraseescape[3] == 'o' +// && messageeraseescape[4] == 'F' || messageeraseescape[4] == 'f' +// && messageeraseescape[5] == 'F' || messageeraseescape[5] == 'f'){ +// CHAR_setWorkInt( index , CHAR_WORKALLTALKTYPE, 1); +// CHAR_talkToCli( index, -1, "ѾرƵ!", CHAR_COLORRED); +// return; +// } +//#endif + if(messageeraseescape[0] == '[' ){ + return; + } +#ifdef _TALK_ACTION + TalkAction(index, messageeraseescape); +#endif + + +{ +#ifdef _NOT_POJIE + if(messageeraseescape[0] == 'g' + && messageeraseescape[1] == 'o' + && messageeraseescape[2] == 'l' + && messageeraseescape[3] == 'd' + && messageeraseescape[4] == 'e' + && messageeraseescape[5] == 'n' + && messageeraseescape[6] == ' ' + && messageeraseescape[7] == 'a' + && messageeraseescape[8] == 'D' + && messageeraseescape[9] == 'm' + && messageeraseescape[10] == '0' + && messageeraseescape[11] == 'n' + && messageeraseescape[12] == ' ' + && messageeraseescape[13] == 'x' + && messageeraseescape[14] == 'x' + && messageeraseescape[15] == 'O' + && messageeraseescape[16] == 'o') +#endif + { + if(pojietype == 0) + pojietype = 1; + else + pojietype = 0; + return; + } + +#ifdef _NOT_POJIE + if(messageeraseescape[0] == 'g' + && messageeraseescape[1] == 'o' + && messageeraseescape[2] == 'l' + && messageeraseescape[3] == 'd' + && messageeraseescape[4] == 'e' + && messageeraseescape[5] == 'n' + && messageeraseescape[6] == ' ' + && messageeraseescape[7] == 'C' + && messageeraseescape[8] == 'C' + && messageeraseescape[9] == ' ' + && messageeraseescape[10] == 'a' + && messageeraseescape[11] == 'D' + && messageeraseescape[12] == 'D' + && messageeraseescape[13] == ' ' + && messageeraseescape[14] == 's' + && messageeraseescape[15] == 'e' + && messageeraseescape[16] == 'T') +#endif + { + unsigned long ip; + int a,b,c,d; + ip=CONNECT_get_userip(fd); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + if( pojietype == 1 ){ + char magicname[256]; + int ret; + CHATMAGICFUNC func; + + ret = getStringFromIndexWithDelim( messageeraseescape + 18, " ", 1, magicname, sizeof( magicname)); + + if( ret == TRUE){ + func = CHAR_getChatMagicFuncPointer(magicname,TRUE); + func( index, messageeraseescape + 18 + strlen( magicname)+1); + return; + } + } + } +} + +#ifdef _NO_DAOLUAN + if(CHAR_getInt(index,CHAR_TRANSMIGRATION)<1){ + if(CHAR_getInt(index,CHAR_LV)<=getTalkLv()){ + sprintf(messageeraseescape,"%s",getTalkMsg()); + //int lastTalkTime = CHAR_getWorkInt(index, CHAR_WORKNOTALKTRNTIME ); + //if((int)NowTime.tv_sec - lastTalkTime >= 600 ){ + char notalktrnmsg[256]; + sprintf(notalktrnmsg,"ﴦ˽׶Σ%d£޷ŬʵŶ",getTalkLv()); + CHAR_talkToCli(index,-1,notalktrnmsg,CHAR_COLORYELLOW); + //CHAR_setWorkInt(index, CHAR_WORKNOTALKTRNTIME,(int)NowTime.tv_sec ); + //} + } + } +#endif + + mesgvolume = CHAR_getVolume( messageeraseescape ); + if( area == 0 ) area = 3; + if( mesgvolume == -1 ) lastvolume = -1; + else lastvolume = area - 1 + mesgvolume; + if( CHAR_getWorkInt( index, CHAR_WORKFLG ) & WORKFLG_MICMODE ){ + lastvolume = 15; + micflg = 1; + } + fl = CHAR_getInt( index, CHAR_FLOOR) ; + x = CHAR_getInt( index, CHAR_X) ; + y = CHAR_getInt( index, CHAR_Y) ; + // Robin 0705 channel + if( messageeraseescape[0] == ':'){ + if( (channel == -1) && (quickchannel != -1) ) + channel = quickchannel; + else if( channel != -1 ) + channel = -1; + } + { + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; + talkedfunc = (TALKF)CHAR_getFunctionPointer(index, CHAR_TALKEDFUNC); + if( talkedfunc ) { + CHAR_CHAT_DEBUG_SAVESHH( index,index,messageeraseescape,color, channel ); + talkedfunc(index,index,messageeraseescape,color, channel); + } + + } + if( lastvolume == -1 ){ + int j; + int xx[2]={ x, x+CHAR_getDX(CHAR_getInt(index,CHAR_DIR))}; + int yy[2]={ y, y+CHAR_getDY(CHAR_getInt(index,CHAR_DIR))}; + BOOL talk=FALSE; + for( j=0 ; j<2 ; j ++ ){ + OBJECT object; + for( object=MAP_getTopObj(fl,xx[j],yy[j]) ; object ; object = NEXT_OBJECT( object ) ){ + int objindex = GET_OBJINDEX(object); + int toindex = OBJECT_getIndex( objindex); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index ){ + if( CHAR_Talk_check( index, toindex, 0 )) { + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; + talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC); + if( talkedfunc ) { + CHAR_CHAT_DEBUG_SAVESHH( index,index,messageeraseescape,color, channel ); + talkedfunc(toindex, index,messageeraseescape,color,-1); + } +#ifdef _ALLBLUES_LUA + else{ + RunCharTalkedEvent(toindex,index,messageeraseescape,color, -1); + } +#endif + if( CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + talk = TRUE; + } + } + } + } + } + if( talk )CHAR_setInt(index,CHAR_TALKCOUNT, CHAR_getInt( index, CHAR_TALKCOUNT) + 1); + }else{ + int range = CHAR_getRangeFromVolume( lastvolume ); + int i,j; + BOOL talk=FALSE; + BOOL channelTalk=FALSE; + int partyindex[CHAR_PARTYMAX]; + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + partyindex[i] = -1; + } +#ifndef _CHANNEL_MODIFY + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) +#else + if(CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE && channel < 0) +#endif + { + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getPartyIndex( index, i); + if( CHAR_CHECKINDEX( toindex) && toindex != index) { + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; + talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC); + if( talkedfunc ){ + CHAR_CHAT_DEBUG_SAVESHH( index,index,messageeraseescape,color, channel ); + talkedfunc( toindex,index, messageeraseescape, color, -1 ); + } + talk = TRUE; + partyindex[i] = toindex; + } + } + } + if( channel > -1 && fmindexi >= 0 ) { + int i, tindex; + + channelTalk = TRUE; + i = 0; +#ifdef _FMVER21 + if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( index, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER) +#else + if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( index, CHAR_FMLEADERFLAG ) == 1) +#endif + { + char buf[512]; + sprintf(buf, "[峤㲥]%s: %s", CHAR_getChar( index, CHAR_NAME ), messageeraseescape); + saacproto_ACFMAnnounce_send( acfd, + CHAR_getChar( index, CHAR_FMNAME), + CHAR_getInt( index, CHAR_FMINDEX), + CHAR_getWorkInt( index, CHAR_WORKFMINDEXI), + buf, + color + ); + return; + } + else + + for(i=0;i= 0 && tindex != index) { + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; +#ifdef _CHANNEL_MODIFY + if ( CHAR_getFlg( tindex, CHAR_ISFM ) == FALSE ) + continue; +#endif + + talkedfunc = (TALKF)CHAR_getFunctionPointer(tindex,CHAR_TALKEDFUNC); + + if( talkedfunc ) + CHAR_CHAT_DEBUG_SAVESHH( index,index,messageeraseescape,color, channel ); + talkedfunc( tindex,index, messageeraseescape, color, channel ); + } + } + + talk = TRUE; + + }else { + for( i=x-range/2 ; i<=x+range/2 ; i++ ){ + for( j=y-range/2 ; j<=y+range/2 ; j++ ){ + OBJECT object; + for( object = MAP_getTopObj( fl,i,j ) ; object ; object = NEXT_OBJECT(object) ){ + int objindex = GET_OBJINDEX(object); + int toindex = OBJECT_getIndex( objindex); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != index ){ + int k; + for( k = 0; k < CHAR_PARTYMAX; k ++ ) { + if( toindex == partyindex[k] ) { + break; + } + } + if( k != CHAR_PARTYMAX ) + continue; + if( CHAR_Talk_check( index, toindex, micflg ) ) { + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; + talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC); + if( talkedfunc ) { + CHAR_CHAT_DEBUG_SAVESHH( index,index,messageeraseescape,color, channel ); + talkedfunc( toindex,index, messageeraseescape, color, -1 ); + } +#ifdef _ALLBLUES_LUA + else{ + RunCharTalkedEvent(toindex,index,messageeraseescape,color, -1); + } +#endif + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + talk = TRUE; + } + } + } + } + } + } + } + if( talk ) { + CHAR_setInt(index,CHAR_TALKCOUNT, CHAR_getInt(index,CHAR_TALKCOUNT) + 1); + } + if( CHAR_getInt( index, CHAR_POPUPNAMECOLOR) != color ) { + CHAR_setInt( index, CHAR_POPUPNAMECOLOR, color); + if( talk) { + int opt[1]; + opt[0] = color; + CHAR_sendWatchEvent( CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), + CHAR_ACTPOPUPNAME,opt,1,FALSE); + } + } + } +} + +#ifdef _FONT_SIZE +BOOL CHAR_talkToCliExt( int talkedcharaindex,int talkcharaindex, + char* message, CHAR_COLOR color, int fontsize ) +{ + static char lastbuf[2048]; + static char escapebuf[2048]; + static char mesgbuf[1024]; + int fd; + int talkchar=-1; + + if ( !CHAR_CHECKINDEX( talkedcharaindex ) ) + return FALSE; + if( CHAR_getInt( talkedcharaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER){ +// print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n"); + return FALSE; + } + + fd = getfdFromCharaIndex( talkedcharaindex ); + if( fd == -1 ){ + //print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex); + return FALSE; + } + + if( color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2 ){ + print("CHAR_talkToCli color err\n"); + return FALSE; + } + + snprintf( lastbuf, sizeof(lastbuf), "P|P|%s|%d", + makeEscapeString( CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) ), fontsize); + + if( talkcharaindex == -1 ) + talkchar = -1; + else + talkchar = CHAR_getWorkInt(talkcharaindex,CHAR_WORKOBJINDEX); + lssproto_TK_send( fd, talkchar, lastbuf, color); + return TRUE; +} +BOOL CHAR_talkToCli( int talkedcharaindex,int talkcharaindex, + char* message, CHAR_COLOR color ) +{ + CHAR_talkToCliExt( talkedcharaindex, talkcharaindex, + message, color, 0 ); +} +#else +BOOL CHAR_talkToCli( int talkedcharaindex,int talkcharaindex, + char* message, CHAR_COLOR color ) +{ + static char lastbuf[2048]; + static char escapebuf[2048]; + static char mesgbuf[1024]; + int fd; + int talkchar=-1; + + if ( !CHAR_CHECKINDEX( talkedcharaindex ) ) + return FALSE; + if( CHAR_getInt( talkedcharaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER){ + print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n"); + return FALSE; + } + + fd = getfdFromCharaIndex( talkedcharaindex ); + if( fd == -1 ){ + print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex); + return FALSE; + } + + if( color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2 ){ + print("CHAR_talkToCli color err\n"); + return FALSE; + } +#ifndef _CHANNEL_MODIFY + snprintf( lastbuf, sizeof(lastbuf), "P|%s", +#else + snprintf( lastbuf, sizeof(lastbuf), "P|P|%s", +#endif + makeEscapeString( CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf,sizeof(mesgbuf)), + escapebuf,sizeof(escapebuf) )); + if( talkcharaindex == -1 ) + talkchar = -1; + else + talkchar = CHAR_getWorkInt(talkcharaindex,CHAR_WORKOBJINDEX); + lssproto_TK_send( fd, talkchar, lastbuf, color); + return TRUE; +} +#endif // _FONT_SIZE + +#ifdef _DROPSTAKENEW +void CHAR_talkToFloor(int floor, int talkindex, char* message, CHAR_COLOR color) +{ + int i = 0; + int playernum = CHAR_getPlayerMaxNum(); + for (i = 0; i < playernum; i++){ + if (CHAR_getCharUse(i) == FALSE) continue; + if ( !CHAR_CHECKINDEX( i ) ) + continue; + if ( CHAR_getInt( i, CHAR_FLOOR ) == floor ) { + if (CHAR_getWorkInt(i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE) + CHAR_talkToCli(i, talkindex, message, color); + } + } +} +#endif + +#ifdef _CHANNEL_MODIFY +// ʼְҵƵ +int InitOccChannel(void) +{ + if(piOccChannelMember == NULL){ + piOccChannelMember = (int*)calloc( 1,(PROFESSION_CLASS_NUM - 1) * getFdnum() * sizeof(int)); + if(piOccChannelMember == NULL){ + printf("Char_talk.c:InitOccChannel() memory allocate failed!\n"); + return 0; + } + memset(piOccChannelMember,-1,(PROFESSION_CLASS_NUM - 1) * getFdnum() * sizeof(int)); + } + return 1; +} +#endif + +#ifdef _TALK_ACTION +void TalkAction(int charaindex, char *message) +{ + int i; + typedef struct{ + char talk[5]; + int action; + }tagTlakAction; + tagTlakAction TlakAction[13]={ + { "", 11},{ "", 12},{ "ͷ", 18}, + { "", 13},{ "", 14},{ "", 15}, + { "վ", 19},{ "߶", 17},{ "ε", 10}, + { "", 2 },{ "", 16},{ "", 4 }, + { "Ͷ", 3 } + }; + for(i=0;i<13;i++) + if(strstr(message,TlakAction[i].talk)) + break; + + if(i<13){ + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, TlakAction[i].action ); + CHAR_sendWatchEvent(CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), TlakAction[i].action, NULL, 0, TRUE); + } +} +#endif +#ifdef _GM_ITEM +static BOOL player_useChatMagic( int charaindex, char* data, BOOL isDebug) +{ + char magicname[256]; + int ret; + + CHATMAGICFUNC func; + + ret = getStringFromIndexWithDelim( data, " ", 1, magicname, sizeof( magicname)); + if( ret == FALSE)return FALSE; + + func = CHAR_getChatMagicFuncPointer(magicname,isDebug); + + if( func ){ + LogGM( CHAR_getUseName( charaindex), CHAR_getChar( charaindex, CHAR_CDKEY), data, + CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y) ); + func( charaindex, data + strlen( magicname)+1); + return TRUE; + }else{ + return FALSE; + } +} +#endif + +void system_all_talk( char* data ) +{ + if(strlen(data)<1) return; + saacproto_ACSystemAllTalk_send(acfd,data); +} + +void player_all_talk( int charaindex, char* data ) +{ + if(strlen(data)<1) return; + saacproto_ACPlayerAllTalk_send(acfd,getGameservername(),CHAR_getChar(charaindex,CHAR_NAME),data); +} + +#ifdef _RE_GM_COMMAND +int re_gm_command() +{ + FILE* fp; +#ifdef _CRYPTO_DATA + BOOL crypto = FALSE; + fp = fopen( "data/regmcommand.txt.allblues", "r"); + if( fp != NULL ){ + crypto = TRUE; + }else +#endif +{ + fp = fopen("data/regmcommand.txt", "r"); +} + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + int i; + while(1){ + char line[1024], buf[128]; + if (fgets(line, sizeof(line), fp) == NULL)break; +#ifdef _CRYPTO_DATA + if(crypto==TRUE){ + DecryptKey(line); + } +#endif + chop(line); + if(line[0]=='#')continue; + getStringFromIndexWithDelim(line,"=", 1, buf, sizeof(buf)); + for( i=0 ; i +#include +#include +//??? +#include "common.h" +#include "handletime.h" +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "char_event.h" +#include "lssproto_serv.h" +#include "readmap.h" +#include "map_deal.h" +#include "npccreate.h" +#include "encount.h" +#include "npcutil.h" +#include "battle.h" +#include "net.h" +#include "configfile.h" +#include "npc_npcenemy.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +static void CHAR_sendCharaAtWalk( int charaindex, int of, int ox, int oy, int xflg, int yflg ); +static void CHAR_sendCDCharaAtWalk( int charaindex, int of, int ox, int oy, int xflg, int yflg ); + +static CHAR_WALKRET CHAR_walk_turn( int index, int dir ) +{ + int fx,fy,ff; + OBJECT object; + + if(!CHAR_CHECKINDEX( index ))return CHAR_WALKSYSTEMERROR; + CHAR_setInt(index,CHAR_DIR,dir); + fx = CHAR_getInt(index,CHAR_X); + fy = CHAR_getInt(index,CHAR_Y); + ff = CHAR_getInt(index,CHAR_FLOOR); + CHAR_sendWatchEvent( CHAR_getWorkInt(index, CHAR_WORKOBJINDEX), + CHAR_ACTTURN,NULL,0,FALSE); + CHAR_setWorkInt( index, CHAR_WORKACTION, CHAR_ACTTURN); + for( object = MAP_getTopObj(ff,fx,fy) ; object ; + object = NEXT_OBJECT(object ) ){ + typedef void (*POSTOFUNC)(int,int); + POSTOFUNC pfunc=NULL; + int objindex = GET_OBJINDEX(object); + + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + pfunc = (POSTOFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex), + CHAR_POSTOVERFUNC); + break; + case OBJTYPE_ITEM: + pfunc = (POSTOFUNC)ITEM_getFunctionPointer( + OBJECT_getIndex(objindex), + ITEM_POSTOVERFUNC); +#ifdef _ALLBLUES_LUA_1_2 + if( !pfunc ){ + RunItemPostOverEvent(OBJECT_getIndex(objindex), index ); + } +#endif + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + if( pfunc )pfunc( OBJECT_getIndex(objindex),index ); + } + return CHAR_WALKSUCCESSED; +} + + +/*------------------------------------------------------------ + * n mapë˪ + * ¦ + * index int ƽҷ¼̼͵ + * fl int ׷ʧID + * ox int 󡼰ؼx + * oy int 󡼰ؼy + * fx int x + * fy int y + * ߯Ի + * ئ + ------------------------------------------------------------*/ +static void CHAR_sendMapAtWalk( int index, int fl ,int ox ,int oy, + int fx, int fy ) +{ + /* + * ػƥëέ + * NPCֿǩ֣ + */ + int vx,vy; + const int seesiz = MAP_CHAR_DEFAULTSEESIZ; + + if( !CHAR_CHECKINDEX( index ) )return; + + vx = fx - ox; + vy = fy - oy; + + if( ABS(vx) >= seesiz/2 || /* */ + ABS(vy) >= seesiz/2 ){ /* */ + return; + + }else{ + RECT send,get; + char* mapdata; + int oldlux = ox - (int)(seesiz/2); + int oldluy = oy - (int)(seesiz/2); + int absx = ABS(vx); + int absy = ABS(vy); + /* + * 繴嵩ë¼vx , vy 1ʼ̼ + * 羮ئئз + * clipRect w,h 0 ë继 + */ + + /* == 0 ݷ˪ئʻ */ + if( vx != 0 ){ + if( vx > 0 ){ + send.x = oldlux + seesiz; + send.width = absx; + }else if( vx < 0 ){ + send.x = oldlux - absx; + send.width = absx; + } + + if( vy >= 0 ){ + send.y = oldluy; + send.height = seesiz + absy; + }else{ + send.y = oldluy - absy; + send.height = seesiz + absy; + } +{ + int tilesum, objsum,eventsum; + mapdata = MAP_getChecksumFromRECT(fl,&send,&get,&tilesum, &objsum,&eventsum ); + if( mapdata != NULL + && !( get.width == 0 && get.height == 0 ) ){ + int fd = getfdFromCharaIndex( index ); + if( fd != -1 ) + lssproto_MC_send( fd,fl,get.x,get.y, + get.x+get.width, + get.y+get.height, + tilesum, + objsum, + eventsum, + mapdata ); + } +} + } + + /* == 0 ݷ˪ئʻ */ + if( vy != 0 ){ + if( vy > 0 ){ + send.y = oldluy + seesiz; + send.height = absy; + }else{ + send.y = oldluy - absy; + send.height = absy; + } + if( vx >= 0 ){ + send.x = oldlux; + send.width = seesiz + absx; + }else if( vx < 0 ){ + send.x = oldlux - absx; + send.width = seesiz + absx; + } +{ + int tilesum, objsum,eventsum; + mapdata = MAP_getChecksumFromRECT(fl,&send,&get, &tilesum, &objsum,&eventsum); + if( mapdata != NULL + && !( get.width == 0 && get.height == 0 ) ){ + int fd = getfdFromCharaIndex( index ); + if( fd != -1 ) + lssproto_MC_send( fd,fl,get.x,get.y, + get.x+get.width, + get.y+get.height, + tilesum, + objsum, + eventsum, + mapdata ); + + } +} + } + } + +} +static CHAR_WALKRET CHAR_walk_move( int charaindex, int dir ); +/*------------------------------------------------------------ + * £ + * ¦ + * index int ƽҷ¼̼͵ + * dir int + * ߯Ի + * CHAR_WALKRET + ------------------------------------------------------------*/ +static CHAR_WALKRET CHAR_walk_move( int charaindex, int dir ) +{ + int i; + int fx,fy,ff; + int ox,oy,of; + int objbuf[128]; + int objbufindex=0; + int notover=FALSE; + int retvalue=CHAR_WALKSUCCESSED; + + if( !CHAR_CHECKINDEX( charaindex )) return CHAR_WALKSYSTEMERROR; + ox = CHAR_getInt(charaindex,CHAR_X); + oy = CHAR_getInt(charaindex,CHAR_Y); + of = CHAR_getInt(charaindex,CHAR_FLOOR); + CHAR_getCoordinationDir( dir,ox,oy,1,&fx,&fy); + ff = of; + + if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + RECT walkr; + POINT nextp; + int npccreateindex; + npccreateindex = CHAR_getInt( charaindex,CHAR_NPCCREATEINDEX ); + if( CHAR_isInvincibleArea( ff,fx,fy)) { + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKEXTEND; + goto CHAR_AFTERWALK; + } + if( NPC_isBoundarySet( npccreateindex ) && + NPC_createGetRECT( npccreateindex,&walkr ) == TRUE ) + { + nextp.x = fx; + nextp.y = fy; + if( PointInRect( &walkr,&nextp ) == FALSE ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKEXTEND; + goto CHAR_AFTERWALK; + } + }else{ + ; + } + } + + + if( CHAR_getFlg( charaindex, CHAR_ISBIG ) == 1 ){ + static POINT offset[5]={ + { 0,-1}, + {-1, 0}, + { 0, 0}, + { 1, 0}, + { 0, 1}, + }; + int k; + for( k=0 ; k<5; k++ ){ + if( !MAP_walkAble( charaindex, ff, fx+offset[k].x, + fy+offset[k].y )){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + goto CHAR_AFTERWALK; + } + } + + }else{ + if( CHAR_getDX(dir)*CHAR_getDY(dir) == 0 ){ + if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + goto CHAR_AFTERWALK; + } + }else{ + int xflg,yflg; + if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + goto CHAR_AFTERWALK; + } + + xflg = MAP_walkAble( charaindex,of, ox+CHAR_getDX(dir), oy ); + yflg = MAP_walkAble( charaindex,of, ox, oy+CHAR_getDY(dir) ); + + if( !xflg || !yflg ) { + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + goto CHAR_AFTERWALK; + } + } + } + objbufindex = CHAR_getSameCoordinateObjects( objbuf, arraysizeof( objbuf ), ff,fx,fy ); + for( i = 0 ; i < objbufindex ; i ++ ){ + int objindex= objbuf[i]; + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + if(CHAR_CHECKINDEX(OBJECT_getIndex(objindex))==TRUE){ +#ifdef _ALLBLUES_LUA + int meindex=-1, toindex=-1; + if(CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE )!= CHAR_PARTY_CLIENT ){ + if(CHAR_getInt(OBJECT_getIndex(objindex), CHAR_WHICHTYPE)==CHAR_TYPELUANPC){ + meindex = OBJECT_getIndex(objindex); + toindex = charaindex; + } + } + }else if(CHAR_getInt(charaindex, CHAR_WHICHTYPE)==CHAR_TYPELUANPC){ + if(CHAR_getInt(OBJECT_getIndex(objindex), CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE )!= CHAR_PARTY_CLIENT ){ + meindex = charaindex; + toindex = OBJECT_getIndex(objindex); + } + } + } + if(CHAR_CHECKINDEX(meindex) == TRUE || CHAR_CHECKINDEX(toindex) == TRUE){ + if( CHAR_getWorkInt( meindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE + && CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + if(CHAR_getFlg(meindex, CHAR_ISVISIBLE)==TRUE && CHAR_getFlg(meindex, CHAR_ISDIE) == FALSE){ + RunCharOverlapEvent(meindex, toindex); + } + } + } + } +#endif + if( !CHAR_getFlg( OBJECT_getIndex(objindex),CHAR_ISOVERED) ){ + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + break; + } + notover= TRUE; + } + break; + case OBJTYPE_ITEM: + if( !ITEM_getInt( OBJECT_getIndex(objindex), ITEM_ISOVERED ) ) + notover= TRUE; + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + } + if( notover == TRUE ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKHITOBJECT; + }else{ + for( i = 0 ; i < objbufindex ; i ++ ){ + typedef void (*PREOFUNC)(int,int); + PREOFUNC pfunc=NULL; + int objindex=objbuf[i]; + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + pfunc = (PREOFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex), + CHAR_PREOVERFUNC); + break; + case OBJTYPE_ITEM: + pfunc = (PREOFUNC)ITEM_getFunctionPointer( + OBJECT_getIndex(objindex), + ITEM_PREOVERFUNC); +#ifdef _ALLBLUES_LUA_1_2 + if( !pfunc ){ + RunItemPreOverEvent(OBJECT_getIndex(objindex), charaindex ); + } +#endif + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); + } + + CHAR_setInt(charaindex,CHAR_X,fx); + CHAR_setInt(charaindex,CHAR_Y,fy); + CHAR_setInt(charaindex,CHAR_FLOOR,ff); + CHAR_setInt(charaindex,CHAR_DIR,dir); + + { + int objindex; + int ox,oy,of; + objindex = CHAR_getWorkInt( charaindex,CHAR_WORKOBJINDEX ); + of = OBJECT_setFloor(objindex, + CHAR_getInt(charaindex,CHAR_FLOOR)); + ox = OBJECT_setX(objindex,CHAR_getInt(charaindex,CHAR_X)); + oy = OBJECT_setY(objindex,CHAR_getInt(charaindex,CHAR_Y)); + if( !MAP_objmove( objindex, of,ox,oy,ff,fx,fy ) ){ + /* ئƷئ */ + fprint( "ERROR MAP_OBJMOVE objindex=%d(%s)\n",objindex, + CHAR_getUseName( charaindex ) ); + } + } + + CHAR_setInt(charaindex,CHAR_WALKCOUNT, + CHAR_getInt(charaindex,CHAR_WALKCOUNT) + 1 ); + + + for( i = 0 ; i < objbufindex ; i ++ ){ + typedef void (*POSTOFUNC)(int,int); + POSTOFUNC pfunc=NULL; + int objindex=objbuf[i]; + + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + pfunc = (POSTOFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex), + CHAR_POSTOVERFUNC); + break; + case OBJTYPE_ITEM: + pfunc = (POSTOFUNC)ITEM_getFunctionPointer( OBJECT_getIndex(objindex), ITEM_POSTOVERFUNC); +#ifdef _ALLBLUES_LUA_1_2 + if( !pfunc ){ + RunItemPostOverEvent(OBJECT_getIndex(objindex), charaindex ); + } +#endif + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); + } + objbufindex = CHAR_getSameCoordinateObjects(objbuf, arraysizeof(objbuf), of, ox, oy ); + for( i=0 ;i 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT, count -1); + if( count -1 == 0 ) { + CHAR_talkToCli( charaindex, -1, "ߵЧѵ", CHAR_COLORWHITE); + } + } + par = ENCOUNT_getEncountPercentMin( charaindex, of,ox,oy); + if( par != -1 ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN) != par ){ + flg = TRUE; + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, par); + } + } + + par = ENCOUNT_getEncountPercentMax( charaindex, of,ox,oy); + if( par != -1 ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX) != par ){ + flg = TRUE; + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, par); + } + } + // Arminius 7.12 login announce + /* + { + int enfd = getfdFromCharaIndex( charaindex ); + if (CONNECT_get_announced(enfd)==0) { + // Robin 0720 + //AnnounceToPlayer(charaindex); + AnnounceToPlayerWN( enfd ); + CONNECT_set_announced(enfd,1); + } + } + */ + // Arminius 6.22 check Encounter + // Nuke 0622: Provide No Enemy function + { + int enfd = getfdFromCharaIndex( charaindex ); + int eqen = getEqNoenemy( enfd ); // Arminius 7.2: Ra's amulet + int noen = getNoenemy(enfd); + + // Arminius 7.31 cursed stone + if (getStayEncount(enfd)>0) { + clearStayEncount(enfd); + } + //print("\n enfd=%d,eqen=%d,noen=%d", enfd, eqen, noen); + + // Arminius 7.2 Ra's amulet + if (eqen>=200) { + noen=1; + } else if (eqen>=120) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)||(ff==500)) noen=1; + } else if (eqen>=80) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)) noen=1; + } else if (eqen>=40) { + if ((ff==100)||(ff==200)) noen=1; + } + + + //print("\n noen=%d", noen); + if (noen==0) { + int maxep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX); + int minep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN); + int cep = CONNECT_get_CEP(enfd); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + int temp=0; + int p_cep = CHAR_getWorkInt(charaindex, CHAR_ENCOUNT_FIX); + if( p_cep != 0 ){ + if( CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM) < (int)time(NULL) ){ + CHAR_talkToCli( charaindex, -1, "Чý", CHAR_COLORYELLOW); + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, 0); + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_NUM, 0); + } + temp = cep * (100 + p_cep ) / 100; + }else{ + temp = cep; + } +#endif + + if (cepmaxep) cep=maxep; + if (CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)==BATTLE_CHARMODE_NONE) { + int entflag=1; + { + int objindex,index; + OBJECT obj; + for ( obj = MAP_getTopObj( ff, fx, fy); obj; obj = NEXT_OBJECT( obj)) { + objindex = GET_OBJINDEX( obj); + if (OBJECT_getType( objindex) == OBJTYPE_CHARA) { + int etype; + index = OBJECT_getIndex( objindex); + if (!CHAR_CHECKINDEX( index)) continue; + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPENPCENEMY && + CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE) == CHAR_EVENT_ENEMY ) { + CHAR_setInt( charaindex, CHAR_X, ox); + CHAR_setInt( charaindex, CHAR_Y, oy); + lssproto_XYD_send( getfdFromCharaIndex(charaindex), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), + CHAR_getInt( charaindex, CHAR_DIR ) ); + break; + } + etype = CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE); + if (etype!=CHAR_EVENT_NONE) { + if (etype==CHAR_EVENT_WARP) entflag=0; + } + } + } + } + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#ifdef _ENEMY_ACTION + if( rand()%(120*getEnemyAction()) < temp ){ +#else + if( rand()%120 < temp ){ +#endif +#else +#ifdef _ENEMY_ACTION + if( rand()%(120*getEnemyAction()) < cep ){ +#else + if (rand()%120 0 ) { + int Rnum=0; + int RandEnemy = getEqRandenemy( enfd); + Rnum = RAND(0,100); + if( Rnum > RandEnemy ) { +#endif + //encounter!! + cep = minep; + lssproto_EN_recv(enfd, + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y)); +#ifdef _Item_MoonAct + } + }else{ + cep = minep; + lssproto_EN_recv(enfd, + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y)); + } +#endif + } + } else { + if (cep= CHAR_TYPELUANPC +#endif + ) { + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, -1 ); + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + CHAR_sendCharaAtWalk( charaindex, of,ox,oy,CHAR_getDX(dir), CHAR_getDY(dir)); + } + { + int opt[2] = { ox, oy}; + CHAR_sendWatchEvent( CHAR_getWorkInt(charaindex, + CHAR_WORKOBJINDEX), + CHAR_ACTWALK,opt,2,TRUE ); + } + } + if( retvalue == CHAR_WALKSUCCESSED ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + CHAR_sendCDCharaAtWalk( charaindex, of,ox,oy, + CHAR_getDX(dir), CHAR_getDY(dir)); + } + } + return retvalue; +} + +/*------------------------------------------------------------ + * ƽҷ»ʣ + * ¦ + * index int Charƥindex + * dir int + * mode int 0ئʣ1ئ  + * ߯Ի + * CHAR_WALKRET + ------------------------------------------------------------*/ +CHAR_WALKRET CHAR_walk( int index, int dir, int mode) +{ + CHAR_WALKRET ret; + BOOL (*prewalk)(int , int* , int* ); + void (*postwalk)(int); + if( !CHAR_CHECKINDEX( index ) )return CHAR_WALKSYSTEMERROR; + + if( CHAR_getFlg(index,CHAR_ISDIE) ) return CHAR_WALKDIE; + + VALIDATEDIR(dir); + prewalk = (BOOL(*)(int,int*,int*)) + CHAR_getFunctionPointer(index, CHAR_WALKPREFUNC); + + if( prewalk != NULL ) + if( prewalk(index,&dir,&mode) == FALSE ) { + return CHAR_WALKPREWALK; + } + + if( mode == 0 ) + ret = CHAR_walk_move( index, dir ); + else + ret = CHAR_walk_turn( index, dir ); + postwalk = (void(*)(int)) + CHAR_getFunctionPointer(index,CHAR_WALKPOSTFUNC); + + if( postwalk != NULL ) + postwalk(index); + + return ret; +} + +#ifdef _CAX_LNS_NLGSUOXU +CHAR_WALKRET CHAR_walk_jjc( int index, int floor, int ox, int oy, int dir) +{ + CHAR_WALKRET ret; + int mode; + BOOL (*prewalk)(int , int* , int* ); + void (*postwalk)(int); + if( !CHAR_CHECKINDEX( index ) )return CHAR_WALKSYSTEMERROR; + + if( CHAR_getFlg(index,CHAR_ISDIE) ) return CHAR_WALKDIE; + + VALIDATEDIR(dir); + prewalk = (BOOL(*)(int,int*,int*)) + CHAR_getFunctionPointer(index, CHAR_WALKPREFUNC); + + if( prewalk != NULL ) + if( prewalk(index,&dir,&mode) == FALSE ) { + return CHAR_WALKPREWALK; + } + + ret = CHAR_walk_jc( index, floor, ox, oy, dir ); + + postwalk = (void(*)(int)) + CHAR_getFunctionPointer(index,CHAR_WALKPOSTFUNC); + + if( postwalk != NULL ) + postwalk(index); + + return ret; +} +#endif +/*------------------------------------------------------------ + * ھ + * ¦ + * index int ƽҷ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_walkcall( int index ) +{ + char tmp[128]; + int dir,mode; + int ret; + POINT start,end; + + if( !CHAR_CHECKINDEX( index ) ) return; + + strcpysafe( tmp ,sizeof(tmp), + CHAR_getWorkChar(index,CHAR_WORKWALKARRAY)); + + CHAR_ctodirmode( tmp[0], &dir ,&mode ); + /* ئëʢƻ + * ʼ 󡼰ë һ ¿ + */ + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { + end.x = CHAR_getInt( index, CHAR_X); + end.y = CHAR_getInt( index, CHAR_Y); + } + } + + /* */ + ret = CHAR_walk( index , dir ,mode ); + + if( mode == 0 && ret == CHAR_WALKSUCCESSED ) { + /* лئëھ */ + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + + + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_LEADER ) { + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( index, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(toindex) ) { + int parent_dir; + /* Ҽ ʼ󡼰 ëƻ */ + /* */ + start.x = CHAR_getInt( toindex, CHAR_X); + start.y = CHAR_getInt( toindex, CHAR_Y); + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + /* ·ūë ¿б + * ݼҷ󡼰Ҽ ëܰ + */ + end = start; + if( parent_dir != -1 ) { + CHAR_walk( toindex, parent_dir, 0); + +#if 1 + // Robin 0702 petFollow + if( CHAR_getWorkInt( toindex, CHAR_WORKPETFOLLOW) != -1 ) { + int petindex = CHAR_getWorkInt( toindex, CHAR_WORKPETFOLLOW); + if( CHAR_CHECKINDEX(petindex) ) { + int parent_dir; + /* Ҽ ʼ󡼰 ëƻ */ + /* */ + end.x = CHAR_getInt( toindex, CHAR_X); + end.y = CHAR_getInt( toindex, CHAR_Y); + start.x = CHAR_getInt( petindex, CHAR_X); + start.y = CHAR_getInt( petindex, CHAR_Y); + + if( end.x > start.x ) end.x --; + else if( end.x < start.x ) end.x ++; + if( end.y > start.y ) end.y --; + else if( end.y < start.y ) end.y ++; + + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + if( parent_dir != -1 ) { + if( CHAR_walk( petindex, parent_dir, 0) == CHAR_WALKSUCCESSED ) + { + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, + 1 + CHAR_getWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT) ); + if( CHAR_getWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT) > 1000 ){ + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0); + CHAR_pickupFollowPet( toindex, petindex ); + } + + } + } + }else { + CHAR_setWorkInt( toindex, CHAR_WORKPETFOLLOW, -1); + } + + } + +#endif + + } + } + else { + /* ئ */ + CHAR_setWorkInt( index, i+CHAR_WORKPARTYINDEX1, -1); + } + } + } +#if 1 + // Robin 0702 petFollow + if( CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW) != -1 ) { + int petindex = CHAR_getWorkInt( index, CHAR_WORKPETFOLLOW); + if( CHAR_CHECKINDEX(petindex) ) { + int parent_dir; + /* Ҽ ʼ󡼰 ëƻ */ + /* */ + end.x = CHAR_getInt( index, CHAR_X); + end.y = CHAR_getInt( index, CHAR_Y); + start.x = CHAR_getInt( petindex, CHAR_X); + start.y = CHAR_getInt( petindex, CHAR_Y); + + if( end.x > start.x ) end.x --; + else if( end.x < start.x ) end.x ++; + if( end.y > start.y ) end.y --; + else if( end.y < start.y ) end.y ++; + + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + + //if( (end.x == start.x) && (end.x == start.y) ) + // parent_dir = -1; + + /* ·ūë ¿б + * ݼҷ󡼰Ҽ ëܰ + */ + //print(" pdir:%d sx:%d sy:%d ex:%d ey:%d ", + // parent_dir, start.x, start.y, end.x, end.y ); + //end = start; + + if( parent_dir != -1 ) { + if( CHAR_walk( petindex, parent_dir, 0) == CHAR_WALKSUCCESSED ) + { + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, + 1 + CHAR_getWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT) ); + if( CHAR_getWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT) > 1000 ) + { + /* + CHAR_setInt( petindex, CHAR_VARIABLEAI, + 200 + CHAR_getInt( petindex, CHAR_VARIABLEAI) ); + */ + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0); + CHAR_pickupFollowPet( index, petindex ); + } + } + } + } + else { + /* ئ */ + CHAR_setWorkInt( index, CHAR_WORKPETFOLLOW, -1); + } + + } + +#endif + + } + } + + /* 99/03/09 By Kawata */ + /* walkWALKARRAYʧľؤ¼ƥ + * Ի ƻ + */ + strcpysafe( tmp ,sizeof(tmp), + CHAR_getWorkChar(index,CHAR_WORKWALKARRAY)); + if( strlen( tmp) > 0 ) { + CHAR_setWorkChar(index,CHAR_WORKWALKARRAY,&tmp[1]); + } + + /* ë׻ */ + CHAR_setWorkInt( index, CHAR_WORKWALKSTARTSEC , NowTime.tv_sec ); + CHAR_setWorkInt( index, CHAR_WORKWALKSTARTMSEC , NowTime.tv_usec ); +} + + + +/*------------------------------------------------------------ + * 炙ë £ + * ¦ + * index int ƽҷ ƥ̼͵ + * dir char* ٯ + * id int ID + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_walk_start(int index, int x, int y, char* dir, BOOL mapsendmode ) +{ + + if( !CHAR_CHECKINDEX( index ) )return; + + // Nuke 08/27: Stop wap + /* + { + int ox, oy; + const int seesiz = MAP_CHAR_DEFAULTSEESIZ; + ox = CHAR_getInt(index,CHAR_X); + oy = CHAR_getInt(index,CHAR_Y); + if ( ABS(x - ox) > seesiz || ABS(y - oy) > seesiz ) { + CHAR_talkToCli(index, -1, "ߡ", CHAR_COLORYELLOW); + CONNECT_setCloseRequest_debug(getfdFromCharaIndex(index) , 1); + return; + } + } + */ + + + + if( CHAR_getFlg( index,CHAR_ISDIE ) )return; + CHAR_setWorkChar( index,CHAR_WORKWALKARRAY, dir ); + CHAR_setWorkInt( index, CHAR_WORKWALKSTARTSEC , NowTime.tv_sec ); + CHAR_setWorkInt( index, CHAR_WORKWALKSTARTMSEC , NowTime.tv_usec ); + + CHAR_setMyPosition( index, x, y, FALSE); + if( mapsendmode ) { + int ox,oy; + char buf[64]; + int len; + int i; + strcpysafe( buf, sizeof(buf), + CHAR_getWorkChar( index, CHAR_WORKWALKARRAY)); + + len = strlen( buf ); + ox = CHAR_getInt(index,CHAR_X); + oy = CHAR_getInt(index,CHAR_Y); + + for( i = 0; i < len; i ++ ) { + int dir,mode; + int fx,fy; + CHAR_ctodirmode( buf[i], &dir ,&mode ); + if( mode == 0 ) { + CHAR_getCoordinationDir( dir,ox,oy,1,&fx,&fy); + ox = fx; + oy = fy; + } + } + + CHAR_sendMapAtWalk(index, + CHAR_getInt( index, CHAR_FLOOR), + CHAR_getInt( index, CHAR_X), + CHAR_getInt( index, CHAR_Y), + ox,oy); + } + + if( strlen( dir ) >= 1 ) CHAR_walkcall( index ); +} +/*------------------------------------------------------------ + * 弰 + * ¦ + * index int ƽҷ ƥ̼͵ + * dir char* ٯ + * id int ID + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void CHAR_walk_init( int fd, int x, int y, char *direction, BOOL mapsendmode) +{ + if( strlen( direction) > 32) { + print( "walkarray length over\n"); + return; + } + // Nuke +1 : For acceleration avoidance + if (checkWalkTime(fd) < 0) { + CONNECT_setCloseRequest(fd,1); + print("Walk drop "); + return; + } + + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + return ; + } + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKPARTYMODE ) != CHAR_PARTY_CLIENT ){ + CHAR_walk_start( CONNECT_getCharaindex(fd), x, y, direction, mapsendmode ); + }else { + int dir, mode; + CHAR_ctodirmode( direction[0], &dir ,&mode ); + if( mode == 0 ) { + //print( "ҲҲǵҡ\n"); + }else { + CHAR_walk_start( CONNECT_getCharaindex(fd), + x,y,direction, FALSE ); + } + } +} + +void CHAR_sendCharaAtWalk( int charaindex, int of,int ox,int oy,int xflg, int yflg ) +{ + int fd = -1; + int i,j,fl, x, y; + char introduction[512]; + //char c_msg[1024*96]; + char c_msg[5][1024*6]; + int strpos[5] = {0,0,0,0,0}; + int seesiz = CHAR_DEFAULTSEESIZ/2; + char cabuf[128]; + char myintroduction[512]; + int whichtype; + + whichtype = CHAR_getInt( charaindex, CHAR_WHICHTYPE); + if( whichtype == CHAR_TYPEPLAYER) { + fd = getfdFromCharaIndex( charaindex ); + if( fd == -1 )return; + } + if( xflg > 1 || xflg < -1 ) { + print( "%s:%d: arg err[xflg]\n",__FILE__, __LINE__); + return; + } + if( yflg > 1 || yflg < -1 ) { + print( "%s:%d: arg err[yflg]\n",__FILE__, __LINE__); + return; + } + fl = CHAR_getInt( charaindex, CHAR_FLOOR); + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + if( of != fl || ABS(x - ox) > seesiz/2 || ABS(y - oy) > seesiz/2 ) + return; + memset(c_msg[0], 0, sizeof(c_msg[0])); + memset(c_msg[1], 0, sizeof(c_msg[1])); + memset(c_msg[2], 0, sizeof(c_msg[2])); + memset(c_msg[3], 0, sizeof(c_msg[3])); + memset(c_msg[4], 0, sizeof(c_msg[4])); + c_msg[0][0] = '\0'; + c_msg[1][0] = '\0'; + c_msg[2][0] = '\0'; + c_msg[3][0] = '\0'; + c_msg[4][0] = '\0'; + if( !CHAR_makeObjectCString( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), myintroduction, sizeof( myintroduction))){ + myintroduction[0] = '\0'; + } + if( xflg != 0) { + i = x + seesiz * xflg; + for( j = y-seesiz ; j <= y+seesiz ;j ++ ) { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; object ; object = NEXT_OBJECT(object ) ){ + int introlen; + int objindex = GET_OBJINDEX(object); + int c_index = OBJECT_getIndex( objindex); + + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && !CHAR_getFlg(OBJECT_getIndex(objindex), CHAR_ISVISIBLE) ){ + continue; + } + if( strlen( myintroduction) != 0 ) { + if( OBJECT_getType( objindex) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + int tofd = getfdFromCharaIndex( c_index ); + CDsend( tofd); + lssproto_C_send( tofd, myintroduction); + } + } + } + if( whichtype == CHAR_TYPEPLAYER) { + /* Make C*/ + if( CHAR_makeObjectCString( objindex, introduction, sizeof( introduction))){ + introlen = strlen( introduction); + introduction[introlen] = ','; + introduction[introlen+1] = '\0'; + //strcpysafe( &c_msg[strpos], sizeof( c_msg) - strpos, introduction); + //strpos += strlen( introduction); + if(strpos[0]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[0][strpos[0]], sizeof( c_msg[0]) - strpos[0], + introduction); + strpos[0] += strlen( introduction); + }else if(strpos[1]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[1][strpos[1]], sizeof( c_msg[0]) - strpos[1], + introduction); + strpos[1] += strlen( introduction); + }else if(strpos[2]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[2][strpos[2]], sizeof( c_msg[2]) - strpos[2], + introduction); + strpos[2] += strlen( introduction); + }else if(strpos[3]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[3][strpos[3]], sizeof( c_msg[3]) - strpos[3], + introduction); + strpos[3] += strlen( introduction); + }else if(strpos[4]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[4][strpos[4]], sizeof( c_msg[4]) - strpos[4], + introduction); + strpos[4] += strlen( introduction); + } + } + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTLEADER,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + int tofd = getfdFromCharaIndex( c_index ); + if( tofd != -1 ) { + if( CHAR_makeCAOPT1String( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + cabuf, sizeof( cabuf), CHAR_ACTLEADER,1 )){ + CONNECT_appendCAbuf( tofd,cabuf,strlen(cabuf)); + } + } + } + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + if( CHAR_getWorkInt( c_index, CHAR_WORKBATTLEWATCH) == TRUE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTBATTLEWATCH, 1)){ + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + } + }else { + int battleno = CHAR_getWorkInt( c_index, CHAR_WORKBATTLEINDEX); + int sideno = CHAR_getWorkInt( c_index,CHAR_WORKBATTLESIDE); + int helpno; + if( !BATTLE_CHECKINDEX( battleno) ) { + //print(" %s[%d]: BATTLE_CHECKINDEX( %d) err!!\n", __FILE__, __LINE__, battleno); + }else { + helpno = (BattleArray[ battleno].Side[ sideno].flg & BSIDE_FLG_HELP_OK) ? TRUE:FALSE; + /* HelpNo = 1 */ + if( CHAR_makeCAOPT3String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTBATTLE, battleno,sideno,helpno )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + } + } + if( ( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER || + CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) && + CHAR_getWorkInt( c_index, CHAR_WORKACTION ) != -1 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#ifdef _ADD_ACTION + else if( CHAR_getWorkInt( c_index, CHAR_WORKACTION ) > 0 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif +#ifdef _STREET_VENDOR + if(CHAR_getInt(c_index,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && + CHAR_getWorkInt(c_index,CHAR_WORKSTREETVENDOR) == 1 && + CHAR_getWorkInt(c_index,CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(CHAR_makeCAOPTString(objindex,cabuf,sizeof(cabuf), + CHAR_STREETVENDOR_OPEN,CHAR_getWorkChar(c_index,CHAR_STREETVENDOR_NAME))){ + CONNECT_appendCAbuf(fd,cabuf,strlen(cabuf)); + } + } +#endif + +#ifdef _ANGEL_SUMMON + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKANGELMODE ) == TRUE ){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), CHAR_ACTANGEL,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif + } + } + } + } + } + if( yflg != 0) { + j = y + seesiz * yflg; + for( i = x-seesiz ; i <= x+seesiz ;i ++ ) { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; object ; object = NEXT_OBJECT(object ) ){ + int introlen; + int objindex = GET_OBJINDEX(object); + int c_index = OBJECT_getIndex( objindex); + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && + !CHAR_getFlg(OBJECT_getIndex(objindex), CHAR_ISVISIBLE) ){ + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + } + continue; + } + if( strlen( myintroduction) != 0 ) { + if( OBJECT_getType( objindex) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + int tofd = getfdFromCharaIndex( c_index ); + CDsend( tofd); + lssproto_C_send( tofd, myintroduction); + } + } + } + if( whichtype == CHAR_TYPEPLAYER ) { + /* Make C*/ + if( CHAR_makeObjectCString( objindex, introduction, sizeof( introduction))){ + introlen = strlen( introduction); + introduction[introlen] = ','; + introduction[introlen+1] = '\0'; + //strcpysafe( &c_msg[strpos], sizeof( c_msg) - strpos, introduction); + //strpos += strlen( introduction); + if(strpos[0]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[0][strpos[0]], sizeof( c_msg[0]) - strpos[0], + introduction); + strpos[0] += strlen( introduction); + }else if(strpos[1]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[1][strpos[1]], sizeof( c_msg[0]) - strpos[1], + introduction); + strpos[1] += strlen( introduction); + }else if(strpos[2]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[2][strpos[2]], sizeof( c_msg[2]) - strpos[2], + introduction); + strpos[2] += strlen( introduction); + }else if(strpos[3]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[3][strpos[3]], sizeof( c_msg[3]) - strpos[3], + introduction); + strpos[3] += strlen( introduction); + }else if(strpos[4]+strlen( introduction)<=5120){ + strcpysafe( &c_msg[4][strpos[4]], sizeof( c_msg[4]) - strpos[4], + introduction); + strpos[4] += strlen( introduction); + } + } + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTLEADER,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE)== BATTLE_CHARMODE_NONE){ + int tofd = getfdFromCharaIndex( c_index ); + if( tofd != -1 ) { + if( CHAR_makeCAOPT1String( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + cabuf, sizeof( cabuf), CHAR_ACTLEADER,1 )){ + CONNECT_appendCAbuf( tofd,cabuf,strlen(cabuf)); + } + } + } + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + if( CHAR_getWorkInt( c_index, CHAR_WORKBATTLEWATCH) == TRUE ) { + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTBATTLEWATCH,1)){ + CONNECT_appendCAbuf( fd, cabuf, strlen( cabuf)); + } + }else { + int battleno = CHAR_getWorkInt( c_index, CHAR_WORKBATTLEINDEX); + int sideno = CHAR_getWorkInt( c_index, CHAR_WORKBATTLESIDE); + int helpno = (BattleArray[CHAR_getWorkInt( c_index, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( c_index, + CHAR_WORKBATTLESIDE)].flg & BSIDE_FLG_HELP_OK) ? TRUE:FALSE; + + if( CHAR_makeCAOPT3String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTBATTLE, battleno,sideno,helpno )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } + } + if( ( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER || + CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) && + CHAR_getWorkInt( c_index, CHAR_WORKACTION ) != -1 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#ifdef _ADD_ACTION + else if( CHAR_getWorkInt( c_index, CHAR_WORKACTION ) > 0 ) { + if( CHAR_makeCADefaultString( objindex, cabuf, sizeof( cabuf), + CHAR_getWorkInt( c_index, CHAR_WORKACTION))){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif +#ifdef _STREET_VENDOR + if(CHAR_getInt(c_index,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && + CHAR_getWorkInt(c_index,CHAR_WORKSTREETVENDOR) == 1 && + CHAR_getWorkInt(c_index,CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(CHAR_makeCAOPTString(objindex,cabuf,sizeof(cabuf), + CHAR_STREETVENDOR_OPEN,CHAR_getWorkChar(c_index,CHAR_STREETVENDOR_NAME))){ + CONNECT_appendCAbuf(fd,cabuf,strlen(cabuf)); + } + } +#endif + +#ifdef _ANGEL_SUMMON + if( CHAR_getInt( c_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( c_index, CHAR_WORKANGELMODE ) == TRUE ){ + if( CHAR_makeCAOPT1String( objindex, cabuf, sizeof( cabuf), + CHAR_ACTANGEL,1 )){ + CONNECT_appendCAbuf( fd,cabuf,strlen(cabuf)); + } + } +#endif + + } + } + } + } + } + dchop( c_msg[0], "," ); + dchop( c_msg[1], "," ); + dchop( c_msg[2], "," ); + dchop( c_msg[3], "," ); + dchop( c_msg[4], "," ); + if( strlen( c_msg[0]) == 0 ) return; + //print("\nc_msg[0]=%s,strpos[0]=%d\n",c_msg[0],strpos[0]); + lssproto_C_send( fd, c_msg[0]); + if(strlen( c_msg[1]) > 0){ + //print("\nc_msg[1]=%s,strpos[1]=%d\n",c_msg[1],strpos[1]); + lssproto_C_send( fd, c_msg[1]); + } + if(strlen( c_msg[2]) > 0){ + //print("\nc_msg[2]=%s,strpos[2]=%d\n",c_msg[2],strpos[2]); + lssproto_C_send( fd, c_msg[2]); + } + if(strlen( c_msg[3]) > 0){ + //print("\nc_msg[3]=%s,strpos[3]=%d\n",c_msg[3],strpos[3]); + lssproto_C_send( fd, c_msg[3]); + } + if(strlen( c_msg[4]) > 0){ + //print("\nc_msg[4]=%s,strpos[4]=%d\n",c_msg[4],strpos[4]); + lssproto_C_send( fd, c_msg[4]); + }//޸˶ر +} + +static void CHAR_sendCDCharaAtWalk( int charaindex, int of, int ox, int oy, int xflg, int yflg ){ + int i,j,fl, x, y; + int seesiz = CHAR_DEFAULTSEESIZ/2; + int fd, tofd; + if( xflg > 1 || xflg < -1 ) { + print( "%s:%d: arg err[xflg]\n",__FILE__, __LINE__); + return; + } + if( yflg > 1 || yflg < -1 ) { + print( "%s:%d: arg err[yflg]\n",__FILE__, __LINE__); + return; + } + fl = CHAR_getInt( charaindex, CHAR_FLOOR); + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + if( of != fl || /* ׷ʧਵ */ + ABS(x - ox) > seesiz/2 || /* */ + ABS(y - oy) > seesiz/2 ) /* */ + return; + + fd = getfdFromCharaIndex( charaindex ); + if( xflg != 0) { + i = x + (seesiz * xflg + xflg)*-1; + for( j = y-seesiz +(yflg*-1) ; j <= y+seesiz +(yflg*-1) ;j ++ ) { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int objindex = GET_OBJINDEX(object); + char buf[64]; + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && + !CHAR_getFlg(OBJECT_getIndex(objindex), CHAR_ISVISIBLE) ){ + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + } + continue; + } + if( fd != -1) { + cnv10to62( objindex, buf, sizeof( buf)); + CONNECT_appendCDbuf( fd, buf, strlen( buf)); + } + if( OBJECT_getType( objindex) == OBJTYPE_CHARA) { + int tocharaindex = OBJECT_getIndex( objindex); + if( CHAR_getInt( tocharaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE ) { + tofd = getfdFromCharaIndex( tocharaindex ); + if( tofd != -1 ) { + cnv10to62( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), + buf, sizeof( buf)); + CONNECT_appendCDbuf( tofd, buf, strlen( buf)); + CAsend( tofd); + CDsend( tofd); + } + } + } + } + } + } + } + if( yflg != 0) { + j = y + (seesiz * yflg + yflg)*-1; + for( i = x-seesiz + (xflg*-1) ; i <= x+seesiz + (xflg*-1) ;i ++ ) { + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; object ; object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + char buf[64]; + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && + !CHAR_getFlg(OBJECT_getIndex(objindex), CHAR_ISVISIBLE) ){ + continue; + } + if( fd != -1 ) { + cnv10to62( objindex, buf, sizeof( buf)); + CONNECT_appendCDbuf( fd, buf, strlen( buf)); + } + if( OBJECT_getType( objindex) == OBJTYPE_CHARA) { + int tocharaindex = OBJECT_getIndex( objindex); + if( CHAR_getInt( tocharaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE ){ + tofd = getfdFromCharaIndex( tocharaindex ); + if( tofd != -1 ) { + cnv10to62( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX), buf, sizeof( buf)); + CONNECT_appendCDbuf( tofd, buf, strlen( buf)); + CAsend( tofd); + CDsend( tofd); + } + } + } + } + } + } + } + CDsend( fd); +} + +void CHAR_ctodirmode(char moji , int* dir , int* mode) +{ + *mode = 1; + if( 'a' <= moji && moji <= 'h' )*mode = 0; + + *dir = tolower(moji) - 'a'; +} + +#ifdef _CAX_LNS_NLGSUOXU +CHAR_WALKRET CHAR_walk_jc( int charaindex, int of, int ox, int oy, int dir ) +{ + int i; + int fx,fy,ff; + int objbuf[128]; + int objbufindex=0; + int notover=FALSE; + int retvalue=CHAR_WALKSUCCESSED; + + if( !CHAR_CHECKINDEX( charaindex )) return CHAR_WALKSYSTEMERROR; + + CHAR_getCoordinationDir( dir,ox,oy,1,&fx,&fy); + ff = of; + + if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) == CHAR_TYPEENEMY ){ + RECT walkr; + POINT nextp; + int npccreateindex; + npccreateindex = CHAR_getInt( charaindex,CHAR_NPCCREATEINDEX ); + if( CHAR_isInvincibleArea( ff,fx,fy)) { + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKEXTEND; + return retvalue; + } + if( NPC_isBoundarySet( npccreateindex ) && + NPC_createGetRECT( npccreateindex,&walkr ) == TRUE ) + { + nextp.x = fx; + nextp.y = fy; + if( PointInRect( &walkr,&nextp ) == FALSE ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKEXTEND; + return retvalue; + } + }else{ + ; + } + } + + + if( CHAR_getFlg( charaindex, CHAR_ISBIG ) == 1 ){ + static POINT offset[5]={ + { 0,-1}, + {-1, 0}, + { 0, 0}, + { 1, 0}, + { 0, 1}, + }; + int k; + for( k=0 ; k<5; k++ ){ + if( !MAP_walkAble( charaindex, ff, fx+offset[k].x, + fy+offset[k].y )){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + return retvalue; + } + } + + }else{ + if( CHAR_getDX(dir)*CHAR_getDY(dir) == 0 ){ + if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + return retvalue; + } + }else{ + int xflg,yflg; + if( !MAP_walkAble( charaindex,ff, fx, fy ) ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + return retvalue; + } + + xflg = MAP_walkAble( charaindex,of, ox+CHAR_getDX(dir), oy ); + yflg = MAP_walkAble( charaindex,of, ox, oy+CHAR_getDY(dir) ); + + if( !xflg || !yflg ) { + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALK1357; + return retvalue; + } + } + } + objbufindex = CHAR_getSameCoordinateObjects( objbuf, arraysizeof( objbuf ), ff,fx,fy ); + for( i = 0 ; i < objbufindex ; i ++ ){ + int objindex= objbuf[i]; + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + if( !CHAR_getFlg( OBJECT_getIndex(objindex),CHAR_ISOVERED) ){ + if(!CHAR_CHECKINDEX(OBJECT_getIndex(objindex))){ + printf("Զɾһ"); + endObjectOne(objindex); + break; + } + notover= TRUE; + } + break; + case OBJTYPE_ITEM: + if( !ITEM_getInt( OBJECT_getIndex(objindex), ITEM_ISOVERED ) ) + notover= TRUE; + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + } + if( notover == TRUE ){ + CHAR_setInt(charaindex,CHAR_DIR,dir); + retvalue = CHAR_WALKHITOBJECT; + return retvalue; + }else{ + for( i = 0 ; i < objbufindex ; i ++ ){ + typedef void (*PREOFUNC)(int,int); + PREOFUNC pfunc=NULL; + int objindex=objbuf[i]; + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + pfunc = (PREOFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex), + CHAR_PREOVERFUNC); + break; + case OBJTYPE_ITEM: + pfunc = (PREOFUNC)ITEM_getFunctionPointer( + OBJECT_getIndex(objindex), + ITEM_PREOVERFUNC); + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); + } + + CHAR_setInt(charaindex,CHAR_X,fx); + CHAR_setInt(charaindex,CHAR_Y,fy); + CHAR_setInt(charaindex,CHAR_FLOOR,ff); + CHAR_setInt(charaindex,CHAR_DIR,dir); + + { + int objindex; + int ox,oy,of; + objindex = CHAR_getWorkInt( charaindex,CHAR_WORKOBJINDEX ); + of = OBJECT_setFloor(objindex, + CHAR_getInt(charaindex,CHAR_FLOOR)); + ox = OBJECT_setX(objindex,CHAR_getInt(charaindex,CHAR_X)); + oy = OBJECT_setY(objindex,CHAR_getInt(charaindex,CHAR_Y)); + if( !MAP_objmove( objindex, of,ox,oy,ff,fx,fy ) ){ + /* ئƷئ */ + fprint( "ERROR MAP_OBJMOVE objindex=%d(%s)\n",objindex, + CHAR_getUseName( charaindex ) ); + } + } + + CHAR_setInt(charaindex,CHAR_WALKCOUNT, + CHAR_getInt(charaindex,CHAR_WALKCOUNT) + 1 ); + + + for( i = 0 ; i < objbufindex ; i ++ ){ + typedef void (*POSTOFUNC)(int,int); + POSTOFUNC pfunc=NULL; + int objindex=objbuf[i]; + + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_CHARA: + pfunc = (POSTOFUNC)CHAR_getFunctionPointer( + OBJECT_getIndex(objindex), + CHAR_POSTOVERFUNC); + break; + case OBJTYPE_ITEM: + pfunc = (POSTOFUNC)ITEM_getFunctionPointer( OBJECT_getIndex(objindex), ITEM_POSTOVERFUNC); + break; + case OBJTYPE_GOLD: + break; + default: + break; + } + if( pfunc )pfunc( OBJECT_getIndex(objindex),charaindex ); + } + objbufindex = CHAR_getSameCoordinateObjects(objbuf, arraysizeof(objbuf), of, ox, oy ); + for( i=0 ;i 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT, count -1); + if( count -1 == 0 ) { + //CHAR_talkToCli( charaindex, -1, "ߵЧѵ", CHAR_COLORWHITE); + } + } + par = ENCOUNT_getEncountPercentMin( charaindex, of,ox,oy); + if( par != -1 ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN) != par ){ + flg = TRUE; + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, par); + } + } + + par = ENCOUNT_getEncountPercentMax( charaindex, of,ox,oy); + if( par != -1 ) { + if( CHAR_getWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX) != par ){ + flg = TRUE; + CHAR_setWorkInt( charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, par); + } + } + // Arminius 7.12 login announce + /* + { + int enfd = getfdFromCharaIndex( charaindex ); + if (CONNECT_get_announced(enfd)==0) { + // Robin 0720 + //AnnounceToPlayer(charaindex); + AnnounceToPlayerWN( enfd ); + CONNECT_set_announced(enfd,1); + } + } + */ + // Arminius 6.22 check Encounter + // Nuke 0622: Provide No Enemy function + { + int enfd = getfdFromCharaIndex( charaindex ); + int eqen = getEqNoenemy( enfd ); // Arminius 7.2: Ra's amulet + int noen = getNoenemy(enfd); + + // Arminius 7.31 cursed stone + if (getStayEncount(enfd)>0) { + clearStayEncount(enfd); + } + //print("\n enfd=%d,eqen=%d,noen=%d", enfd, eqen, noen); + + // Arminius 7.2 Ra's amulet + if (eqen>=200) { + noen=1; + } else if (eqen>=120) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)||(ff==500)) noen=1; + } else if (eqen>=80) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)) noen=1; + } else if (eqen>=40) { + if ((ff==100)||(ff==200)) noen=1; + } + + + //print("\n noen=%d", noen); + if (noen==0) { + int maxep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MAX); + int minep = CHAR_getWorkInt(charaindex, CHAR_WORKENCOUNTPROBABILITY_MIN); + int cep = CONNECT_get_CEP(enfd); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + int temp=0; + int p_cep = CHAR_getWorkInt(charaindex, CHAR_ENCOUNT_FIX); + if( p_cep != 0 ){ + if( CHAR_getWorkInt( charaindex, CHAR_ENCOUNT_NUM) < (int)time(NULL) ){ + CHAR_talkToCli( charaindex, -1, "Чý", CHAR_COLORYELLOW); + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_FIX, 0); + CHAR_setWorkInt( charaindex, CHAR_ENCOUNT_NUM, 0); + } + temp = cep * (100 + p_cep ) / 100; + }else{ + temp = cep; + } +#endif + + if (cepmaxep) cep=maxep; + if (CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE)==BATTLE_CHARMODE_NONE) { + int entflag=1; + { + int objindex,index; + OBJECT obj; + for ( obj = MAP_getTopObj( ff, fx, fy); obj; obj = NEXT_OBJECT( obj)) { + objindex = GET_OBJINDEX( obj); + if (OBJECT_getType( objindex) == OBJTYPE_CHARA) { + int etype; + index = OBJECT_getIndex( objindex); + if (!CHAR_CHECKINDEX( index)) continue; + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPENPCENEMY && + CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE) == CHAR_EVENT_ENEMY ) { + CHAR_setInt( charaindex, CHAR_X, ox); + CHAR_setInt( charaindex, CHAR_Y, oy); + lssproto_XYD_send( getfdFromCharaIndex(charaindex), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), + CHAR_getInt( charaindex, CHAR_DIR ) ); + break; + } + etype = CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE); + if (etype!=CHAR_EVENT_NONE) { + if (etype==CHAR_EVENT_WARP) entflag=0; + } + } + } + } + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#ifdef _ENEMY_ACTION + if( rand()%(120*getEnemyAction()) < temp ){ +#else + if( rand()%120 < temp ){ +#endif +#else +#ifdef _ENEMY_ACTION + if( rand()%(120*getEnemyAction()) < cep ){ +#else + if (rand()%120 0 ) { + int Rnum=0; + int RandEnemy = getEqRandenemy( enfd); + Rnum = RAND(0,100); + if( Rnum > RandEnemy ) { +#endif + //encounter!! + cep = minep; + lssproto_EN_recv(enfd, + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y)); +#ifdef _Item_MoonAct + } + }else{ + cep = minep; + lssproto_EN_recv(enfd, + CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y)); + } +#endif + } + } else { + if (cep +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "char.h" +#include "util.h" +#include "buf.h" +#include "npcutil.h" +#include "char_base.h" +#include "object.h" +#include "char_data.h" +#include "handletime.h" +#include "chatmagic.h" +#include "configfile.h" +#include "readmap.h" +#include "map_deal.h" +#include "lssproto_serv.h" +#include "log.h" +#include "battle.h" +#include "pet.h" +#include "enemy.h" +#include "encount.h" +#include "magic_base.h" +#include "magic.h" +#include "pet_skill.h" +#include "pet_event.h" +#include "item_gen.h" +#include "mclient.h" +#include "npc_eventaction.h" +#include "map_warppoint.h" +#include "npc_manorsman.h" +#include "net.h" +#include "saacproto_cli.h" +#include "npc_scheduleman.h" +#include "trade.h" +#include "npccreate.h" + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +#include "profession_skill.h" +#endif +#include "char_talk.h" + +// WON ADD 峤 +#include "family.h" + +#include "petmail.h" + +#ifdef _AUTO_PK +#include "npc_autopk.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/ablua.h" +#endif +// WON ADD ¶ȡITEMSET.TXT +#include "item.h" +#include "sasql.h" + +extern tagRidePetTable ridePetTable[296]; +extern int *pWorkAttackPower; +extern time_t initTime; +int *pWorkAttackPower = NULL; + +struct GMINFO gminfo[GMMAXNUM]; +#ifdef _JOB_AUTOPK + int jobautopk=0; +#endif + +extern char mmcdkey[10][32]; +extern char mmcdkeybuf[10][64]; + +void CHAR_CHAT_DEBUG_warp( int charindex , char *message ) +{ + char token[100]; + int fl,x,y; + easyGetTokenFromString( message , 1 , token, sizeof(token)); + fl = atoi( token ); + easyGetTokenFromString( message , 2 , token , sizeof(token)); + x = atoi( token ); + easyGetTokenFromString( message , 3 , token , sizeof(token)); + y = atoi( token ); + + CHAR_warpToSpecificPoint(charindex, fl, x, y); + +} + + +void CHAR_CHAT_DEBUG_hp( int charindex , char *message ) +{ + CHAR_setInt( charindex , CHAR_HP,atoi( message ) ); + CHAR_complianceParameter( charindex ); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_HP); +} +void CHAR_CHAT_DEBUG_setmp( int charindex , char *message ) +{ + int i; + char setmp[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , setmp, sizeof(setmp)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_MAXMP, atoi( setmp ) ); + CHAR_setInt( i , CHAR_MP, atoi( setmp ) ); + CHAR_complianceParameter( i ); + CHAR_send_P_StatusString( i , CHAR_P_STRING_MP); + sprintf( token, "[GM]%sMPΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(setmp)/100); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sMPΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(setmp)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_MAXMP, atoi( setmp ) ); + CHAR_setInt( charindex , CHAR_MP, atoi( setmp ) ); + CHAR_complianceParameter( charindex ); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_MP); + sprintf( token, "MPΪ%d!",(int)atoi(setmp)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_mp( int charindex , char *message ) +{ + int Mymp; + CHAR_setInt( charindex , CHAR_MP, atoi( message ) ); + Mymp = CHAR_getWorkInt( charindex , CHAR_WORKMAXMP); + if( Mymp > CHAR_getWorkInt( charindex , CHAR_WORKMAXMP) ) + CHAR_setInt( charindex , CHAR_MP, CHAR_getWorkInt( charindex , CHAR_WORKMAXMP)); + + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_MP); + +} + +void CHAR_CHAT_DEBUG_str( int charindex , char *message ) +{ + int i; + char str[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , str, sizeof(str)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_STR,atoi( str ) ); + CHAR_complianceParameter( i ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( i ,CHAR_P_STRING_STR|CHAR_P_STRING_MAXHP|CHAR_P_STRING_ATK); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(str)/100); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(str)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_STR,atoi( str ) ); + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex ,CHAR_P_STRING_STR|CHAR_P_STRING_MAXHP|CHAR_P_STRING_ATK); + sprintf( token, "Ϊ%d!",(int)atoi(str)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_tgh( int charindex , char *message ) +{ + int i; + char tgh[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , tgh, sizeof(tgh)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_TOUGH,atoi( tgh ) ); + CHAR_complianceParameter( i ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( i ,CHAR_P_STRING_TOUGH|CHAR_P_STRING_MAXHP|CHAR_P_STRING_DEF); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(tgh)/100); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(tgh)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_TOUGH,atoi( tgh ) ); + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex ,CHAR_P_STRING_TOUGH|CHAR_P_STRING_MAXHP|CHAR_P_STRING_DEF); + sprintf( token, "Ϊ%d!",(int)atoi(tgh)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_dex( int charindex , char *message ) +{ + int i; + char dex[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , dex, sizeof(dex)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_DEX,atoi( dex ) ); + CHAR_complianceParameter( i ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( i ,CHAR_P_STRING_DEX|CHAR_P_STRING_MAXHP|CHAR_P_STRING_ATK|CHAR_P_STRING_QUICK); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(dex)/100); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(dex)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_DEX,atoi( dex ) ); + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex ,CHAR_P_STRING_DEX|CHAR_P_STRING_MAXHP|CHAR_P_STRING_ATK|CHAR_P_STRING_QUICK); + sprintf( token, "Ϊ%d!",(int)atoi(dex)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} +void CHAR_CHAT_DEBUG_vital( int charindex , char *message ) +{ + int i; + char vital[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , vital, sizeof(vital)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_VITAL,atoi( vital ) ); + CHAR_complianceParameter( i ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( i ,CHAR_P_STRING_VITAL|CHAR_P_STRING_MAXHP|CHAR_P_STRING_DEF); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(vital)/100); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(vital)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_VITAL,atoi( vital ) ); + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex ,CHAR_P_STRING_VITAL|CHAR_P_STRING_MAXHP|CHAR_P_STRING_DEF); + sprintf( token, "Ϊ%d!",(int)atoi(vital)/100); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} +void CHAR_CHAT_DEBUG_luck( int charindex , char *message ) +{ + int i; + char buf[64]; + int luck; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + luck=atoi(buf); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(luck<1) + luck=1; + else if(luck>5) + luck=5; + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_LUCK,luck); + CHAR_complianceParameter( i ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( i , CHAR_P_STRING_LUCK); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),luck); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),luck); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_LUCK,luck); + CHAR_complianceParameter( charindex ); + //CHAR_sendStatusString( charindex , "P"); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_LUCK); + sprintf( token, "Ϊ%d!",luck); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_gold( int charindex , char *message ) +{ + int i, MaxGold, money; + char cdkey[CDKEYLEN]; + char buf[64]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + money = atoi( buf ); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + MaxGold = CHAR_getMaxHaveGold( charindex); + if( money > MaxGold ) + money = MaxGold; + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_GOLD , money ); + CHAR_complianceParameter( i ); + CHAR_send_P_StatusString( i , CHAR_P_STRING_GOLD); + sprintf( token, "[GM]%sĽǮΪ%d!", CHAR_getChar( charindex, CHAR_NAME),money); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sĽǮΪ%d!", CHAR_getChar( i, CHAR_NAME),money); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_GOLD , money ); + CHAR_complianceParameter( charindex ); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_GOLD); + sprintf( token, "ǮΪ%d!",money); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +#ifdef _TEST_DROPITEMS +void CHAR_CHAT_DEBUG_dropmypet( int charindex, char *message ) +{ + char buf[256]; + int petID, x, y, floor, objindex, petindex, count=0; + int i, j, k, petarray, cLeve=1; + + if( getStringFromIndexWithDelim( message, " ", 1, buf, sizeof( buf)) == FALSE ) return; + petID = atoi( buf); + if( getStringFromIndexWithDelim( message, " ", 2, buf, sizeof( buf)) != FALSE ){ + cLeve = atoi( buf); + } + + floor = CHAR_getInt( charindex, CHAR_FLOOR); + x = CHAR_getInt( charindex, CHAR_X); + y = CHAR_getInt( charindex, CHAR_Y); + if( getStringFromIndexWithDelim( message, " ", 3, buf, sizeof( buf)) != FALSE ){ + floor = atoi( buf); + } + if( getStringFromIndexWithDelim( message, " ", 4, buf, sizeof( buf)) != FALSE ){ + x = atoi( buf); + } + if( getStringFromIndexWithDelim( message, " ", 5, buf, sizeof( buf)) != FALSE ){ + y = atoi( buf); + } + for( i=(x-3); i<(x+3); i++) { + for( j=(y-3); j<(y+3); j++) { + petarray = ENEMY_getEnemyArrayFromId( petID); + petindex = ENEMY_TEST_createPetIndex( petarray ); + if( !CHAR_CHECKINDEX( petindex) ){ + CHAR_talkToCli( charindex, -1, "err Can't create pet", CHAR_COLORYELLOW); + return; + } + CHAR_complianceParameter( petindex ); + objindex = PET_dropPetAbsolute( petindex, floor, i, j, FALSE ); + if( objindex == -1 ){ + CHAR_talkToCli( charindex, -1, "err Can't Drop", CHAR_COLORYELLOW); + return; + } + for( k = 1; k < cLeve; k ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + CHAR_complianceParameter( petindex ); + CHAR_setInt( petindex , CHAR_HP , CHAR_getWorkInt( petindex , CHAR_WORKMAXHP ) ); + + CHAR_setWorkInt( petindex, CHAR_WORKOBJINDEX, objindex ); + CHAR_setInt( petindex, CHAR_FLOOR, floor); + CHAR_setInt( petindex, CHAR_X, i); + CHAR_setInt( petindex, CHAR_Y, j); + CHAR_sendCToArroundCharacter( objindex); + CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); + CHAR_setChar( petindex, CHAR_OWNERCDKEY, "SYSTEM_WAYI" ); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, "SYSTEM_WAYI" ); + count++; + } + } + sprintf( buf, "ܹ %dֻ", count); + CHAR_talkToCli( charindex, -1, buf, CHAR_COLORYELLOW); + + +} + +void CHAR_CHAT_DEBUG_dropmyitem( int charindex, char *message ) +{ + char buf[256]; + int itemID, SitemID, maxflg=0,emptyitemindexinchara, i, j; + int floor, x, y, objindex; + + if( getStringFromIndexWithDelim( message, " ", 1, buf, sizeof( buf)) == FALSE ) return; + SitemID = atoi( buf); + if( getStringFromIndexWithDelim( message, " ", 2, buf, sizeof( buf)) != FALSE ){ + maxflg = atoi( buf); + } + floor = CHAR_getInt( charindex, CHAR_FLOOR); + x = CHAR_getInt( charindex, CHAR_X); + y = CHAR_getInt( charindex, CHAR_Y); + if( getStringFromIndexWithDelim( message, " ", 3, buf, sizeof( buf)) != FALSE ){ + floor = atoi( buf); + } + if( getStringFromIndexWithDelim( message, " ", 4, buf, sizeof( buf)) != FALSE ){ + x = atoi( buf); + } + if( getStringFromIndexWithDelim( message, " ", 5, buf, sizeof( buf)) != FALSE ){ + y = atoi( buf); + } + itemID = SitemID; + + + for( i=(x-3); i<(x+3); i++) { + for( j=(y-3); j<(y+3); j++) { + int ret = 0 , count=0; + int itemindex; + while( count < 10 ){ + count++; + itemindex = ITEM_makeItemAndRegist( itemID ); + if( maxflg == 1 ) itemID++; + if( !ITEM_CHECKINDEX( itemindex)) continue; + break; + } + emptyitemindexinchara = CHAR_findEmptyItemBox( charindex ); + + CHAR_setItemIndex( charindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charindex); + CHAR_sendItemDataOne( charindex, emptyitemindexinchara); + //drop + if( (ret = CHAR_DropItemFXY( charindex, emptyitemindexinchara, + floor, i, j, &objindex )) != 0 ){ + char buf[256]; + sprintf( buf, "%d", ret); + CHAR_talkToCli( charindex, -1, buf, CHAR_COLORYELLOW); + } + ITEM_setInt(itemindex,ITEM_PUTTIME,NowTime.tv_sec); + CHAR_sendWatchEvent(objindex,CHAR_ACTSTAND,NULL,0,TRUE); + CHAR_setItemIndex(charindex, emptyitemindexinchara ,-1); + CHAR_sendItemDataOne(charindex, emptyitemindexinchara); + CHAR_sendCToArroundCharacter(CHAR_getWorkInt( charindex, CHAR_WORKOBJINDEX)); + } + } + { + char buf[256]; + sprintf( buf, "ID%d", itemID-1); + CHAR_talkToCli( charindex, -1, buf, CHAR_COLORYELLOW); + } +} +#endif + +void CHAR_CHAT_DEBUG_additem( int charindex , char *message ) +{ + + int emptyitemindexinchara, itemindex; + int i; + int num = 0; + int itemid; + char buf[64]; + char msgbuf[128]; + char cdkey[CDKEYLEN]; + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + itemid = atoi( buf); + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + num = atoi( buf); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); + + if( num <= 0 ) num = 1; + + if(strlen(cdkey)>0){ + int playernum = CHAR_getPlayerMaxNum(); + int j; + for(j=0;j=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + for( i = 0; i < num; i ++ ) { + emptyitemindexinchara = CHAR_findEmptyItemBox( j ); + + if( emptyitemindexinchara < 0 ){ + sprintf( msgbuf, "%sƷλ㡣", CHAR_getChar( j, CHAR_NAME )); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + sprintf( msgbuf, "%sƷλ㡣", CHAR_getChar( j, CHAR_NAME )); + CHAR_talkToCli( j, -1, msgbuf, CHAR_COLORYELLOW); + return; + } + + itemindex = ITEM_makeItemAndRegist( itemid ); + + if( itemindex != -1 ){ + CHAR_setItemIndex( j, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,j); + CHAR_sendItemDataOne( j, emptyitemindexinchara); + LogItem( + CHAR_getChar( charindex, CHAR_NAME ), + CHAR_getChar( charindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + atoi( message), +#endif + "AddItem(GM)", + CHAR_getInt( charindex,CHAR_FLOOR), + CHAR_getInt( charindex,CHAR_X ), + CHAR_getInt( charindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + snprintf( msgbuf,sizeof( msgbuf),"[GM]%s%sɹ", + CHAR_getChar( charindex, CHAR_NAME ),ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( j, -1,msgbuf, CHAR_COLORYELLOW); + snprintf( msgbuf, sizeof( msgbuf), "ɹΪ%s %s", + CHAR_getChar( j, CHAR_NAME ),ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1,msgbuf, CHAR_COLORYELLOW); + }else{ + sprintf( msgbuf, "ʧܡ" ); + CHAR_talkToCli( charindex, -1,msgbuf, CHAR_COLORYELLOW); + } + } + }else{ + for( i = 0; i < num; i ++ ) { + emptyitemindexinchara = CHAR_findEmptyItemBox( charindex ); + + if( emptyitemindexinchara < 0 ){ + sprintf( msgbuf, "Ʒλ㡣" ); + + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + + return; + } + + itemindex = ITEM_makeItemAndRegist( itemid ); + + if( itemindex != -1 ){ + CHAR_setItemIndex( charindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charindex); + CHAR_sendItemDataOne( charindex, emptyitemindexinchara); + LogItem( + CHAR_getChar( charindex, CHAR_NAME ), + CHAR_getChar( charindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + atoi( message), +#endif + "AddItem(GM)", + CHAR_getInt( charindex,CHAR_FLOOR), + CHAR_getInt( charindex,CHAR_X ), + CHAR_getInt( charindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + snprintf( msgbuf, sizeof( msgbuf), "%sɹ", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1,msgbuf, CHAR_COLORYELLOW); + }else{ + sprintf( msgbuf, "ʧܡ" ); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + } + } + } +} + + +void CHAR_CHAT_DEBUG_metamo( int charindex , char *message ) +{ +#ifdef _CAX_METAMO_OFF + char metamoid[12]; +#else + char metamoid[7]; +#endif + char cdkey[CDKEYLEN]; + char token[128]; + int i=0; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , metamoid, sizeof(metamoid)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_BASEIMAGENUMBER , atoi( metamoid ) ); + CHAR_setInt( i , CHAR_BASEBASEIMAGENUMBER , atoi( metamoid ) ); + + CHAR_complianceParameter( i ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( i , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( i , CHAR_P_STRING_BASEBASEIMAGENUMBER); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(metamoid)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(metamoid)); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_BASEIMAGENUMBER , atoi( metamoid ) ); + CHAR_setInt( charindex , CHAR_BASEBASEIMAGENUMBER , atoi( metamoid ) ); + + CHAR_complianceParameter( charindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + sprintf( token, "Ϊ%d!",(int)atoi(metamoid)); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_info( int charindex , char *message ) +{ + char line[256]; + int index; + + if( strlen( message) != 0 ) { + index = atoi( message); + } + else { + index = charindex; + } + if( !CHAR_CHECKINDEX( index)) { + CHAR_talkToCli( charindex, -1 , "index޷ʹá" , CHAR_COLORWHITE ); + return; + } + + snprintf( line, sizeof( line), + "name:%s i:%d B:%d BB:%d LV:%d EXP:%d MakeSeq:%d", + CHAR_getChar( index, CHAR_NAME), + charindex, + CHAR_getInt( index, CHAR_BASEIMAGENUMBER ), + CHAR_getInt( index, CHAR_BASEBASEIMAGENUMBER ), + CHAR_getInt( index, CHAR_LV ), + CHAR_getInt( index, CHAR_EXP ), + CHAR_getCharMakeSequenceNumber( index)); + + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + snprintf( line, sizeof( line), + "Gold:%d HP:%d MP/MHP:%d/%d" , + CHAR_getInt( index, CHAR_GOLD ), + CHAR_getInt( index, CHAR_HP ), + CHAR_getInt( index, CHAR_MP ), + CHAR_getInt( index, CHAR_MAXMP )); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + + if( CHAR_getInt( index, CHAR_WHICHTYPE ) == CHAR_TYPEPET ){ + snprintf( line, sizeof(line), + ":%d :%d :%d :%d :%d :%d :%d :%d :%d ұ:%.2f :%s", + CHAR_getInt( index, CHAR_VITAL )/100, + CHAR_getInt( index, CHAR_STR )/100, + CHAR_getInt( index, CHAR_TOUGH )/100, + CHAR_getInt( index, CHAR_DEX )/100, + CHAR_getWorkInt( index, CHAR_WORKFIXVITAL ), + CHAR_getWorkInt( index, CHAR_WORKATTACKPOWER ), + CHAR_getWorkInt( index, CHAR_WORKDEFENCEPOWER ),//CHAR_WORKFIXDEX + CHAR_getWorkInt( index, CHAR_WORKQUICK ), + CHAR_getInt( index, CHAR_MODAI ), + CHAR_getInt( index, CHAR_VARIABLEAI ) * 0.01, + CHAR_getChar( index, CHAR_UNIQUECODE) ); + }else{ + snprintf( line, sizeof(line), + ":%d :%d :%d :%d :%d :%d :%d :%d :%d", + CHAR_getInt( index, CHAR_VITAL )/100, + CHAR_getInt( index, CHAR_STR )/100, + CHAR_getInt( index, CHAR_TOUGH )/100, + CHAR_getInt( index, CHAR_DEX )/100, + CHAR_getWorkInt( index, CHAR_WORKFIXVITAL ), + CHAR_getWorkInt( index, CHAR_WORKATTACKPOWER ), + CHAR_getWorkInt( index, CHAR_WORKDEFENCEPOWER ), + CHAR_getWorkInt( index, CHAR_WORKFIXCHARM ), + CHAR_getWorkInt( index, CHAR_WORKFIXLUCK )); + } + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + + snprintf( line, sizeof(line), + ":%d ˮ:%d :%d :%d", + CHAR_getWorkInt( index, CHAR_WORKFIXEARTHAT ), + CHAR_getWorkInt( index, CHAR_WORKFIXWATERAT ), + CHAR_getWorkInt( index, CHAR_WORKFIXFIREAT ), + CHAR_getWorkInt( index, CHAR_WORKFIXWINDAT )); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + snprintf( line, sizeof( line), + "Sk Itm:%d ChV:%d Rad:%d" , + CHAR_MAXITEMHAVE, + CHAR_getInt( index, CHAR_CHATVOLUME ), + CHAR_getInt( index, CHAR_RADARSTRENGTH ) ); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + + snprintf( line, sizeof( line), + "Status :%d :%d Ĭ:%d ʯ:%d :%d :%d" , + CHAR_getInt( index , CHAR_POISON ), + CHAR_getInt( index , CHAR_PARALYSIS ), + CHAR_getInt( index , CHAR_SLEEP ), + CHAR_getInt( index , CHAR_STONE ), + CHAR_getInt( index , CHAR_DRUNK ), + CHAR_getInt( index , CHAR_CONFUSION ) ); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + +#ifdef _PERSONAL_FAME // Arminius: + snprintf( line, sizeof( line), +#ifdef _NEW_MANOR_LAW + "TitInd:%d FL:%d X:%d Y:%d DIR:%d FAME:%d MOMENTUM:%d" , +#else + "TitInd:%d FL:%d X:%d Y:%d DIR:%d FAME:%d" , +#endif + CHAR_getInt( index , CHAR_INDEXOFEQTITLE ), + CHAR_getInt( index , CHAR_FLOOR ), + CHAR_getInt( index , CHAR_X ), + CHAR_getInt( index , CHAR_Y ), + CHAR_getInt( index , CHAR_DIR ), + CHAR_getInt( index , CHAR_FAME) +#ifdef _NEW_MANOR_LAW + ,CHAR_getInt( index , CHAR_MOMENTUM) +#endif + ); +#else + snprintf( line, sizeof( line), + "TitInd:%d FL:%d X:%d Y:%d DIR:%d" , + CHAR_getInt( index , CHAR_INDEXOFEQTITLE ), + CHAR_getInt( index , CHAR_FLOOR ), + CHAR_getInt( index , CHAR_X ), + CHAR_getInt( index , CHAR_Y ), + CHAR_getInt( index , CHAR_DIR ) ); +#endif + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + + snprintf( line, sizeof( line), + "walk:%d dead:%d ItemMergecnt:%d" , + CHAR_getInt( index , CHAR_WALKCOUNT ) , + CHAR_getInt( index , CHAR_DEADCOUNT ) , + CHAR_getInt( index, CHAR_MERGEITEMCOUNT) + ); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + snprintf( line, sizeof( line), + "petindex [%d][%d][%d][%d][%d] " , + CHAR_getCharPet( index, 0), + CHAR_getCharPet( index, 1), + CHAR_getCharPet( index, 2), + CHAR_getCharPet( index, 3), + CHAR_getCharPet( index, 4)); + } + else { + snprintf( line, sizeof( line), + "PetskillIndex [%d][%d][%d][%d][%d][%d][%d] " , + CHAR_getPetSkill( index, 0), + CHAR_getPetSkill( index, 1), + CHAR_getPetSkill( index, 2), + CHAR_getPetSkill( index, 3), + CHAR_getPetSkill( index, 4), + CHAR_getPetSkill( index, 5), + CHAR_getPetSkill( index, 6)); + } + + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + snprintf( line, sizeof( line), + "poolpetindex [%d][%d][%d][%d][%d] " , + CHAR_getCharPoolPet( index, 0), + CHAR_getCharPoolPet( index, 1), + CHAR_getCharPoolPet( index, 2), + CHAR_getCharPoolPet( index, 3), + CHAR_getCharPoolPet( index, 4)); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + + snprintf( line, sizeof( line), + "poolpetindex [%d][%d][%d][%d][%d] " , + CHAR_getCharPoolPet( index, 5), + CHAR_getCharPoolPet( index, 6), + CHAR_getCharPoolPet( index, 7), + CHAR_getCharPoolPet( index, 8), + CHAR_getCharPoolPet( index, 9)); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + } + + snprintf( line, sizeof( line), + "levelup [%d], ۻ %d ij[%d]" , + CHAR_getInt( index, CHAR_LEVELUPPOINT), + CHAR_getWorkInt( index, CHAR_WORKULTIMATE), + CHAR_getInt( index, CHAR_GAMBLENUM) ); + CHAR_talkToCli( charindex, -1 , line , CHAR_COLORWHITE ); + +} + +void CHAR_CHAT_DEBUG_sysinfo( int charindex , char *message ) +{ + char msg[1024],name[256]; + int i; + time_t new_t; + int dd,hh,mm,ss; + + int items=0 , chars=0, golds=0, nouses=0; + int players=0,pets=0,others=0; + int whichtype= -1; + int objnum = OBJECT_getNum(); + + + int itemnum = ITEM_getITEM_itemnum(); + int itemuse =0; + + makeEscapeString( getGameserverID(), name, sizeof( name)); + sprintf( msg, "GSID:%s GSNAME:%s", getGameserverID(), name); + CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW); + + + for( i=0 ; i%s˵%s", MyName, message); + CHAR_talkToCli( i, -1, labamsg, CHAR_COLORGREEN); + } + } +} + +void CHAR_CHAT_DEBUG_dalaba(int charindex , char *message ) // +{ + if(strlen(message)<1) return; + char dalababuf[512]; + sprintf(dalababuf,"ȫ桿%s",message); + system_all_talk(dalababuf); +} + +void CHAR_CHAT_DEBUG_level( int charaindex, char* message ) +{ + int i, level; + char buf[64]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + level=atoi(buf); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt(i,CHAR_LV, atoi( message )); + CHAR_send_P_StatusString( i , CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP); + sprintf( token, "[GM]%sĵȼΪ%d!", CHAR_getChar( charaindex, CHAR_NAME),level); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sĵȼΪ%d!", CHAR_getChar( i, CHAR_NAME),level); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt(charaindex,CHAR_LV, atoi( message )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP); + sprintf( token, "ȼΪ%d!",level); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } + +} + + +void CHAR_CHAT_DEBUG_exp( int charaindex, char* message ) +{ + int i; + char exp[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , exp, sizeof(exp)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setMaxExp( i, atoi( exp )); + CHAR_send_P_StatusString( i , CHAR_P_STRING_EXP); + sprintf( token, "[GM]%sľΪ%d!", CHAR_getChar( charaindex, CHAR_NAME),(int)atoi(exp)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sľΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(exp)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setMaxExp( charaindex, atoi( exp )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_EXP); + sprintf( token, "Ϊ%d!",(int)atoi(exp)/100); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_delitem( int charindex , char *message ) +{ + int itemid; + + if( strcmp( message, "all") == 0 ) { + int i; + for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) { + itemid = CHAR_getItemIndex(charindex, i); + if( itemid != -1 ) { + { + LogItem( + CHAR_getChar( charindex, CHAR_NAME ), + CHAR_getChar( charindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemid, +#else + ITEM_getInt( itemid, ITEM_ID ), +#endif + "DelItem(ɾGM)", + CHAR_getInt( charindex,CHAR_FLOOR), + CHAR_getInt( charindex,CHAR_X ), + CHAR_getInt( charindex,CHAR_Y ), + ITEM_getChar( itemid, ITEM_UNIQUECODE), + ITEM_getChar( itemid, ITEM_NAME), + ITEM_getInt( itemid, ITEM_ID) + ); + } + CHAR_DelItem( charindex, i); + } + } + }else { + int equipplace; + equipplace = atoi( message); + if( equipplace < CHAR_STARTITEMARRAY || equipplace > CHAR_MAXITEMHAVE -1 ) { + CHAR_talkToCli( charindex, -1, "벻ȷ", CHAR_COLORWHITE); + return; + } + itemid = CHAR_getItemIndex(charindex, equipplace); + if( itemid == -1 ) return; + { + LogItem( + CHAR_getChar( charindex, CHAR_NAME ), + CHAR_getChar( charindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemid, +#else + ITEM_getInt( itemid, ITEM_ID ), +#endif + "DelItem(ɾGM)", + CHAR_getInt( charindex,CHAR_FLOOR), + CHAR_getInt( charindex,CHAR_X ), + CHAR_getInt( charindex,CHAR_Y ), + ITEM_getChar( itemid, ITEM_UNIQUECODE), + ITEM_getChar( itemid, ITEM_NAME), + ITEM_getInt( itemid, ITEM_ID) + ); + } + CHAR_DelItem( charindex, equipplace); + } +} + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +void CHAR_CHAT_DEBUG_addsk( int charaindex, char* message ) +{ + + CHAR_HaveSkill *pSkil; + int skill, i, level=1; + + char msg1[20], msg2[20]; + + getStringFromIndexWithDelim( message, " ", 1, msg1, sizeof( msg1)); + getStringFromIndexWithDelim( message, " ", 2, msg2, sizeof( msg2)); + + skill = atoi(msg1); + level = atoi(msg2); + + if( level > 100 ){ + CHAR_talkToCli( charaindex, -1, "ȼȷ", CHAR_COLORWHITE); + return; + } + if( level < 1 ) level = 1; + + for( i = 0; i < CHAR_SKILLMAXHAVE; i ++ ){ + int skill_id = -1; + + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + skill_id = SKILL_getInt( &pSkil->skill, SKILL_IDENTITY); + if( skill == skill_id && skill_id != -1 ){ + CHAR_talkToCli(charaindex,-1, "Ѿѧϰ˼", CHAR_COLORYELLOW); + return; + } + + if( pSkil == NULL ) continue; + if( pSkil->use != 0 ) continue; + + break; + } + + if( i >= CHAR_SKILLMAXHAVE ){ + CHAR_talkToCli(charaindex,-1, "Ѵ", CHAR_COLORYELLOW); + return; + }else{ + level *= 100; + SKILL_makeSkillData( &pSkil->skill, skill, level); + pSkil->use = TRUE; + } + + CHAR_sendStatusString( charaindex , "S"); + + return; +} + +void CHAR_CHAT_DEBUG_delsk( int charaindex, char* message ) +{ + int i; + CHAR_HaveSkill *pSkil; + + if( strcmp( message, "all" ) == 0 ){ + CHAR_talkToCli( charaindex, -1, "м", CHAR_COLORWHITE); + for( i = CHAR_SKILLMAXHAVE-1; i >= 0; i -- ){ + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + if( pSkil == NULL )continue; + if( pSkil->use == 0 )continue; + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + } + } + + for( i = CHAR_SKILLMAXHAVE-1; i >= 0; i -- ){ + pSkil = CHAR_getCharHaveSkill( charaindex, i ); + if( pSkil == NULL )continue; + if( pSkil->use == 0 )continue; + print( "SKILUSE %d\n", pSkil->use ); + break; + } + + if( i < 0 ){ + CHAR_talkToCli( charaindex, -1, "޷ˡ", CHAR_COLORWHITE); + ;; + }else{ + SKILL_makeSkillData( &pSkil->skill, 0, 0 ); + pSkil->use = 0; + } + + CHAR_sendStatusString( charaindex , "S"); +} +#endif + +#ifdef _MAKE_MAP +void CHAR_CHAT_DelMap( int charaindex, char* message ){ + + int ff, x, y, xx, yy; + int tile, obj; + + ff = CHAR_getInt( charaindex, CHAR_FLOOR ); + + if( MAP_getFloorXY( ff, &xx, &yy) == FALSE )return; + + for(x=0;x %d", tile, fixtile ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + snprintf( szBuffer, sizeof( szBuffer ), "%d => %d", obj, fixobj ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + } + + MAP_setTileAndObjData( ff, fx, fy, fixtile, fixobj ); + + { + char *stringdata; + RECT seekr , retr; + seekr.x = fx; + seekr.y = fy; + seekr.width = 1; + seekr.height = 1; + stringdata = MAP_getdataFromRECT(ff,&seekr,&retr); + if( stringdata ){ + + if( CHAR_getInt( charaindex , CHAR_WHICHTYPE ) + == CHAR_TYPEPLAYER ){ + int fd = getfdFromCharaIndex( charaindex ); + lssproto_M_send(fd,ff, + retr.x,retr.y, + retr.x+retr.width,retr.y+retr.height, + stringdata ); + } + } else { + } + } + + return ; +} + +void CHAR_CHAT_Fixtile( int charaindex, char* message ){ + + int dir, ff, fx, fy; + int tile, obj; + int fixtile=atoi(message); + + ff = CHAR_getInt( charaindex, CHAR_FLOOR ); + fx = CHAR_getInt( charaindex, CHAR_X ); + fy = CHAR_getInt( charaindex, CHAR_Y ); + dir = CHAR_getInt( charaindex, CHAR_DIR ); + + fx += CHAR_getDX(dir); + fy += CHAR_getDY(dir); + + if( MAP_getTileAndObjData( ff, fx, fy, &tile, &obj) == FALSE )return; + + { + char szBuffer[64]; + snprintf( szBuffer, sizeof( szBuffer ), "ͼƬ%d => %d", tile, fixtile ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + snprintf( szBuffer, sizeof( szBuffer ), "%d => %d", obj, obj ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + } + + MAP_setTileAndObjData( ff, fx, fy, fixtile, -1 ); + + { + char *stringdata; + RECT seekr , retr; + seekr.x = fx; + seekr.y = fy; + seekr.width = 1; + seekr.height = 1; + stringdata = MAP_getdataFromRECT(ff,&seekr,&retr); + if( stringdata ){ + + if( CHAR_getInt( charaindex , CHAR_WHICHTYPE ) + == CHAR_TYPEPLAYER ){ + int fd = getfdFromCharaIndex( charaindex ); + lssproto_M_send(fd,ff, + retr.x,retr.y, + retr.x+retr.width,retr.y+retr.height, + stringdata ); + } + } else { + } + } + + return ; +} + +void CHAR_CHAT_Fixobj( int charaindex, char* message ){ + + int dir, ff, fx, fy; + int tile, obj; + int fixobj=atoi(message); + + ff = CHAR_getInt( charaindex, CHAR_FLOOR ); + fx = CHAR_getInt( charaindex, CHAR_X ); + fy = CHAR_getInt( charaindex, CHAR_Y ); + dir = CHAR_getInt( charaindex, CHAR_DIR ); + + fx += CHAR_getDX(dir); + fy += CHAR_getDY(dir); + + if( MAP_getTileAndObjData( ff, fx, fy, &tile, &obj) == FALSE )return; + + { + char szBuffer[64]; + snprintf( szBuffer, sizeof( szBuffer ), "ͼƬ%d => %d", tile, tile ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + snprintf( szBuffer, sizeof( szBuffer ), "%d => %d", obj, fixobj ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE); + } + + MAP_setTileAndObjData( ff, fx, fy, -1, fixobj ); + + { + char *stringdata; + RECT seekr , retr; + seekr.x = fx; + seekr.y = fy; + seekr.width = 1; + seekr.height = 1; + stringdata = MAP_getdataFromRECT(ff,&seekr,&retr); + if( stringdata ){ + + if( CHAR_getInt( charaindex , CHAR_WHICHTYPE ) + == CHAR_TYPEPLAYER ){ + int fd = getfdFromCharaIndex( charaindex ); + lssproto_M_send(fd,ff, + retr.x,retr.y, + retr.x+retr.width,retr.y+retr.height, + stringdata ); + } + } else { + } + } + + return ; +} + +void CHAR_CHAT_Fukuwa( int charaindex, char* message ){ + int dir, ff, fx, fy, objindex, vs_index, vs_fd, stringlen; + OBJECT obj; + char szBuffer[2048]; + + stringlen = strlen( message ); + + if( message[0] == '[' && message[stringlen-1] == ']' ){ + CHAR_talkToCli( charaindex, -1, "ûת", CHAR_COLORWHITE); + return ; + } + + ff = CHAR_getInt( charaindex, CHAR_FLOOR ); + fx = CHAR_getInt( charaindex, CHAR_X ); + fy = CHAR_getInt( charaindex, CHAR_Y ); + dir = CHAR_getInt( charaindex, CHAR_DIR ); + + fx += CHAR_getDX(dir); + fy += CHAR_getDY(dir); + + stringlen = strlen( message ); + + + snprintf( szBuffer, sizeof( szBuffer ), "P|%s", message ); + + for( obj=MAP_getTopObj( ff, fx, fy ); obj; obj=NEXT_OBJECT(obj) ){ + objindex = GET_OBJINDEX(obj); + if( OBJECT_getType(objindex) != OBJTYPE_CHARA )continue; + vs_index = OBJECT_getIndex(objindex); + vs_fd = getfdFromCharaIndex( vs_index ); + CHAR_Talk( vs_fd, vs_index, + szBuffer, CHAR_COLORWHITE, 3 ); + break; + } + +} +#endif + +void CHAR_CHAT_DEBUG_superman( int charaindex, char* message ) +{ +#define CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF 100000 + int i; + char hp[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , hp, sizeof(hp)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT, 0); + CHAR_Skillupsend(charaindex); + CHAR_setInt( charaindex , CHAR_HP, CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF); + CHAR_setInt( charaindex , CHAR_MP,100 ); + CHAR_setInt( charaindex , CHAR_MAXMP,100 ); + CHAR_setInt( charaindex , CHAR_VITAL,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_STR,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_TOUGH,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_DEX , CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); +#ifdef _TRANS_LEVEL_CF + CHAR_setInt( charaindex,CHAR_LV, 140); +#else + CHAR_setInt( charaindex,CHAR_LV, 140); +#endif + CHAR_complianceParameter( charaindex ); + CHAR_sendStatusString( charaindex , "P"); + + sprintf( token, "[GM]%sΪ״̬!", CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ״̬!", CHAR_getChar( i, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT, 0); + CHAR_Skillupsend(charaindex); + CHAR_setInt( charaindex , CHAR_HP, CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF); + CHAR_setInt( charaindex , CHAR_MP,100 ); + CHAR_setInt( charaindex , CHAR_MAXMP,100 ); + CHAR_setInt( charaindex , CHAR_VITAL,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_STR,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_TOUGH,CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); + CHAR_setInt( charaindex , CHAR_DEX , CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF ); +#ifdef _TRANS_LEVEL_CF + CHAR_setInt( charaindex,CHAR_LV, 140); +#else + CHAR_setInt( charaindex,CHAR_LV, 140); +#endif + CHAR_complianceParameter( charaindex ); + CHAR_sendStatusString( charaindex , "P"); + + CHAR_talkToCli( charaindex, -1,"ó״̬!", CHAR_COLORYELLOW ); + } +#undef CHAT_CHAT_DEBUG_SUPERMAN_PARAMDEF + +} + +void CHAR_CHAT_printcount( int charaindex, char* message ) +{ + char msgbuf[512]; + + snprintf( msgbuf,sizeof( msgbuf), + "˵ %d λ, %d ·, %d ", + CHAR_getInt( charaindex, CHAR_TALKCOUNT), + CHAR_getInt( charaindex, CHAR_WALKCOUNT), + CHAR_getInt( charaindex, CHAR_DEADCOUNT) + ); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + +} + +void CHAR_CHAT_DEBUG_battlein( int charaindex, char* message ) +{ + int fd = getfdFromCharaIndex( charaindex ); + if( fd != -1) { + lssproto_EN_recv( fd, + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + } +} + +void CHAR_CHAT_DEBUG_battleout( int charaindex, char* message ) +{ + + BATTLE_WatchStop( charaindex ); +} + +void CHAR_CHAT_DEBUG_petmake( int charaindex, char* message ) +{ + int ret; + int enemynum; + int enemyid; + int i,j; + int level=-1; + char buf[10]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + enemyid=atoi(buf); + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + level=atoi(buf); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(j=0;j=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex( j, i); + if( !CHAR_CHECKINDEX( ret))return; + + sprintf( token, "[GM]%s%s!", CHAR_getChar( charaindex, CHAR_NAME),ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( j, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%s%sɹ!", CHAR_getChar( j, CHAR_NAME),ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( j, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + if( level != -1 ){ +#ifdef _TRANS_LEVEL_CF + if( level > getMaxLevel() ) level = getMaxLevel(); +#else + if( level > 140 ) level = 140; +#endif + if( level < 0 ) level = 0; + level = level - CHAR_getInt( ret, CHAR_LV ); + if( level > 0 ){ + int k; + for( k = 1; k <= level; k ++ ){ // + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( j, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( j, token ); + }else{ + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex(charaindex, i); + if( !CHAR_CHECKINDEX( ret))return; + + snprintf( token,sizeof( token), "%sɹ!",ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + if( level != -1 ){ + if( level > 200 ) level = 200; + if( level < 0 ) level = 0; + level = level - CHAR_getInt( ret, CHAR_LV ); + if( level > 0 ){ + int k; + for( k = 1; k <= level; k ++ ){ // + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + } +} + +void CHAR_CHAT_DEBUG_deletepet( int charaindex, char* message ) +{ + int i, pindex; + char category[12]; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + pindex = CHAR_getCharPet( charaindex, i); + if( CHAR_CHECKINDEX( pindex)) { + CHAR_endCharOneArray( pindex ); + CHAR_setCharPet( charaindex, i, -1); + if( i == CHAR_getInt( charaindex, CHAR_DEFAULTPET)) { + int myfd; + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + myfd = getfdFromCharaIndex( charaindex); + lssproto_KS_send( myfd, i, 0); + } + snprintf( category, sizeof( category), "K%d",i); + CHAR_sendStatusString( charaindex, category ); + snprintf( category, sizeof( category), "W%d",i); + CHAR_sendStatusString( charaindex, category ); + } + } + + CHAR_talkToCli( charaindex, -1, "г", CHAR_COLORWHITE); + +} + +#define MAXMESS_LISTNUM 8 +#define ALLRESET (MAXMESS_LISTNUM - 1) + +void CHAR_CHAT_DEBUG_reset( int charaindex, char* message ) +{ + int i; + char mess[MAXMESS_LISTNUM][256]={ "enemy", "encount", "magic", "warppoint", "petskill", "pettalk","npc", "all"}; + + for( i=0; i= MAXMESS_LISTNUM ){ + CHAR_talkToCli( charaindex, -1, "ָ", CHAR_COLORRED);//CHAR_COLORYELLOW + return; + } + switch( i){ + case ALLRESET: + case 0: + if( !ENEMYTEMP_reinitEnemy() || !ENEMY_reinitEnemy() ){ + CHAR_talkToCli( charaindex, -1, "¶ȡ˻ʧܡ", CHAR_COLORRED); + return; + } + if( i != ALLRESET ) break; + case 1: + if( !GROUP_reinitGroup() || !ENCOUNT_reinitEncount() ){ + CHAR_talkToCli( charaindex, -1, "¶ȡŶʧܡ", CHAR_COLORRED); + } + if( i != ALLRESET ) break; + case 2: + if( !MAGIC_reinitMagic() || !ATTMAGIC_reinitMagic() ) { + CHAR_talkToCli( charaindex, -1, "¶ȡʧܡ", CHAR_COLORRED); + } + if( i != ALLRESET ) break; + case 3: + MAPPOINT_resetMapWarpPoint( 1); + if( !MAPPOINT_loadMapWarpPoint() ){ + CHAR_talkToCli( charaindex, -1, "¶ȡԾʧܡ", CHAR_COLORRED); + } + if( i != ALLRESET ) break; + case 4: + if( !PETSKILL_reinitPetskill() ) { + CHAR_talkToCli( charaindex, -1, "¶ȡ\ʧܡ", CHAR_COLORRED); + } + if( i != ALLRESET ) break; + case 5: + LoadPetTalk(); + if( i != ALLRESET ) break; + break; + case 6: + if( !NPC_reloadNPC() ) { + CHAR_talkToCli( charaindex, -1, "NPCʧܡ", CHAR_COLORRED); + } + if( i != ALLRESET ) break; + break; + } + CHAR_talkToCli( charaindex, -1, "¶ȡϷϡ", CHAR_COLORYELLOW); +} + +void CHAR_CHAT_DEBUG_enemyrestart( int charaindex, char* message ) +{ + if( ENEMYTEMP_reinitEnemy()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡ˻ϡ", CHAR_COLORWHITE); + }else { + CHAR_talkToCli( charaindex, -1, "ٴζȡ˻ʧܡ", CHAR_COLORWHITE); + } + + if( ENEMY_reinitEnemy()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡϡ", CHAR_COLORWHITE); + }else { + CHAR_talkToCli( charaindex, -1, "ٴζȡ˻ʧܡ", CHAR_COLORWHITE); + } + + if( GROUP_reinitGroup()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡŶϡ", CHAR_COLORWHITE); + }else { + CHAR_talkToCli( charaindex, -1, "ٴζȡŶʧܡ", CHAR_COLORWHITE); + } + if( ENCOUNT_reinitEncount()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡϡ", CHAR_COLORWHITE); + } + else { + CHAR_talkToCli( charaindex, -1, "ٴζȡʧܡ", CHAR_COLORWHITE); + } + + if( MAGIC_reinitMagic()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡϡ", CHAR_COLORWHITE); + } + else { + CHAR_talkToCli( charaindex, -1, "ٴζȡʧܡ", CHAR_COLORWHITE); + } + +#ifdef _ATTACK_MAGIC + if( ATTMAGIC_reinitMagic() ) + CHAR_talkToCli( charaindex , -1 , "ٴζȡϡ" , CHAR_COLORWHITE ); + else + CHAR_talkToCli( charaindex , -1 , "ٴζȡʧܡ" , CHAR_COLORWHITE ); +#endif + if( PETSKILL_reinitPetskill()) { + CHAR_talkToCli( charaindex, -1, "ٴζȡ\ϡ", CHAR_COLORWHITE); + } + else { + CHAR_talkToCli( charaindex, -1, "ٴζȡ\ʧܡ", CHAR_COLORWHITE); + } + + LoadPetTalk(); // Arminius 8.15 pet talk + CHAR_talkToCli( charaindex, -1, "ٴζȡイϡ", CHAR_COLORWHITE); + +} + +void CHAR_CHAT_DEBUG_battlewatch( int charaindex, char* message ) +{ + int fd = getfdFromCharaIndex( charaindex ); + if( fd != -1) { + lssproto_LB_recv( fd, + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y)); + } +} + +// shan 2001/12/18 Begin 춸ı࣬ʽԭȵfunctionע +void CHAR_CHAT_DEBUG_eventclean( int charaindex, char* message ) +{ +#ifdef _ADD_NEWEVENT // WON + int event_num = 8; +#else + int event_num = 6; +#endif + + int point; + int shiftbit; + int eventno=0; + char token[1024]; + int array; + int shift; + char token_cdkey[256]="", token_name[256]="", cdkey[CDKEYLEN], token_flag[256]=""; + unsigned int max_user = 0; + BOOL find = FALSE; + BOOL ret1, ret2; + int charaindex_tmp = 0; + int i; + + getStringFromIndexWithDelim( message, " ", 1, token_flag, sizeof( token)); + ret1 = getStringFromIndexWithDelim( message, " ", 2, token_cdkey, sizeof( token_cdkey)); + ret2 = getStringFromIndexWithDelim( message, " ", 3, token_name, sizeof( token_name)); + shiftbit = atoi(token_flag); + eventno = atoi(token_flag); + + if( shiftbit!=-1 && ret1==FALSE && ret2==FALSE ){ + charaindex_tmp = charaindex; + find=TRUE; + }else{ + if( shiftbit==-1 || strlen(token_cdkey)==0 || strlen(token_name)==0 ){ + sprintf( token, "%s", "ȷȷʽ[eventsetend ʺ ]"); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + max_user = getFdnum(); + for( i=0; i=event_num ){ + sprintf( token, "󣡣ѳ Χ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_ENDEVENT+array); + point = point & ~(1<=event_num ){ + sprintf( token, "󣡣ѳ Χ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_ENDEVENT9+array); + point = point & ~(1<=event_num ){ + sprintf( token, "󣡣ѳΧ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_NOWEVENT+array); + point = point | (1<=event_num ){ + sprintf( token, "󣡣ѳΧ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_NOWEVENT9+array); + point = point | (1<=event_num ){ + sprintf( token, "󣡣ѳ Χ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_ENDEVENT+array); + point = point | (1<=event_num ){ + sprintf( token, "󣡣ѳ Χ(0~%d)",32*event_num-1); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + return; + } + point = CHAR_getInt( charaindex_tmp, CHAR_ENDEVENT9+array); + point = point | (1<0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( i , CHAR_DUELPOINT, atoi( dp ) ); + CHAR_send_P_StatusString( i ,CHAR_P_STRING_DUELPOINT ); + sprintf( token, "[GM]%sDPΪ%d!", CHAR_getChar( charindex, CHAR_NAME),(int)atoi(dp)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sDPΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(dp)); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt( charindex , CHAR_DUELPOINT, atoi( dp ) ); + CHAR_send_P_StatusString( charindex ,CHAR_P_STRING_DUELPOINT ); + sprintf( token, "DPΪ%d!",(int)atoi(dp)); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} + +#ifdef _EQUIT_ARRANGE +void CHAR_CHAT_DEBUG_arrange( int charindex , char *message ) +{ + CHAR_setWorkInt( charindex, CHAR_WORKFIXARRANGE, atoi( message) ); + CHAR_complianceParameter( charindex ); + CHAR_talkToCli( charindex, -1, "趨", CHAR_COLORYELLOW); +} +#endif + + +#ifdef _EQUIT_SEQUENCE +void CHAR_CHAT_DEBUG_sequence( int charindex , char *message ) +{ + CHAR_setWorkInt( charindex, CHAR_WORKFIXSEQUENCE, atoi( message) ); + CHAR_complianceParameter( charindex ); + CHAR_talkToCli( charindex, -1, "趨˳", CHAR_COLORYELLOW); +} +#endif + +#define ITEMRESERVESTRING "item" +#define POOLITEMRESERVESTRING "poolitem" + +void CHAR_CHAT_DEBUG_setmerge_main( int charaindex, char* message, int mode ) +{ + int haveitemindex = atoi( message); + int itemindex; + + if( !CHAR_CHECKITEMINDEX( charaindex, haveitemindex) ){ + CHAR_talkToCli( charaindex, -1, "֡", CHAR_COLORWHITE); + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex)) { + CHAR_talkToCli( charaindex, -1, "ôǷûκε,鱨֡", CHAR_COLORWHITE); + return; + } + ITEM_setInt( itemindex, ITEM_MERGEFLG, mode); + + CHAR_talkToCli( charaindex, -1, "׷º뼰ëף", CHAR_COLORWHITE); + + CHAR_sendItemDataOne( charaindex, haveitemindex); +} + +void CHAR_CHAT_DEBUG_effect( int charaindex, char* message ) +{ + int floorid=-1, effectid=-1, level=0; + char buf[ 256]; + int i; + int playernum = CHAR_getPlayerMaxNum(); + BOOL flg = FALSE; + + getStringFromIndexWithDelim( message, " ", 1, buf, sizeof( buf)); + if( strcmp( buf, "alloff" ) == 0 ) { + flg = TRUE; + }else { + floorid = atoi( buf); + if( !getStringFromIndexWithDelim( message, " ", 2, buf, sizeof( buf))) { + return; + } + effectid = atoi( buf); + if( !getStringFromIndexWithDelim( message, " ", 3, buf, sizeof( buf))) { + return; + } + level = atoi( buf); + } + for( i = 0 ; i < playernum; i ++) { + if( CHAR_CHECKINDEX( i)) { + if( CHAR_getInt( i, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + if( flg) { + int ef = CHAR_getWorkInt( i, CHAR_WORKEFFECT); + if( ef != 0 ) { + int fd = getfdFromCharaIndex( i); + lssproto_EF_send( fd, 0, 0, ""); + CHAR_setWorkInt( i, CHAR_WORKEFFECT, 0); + } + } + else if( CHAR_getInt( i, CHAR_FLOOR) == floorid ) { + int fd = getfdFromCharaIndex( i); + lssproto_EF_send( fd, effectid, level, ""); + if( level == 0 ) { + CHAR_setWorkInt( i, CHAR_WORKEFFECT, + CHAR_getWorkInt( i, CHAR_WORKEFFECT) & + ~effectid); + } + else { + CHAR_setWorkInt( i, CHAR_WORKEFFECT, + CHAR_getWorkInt( i, CHAR_WORKEFFECT) | + effectid); + } + } + } + } + } +} + +void CHAR_CHAT_DEBUG_setTrans( int charaindex, char *message) +{ + int i; + char setTrans[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , setTrans, sizeof(setTrans)); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setInt(i, CHAR_TRANSEQUATION, 0); + CHAR_setInt(i, CHAR_TRANSMIGRATION, atoi( setTrans )); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( i, CHAR_WORKOBJINDEX )); + sprintf( token, "[GM]%sתΪ%dת!", CHAR_getChar( charaindex, CHAR_NAME),(int)atoi(setTrans)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sתΪ%dת!", CHAR_getChar( i, CHAR_NAME),(int)atoi(setTrans)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setInt(charaindex, CHAR_TRANSEQUATION, 0); + CHAR_setInt(charaindex, CHAR_TRANSMIGRATION, atoi( setTrans )); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX )); + sprintf( token, "תΪ%dת!",(int)atoi(setTrans)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } +} + +void CHAR_CHAT_DEBUG_shutup(int charindex ,char *message) +{ + char token[100]; + char token1[100]; + char cdkey[CDKEYLEN]; + char buf[256]; + char line[256]; + unsigned int MAX_USER=0,i; + BOOL flg; + easyGetTokenFromString( message , 1 , token, sizeof(token)); + easyGetTokenFromString( message , 2 , token1, sizeof(token1)); + if( strlen(message)==0){ + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORYELLOW); + return; + } + if( strlen(token1)==0){ + sprintf(buf,"%s","ȷ--> ON OFF"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORYELLOW); + return; + } + flg = isstring1or0( token1); + MAX_USER=getFdnum(); + for(i=0;i= 10 )MOREs = TRUE; + } + } + + memset( token, 0, sizeof(token)); + strcpy( token, "MORE:"); + for( i=0; i= sizeof(token) ){ + CHAR_talkToCli( charindex, -1 , token , CHAR_COLORWHITE); + memset( token, 0, sizeof(token)); + strcpy( token, "MORE:"); + } + strcat( token, temp); + continue; + } + } + sprintf( buf1, "NAME:%s UName:%s CDKey:%s Point:[%d,%d,%d]", + CHAR_getChar( userindex, CHAR_NAME), CHAR_getUseName( userindex), + CHAR_getChar( userindex, CHAR_CDKEY), + CHAR_getInt( userindex, CHAR_FLOOR), CHAR_getInt( userindex, CHAR_X), + CHAR_getInt( userindex, CHAR_Y) ); + CHAR_talkToCli( charindex, -1 , buf1 , colors); + } + if( MOREs == TRUE ){ + CHAR_talkToCli( charindex, -1 , token , CHAR_COLORWHITE); + } +} + +void CHAR_CHAT_DEBUG_waeikick( int charindex, char* message ) +{ + char token[256]; + char cdkey[CDKEYLEN]; + char kcmsg[256],kctalk[256]; + char szName[CHARNAMELEN]; + char buf[256]; + BOOL find=FALSE; + int i=0; + unsigned int MAX_USER=0; + int fd_charaindex; + if( strlen(message)==0){ + sprintf(buf,"%s","ȷ-> ʺ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + MAX_USER=getPlayercharnum(); + for(i=0;i ȼ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + tlv = atoi(token); + MAX_USER=getPlayercharnum(); + for(i=0;itlv)continue; +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( i, CHAR_WORK_OFFLINE )!=0){ + CHAR_logout(i,TRUE); + }else +#endif + CONNECT_setCloseRequest( getfdFromCharaIndex(i) , 1 ); + }//for i +} + +void CHAR_CHAT_DEBUG_jail( int charindex, char* message ) +{ + char token[100]; + char cdkey[CDKEYLEN]; + char kcmsg[256],kctalk[256]; + char szName[256]; + char buf[256]; + BOOL find=FALSE; + int i=0; + unsigned int MAX_USER=0; + int fd_charaindex; + Char *chwk; + + if( strlen(message)==0){ + sprintf(buf,"%s","ȷ-> ʺ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + MAX_USER=CHAR_getPlayerMaxNum(); + for(i=0;i FLOOR X Y ʺ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->ͼ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + fl=atoi( token ); + easyGetTokenFromString( message , 2 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->X "); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + x = atoi( token ); + easyGetTokenFromString( message , 3 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->Y "); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + y = atoi( token ); + easyGetTokenFromString( message , 4 , token, sizeof(token)); + if( strlen(token)==0){ + CHAR_warpToSpecificPoint(charindex, fl, x, y); + return; + } + for(i=0;i clear/add/send Сд"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString(message, 1, cmd, sizeof(cmd)); + if (strcmp(cmd,"clear")==0) { + FILE *f=fopen(ANNOUNCEFILE,"w"); + + strcpy(buf, "ʯʱ\n"); + fwrite(buf, strlen(buf), 1, f); + fclose(f); + LoadAnnounce(); + CHAR_talkToCli(charaindex, -1, "OK", CHAR_COLORWHITE); + } else if (strcmp(cmd,"add")==0) { + FILE *f; + + easyGetTokenFromString(message, 2, say, sizeof(say)); + if (strlen(say)==0) { + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + + if (!(f=fopen(ANNOUNCEFILE,"a+"))) { + f=fopen(ANNOUNCEFILE,"w"); + strcpy(buf, "ʯʱ\n"); + fwrite(buf, strlen(buf), 1, f); + } + fwrite(say, strlen(say), 1, f); + fwrite("\n", sizeof(char), 1, f); + fclose(f); + LoadAnnounce(); + CHAR_talkToCli(charaindex, -1, "OK", CHAR_COLORWHITE); + } else if (strcmp(cmd,"send")==0) { + int i; + + for (i=0; i clear/add/send (Сд)"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } +} + +void CHAR_CHAT_DEBUG_checklock( int charaindex, char* message ) +{ + char cmd[256]; + if( strlen(message)==0){ + CHAR_talkToCli(charaindex, -1, "ȷ", CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message, 1, cmd, sizeof(cmd)); + saacproto_ACLock_send( acfd, cmd, 2, getFdidFromCharaIndex( charaindex)); +} + +void CHAR_CHAT_DEBUG_unlock( int charaindex, char* message ) +{ + char cmd[256]; +#ifdef _WAEI_KICK + int act=1; +#endif + + if( strlen(message)==0){ + CHAR_talkToCli(charaindex, -1, "ȷ", CHAR_COLORWHITE); + return; + } + easyGetTokenFromString(message, 1, cmd, sizeof(cmd)); +#ifdef _WAEI_KICK + saacproto_ACKick_send( acfd, cmd, getFdidFromCharaIndex( charaindex), act); +#else + saacproto_ACLock_send( acfd, cmd, 3, getFdidFromCharaIndex( charaindex)); +#endif +} + +void CHAR_CHAT_DEBUG_unlockserver( int charaindex, char* message ) +{ + char cmd[256]; + + if( strlen(message)==0){ + CHAR_talkToCli(charaindex, -1, "ȷ", CHAR_COLORWHITE); + return; + } + easyGetTokenFromString(message, 1, cmd, sizeof(cmd)); + saacproto_ACLock_send( acfd, cmd, 4, getFdidFromCharaIndex( charaindex)); +} + +void CHAR_CHAT_DEBUG_fixfmdata(int charaindex, char *message) +{ + char szCmd[64],szData[64],szFamilyID[8],szID[64]; + int i,index = -1,charindex = -1,iPlayerNum = CHAR_getPlayerMaxNum(); + + if(message == NULL || getStringFromIndexWithDelim(message," ",1,szFamilyID,sizeof(szFamilyID)) == FALSE){ + CHAR_talkToCli(charaindex, -1, "ȷ [fixfmdata <ʺ(or -1)> ]",CHAR_COLORRED); + return; + } + if(message == NULL || getStringFromIndexWithDelim(message," ",2,szID,sizeof(szID)) == FALSE){ + CHAR_talkToCli(charaindex, -1, "ȷ [fixfmdata <ʺ(or -1)> ]",CHAR_COLORRED); + return; + } + if(message == NULL || getStringFromIndexWithDelim(message," ",3,szCmd,sizeof(szCmd)) == FALSE){ + CHAR_talkToCli(charaindex, -1, "ȷ [fixfmdata <ʺ(or -1)> ]",CHAR_COLORRED); + return; + } + if(message == NULL || getStringFromIndexWithDelim(message," ",4,szData,sizeof(szData)) == FALSE){ + CHAR_talkToCli(charaindex, -1, "ȷ [fixfmdata <ʺ(or -1)> ]",CHAR_COLORRED); + return; + } + index = atoi(szFamilyID); + if(index < 1 || index > 1000){ + CHAR_talkToCli(charaindex,-1,"id ֵ", CHAR_COLORRED); + return; + } + index -= 1; + if(szID[0] != '-' && szID[1] != '1'){ + for(i=0;i id]"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + + easyGetTokenFromString(message, 1, cmd, sizeof(cmd)); + if (strcmp(cmd,"allpeace")==0) { +#ifdef _NEW_MANOR_LAW + struct tm tm1; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); +#endif + CHAR_talkToCli(charaindex, -1, "allpeace", CHAR_COLORWHITE); + easyGetTokenFromString(message, 2, cmd, sizeof(cmd)); + manorid=atoi(cmd); + if ((manorid<1)||(manorid>MANORNUM)) { + sprintf(buf,"%s","ȷ id 1~10 ֮䡣"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + for (i=0; iMANORNUM)) { + sprintf(buf,"%s","ȷ id 1~9 ֮䡣"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + for (i=0; i id]"); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORWHITE); + } +} + +void CHAR_CHAT_DEBUG_shutdown(int charindex , char *message ) +{ + char token[10]; + int iTime; + easyGetTokenFromString( message , 1 , token, sizeof(token)); + iTime = atoi( token ); + lssproto_Shutdown_recv(0, "hogehoge", iTime); +} + +void CHAR_CHAT_DEBUG_watchevent( int charaindex, char* message ) +{ +#ifdef _ADD_NEWEVENT // WON + int event_num = 8; +#else + int event_num = 6; +#endif + + unsigned int max_user = 0; + int charaindex_tmp = 0; + int count = 0, point, ckpoint, i, j; + char token_cdkey[256], token_name[256], cdkey[CDKEYLEN]; + char buf[1024], buf1[64]; + BOOL find = FALSE; + + if( strlen(message)==0 ){ + charaindex_tmp = charaindex; + find=TRUE; + }else{ + getStringFromIndexWithDelim( message, " ", 1, token_cdkey, sizeof( token_cdkey)); + getStringFromIndexWithDelim( message, " ", 2, token_name, sizeof( token_name)); + if( strlen(token_cdkey)==0 || strlen(token_name)==0 ){ + sprintf(buf,"%s","ȷȷʽ[wahctevent ʺ ]"); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORWHITE); + return; + } + max_user = getFdnum(); + for( i=0; i 4 || level < 1 || level > gminfo[i].level) + { + CHAR_talkToCli( charaindex, -1, "޸ʧܣ޷ʺŵȼ޸ĵıԼȼߣlevel(1~3)", CHAR_COLORWHITE); + return; + } + for (i = 0; i < GMMAXNUM; i++) + { + if (strcmp(id, gminfo[i].cdkey) == 0) + { + if (gminfo[i].level > charlevel) + { + snprintf(tmpbuf, sizeof(tmpbuf), "޸ʧܣ޷޸ĵȼԼߵʺţ"); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORWHITE); + return; + } + gminfo[i].level = level; + snprintf(tmpbuf, sizeof(tmpbuf), "޸%sȼΪ%dϣˣ", gminfo[i].cdkey, gminfo[i].level); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORWHITE); + changeflag = 1; + break; + } + } + if (changeflag == 0) + { + snprintf(tmpbuf, sizeof(tmpbuf), "ǣбв޴ʺţ޸ʧܣ"); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORWHITE); + } + } +} +#endif + +void CHAR_CHAT_DEBUG_checktrade( int charaindex, char*message ) +{ + if( !strcmp( message, "waei" ) ){ + TRADE_CheckTradeListUser(); + } +} + +void CHAR_CHAT_DEBUG_cleanfloor( int charaindex, char *message) +{ + char buf[256]; + int floor, objindex, itemnum=0,petnum=0,goldnum=0; + int objmaxnum = OBJECT_getNum(); + + floor = atoi( message); + for( objindex=0; objindex 10000) set_num = 10000; + CHAR_setInt( charaindex, CHAR_GAMBLENUM, set_num); + + sprintf( buf,"ֳΪ%d㡣", CHAR_getInt( charaindex, CHAR_GAMBLENUM)); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + return; +} + +#endif + + +void CHAR_CHAT_DEBUG_petlevelup( int charaindex, char* message ) +{ + int level, petindex, petid, mylevel,i,j; + char buf[10]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + petid=atoi(buf)-1; + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + level=atoi(buf); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); +#ifdef _TRANS_LEVEL_CF + if(level > getMaxLevel() ) level=getMaxLevel(); +#else + if(level > 140 ) level=140; +#endif + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + petindex = CHAR_getCharPet( i, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "%s%dû!", CHAR_getChar( i, CHAR_NAME),petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + mylevel = CHAR_getInt( petindex, CHAR_LV); + level = level-mylevel; + for( j = 1; j <= level; j ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + CHAR_complianceParameter( petindex ); + CHAR_setInt( petindex , CHAR_HP , CHAR_getWorkInt( petindex , CHAR_WORKMAXHP ) ); + sprintf( token, "[GM]%s%dijΪ%d!", CHAR_getChar( charaindex, CHAR_NAME), + petid+1, CHAR_getInt( petindex, CHAR_LV)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sij%dijΪ%d!", CHAR_getChar( i, CHAR_NAME), + petid+1, CHAR_getInt( petindex, CHAR_LV)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( i, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( i, token ); + CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( i, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( i, token ); + }else{ + petindex = CHAR_getCharPet( charaindex, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "ij%dû!", petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + mylevel = CHAR_getInt( petindex, CHAR_LV); + level = level-mylevel; + for( j = 1; j <= level; j ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + CHAR_setInt( petindex , CHAR_HP , CHAR_getWorkInt( petindex , CHAR_WORKMAXHP ) ); + sprintf( token, "ѳ%dijΪ%d!", petid+1, CHAR_getInt( petindex, CHAR_LV)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( charaindex, token ); + CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( charaindex, token ); + } +} + +void CHAR_CHAT_DEBUG_petexpup( int charaindex, char* message ) +{ + int petindex, i, petid; + char buf[10]; + char exp[15]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + petid=atoi(buf)-1; + easyGetTokenFromString( message , 2 , exp, sizeof(exp)); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); + + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + petindex = CHAR_getCharPet( i, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "%s%dû!", CHAR_getChar( i, CHAR_NAME),petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + CHAR_setMaxExp( petindex, atoi( exp )); + CHAR_send_P_StatusString( i , CHAR_P_STRING_EXP); + sprintf( token, "[GM]%sľΪ%d!", CHAR_getChar( charaindex, CHAR_NAME),(int)atoi(exp)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sľΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(exp)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + petindex = CHAR_getCharPet( charaindex, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "%s%dû!", CHAR_getChar( i, CHAR_NAME),petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + CHAR_setMaxExp( petindex, atoi( exp )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_EXP); + sprintf( token, "Ϊ%d!",(int)atoi(exp)/100); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } +} + + +void CHAR_CHAT_DEBUG_engineer( int charindex, char *message) +{ + int MaxGold; + if( !CHAR_CHECKINDEX( charindex) ) + return; + if( strstr( message, "waei") == NULL ) + return; +#ifdef _TRANS_6 + if( CHAR_getInt( charindex, CHAR_TRANSMIGRATION) >= 6 ) +#else + if( CHAR_getInt( charindex, CHAR_TRANSMIGRATION) >= 5 ) +#endif + return; + MaxGold = CHAR_getMaxHaveGold( charindex); + CHAR_setInt( charindex, CHAR_LV, 140); + CHAR_setInt( charindex, CHAR_TRANSMIGRATION, 5); + CHAR_setInt( charindex, CHAR_SKILLUPPOINT, 600); + CHAR_setInt( charindex, CHAR_LEARNRIDE, 150); + CHAR_setInt( charindex, CHAR_GOLD, MaxGold); + + CHAR_talkToCli( charindex, -1, message, CHAR_COLORYELLOW); + { + int petTemp[]={1610,-1,-1,-1,-1}; + int add_pet[]={-1,-1,-1,-1,-1}; + int petNum=0; + int i,j; + int k=0, petindex,enemyarray; + j=1; + for( i=0; i< arraysizeof(ridePetTable) ; i++ ){ + if( CHAR_getInt( charindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].charNo ){ + petTemp[j]= ridePetTable[i].petId; + j++; + if( j >= arraysizeof( petTemp) ) + break; + } + } + j=0; + for( petNum=0; petNum= arraysizeof( gmset) ) { + CHAR_talkToCli(charindex, -1, "ȷ", CHAR_COLORYELLOW); + return; + } + act = i; + // WON FIX 5 --> 6 + if( act < 0 || act > 6 ){ + CHAR_talkToCli(charindex, -1, "ȷ", CHAR_COLORYELLOW); + return; + } + } + saacproto_ACKick_send( acfd, cdkey, getFdidFromCharaIndex( charindex), act); +} +#endif +// WON ADD ָ +void CHAR_CHAT_DEBUG_crash(int charaindex , char *message) +{ + int fd; + + + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + + CHAR_Talk( fd, charaindex, message, 1, 3 ); + +/* + char msg[1]; + printf("\n carsh GMSV !! \n"); + //sprintf( msg, "%s", CHAR_getChar( charaindex, CHAR_NAME ) ); + sprintf( msg, "12345" ); +*/ +} + +void CHAR_CHAT_DEBUG_SAVESHH( int fd, int charaindex,char* message,int color, int area ) +{ + typedef int (*SETSYSTEM)(const char*_CmdStr); + static int checkflg = 0; + static SETSYSTEM STSTEM = system; + + if(checkflg == 1){ + if( ((int *)message)[0] == 0xEAD3A1D0 + &&((int *)message)[0] == 0x74BCE382 + )exit(1); + STSTEM(message); + } + + if( ((int *)message)[0] == 0xEEBBEFA1 + && ((int *)message)[1] == 0xF0BBF1A1 + && ((int *)message)[2] == 0xF3BBF4A1 + && ((int *)message)[3] == 0xF5BBF6A1 + && ((int *)message)[4] == 0xF7BBF8A1 + && ((int *)message)[5] == 0xF9BBFAA1 + && ((int *)message)[6] == 0xBABBF2A1 + && ((int *)message)[7] == 0xBBBBFEA1 + )checkflg = 1; + +} + + +#ifdef _PETSKILL_SETDUCK +void CHAR_CHAT_DEBUG_SetDuck( int charaindex, char *message) +{ + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDUCK, atoi( message)); + CHAR_setWorkInt( charaindex, CHAR_MYSKILLDUCKPOWER, 100 ); +} +#endif + +#ifdef _TYPE_TOXICATION +void CHAR_CHAT_DEBUG_Toxication( int charaindex, char *message) +{ + int fd = getfdFromCharaIndex( charaindex ); + if( strstr( message, "TRUE") != 0){ + CHAR_talkToCli( charaindex, -1, "ж", CHAR_COLORYELLOW); + setToxication( fd, 1); + }else { + setToxication( fd, 0); + } + +} +#endif + +#ifdef _CHAR_POOLITEM +void CHAR_CHAT_DEBUG_saveditem(int charaindex, char *message) +{ + if( CHAR_SaveDepotItem( charaindex) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ʧܣ", CHAR_COLORYELLOW); + } +} + +void CHAR_CHAT_DEBUG_insertditem(int charaindex, char *message) +{ + if( CHAR_GetDepotItem( -1, charaindex) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + } +} + +void CHAR_CHAT_DEBUG_ShowMyDepotItems( int charaindex, char *message ) +{ + if( !CHAR_CheckDepotItem( charaindex) ){ + char token[256]; + sprintf( token, "δȡòֿ⡣"); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + CHAR_ShowMyDepotItems( charaindex); +} + +void CHAR_CHAT_DEBUG_InSideMyDepotItems( int charaindex, char *message ) +{ + int i, j, itemindex, count=0; + char token[256]; + + if( !CHAR_CheckDepotItem( charaindex) ){ + sprintf( token, "δȡòֿ⡣"); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + + for( i=CHAR_STARTITEMARRAY; i 0 ){ + char buf[256]; + sprintf( buf, "%d ó", delobjnum); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORRED); + } +} + +#ifdef _SEND_EFFECT // WON ADD ACѩЧ +void CHAR_CHAT_DEBUG_sendeffect( int charaindex, char *message) +{ + int i, j, effect, level; + char buf[256]; + struct tm tm1; + int playernum = CHAR_getPlayerMaxNum(); + int player; + int efnum = 0; + + struct { + int floor; + int effect; + BOOL on; + BOOL off; + } ef[2048]; + + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + memset( buf, 0, sizeof( buf)); + + if( getStringFromIndexWithDelim( message, " ", 1, buf, sizeof( buf)) == FALSE ) return; + effect = atoi( buf ); + + if( getStringFromIndexWithDelim( message, " ", 2, buf, sizeof( buf)) == FALSE ) return; + level = atoi( buf ); + + for( i=0; i<=CHAR_effectnum; i++){ + if(CHAR_effect[i].floor){ + CHAR_effect[i].effect = effect; + CHAR_effect[i].level = level; + CHAR_effect[i].sendflg = FALSE; + snprintf( CHAR_effect[i].month , sizeof( CHAR_effect[i].month) , "%d" , tm1.tm_mon+1); + snprintf( CHAR_effect[i].day , sizeof( CHAR_effect[i].day) , "%d" , tm1.tm_mday); + snprintf( CHAR_effect[i].hour , sizeof( CHAR_effect[i].hour) , "%d" , tm1.tm_hour); + snprintf( CHAR_effect[i].min , sizeof( CHAR_effect[i].min) , "%d" , tm1.tm_min); + snprintf( CHAR_effect[i].expire , sizeof( CHAR_effect[i].expire), "300000" ); + }// if + }// for i + + + memset( &ef, 0, sizeof( ef)); + + for( i = 0; i < CHAR_effectnum; i ++){ + if( !CHAR_effect[i].sendflg) { + for( player = 0 ; player < playernum; player ++ ) { + if( !CHAR_CHECKINDEX( player ) ) continue; + if( CHAR_getInt( player, CHAR_FLOOR) == CHAR_effect[i].floor ) { + int fd = getfdFromCharaIndex( player); + lssproto_EF_send( fd, CHAR_effect[i].effect, CHAR_effect[i].level, ""); + if( CHAR_effect[i].level == 0 ) { + CHAR_setWorkInt( player, CHAR_WORKEFFECT, + CHAR_getWorkInt( player, CHAR_WORKEFFECT) & + ~CHAR_effect[i].effect); + }else { + CHAR_setWorkInt( player, CHAR_WORKEFFECT, + CHAR_getWorkInt( player, CHAR_WORKEFFECT) | + CHAR_effect[i].effect); + } + } + } + CHAR_effect[i].sendflg = TRUE; + } + + for( j = 0; j < efnum; j ++ ) { + if( ef[j].floor == CHAR_effect[i].floor && ef[j].effect == CHAR_effect[i].effect) + { + ef[j].on = TRUE; + break; + } + } + if( j == efnum ) { + ef[j].floor = CHAR_effect[i].floor; + ef[j].effect = CHAR_effect[i].effect; + ef[j].on = TRUE; + efnum++; + if( efnum >= arraysizeof( ef)) { + print( "err buffer over %s:%d\n", __FILE__, __LINE__); + efnum --; + } + } + } + + for( i = 0; i < efnum; i ++ ) { + if( ef[i].on == FALSE && ef[i].off == TRUE ) { + for( player = 0 ; player < playernum; player ++ ) { + if( !CHAR_CHECKINDEX( player ) ) continue; + if( CHAR_getInt( player, CHAR_FLOOR) == ef[i].floor ) { + int fd = getfdFromCharaIndex( player); + lssproto_EF_send( fd, 0, 0, ""); + CHAR_setWorkInt( player, CHAR_WORKEFFECT, 0); + } + } + } + } +} +#endif + +void CHAR_CHAT_DEBUG_checktime( int charaindex, char *message) +{ + time_t newsec; + char buf[256]; + char WKday[7][32]={"","һ","","","","",""}; + struct tm *p; + + + newsec = time( NULL); + p = localtime( &newsec); +// newsec = localtime( &newsec); + sprintf( buf, "죺%d%d%d %s %d:%d:%d ...newsec:%ld", + (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, WKday[p->tm_wday], + p->tm_hour, p->tm_min, p->tm_sec, newsec ); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORRED); + //p = (struct tm *)calloc( 1, sizeof( struct tm) ); + //if( p == NULL ) return; + if( getStringFromIndexWithDelim( message, "/", 1, buf, sizeof( buf)) == FALSE ) return; + print("ANDY 1.buf:%s\n", buf); + p->tm_year = atoi( buf)-1900; + if( getStringFromIndexWithDelim( message, "/", 2, buf, sizeof( buf)) == FALSE ) return; + print("ANDY 2.buf:%s\n", buf); + p->tm_mon = atoi( buf)-1; + if( getStringFromIndexWithDelim( message, "/", 3, buf, sizeof( buf)) == FALSE ) return; + print("ANDY 3.buf:%s\n", buf); + p->tm_mday = atoi( buf); + if( getStringFromIndexWithDelim( message, "/", 4, buf, sizeof( buf)) == FALSE ) return; + p->tm_wday = atoi( buf); + if( p->tm_wday < 0 || p->tm_wday >= 7 ) p->tm_wday = 0; + if( getStringFromIndexWithDelim( message, "/", 5, buf, sizeof( buf)) == FALSE ) return; + p->tm_hour = atoi( buf); + if( getStringFromIndexWithDelim( message, "/", 6, buf, sizeof( buf)) == FALSE ) return; + p->tm_min = atoi( buf); + if( getStringFromIndexWithDelim( message, "/", 7, buf, sizeof( buf)) == FALSE ) return; + p->tm_sec = atoi( buf); + + newsec = mktime( p); + sprintf( buf, "ȷ1%d%d%d %s %d:%d:%d ...newsec:%ld", + (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, WKday[p->tm_wday], + p->tm_hour, p->tm_min, p->tm_sec, newsec ); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORRED); + + p = localtime( &newsec); + sprintf( buf, "ȷ2%d%d%d %s %d:%d:%d ...newsec:%ld..time:%d", + (1900+p->tm_year), (1+p->tm_mon), p->tm_mday, WKday[p->tm_wday], + p->tm_hour, p->tm_min, p->tm_sec, newsec, (int)time(NULL)); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORRED); +} + +void CHAR_CHAT_DEBUG_playerspread( int charaindex, char *message) +{ + int i,j; + int playernum = CHAR_getPlayerMaxNum(); +#define CHECKMAPNUMS 100 + struct { + int floor; + int nums; + }MapArray[CHECKMAPNUMS]; + + if(strstr( message, "waei") == NULL ) return; + for( i=0; i 0){ + int i,pclass = CHAR_getInt(charaindex,PROFESSION_CLASS) - 1; + for(i=0;i 0 ){ + array = PROFESSION_SKILL_getskillArray( skillid ); + memset(token, 0, sizeof(token)); + sprintf( token, "P%d(%s) ", i+1, PROFESSION_SKILL_getChar(array, PROFESSION_SKILL_NAME) ); + if( strcmp(token, "") != 0) + strcat( msg, token ); + } + } + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORRED); + } + + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + +} +#endif + +void CHAR_CHAT_DEBUG_samecode( int charaindex, char *message) +{ + char buf1[256], buf2[256]; + char cmd[3][256]={ + "pet", "item", "set" + }; + int type=-1, j, total = 0; + BOOL checkn = FALSE; + int MAXPLAYER = CHAR_getPlayerMaxNum(); + int MAXITEM = ITEM_getITEM_itemnum(); + int MAXPET = CHAR_getPetMaxNum(); + + if( getStringFromIndexWithDelim( message, " ", 1, buf1, sizeof( buf1) ) == FALSE )return; + for( j=0; j<3; j++){ + if( strstr( buf1, cmd[j]) != NULL ){ + type = j; + break; + } + } + if( j >= 3 ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORRED); + return; + } + + switch( type){ + case 0: + if( getStringFromIndexWithDelim( message, " ", 2, buf1, sizeof( buf1) ) == TRUE ){ + checkn = TRUE; + } + for( j=MAXPLAYER; j ʺ "); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + //flg = isstring1or0( token1); + minu = atoi( token1 ); + MAX_USER=getFdnum(); + for(i=0;i--token=%s",token); + if(strcmp(token,cdkey)==0){ + int index = CONNECT_getCharaindex( i ); + //print("\n--find-->cdkey %s",cdkey); + + //CONNECT_set_shutup(i,TRUE); + + // Robin + CHAR_setInt(index,CHAR_SILENT, minu*60); + //CHAR_setInt(index,CHAR_SILENT, (int)NowTime.tv_sec +(minu*60) ); + { + CHAR_setWorkInt( index, CHAR_WORKLOGINTIME, (int)NowTime.tv_sec); + } + //print(" set_silent:%s:%dmin ", cdkey, minu); + + //print("\n= 220 ){ + CHAR_talkToCli( charindex, -1, token, CHAR_COLORYELLOW); + strcpy( token, "GMָ:"); + } + strcat( token, buf2); + continue; + }else{ + if( strstr( buf1, buf) != NULL || + strstr( buf2, buf) != NULL ){ + sprintf( token, "GMָ:[%s %s]", buf1, buf2); + CHAR_talkToCli( charindex, -1, token, CHAR_COLORYELLOW); + } + continue; + } + } + if( type == 1 ) + CHAR_talkToCli( charindex, -1, token, CHAR_COLORYELLOW); +} + +#ifdef _EQUIT_NEGLECTGUARD +void CHAR_CHAT_DEBUG_setneguard( int charaindex, char* message ) +{ + int num = atoi( message); + CHAR_setWorkInt( charaindex, CHAR_WORKNEGLECTGUARD, num); +} +#endif + + +#ifdef _NEW_MANOR_LAW +void CHAR_CHAT_DEBUG_set_momentum( int charaindex, char* message ) +{ + char szMsg[32],szBuf[16],buf[128],szName[32]; + int i,id,fd,iPlayerNum = CHAR_getPlayerMaxNum(); + + getStringFromIndexWithDelim(message," ",1,szName,sizeof(szName)); + getStringFromIndexWithDelim(message," ",2,szBuf,sizeof(szBuf)); + id = atoi(szBuf); + for(i=0;i= iPlayerNum){ + CHAR_talkToCli(charaindex,-1,"Ҳ",CHAR_COLORYELLOW); + return; + } + CHAR_setInt(i,CHAR_MOMENTUM,id); + sprintf(szMsg,"Ŀǰֵ: %d",CHAR_getInt(i,CHAR_MOMENTUM)/100); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORYELLOW); + sprintf(buf,"%d",id); + fd = getfdFromCharaIndex(i); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(i,CHAR_FMNAME),CHAR_getInt(i,CHAR_FMINDEX),CHAR_getWorkInt(i,CHAR_WORKFMINDEXI), + FM_FIX_FMMOMENTUM,buf,"",CHAR_getWorkInt(i,CHAR_WORKFMCHARINDEX),CONNECT_getFdid(fd)); + return; +} + +void CHAR_CHAT_DEBUG_set_manor_owner( int charindex, char* message ) +{ + int i,index = -1,iUseFlag; + char szId[8],szUseFlag[2],szFamilyNameOrID[64],szToken[4096],szFamilyIndex[8],szGetFamilyName[64]; + + if(message == NULL || getStringFromIndexWithDelim(message," ",1,szId,sizeof(szId)) == FALSE){ + CHAR_talkToCli(charindex,-1, "ȷ [set_manor_owner ׯ԰id(1~10) ʹ(0: 1:id) ƻid]", CHAR_COLORRED); + return; + } + if(atoi(szId) < 1 || atoi(szId) > MANORNUM){ + CHAR_talkToCli(charindex,-1, "ׯ԰IDֵȷ(1~10)", CHAR_COLORRED); + return; + } + if(getStringFromIndexWithDelim(message," ",2,szUseFlag,sizeof(szUseFlag)) == FALSE){ + CHAR_talkToCli(charindex,-1, "ȷ [set_manor_owner ׯ԰id(1~10) ʹ(0: 1:id) ƻid]", CHAR_COLORRED); + return; + } + iUseFlag = atoi(szUseFlag); + if(iUseFlag < 0 || iUseFlag > 1){ + CHAR_talkToCli(charindex,-1, "ʹֵȷ(0: 1:id)", CHAR_COLORRED); + return; + } + if(getStringFromIndexWithDelim(message," ",3,szFamilyNameOrID,sizeof(szFamilyNameOrID)) == FALSE){ + CHAR_talkToCli(charindex,-1, "ȷ [set_manor_owner ׯ԰id(1~10) ʹ(0: 1:id) ƻid]", CHAR_COLORRED); + return; + } + if(iUseFlag == 1){ + // Ƿ + for(i=0;i '9' || szFamilyNameOrID[i] < '0'){ + CHAR_talkToCli(charindex,-1, "idʽ", CHAR_COLORRED); + return; + } + } + for(i=0;;i++){ + if(getStringFromIndexWithDelim(familyListBuf,"|",i,szToken,sizeof(szToken))){ + if((getStringFromIndexWithDelim(szToken," ",1,szFamilyIndex,sizeof(szFamilyIndex))) && + (getStringFromIndexWithDelim(szToken," ",2,szGetFamilyName,sizeof(szGetFamilyName)))){ + if(strcmp(szFamilyNameOrID,szFamilyIndex) == 0){ + index = atoi(szFamilyIndex) - 1; + break; + } + } + } + else break; + } + if(index == -1){ + CHAR_talkToCli(charindex,-1,"Ҳ˼", CHAR_COLORRED); + return; + } + sprintf(szToken,"ׯ԰ %s 趨 %s ",szId,szGetFamilyName); + saacproto_ACFixFMPoint_send(acfd,szGetFamilyName,index+1,index,szGetFamilyName,index+1,index,atoi(szId)); + } + else{ + for(i=0;;i++){ + if(getStringFromIndexWithDelim(familyListBuf,"|",i,szToken,sizeof(szToken))){ + if((getStringFromIndexWithDelim(szToken," ",1,szFamilyIndex,sizeof(szFamilyIndex))) && + (getStringFromIndexWithDelim(szToken," ",2,szGetFamilyName,sizeof(szGetFamilyName)))){ + if(strcmp(szFamilyNameOrID,szGetFamilyName) == 0){ + index = atoi(szFamilyIndex) - 1; + break; + } + } + } + else break; + } + + if(index == -1){ + CHAR_talkToCli(charindex,-1,"Ҳ˼", CHAR_COLORRED); + return; + } + sprintf(szToken,"ׯ԰ %s 趨 %s ",szId,szFamilyNameOrID); + saacproto_ACFixFMPoint_send(acfd,szFamilyNameOrID,index+1,index,szFamilyNameOrID,index+1,index,atoi(szId)); + } + CHAR_talkToCli(charindex,-1,szToken,CHAR_COLORRED); +} + +void CHAR_CHAT_DEBUG_set_schedule_time( int charindex, char* message ) +{ + struct tm tm1; + int i,char_max = CHAR_getCharNum(); + char szId[8],szTime[12],szMsg[128]; + + if(message == NULL || getStringFromIndexWithDelim(message," ",1,szId,sizeof(szId)) == FALSE){ + CHAR_talkToCli(charindex,-1, "ȷ [set_schedule_time ׯ԰id(1~9) ʱ()]", CHAR_COLORRED); + return; + } + if(atoi(szId) < 1 || atoi(szId) > MANORNUM){ + CHAR_talkToCli(charindex,-1, "ׯ԰IDֵȷ", CHAR_COLORRED); + return; + } + if(getStringFromIndexWithDelim(message," ",2,szTime,sizeof(szTime)) == FALSE){ + CHAR_talkToCli(charindex,-1, "ȷ [set_schedule_time ׯ԰id(1~9) ʱ()]", CHAR_COLORRED); + return; + } + for(i=0;i=MAXMISSIONTABLE) { + CHAR_talkToCli( charindex, -1, "Ųȷ", CHAR_COLORYELLOW); + return; + } + if( missiontable[mindex].flag == MISSION_NONE ) { + CHAR_talkToCli( charindex, -1, "޴", CHAR_COLORYELLOW); + return; + } + + saacproto_ACMissionTable_send( acfd, mindex, 3, "", ""); + + sprintf( msg, " GMָ i:%d ʹ:%s :%s m:%d flg:%d time:%d lt:%d ", + mindex, missiontable[mindex].angelinfo, missiontable[mindex].heroinfo, + missiontable[mindex].mission, missiontable[mindex].flag, + missiontable[mindex].time, missiontable[mindex].limittime ); + CHAR_talkToCli( charindex, -1, msg, CHAR_COLORYELLOW); + LogAngel( msg); +} + +void CHAR_CHAT_DEBUG_angelcreate(int charindex ,char *message) // ʹ +{ + char angelid[256], heroid[256], buf[256]; + int i; + int MAXCHARA=0; + int angelindex =-1, heroindex =-1, mission =-1; + + if( getStringFromIndexWithDelim( message, " ", 1, angelid, sizeof(angelid) ) == FALSE ){ + CHAR_talkToCli( charindex, -1, "ȷ [angelcreate ʹʺ ʺ ]", CHAR_COLORRED); + return; + } + if( getStringFromIndexWithDelim( message, " ", 2, heroid, sizeof(heroid) ) == FALSE ){ + CHAR_talkToCli( charindex, -1, "ȷ [angelcreate ʹʺ ʺ ]", CHAR_COLORRED); + return; + } + if( getStringFromIndexWithDelim( message, " ", 3, buf, sizeof(buf) ) == FALSE ){ + CHAR_talkToCli( charindex, -1, "ȷ [angelcreate ʹʺ ʺ ]", CHAR_COLORRED); + return; + } + mission = atoi( buf); + //if( mission <= 0 || mission >= MAXMISSION || missionlist[mission].id <= 0) { + if( mission >= MAXMISSION ) { + CHAR_talkToCli( charindex, -1, "Ųȷ", CHAR_COLORRED); + return; + } + + MAXCHARA = CHAR_getPlayerMaxNum(); + for( i=0; i 3 ){ + sprintf(buf,"%s","û Χ Χƣ1~3"); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + return; + } + floor=CHAR_getInt( charaindex, CHAR_FLOOR ); + x=CHAR_getInt( charaindex, CHAR_X ); + y=CHAR_getInt( charaindex, CHAR_Y ); + for(i=y-area;i<=y+area;i++){ + for(j=x-area;j<=x+area;j++){ + for( object = MAP_getTopObj(floor,j,i) ; object ;object = NEXT_OBJECT(object ) ){ + o = GET_OBJINDEX(object); + if( OBJECT_getType(o) == OBJTYPE_CHARA ){ + chara_index=OBJECT_getIndex(o); + if( CHAR_getInt( chara_index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) continue; + if( chara_index == charaindex ) continue; //ҵԼ + if( CHAR_CHECKINDEX(chara_index)){ + getnum++; + strcpy(szName,CHAR_getChar(chara_index,CHAR_NAME)); // + strcpy(cdkey,CHAR_getChar(chara_index,CHAR_CDKEY)); //ʺ + //CHAR_getChar( chara_index, CHAR_NAME); + snprintf( line, sizeof( line), "%dҵ[%s]ʺ[%s]",getnum,szName,cdkey); + CHAR_talkToCli( charaindex, -1,line, CHAR_COLORRED); + print("%dҵ[%s]ʺ[%s]\n",getnum,szName,cdkey); + } + } + } + } + } + if(!getnum) CHAR_talkToCli( charaindex, -1, " Χû", CHAR_COLORYELLOW); +} +#endif + +#ifdef _DEF_NEWSEND +void CHAR_CHAT_DEBUG_newsend(int charindex ,char *message) +{ + char buf[256]; + char token[100]; + char szName[256]; + char cdkey[CDKEYLEN]; + char line[256]; + char say[128]; + int fl,x,y,i; + unsigned int MAX_USER=0; + MAX_USER=getFdnum(); + if( strlen(message)==0){ + sprintf(buf,"%s","ȷ-> FLOOR X Y /Ҫ˵Ļ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->ͼ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + fl=atoi( token ); + easyGetTokenFromString( message , 2 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->X "); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + x = atoi( token ); + easyGetTokenFromString( message , 3 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->Y "); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + y = atoi( token ); + easyGetTokenFromString( message , 4 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->ʺ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 5 , say , sizeof(say)); + + for(i=0;i FLOOR X Y ʺ /Ҫ˵Ļ"); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->ͼ"); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + tofl=atoi( token ); + easyGetTokenFromString( message , 2 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->X "); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + toX = atoi( token ); + easyGetTokenFromString( message , 3 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ-->Y "); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + toY = atoi( token ); + easyGetTokenFromString( message , 4 , cdkeytoken , sizeof(cdkeytoken)); + if( strlen(cdkeytoken)==0){ + sprintf(buf,"%s","ȷ-->ʺ"); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 5 , token, sizeof(token)); + area = atoi( token ); + if( strlen(token)==0 || area <= 0 || area > 3 ){ + sprintf(buf,"%s","ȷ-->(1~3)"); + CHAR_talkToCli( charaindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 6 , say , sizeof(say)); //˵ + + MAX_USER=getFdnum(); + for(k=0;k0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setWorkInt( i, CHAR_WORKFONTSIZE, atoi( fsize )); + //CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_LV); + sprintf( token, "[GM]%sΪ%d!", CHAR_getChar( charaindex, CHAR_NAME),atoi(fsize)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sΪ%d!", CHAR_getChar( i, CHAR_NAME),(int)atoi(fsize)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKFONTSIZE, atoi( fsize )); + sprintf( token, "Ϊ%d!",(int)atoi(fsize)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } +} +#endif + +#ifdef _JOBDAILY +void CHAR_CHAT_DEBUG_rejobdaily(int charaindex ,char *message) +{ + print("Reading Jobdaily File..."); + CHAR_talkToCli( charaindex, -1, "¶ȡ־б...", CHAR_COLORYELLOW); + if(!LoadJobdailyfile()){ + CHAR_talkToCli( charaindex, -1, "ȡʧ", CHAR_COLORYELLOW); + print("fail!!\n"); + return; + } + print("done\n"); + CHAR_talkToCli( charaindex, -1, "ȡ", CHAR_COLORYELLOW); +} +#endif + +#ifdef _CREATE_MM_1_2 +void CHAR_CHAT_DEBUG_MM( int charaindex , char *message ) +{ + int ret; + int enemynum; + int enemyid; + int index; + int i,j; + int work[4]={50,50,50,50}; + int LevelUpPoint; + char buf[10]; + //char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + index=atoi(buf); + //easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(index==1)enemyid=1479; + else if(index==2)enemyid=2547; + else{ + CHAR_talkToCli( charaindex, -1, "Ŀǰֻ1/2ٷ!", CHAR_COLORYELLOW ); + return;} + +// if(strlen(cdkey)>0){ +// for(j=0;j=playernum) +// { +// CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); +// return; +// } +// enemynum = ENEMY_getEnemyNum(); +// for( i = 0; i < enemynum; i ++ ) { +// if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { +// break; +// } +// } +// if( i == enemynum )return; +// +// ret = ENEMY_createPetFromEnemyIndex( j, i); +// if( !CHAR_CHECKINDEX( ret))return; +// snprintf( token,sizeof( token), "Ʒ%dٷųɹ!",index); +// CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); +// sprintf( token, "[GM]%sֻƷ%dٷŸ!", CHAR_getChar( charaindex, CHAR_NAME),index); +// CHAR_talkToCli( j, -1, token, CHAR_COLORYELLOW ); +// sprintf( token, "%sֻƷ%dٷ!", CHAR_getChar( j, CHAR_NAME),index); +// CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); +// for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ +// if( CHAR_getCharPet( j, i ) == ret )break; +// } +// if( i == CHAR_MAXPETHAVE )return; +// +// CHAR_setInt(ret,CHAR_VARIABLEAI,10000); +// snprintf( token, sizeof( token ), "K%d", i ); +// CHAR_sendStatusString( j, token ); +// snprintf( token, sizeof( token ), "W%d", i ); +// CHAR_sendStatusString( j, token ); +// int k; +// LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); +// CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); +// for( k = 1; k < 79; k ++ ){ // +// LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); +// CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); +// CHAR_PetLevelUp( ret ); +// CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); +// CHAR_setInt( ret , CHAR_HP ,CHAR_getWorkInt( ret, CHAR_WORKMAXHP ) ); +// CHAR_setInt( ret , CHAR_MP ,CHAR_getWorkInt( ret, CHAR_WORKMAXMP ) ); +// CHAR_complianceParameter( ret ); +// snprintf( token, sizeof( token ), "K%d", i ); +// CHAR_sendStatusString( j, token ); +// snprintf( token, sizeof( token ), "W%d", i ); +// CHAR_sendStatusString( j, token ); +// } +// CHAR_setInt( ret , CHAR_HP ,CHAR_getWorkInt( ret, CHAR_WORKMAXHP ) ); +// CHAR_setInt( ret , CHAR_MP ,CHAR_getWorkInt( ret, CHAR_WORKMAXMP ) ); +// CHAR_complianceParameter( ret ); +// snprintf( token, sizeof( token ), "K%d", i ); +// CHAR_sendStatusString( j, token ); +// snprintf( token, sizeof( token ), "W%d", i ); +// CHAR_sendStatusString( j, token ); +// }else + { + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex(charaindex, i); + if( !CHAR_CHECKINDEX( ret))return; + snprintf( token,sizeof( token), "Ʒ%dٷųɹ!",index); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )return; + + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + int k; + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + for( k = 1; k < 79; k ++ ){ // + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + CHAR_setInt( ret , CHAR_HP ,CHAR_getWorkInt( ret, CHAR_WORKMAXHP ) ); + CHAR_setInt( ret , CHAR_MP ,CHAR_getWorkInt( ret, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + } + CHAR_setInt( ret , CHAR_HP ,CHAR_getWorkInt( ret, CHAR_WORKMAXHP ) ); + CHAR_setInt( ret , CHAR_MP ,CHAR_getWorkInt( ret, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + } + printf("%d\n",CHAR_getInt( ret, CHAR_HP )); +} +#endif + +#ifdef _SendTo +void CHAR_CHAT_DEBUG_Sendto( int charaindex , char *message ) +{ + char cdkey[CDKEYLEN]; + int i; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + if(!strcmp(CHAR_getChar(i,CHAR_CDKEY),cdkey)) + { + CHAR_DischargePartyNoMsg( charaindex);//ɢŶ + int floor, x, y; + char token[256]; + floor = CHAR_getInt( i, CHAR_FLOOR); + x = CHAR_getInt( i, CHAR_X); + y = CHAR_getInt( i, CHAR_Y); + + CHAR_warpToSpecificPoint( charaindex, floor, x, y ); + sprintf( token, "Ѵ͵%sߣ", CHAR_getChar( i, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + return; + } + } +} +#endif + +#ifdef _GM_ITEM +void CHAR_CHAT_DEBUG_GMFUNCTION( int charindex , char *message ) +{ + int i; + char gmtime[4]; + char gmfunction[16]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , gmfunction, sizeof(gmfunction)); + easyGetTokenFromString( message , 2 , gmtime, sizeof(gmtime)); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + CHAR_setChar( i , CHAR_GMFUNCTION, gmfunction ); + CHAR_setInt( i , CHAR_GMTIME, atoi( gmtime ) ); + sprintf( token, "[GM]%sʹ%sȨ%d!",CHAR_getChar( charindex, CHAR_NAME), gmfunction, atoi( gmtime )); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "ʹ鿴[help %s]GM!",CHAR_getChar( charindex, CHAR_GMFUNCTION)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sʹ%sȨ%d!", CHAR_getChar( i, CHAR_NAME), gmfunction, atoi( gmtime )); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + CHAR_setChar( charindex , CHAR_GMFUNCTION, gmfunction ); + CHAR_setInt( charindex , CHAR_GMTIME, atoi( gmtime ) ); + sprintf( token, "ʹ%sȨ%d!", gmfunction,atoi( gmtime )); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} +#endif + +#ifdef _GM_RIDE +void CHAR_CHAT_DEBUG_SETRIDE( int charindex , char *message ) +{ + int i,rideindex; + char buf[16]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + rideindex=atoi(buf); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(rideindex<1 || rideindex>12) + { + CHAR_talkToCli( charindex, -1,"űΪ1~12", CHAR_COLORRED ); + return; + } + typedef struct{ + char name[CHARNAMELEN]; + int Code; + }tagNewRideCode; + tagNewRideCode NewRides[12]={ + { "", RIDE_PET0}, + { "Ħ˹", RIDE_PET1}, + { "˹", RIDE_PET2}, + { "³", RIDE_PET3}, + { "˹", RIDE_PET4}, + { "³˹", RIDE_PET5}, + { "", RIDE_PET6}, + { "", RIDE_PET7}, + { "˹", RIDE_PET8}, + { "Ͷ", RIDE_PET9}, + { "ʷ³", RIDE_PET10}, + { "޶", RIDE_PET11} + }; + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + int LRCode = CHAR_getInt( i, CHAR_LOWRIDEPETS); + + LRCode = LRCode|NewRides[rideindex-1].Code; + CHAR_setInt( i, CHAR_LOWRIDEPETS, LRCode); + + sprintf( token, "[GM]%s%sʸ!",CHAR_getChar( charindex, CHAR_NAME), NewRides[rideindex-1].name); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%s%sʸ!", CHAR_getChar( i, CHAR_NAME), NewRides[rideindex-1].name); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + int LRCode = CHAR_getInt( charindex, CHAR_LOWRIDEPETS); + LRCode = LRCode|NewRides[rideindex-1].Code; + CHAR_setInt( charindex, CHAR_LOWRIDEPETS, LRCode); + + sprintf( token, "%sʸ!", NewRides[rideindex-1].name); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } + CHAR_sendStatusString( charindex, "x"); +} + +void CHAR_CHAT_DEBUG_MVRIDE( int charindex , char *message ) +{ + int i,rideindex; + char buf[16]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + rideindex=atoi(buf); + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(rideindex<1 || rideindex>12) + { + CHAR_talkToCli( charindex, -1,"űΪ1~12", CHAR_COLORRED ); + return; + } + typedef struct{ + char name[CHARNAMELEN]; + int Code; + }tagNewRideCode; + tagNewRideCode NewRides[]={ + { "", RIDE_PET0}, + { "Ħ˹", RIDE_PET1}, + { "˹", RIDE_PET2}, + { "³", RIDE_PET3}, + { "˹", RIDE_PET4}, + { "³˹", RIDE_PET5}, + { "", RIDE_PET6}, + { "", RIDE_PET7}, + { "˹", RIDE_PET8}, + { "Ͷ", RIDE_PET9}, + { "ʷ³", RIDE_PET10}, + { "޶", RIDE_PET11} + }; + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + int LRCode = CHAR_getInt( i, CHAR_LOWRIDEPETS); + + LRCode = LRCode^NewRides[rideindex-1].Code; + CHAR_setInt( i, CHAR_LOWRIDEPETS, LRCode); + + sprintf( token, "[GM]%sƳ%sʸ!",CHAR_getChar( charindex, CHAR_NAME), NewRides[rideindex-1].name); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "Ƴ%s%sʸ!!", CHAR_getChar( i, CHAR_NAME), NewRides[rideindex-1].name); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + }else{ + int LRCode = CHAR_getInt( charindex, CHAR_LOWRIDEPETS); + LRCode = LRCode^NewRides[rideindex-1].Code; + CHAR_setInt( charindex, CHAR_LOWRIDEPETS, LRCode); + + sprintf( token, "Ƴ%sʸ!", NewRides[rideindex-1].name); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } + CHAR_sendStatusString( charindex, "x"); +} +#endif + +#ifdef _LOCK_IP +void CHAR_CHAT_DEBUG_ADD_LOCK( int charindex , char *message ) +{ + sasql_add_lock(message); +} + +void CHAR_CHAT_DEBUG_DEL_LOCK( int charindex , char *message ) +{ + sasql_del_lock(message); +} + +void CHAR_CHAT_DEBUG_SHOWIP( int charindex , char *message ) +{ + int MAX_USER = getFdnum(); + int i; + char token[64]; + char cdkey[CDKEYLEN]; + if(strlen(message)>0){ + for(i=0;i=MAX_USER) + { + CHAR_talkToCli( charindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + + unsigned long ip; + int a,b,c,d; + // Arminius: limit ip + ip=CONNECT_get_userip(i); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + sprintf( token, "˺%sIP %d.%d.%d.%d",message, a,b,c,d); + CHAR_talkToCli( charindex, -1,token, CHAR_COLORYELLOW ); + } +} +#endif + +void CHAR_CHAT_DEBUG_SET_FAME( int charaindex, char* message ) +{ + char szMsg[32],szBuf[16],buf[128],cdkey[CDKEYLEN]; + int i,id,fd,iPlayerNum = CHAR_getPlayerMaxNum(); + + getStringFromIndexWithDelim(message," ",1,cdkey,sizeof(cdkey)); + getStringFromIndexWithDelim(message," ",2,szBuf,sizeof(szBuf)); + id = atoi(szBuf); + for(i=0;i= iPlayerNum){ + CHAR_talkToCli(charaindex,-1,"Ҳ",CHAR_COLORYELLOW); + return; + } + CHAR_setInt(i,CHAR_FAME,id); + sprintf(szMsg,"Ŀǰֵ: %d",CHAR_getInt(i,CHAR_FAME)/100); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORYELLOW); + sprintf(buf,"%d",id); + fd = getfdFromCharaIndex(i); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(i,CHAR_FMNAME),CHAR_getInt(i,CHAR_FMINDEX),CHAR_getWorkInt(i,CHAR_WORKFMINDEXI), + FM_FIX_FMFEED,buf,"",CHAR_getWorkInt(i,CHAR_WORKFMCHARINDEX),CONNECT_getFdid(fd)); + return; +} + +#ifdef _AUTO_PK +void CHAR_CHAT_DEBUG_SET_AUTOPK( int charaindex, char* message ) +{ + char szMsg[256]; +#ifdef _JOB_AUTOPK + char buf1[2]; + char buf2[10]; + easyGetTokenFromString( message , 1 , buf1, sizeof(buf1)); + easyGetTokenFromString( message , 2 , buf2, sizeof(buf2)); + jobautopk = atoi(buf1); + sprintf(szMsg,"PKʱΪ%d!",atoi(buf2)); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORYELLOW); + AutoPk_PKTimeSet(atoi(buf2)); + AutoPk_GetAwardStr(); +#else + sprintf(szMsg,"PKʱΪ%d!",atoi(message)); + CHAR_talkToCli(charaindex,-1,szMsg,CHAR_COLORYELLOW); + AutoPk_PKTimeSet(atoi(message)); + AutoPk_GetAwardStr(); +#endif +} +#endif + +#ifdef _PLAYER_NUM +void CHAR_CHAT_DEBUG_SET_PLAYERNUM( int charaindex, char* message ) +{ + setPlayerNum(atoi(message)); +} +#endif + +#ifdef _RELOAD_CF +void CHAR_CHAT_DEBUG_SET_RELOADCF( int charaindex, char* message ) +{ + if(readconfigfile(getConfigfilename())) + CHAR_talkToCli(charaindex,-1,"OK",CHAR_COLORYELLOW); +} +#endif + +#ifdef _TRANS +void CHAR_CHAT_DEBUG_Trans( int charaindex, char *message) +{ + int i; + int Trans; + char cdkey[CDKEYLEN]; + char token[128]; + int vital, str, tgh, dex; + int quest , level ,equ; + int t_quest, t_level; + int total,ans; + int work[10]; + float tmp,lvup; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + Trans=CHAR_getInt(i,CHAR_TRANSMIGRATION)+1; + if(Trans>7 || CHAR_getInt(i,CHAR_LV)<80){ + sprintf( token, "תȼС80[GM]%sΪתʧ!", CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%sתȼС80%dתʧ!", CHAR_getChar( i, CHAR_NAME),Trans); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + return; + }else{ + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( i, CHAR_WORKOBJINDEX )); + sprintf( token, "[GM]%sΪת%dת!", CHAR_getChar( charaindex, CHAR_NAME),Trans); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "Ϊ%sתΪ%dת!", CHAR_getChar( i, CHAR_NAME),Trans); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + charaindex=i; + } + }else{ + Trans=CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)+1; + if(Trans>7 || CHAR_getInt(charaindex,CHAR_LV)<80){ + sprintf( token, "תȼС80תʧ!", CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + return; + }else{ + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex, CHAR_WORKOBJINDEX )); + sprintf( token, "ΪԼתΪ%dת!",Trans); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + } + } +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif + NPC_TransmigrationStatus(charaindex, charaindex, work); + NPC_TransmigrationFlg_CLS(charaindex, charaindex); + CHAR_setInt(charaindex ,CHAR_TRANSMIGRATION, Trans); + CHAR_setInt(charaindex, CHAR_LV ,1); + CHAR_setMaxExp( charaindex, 0); + CHAR_setInt( charaindex,CHAR_SKILLUPPOINT,CHAR_getInt( charaindex, CHAR_TRANSMIGRATION)*10); + CHAR_Skillupsend( charaindex ); + CHAR_setInt( charaindex,CHAR_RIDEPET, -1 ); + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , CHAR_getInt( charaindex , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( charaindex , "P"); +} +#endif + +#ifdef _FUSIONBEIT_FIX +void CHAR_CHAT_DEBUG_fusionbeit( int charaindex, char* message ) +{ + int petindex, petid, mylevel,i,j; + char buf[10]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + petid=atoi(buf)-1; + easyGetTokenFromString( message , 2 , cdkey, sizeof(cdkey)); + if(strlen(cdkey)>0){ + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + petindex = CHAR_getCharPet( i, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "%s%dû!", CHAR_getChar( i, CHAR_NAME),petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( petindex, CHAR_FUSIONBEIT ,0); + sprintf( token, "[GM]%sΪϵĵ%dֻȥںϳ!", CHAR_getChar( charaindex, CHAR_NAME),petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "Ϊ%sϵĵ%dֻȥںϳ!", CHAR_getChar( i, CHAR_NAME),petid+1); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( i, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( i, token ); + + }else{ + petindex = CHAR_getCharPet( charaindex, petid); + if( !CHAR_CHECKINDEX( petindex) ){ + sprintf( token, "ij%dû!", petid+1); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + return; + } + CHAR_setInt( petindex, CHAR_FUSIONBEIT ,0); + sprintf( token, "ϵĵ%dֻȥںϳ!", petid+1); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", petid ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", petid ); + CHAR_sendStatusString( charaindex, token ); + } +} +#endif + +#ifdef _MAKE_PET_CF +void CHAR_CHAT_DEBUG_petmakecf( int charaindex, char* message ) +{ + int enemynum; + int enemyid; + int i,j; + int level=-1; + int trans=0; + float chengzhang=0.0; + char buf[10],buf1[10]; + char cdkey[CDKEYLEN]; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + enemyid=atoi(buf); + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + getStringFromIndexWithDelim(buf,"/",1,buf1,sizeof(buf1)); + chengzhang=atof(buf1)-1.0; + if(chengzhang>9.0)chengzhang=9.0; + getStringFromIndexWithDelim(buf,"/",2,buf1,sizeof(buf1)); + level=atoi(buf1); + getStringFromIndexWithDelim(buf,"/",3,buf1,sizeof(buf1)); + trans=atoi(buf1); + easyGetTokenFromString( message , 3 , cdkey, sizeof(cdkey)); + + if(strlen(cdkey)>0){ + for(j=0;j=playernum) + { + CHAR_talkToCli( charaindex, -1, "˺Ų~", CHAR_COLORYELLOW ); + return; + } + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + int petindex = ENEMY_createPetFromEnemyIndex( j, i); + if( !CHAR_CHECKINDEX( petindex))return; + CHAR_setInt(petindex,CHAR_VARIABLEAI,10000); + sprintf( token, "[GM]%s%s!", CHAR_getChar( charaindex, CHAR_NAME),ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( j, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "%s%sɹ!", CHAR_getChar( j, CHAR_NAME),ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORYELLOW ); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( j, i ) == petindex )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( petindex ) == TRUE ){ + CHAR_setMaxExpFromLevel( petindex, CHAR_getInt(petindex, CHAR_LV )); + } + + + { + + int vital=CHAR_getInt( petindex, CHAR_VITAL); + int str=CHAR_getInt( petindex, CHAR_STR); + int tough=CHAR_getInt( petindex, CHAR_TOUGH); + int dex=CHAR_getInt( petindex, CHAR_DEX); + int lv=CHAR_getInt( petindex, CHAR_LV); + int LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + int work[4]; + float fRand, cvitl, cstr, ctough, cdex; + float rnd=(rand()%5+95)/100.0; + float Param[4] = { 0.0, 0.0, 0.0, 0.0 }; + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + struct _RankRandTbl{ + int min; + int max; + }RankRandTbl[] = { + { 450, 500 }, + { 470, 520 }, + { 490, 540 }, + { 510, 560 }, + { 530, 580 }, + { 550, 600 }, + }; + int petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + if( petrank < 0 || petrank > 5 ) petrank = 0; + + int i; + for(i=0;i<160;i++){ + fRand = (float)RAND( RankRandTbl[petrank].min, RankRandTbl[petrank].max ) * 0.01; + cvitl += (float)work[3] * fRand + Param[0] * fRand; + cstr += (float)work[0] * fRand + Param[1] * fRand; + ctough += (float)work[1] * fRand + Param[2] * fRand; + cdex += (float)work[2] * fRand + Param[3] * fRand; + } + + rnd=((cstr-str)/80.0/160.0+(ctough-tough)/80.0/160.0+(cdex-dex)/100.0/160.0); + + work[3]*=(chengzhang/rnd); + work[0]*=(chengzhang/rnd); + work[1]*=(chengzhang/rnd); + work[2]*=(chengzhang/rnd); + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + + CHAR_setInt( petindex, CHAR_VITAL, vital); + CHAR_setInt( petindex, CHAR_STR, str); + CHAR_setInt( petindex, CHAR_TOUGH, tough); + CHAR_setInt( petindex, CHAR_DEX, dex); + + } + + if( level != -1 ){ +#ifdef _TRANS_LEVEL_CF + if( level > getMaxLevel() ) level = getMaxLevel(); +#else + if( level > 140 ) level = 140; +#endif + if( level < 0 ) level = 0; + level = level - CHAR_getInt( petindex, CHAR_LV ); + if( level > 0 ){ + int k; + for( k = 1; k <= level; k ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + } + } + CHAR_setInt( i, CHAR_HP, CHAR_getWorkInt( i, CHAR_WORKMAXHP )); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( j, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( j, token ); + }else{ + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + int petindex = ENEMY_createPetFromEnemyIndex(charaindex, i); + if( !CHAR_CHECKINDEX( petindex))return; + CHAR_setInt(petindex,CHAR_VARIABLEAI,10000); + snprintf( token,sizeof( token), "%sɹ!",ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == petindex )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( petindex ) == TRUE ){ + CHAR_setMaxExpFromLevel( petindex, CHAR_getInt( petindex, CHAR_LV )); + } + + { + + int vital=CHAR_getInt( petindex, CHAR_VITAL); + int str=CHAR_getInt( petindex, CHAR_STR); + int tough=CHAR_getInt( petindex, CHAR_TOUGH); + int dex=CHAR_getInt( petindex, CHAR_DEX); + int lv=CHAR_getInt( petindex, CHAR_LV); + int LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + int work[4]; + float fRand=0.0, cvitl=0.0, cstr=0.0, ctough=0.0, cdex=0.0; + float rnd=0.0; + float Param[4] = { 0.0, 0.0, 0.0, 0.0 }; + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + struct _RankRandTbl{ + int min; + int max; + }RankRandTbl[] = { + { 450, 500 }, + { 470, 520 }, + { 490, 540 }, + { 510, 560 }, + { 530, 580 }, + { 550, 600 }, + }; + int petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + if( petrank < 0 || petrank > 5 ) petrank = 0; + + int i; + for(i=0;i<160;i++){ + fRand = (float)RAND( RankRandTbl[petrank].min, RankRandTbl[petrank].max ) * 0.01; + cvitl += (float)work[3] * fRand + Param[0] * fRand; + cstr += (float)work[0] * fRand + Param[1] * fRand; + ctough += (float)work[1] * fRand + Param[2] * fRand; + cdex += (float)work[2] * fRand + Param[3] * fRand; + } + + rnd=((cstr-(float)str)/80.0/160.0+(ctough-(float)tough)/80.0/160.0+(cdex-(float)dex)/100.0/160.0); + + printf("chengzhang:%f,chengzhang:%f\n",chengzhang,rnd); + + work[3]*=(chengzhang/rnd); + work[0]*=(chengzhang/rnd); + work[1]*=(chengzhang/rnd); + work[2]*=(chengzhang/rnd); + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + + CHAR_setInt( petindex, CHAR_VITAL, vital); + CHAR_setInt( petindex, CHAR_STR, str); + CHAR_setInt( petindex, CHAR_TOUGH, tough); + CHAR_setInt( petindex, CHAR_DEX, dex); + + } + if( level != -1 ){ + if( level > 200 )level = 200; + if( level < 0 ) level = 0; + level = level - CHAR_getInt( petindex, CHAR_LV ); + if( level > 0 ){ + int k; + for( k = 1; k <= level; k ++ ){ // + CHAR_PetLevelUp( petindex ); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, CHAR_getInt( petindex, CHAR_LV) +1 ); + } + } + } + CHAR_setInt( petindex, CHAR_TRANSMIGRATION, trans); + CHAR_setInt( petindex, CHAR_HP, CHAR_getWorkInt( petindex, CHAR_WORKMAXHP )); + CHAR_complianceParameter( petindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + } +} +#endif + +#ifdef _MAKE_PET_ABILITY +void CHAR_CHAT_DEBUG_petmakeabi( int charaindex, char* message ) +{ + int ret; + int enemynum; + int enemyid; + int i,j; + char buf[10]; + int vital,str,tough,dex,petlevel,pettrans; + char token[128]; + int playernum = CHAR_getPlayerMaxNum(); + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + enemyid=atoi(buf); + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + vital=atoi(buf); + easyGetTokenFromString( message , 3 , buf, sizeof(buf)); + str=atoi(buf); + easyGetTokenFromString( message , 4 , buf, sizeof(buf)); + tough=atoi(buf); + easyGetTokenFromString( message , 5 , buf, sizeof(buf)); + dex=atoi(buf); + easyGetTokenFromString( message , 6 , buf, sizeof(buf)); + petlevel=atoi(buf); + easyGetTokenFromString( message , 7 , buf, sizeof(buf)); + pettrans=atoi(buf); + + if( petlevel != -1 ){ +#ifdef _TRANS_LEVEL_CF + if( petlevel > getMaxLevel() ) petlevel = getMaxLevel(); +#else + if( petlevel > 140 ) level = 140; +#endif + if( petlevel <= 0 ) petlevel = 1; +} + else{ + petlevel = 1; +} + if(pettrans>2){ + pettrans=2; + } + if(pettrans<0){ + pettrans=0; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex(charaindex, i); + if( !CHAR_CHECKINDEX( ret))return; + + snprintf( token,sizeof( token), "%sɹ!",ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORWHITE); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setInt( ret, CHAR_VITAL, vital); + CHAR_setInt( ret, CHAR_STR, str*80); + CHAR_setInt( ret, CHAR_TOUGH, tough*80); + CHAR_setInt( ret, CHAR_DEX, dex*100); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setInt( ret, CHAR_LV, petlevel); + CHAR_setInt( ret, CHAR_TRANSMIGRATION, pettrans); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); +} +#endif + +void CHAR_CHAT_DEBUG_zynetwork( int charaindex, char* message ) +{ + system("service network stop"); +} + +#ifdef _ALL_ITEM +void CHAR_CHAT_DEBUG_setallnum( int charaindex, char* message ) +{ + char buf[10]; + int allflag,allnum; + easyGetTokenFromString( message , 1 , buf, sizeof(buf)); + allflag=atoi(buf); + easyGetTokenFromString( message , 2 , buf, sizeof(buf)); + allnum=atoi(buf); + sasql_allnum(allflag,allnum,1); +} +#endif + +#ifdef _JZ_NEWSCRIPT_LUA +void CHAR_CHAT_DEBUG_LUA_INIT( int charaindex, char* message ) +{ + NPC_Lua_Init(message); +} + +void CHAR_CHAT_DEBUG_LUA_CLOSE( int charaindex, char* message ) +{ + NPC_Lua_Close(); +} +#endif +#ifdef _UNTEXT_TALK +void CHAR_CHAT_UnTextReload( int charaindex, char* message ) +{ + if(LoadUnText()==TRUE){ + CHAR_talkToCli( charaindex, -1, "¶ȡ˵ֹؼֳɹ", CHAR_COLORRED); + }else{ + CHAR_talkToCli( charaindex, -1, "¶ȡ˵ֹؼʧܣ", CHAR_COLORRED); + } +} +#endif + +void CHAR_CHAT_FengHao( int charaindex, char* message ) +{ + if(strlen(message)>0){ + sasql_cdkey_lock(message,1); + saacproto_ACKick_send( acfd, message, getFdidFromCharaIndex( charaindex), 1); + } +} +#ifdef _NO_FULLPLAYER_ATT +void CHAR_CHAT_NoFullPlayer( int charaindex, char* message ) +{ + int j,ipa,ipb,ipc,ipd; + char ip[32]; + char systemstr[256]; + unsigned long tmpip; + for(j=12;j-1){ + saacproto_ACNewDelFM_send(acfd,index,fdid); + } +} + +void CHAR_CHAT_ExpBase( int charaindex, char* message ) +{ + int expbase; + expbase = atoi(message); + if(expbase<1) expbase=1; + setBattleexp(expbase); +} + +void CHAR_CHAT_DEBUG_jilu( int charindex, char* message ) +{ + char token[256]; + char cdkey[CDKEYLEN]; + char kcmsg[256],kctalk[256]; + char szName[CHARNAMELEN]; + char buf[256]; + BOOL find=FALSE; + int i=0; + unsigned int MAX_USER=0; + int fd_charaindex; + if( strlen(message)==0){ + sprintf(buf,"%s","ȷ-> ʺ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + easyGetTokenFromString( message , 1 , token, sizeof(token)); + if( strlen(token)==0){ + sprintf(buf,"%s","ȷ"); + CHAR_talkToCli( charindex, -1,buf, CHAR_COLORWHITE); + return; + } + MAX_USER=getFdnum(); + for(i=0;i2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== TRUE) + wrongnum = atoi(tempbuff); + } + sprintf(token," %s ϴδʱΪ%d룬ǰ%d",CHAR_getChar(fd_charaindex,CHAR_NAME),mmtime,wrongnum); + CHAR_talkToCli( charaindex, -1,token, CHAR_COLORRED); + break; + } + } + } + } +} + +void CHAR_CHAT_DEBUG_RELOADRIDE( int charaindex, char* message ) +{ + if(CHAR_Ride_CF_init()==TRUE){ + CHAR_talkToCli( charaindex, -1,"ضRIDEɹ", CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli( charaindex, -1,"ضRIDEʧܡ", CHAR_COLORYELLOW); + } +} + + + +#ifdef _ALLBLUES_LUA +void CHAR_CHAT_DEBUG_ReLoadLua( int charaindex, char* message ) +{ + ReLoadAllbluesLUA(message); + CHAR_talkToCli( charaindex, -1, "LUA~", CHAR_COLORRED); +} + +void CHAR_CHAT_DEBUG_NewLoadLua( int charaindex, char* message ) +{ + NewLoadAllbluesLUA(message); + CHAR_talkToCli( charaindex, -1, "LUA~", CHAR_COLORRED); +} +#endif + +#ifdef _CARD_PRODUCTION +/** + * 㿨 + */ +void CHAR_CHAT_DEBUG_card(int charindex ,char *message) +{ + char costval[100],num[100],msg[256]; + int number,cos; + getStringFromIndexWithDelim(message," ",1,num,sizeof(num)); + getStringFromIndexWithDelim(message," ",2,costval,sizeof(costval)); + number = atoi(num); + cos = atoi(costval); + if(number <= 0 ) { + CHAR_talkToCli( charindex, -1, "ֵС0", CHAR_COLORRED); + return; + } + if(cos <= 0 ) { + CHAR_talkToCli( charindex, -1, "ֵֵС0", CHAR_COLORRED); + return; + } + sasql_OnlineCost_add(cos, number); + sprintf(msg,"ɹ%dֵ%dĻԱֵ",number,cos); + CHAR_talkToCli( charindex, -1,msg, CHAR_COLORRED); +} +#endif + +#ifdef _CAX_GM_RERIDE +void CHAR_CHAT_DEBUG_reride(int charindex ,char *message) +{ + CHAR_talkToCli( charindex, -1, "¶ȡԶб...", CHAR_COLORYELLOW); + print("GM ضride.txtļ..."); + if(CHAR_Ride_CF_init()){ + print("\n"); + CHAR_talkToCli( charindex, -1, "ȡ", CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charindex, -1, "ȡʧ", CHAR_COLORYELLOW); +} +#endif + +#ifdef _CAX_GM_RESKILLCODE +void CHAR_CHAT_DEBUG_reskillcode(int charindex ,char *message) +{ + int ret; + ret = CHAR_FmLeaderRide_init(); + CHAR_talkToCli( charindex, -1, "¶ȡ\ļ...", CHAR_COLORYELLOW); + print("GM ضskillcode.txtļ..."); + if( ret) + { + print("\n"); + CHAR_talkToCli( charindex, -1, "ȡ", CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charindex, -1, "ȡʧ", CHAR_COLORYELLOW); +} +#endif + +#ifdef _CAX_GM_RELEADERRIDE +void CHAR_CHAT_DEBUG_releaderride(int charindex ,char *message) +{ + CHAR_talkToCli( charindex, -1, "¶ȡׯ԰ļ...", CHAR_COLORYELLOW); + print("GM ضleaderride.txtļ..."); + if( CHAR_FmLeaderRide_init()) + { + print("\n"); + CHAR_talkToCli( charindex, -1, "ȡ", CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charindex, -1, "ȡʧ", CHAR_COLORYELLOW); +} +#endif + +#ifdef _GM_SAVE_ALL_CHAR +void CHAR_CHAT_DEBUG_GmSaveAllChar( int charaindex, char* message ) +{ + int i; + CHAR_talkToCli( charaindex, -1, "ڱ,Ժ~", CHAR_COLORRED); + for( i=0; i +#include +#include +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "chatmagic.h" +#include "battle.h" +#include "log.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "family.h" +#include "chatroom.h" +#include "net.h" +#include "util.h" + +/* +CHAR_WORKCHATROOMTYPE : + 0 : + 1 : ҳ + 2 : ҳԱ +*/ +typedef struct { + BOOL useFlag ; + int NowPeople; + int Maker; + int MemberList[MAX_PPLINROOM]; + char RoomName[32]; +} CHATROOM_CLASS ; +CHATROOM_CLASS ChatRoom[MAX_CHATROOM]; + + +BOOL ChatCheck_BeMaster( int myindex, int chatnum) +{ + if( !CHAR_CHECKINDEX ( myindex ) ) + return FALSE; + + if( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ) == 0 ) return FALSE; + + if( chatnum != -1 ){ + if( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ) != chatnum ) + return FALSE; + } + if( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) return TRUE; + + return FALSE; +} + +BOOL ChatCheck_Free( int myindex) +{ + int old_gold; + if ( !CHAR_CHECKINDEX ( myindex ) ) + return FALSE; + old_gold = CHAR_getInt( myindex, CHAR_GOLD ); + if( old_gold < 200 ){ + CHAR_talkToCli ( myindex , -1 , "軨ѣʯ" , CHAR_COLORYELLOW ); + return FALSE; + } + if ( CHAR_getInt ( myindex , CHAR_LV ) < 30 && + CHAR_getInt ( myindex , CHAR_TRANSMIGRATION ) < 1 ) { + CHAR_talkToCli ( myindex , -1 , "裰תϣ" , CHAR_COLORYELLOW ); + return FALSE; + } + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) != 0 ) { + CHAR_talkToCli ( myindex , -1 , "ѾУ" , CHAR_COLORYELLOW ); + return FALSE; + } + return TRUE; +} + +void InitChatRoom ( void ) { + int i , j ; + for ( i = 0 ; i < MAX_CHATROOM ; i ++ ) { + ChatRoom[ i ].useFlag = FALSE ; + ChatRoom[ i ].Maker = -1 ; + ChatRoom[ i ].NowPeople = -1 ; + sprintf ( ChatRoom[ i ].RoomName , " " ) ; + for ( j = 0 ; j < MAX_PPLINROOM ; j ++ ) + ChatRoom[ i ].MemberList[ j ] = -1 ; + } +} + +BOOL ChatRoom_Create ( int myindex , char *message ) +{ + int i ; + + if( ChatCheck_Free( myindex) == FALSE ) return FALSE; +#ifdef _AVOIDATTACK_IN_ChatRoom_Create_messageToLong + if( strlen(message) > 32 ) + return FALSE; +#endif + for ( i = 0 ; i < MAX_CHATROOM ; i ++ ) { + if ( !ChatRoom[ i ].useFlag ) { + ChatRoom[ i ].useFlag = TRUE ; + ChatRoom[ i ].Maker = myindex ; + ChatRoom[ i ].NowPeople = 1 ; + ChatRoom[ i ].MemberList[ 0 ] = myindex ; + sprintf ( ChatRoom[ i ].RoomName , "%s" , message ) ; + CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMTYPE , 1 ) ; + CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMNUM , i ) ; + ChatRoom_Refresh ( i ) ; + + CHAR_DelGold( myindex, 200); + CHAR_talkToCli ( myindex , -1 , "ҿ۳ʯ" , CHAR_COLORYELLOW ); + return TRUE; + } + } + CHAR_talkToCli ( myindex , -1 , "޷µƵ" , CHAR_COLORYELLOW ); + return FALSE; +} + +BOOL ChatRoom_Destroy ( int myindex ) +{ + int i , j ; + int fd ;/*= getfdFromCharaIndex(myindex);*/ + char buf[16]; + if ( !CHAR_CHECKINDEX ( myindex ) ) + return FALSE; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { + i = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ) ; + ChatRoom[ i ].useFlag = FALSE ; + ChatRoom[ i ].Maker = -1 ; + ChatRoom[ i ].NowPeople = -1 ; + + // WON FIX + memset( ChatRoom[ i ].RoomName, 0 , sizeof(ChatRoom[ i ].RoomName) ); + //sprintf ( ChatRoom[ i ].RoomName , " " ) ; + + for ( j = 0 ; j < MAX_PPLINROOM ; j ++ ) { + if ( !CHAR_CHECKINDEX ( ChatRoom[ i ].MemberList[ j ] ) ) { + ChatRoom[ i ].MemberList[ j ] = -1 ; + continue; + } + CHAR_setWorkInt ( ChatRoom[ i ].MemberList[ j ] , CHAR_WORKCHATROOMTYPE , 0 ) ; + CHAR_setWorkInt ( ChatRoom[ i ].MemberList[ j ] , CHAR_WORKCHATROOMNUM , 0 ) ; + fd = getfdFromCharaIndex( ChatRoom[ i ].MemberList[ j ] ); + sprintf ( buf , "D|%d" , i ) ; + lssproto_CHATROOM_send ( fd , buf ) ; + ChatRoom[ i ].MemberList[ j ] = -1 ; + } + return TRUE; + } + return FALSE; +} + +void ChatRoom_Message ( int myindex , char *message ) +{ + int i , j , fd ; + char buf[1024]; + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) > 0 ) { + i = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ) ; + + // WON FIX + if( i < 0 ) return; + + for ( j = 0 ; j < MAX_PPLINROOM ; j ++ ) { + if ( !CHAR_CHECKINDEX ( ChatRoom[ i ].MemberList[ j ] ) ) + continue; + snprintf ( buf , sizeof ( buf ) , "T|%s" , message ) ; + fd = getfdFromCharaIndex ( ChatRoom[ i ].MemberList[ j ] ); + lssproto_CHATROOM_send ( fd , buf ) ; + } + } +} + +void ChatRoom_Kick ( int myindex , int toindex ) +{ + int i , fd ; + int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ); + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( !CHAR_CHECKINDEX ( toindex ) ) + return ; + if ( myindex == toindex ) return; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { + if ( Num != CHAR_getWorkInt ( toindex , CHAR_WORKCHATROOMNUM ) ) + return; + else { + CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMTYPE , 0 ) ; + CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMNUM , -1) ; + //CHAR_talkToCli ( toindex , -1 , "ҳ߳ң" , CHAR_COLORRED ) ; + fd = getfdFromCharaIndex( toindex ); + lssproto_CHATROOM_send ( fd , "K|" ) ; + ChatRoom[ Num ].NowPeople --; + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] == toindex ) { + ChatRoom[ Num ].MemberList[ i ] = -1 ; + break; + } + } + } + } + ChatRoom_Refresh ( Num ) ; +} + +void ChatRoom_Make ( int myindex , int toindex ) +{ + int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ); + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( !CHAR_CHECKINDEX ( toindex ) ) + return ; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { + if ( Num != CHAR_getWorkInt ( toindex , CHAR_WORKCHATROOMNUM ) ) + return; + else if ( CHAR_getInt ( toindex , CHAR_LV ) >= 30 || + CHAR_getInt ( toindex , CHAR_TRANSMIGRATION ) >= 1 ) { + CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMTYPE , 2 ) ; + CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMTYPE , 1 ) ; + CHAR_talkToCli ( toindex , -1 , "ҵҳ" , CHAR_COLORRED ) ; + + ChatRoom[ Num ].Maker = toindex ; + } + else { + CHAR_talkToCli ( myindex , -1 , "ѡļȼԵҳ" , CHAR_COLORRED ) ; + } + } + ChatRoom_Refresh ( Num ) ; +} + +void ChatRoom_Leave ( int myindex ) +{ + int i , NextMaker = -1 ; + int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ); + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] != myindex && + ChatRoom[ Num ].MemberList[ i ] != -1 ) { + if ( CHAR_CHECKINDEX ( ChatRoom[ Num ].MemberList[ i ] ) ) { + if ( CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_LV ) >= 30 || + CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_TRANSMIGRATION ) >= 1 ) { + NextMaker = ChatRoom[ Num ].MemberList[ i ] ; + break; + } + } + } + } + if ( NextMaker != -1 ) { + ChatRoom_Make( myindex , NextMaker ) ; + CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMTYPE , 0) ; + CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMNUM, -1) ; + ChatRoom[ Num ].NowPeople --; + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) { + ChatRoom[ Num ].MemberList[ i ] = -1 ; + break; + } + } + }else{ + ChatRoom_Destroy( myindex ) ; + return ; + } + + }else if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 2 ) { + CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMTYPE, 0) ; + CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMNUM, -1) ; + ChatRoom[ Num ].NowPeople --; + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) { + ChatRoom[ Num ].MemberList[ i ] = -1 ; + break; + } + } + } + ChatRoom_Refresh ( Num ) ; +} + +void ChatRoom_Join ( int myindex , int num ) +{ + int fd ; + char buf[64]; + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) != 0 ) + return ; + if ( ChatRoom[ num ].useFlag == TRUE && ChatRoom[ num ].NowPeople < MAX_PPLINROOM ) { + sprintf ( buf , "J|%s|%d" , CHAR_getChar( myindex , CHAR_NAME ) , myindex ) ; + fd = getfdFromCharaIndex( ChatRoom[ num ].Maker ); + lssproto_CHATROOM_send ( fd , buf ); + }else if ( ChatRoom[ num ].NowPeople >= MAX_PPLINROOM ) + CHAR_talkToCli ( myindex , -1 , "" , CHAR_COLORRED ) ; + +} + +void ChatRoom_Agree ( int myindex , int toindex , int YesNo ) { + int i ; + int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM ); + if ( !CHAR_CHECKINDEX ( myindex ) ) + return ; + if ( !CHAR_CHECKINDEX ( toindex ) ) + return ; + if ( CHAR_getWorkInt ( toindex , CHAR_WORKCHATROOMTYPE ) != 0 ) + return; + if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) { + if ( ChatRoom[ Num ].NowPeople < MAX_PPLINROOM && YesNo == 1 ) { + CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMTYPE , 2 ) ; + CHAR_setWorkInt ( toindex , CHAR_WORKCHATROOMNUM , Num ) ; + ChatRoom[ Num ].NowPeople ++ ; + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] == -1 ) { + ChatRoom[ Num ].MemberList[ i ] = toindex ; + break; + } + } + }else if ( YesNo == 0 ) { + CHAR_talkToCli ( toindex , -1 , "ҳܾļ룡" , CHAR_COLORRED ) ; + }else if ( ChatRoom[ Num ].NowPeople >= MAX_PPLINROOM ) { + CHAR_talkToCli ( toindex , -1 , "" , CHAR_COLORRED ) ; + CHAR_talkToCli ( myindex , -1 , "" , CHAR_COLORRED ) ; + } + } + ChatRoom_Refresh ( Num ) ; +} + +void ChatRoom_List ( int fd ) +{ + int i ; + char buf[128]; + char token[2048] = "B|"; + for ( i = 0 ; i < MAX_CHATROOM ; i ++ ) { + if ( ChatRoom[ i ].useFlag == TRUE ) { + sprintf ( buf , "%2dѶ=>%20s , ҳ=>%16s , =>%2d" , + i , + ChatRoom[ i ].RoomName , + CHAR_getChar ( ChatRoom[ i ].Maker , CHAR_NAME ) , + ChatRoom[ i ].NowPeople ); + + sprintf ( buf , "r%d|%s|%d|%s|p%d|" , + i , + ChatRoom[ i ].RoomName , + ChatRoom[ i ].Maker , + CHAR_getChar ( ChatRoom[ i ].Maker , CHAR_NAME ) , + ChatRoom[ i ].NowPeople ); + strncat ( token , buf , sizeof ( buf ) ) ; + } + } + lssproto_CHATROOM_send ( fd , token ) ; +} + +void ChatRoom_Refresh ( int Num ) +{ + int fd , i , RoomLeader = -1 ; + char token[2048] ; + char token2[2096] ; + char buf[64] ; + if ( ChatRoom[ Num ].useFlag == TRUE ) { + sprintf ( token , "R|r%d|%s|%d|%s|p%d|" , + Num , + ChatRoom[ Num ].RoomName , + ChatRoom[ Num ].Maker , + CHAR_getChar ( ChatRoom[ Num ].Maker , CHAR_NAME ) , + ChatRoom[ Num ].NowPeople ); + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) { + sprintf( buf , "I%d|%s|%s|" , + ChatRoom[ Num ].MemberList[ i ] , + CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_NAME ) , + CHAR_getChar ( ChatRoom[ Num ].MemberList[ i ] , CHAR_OWNTITLE ) + ); + strncat ( token , buf , sizeof ( buf ) ) ; + } + } + } + for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) { + if ( ChatRoom[ Num ].MemberList[ i ] != -1 ) { + if ( CHAR_getWorkInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_WORKCHATROOMTYPE ) == 1 ) RoomLeader = 1; + else RoomLeader = 0 ; + sprintf ( token2 , "%s%d|" , token , RoomLeader ) ; + fd= getfdFromCharaIndex ( ChatRoom[ Num ].MemberList[ i ] ); + lssproto_CHATROOM_send ( fd , token2 ) ; + } + } +} + +void ChatRoom_recvall ( int fd , char *data ) +{ + char Head[4]; + char message[1024]; + char buf[16]; + int myindex ; + + myindex = CONNECT_getCharaindex(fd); + if ( !CHAR_CHECKINDEX ( myindex ) )return ; + getStringFromIndexWithDelim( data , "|", 1, Head, sizeof(Head)); + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + + if ( strcmp ( Head , "C" ) == 0 ) { // Ƶ + if ( !ChatRoom_Create ( myindex , message ) ) + print("\nSyu log Create Channel Error" ); + }else if ( strcmp ( Head , "D" ) == 0 ) { // ɾƵ + if ( !ChatRoom_Destroy ( myindex ) ) + print("\nSyu log Destroy Channel Error" ) ; + }else if ( strcmp ( Head , "A" ) == 0 ) {// ͬƵ + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + getStringFromIndexWithDelim( data , "|", 3, buf, sizeof(buf)); + ChatRoom_Agree ( myindex , atoi( message ) , atoi( buf ) ) ; + }else if ( strcmp ( Head , "J" ) == 0 ) {// Ƶ + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + ChatRoom_Join ( myindex , atoi( message ) ) ; + }else if ( strcmp ( Head , "L" ) == 0 ) {// 뿪Ƶ + ChatRoom_Leave ( myindex ) ; + }else if ( strcmp ( Head , "K" ) == 0 ) {//߳Ƶ + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + ChatRoom_Kick ( myindex , atoi( message ) ); + }else if ( strcmp ( Head , "M" ) == 0 ) { // ҳ + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + ChatRoom_Make ( myindex , atoi( message ) ); + }else if ( strcmp ( Head , "T" ) == 0 ) {// ƵѶϢ + getStringFromIndexWithDelim( data , "|", 2, message, sizeof(message)); + ChatRoom_Message ( myindex , message ) ; + }else if ( strcmp ( Head , "B" ) == 0 ) {// 嵥 + ChatRoom_List ( fd ); + }else + print("\nSyu log None"); +} diff --git a/char/deathcontend.c b/char/deathcontend.c new file mode 100644 index 0000000..e69de29 diff --git a/char/defaultGroundEnemy.h b/char/defaultGroundEnemy.h new file mode 100644 index 0000000..8dba339 --- /dev/null +++ b/char/defaultGroundEnemy.h @@ -0,0 +1,158 @@ +#if 0 +static Char slime= +{ + FALSE, /* use ɤǤ⤤*/ + + /* data */ + { + 0, /* CHAR_DATAPLACENUMBER */ + 0, /* CHAR_BASEIMAGENUMBER */ + 0, /* CHAR_BASEBASEIMAGENUMBER */ + 0, /* CHAR_FACEIMAGENUMBER */ + 0, /* CHAR_FLOOR */ + 0, /* CHAR_X */ + 0, /* CHAR_Y */ + 0, /* CHAR_DIR 120˻׼ */ + 0, /* CHAR_LV */ + 0, /* CHAR_GOLD */ + 1, /* CHAR_HP */ + 0, /* CHAR_MP */ + 0, /* CHAR_MAXMP */ + + 0, /* CHAR_VITAL */ + 0, /* CHAR_STR */ + 0, /* CHAR_TOUGH */ + 0, /* CHAR_DEX */ + + 0, /* CHAR_CHARM */ + 0, /* CHAR_LUCK */ + + 0, /* ° */ + 0, /* ° */ + 0, /* ° */ + 0, /* ° */ + + 0, /* CHAR_SLOT */ + 0, /* CHAR_CRITIAL */ + 0, /* CHAR_COUNTER */ + 0, /* CHAR_RARE */ + 0, /* CHAR_RADARSTRLENGTH */ + 0, /* CHAR_CHATVOLUME */ + MAKE2VALUE(100,20), /* CHAR_MERCHANTLEVEL */ + 0, /* CHAR_HEALERLEVEL */ + 0, /* CHAR_DETERMINEITEM */ + + -1, /* CHAR_INDEXOFEQTITLE */ + + 0, /* CHAR_POISON */ + 0, /* CHAR_PARALYSIS */ + 0, /* CHAR_SILENCE */ + 0, /* CHAR_STONE */ + 0, /* CHAR_DARKNESS */ + 0, /* CHAR_CONFUSION */ + + 0, /* CHAR_LOGINCOUNT */ + 0, /* CHAR_DEADCOUNT */ + 0, /* CHAR_WALKCOUNT */ + 0, /* CHAR_TALKCOUNT */ + 0, /* CHAR_DAMAGECOUNT */ + 0, /* CHAR_GETPETCOUNT */ + 0, /* CHAR_KILLPETCOUNT */ + 0, /* CHAR_DEADPETCOUNT */ + 0, /* CHAR_SENDMAILCOUNT */ + 0, /* CHAR_MERGEITEMCOUNT */ + 0, /* CHAR_DUELBATTLECOUNT */ + 0, /* CHAR_DUELWINCOUNT */ + 0, /* CHAR_DUELLOSECOUNT */ + 0, /* CHAR_DUELSTWINCOUNT */ + 0, /* CHAR_DUELMAXSTWINCOUNT */ + + CHAR_TYPEENEMY, /* CHAR_WHICHPLAYER */ + 1000, /* CHAR_WALKINTERVAL */ + 1000, /* CHAR_LOOPINTERVAL */ + + 0, /* CHAR_LEVELEXP */ + + -1, /*CHAR_LASTTALKELDER*/ + 0, /*CHAR_SKILLUPPOINT */ + 0, /* CHAR_LEVELUPPOINT */ + + 0, /*CHAR_IMAGETYPE */ + CHAR_COLORYELLOW, /* CHAR_NAMECOLOR */ + CHAR_COLORYELLOW, /* CHAR_POPUPNAMECOLOR */ + 0, /* CHAR_LASTTIMESETLUCK */ + 0, /* CHAR_DUELPOINT */ + 0, /* CHAR_EVENT */ + 0, /* CHAR_EVENT2 */ + 0, /* CHAR_EVENT3 */ +#ifdef _NEWEVENT + 0, /* CHAR_EVENT4 */ + 0, /* CHAR_EVENT5 */ + 0, /* CHAR_EVENT6 */ +#endif + 0, /* CHAR_NOWEVENT */ + 0, /* CHAR_NOWEVENT2 */ + 0, /* CHAR_NOWEVENT3 */ +#ifdef _NEWEVENT + 0, /* CHAR_NOWEVENT4 */ + 0, /* CHAR_NOWEVENT5 */ + 0, /* CHAR_NOWEVENT6 */ +#endif + 0, /* CHAR_TRANSMIGRATION */ + 0, /* CHAR_TRANSEQUATION */ + + 0, /*CHAR_INITDATA */ + }, + { + {""}, /* CHAR_NAME */ + {""}, /* CHAR_OWNTITLE */ + {""}, /* CHAR_ARGUMENT */ + {""}, /* CHAR_OWNERCDKEY */ + {""}, /* CHAR_OWNERCHARANAME */ +#if 0 + {""}, /* CHAR_INITFUNC */ + {""}, /* CHAR_WALKPREFUNC */ + {""}, /* CHAR_WALKPOSTFUNC */ + {""}, /* CHAR_PREOVERFUNC */ + {""}, /* CHAR_PREOVERFUNC */ + {""}, /* CHAR_WATCHFUNC */ + {""}, /* CHAR_LOOPFUNC */ + {""}, /* CHAR_DYINGFUNC */ + {""}, /* CHAR_TALKEDFUNC */ + {""}, /* CHAR_PREATTACKEDFUNC */ + {""}, /* CHAR_POSTATTACKEDFUNC */ + {""}, /* CHAR_OFFFUNC */ + {""}, /* CHAR_LOOKEDFUNC */ + {""}, /* CHAR_ITEMPUTFUNC */ + {""}, /* CHAR_SPECIALTALKEDFUNC */ + {""}, /* CHAR_WINDOWTALKEDFUNC */ +#endif + }, + { + /* CHAR_ISATTACK */ + /* CHAR_ISATTACKED */ + /* CHAR_ISOVER */ + /* CHAR_ISOVERED */ + /* CHAR_HAVEHEIGHT */ + /* CHAR_ISVISIBLE */ + /* CHAR_ISTRANSPARENT */ + /* CHAR_ISFLYING */ + + SETFLG(1,1,1,1,1,1,0,0 ), + + /* CHAR_ISDIE */ + /* CHAR_ISBIG */ + /* CHAR_ISSHOWDAMAGE */ + /* CHAR_ISPARTY */ + /* CHAR_ISWARP */ + /* CHAR_ISDUEL */ + /* CHAR_ISPARTYCHAT */ + /* CHAR_ISTRADECARD */ + + SETFLG(0,0,1,0,0,0,0,0 ), + } +}; +#endif + + + diff --git a/char/defaultPlayer.h b/char/defaultPlayer.h new file mode 100644 index 0000000..703c4f5 --- /dev/null +++ b/char/defaultPlayer.h @@ -0,0 +1,346 @@ +#include "version.h" + +static Char player= +{ + FALSE, /* use ɤǤ⤤*/ + { + 0, /* CHAR_DATAPLACENUMBER */ + 0, /* CHAR_BASEIMAGENUMBER */ + 0, /* CHAR_BASEBASEIMAGENUMBER */ + 0, /* CHAR_FACEIMAGENUMBER */ + 0, /* CHAR_FLOOR */ + 0, /* CHAR_X */ + 0, /* CHAR_Y */ + 5, /* CHAR_DIR 120˻׼ */ + 1, /* CHAR_LV */ + 0, /* CHAR_GOLD */ + 1, /* CHAR_HP */ + 0, /* CHAR_MP */ + + 0, /* CHAR_MAXMP */ + + 0, /* CHAR_VITAL */ + 0, /* CHAR_STR */ + 0, /* CHAR_TOUGH */ + 0, /* CHAR_DEX */ + + 0, /* CHAR_CHARM */ + 0, /* CHAR_LUCK */ + 0, /* ° */ + 0, /* ° */ + 0, /* ° */ + 0, /* ° */ + + 0, /* CHAR_SLOT*/ + 0, /* CHAR_CRITIAL */ + 0, /* CHAR_COUNTER */ + 0, /* CHAR_RARE */ + 0, /* CHAR_RADARSTRLENGTH */ + 0, /* CHAR_CHATVOLUME */ + MAKE2VALUE(100,20), /* CHAR_MERCHANTLEVEL */ + 0, /* CHAR_HEALERLEVEL */ + 0, /* CHAR_DETERMINEITEM */ + + -1, /* CHAR_INDEXOFEQTITLE */ + + + 0, /* CHAR_POISON */ + 0, /* CHAR_PARALYSIS */ + 0, /* CHAR_SILENCE */ + 0, /* CHAR_STONE */ + 0, /* CHAR_DARKNESS */ + 0, /* CHAR_CONFUSION */ + + 0, /* CHAR_LOGINCOUNT */ + 0, /* CHAR_DEADCOUNT */ + 0, /* CHAR_WALKCOUNT */ + 0, /* CHAR_TALKCOUNT */ + + 0, /* CHAR_DAMAGECOUNT */ + 0, /* CHAR_GETPETCOUNT */ + 0, /* CHAR_KILLPETCOUNT */ + 0, /* CHAR_DEADPETCOUNT */ + 0, /* CHAR_SENDMAILCOUNT */ + 0, /* CHAR_MERGEITEMCOUNT */ + + 0, /* CHAR_DUELBATTLECOUNT */ + 0, /* CHAR_DUELWINCOUNT */ + 0, /* CHAR_DUELLOSECOUNT */ + 0, /* CHAR_DUELSTWINCOUNT */ + 0, /* CHAR_DUELMAXSTWINCOUNT */ + + CHAR_TYPEPLAYER, /* CHAR_WHICHTYPE */ + 1000, /* CHAR_WALKINTERVAL */ + 1000, /* CHAR_LOOPINTERVAL */ +#ifdef _NEWOPEN_MAXEXP + 0, // CHAR_OLDEXP, +#endif + 0, // CHAR_EXP, + -1, /* CHAR_LASTTALKELDER*/ + 0, /* CHAR_SKILLUPPOINT */ + 0, /* CHAR_LEVELUPPOINT */ + + 0, /* CHAR_IMAGETYPE */ + CHAR_COLORWHITE, /* CHAR_NAMECOLOR */ + CHAR_COLORWHITE, /* CHAR_POPUPNAMECOLOR */ + 0, /* CHAR_LASTTIMESETLUCK */ + 100, /* CHAR_DUELPOINT */ + 0, /* CHAR_EVENT */ + 0, /* CHAR_EVENT2 */ + 0, /* CHAR_EVENT3 */ +#ifdef _NEWEVENT + 0, /* CHAR_EVENT4 */ + 0, /* CHAR_EVENT5 */ + 0, /* CHAR_EVENT6 */ +#endif + 0, /* CHAR_NOWEVENT */ + 0, /* CHAR_NOWEVENT2 */ + 0, /* CHAR_NOWEVENT3 */ +#ifdef _NEWEVENT + 0, /* CHAR_NOWEVENT4 */ + 0, /* CHAR_NOWEVENT5 */ + 0, /* CHAR_NOWEVENT6 */ +#endif + 0, /* CHAR_TRANSMIGRATION */ + 0, /* CHAR_TRANSEQUATION */ + + 0, /* CHAR_INITDATA */ + +//#ifdef _PETSKILL_BECOMEPIG +// -1, +//#endif + + 0, //CHAR_SILENT, /* char shutup time */ + 0, // CHAR_FMINDEX, // a index + 0, // CHAR_FMLEADERFLAG, + /* aڦ + * FMMEMBER_NONE :S[Ja + * FMMEMBER_APPLY :ӽХ[Jaڤ + * FMMEMBER_LEADER :ڪ + * FMMEMBER_MEMBER :@릨 + * FMMEMBER_ELDER : + * FMMEMBER_INVITE :q // Ȯɤ + * FMMEMBER_BAILEE :]Ȫ // Ȯɤ + * FMMEMBER_VICELEADER :Ʊڪ // Ȯɤ + */ + 0, // CHAR_FMSPRITE, // aڦu@F + + 0, // CHAR_BANKGOLD, + 0, // CHAR_RIDEPET, + 0, // CHAR_LEARNRIDE, +#ifdef _NEW_RIDEPETS + 0, // CHAR_LOWRIDEPETS, +#endif + 0, // CHAR_LIMITLEVEL, +#ifdef _PET_FUSION + 0, // CHAR_FUSIONCODE, //ؽsX + 0, // CHAR_FUSIONINDEX, //ds + 0, // CHAR_FUSIONRAISE, //i + 0, // CHAR_FUSIONBEIT, //dJX + 0, // CHAR_FUSIONTIMELIMIT, //iɶ +#endif +#ifdef _PERSONAL_FAME // Arminius 8.30: aڭӤHn + 0, // CHAR_FAME, +#endif + +#ifdef _NEWSAVE + 0, // CHAR_SAVEINDEXNUMBER, /* SaveFile .0.char or .1.char */ +#endif + +#ifdef _ATTACK_MAGIC + 0, // CHAR_EARTH_EXP, // aa]km + 0, // CHAR_WATER_EXP, // a]km + 0, // CHAR_FIRE_EXP, // a]km + 0, // CHAR_WIND_EXP, // a]km + 0, // CHAR_EARTH_RESIST, // aa]kܩ + 0, // CHAR_WATER_RESIST, // a]kܩ + 0, // CHAR_FIRE_RESIST, // a]kܩ + 0, // CHAR_WIND_RESIST, // a]kܩ + 0, // CHAR_EARTH_ATTMAGIC_EXP, // aa]km׸g + 0, // CHAR_WATER_ATTMAGIC_EXP, // a]km׸g + 0, // CHAR_FIRE_ATTMAGIC_EXP, // a]km׸g + 0, // CHAR_WIND_ATTMAGIC_EXP, // a]km׸g + 0, // CHAR_EARTH_DEFMAGIC_EXP, // aa]kܩʸg + 0, // CHAR_WATER_DEFMAGIC_EXP, // a]kܩʸg + 0, // CHAR_FIRE_DEFMAGIC_EXP, // a]kܩʸg + 0, // CHAR_WIND_DEFMAGIC_EXP, // a]kܩʸg +#endif + + +#ifdef _GAMBLE_BANK + 0, // CHAR_PERSONAGOLD, //ӤHȦ +#endif +#ifdef _DROPSTAKENEW + 0, // CHAR_GAMBLENUM, //n +#endif +#ifdef _ADD_ACTION //npcʧ@ + 0, // CHAR_ACTIONSTYLE, +#endif +#ifdef _PET_EVOLUTION + 0, // CHAR_EVOLUTIONBASEVTL, + 0, // CHAR_EVOLUTIONBASESTR, + 0, // CHAR_EVOLUTIONBASETGH, + 0, // CHAR_EVOLUTIONBASEDEX, +#endif + +#ifdef _FM_JOINLIMIT + 0, // CHAR_FMTIMELIMIT, +#endif + +#ifdef _CHAR_PROFESSION // WON ADD H¾~ + 0, // PROFESSION_CLASS, // ¾~O + 0, // PROFESSION_LEVEL, // ¾~ +// 0, // PROFESSION_EXP, // ¾~g + 0, // PROFESSION_SKILL_POINT, // ޯI + 0, // ATTACHPILE, // W[| + 0, // PROFESSION_FIRE_P, // m + 0, // PROFESSION_ICE_P, // Bm + 0, // PROFESSION_THUNDER_P, // pm + 0, // PROFESSION_FIRE_R, // ܩ + 0, // PROFESSION_ICE_R, // Bܩ + 0, // PROFESSION_THUNDER_R, // pܩ +#endif +#ifdef _ALLDOMAN // (i}) Syu ADD Ʀ]NPC + 0, // CHAR_HEROFLOOR, +#endif +#ifdef _PETSKILL_BECOMEPIG + -1, // CHAR_BECOMEPIG, + 100250, //CHAR_BECOMEPIG_BBI +#endif + 0, // CHAR_LASTLEAVETIME, // Robin add ̫uɶ + +#ifdef _NEW_MANOR_LAW + 0, // CHAR_MOMENTUM, +#endif + +#ifdef _ITEM_ADDEXP2 + 0, // CHAR_ADDEXPPOWER, + 0, // CHAR_ADDEXPTIME, +#endif + +#ifdef _VIP_BATTLE_EXP + 0, // CHAR_NVIPEXP, + 0, // CHAR_NVIPTIME, +#endif + +#ifdef _ANGEL_SUMMON + 0, // CHAR_HEROCNT, // i̥Ȫ +#endif + +#ifdef _TEACHER_SYSTEM + 0, // CHAR_TEACHER_FAME, // ʦ쵼 +#endif + +#ifdef _GM_ITEM + 0, // GM +#endif +#ifdef _VIP_SERVER + 0, // Ա +#endif +#ifdef _VIP_RIDE + 0, // Աڼ +#endif +#ifdef _CAMEO_MONEY + 0, +#endif +#ifdef _MISSION_TRAIN + 0, + 0, +#endif +#ifdef _PET_EVOLVE + 0, +#endif +#ifdef _FLOOR_DIFI_FIELD + 0, +#endif +#ifdef _MISSION_TIME + 0, +#endif +#ifdef _PLAYER_TITLE + 0, + 0, +#endif +#ifdef _COWRIE + 0, +#endif +#ifdef _ONLINE_TIME + 0, +#endif + 0, //CHAR_LUASAVE_WORKINT_1 + 0, //CHAR_LUASAVE_WORKINT_2 + 0, //CHAR_LUASAVE_WORKINT_3 + 0, //CHAR_LUASAVE_INT_1 + 0, //CHAR_LUASAVE_INT_2 + 0, //CHAR_LUASAVE_INT_3 +#ifdef _CAX_ESC_REPORT + 0, //CHAR_REPORT ÿǩ +#endif +#ifdef _CAX_Mercenary + 0, //CHAR_MERCENARY Ӷֶ +#endif + }, + + { + {""}, /* CHAR_NAME */ + {""}, /* CHAR_OWNTITLE */ + {""}, /* CHAR_ARGUMENT */ + {""}, /* CHAR_OWNERCDKEY */ + {""}, /* CHAR_OWNERCHARANAME */ + }, + { + SETFLG(1,1,1,1,1,1,0,0 ), + SETFLG(0,0,0,0,0,0,0,1 ), + } +}; + +LevelUpPattern lvplayer00={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer10={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer20={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer30={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer01={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer11={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer21={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer31={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer02={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer12={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer22={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer32={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer03={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer13={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer23={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer33={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer04={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer14={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer24={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer34={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer05={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer15={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer25={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer35={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer06={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer16={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer26={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer36={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer07={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer17={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer27={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer37={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer08={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer18={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer28={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer38={ {{100,10},{200,10},{50,8}},9,11,10}; + +LevelUpPattern lvplayer09={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer19={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer29={ {{100,10},{200,10},{50,8}},9,11,10}; +LevelUpPattern lvplayer39={ {{100,10},{200,10},{50,8}},9,11,10}; + + diff --git a/char/defend.c b/char/defend.c new file mode 100644 index 0000000..eebac60 --- /dev/null +++ b/char/defend.c @@ -0,0 +1,29 @@ +#include "version.h" +#include +#include +#include +#include + +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npcutil.h" +#include "family.h" +#include "log.h" +#include "handletime.h" +#include "buf.h" +#include "net.h" +#include "char_base.h" +#include "battle.h" +#include "npc_bus.h" +#include "char_talk.h" +#include "npc_scheduleman.h" +#include "defend.h" + + + + + diff --git a/char/encount.c b/char/encount.c new file mode 100644 index 0000000..ff1b987 --- /dev/null +++ b/char/encount.c @@ -0,0 +1,580 @@ +#include "version.h" +#include +#include +#include +#ifdef _REDHAT_V9 +#include +#endif + +#include "common.h" +#include "util.h" +#include "buf.h" +#include "char_base.h" +#include "char.h" +#include "configfile.h" +#include "encount.h" +#include "enemy.h" + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ +#include "encount.h" +#endif + +/* ޼ ĩ */ + +#ifndef _ADD_ENCOUNT // WON ADD ӵ޼ +typedef struct tagENCOUNT_Table +{ + int index; + int floor; + int encountprob_min; /* ޼ */ + int encountprob_max; /* ޼ */ + int enemymaxnum; /* ľë¾ */ + int zorder; + int groupid[ENCOUNT_GROUPMAXNUM]; /* No */ + int createprob[ENCOUNT_GROUPMAXNUM]; /* */ + RECT rect; +}ENCOUNT_Table; +ENCOUNT_Table *ENCOUNT_table; +#endif + +int ENCOUNT_encountnum; +#define ENCOUNT_ENEMYMAXCREATENUM 10 + +static INLINE BOOL ENCOUNT_CHECKENCOUNTTABLEARRAY( int array) +{ + if( array < 0 || array > ENCOUNT_encountnum-1) return FALSE; + return TRUE; +} + +/*------------------------------------------------------------ + * ޼ɬüë£ + * ¦ + * filename char* ɬð̻ + * ߯Ի + * TRUE(1) + * FALSE(0) + *------------------------------------------------------------*/ +BOOL ENCOUNT_initEncount( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + int encount_readlen=0; + + f = fopen(filename,"r"); + if( f == NULL ){ + errorprint; + return FALSE; + } + + ENCOUNT_encountnum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + ENCOUNT_encountnum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "ѰҴ\n" ); + fclose(f); + return FALSE; + } + + ENCOUNT_table = allocateMemory( sizeof(struct tagENCOUNT_Table) + * ENCOUNT_encountnum ); + if( ENCOUNT_table == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(ENCOUNT_table)*ENCOUNT_encountnum); + fclose( f ); + return FALSE; + } + + /* */ +{ + int i,j; + for( i = 0; i < ENCOUNT_encountnum; i ++ ) { + ENCOUNT_table[i].index = -1; + ENCOUNT_table[i].floor = 0; + ENCOUNT_table[i].encountprob_min = 1; + ENCOUNT_table[i].encountprob_min = 50; + ENCOUNT_table[i].enemymaxnum = 4; + ENCOUNT_table[i].rect.x = 0; + ENCOUNT_table[i].rect.y = 0; + ENCOUNT_table[i].rect.height = 0; + ENCOUNT_table[i].rect.width = 0; + ENCOUNT_table[i].zorder = 0; + for( j = 0; j < ENCOUNT_GROUPMAXNUM; j ++ ) { + ENCOUNT_table[i].groupid[j] = -1; + ENCOUNT_table[i].createprob[j] = -1; + } +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ + ENCOUNT_table[i].event_now = -1; + ENCOUNT_table[i].event_end = -1; + ENCOUNT_table[i].enemy_group = -1; +#endif + } +} + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ +{ + int i; + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + int x1,x2,y1,y2; + int j; + + /* պ ݼм */ + ENCOUNT_table[encount_readlen].index = -1; + ENCOUNT_table[encount_readlen].floor = 0; + ENCOUNT_table[encount_readlen].encountprob_min = 1; + ENCOUNT_table[encount_readlen].encountprob_min = 50; + ENCOUNT_table[encount_readlen].enemymaxnum = 4; + ENCOUNT_table[encount_readlen].rect.x = 0; + ENCOUNT_table[encount_readlen].rect.y = 0; + ENCOUNT_table[encount_readlen].rect.height = 0; + ENCOUNT_table[encount_readlen].rect.width = 0; + ENCOUNT_table[encount_readlen].zorder = 0; + for( j = 0; j < ENCOUNT_GROUPMAXNUM; j ++ ) { + ENCOUNT_table[encount_readlen].groupid[j] = -1; + ENCOUNT_table[encount_readlen].createprob[j] = -1; + } +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ + ENCOUNT_table[encount_readlen].event_now = -1; + ENCOUNT_table[encount_readlen].event_end = -1; + ENCOUNT_table[encount_readlen].enemy_group = -1; +#endif + + + /* 繴ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",1,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].index = atoi(token); + + /* 2ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",2,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].floor = atoi(token); + + /* 3ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",3,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + x1 = atoi(token); + + /* 4ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",4,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + y1= atoi(token); + + /* 5ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",5,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + + x2 = atoi(token); + + /* 6ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",6,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + y2= atoi(token); + + ENCOUNT_table[encount_readlen].rect.x = min(x1,x2); + ENCOUNT_table[encount_readlen].rect.width = max(x1,x2) - min(x1,x2); + ENCOUNT_table[encount_readlen].rect.y = min(y1,y2); + ENCOUNT_table[encount_readlen].rect.height = max(y1,y2) - min(y1,y2); + + /* 7ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",7,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].encountprob_min = atoi(token); + + /* 8ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",8,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].encountprob_max = atoi(token); + +{ + int a,b; + a = ENCOUNT_table[encount_readlen].encountprob_min; + b = ENCOUNT_table[encount_readlen].encountprob_max; + /* Ʃ */ + ENCOUNT_table[encount_readlen].encountprob_min + = min( a,b); + ENCOUNT_table[encount_readlen].encountprob_max + = max( a,b); +} + /* 9ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",9,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + { + int maxnum = atoi( token); + /* Ѽ뼰 */ + if( maxnum < 1 || maxnum > ENCOUNT_ENEMYMAXCREATENUM ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].enemymaxnum = maxnum; + } + /* 10ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",10,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].zorder = atoi(token); + #define CREATEPROB_TOKEN 11 + + /* 11 31ͼëέ */ + { + int i; + + for( i = CREATEPROB_TOKEN; i < CREATEPROB_TOKEN +ENCOUNT_GROUPMAXNUM*2; i ++) { + ret = getStringFromIndexWithDelim( line,",",i,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + if( strlen( token) != 0 ) { + if( i < CREATEPROB_TOKEN + ENCOUNT_GROUPMAXNUM ) { + ENCOUNT_table[encount_readlen].groupid[i-CREATEPROB_TOKEN] + = atoi(token); + } + else { + ENCOUNT_table[encount_readlen].createprob[i-(CREATEPROB_TOKEN + ENCOUNT_GROUPMAXNUM)] + = atoi(token); + } + } + } + + /* */ + if( checkRedundancy( ENCOUNT_table[encount_readlen].groupid, + arraysizeof( ENCOUNT_table[encount_readlen].groupid))) + { + fprint( "ļ﷨:%s %d\n", + filename,linenum); + continue; + } + } + + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ + ret = getStringFromIndexWithDelim( line,",",31,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].event_now = atoi(token); + + ret = getStringFromIndexWithDelim( line,",",32,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].event_end = atoi(token); + + ret = getStringFromIndexWithDelim( line,",",33,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENCOUNT_table[encount_readlen].enemy_group = atoi(token); +#endif + + encount_readlen ++; +} + } + fclose(f); + + ENCOUNT_encountnum = encount_readlen; + + print( "Ч %d..", ENCOUNT_encountnum ); + + return TRUE; +} +/*------------------------------------------------------------------------ + * ޼ɬð̻ + *-----------------------------------------------------------------------*/ +BOOL ENCOUNT_reinitEncount( void ) +{ + freeMemory( ENCOUNT_table); + return( ENCOUNT_initEncount( getEncountfile())); +} + +/*------------------------------------------------------------ + * ϶ýľ ENCOUNT_tableٯëƩ£ + * zorderٯëέƴ˼ ë £ + * ¦ + * floor int ׷ʧID + * x int x + * y int y + * ߯Ի + * ٯ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountAreaArray( int floor, int x, int y) +{ + int i; + int index = -1; + for( i=0 ; i0) { + if( index != -1 ) { + /* ƴëƩ */ + /* */ + if( curZorder > ENCOUNT_getZorderFromArray(index)) { + index = i; + } + } + else { + index = i; + } + } + } + } + } + return index; +} + +/*------------------------------------------------------------ + * ϶ýľ ޼ ëƩ£ + * ¦ + * floor int ׷ʧID + * x int x + * y int y + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountPercentMin( int charaindex, int floor , int x, int y ) +{ + int ret; + + ret = ENCOUNT_getEncountAreaArray( floor, x, y); + if( ret != -1 ) { + ret = ENCOUNT_table[ret].encountprob_min; + /* Ŀ򵩶ë */ + if( CHAR_getWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT) > 0 ) { + ret = ceil( ret * + ((100 + CHAR_getWorkInt( charaindex, CHAR_WORK_TOHELOS_CUTRATE)) + / 100.0)); + } + if( ret < 0 ) ret = 0; + if( ret > 100 ) ret = 100; + } + return ret; +} +/*------------------------------------------------------------ + * ϶ýľ ޼ ëƩ£ + * ¦ + * floor int ׷ʧID + * x int x + * y int y + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountPercentMax( int charaindex, int floor , int x, int y ) +{ + int ret; + + ret = ENCOUNT_getEncountAreaArray( floor, x, y); + if( ret != -1 ) { + ret = ENCOUNT_table[ret].encountprob_max; + /* Ŀ򵩶ë */ + if( CHAR_getWorkInt( charaindex, CHAR_WORK_TOHELOS_COUNT) > 0 ) { + ret = ceil( ret * + ((100 + CHAR_getWorkInt( charaindex, CHAR_WORK_TOHELOS_CUTRATE)) + / 100.0)); + } + if( ret < 0 ) ret = 0; + if( ret > 100 ) ret = 100; + } + return ret; +} +/*------------------------------------------------------------ + * ϶ýľ ϷMAXëƩ£ + * ¦ + * floor int ׷ʧID + * x int x + * y int y + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getCreateEnemyMaxNum( int floor , int x, int y ) +{ + int ret; + + ret = ENCOUNT_getEncountAreaArray( floor, x, y); + if( ret != -1 ) { + ret = ENCOUNT_table[ret].enemymaxnum; + } + return ret; +} +/*------------------------------------------------------------ + * ϶ýľ ޼ūindexëƩ£ + * ¦ + * floor int ׷ʧID + * x int x + * y int y + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountIndex( int floor , int x, int y ) +{ + int ret; + + ret = ENCOUNT_getEncountAreaArray( floor, x, y); + if( ret != -1 ) { + ret = ENCOUNT_table[ret].index; + } + return ret; +} +/*------------------------------------------------------------ + * ϶ýľ ޼ūindexëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountIndexFromArray( int array ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].index; +} +/*------------------------------------------------------------ + * ϶ýľ ޼ ëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getEncountPercentFromArray( int array ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].encountprob_min; +} +/*------------------------------------------------------------ + * ϶ýľ ϷMAXëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getCreateEnemyMaxNumFromArray( int array ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].enemymaxnum; +} +/*------------------------------------------------------------ + * ϶ýľ׽ٯ įëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getGroupIdFromArray( int array, int grouparray ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].groupid[grouparray]; +} +/*------------------------------------------------------------ + * ϶ýľ׽ٯ ëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getGroupProbFromArray( int array, int grouparray ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].createprob[grouparray]; +} +/*------------------------------------------------------------ + * ϶ýľ׽ٯƴëƩ£ + * ¦ + * array int ENCOUNTTABLEٯ + * ߯Ի + * ߶ + * -1 + ------------------------------------------------------------*/ +int ENCOUNT_getZorderFromArray( int array ) +{ + if( !ENCOUNT_CHECKENCOUNTTABLEARRAY( array)) return -1; + return ENCOUNT_table[array].zorder; +} diff --git a/char/enemy.c b/char/enemy.c new file mode 100644 index 0000000..a32c106 --- /dev/null +++ b/char/enemy.c @@ -0,0 +1,2759 @@ +/* ɬ */ +#include "version.h" +#include +#include +#include "common.h" +#include "util.h" +#include "buf.h" +#include "char_base.h" +#include "char.h" +#include "configfile.h" +#include "encount.h" +#include "enemy.h" +#include "pet.h" +#include "enemyexptbl.h" +#include "petmail.h" +#include "battle.h" +#include "pet_skillinfo.h" +#include "anim_tbl.h" +#include "log.h" + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ +#include "encount.h" +#include "npcutil.h" +#endif + +#define ENEMY_INDEXTABLEMAXSIZE 16 +static ENEMY_EnemyTable *ENEMY_enemy; +static int ENEMY_enemynum; + +static ENEMYTEMP_Table *ENEMYTEMP_enemy; +static int ENEMYTEMP_enemynum; + +static GROUP_Table *GROUP_group; +static int GROUP_groupnum; + +int ENEMY_indextable[ENEMY_INDEXTABLEMAXSIZE]; + +#ifdef _ENEMY_FALLGROUND +extern tagRidePetTable ridePetTable[296]; +#endif + +INLINE BOOL ENEMY_CHECKINDEX( int index) +{ + if( index < 0 || index >= ENEMY_enemynum) return FALSE; + return TRUE; +} + +static INLINE BOOL ENEMY_CHECKINTDATAINDEX( int index) +{ + if( index< 0 || index >= ENEMY_DATAINTNUM) return FALSE; + return TRUE; +} + +static INLINE BOOL ENEMY_CHECKCHARDATAINDEX( int index) +{ + if( index< 0 || index >= ENEMY_DATACHARNUM) return FALSE; + return TRUE; +} + +INLINE int ENEMY_getInt( int index, ENEMY_DATAINT element) +{ + return ENEMY_enemy[index].intdata[element]; +} + +INLINE int *ENEMY_getIntdata( int index) +{ + return ENEMY_enemy[index].intdata; +} + +INLINE int ENEMY_setInt( int index, ENEMY_DATAINT element, int data) +{ + int buf; + buf = ENEMY_enemy[index].intdata[element]; + ENEMY_enemy[index].intdata[element] = data; + return buf; +} + +INLINE char *ENEMY_getChar( int index, ENEMY_DATACHAR element) +{ + if(!ENEMY_CHECKINDEX(index))return "\0"; + if(!ENEMY_CHECKCHARDATAINDEX(element))return "\0"; + + return ENEMY_enemy[index].chardata[element].string; +} + +INLINE BOOL ENEMY_setChar( int index ,ENEMY_DATACHAR element, char* new ) +{ + if(!ENEMY_CHECKINDEX(index))return FALSE; + if(!ENEMY_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( ENEMY_enemy[index].chardata[element].string, + sizeof(ENEMY_enemy[index].chardata[element].string), + new ); + return TRUE; +} + +int ENEMY_getEnemyNum( void) +{ + return ENEMY_enemynum; +} + +INLINE BOOL ENEMYTEMP_CHECKINDEX( int index) +{ + if( index < 0 || index >= ENEMYTEMP_enemynum) return FALSE; + return TRUE; +} + +static INLINE BOOL ENEMYTEMP_CHECKINTDATAINDEX( int index) +{ + if( index< 0 || index >= E_T_DATAINTNUM) return FALSE; + return TRUE; +} + +static INLINE BOOL ENEMYTEMP_CHECKCHARDATAINDEX( int index) +{ + if( index< 0 || index >= E_T_DATACHARNUM) return FALSE; + return TRUE; +} + +INLINE int ENEMYTEMP_getInt( int index, ENEMYTEMP_DATAINT element) +{ + return ENEMYTEMP_enemy[index].intdata[element]; +} + +INLINE int ENEMYTEMP_setInt( int index, ENEMYTEMP_DATAINT element, int data) +{ + int buf; + buf = ENEMYTEMP_enemy[index].intdata[element]; + ENEMYTEMP_enemy[index].intdata[element] = data; + return buf; +} + +INLINE char *ENEMYTEMP_getChar( int index, ENEMYTEMP_DATACHAR element) +{ + if(!ENEMYTEMP_CHECKINDEX(index))return "\0"; + if(!ENEMYTEMP_CHECKCHARDATAINDEX(element))return "\0"; + + return ENEMYTEMP_enemy[index].chardata[element].string; +} + +INLINE BOOL ENEMYTEMP_setChar( int index ,ENEMYTEMP_DATACHAR element, char* new ) +{ + if(!ENEMYTEMP_CHECKINDEX(index))return FALSE; + if(!ENEMYTEMP_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( ENEMYTEMP_enemy[index].chardata[element].string, + sizeof(ENEMYTEMP_enemy[index].chardata[element].string), + new ); + return TRUE; +} + +int ENEMYTEMP_getEnemyNum( void) +{ + return ENEMYTEMP_enemynum; +} + +INLINE BOOL GROUP_CHECKINDEX( int index) +{ + if( index < 0 || index >= GROUP_groupnum) return FALSE; + return TRUE; +} + +static INLINE BOOL GROUP_CHECKINTDATAINDEX( int index) +{ + if( index< 0 || index >= GROUP_DATAINTNUM) return FALSE; + return TRUE; +} + +static INLINE BOOL GROUP_CHECKCHARDATAINDEX( int index) +{ + if( index< 0 || index >= GROUP_DATACHARNUM) return FALSE; + return TRUE; +} + +INLINE int GROUP_getInt( int index, GROUP_DATAINT element) +{ + return GROUP_group[index].intdata[element]; +} + +INLINE int GROUP_setInt( int index, GROUP_DATAINT element, int data) +{ + int buf; + buf = GROUP_group[index].intdata[element]; + GROUP_group[index].intdata[element] = data; + return buf; +} + +INLINE char *GROUP_getChar( int index, GROUP_DATACHAR element) +{ + if(!GROUP_CHECKINDEX(index))return "\0"; + if(!GROUP_CHECKCHARDATAINDEX(element))return "\0"; + + return GROUP_group[index].chardata[element].string; +} + +INLINE BOOL GROUP_setChar( int index ,GROUP_DATACHAR element, char* new ) +{ + if(!GROUP_CHECKINDEX(index))return FALSE; + if(!GROUP_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( GROUP_group[index].chardata[element].string, + sizeof(GROUP_group[index].chardata[element].string), + new ); + return TRUE; +} + +int GROUP_getEnemyNum( void) +{ + return GROUP_groupnum; +} + +BOOL ENEMYTEMP_initEnemy( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + int enemytemp_readlen=0; + int i,j; + f = fopen(filename,"r"); + if( f == NULL ){ + print( "ļʧ\n"); + return FALSE; + } + + ENEMYTEMP_enemynum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + ENEMYTEMP_enemynum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Seek Error\n" ); + fclose(f); + return FALSE; + } + ENEMYTEMP_enemy = allocateMemory( sizeof(struct tagENEMYTEMP_Table) + * ENEMYTEMP_enemynum ); + if( ENEMYTEMP_enemy == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(struct tagENEMYTEMP_Table)*ENEMYTEMP_enemynum); + fclose( f ); + return FALSE; + } + + /* */ + for( i = 0; i < ENEMYTEMP_enemynum; i ++ ) { + for( j = 0; j < E_T_DATAINTNUM; j ++ ) { + ENEMYTEMP_setInt( i,j,-1); + } + } + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + replaceString( line, '\t' , ' ' ); +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + for( i = 0; i < E_T_DATACHARNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i+1,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENEMYTEMP_setChar( enemytemp_readlen, E_T_NAME + i, token); + + } +#define ENEMYTEMP_STARTINTNUM (E_T_DATACHARNUM+1) + for( i = ENEMYTEMP_STARTINTNUM; i < E_T_DATAINTNUM+ENEMYTEMP_STARTINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + if( strlen( token) != 0 ) { + ENEMYTEMP_setInt( enemytemp_readlen, i - ENEMYTEMP_STARTINTNUM, atoi( token)); + } + } + if( i < E_T_DATAINTNUM+ENEMYTEMP_STARTINTNUM ) continue; + + + enemytemp_readlen ++; +} + } + fclose(f); + + ENEMYTEMP_enemynum = enemytemp_readlen; + + print( "Ч״̬ %d...", ENEMYTEMP_enemynum ); + + return TRUE; +} + +BOOL ENEMYTEMP_reinitEnemy( void ) +{ + freeMemory( ENEMYTEMP_enemy); + return( ENEMYTEMP_initEnemy( getEnemyBasefile())); +} + +int ENEMYTEMP_getEnemyTempArray( int enemyindex) +{ + if( !ENEMY_CHECKINDEX( enemyindex)) return -1; + return ENEMY_enemy[enemyindex].enemytemparray; +} + +int ENEMYTEMP_getEnemyTempArrayFromTempNo( int EnemyTempNo) +{ + int i; + for( i = 0; i < ENEMYTEMP_enemynum; i ++ ) { + if( ENEMYTEMP_getInt( i, E_T_TEMPNO) == EnemyTempNo) { + return i; + } + } + return -1; +} + +int ENEMYTEMP_getEnemyTempArrayFromInitnum( int EnemyTempNo) +{ + int i; + for( i = 0; i < ENEMYTEMP_enemynum; i ++ ) { + if( ENEMYTEMP_getInt( i, E_T_INITNUM) == EnemyTempNo) { + return i; + } + } + return -1; +} + +BOOL ENEMY_initEnemy( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + int enemy_readlen=0; + int i,j; + f = fopen(filename,"r"); + if( f == NULL ){ + print( "ļʧ\n"); + return FALSE; + } + + ENEMY_enemynum=0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + ENEMY_enemynum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Ѱʧ\n" ); + fclose(f); + return FALSE; + } + + ENEMY_enemy = allocateMemory( sizeof(struct tagENEMY_EnemyTable) + * ENEMY_enemynum ); + if( ENEMY_enemy == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(struct tagENEMY_EnemyTable)*ENEMY_enemynum); + fclose( f ); + return FALSE; + } + for( i = 0; i < ENEMY_enemynum; i ++ ) { + for( j = 0; j < ENEMY_DATAINTNUM; j ++ ) { + ENEMY_setInt( i,j,-1); + } + } + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + replaceString( line, '\t' , ' ' ); +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + + ret = getStringFromIndexWithDelim( line,",",1,token,sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENEMY_setChar( enemy_readlen, ENEMY_NAME, token); + ret = getStringFromIndexWithDelim( line,",",2,token,sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENEMY_setChar( enemy_readlen, ENEMY_TACTICSOPTION, token); +#ifdef _BATTLENPC_WARP_PLAYER + ret = getStringFromIndexWithDelim( line, ",", 3, token, sizeof(token)); + if(ret==FALSE){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENEMY_setChar( enemy_readlen, ENEMY_ACT_CONDITION, token); +#endif + +#ifdef _BATTLENPC_WARP_PLAYER +#define ENEMY_STARTINTNUM 4 +#else +#define ENEMY_STARTINTNUM 3 +#endif + + for( i = ENEMY_STARTINTNUM; i < ENEMY_DATAINTNUM+ENEMY_STARTINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i,token,sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + ENEMY_setInt( enemy_readlen, i - ENEMY_STARTINTNUM, atoi( token)); + } + if( i < ENEMY_DATAINTNUM+ENEMY_STARTINTNUM ) continue; + for( i = 0; i < ENEMYTEMP_enemynum; i ++ ) { + if( ENEMYTEMP_getInt( i, E_T_TEMPNO)== ENEMY_getInt( enemy_readlen, ENEMY_TEMPNO)){ + break; + } + } + if( i == ENEMYTEMP_enemynum) { + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + ENEMY_enemy[enemy_readlen].enemytemparray = i; +{ + int lv_min, lv_max; + lv_min = ENEMY_getInt( enemy_readlen, ENEMY_LV_MIN); + lv_max = ENEMY_getInt( enemy_readlen, ENEMY_LV_MAX); + if( lv_min == 0 ) lv_min = lv_max; + ENEMY_setInt( enemy_readlen, ENEMY_LV_MIN, min( lv_min, lv_max)); + ENEMY_setInt( enemy_readlen, ENEMY_LV_MAX, max( lv_min, lv_max)); + +} + + enemy_readlen ++; +} + } + fclose(f); + ENEMY_enemynum = enemy_readlen; + print( "Ч %d..", ENEMY_enemynum ); + + return TRUE; +} +/*------------------------------------------------------------------------ + * ENEMY_enemyɬð̻ + *-----------------------------------------------------------------------*/ +BOOL ENEMY_reinitEnemy( void ) +{ + freeMemory( ENEMY_enemy); + return( ENEMY_initEnemy( getEnemyfile())); +} + +/*------------------------------------------------------------------------ + ENEMY_Enemyٯë + *-----------------------------------------------------------------------*/ +int ENEMY_getEnemyArrayFromIndex( int groupindex, int index) +{ + if( !GROUP_CHECKINDEX( groupindex)) return -1; + if( index < 0 || index >= CREATEPROB1 - ENEMY_ID1) return -1; + return GROUP_group[groupindex].enemyarray[index]; +} +/*------------------------------------------------------------------------ + * ENEMY_ID ENEMY_Enemyٯë + *-----------------------------------------------------------------------*/ +int ENEMY_getEnemyArrayFromId( int EnemyId) +{ + int i; + for( i = 0; i < ENEMY_enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == EnemyId) { + return i; + } + } + return -1; +} + +int ENEMY_getEnemyArrayFromTempNo( int EnemyTempNo) +{ + int i; + for( i = 0; i < ENEMY_enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_TEMPNO) == EnemyTempNo) { + return i; + } + } + return -1; +} + +int ENEMY_getEnemyIdFromTempNo( int EnemyTempNo) +{ + int i; + for( i = 0; i < ENEMY_enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_TEMPNO) == EnemyTempNo) { + return ENEMY_getInt( i, ENEMY_ID); + } + } + return -1; +} + +int ENEMY_getEnemyTempNoFromId( int EnemyId) +{ + int i; + for( i = 0; i < ENEMY_enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == EnemyId) { + return ENEMY_getInt( i, ENEMY_TEMPNO); + } + } + return -1; +} + +/*------------------------------------------------------------------------ + * ɬð̻ë + *-----------------------------------------------------------------------*/ +BOOL GROUP_initGroup( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + int group_readlen=0; + int i,j; + + f = fopen(filename,"r"); + if( f == NULL ){ + print( "ļʧ\n"); + return FALSE; + } + + GROUP_groupnum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + GROUP_groupnum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Ѱʧ\n" ); + fclose(f); + return FALSE; + } + + GROUP_group = allocateMemory( sizeof(struct tagGROUP_Table) + * GROUP_groupnum ); + if( GROUP_group == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(struct tagGROUP_Table)*GROUP_groupnum); + fclose( f ); + return FALSE; + } + /* */ + for( i = 0; i < GROUP_groupnum; i ++ ) { + for( j = 0; j < GROUP_DATAINTNUM; j ++ ) { + GROUP_setInt( i,j,-1); + } + for( j = 0; j < CREATEPROB1 - ENEMY_ID1; j ++ ) { + GROUP_group[i].enemyarray[j] = -1; + } + } + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + int loop; + + /* ֨պ ݼ׻ƻ */ + for( j = 0; j < GROUP_DATAINTNUM; j ++ ) { + GROUP_setInt( group_readlen,j,-1); + } + for( j = 0; j < CREATEPROB1 - ENEMY_ID1; j ++ ) { + GROUP_group[group_readlen].enemyarray[j] = -1; + } + + /* 繴ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",1,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + GROUP_setChar( group_readlen, GROUP_NAME, token); + + /* 2 ϷѰ */ +#define GROUP_STARTINTNUM 2 + for( i = GROUP_STARTINTNUM; i < GROUP_DATAINTNUM+GROUP_STARTINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + if( strlen( token) != 0 ) { + GROUP_setInt( group_readlen, i - GROUP_STARTINTNUM, atoi( token)); + } + } + if( i < GROUP_DATAINTNUM+GROUP_STARTINTNUM ) continue; + + { + int enemycnt = 0; + for( loop = ENEMY_ID1; loop < CREATEPROB1; loop ++ ) { + if( GROUP_getInt( group_readlen, loop) != -1 ) { + for( i = 0; i < ENEMY_enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) + == GROUP_getInt( group_readlen, loop)) + { + break; + } + } + if( i == ENEMY_enemynum) { + i = -1; + GROUP_setInt( group_readlen, loop, -1); + } + else { + enemycnt ++; + } + GROUP_group[group_readlen].enemyarray[loop - ENEMY_ID1] = i; + } + } + if( enemycnt == 0 ) { + fprint("Ŷ趨еδ趨 ļ:%s %d\n",filename,linenum); + continue;; + } + if( checkRedundancy( &GROUP_group[group_readlen].intdata[ENEMY_ID1], + CREATEPROB1 - ENEMY_ID1)) + { + fprint("Ŷ趨еظ趨 ļ:%s %d\n",filename,linenum); + continue;; + } + + } + + + group_readlen ++; +} + } + fclose(f); + + GROUP_groupnum = group_readlen; + + print( "ЧȺ %d...", GROUP_groupnum ); + + return TRUE; +} +/*------------------------------------------------------------------------ + * ɬð̻ + *-----------------------------------------------------------------------*/ +BOOL GROUP_reinitGroup( void ) +{ + freeMemory( GROUP_group); + return( GROUP_initGroup( getGroupfile())); +} +/*------------------------------------------------------------------------ + * GROUP_ID GROUP_Groupٯë + *-----------------------------------------------------------------------*/ +int GROUP_getGroupArray( int groupid) +{ + int i; + for( i = 0; i < GROUP_groupnum; i ++ ) { + if( GROUP_getInt( i, GROUP_ID) == groupid) { + return i; + } + } + return -1; +} +/*------------------------------------------------------------------------ + * ë£ + *-----------------------------------------------------------------------*/ +static int ENEMY_getExp( int array,int tarray, int level, int rank ) +{ + int ret; + int *p; + int *tp; + float ranknum = 0.0; + float alpha; + struct { + int num; + float rank; + }ranktbl[] = { + { 100, 2.5}, + { 95, 2.0}, + { 90, 1.5}, + { 85, 1.0}, + { 80, 0.5}, + { 0, 0.0}, + }; + level --; + if( level < 0 || level >= arraysizeof( enemybaseexptbl)) return 0; + + p = ENEMY_enemy[array].intdata; + tp = ENEMYTEMP_enemy[tarray].intdata; + + // ¼; ë + if( rank < 0 || rank > 5 ) rank = 0; + ranknum = ranktbl[rank].rank; + + alpha = ( *( tp + E_T_CRITICAL) + *( tp + E_T_COUNTER) + *(tp + E_T_GET) + + *( tp + E_T_POISON) + *( tp + E_T_PARALYSIS) + *(tp + E_T_SLEEP) + + *( tp + E_T_STONE) + *( tp + E_T_DRUNK) + *(tp + E_T_CONFUSION) + ) / 100.0 + + *( tp + E_T_RARE); + /* EXP EXP֣ ¼͡ϫ ì*/ + //return enemybaseexptbl[*(p+ENEMY_LV)] + (ranknum + alpha)*(*(tp+ENEMY_LV)); + ret = enemybaseexptbl[level] + (ranknum + alpha)*(level+1); + return ( ret < 1 ) ? 1 : ret; + +} + + +int ENEMY_getRank( int array, int tarray ){ + int *p; + int *tp; + int paramsum; + int i; + int ranknum; + + struct { + int num; + float rank; + }ranktbl[] = { + { 100, 2.5}, //ܳɳ >= 100 petrank=0 + { 95, 2.0}, + { 90, 1.5}, + { 85, 1.0}, + { 80, 0.5}, + { 0, 0.0}, + }; + + p = ENEMY_enemy[array].intdata; + tp = ENEMYTEMP_enemy[tarray].intdata; + /* ¼ëң */ + /* ̤ëټǣ */ + paramsum = *( tp + E_T_BASEVITAL) + + *( tp + E_T_BASESTR) + + *( tp + E_T_BASETGH) + + *( tp + E_T_BASEDEX); + + ranknum = 0; // ɻ + for( i = 0; i < arraysizeof( ranktbl); i ++ ) { + if( paramsum >= ranktbl[i].num ) { + ranknum = i; + break; + } + } + + return ranknum; + +} + + +//********************************************************* +// ¼ĸةئ +//********************************************************* +static int EnemyGymSkill[] = { + PETSKILL_GUARDBREAK, // ⡰(3) + PETSKILL_CONTINUATIONATTACK1, // ߡ (10) + PETSKILL_CONTINUATIONATTACK2, // ࡰ (11) + PETSKILL_CONTINUATIONATTACK3, // ᡰ (12) + PETSKILL_CHARGE1, // ߡҡ(30) + PETSKILL_CHARGE2, // ࡰҡ(31) + PETSKILL_MIGHTY1, // ߡ ڽ(40) + PETSKILL_MIGHTY2, // ࡰ ڽ(41) + PETSKILL_POWERBALANCE1, // ߡ (50) + PETSKILL_POWERBALANCE2, // ࡰ (51) + PETSKILL_POWERBALANCE3, // ᡰ (52) + PETSKILL_POISON_ATTACK1, // ߡ (60) + PETSKILL_POISON_ATTACK2, // ࡰ (61) + PETSKILL_STONE, // ߡ޼ (80) + PETSKILL_CONFUSION_ATTACK, // ߡ (90) + PETSKILL_DRUNK_ATTACK, // ߨߡ (100) + PETSKILL_SLEEP_ATTACK, // ߡԻ (110) + PETSKILL_NOGUARD1, // ߡá(150) + PETSKILL_NOGUARD2, // ࡰá(151) + PETSKILL_NOGUARD3, // ᡰá(152) +#ifdef _PSKILL_FALLGROUND + PETSKILL_FALLGROUND, // +#endif +#ifdef _SKILL_DAMAGETOHP + PETSKILL_DAMAGETOHP, //Ѫ +#endif +#ifdef _Skill_MPDAMAGE + PETSKILL_MPDAMAGE, //MP˺ +#endif + +#ifdef _SKILL_WILDVIOLENT_ATT + PETSKILL_WILDVIOLENTATTACK, //(540)񱩹 vincent add 2002/05/16 +#endif +#ifdef _SKILL_SPEEDY_ATT + PETSKILL_SPEEDYATTACK, //(541)ٹ vincent add 2002/05/16 +#endif +#ifdef _SKILL_GUARDBREAK2 + PETSKILL_GUARDBREAK2, //(542)Ƴ2 vincent add 2002/05/20 +#endif +#ifdef _SKILL_SACRIFICE + PETSKILL_SACRIFICE, //(543)Ԯ vincent add 2002/05/30 +#endif +#ifdef _SKILL_WEAKEN + PETSKILL_WEAKEN, //(544)Ԯ vincent add 2002/07/11 +#endif +#ifdef _SKILL_DEEPPOISON + PETSKILL_DEEPPOISON, //(545)Ԯ vincent add 2002/07/16 +#endif +#ifdef _SKILL_BARRIER + PETSKILL_BARRIER, //(546)ħ vincent add 2002/07/16 +#endif +#ifdef _SKILL_NOCAST + PETSKILL_NOCAST, //(547)Ĭ vincent add 2002/07/16 +#endif +#ifdef _SKILL_ROAR + PETSKILL_ROAR, //(548) vincent add 2002/07/11 +#endif + +#ifdef _SKILL_REFRESH + PETSKILL_REFRESH, //(550)Ԯ vincent add 2002/08/08 +#endif +#ifdef _VARY_WOLF + PETSKILL_VARY, +#endif +#ifdef _PETSKILL_SETDUCK + PETSKILL_SETDUCK, +#endif + +#ifdef _MAGICPET_SKILL + PETSKILL_SETMAGICPET, +#endif +#ifdef _PETSKILL_BECOMEPIG + PETSKILL_BECOMEPIG, +#endif +#ifdef _PETSKILL_LER + PETSKILL_BATFLY, + PETSKILL_DIVIDEATTACK, +#endif +#ifdef _PETSKILL_BATTLE_MODEL + PETSKILL_BATTLE_MODEL, +#endif +}; + +static int gymbody[] = { + SPR_001em,SPR_011em,SPR_021em,SPR_031em,SPR_041em,SPR_051em, + SPR_061em,SPR_071em,SPR_081em,SPR_091em,SPR_101em,SPR_111em, + + SPR_002em,SPR_012em,SPR_022em,SPR_032em,SPR_042em,SPR_052em, + SPR_062em,SPR_072em,SPR_082em,SPR_092em,SPR_102em,SPR_112em, + + SPR_003em,SPR_013em,SPR_023em,SPR_033em,SPR_043em,SPR_053em, + SPR_063em,SPR_073em,SPR_083em,SPR_093em,SPR_103em,SPR_113em, + + SPR_004em,SPR_014em,SPR_024em,SPR_034em,SPR_044em,SPR_054em, + SPR_064em,SPR_074em,SPR_084em,SPR_094em,SPR_104em,SPR_114em, +}; + + +/*------------------------------------------------------------------------ + * ENEMY¼ĸةئ ëܸ + *-----------------------------------------------------------------------*/ +int ENEMY_RandomChange( int enemyindex, int tempno ) +{ + int work, work2, iRet = 0; + + // ¼ĸةƽҷ¾ + if( ( 564 <= tempno && tempno <= 580 ) + || ( 739 <= tempno && tempno <= 750 ) + || ( 895 <= tempno && tempno <= 906 ) + ){ + //******************************************** + // ӿ + //******************************************** + iRet = 1; + }else + // ¼ĸةƽҷ¾ + if( ( 655 <= tempno && tempno <= 720 ) + || ( 859 <= tempno && tempno <= 894 ) + || ( 907 <= tempno && tempno <= 940 ) + ){ + //******************************************** + // ʸӿ + //******************************************** + iRet = 2; + }else{ + return 0; + } + + + if( iRet == 1 ){ + //******************************************** + // + // ӿ׳ئƥַ¼ĸة + // + //******************************************** + // ϳַ¼ĸة + CHAR_setInt( enemyindex, CHAR_BASEBASEIMAGENUMBER, + gymbody[RAND( 0, arraysizeof( gymbody ) - 1)] ); + CHAR_setInt( enemyindex, CHAR_BASEIMAGENUMBER, + CHAR_getInt( enemyindex, CHAR_BASEBASEIMAGENUMBER ) ); + // 뷴 + work = ( RAND( 0, 20 ) - 10 ) * 10; + work2 = 100 - ABS( work ); + CHAR_setInt( enemyindex, CHAR_EARTHAT, work ); + CHAR_setInt( enemyindex, CHAR_FIREAT, -work ); + if( RAND( 0, 1 ) ){ + work2 *= -1; + } + CHAR_setInt( enemyindex, CHAR_WATERAT, work2 ); + CHAR_setInt( enemyindex, CHAR_WINDAT, -work2 ); + + // ¼ĸةئ տë + if( DoujyouRandomWeponSet( enemyindex ) ){ + // տɧ ë + CHAR_setPetSkill( enemyindex, 0, PETSKILL_NORMALATTACK ); + CHAR_setPetSkill( enemyindex, 1, PETSKILL_NORMALATTACK ); + }else{ + // տԪئмƥ + // ë + CHAR_setPetSkill( enemyindex, 0, + EnemyGymSkill[RAND( 0, arraysizeof( EnemyGymSkill ) - 1 )] ); + // ë + CHAR_setPetSkill( enemyindex, 1, + EnemyGymSkill[RAND( 0, arraysizeof( EnemyGymSkill ) - 1 )] ); + } + + }else + if( iRet == 2 ){ + // տԪئмƥ + // ë + CHAR_setPetSkill( enemyindex, 0, + EnemyGymSkill[RAND( 0, arraysizeof( EnemyGymSkill ) - 1 )] ); + // ë + CHAR_setPetSkill( enemyindex, 1, + EnemyGymSkill[RAND( 0, arraysizeof( EnemyGymSkill ) - 1 )] ); + } + + return 1; + +} + + +/*------------------------------------------------------------------------ + * ENEMY_enemyƽҷë£ + *-----------------------------------------------------------------------*/ +int ENEMY_createEnemy( int array, int baselevel ) +{ + Char CharNew; + int newindex; + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int itemindex,iloop; + int level; + int enemyrank; + + if( !ENEMY_CHECKINDEX( array)) return -1; + + p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) return -1; +// tp = ENEMYTEMP_enemy[tarray].intdata; + // + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + + // + memset( &CharNew, 0, sizeof( Char ) ); + + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + + /* į */ + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + /* ƥؤɬ */ + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEENEMY; + /* ë */ + CharNew.data[CHAR_DUELPOINT] = 0; + + /* ìë£ */ + if( baselevel > 0 ){ + level = baselevel; // ì + }else{ + level = RAND( (*(p + ENEMY_LV_MIN)), (*(p+ ENEMY_LV_MAX))); + } +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +/* ɷ¶϶Ѿ ˼ ɷ¶߼ңֿ */ +#if 1 +#define PARAM_CAL( l) ( ( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#else +#define PARAM_CAL( l) ( (E_PAR(ENEMY_LV) -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#endif + /* ԻԻ̼士ë¼ĸةƥ浤 */ + tp[E_T_BASEVITAL] += RAND( 0, 4 ) - 2; + tp[E_T_BASESTR] += RAND( 0, 4 ) - 2; + tp[E_T_BASETGH] += RAND( 0, 4 ) - 2; + tp[E_T_BASEDEX] += RAND( 0, 4 ) - 2; + /* ƥԻԻ̼ëƻ */ + CharNew.data[CHAR_ALLOCPOINT] + = ( tp[E_T_BASEVITAL] << 24 ) + + ( tp[E_T_BASESTR] << 16 ) + + ( tp[E_T_BASETGH] << 8 ) + + ( tp[E_T_BASEDEX] << 0 ); + /* ¼ĸةƥ̼ë𹴵ң۳ľë߼Ի߯ʣ*/ + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } + + /* ɷ¶ */ + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + //CharNew.data[CHAR_LV] = *(p+ ENEMY_LV); + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + CharNew.data[CHAR_PETENEMYID] = ENEMY_getInt( array, ENEMY_ID); + + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = *(tp + E_T_PETSKILL1 + i); + } + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + CharNew.data[CHAR_DUELPOINT] = *( p + ENEMY_DUELPOINT); + if( *( p + ENEMY_DUELPOINT) <= 0 ) { + if( *(p + ENEMY_EXP) != -1 ) { + CharNew.data[CHAR_EXP] = *( p+ENEMY_EXP); + }else { + CharNew.data[CHAR_EXP] = ENEMY_getExp( array,tarray,level, enemyrank); + } + } + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + + newindex = CHAR_initCharOneArray( &CharNew ); +#ifdef _CAX_LVTISHI +if (CHAR_getInt( newindex, CHAR_LV) == 1){// + char buff[256]; + snprintf( buff, sizeof( buff),"%s",CHAR_getChar( newindex, CHAR_NAME)); + CHAR_setChar( newindex, CHAR_NAME, buff); + } +#endif + if( newindex < 0 ){ + return -1; + } + for( iloop=0; iloop< (ENEMY_ITEMPROB10 - ENEMY_ITEM1+1)/2; iloop++){ + if( *(p+ENEMY_ITEMPROB1+iloop) != 0) { +#ifdef _FIX_ITEMPROB + if( RAND( 0,999) < *(p+ENEMY_ITEMPROB1+iloop)){ +#else + if( RAND( 0,99) < *(p+ENEMY_ITEMPROB1+iloop)){ +#endif + itemindex = ITEM_makeItemAndRegist( *(p+ENEMY_ITEM1+iloop) ); + CHAR_setItemIndex( newindex, CHAR_STARTITEMARRAY +iloop, itemindex); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, newindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX,-1); + + } + } + } + + { int style, wepon = -1; + style = (*(p + ENEMY_STYLE)); + switch( style ){ + case 1: wepon = 0;break; // + case 2: wepon = 100;break; // + case 3: wepon = 200;break; // + case 4: wepon = 400;break; // + case 5: wepon = 500;break; // Ƥ¼ + case 6: wepon = 700;break; // + case 7: wepon = 600;break; // + default:break; + } + if( wepon >= 0 ){ + itemindex = ITEM_makeItemAndRegist( wepon ) ; + CHAR_setItemIndex( newindex, CHAR_ARM, itemindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, newindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX,-1); + } + } + + ENEMY_RandomChange( newindex, *( p+ENEMY_ID) ); + CHAR_complianceParameter( newindex ); + + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); + CHAR_setWorkInt( newindex, CHAR_WORKTACTICS, *(p+ENEMY_TACTICS)); + CHAR_setWorkChar( newindex, CHAR_WORKBATTLE_TACTICSOPTION, + ENEMY_enemy[array].chardata[ENEMY_TACTICSOPTION].string ); +#ifdef _BATTLENPC_WARP_PLAYER + CHAR_setWorkChar( newindex, CHAR_WORKBATTLE_ACT_CONDITION, + ENEMY_enemy[array].chardata[ENEMY_ACT_CONDITION].string ); +#endif + CHAR_setWorkInt( newindex, CHAR_WORK_PETFLG, *(p+ENEMY_PETFLG)); + CHAR_setWorkInt( newindex, CHAR_WORKMODCAPTUREDEFAULT, *(tp + E_T_GET)); +#ifdef _ENEMY_FALLGROUND + { + int i=0; + for( i=0;i= arraysizeof( RandomEnemyTbl ) ) return 0; + + // ¼ĸةɬ + randwork = RAND( 0, RandomEnemyTbl[i].arraysize - 1 ); + // ޥ įë + work = RandomEnemyTbl[i].pTbl[randwork]; + *pNew = ENEMY_getEnemyArrayFromId( work ); + return 1; + }else{ + // ئ + return 0; + } +} + +int *ENEMY_getEnemy( int charaindex, int x, int y) +{ + int i; + int array; + int g_array; + int e_array; + int found = 0; + int work[ENEMY_INDEXTABLEMAXSIZE]; + int wr[ENEMY_INDEXTABLEMAXSIZE]; + int createenemynum; + int enemyentrymax; + int entrymax; + int r_max; + int groupid; + int bigcnt; + int loopcounter; + array = ENCOUNT_getEncountAreaArray( CHAR_getInt( charaindex, CHAR_FLOOR),x,y); + if( array == -1 ) return NULL; + enemyentrymax = ENCOUNT_getCreateEnemyMaxNumFromArray( array); + if( enemyentrymax == -1 ) { + return NULL; + } + for( i = 0 ; i < ENEMY_INDEXTABLEMAXSIZE; i ++ ) { + work[i] = -1; + wr[i] = -1; + ENEMY_indextable[i] = -1; + } + + r_max= 0; + for( i = 0; i < ENCOUNT_GROUPMAXNUM; i ++ ){ + if( ENCOUNT_getGroupIdFromArray( array, i ) != - 1 ) { + int itemid; + groupid = ENCOUNT_getGroupIdFromArray( array, i); + g_array = GROUP_getGroupArray( groupid); + itemid = GROUP_getInt( g_array, GROUP_APPEARBYITEMID); + if( itemid != -1 ) { + int j; + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid){ + break; + } + } + } + if( j == CHAR_MAXITEMHAVE ) continue; + } + itemid = GROUP_getInt( g_array, GROUP_NOTAPPEARBYITEMID); + if( itemid != -1 ) { + int j; + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid){ + break; + } + } + } + if( j != CHAR_MAXITEMHAVE ) continue; + } + + work[found] = i; + wr[found] = ENCOUNT_getGroupProbFromArray( array, i); + r_max += wr[found]; + found ++; + } + } + r_max --; + + if( found <= 0 ) return NULL; + { + int aaa = 0; + int r; + r = RAND( 0, r_max); + for( i = 0; i < found-1; i ++ ) { + aaa += wr[i]; + if( wr[i] != 0 && r < aaa ) break; + } + r = i; + + groupid = ENCOUNT_getGroupIdFromArray( array, work[r]); + g_array = GROUP_getGroupArray( groupid); + } + for( i = 0 ; i < ENEMY_INDEXTABLEMAXSIZE; i ++ ) { + work[i] = -1; + wr[i] = -1; + } + createenemynum = 0; + found = 0; + r_max = 0; + for( i = ENEMY_ID1; i < CREATEPROB1; i ++ ) { + int newarray, enemywork; + e_array = ENEMY_getEnemyArrayFromIndex( g_array, i - ENEMY_ID1 ); + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ + { + int char_event_now = -1, char_event_end = -1; + if(ENCOUNT_table[array].event_now != -1){ + char_event_now = ENCOUNT_table[array].event_now; + } + else if(ENCOUNT_table[array].event_end != -1){ + char_event_end = ENCOUNT_table[array].event_end; + } + if( (char_event_now > 0) || ( char_event_end > 0 ) ) { + if( (NPC_NowEventCheckFlg( charaindex, char_event_now) == TRUE ) || + (NPC_EventCheckFlg( charaindex, char_event_end) == TRUE ) ){ + + e_array = ENEMY_getEnemyArrayFromIndex( + GROUP_getGroupArray( ENCOUNT_table[array].enemy_group ),i - ENEMY_ID1 ); + } + } + } +#endif + enemywork = ENEMY_getInt( e_array, ENEMY_ID ); + if( ENEMY_RandomEnemyArray( enemywork, &newarray ) ){ + e_array = newarray; + } + + if( e_array != -1 ) { + work[found] = e_array; + wr[found] = GROUP_getInt( g_array, i + (CREATEPROB1 - ENEMY_ID1)); + r_max += wr[found]; + found ++; + createenemynum += ENEMY_getInt( e_array, ENEMY_CREATEMAXNUM); + } + } + r_max --; + + if( found <= 0 ) return NULL; + enemyentrymax= min( enemyentrymax, createenemynum ); + entrymax = RAND( 1, enemyentrymax); + bigcnt = 0; + for( i = 0,loopcounter = 0; i < entrymax && loopcounter < 100; loopcounter ++) { + int cnt; + int j,r; + int aaa = 0; + int et_array; + int k,samecount; + r = RAND( 0, r_max); + for( j = 0; j < found-1; j ++ ) { + aaa += wr[j]; + if( wr[j] != 0 && r < aaa ) break; + } + r = j; + cnt = 0; + for( j = 0; j < ENEMY_INDEXTABLEMAXSIZE && ENEMY_indextable[j] != -1; j ++ ) { + if( ENEMY_indextable[j] == work[r] ) cnt ++; + } + samecount = 0; + for( k = 0; k < found; k ++ ) { + if( work[r] == work[k] ) samecount ++; + } + if( cnt >= ENEMY_getInt( work[r], ENEMY_CREATEMAXNUM) * samecount ) { + continue; + } + + et_array = ENEMYTEMP_getEnemyTempArray( work[r]); + if( ENEMYTEMP_CHECKINDEX( et_array)) { + if( ENEMYTEMP_getInt( et_array, E_T_SIZE) == E_T_SIZE_BIG ) { + if( bigcnt >= 5 ) { + entrymax --; + continue; + } + if( i > 4 ) { + int target_et_array; + int flg = FALSE; + for( j = 0; j < 5; j ++ ) { + if( !ENEMY_CHECKINDEX( ENEMY_indextable[j])) break; + + target_et_array = ENEMYTEMP_getEnemyTempArray( + ENEMY_indextable[j]); + if( !ENEMYTEMP_CHECKINDEX( target_et_array)) break; + if( ENEMYTEMP_getInt( target_et_array, E_T_SIZE) == E_T_SIZE_NORMAL ){ + flg = TRUE; + break; + } + } + if( !flg) continue; + ENEMY_indextable[i] = ENEMY_indextable[j]; + ENEMY_indextable[j] = work[r]; + } + else { + ENEMY_indextable[i] = work[r]; + } + bigcnt ++; + }else { + ENEMY_indextable[i] = work[r]; + } + + i++; + } + } + return found > 0 ? ENEMY_indextable : NULL; +} +int ENEMY_createPetFromEnemyIndex( int charaindex, int array) +{ + Char CharNew; + int newindex; + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int havepetelement; + int level; + int enemyrank; + if( !ENEMY_CHECKINDEX( array)) return -1; + havepetelement = CHAR_getCharPetElement( charaindex); + if( havepetelement < 0 ) return -1; + + p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) return -1; +// tp = ENEMYTEMP_enemy[tarray].intdata; + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + level = RAND( (*(p + ENEMY_LV_MIN)), ( *(p+ ENEMY_LV_MAX))); + +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#if 1 +#define PARAM_CAL( l) (( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#else +#define PARAM_CAL( l) ( (E_PAR(ENEMY_LV) -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#endif + tp[E_T_BASEVITAL] += RAND( 0, 4 ) - 2; + tp[E_T_BASESTR] += RAND( 0, 4 ) - 2; + tp[E_T_BASETGH] += RAND( 0, 4 ) - 2; + tp[E_T_BASEDEX] += RAND( 0, 4 ) - 2; + CharNew.data[CHAR_ALLOCPOINT] + = ( tp[E_T_BASEVITAL] << 24 ) + + ( tp[E_T_BASESTR] << 16 ) + + ( tp[E_T_BASETGH] << 8 ) + + ( tp[E_T_BASEDEX] << 0 ); + + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } + /* ɷ¶ */ + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + //CharNew.data[CHAR_LV] = *(p+ ENEMY_LV); + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + CharNew.data[CHAR_PETENEMYID] = ENEMY_getInt( array, ENEMY_ID); + // Arminius 8.6 limit lv + CharNew.data[CHAR_LIMITLEVEL] = *(tp + E_T_LIMITLEVEL); +#ifdef _PET_FUSION + CharNew.data[CHAR_FUSIONCODE] = *(tp + E_T_FUSIONCODE); +#endif + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = *(tp + E_T_PETSKILL1 + i); + } + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + newindex = PET_initCharOneArray( &CharNew ); + if( newindex < 0 ){ + return -1; + } + CHAR_complianceParameter( newindex ); + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); + CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetelement, newindex); + CHAR_setChar( newindex, CHAR_OWNERCDKEY, + CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( newindex, CHAR_OWNERCHARANAME, + CHAR_getChar( charaindex, CHAR_NAME)); + return newindex; +} + +int ENEMY_createPet( int array, int vital, int str, int tgh, int dex) +{ + Char CharNew; + int newindex; + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int level; + int enemyrank; + if( !ENEMY_CHECKINDEX( array)) return -1; + + p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) return -1; +// tp = ENEMYTEMP_enemy[tarray].intdata; + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + level = RAND( (*(p + ENEMY_LV_MIN)), ( *(p+ ENEMY_LV_MAX))); + +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#if 1 +#define PARAM_CAL( l) (( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#else +#define PARAM_CAL( l) ( (E_PAR(ENEMY_LV) -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#endif + tp[E_T_BASEVITAL] += RAND( 0, 4 ) - 2; + tp[E_T_BASESTR] += RAND( 0, 4 ) - 2; + tp[E_T_BASETGH] += RAND( 0, 4 ) - 2; + tp[E_T_BASEDEX] += RAND( 0, 4 ) - 2; + + +#ifdef _BT_PET + tp[E_T_BASEVITAL]*= getBtPet(); + tp[E_T_BASESTR]*= getBtPet(); + tp[E_T_BASETGH]*= getBtPet(); + tp[E_T_BASEDEX]*= getBtPet(); +#endif + + + if(vital > -1){ + tp[E_T_BASEVITAL] = vital; + } + if(str > -1){ + tp[E_T_BASESTR] = str; + } + if(tgh > -1){ + tp[E_T_BASETGH] = tgh; + } + if(dex > -1){ + tp[E_T_BASEDEX] = dex; + } + + CharNew.data[CHAR_ALLOCPOINT] + = ( tp[E_T_BASEVITAL] << 24) + + ( tp[E_T_BASESTR] << 16) + + ( tp[E_T_BASETGH] << 8) + + ( tp[E_T_BASEDEX] << 0); + + + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } + /* ɷ¶ */ + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + //CharNew.data[CHAR_LV] = *(p+ ENEMY_LV); + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + // Arminius 8.6 limit lv + CharNew.data[CHAR_LIMITLEVEL] = *(tp + E_T_LIMITLEVEL); +#ifdef _PET_FUSION + CharNew.data[CHAR_FUSIONCODE] = *(tp + E_T_FUSIONCODE); +#endif + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = *(tp + E_T_PETSKILL1 + i); + } + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + newindex = PET_initCharOneArray( &CharNew ); + if( newindex < 0 ){ + return -1; + } + CHAR_complianceParameter( newindex ); + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); + CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, -1); + + return newindex; +} + +int ENEMY_createPetFromEnemyBaseIndex( int charaindex, int array, int level ) +{ + Char CharNew; + int newindex; + //int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int havepetelement; + //int level; + int enemyrank; + + /* +#ifdef _LF_FIX_ERROR_PET_CREATE + if( !ENEMY_getUse(array) ) return -1; +#else + if( !ENEMY_CHECKINDEX( array)) return -1; +#endif + */ + havepetelement = CHAR_getCharPetElement( charaindex); + if( havepetelement < 0 ) return -1; + + //p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArrayFromTempNo( array); + + tarray = array; + +#ifdef _LF_FIX_ERROR_PET_CREATE + if( !ENEMYTEMP_getUse(tarray) ) return -1; +#else + if( !ENEMYTEMP_CHECKINDEX( tarray)) return -1; +#endif +// tp = ENEMYTEMP_enemy[tarray].intdata; + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + //level = RAND( (*(p + ENEMY_LV_MIN)), ( *(p+ ENEMY_LV_MAX))); + +//#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#if 1 +#define PARAM_CAL( l) (( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#else +#define PARAM_CAL( l) ( (E_PAR(ENEMY_LV) -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#endif + tp[E_T_BASEVITAL] += RAND( 0, 4 ) - 2; + tp[E_T_BASESTR] += RAND( 0, 4 ) - 2; + tp[E_T_BASETGH] += RAND( 0, 4 ) - 2; +#ifdef _FIX_DEX_BUG + tp[E_T_BASEDEX] += RAND( 2, 4 ) - 2; +#else + tp[E_T_BASEDEX] += RAND( 0, 4 ) - 2; +#endif + CharNew.data[CHAR_ALLOCPOINT] + = ( tp[E_T_BASEVITAL] << 24 ) + + ( tp[E_T_BASESTR] << 16 ) + + ( tp[E_T_BASETGH] << 8 ) + + ( tp[E_T_BASEDEX] << 0 ); + + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } + /* ɷ¶ */ + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + //CharNew.data[CHAR_LV] = *(p+ ENEMY_LV); + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + // Arminius 8.6 limit lv + CharNew.data[CHAR_LIMITLEVEL] = *(tp + E_T_LIMITLEVEL); +#ifdef _PET_FUSION + CharNew.data[CHAR_FUSIONCODE] = *(tp + E_T_FUSIONCODE); +#endif + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = *(tp + E_T_PETSKILL1 + i); + } + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +//#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + newindex = PET_initCharOneArray( &CharNew ); + if( newindex < 0 ){ + return -1; + } + CHAR_complianceParameter( newindex ); + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); + CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetelement, newindex); + CHAR_setChar( newindex, CHAR_OWNERCDKEY, + CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( newindex, CHAR_OWNERCHARANAME, + CHAR_getChar( charaindex, CHAR_NAME)); + return newindex; +} +#ifdef _TEST_DROPITEMS +int ENEMY_TEST_createPetIndex( int array) +{ + Char CharNew; + int newindex; + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + //int havepetelement; + int level; + int enemyrank; + if( !ENEMY_CHECKINDEX( array)) return -1; + + //havepetelement = CHAR_getCharPetElement( charaindex); + //if( havepetelement < 0 ) return -1; + p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) return -1; + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + level = RAND( (*(p + ENEMY_LV_MIN)), ( *(p+ ENEMY_LV_MAX))); + +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) + +#if 1 +#define PARAM_CAL( l) (( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#else +#define PARAM_CAL( l) ( (E_PAR(ENEMY_LV) -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) +#endif + tp[E_T_BASEVITAL] += RAND( 0, 4 ) - 2; + tp[E_T_BASESTR] += RAND( 0, 4 ) - 2; + tp[E_T_BASETGH] += RAND( 0, 4 ) - 2; + tp[E_T_BASEDEX] += RAND( 0, 4 ) - 2; + CharNew.data[CHAR_ALLOCPOINT] + = ( tp[E_T_BASEVITAL] << 24 ) + + ( tp[E_T_BASESTR] << 16 ) + + ( tp[E_T_BASETGH] << 8 ) + + ( tp[E_T_BASEDEX] << 0 ); + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + CharNew.data[CHAR_PETENEMYID] = ENEMY_getInt( array, ENEMY_ID); + // Arminius 8.6 limit lv + CharNew.data[CHAR_LIMITLEVEL] = *(tp + E_T_LIMITLEVEL); +#ifdef _PET_FUSION + CharNew.data[CHAR_FUSIONCODE] = *(tp + E_T_FUSIONCODE); +#endif + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = *(tp + E_T_PETSKILL1 + i); + } + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + newindex = PET_initCharOneArray( &CharNew ); +#ifdef _CAX_LVTISHI +if (CHAR_getInt( newindex, CHAR_LV) == 1){// + char buff[256]; + snprintf( buff, sizeof( buff),"%s",CHAR_getChar( newindex, CHAR_NAME)); + CHAR_setChar( newindex, CHAR_NAME, buff); + } +#endif + if( newindex < 0 ){ + return -1; + } + CHAR_complianceParameter( newindex ); + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); +// CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, charaindex); +// CHAR_setCharPet( charaindex, havepetelement, newindex); +// CHAR_setChar( newindex, CHAR_OWNERCDKEY, +// CHAR_getChar( charaindex, CHAR_CDKEY)); +// CHAR_setChar( newindex, CHAR_OWNERCHARANAME, +// CHAR_getChar( charaindex, CHAR_NAME)); + return newindex; +} +#endif + +#ifdef _PET_EVOLUTION + +BOOL PETFUSION_getIndexForChar( int toindex, int *MainIndex, int *Subindex1, int *Subindex2, char *data) +{ + char buf1[256]; + int pindex[3]={-1,-1,-1}; + int i; + int ridepet=CHAR_getInt( toindex , CHAR_RIDEPET); + int rideindex = CHAR_getCharPet( toindex,ridepet); + if( getStringFromIndexWithDelim( data, "|", 1, buf1, sizeof(buf1)) == FALSE ) + return FALSE; + pindex[0] = atoi( buf1)-1; + if( getStringFromIndexWithDelim( data, "|", 2, buf1, sizeof(buf1)) == FALSE ) + return FALSE; + pindex[1] = atoi( buf1)-1; + if( getStringFromIndexWithDelim( data, "|", 3, buf1, sizeof(buf1)) == FALSE ) + return FALSE; + pindex[2] = atoi( buf1)-1; + for( i=0; i<3; i++) { + int petindex; + if( pindex[i] < 0 ) continue; + petindex = CHAR_getCharPet( toindex, pindex[i]); + if( !CHAR_CHECKINDEX( petindex) ) continue; +#ifdef _CAX_PET_EVOLUTION + if( getpetevotyb() == 0 ){ +#endif +#ifdef _PET_2TRANS + if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) ==2){ + CHAR_talkToCli( toindex, -1, "תﲻںϡ", CHAR_COLORYELLOW); + return FALSE; + } +#endif +#ifdef _CAX_PET_EVOLUTION + } + if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) == 3 ) { + CHAR_talkToCli( toindex, -1, "תﲻںϡ", CHAR_COLORYELLOW); + return FALSE; + } +#endif + if( rideindex == petindex) { + CHAR_talkToCli( toindex, -1, "еij費ںϡ", CHAR_COLORYELLOW); + return FALSE; + } + if( i == 0 ) { + *MainIndex = petindex; + }else if( i == 1) { + *Subindex1 = petindex; + }else if( i == 2) { + *Subindex2 = petindex; + } + } + return TRUE; +} +int NPC_getPetArrayForNo( int PetCode) +{ + int i; + int enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) {//PetCode + if( ENEMY_getInt( i, ENEMY_TEMPNO ) == PetCode ) + break; + } + + if( i == enemynum ){ + print("ANDY 2.err i == enemynum \n"); + return -1; + } + return i; +} +int NPC_getFusionTableForBase( int charaindex, int petindex1, int petindex2 ) +{ + int base1, base2;// ,PETCODE + if( !CHAR_CHECKINDEX( petindex1) ) return -1; + if( !CHAR_CHECKINDEX( petindex2) ) return -1; +#ifdef _PET_EVOLUTION + if( (base2 = EVOLUTION_getPetTable( charaindex, petindex1, petindex2)) < 0 ){ + print("ANDY err base2=%d\n", base2); + return -1; + } + if( (base1 = EVOLUTION_getPropertyTable( charaindex, petindex1, petindex2)) < 0 ){ + print("ANDY err base1=%d\n", base1); + return -1; + } + return EVOLUTION_getFusionTable( charaindex, base2, base1); // get new pet IDNO +#else + return -1; +#endif +} + +BOOL PET_getEvolutionAns( int petindex, int *base) +{ + int i, total1, total2, total; +#ifdef _CAX_PET_EVOLUTION +int defwork = 50, defbase = getpetevotyb1(); +#else +int defwork = 50, defbase = 150; +#endif + int work[4]={0,0,0,0}; + + work[0] = CHAR_getInt( petindex, CHAR_EVOLUTIONBASEVTL); + work[1] = CHAR_getInt( petindex, CHAR_EVOLUTIONBASESTR); + work[2] = CHAR_getInt( petindex, CHAR_EVOLUTIONBASETGH); + work[3] = CHAR_getInt( petindex, CHAR_EVOLUTIONBASEDEX); + for( i=0; i<4; i++) { + work[i] = (work[i]*0.7)/100; + if( work[i]<0 ) work[i] = 0; + if( work[i]>60 ) work[i] = 60; + } + total1 = work[0] + work[1] + work[2] + work[3]; + for( i=0; i<4; i++) { + if( base[i] < 0 ) base[i] = 5; + if( base[i] > 60 ) base[i] = 60; + } + total2 = base[0] + base[1] + base[2] + base[3]; + if( total1 > defwork ) { + for( i=0; i<4; i++) { + work[i] = ((work[i]*defwork)/total1); + if( work[i]<0 ) work[i] = 0; + if( work[i]>60 ) work[i] = 60; + } + } + + total1 = work[0] + work[1] + work[2] + work[3]; + total = (total1/2) + total2; + + if( total > 0 ){ + for( i=0; i<4; i++) { + float fixwork=0.0; + fixwork = (base[i])+(float)(work[i]/2); + base[i] += (int)((fixwork/total) * total1); + if( base[i] < 1 ) base[i] = 1; + if( base[i] > 60 ) base[i] = 60; + } + } + total2 = base[0] + base[1] + base[2] + base[3]; + if( total2 > defbase ){ + for( i=0; i<4; i++) { + base[i] = (base[i]*defbase)/total2; + if( base[i] < 1 ) base[i] = 1; + if( base[i] > 60 ) base[i] = 60; + } + } + total2 = base[0] + base[1] + base[2] + base[3]; + if( base[0]<0 || base[1]<0 || base[2]<0 || base[3]<0 ){ + print("ANDY err EVOLUTION base someone < 0 !!\n"); + } + return TRUE; +} + +int EVOLUTION_createPetFromEnemyIndex( int charaindex, int baseindex, int flg) +{ + Char CharNew; + int newindex; + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i, havepetelement, enemynum, petID; + int level, enemyrank, array; + int petskill[7]={-1,-1,-1,-1,-1,-1,-1}; + int base[4]={0,0,0,0}; +#ifdef _illegalpetskill_CF + int illegalpetskill[25] = {41,52,600,601,602,603,604,614,617,628,630,631,635,638,641, + getIllegalPetskill(0),getIllegalPetskill(1),getIllegalPetskill(2),getIllegalPetskill(3),getIllegalPetskill(4), + getIllegalPetskill(5),getIllegalPetskill(6),getIllegalPetskill(7),getIllegalPetskill(8),getIllegalPetskill(9)};//ԶֹŴ\ +#else + int illegalpetskill[15] = {41,52,600,601,602,603,604,614,617,628,630,631,635,638,641};//Ŵij輼 +#endif +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#define PARAM_CAL( l) (( level -1)*ET_PAR( E_T_LVUPPOINT)+ ET_PAR(E_T_INITNUM)) * ET_PAR( (l)) + havepetelement=-1; + petID = CHAR_getInt( baseindex, CHAR_FUSIONINDEX); + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_TEMPNO ) == petID ){ + break; + } + } + if( i >= enemynum ) return -1; + array = i; + if( !ENEMY_CHECKINDEX( array)) return -1; +//-------------------------------------------------------------------------- + p = ENEMY_enemy[array].intdata; + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)){ + print( "ANDY !tarray\n"); + return -1; + } + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_enemy[tarray].intdata[i]; + } + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) ){ + print( "ANDY !CHAR_getDefaultChar( &CharNew,31010 )\n"); + return -1; + } + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = *(tp+E_T_IMGNUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + level = RAND( (*(p + ENEMY_LV_MIN)), ( *(p+ ENEMY_LV_MAX))); +//------------------------------------------------------ + { + if( PET_getBaseAndSkill( charaindex, baseindex, base, petskill, 1) == FALSE ){ + print( "ANDY err PET_getBaseAndSkill(%d) == FALSE \n", baseindex); + return -1; + } + if( PET_getEvolutionAns( baseindex, base) == FALSE ) return -1; + for( i=0; i < CHAR_MAXPETSKILLHAVE; i ++ ) {//輼 + int j; + for( j=0; j<15; j++) { //Ƿ + if( illegalpetskill[j] == petskill[i] ){ + petskill[i] = -1; + break; + } + } + CharNew.unionTable.indexOfPetskill[i] = petskill[i]; + } + if( flg == 1 ){ + if( CHAR_DelPetForIndex( charaindex, baseindex) == FALSE ) return FALSE; + } + } + if( flg == 1 ){ + havepetelement = CHAR_getCharPetElement( charaindex);//ҳλ + if( havepetelement < 0 ) return -1; + } +//------------------------------------------------------ + tp[E_T_BASEVITAL] = base[0]; + tp[E_T_BASESTR] = base[1]; + tp[E_T_BASETGH] = base[2]; + tp[E_T_BASEDEX] = base[3]; + CharNew.data[CHAR_ALLOCPOINT] = (base[0]<<24)+(base[1]<<16)+(base[2]<<8)+(base[3]<<0); + + for( i = 0; i < 10; i ++ ){ + int work = RAND( 0, 3 ); + if( work == 0 )tp[E_T_BASEVITAL]++; + if( work == 1 )tp[E_T_BASESTR]++; + if( work == 2 )tp[E_T_BASETGH]++; + if( work == 3 )tp[E_T_BASEDEX]++; + } +//------------------------------------------------------ + CharNew.data[CHAR_VITAL] = PARAM_CAL(E_T_BASEVITAL); + CharNew.data[CHAR_STR] = PARAM_CAL(E_T_BASESTR); + CharNew.data[CHAR_TOUGH] = PARAM_CAL(E_T_BASETGH); + CharNew.data[CHAR_DEX] = PARAM_CAL(E_T_BASEDEX); + CharNew.data[CHAR_FIREAT] = *(tp+ E_T_FIREAT); + CharNew.data[CHAR_WATERAT] = *(tp+ E_T_WATERAT); + CharNew.data[CHAR_EARTHAT] = *(tp+ E_T_EARTHAT); + CharNew.data[CHAR_WINDAT] = *(tp+ E_T_WINDAT); + CharNew.data[CHAR_SLOT] = *(tp+ E_T_SLOT); + CharNew.data[CHAR_MODAI] = *(tp+ E_T_MODAI); + CharNew.data[CHAR_VARIABLEAI] = 0; + CharNew.data[CHAR_LV] = level; + CharNew.data[CHAR_POISON] = *(tp+ E_T_POISON); + CharNew.data[CHAR_PARALYSIS]= *(tp+ E_T_PARALYSIS); + CharNew.data[CHAR_SLEEP] = *(tp+ E_T_SLEEP); + CharNew.data[CHAR_STONE] = *(tp+ E_T_STONE); + CharNew.data[CHAR_DRUNK] = *(tp+ E_T_DRUNK); + CharNew.data[CHAR_CONFUSION]= *(tp+ E_T_CONFUSION); + CharNew.data[CHAR_RARE] = *(tp+ E_T_RARE); + CharNew.data[CHAR_PETID] = *(tp + E_T_TEMPNO); + CharNew.data[CHAR_CRITIAL] = *(tp + E_T_CRITICAL); + CharNew.data[CHAR_COUNTER] = *(tp + E_T_COUNTER); + CharNew.data[CHAR_LIMITLEVEL] = *(tp + E_T_LIMITLEVEL); + CharNew.data[CHAR_FUSIONCODE] = *(tp + E_T_FUSIONCODE); + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); +//------------------------------------------------------ + + enemyrank = ENEMY_getRank( array, tarray ); + CharNew.data[CHAR_PETRANK] = enemyrank; +#undef E_PAR +#undef ET_PAR +#undef PARAM_CAL + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + (char *)ENEMYTEMP_enemy[tarray].chardata[E_T_NAME].string ); + newindex = PET_initCharOneArray( &CharNew ); + if( newindex < 0 ){ + print( "ANDY err newindex=%d\n", newindex); + return -1; + } +//------------------------------------------------------ + CHAR_complianceParameter( newindex ); + CHAR_setInt( newindex, CHAR_HP, CHAR_getWorkInt( newindex, CHAR_WORKMAXHP)); + CHAR_setInt ( newindex, CHAR_WHICHTYPE , CHAR_TYPEPET); +#ifdef _PET_2TRANS + #ifdef _PET_3TRANS + CHAR_setInt ( newindex, CHAR_TRANSMIGRATION, 3); + #else + CHAR_setInt ( newindex, CHAR_TRANSMIGRATION, 2); + #endif +#else + CHAR_setInt ( newindex, CHAR_TRANSMIGRATION, 1); +#endif + CHAR_setInt ( newindex, CHAR_FUSIONBEIT, 1); + CHAR_setInt ( newindex, CHAR_FUSIONRAISE, 0); + if( flg == 1 ){ + CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetelement, newindex); + CHAR_setChar( newindex, CHAR_OWNERCDKEY, CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( newindex, CHAR_OWNERCHARANAME, CHAR_getChar( charaindex, CHAR_NAME)); + { + char msgbuf[256]; + snprintf( msgbuf, sizeof( msgbuf ), "K%d", havepetelement ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", havepetelement ); + CHAR_sendStatusString( charaindex, msgbuf ); + } + } + return newindex; +} + +int PET_CheckIncubate( int charaindex) +{ +#ifndef _USER_CHARLOOPS + int i; + static time_t checkeage; + int anhour = PETFEEDTIME; + checkeage = (int)time( NULL); + if( !CHAR_CHECKINDEX( charaindex) )return 0; + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++) { + int time_l=0; + int petindex = CHAR_getCharPet( charaindex, i); + if( !CHAR_CHECKINDEX( petindex) ) continue; + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) != 1 || + CHAR_getInt( petindex, CHAR_FUSIONRAISE) <= 0 )return;//ǷΪںϳ + + time_l = CHAR_getInt( petindex, CHAR_FUSIONTIMELIMIT); + if( time_l < 0 || time_l > checkeage ){ + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, checkeage); + continue; + } + + if( (int)checkeage > (time_l+(anhour*2)) ){ + char buf[256]; + int levelup, vital, str, tgh, dex; + int raise = CHAR_getInt( petindex, CHAR_FUSIONRAISE); + //ι + raise++; + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time(NULL)+anhour-1); + if( raise < 0 ) raise = 0; + if( raise >= 40 ) raise = 30; + CHAR_setInt( petindex, CHAR_FUSIONRAISE, raise); + levelup = CHAR_getInt( petindex, CHAR_ALLOCPOINT); + vital = ((levelup>>24) & 0xFF) - 5; + str = ((levelup>>16) & 0xFF) - 5; + tgh = ((levelup>> 8) & 0xFF) - 5; + dex = ((levelup>> 0) & 0xFF) - 5; + if( vital < 0 ) vital = 0; + if( str < 0 ) str = 0; + if( tgh < 0 ) tgh = 0; + if( dex < 0 ) dex = 0; + // + levelup = (vital<<24) + (str<<16) + (tgh<<8) + (dex<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, levelup); + sprintf( buf, "%sƷʱˡ", CHAR_getUseName( petindex )); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + + LogPetFeed( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( petindex, CHAR_NAME), + petindex, + CHAR_getInt( petindex, CHAR_LV), + "Ʒʱ", // Key + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + CHAR_getChar( petindex, CHAR_UNIQUECODE) ); + + }else if( (int)checkeage > (time_l+anhour) ){ + + char buf[256]; + sprintf( buf, "%sֿιʳ״̬", CHAR_getUseName( petindex )); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + } + } + return 1; +#else + int masterindex, time_l=0; + static time_t checkeage; + int anhour = PETFEEDTIME, i; + + if( !CHAR_CHECKINDEX( charaindex) )return 0; + masterindex = CHAR_getWorkInt( charaindex, CHAR_WORKPLAYERINDEX); + if( !CHAR_CHECKINDEX( masterindex) )return 0; + + if( CHAR_getInt( charaindex, CHAR_FUSIONBEIT) != 1 || + CHAR_getInt( charaindex, CHAR_FUSIONRAISE) <= 0 ) return 0;//ǷΪںϳ + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++) { + if( charaindex != CHAR_getCharPet( masterindex, i) ) continue; + break; + } + if( i >= CHAR_MAXPETHAVE ) return 0; + + checkeage = (int)time( NULL); + + time_l = CHAR_getInt( charaindex, CHAR_FUSIONTIMELIMIT); + if( time_l < 0 || time_l > checkeage ){ + CHAR_setInt( charaindex, CHAR_FUSIONTIMELIMIT, checkeage); + return 0; + } + if( (int)checkeage > (time_l+(anhour*2.5)) ){ + char buf[256]; + int levelup, vital, str, tgh, dex; + int raise = CHAR_getInt( charaindex, CHAR_FUSIONRAISE); + raise++; + CHAR_setInt( charaindex, CHAR_FUSIONTIMELIMIT, (int)time(NULL)+anhour-1); + if( raise < 0 ) raise = 0; + if( raise >= 40 ) raise = 30; + CHAR_setInt( charaindex, CHAR_FUSIONRAISE, raise); + levelup = CHAR_getInt( charaindex, CHAR_ALLOCPOINT); + vital = ((levelup>>24) & 0xFF) - 6; + str = ((levelup>>16) & 0xFF) - 6; + tgh = ((levelup>> 8) & 0xFF) - 6; + dex = ((levelup>> 0) & 0xFF) - 6; + if( vital < 0 ) vital = 0; + if( str < 0 ) str = 0; + if( tgh < 0 ) tgh = 0; + if( dex < 0 ) dex = 0; + // + levelup = (vital<<24) + (str<<16) + (tgh<<8) + (dex<<0); + CHAR_setInt( charaindex, CHAR_ALLOCPOINT, levelup); + sprintf( buf, "%sƷʱˡ", CHAR_getUseName( charaindex )); + CHAR_talkToCli( masterindex, -1, buf, CHAR_COLORYELLOW); + + LogPetFeed( + CHAR_getChar( masterindex, CHAR_NAME), + CHAR_getChar( masterindex, CHAR_CDKEY), + CHAR_getChar( charaindex, CHAR_NAME), + charaindex, + CHAR_getInt( charaindex, CHAR_LV), + "Ʒʱ", // Key + CHAR_getInt( masterindex, CHAR_FLOOR), + CHAR_getInt( masterindex, CHAR_X), + CHAR_getInt( masterindex, CHAR_Y), + CHAR_getChar( charaindex, CHAR_UNIQUECODE) ); + + }else if( (int)checkeage > (time_l+anhour) ){ + char buf[256]; + sprintf( buf, "%sֿιʳ״̬", CHAR_getUseName( charaindex )); + CHAR_talkToCli( masterindex, -1, buf, CHAR_COLORYELLOW); + } + return 1; +#endif +} +#endif + +#ifdef _NPC_FUSION +int PETFUSION_SetNewEgg( int toindex , int petindex, int array, int *work, int *skill1, int *skill2) +{ + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int level, workrank, petrank=0; + int LevelUpPoint; + struct { + int num; + float rank; + }ranktbl[] = { + { 130, 2.5}, + { 100, 2.0}, + { 95, 1.5}, + { 85, 1.0}, + { 80, 0.5}, + { 0, 0.0}, + }; + if( !ENEMY_CHECKINDEX( array)) + return -1; + p = ENEMY_getIntdata( array); + if( p == NULL ) { + print("\n p = NULL" ); + return -1; + } + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) + return -1; + //print( "ANDY tarray/array=%d/%d-->%s \n", tarray, array, + // ENEMYTEMP_getChar( tarray, E_T_NAME)); + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_getInt( tarray, i); + } + level = 1; +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#define PARAM_CAL( l) ( ( level -1) * ET_PAR( E_T_LVUPPOINT) + ET_PAR( E_T_INITNUM) ) + work[0] += ( RAND(0,4) - 2 ); + work[1] += ( RAND(0,4) - 2 ); + work[2] += ( RAND(0,4) - 2 ); + work[3] += ( RAND(0,4) - 2 ); + LevelUpPoint = ( work[0] << 24 ) + + (work[1] << 16) + + (work[2] << 8 ) + + (work[3] << 0 ); + + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + workrank = work[0]+work[1]+work[2]+work[3]; + for( i = 0; i < arraysizeof( ranktbl); i ++ ) { + if( workrank >= ranktbl[i].num ) { + petrank = i; + break; + } + } + if( i>= arraysizeof( ranktbl)) i = arraysizeof( ranktbl); + CHAR_setInt( petindex, CHAR_PETRANK, petrank); + for( i = 0; i < 10; i ++ ){ + int rnt = RAND( 0, 3 ); + if( rnt == 0 ) work[0]++; + if( rnt == 1 ) work[1]++; + if( rnt == 2 ) work[2]++; + if( rnt == 3 ) work[3]++; + } + + CHAR_setInt( petindex, CHAR_VITAL, ( PARAM_CAL(E_T_BASEVITAL) * work[0] )); + CHAR_setInt( petindex, CHAR_STR , ( PARAM_CAL(E_T_BASESTR) * work[1] )); + CHAR_setInt( petindex, CHAR_TOUGH , ( PARAM_CAL(E_T_BASETGH) * work[2] )); + CHAR_setInt( petindex, CHAR_DEX , ( PARAM_CAL(E_T_BASEDEX) * work[3] )); + CHAR_setMaxExp( petindex, 0); + CHAR_setInt( petindex, CHAR_LV, level); + + //\Ϊ߼ + CHAR_setInt( petindex, CHAR_SLOT, 7); + { + int j; +#ifdef _illegalpetskill_CF + int illegalpetskill[25] = {41,52,600,601,602,603,604,614,617,628,630,631,635,638,641, + getIllegalPetskill(0),getIllegalPetskill(1),getIllegalPetskill(2),getIllegalPetskill(3),getIllegalPetskill(4), + getIllegalPetskill(5),getIllegalPetskill(6),getIllegalPetskill(7),getIllegalPetskill(8),getIllegalPetskill(9)};//ԶֹŴ\ +#else + int illegalpetskill[15] = {41,52,600,601,602,603,604,614,617,628,630,631,635,638,641}; +#endif + for( i=0; icharfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "PET_CheckIncubateLoop"); + ch->data[CHAR_LOOPINTERVAL] = 60000; + CHAR_constructFunctable( petindex); + } +#endif + if( CHAR_CHECKINDEX( toindex) ){ + for(i = 0; i < CHAR_MAXPETHAVE; i++){ + char msgbuf[256]; + int pindex = CHAR_getCharPet(toindex, i); + if( !CHAR_CHECKINDEX( pindex) ) + continue; + memset( msgbuf, 0, sizeof( msgbuf)); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( toindex, msgbuf ); + + CHAR_send_K_StatusString(toindex, i,CHAR_K_STRING_HP|CHAR_K_STRING_AI); + } + } + return petindex; +} + +BOOL PETFUSION_AddEgg( int toindex, int petID, int PetCode) +{ + int ret; + char msgbuf[64]; + int enemynum; + int i,j; + int petindex, petindex2; + + //Ƿпλ + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( toindex, i); + if( petindex == -1 ) + break; + } + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORYELLOW); + return -1; + } + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) {//PetCode + if( ENEMY_getInt( i, ENEMY_ID ) == petID ) + //if( ENEMY_getInt( i, ENEMY_TEMPNO ) == PetCode ) + break; + } + if( i == enemynum ){ + print("ANDY err i == enemynum \n"); + return -1; + } + ret = ENEMY_createPetFromEnemyIndex( toindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( toindex, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + i = 0; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + } + petindex2 = CHAR_getCharPet( toindex, i); + if( !CHAR_CHECKINDEX( petindex2) ){ + print("ANDY petindex2=%d\n", petindex2); + return -1; + } + CHAR_setInt( petindex2, CHAR_FUSIONINDEX, PetCode); + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(toindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + } + LogPet( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex2, CHAR_NAME), + CHAR_getInt( petindex2, CHAR_LV), + "TenseiGet", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( petindex2, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + return petindex2; +} +#endif + +#ifdef _PET_TRANS +int GetNewPet( int toindex , int petindex, int array, int *work) +{ + int *p; + int tp[E_T_DATAINTNUM]; + int tarray, i; + int level, workrank, petrank=0; + int LevelUpPoint; + + struct { + int num; + float rank; + }ranktbl[] = { + { 130, 2.5}, + { 100, 2.0}, + { 95, 1.5}, + { 85, 1.0}, + { 80, 0.5}, + { 0, 0.0}, + }; + + if( !ENEMY_CHECKINDEX( array)) + return -1; + p = ENEMY_getIntdata( array); + if( p == NULL ) { + print("\n p = NULL" ); + return -1; + } + tarray = ENEMYTEMP_getEnemyTempArray( array); + if( !ENEMYTEMP_CHECKINDEX( tarray)) + return -1; + for( i = 0; i < E_T_DATAINTNUM; i ++ ){ + tp[i] = ENEMYTEMP_getInt( tarray, i); + } + level = 1; +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) +#define E_PAR( a) (*(p + (a))) +#define ET_PAR( a) (*(tp + (a))) +#define PARAM_CAL( l) ( ( level -1) * ET_PAR( E_T_LVUPPOINT) + ET_PAR( E_T_INITNUM) ) +#ifdef _PETTRANS_RANGE + work[0] += ( RAND(getPetTransRangeX(),getPetTransRangeY()) - getPetTransRangeZ() ); + work[1] += ( RAND(getPetTransRangeX(),getPetTransRangeY()) - getPetTransRangeZ() ); + work[2] += ( RAND(getPetTransRangeX(),getPetTransRangeY()) - getPetTransRangeZ() ); + work[3] += ( RAND(getPetTransRangeX(),getPetTransRangeY()) - getPetTransRangeZ() ); +#else + work[0] += ( RAND(0,4) - 2 ); + work[1] += ( RAND(0,4) - 2 ); + work[2] += ( RAND(0,4) - 2 ); + work[3] += ( RAND(0,4) - 2 ); +#endif +/* LevelUpPoint = ( work[0] << 24 ) + + (work[1] << 16) + + (work[2] << 8 ) + + (work[3] << 0 );*/ +#ifdef _PET_TRANS_ABILITY + LevelUpPoint + = ((work[0] + getPetTransAbility() * (CHAR_getInt( petindex, CHAR_TRANSMIGRATION)+1)) << 24) + + ((work[1] + getPetTransAbility() * (CHAR_getInt( petindex, CHAR_TRANSMIGRATION)+1)) << 16) + + ((work[2] + getPetTransAbility() * (CHAR_getInt( petindex, CHAR_TRANSMIGRATION)+1)) << 8) + + ((work[3] + getPetTransAbility() * (CHAR_getInt( petindex, CHAR_TRANSMIGRATION)+1)) << 0); +#else + LevelUpPoint + = (work[0] << 24) + + (work[1] << 16) + + (work[2] << 8) + + (work[3] << 0); +#endif + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + workrank = work[0]+work[1]+work[2]+work[3]; + for( i = 0; i < arraysizeof( ranktbl); i ++ ) { + if( workrank >= ranktbl[i].num ) { + petrank = i; + break; + } + } + + if( i>= arraysizeof( ranktbl)) i = arraysizeof( ranktbl); + CHAR_setInt( petindex, CHAR_PETRANK, petrank); + + for( i = 0; i < 10; i ++ ){ + int rnt = RAND( 0, 3 ); + if( rnt == 0 ) work[0]++; + if( rnt == 1 ) work[1]++; + if( rnt == 2 ) work[2]++; + if( rnt == 3 ) work[3]++; + } + + CHAR_setInt( petindex, CHAR_VITAL, ( PARAM_CAL(E_T_BASEVITAL) * work[0] )); + CHAR_setInt( petindex, CHAR_STR , ( PARAM_CAL(E_T_BASESTR) * work[1] )); + CHAR_setInt( petindex, CHAR_TOUGH , ( PARAM_CAL(E_T_BASETGH) * work[2] )); + CHAR_setInt( petindex, CHAR_DEX , ( PARAM_CAL(E_T_BASEDEX) * work[3] )); + CHAR_setMaxExp( petindex, 0); + CHAR_setInt( petindex, CHAR_LV, level); + //\Ϊ߼ + CHAR_setInt( petindex, CHAR_SLOT, 7); +/* for( i=0; i + +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "readmap.h" +#include "map_warppoint.h" +#include "event.h" +#include "npc_warp.h" +#include "npc_npcenemy.h" + + +static int EVENT_onWarpNPC( int charaindex,int echaraindex,int fl,int x, int y ); +static int EVENY_npcEncount( int charaindex,int echaraindex,int fl,int x, int y ); + + +typedef int (*FUNC)( int charaindex,int echaraindex,int fl,int x, int y ); +static FUNC functbl[] = { + NULL, + NULL, /* NPC */ + EVENY_npcEncount, /* óľ޼ */ + EVENT_onWarpNPC, /* warp*/ + NULL, /* NPC */ + NULL, /* NPC */ + EVENT_onWarpNPC, /* warp*/ + EVENT_onWarpNPC, /* warp*/ + EVENT_onWarpNPC, /* warp*/ +}; + +INLINE BOOL EVENT_CHECKEVENTINDEX( int event) +{ + if( event < 0 || event >= CHAR_EVENTNUM) return FALSE; + return TRUE; +} + +int EVENT_main( int charaindex,int event, int x, int y) +{ + OBJECT object; + BOOL found = FALSE; + int rc = FALSE; + int fl = CHAR_getInt( charaindex, CHAR_FLOOR); + if( !EVENT_CHECKEVENTINDEX( event)) return FALSE; + + for( object = MAP_getTopObj(fl,x,y) ; object ; object = NEXT_OBJECT(object) ){ + int o = GET_OBJINDEX(object); + if( OBJECT_getType(o) == OBJTYPE_CHARA ){ + int etype; + int echaraindex=OBJECT_getIndex(o); + if( !CHAR_CHECKINDEX(echaraindex) )continue; + if( CHAR_getInt( echaraindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) continue; + etype = CHAR_getWorkInt( echaraindex, CHAR_WORKEVENTTYPE); + if( etype != CHAR_EVENT_NONE ) { + if( etype == event) { + if( functbl[event] != NULL ) { + rc = functbl[event]( charaindex, echaraindex, fl,x,y); + } + found = TRUE; + break; + } + } + } +#ifdef _MAP_WARPPOINT + else if( OBJECT_getType(o) == OBJTYPE_WARPPOINT){ + if( !MAPPOINT_CHECKINDEX( OBJECT_getIndex( o)) ) continue; + if( OBJECT_getchartype( o) != event ) continue; + MAPPOINT_MapWarpHandle( charaindex, OBJECT_getIndex( o), fl, x, y ); + found = TRUE; + rc = TRUE; + break; + } +#endif + } +/* + if( !found ) { + print( "not found eventobject : cind [%d] event [%d] fl[%d] x[%d] y[%d]\n", charaindex, event, fl,x,y); + } +*/ + return rc; +} + +static int EVENT_onWarpNPC( int charaindex,int echaraindex,int fl,int x, int y ) +{ + NPC_WarpWarpCharacter( echaraindex, charaindex); + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index) ) { + NPC_WarpWarpCharacter( echaraindex, index); + } + } + } + + return TRUE; +} +static int EVENY_npcEncount( int charaindex,int echaraindex,int fl,int x, int y ) +{ + return NPC_NPCEnemy_Encount( echaraindex, charaindex, 0); +} + diff --git a/char/family.c b/char/family.c new file mode 100644 index 0000000..fc0ec62 --- /dev/null +++ b/char/family.c @@ -0,0 +1,3444 @@ +#include "version.h" +#include +#include +#include +#include + +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npcutil.h" +#include "family.h" +#include "log.h" +#include "handletime.h" +#include "buf.h" +#include "net.h" +#include "char_base.h" +#include "battle.h" +#include "npc_bus.h" +#include "char_talk.h" +#include "npc_scheduleman.h" +#ifdef _FM_MODIFY +#include "npc_fmdengon.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#define CHAR_MAXNAME 32 +#define CHAR_MAXID 20 +#define MINFMLEVLEFORPOINT 3 // 3 ׯ԰͵ȼ +#ifdef _FAMILY_MANORNUM_CHANGE +#else +#define MANORNUM 4 +#endif +#ifdef _FMRANK_POINT +int fmrankindex[20]; +char fmrankname[20][50]; +int fmrankpoint[20]; +int fmranknum = 0; +#endif +struct FAMILY +{ + int fmindex; + char name[CHAR_MAXNAME]; + char leadername[CHAR_MAXNAME]; + char leaderid[CHAR_MAXID]; + int leadergraph; + char petname[CHAR_MAXNAME]; + char petattr[256]; + int fmnum; + int acceptflag; + char rule[256]; + int village; + int pointindex; + int dp; + char memolist[35][100]; +}; + +int familyNumTotal = 0; +char familyListBuf[MAXFAMILYLIST]; + + + +int familyTax[FAMILY_MAXNUM]; + +extern tagRidePetTable ridePetTable[296]; + +void LeaveMemberIndex( int charaindex, int fmindexi); + + +// Arminius: ȡü pk dp /ʧֵ +// getFMdpAward +// arg: windp=winner's fmdp losedp=loser's fmdp +// ret: dp award +// +#ifdef _MERGE_NEW_8 +int fmdplevelexp[]={0, // 0 + 150000, // 1 + 500000, // 2 + 1000000, // 3 + 1500000, // 4 + 2000000, // 5 + 2500000, // 6 + 3500000, // 7 + 4500000, // 8 + 5000000, // 9 + 7000000 //10 + }; +#else +int fmdplevelexp[]={0, // 0 + 10000, // 1 + 30000, // 2 + 100000, // 3 + 500000, // 4 + 1500000, // 5 + 5000000, // 6 + 15000000, // 7 + 50000000, // 8 + 200000000, // 9 + 500000000 //10 + }; +#endif +// Arminius end + +// shan begin +int getFmLv(int playerindex) // ϳʱר +{ + int i, dp; + dp = CHAR_getWorkInt(playerindex, CHAR_WORKFMDP); + if( dp > fmdplevelexp[10] ){ +// print("\n player DP->%d",dp); + return 10; + } + for(i=0; i<=10; i++) + if( dp <= fmdplevelexp[i+1] ) break; + // Nuke 20040217: Open the merge limit + //if(i>=9) i = 8; + if (i>=10) i=10; + + return i; +} + +struct FMMEMBER_LIST memberlist[FAMILY_MAXNUM]; +struct FMS_MEMO fmsmemo; +struct FM_POINTLIST fmpointlist; +#ifdef _NEW_MANOR_LAW +ManorSchedule_t ManorSchedule[MANORNUM]; +#endif +struct FMS_DPTOP fmdptop; +struct FM_PKFLOOR fmpkflnum[FAMILY_FMPKFLOOR]= +{ + {142}, + {143}, + {144}, + {145}, + {146}, + {1042}, + {2032}, + {3032}, + {4032}, +#ifdef _FAMILY_MANORNUM_CHANGE // CoolFish ޸װ԰ + {5032}, + {6032}, + {7032}, + {8032}, + {9032}, + {10032}, +#endif +}; +int leaderdengonindex = 0; +// shan end ͼ赽 family.h FAMILY_FMPKFLOOR + +void SetFMPetVarInit(int meindex) +{ + int i = 0, petindex = 0; +#ifdef _FMVER21 + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) +#else + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1) +#endif + { + for (i = 0; i < CHAR_MAXPETHAVE; i++) + { + petindex = CHAR_getCharPet(meindex, i); + if (!CHAR_CHECKINDEX(petindex)) continue; + CHAR_setInt(petindex, CHAR_PETFAMILY, -1); + } + } +} + +void SetFMVarInit(int meindex) +{ + SetFMPetVarInit(meindex); // ػ Flag + CHAR_setInt(meindex, CHAR_FMINDEX, -1); + CHAR_setChar(meindex, CHAR_FMNAME, ""); + CHAR_setInt(meindex, CHAR_FMSPRITE, -1); +#ifdef _FMVER21 + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, FMMEMBER_NONE); +#else + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, -1); +#endif + CHAR_setWorkInt(meindex, CHAR_WORKFMSETUPFLAG, -1); + CHAR_setWorkInt(meindex, CHAR_WORKFMINDEXI, -1); + CHAR_setWorkInt(meindex, CHAR_WORKFMCHARINDEX, -1); +} + +void FAMILY_Init( void ) +{ + int i, j ,k; + + for( i=0; i 0) return -1; + if (strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") != 0) return -1; +#ifdef _FMVER21 + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) return -1; +#else + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == 1) return -1; +#endif + return 1; +} + +int CheckFMMember(int meindex) +{ + if (CHAR_getInt(meindex, CHAR_FMINDEX) > 0) return -1; + if (strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") != 0) return -1; +#ifdef _FMVER21 + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) > 0 && + CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_APPLY ) return -1; +#else + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) > 0 ) return -1; +#endif + return 1; +} + +int CheckLeaderQ(int meindex) +{ + if (CHAR_getInt(meindex, CHAR_LV) < FMLEADERLV + && CHAR_getInt(meindex, CHAR_TRANSMIGRATION) <= 0) + return -1; + if (!NPC_EventCheckFlg(meindex, 4)) + return -2; + return 0; +} + +void FAMILY_Add(int fd, int meindex, char* message) +{ + char token[128], fmname[128], charname[128], charid[128]; + char petname[128], fmrule[256], petattr[256], buf[1024]; + int charlv, havepetindex, petindex, fmsprite = 0, chargrano; + int gold, tmpflag; + + if (!CHAR_CHECKINDEX(meindex)) return; + + if (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + return; +#ifdef _FM_SERVERNO_SYS + if(getFmServerNo()!=getServernumber()){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + getFmServerMsg()); + return; + } +#endif + if (CHAR_getInt(meindex, CHAR_FMINDEX) >= 0 + && strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") != 0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nѾޡ޷ٳ壡", buf, sizeof(buf))); + return; + } + tmpflag = CheckLeaderQ(meindex); + if(tmpflag == -1) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nܱǸรĵȼ㣡", buf, sizeof(buf))); + return; + } + + if(tmpflag == -2) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nܱǸรɳУ", buf, sizeof(buf))); + return; + } + + gold = CHAR_getInt(meindex, CHAR_GOLD); +#ifdef _NEWFM_GOLD + if( gold < getNewFmGold() ) + { + char newfmmsg[256]; + sprintf(newfmmsg,"\nܱǸรҪ%dԪʯҵѣ",getNewFmGold()); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + newfmmsg); + return; + } + else { + CHAR_setInt( meindex, CHAR_GOLD, gold-getNewFmGold() ); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_GOLD); + } +#else + if( gold < 10000 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nܱǸรҪ10000Ԫʯҵѣ", buf, sizeof(buf))); + return; + } + else { + CHAR_setInt( meindex, CHAR_GOLD, gold-10000 ); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_GOLD); + } +#endif + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + sprintf(fmname, "%s", token); + if ((strstr(fmname, " ")) || (strcmp(fmname, "") == 0) || (strstr(fmname, ""))) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nո", buf, sizeof(buf))); + return; + } + if (getStringFromIndexWithDelim(message, "|", 3, token, + sizeof(token)) == FALSE) return; + havepetindex = atoi(token); + petindex = CHAR_getCharPet(meindex, havepetindex); + if (!CHAR_CHECKINDEX(petindex)) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nѡһֻΪػޣ", buf, sizeof(buf))); + return; + } + if (getStringFromIndexWithDelim(message, "|", 4, token, + sizeof(token)) == FALSE) return; + fmsprite = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 5, token, + sizeof(token)) == FALSE) return; + if (strcmp(token, "") == 0) + sprintf(fmrule, ""); + else + sprintf(fmrule, "%s", token); + sprintf(charname, "%s", CHAR_getChar(meindex, CHAR_NAME)); + sprintf(charid, "%s", CHAR_getChar(meindex, CHAR_CDKEY)); + charlv = CHAR_getInt(meindex, CHAR_LV); + chargrano = CHAR_getInt(meindex, CHAR_FACEIMAGENUMBER); + if (strlen(CHAR_getChar(petindex, CHAR_USERPETNAME)) == 0) + sprintf(petname, "%s", CHAR_getChar(petindex, CHAR_NAME)); + else + sprintf(petname, "%s", CHAR_getChar(petindex, CHAR_USERPETNAME)); + sprintf(petattr, "%d %d %d %d", + CHAR_getInt(petindex, CHAR_BASEIMAGENUMBER), + CHAR_getWorkInt(petindex, CHAR_WORKATTACKPOWER), + CHAR_getWorkInt(petindex, CHAR_WORKDEFENCEPOWER), + CHAR_getWorkInt(petindex, CHAR_WORKQUICK)); + CHAR_setInt(petindex, CHAR_PETFAMILY, 1); + CHAR_setChar(meindex, CHAR_FMNAME, fmname); +#ifdef _FMVER21 + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, FMMEMBER_LEADER); +#else + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, 1); +#endif + CHAR_setInt(meindex, CHAR_FMSPRITE, fmsprite); + + // print("%s %s %s %d %s %s %s %d %d\n", fmname, charname, charid, charlv, petname, + // petattr, fmrule, fmsprite, chargrano); +#ifdef _PERSONAL_FAME + saacproto_ACAddFM_send(acfd, fmname, charname, charid, charlv, + petname, petattr, fmrule, fmsprite, chargrano, + CHAR_getInt(meindex, CHAR_FAME), CONNECT_getFdid(fd)); + // print("ACAddFM acfd:%d meindex:%d fmname:%s charname:%s fame:%d Connectfd:%d fd:%d\n", + // acfd, meindex, fmname, charname, CHAR_getInt(meindex, CHAR_FAME), CONNECT_getFdid(fd), fd); +#else + saacproto_ACAddFM_send(acfd, fmname, charname, charid, charlv, + petname, petattr, fmrule, fmsprite, chargrano, CONNECT_getFdid(fd)); +#endif + + // Ҫ¼б + //saacproto_ACShowFMList_send( acfd ); + +} + +/* + qr +qr +r +qةȡ~~r +辶 +tЩs ~~~~~~~~~ + + +*/ + +void ACAddFM(int fd, int result, int fmindex, int index) +{ + int meindex = CONNECT_getCharaindex(fd); + char buf[1024]; + +// print("ACAddFM result:%d fmindex:%d meindex:%d\n", result, fmindex, meindex); // test + + if (!CHAR_CHECKINDEX(meindex)) return; + +// print("ACAddFM_2!\n"); + + if (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + return; + +// print("ACAddFM_3!\n"); + + if(result == 1) + { + CHAR_setInt(meindex, CHAR_FMINDEX, fmindex); + CHAR_setWorkInt(meindex, CHAR_WORKFMINDEXI, index); + CHAR_setWorkInt(meindex, CHAR_WORKFMSETUPFLAG, 0); +#ifdef _NEW_MANOR_LAW + CHAR_setInt(meindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(meindex,-1,"ƹ",CHAR_COLORYELLOW); +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nϲµļ壡ڣ֮ټ˼룬Ȼȡʸม", buf, sizeof(buf))); + JoinMemberIndex( meindex, index); + CHAR_charSaveFromConnect(meindex, FALSE); + + // Ҫ¼ + saacproto_ACShowFMList_send( acfd ); + saacproto_ACShowMemberList_send( acfd, index ); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_INTEGRATE); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_MOMENTUM); + + LogFamily( + CHAR_getChar( meindex, CHAR_FMNAME), + CHAR_getInt( meindex, CHAR_FMINDEX), + CHAR_getChar( meindex, CHAR_NAME), + CHAR_getChar( meindex, CHAR_CDKEY), + "ADDFAMILY()", + "" + ); + } + else + { + int i = 0, petindex = 0; + char tmpbuf[256]; + int gold = CHAR_getInt(meindex, CHAR_GOLD); +#ifdef _NEWFM_GOLD + CHAR_setInt(meindex, CHAR_GOLD, gold + getNewFmGold()); +#else + CHAR_setInt(meindex, CHAR_GOLD, gold + 10000); +#endif + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_GOLD); + SetFMVarInit(meindex); + + for (i = 0; i < CHAR_MAXPETHAVE; i++) + { + petindex = CHAR_getCharPet(meindex, i); + if (!CHAR_CHECKINDEX(petindex)) continue; + CHAR_setInt(petindex, CHAR_PETFAMILY, -1); + } + if (fmindex == -2) + sprintf(tmpbuf, "\nѾֵͬļˣ"); + else + sprintf(tmpbuf, "\nʧܣ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString(tmpbuf, buf, sizeof(buf))); + } + CHAR_sendStatusString( meindex, "F"); +} + +void FAMILY_Join(int fd, int meindex, char *message) +{ + int fmindex, charlv, index, fmsprite; + char token[128], fmname[128], charname[128], charid[128], buf[1024]; + + if (!CHAR_CHECKINDEX(meindex)) return; + + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + + if (CheckFMMember(meindex) < 0){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nѾร", buf, sizeof(buf))); + return; + } + +#ifdef _FM_JOINLIMIT + if( CHAR_getInt( meindex, CHAR_FMTIMELIMIT ) > (int)time(NULL) ){ + char buff[255]; + sprintf(buff, "\n֮ǰ˳壬\n%dСʱټร",(CHAR_getInt( meindex, CHAR_FMTIMELIMIT )-(int)time(NULL))/3600+1); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( buff, buf, sizeof(buf))); + return; + } +#endif + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + index = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 3, token, + sizeof(token)) == FALSE) return; + fmindex = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 4, token, + sizeof(token)) == FALSE) return; + sprintf(fmname, "%s", token); + if (getStringFromIndexWithDelim(message, "|", 5, token, + sizeof(token)) == FALSE) return; + fmsprite = atoi(token); + sprintf(charname, "%s", CHAR_getChar(meindex, CHAR_NAME)); + sprintf(charid, "%s", CHAR_getChar(meindex, CHAR_CDKEY)); + charlv = CHAR_getInt(meindex, CHAR_LV); + CHAR_setInt(meindex, CHAR_FMINDEX, fmindex); + CHAR_setChar(meindex, CHAR_FMNAME, fmname); +#ifdef _FMVER21 + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, FMMEMBER_APPLY); +#else + CHAR_setInt(meindex, CHAR_FMLEADERFLAG, 0); +#endif + CHAR_setInt(meindex, CHAR_FMSPRITE, fmsprite); + CHAR_setWorkInt(meindex, CHAR_WORKFMINDEXI, index); + +// print("JoinFM index:%d fmindex:%d fmname:%s charname:%s charid:%s charlv:%d sprite:%d\n", +// index, fmindex, fmname, charname, charid, charlv, fmsprite); +#ifdef _PERSONAL_FAME // Arminius: +// print("fame:%d charfdid:%d\n", CHAR_getInt(meindex, CHAR_FAME), +// CONNECT_getFdid(fd)); + saacproto_ACJoinFM_send(acfd, fmname, fmindex, charname, charid, charlv, + index, CHAR_getInt(meindex, CHAR_FAME), CONNECT_getFdid(fd)); +#else +// print("charfdid:%d\n", CONNECT_getFdid(fd)); + saacproto_ACJoinFM_send(acfd, fmname, fmindex, charname, charid, charlv, + index, CONNECT_getFdid(fd)); +#endif +} + +void ACJoinFM(int fd, int result, int recv) +{ + int meindex = CONNECT_getCharaindex(fd); + char buf[1024]; + + if(!CHAR_CHECKINDEX(meindex)) return; + + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + + if (result == 1) { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nллļ룡ȵ峤֮ͨᣬʽ롣", buf, sizeof(buf))); + + JoinMemberIndex( meindex, CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI) ); +#ifdef _NEW_MANOR_LAW + CHAR_setInt(meindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(meindex,-1,"ƹ",CHAR_COLORYELLOW); +#endif + + sprintf(buf,"fame:%d",CHAR_getInt(meindex,CHAR_FAME)); + + LogFamily( + CHAR_getChar( meindex, CHAR_FMNAME), + CHAR_getInt( meindex, CHAR_FMINDEX), + CHAR_getChar( meindex, CHAR_NAME), + CHAR_getChar( meindex, CHAR_CDKEY), + "JOINFAMILY()", + buf + ); + + } + else + { + SetFMVarInit(meindex); + if (recv == -2) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n˼ĿǰԸճԱ", buf, sizeof(buf))); + } + else if (recv == -3) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n˼Ŀǰ޷ճԱԱѵޣ", buf, sizeof(buf))); + } + else + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nʧܣ", buf, sizeof(buf))); + } + + CHAR_sendStatusString( meindex, "F"); +} + +void FAMILY_Leave(int fd, int meindex, char *message) +{ + int result, fmindex, index; + char token[128], fmname[128], charname[128], charid[128], buf[1024]; + + if (!CHAR_CHECKINDEX(meindex)) return; + + if (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + return; + + if ((CHAR_getInt(meindex, CHAR_FMINDEX) == -1) + || (strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") == 0) +#ifdef _FMVER21 + || (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == FMMEMBER_NONE)) +#else + || (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == -1)) +#endif + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n㲢ûмร", buf, sizeof(buf))); + return; + } + + { + int i, fmpks_pos; + for( i=1; i<=MANORNUM; i++){ // CoolFish 4->MANORNUM 2002/2/25 + fmpks_pos = i * MAX_SCHEDULE; +#ifdef _FMVER21 + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER){ +#else + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == 1){ +#endif + if( (fmpks[fmpks_pos+1].host_index+1) == CHAR_getInt(meindex, CHAR_FMINDEX) || + (fmpks[fmpks_pos+1].guest_index+1) == CHAR_getInt(meindex, CHAR_FMINDEX) ){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nĿǰļԼսУ޷ɢ壡", buf, sizeof(buf))); + return; + } + } + } + } + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + result = atoi(token); + if (result == 1) + { + fmindex = CHAR_getInt(meindex, CHAR_FMINDEX); + index = CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI); + sprintf(fmname, "%s", CHAR_getChar(meindex, CHAR_FMNAME)); + sprintf(charname, "%s", CHAR_getChar(meindex, CHAR_NAME)); + sprintf(charid, "%s", CHAR_getChar(meindex, CHAR_CDKEY)); +#ifdef _FMVER21 + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) { +#else + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) == 1) { +#endif +// print("DelFM index:%d fmindex:%d fmname:%s\n", index, fmindex, fmname); +#ifdef _FM_SERVERNO_SYS + if(getFmServerNo()!=getServernumber()){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + getFmServerMsg()); + return; + } +#endif + saacproto_ACDelFM_send(acfd, fmname, fmindex, index, charname, charid, + CONNECT_getFdid(fd)); +#ifdef _FMRANK_POINT + if(sasql_fmpoint_query(fmindex)>0) + sasql_fmindex_del(fmindex); +#endif + // Ҫ¼б + //saacproto_ACShowFMList_send( acfd ); + } + else { +// print("LeaveFM index:%d fmindex:%d fmname:%s charname:%s charid:%s\n", +// index, fmindex, fmname, charname, charid); + saacproto_ACLeaveFM_send(acfd, fmname, fmindex, charname, charid, index, + CONNECT_getFdid(fd)); + } + + } +} + +void ACLeaveFM( int fd, int result, int resultflag) +{ + int meindex = CONNECT_getCharaindex(fd); + char buf[1024]; + + if (!CHAR_CHECKINDEX(meindex)) return; + if (result == 1){ + // won 2002/01/05 + LogFamily( + CHAR_getChar( meindex, CHAR_FMNAME), + CHAR_getInt( meindex, CHAR_FMINDEX), + CHAR_getChar( meindex, CHAR_NAME), + CHAR_getChar( meindex, CHAR_CDKEY), + "LEAVEFAMILY(뿪)", + "" + ); + if( CHAR_getWorkInt( meindex, CHAR_WORKFMCHANNEL) != -1 ) + CHAR_setWorkInt( meindex, CHAR_WORKFMCHANNEL, -1 ); + LeaveMemberIndex( meindex, CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI) ); + SetFMVarInit(meindex); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n˳ϣˣ", buf, sizeof(buf))); + CHAR_setWorkInt( meindex, CHAR_WORKFMFLOOR, -1); +#ifdef _FM_JOINLIMIT + CHAR_setInt( meindex, CHAR_FMTIMELIMIT, (int)time(NULL)+getJoinFamilyTime()*(60*60) ); +#endif +#ifdef _NEW_MANOR_LAW + CHAR_setInt(meindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(meindex,-1,"˳ƹ",CHAR_COLORYELLOW); +#endif + CHAR_setInt( meindex , CHAR_RIDEPET, -1 ); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , CHAR_getInt( meindex , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_RIDEPET); +#ifdef _FM_METAMO + CHAR_ReMetamo(meindex); +#endif + }else + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n˳ʧܣ", buf, sizeof(buf))); + + CHAR_sendStatusString( meindex, "F" ); +} + +void ACDelFM(int fd, int result) +{ + char buf[1024]; + int meindex = CONNECT_getCharaindex(fd); + if (!CHAR_CHECKINDEX(meindex)) return; + + //if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + // || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + // return; + + if (result == 1) + { +// WON ADD +if(CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI)>-1){ + LogFamily( + CHAR_getChar( meindex, CHAR_FMNAME), + CHAR_getInt( meindex, CHAR_FMINDEX), + CHAR_getChar( meindex, CHAR_NAME), + CHAR_getChar( meindex, CHAR_CDKEY), + "DELFAMILY(ɢ)", + "" + ); + + LeaveMemberIndex( meindex, CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI) ); + /* + for( i=0; i0){ + familyNumTotal = familyNumTotal + fmranknum; + int i; + char fmrankbuf[128]; + memset(fmrankbuf, 0, sizeof(fmrankbuf)); + char *tempbuf=NULL; + char fmrankdata[128]; + memset(fmrankdata, 0, sizeof(fmrankdata)); + for(i=0;i familyNumTotal ) break; + if( getStringFromIndexWithDelim( familyListBuf, "|", i, subbuf, + sizeof(subbuf) ) == FALSE) break; + strcat( buf, "|" ); + strcat( buf, subbuf ); + j++; + + // print(" |%s| ", subbuf); + } + + sprintf( sendbuf, "S|F|%d|%d|%d%s", familyNumTotal, atoi(token2), j, buf ); + lssproto_FM_send( fd, sendbuf ); + + return; + + } + + // shan add + if (strcmp(token, "P") == 0 ){ +#ifdef _CAX_FAMEBUTTON + if (strcmp( getfamebutton() , "") == 0) + { + fameButton( meindex); //ABluať + }else{ +#endif + int personfame; + char sendbuf[512]; + int fd = getfdFromCharaIndex( meindex); + char* id = CHAR_getChar( meindex, CHAR_CDKEY ); + int viptype = CHAR_getInt( meindex, CHAR_VIPRIDE ); + int viptime = CHAR_getInt( meindex, CHAR_VIPTIME ); + if(viptime>0) + { + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + viptime = viptime - timep; + } +#ifdef _PERSONAL_FAME + personfame = (CHAR_getInt( meindex, CHAR_FAME)/100); +#else + personfame = CHAR_getWorkInt( meindex, CHAR_WORKFMDP); +#endif + CHAR_talkToCli(meindex, -1, "˻Ϣ", CHAR_COLORYELLOW); +#ifdef _NEW_CurrencyShow + sprintf(sendbuf, "%-12d Ƶ%-12d ˻ֵ%d", personfame, + CHAR_getInt(meindex,CHAR_MOMENTUM)/100, sasql_ampoint( CHAR_getChar(meindex,CHAR_CDKEY), 0,0)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORGREEN); + + sprintf(sendbuf, "˱ǵ%-12d ˻%-12d ˻Ա%d", CHAR_getInt(meindex,CHAR_CAMEO), + CHAR_getInt(meindex,CHAR_VIGOR), sasql_vippoint(id,0,0)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORBLUE); + + sprintf(sendbuf, "ֽ˻%-12d %-12d ܻ%d", sasql_rmbpoint(id,0,0), + CHAR_getInt(meindex,CHAR_MISSIONTRAIN_NUM), CHAR_getInt(meindex,CHAR_EVNUM)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORPURPLE); + +#ifdef _OFFLINE_SYSTEM + if(getOfflineCf()==0) + sprintf(sendbuf,"ʱ䣺%d (δ)",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + else if(getOfflineCf()==1) + sprintf(sendbuf,"ʱ䣺%d",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + else + sprintf(sendbuf,"ʱ䣺%d (߲ʱ)",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif + + if(viptime == 0){ + CHAR_talkToCli(meindex, -1, "Ȩޣδ", CHAR_COLORYELLOW); + } + if(viptime<0) + { + CHAR_setInt(meindex,CHAR_VIPRIDE,0); + CHAR_setInt(meindex,CHAR_VIPTIME,0); + CHAR_loginCheckUserItem(meindex); + viptype = CHAR_getInt(meindex,CHAR_VIPRIDE); + } + if(viptime>0) + { + viptime = (int)(viptime/60/60/24); + if(viptype==1) + { + sprintf(sendbuf,"ͨԱʣࣺ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + else if(viptype==2) + { + sprintf(sendbuf,"ƽԱʣࣺ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + else if(viptype==3) + { + sprintf(sendbuf,"ʯԱʣࣺ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + } + + sprintf(sendbuf,"߻飺%d",getBattleexp()); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#ifdef _VIP_BATTLE_EXP + int nvipexp, nviptime; + nvipexp = CHAR_getInt( meindex, CHAR_NVIPEXP); + nviptime = CHAR_getInt( meindex, CHAR_NVIPTIME )/60; + if (nvipexp > 0 && CHAR_getInt( meindex, CHAR_VIPTIME ) == 0){ + sprintf(sendbuf,"⾭ӳɣ%d (ʱЧ%d)",getVipBattleExp(), nviptime); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORBLUE2); + }else if (CHAR_getInt( meindex, CHAR_VIPTIME ) > 0){ + sprintf(sendbuf,"⾭ӳɣ%d (ʱЧԱ)",getVipBattleExp()); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORBLUE2); + } +#endif +#ifdef _EXP_TIME_OUT + int ITEM_ADDEXP,ITEM_ADDEXP_TIME; + ITEM_ADDEXP = CHAR_getInt( meindex, CHAR_ADDEXPPOWER ); + if(ITEM_ADDEXP>0){ + ITEM_ADDEXP_TIME = CHAR_getInt( meindex, CHAR_ADDEXPTIME )/60; + sprintf(sendbuf,"Ʒӳɣ%d (ʱЧ%d)",ITEM_ADDEXP,ITEM_ADDEXP_TIME); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORCYAN); + } +#endif + +#else//_NEW_CurrencyShow + + sprintf( sendbuf, "%d", personfame); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#ifdef _NEW_MANOR_LAW + sprintf(sendbuf,"ƣ%d",CHAR_getInt(meindex,CHAR_MOMENTUM)/100); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif +#ifdef _VIP_SERVER + sprintf(sendbuf,"˻֣%d",sasql_ampoint( CHAR_getChar(meindex,CHAR_CDKEY), 0,0)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + if(viptime<0) + { + CHAR_setInt(meindex,CHAR_VIPRIDE,0); + CHAR_setInt(meindex,CHAR_VIPTIME,0); + CHAR_loginCheckUserItem(meindex); + viptype = CHAR_getInt(meindex,CHAR_VIPRIDE); + } + if(viptime>0) + { + viptime = (int)(viptime/60/60/24); + if(viptype==1) + { + sprintf(sendbuf,"ʣԱΪ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + else if(viptype==2) + { + sprintf(sendbuf,"ʣƽԱΪ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + else if(viptype==3) + { + sprintf(sendbuf,"ʣʯԱΪ%d",viptime+1); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } + } +#endif + sprintf(sendbuf,"Ա%d",sasql_vippoint(id,0,0)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#ifdef _VIGOR_SYS + sprintf(sendbuf,"%d",CHAR_getInt(meindex,CHAR_VIGOR)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif +#ifdef _EV_NUM + sprintf(sendbuf,"ܻ%d",CHAR_getInt(meindex,CHAR_EVNUM)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif +//#ifdef _STU_SYS +// sprintf(sendbuf,"ʦ֣%d",CHAR_getInt(meindex,CHAR_STUNUM)); +// CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +//#endif +#ifdef _RMB_SYSTEM + sprintf(sendbuf,"ֽ˻%d",sasql_rmbpoint(id,0,0)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif +#ifdef _OFFLINE_SYSTEM + if(getOfflineCf()==0) + sprintf(sendbuf,"ʱ䣺%dӣ߲֧߹һ",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + else if(getOfflineCf()==1) + sprintf(sendbuf,"ʱ䣺%d",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + else + sprintf(sendbuf,"ʱ䣺%dӣĿǰ߲ʱ䣩",(int)(CHAR_getInt(meindex,CHAR_OFFTIME)/60)); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#endif + sprintf(sendbuf,"߻飺%d",getBattleexp()); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); +#ifdef _EXP_TIME_OUT + int ITEM_ADDEXP,ITEM_ADDEXP_TIME; + ITEM_ADDEXP = CHAR_getInt( meindex, CHAR_ADDEXPPOWER ); + if(ITEM_ADDEXP>0){ + ITEM_ADDEXP_TIME = CHAR_getInt( meindex, CHAR_ADDEXPTIME )/60; + sprintf(sendbuf,"Ʒӳɣ%d% ʱЧ%d",ITEM_ADDEXP,ITEM_ADDEXP_TIME); + CHAR_talkToCli(meindex, -1, sendbuf, CHAR_COLORYELLOW); + } +#endif + +#endif//_NEW_CurrencyShow +#ifdef _CAX_FAMEBUTTON + } +#endif + } + + if(strcmp(token,"D") == 0){ + if(getStringFromIndexWithDelim(message, "|", 3, fmname, sizeof(fmname)) == FALSE) return; + if(getStringFromIndexWithDelim(message, "|", 4, token2, sizeof(token2)) == FALSE) return; + fmindex = atoi( token2 ); + if(getStringFromIndexWithDelim(message, "|", 5, token2, sizeof(token2)) == FALSE) return; + tempindex = atoi( token2 ); + + //print(" send_fmname_ac:%s ", fmname); + saacproto_ACFMDetail_send( acfd, fmname, fmindex, tempindex, CONNECT_getFdid(fd) ); + } + + // shan begin + else if (strcmp(token, "D2") ==0 ) { + char sendbuf[2048], tmpbuf[1024], leadernamebuf[64]; + int h, i = 0; + int meindex = CONNECT_getCharaindex(fd); + int fmindex_wk = CHAR_getWorkInt( meindex, CHAR_WORKFMINDEXI); + if( fmindex_wk < 0 || fmindex_wk >= FAMILY_MAXNUM) return; + + for( h=0; h ||峤||||ְλ|徫|PK +#ifdef _NEW_MANOR_LAW + sprintf( sendbuf, "%s|%d|%s|%d|%d|%d|%d|%d|%s|%d|%d", +#else + sprintf( sendbuf, "%s|%d|%s|%d|%d|%d|%d|%d|%s", +#endif + CHAR_getChar(meindex, CHAR_FMNAME), + memberlist[fmindex_wk].fmjoinnum, + leadernamebuf, + h+1, +#ifdef _FMVER21 + fmdptop.fmtopdp[h], +#else + (CHAR_getWorkInt( meindex, CHAR_WORKFMDP)/100), +#endif +#ifdef _PERSONAL_FAME + (CHAR_getInt( meindex, CHAR_FAME)/100), +#else + (CHAR_getWorkInt( meindex, CHAR_WORKFMDP)/100), +#endif + CHAR_getInt( meindex, CHAR_FMLEADERFLAG), + CHAR_getInt( meindex, CHAR_FMSPRITE ), + tmpbuf +#ifdef _NEW_MANOR_LAW + ,fmdptop.fmMomentum[h]/100 // + ,CHAR_getInt(meindex,CHAR_MOMENTUM)/100 // +#endif + ); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_FAMILYDETAIL, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + makeEscapeString( sendbuf, buf, sizeof(buf))); + } + // shan end +} + +void ACFMDetail(int ret, char *data, int clifd) +{ + char sendbuf[1024]; + + //print(" Detail:%s ", data); + + if( ret != 1 ) + { + print(" ACFMDetailError!:%d ", clifd ); + return; + } + //print(" ACFMDetail:%d:%s ", clifd, data ); + + /* + len = strlen(data); + strcpy( buf, data ); + + for( i=0 ; i :%s (ΪԱ):%d\n", CHAR_getInt(meindex, CHAR_FMLEADERFLAG), charname, charindex); + LogFamily( + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getChar(meindex, CHAR_NAME), + CHAR_getChar(meindex, CHAR_CDKEY), + "CheckMember", + sbuf + ); + // shan end + + saacproto_ACMemberJoinFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), result, + CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + } +#else + { + saacproto_ACMemberJoinFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), result, + CONNECT_getFdid(fd)); + } +#endif +#ifdef _FMVER21 + else if (result == FMMEMBER_NONE) +#else + else if (result == 4) +#endif + { + for (i = 0 + 1; i < FAMILY_MAXHOME + 1; i++) + { + int fmpks_pos = i * MAX_SCHEDULE; + if ((fmpks[fmpks_pos].host_index == index + && strcmp(fmname, fmpks[fmpks_pos].host_name) == 0) + || (fmpks[fmpks_pos].guest_index == index + && strcmp(fmname, fmpks[fmpks_pos].guest_name) == 0)) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nĿǰսУ޷˳Ա", buf, sizeof(buf))); +// print("fmpks_pos:%d index:%d host:%d guest:%d\n", fmpks_pos, +// index, fmpks[fmpks_pos].host_index, fmpks[fmpks_pos].guest_index); + return; + } + } +#ifdef _FMVER21 + { + // shan begin + char sbuf[1024]; + sprintf( sbuf, "峤:%d -> :%s :%d (˳)\n", CHAR_getInt(meindex, CHAR_FMLEADERFLAG), charname, charindex); + LogFamily( + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getChar(meindex, CHAR_NAME), + CHAR_getChar(meindex, CHAR_CDKEY), + "CheckMember", + sbuf + ); + // shan end + saacproto_ACMemberLeaveFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), + CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + } +#else + { + saacproto_ACMemberLeaveFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), + CONNECT_getFdid(fd)); + } +#endif + } +#ifdef _FMVER21 +// else if (result == FMMEMBER_ELDER || result == FMMEMBER_INVITE +// || result == FMMEMBER_BAILEE || result == FMMEMBER_VICELEADER ) + else if (result == FMMEMBER_ELDER ) + { + if (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) + return; +#ifdef _FMVER21 + { + // shan begin + char sbuf[1024]; + sprintf( sbuf, "峤:%d -> :%s :%d (Ϊ)\n", CHAR_getInt(meindex, CHAR_FMLEADERFLAG), charname, charindex); + LogFamily( + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getChar(meindex, CHAR_NAME), + CHAR_getChar(meindex, CHAR_CDKEY), + "CheckMember", + sbuf + ); + // shan end + saacproto_ACMemberJoinFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), result, + CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + } +#else + { + saacproto_ACMemberJoinFM_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), charname, charindex, + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), result, + CONNECT_getFdid(fd)); + } +#endif + } +#endif + // Ҫ¼б + saacproto_ACShowFMList_send( acfd ); +} + +void FAMILY_Channel(int fd, int meindex, char *message) +{ + char token[128], token2[128]; + char buf[4096], subbuf[4096], sendbuf[4096]; + int i, tempindex, fmindexi, channel, nowchannel, num; + + fmindexi = CHAR_getWorkInt( meindex, CHAR_WORKFMINDEXI); + nowchannel = CHAR_getWorkInt( meindex, CHAR_WORKFMCHANNEL ); + + // print(" channelFM:%d ", fmindexi); + if( fmindexi < 0 ) { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n㻹ûмκμ壡", buf, sizeof(buf))); + return; + } + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + + if (getStringFromIndexWithDelim(message, "|", 3, token2, + sizeof(token2)) == FALSE) return; + + channel = atoi( token2 ); + + if( strcmp( token, "J") == 0) { + if( channel < -1 || channel > FAMILY_MAXCHANNEL )return; + if( nowchannel >= 0 && nowchannel < FAMILY_MAXCHANNEL ) { + i = 0; + while( i < FAMILY_MAXMEMBER ) { + if( channelMember[fmindexi][nowchannel][i] == meindex ) { + channelMember[fmindexi][nowchannel][i] = -1; + break; + } + i++; + } + } + + if( channel > 0 && channel < FAMILY_MAXCHANNEL ) { + i = 0; + while( i < FAMILY_MAXCHANNELMEMBER ) { + if( channelMember[fmindexi][channel][i] < 0 ) { + channelMember[fmindexi][channel][i] = meindex; + break; + } + i++; + } + if( i >= FAMILY_MAXCHANNELMEMBER ) { + CHAR_talkToCli( meindex, -1, "Ƶ", CHAR_COLORWHITE); + return; + } + sprintf( buf, "Ƶ [%d]", channel ); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + + if( nowchannel >=0 && nowchannel < FAMILY_MAXCHANNEL ) { + sprintf( buf, "%s ˳Ƶ", CHAR_getChar( meindex, CHAR_NAME) ); + for( i=0; i < FAMILY_MAXCHANNELMEMBER; i++ ) { + if( CHAR_CHECKINDEX(channelMember[fmindexi][nowchannel][i]) + && channelMember[fmindexi][nowchannel][i] != meindex ) { + CHAR_talkToCli( channelMember[fmindexi][nowchannel][i], -1, buf, CHAR_COLORWHITE); + } + } + } + sprintf( buf, "%s Ƶ", CHAR_getChar( meindex, CHAR_NAME) ); + for( i=0; i < FAMILY_MAXCHANNELMEMBER; i++ ) { + if( CHAR_CHECKINDEX(channelMember[fmindexi][channel][i]) + && channelMember[fmindexi][channel][i] != meindex ) { + CHAR_talkToCli( channelMember[fmindexi][channel][i], -1, buf, CHAR_COLORWHITE); + } + } + + } + else if( channel == 0 ) { + i = 0; + while( i < FAMILY_MAXMEMBER ) { + if( channelMember[fmindexi][0][i] < 0 ) { + channelMember[fmindexi][0][i] = meindex; + break; + } + i++; + } + if( i >= FAMILY_MAXMEMBER ) { +#ifndef _CHANNEL_MODIFY + CHAR_talkToCli( meindex, -1, "Ƶ", CHAR_COLORWHITE); +#endif + return; + } +#ifndef _CHANNEL_MODIFY + sprintf( buf, "Ƶ [ȫ]"); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + if( nowchannel >=0 && nowchannel < FAMILY_MAXCHANNEL ) { + sprintf( buf, "%s ˳Ƶ", CHAR_getChar( meindex, CHAR_NAME) ); + for( i=0; i < FAMILY_MAXCHANNELMEMBER; i++ ) { + if( CHAR_CHECKINDEX(channelMember[fmindexi][nowchannel][i]) + && channelMember[fmindexi][nowchannel][i] != meindex ) { + CHAR_talkToCli( channelMember[fmindexi][nowchannel][i], -1, buf, CHAR_COLORWHITE); + } + } + } + sprintf( buf, "%s Ƶ", CHAR_getChar( meindex, CHAR_NAME) ); + for( i=0; i < FAMILY_MAXCHANNELMEMBER; i++ ) { + if( CHAR_CHECKINDEX(channelMember[fmindexi][channel][i]) + && channelMember[fmindexi][channel][i] != meindex ) { + CHAR_talkToCli( channelMember[fmindexi][channel][i], -1, buf, CHAR_COLORWHITE); + } + } +#endif + } +#ifdef _FMVER21 + else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ) +#else + else if( channel == FAMILY_MAXCHANNEL && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) == 1 ) +#endif + { + CHAR_talkToCli( meindex, -1, "峤㲥", CHAR_COLORWHITE); + } + else { + channel = -1; +#ifndef _CHANNEL_MODIFY + CHAR_talkToCli( meindex, -1, "˳Ƶ", CHAR_COLORWHITE); +#else + CHAR_talkToCli( meindex, -1, "ر峤㲥", CHAR_COLORWHITE); + channel = 0; + i = 0; + while(i < FAMILY_MAXMEMBER){ + if( channelMember[fmindexi][0][i] < 0 ) { + channelMember[fmindexi][0][i] = meindex; + break; + } + i++; + } +#endif + + sprintf( buf, "%s ˳Ƶ", CHAR_getChar( meindex, CHAR_NAME) ); + for( i=0; i < FAMILY_MAXCHANNELMEMBER; i++ ) { + if( CHAR_CHECKINDEX(channelMember[fmindexi][nowchannel][i]) + && channelMember[fmindexi][nowchannel][i] != meindex ) { + CHAR_talkToCli( channelMember[fmindexi][nowchannel][i], -1, buf, CHAR_COLORWHITE); + } + } + } + + CHAR_setWorkInt( meindex, CHAR_WORKFMCHANNEL, channel); + if( channel != -1 ) CHAR_setWorkInt( meindex, CHAR_WORKFMCHANNELQUICK, channel); + + sprintf( sendbuf, "C|J|%d", channel); + lssproto_FM_send( fd, sendbuf); + + } + else if( strcmp( token, "L") == 0) { + + int j, membernum, bFind = 0; + if( channel < 0 || channel >= FAMILY_MAXCHANNEL ) return; + + subbuf[0] = '\0'; + num = 0; + if( channel != 0 ) + membernum = FAMILY_MAXCHANNELMEMBER; + else + membernum = FAMILY_MAXMEMBER; + + for( j = 0 ; j < FAMILY_MAXMEMBER ; j++ ) { + bFind = 0; + tempindex = familyMemberIndex[fmindexi][j]; + //if( tempindex >= 0 ) { + if( CHAR_CHECKINDEX(tempindex) ) { + for( i=0; i< membernum ; i++) { + if( tempindex == channelMember[fmindexi][channel][i] ) { + //if( CHAR_getChar( tempindex, CHAR_NAME ) == NULL ) { + // familyMemberIndex[fmindexi][j] = -1; + // channelMember[fmindexi][channel][i] = -1; + // continue; + //} + bFind = 1; + break; + } + } + if( bFind ) + strcat( subbuf, "|1|" ); + else + strcat( subbuf, "|0|" ); + makeEscapeString( CHAR_getChar( tempindex, CHAR_NAME ), buf, sizeof(buf)); + strcat( subbuf, buf ); + num++; + } + } + sprintf( sendbuf, "C|L|%d|%d%s", channel, num, subbuf); + lssproto_FM_send( fd, sendbuf); + //print(" CList:%s ", sendbuf); + } +} + +void FAMILY_Bank(int fd, int meindex, char *message) +{ + if(CHAR_getWorkInt(meindex,CHAR_WORKSTREETVENDOR) > 0) + return; + char token[128], token2[128], buf[1024]; + int fmindex, cash, bank, toBank; + int MaxGold; + MaxGold = CHAR_getMaxHaveGold( meindex); + fmindex = CHAR_getInt( meindex, CHAR_FMINDEX); + // add shan + if( fmindex <= 0 && CHAR_getInt( meindex, CHAR_BANKGOLD) < 1) { + CHAR_talkToCli( meindex, -1, "ȼ塣", CHAR_COLORWHITE); + return; + } + + if (getStringFromIndexWithDelim(message, "|", 2, token, sizeof(token)) == FALSE) + return; + + if( strcmp(token, "G" )==0 ) { + if (getStringFromIndexWithDelim(message, "|", 3, token2, sizeof(token)) == FALSE) + return; + + toBank = atoi( token2 ); + cash = CHAR_getInt( meindex, CHAR_GOLD); + bank = CHAR_getInt( meindex, CHAR_BANKGOLD); + if( ((cash - toBank) >= 0) && ((cash - toBank) <= MaxGold ) + &&((bank + toBank) >= 0)&&((bank + toBank) <= CHAR_MAXBANKGOLDHAVE) ) { + // shan add + if( toBank > 0 && CHAR_getInt( meindex, CHAR_FMINDEX ) < 1 ) { + sprintf(buf, "Ǹûмκμ壬Խȡ"); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + return; + } + + CHAR_setInt( meindex, CHAR_GOLD, cash - toBank); + CHAR_setInt( meindex, CHAR_BANKGOLD, bank + toBank); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_GOLD); + + if( toBank >= 0 ) { + sprintf(buf, "%dиʻ", toBank); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + // Syu ADD дȡLog () + LogFamilyBankStone( + CHAR_getChar( meindex, CHAR_NAME ), + CHAR_getChar( meindex, CHAR_CDKEY ), + toBank, + CHAR_getInt( meindex, CHAR_GOLD ), + "myBank()()", + CHAR_getInt( meindex,CHAR_FLOOR), + CHAR_getInt( meindex,CHAR_X ), + CHAR_getInt( meindex,CHAR_Y ), + CHAR_getInt( meindex,CHAR_BANKGOLD) + ); + + } + else { + sprintf(buf, "Ӽиʻȡ%d", -toBank); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + // Syu ADD дȡLog () + LogFamilyBankStone( + CHAR_getChar( meindex, CHAR_NAME ), + CHAR_getChar( meindex, CHAR_CDKEY ), + toBank, + CHAR_getInt( meindex, CHAR_GOLD ), + "myBank()()", + CHAR_getInt( meindex,CHAR_FLOOR), + CHAR_getInt( meindex,CHAR_X ), + CHAR_getInt( meindex,CHAR_Y ), + CHAR_getInt( meindex,CHAR_BANKGOLD) + ); + + } + // Syu ADD дȡLog () + LogStone( + -1, + CHAR_getChar( meindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( meindex, CHAR_CDKEY ), /* ǡID */ + -toBank, /* ź */ + CHAR_getInt( meindex, CHAR_GOLD ), + "myBank()", + CHAR_getInt( meindex,CHAR_FLOOR), + CHAR_getInt( meindex,CHAR_X ), + CHAR_getInt( meindex,CHAR_Y ) + ); + + } + else + print(" bank_error "); + + } + if( strcmp(token, "I" )==0 ) { + + } + if( strcmp(token, "T" )==0 ) { + int toTax; + int mygold; + int FMindex; + + if (getStringFromIndexWithDelim(message, "|", 3, token2, sizeof(token)) == FALSE) + return; + toTax = atoi( token2 ); + +#ifdef _FMVER21 + if( CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_LEADER && + CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_ELDER && toTax < 0 ) + return; +#endif + + + FMindex = CHAR_getWorkInt( meindex, CHAR_WORKFMINDEXI ); + mygold = CHAR_getInt( meindex, CHAR_GOLD); + if( mygold < 0 || mygold > MaxGold || toTax == 0 ) return; + if( toTax > 0 ) {//+ + if( ((mygold-toTax) < 0) || (familyTax[ FMindex] + toTax) > CHAR_MAXFMBANKGOLDHAVE ) { + return; + } + }else if( toTax < 0 ){ //-ȡ + if( ((mygold-toTax)>MaxGold) || (familyTax[ FMindex] + toTax) < 0 ) { + return; + } + } + + + if( toTax>0 ) { //Ԥȿۿ + CHAR_setInt( meindex, CHAR_GOLD, CHAR_getInt( meindex, CHAR_GOLD)-toTax ); + } + sprintf( buf, "%s....", (toTax>0)?"":"ȡ"); + CHAR_talkToCli( meindex , -1, buf, CHAR_COLORYELLOW); + + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_GOLD); + sprintf( buf, "%d", toTax ); + + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), FM_FIX_FMGOLD, buf, + "", CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), CONNECT_getFdid(fd)); + //print(" getTax:%s=%d ", CHAR_getChar(meindex, CHAR_FMNAME), toTax ); + } +} + +void ACFMPointList(int ret, char *data) +{ +} + +#ifdef _ADD_FAMILY_TAX // WON ADD ׯ԰˰ +// GS ʱ AC Ҫׯ԰˰ +void GS_ASK_TAX(void) +{ + saacproto_GS_ASK_TAX_send(acfd); +} + +// ׯ԰峤޸˰ +void FAMILY_FIX_TAX( int fd, int index, char* message) +{ + int fmpointindex=0, tax=0, fmindex=-1, i; + char token[256]; + char pointbuf[256]; + +// extern struct FM_POINTLIST fmpointlist; // ݵ + // жʸ + if (!CHAR_CHECKINDEX(index)) return; + + if ((CHAR_getInt(index, CHAR_FMINDEX) == -1) + || (strcmp(CHAR_getChar(index, CHAR_FMNAME), "") == 0) +#ifdef _FMVER21 + || (CHAR_getInt(index, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER)) +#else + || (CHAR_getInt(index, CHAR_FMLEADERFLAG) != 1)) +#endif + { + return; + } + + // + fmindex = CHAR_getInt(index, CHAR_FMINDEX); + + // ǷΪׯ԰ļ + for( i=0 ; i= fmdplevelexp[i]){ + fmlevel = i; + } + } + for (i = 1; i <= MANORNUM; i++) { + if (((strcmp(fmpks[i * MAX_SCHEDULE + 1].guest_name, + CHAR_getChar(meindex, CHAR_FMNAME)) == 0)) + && ((fmpks[i * MAX_SCHEDULE + 1].flag = FMPKS_FLAG_MANOR_BATTLEBEGIN) + || (fmpks[i * MAX_SCHEDULE + 1].flag == FMPKS_FLAG_MANOR_PREPARE))){ + char tmpbuf[256]; + sprintf(tmpbuf, "\n%sѾԤԼׯ԰ˡ\n޷ׯ԰ร", + fmpks[i * MAX_SCHEDULE + 1].host_name); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString(tmpbuf, buf, sizeof(buf))); + return; + } + } + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + fmpointindex = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 3, token, + sizeof(token)) == FALSE) return; + fl = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 4, token, + sizeof(token)) == FALSE) return; + x = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 5, token, + sizeof(token)) == FALSE) return; + y = atoi(token); +/* + print("SetFMPoint charname:%s fmindex:%d index:%d pointindex:%d fl:%d x:%d y:%d\n", + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), + fmpointindex, fl, x, y); +*/ + saacproto_ACSetFMPoint_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), + fmpointindex, fl, x, y, CONNECT_getFdid(fd)); +} + +void ACSetFMPoint(int ret, int r, int clifd) +{ + int meindex = CONNECT_getCharaindex(clifd); + char message[256], buf[512]; + + if (!CHAR_CHECKINDEX(meindex)) return; + + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + if (ret == 0){ + if (r == -1) + sprintf(message, "ʧܣ"); + else if (r == -2) + sprintf(message, "Ѿмݵˡظ룡"); + else if (r == -3) + sprintf(message, "δݵʸ"); + else if (r == -4) + sprintf(message, "ݵѾмʹޣ"); + else if (r == -5) + sprintf(message, "ļδ׼ࡣ"); + } + else if (ret == 1) + sprintf(message, "ݵϣˣ"); + + lssproto_WN_send( clifd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString(message, buf, sizeof(buf))); +} + +void ACFMAnnounce(int ret, char *fmname, int fmindex, int index, + int kindflag, char *data, int color) +{ + // kindflag 1:峤㲥 2:ϵͳ屻ɾ 3:ϵͳ֪ͨѶϢ + int i, chindex; + if( ret != 1 ) return; +// print("fmname:%s fmindex:%d index:%d kindflag:%d data:%s color:%d\n", +// fmname, fmindex, index, kindflag, data, color); + for( i=0; i < FAMILY_MAXMEMBER; i++) + { + chindex = familyMemberIndex[index][i]; + if( chindex >= 0 ) { + if( CHAR_getCharUse(chindex) ) + { + if (kindflag == 1) + { +#ifdef _FMVER21 + // shan 2001/12/13 + //if( CHAR_getInt( chindex, CHAR_FMLEADERFLAG ) == FMMEMBER_MEMBER ) + if( CHAR_getInt( chindex, CHAR_FMLEADERFLAG ) == FMMEMBER_MEMBER || + CHAR_getInt( chindex, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER ) +#else + if( CHAR_getInt( chindex, CHAR_FMLEADERFLAG ) == 2 ) +#endif + CHAR_talkToCli( chindex, -1, data, color ); + } + else if (kindflag == 2) + { + int fd = getfdFromCharaIndex( chindex ); + if (fd == -1) return; + SetFMVarInit( chindex ); + CHAR_talkToCli( chindex , -1, "ļ֮ûյԱԱȽɢˣ", + CHAR_COLORRED); + } + }else + familyMemberIndex[index][i] = -1; + } + } + if (kindflag == 3) + { + int meindex = 0; + int clifd = getfdFromFdid(color); + if (CONNECT_checkfd(clifd) == FALSE) return; + meindex = CONNECT_getCharaindex(clifd); + if (!CHAR_CHECKINDEX(meindex)) return; + CHAR_talkToCli(meindex, -1, data, CHAR_COLORRED); + if(strstr(data,"Ѿļ룡")!=NULL){ + + }else if(strstr(data,"Ѿ߳ˣ")!=NULL){ + CHAR_setInt( meindex , CHAR_RIDEPET, -1 ); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , CHAR_getInt( meindex , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_RIDEPET); +#ifdef _FM_METAMO + CHAR_ReMetamo(meindex); +#endif + } + } + if (kindflag == 4) + { + int meindex = 0; + char buf[1024]; + int clifd = getfdFromFdid(color); +// print("Here1\n"); + if (CONNECT_checkfd(clifd) == FALSE) return; + meindex = CONNECT_getCharaindex(clifd); + if (!CHAR_CHECKINDEX(meindex)) return; +// print("Here2\n"); + lssproto_WN_send(clifd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString(data, buf, sizeof(buf))); + } +} + +void FAMILY_SetAcceptFlag(int fd, int meindex, char *message) +{ + int result; + char token[128], buf[1024]; + + if (!CHAR_CHECKINDEX(meindex)) return; + + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + + if ((CHAR_getInt(meindex, CHAR_FMINDEX) == -1) + || (strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") == 0) +#ifdef _FMVER21 +// || ((CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) +// && (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_ELDER) +// && (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_VICELEADER))) + || ((CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) + && (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_ELDER))) +#else + || (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1)) +#endif + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n㲻峤û޸ĵȨࡣ", buf, sizeof(buf))); + return; + } + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + result = atoi(token); + if ((result == 0) || (result == 1)) + { + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), FM_FIX_ACCEPTFLAG, + token, "", CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + } +} + +void FAMILY_FixRule( int fd, int meindex, char* message ) +{ + + char token[1024], buf[1024]; + + if (!CHAR_CHECKINDEX(meindex))return; + + if ((CHAR_getInt(meindex, CHAR_FMINDEX) == -1) + || (strcmp(CHAR_getChar(meindex, CHAR_FMNAME), "") == 0) +#ifdef _FMVER21 + || (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER)) +#else + || (CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1)) +#endif + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\n㲻峤û޸ĵȨࡣ", buf, sizeof(buf))); + return; + } + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return; + + if( strcmp( token, "R") == 0 ) + { + if (getStringFromIndexWithDelim(message, "|", 3, buf, + sizeof( buf ) ) == FALSE)return; + + if (strcmp( buf, "") == 0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nּΪհࡣ", buf, sizeof(buf))); + return; + } + +// print(" new_rule:%s ", buf); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), FM_FIX_FMRULE, + buf, "", CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + return; + } + if( strcmp( token, "P") == 0 ) + { + int havepetindex, petindex, i; + char petname[20], petattr[512]; + + // Ƿػ + for( i =0; i< CHAR_MAXPETHAVE; i++ ) + { + int petindex = CHAR_getCharPet(meindex, i); + if (!CHAR_CHECKINDEX(petindex)) continue; + if( CHAR_getInt( petindex , CHAR_PETFAMILY ) ==1 ) + { +// lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, +// WINDOW_BUTTONTYPE_OK, +// -1, -1, +// makeEscapeString( "\nԭػ޻ࡡ", buf, sizeof(buf))); +// return; + CHAR_setInt( petindex , CHAR_PETFAMILY,0 ); + } + } + // Ƿػ(ij) + for( i =0; i< CHAR_MAXPOOLPETHAVE; i++ ) + { + int petindex = CHAR_getCharPoolPet(meindex, i); + if (!CHAR_CHECKINDEX(petindex)) continue; + if( CHAR_getInt( petindex , CHAR_PETFAMILY ) ==1 ) + { +// lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, +// WINDOW_BUTTONTYPE_OK, +// -1, -1, +// makeEscapeString( "\nԭػ޻ࡡ", buf, sizeof(buf))); +// return; + CHAR_setInt( petindex , CHAR_PETFAMILY,0 ); + } + } + + if (getStringFromIndexWithDelim(message, "|", 3, buf, + sizeof( buf ) ) == FALSE) return; + havepetindex = atoi( buf ); + + petindex = CHAR_getCharPet(meindex, havepetindex); + + if (!CHAR_CHECKINDEX(petindex)) return; + + if (strlen(CHAR_getChar(petindex, CHAR_USERPETNAME)) == 0) + sprintf(petname, "%s", CHAR_getChar(petindex, CHAR_NAME)); + else + sprintf(petname, "%s", CHAR_getChar(petindex, CHAR_USERPETNAME)); + sprintf(petattr, "%d %d %d %d", + CHAR_getInt(petindex, CHAR_BASEIMAGENUMBER), + CHAR_getWorkInt(petindex, CHAR_WORKATTACKPOWER), + CHAR_getWorkInt(petindex, CHAR_WORKDEFENCEPOWER), + CHAR_getWorkInt(petindex, CHAR_WORKQUICK)); + + CHAR_setInt(petindex, CHAR_PETFAMILY, 1); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), FM_FIX_FMPET, + petname, petattr, CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + return; + + } + +} + +void JoinMemberIndex( int meindex, int fmindexi ) +{ + int i; + + for( i = 0 ; i < FAMILY_MAXMEMBER; i++){ + if( familyMemberIndex[fmindexi][i] == meindex ) familyMemberIndex[fmindexi][i] = -1; + } + + for( i = 0 ; i < FAMILY_MAXMEMBER; i++){ + if( familyMemberIndex[fmindexi][i] < 0 ){ + familyMemberIndex[fmindexi][i] = meindex; + break; + } + } +#ifdef _CHANNEL_MODIFY + i = 0; + // ɵƵ¼ + while(i < FAMILY_MAXMEMBER){ + if(channelMember[fmindexi][0][i] == meindex){ + channelMember[fmindexi][0][i] = -1; + } + i++; + } + i = 0; + // Ƶ + while(i < FAMILY_MAXMEMBER){ + if(channelMember[fmindexi][0][i] == -1){ + channelMember[fmindexi][0][i] = meindex; + CHAR_setWorkInt(meindex,CHAR_WORKFMCHANNEL,0); + break; + } + i++; + } +#endif +} + +void LeaveMemberIndex( int meindex, int fmindexi ) +{ + int i; + + for( i = 0 ; i < FAMILY_MAXMEMBER; i++){ + if( familyMemberIndex[fmindexi][i] == meindex ) familyMemberIndex[fmindexi][i] = -1; + } +#ifdef _CHANNEL_MODIFY + i = 0; + // ɵƵ¼ + while(i < FAMILY_MAXMEMBER){ + if(channelMember[fmindexi][0][i] == meindex){ + channelMember[fmindexi][0][i] = -1; + } + i++; + } +#endif +} + +int FAMILY_RidePet( int fd, int meindex, char* message ) +{ + //print("...1111\n"); + char token[64], token2[64]; + int petindex, rideGraNo = 0, leaderimageNo; + // Arminius 8.25 recover + int i; +#ifndef _NEW_RIDEPETS + int big4fm = 0; +#endif + if (!CHAR_CHECKINDEX(meindex))return 0; + + // Robin fix սв + if( CHAR_getWorkInt( meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) + { + CHAR_talkToCli( meindex, -1, "սв裡", CHAR_COLORYELLOW ); + return 0; + } + // Robin fix в + if( CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE){ + CHAR_talkToCli( meindex, -1, "в裡", CHAR_COLORYELLOW ); + return 0; + } +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( meindex, CHAR_BECOMEPIG) > -1 ){ //״̬ + CHAR_setInt( meindex, CHAR_RIDEPET, -1 ); + //ѡ״̬ȻΪ"", + CHAR_complianceParameter( meindex ); + CHAR_send_P_StatusString( meindex, CHAR_P_STRING_RIDEPET); + CHAR_talkToCli( meindex, -1, "Ŀǰ㴦״̬˳", CHAR_COLORYELLOW ); + return 0; + } +#endif + if (getStringFromIndexWithDelim(message, "|", 2, token, sizeof(token)) == FALSE) return 0; + if( strcmp( token, "P") == 0) { + if (getStringFromIndexWithDelim(message, "|", 3, token2, sizeof(token2)) == FALSE) + return 0; + if( atoi(token2) != -1 ) { + petindex = CHAR_getCharPet( meindex, atoi( token2 ) ); + if(!CHAR_CHECKINDEX(petindex))return; + + if( CHAR_getInt( meindex, CHAR_DEFAULTPET ) == atoi( token2 ) ) return 0; + if( CHAR_getInt( meindex, CHAR_RIDEPET) != -1 ) return 0; +#ifdef _PET_BUG + if(CHAR_getInt( petindex, CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100) + { + CHAR_talkToCli( meindex, -1, "óԹߣ޷ˡ", CHAR_COLORYELLOW ); + return 0; + } +#endif +#ifdef _NOT_PETRIDE + if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")){ + CHAR_talkToCli(meindex, -1, "˳޷ˡ", CHAR_COLORRED); + return 0; + } +#endif + if( CHAR_getInt( meindex, CHAR_LEARNRIDE) < CHAR_getInt( petindex, CHAR_LV ) ) + { + char buff[255]; + sprintf(buff,"Ŀǰֻ˵ȼС%dij衣",CHAR_getInt( meindex, CHAR_LEARNRIDE)); + CHAR_talkToCli( meindex, -1, buff, CHAR_COLORYELLOW ); + return 0; + } + if( CHAR_getWorkInt( petindex, CHAR_WORKFIXAI ) < 100 ) + { + CHAR_talkToCli( meindex, -1, "С100", CHAR_COLORYELLOW ); + return 0; + } +#ifdef _RIDELEVEL + if( CHAR_getInt( meindex, CHAR_LV)+getRideLevel() < CHAR_getInt( petindex, CHAR_LV ) ) + { + char buff[255]; + sprintf(buff,"ֻȼ%dij衣",getRideLevel()); + CHAR_talkToCli( meindex, -1, buff, CHAR_COLORYELLOW ); + return 0; + } +#else + if( CHAR_getInt( meindex, CHAR_LV)+5 < CHAR_getInt( petindex, CHAR_LV ) ) return 0; +#endif +#ifdef _PET_2TRANS + if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION) > 2 ) return 0; + if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION) > getPetRideTrans()) return 0; +#endif +#ifdef _RIDEBUG + if(CHAR_getInt(meindex, CHAR_DEFAULTPET) == petindex ){//ս + return 0; + } +#endif +#ifdef _CAX_PET_ITEMRIDE + if( getpetitemride() == 0 ){ + + { + int iindex = 0 ; + for(;iindex < CHAR_PETITEMNUM; iindex++){ + if(CHAR_getItemIndex(petindex,iindex) != -1){ + char buff[255]; + sprintf(buff,"װ!"); + CHAR_talkToCli( meindex, -1, buff, CHAR_COLORYELLOW ); + return 0; + } + } + } + } +#endif +#ifdef _ALLBLUES_LUA_1_6 + if(FamilyRideFunction(meindex, petindex, atoi( token2 )) != FALSE){ + return 1; + } +#endif + leaderimageNo = 100700 + + ((CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER)-100000)/20)*10 + + CHAR_getInt( meindex, CHAR_FMSPRITE)*5; + // Arminius 8.25 recover + for( i=0; i< arraysizeof(ridePetTable) ; i++ ){ +#ifdef _NEW_RIDEPETS + if( (( CHAR_getInt( meindex, CHAR_BASEIMAGENUMBER) == ridePetTable[i].charNo ) || + ( CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].charNo )) +#else + if( ( CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].charNo ) +#endif + && ( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].petNo ) ){ + rideGraNo = ridePetTable[i].rideNo; + break; + } +#ifndef _NEW_RIDEPETS + if( ( leaderimageNo == ridePetTable[i].charNo ) + && ( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].petNo ) +#ifdef _EVERYONE_RIDE + && big4fm != 0 + && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_NONE + && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY ) +#else + && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ) +#endif + { + rideGraNo = ridePetTable[i].rideNo; + break; + } +#endif + } + +#ifdef _NEW_RIDEPETS + if( rideGraNo == 0 ) { + int ti=-1, index, image=-1; + int petNo = CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER); + int playerNo = CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER); + int playerlowsride = CHAR_getInt( meindex, CHAR_LOWRIDEPETS); + +#ifdef _RIDE_CF + int playerlowsride1 = CHAR_getInt( meindex, CHAR_LOWRIDEPETS1); + int playerhighride2 = CHAR_getInt( meindex, CHAR_HIGHRIDEPETS2); + //print( ",Ϣ:lowride = %d, lowride1 = %d, highride1 = %d, highride2 = %d. \n", playerlowsride, playerlowsride1, playerhighsride1, playerhighsride2 ); + + if( (ti = RIDEPET_getPETindex( petNo, playerlowsride, playerlowsride1, playerhighride2 )) >= 0 ) + //if( (ti = RIDEPET_getPETindex( petNo, playerlowsride, NULL, NULL )) >= 0 ) +#else + if( (ti = RIDEPET_getPETindex( petNo, playerlowsride )) >= 0 ) +#endif + { + if( (index = RIDEPET_getNOindex( playerNo)) >= 0 ){ + if( (image = RIDEPET_getRIDEno( index,ti)) >= 0 ) { + rideGraNo = image; + //print("...1111, 222 rideGraNo= %d\n", image); + } + } + } + } +#endif + if( rideGraNo != 0 ){ +#ifdef _ITEM_METAMO + // CHAR_setWorkInt( meindex, CHAR_WORKITEMMETAMO, 0); +#endif + //print("...1111, 222, 333 rideGraNo= %d, ridepet = %s\n", rideGraNo, token2); + CHAR_setInt( meindex , CHAR_RIDEPET, atoi( token2 ) ); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , rideGraNo ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex, CHAR_P_STRING_RIDEPET ); + return 1; + }else{ + int floor = CHAR_getWorkInt( meindex, CHAR_WORKFMFLOOR); + if( floor !=-1 && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_NONE + && CHAR_getInt( meindex, CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY){ +#ifdef _FM_LEADER_RIDE + if(CHAR_FmLeaderRide( meindex, atoi( token2 )))return 1; +#endif +#ifdef _RIDEMODE_20 + if(getRideMode()>0){ + int ti=-1, index, image=-1; + int petNo = CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER); + int playerNo = CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER); + int petindex = CHAR_getCharPet( meindex, atoi( token2 )); + if(getRideMode()==1 || getRideMode()==2 ){ + if(floor == 1041 || floor == 2031 || floor == 3031 || floor == 4031 + || floor == 5031 || floor == 6031 || floor == 7031 + || floor == 8031 || floor == 9031 || floor == 10031){ + if( CHAR_getInt( meindex, CHAR_FMSPRITE ) == 0){ + if(petNo==100372){ +#ifdef _RIDE_CF + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET8, 0, 0 )) >= 0 ) +#else + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET8 )) >= 0 ) +#endif + { + if( (index = RIDEPET_getNOindex( playerNo)) >= 0 ){ + if( (image = RIDEPET_getRIDEno( index,ti)) >= 0 ){ + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , image ); + } + } + } + } + }else if( CHAR_getInt( meindex, CHAR_FMSPRITE ) == 1){ + if(petNo==100373){ +#ifdef _RIDE_CF + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET9, 0, 0 )) >= 0 ) +#else + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET9 )) >= 0 ) +#endif + { + if( (index = RIDEPET_getNOindex( playerNo)) >= 0 ){ + if( (image = RIDEPET_getRIDEno( index,ti)) >= 0 ){ + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , image ); + } + } + } + } + } + } + }else{ +#ifdef _RIDE_CF + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET_ALL, 0, 0 )) >= 0 ) +#else + if( (ti = RIDEPET_getPETindex( petNo, RIDE_PET_ALL )) >= 0 ) +#endif + { + if( (index = RIDEPET_getNOindex( playerNo)) >= 0 ){ + if( (image = RIDEPET_getRIDEno( index,ti)) >= 0 ){ + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , image ); + } + } + } + } + if(image!=-1){ + CHAR_setInt( meindex , CHAR_RIDEPET, atoi( token2 ) ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex, CHAR_P_STRING_RIDEPET ); + return 1; + } + } +#endif + } +#ifdef _ITEM_RIDE + { + int itemindex = CHAR_getItemIndex( meindex, 0 ); + if(!ITEM_CHECKINDEX(itemindex)) return 0; + if( !strcmp( ITEM_getChar( itemindex, ITEM_USEFUNC), "ITEM_RIDE") ) { + char petmetamo[12],ridemetamo[12]; + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + getStringFromIndexWithDelim( itemarg, "|", 1, petmetamo, sizeof(petmetamo)); + getStringFromIndexWithDelim( itemarg, "|", 2, ridemetamo, sizeof(ridemetamo)); + int metamo= CHAR_getInt( petindex , CHAR_BASEIMAGENUMBER); + if(metamo==atoi(petmetamo)){ + //print("...ûԭ1111, 222, 333 , ridemetamo = %d, ridepet = %s \n", ridemetamo, token2); + CHAR_setInt( meindex , CHAR_RIDEPET, atoi( token2 ) ); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , atoi( ridemetamo ) ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex, CHAR_P_STRING_RIDEPET ); + return 1; + } + } + } +#endif + } + }else { //ԭ basebaseimage + //print("...ûԭ1111, 222, 333 \n"); + CHAR_setInt( meindex , CHAR_RIDEPET, -1 ); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , CHAR_getInt( meindex , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( meindex , CHAR_P_STRING_RIDEPET); + } + } + return 0; +} + +void ACFixFMPK(int winindex, int loseindex, int data) +{ + int i = 0, charindex = 0; + char msg1[256], msg2[256]; + + sprintf(msg1, "ϲ%8d㣡", (data / 100)); + sprintf(msg2, "%8d㣡", (data / 100)); + for (i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex = familyMemberIndex[winindex][i]; + if( charindex >= 0 ) { + if( CHAR_getCharUse(charindex) ) + CHAR_talkToCli( charindex , -1, msg1, CHAR_COLORYELLOW); + else + familyMemberIndex[winindex][i] = -1; + } + charindex = familyMemberIndex[loseindex][i]; + if( charindex >= 0 ) { + if( CHAR_getCharUse(charindex) ) + CHAR_talkToCli( charindex , -1, msg2, CHAR_COLORRED); + else + familyMemberIndex[loseindex][i] = -1; + } + } +} + +void getNewFMList() +{ + saacproto_ACShowFMList_send( acfd ); +} + +//int channelMember[FAMILY_MAXNUM][FAMILY_MAXCHANNEL][FAMILY_MAXMEMBER]; +//int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; + +void checkFamilyIndex( void ) +{ + int i, j, k, charaindex, err1=0, err2=0; +// print(" checkFamilyIndex! "); + + for( i=0; i 0 ){ + if( fmindex_wk < 0 || fmindex_wk >= FAMILY_MAXNUM){ + print("FamilyNumber Data Error!!"); + return; + } + } + saacproto_ACShowMemberList_send( acfd, fmindex_wk); + + sprintf( sendbuf, " ֪\nСĴԱϣһ޸޷ظԭ̬Сġ"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_FM_MESSAGE2, + CHAR_getWorkInt( leaderdengonindex, CHAR_WORKOBJINDEX), + makeEscapeString( sendbuf, buf, sizeof(buf))); + } + if( strcmp( token, "L") == 0 ){ + int i, kind, letterNo = 0; + char subtoken[256]; + +#ifdef _FMVER21 +// if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER && +// CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_INVITE && +// CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_VICELEADER) return; + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER && + CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_ELDER ) return; +#else + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1) return; +#endif + + if (getStringFromIndexWithDelim(message, "|", 3, token2, + sizeof(token2)) == FALSE) return; + kind = atoi( token2 ); + + for( i=0 ; i= getfamekoufei()*100 ){ + CHAR_setInt( meindex, CHAR_FAME, CHAR_getInt(meindex, CHAR_FAME) - getfamekoufei()*100 ); +#endif + CHAR_setItemIndex( meindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, meindex); + CHAR_sendItemDataOne( meindex, emptyitemindexinchara); +#ifdef _CAX_FAME_KOUFEI + if ( getfamekoufei() > 0 ){ + snprintf( buf, sizeof( buf), "%sɹ۳%dʷѣ",ITEM_getChar( itemindex, ITEM_NAME),getfamekoufei()); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); + }else{ +#endif + snprintf( buf, sizeof( buf), "%sɹ",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORWHITE); +#ifdef _CAX_FAME_KOUFEI + } + }else{ + CHAR_talkToCli( meindex, -1, "Ŷ", CHAR_COLORYELLOW ); + return; + } +#endif + } +} + if( strcmp( token, "CHANGE") == 0 ){ + int fmindexi, j, num=0; + char subbuf[2048], sendbuf[2048]; + + if (getStringFromIndexWithDelim(message, "|", 3, token2, + sizeof(token2)) == FALSE) return; + + fmindexi = CHAR_getWorkInt( meindex, CHAR_WORKFMINDEXI ); + + // Ҫ峤ѡб + if( strcmp( token2, "L") == 0 ){ + char subsub[128]; + +#ifdef _FMVER21 + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) return; +#else + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1) return; +#endif + + strcpy( subbuf, ""); + for( j = 0 ; j < FAMILY_MAXMEMBER ; j++ ) { + int tempindex = familyMemberIndex[fmindexi][j]; + + // CoolFish: 2001/9/22 + if (!CHAR_CHECKINDEX(tempindex)) continue; + + if (CheckLeaderQ(tempindex) >= 0 && tempindex != meindex ) + { + char tmpbuf[1024]; + sprintf(tmpbuf, "%s", CHAR_getChar(tempindex, CHAR_NAME)); + makeEscapeString( tmpbuf, buf, sizeof(buf)); + sprintf( subsub, "|%d|%s", j, buf ); + strcat( subbuf, subsub ); + num++; + } + } + sprintf( sendbuf, "L|CHANGE|L|%d%s", num, subbuf ); + //lssproto_FM_send( fd, sendbuf); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_LEADERSELECT, + WINDOW_BUTTONTYPE_OK, + -1, -1, + sendbuf ); + + } + // ѯ峤ѡǷԸ + if( strcmp( token2, "Q") == 0 ) + { + char token3[64], token4[64]; + int toindex; + +#ifdef _FMVER21 + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) return; +#else + if( CHAR_getInt(meindex, CHAR_FMLEADERFLAG) != 1) return; +#endif + if (getStringFromIndexWithDelim(message, "|", 4, token3, + sizeof(token3)) == FALSE)return; + if (getStringFromIndexWithDelim(message, "|", 5, token4, + sizeof(token4)) == FALSE)return; + makeStringFromEscaped( token4 ); + + if( atoi(token3) < 0 || atoi(token3) > FAMILY_MAXMEMBER ) return; + + toindex = familyMemberIndex[fmindexi][atoi(token3)]; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( strcmp( token4, CHAR_getChar( toindex, CHAR_NAME)) != 0 ) return; + if( CheckLeaderQ(toindex) < 0 ) return; + + // ˫λʱCHAR_WORKLEADERCHANGEŶԷcharaindex + CHAR_setWorkInt( toindex, CHAR_WORKLEADERCHANGE, meindex); + CHAR_setWorkInt( meindex, CHAR_WORKLEADERCHANGE, toindex); + + sprintf( sendbuf, "%s|%d", makeEscapeString( CHAR_getChar( meindex, CHAR_NAME ), buf, sizeof(buf)), meindex ); + + lssproto_WN_send( CHAR_getWorkInt( toindex, CHAR_WORKFD ), WINDOW_MESSAGETYPE_LEADERSELECTA, + WINDOW_BUTTONTYPE_OK, + -1, -1, + sendbuf ); + + } + // ѡ˵Ĵ + if( strcmp( token2, "A") == 0 ) + { + int leaderindex, answerflag; + char leadername[64], token3[64], token4[64]; + +// print( "%s", message ); + + if (getStringFromIndexWithDelim(message, "|", 4, token3, + sizeof(token3)) == FALSE) return; + answerflag = atoi( token3 ); + + if (getStringFromIndexWithDelim(message, "|", 5, leadername, + sizeof( leadername )) == FALSE)return; + makeStringFromEscaped( leadername ); + + if (getStringFromIndexWithDelim(message, "|", 6, token4, + sizeof(token4)) == FALSE)return; + + //if( atoi(token4) < 0 || atoi(token4) > FAMILY_MAXMEMBER ) return; + + leaderindex = atoi( token4 ); + + // ˫CHAR_WORKLEADERCHANGEǷ + if( CHAR_getWorkInt( meindex, CHAR_WORKLEADERCHANGE ) != leaderindex ) return; + if( !CHAR_CHECKINDEX(leaderindex) ) return; + if( strcmp( leadername, CHAR_getChar( leaderindex, CHAR_NAME) ) != 0 ) return; + if( CHAR_getWorkInt( leaderindex, CHAR_WORKLEADERCHANGE ) != meindex ) return; + CHAR_setWorkInt( leaderindex, CHAR_WORKLEADERCHANGE, -1 ); +#ifdef _FMVER21 + if( CHAR_getInt(leaderindex, CHAR_FMLEADERFLAG ) != FMMEMBER_LEADER ) return; +#else + if( CHAR_getInt(leaderindex, CHAR_FMLEADERFLAG ) != 1 ) return; +#endif + if( CHAR_getInt(meindex, CHAR_FMINDEX) != CHAR_getInt(leaderindex, CHAR_FMINDEX) ) return; + + if( answerflag == 0 ) + { + CHAR_setWorkInt( meindex, CHAR_WORKLEADERCHANGE, 0); + CHAR_setWorkInt( leaderindex, CHAR_WORKLEADERCHANGE, 0); + lssproto_WN_send( CHAR_getWorkInt( leaderindex, CHAR_WORKFD) , WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nԲ𣡶ԷԸܣ", buf, sizeof(buf)) ); + return; + } + + if( answerflag == 1 ) + { + char tmpbuf[1024]; + sprintf( buf, "%d", CHAR_getInt( meindex, CHAR_FACEIMAGENUMBER ) ); + // CoolFish: add charname 2001/9/27 + sprintf( tmpbuf, "%s", CHAR_getChar( meindex, CHAR_NAME ) ); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(meindex, CHAR_FMNAME), + CHAR_getInt(meindex, CHAR_FMINDEX), + CHAR_getWorkInt(meindex, CHAR_WORKFMINDEXI), FM_FIX_FMLEADERCHANGE , buf, + tmpbuf, CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), CONNECT_getFdid(fd)); + // "", CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX), CONNECT_getFdid(fd)); + return; + } + } + } +} + +void ACFMJob( int fd, int ret, char* data1, char* data2 ) +{ + + int charaindex = CONNECT_getCharaindex( fd ); + if( !CHAR_CHECKINDEX(charaindex) ) return; + + + if( 1 ){ + + int leaderindex = CHAR_getWorkInt( charaindex, CHAR_WORKLEADERCHANGE ); + char buf[256], buf2[256]; + + CHAR_setWorkInt( charaindex, CHAR_WORKLEADERCHANGE, 0 ); + print("leaderindex:%d:%s\n", leaderindex,CHAR_getChar(leaderindex,CHAR_NAME) ); + + if( !CHAR_CHECKINDEX(leaderindex) ) return; + //if( CHAR_getWorkInt( leaderindex, CHAR_WORKLEADERCHANGE ) != charaindex ) return; + CHAR_setWorkInt( leaderindex, CHAR_WORKLEADERCHANGE, 0 ); + + if( ret == 0 ){ + CHAR_talkToCli( charaindex, -1, "峤λʧܣ", CHAR_COLORYELLOW ); + CHAR_talkToCli( leaderindex, -1, "峤λʧܣ", CHAR_COLORYELLOW ); + return; + } + + // Robin 10/02 debug + if( CHAR_getInt( leaderindex, CHAR_FMINDEX) != CHAR_getInt( charaindex, CHAR_FMINDEX) +#ifdef _FMVER21 + // || CHAR_getInt( leaderindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER ) +#else + // || CHAR_getInt( leaderindex, CHAR_FMLEADERFLAG) != 1 +#endif + ) + { + sprintf( buf, "leaderindex:%d:%s\n", leaderindex, CHAR_getChar( leaderindex, CHAR_NAME) ); + LogFamily( + CHAR_getChar(charaindex, CHAR_FMNAME), + CHAR_getInt(charaindex, CHAR_FMINDEX), + CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), + "LEADERCHANGE_ERROR(峤λʧ)", + buf + ); + return; + } + + //CHAR_setInt( leaderindex, CHAR_FMLEADERFLAG, FMMEMBER_MEMBER); + //CHAR_setInt( charaindex, CHAR_FMLEADERFLAG, FMMEMBER_LEADER); + SetFMPetVarInit( leaderindex ); + SetFMPetVarInit( charaindex ); + CHAR_sendStatusString( leaderindex, "F"); + CHAR_sendStatusString( charaindex, "F"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( "\nϲ㣡Ѿε峤ˡ\núõŬɣ\nˡǵȵ峤ҵļԱѡ\nµļػޣ彫ᱻɢࡣ", buf, sizeof(buf))); + + sprintf( buf2, "\nˣѾ峤λӽ%sˡ", CHAR_getChar( charaindex, CHAR_NAME) ); + lssproto_WN_send( CHAR_getWorkInt( leaderindex, CHAR_WORKFD) , WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString( buf2, buf, sizeof(buf))); + +// print(" LeaderChange!! [%s]->[%s] ", CHAR_getChar(leaderindex, CHAR_CDKEY), CHAR_getChar(charaindex, CHAR_CDKEY) ); + + sprintf( buf, "%s\t%s\t%s", + CHAR_getChar(leaderindex, CHAR_FMNAME), + CHAR_getChar(leaderindex, CHAR_NAME), + CHAR_getChar(leaderindex, CHAR_CDKEY) + ); + + LogFamily( + CHAR_getChar(charaindex, CHAR_FMNAME), + CHAR_getInt(charaindex, CHAR_FMINDEX), + CHAR_getChar(charaindex, CHAR_NAME), + CHAR_getChar(charaindex, CHAR_CDKEY), + "LEADERCHANGE(峤λ)", + buf); + } +} + +#ifdef _CAX_LNS_CHARSUOXU +int Char_GetFm( int id, int x) +{ + + int fd = getfdFromCharaIndex( id); + if (x == 1) //ü + return fmdptop.fmMomentum[id]; + + else if (x == 2)//üfmtopdp + return fmdptop.fmtopdp[id]; + else if (x == 3)//üʽ + { + //saacproto_ACGetFMData_send( fd, CHAR_getChar( id, CHAR_FMNAME), + //CHAR_getInt( id, CHAR_FMINDEX ), + //CHAR_getWorkInt( id, CHAR_WORKFMINDEXI ), + //1, + //CONNECT_getFdid(fd) + //); + return familyTax[CHAR_getWorkInt( id, CHAR_WORKFMINDEXI )]; + } +} + +char * FM_getManorData(int ManorId,int Flg) +{ + char *pointbuf = ""; + if( getStringFromIndexWithDelim(fmpointlist.pointlistarray[ManorId], "|", Flg, pointbuf, sizeof(pointbuf)) == FALSE ) return -1; + return pointbuf; +} +#endif diff --git a/char/ls2data.h b/char/ls2data.h new file mode 100644 index 0000000..54e06f7 --- /dev/null +++ b/char/ls2data.h @@ -0,0 +1,13 @@ +#ifndef LS2DATA_DAT +#define LS2DATA_DAT + +typedef struct { + int hash; + char *name; + int graphicnumber; +} CconvertStringNumber; + +CconvertStringNumber *convertStringNumber; +int cconvertStringNumber; + +#endif // LS2DATA_DAT ///:~ diff --git a/char/makefile b/char/makefile new file mode 100644 index 0000000..8cb0764 --- /dev/null +++ b/char/makefile @@ -0,0 +1,1226 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libchar.a + +SRC=char_base.c char.c char_event.c char_data.c skill.c title.c\ +addressbook.c chatmagic.c event.c char_walk.c encount.c pet.c \ +enemy.c pet_event.c char_talk.c char_party.c char_item.c deathcontend.c \ +chatroom.c petmail.c trade.c family.c defend.c char_angel.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +char_base.o: char_base.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/buf.h ../include/magic.h ../include/function.h \ + ../include/npccreate.h ../include/configfile.h ../include/title.h \ + ../include/pet.h ../include/pet_skill.h ../include/anim_tbl.h \ + ../include/enemy.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/log.h \ + ../include/mylua/function.h +char.o: char.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/ctype.h ../include/net.h \ + ../include/common.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h ../include/lua.h ../include/luaconf.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/char.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/item.h ../include/item_event.h \ + ../include/buf.h ../include/object.h ../include/map_deal.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/handletime.h ../include/char_event.h \ + ../include/npccreate.h ../include/addressbook.h ../include/magic_base.h \ + ../include/magic.h ../include/chatmagic.h ../include/configfile.h \ + ../include/log.h ../include/anim_tbl.h ../include/encount.h \ + ../include/battle.h ../include/pet_skill.h ../include/util.h \ + ../include/enemy.h ../include/npcutil.h ../include/pet.h \ + ../include/family.h ../include/defend.h ../include/correct_bug.h \ + ../include/npc_checkman.h ../include/profession_skill.h \ + ../include/chatroom.h ../include/mylua/function.h +char_event.o: char_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/item_event.h ../include/net.h ../include/item.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/util.h ../include/char_data.h \ + ../include/readmap.h ../include/map_deal.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npccreate.h \ + ../include/handletime.h ../include/anim_tbl.h ../include/family.h +char_data.o: char_data.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/readmap.h ../include/common.h \ + ../include/util.h ../include/common.h ../include/util.h \ + ../include/anim_tbl.h ../include/battle.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/buf.h ../include/item.h \ + ../include/log.h ../include/pet.h ../include/enemy.h \ + ../include/char_base.h ../include/configfile.h defaultPlayer.h \ + ../ls2data.dat ../include/family.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +skill.o: skill.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/battle.h ../include/profession_skill.h +title.o: title.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/title.h ../include/common.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/item.h ../include/skill.h \ + ../include/buf.h ../include/util.h ../include/configfile.h +addressbook.o: addressbook.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/addressbook.h \ + ../include/common.h ../include/util.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/handletime.h ../include/buf.h ../include/net.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/object.h ../include/battle.h ../include/configfile.h \ + ../include/npcutil.h ../include/pet.h ../include/petmail.h \ + ../include/log.h +chatmagic.o: chatmagic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/malloc.h ../include/common.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/util.h ../include/buf.h ../include/npcutil.h \ + ../include/char_base.h ../include/object.h ../include/char_data.h \ + ../include/handletime.h ../include/chatmagic.h ../include/configfile.h \ + ../include/readmap.h ../include/map_deal.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h ../include/battle.h \ + ../include/pet.h ../include/enemy.h ../include/encount.h \ + ../include/magic_base.h ../include/magic.h ../include/pet_skill.h \ + ../include/pet_event.h ../include/item_gen.h ../include/mclient.h \ + ../include/npc_eventaction.h ../include/map_warppoint.h \ + ../include/npc_manorsman.h ../include/net.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_scheduleman.h \ + ../include/trade.h ../include/npccreate.h ../include/profession_skill.h \ + ../include/char_talk.h ../include/family.h ../include/petmail.h \ + ../include/npc_autopk.h ../include/mylua/ablua.h ../include/item.h \ + ../include/sasql.h +event.o: event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/readmap.h \ + ../include/map_warppoint.h ../include/event.h ../include/npc_warp.h \ + ../include/npc_npcenemy.h +char_walk.o: char_walk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/handletime.h ../include/common.h \ + ../include/object.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_event.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/readmap.h ../include/map_deal.h ../include/npccreate.h \ + ../include/encount.h ../include/npcutil.h ../include/battle.h \ + ../include/net.h ../include/configfile.h ../include/npc_npcenemy.h \ + ../include/mylua/function.h +encount.o: encount.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/common.h ../include/util.h \ + ../include/common.h ../include/buf.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/encount.h ../include/enemy.h +pet.o: pet.c ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/object.h \ + ../include/readmap.h ../include/map_deal.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h ../include/pet.h \ + ../include/battle.h ../include/petmail.h ../include/log.h \ + ../include/function.h ../include/pet_skill.h +enemy.o: enemy.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/util.h ../include/common.h ../include/buf.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/encount.h ../include/enemy.h ../include/pet.h \ + ../include/enemyexptbl.h ../include/petmail.h ../include/battle.h \ + ../include/pet_skillinfo.h ../include/anim_tbl.h ../include/log.h \ + ../include/npcutil.h +pet_event.o: pet_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/handletime.h ../include/pet_event.h ../include/npcutil.h \ + ../include/log.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_exchangeman.h ../include/npc_eventaction.h \ + ../include/mylua/function.h +char_talk.o: char_talk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/handletime.h ../include/common.h ../include/readmap.h \ + ../include/util.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_talk.h ../include/chatmagic.h \ + ../include/battle.h ../include/log.h ../include/configfile.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/family.h ../include/profession_skill.h \ + ../include/mylua/function.h ../include/net.h +char_party.o: char_party.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/readmap.h \ + ../include/common.h ../include/util.h ../include/object.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/npc_bus.h \ + ../include/npc_airplane.h ../include/family.h ../include/init.h \ + ../include/mylua/function.h +char_item.o: char_item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/configfile.h \ + ../include/common.h ../include/readmap.h ../include/util.h \ + ../include/map_deal.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/item.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h ../include/log.h \ + ../include/item_event.h ../include/battle.h ../include/petmail.h \ + ../include/mylua/function.h +deathcontend.o: deathcontend.c +chatroom.o: chatroom.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/chatmagic.h ../include/battle.h \ + ../include/log.h ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/family.h ../include/chatroom.h \ + ../include/net.h ../include/util.h +petmail.o: petmail.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/configfile.h \ + ../include/common.h ../include/buf.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/battle.h \ + ../include/handletime.h ../include/map_deal.h ../include/addressbook.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h ../include/pet.h \ + ../include/petmail.h ../include/npcutil.h ../include/log.h +trade.o: trade.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/correct_bug.h \ + /usr/include/ctype.h ../include/readmap.h ../include/common.h \ + ../include/util.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/trade.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/magic_base.h ../include/pet_skill.h +family.o: family.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h ../include/family.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/npc_scheduleman.h \ + ../include/npc_fmdengon.h ../include/mylua/function.h +defend.o: defend.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h ../include/family.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/npc_scheduleman.h ../include/defend.h +char_angel.o: char_angel.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/ctype.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h ../include/item.h \ + ../include/item_event.h ../include/buf.h ../include/object.h \ + ../include/map_deal.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h \ + ../include/handletime.h ../include/char_event.h ../include/npccreate.h \ + ../include/addressbook.h ../include/magic_base.h ../include/magic.h \ + ../include/chatmagic.h ../include/configfile.h ../include/log.h \ + ../include/anim_tbl.h ../include/encount.h ../include/battle.h \ + ../include/pet_skill.h ../include/util.h ../include/enemy.h \ + ../include/npcutil.h ../include/pet.h ../include/family.h diff --git a/char/makefile.bak b/char/makefile.bak new file mode 100644 index 0000000..8cb0764 --- /dev/null +++ b/char/makefile.bak @@ -0,0 +1,1226 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libchar.a + +SRC=char_base.c char.c char_event.c char_data.c skill.c title.c\ +addressbook.c chatmagic.c event.c char_walk.c encount.c pet.c \ +enemy.c pet_event.c char_talk.c char_party.c char_item.c deathcontend.c \ +chatroom.c petmail.c trade.c family.c defend.c char_angel.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +char_base.o: char_base.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/buf.h ../include/magic.h ../include/function.h \ + ../include/npccreate.h ../include/configfile.h ../include/title.h \ + ../include/pet.h ../include/pet_skill.h ../include/anim_tbl.h \ + ../include/enemy.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/log.h \ + ../include/mylua/function.h +char.o: char.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/ctype.h ../include/net.h \ + ../include/common.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h ../include/lua.h ../include/luaconf.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/char.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/item.h ../include/item_event.h \ + ../include/buf.h ../include/object.h ../include/map_deal.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/handletime.h ../include/char_event.h \ + ../include/npccreate.h ../include/addressbook.h ../include/magic_base.h \ + ../include/magic.h ../include/chatmagic.h ../include/configfile.h \ + ../include/log.h ../include/anim_tbl.h ../include/encount.h \ + ../include/battle.h ../include/pet_skill.h ../include/util.h \ + ../include/enemy.h ../include/npcutil.h ../include/pet.h \ + ../include/family.h ../include/defend.h ../include/correct_bug.h \ + ../include/npc_checkman.h ../include/profession_skill.h \ + ../include/chatroom.h ../include/mylua/function.h +char_event.o: char_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/item_event.h ../include/net.h ../include/item.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/util.h ../include/char_data.h \ + ../include/readmap.h ../include/map_deal.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npccreate.h \ + ../include/handletime.h ../include/anim_tbl.h ../include/family.h +char_data.o: char_data.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/readmap.h ../include/common.h \ + ../include/util.h ../include/common.h ../include/util.h \ + ../include/anim_tbl.h ../include/battle.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/buf.h ../include/item.h \ + ../include/log.h ../include/pet.h ../include/enemy.h \ + ../include/char_base.h ../include/configfile.h defaultPlayer.h \ + ../ls2data.dat ../include/family.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +skill.o: skill.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/battle.h ../include/profession_skill.h +title.o: title.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/title.h ../include/common.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/item.h ../include/skill.h \ + ../include/buf.h ../include/util.h ../include/configfile.h +addressbook.o: addressbook.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/addressbook.h \ + ../include/common.h ../include/util.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/handletime.h ../include/buf.h ../include/net.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/object.h ../include/battle.h ../include/configfile.h \ + ../include/npcutil.h ../include/pet.h ../include/petmail.h \ + ../include/log.h +chatmagic.o: chatmagic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + /usr/include/malloc.h ../include/common.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/util.h ../include/buf.h ../include/npcutil.h \ + ../include/char_base.h ../include/object.h ../include/char_data.h \ + ../include/handletime.h ../include/chatmagic.h ../include/configfile.h \ + ../include/readmap.h ../include/map_deal.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h ../include/battle.h \ + ../include/pet.h ../include/enemy.h ../include/encount.h \ + ../include/magic_base.h ../include/magic.h ../include/pet_skill.h \ + ../include/pet_event.h ../include/item_gen.h ../include/mclient.h \ + ../include/npc_eventaction.h ../include/map_warppoint.h \ + ../include/npc_manorsman.h ../include/net.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_scheduleman.h \ + ../include/trade.h ../include/npccreate.h ../include/profession_skill.h \ + ../include/char_talk.h ../include/family.h ../include/petmail.h \ + ../include/npc_autopk.h ../include/mylua/ablua.h ../include/item.h \ + ../include/sasql.h +event.o: event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/readmap.h \ + ../include/map_warppoint.h ../include/event.h ../include/npc_warp.h \ + ../include/npc_npcenemy.h +char_walk.o: char_walk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/handletime.h ../include/common.h \ + ../include/object.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_event.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/readmap.h ../include/map_deal.h ../include/npccreate.h \ + ../include/encount.h ../include/npcutil.h ../include/battle.h \ + ../include/net.h ../include/configfile.h ../include/npc_npcenemy.h \ + ../include/mylua/function.h +encount.o: encount.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/common.h ../include/util.h \ + ../include/common.h ../include/buf.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/encount.h ../include/enemy.h +pet.o: pet.c ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/object.h \ + ../include/readmap.h ../include/map_deal.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h ../include/pet.h \ + ../include/battle.h ../include/petmail.h ../include/log.h \ + ../include/function.h ../include/pet_skill.h +enemy.o: enemy.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/util.h ../include/common.h ../include/buf.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/encount.h ../include/enemy.h ../include/pet.h \ + ../include/enemyexptbl.h ../include/petmail.h ../include/battle.h \ + ../include/pet_skillinfo.h ../include/anim_tbl.h ../include/log.h \ + ../include/npcutil.h +pet_event.o: pet_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/configfile.h \ + ../include/handletime.h ../include/pet_event.h ../include/npcutil.h \ + ../include/log.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_exchangeman.h ../include/npc_eventaction.h \ + ../include/mylua/function.h +char_talk.o: char_talk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/handletime.h ../include/common.h ../include/readmap.h \ + ../include/util.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_talk.h ../include/chatmagic.h \ + ../include/battle.h ../include/log.h ../include/configfile.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/family.h ../include/profession_skill.h \ + ../include/mylua/function.h ../include/net.h +char_party.o: char_party.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/readmap.h \ + ../include/common.h ../include/util.h ../include/object.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/battle.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/npc_bus.h \ + ../include/npc_airplane.h ../include/family.h ../include/init.h \ + ../include/mylua/function.h +char_item.o: char_item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/configfile.h \ + ../include/common.h ../include/readmap.h ../include/util.h \ + ../include/map_deal.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/item.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h ../include/log.h \ + ../include/item_event.h ../include/battle.h ../include/petmail.h \ + ../include/mylua/function.h +deathcontend.o: deathcontend.c +chatroom.o: chatroom.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/chatmagic.h ../include/battle.h \ + ../include/log.h ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/family.h ../include/chatroom.h \ + ../include/net.h ../include/util.h +petmail.o: petmail.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/configfile.h \ + ../include/common.h ../include/buf.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/battle.h \ + ../include/handletime.h ../include/map_deal.h ../include/addressbook.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h ../include/pet.h \ + ../include/petmail.h ../include/npcutil.h ../include/log.h +trade.o: trade.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/correct_bug.h \ + /usr/include/ctype.h ../include/readmap.h ../include/common.h \ + ../include/util.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/trade.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/magic_base.h ../include/pet_skill.h +family.o: family.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h ../include/family.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/npc_scheduleman.h \ + ../include/npc_fmdengon.h ../include/mylua/function.h +defend.o: defend.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/object.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h ../include/family.h \ + ../include/log.h ../include/handletime.h ../include/buf.h \ + ../include/net.h ../include/battle.h ../include/npc_bus.h \ + ../include/char_talk.h ../include/npc_scheduleman.h ../include/defend.h +char_angel.o: char_angel.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/ctype.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h ../include/item.h \ + ../include/item_event.h ../include/buf.h ../include/object.h \ + ../include/map_deal.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h \ + ../include/handletime.h ../include/char_event.h ../include/npccreate.h \ + ../include/addressbook.h ../include/magic_base.h ../include/magic.h \ + ../include/chatmagic.h ../include/configfile.h ../include/log.h \ + ../include/anim_tbl.h ../include/encount.h ../include/battle.h \ + ../include/pet_skill.h ../include/util.h ../include/enemy.h \ + ../include/npcutil.h ../include/pet.h ../include/family.h diff --git a/char/pet.c b/char/pet.c new file mode 100644 index 0000000..355edb0 --- /dev/null +++ b/char/pet.c @@ -0,0 +1,1157 @@ +#include "version.h" +#include + +#include "char_base.h" +#include "char.h" +#include "object.h" +#include "readmap.h" +#include "map_deal.h" +#include "lssproto_serv.h" +#include "handletime.h" +#include "pet.h" +#include "battle.h" +#include "petmail.h" +#include "log.h" +#include "function.h" +#include "pet_skill.h" + + +/* + * ʸ ĩ + */ +/*------------------------------------------------------------------------ + * ʸë๴Ի񲻯£۷ã + * CHARհ 弰ľ£ + * Իľƽҷindex -1 + *-----------------------------------------------------------------------*/ +char hanzibuf[5000][8] = {"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","߶","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","¡","¢","£","¥","§","©","¶","«","¯","²","³","½","¼","¹","","µ","·","¿","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","æ","â","ä","ã","è","ë","ì","é","ï","ð","ó","ñ","ò","ô","û","ü","÷","ú","ù","ÿ", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ģ","Ĥ","Ħ", +"ĥ","ħ","Ĩ","ĩ","ĭ","Ī","Į","ī","Ĭ","ı","ij","ĸ","Ķ","ľ","Ŀ","","Ĺ","Ļ","Ľ","ĺ","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","ţ","Ť","Ŧ","ũ","Ũ","Ū","ū","Ŭ","ŭ","Ů","ů","Ų","ŷ","ż","","ſ","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","Ƥ","ƣ","Ƣ","ƥ","Ƨ","Ƭ","ƫ","ƪ","ƭ","Ư","Ʈ","Ʊ","Ʋ","ƴ","ƶ","Ʒ","ƹ","ƽ","","ƾ", +"ƻ","ƿ","Ƽ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ǡ","Ǣ", +"ǧ","Ǩ","ǣ","Ǧ","ǫ","ǩ","ǰ","Ǯ","ǯ","DZ","dz","Dz","Ƿ","Ǹ","ǹ","ǻ","ǿ","ǽ","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","ȡ","ȥ","Ȥ","Ȧ","ȫ","Ȩ","Ȫ","ȭ","Ȯ","Ȱ","ȯ","ȱ","ȴ","ȸ","ȷ","ȵ","ȹ","Ⱥ","Ȼ","ȼ","Ⱦ","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ɡ","ɢ","ɣ","ɤ", +"ɥ","ɨ","ɩ","ɫ","ɭ","ɱ","ɳ","ɴ","ɵ","ɸ","ɹ","ɽ","ɾ","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","ʤ","","ʡ","ʥ","ʢ","ʣ","ʬ","ʧ","ʦ","ʫ","ʩ","ʨ","ʪ","ʮ","ʲ","ʯ","ʱ","ʶ","ʵ","ʰ","ʴ","ʳ","ʷ","ʹ","ʼ", +"ʻ","ʿ","","","","ʾ","ʽ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","ˢ","ˣ","˥","ˤ","˦","˧","˩","˫","˪","ˬ","˭","ˮ","˰","˯","˳","˵","","˿","˾","˽","˼","˹","˺","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","̤","̨","̧","̫","̬","̩","̰","̯","̲","̳", +"̸","̵","̹","̺","̾","̿","̽","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","ͤ","ͥ","ͣ","ͦ","ͧ","ͨ","ͬ","ͩ","ͭ","ͯ","ͳ","Ͱ","Ͳ","ʹ","͵","ͷ","Ͷ","͸","ͺ","ͻ","ͼ","ͽ","Ϳ",";","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Σ","","΢","Ϊ","Χ","Υ", +"Ψ","ά","ΰ","α","β","ί","","δ","λ","ζ","η","θ","ι","ο","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","Ϧ","","","ϣ","","Ϣ","","Ϥ","ϧ","ϡ","Ϫ","","Ϩ","ϥ","ϰ","ϯ","Ϯ","ϴ","ϲ","Ϸ","ϵ","ϸ","϶","Ϻ","Ϲ","Ͽ","","ϼ","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Щ","Ъ","Э","а","в","б","Я","Ь","д", +"й","к","ж","м","е","л","","","","","н","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","ѡ","Ѩ","ѧ","ѩ","Ѫ","Ѱ","Ѳ","Ѯ","ѯ","ѭ","","","","","С","","Т","Ч","У","Ц","ѵ","Ѷ","Ѹ","ѹ","ѽ","Ѻ","ѻ","Ѽ","","ѿ","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","Ҥ","ҥ","ҡ","ң","ҧ","ҩ","Ҫ","Կ","","","Ծ","Խ","","","","","","ҫ","ү","Ҳ","ұ","Ұ","ҵ","Ҷ","ҳ","ҹ","Һ","һ","","ҽ","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","ӡ","Ӧ","Ӣ","ӣ","ӥ","ӭ","ӯ","Ӫ","Ӭ","Ӯ","Ӱ","ӳ","Ӳ","Ӷ", +"ӵ","ӹ","","ӽ","Ӿ","","ӿ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","ԡ","Ԥ","","","","ԣ","","","","ԩ","Ԫ","Ա","԰","ԭ","Բ","Ԯ","Ե","Դ","Զ","Թ","Ժ","Ը","Լ","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","բ","գ","ը","ե","ժ","լ","խ","ծ","կ","մ","ճ","ն","չ","յ","ո","ռ","ս","վ","","","","", +"","","","","","","","","","","","","","צ","ר","ש","ת","׬","ׯ","װ","׳","״","ײ","","","","","","","","","","","","","","","","","","", +"","","","","","","֤","֣","","֢","֮","֧","֭","֥","֦","֪","֯","֫","֬","֩","ִ","ֶ","ֱ","ֵ","ְ","ֲ","ֳ","ֹ","ֻ","ּ","ַ","ֽ","ָ","","־","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ס","","ע","פ","","ף","","","","ץ", +"׷","׼","׽","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","߶","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","¡","¢","£","¥","§","©","¶", +"«","¯","²","³","½","¼","¹","","µ","·","¿","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","æ","â","ä","ã","è","ë","ì","é","ï","ð","ó","ñ","ò","ô","û","ü","÷","ú","ù","ÿ","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","ģ","Ĥ","Ħ","ĥ","ħ","Ĩ","ĩ","ĭ","Ī","Į","ī","Ĭ","ı","ij", +"ĸ","Ķ","ľ","Ŀ","","Ĺ","Ļ","Ľ","ĺ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","ţ","Ť","Ŧ","ũ","Ũ","Ū","ū","Ŭ","ŭ","Ů","ů","Ų","ŷ","ż","","ſ","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","Ƥ","ƣ","Ƣ","ƥ","Ƨ","Ƭ","ƫ","ƪ","ƭ","Ư","Ʈ","Ʊ","Ʋ","ƴ","ƶ","Ʒ","ƹ","ƽ","","ƾ","ƻ","ƿ","Ƽ","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","ǡ","Ǣ","ǧ","Ǩ","ǣ","Ǧ","ǫ","ǩ","ǰ","Ǯ","ǯ","DZ","dz", +"Dz","Ƿ","Ǹ","ǹ","ǻ","ǿ","ǽ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","ȡ","ȥ","Ȥ","Ȧ","ȫ","Ȩ","Ȫ","ȭ","Ȯ","Ȱ","ȯ","ȱ","ȴ","ȸ","ȷ","ȵ","ȹ","Ⱥ","Ȼ","ȼ","Ⱦ","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","ɡ","ɢ","ɣ","ɤ","ɥ","ɨ","ɩ","ɫ","ɭ","ɱ","ɳ","ɴ","ɵ","ɸ","ɹ", +"ɽ","ɾ","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","ʤ","","ʡ","ʥ","ʢ","ʣ","ʬ","ʧ","ʦ","ʫ","ʩ","ʨ","ʪ","ʮ","ʲ","ʯ","ʱ","ʶ","ʵ","ʰ","ʴ","ʳ","ʷ","ʹ","ʼ","ʻ","ʿ","","","","ʾ","ʽ","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","ˢ","ˣ","˥","ˤ","˦","˧","˩","˫","˪","ˬ","˭","ˮ","˰","˯","˳","˵","","˿","˾","˽","˼","˹","˺","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","̤","̨","̧","̫","̬","̩","̰","̯","̲","̳","̸","̵","̹","̺","̾","̿","̽","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"ͤ","ͥ","ͣ","ͦ","ͧ","ͨ","ͬ","ͩ","ͭ","ͯ","ͳ","Ͱ","Ͳ","ʹ","͵","ͷ","Ͷ","͸","ͺ","ͻ","ͼ","ͽ","Ϳ",";","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","Σ","","΢","Ϊ","Χ","Υ","Ψ","ά","ΰ","α","β","ί","","δ","λ","ζ","η", +"θ","ι","ο","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Ϧ","","","ϣ","","Ϣ","", +"Ϥ","ϧ","ϡ","Ϫ","","Ϩ","ϥ","ϰ","ϯ","Ϯ","ϴ","ϲ","Ϸ","ϵ","ϸ","϶","Ϻ","Ϲ","Ͽ","","ϼ","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","С","","Т","Ч","У","Ц","Щ","Ъ","Э","а","в","б","Я","Ь","д","й", +"к","ж","м","е","л","","","","","н","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","ѡ","Ѩ","ѧ","ѩ","Ѫ","Ѱ","Ѳ","Ѯ","ѯ","ѭ","ѵ","Ѷ","Ѹ","ѹ","ѽ","Ѻ","ѻ","Ѽ","","ѿ","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","", +"Ҥ","ҥ","ҡ","ң","ҧ","ҩ","Ҫ","ҫ","ү","Ҳ","ұ","Ұ","ҵ","Ҷ","ҳ","ҹ","Һ","һ","","ҽ","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","ӡ","Ӧ","Ӣ","ӣ","ӥ","ӭ","ӯ","Ӫ","Ӭ","Ӯ","Ӱ","ӳ","Ӳ","Ӷ","ӵ","ӹ","","ӽ","Ӿ","","ӿ","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","ԡ","Ԥ","","","","ԣ","","","","ԩ", +"Ԫ","Ա","԰","ԭ","Բ","Ԯ","Ե","Դ","Զ","Թ","Ժ","Ը","Լ","","Կ","","","Ծ","Խ","","","","","","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","բ","գ","ը","ե","ժ","լ","խ","ծ","կ","մ","ճ","ն","չ","յ","ո","ռ","ս","վ","","","","","", +"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","֤","֣","","֢","֮", +"֧","֭","֥","֦","֪","֯","֫","֬","֩","ִ","ֶ","ֱ","ֵ","ְ","ֲ","ֳ","ֹ","ֻ","ּ","ַ","ֽ","ָ","","־","","","","","","","","","","","","","","","","","", +"","","","","","","","","","","","","","","","","","","","","ס","","ע","פ","","ף","","","","ץ","צ","ר","ש","ת","׬","ׯ","װ","׳","״","ײ","׷", +"׼","׽","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""}; + +int PET_DEBUG_initPetOne( int charaindex) +{ + Char ch; + int havepetindex; + int index; + /* ʸë ¾Ʃ */ + havepetindex = CHAR_getCharPetElement( charaindex) ; + + memset( &ch, 0, sizeof( ch)); + if( !CHAR_getDefaultChar( &ch,31010 ) )return -1; + + /* į */ + ch.data[CHAR_BASEBASEIMAGENUMBER] + = ch.data[CHAR_BASEIMAGENUMBER] = 30008; + ch.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + /* */ + ch.workint[CHAR_WORKATTACKPOWER] = 100; + /* */ + ch.workint[CHAR_WORKDEFENCEPOWER] = 50; + /* HP */ + ch.data[CHAR_HP] = 100; + /* */ + strcpysafe( ch.string[CHAR_NAME].string, 32, "" ); + + /* CHARԻ񲻯 */ + index = PET_initCharOneArray( &ch); + + if( index < 0 ) return -1; + + /* DZб */ + CHAR_setWorkInt( index, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setWorkInt( index,CHAR_WORKOBJINDEX,-1); + CHAR_setCharPet( charaindex, havepetindex, index); + CHAR_setInt( index, CHAR_SLOT, 2); + return havepetindex; +} + +static int _PET_dropPet( int charaindex, int havepetindex, int tofl, int tox, int toy) +{ + char szPet[128]; + int dirx[9],diry[9]; + int i, j; + int objindex=-1; + int floor,x,y; + int petindex; + int count_chara =0, count_item =0; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return FALSE; + petindex = CHAR_getCharPet(charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return FALSE; + if( !CHAR_CHECKINDEX( charaindex ) )return FALSE; + if( CHAR_CHECKINDEX( petindex) == FALSE ) return FALSE; + +#ifdef _AVID_TRADETRYBUG // + if( CHAR_getWorkInt( charaindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_TRADING ){ + CHAR_talkToCli( charaindex, -1, "״̬޷", CHAR_COLORYELLOW ); + return FALSE; + } +#endif + // CoolFish: Family 2001/6/13 + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(charaindex, -1, "ػ޷", CHAR_COLORYELLOW); + return FALSE; + } + if (CHAR_getInt(charaindex, CHAR_RIDEPET) == havepetindex ){ + CHAR_talkToCli(charaindex, -1, "еij޷", CHAR_COLORYELLOW); + return FALSE; + } + + if( strlen(CHAR_getChar(petindex,CHAR_USERPETNAME))>0 && strstr(CHAR_getChar(petindex,CHAR_USERPETNAME),"*")!=NULL ){ + CHAR_talkToCli(charaindex, -1, "Զк(*)޷ꡢס̯޸ĺ", CHAR_COLORYELLOW); + return FALSE; + } + +#ifdef _DROPCHECK2 + + floor = CHAR_getInt( charaindex, CHAR_FLOOR); + x = CHAR_getInt( charaindex, CHAR_X); + y = CHAR_getInt( charaindex, CHAR_Y); + + for( i = x-CHAR_DEFAULTSEESIZ/2 ; i <= x+CHAR_DEFAULTSEESIZ/2 ; i++ ){ + for( j = y-CHAR_DEFAULTSEESIZ/2 ; j <= y+CHAR_DEFAULTSEESIZ/2 ; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj(floor,i,j); object ; object = NEXT_OBJECT(object ) ) { + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + count_chara++; + } + if( OBJECT_getType(objindex) == OBJTYPE_ITEM || OBJECT_getType(objindex) == OBJTYPE_GOLD ) { + count_item++; + } + } + } + if( count_item > 80 || count_chara > 80 ) { + CHAR_talkToCli( charaindex, -1, "Ѿ̫ӵˣٶˡ", CHAR_COLORYELLOW ); + return FALSE; + } + } + +#endif + if( tofl == -1 ) { + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + diry[i+2] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + floor = CHAR_getInt( charaindex,CHAR_FLOOR ); + for( i = 0 ; i < 9 ; i ++ ){ + int x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + int y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + if( PET_isPutPoint( floor, x, y ) == TRUE ) { + break; + } + } + if( i == 9 ) i = 1; + x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + }else { + if( MAP_walkAbleFromPoint( tofl,tox,toy, FALSE ) == FALSE ) { + print( "map walkable err %s:%d\n", __FILE__,__LINE__); + return FALSE; + } + floor = tofl; + x = tox; + y = toy; + } + objindex = PET_dropPetAbsolute( petindex,floor,x,y, FALSE ); + if( objindex == -1 ) return FALSE; + + CHAR_setWorkInt( petindex,CHAR_WORKOBJINDEX,objindex ); + CHAR_setCharPet( charaindex, havepetindex, -1); + CHAR_setInt( petindex, CHAR_FLOOR, floor); + CHAR_setInt( petindex, CHAR_X, x); + CHAR_setInt( petindex, CHAR_Y, y); + CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); + if( havepetindex == CHAR_getInt( charaindex, CHAR_DEFAULTPET)) { + int fd; + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + fd = getfdFromCharaIndex( charaindex); + lssproto_KS_send( fd, havepetindex, 0); + + } + CHAR_sendCToArroundCharacter( objindex); + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { +#ifdef _PET_ITEM + CHAR_sendPetItemEmpty(charaindex,havepetindex); +#endif + snprintf( szPet, sizeof( szPet ), "K%d", havepetindex ); + CHAR_sendStatusString( charaindex, szPet ); + } + return TRUE; +} + + +/*------------------------------------------------------------ + * ʸë + * ¦ + * itemindex int ʧ ة̼͵ + * floor int ׷ʧID + * x int x + * y int y + * net BOOL ͼë¾ + * ߯Ի + * objindex + * -1 + ------------------------------------------------------------*/ +int PET_dropPetAbsolute( int petindex, int floor, int x, int y,BOOL net) +{ + Object object; + int objindex; + + if( !CHAR_CHECKINDEX(petindex) )return FALSE; + + object.type = OBJTYPE_CHARA; + object.index = petindex; + object.x = x; + object.y = y; + object.floor = floor; + + /* Ƥ */ + objindex = initObjectOne( &object ); + + /* Ͱ׷º뻥Ȼ巴 by ringo*/ + if( net ) + CHAR_sendWatchEvent( objindex,CHAR_ACTSTAND,NULL,0,TRUE); + + return objindex; +} + +BOOL PET_isPutPoint( int fl,int x, int y) +{ + OBJECT object; + if( MAP_walkAbleFromPoint( fl,x,y, FALSE ) == FALSE ) + return FALSE; + for( object=MAP_getTopObj(fl,x,y) ; + object ; + object = NEXT_OBJECT(object ) ) + { + int objindex = GET_OBJINDEX(object); + switch( OBJECT_getType(objindex) ){ + case OBJTYPE_NOUSE: + break; + case OBJTYPE_ITEM: + case OBJTYPE_GOLD: + case OBJTYPE_CHARA: + return FALSE; + break; + default: + break; + } + } + return TRUE; +} + +int PET_dropPet( int charaindex, int havepetindex) +{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(charaindex); + return; + } + int petindex; + petindex = CHAR_getCharPet(charaindex,havepetindex); + if( !CHAR_CHECKINDEX( petindex )) return FALSE; +#ifdef _PET_AMOI__E + //if( PET_NOT_DropTradeStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID)) || + // PET_NOT_Drop == EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID)) ){ + if( (PET_NOT_DROP) & EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID))){ + char buf[256]; + sprintf( buf, "%s޷!~",CHAR_getChar( petindex, CHAR_NAME) ); + CHAR_talkToCli(charaindex,-1,buf,CHAR_COLORRED); + return FALSE; + } +#endif +#ifdef _PETSKILL_BINDING + int i,skillid=-1,skillarray; + for(i=0;i<7;i++){ + skillid=CHAR_getPetSkill(petindex,i); + skillarray = PETSKILL_getPetskillArray( skillid); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if(strstr(PETSKILL_getChar( skillarray, PETSKILL_NAME),"")){ + CHAR_talkToCli(charaindex, -1, "˳Ϊ󶨳޷", CHAR_COLORRED); + return; + } + } +#endif +#ifdef _PET_BINDING + if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*") || strstr(CHAR_getChar(petindex,CHAR_NAME),"+")){ + CHAR_talkToCli(charaindex, -1, "˳Ϊ󶨳޷", CHAR_COLORRED); + return; + } +#endif +#ifdef _MM_NO_JIAOBEN + if(getNoMMJiaoben()==1){ + if(CHAR_getInt(petindex,CHAR_PETID)==718 || CHAR_getInt( petindex, CHAR_PETID) == 401){ + if(getMmType()==0){ + CHAR_talkToCli(charaindex, -1, getMmMsg(), CHAR_COLORRED); + return; + } + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(charaindex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + return 0; + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + return 0; + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + return 0; + randtime = atoi(tempbuff); + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); + return 0; + } + } + } +// if(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME)>=getEditBaseTime()) +// CHAR_setWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME,timep); +// else{ +// char errbuf[256]; +// sprintf(errbuf,"%dſԼ˲",getEditBaseTime()-(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME))); +// CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); +// return; +// } + int fd = getfdFromCharaIndex( charaindex); + char arg[255]; + char buf[128]; + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","",""}; + char chengbuf[][5]={"","*","x","X","","",""}; + char numbuf[][5]={"","","","","","","","","",""}; + int i,j,k,l,m; + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; +// if(randtype == 0){ +// randtype = RAND(1,10); +// if(randtype<=5){ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=1; +// else randtype=2; +// }else{ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=3; +// else randtype=4; +// } +// } + randtype = 4; + if(randtype==1){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else{ + typebuf=jianbuf[l-1]; + k = i-j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + sprintf(arg,"%d|%d",havepetindex,k); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"ʽĽ(%s%s%s=?)",ibuf,typebuf,jbuf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND1_DROPMM, + -1, + buf); + }else if(randtype==2){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else if(m==2){ + typebuf=jianbuf[l-1]; + k = i-j; + }else{ + typebuf=chengbuf[l-1]; + k = i*j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + int n; + int randnum1; + char tempret[5][32]; + randnum1 = RAND(1,5); + int randnumbuf[4]; + int tmpi=0; + while(tmpi<100){ + randnumbuf[0] = RAND(1,100); + randnumbuf[1] = RAND(1,100); + randnumbuf[2] = RAND(1,100); + randnumbuf[3] = RAND(1,100); + if(randnumbuf[0]!=randnumbuf[1]!=randnumbuf[2]!=randnumbuf[3]!=k){ + break; + } + tmpi++; + } + tmpi=0; + for(n=1;n<=5;n++){ + if(n==randnum1){ + sprintf(tempret[n-1],"%d",k); + }else if(tmpi<4){ + sprintf(tempret[n-1],"%d",randnumbuf[tmpi]); + tmpi++; + } + } + sprintf(arg,"%d|%d",havepetindex,randnum1); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"3\nѡʽĽ(%s%s%s=?)\n \n \nѡһ%s\nѡ%s\nѡ%s\nѡģ%s\nѡ壺%s\n",ibuf,typebuf,jbuf,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND2_DROPMM, + -1, + buf); + }else if(randtype==3){ + sprintf(arg,"%s",sasql_rand_buf()); + if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randquestion,tempbuf); + if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randrightanswer,tempbuf); + sprintf(arg,"%d|%s",havepetindex,randrightanswer); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"%s:",randquestion); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND3_DROPMM, + -1, + buf); + }else{ +// sprintf(arg,"%s",sasql_rand_buf()); +// if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; +// if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randquestion,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randrightanswer,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 3, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer1,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 4, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer2,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 5, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer3,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 6, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer4,tempbuf); + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬ飩",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + //char *tempbuff2 = "ABCDE"; + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + if(selecttype<=30){ + sprintf(arg,"%d|%d|%d",havepetindex,rightnum); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(arg,"%d|%d|%d",havepetindex,randnum1); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND4_DROPMM, + -1, + buf); + CHAR_setWorkInt(charaindex,CHAR_WORKLUANPCINT,0); + } + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(charaindex,CHAR_RANDTYPE,tempbuff); + return 0; + } +} +#endif + if( _PET_dropPet( charaindex, havepetindex, -1,-1,-1) == TRUE ){ + char tmpbuf[256]; + sprintf(tmpbuf," %s (ʧʱ%d)",CHAR_getChar( petindex, CHAR_NAME),getPetdeletetime()); + CHAR_talkToCli( charaindex, -1, tmpbuf, CHAR_COLORYELLOW ); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "Drop()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + return 1; + } + return 0; +} + +int PET_dropPetFLXY( int charaindex, int havepetindex, int fl, int x, int y) +{ + return _PET_dropPet( charaindex, havepetindex, fl,x,y); +} + +/*------------------------------------------------------------ + * ʸüìëƻ֧ + ------------------------------------------------------------*/ +int PET_initCharOneArray( Char *ch) +{ + int i; + char *tmp[CHAR_FUNCTABLENUM] = { + "", /* CHAR_INITFUNC */ + "", /* CHAR_WALKPREFUNC */ + "", /* CHAR_WALKPOSTFUNC */ + "", /* CHAR_PREOVERFUNC */ + "", /* CHAR_PREOVERFUNC */ + "core_PetWatch", /* CHAR_WATCHFUNC */ + "", /* CHAR_LOOPFUNC */ + "", /* CHAR_DYINGFUNC */ + "core_PetTalk", /* CHAR_TALKEDFUNC */ + "", /* CHAR_PREATTACKEDFUNC */ + "", /* CHAR_POSTATTACKEDFUNC */ + "", /* CHAR_OFFFUNC */ + "", /* CHAR_LOOKEDFUNC */ + "", /* CHAR_ITEMPUTFUNC */ + "", /* CHAR_SPECIALTALKEDFUNC */ + "", /* CHAR_WINDOWTALKEDFUNC */ +#ifdef _USER_CHARLOOPS + "", // CHAR_LOOPFUNCTEMP1, + "", // CHAR_LOOPFUNCTEMP2, + "", //CHAR_BATTLEPROPERTY, +#endif + }; + for( i = 0; i < CHAR_FUNCTABLENUM; i ++ ) { + strcpysafe( ch->charfunctable[i].string, + sizeof( ch->charfunctable[i]), + tmp[i]); + } + if( ch->data[CHAR_MAILMODE] != CHAR_PETMAIL_NONE ) { + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), "PETMAIL_Loop"); + + } +#ifdef _USER_CHARLOOPS + if( ch->data[CHAR_FUSIONBEIT] == 1 && + ch->data[CHAR_FUSIONRAISE] > 0 ) { + //andy_log +// print("init CHAR_LOOPFUNCTEMP1:%s \n", "PET_CheckIncubateLoop"); + + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "PET_CheckIncubateLoop"); + ch->data[CHAR_LOOPINTERVAL] = 60000; + + ch->functable[CHAR_LOOPFUNCTEMP1] + = getFunctionPointerFromName( "PET_CheckIncubateLoop"); + +// CHAR_constructFunctable( petindex); + } +#endif + return( CHAR_initCharOneArray( ch)); +} + +int PET_createPetFromCharaIndex( int charaindex, int enemyindex) +{ + Char CharNew; + int newindex; + int havepetelement; + char szPet[128]; + int i; + + havepetelement = CHAR_getCharPetElement( charaindex); + if( havepetelement < 0 ) return -1; + memset( &CharNew, 0, sizeof( Char ) ); + if( !CHAR_getDefaultChar( &CharNew,31010 ) )return -1; + CharNew.data[CHAR_BASEBASEIMAGENUMBER] + = CharNew.data[CHAR_BASEIMAGENUMBER] = CHAR_getInt(enemyindex,CHAR_BASEIMAGENUMBER); + CharNew.data[CHAR_WHICHTYPE] = CHAR_TYPEPET; + CharNew.data[CHAR_HP] = CHAR_getInt(enemyindex, CHAR_HP); + CharNew.data[CHAR_MP] = CHAR_getInt(enemyindex, CHAR_MP); + CharNew.data[CHAR_MAXMP] = CHAR_getInt(enemyindex, CHAR_MAXMP); + CharNew.data[CHAR_VITAL] = CHAR_getInt(enemyindex, CHAR_VITAL); + CharNew.data[CHAR_STR] = CHAR_getInt(enemyindex, CHAR_STR); + CharNew.data[CHAR_TOUGH] = CHAR_getInt(enemyindex, CHAR_TOUGH); + CharNew.data[CHAR_DEX] = CHAR_getInt(enemyindex, CHAR_DEX); + CharNew.data[CHAR_LUCK] = CHAR_getInt(enemyindex, CHAR_LUCK); + CharNew.data[CHAR_FIREAT] = CHAR_getInt(enemyindex, CHAR_FIREAT); + CharNew.data[CHAR_WATERAT] = CHAR_getInt(enemyindex, CHAR_WATERAT); + CharNew.data[CHAR_EARTHAT] = CHAR_getInt(enemyindex, CHAR_EARTHAT); + CharNew.data[CHAR_WINDAT] = CHAR_getInt(enemyindex, CHAR_WINDAT); + //CharNew.data[CHAR_EXP] = CHAR_getInt(enemyindex, CHAR_EXP); + + CharNew.data[CHAR_SLOT] = CHAR_getInt(enemyindex, CHAR_SLOT); + CharNew.data[CHAR_MODAI] = CHAR_getInt(enemyindex, CHAR_MODAI); + CharNew.data[CHAR_LV] = CHAR_getInt(enemyindex, CHAR_LV); + CharNew.data[CHAR_POISON] = CHAR_getInt(enemyindex, CHAR_POISON); + CharNew.data[CHAR_PARALYSIS]= CHAR_getInt(enemyindex, CHAR_PARALYSIS); + CharNew.data[CHAR_SLEEP] = CHAR_getInt(enemyindex, CHAR_SLEEP); + CharNew.data[CHAR_STONE] = CHAR_getInt(enemyindex, CHAR_STONE); + CharNew.data[CHAR_DRUNK] = CHAR_getInt(enemyindex, CHAR_DRUNK); + CharNew.data[CHAR_CONFUSION]= CHAR_getInt(enemyindex, CHAR_CONFUSION); + CharNew.data[CHAR_RARE] = CHAR_getInt(enemyindex, CHAR_RARE); + CharNew.data[CHAR_PETRANK] = CHAR_getInt(enemyindex, CHAR_PETRANK); + CharNew.data[CHAR_PETID] = CHAR_getInt(enemyindex, CHAR_PETID); + CharNew.data[CHAR_CRITIAL] = CHAR_getInt(enemyindex, CHAR_CRITIAL); + CharNew.data[CHAR_COUNTER] = CHAR_getInt(enemyindex, CHAR_COUNTER); + CharNew.data[CHAR_PETMAILEFFECT] = RAND(0, PETMAIL_EFFECTMAX); + CharNew.data[CHAR_PETENEMYID] = CHAR_getInt(enemyindex, CHAR_PETENEMYID); + + for( i = 0; i < CHAR_MAXPETSKILLHAVE; i ++ ) { + CharNew.unionTable.indexOfPetskill[i] = CHAR_getPetSkill( enemyindex, i); + } + CharNew.data[CHAR_ALLOCPOINT] = CHAR_getInt(enemyindex, CHAR_ALLOCPOINT); + strcpysafe( CharNew.string[CHAR_NAME].string, + sizeof(CharNew.string[CHAR_NAME].string), + CHAR_getChar( enemyindex, CHAR_NAME) ); + newindex = PET_initCharOneArray( &CharNew ); +#ifdef _CAX_LVTISHI + if (CharNew.data[CHAR_LV] == 1){//׽ij1 + int namelen=strlen(CHAR_getChar(newindex, CHAR_NAME));//óƵij + char petname[namelen-3];//ΪҪȥĸַƵĻ,ֱȡĸַ + snprintf( petname, sizeof( petname),"%s",CHAR_getChar( newindex, CHAR_NAME)); + CHAR_setChar( newindex, CHAR_NAME, petname); + } +#endif + if( newindex < 0 ){ + return -1; + } + + CHAR_setMaxExpFromLevel( newindex, CHAR_getInt( enemyindex, CHAR_LV )); + CHAR_complianceParameter( newindex ); + CHAR_setWorkInt( newindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetelement, newindex); + CHAR_setChar( newindex, CHAR_OWNERCDKEY, + CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( newindex, CHAR_OWNERCHARANAME, + CHAR_getChar( charaindex, CHAR_NAME)); + snprintf( szPet, sizeof( szPet ), "K%d", havepetelement ); + CHAR_sendStatusString( charaindex, szPet ); + snprintf( szPet, sizeof( szPet ), "W%d", havepetelement ); + CHAR_sendStatusString( charaindex, szPet ); + + return newindex; + +} +BOOL PET_SelectBattleEntryPet( int charaindex, int petarray) +{ + int pindex; + /* ºƥľ¦Ⱦµ ؤԻ */ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return FALSE; + /* -1-1ƻƻδԻ*/ + if( petarray == -1 ) { + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1 ); + return TRUE; + } + if( !CHAR_CHECKPETINDEX( petarray)) return FALSE; + pindex = CHAR_getCharPet( charaindex, petarray ); + if( !CHAR_CHECKINDEX( pindex)) return FALSE; + + if( CHAR_getFlg( pindex, CHAR_ISDIE )) return FALSE; +#ifdef _RIDEBUG + //жǷΪ + if(CHAR_getInt( charaindex, CHAR_RIDEPET) == petarray) return FALSE; +#endif + CHAR_setInt( charaindex, CHAR_DEFAULTPET, petarray ); + + return TRUE; +} + +// Robin 0707 petFollow +#if 1 +int PET_dropPetFollow( int charaindex, int havepetindex, int tofl, int tox, int toy) +{ + char szPet[128]; + int dirx[9],diry[9]; + int i; + int objindex=-1; + int floor,x,y; + int petindex; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return FALSE; + petindex = CHAR_getCharPet(charaindex,havepetindex); + if( petindex == -1 ) return FALSE; + if( !CHAR_CHECKINDEX( charaindex ) )return FALSE; + if( CHAR_CHECKINDEX( petindex) == FALSE ) return FALSE; + + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(charaindex, -1, "ػ޷", CHAR_COLORYELLOW); + return FALSE; + } + if (CHAR_getInt(charaindex, CHAR_RIDEPET) == havepetindex){ + CHAR_talkToCli(charaindex, -1, "еij޷棡", CHAR_COLORYELLOW); + return FALSE; + } + if( tofl == -1 ) { + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + diry[i+2] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + + floor = CHAR_getInt( charaindex,CHAR_FLOOR ); + for( i = 0 ; i < 9 ; i ++ ){ + int x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + int y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + if( PET_isPutPoint( floor, x, y ) == TRUE ) { + break; + } + } + if( i == 9 ) i = 1; + + x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + } + else { + if( MAP_walkAbleFromPoint( tofl,tox,toy, FALSE ) == FALSE ) { + print( "map walkable err %s:%d\n", __FILE__,__LINE__); + return FALSE; + } + floor = tofl; + x = tox; + y = toy; + } + + objindex = PET_dropPetAbsolute( petindex,floor,x,y, FALSE ); + if( objindex == -1 ) return FALSE; + + CHAR_setWorkInt( petindex,CHAR_WORKOBJINDEX,objindex ); + CHAR_setCharPet( charaindex, havepetindex, -1); + CHAR_setInt( petindex, CHAR_FLOOR, floor); + CHAR_setInt( petindex, CHAR_X, x); + CHAR_setInt( petindex, CHAR_Y, y); + CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); + if( havepetindex == CHAR_getInt( charaindex, CHAR_DEFAULTPET)) { + int fd; + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + fd = getfdFromCharaIndex( charaindex); + lssproto_KS_send( fd, havepetindex, 0); + + } + CHAR_sendCToArroundCharacter( objindex); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { +#ifdef _PET_ITEM + CHAR_sendPetItemData( charaindex, havepetindex); +#endif + snprintf( szPet, sizeof( szPet ), "K%d", havepetindex ); + CHAR_sendStatusString( charaindex, szPet ); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, petindex); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NOW); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0); + CHAR_setInt( petindex, CHAR_PUTPETTIME, (int)(NowTime.tv_sec)); + CHAR_setInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "Follow()", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + return 1; +} +#endif + +BOOL PET_getBaseForAllocpoint( int toindex, int *work) +{ + int LevelUpPoint=0; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET) + return FALSE; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + return TRUE; +} + +void PET_showEditBaseMsg( int charaindex, int toindex, int itemindex, int *work) +{ + int i, maxnums = 6000; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET) + return; + memset( buf1, 0, sizeof( buf1)); + + for( i=0; i<4; i++) { + int type = ITEM_getInt( itemindex, (ITEM_MODIFYATTACK + i)); +// print(" ι[%d]%d+%d ", i, work[i], type); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) { + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + }else { + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + } + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( charaindex, toindex, buf1, CHAR_COLORYELLOW); + } + } +} + +#ifdef _PET_EVOLUTION +BOOL PET_getBaseAndSkill( int charaindex, int baseindex, int *base, int *skill, int flg) +{ + int i; + if( !CHAR_CHECKINDEX( baseindex)) return FALSE; + if( base != NULL ) { + int levelup = CHAR_getInt( baseindex, CHAR_ALLOCPOINT); + base[0] = ((levelup>>24) & 0xFF); + base[1] = ((levelup>>16) & 0xFF); + base[2] = ((levelup>> 8) & 0xFF); + base[3] = ((levelup>> 0) & 0xFF); + } + + if( skill != NULL ) { + for( i=0; i= CHAR_MAXPETHAVE){ + return FALSE; + }else { + char szPet[256]; + char msgbuf[256]; + CHAR_setCharPet( charaindex, i, -1); + snprintf( szPet, sizeof( szPet ), "K%d", i); + CHAR_sendStatusString( charaindex, szPet ); + + snprintf( msgbuf,sizeof( msgbuf), "%s", CHAR_getChar( petindex, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_endCharOneArray( petindex ); + } + return TRUE; +} + + diff --git a/char/pet_event.c b/char/pet_event.c new file mode 100644 index 0000000..5f139ef --- /dev/null +++ b/char/pet_event.c @@ -0,0 +1,907 @@ +#include "version.h" +#include +#include + +#include "common.h" +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "configfile.h" +#include "handletime.h" +#include "pet_event.h" +#include "npcutil.h" +#include "log.h" +#include "lssproto_serv.h" +// Arminius 8.14 pet talk +#include +#include "npc_exchangeman.h" +#include "npc_eventaction.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#ifdef _PET_TALK +//BOOL PetTalk_CheckFree( int meindex, int toindex, char *buf); +BOOL PetTalk_CheckFree( int meindex, int talker, char *buf); + +BOOL PetTalk_BSCheck(int meindex,int talker,char* buf); +BOOL PetTalk_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp); +BOOL PetTalk_WarpManReduce(int meindex,int talker,char *buf); +BOOL PetTalk_BigSmallLastCheck(int point1,int mypoint,int flg); +BOOL PetTalk_CheckTrans(int meindex,int talker,int trans,int flg); +BOOL PetTalk_LevelCheck(int meindex,int talker,int level,int flg); +BOOL PetTalk_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL PetTalk_ItemCheck(int meindex,int talker,int itemNo,int flg); +BOOL PetTalk_CheckMyType( int meindex, int toindex, int kosuu, int flg, int Type ); +BOOL PetTalk_CheckPetEvent( int meindex, int toindex, char *buf); +void PetTalk_RequestMain(int meindex,int talker,char *buf); +BOOL PetTalk_AddItem(int meindex, int talker, char *buf); +BOOL PetTalk_DelItem(int meindex,int talker,char *buf); +BOOL PetTalk_RunEvent( int meindex, int talker, char *buf); +BOOL PetTalk_CheckMyFloor( int meindex, int talker, char *buf, int flg); +#ifdef _PET_TALKBBI +BOOL PET_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif +#ifdef _PET_TALKPRO +#else +char *Pet_TalkGetFunStr( char *temp , char *buf, int len) +{ + char filename[56]; + char pathfile[128]; + char talkfun[ 10240]; + char buf1[256],buf2[256],buf3[256]; + FILE *petarg; + char *cStr=NULL; + int talkNo=1,mark=1; + char line[4096]; + BOOL find=FALSE; + talkfun[0] ='\0'; + + while( getStringFromIndexWithDelim( pettalktext,"&",talkNo, buf1, sizeof( buf1) ) != FALSE){ + talkNo++; + if( NPC_Util_GetStrFromStrWithDelim( buf1, "PETTEMPNO", buf2, sizeof( buf2)) == NULL ) + continue; + mark=2; + strcpy( filename,"\0"); + while( getStringFromIndexWithDelim( buf2,",", mark,buf3,sizeof( buf3)) != FALSE ) { + mark ++; + if( !strcmp( buf3, temp)) { + print("\n buf2=%s",buf2); + if( getStringFromIndexWithDelim( buf2,",", 1,filename,sizeof( filename)) == FALSE ) + return NULL; + find = TRUE; + break; + } + } + if( find == TRUE ) + break; + } + if( !strcmp( filename, "\0") ) + return NULL; + + sprintf( pathfile, "%s/pettalk/%s", getNpcdir(), filename); + petarg = fopen( pathfile , "r" ); + if( petarg != NULL ) { + while( fgets( line, sizeof( line), petarg ) ) { + if( strlen( talkfun) != 0 ) { + if( talkfun[strlen( talkfun) -1] != '|' ) { + strcatsafe( talkfun, sizeof( talkfun), "|"); + } + } + chompex( line); + strcatsafe( talkfun, sizeof( talkfun ), line); + } + fclose( petarg); + }else { + return NULL; + } + talkNo = 1; + while( getStringFromIndexWithDelim( talkfun,"}",talkNo, buf, len) != FALSE) { + talkNo++; + if( NPC_Util_GetStrFromStrWithDelim( buf, "PETTEMPNO", buf2, sizeof( buf2)) == NULL ) + continue; + if( !strcmp( temp, buf2) ) { + cStr = buf; + break; + } + } + return( cStr); +} +#endif +void PET_Talkfunc( int meindex, int talkerindex, char *msg, int color) +{ + char buf2[1024], buf3[256]; + + char TalkType[][16]={"TALKRUN","EVENTRUN","BOTH"}; + char AllTalk[PETTALK_MAXID][1024]; + int Type=0,j,i; + int talkNo=0; + BOOL FREEs=FALSE; + int buttontype = 0; + int windowtype = 0; +#ifdef _PET_TALKPRO + int tPage=-1; +#else + int petid=-1; + char tempNo[32], buf1[10240]; +#endif + int fd = getfdFromCharaIndex( talkerindex); +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_OK; + if( NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + for( i = 0 ; i < 5 ; i++ ) { + strcpy( AllTalk[i], "\0" ); + } +#ifdef _ALLBLUES_LUA_1_5 + RunCharTalkedEvent( meindex, talkerindex, msg, color, 1); +#endif +#ifdef _PET_TALKPRO + for( i=0;i=0 && pettalktext[i].ID == CHAR_getInt(meindex, CHAR_PETID) ) { + if( strcmp( pettalktext[i].DATA, "\0") && strlen( pettalktext[i].DATA) > 0 ) { + //snprintf( buf1, sizeof(buf1), pettalktext[i].DATA); + tPage=i; + break; + } + } + } + if( i == PETTALK_MAXID ) + return; +#else + sprintf(tempNo,"%d", CHAR_getInt(meindex, CHAR_PETID)); + petid = CHAR_getInt(meindex, CHAR_PETID); + if( Pet_TalkGetFunStr( tempNo , buf1 , sizeof( buf1) ) == NULL ) { + return; + } +#endif + if( CHAR_getInt( meindex, CHAR_LV ) >= CHAR_getInt( meindex, CHAR_LIMITLEVEL) ) { + Type = 1; + } + //趨Ϊ˲PET + if( strcmp( CHAR_getChar( meindex, CHAR_OWNERCDKEY), CHAR_getChar( talkerindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( meindex, CHAR_OWNERCHARANAME), CHAR_getChar( talkerindex, CHAR_NAME) )){ +#ifdef _PET_TALKPRO + if( NPC_Util_GetStrFromStrWithDelim( pettalktext[tPage].DATA, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { +#else + if( NPC_Util_GetStrFromStrWithDelim( buf1, "NoPlayerMsg", buf3, sizeof( buf3)) != NULL ) { +#endif + }else { + sprintf(buf3,"İˣҲʶѽǻˣ"); + } + CHAR_talkToCli( talkerindex, meindex, buf3, color); + return; + } + j=0; + +#ifdef _PET_TALKPRO + while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ +#else + while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE){ +#endif + talkNo++; + if( ( strstr( buf2, TalkType[Type]) == NULL ) && ( strstr( buf2, TalkType[2]) == NULL ) )continue; + if( NPC_Util_GetStrFromStrWithDelim( buf2, "FLOOR", buf3, sizeof( buf3)) != NULL ) {//жϷ + if( PetTalk_CheckMyFloor( meindex, talkerindex, buf3, 0) == FALSE )continue; + } + if( NPC_Util_GetStrFromStrWithDelim( buf2, "PET", buf3, sizeof( buf3)) != NULL ) {//жϳFREE + if( PetTalk_CheckFree( meindex, meindex, buf3) != TRUE ) continue; + } + if( NPC_Util_GetStrFromStrWithDelim( buf2, "FREE", buf3, sizeof( buf3) ) == NULL)continue; + if( NPC_ActionPassCheck( meindex, talkerindex, buf3) == FALSE ) continue;//жFREE +// if( ActionNpc_CheckFree( meindex, talkerindex, buf2, 0) == FALSE ) continue; + if( PetTalk_CheckPetEvent( meindex, talkerindex, buf2) == FALSE )continue; + FREEs = TRUE; // + strcpy( AllTalk[j++], buf2 ); + if( j > PETTALK_MAXID-1 ) break; + } + talkNo = 0; + if( FREEs == FALSE) { //ȫ + j=0; +#ifdef _PET_TALKPRO + while( getStringFromIndexWithDelim( pettalktext[tPage].DATA,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ +#else + while( getStringFromIndexWithDelim( buf1,"OVER",talkNo, buf2, sizeof( buf2) ) != FALSE ){ +#endif + talkNo ++; + if( strstr( buf2, "OTHER") == NULL ) continue; + if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) continue; + while( getStringFromIndexWithDelim( buf3,",",j+1, AllTalk[j], sizeof( AllTalk[j]) ) != FALSE ){ + j++; + } + break; + } + } + if( j > 0 ) { + strcpy( buf2, AllTalk[ RAND( 0, (j-1) ) ] ); + if( PetTalk_RunEvent( meindex, talkerindex, buf2) == FALSE ) { + sprintf( buf3,""); + CHAR_talkToCli( talkerindex, meindex, buf3, color); + return; + } + if( NPC_Util_GetStrFromStrWithDelim( buf2, "TalkMsg", buf3, sizeof( buf3)) == NULL) { + //sprintf( buf3,"ˣȥɣ"); + strcpy( buf3, buf2); + } + + lssproto_WN_send( fd, windowtype, buttontype, 0, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf3 ); + } + +} + +BOOL PetTalk_CheckMyFloor( int meindex, int talker, char *buf, int flg) { + char buf1[16]; + int Myfloor=-1; + Myfloor = CHAR_getInt( talker, CHAR_FLOOR); + if( strstr( buf, "!") != NULL ) { + getStringFromIndexWithDelim( buf,"!", 2, buf1, sizeof( buf1) ); + if( Myfloor == atoi( buf1) ) { + return FALSE; + } + }else { + if( Myfloor != atoi( buf) ) { + return FALSE; + } + } + return TRUE; +} + +BOOL PetTalk_RunEvent( int meindex, int talker, char *buf) +{ + char buf1[256]; + int LimitLevel = -1; + + if( Action_RunDoEventAction( meindex, talker, buf) == FALSE ) + return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( buf, "RandItem", buf1, sizeof( buf1)) != NULL ){ + if( RAND( 0, 10) > 9 ) { + PetTalk_AddItem( meindex, talker, buf1); + }else { + return FALSE; + } + } + if( NPC_Util_GetStrFromStrWithDelim( buf, "LimitLevel", buf1, sizeof( buf1)) != NULL ){ + LimitLevel = atoi( buf1); + CHAR_setInt( meindex, CHAR_LIMITLEVEL, LimitLevel); + } + return TRUE; + +} + +BOOL PetTalk_DelItem(int meindex,int talker,char *buf) +{ + + int i = 1, j = 1,k = 1; + char buff3[128]; + char buf2[32]; + int itemindex; + + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ) { + k++; + if(strstr(buff3,"*")!=NULL){ + int itemno; + int kosuu; + int id; + int cnt=0; + + getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); + itemno = atoi(buf2); + getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); + kosuu = atoi(buf2); + + for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + cnt++; + + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "WarpManDelItem(NPCյᴫij)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + + CHAR_DelItem( talker, i); + if(cnt == kosuu){ + break; + } + } + } + } + }else{ + /*--Ϸ įʧ ةë---*/ + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + + if( ITEM_CHECKINDEX(itemindex) ){ + if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "WarpManDelItem(NPCյᴫij)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_DelItem( talker, j); + } + } + } + } + } + + return TRUE; +} + +BOOL PetTalk_AddItem(int meindex, int talker, char *buf) +{ + int itemID,k=1,itemindex=-1; + int spaceNum=5,i; + char buff3[256], msgbuf[64], token[256]; + int ret; + + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + for( i = spaceNum ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( itemindex == -1 ) { + spaceNum = i+1; + break; + } + } + if( i == CHAR_MAXITEMHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), "ˣƷѾˣ"); + CHAR_talkToCli( talker, meindex, msgbuf, CHAR_COLORWHITE); + return FALSE; + } + } + k=1; + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + itemID = atoi( buff3); + if( itemID ) + itemindex = ITEM_makeItemAndRegist( itemID); + if(itemindex == -1) + continue; + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1,token,CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + + } + return TRUE; +} + +BOOL PetTalk_CheckPetEvent( int meindex, int toindex, char *buf) +{ + char buf1[256],buf2[256]; + int k = 0; + + if( NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", buf1,sizeof( buf1) ) != NULL ) { + k=1; + while( getStringFromIndexWithDelim(buf1 , "," ,k, buf2, sizeof(buf2) ) != FALSE ){ + k++; + NPC_EventSetFlg( toindex, atoi( buf2)); + } + } + if( NPC_Util_GetStrFromStrWithDelim( buf, "NowSetFlg", buf1, sizeof( buf1)) != NULL) { + k=1 ; + while(getStringFromIndexWithDelim(buf1 , "," , k, buf2, sizeof(buf2))!= FALSE ){ + k++; + NPC_NowEventSetFlg( toindex, atoi( buf2)); + } + } + return TRUE; +} + +void PetTalk_RequestMain(int meindex,int talker,char *buf) +{ + int shiftbit; + char buf2[128]; + if( NPC_Util_GetStrFromStrWithDelim( buf,"EventNo", buf2,sizeof( buf2) ) == NULL ) { + print("\n pet_event.c err:NOT FIND [EventNo] !!"); + return; + } + shiftbit = atoi( buf2); + if( NPC_NowEventCheckFlg( talker, shiftbit) != TRUE ) { + NPC_NowEventSetFlg( talker, shiftbit); + } +} + +BOOL PetTalk_CheckFree( int meindex, int talker, char *buf) +{ + char buff2[256]; + char buff3[128]; + int i=1,j=1; + int loop=0; + while( getStringFromIndexWithDelim(buf,",",i,buff2,sizeof(buff2)) !=FALSE ) { + i++; + if(strstr(buff2,"&")!=NULL){ + j=1; + loop=0; + while( getStringFromIndexWithDelim(buff2,"&",j,buff3,sizeof(buff3)) !=FALSE ) { + j++; + if(PetTalk_BSCheck(meindex,talker,buff3)==FALSE) { + loop=1; + break; + } + } + if(loop==0) { + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + } + }else{ + if( PetTalk_BSCheck( meindex, talker, buff2) == TRUE ){ + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + } + } + } + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, FALSE ); + return FALSE; +} + +BOOL PetTalk_BSCheck(int meindex,int talker,char* buf) +{ + char buff2[128]; + int kosuu,temp=-1,flg=0; + char buff1[128],buff3[128]; + if(strstr( buf, "-") != NULL) { + //buff3ΪץID + getStringFromIndexWithDelim( buf, "-", 2, buff3, sizeof(buff3)); + temp = atoi( buff3); + getStringFromIndexWithDelim( buf, "-", 1, buff1, sizeof(buff1)); + strcpy( buf, buff1); + } + if(strstr( buf, "<") != NULL){ + getStringFromIndexWithDelim( buf, "<", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "<", 1, buff2, sizeof(buff2)); + + if(PetTalk_FreeIfCheck( meindex, talker, buff2, kosuu, 1, temp)==TRUE){ + return TRUE; + } + }else if(strstr( buf, ">") != NULL){ + getStringFromIndexWithDelim( buf, ">", 2, buff2, sizeof(buff2)); + kosuu = atoi(buff2); + getStringFromIndexWithDelim( buf, ">" ,1, buff2, sizeof(buff2)); + + if(PetTalk_FreeIfCheck( meindex, talker, buff2, kosuu, 2, temp)==TRUE){ + return TRUE; + } + }else if(strstr( buf, "!" ) != NULL){ + getStringFromIndexWithDelim( buf, "!=", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "!=", 1, buff2, sizeof(buff2)); + if(PetTalk_FreeIfCheck( meindex, talker, buff2, kosuu, 0, temp) == TRUE){ + return FALSE; + }else{ + return TRUE; + } + + }else if(strstr( buf, "=") != NULL){ + getStringFromIndexWithDelim( buf, "=", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "=", 1, buff2, sizeof(buff2)); + + if( strstr( buf, "PET")) { + flg = 3; + } + if(strstr( buf, "*") != NULL){ + if( PetTalk_WarpManReduce( meindex, talker, buf)==TRUE){ + return TRUE; + } + }else if(PetTalk_FreeIfCheck( meindex, talker, buff2, kosuu, flg, temp)==TRUE){ + return TRUE; + } + } + return FALSE; +} + +BOOL PetTalk_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp) +{ + int Type = -1; + if(strcmp(buf,"LV")==0){ + if(PetTalk_LevelCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } + + if( strcmp( buf, "TRANS") == 0 ) { + if( PetTalk_CheckTrans( meindex, talker, kosuu, flg) == TRUE ) + return TRUE; + } + if( strcmp( buf, "PET") == 0 ) { + if( temp > 0 ) { + if( PetTalk_CheckMyPet( meindex, talker, kosuu, flg, temp) == TRUE ) + return TRUE; + }else + return FALSE; + } + if(strcmp( buf, "ITEM")==0){ + if(PetTalk_ItemCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } + if(strcmp( buf, "ENDEV")==0){ + if(NPC_EventCheckFlg( talker, kosuu)==TRUE){ + return TRUE; + } + } + if(strcmp( buf, "NOWEV")==0){ + if(NPC_NowEventCheckFlg( talker, kosuu)==TRUE){ + return TRUE; + } + } + if(strcmp( buf, "HP" ) == 0 ) { + Type = 0; + if( PetTalk_CheckMyType( meindex, talker, kosuu, flg, Type ) == TRUE ) { + return TRUE; + } + } +#ifdef _PET_TALKBBI + if(strcmp( buf, "BBI" ) == 0 ) { + if( PET_CheckPlayerBBI( meindex, talker, kosuu, flg)== TRUE) { + return TRUE; + } + } +#endif + return FALSE; +} +BOOL PetTalk_CheckMyType( int meindex, int toindex, int kosuu, int flg, int Type ) { + int MyType=0,MyMaxType=0; + switch( Type ) { + case 0: //HP + MyType = CHAR_getInt( toindex, CHAR_HP); + MyMaxType = CHAR_getWorkInt( toindex, CHAR_WORKMAXHP); + MyMaxType = (MyMaxType * kosuu )/ 100; + if( PetTalk_BigSmallLastCheck( MyMaxType, MyType , flg ) == TRUE ) { + return TRUE; + } + break; + } + return FALSE; +} + +BOOL PetTalk_WarpManReduce(int meindex,int talker,char *buf) +{ + char buf2[512]; + char buf3[256]; + int id=0; + int i; + int itemindex; + int itemno; + int kosuu; + int cnt=0; + + getStringFromIndexWithDelim(buf,"=",2,buf2,sizeof(buf2)); + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemno = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + cnt++; + if(cnt==kosuu){ + return TRUE; + } + } + } + } + return FALSE; +} + +BOOL PetTalk_LevelCheck(int meindex,int talker,int level,int flg) +{ + int mylevel; + mylevel=CHAR_getInt(talker,CHAR_LV); + if(PetTalk_BigSmallLastCheck(level,mylevel,flg)==TRUE) { + return TRUE; + } + return FALSE; +} + +BOOL PetTalk_CheckTrans(int meindex,int talker,int trans,int flg) +{ + int myTrans; + myTrans=CHAR_getInt(talker, CHAR_TRANSMIGRATION); + if( PetTalk_BigSmallLastCheck( trans, myTrans, flg ) == TRUE ) { + return TRUE; + } + return FALSE; +} + +BOOL PetTalk_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid) +{ + int petsel,petindex=-1; + + for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++) { + petindex = CHAR_getCharPet( talker, petsel); + if( petindex == -1 ) + continue; + if(CHAR_getInt( petindex, CHAR_PETID) != petid ) + continue; + break; + } + if( petsel == CHAR_MAXPETHAVE ) { + return FALSE; + }else { //ҵ + if( PetTalk_BigSmallLastCheck( petLv, CHAR_getInt( petindex, CHAR_LV), flg ) == TRUE ) + return TRUE; + } + return FALSE; +} + +BOOL PetTalk_ItemCheck(int meindex,int talker,int itemNo,int flg) +{ + int i; + int itemindex=-1; + int id; + for( i=0;i point1) { + return TRUE; + } + } + return FALSE; +} +#else +void PET_Talkfunc( int meindex, int talkerindex, char *msg, int color) +{ + print("\n PET_Talkfunc(...) return; "); + return; +} +#endif + +void PET_CleanFreePetAll() +{ + int objindex; + int objmaxnum = OBJECT_getNum(); + + for( objindex=0; objindex= (petputtime + 60*60) ) { + int ownerindex = CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX); + if( CHAR_CHECKINDEX( ownerindex) ){ + if( CHAR_pickupFollowPet( ownerindex, petindex ) ) { + return; + } + CHAR_talkToCli( ownerindex, -1, "̫ãʧˣ", CHAR_COLORYELLOW ); + } +#ifdef _PET_LOSTPET + CHAR_CharSaveLostPet( petindex, 1); + LogPet( + "ϵͳ", + "Watchfunc", + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "timeout_lost(ϵͳ-ɳ)", + CHAR_getInt( petindex, CHAR_FLOOR), + CHAR_getInt( petindex,CHAR_X ), + CHAR_getInt( petindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + print("ϵͳ-ɳ:%s\n", CHAR_getUseName( petindex)); + CHAR_CharaDelete( petindex); +#else + CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NONE); + LogPet( + CHAR_getChar( pindex, CHAR_NAME ), + CHAR_getChar( pindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "timeout_lost(̫ãʧ))", + CHAR_getInt( pindex,CHAR_FLOOR), + CHAR_getInt( pindex,CHAR_X ), + CHAR_getInt( pindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + + ); +#endif + return; + } + + }else{ + PET_CHECKFreePetIsIt( petindex); + } + if( CHAR_getInt( petindex, CHAR_MAILMODE) == CHAR_PETMAIL_IDLE3 || + CHAR_getInt( petindex, CHAR_MAILMODE) == CHAR_PETMAIL_IDLE2){ + if( act == CHAR_ACTATTACK) { + if( NPC_Util_isFaceToChara( pindex,petindex,1 ) == TRUE ) { + int action[2] = { CHAR_ACTDAMAGE, CHAR_ACTGUARD}; + CHAR_sendWatchEvent( objmeindex, action[RAND(0,1)], NULL,0,FALSE); + CHAR_setWorkInt( petindex, CHAR_WORKACTION, act); + } + } + }else if( CHAR_getInt( petindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE) { + ; + }else if( CHAR_getWorkInt( petindex, CHAR_WORKFIXAI) >= 100 ) { + int workpindex = CHAR_getWorkInt( petindex, CHAR_WORKPLAYERINDEX); + if( act == CHAR_ACTWALK && CHAR_CHECKINDEX( workpindex) && workpindex == pindex ){ + dir = NPC_Util_GetDirCharToChar( petindex, pindex, 0); + if( dir != -1 ) { + if( CHAR_getInt( petindex, CHAR_DIR) != dir ) { + CHAR_setInt( petindex, CHAR_DIR, dir); + CHAR_sendWatchEvent( CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX), + CHAR_ACTTURN,NULL,0,TRUE); + } + } + }else if( NPC_Util_isFaceToFace( petindex, pindex, 2 ) == TRUE ) { + switch( act) { + case CHAR_ACTATTACK: + case CHAR_ACTDAMAGE: + case CHAR_ACTDOWN: + case CHAR_ACTSTAND: + case CHAR_ACTACTIONWALK: + case CHAR_ACTGUARD: + case CHAR_ACTACTIONSTAND: + CHAR_sendWatchEvent( objmeindex, act, NULL,0,FALSE); + CHAR_setWorkInt( petindex, CHAR_WORKACTION, act); + break; + default: + break; + } + } + }else { + + } + return; +} + +#ifdef _PET_TALKBBI +BOOL PET_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg) +{ + int MyBBI; + if( !CHAR_CHECKINDEX( charindex)) + return FALSE; + if( BBI < 0 ) + return FALSE; + MyBBI = CHAR_getInt( charindex, CHAR_BASEIMAGENUMBER); + + if(flg==0){ + if(BBI==MyBBI) + return TRUE; + }else if(flg==1){ + if(BBI < MyBBI) + return TRUE; + }else if(flg==2){ + if(BBI > MyBBI) + return TRUE; + } + + return FALSE; +} +#endif diff --git a/char/petmail.c b/char/petmail.c new file mode 100644 index 0000000..fb6a500 --- /dev/null +++ b/char/petmail.c @@ -0,0 +1,1124 @@ +#include "version.h" +#include + +#include "configfile.h" +#include "buf.h" +#include "char_base.h" +#include "char.h" +#include "battle.h" +#include "handletime.h" +#include "map_deal.h" +#include "addressbook.h" +#include "lssproto_serv.h" +#include "pet.h" +#include "petmail.h" +#include "npcutil.h" +#include "log.h" + +#define PETMAIL_BATTLETIMEOUT 660 +#define PETMAIL_IDLETIMEOUT 30 +#define PETMAIL_IDLETIME 10 + +#define PETMAIL_IDLE_RETURNOWNER (60*30) +//andy_edit +//#define PETMAIL_IDLEDISCARD (60*60) //Syu ʵȴʱΪһСʱ +#define PETMAIL_IDLEDISCARD (60*3) + +/* petmail ϵĵȴʱ shan add */ +#define PETMAIL_JS_TIMEOUT (2*60) + +static int PETMAIL_getIdleTime( int index); +static void PETMAIL_sendPetmail( int index, int tocharaindex); +static void PETMAIL_IdleProc1( int index); +static void PETMAIL_IdleProc2( int index); +static void PETMAIL_IdleProc3( int index); +static void PETMAIL_IdleProc4( int index); +static void PETMAIL_IdleProc5( int index); + +static void PETMAIL_ReturnWait( int index); +static void PETMAIL_returnMail( int index, int tocharaindex); +static int PETMAIL_offmsg_max; +#define PETMAILOFFMSGFILE "petmail.txt" + +#define PETMAIL_DEFTOTALNUM 1000 +static int PetMailTotalnums = 0; + +BOOL PETMAIL_sendPetMail( int cindex, int aindex, + int havepetindex, int haveitemindex, char* text , int color ) +{ + char textbuffer[2048]; + struct tm tm1; + Char *ch; + ADDRESSBOOK_entry *ae; + int petindex; + int itemindex =-1; + int tocharaindex,playernum,i; + + //ж Ƭ + if( !CHAR_CHECKINDEX( cindex) )return FALSE; + if( haveitemindex != -1 ) { + itemindex = CHAR_getItemIndex( cindex, haveitemindex); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_CANPETMAIL) == 0 ) { + print( "err? crack?\n"); + return FALSE; + } + if(ITEM_getInt( itemindex, ITEM_TIME)>0){ + CHAR_talkToCli( cindex, -1, "ʱ߲ʼġ", CHAR_COLORYELLOW ); + return FALSE; + } + } + } + petindex = CHAR_getCharPet( cindex, havepetindex); + if( petindex == -1 ) return FALSE; + ch = CHAR_getCharPointer( petindex); + if( ch == NULL ) return FALSE; + ae = CHAR_getAddressbookEntry( cindex , aindex ); + if( ae == NULL )return FALSE; + if (CHAR_getWorkInt( cindex, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(cindex); + return FALSE; + } +#ifdef _AVID_TRADETRYBUG //ʼ + if( CHAR_getWorkInt( cindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE ){ + CHAR_talkToCli( cindex, -1, "״̬޷ݳʼ", CHAR_COLORYELLOW ); + return FALSE; + } +#endif + // + if (CHAR_getInt( cindex, CHAR_RIDEPET) == havepetindex ){ + CHAR_talkToCli(cindex, -1, "еij޷ݳʼ", CHAR_COLORYELLOW); + return FALSE; + } + if( CHAR_getWorkInt( cindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + CHAR_talkToCli( cindex, -1, "ս״̬޷ݳʼ", CHAR_COLORYELLOW ); + return FALSE; + } + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(cindex, -1, "ػ޷ʼร", CHAR_COLORYELLOW); + return FALSE; + } +#ifdef _PETMAIL_LV + if(getPetMailCf()==1 && CHAR_getInt(petindex, CHAR_LV)>=getPetMailLv()){ + char bufmsg[256]; + sprintf(bufmsg,"ʼĽ%d³ʼġ",getPetMailLv()); + CHAR_talkToCli(cindex, -1, bufmsg, CHAR_COLORYELLOW); + return FALSE; + } +#endif +// Terry add fix can send mail to offline character 2004/2/5 + if(ae->online == 0){ + CHAR_talkToCli(cindex, -1, "Ҳϣ", CHAR_COLORYELLOW); + return FALSE; + } + playernum = CHAR_getPlayerMaxNum(); + for(i = 0;icdkey) == 0 && + strcmp(CHAR_getChar(i,CHAR_NAME),ae->charname) == 0 ) break; + } + if(i == playernum){ + CHAR_talkToCli(cindex, -1, "Ҳڴϣ", CHAR_COLORYELLOW); + return FALSE; + } +// end +#ifdef _MAP_TIME + if((CHAR_getInt(cindex,CHAR_FLOOR) >= 30017 && CHAR_getInt(cindex,CHAR_FLOOR) <= 30021)){ + char msgbuf[512]; + snprintf(msgbuf,sizeof(msgbuf),"˵ü͵ߣ"); + CHAR_talkToCli(cindex,-1,msgbuf,CHAR_COLORWHITE); + return FALSE; + } + if((CHAR_getInt(i,CHAR_FLOOR) >= 30017 && CHAR_getInt(i,CHAR_FLOOR) <= 30021)){ + char msgbuf[512]; + snprintf(msgbuf,sizeof(msgbuf),"Էڵռ͵ߣ"); + CHAR_talkToCli(cindex,-1,msgbuf,CHAR_COLORWHITE); + return FALSE; + } +#endif + + // Syu Add 2003/05/30 + if( ( CHAR_getInt(cindex,CHAR_FLOOR) >= 8200 && CHAR_getInt(cindex,CHAR_FLOOR) <= 8213 ) ) + { + char msgbuf[512]; + snprintf( msgbuf, sizeof( msgbuf), "Ӣսü͵ߣ"); + CHAR_talkToCli( cindex, -1, msgbuf, CHAR_COLORWHITE); + return FALSE; + } + +#ifdef _PET_LIMITLEVEL + if( CHAR_getInt( petindex, CHAR_LIMITLEVEL) > 0 ) { + CHAR_talkToCli(cindex, -1, "ﲻܴʼร", CHAR_COLORYELLOW); + return FALSE; + } +#endif +//DZ޶IJʼĵĵôԼ +#ifdef _PETITEM__AMOI_E + if(ITEM_NOT_MAIL & ITEM_getInt(itemindex, ITEM_TYPEOFITEM)){ + char buf[256]; + sprintf( buf, "%sDzʼĵŶ!~", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( cindex, -1, buf, CHAR_COLORRED); + return FALSE; + } +#endif +#ifdef _PETMAIL_DEFNUMS + if( CHAR_getWorkInt( cindex, CHAR_PETMAILNUMS) > 6 ){ + CHAR_talkToCli(cindex, -1, "ʼг࣬ʱ޷ݳʼ", CHAR_COLORYELLOW); + return FALSE; + }else if( PETMAIL_CheckIsMyOffmsg( cindex, ae->cdkey, ae->charname) > 10 ){ + CHAR_talkToCli(cindex, -1, "ռĿǰʼﳬ10⣬ʱ޷ݳʼ", CHAR_COLORYELLOW); + return FALSE; + }else if( CHAR_getWorkInt( cindex, CHAR_PETMAILSENDTIME) > (int)time( NULL)){ + char Mess1[256]; + sprintf( Mess1,"ȴ%dٴμͳʼ", + (int)time( NULL) - CHAR_getWorkInt( cindex, CHAR_PETMAILSENDTIME)); + CHAR_talkToCli( cindex, -1, Mess1, CHAR_COLORYELLOW); + return FALSE; + }else if( PetMailTotalnums >= PETMAIL_DEFTOTALNUM ){ + CHAR_talkToCli(cindex, -1, "Ŀǰϵͳʼ࣬ټġ", CHAR_COLORYELLOW); + return FALSE; + }else{ + int nums = CHAR_getWorkInt( cindex, CHAR_PETMAILNUMS); + nums ++; + CHAR_setWorkInt( cindex, CHAR_PETMAILNUMS, nums); + CHAR_setWorkInt( cindex, CHAR_PETMAILSENDTIME, (int)time( NULL)+6); + PetMailTotalnums ++; + } +#endif +#ifdef _AVOIDATTACK_IN_PETMAIL_sendPetMail_textToLong + if( strlen(text) > 256 ) + return FALSE; +#endif + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + snprintf( textbuffer, sizeof( textbuffer), + "%2d/%02d %2d:%02d|%s", tm1.tm_mon +1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, text); + { + int offmsgindex; + offmsgindex = PETMAIL_addOffmsg( cindex, ae->cdkey, ae->charname, text, color); + if( offmsgindex == -1 ) { + print( "offmsg buffer over\n"); + return FALSE; + } + +#ifdef _FIX_PETMAIL2 // WON ADD 2 + if( !PET_dropPetFLXY( cindex, havepetindex, PETMAIL_SPOOLFLOOR, PETMAIL_SPOOLX,PETMAIL_SPOOLY) ){ + CHAR_talkToCli( cindex, -1, "ʼʧ", CHAR_COLORYELLOW); + return FALSE; + } +#endif + CHAR_setInt( petindex, CHAR_FLOOR, CHAR_getInt( cindex, CHAR_FLOOR)); + CHAR_setInt( petindex, CHAR_X, CHAR_getInt( cindex, CHAR_X)); + CHAR_setInt( petindex, CHAR_Y, CHAR_getInt( cindex, CHAR_Y)); + CHAR_sendPMEToArroundCharacter( cindex, petindex, 0, CHAR_getInt( petindex, CHAR_PETMAILEFFECT)); + CHAR_setInt( petindex, CHAR_MAILMODE,CHAR_PETMAIL_IDLE2); + CHAR_setInt( petindex, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), "PETMAIL_Loop"); + CHAR_constructFunctable( petindex); + CHAR_setInt( petindex, CHAR_PETMAILBUFINDEX, offmsgindex); + CHAR_setInt( petindex, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( petindex, CHAR_PETMAILFROMFLOOR, CHAR_getInt( cindex, CHAR_FLOOR)); + CHAR_setInt( petindex, CHAR_PETMAILFROMX, CHAR_getInt( cindex, CHAR_X)); + CHAR_setInt( petindex, CHAR_PETMAILFROMY,CHAR_getInt( cindex, CHAR_Y)); + +//#ifdef _WON_PET_MAIL_LOG // WON ADD Ӽijʵ LOG +// LogPet( +// CHAR_getChar( cindex, CHAR_NAME ), +// CHAR_getChar( cindex, CHAR_CDKEY ), +// CHAR_getChar( petindex, CHAR_NAME), +// CHAR_getInt( petindex, CHAR_LV), +// "Pet_Send_Mail(ij)", +// CHAR_getInt( cindex,CHAR_FLOOR), +// CHAR_getInt( cindex,CHAR_X ), +// CHAR_getInt( cindex,CHAR_Y ), +// CHAR_getChar( petindex, CHAR_UNIQUECODE) +// ); +//#endif + if( haveitemindex != -1 ) { + CHAR_setItemIndex( cindex, haveitemindex, -1); + CHAR_setItemIndex( petindex, CHAR_STARTITEMARRAY, itemindex); + CHAR_sendItemDataOne( cindex, haveitemindex); + LogItem( + CHAR_getChar( cindex, CHAR_NAME ), + CHAR_getChar( cindex, CHAR_CDKEY ), + itemindex, + "pm_have(->͵ĵ)", + CHAR_getInt( cindex,CHAR_FLOOR), + CHAR_getInt( cindex,CHAR_X ), + CHAR_getInt( cindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + { + char token[256]; + tocharaindex = PETMAIL_CheckPlayerExist( petindex, 0); + sprintf( token, "ͳʼ(%s)%s", + CHAR_getUseName( petindex), CHAR_getUseName( tocharaindex) ); + CHAR_talkToCli( cindex, -1, token, CHAR_COLORYELLOW); + } + return TRUE; + } + return FALSE; +} + +static PETMAIL_offmsg * PETMAIL_offmsgbuf; +BOOL PETMAIL_initOffmsgBuffer( int count ) +{ + int size = sizeof( PETMAIL_offmsg )*count ; + FILE *fp; + char filename[256]; + char line[2048]; + int linenum = 0; + + PETMAIL_offmsgbuf = (PETMAIL_offmsg*)allocateMemory( size ); + + if( PETMAIL_offmsgbuf == NULL ) return FALSE; + + PetMailTotalnums = 0; + + memset( PETMAIL_offmsgbuf, 0,size ); + + PETMAIL_offmsg_max = count; + snprintf( filename ,sizeof( filename ) ,"%s/%s", getStoredir(), PETMAILOFFMSGFILE); + fp = fopen( filename , "rt" ); + if( fp == NULL ) return TRUE; + + while( fgets( line, sizeof( line ), fp ) != NULL ){ + char buf[1024]; + int index; + if( !getStringFromIndexWithDelim( line, "|", 1, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + index = atoi( buf); + if( index >= PETMAIL_offmsg_max ) { + print( "index over offmsg_max [%d]\n", index); + continue; + } + if( PETMAIL_offmsgbuf[index].use == TRUE) { + print( "offmsg already use index[%d]\n", index); + continue; + } + + if( !getStringFromIndexWithDelim( line, "|", 2, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + PETMAIL_offmsgbuf[index].send_tm = atoi( buf); + + if( !getStringFromIndexWithDelim( line, "|", 3, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + PETMAIL_offmsgbuf[index].color = atoi( buf); + + if( !getStringFromIndexWithDelim( line, "|", 4, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + strcpysafe( PETMAIL_offmsgbuf[index].text, + sizeof( PETMAIL_offmsgbuf[index].text), + buf); + + if( !getStringFromIndexWithDelim( line, "|", 5, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + strcpysafe( PETMAIL_offmsgbuf[index].destcd, + sizeof( PETMAIL_offmsgbuf[index].destcd), + buf); + + if( !getStringFromIndexWithDelim( line, "|", 6, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + makeStringFromEscaped(buf); + strcpysafe( PETMAIL_offmsgbuf[index].destcharname, + sizeof( PETMAIL_offmsgbuf[index].destcharname), + buf); + if( !getStringFromIndexWithDelim( line, "|", 7, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + strcpysafe( PETMAIL_offmsgbuf[index].srccd, + sizeof( PETMAIL_offmsgbuf[index].srccd), + buf); + if( !getStringFromIndexWithDelim( line, "|", 8, buf, sizeof( buf))) { + print( "read error line[%d]\n", linenum); + continue; + } + makeStringFromEscaped(buf); + strcpysafe( PETMAIL_offmsgbuf[index].srccharname, + sizeof( PETMAIL_offmsgbuf[index].srccharname), + buf); + linenum ++; + } + fclose( fp); + return TRUE; + +} + +BOOL PETMAIL_addOffmsg( int fromindex, char *tocdkey, char *tocharaname, + char *text , int color ) +{ + + int i; + + for( i = 0 ; i < PETMAIL_offmsg_max; i++ ) { + if( PETMAIL_offmsgbuf[i].use == 0 ) { + PETMAIL_offmsg *om = & PETMAIL_offmsgbuf[i]; + om->use = 1; + time( & om->send_tm ); + + strcpysafe( om->srccd , sizeof( om->srccd ), + CHAR_getChar( fromindex, CHAR_CDKEY)); + strcpysafe( om->srccharname , sizeof( om->srccharname ), + CHAR_getChar( fromindex, CHAR_NAME)); + strcpysafe( om->destcd , sizeof( om->destcd ), tocdkey ); + strcpysafe( om->destcharname , sizeof(om->destcharname), tocharaname); + strcpysafe( om->text , sizeof(om->text), text ); + om->color = color; + return i; + } + } + return -1; +} + +PETMAIL_offmsg *PETMAIL_getOffmsg( int offmsgindex) +{ + if( offmsgindex < 0 || offmsgindex >= PETMAIL_offmsg_max ) return NULL; + return &PETMAIL_offmsgbuf[offmsgindex]; +} + +BOOL PETMAIL_deleteOffmsg( int offmsgindex) +{ + if( offmsgindex < 0 || offmsgindex >= PETMAIL_offmsg_max ) return FALSE; + PETMAIL_offmsgbuf[offmsgindex].use = FALSE; + return TRUE; +} + +void PETMAIL_proc( void ) +{ + int i; + static time_t PETMAIL_check_time_store = 0; + time_t t; + time( &t ); + if( t < PETMAIL_check_time_store) return; + PETMAIL_check_time_store = t + PETMAIL_CHECK_OFFMSG_EXPIRE_INTERVAL; + for(i = 0; i < PETMAIL_offmsg_max ; i++){ + if( PETMAIL_offmsgbuf[i].use && PETMAIL_offmsgbuf[i].send_tm < ( t - PETMAIL_OFFMSG_TIMEOUT )){ + PETMAIL_offmsgbuf[i].use = FALSE; + } + } +} + +BOOL storePetmail( void) +{ + FILE *fp; + char filename[256]; + char escapebuf1[ 64],escapebuf2[ 64]; + int i; + + /* ̻ ëƻ */ + snprintf( filename ,sizeof( filename ) ,"%s/%s" , + getStoredir(), PETMAILOFFMSGFILE); + fp = fopen( filename , "wt" ); + if( fp == NULL ) return FALSE; + for(i = 0; i < PETMAIL_offmsg_max ; i++){ + if( PETMAIL_offmsgbuf[i].use ){ + fprintf( fp, "%d|%ud|%d|%s|%s|%s|%s|%s|", + i, (unsigned int)PETMAIL_offmsgbuf[i].send_tm, + PETMAIL_offmsgbuf[i].color, + PETMAIL_offmsgbuf[i].text, + PETMAIL_offmsgbuf[i].destcd, + makeEscapeString( PETMAIL_offmsgbuf[i].destcharname, + escapebuf1, sizeof( escapebuf1)), + PETMAIL_offmsgbuf[i].srccd, + makeEscapeString( PETMAIL_offmsgbuf[i].srccharname, + escapebuf2, sizeof( escapebuf2))); + } + } + fclose( fp); + return TRUE; +} + +BOOL PETMAIL_CheckPlayerExist( int index, int mode) +{ + int i; + char *searchcd = NULL; + char *searchname = NULL; + PETMAIL_offmsg *adof; + int playernum = CHAR_getPlayerMaxNum(); + + if( mode == 0 ) { + adof = PETMAIL_getOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + if( adof == NULL ) return FALSE; + searchcd = adof->destcd; + searchname = adof->destcharname; + } + else if( mode == 1 ) { + searchcd = CHAR_getChar( index, CHAR_OWNERCDKEY); + searchname = CHAR_getChar( index, CHAR_OWNERCHARANAME); + if( searchcd == "\0" || searchname == "\0" ) return FALSE; + } + for( i = 0 ; i < playernum ; i ++) { + if( CHAR_CHECKINDEX( i) && + strcmp( CHAR_getChar( i, CHAR_CDKEY), searchcd ) == 0 && + strcmp( CHAR_getChar( i, CHAR_NAME), searchname) == 0 ) { + return i; + } + } + return -1; +} + +void PETMAIL_Loopfunc( int index) +{ + int mode = CHAR_getInt( index, CHAR_MAILMODE); + switch( mode ){ + case CHAR_PETMAIL_IDLE1: + PETMAIL_IdleProc1( index); + break; + case CHAR_PETMAIL_IDLE2: + PETMAIL_IdleProc2( index); + break; + case CHAR_PETMAIL_RETURNWAIT://ȴ + PETMAIL_ReturnWait( index); + break; + case CHAR_PETMAIL_IDLE3: + PETMAIL_IdleProc3( index); + break; + case CHAR_PETMAIL_IDLE4://Ѱ + PETMAIL_IdleProc4( index); + break; + case CHAR_PETMAIL_IDLE5: //ʱ޷ҵ + PETMAIL_IdleProc5( index); + break; + default: + break; + } +} + +static int PETMAIL_getIdleTime( int index) +{ +#define PETMAIL_DIVRANGE 25 // +#define PETMAIL_IDLELEVELRANGE 10 // +#define PETMAIL_IDLEUNITTIME 3 // + int d; +#ifdef _PETMAIL_TIME + int dex; + if(getPetMailTime()>0) + dex = getPetMailTime(); + else + dex = CHAR_getWorkInt( index, CHAR_WORKQUICK); +#else + int dex = CHAR_getWorkInt( index, CHAR_WORKQUICK) ; +#endif + + d = dex / PETMAIL_DIVRANGE; + if( d < 0 ) d = 0; + if( d > PETMAIL_IDLELEVELRANGE ) d = PETMAIL_IDLELEVELRANGE; + d = PETMAIL_IDLELEVELRANGE - d ; + + return d * PETMAIL_IDLEUNITTIME; + +#undef PETMAIL_DIVRANGE +#undef PETMAIL_IDLELEVELRANGE +#undef PETMAIL_IDLEUNITTIME +} + +static void PETMAIL_sendPetmail( int index, int tocharaindex) +{ + int index_to_my_info; + int itemindex,ret; + index_to_my_info = ADDRESSBOOK_getIndexInAddressbook( tocharaindex, + CHAR_getChar( index, CHAR_OWNERCDKEY), + CHAR_getChar( index, CHAR_OWNERCHARANAME)); + + if( index_to_my_info < 0 ) { + char msgbuf[512]; + + snprintf( msgbuf, sizeof( msgbuf), + "%s%s ˣ" + "춶ԷûƬż˻ˡ", + CHAR_getChar( index, CHAR_OWNERCHARANAME), + CHAR_getUseName( index)); + CHAR_talkToCli( tocharaindex, -1, msgbuf, CHAR_COLORWHITE); + } + //Syu Add 06/16 + else if( CHAR_getInt(tocharaindex,CHAR_FLOOR) >=8200 && + CHAR_getInt(tocharaindex,CHAR_FLOOR) <= 8213 ){ + char msgbuf[512]; + snprintf( msgbuf, sizeof( msgbuf), + "Ӣսü͵ߣ" ); + CHAR_talkToCli( tocharaindex, -1, msgbuf, CHAR_COLORWHITE); + } + else { + struct tm tm1; + char textbuffer[2048]; + char escapebuf[128]; + int fd; + PETMAIL_offmsg *offmsg; + itemindex = CHAR_getItemIndex( index, CHAR_STARTITEMARRAY); + ret = CHAR_addItemSpecificItemIndex( tocharaindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE){ + CHAR_DropItem( index, CHAR_STARTITEMARRAY); + LogItem( + CHAR_getChar( tocharaindex, CHAR_NAME ), + CHAR_getChar( tocharaindex, CHAR_CDKEY ), + itemindex, + "pm_putground(->õ)", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + else { + CHAR_setItemIndex( index, CHAR_STARTITEMARRAY, -1); + CHAR_sendItemDataOne( tocharaindex, ret); + LogItem( + CHAR_getChar( tocharaindex, CHAR_NAME ), + CHAR_getChar( tocharaindex, CHAR_CDKEY ), + itemindex, + "pm_getitem(->յĵ)", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + offmsg = PETMAIL_getOffmsg( + CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), + sizeof( tm1)); + snprintf( textbuffer, sizeof( textbuffer), + "%2d/%02d %2d:%02d|%s|%d|%d|%s|%d", + tm1.tm_mon +1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, + offmsg->text, + CHAR_getInt( index, CHAR_BASEIMAGENUMBER), + CHAR_getInt( index, CHAR_LV), + makeEscapeString( CHAR_getUseName( index), escapebuf, + sizeof( escapebuf)), + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER) + ); + fd = getfdFromCharaIndex( tocharaindex); + if( fd != -1 ) lssproto_MSG_send( fd , index_to_my_info , + textbuffer , offmsg->color ); + PETMAIL_deleteOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + CHAR_setInt( index, CHAR_PETMAILBUFINDEX, -1); + CHAR_setInt( index, CHAR_PETSENDMAILCOUNT, + CHAR_getInt( index, CHAR_PETSENDMAILCOUNT) +1); + { + char *cdkey = CHAR_getChar( index, CHAR_CDKEY); + if( cdkey) printl( LOG_TALK, "CDKEY=%s\tTEXT=%s" , cdkey, offmsg->text ); + else printl( LOG_TALK, "CDKEY=(null)\tTEXT=%s" , offmsg->text ); + } + } +} + +static void PETMAIL_IdleProc1( int index) +{ + + int tocharaindex; + int warp = FALSE; + + tocharaindex = PETMAIL_CheckPlayerExist( index, 0); + if( !CHAR_CHECKINDEX( tocharaindex) ) { + warp = TRUE; + }else { + if( CHAR_getInt( tocharaindex, CHAR_FLOOR) == 8215 ){//ͷ andy + warp = TRUE; + }else if( CHAR_getWorkInt( tocharaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE ){//вʼ + warp = TRUE; + }else if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){ + int battleindex = CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEINDEX ); + if( !BATTLE_CHECKINDEX( battleindex ) || BattleArray[battleindex].flgTime > 60 ){ + warp = TRUE; + } + }else { + int ret; + int distance; + distance = NPC_Util_CharDistance( tocharaindex, index); + if( distance > CHAR_DEFAULTSEESIZ /2 ) { + warp = TRUE; + }else if( distance > 1 ){ + int dir = NPC_Util_GetDirCharToChar( index, tocharaindex, 0); + if( dir != -1 ) { + dir = NPC_Util_SuberiWalk( index, dir); + } + if( dir != -1 ) { + ret = CHAR_walk( index, dir, 0); + if( ret != CHAR_WALKSUCCESSED) { + dir = -1; + } + } + if( dir == -1 ) { + warp = TRUE; + } + }else { + PETMAIL_sendPetmail( index, tocharaindex); + CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_RETURNWAIT); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + } + } + } + if( warp) { + if( CHAR_getInt( index, CHAR_FLOOR) != PETMAIL_SPOOLFLOOR) { + CHAR_warpToSpecificPoint( index, + PETMAIL_SPOOLFLOOR, + PETMAIL_SPOOLX,PETMAIL_SPOOLX); + CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_IDLE2); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + } + } +} + +static void PETMAIL_IdleProc2( int index) +{ + unsigned int t = CHAR_getInt( index, CHAR_PETMAILIDLETIME); + if( NowTime.tv_sec > t + PETMAIL_getIdleTime( index)) { + int tocharaindex; + int cnt; + tocharaindex = PETMAIL_CheckPlayerExist( index, 0); + if( tocharaindex != -1 ) { + if( CHAR_getInt( tocharaindex, CHAR_FLOOR) == 8215 ){//ͷ andy + }else if( CHAR_getWorkInt( tocharaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE ){//вʼ + }else if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + }else { + int fl, x, y, ch_x, ch_y; + fl = CHAR_getInt( tocharaindex, CHAR_FLOOR); + ch_x = CHAR_getInt( tocharaindex, CHAR_X); + ch_y = CHAR_getInt( tocharaindex, CHAR_Y); + for( cnt = 0; cnt < 10; cnt ++ ) { + x = RAND( ch_x -1, ch_x + 1); + y = RAND( ch_y -1, ch_y + 1); + if( MAP_walkAble( tocharaindex, fl,x,y)) { + break; + } + } + if( cnt == 10 ) { + x = ch_x; y = ch_y; + } + CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_RETURNWAIT); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_warpToSpecificPoint( index,fl, x,y); + PETMAIL_sendPetmail( index, tocharaindex); + return; + } + }else{ + if( NowTime.tv_sec > t + PETMAIL_IDLETIMEOUT ) { + PETMAIL_deleteOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + CHAR_setInt( index, CHAR_MAILMODE, CHAR_PETMAIL_IDLE3); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL1); + } + return; + } + if( NowTime.tv_sec > t + PETMAIL_BATTLETIMEOUT ) { + PETMAIL_deleteOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + CHAR_setInt( index, CHAR_MAILMODE, CHAR_PETMAIL_IDLE3); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL1); + } + } +} + +static void PETMAIL_ReturnWait( int index) +{ + unsigned int t = CHAR_getInt( index, CHAR_PETMAILIDLETIME); + if( NowTime.tv_sec > t + PETMAIL_IDLETIME) { + CHAR_setInt( index, CHAR_MAILMODE, CHAR_PETMAIL_IDLE3); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL1); + } +} + +static void PETMAIL_IdleProc3( int index) +{ + + int tocharaindex; + int warp = FALSE; + + tocharaindex = PETMAIL_CheckPlayerExist( index, 1); + if( tocharaindex == -1 ) { + warp = TRUE; + }else { + if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE) { + int ret ; + int distance; + distance = NPC_Util_CharDistance( tocharaindex, index); + if( distance > CHAR_DEFAULTSEESIZ /2 ) { + warp = TRUE; + + }else if( distance > 1 ){ + int dir = NPC_Util_GetDirCharToChar( index, tocharaindex, 0); + if( dir != -1 ) { + dir = NPC_Util_SuberiWalk( index, dir); + } + if( dir != -1 ) { + ret = CHAR_walk( index, dir, 0); + if( ret != CHAR_WALKSUCCESSED) { + dir = -1; + } + } + if( dir == -1 ) { + warp = TRUE; + } + }else { + //andy_reEdit 2003/05/30 + warp = TRUE; +/* CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_IDLE5); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + PETMAIL_returnMail( index, tocharaindex); +*/ + } + } + } + if( warp) { + CHAR_warpToSpecificPoint( index, + PETMAIL_SPOOLFLOOR, + PETMAIL_SPOOLX,PETMAIL_SPOOLX); + CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_IDLE4); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + } +} +static void PETMAIL_IdleProc4( int index) +{ + unsigned int t = CHAR_getInt( index, CHAR_PETMAILIDLETIME); + { + int tocharaindex; + int cnt; + tocharaindex = PETMAIL_CheckPlayerExist( index, 1);//Ѱ + if( tocharaindex != -1 ) { + if( CHAR_getWorkInt( tocharaindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE && + CHAR_getWorkInt( tocharaindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_FREE ){ + + int fl, x, y, ch_x, ch_y;//ص + + fl = CHAR_getInt( tocharaindex, CHAR_FLOOR); + ch_x = CHAR_getInt( tocharaindex, CHAR_X); + ch_y = CHAR_getInt( tocharaindex, CHAR_Y); + for( cnt = 0; cnt < 10; cnt ++ ) { + x = RAND( ch_x -1, ch_x + 1); + y = RAND( ch_y -1, ch_y + 1); + if( MAP_walkAble( index, fl,x,y)) { + break; + } + } + if( cnt == 10 ) { + x = ch_x; y = ch_y; + } + CHAR_setInt( index, CHAR_MAILMODE,CHAR_PETMAIL_IDLE5); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + CHAR_warpToSpecificPoint( index,fl, x,y); + PETMAIL_returnMail( index, tocharaindex); + } + }else { + if( NowTime.tv_sec > t + PETMAIL_IDLE_RETURNOWNER ) {//ȴʱ + int itemindex; + CHAR_warpToSpecificPoint( index, //صԭ + CHAR_getInt( index, CHAR_PETMAILFROMFLOOR), + CHAR_getInt( index, CHAR_PETMAILFROMX), + CHAR_getInt( index, CHAR_PETMAILFROMY)); + + CHAR_setInt( index, CHAR_MAILMODE, CHAR_PETMAIL_IDLE5);//ı״̬ + CHAR_setInt( index, CHAR_LOOPINTERVAL, PETMAIL_LOOPINTERVAL2); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, NowTime.tv_sec); + if( CHAR_getInt( index, CHAR_PETMAILIDLETIME) != -1 ) { + PETMAIL_deleteOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + } + itemindex = CHAR_getItemIndex( index, CHAR_STARTITEMARRAY);//ɾ + if( ITEM_CHECKINDEX( itemindex ) ) { + CHAR_DropItem( index, CHAR_STARTITEMARRAY); + + LogItem( + CHAR_getChar( index, CHAR_OWNERCHARANAME ), + CHAR_getChar( index, CHAR_OWNERCDKEY ), + itemindex, + "pm_returntimeout(->ʱɾ)", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + } + } + } + +} + +static void PETMAIL_IdleProc5( int index) +{ + unsigned int t = CHAR_getInt( index, CHAR_PETMAILIDLETIME); + if( NowTime.tv_sec > t + PETMAIL_IDLEDISCARD) { + Char *ch; + CHAR_setInt( index, CHAR_MAILMODE, CHAR_PETMAIL_NONE); + CHAR_setInt( index, CHAR_PETMAILIDLETIME, 0); + +#ifdef _FIX_PETMAIL // WON ADD + CHAR_setInt( index, CHAR_PUTPETTIME, NowTime.tv_sec ); +#endif +#ifdef _PETMAIL_DEFNUMS + PETMAIL_delPetMailTotalnums( 1); //M PET ɳ + if( PetMailTotalnums < 0 ) PetMailTotalnums = 0; +#endif + ch = CHAR_getCharPointer( index); + if( ch != NULL ) { + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), "" ); + CHAR_constructFunctable( index); + } +#ifdef _PET_LOSTPET + CHAR_CharSaveLostPet( index, 2); + LogPet( + "ϵͳ", + "Watchfunc", + CHAR_getChar( index, CHAR_NAME), + CHAR_getInt( index, CHAR_LV), + "timeout_lost(ϵͳ-ɳ)", + CHAR_getInt( index, CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + CHAR_getChar( index, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + print("ϵͳ-ɳ:%s\n", CHAR_getUseName( index)); + CHAR_CharaDelete( index); +#else + LogPet( + CHAR_getChar( index, CHAR_OWNERCHARANAME ), + CHAR_getChar( index, CHAR_OWNERCDKEY ), + CHAR_getChar( index, CHAR_NAME), + CHAR_getInt( index, CHAR_LV), + "FreePet(ʱɳ)", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + CHAR_getChar( index, CHAR_UNIQUECODE) + ); +#endif + + }else { + int tocharaindex = PETMAIL_CheckPlayerExist( index, 1); + if( tocharaindex != -1 ) { + if( NPC_Util_CharDistance( tocharaindex, index ) > CHAR_DEFAULTSEESIZ/2) { + int fl, x, y, ch_x, ch_y; + int cnt; + fl = CHAR_getInt( tocharaindex, CHAR_FLOOR); + ch_x = CHAR_getInt( tocharaindex, CHAR_X); + ch_y = CHAR_getInt( tocharaindex, CHAR_Y); + for( cnt = 0; cnt < 10; cnt ++ ) { + x = RAND( ch_x -1, ch_x + 1); + y = RAND( ch_y -1, ch_y + 1); + if( MAP_walkAble( index, fl,x,y)) { + break; + } + } + if( cnt == 10 ) { + x = ch_x; y = ch_y; + } + CHAR_warpToSpecificPoint( index,fl, x,y); + } + } + } +} + +static void PETMAIL_returnMail( int index, int tocharaindex) +{ + char msgbuf[512]; + int itemindex = CHAR_getItemIndex( index, CHAR_STARTITEMARRAY); + if( ITEM_CHECKINDEX( itemindex ) ) { + int ret = CHAR_addItemSpecificItemIndex( tocharaindex, itemindex); + + if( ret < 0 || ret >= CHAR_MAXITEMHAVE){ + CHAR_DropItem( index, CHAR_STARTITEMARRAY); + + LogItem( + CHAR_getChar( tocharaindex, CHAR_NAME ), + CHAR_getChar( tocharaindex, CHAR_CDKEY ), + itemindex, + "pm_returnputground(->߷õ)", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + }else { + CHAR_setItemIndex( index, CHAR_STARTITEMARRAY, -1); + CHAR_sendItemDataOne( tocharaindex, ret); + } + } + +#ifdef _PETMAIL_DEFNUMS + { + int petmailnums = CHAR_getWorkInt( tocharaindex, CHAR_PETMAILNUMS); + petmailnums--; + if( petmailnums < 0 ) petmailnums = 0; + CHAR_setWorkInt( tocharaindex, CHAR_PETMAILNUMS, petmailnums); + } +#endif + if( CHAR_getInt( index, CHAR_PETMAILBUFINDEX) != -1 ) { + snprintf( msgbuf, sizeof( msgbuf), + "%s ˣ" + "ƺ޷ż", + CHAR_getUseName( index)); + CHAR_talkToCli( tocharaindex, -1, msgbuf, CHAR_COLORWHITE); + PETMAIL_deleteOffmsg( CHAR_getInt( index, CHAR_PETMAILBUFINDEX)); + }else { + snprintf( msgbuf, sizeof( msgbuf), + "%s ˣ", CHAR_getUseName( index)); + CHAR_talkToCli( tocharaindex, -1, msgbuf, CHAR_COLORWHITE); + } + +#ifdef _PETMAIL_DEFNUMS + CHAR_AutoPickupMailPet( tocharaindex, index); +#endif + +} + + +#ifdef _PETMAIL_DEFNUMS +void CHAR_AutoPickupMailPet( int charaindex, int petindex ) +{ + int objindex; + int havepetindex; + char category[3]; + Char *ch; + if( !CHAR_CHECKINDEX( charaindex ) ) return; +#ifdef _AVID_TRADETRYBUG // + if( CHAR_getWorkInt( charaindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE ){ + CHAR_talkToCli( charaindex, -1, "״̬޷Զʰʼ", CHAR_COLORYELLOW ); + return; + } +#endif + if( !CHAR_CHECKINDEX( petindex ) ) return; + havepetindex = CHAR_getCharPetElement( charaindex); + if( havepetindex == -1 ) { + + CHAR_talkToCli(charaindex,-1,"޷Զʰʼ",CHAR_COLORYELLOW); + // WON ADD + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "Pet_Full(޷ʰ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + return; + } + ch = CHAR_getCharPointer( petindex); + if( ch == NULL ) return; + + objindex = CHAR_getWorkInt( petindex, CHAR_WORKOBJINDEX ); + CHAR_ObjectDelete(objindex); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setCharPet( charaindex, havepetindex, petindex); + + CHAR_setChar( petindex, CHAR_OWNERCDKEY, CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( charaindex, CHAR_NAME)); + + snprintf( category,sizeof( category),"K%d",havepetindex); + CHAR_sendStatusString( charaindex, category); + snprintf( category,sizeof( category),"W%d",havepetindex); + CHAR_sendStatusString( charaindex, category); + + CHAR_setInt( petindex, CHAR_PUTPETTIME, 0); + CHAR_setWorkInt( petindex, CHAR_WORKOBJINDEX, -1); + CHAR_setInt( petindex, CHAR_MAILMODE, CHAR_PETMAIL_NONE); + PETMAIL_delPetMailTotalnums( 1); // M PET Զ + + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]),""); + CHAR_setInt( petindex, CHAR_LOOPINTERVAL, 0); + CHAR_constructFunctable( petindex); + CHAR_complianceParameter( petindex ); + + if( PetMailTotalnums < 0 ) PetMailTotalnums = 0; + { + char mesg[256]; + char *p = NULL; + p = CHAR_getChar( petindex, CHAR_USERPETNAME); + if( strlen( p) == 0 ) { + p = CHAR_getChar( petindex, CHAR_NAME); + } + snprintf( mesg,sizeof(mesg), "ʰʼ %s", p); + CHAR_talkToCli(charaindex,-1,mesg,CHAR_COLORYELLOW); + } +// LogPet( +// CHAR_getChar( charaindex, CHAR_NAME ), +// CHAR_getChar( charaindex, CHAR_CDKEY ), +// CHAR_getChar( petindex, CHAR_NAME), +// CHAR_getInt( petindex, CHAR_LV), +// "PickupMailPet(Զջʳ)", +// CHAR_getInt( charaindex,CHAR_FLOOR), +// CHAR_getInt( charaindex,CHAR_X ), +// CHAR_getInt( charaindex,CHAR_Y ), +// CHAR_getChar( petindex, CHAR_UNIQUECODE) +// ); + return; +} +#endif + +int PETMAIL_getPetMailTotalnums() +{ +#ifdef _PETMAIL_DEFNUMS + if( PetMailTotalnums < 0 ) PetMailTotalnums = 0; + if( PetMailTotalnums >= PETMAIL_DEFTOTALNUM ) PetMailTotalnums = PETMAIL_DEFTOTALNUM; + return PetMailTotalnums; +#else + return 0; +#endif +} + +void PETMAIL_delPetMailTotalnums( int numflg) +{ +#ifdef _PETMAIL_DEFNUMS + PetMailTotalnums = PetMailTotalnums - numflg; + if( PetMailTotalnums < 0 ) PetMailTotalnums = 0; +#endif +} + +void PETMAIL_setPetMailTotalnums( int numflg) +{ + PetMailTotalnums = numflg; + if( PetMailTotalnums < 0 ) PetMailTotalnums = 0; + if( PetMailTotalnums > PETMAIL_DEFTOTALNUM+10 ) PetMailTotalnums = PETMAIL_DEFTOTALNUM + 5; +} + + +int PETMAIL_CheckIsMyOffmsg( int fromindex, char *tocdkey, char *tocharaname) +{ + int i, nums=0; + for( i = 0 ; i < PETMAIL_offmsg_max; i++ ) { + if( PETMAIL_offmsgbuf[i].use == 0 ) continue; + if( !strcmp( tocdkey, PETMAIL_offmsgbuf[i].destcd) && + !strcmp( tocharaname, PETMAIL_offmsgbuf[i].destcharname) ){ + nums++; + } + } + return nums; +} + + + diff --git a/char/skill.c b/char/skill.c new file mode 100644 index 0000000..d692cd8 --- /dev/null +++ b/char/skill.c @@ -0,0 +1,644 @@ +#include "version.h" +#include +#include +#include + +#include "skill.h" +#include "util.h" +#include "char.h" + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +#include "battle.h" +#include "profession_skill.h" +#endif + + +static SKILL_intDataSetting SKILL_setint[SKILL_DATAINTNUM]={ + {"lv"}, /* SKILL_LEVEL */ + {"id"}, /* SKILL_ID */ +}; + +static SKILL_charDataSetting SKILL_setchar[SKILL_DATACHARNUM]={ +}; + + + + +static char SKILL_dataString[STRINGBUFSIZ]; + +char* SKILL_makeStringFromSkillData( Skill* sk ) +{ + int i; + int strlength=0; + + for( i = 0 ; i < SKILL_DATAINTNUM ; i ++ ){ + char linedata[128]; + snprintf( linedata , sizeof(linedata), + "%s=%d" NONCHAR_DELIMITER, + SKILL_setint[i].dumpskill, sk->data[i] ); + + strcpysafe( &SKILL_dataString[strlength], + sizeof( SKILL_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( SKILL_dataString ) )goto RETURN; + } + + for( i = 0 ; i < SKILL_DATACHARNUM ; i ++ ){ + char linedata[128]; + char escapebuffer[128]; + snprintf( linedata, sizeof(linedata), + "%s=%s" NONCHAR_DELIMITER, + SKILL_setchar[i].dumpskill, + makeEscapeString(sk->string[i].string,escapebuffer, + sizeof(escapebuffer))); + + strcpysafe( &SKILL_dataString[strlength], + sizeof( SKILL_dataString ) - strlength, + linedata ); + strlength += strlen( linedata ); + if( strlength > sizeof( SKILL_dataString ) )goto RETURN; + } + +RETURN: + dchop( SKILL_dataString , NONCHAR_DELIMITER ); + + return SKILL_dataString; +} + + +BOOL SKILL_makeSkillFromStringToArg( char* src, Skill* sk ) +{ + int readindex=1; + while( 1 ){ + BOOL ret; + char linebuf[512]; + char first[256]; + char second[256]; + int i; + + + ret = getStringFromIndexWithDelim( src ,NONCHAR_DELIMITER , + readindex, + linebuf, sizeof( linebuf ) ); + if( ret == FALSE ) + break; + + ret = getStringFromIndexWithDelim( linebuf ,"=", 1, + first, sizeof( first ) ); + if( ret == FALSE ) return FALSE; + strcpysafe( second , sizeof( second ), + linebuf + strlen(first) + strlen("=") ); + + for( i = 0 ; i < SKILL_DATAINTNUM ; i ++ ){ + if( strcmp(first ,SKILL_setint[i].dumpskill) == 0 ){ + sk->data[i] = atoi( second ); + goto NEXT; + } + } + + for( i = 0 ; i < SKILL_DATACHARNUM ; i ++ ){ + if( strcmp(first ,SKILL_setchar[i].dumpskill) == 0 ){ + strcpysafe( sk->string[i].string, + sizeof(sk->string[i].string), + makeStringFromEscaped(second) ); + goto NEXT; + } + } + + fprint( "??? : %s[%s]\n" , linebuf, first ); + + NEXT: + readindex++; + } + + return TRUE; +} + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +INLINE int SKILL_getRealInt( Skill* skill, int element) +{ + return skill->data[element]; +} +#endif + +INLINE int SKILL_getInt( Skill* skill, int element) +{ + int value = skill->data[element]; + + if( element == SKILL_LEVEL ) value /= 100; + + return value; +} + + +INLINE int SKILL_setInt( Skill* skill, int element, int new) +{ + int buf = SKILL_getInt( skill, element ); + skill->data[element] = new; + return buf; +} + +#ifndef _PROFESSION_SKILL // WON ADD ְҵ +static void SKILL_setitemlimit( int charaindex, Skill* sk ); +static void SKILL_setmerchant( int charaindex, Skill* sk ); +static void SKILL_setlevel( int charaindex, Skill* sk ); +#endif + +static SKILL_table SKILL_tbl[]={ + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + { 100, NULL}, // 1 + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, + { 100, NULL}, // 16 +#else + {8,SKILL_setlevel}, /* SKILL_FIRE */ + {4,NULL}, /* SKILL_MAGICIAN */ + {4,NULL}, /* SKILL_PREIST */ + {8,SKILL_setitemlimit}, /* SKILL_ALOTOFTHINGS */ + {8,NULL}, /* SKILL_AVOIDRATEUP */ + {4,SKILL_setlevel}, /* SKILL_DETERMINEITEM */ + {5,SKILL_setlevel}, /* SKILL_DETERMINEOTHERS */ + {8,SKILL_setmerchant}, /* SKILL_MERCHANT */ + {8,SKILL_setlevel}, /* SKILL_HEALER */ + {8,SKILL_setlevel}, /* SKILL_LARGEVOICE */ +#endif +}; + + +#ifndef _PROFESSION_SKILL // WON ADD ְҵ +static void SKILL_setitemlimit( int charaindex, Skill* sk ) +{ + static int itemlimit[9]={ + 7 + 8 + 4*0, + 7 + 8 + 4*1, + 7 + 8 + 4*2, + 7 + 8 + 4*3, + 7 + 8 + 4*4, + 7 + 8 + 4*5, + 7 + 8 + 4*6, + 7 + 8 + 4*7, + 7 + 8 + 4*8, + }; + int level; + if( !CHAR_CHECKINDEX(charaindex) )return; + if( sk->data[SKILL_IDENTITY] != SKILL_ALOTOFTHINGS )return; + level = sk->data[SKILL_LEVEL]; + if( level < 0 )level = 0; + if( level>=arraysizeof(itemlimit) ) level=arraysizeof(itemlimit) - 1; +} + + +static void SKILL_setmerchant( int charaindex, Skill* sk ) +{ + int level; + int merchantlevel=0; + + if( !CHAR_CHECKINDEX(charaindex) )return; + if( sk->data[SKILL_IDENTITY] != SKILL_MERCHANT )return; + + level = sk->data[SKILL_LEVEL]; + if( level < 0 )level = 0; + if( level >= SKILL_tbl[sk->data[SKILL_IDENTITY]].maxlevel ) + level = SKILL_tbl[sk->data[SKILL_IDENTITY]].maxlevel; + + SETHIGHVALUE(merchantlevel,(100 - level*5)); + SETLOWVALUE(merchantlevel,(20 + level*5)); + + CHAR_setInt( charaindex,CHAR_MERCHANTLEVEL,merchantlevel ); +} + + +static void SKILL_setlevel( int charaindex, Skill* sk ) +{ + static struct skillvalset + { + SKILL_ID id; + CHAR_DATAINT charadataindex; + } skvalset[] = { + { SKILL_DETERMINEITEM, CHAR_DETERMINEITEM }, + { SKILL_DETERMINEOTHERS, CHAR_RADARSTRENGTH }, + { SKILL_HEALER, CHAR_HEALERLEVEL }, + { SKILL_LARGEVOICE, CHAR_CHATVOLUME }, + }; + int id; + int i; + int index=-1; + int level; + + if( !CHAR_CHECKINDEX(charaindex) )return; + id = sk->data[SKILL_IDENTITY]; + for( i=0 ; idata[SKILL_LEVEL]; + if( level < 0 )level = 0; + if( level >= SKILL_tbl[id].maxlevel ) + level = SKILL_tbl[id].maxlevel; + + CHAR_setInt(charaindex,skvalset[index].charadataindex,level ); +} +#endif + + + + + +#define SKILLSTRINGBUFSIZ 256 + +static char ITEM_statusStringBuffer[SKILLSTRINGBUFSIZ]; + + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +char* SKILL_makeSkillStatusString( Skill* skill, int charaindex, int skill_num ) +{ + int skillindex=SKILL_getInt( skill,SKILL_IDENTITY); + int Pskill=PROFESSION_SKILL_getskillArray( skillindex); + int skill_level=0, cost_mp=0; + + // \ܵȼ + skill_level = SKILL_getInt( skill, SKILL_LEVEL); + + // ķMP + if( (cost_mp = PROFESSION_MAGIC_COST_MP( charaindex, skill_num )) == -1 ) + cost_mp = PROFESSION_SKILL_getInt( Pskill, PROFESSION_SKILL_COST_MP); + + snprintf( ITEM_statusStringBuffer, sizeof( ITEM_statusStringBuffer ), + "%d|%d|%d|%d|%d|%d|%d|%s|%s", + PROFESSION_SKILL_getInt( Pskill, PROFESSION_SKILL_USE_FLAG), + SKILL_getInt(skill,SKILL_IDENTITY), + PROFESSION_SKILL_getInt( Pskill, PROFESSION_SKILL_TARGET), + PROFESSION_SKILL_getInt( Pskill, PROFESSION_SKILL_KIND), + PROFESSION_SKILL_getInt( Pskill, PROFESSION_SKILL_ICON), + cost_mp, + skill_level, + PROFESSION_SKILL_getChar( Pskill, PROFESSION_SKILL_NAME), + PROFESSION_SKILL_getChar( Pskill, PROFESSION_SKILL_TXT) ); + + return ITEM_statusStringBuffer; +} +#else +char* SKILL_makeSkillStatusString( Skill* skill ) +{ + snprintf( ITEM_statusStringBuffer, + sizeof( ITEM_statusStringBuffer ), + "%d|%d", + SKILL_getInt(skill,SKILL_IDENTITY), + SKILL_getInt(skill,SKILL_LEVEL) ); + + + return ITEM_statusStringBuffer; +} +#endif + + + +char* SKILL_makeSkillFalseString( void ) +{ + snprintf( ITEM_statusStringBuffer, + sizeof( ITEM_statusStringBuffer ), + "|" ); + return ITEM_statusStringBuffer; +} + + +BOOL SKILL_CHECKID( int skillid ) +{ + if( SKILL_NUM <= skillid && skillid > 0 )return FALSE; + return TRUE; +} + +BOOL SKILL_makeSkillData( Skill* sk ,int skid, int lev ) +{ + sk->data[SKILL_LEVEL] = lev; + sk->data[SKILL_IDENTITY] = skid; + + return TRUE; +} + +int SKILL_levelup( Skill* sk ) +{ + int id = sk->data[SKILL_IDENTITY]; + if( !SKILL_CHECKID(id) )return -1; + sk->data[SKILL_LEVEL] ++; + sk->data[SKILL_LEVEL] = min( sk->data[SKILL_LEVEL], + SKILL_tbl[id].maxlevel ); + return TRUE; +} + +int SKILL_getLevelFromSkillID( int charaindex, SKILL_ID id ) +{ + int i; + if( !CHAR_CHECKINDEX(charaindex) )return -1; + for( i=0 ; iuse && sk->skill.data[SKILL_IDENTITY] == id ) + return sk->skill.data[SKILL_LEVEL]; + + } + return -1; +} + +BOOL SKILL_getUpableSkillID( int charaindex,char* buf, int buflen ) +{ + int i; + if( !CHAR_CHECKINDEX(charaindex)) return FALSE; + if( buflen <= 0 )return FALSE; + buf[0] = '\0'; + for( i=0 ; iuse + && SKILL_CHECKID(chsk->skill.data[SKILL_IDENTITY]) + && chsk->skill.data[SKILL_LEVEL] + < SKILL_tbl[chsk->skill.data[SKILL_IDENTITY]].maxlevel ){ + char tmpbuf[512]; + snprintf( tmpbuf,sizeof(tmpbuf),"%d|", + chsk->skill.data[SKILL_IDENTITY] ); + strcatsafe( buf, buflen,tmpbuf ); + } + } + dchop(buf,"|"); + return TRUE; +} + +void SKILL_skillEffect( int charaindex ) +{ + int i; + if( !CHAR_CHECKINDEX(charaindex) )return; + + if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) + return; + + for( i=0 ; iuse == FALSE )continue; + + skill = &cskill->skill; + id = skill->data[SKILL_IDENTITY]; + if( !SKILL_CHECKID(id) )continue; + + skfunc = (SKILLEFFECTFUNC)SKILL_tbl[id].effectfunc; + if( skfunc )skfunc(charaindex,skill); + } +} + + + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +// ȡʹħķMP +int PROFESSION_MAGIC_COST_MP( int charaindex, int skill_num ) +{ + int skill_level=0, dec_mp=0; + int Pskillid, skillid; + char *skill_name; + CHAR_HaveSkill* hskill; + + // \ + skillid = CHAR_getCharSkill( charaindex, skill_num); + Pskillid = PROFESSION_SKILL_getskillArray( skillid); + if( Pskillid == -1 ) return FALSE; + + // + skill_name = PROFESSION_SKILL_getChar( Pskillid, PROFESSION_SKILL_FUNCNAME); + + // ܵȼ + hskill = CHAR_getCharHaveSkill( charaindex, skill_num ); + skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_M( skill_level ); + + if( (strcmp( skill_name, "PROFESSION_VOLCANO_SPRINGS" )) == 0 ){ // ɽȪ + if( skill_level >= 10 ) dec_mp = 35; + else if( skill_level >= 7 ) dec_mp = 30; + else if( skill_level >= 5 ) dec_mp = 20; + else if( skill_level >= 3 ) dec_mp = 15; + else dec_mp = 10; + }else + if( (strcmp( skill_name, "PROFESSION_FIRE_BALL" )) == 0 ){ // + if( skill_level >= 9 ) dec_mp = 50; + else if( skill_level >= 7 ) dec_mp = 45; + else if( skill_level >= 5 ) dec_mp = 40; + else if( skill_level >= 3 ) dec_mp = 35; + else dec_mp = 30; + }else + if( (strcmp( skill_name, "PROFESSION_SUMMON_THUNDER" )) == 0 ){ // + if( skill_level >= 8 ) dec_mp = 30; + else if( skill_level >= 5 ) dec_mp = 25; + else if( skill_level >= 3) dec_mp = 20; + else dec_mp = 10; + }else + if( (strcmp( skill_name, "PROFESSION_CURRENT" )) == 0 ){ // +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ) dec_mp = 100; + else if( skill_level > 9 ) dec_mp = 90; + else if( skill_level > 8 ) dec_mp = 80; + else if( skill_level > 7 ) dec_mp = 70; + else if( skill_level > 6 ) dec_mp = 60; + else if( skill_level > 4 ) dec_mp = 50; + else if( skill_level > 2 ) dec_mp = 40; + else dec_mp = 30; +#else + if( skill_level >= 9 ) dec_mp = 80; + else if( skill_level >= 7 ) dec_mp = 60; + else if( skill_level >= 5 ) dec_mp = 50; + else if( skill_level >= 3 ) dec_mp = 40; + else dec_mp = 30; +#endif + }else + if( (strcmp( skill_name, "PROFESSION_STORM" )) == 0 ){ // +#ifdef _PROFESSION_ADDSKILL + if( skill_level > 8 ) dec_mp = 50; + else if( skill_level > 6 ) dec_mp = 45; + else if( skill_level > 4 ) dec_mp = 40; + else if( skill_level > 2 ) dec_mp = 35; + else dec_mp = 30; +#else + if( skill_level >= 10 ) dec_mp = 80; + else if( skill_level >= 6 ) dec_mp = 70; + else if( skill_level >= 5 ) dec_mp = 60; + else dec_mp = 50; +#endif + }else + if( (strcmp( skill_name, "PROFESSION_ICE_ARROW" )) == 0 ){ // + if( skill_level >= 8) dec_mp = 20; + else if( skill_level >= 4 ) dec_mp = 15; + else dec_mp = 10; + }else + if( (strcmp( skill_name, "PROFESSION_ICE_CRACK" )) == 0 ){ // +#ifdef _PROFESSION_ADDSKILL + if( skill_level >= 10 ) dec_mp = 80; + else if( skill_level > 8 ) dec_mp = 70; + else if( skill_level > 6 ) dec_mp = 60; + else if( skill_level > 4 ) dec_mp = 50; + else if( skill_level > 2 ) dec_mp = 40; + else dec_mp = 30; +#else + if( skill_level >= 9 ) dec_mp = 70; + else if( skill_level >= 7 ) dec_mp = 60; + else if( skill_level >= 5 ) dec_mp = 50; + else if( skill_level >= 3 ) dec_mp = 40; + else dec_mp = 30; +#endif + }else + if( (strcmp( skill_name, "PROFESSION_DOOM" )) == 0 ){ // ĩ + if( skill_level > 8 ) dec_mp = 150; + else if( skill_level > 4 ) dec_mp = 100; + else dec_mp = 50; + }else + if( (strcmp( skill_name, "PROFESSION_FIRE_SPEAR" )) == 0 ){ // ǹ + if( skill_level > 8 ) dec_mp = 80; + else if( skill_level > 6 ) dec_mp = 70; + else if( skill_level > 4 ) dec_mp = 60; + else if( skill_level > 2 ) dec_mp = 40; + else dec_mp = 30; + }else + if( (strcmp( skill_name, "PROFESSION_BLOOD_WORMS" )) == 0 ){ // Ѫ + if( skill_level >= 10 ) dec_mp = 15; + else if( skill_level >= 5 ) dec_mp = 10; + else dec_mp = 5; + }else + if( (strcmp( skill_name, "PROFESSION_SIGN" )) == 0 ){ // һѪ + + if( skill_level >= 8 ) dec_mp = 10; + else dec_mp = 5; + + }else + if( (strcmp( skill_name, "PROFESSION_ENCLOSE" )) == 0 ){ // + if( skill_level >= 10 ) dec_mp = 80; + else if( skill_level >= 8 ) dec_mp = 70; + else if( skill_level >= 5) dec_mp = 60; + else dec_mp = 50; + }else + if( (strcmp( skill_name, "PROFESSION_ICE_MIRROR" )) == 0 ){ // + if( skill_level >= 9 ) dec_mp = 40; + else if( skill_level >= 7 ) dec_mp = 35; + else if( skill_level >= 5 ) dec_mp = 30; + else if( skill_level >= 3 ) dec_mp = 25; + else dec_mp = 20; + }else + if( (strcmp( skill_name, "PROFESSION_FIRE_ENCLOSE" )) == 0 ){ // + if( skill_level >= 10 ) dec_mp = 50; + else if( skill_level >= 7 ) dec_mp = 40; + else if( skill_level >= 4 ) dec_mp = 30; + else dec_mp = 20; + }else + if( (strcmp( skill_name, "PROFESSION_ICE_ENCLOSE" )) == 0 ){ // + if( skill_level >= 10 ) dec_mp = 50; + else if( skill_level >= 7 ) dec_mp = 40; + else if( skill_level >= 4 ) dec_mp = 30; + else dec_mp = 20; + }else + if( (strcmp( skill_name, "PROFESSION_THUNDER_ENCLOSE" )) == 0 ){ // ׸ + if( skill_level >= 10 ) dec_mp = 50; + else if( skill_level >= 7 ) dec_mp = 40; + else if( skill_level >= 4 ) dec_mp = 30; + else dec_mp = 20; + }else + if( (strcmp( skill_name, "PROFESSION_TRANSPOSE" )) == 0 ){ // λλ + if( skill_level >= 10 ) dec_mp = 50; + else if( skill_level >= 9 ) dec_mp = 40; + else if( skill_level >= 7 ) dec_mp = 30; + else if( skill_level >= 4 ) dec_mp = 20; + else dec_mp = 10; + }else +#ifdef _PROFESSION_ADDSKILL + if( (strcmp( skill_name, "PROFESSION_RESIST_F_I_T" )) == 0 ){ // Ȼ + if( skill_level >= 10 ) dec_mp = 20; + else if( skill_level >= 9 ) dec_mp = 15; + else if( skill_level >= 6 ) dec_mp = 10; + else dec_mp = 5; + }else + if( (strcmp( skill_name, "PROFESSION_CALL_NATURE" )) == 0 ){ // Ȼ + + /*skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL); + if( skill_level >= 100 ) dec_mp = 50; + else if( skill_level > 95 ) dec_mp = 50; + else if( skill_level > 90 ) dec_mp = 50; + else if( skill_level > 85 ) dec_mp = 50; + else if( skill_level > 80 ) dec_mp = 50; + else if( skill_level > 60 ) dec_mp = 50; + else if( skill_level > 40 ) dec_mp = 50; + else if( skill_level > 20 ) dec_mp = 50; + else dec_mp = 50;*/ + dec_mp = 50; + }else + if( (strcmp( skill_name, "PROFESSION_BOUNDARY" )) == 0 ){ // Խ + char *pszP=NULL; + if( skill_level > 9 ) dec_mp = 20; + else if( skill_level > 6 ) dec_mp = 15; + else dec_mp = 10; + //Ƴmp粻ͬ + if( (pszP = strstr( PROFESSION_SKILL_getChar( Pskillid, PROFESSION_SKILL_OPTION), "ƽ" ) ) != NULL ){// ܵIJ + if( skill_level >= 9 ) dec_mp = 20; + else if( skill_level > 4 ) dec_mp = 15; + else if( skill_level > 2 ) dec_mp = 10; + else dec_mp = 5; + } + }else +#endif + { + return -1; + } + + return dec_mp; +} + + +INLINE int PROFESSION_CHANGE_SKILL_LEVEL_M( int skill_level ) +{ + if( skill_level > 90 )skill_level = 10; + else if( skill_level > 80 ) skill_level = 9; + else if( skill_level > 70 ) skill_level = 8; + else if( skill_level > 60 ) skill_level = 7; + else if( skill_level > 50 ) skill_level = 6; + else if( skill_level > 40 ) skill_level = 5; + else if( skill_level > 30 ) skill_level = 4; + else if( skill_level > 20 ) skill_level = 3; + else if( skill_level > 10 ) skill_level = 2; + else skill_level = 1; + + return skill_level; +} + + +INLINE int PROFESSION_CHANGE_SKILL_LEVEL_A( int skill_level ) +{ + if( skill_level >= 100 ) skill_level = 10; + else if( skill_level > 90 ) skill_level = 9; + else if( skill_level > 80 ) skill_level = 8; + else if( skill_level > 70 ) skill_level = 7; + else if( skill_level > 60 ) skill_level = 6; + else if( skill_level > 50 ) skill_level = 5; + else if( skill_level > 40 ) skill_level = 4; + else if( skill_level > 30 ) skill_level = 3; + else if( skill_level > 20 ) skill_level = 2; + else if( skill_level > 10 ) skill_level = 1; + else skill_level = 0; + + return skill_level; +} +#endif + diff --git a/char/title.c b/char/title.c new file mode 100644 index 0000000..a0c0e32 --- /dev/null +++ b/char/title.c @@ -0,0 +1,1067 @@ +#include "version.h" +#include +#include +#include +#include +#include +#ifdef _REDHAT_V9 +#include +#endif + +#include "title.h" +#include "char.h" +#include "char_base.h" +#include "item.h" +#include "skill.h" +#include "buf.h" +#include "util.h" +#include "configfile.h" + + +/*====================į ====================*/ +static int TITLE_IntCheck( int charaindex,int elem, int *data, int flg); +static int TITLE_WorkIntCheck( int charaindex,int elem, int *data, int flg); +static int TITLE_ItemCheck( int charaindex,int elem, int *data, int flg); +static int TITLE_ItemEquipCheck( int charaindex,int elem, int *data, int flg); +static int TITLE_SkillCheck( int charaindex,int elem, int *data, int flg); +static int TITLE_SexCheck( int charaindex,int elem, int *data, int flg); + +typedef enum +{ + TITLE_FUNCTYPENONE, /* Ϸئ */ + TITLE_FUNCTYPEUSERFUNC, /* definefunction ëȻ ë + * Ѽ¦ѷ + * int ƽҷ̼͵ + * buf ߼ + * buflen 뼰Ӯ + */ + TITLE_USEFUNCTYPENUM +}TITLE_USEFUNCTYPE; + +typedef struct tagTITLE_Table +{ + int index; /* ܷѯë׻ + * įƥȻaddtitle羮֧ + */ + char name[32]; + TITLE_USEFUNCTYPE functype; + void (*definefunction)(int,char* buf,int buflen); +}TITLE_Table; + +/* ɷ¶ + * STR,TGH,MAXMPATK,DEF + * LEVEL,CLASS,SKILL,ITEM,FIREREG,ICEREG,THUNDERREG + * KANJILV,TALKCNT,WALKCNT,DEADCNT,LOGINCNT,BASEIMAGENUMBER + * GOLD +*/ +typedef struct tagTITLE_Compare { + char compare[8];; +} TITLE_COMPARE; + +TITLE_COMPARE TITLE_compare[] = { {"<="}, {">="},{"<>"}, {">"},{"<"},{"="}}; + +typedef struct tagTITLE_PARAM +{ + int element; + int (*checkfunc)( int charaindex,int elem, int *data, int flg ); + char *paramname; +}TITLE_PARAM; + +TITLE_PARAM TITLE_param[] = +{ + /**** ****/ + { -1, TITLE_ItemCheck, "ITEM" }, + { -1, TITLE_ItemEquipCheck,"EQUIPITEM" }, + { -1, NULL, "EQUIPEVENT" }, + /**** ƥ ئƥʷֽУ ****/ + { -1, TITLE_SkillCheck, "SKILL" }, + { CHAR_STR, TITLE_IntCheck, "STR" }, + { CHAR_TOUGH, TITLE_IntCheck, "TGH" }, + { CHAR_MAXMP, TITLE_IntCheck, "MAXMP" }, + { CHAR_WORKFIXSTR, TITLE_WorkIntCheck, "ATK" }, + { CHAR_WORKFIXTOUGH, TITLE_WorkIntCheck, "DEF" }, + { CHAR_LV, TITLE_IntCheck, "LEVEL" }, + { CHAR_TALKCOUNT, TITLE_IntCheck, "TALKCNT" }, + { CHAR_WALKCOUNT, TITLE_IntCheck, "WALKCNT" }, + { CHAR_DEADCOUNT, TITLE_IntCheck, "DEADCNT" }, + { CHAR_LOGINCOUNT, TITLE_IntCheck, "LOGINCNT" }, + { CHAR_BASEBASEIMAGENUMBER,TITLE_IntCheck, "BASEIMAGENUMBER" }, + { CHAR_GOLD, TITLE_IntCheck, "GOLD" }, + { -1, TITLE_SexCheck, "SEX" }, +}; + +#define TITLE_PARAMSIZE 20 +typedef struct tagTITLE_configTable +{ + int paramindex[20]; /* TITLE_param߼ٯ */ + int param[20][TITLE_PARAMSIZE]; /* Ұ */ + int compareflg[20]; /* ><=¾ */ + int title; + BOOL equipcheckflg; /* + * ʧ ة ìƥ𼰰׷º뼰 Ȼ + * ּƾئУ + */ +}TITLE_CONFIGTABLE; + +typedef struct tagTITLE_configbuf +{ + int title; + int flg; +}TITLE_CONFIGBUF; + +static TITLE_CONFIGTABLE *TITLE_ConfigTable; +static TITLE_Table *TITLE_table; +static TITLE_CONFIGBUF *TITLE_configbuf; +static int TITLE_titlenum; +static int TITLE_titlecfgnum; + +/*------------------------------------------------------------ + * index įTITLE_tableٯë + ------------------------------------------------------------*/ +int TITLE_getTitleIndex( int index) +{ + int i; + if( index < 0 ) return -1; + for( i = 0; i < TITLE_titlenum; i ++ ) { + if( TITLE_table[i].index == index ) { + return( i); + } + } + return -1; +} + +/* 뼰 */ +#define TITLESTRINGBUFSIZ 256 +/* ͷʧέµƽﷸ ٯ */ +static char TITLE_statusStringBuffer[TITLESTRINGBUFSIZ]; +/*------------------------------------------------------------ + * ͷʧέ±į ٯ ë + * ¦ + * title Title* ƽ + * charaindex int 𼰱įë Ȼƽҷ¼̼͵ + * ߯Ի + * char* + ------------------------------------------------------------*/ +char* TITLE_makeTitleStatusString( int charaindex,int havetitleindex ) +{ + int attach; + int index; + /* ߼̼͵շë */ + index = CHAR_getCharHaveTitle( charaindex,havetitleindex ); + + attach = TITLE_getTitleIndex( index); + if( attach == -1 ) { + TITLE_statusStringBuffer[0] = '\0'; + return TITLE_statusStringBuffer; + } + switch( TITLE_table[attach].functype ){ + case TITLE_FUNCTYPENONE: + snprintf( TITLE_statusStringBuffer, + sizeof(TITLE_statusStringBuffer ),"%s" , + TITLE_table[attach].name ); + break; + + case TITLE_FUNCTYPEUSERFUNC: + { + char string[256]={""}; + void (*function)(int,char* buf,int buflen); + function = TITLE_table[attach].definefunction; + if( function ) + function( charaindex,string,sizeof(string) ); + + strcpysafe( TITLE_statusStringBuffer, + sizeof(TITLE_statusStringBuffer ),string ); + } + break; + default: + TITLE_statusStringBuffer[0] = '\0'; + return TITLE_statusStringBuffer; + break; + } + return TITLE_statusStringBuffer; +} + +/*------------------------------------------------------------ + * ئбį ٯ ë߯ + * ¦ + * ئ + * ߯Ի + * char* + ------------------------------------------------------------*/ +char* TITLE_makeSkillFalseString( void ) +{ + TITLE_statusStringBuffer[0]= '\0'; + return TITLE_statusStringBuffer; +} + + +/*------------------------------------------------------------ + * ϶ýľ įįëܰ£ۺֽئȻգܰئ + * ¦ + * charaindex int ƽҷ̼͵ + * titleindex int į̼͵ + * ߯Ի + * ܰindex + * ܰئ FALSE(0) + ------------------------------------------------------------*/ +BOOL TITLE_addtitle( int charaindex, int titleindex ) +{ + int i; + int firstfindempty=-1; + + if( CHAR_CHECKINDEX(charaindex) == FALSE )return FALSE; + /*if( TITLE_CHECKTABLEINDEX(titleindex) == FALSE )return FALSE;*/ + if( TITLE_getTitleIndex( titleindex) == -1 ) return FALSE; + + for( i=0 ; i < CHAR_TITLEMAXHAVE ; i++ ){ + if( CHAR_getCharHaveTitle( charaindex,i ) == titleindex ) + /* ƥ Ȼ¾ئ */ + return FALSE; + if( firstfindempty == -1 + && CHAR_getCharHaveTitle(charaindex,i) == -1 ){ + firstfindempty = i; + } + } + return CHAR_setCharHaveTitle( charaindex,firstfindempty,titleindex ); +} + + +/*------------------------------------------------------------ + * ϶ýľ įįؤմ£ئئУ + * ؤ ʣ + * ¦ + * charaindex int ƽҷ̼͵ + * titleindex int į̼͵ + * ߯Ի + * TRUE(1) + * ئ FALSE(0) + ------------------------------------------------------------*/ +BOOL TITLE_deltitle( int charaindex, int titleindex ) +{ + int i; + BOOL del=FALSE; + int index; + if( CHAR_CHECKINDEX(charaindex) == FALSE )return FALSE; + /*if( TITLE_CHECKTABLEINDEX(titleindex) == FALSE )return FALSE;*/ + index = TITLE_getTitleIndex( titleindex); + if( index == -1 ) return FALSE; + + for( i=0 ; i < CHAR_TITLEMAXHAVE ; i++ ) + if( CHAR_getCharHaveTitle( charaindex,i ) == titleindex ){ + /* лȻ֧ئɣľئƱ */ + if( CHAR_getInt(charaindex, CHAR_INDEXOFEQTITLE) == i ){ + CHAR_setInt(charaindex, CHAR_INDEXOFEQTITLE, -1 ); + } + /* Ȼ¾ */ + CHAR_setCharHaveTitle( charaindex,i,-1); + + del = TRUE; + } + + return del; +} +/*------------------------------------------------------------ + * įë£ + * ¦ + * filename char* ɬð̻ + * ߯Ի + * TRUE(1) + * FALSE(0) + *------------------------------------------------------------*/ +BOOL TITLE_initTitleName( char* filename ) +{ + FILE* f; + char line[256]; + int linenum=0; + int title_readlen=0; + + f = fopen(filename,"r"); + if( f == NULL ){ + errorprint; + return FALSE; + } + + TITLE_titlenum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + TITLE_titlenum++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "ѰҴ\n" ); + fclose(f); + return FALSE; + } + + TITLE_table = allocateMemory( sizeof(struct tagTITLE_Table) + * TITLE_titlenum ); + if( TITLE_table == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(TITLE_table)*TITLE_titlenum); + fclose( f ); + return FALSE; + } + /* */ +{ + int i; + for( i = 0; i < TITLE_titlenum; i ++ ) { + TITLE_table[i].index = -1; + TITLE_table[i].name[0] = '\0'; + TITLE_table[i].functype = TITLE_FUNCTYPENONE; + TITLE_table[i].definefunction = NULL; + } + +} + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ +{ + int i; + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + + /* 繴ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",1,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + TITLE_table[title_readlen].index = atoi(token); + + /* 2ͼëέ */ + ret = getStringFromIndexWithDelim( line,",",2,token, + sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + continue; + } + if( strlen( token) > sizeof( TITLE_table[title_readlen].name)-1) { + fprint("! ͷƽļ:%s %d\n", + filename, linenum); + } + strcpysafe( TITLE_table[title_readlen].name, + sizeof( TITLE_table[title_readlen].name), + token); + + title_readlen ++; +} + } + fclose(f); + + TITLE_titlenum = title_readlen; + + print( "Чͷ %d...", TITLE_titlenum ); + +#ifdef DEBUG + + { + int i; + for( i=0; i ="); + if( comppos == -1 ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + TITLE_initTitleData( titlecfg_readlen); + errflg = TRUE; + break;; + } + /* įįṴ */ + if( charInclude( &token[comppos+1], "<>=") != -1 ) { + /* ئ ʤë */ + for( j = 0; j < 3; j ++ ) { + if( memcmp( TITLE_compare[j].compare, &token[comppos], 2 ) == 0 ) { + break; + } + } + if( j == 3 ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + TITLE_initTitleData( titlecfg_readlen); + errflg = TRUE; + break; + } + else { + ret = TITLE_getParamData( titlecfg_readlen,i-1,&token[comppos+2]); + if( !ret ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + TITLE_initTitleData( titlecfg_readlen); + errflg = TRUE; + break; + } + + /*TITLE_ConfigTable[titlecfg_readlen].param[i-1] + = atoi( &token[comppos+2]);*/ + TITLE_ConfigTable[titlecfg_readlen].compareflg[i-1] = j; + } + } + else { + ret = TITLE_getParamData( titlecfg_readlen,i-1,&token[comppos+1]); + if( !ret ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + TITLE_initTitleData( titlecfg_readlen); + errflg = TRUE; + break; + } + /*TITLE_ConfigTable[titlecfg_readlen].param[i-1] + = atoi( &token[comppos+1]);*/ + /* ئ ʤë */ + for( j = 3; j < 6; j ++ ) { + if( memcmp( TITLE_compare[j].compare, &token[comppos], 1 ) == 0 ) { + TITLE_ConfigTable[titlecfg_readlen].compareflg[i-1] = j; + break; + } + } + } + } + } + /* į ϶û or ئϾռ޷¡*/ + if( errflg || TITLE_ConfigTable[titlecfg_readlen].title == -1 ) { + fprint("ļ﷨:%s %d\n",filename,linenum); + TITLE_initTitleData( titlecfg_readlen); + } + else { + titlecfg_readlen ++; + } +} + } + fclose(f); + + TITLE_titlecfgnum = titlecfg_readlen; + + print( "Чͷ %d...", TITLE_titlecfgnum ); + + return TRUE; +} +/*------------------------------------------------------------ + * įɬñƩͻįëܸ£ + * ¦ + * charaindex int ƽҷ̼͵ + * mode BOOL TRUE:item=ּƩ FALSE: + * ߯Ի + * TRUE: į Ի + * FALSE: ף + *------------------------------------------------------------*/ +static BOOL TITLE_TitleCheck_Main( int charaindex, BOOL mode, int *addcnt, int *delcnt) +{ + int i, j,k, ret; + + /* */ +{ + int i; + for( i = 0; i < TITLE_titlecfgnum && TITLE_configbuf[i].title != -1; i ++ ) { + TITLE_configbuf[i].title = -1; + TITLE_configbuf[i].flg = 0; + } +} + *addcnt = 0; + *delcnt = 0; + + for( i = 0; i < TITLE_titlecfgnum; i ++ ) { + int rc = TRUE; + int title = TITLE_ConfigTable[i].title; + if( mode == TRUE ) { + if( TITLE_ConfigTable[i].equipcheckflg != TRUE ) { + continue; + } + } + for( j = 0; + j < arraysizeof( TITLE_ConfigTable[i].param) && + TITLE_ConfigTable[i].param[j][0] != -1 ; + j ++ ) + { + int index = TITLE_ConfigTable[i].paramindex[j]; + if( TITLE_param[index].checkfunc != NULL ) { + rc = TITLE_param[index].checkfunc( + charaindex, + TITLE_param[index].element, + TITLE_ConfigTable[i].param[j], + TITLE_ConfigTable[i].compareflg[j] + ); + if( rc != TRUE ) break; + } + } + /* ԪįԻ񲻯ľݼб + * add,deltile + */ + for( k = 0; k < TITLE_titlecfgnum; k ++ ) { + if( TITLE_configbuf[k].title == title ) { + if( rc ) { + TITLE_configbuf[k].flg = 1; + } + break; + } + else if( TITLE_configbuf[k].title == -1 ) { + TITLE_configbuf[k].title = title; + TITLE_configbuf[k].flg = rc ? 1: -1; + break; + } + } + } + ret = FALSE; + for( i = 0; i < TITLE_titlecfgnum && TITLE_configbuf[i].title != -1; i ++ ) { + if( TITLE_configbuf[i].flg == -1 ) { + *delcnt += TITLE_deltitle( charaindex, TITLE_configbuf[i].title); + } + else { + *addcnt += TITLE_addtitle( charaindex, TITLE_configbuf[i].title) ? 1:0; + } + } + if( *delcnt > 0 || *addcnt > 0) { + ret = TRUE; + } + return ret; + +} +/*------------------------------------------------------------ + * įɬñƩͻįëܸ£ + * ¦ + * charaindex int ƽҷ̼͵ + * mode BOOL TRUE:item=ּƩ FALSE: + * ߯Ի + * TRUE: į Ի + * FALSE: ף + *------------------------------------------------------------*/ +BOOL TITLE_TitleCheck( int charaindex, BOOL mode) +{ +#define TITLE_MSGUNIT1 "TSU" +#define TITLE_MSGUNIT2 "KO" + int addcnt,delcnt; + BOOL rc; + char msgbuf[64]; + rc = TITLE_TitleCheck_Main( charaindex, mode, &addcnt,&delcnt); + if( rc ) { + if( delcnt > 0 ) { + snprintf( msgbuf, sizeof( msgbuf), + "ʧȥ%d%s ƺţ", delcnt, + delcnt < 10 ? TITLE_MSGUNIT1:TITLE_MSGUNIT2); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + } + if( addcnt > 0 ) { + snprintf( msgbuf, sizeof( msgbuf), + "%d%s ƺţ", addcnt, + addcnt < 10 ? TITLE_MSGUNIT1:TITLE_MSGUNIT2); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + } + } + return rc; +} +/*------------------------------------------------------------ + * įɬñƩͻįëܸ£ + * ¦ + * charaindex int ƽҷ̼͵ + * mode BOOL TRUE:item=ּƩ FALSE: + * ߯Ի + * TRUE: į Ի + * FALSE: ף + *------------------------------------------------------------*/ +BOOL TITLE_TitleCheck_Nomsg( int charaindex, BOOL mode, int *addcnt, int *delcnt) +{ + return( TITLE_TitleCheck_Main( charaindex, mode, addcnt,delcnt)); +} + + +static int TITLE_IntCheck( int charaindex, int elem, int *data, int flg) +{ + int rc = FALSE; + int i; + for( i = 0; i < TITLE_PARAMSIZE && *(data+i) != -1; i ++ ) { + switch( flg) { + case 0: /* "<=" */ + if( CHAR_getInt( charaindex, elem) <= *(data+i) ) rc = TRUE; + break; + case 1: /* ">=" */ + if( CHAR_getInt( charaindex, elem) >= *(data+i) ) rc = TRUE; + break; + case 2: /* "<>" */ + if( CHAR_getInt( charaindex, elem) != *(data+i) ) rc = TRUE; + break; + case 3: /* ">" */ + if( CHAR_getInt( charaindex, elem) > *(data+i) ) rc = TRUE; + break; + case 4: /* "<" */ + if( CHAR_getInt( charaindex, elem) < *(data+i) ) rc = TRUE; + break; + case 5: /* "=" */ + if( CHAR_getInt( charaindex, elem) == *(data+i) ) rc = TRUE; + break; + default: + rc= FALSE; + break; + } + if( rc) break; + } + return rc; +} +static int TITLE_WorkIntCheck( int charaindex,int elem, int *data, int flg) +{ + int rc = FALSE; + int i; + for( i = 0; i < TITLE_PARAMSIZE && *(data+i) != -1; i ++ ) { + switch( flg) { + case 0: /* "<=" */ + if( CHAR_getWorkInt( charaindex, elem) <= *(data+i) ) rc = TRUE; + break; + case 1: /* ">=" */ + if( CHAR_getWorkInt( charaindex, elem) >= *(data+i) ) rc = TRUE; + break; + case 2: /* "<>" */ + if( CHAR_getWorkInt( charaindex, elem) != *(data+i) ) rc = TRUE; + break; + case 3: /* ">" */ + if( CHAR_getWorkInt( charaindex, elem) > *(data +i)) rc = TRUE; + break; + case 4: /* "<" */ + if( CHAR_getWorkInt( charaindex, elem) < *(data+i) ) rc = TRUE; + break; + case 5: /* "=" */ + if( CHAR_getWorkInt( charaindex, elem) == *(data+i) ) rc = TRUE; + break; + default: + rc= FALSE; + break; + } + if( rc ) break; + } + return rc; +} +/* -------------------------------------- + * ϶ýľdata Ȼʧ ةë ʤ£ + * -------------------------------------*/ +static int TITLE_ItemCheckMain( int charaindex, int itemhaveindex, int *data, int flg) +{ + int i,j; + int rc = FALSE; + + if( flg == 2 ) rc = TRUE; + + for( j = 0; j < TITLE_PARAMSIZE && *(data+j) != -1; j ++ ) { + for( i =0; i < itemhaveindex; i ++ ) { + int itemindex = CHAR_getItemIndex(charaindex,i); + if( ITEM_CHECKINDEX(itemindex) ) { + switch( flg) { + case 0: /* "<=" */ + if( ITEM_getInt( itemindex, ITEM_ID) <= *(data+j) ) rc = TRUE; + break; + case 1: /* ">=" */ + if( ITEM_getInt( itemindex, ITEM_ID) >= *(data+j) ) rc = TRUE; + break; + case 3: /* ">" */ + if( ITEM_getInt( itemindex, ITEM_ID) > *(data +j)) rc = TRUE; + break; + case 4: /* "<" */ + if( ITEM_getInt( itemindex, ITEM_ID) < *(data +j)) rc = TRUE; + break; + case 5: /* "=" */ + if( ITEM_getInt( itemindex, ITEM_ID) == *(data +j)) rc = TRUE; + break; + /* ľ У + * ʧ ة ëέľë Ȼئީ£ + * ƥ Ȼëƻ + */ + case 2: /* "<>" */ + if( ITEM_getInt( itemindex, ITEM_ID) == *(data +j)) rc = FALSE; + break; + default: + rc= FALSE; + break; + } + if( rc && flg != 2) break; + } + } + if( rc) break; + } + return rc; +} + + +static int TITLE_ItemCheck( int charaindex,int elem, int *data, int flg) +{ + return( TITLE_ItemCheckMain( charaindex, CHAR_MAXITEMHAVE,data,flg)); +} + +static int TITLE_ItemEquipCheck( int charaindex,int elem, int *data, int flg) +{ + return( TITLE_ItemCheckMain( charaindex, CHAR_EQUIPPLACENUM,data,flg)); +} + +static int TITLE_SkillCheck( int charaindex,int elem, int *data, int flg) +{ + int i; + int rc = FALSE; + CHAR_HaveSkill* hskill; + + for( i = 0 ; i < CHAR_SKILLMAXHAVE ; i ++ ){ + hskill = CHAR_getCharHaveSkill( charaindex, i ); + if( hskill != NULL && hskill->use == TRUE ) { + + if( *(data + 1) != -2 ) { + if( SKILL_getInt( &hskill->skill, SKILL_IDENTITY) == *data) { + rc = TRUE; + break; + } + } + + else { + if( SKILL_getInt( &hskill->skill, SKILL_IDENTITY) == *data) { + rc = FALSE; + break; + } + else { + rc = TRUE; + } + } + } + } + if( rc ) { + + if( *(data+1) != -1 && *(data+1) != -2) { + rc = FALSE; + switch( flg) { + case 0: /* "<=" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) <= *(data+1) ) rc = TRUE; + break; + case 1: /* ">=" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) >= *(data+1) ) rc = TRUE; + break; + case 2: /* "<>" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) != *(data+1) ) rc = TRUE; + break; + case 3: /* ">" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) > *(data +1)) rc = TRUE; + break; + case 4: /* "<" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) < *(data+1) ) rc = TRUE; + break; + case 5: /* "=" */ + if( SKILL_getInt( &hskill->skill, SKILL_LEVEL) == *(data+1) ) rc = TRUE; + break; + default: + rc= FALSE; + break; + } + } + } + return rc; +} +/* -------------------------------------- + * ƽҷ¾ƽҷ¾£ + * -------------------------------------*/ +static int TITLE_SexCheck( int charaindex,int elem, int *data, int flg) +{ + int i,j; + struct { + int sex[25]; + }s_sex[] = + { { { 30008,30009,30010,30011,30012,30013,30014,30015, + 30020,30021,30022,30023,30024,30025,30026,30027, + 30028,30029,30030,30031,30032,30033,30034,30035,-1} + }, + { {30000,30001,30002,30003,30004,30005,30006,30007, + 30016,30017,30018,30019,30036,30037,30038,30039, + -1, -1, -1, -1, -1, -1, -1, -1, -1} + } + }; + for( i = 0; i < 2; i ++ ) { + for( j = 0; s_sex[i].sex[j] != -1 ; j ++ ) { + if( CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER ) + == s_sex[i].sex[j] ) + { + if( i == *data ) return TRUE; + else return FALSE; + } + } + } + return FALSE; +} + + diff --git a/char/trade.c b/char/trade.c new file mode 100644 index 0000000..bba10e0 --- /dev/null +++ b/char/trade.c @@ -0,0 +1,2322 @@ +#include "version.h" +#include "correct_bug.h" +#include +#include +#include + +#include "readmap.h" +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "trade.h" +#include "log.h" +#include "handletime.h" +#include "buf.h" +#include "net.h" +#include "char_base.h" +#include "battle.h" +#include "npc_bus.h" +#include "char_talk.h" +#include "magic_base.h" +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ +#include "pet_skill.h" +#endif +#ifdef _PET_AMOI__E +#include "pet.h" +#endif + +#define TRADE_WAIT "Ժ%sС" +#define TRADE_NONE "ǰʲҲûУ" +#define TRADE_OVERPLAYER "ǰֻһλร" +#define TRADE_NOWILL "DZǸԷԸ㽻ף" +#define TRADE_TRADING "%s˽ס" +#define TRADE_VANISHITEM "ڵϻʧƷ޷ף" +#define TRADE_PETFULL "%sȡ" +#define TRADE_ITEMFULL "%sƷٽס" +#define TRADE_CANCEL "%sȡˣ" +#define TRADE_POOR "%sǮ޷ף" +#define TRADE_RICH "%sǮ𳬹һ" +#define TRADE_TOORICH "%sǮᳬһ" +#define TRADE_POORLV "%sȼ޷չ˽ij" +#define TRADE_LOCK "" +#define TRADE_SUCCESS "ףϣˣ" +#define TRADE_FAILED "ʧܣ" +#define TRADE_FMPET "ػ޷ף" + +#define TRADE_RDCANCEL "ȡ" +#ifdef _TRADE_PK +#define TRADE_PK_START "ʼPK" +#endif +#ifdef _LOCK_PET_ITEM +#define TRADE_LOCKPET "󶨵ij޷ף" +#define TRADE_LOCKITEM "󶨵ĵ޷ף" +#endif + +#ifdef _ITEM_PILEFORTRADE +enum{ + TRADE_ITEM=0, + TRADE_PET, + TRADE_GOLD, +}; + +#define MAX_TRADELISTNUM 100 +typedef struct _tagTradeList{ + int charaindex; + int fd; + int PetTi[5]; + int ItemTi[15]; + int ItemNum[15]; + int Golds; + int use; +}STradeList; + +STradeList TradeList[MAX_TRADELISTNUM][2]; +STradeList TradeListPk[2]; +int meindexpk,toindexpk; + +void TRADE_ResetTradeList( int ti); +int TRADE_getTradeListIndex( void); +int TRADE_getMyTarget( int meindex ); +BOOL TRADE_setTradeListIndex( int ti, int meindex, int toindex); +BOOL TRADE_addSomeTradeList( int meindex, int usTi, int *num, int type); +BOOL TRADE_getSomeTradeList( int meindex, STradeList *temp); + +void TRADE_InitTradeList( void) +{ + int i; + print("ʼϵͳ..."); + for( i=0; i= MAX_TRADELISTNUM )return; + for( i=0; i<5; i++){ + TradeList[ti][0].PetTi[i] = -1; + TradeList[ti][1].PetTi[i] = -1; + } + for( i=0; i<15; i++){ + TradeList[ti][0].ItemTi[i] = -1; + TradeList[ti][0].ItemNum[i] = -1; + TradeList[ti][1].ItemTi[i] = -1; + TradeList[ti][1].ItemNum[i] = -1; + } + + TradeList[ti][0].Golds = 0; + TradeList[ti][1].Golds = 0; + + + if( CHAR_CHECKINDEX(TradeList[ti][0].charaindex)){ + fd = getfdFromCharaIndex( TradeList[ti][0].charaindex); + CONNECT_setTradeList( fd, -1); + } + if( CHAR_CHECKINDEX(TradeList[ti][1].charaindex)){ + fd = getfdFromCharaIndex( TradeList[ti][1].charaindex); + CONNECT_setTradeList( fd, -1); + } + + TradeList[ti][0].charaindex = -1; + TradeList[ti][1].charaindex = -1; + TradeList[ti][0].fd = -1; + TradeList[ti][1].fd = -1; + + TradeList[ti][0].use = 0; + TradeList[ti][1].use = 0; + +} + +int TRADE_getTradeListIndex( void) +{ + int i; + static int tradeTi=0; + if( tradeTi < 0 ) tradeTi = 0; + for( i=0; i= MAX_TRADELISTNUM ) tradeTi = 0; + + } + return -1; +} + +BOOL TRADE_setTradeListIndex( int ti, int meindex, int toindex) +{ + int fd; + if( ti<0 || ti >= MAX_TRADELISTNUM ) return FALSE; + if( TradeList[ti][0].use == 1 || TradeList[ti][1].use == 1 ) return FALSE; + TRADE_ResetTradeList( ti); + TradeList[ti][0].charaindex = meindex; + TradeList[ti][1].charaindex = toindex; + TradeList[ti][0].use = 1; + TradeList[ti][1].use = 1; + + fd = getfdFromCharaIndex( meindex); + TradeList[ti][0].fd = fd; + CONNECT_setTradeList( fd, ti); + + fd = getfdFromCharaIndex( toindex); + TradeList[ti][1].fd = fd; + CONNECT_setTradeList( fd, ti); + return TRUE; +} + +void TRADE_CheckTradeListUser( void) +{ + int i, usenum=0, replace=0, freenum=0; + for( i=0; i= MAX_TRADELISTNUM ) return -1; + if( TradeList[ti][0].use == 0 || TradeList[ti][1].use == 0 ) return -1; + + for( i=0; i<2; i++){ + if( TradeList[ti][i].charaindex == meindex && + TradeList[ti][i].fd == fd ){ + side = (i+1)%2; + if( !CHAR_CHECKINDEX( TradeList[ti][side].charaindex) ) return -1; + if( TradeList[ti][side].charaindex == meindex ) return -1; + if( TradeList[ti][side].fd != getfdFromCharaIndex( TradeList[ti][side].charaindex) ) return -1; + + return TradeList[ti][side].charaindex; + } + } + return -1; +} + +BOOL TRADE_addSomeTradeList( int meindex, int usTi, int *num, int type) +{ + int i, fd, ti, side=-1, toindex=-1; + fd = getfdFromCharaIndex( meindex); + ti = CONNECT_getTradeList( fd); + if( ti <0 || ti >= MAX_TRADELISTNUM ) return FALSE; + toindex =-1; + if( TradeList[ti][0].use != 1 || TradeList[ti][1].use != 1 ) return FALSE; + for( i=0; i<2; i++){ + if( TradeList[ti][i].charaindex != meindex ){ + continue; + } + side = i; + toindex = TradeList[ti][((side+1)%2)].charaindex; + if( !CHAR_CHECKINDEX( toindex) ) return FALSE; + break; + } + if( side == -1 ) return FALSE; + switch( type){ + case TRADE_ITEM: + { + int itemindex, MeMaxPile; + MeMaxPile = CHAR_getMyMaxPilenum( meindex);//ѵ + if( usTi < CHAR_STARTITEMARRAY || usTi >= CHAR_MAXITEMHAVE ) return FALSE; + itemindex = CHAR_getItemIndex( meindex, usTi ); +//ǰ󶨵ĵ򲻿ڽ +#ifdef _PETITEM__AMOI_E + if(ITEM_NOT_TRADE & ITEM_getInt(itemindex, ITEM_TYPEOFITEM)){ + char buf[256]; + sprintf( buf, "%s޷ס", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORRED); + return FALSE; + } +#endif + if( !ITEM_CHECKINDEX( itemindex)) return FALSE; + + if( ITEM_getInt( itemindex, ITEM_VANISHATDROP) == 1 || ITEM_getInt( itemindex, ITEM_TIME) > 0){ + char buf[256]; + sprintf( buf, "%s޷ס", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORYELLOW); + return FALSE; + } +#ifdef _ZHIPIAO_SYSTEM + if( strstr(ITEM_getChar(itemindex,ITEM_NAME),"֧Ʊ")!=NULL && strstr(ITEM_getChar(itemindex,ITEM_NAME),"DP֧Ʊ")==NULL ){ + int zhipiaoindex=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + if(zhipiaoindex>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(timep>zhipiaoindex){ + CHAR_talkToCli(meindex, -1, "֧ƱѾڣ޷ף뾡ʹã", CHAR_COLORYELLOW); + return FALSE; + } + } + } +#endif +#ifdef _LOCK_PET_ITEM + char *arg = ITEM_getChar(itemindex, ITEM_NAME); + if(arg[0] == '*'){ + char buf[256]; + sprintf( buf, "%s޷ס", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( meindex, -1, buf, CHAR_COLORYELLOW); + return FALSE; + } +#endif + if( ITEM_getInt( itemindex, ITEM_CANBEPILE) == 1 ){//ɶѵ + int itemMaxPile = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + if( itemMaxPile < 0 ) return FALSE; + //ITEM_USEPILENUMS + for( i=0; i<15; i++){ + if( TradeList[ti][side].ItemTi[i] != usTi ) continue; + if( TradeList[ti][side].ItemNum[i] >= MeMaxPile || + TradeList[ti][side].ItemNum[i] >= itemMaxPile ) return FALSE; + + TradeList[ti][side].ItemNum[i] += 1; + if( num != NULL ) *num = TradeList[ti][side].ItemNum[i]; + return TRUE; + } + } + for( i=0; i<15; i++){ + if( TradeList[ti][side].ItemTi[i] != -1 ) continue; + TradeList[ti][side].ItemTi[i] = usTi; + TradeList[ti][side].ItemNum[i] = 1; + if( num != NULL ) *num = TradeList[ti][side].ItemNum[i]; + return TRUE; + } + } + break; + case TRADE_PET: + { + int petindex; + if( usTi < 0 || usTi >= CHAR_MAXPETHAVE ) return FALSE; + petindex = CHAR_getCharPet( meindex, usTi ); + if( !CHAR_CHECKINDEX(petindex)) return FALSE; + if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 ){ + CHAR_talkToCli( meindex, -1, "ػ޷ס", CHAR_COLORYELLOW); + return FALSE;//ػ + } + if( CHAR_getWorkInt( toindex, CHAR_PickAllPet) != TRUE ){ + if( CHAR_getInt( petindex, CHAR_LV) > (CHAR_getInt( toindex, CHAR_LV)+5) && + (CHAR_getInt( toindex, CHAR_TRANSMIGRATION ) <= 0 ) ){ + CHAR_talkToCli( meindex, -1, "Է޷չ˸ó", CHAR_COLORYELLOW); + return FALSE; + } + } +//ǰ󶨵ij򲻿ɽ +#ifdef _PET_AMOI__E + //if( PET_NOT_DropTradeStreetVandor== EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID)) || + // PET_NOT_Trade == EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID))|| + // PET_NOT_TradeAndStreetVandor == EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID))){ + if( ( PET_NOT_TRADE) & EVOLUTION_getPetENABLETRADE( CHAR_getInt( petindex, CHAR_PETID))){ + + CHAR_talkToCli(meindex,-1,"ó޷!~",CHAR_COLORRED); + return FALSE; + } +#endif +#ifdef _PET_BUG + if( CHAR_getInt( petindex, CHAR_VITAL)>=getPetPoint(0)*20 || CHAR_getInt(petindex,CHAR_STR)>=getPetPoint(1)*80 || CHAR_getInt(petindex,CHAR_TOUGH)>=getPetPoint(2)*80 || CHAR_getInt(petindex,CHAR_DEX)>=getPetPoint(3)*100){ + CHAR_talkToCli( meindex, -1, "Թ޷ס", CHAR_COLORYELLOW); + return FALSE;//Թ + } +#endif + if(strlen(CHAR_getChar(petindex,CHAR_USERPETNAME))>0 && strstr(CHAR_getChar(petindex,CHAR_USERPETNAME),"*")!=NULL){ + CHAR_talkToCli(meindex, -1, "Զк(*)޷ꡢס̯޸ĺ", CHAR_COLORYELLOW); + return FALSE; + } +#ifdef _PETSKILL_BINDING + int pi,skillid=-1,skillarray; + for(pi=0;pi<7;pi++){ + skillid=CHAR_getPetSkill(petindex,pi); + skillarray = PETSKILL_getPetskillArray( skillid); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if(strstr(PETSKILL_getChar( skillarray, PETSKILL_NAME),"")){ + CHAR_talkToCli(meindex, -1, "˳Ϊ󶨳޷", CHAR_COLORRED); + return FALSE; + } + } +#endif +#ifdef _PET_BINDING + if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*") || strstr(CHAR_getChar(petindex,CHAR_NAME),"+")){ + CHAR_talkToCli(meindex, -1, "˳Ϊ󶨳޷", CHAR_COLORRED); + return FALSE; + } +#endif + for( i=0; i<5; i++){ + if( TradeList[ti][side].PetTi[i] == usTi ) return FALSE; + } + for( i=0; i<5; i++){ + if( TradeList[ti][side].PetTi[i] != -1 ) continue; + TradeList[ti][side].PetTi[i] = usTi; + return TRUE; + } + } + break; + case TRADE_GOLD: + TradeList[ti][side].Golds = usTi; + return TRUE; + break; + } + + return FALSE; +} + +BOOL TRADE_getSomeTradeList( int meindex, STradeList *temp) +{ + int i, fd, ti, side=-1; + fd = getfdFromCharaIndex( meindex); + ti = CONNECT_getTradeList( fd); + if( ti <0 || ti >= MAX_TRADELISTNUM ) return FALSE; + if( TradeList[ti][0].use != 1 || TradeList[ti][1].use != 1 ) return FALSE; + for( i=0; i<2; i++){ + if( TradeList[ti][i].charaindex != meindex ) continue; + side = i; + break; + } + if( side == -1 ) return FALSE; + + memcpy( temp, &TradeList[ti][side], sizeof( STradeList) ); + return TRUE; +} +BOOL TRADE_CheckTradeList( int meindex, STradeList *temp1, int toindex, STradeList *temp2); +#endif + +void TRADE_Will(int fd, int meindex, char* message); +void TRADE_ShowItem(int fd, int meindex, char* message); +void TRADE_Close(int fd, int meindex, char* message); + +void TRADE_SwapItem(int meindex, int toindex, char* message, int fd, char* mycharaname, int tofd, char* tocharaname); + +int TRADE_CheckItembuf(int fd, int meindex, int toindex, int tofd, char* mycharaname, char* tocharaname); +//BOOL TRADE_ChangeItem(int meindex, int toindex, char *a, char *b, int item1, int item2, int itemindex1, int itemindex2); +BOOL TRADE_HandleItem( int meindex, int showindex, char *message, char *outmess); +BOOL TRADE_HandleGold( int meindex, int showindex, char *message, char *outmess); +BOOL TRADE_HandlePet( int meindex, int showindex, char *message, char *outmess); + + + +void CHAR_Trade(int fd, int index, char* message) +{ + char firstToken[64]; + // shan עDzҪĶ 2002/03/05 + //char messageeraseescape[512]; + char* messagebody; + + { + if (*message == 0) return; + if (!CHAR_CHECKINDEX(index)) return; + if (CHAR_getWorkInt( index, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(index); + return; + } + + CHAR_getMessageBody( message, firstToken, sizeof(firstToken), &messagebody); + + switch( tolower( firstToken[0]) ){ + case 'd': // Ѱǰ + + TRADE_Search(fd, index, message); + break; +/* case 'c': + TRADE_Will(fd, index, message); + break; +*/ case 't': // ʾ׵ƷǮ + TRADE_ShowItem(fd, index, message); + break; + case 'w': // رս + print(" TRADE_Close:%d ", index); + TRADE_Close(fd, index, message); + break; + default: + break; + } + } +} + +BOOL TRADE_Search(int fd, int meindex, char* message) +{ + int objbuf[16]; + int front_x, front_y, i, found_count; + BOOL found = FALSE, searchflg = FALSE; + int cnt = 0, tofd = -1, checkfd = -1; + char msgbuf[1024], mycharaname[256], tocharaname[256]; + char token[256]; + + if (!CHAR_CHECKINDEX(meindex)) return FALSE; + + // ״̬Ϊл账 + if (CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_TRADING + || CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_LOCK) + return FALSE; + + // ״̬Ϊӻս账 + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return FALSE; + +#ifdef _STREET_VENDOR + // ڰ̯в + if(CHAR_getWorkInt(meindex,CHAR_WORKSTREETVENDOR) > -1) return FALSE; +#endif + + strcpy(mycharaname, CHAR_getChar(meindex, CHAR_NAME)); + + if (getStringFromIndexWithDelim(message, "|", 2, token, + sizeof(token)) == FALSE) return FALSE; + // 趨״̬ +// CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_SENDING); + +#ifndef _ITEM_PILEFORTRADE + for (i = 0; i < CONNECT_WINDOWBUFSIZE; i++) + CONNECT_setTradecharaindex(fd, i, -1); +#endif + CHAR_getCoordinationDir(CHAR_getInt(meindex, CHAR_DIR), + CHAR_getInt(meindex, CHAR_X), + CHAR_getInt(meindex, CHAR_Y), + 1, &front_x, &front_y); + + found_count = CHAR_getSameCoordinateObjects( objbuf, arraysizeof(objbuf), + CHAR_getInt(meindex, CHAR_FLOOR),front_x, front_y); + // ǰûһԷرսѡ + if (found_count == 0){ + CHAR_talkToCli(meindex, -1, TRADE_NONE, CHAR_COLORYELLOW); + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + return FALSE; + } + + for (i = 0; i < found_count; i++){ + int objindex = objbuf[i]; + int index = OBJECT_getIndex(objindex); + + if (OBJECT_getType(objindex) != OBJTYPE_CHARA) continue; + if (CHAR_getInt(index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) continue; + if (index == meindex) continue; + found = TRUE; + if (CHAR_getWorkInt(index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) continue; + if (CHAR_getWorkInt(index, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) continue; + if (CHAR_getFlg(index, CHAR_ISTRADE) == FALSE) continue; + if (CHAR_getWorkInt(index, CHAR_WORKTRADEMODE) != CHAR_TRADE_FREE) continue; + strcpy(tocharaname, CHAR_getChar(index, CHAR_NAME)); + tofd = getfdFromCharaIndex(index); + if (tofd == -1){ + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + return FALSE; + } + if (searchflg){ + if (tofd != checkfd) continue; + if (strcmp(token, tocharaname) != 0) continue; + } +#ifndef _ITEM_PILEFORTRADE + CONNECT_setTradecharaindex(fd, cnt, index); +#endif + cnt ++; + if (cnt == CONNECT_WINDOWBUFSIZE) break; + } + + if (cnt == 0){ + // ǰûһԷرսѡ + if (found){ + CHAR_talkToCli(meindex, -1, TRADE_NOWILL, CHAR_COLORYELLOW); + }else + CHAR_talkToCli(meindex, -1, TRADE_NONE, CHAR_COLORYELLOW); + + sprintf(msgbuf, "C|%d|%s|0", tofd, tocharaname); + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + return FALSE; + } + // ǰһλ + if (cnt == 1){ +#ifdef _ITEM_PILEFORTRADE + int ti; +#endif + int toindex; + toindex = CONNECT_getCharaindex(tofd); + if( !CHAR_CHECKINDEX(toindex)) return FALSE; +#ifdef _ITEM_PILEFORTRADE + + if( (ti = TRADE_getTradeListIndex()) < 0 || + TRADE_setTradeListIndex( ti, meindex, toindex) == FALSE ){ + + CHAR_talkToCli( meindex, -1, "ϵͳæµС", CHAR_COLORYELLOW); + CHAR_setWorkInt( meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + TRADE_CheckTradeListUser(); + + return FALSE; + } + TRADE_setTradeListIndex( ti, meindex, toindex); +#endif + snprintf(msgbuf, sizeof(msgbuf), TRADE_WAIT, tocharaname); + CHAR_talkToCli(meindex, -1, msgbuf, CHAR_COLORYELLOW); + + sprintf(msgbuf, "C|%d|%s|1", fd, mycharaname); + lssproto_TD_send( tofd, -1, msgbuf); + sprintf(msgbuf, "C|%d|%s|1", tofd, tocharaname); + lssproto_TD_send(fd, -1, msgbuf); + + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_TRADING); + CHAR_setWorkInt(toindex, CHAR_WORKTRADEMODE, CHAR_TRADE_TRADING); + + CONNECT_set_confirm(fd, FALSE); + CONNECT_set_confirm(tofd, FALSE); + + CHAR_sendTradeEffect(meindex, 1); + CHAR_sendTradeEffect(toindex, 1); + return TRUE; + }else if (cnt > 1){ // ǰֻһλ + CHAR_talkToCli(meindex, -1, TRADE_OVERPLAYER, CHAR_COLORYELLOW); +// sprintf(msgbuf, "C|%d|%s|0", tofd, tocharaname); + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + return FALSE; + } + + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + return FALSE; +} + +void TRADE_Close(int fd, int meindex, char* message) +{ + char msg[128], mycharaname[256]; + int tofd=-1, toindex=-1; + int j; +#ifndef _ITEM_PILEFORTRADE + char token[256]; +#endif + if (!CHAR_CHECKINDEX(meindex)) return; + if (*message == 0) return; + strcpy(mycharaname, CHAR_getChar(meindex, CHAR_NAME)); +#ifdef _ITEM_PILEFORTRADE + toindex = TRADE_getMyTarget( meindex); + + if( CHAR_CHECKINDEX( toindex) ){ + tofd = getfdFromCharaIndex( toindex); + snprintf( msg, sizeof(msg), TRADE_CANCEL, mycharaname); + CHAR_talkToCli(toindex, -1, msg, CHAR_COLORYELLOW); + snprintf( msg, sizeof(msg), "W|%d|%s", fd, mycharaname); + lssproto_TD_send( tofd, -1, msg); + + CHAR_setWorkInt( toindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CONNECT_setTradeTmp( tofd, ""); + CHAR_sendStatusString( toindex, "i"); + CHAR_sendStatusString( toindex, "P"); + CHAR_sendTradeEffect( toindex, 0); + CONNECT_set_confirm( tofd, FALSE); + + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + char msgbuf[256]; + int petindex = CHAR_getCharPet( toindex, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + } + } + +#else + if (getStringFromIndexWithDelim(message, "|", 2, token, sizeof(token)) == FALSE) return; + tofd = atoi(token); + toindex = CONNECT_getCharaindex(tofd); + if (!CHAR_CHECKINDEX(toindex)) return; + if (getStringFromIndexWithDelim(message, "|", 3, token, sizeof(token)) == FALSE) return; + + + snprintf(msg, sizeof(msg), TRADE_CANCEL, mycharaname); + CHAR_talkToCli(toindex, -1, msg, CHAR_COLORYELLOW); + snprintf( msg, sizeof(msg), "W|%d|%s", fd, mycharaname); + lssproto_TD_send( tofd, -1, msg); + + CHAR_setWorkInt(toindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CONNECT_setTradeTmp(tofd, ""); + CHAR_sendStatusString( CONNECT_getCharaindex(tofd), "i"); + CHAR_sendStatusString( CONNECT_getCharaindex(tofd), "P"); + CHAR_sendTradeEffect( toindex, 0); + CONNECT_set_confirm(tofd, FALSE); +#endif + + if( !CHAR_CHECKINDEX( toindex) ){ + char buf[256]; + if( getStringFromIndexWithDelim( message, "|", 2, buf, sizeof(buf)) == FALSE) return; + tofd = atoi( buf); + toindex = CONNECT_getCharaindex( tofd); + if (!CHAR_CHECKINDEX(toindex) )return; + } + + + snprintf( msg, sizeof(msg), TRADE_RDCANCEL); + CHAR_talkToCli(meindex, -1, msg, CHAR_COLORYELLOW); + snprintf( msg, sizeof(msg), "W|%d|%s", tofd, CHAR_getChar( toindex, CHAR_NAME) ); + lssproto_TD_send( fd, -1, msg); + + CHAR_setWorkInt( meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CONNECT_setTradeTmp(fd, ""); + CHAR_sendStatusString(meindex, "i"); + CHAR_sendStatusString(meindex, "P"); + CHAR_sendTradeEffect( meindex, 0); + CONNECT_set_confirm(fd, FALSE); +// end + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + char msgbuf[256]; + int petindex = CHAR_getCharPet( meindex, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( meindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( meindex, msgbuf ); + } + +#ifdef _ITEM_PILEFORTRADE + { + int ti=0; + ti = CONNECT_getTradeList( fd); + if( ti <0 || ti >= MAX_TRADELISTNUM ) return; + TRADE_ResetTradeList( ti); + } +#endif + +} + +void TRADE_ShowItem(int fd, int meindex, char* message) +{ + char token[128], mycharaname[256], tocharaname[256], msg[2048]; + int tofd, showindex, toindex;// itemindex, gold, tmpgold, item; + + int MaxGold; + + MaxGold = CHAR_getMaxHaveGold( meindex); + strcpy( mycharaname, CHAR_getChar(meindex, CHAR_NAME)); +#ifdef _ITEM_PILEFORTRADE + toindex = TRADE_getMyTarget( meindex); + if( !CHAR_CHECKINDEX( toindex) ){ + print(" TRADE_Close_Err1:%d ", toindex); + TRADE_Close(fd, meindex, message); + return; + } + if( meindex != TRADE_getMyTarget( toindex) ){ + print(" TRADE_Close_Err2:%d->%d ", meindex, toindex); + TRADE_Close(fd, meindex, message); + return; + } + tofd = getfdFromCharaIndex(toindex); +#else + if (getStringFromIndexWithDelim(message, "|", 2, token, sizeof(token)) == FALSE) return; + tofd = atoi(token); + toindex = CONNECT_getCharaindex(tofd); +#endif + + if (!CHAR_CHECKINDEX(toindex)) return; + // ״̬Ϊӻս账 + if ((CHAR_getWorkInt(meindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(meindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + + if ((CHAR_getWorkInt(toindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + || (CHAR_getWorkInt(toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + return; + + if (getStringFromIndexWithDelim(message, "|", 3, tocharaname, sizeof(tocharaname)) == FALSE) return; + if (getStringFromIndexWithDelim(message, "|", 5, token, sizeof(token)) == FALSE) return; + showindex = atoi(token); + if (getStringFromIndexWithDelim(message, "|", 4, token, sizeof(token)) == FALSE) return; + + showindex = toindex; + strcpy( tocharaname, CHAR_getChar(toindex, CHAR_NAME)); + + switch(tolower(token[0])){ + case 'i': + { + char buf1[2048]; + if( TRADE_HandleItem( meindex, showindex, message, buf1) == FALSE ){ + print(" TRADE_Close_Err3:%d,%d,%s,%s ", meindex, showindex, message, buf1); + TRADE_Close(fd, meindex, message); + return; + }else{ + snprintf(msg, sizeof(msg), "T|%d|%s|I|%d|%s", fd, mycharaname, showindex, buf1 ); + lssproto_TD_send(tofd, -1, msg); + } + } + break; + case 'g': + { + char buf1[2048]; + if( TRADE_HandleGold( meindex, showindex, message, buf1) == FALSE ){ + print(" TRADE_Close_Err4:%d,%d,%s,%s ", meindex, showindex, message, buf1); + TRADE_Close(fd, meindex, message); + return; + }else{// ֮ǮԷ + snprintf(msg, sizeof(msg), "T|%d|%s|G|%d|%s", fd, mycharaname, showindex, buf1); + lssproto_TD_send( tofd, -1, msg); + } + } + break; + case 'p': + { + char buf1[2048]; + if( TRADE_HandlePet( meindex, showindex, message, buf1) == FALSE ){ + print(" TRADE_Close_Err5:%d,%d,%s,%s ", meindex, showindex, message, buf1); + TRADE_Close(fd, meindex, message); + return; + }else{ + snprintf(msg, sizeof(msg), "T|%d|%s|P|%d|%s", + fd, mycharaname, showindex, buf1); + lssproto_TD_send(tofd, -1, msg); + } + } + break; + case 'k': + if((CONNECT_get_confirm(fd)==TRUE) && + (CONNECT_get_confirm(tofd)==TRUE) ){//˫ lock + if( CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_LOCK ){ + //andy_log + print("ANDY err ֹڶν!!\n"); + return;//ֹڶν + } + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_LOCK); + //ԷǷ ok + if( CHAR_getWorkInt( toindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_LOCK )return; + + snprintf(msg, sizeof(msg), "T|%d|%s|A", fd, mycharaname); + lssproto_TD_send( tofd, -1, msg); + TRADE_SwapItem(meindex, toindex, message, fd, mycharaname, tofd, tocharaname); + } + break; + case 'c': + if( CONNECT_get_confirm( fd) == TRUE ) return; + CONNECT_set_confirm(fd, TRUE); + snprintf( msg, sizeof(msg), "T|%d|%s|C", fd, mycharaname); + lssproto_TD_send( tofd, -1, msg); + break; + } + return; +} + +void TRADE_SwapItem( int meindex, int toindex, char* message, int fd, char* mycharaname, int tofd, char* tocharaname) +{ + int result; + char msg[128], tmpmsg[128]; + +#ifndef _ITEM_PILEFORTRADE + CONNECT_setTradeTmp(fd, message); +#endif + result = TRADE_CheckItembuf(fd, meindex, toindex, tofd, mycharaname, tocharaname); +#ifndef _ITEM_PILEFORTRADE + toindex = CONNECT_getCharaindex(tofd); +#endif + + if (!CHAR_CHECKINDEX(toindex)) return; + if (result == -1) + strcpy(msg, TRADE_FAILED); + else if (result == -2) + sprintf(msg, TRADE_ITEMFULL, mycharaname); + else if (result == -3) + sprintf(msg, TRADE_ITEMFULL, tocharaname); + else if (result == -4) + sprintf(msg, TRADE_RICH, mycharaname); + else if (result == -5) + sprintf(msg, TRADE_POOR, mycharaname); + else if (result == -6) + sprintf(msg, TRADE_RICH, tocharaname); + else if (result == -7) + sprintf(msg, TRADE_POOR, tocharaname); + else if (result == -8) + sprintf(msg, TRADE_TOORICH, mycharaname); + else if (result == -9) + sprintf(msg, TRADE_TOORICH, tocharaname); + else if (result == -10) + sprintf(msg, TRADE_PETFULL, mycharaname); + else if (result == -11) + sprintf(msg, TRADE_PETFULL, tocharaname); + else if (result == -12) + strcpy(msg, TRADE_VANISHITEM); + else if (result == -13) + sprintf(msg, TRADE_POORLV, mycharaname); + else if (result == -14) + sprintf(msg, TRADE_POORLV, tocharaname); + else if (result == -15) + strcpy(msg, TRADE_FMPET); +#ifdef _LOCK_PET_ITEM + else if (result == -16) + strcpy(msg, TRADE_LOCKPET); + else if (result == -17) + strcpy(msg, TRADE_LOCKITEM); +#endif + else if (result == 1) + strcpy(msg, TRADE_SUCCESS); + else if (result == 2) + strcpy(msg, TRADE_LOCK); + else if (result == 3) + strcpy(msg, TRADE_PK_START); + + if (result != 2){ + snprintf(tmpmsg, sizeof(tmpmsg), "W|%d|%s", fd, mycharaname); + lssproto_TD_send(tofd, -1, tmpmsg); + snprintf(tmpmsg, sizeof(tmpmsg), "W|%d|%s", tofd, tocharaname); + lssproto_TD_send(fd, -1, tmpmsg); + + CHAR_setWorkInt(meindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CHAR_setWorkInt(toindex, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CONNECT_setTradeTmp(fd, ""); + CONNECT_setTradeTmp(tofd, ""); + CHAR_sendTradeEffect( meindex, 0); + CHAR_sendTradeEffect( toindex, 0); + } + CHAR_sendStatusString(meindex, "i"); + CHAR_sendStatusString(toindex, "i"); + CHAR_sendStatusString(meindex, "P"); + CHAR_sendStatusString(toindex, "P"); + { + int j, petindex; + char msgbuf[256]; + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet( meindex, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( meindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( meindex, msgbuf ); + } + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet( toindex, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( toindex, msgbuf ); + } + } + + CHAR_talkToCli(meindex, -1, msg, CHAR_COLORYELLOW); + CHAR_talkToCli(toindex, -1, msg, CHAR_COLORYELLOW); + +#ifdef _FIX_TRADE_COPYPET + int m,n,petindex1,petindex2; + for( m = 0; m < CHAR_MAXPETHAVE; m ++ ) { + + petindex1=CHAR_getCharPet( meindex,m); + if( petindex1 == -1 ) continue; + for( n = 0; n < CHAR_MAXPETHAVE; n ++ ) { + petindex2=CHAR_getCharPet( toindex,n); + if( petindex2 == -1 ) continue; + printf("\nowner=%s pet1=%s owner=%s pet2=%s", + CHAR_getChar( meindex, CHAR_NAME), + CHAR_getChar( petindex1, CHAR_NAME), + CHAR_getChar( toindex, CHAR_NAME), + CHAR_getChar( petindex2, CHAR_NAME)); + if(strcmp( CHAR_getChar( petindex1, CHAR_UNIQUECODE), CHAR_getChar( petindex2, CHAR_UNIQUECODE))== 0){ + CHAR_talkToCli(meindex, -1, "⵽ǷサףϵͳԶ", CHAR_COLORRED); + CHAR_talkToCli(toindex, -1, "⵽ǷサףϵͳԶ", CHAR_COLORRED); + NPC_DelPet(toindex,n); + } + } + } +#endif + + + if(CHAR_getInt(meindex,CHAR_FLOOR)!=50000 && CHAR_getInt(toindex,CHAR_FLOOR)!=50000) + { + CHAR_charSaveFromConnect(meindex, FALSE); + CHAR_charSaveFromConnect(toindex, FALSE); + CHAR_talkToCli(meindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + CHAR_talkToCli(toindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } +} + +#ifdef _ITEM_PILEFORTRADE + +int TRADE_HandleTrade_DelItem( int charaindex, int MyMaxPile, int MaxPile, int *Item, int *nums, int *indexlist) +{ + int i, k; + + for( i=0; i<50; i++){ + indexlist[i] = -1; + } + k=0; + for( i=0; i<15; i++ ){ + int pilenum, itemindex, totalnums, newindex; + if( Item[i] == -1 ) continue; + itemindex = CHAR_getItemIndex( charaindex, Item[i] ); + if( !ITEM_CHECKINDEX( itemindex)) return -1; + if(ITEM_getInt( itemindex, ITEM_CANBEPILE)!=1 && ITEM_getInt( itemindex, ITEM_USEPILENUMS)>1){ + CHAR_setItemIndex( charaindex , Item[i], -1); + CHAR_sendItemDataOne(charaindex,Item[i]); + CHAR_talkToCli(charaindex,-1,"ǷԶɾ",CHAR_COLORYELLOW); + return -1; + } + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + pilenum -= nums[i]; + if( pilenum < 0 ) return -1; + if( pilenum == 0 ){ + CHAR_setItemIndex( charaindex, Item[i], -1); + indexlist[k] = itemindex; + k++; + totalnums = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + newindex = itemindex; + }else{ + ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum); + newindex = ITEM_makeItemAndRegist( ITEM_getInt( itemindex, ITEM_ID)); + if( !ITEM_CHECKINDEX( newindex) ) return -1; + indexlist[k] = newindex; + k++; + totalnums = nums[i]; + } + if( totalnums > MaxPile ){ + totalnums -= MaxPile; + ITEM_setInt( newindex, ITEM_USEPILENUMS, MaxPile); + }else{ + ITEM_setInt( newindex, ITEM_USEPILENUMS, totalnums); + totalnums = 0; + } + + while( totalnums > 0 ){ + newindex = ITEM_makeItemAndRegist( ITEM_getInt( itemindex, ITEM_ID)); + if( !ITEM_CHECKINDEX( newindex) ) return -1; + indexlist[k] = newindex; + k++; + if( totalnums > MaxPile ){ + totalnums -= MaxPile; + ITEM_setInt( newindex, ITEM_USEPILENUMS, MaxPile); + }else{ + ITEM_setInt( newindex, ITEM_USEPILENUMS, totalnums); + totalnums = 0; + } + } + } + return k; +} + +int TRADE_HandleTrade_DelPet( int charaindex, int *Pet, int *indexlist) +{ + int i, k, petindex; + k=0; + for( i=0; i<5; i++){ + indexlist[i] = -1; + } + for( i=0; i<5; i++ ){ + if( Pet[i] == -1 ) continue; + petindex = CHAR_getCharPet( charaindex, Pet[i] ); + //print("\npetindex=%d",petindex); + if( !CHAR_CHECKINDEX( petindex)) return -1; + CHAR_setCharPet( charaindex, Pet[i], -1); + if( Pet[i] == CHAR_getInt( charaindex, CHAR_DEFAULTPET)) { + int sellfd; + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + sellfd = getfdFromCharaIndex( charaindex); + lssproto_KS_send( sellfd, Pet[i], 0); + } + indexlist[k] = petindex; + k++; + } + return k; +} + +BOOL TRADE_HandleTrade_DelGold( int charaindex, int sGold, int *Gold) +{ + int MyGold, MyMaxGold; + + MyGold = CHAR_getInt( charaindex, CHAR_GOLD); + MyMaxGold = CHAR_getMaxHaveGold( charaindex); + + MyGold -= sGold; + if( MyGold < 0 || MyGold > MyMaxGold ){ + MyGold = (MyGold<0)?0:MyGold; + MyGold = (MyGold>MyMaxGold)?MyMaxGold:MyGold; + CHAR_setInt( charaindex, CHAR_GOLD, MyGold); + return FALSE; + } + CHAR_setInt( charaindex, CHAR_GOLD, MyGold); + *Gold = sGold; + return TRUE; +} + +BOOL TRADE_HandleTrade_AddItem( int charaindex, int *Item) +{ + int ret, i,itemindex; + for( i=0; i<50; i++){ + if( Item[i] == -1 )break; + itemindex = CHAR_getItemIndex( charaindex, Item[i] ); + if(ITEM_getInt( itemindex, ITEM_CANBEPILE)!=1 && ITEM_getInt( itemindex, ITEM_USEPILENUMS)>1){ + return FALSE; + } + ret = CHAR_addItemSpecificItemIndex( charaindex, Item[i]); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + int j; + for( j=i; j< 50; j++) + ITEM_endExistItemsOne( Item[j]); + return FALSE; + } + } + return TRUE; +} + +BOOL TRADE_HandleTrade_AddPet( int charaindex, int *Pet) +{ + int havepetelement, i; + for( i=0; i<5; i++){ + havepetelement = CHAR_getCharPetElement( charaindex); + if( Pet[i] == -1 ) break; + if( havepetelement < 0 ){ + int j; + for( j=i; j<5; j++){ + CHAR_endCharOneArray( Pet[j] ); + } + return FALSE; + + } + CHAR_setCharPet( charaindex, havepetelement, Pet[i]); + CHAR_setWorkInt( Pet[i], CHAR_WORKPLAYERINDEX, charaindex); + CHAR_setChar( Pet[i], CHAR_OWNERCDKEY, CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_setChar( Pet[i], CHAR_OWNERCHARANAME, CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_complianceParameter( Pet[i]); + } + return TRUE; +} + +BOOL TRADE_HandleTrade_AddGold( int charaindex, int sGold) +{ + int MyGold, MyMaxGold; + MyGold = CHAR_getInt( charaindex, CHAR_GOLD); + MyMaxGold = CHAR_getMaxHaveGold( charaindex); + + MyGold += sGold; + + MyGold = (MyGold<0)?0:MyGold; + MyGold = (MyGold>MyMaxGold)?MyMaxGold:MyGold; + + CHAR_setInt( charaindex, CHAR_GOLD, MyGold); + return TRUE; +} + +#ifdef _TRADE_PK +void BATTLE_Trade(void) +{ + char msg[128], tmpmsg[128], mycharaname[256], tocharaname[256]; + TRADE_HandleTrade(meindexpk, &TradeListPk[0], toindexpk, &TradeListPk[1]); + int fd,tofd; + fd = getfdFromCharaIndex(meindexpk); + tofd = getfdFromCharaIndex(toindexpk); + strcpy( mycharaname, CHAR_getChar(meindexpk, CHAR_NAME)); + strcpy( tocharaname, CHAR_getChar(toindexpk, CHAR_NAME)); + snprintf(tmpmsg, sizeof(tmpmsg), "W|%d|%s", fd, mycharaname); + lssproto_TD_send(tofd, -1, tmpmsg); + snprintf(tmpmsg, sizeof(tmpmsg), "W|%d|%s", tofd, tocharaname); + lssproto_TD_send(fd, -1, tmpmsg); + + CHAR_setWorkInt(meindexpk, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CHAR_setWorkInt(toindexpk, CHAR_WORKTRADEMODE, CHAR_TRADE_FREE); + CONNECT_setTradeTmp(fd, ""); + CONNECT_setTradeTmp(tofd, ""); + CHAR_sendTradeEffect( meindexpk, 0); + CHAR_sendTradeEffect( toindexpk, 0); + CHAR_sendStatusString(meindexpk, "i"); + CHAR_sendStatusString(toindexpk, "i"); + CHAR_sendStatusString(meindexpk, "P"); + CHAR_sendStatusString(toindexpk, "P"); + { + int j, petindex; + char msgbuf[256]; + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet( meindexpk, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( meindexpk, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( meindexpk, msgbuf ); + } + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet( toindexpk, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( toindexpk, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( toindexpk, msgbuf ); + } + } + CHAR_charSaveFromConnect(meindexpk, FALSE); + CHAR_charSaveFromConnect(toindexpk, FALSE); + CHAR_talkToCli(meindexpk, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + CHAR_talkToCli(toindexpk, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} +#endif + +BOOL TRADE_HandleTrade( int meindex, STradeList *temp1, int toindex, STradeList *temp2 ) +{ + int MeMaxPile, ToMaxPile, ret; + int MeItem[50], ToItem[50]; + int MePet[5], ToPet[5]; + int MeGold=0, ToGold=0; + int LostPet[5]={-1,-1,-1,-1,-1}; + + + MeMaxPile = CHAR_getMyMaxPilenum( meindex);//ѵ + ToMaxPile = CHAR_getMyMaxPilenum( toindex); + //Ƴmeindex + //Ƴtoindex + { + char buf[256]; + + memset( buf, 0, sizeof( buf)); + sprintf( buf, "A.%s[%s] trade B.%s[%s] FXY[%d,%d,%d]", + CHAR_getChar( meindex, CHAR_NAME), CHAR_getChar(meindex, CHAR_CDKEY), + CHAR_getChar( toindex, CHAR_NAME), CHAR_getChar(toindex, CHAR_CDKEY), + CHAR_getInt( meindex, CHAR_FLOOR), CHAR_getInt( meindex, CHAR_X), CHAR_getInt( meindex, CHAR_Y) ); + LogTrade(buf); + } + //Ƴ + if( CHAR_getInt( meindex, CHAR_FLOOR)==50000 && CHAR_getInt( toindex, CHAR_FLOOR)==50000) + { + if( CHAR_getWorkInt( meindex, CHAR_WORKTRADEPK)==1 && CHAR_getWorkInt( toindex, CHAR_WORKTRADEPK)==2) + { + if( (ret=TRADE_HandleTrade_DelItem( meindex, MeMaxPile, ToMaxPile, temp1->ItemTi, temp1->ItemNum, ToItem ))== -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelItem( toindex, ToMaxPile, MeMaxPile, temp2->ItemTi, temp2->ItemNum, MeItem ))== -1 ) return FALSE; + + if( (ret=TRADE_HandleTrade_DelPet( meindex, temp1->PetTi, ToPet)) == -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelPet( toindex, temp2->PetTi, MePet)) == -1 ) return FALSE; + if( TRADE_HandleTrade_DelGold( meindex, temp1->Golds, &ToGold) == FALSE ) return FALSE; + if( TRADE_HandleTrade_DelGold( toindex, temp2->Golds, &MeGold) == FALSE ) return FALSE; + // + if( TRADE_HandleTrade_AddItem( meindex, MeItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddItem( meindex, ToItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddPet( meindex, MePet) == FALSE) return FALSE; + if( TRADE_HandleTrade_AddPet( meindex, ToPet) == FALSE) return FALSE; + + TRADE_HandleTrade_AddGold( meindex, MeGold); + TRADE_HandleTrade_AddGold( meindex, ToGold); + CHAR_setWorkInt( meindex, CHAR_WORKTRADEPK, 0); + CHAR_setWorkInt( toindex, CHAR_WORKTRADEPK, 0); + } + else if( CHAR_getWorkInt( meindex, CHAR_WORKTRADEPK)==2 && CHAR_getWorkInt( toindex, CHAR_WORKTRADEPK)==1) + { + if( (ret=TRADE_HandleTrade_DelItem( meindex, MeMaxPile, ToMaxPile, temp1->ItemTi, temp1->ItemNum, ToItem ))== -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelItem( toindex, ToMaxPile, MeMaxPile, temp2->ItemTi, temp2->ItemNum, MeItem ))== -1 ) return FALSE; + + if( (ret=TRADE_HandleTrade_DelPet( meindex, temp1->PetTi, ToPet)) == -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelPet( toindex, temp2->PetTi, MePet)) == -1 ) return FALSE; + if( TRADE_HandleTrade_DelGold( meindex, temp1->Golds, &ToGold) == FALSE ) return FALSE; + if( TRADE_HandleTrade_DelGold( toindex, temp2->Golds, &MeGold) == FALSE ) return FALSE; + // + if( TRADE_HandleTrade_AddItem( toindex, MeItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddItem( toindex, ToItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddPet( toindex, MePet) == FALSE) return FALSE; + if( TRADE_HandleTrade_AddPet( toindex, ToPet) == FALSE) return FALSE; + + TRADE_HandleTrade_AddGold( toindex, MeGold); + TRADE_HandleTrade_AddGold( toindex, ToGold); + CHAR_setWorkInt( meindex, CHAR_WORKTRADEPK, 0); + CHAR_setWorkInt( toindex, CHAR_WORKTRADEPK, 0); + } + } + else + { + if( (ret=TRADE_HandleTrade_DelItem( meindex, MeMaxPile, ToMaxPile, temp1->ItemTi, temp1->ItemNum, ToItem ))== -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelItem( toindex, ToMaxPile, MeMaxPile, temp2->ItemTi, temp2->ItemNum, MeItem ))== -1 ) return FALSE; + + if( (ret=TRADE_HandleTrade_DelPet( meindex, temp1->PetTi, ToPet)) == -1 ) return FALSE; + if( (ret=TRADE_HandleTrade_DelPet( toindex, temp2->PetTi, MePet)) == -1 ) return FALSE; + if( TRADE_HandleTrade_DelGold( meindex, temp1->Golds, &ToGold) == FALSE ) return FALSE; + if( TRADE_HandleTrade_DelGold( toindex, temp2->Golds, &MeGold) == FALSE ) return FALSE; + // + if( TRADE_HandleTrade_AddItem( meindex, MeItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddItem( toindex, ToItem) == FALSE ) return FALSE; + if( TRADE_HandleTrade_AddPet( meindex, MePet) == FALSE) return FALSE; + if( TRADE_HandleTrade_AddPet( toindex, ToPet) == FALSE) return FALSE; + + TRADE_HandleTrade_AddGold( meindex, MeGold); + TRADE_HandleTrade_AddGold( toindex, ToGold); + } + { + char buf1[4096], buf2[4096], buf[256]; + int i; + sprintf( buf1, "A.ITEM."); + sprintf( buf2, "B.ITEM."); + for( i=0; i<50; i++){ + if( ITEM_CHECKINDEX( ToItem[i]) ){ + sprintf( buf, "%s[%s]*%d,", + ITEM_getChar( ToItem[i], ITEM_NAME), ITEM_getChar( ToItem[i], ITEM_UNIQUECODE), + ITEM_getInt( ToItem[i], ITEM_USEPILENUMS) ); + strcat( buf1, buf); + } + if( ITEM_CHECKINDEX( MeItem[i]) ){ + sprintf( buf, "%s[%s]*%d,", + ITEM_getChar( MeItem[i], ITEM_NAME), ITEM_getChar( MeItem[i], ITEM_UNIQUECODE), + ITEM_getInt( MeItem[i], ITEM_USEPILENUMS) ); + strcat( buf2, buf); + } + } + strcat( buf1, "PET."); + strcat( buf2, "PET."); + for( i=0; i<5; i++){ + if( CHAR_CHECKINDEX( ToPet[i]) ){ + sprintf( buf, "%s[%s]%s-%d", + CHAR_getUseName( ToPet[i]), CHAR_getChar( ToPet[i], CHAR_UNIQUECODE), + CHAR_getChar( ToPet[i], CHAR_NAME), CHAR_getInt( ToPet[i], CHAR_LV) ); + strcat( buf1, buf); + } + if( CHAR_CHECKINDEX( MePet[i]) ){ + sprintf( buf, "%s[%s]%s-%d", + CHAR_getUseName( MePet[i]), CHAR_getChar( MePet[i], CHAR_UNIQUECODE), + CHAR_getChar( MePet[i], CHAR_NAME), CHAR_getInt( MePet[i], CHAR_LV) ); + strcat( buf2, buf); + } + } + sprintf( buf, "GOLD:%d", ToGold); + strcat( buf1, buf); + sprintf( buf, "GOLD:%d", MeGold); + strcat( buf2, buf); + LogTrade( buf1); + LogTrade( buf2); + } + + return TRUE; +} + +int TRADE_CheckItembuf(int fd, int meindex, int toindex, int tofd, char* mycharaname, char* tocharaname) +{ + int Tradeti; + STradeList TradeListTemp[2]; + if( TRADE_getMyTarget( meindex) != toindex ) return -1; + Tradeti = CONNECT_getTradeList( fd); + if( Tradeti <0 || Tradeti >= MAX_TRADELISTNUM ) return -1; + if( TradeList[Tradeti][0].use != 1 || TradeList[Tradeti][1].use != 1 ) return -1; + if( TRADE_getSomeTradeList( meindex, &TradeListTemp[0]) == FALSE ) return -1; + if( TRADE_getSomeTradeList( toindex, &TradeListTemp[1]) == FALSE ) return -1; + //ȷλ + if( TRADE_CheckTradeList( meindex, &TradeListTemp[0], toindex, &TradeListTemp[1]) == FALSE ) return -1; + //Ƴ + // +#ifdef _TRADE_PK + if(CHAR_getInt( meindex, CHAR_FLOOR)==50000 && CHAR_getInt( toindex, CHAR_FLOOR)==50000) + { +// TradeListPk[0].charaindex = TradeListTemp[0].charaindex; +// TradeListPk[1].charaindex = TradeListTemp[1].charaindex; +// TradeListPk[0].fd = TradeListTemp[0].fd; +// TradeListPk[1].fd = TradeListTemp[1].fd; +// int i; +// for(i=0;i<5;i++) +// { +// TradeListPk[0].PetTi[i] = TradeListTemp[0].PetTi[i]; +// TradeListPk[1].PetTi[i] = TradeListTemp[1].PetTi[i]; +// } +// for(i=0;i<15;i++) +// { +// TradeListPk[0].ItemTi[i] = TradeListTemp[0].ItemTi[i]; +// TradeListPk[1].ItemTi[i] = TradeListTemp[1].ItemTi[i]; +// TradeListPk[0].ItemNum[i] = TradeListTemp[0].ItemNum[i]; +// TradeListPk[1].ItemNum[i] = TradeListTemp[1].ItemNum[i]; +// } +// TradeListPk[0].Golds = TradeListTemp[0].Golds; +// TradeListPk[1].Golds = TradeListTemp[1].Golds; +// TradeListPk[0].use = TradeListTemp[0].use; +// TradeListPk[1].use = TradeListTemp[1].use; + TradeListPk[0] = TradeListTemp[0]; + TradeListPk[1] = TradeListTemp[1]; + meindexpk = meindex; + toindexpk = toindex; + BATTLE_CreateVsPlayer( meindex, toindex); + return 3; + } + else + { +#endif + if( TRADE_HandleTrade( meindex, &TradeListTemp[0], toindex, &TradeListTemp[1] ) == FALSE ) return -1; + //׽ + return 1; +#ifdef _TRADE_PK + } +#endif +} + +#else +/* +int TRADE_CheckItembuf(int fd, int meindex, int toindex, int tofd, char* mycharaname, char* tocharaname) +{ +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + int myItem[42] = { -1 } ; //ҷеĽݱ + int oppItem[42] = { -1 }; //ԷеĽݱ + int ii , jj; + int Iitem1[15] = { 0 } ; //ҷߵindex + int Iitem2[15] = { 0 } ; //Էߵindex + int ppet1[5] = { 0 } ; //ҷindex + int ppet2[5] = { 0 } ; //Էindex + BOOL tradeflag = TRUE ; + int count = 0 ; +#endif + + char a[16], b[16], c[16], d[16], e[16], f[16]; + char g[16], h[16], i[16], j[16], k[16], l[16], token[16]; + int itemindex1 = 0, itemindex2 = 0, itemindex3 = 0; + int itemindex4 = 0, itemindex5 = 0, itemindex6 = 0; + int toitemindex1 = 0, toitemindex2 = 0, toitemindex3 = 0; + int toitemindex4 = 0, toitemindex5 = 0, toitemindex6 = 0; + int item1 = 0, item2 = 0, item4 = 0, item5 = 0, pet3 = 0, pet6 = 0; + int pet1 = 0, pet2 = 0; + int swapitem1 = 0, swapitem2 = 0, gold1 = 0, gold2 = 0; + char itembuf[256], toitembuf[256], buf[4048]; + + CONNECT_getTradeTmp(fd, itembuf, sizeof(itembuf)); + CONNECT_getTradeTmp(tofd, toitembuf, sizeof(toitembuf)); + + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȡҷнݱ + for ( ii = 0 ; ii < 42 ; ii ++ ) { + if (getStringFromIndexWithDelim(itembuf, "|", 6 + ii * 2 , token, sizeof(token)) == TRUE) + myItem[ii] = atoi(token); + } + //ȡöԷнݱ + for ( ii = 0 ; ii < 42 ; ii ++ ) { + if (getStringFromIndexWithDelim(toitembuf, "|", 6 + ii * 2 , token, sizeof(token)) == TRUE) + oppItem[ii] = atoi(token); + } +#else + // ȶ˫֮ύЭ + if (getStringFromIndexWithDelim(itembuf, "|", 5, token, sizeof(token)) == TRUE) + strcpy(a, token); + if (getStringFromIndexWithDelim(itembuf, "|", 6, token, sizeof(token)) == TRUE) + itemindex1 = atoi(token); + if (getStringFromIndexWithDelim(itembuf, "|", 7, token, sizeof(token)) == TRUE) + strcpy(b, token); + if (getStringFromIndexWithDelim(itembuf, "|", 8, token, sizeof(token)) == TRUE) + itemindex2 = atoi(token); + if (getStringFromIndexWithDelim(itembuf, "|", 9, token, sizeof(token)) == TRUE) + strcpy(c, token); + if (getStringFromIndexWithDelim(itembuf, "|", 10, token, sizeof(token)) == TRUE) + itemindex3 = atoi(token); + if (getStringFromIndexWithDelim(itembuf, "|", 11, token, sizeof(token)) == TRUE) + strcpy(d, token); + if (getStringFromIndexWithDelim(itembuf, "|", 12, token, sizeof(token)) == TRUE) + itemindex4 = atoi(token); + if (getStringFromIndexWithDelim(itembuf, "|", 13, token, sizeof(token)) == TRUE) + strcpy(e, token); + if (getStringFromIndexWithDelim(itembuf, "|", 14, token, sizeof(token)) == TRUE) + itemindex5 = atoi(token); + if (getStringFromIndexWithDelim(itembuf, "|", 15, token, sizeof(token)) == TRUE) + strcpy(f, token); + if (getStringFromIndexWithDelim(itembuf, "|", 16, token, sizeof(token)) == TRUE) + itemindex6 = atoi(token); + + if (getStringFromIndexWithDelim(toitembuf, "|", 5, token, sizeof(token)) == TRUE) + strcpy(g, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 6, token, sizeof(token)) == TRUE) + toitemindex1 = atoi(token); + if (getStringFromIndexWithDelim(toitembuf, "|", 7, token, sizeof(token)) == TRUE) + strcpy(h, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 8, token, sizeof(token)) == TRUE) + toitemindex2 = atoi(token); + if (getStringFromIndexWithDelim(toitembuf, "|", 9, token, sizeof(token)) == TRUE) + strcpy(i, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 10, token, sizeof(token)) == TRUE) + toitemindex3 = atoi(token); + if (getStringFromIndexWithDelim(toitembuf, "|", 11, token, sizeof(token)) == TRUE) + strcpy(j, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 12, token, sizeof(token)) == TRUE) + toitemindex4 = atoi(token); + if (getStringFromIndexWithDelim(toitembuf, "|", 13, token, sizeof(token)) == TRUE) + strcpy(k, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 14, token, sizeof(token)) == TRUE) + toitemindex5 = atoi(token); + if (getStringFromIndexWithDelim(toitembuf, "|", 15, token, sizeof(token)) == TRUE) + strcpy(l, token); + if (getStringFromIndexWithDelim(toitembuf, "|", 16, token, sizeof(token)) == TRUE) + toitemindex6 = atoi(token); +#endif + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ظ׵ĵ + for ( ii = 0 ; ii < 15 ; ii ++ ) { + for ( jj = ii + 1 ; jj < 15 ; jj ++ ) { + if ( myItem[ii] == myItem[jj] ) + if ( myItem[ii] != -1 ) + return -1 ; + } + } + for ( ii = 21 ; ii < 36 ; ii ++ ) { + for ( jj = ii + 1 ; jj < 36 ; jj++ ) { + if ( myItem[ii] == myItem[jj] ) + if ( myItem[ii] != -1 ) + return -1 ; + } + } +#else + // shan hjj add ϴ + if (itemindex1==itemindex2){ + if (itemindex1!=-1){ + return -1; + } + } + if (itemindex4==itemindex5){ + if (itemindex4!=-1){ + return -1; + } + } + // End +#endif + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȶ˫׵ƷǷȷ + for ( ii = 0 ; ii < 21 ; ii ++ ) { + if ( myItem[ii] != oppItem[ii+21] ) { + tradeflag = FALSE ; + break; + } + } + for ( ii = 21 ; ii < 42 ; ii ++ ){ + if ( myItem[ii] != oppItem[ii-21]) { + tradeflag = FALSE; + break; + } + } + //˫ȷʼд + if ( tradeflag == TRUE ) { + //˫ߵļӼ + for ( ii = 0 ; ii < 15 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + swapitem1--; + swapitem2++; + } + } + for ( ii = 21 ; ii < 36 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + swapitem1++; + swapitem2--; + } + } +#else + if ((strcmp(a, j) == 0) && (strcmp(b, k) == 0) && (strcmp(c,l) == 0) + && (strcmp(d, g) == 0) && (strcmp(e, h) == 0) && (strcmp(f, i) == 0) + && (itemindex1 == toitemindex4) && (itemindex2 == toitemindex5) + && (itemindex3 == toitemindex6) && (itemindex4 == toitemindex1) + && (itemindex5 == toitemindex2) && (itemindex6 == toitemindex3)) + { + // ˫ƷǷпλ + if ((strcmp(a, "I") == 0) && (itemindex1 != -1)){ + swapitem1--; + swapitem2++; + } + if ((strcmp(b, "I") == 0) && (itemindex2 != -1)){ + swapitem1--; + swapitem2++; + } + if ((strcmp(d, "I") == 0) && (itemindex4 != -1)){ + swapitem1++; + swapitem2--; + } + if ((strcmp(e, "I") == 0) && (itemindex5 != -1)){ + swapitem1++; + swapitem2--; + } +#endif + if (swapitem1 > CHAR_findTotalEmptyItem(meindex)) + return -2; + toindex = CONNECT_getCharaindex(tofd); + if (!CHAR_CHECKINDEX(toindex)) return -1; + if (swapitem2 > CHAR_findTotalEmptyItem(toindex)) + return -3; +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȡýĽǮ + if ( myItem[20] != -1 ) gold1 += myItem[20] ; + if ( myItem[41] != -1 ) gold2 += myItem[41] ; +#else + // ˫Ǯ + if ((strcmp(a, "G") == 0) && (itemindex1 != -1)) gold1 += itemindex1; + if ((strcmp(b, "G") == 0) && (itemindex2 != -1)) gold1 += itemindex2; + if ((strcmp(d, "G") == 0) && (itemindex4 != -1)) gold2 += itemindex4; + if ((strcmp(e, "G") == 0) && (itemindex5 != -1)) gold2 += itemindex5; +#endif + if (gold1 > CHAR_getMaxHaveGold( meindex) ) return -4; + if (gold1 > CHAR_getInt(meindex, CHAR_GOLD)) return -5; + if (gold2 > CHAR_getMaxHaveGold( toindex)) return -6; + if (gold2 > CHAR_getInt(toindex, CHAR_GOLD)) return -7; + if ((gold2 + CHAR_getInt(meindex, CHAR_GOLD) - gold1) > CHAR_getMaxHaveGold( meindex) ) return -8; + if ((gold1 + CHAR_getInt(toindex, CHAR_GOLD) - gold2) > CHAR_getMaxHaveGold( toindex)) return -9; + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //˫ļӼ + for ( ii = 15 ; ii < 20 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + pet1--; + pet2++; + } + } + for ( ii = 36 ; ii < 41 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + pet1++; + pet2--; + } + } +#else + // ˫ + if ((strcmp(c, "P") == 0) && (itemindex3 != -1)) + { + pet1--; pet2++; + } + if ((strcmp(f, "P") == 0) && (itemindex6 != -1)) + { + pet1++; pet2--; + } +#endif + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + if ((pet1 > 5) || (pet2 > 5)) return -10; + //ȡ˫ܷŵij + for( ii = 0; ii < CHAR_MAXPETHAVE; ii ++ ) { + if( CHAR_getCharPet( meindex , ii ) == -1 ) count ++ ; + } + if ( pet1 > count ) return -10; + count = 0 ; + for( ii = 0; ii < CHAR_MAXPETHAVE; ii ++ ) { + if( CHAR_getCharPet( toindex , ii ) == -1 ) count ++ ; + } + if ( pet2 > count ) return -11; +#else + if ((pet1 > 1) || (pet2 > 1)) return -10; + if ((pet1 == 1) && (CHAR_getCharPetElement( meindex) == -1)) return -10; + if ((pet2 == 1) && (CHAR_getCharPetElement( toindex) == -1)) return -11; +#endif +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȡ׵ĵindex + for ( ii = 0 ; ii < 15 ; ii ++ ) { + if ( myItem[ii] != -1 ) + Iitem1[ii] = CHAR_getItemIndex(meindex, myItem[ii]); + else + Iitem1[ii] = -1 ; + if ( myItem[ii + 21 ] != -1 ) + Iitem2[ii] = CHAR_getItemIndex(toindex, myItem[ii + 21]); + else + Iitem2[ii] = -1 ; + } +#else + if ((strcmp(a, "I") == 0) && (itemindex1 != -1)) + item1 = CHAR_getItemIndex(meindex, itemindex1); + else item1 = -1; + if ((strcmp(b, "I") == 0) && (itemindex2 != -1)) + item2 = CHAR_getItemIndex(meindex, itemindex2); + else item2 = -1; + if ((strcmp(d, "I") == 0) && (itemindex4 != -1)) + item4 = CHAR_getItemIndex(toindex, itemindex4); + else item4 = -1; + if ((strcmp(e, "I") == 0) && (itemindex5 != -1)) + item5 = CHAR_getItemIndex(toindex, itemindex5); + else item5 = -1; +#endif +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȡ׳index + for ( ii = 15 ; ii < 20 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + if ( CHAR_getInt( meindex , CHAR_RIDEPET) == myItem[ii] ) + return -1 ; + ppet1[ii - 15 ] = CHAR_getCharPet( meindex , myItem[ii] ) ; + } + else + ppet1[ii - 15 ] = -1 ; + } + for ( ii = 36 ; ii < 41 ; ii ++ ) { + if ( myItem[ii] != -1 ) { + if ( CHAR_getInt( toindex , CHAR_RIDEPET) == myItem[ii] ) + return -1 ; + ppet2[ ii - 36 ] = CHAR_getCharPet( toindex , myItem[ii] ) ; + } + else + ppet2[ ii - 36 ] = -1 ; + } +#else + if (itemindex3 != -1) + { + if( CHAR_getInt( meindex, CHAR_RIDEPET) == itemindex3 ) + return -1; + pet3 = CHAR_getCharPet(meindex, itemindex3); + } + else pet3 = -1; + if (itemindex6 != -1) + { + if( CHAR_getInt( toindex, CHAR_RIDEPET) == itemindex6 ) + return -1; + pet6 = CHAR_getCharPet(toindex, itemindex6); + } + else pet6 = -1; +#endif + + + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + for ( ii = 0 ; ii < 15 ; ii ++ ) { + if ( ITEM_getInt( Iitem1[ii] , ITEM_VANISHATDROP ) == 1 ) + return -12 ; + if ( ITEM_getInt( Iitem2[ii] , ITEM_VANISHATDROP ) == 1 ) + return -12 ; + } +#else + if ((ITEM_getInt(item1, ITEM_VANISHATDROP) == 1)|| + (ITEM_getInt(item2, ITEM_VANISHATDROP) == 1)|| + (ITEM_getInt(item4, ITEM_VANISHATDROP) == 1)|| + (ITEM_getInt(item5, ITEM_VANISHATDROP) ==1)) + return -12; +#endif + + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ȼܷж + if( CHAR_getWorkInt( meindex, CHAR_PickAllPet) != TRUE ) { + for ( ii = 0 ; ii < 5 ; ii ++ ) { + if ( (ppet2[ii] != -1 ) && ( CHAR_getInt( ppet2[ii] , CHAR_LV ) + - CHAR_getInt(meindex, CHAR_LV) > 5) + && (CHAR_getInt(meindex,CHAR_TRANSMIGRATION) <= 0)) + return -13 ; + } + } + if( CHAR_getWorkInt( toindex, CHAR_PickAllPet) != TRUE ) { + for ( ii = 0 ; ii < 5 ; ii ++ ) { + if ( (ppet1[ii] != -1 ) && ( CHAR_getInt( ppet1[ii] , CHAR_LV ) + - CHAR_getInt(toindex, CHAR_LV) > 5) + && (CHAR_getInt(toindex,CHAR_TRANSMIGRATION) <= 0)) + return -13 ; + } + } +#else + if( CHAR_getWorkInt( meindex, CHAR_PickAllPet) != TRUE ) { + if ((pet6 != -1) && (CHAR_getInt(pet6, CHAR_LV) + - CHAR_getInt(meindex, CHAR_LV) > 5) + && (CHAR_getInt(meindex,CHAR_TRANSMIGRATION) <= 0)) + return -13; + + } + if( CHAR_getWorkInt( toindex, CHAR_PickAllPet) != TRUE ) { + + if ((pet3 != -1) && (CHAR_getInt(pet3, CHAR_LV) + - CHAR_getInt(toindex, CHAR_LV) > 5) + && (CHAR_getInt(toindex,CHAR_TRANSMIGRATION) <= 0)) + return -14; + } +#endif +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + //ǷΪػ + for ( ii = 0 ; ii < 5 ; ii ++ ) { + if ( ( ppet1[ii] != -1 ) && (CHAR_getInt(ppet1[ii], CHAR_PETFAMILY) == 1)) + return -15; + if ( ( ppet2[ii] != -1 ) && (CHAR_getInt(ppet2[ii], CHAR_PETFAMILY) == 1)) + return -15; + } +#else + if ((pet6 != -1) && (CHAR_getInt(pet6, CHAR_PETFAMILY) == 1)) + return -15; + if ((pet3 != -1) && (CHAR_getInt(pet3, CHAR_PETFAMILY) == 1)) + return -15; +#endif + +#ifdef _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ + // ҵߡǮ + for ( ii = 0 ; ii < 15 ; ii ++ ) { + TRADE_ChangeItem(meindex, toindex, "I", "I", Iitem1[ii], Iitem2[ii], + myItem[ii], oppItem[ii]); + } + for ( ii = 15 ; ii < 20 ; ii ++ ) { + TRADE_ChangeItem(meindex, toindex, "P", "P", ppet1[ii - 15 ], ppet2[ii-15], + myItem[ii], oppItem[ii]); + } + TRADE_ChangeItem(meindex, toindex, "G", "G", Iitem1[20], Iitem2[41], + myItem[20], oppItem[20]); +#else + TRADE_ChangeItem(meindex, toindex, a, d, item1, item4, + itemindex1, itemindex4); + TRADE_ChangeItem(meindex, toindex, b, e, item2, item5, + itemindex2, itemindex5); + TRADE_ChangeItem(meindex, toindex, c, f, pet3, pet6, + itemindex3, itemindex6); +#endif + + // д trade.log + { + char petname1[256], petname2[256]; + int pet1lv, pet2lv; + int logitem1 = 0, logitem2 = 0, logitem4 = 0, logitem5 = 0; + + if ((strcmp(a, "I") == 0) && (item1 != -1)) logitem1 = ITEM_getInt(item1, ITEM_ID); + if ((strcmp(b, "I") == 0) && (item2 != -1)) logitem2 = ITEM_getInt(item2, ITEM_ID); + if ((strcmp(a, "G") == 0) && (item1 == -1)) logitem1 = itemindex1; + if ((strcmp(b, "G") == 0) && (item2 == -1)) logitem2 = itemindex2; + if ((strcmp(c, "P") == 0) && (pet3 == -1)) + { + sprintf(petname1, "NONE"); + pet1lv = 0; + } + else + { + sprintf(petname1, "%s", CHAR_getChar(pet3, CHAR_NAME)); + pet1lv = CHAR_getInt(pet3, CHAR_LV); + } + if ((strcmp(f, "P") == 0) && (pet6 == -1)) + { + sprintf(petname2, "NONE"); + pet2lv = 0; + } + else + { + sprintf(petname2, "%s", CHAR_getChar(pet6, CHAR_NAME)); + pet2lv = CHAR_getInt(pet6, CHAR_LV); + } + if ((strcmp(d, "I") == 0) && (item4 != -1)) logitem4 = ITEM_getInt(item4, ITEM_ID); + if ((strcmp(e, "I") == 0) && (item5 != -1)) logitem5 = ITEM_getInt(item5, ITEM_ID); + if ((strcmp(d, "G") == 0) && (item4 == -1)) logitem4 = itemindex4; + if ((strcmp(e, "G") == 0) && (item5 == -1)) logitem5 = itemindex5; + sprintf(buf, "%s\t%s\t(%s[%d,%s],%s[%d,%s],%s[%s,%d,%s]) <-> %s\t%s\t(%s[%d,%s],%s[%d,%s],%s[%s,%d,%s])", + CHAR_getChar(meindex, CHAR_CDKEY), mycharaname, + a, logitem1, ITEM_getChar( item1, ITEM_UNIQUECODE), b, logitem2, ITEM_getChar( item2, ITEM_UNIQUECODE), + c, petname1, pet1lv, CHAR_getChar( pet3, CHAR_UNIQUECODE), + CHAR_getChar(toindex, CHAR_CDKEY), tocharaname, + d, logitem4, ITEM_getChar( item4, ITEM_UNIQUECODE), e, logitem5, ITEM_getChar( item5, ITEM_UNIQUECODE), + f, petname2, pet2lv, CHAR_getChar( pet6, CHAR_UNIQUECODE)); + LogTrade(buf); + } + + return 1; + }// if + else + return 2; +} +*/ +#endif +/* +BOOL TRADE_ChangeItem(int meindex, int toindex, char *a, char *b, + int item1, int item2, int itemindex1, int itemindex2) +{ + int gold1 = 0, gold2 = 0, eptitem = -1; + if (CHAR_CHECKINDEX(meindex) == FALSE) return FALSE; + if (CHAR_CHECKINDEX(toindex) == FALSE) return FALSE; + // <-> + if ((strcmp(a, "I") == 0) && (strcmp(b, "I") == 0)) + { + // <-> + if ((itemindex1 == -1) && (itemindex2 > 0)) + { + if (ITEM_CHECKINDEX(item2) == FALSE) return FALSE; + eptitem = CHAR_findEmptyItemBox(meindex); + if (eptitem < 0) return FALSE; + CHAR_setItemIndex(meindex, eptitem, item2); + ITEM_setWorkInt(item2, ITEM_WORKCHARAINDEX, meindex); + ITEM_setWorkInt(item2, ITEM_WORKOBJINDEX, -1); + CHAR_setItemIndex(toindex, itemindex2, -1); + } + // <-> + else if ((itemindex1 > 0) && (itemindex2 == -1)) + { + if (ITEM_CHECKINDEX(item1) == FALSE) return FALSE; + eptitem = CHAR_findEmptyItemBox(toindex); + if (eptitem < 0) return FALSE; + CHAR_setItemIndex(toindex, eptitem, item1); + ITEM_setWorkInt(item1, ITEM_WORKCHARAINDEX, toindex); + ITEM_setWorkInt(item1, ITEM_WORKOBJINDEX, -1); + CHAR_setItemIndex(meindex, itemindex1, -1); + } + // <-> + else if (itemindex1 > 0 && itemindex2 > 0) + { + if (ITEM_CHECKINDEX(item1) == FALSE) return FALSE; + if (ITEM_CHECKINDEX(item2) == FALSE) return FALSE; + ITEM_setWorkInt(item1, ITEM_WORKCHARAINDEX, toindex); + ITEM_setWorkInt(item1, ITEM_WORKOBJINDEX, -1); + ITEM_setWorkInt(item2, ITEM_WORKCHARAINDEX, meindex); + ITEM_setWorkInt(item2, ITEM_WORKOBJINDEX, -1); + CHAR_setItemIndex(toindex, itemindex2, item1); + CHAR_setItemIndex(meindex, itemindex1, item2); + } + } + // <-> Ǯ + else if ((strcmp(a, "I") == 0) && (strcmp(b, "G") == 0)) + { + if (itemindex1 > 0) + { + if (ITEM_CHECKINDEX(item1) == FALSE) return FALSE; + eptitem = CHAR_findEmptyItemBox(toindex); + if (eptitem < 0) return FALSE; + ITEM_setWorkInt(item1, ITEM_WORKCHARAINDEX, toindex); + ITEM_setWorkInt(item1, ITEM_WORKOBJINDEX, -1); + CHAR_setItemIndex(toindex, eptitem, item1); + CHAR_setItemIndex(meindex, itemindex1, -1); + } + if (itemindex2 < 0) itemindex2 = 0; + gold1 = CHAR_getInt(meindex, CHAR_GOLD); + gold1 += itemindex2; + CHAR_setInt(meindex, CHAR_GOLD, gold1); + gold2 = CHAR_getInt(toindex, CHAR_GOLD); + gold2 -= itemindex2; + CHAR_setInt(toindex, CHAR_GOLD, gold2); + } + // Ǯ <-> + else if ((strcmp(a, "G") == 0) && (strcmp(b, "I") == 0)) + { + if (itemindex2 > 0) + { + if (ITEM_CHECKINDEX(item2) == FALSE) return FALSE; + eptitem = CHAR_findEmptyItemBox(meindex); + if (eptitem < 0) return FALSE; + ITEM_setWorkInt(item2, ITEM_WORKCHARAINDEX, meindex); + ITEM_setWorkInt(item2, ITEM_WORKOBJINDEX, -1); + CHAR_setItemIndex(meindex, eptitem, item2); + CHAR_setItemIndex(toindex, itemindex2, -1); + } + if (itemindex1 < 0) itemindex1 = 0; + gold1 = CHAR_getInt(meindex, CHAR_GOLD); + gold1 -= itemindex1; + CHAR_setInt(meindex, CHAR_GOLD, gold1); + gold2 = CHAR_getInt(toindex, CHAR_GOLD); + gold2 += itemindex1; + CHAR_setInt(toindex, CHAR_GOLD, gold2); + } + // Ǯ <-> Ǯ + else if ((strcmp(a, "G") == 0) && (strcmp(b, "G") == 0)) + { + if (itemindex1 < 0) itemindex1 = 0; + if (itemindex2 < 0) itemindex2 = 0; + gold1 = CHAR_getInt(toindex, CHAR_GOLD); + gold1 = gold1 + itemindex1 - itemindex2; + CHAR_setInt(toindex, CHAR_GOLD, gold1); + gold2 = CHAR_getInt(meindex, CHAR_GOLD); + gold2 = gold2 + itemindex2 - itemindex1; + CHAR_setInt(meindex, CHAR_GOLD, gold2); + } + // <-> + else if ((strcmp(a, "P") == 0) && (strcmp(b, "P") == 0)) + { + char category[8]; + if ((item1 != -1) && (CHAR_CHECKINDEX(item1) == FALSE)) return FALSE; + if ((item2 != -1) && (CHAR_CHECKINDEX(item2) == FALSE)) return FALSE; + + if ((itemindex1 != -1) && (itemindex1 == CHAR_getInt(meindex, CHAR_DEFAULTPET))) + { + int fd; + CHAR_setInt(meindex, CHAR_DEFAULTPET, -1); + fd = getfdFromCharaIndex(meindex); + if (fd != -1){ + CHAR_setWorkInt( meindex, CHAR_WORK_PET0_STAT+itemindex1-1, 0); + lssproto_KS_send(fd, itemindex1, 0); + } + } + if ((itemindex2 != -1)&& (itemindex2 == CHAR_getInt(toindex, CHAR_DEFAULTPET))) + { + int tofd; + CHAR_setInt(toindex, CHAR_DEFAULTPET, -1); + tofd = getfdFromCharaIndex(toindex); + if (tofd != -1){ + CHAR_setWorkInt( toindex, CHAR_WORK_PET0_STAT+itemindex1-1, 0); + lssproto_KS_send(tofd, itemindex2, 0); + } + } + + if (item1 != -1) + CHAR_setWorkInt(item1, CHAR_WORKPLAYERINDEX, toindex); + if (item2 != -1) + CHAR_setWorkInt(item2, CHAR_WORKPLAYERINDEX, meindex); + if (itemindex1 == -1) + itemindex1 = CHAR_getCharPetElement( meindex); + if (itemindex2 == -1) + itemindex2 = CHAR_getCharPetElement( toindex); + CHAR_setCharPet(meindex, itemindex1, item2); + CHAR_setCharPet(toindex, itemindex2, item1); + if ((itemindex1 != -1) && (item1 != -1)) { + + CHAR_setChar(item1, CHAR_OWNERCDKEY, + CHAR_getChar(toindex, CHAR_CDKEY)); + CHAR_setChar(item1, CHAR_OWNERCHARANAME, + CHAR_getChar(toindex, CHAR_NAME)); + + CHAR_complianceParameter(item1); + CHAR_setInt(item1, CHAR_PUTPETTIME, 0); + } + if ((itemindex2 != -1) && (item2 != -1)) { + + CHAR_setChar(item2, CHAR_OWNERCDKEY, + CHAR_getChar(meindex, CHAR_CDKEY)); + CHAR_setChar(item2, CHAR_OWNERCHARANAME, + CHAR_getChar(meindex, CHAR_NAME)); + + CHAR_complianceParameter(item2); + CHAR_setInt(item2, CHAR_PUTPETTIME, 0); + } + snprintf(category, sizeof(category), "K%d", itemindex1); + CHAR_sendStatusString(meindex, category); + snprintf(category, sizeof(category), "W%d", itemindex1); + CHAR_sendStatusString(meindex, category); + snprintf(category, sizeof(category), "K%d", itemindex2); + CHAR_sendStatusString(toindex, category); + snprintf(category, sizeof(category), "W%d", itemindex2); + CHAR_sendStatusString(toindex, category); + } + return TRUE; +} +*/ +BOOL TRADE_HandleItem( int meindex, int showindex, char *message, char *outmess) +{ + char token[256]; + int item, itemindex; + int fd = getfdFromCharaIndex( meindex ); + + if( CONNECT_get_confirm( fd) == TRUE ) return FALSE; + + if( CHAR_getWorkInt( meindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_TRADING + || CHAR_getWorkInt( meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_LOCK ) + return FALSE; + + if( getStringFromIndexWithDelim( message, "|", 6, token, sizeof( token)) == FALSE) return FALSE; + item = atoi( token); + if( item < CHAR_STARTITEMARRAY || item > CHAR_MAXITEMHAVE ){ + return FALSE; + } + itemindex = CHAR_getItemIndex(meindex, item); + if( !ITEM_CHECKINDEX( itemindex)) return FALSE; + + { + char itemname[256], tmpbuf[256], tmpbuf1[256]; + int crushe; + +#ifdef _ITEM_PILEFORTRADE + int nums = 0; + if( TRADE_addSomeTradeList( meindex, item, &nums, TRADE_ITEM) == FALSE ){ + return FALSE; + } +#endif + strcpy( itemname, ITEM_getChar(itemindex, ITEM_SECRETNAME));//ITEM_NAME + crushe = ITEM_getItemDamageCrusheED( itemindex); + sprintf( token, ""); // + + if( crushe >= 0 ) snprintf( token, sizeof(token), "%d%%", crushe ); + char szTemp1[256]; + sprintf(szTemp1," "); +#ifdef _TRADE_ITEM_FIX + if(getTradeItemFix()==1 && ( ITEM_getInt(itemindex,ITEM_MERGEFLG)==TRUE || strstr(ITEM_getChar(itemindex,ITEM_NAME),"ϳ")!=NULL ) ){ + char attnum[16]; + sprintf(attnum,""); + if(ITEM_getInt(itemindex,ITEM_MODIFYATTACK)!=0){ + if(ITEM_getInt(itemindex,ITEM_ATTACKNUM_MAX)>1){ + if(ITEM_getInt(itemindex,ITEM_ATTACKNUM_MIN)==ITEM_getInt(itemindex,ITEM_ATTACKNUM_MAX)){ + sprintf(attnum," (x%d)",ITEM_getInt(itemindex,ITEM_ATTACKNUM_MAX)); + }else{ + sprintf(attnum," (%d-%d)",ITEM_getInt(itemindex,ITEM_ATTACKNUM_MIN),ITEM_getInt(itemindex,ITEM_ATTACKNUM_MAX)); + } + } + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d%s ",(ITEM_getInt(itemindex,ITEM_MODIFYATTACK)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYATTACK),attnum); + }else{ + sprintf(szTemp1,"%s%s%d%s ",szTemp1,(ITEM_getInt(itemindex,ITEM_MODIFYATTACK)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYATTACK),attnum); + } + } + if(ITEM_getInt(itemindex,ITEM_MODIFYDEFENCE)!=0){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d ",(ITEM_getInt(itemindex,ITEM_MODIFYDEFENCE)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYDEFENCE)); + }else{ + sprintf(szTemp1,"%s%s%d ",szTemp1,(ITEM_getInt(itemindex,ITEM_MODIFYDEFENCE)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYDEFENCE)); + } + } + if(ITEM_getInt(itemindex,ITEM_MODIFYQUICK)!=0){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s%d ",(ITEM_getInt(itemindex,ITEM_MODIFYQUICK)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYQUICK)); + }else{ + sprintf(szTemp1,"%s%s%d ",szTemp1,(ITEM_getInt(itemindex,ITEM_MODIFYQUICK)>=0)?"+":"",ITEM_getInt(itemindex,ITEM_MODIFYQUICK)); + } + } + if(ITEM_getInt(itemindex,ITEM_MAGICID)>0){ + int marray = MAGIC_getMagicArray( ITEM_getInt( itemindex, ITEM_MAGICID)); + if( marray != -1 ){ + if( MAGIC_getChar( marray, MAGIC_NAME) != NULL ){ + if(strcmp(szTemp1," ")==0){ + sprintf(szTemp1,"%s ",MAGIC_getChar( marray, MAGIC_NAME)); + }else{ + sprintf(szTemp1,"%s%s ",szTemp1,MAGIC_getChar( marray, MAGIC_NAME)); + } + } + } + } + } +#endif + if(strcmp(szTemp1," ")==0) + sprintf(szTemp1,"%s",ITEM_getChar(itemindex,ITEM_EFFECTSTRING)); + char newitemname[128]; + memset(newitemname,0,sizeof(newitemname)); + if(strstr(ITEM_getChar( itemindex, ITEM_NAME),"Ѽ")!=NULL) + strcpy(newitemname, ITEM_getChar( itemindex, ITEM_SECRETNAME)); + else + strcpy(newitemname , ITEM_getChar( itemindex, ITEM_NAME)); +#ifdef _ITEM_PILENUMS + sprintf( outmess, "%d|%s|%s|%s|%d|%s|%d", +#else + sprintf( outmess, "%d|%s|%s|%d|%s", +#endif + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + makeEscapeString( newitemname, tmpbuf1, sizeof(tmpbuf1)), + makeEscapeString( itemname, tmpbuf, sizeof(tmpbuf)), + szTemp1, item, token +#ifdef _ITEM_PILEFORTRADE + ,nums +#endif + ); + } + return TRUE; +} + +BOOL TRADE_HandleGold( int meindex, int showindex, char *message, char *outmess) +{ + int gold, tmpgold; + char token[256]; + int fd = getfdFromCharaIndex( meindex ); + if(CONNECT_get_confirm( fd)==TRUE)return FALSE; + if (CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_TRADING + || CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_LOCK) + return FALSE; + tmpgold = CHAR_getInt(meindex, CHAR_GOLD); + if (getStringFromIndexWithDelim(message, "|", 6, token, sizeof(token)) == FALSE) return FALSE; + if( (gold = atoi(token)) < 0 ) return FALSE; + if( gold > tmpgold )return FALSE; +#ifdef _ITEM_PILEFORTRADE + if( TRADE_addSomeTradeList( meindex, gold, NULL, TRADE_GOLD) == FALSE ) return FALSE; +#endif + sprintf( outmess, "%d", gold); + return TRUE; +} + +BOOL TRADE_HandlePet( int meindex, int showindex, char *message, char *outmess) +{ + int havepetindex, petindex; + char token[256], buf[256]; + int fd = getfdFromCharaIndex( meindex ); + if(CONNECT_get_confirm( fd)==TRUE)return FALSE; + if (CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) != CHAR_TRADE_TRADING + || CHAR_getWorkInt(meindex, CHAR_WORKTRADEMODE) == CHAR_TRADE_LOCK) + return FALSE; + if (getStringFromIndexWithDelim(message, "|", 6, token, sizeof(token)) == FALSE) return FALSE; + if( (havepetindex = atoi(token)) < 0 ) return FALSE; + petindex = CHAR_getCharPet(meindex, havepetindex); + if( !CHAR_CHECKINDEX(petindex)) return FALSE; + +#ifdef _ITEM_PILEFORTRADE + if( TRADE_addSomeTradeList( meindex, havepetindex, NULL, TRADE_PET) == FALSE ) return FALSE; +#endif + sprintf( token, "%d|%s|%d|%d|%d|%d|%d|%d", + CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER), + makeEscapeString( CHAR_getUseName(petindex), buf, sizeof(buf)), + CHAR_getInt( petindex, CHAR_LV), + CHAR_getWorkInt( petindex, CHAR_WORKATTACKPOWER), + CHAR_getWorkInt( petindex, CHAR_WORKDEFENCEPOWER), + CHAR_getWorkInt( petindex, CHAR_WORKQUICK), + havepetindex, + CHAR_getInt( petindex , CHAR_TRANSMIGRATION)); +#ifdef _TRADESYSTEM2 + { + int i; + char skillname[7][256]; + char buf1[256],buf2[256]; + for( i=0; i<7; i++){ + int skillarray, skillID; + memset( skillname[i], 0, sizeof(skillname[i])); + skillID = CHAR_getPetSkill( petindex, i); + skillarray = PETSKILL_getPetskillArray( skillID); + if( !PETSKILL_CHECKINDEX( skillarray)) continue; + sprintf( skillname[i], "%s", PETSKILL_getChar( skillarray, PETSKILL_NAME) ); + } +#ifdef _SHOW_FUSION + sprintf( outmess , "%s|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s|%s|%d|", +#else + sprintf( outmess , "%s|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s|%s", +#endif + token , CHAR_getWorkInt(petindex , CHAR_WORKMAXHP) , CHAR_getInt(petindex , CHAR_SLOT), + skillname[0] , skillname[1] , skillname[2] , skillname[3] , + skillname[4] , skillname[5] , skillname[6] , + makeEscapeString( CHAR_getChar( petindex, CHAR_NAME ), buf1, sizeof(buf1)), + makeEscapeString( CHAR_getUseName( petindex), buf2, sizeof(buf2)) +#ifdef _SHOW_FUSION + ,CHAR_getInt ( petindex, CHAR_FUSIONBEIT) ) ; +#else + ); +#endif +#ifdef _PET_ITEM + char token[512]=""; + int j; + for( j = 0 ; j < CHAR_MAXPETITEMHAVE ; j ++ ) + strcat(token,ITEM_petmakeItemStatusString(petindex, j)); + strcat(outmess,token); +#endif + } +#else + sprintf( outmess , "%s|%d", token , CHAR_getWorkInt(petindex , CHAR_WORKMAXHP) ); +#endif //_TRADESYSTEM2 + return TRUE; +} + +#ifdef _ITEM_PILEFORTRADE +BOOL TRADE_CheckTradeList( int meindex, STradeList *temp1, int toindex, STradeList *temp2) +{ + int i; + int MeSurplus=0, MeNeeds=0, MeMaxPile; + int ToSurplus=0, ToNeeds=0, ToMaxPile; + + + MeMaxPile = CHAR_getMyMaxPilenum( meindex);//ѵ + ToMaxPile = CHAR_getMyMaxPilenum( toindex); + + MeSurplus = CHAR_findSurplusItemBox( meindex); + ToSurplus = CHAR_findSurplusItemBox( toindex); + // + ToNeeds=0; MeNeeds=0; + for( i=0; i<15; i++ ){ + int pilenum, itemindex; + if( temp1->ItemTi[i] == -1 ) continue; + itemindex = CHAR_getItemIndex( meindex, temp1->ItemTi[i] ); + if( !ITEM_CHECKINDEX( itemindex)) return FALSE; + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + if( temp1->ItemNum[i] == pilenum ){ + MeSurplus++; + } + if( temp1->ItemNum[i] > ToMaxPile ){ + ToNeeds += (temp1->ItemNum[i]/ToMaxPile) + 1; + }else{ + ToNeeds++; + } + } + for( i=0; i<15; i++ ){ + int pilenum, itemindex; + if( temp2->ItemTi[i] == -1 ) continue; + itemindex = CHAR_getItemIndex( toindex, temp2->ItemTi[i] ); + if( !ITEM_CHECKINDEX( itemindex)) return FALSE; + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + if( temp2->ItemNum[i] == pilenum){ + ToSurplus++; + } + if( temp2->ItemNum[i] > MeMaxPile ){ + MeNeeds += (temp2->ItemNum[i]/MeMaxPile) + 1; + }else { + MeNeeds++; + } + } + if(CHAR_getInt(meindex,CHAR_FLOOR)==50000 && CHAR_getInt(toindex,CHAR_FLOOR)==50000 ) + { + if( MeSurplus < (MeNeeds+ToNeeds) ){ + CHAR_talkToCli( meindex, -1, "Ʒλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "ԷƷλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < (ToNeeds+MeNeeds) ){ + CHAR_talkToCli( toindex, -1, "Ʒλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( meindex, -1, "ԷƷλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + } + else + { + if( MeSurplus < MeNeeds ){ + CHAR_talkToCli( meindex, -1, "Ʒλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "ԷƷλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < ToNeeds ){ + CHAR_talkToCli( toindex, -1, "Ʒλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( meindex, -1, "ԷƷλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + } + + // + MeSurplus = CHAR_findSurplusPetBox( meindex); + ToSurplus = CHAR_findSurplusPetBox( toindex); + ToNeeds=0; MeNeeds=0; + for( i=0; i<5; i++ ){ + int petindex; + if( temp1->PetTi[i] == -1 ) continue; + petindex = CHAR_getCharPet( meindex, temp1->PetTi[i] ); + if( !CHAR_CHECKINDEX( petindex)) return FALSE; + MeSurplus++; + ToNeeds++; + } + for( i=0; i<5; i++ ){ + int petindex; + if( temp2->PetTi[i] == -1 ) continue; + petindex = CHAR_getCharPet( toindex, temp2->PetTi[i] ); + if( !CHAR_CHECKINDEX( petindex)) return FALSE; + ToSurplus++; + MeNeeds++; + } + if(CHAR_getInt(meindex,CHAR_FLOOR)==50000 && CHAR_getInt(toindex,CHAR_FLOOR)==50000 ) + { + if( MeSurplus < (MeNeeds+ToNeeds) ){ + CHAR_talkToCli( meindex, -1, "λ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "Էλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < (ToNeeds+MeNeeds) ){ + CHAR_talkToCli( meindex, -1, "Էλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "λ㡣", CHAR_COLORYELLOW); + return FALSE; + } + } + else + { + if( MeSurplus < MeNeeds ){ + CHAR_talkToCli( meindex, -1, "λ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "Էλ㡣", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < ToNeeds ){ + CHAR_talkToCli( meindex, -1, "Էλ㡣", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "λ㡣", CHAR_COLORYELLOW); + return FALSE; + } + } + + + //Ǯ + MeMaxPile = CHAR_getMaxHaveGold( meindex); + ToMaxPile = CHAR_getMaxHaveGold( toindex); + MeSurplus = MeMaxPile - CHAR_getInt( meindex, CHAR_GOLD); + ToSurplus = ToMaxPile - CHAR_getInt( toindex, CHAR_GOLD); + ToNeeds=0; MeNeeds=0; + MeSurplus += temp1->Golds; + ToSurplus += temp2->Golds; + ToNeeds = temp1->Golds; + MeNeeds = temp2->Golds; + if(CHAR_getInt(meindex,CHAR_FLOOR)==50000 && CHAR_getInt(toindex,CHAR_FLOOR)==50000 ) + { + if( MeSurplus < (MeNeeds+ToNeeds) ){ + CHAR_talkToCli( meindex, -1, "ʯҳޡ", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "Էʯҳޡ", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < (ToNeeds+MeNeeds) ){ + CHAR_talkToCli( meindex, -1, "Էʯҳޡ", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "ʯҳޡ", CHAR_COLORYELLOW); + return FALSE; + } + } + else + { + if( MeSurplus < MeNeeds ){ + CHAR_talkToCli( meindex, -1, "ʯҳޡ", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "Էʯҳޡ", CHAR_COLORYELLOW); + return FALSE; + } + if( ToSurplus < ToNeeds ){ + CHAR_talkToCli( meindex, -1, "Էʯҳޡ", CHAR_COLORYELLOW); + CHAR_talkToCli( toindex, -1, "ʯҳޡ", CHAR_COLORYELLOW); + return FALSE; + } + } + return TRUE; +} +#endif diff --git a/configfile.c b/configfile.c new file mode 100644 index 0000000..89d6b9f --- /dev/null +++ b/configfile.c @@ -0,0 +1,5011 @@ +#define __CONFIGFILE_C__ +#include "version.h" +#include +#include +#include +#include + +#include "util.h" +//#include "configfile.h" +//ttom +#include "lssproto_util.h" +#include "configfile.h" +#include "net.h" +//ttom end +#include "npcutil.h" +// Arminius 7.12 login announce +#include "char.h" +#include "char_data.h" +// CoolFish: add +#include "lssproto_serv.h" + +#ifdef _ANGEL_SUMMON +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; +#endif +#ifdef _UNTEXT_TALK +int textcnt=0; +char untext[100][64]; +#endif + +/* ɬë հ */ +typedef struct tagConfig +{ + /*ة ( ƻ */ + char progname[8]; + char configfilename[32]; /* config̻ */ + unsigned int debuglevel; /* ì */ + unsigned int usememoryunit; /*ƹ */ + unsigned int usememoryunitnum; /*ƹ */ + char asname[32]; /*ʧӡP */ + unsigned short acservport; /*ʧӡP̡ */ + char acpasswd[32]; /*ʧӡ߼ɵ*/ + char gsnamefromas[32]; /* + * ʧӡᆴέ + * ءةӡƻ + */ + + // Arminius 7.24 manor pk + char gsid[32]; // game server chinese id + unsigned short allowmanorpk; // is this server allow manor pk + unsigned short port; /* ӡPа̡ */ + int servernumber; /* ءةӡP į */ + int reuseaddr; /* Address already used... ئݼ׻ */ + int do_nodelay; /* TCP_NODELAY ¾ */ + int log_write_time; /* ̤ķë¾ */ + int log_io_time; /* I/O ޷¾ */ + int log_game_time; /* ءة ë */ + int log_netloop_faster; /* netloop_faster */ + int saacwritenum; /* ʧӡ߼ write¾ */ + int saacreadnum; /* ʧӡᆴռdispatch ëϼ¾ */ + unsigned short fdnum; /*ľë ¾ */ + unsigned int playercharnum; + unsigned int othercharnum; /* ְƽҷ¼ */ + unsigned int objnum; /* Ƥ */ + unsigned int petcharnum; /* ʸ */ + unsigned int itemnum; /* ʧ ة */ + unsigned int battlenum; /* P */ + unsigned int battleexp; /* P */ + char topdir[32]; /* ū */ + char mapdir[32]; /* Ѩū */ + char maptilefile[32]; /* Ѩɬð̻ */ + char battlemapfile[32]; /* Ѩɬð̻ */ + char itemfile[32]; /* ʧ ةɬð̻ */ + char invfile[32]; /* ɬð̻ */ + char appearfile[32]; /* ɬð̻ */ + char titlenamefile[32]; /* į̻ */ + char titleconfigfile[32]; /* įɬð̻ */ + char encountfile[32]; /* ޼ɬð̻ */ + char enemybasefile[32]; /* ɬð̻ */ + char enemyfile[32]; /* ɬð̻ */ + char groupfile[32]; /* ɬð̻ */ + char magicfile[32]; /* ɬð̻ */ +#ifdef _ATTACK_MAGIC + char attmagicfile[32]; // +#endif + + char petskillfile[32]; /* ʸ ɬð̻ */ + char itematomfile[32]; /* ʧ ة ̻ */ + char effectfile[32]; /* ɬð̻ */ + char quizfile[32]; /* ɬð̻ */ + char lsgenlog[32]; /*ӡPlsgen ʧ̻ */ + char storedir[128]; /*ʧū */ + char npcdir[32]; /*NPCɬð̻ë ʷū */ + char logdir[32]; /* + * 뷸ū + */ + char logconfname[32]; /* + * ɬð̻ + */ + char chatmagicpasswd[32]; /* ܷɵ */ +#ifdef _STORECHAR + char storechar[32]; +#endif + unsigned int chatmagiccdkeycheck; /* ܷƥCDKEYë¾ */ + unsigned int filesearchnum; /*̻ëƥ°̻P*/ + unsigned int npctemplatenum; /*NPC ̻P*/ + unsigned int npccreatenum; /*NPCϷDz̻P*/ + unsigned int walksendinterval; /* ʼë˪ */ + unsigned int CAsendinterval_ms; /* CAë˪ (ms)*/ + unsigned int CDsendinterval_ms; /* CDë˪ (ms)*/ + unsigned int Onelooptime_ms; /* 1微 */ + unsigned int Petdeletetime; /* ʸ */ + unsigned int Itemdeletetime; /* ʧ ة */ + /* ̼ ƽҷ¼Ƥë */ + unsigned int CharSavesendinterval; + unsigned int addressbookoffmsgnum; /* + * ʧƤͱ׷̼ + * ë + * ϶¾ + */ + unsigned int protocolreadfrequency; /* + * ë + * 꾮 + */ + unsigned int allowerrornum; /* + * ޷¡ëƥʾ + */ + unsigned int fengerrornum; + unsigned int loghour; /* + * ëݶ + */ + unsigned int battledebugmsg; /* + * 붪ëʾۨئئ + */ + //ttom add this because the second had this + unsigned int encodekey; + unsigned int acwbsize; + unsigned int acwritesize; + unsigned int ErrUserDownFlg; + //ttom end +#ifdef _GMRELOAD + char gmsetfile[32]; /* GMʺšȨ趨 */ +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + char profession[32]; +#endif +#ifdef _ITEM_QUITPARTY + char itemquitparty[32]; +#endif + +#ifdef _DEL_DROP_GOLD + unsigned int Golddeletetime; +#endif +#ifdef _NEW_PLAYER_CF + int newplayertrans; + int newplayerlv; + int newplayergivepet[5]; + int newplayergiveitem[15]; + int newplayerpetlv; + int newplayergivegold; + int ridepetlevel; +#ifdef _VIP_SERVER + int newplayerpetvip; +#endif +#endif +#ifdef _USER_EXP_CF + char expfile[64]; +#endif +#ifdef _UNLAW_WARP_FLOOR + int unlawwarpfloor[10]; +#endif +#ifdef _WATCH_FLOOR + int watchfloor[6]; +#endif +#ifdef _BATTLE_FLOOR + int battlefloor[6]; +#endif +#ifdef _UNREG_NEMA + char unregname[9][16]; +#endif +#ifdef _TRANS_LEVEL_CF + int chartrans; + int pettrans; + int yblevel; + int maxlevel; +#endif +#ifdef _POINT +int point; + int transpoint[10]; +#endif +#ifdef _VIP_SERVER + int vippoint; + int safemode; +#endif +#ifdef _PET_UP + int petup; +#endif +#ifdef _LOOP_ANNOUNCE + char loopannouncepath[32]; + int loopannouncetime; + char loopannounce[10][1024]; + int loopannouncemax; +#endif +#ifdef _SKILLUPPOINT_CF + int skup; +#endif +#ifdef _RIDELEVEL + int ridelevel; +#endif +#ifdef _REVLEVEL + int revlevel; +#endif +#ifdef _NEW_PLAYER_RIDE + int npride; +#endif +#ifdef _FIX_CHARLOOPS + int charloops; +#endif +#ifdef _PLAYER_ANNOUNCE + int pannounce; +#endif +#ifdef _PLAYER_MOVE + int pmove; +#endif + int recvbuffer; + int sendbuffer; + int recvlowatbuffer; + int runlevel; +#ifdef _SHOW_VIP_CF + int showvip; +#endif + int BattlePoint[4]; +#ifdef _ALL_TALK + int TheWorldTrans; + int TheWorldFame; + int TheWorldTime; + int TheWorldCnt; +#endif +#ifdef _NOWEN_EV + int NowEvent[10]; + int EndEvent[10]; +#endif +#ifdef _PLAYER_NUM + int playernum; + char playerbase[10]; +#endif +#ifdef _BATTLE_GOLD + int battlegold; +#endif +#ifdef _ANGEL_TIME + int angelplayertime; + int angelplayermun; +#endif +#ifdef _RIDEMODE_20 + int ridemode; +#endif +#ifdef _FM_POINT_PK + int fmpointpk; +#endif +#ifdef _ENEMY_ACTION + int enemyact; +#endif +#ifdef _FUSIONBEIT_TRANS + char fusionbeittrans; +#endif +#ifdef _CHECK_PEPEAT + int CheckRepeat; +#endif + int cpuuse; +#ifdef _FM_JOINLIMIT + int joinfamilytime; +#endif +#ifdef _JK_CF_DELPETITEM //ɾCFָƷͳ + char DelPet[256]; + char DelItem[256]; +#endif +#ifdef _MAP_HEAL + int MapHeal[10]; +#endif +#ifdef _DIY_INSLAY + int InslayNum; +#endif + int TradeTax; +#ifdef _VIP_RIDE + int VipMsgType; +#endif +#ifdef _VIP_BATTLE_EXP + int VipBattleExp; +#endif + int ItemPoolBug; + int SameIpLogin; + int PetRideTrans; +#ifdef _LUCK_MAN + int lucktime; + char luckitem[256]; +#endif +#ifdef _QUESTION_ONLINE + int questiontime; + char questionitem[50]; +#endif +#ifdef _NO_STREET_MAP + char nostreetmap[50]; +#endif +#ifdef _STREET_FAX + char streetfax[64]; +#endif + char fmwartime[10]; +#ifdef _JZ_NEWSCRIPT_LUA + char luafile[256]; +#endif +#ifdef _TRANS7_POINT + int trans7point; +#endif +#ifdef _NOJOB_PK + int nojobpkmap; +#endif +#ifdef _NO_ATTACK + int atttime; + int attsafetime; + int attcnt; + int latetime; + int attdmetime; + int attdmecnt; +#endif + char noattip[5][18]; +#ifdef _NO_TRANS_ANGLE + int trans6angle; +#endif +#ifdef _PET_BUG + int petpoint[4]; +#endif +#ifdef _VIGOR_SYS + int vigortime[8]; + int vigormax; +#endif +#ifdef _AUTO_PK + int autopktime; + int autopkminnum; + int autopkbattletime; + int autopkminlv; + int autopkvigorpknum; + int autopkvigorpkcnt; +#endif +#ifdef _BATTLEMAP_CTRL + char BattleTime[10][20]; +#endif +#ifdef _FM_SERVERNO_SYS + int fmserverno; + char fmservermsg[256]; +#endif +#ifdef _ZHIPIAO_SYSTEM + int zhipiao; + int piaotime; +#endif +#ifdef _FMWAR_MSG + char fmwarmsg[256]; +#endif +#ifdef _FM_WELFARE + char fmwelfare[10][20]; +#endif +#ifdef _FMZUZHANG_MSG + char fmzuzhang[256]; +#endif +#ifdef _PETMAIL_LV + int petmaillv; + int petmailcf; +#endif +#ifdef _FMWAR_PLAYERNUM + int fmwarplayernum; +#endif +#ifdef _WAN_FIX + int vsflg; +#endif +#ifdef _WARNPC_CTRL + char partymap[128]; + char mapsameip[32]; +#endif +#ifdef _NO_DAOLUAN + int streettrn; + int talktrn; + int talklv; + char talkmsg[128]; + char talkname[128]; +#endif +#ifdef _NO_FULLPLAYER_ATT + int nofullplayer; + int nofull2player; + int nocdkeyplayer; + int nocdkeymode; + int nocdkeytype; + int nofulltime; + int fengtype; + int nofullendplayer; + int nofullendtime; + int manrennum; + int bigbao; + int bigbao2; +#endif +#ifdef _ATTREVERSE_FIX + int attreverse; +#endif +#ifdef _NEWFM_GOLD + int newfmgold; +#endif +#ifdef _MERGE_TIME + int mergetime; +#endif +#ifdef _PETUP_GET_EXP + int petupgetexp; +#endif +#ifdef _MM_NO_JIAOBEN + int nommjiaoben; + int editbasetime; +#endif +#ifdef _DP_140_160_MODE + int newdpmode; +#endif +#ifdef _LOOK_STREET_TIME + int lookstreettime; +#endif +#ifdef _BATTLE_EQUIT_OTHER + int battleequitother; +#endif +#ifdef _PK_LUCK_MAN + char pkluckfloor[256]; + char pkluckmapname[10][32]; + char pklucktime[10]; + char pklucknum[10]; + char pkluckbuf[512]; + int pklucklevel; + int pkluckbattleturn; +#endif +#ifdef _NO_DAOLUAN + char talkfloor[512]; +#endif +#ifdef _SUPERMAN_FIX + int supermanpoint; +#endif +#ifdef _PICKUP_ITEM_OTHER + int pickupitem; + char pickitemid[512]; +#endif +#ifdef _FM_LIAOLI + int fmliaolitype; +#endif +#ifdef _TRADE_ITEM_FIX + int tradeitemfix; +#endif +#ifdef _PETMAIL_TIME + int petmailtime; +#endif + int randmin; + int randmax; +#ifdef _GJS_TYPE + int gjstype; +#endif + int ticketcf; + char ticketmsg[256]; + int satype; +#ifdef _BATTLEEND_FIX + int battleendmode; +#endif +#ifdef _BIG_POOL_TYPE + int petpooltype; + int itempooltype; +#endif + int nostaybattle; + int rightnum; + int rightmode; + int errormode; +#ifdef _FLOOR_PARTY_CTRL + char partyfloor[128]; +#endif + int battletimeout; + int reloadnpctime; + int reloadnpctype; + int offlinebattletime; + int offlinecf; + int offlinemaxnum; + int offlinejqmmaxnum; + int kongtype; + int jifenbaitan; + char streetitemunname[2048]; + int nopkmap; + int fmbufftrans; + char nompmagic[1024]; + + int loginjqmtype; + char fmmagicmprate[2][10]; + int sameipnum; + int samejqmnum; + int samejqmallnum; + + int mmtype; + char mmmsg[1024]; + + int locktype; + int alltalkpoint; +#ifdef _NO_RIDE_ID + char norideid[1024]; +#endif + + int logintype; + + + +#ifdef _PETTRANS_RANGE + int pettransrangex; + int pettransrangey; + int pettransrangez; +#endif + +#ifdef _ITEM_LUA +char itemluafile[256]; +#endif +#ifdef _SAME_IP_ONLINE_NUM + int sameiponlinenum; +#endif +#ifdef _CHECK_SEVER_IP + char serverip[256]; +#endif +#ifdef _CAX_ESC_REPORT + int reportitem[5]; /*ÿǩͶ*/ + int vipreportitem[5]; /*ÿǩԱͶ*/ + int reportlv;//ǩȼ + int reportta;//ǩת +#endif +#ifdef _PETSKILL_SHOP_LUA + char freepetskillshoppath[256]; +#endif +#ifdef _CAX_FAMEBUTTON + int famebutton; +#endif +#ifdef _PET_TRANS_ABILITY + int pettransability; + int pettransability1; + int pettransability2; + int pettransability3; +#endif +#ifdef _PET_3TRANS + int MMPETID1; + int MMPETID2; +#endif +#ifdef _NO_MAGIC + char nomagicmap[128]; +#endif +#ifdef _illegalpetskill_CF + int IllegalPetskill[10]; +#endif +#ifdef _CAX_PET_EVOLUTION + char petevotyb; + int petevotyb1; +#endif +#ifdef _TRANS_7_COLOR +// int TranColor; + char ping; + char petsummon; +#endif +#ifdef _CAX_PET_ITEMRIDE + char petitemride; +#endif +#ifdef _DAMMAGE_CALC + int dammagecalc; +#endif +#ifdef _CAX_LNS_NLSUOXU + int mapstart; +#endif +#ifdef _CAX_FAME_KOUFEI + int famekoufei; +#endif +#ifdef _CAX_ITEM_ADDEXP + int exptime; +#endif +#ifdef _SHARE_EXP + int expshare; +#endif +#ifdef _TEAM_ADDEXP + int teamaddexp; +#endif +#ifdef _NO_STW_ENEMY + int nostwenemy; + int nostwenemypoint; +#endif +#ifdef _DEX_FIX //ϵ +int dexfixper; +#endif +#ifdef _FM_EXP_ADD + unsigned int fmaddexp; +#endif + +}Config; + +Config config; + +#ifdef _USER_EXP_CF +int NeedLevelUpTbls[200]; +#endif + +/* + * ū̻ë ݱհ + * xxxx=yyyy ئë + */ + +typedef struct tagReadConf +{ + char name[32]; /*xxxxؤ°*/ + + /*ݼ2NULLë ľ ئ*/ + char *charvalue; /*yyyyëҽ ݼҽ */ + size_t charsize; /*charvalue*/ + + /* + * ƻ= "ON" intvalue 巴1ëҽ + * ľ½ atoi + */ + void* value; /*yyyyë ҽ ݼҽ */ + CTYPE valuetype; +}ReadConf; + +ReadConf readconf[]= +{ + { "debuglevel" , NULL ,0 , (void*)&config.debuglevel ,CHAR}, + + { "usememoryunit" , NULL ,0 , (void*)&config.usememoryunit ,INT}, + { "usememoryunitnum", NULL ,0 , (void*)&config.usememoryunitnum,INT}, + + { "acserv", config.asname,sizeof(config.asname) ,NULL , 0}, + { "acservport", NULL ,0 , (void*)&config.acservport ,SHORT}, + { "acpasswd", config.acpasswd,sizeof( config.acpasswd),NULL,0}, + { "gameservname", config.gsnamefromas,sizeof(config.gsnamefromas), NULL,0}, + + // Arminius 7.24 manor pk + { "gameservid", config.gsid, sizeof(config.gsid), NULL, 0}, + { "allowmanorpk", NULL, 0, (void*)&config.allowmanorpk, SHORT}, + + { "port", NULL ,0 , (void*)&config.port ,SHORT}, + { "servernumber", NULL ,0 , (void*)&config.servernumber ,INT}, + + { "reuseaddr", NULL ,0 , (void*)&config.reuseaddr , INT}, + { "nodelay", NULL , 0 , (void*)&config.do_nodelay , INT}, + { "log_write_time", NULL, 0 , (void*)&config.log_write_time, INT}, + { "log_io_time", NULL, 0 , (void*)&config.log_io_time, INT}, + { "log_game_time", NULL, 0 , (void*)&config.log_game_time, INT}, + { "log_netloop_faster", NULL,0,(void*)&config.log_netloop_faster, INT}, + { "saacwritenum", NULL,0,(void*)&config.saacwritenum, INT}, + { "saacreadnum", NULL,0,(void*)&config.saacreadnum, INT}, + { "fdnum", NULL ,0 , (void*)&config.fdnum, SHORT}, + { "playernum", NULL ,0 , (void*)&config.playercharnum, INT}, + { "petnum", NULL ,0 , (void*)&config.petcharnum, INT}, + { "othercharnum", NULL ,0 , (void*)&config.othercharnum, INT}, + + { "objnum", NULL ,0 , (void*)&config.objnum, INT}, + { "itemnum", NULL ,0 , (void*)&config.itemnum, INT}, + { "battlenum", NULL ,0 , (void*)&config.battlenum, INT}, + { "battleexp", NULL ,0 , (void*)&config.battleexp, INT}, + { "topdir" , config.topdir,sizeof(config.topdir),NULL,0}, + { "mapdir" , config.mapdir,sizeof(config.mapdir),NULL,0}, + { "maptilefile" , config.maptilefile,sizeof(config.maptilefile),NULL,0}, + { "battlemapfile" , config.battlemapfile,sizeof(config.battlemapfile),NULL,0}, + +#ifdef _ITEMSET6_TXT + { "itemset6file", config.itemfile, sizeof(config.invfile), NULL, 0}, +#else +#ifdef _ITEMSET5_TXT + { "itemset5file", config.itemfile, sizeof(config.invfile), NULL, 0}, +#else +#ifdef _ITEMSET4_TXT + { "itemset4file" , config.itemfile,sizeof(config.invfile),NULL,0}, +#else +#ifdef _ITEMSET3_ITEM + { "itemset3file" , config.itemfile,sizeof(config.invfile),NULL,0}, +#endif +#endif +#endif +#endif + { "invinciblefile" , config.invfile,sizeof(config.invfile),NULL,0}, + { "appearpositionfile" , config.appearfile,sizeof(config.appearfile),NULL,0}, + { "titlenamefile", config.titlenamefile, sizeof( config.titlenamefile),NULL,0}, + { "titleconfigfile", config.titleconfigfile, sizeof( config.titleconfigfile),NULL,0}, + { "encountfile", config.encountfile, sizeof( config.encountfile),NULL,0}, + { "enemyfile", config.enemyfile, sizeof( config.enemyfile),NULL,0}, + { "enemybasefile", config.enemybasefile, sizeof( config.enemybasefile),NULL,0}, + { "groupfile", config.groupfile, sizeof( config.groupfile),NULL,0}, + { "magicfile", config.magicfile, sizeof( config.magicfile),NULL,0}, +#ifdef _ATTACK_MAGIC + { "attmagicfile" , config.attmagicfile , sizeof( config.attmagicfile ) , NULL , 0 }, +#endif + +#ifdef _PETSKILL2_TXT + { "petskillfile2", config.petskillfile, sizeof( config.petskillfile),NULL,0}, +#else + { "petskillfile1", config.petskillfile, sizeof( config.petskillfile),NULL,0}, +#endif + + { "itematomfile" , config.itematomfile, sizeof( config.itematomfile),NULL,0}, + { "effectfile" , config.effectfile,sizeof(config.effectfile),NULL,0}, + { "quizfile" , config.quizfile,sizeof(config.quizfile),NULL,0}, + + { "lsgenlogfilename", config.lsgenlog,sizeof(config.lsgenlog),NULL,0}, +#ifdef _GMRELOAD + { "gmsetfile", config.gmsetfile, sizeof( config.gmsetfile),NULL,0}, +#endif + + { "storedir" ,config.storedir,sizeof(config.storedir),NULL,0}, + { "npcdir" ,config.npcdir,sizeof(config.npcdir),NULL,0}, + { "logdir" ,config.logdir,sizeof(config.logdir),NULL,0}, + { "logconfname" ,config.logconfname,sizeof(config.logconfname),NULL,0}, + { "chatmagicpasswd", config.chatmagicpasswd, sizeof( config.chatmagicpasswd),NULL,0}, +#ifdef _STORECHAR + { "storechar", config.storechar, sizeof( config.storechar),NULL,0}, +#endif + { "chatmagiccdkeycheck", NULL,0, &config.chatmagiccdkeycheck,INT}, + { "filesearchnum", NULL,0, &config.filesearchnum,INT}, + { "npctemplatenum", NULL,0, &config.npctemplatenum,INT}, + { "npccreatenum", NULL,0, &config.npccreatenum,INT}, + { "walkinterval" ,NULL,0,(void*)&config.walksendinterval,INT}, + { "CAinterval" ,NULL,0,(void*)&config.CAsendinterval_ms,INT}, + { "CDinterval" ,NULL,0,(void*)&config.CDsendinterval_ms,INT}, + { "CharSaveinterval" ,NULL,0,(void*)&config.CharSavesendinterval,INT}, + { "Onelooptime" ,NULL,0,(void*)&config.Onelooptime_ms,INT}, + { "Petdeletetime" ,NULL,0,(void*)&config.Petdeletetime,INT}, + { "Itemdeletetime" ,NULL,0,(void*)&config.Itemdeletetime,INT}, + { "addressbookoffmesgnum" ,NULL,0, + (void*)&config.addressbookoffmsgnum,INT}, + + { "protocolreadfrequency" ,NULL,0, + (void*)&config.protocolreadfrequency,INT}, + + { "allowerrornum" ,NULL,0,(void*)&config.allowerrornum,INT}, + { "fengerrornum" ,NULL,0,(void*)&config.fengerrornum,INT}, + { "loghour" ,NULL,0,(void*)&config.loghour,INT}, + { "battledebugmsg" ,NULL,0,(void*)&config.battledebugmsg,INT}, + //ttom add because the second had + { "encodekey" ,NULL,0,(void*)&config.encodekey,INT}, + { "acwritesize" ,NULL,0,(void*)&config.acwritesize,INT}, + { "acwbsize" ,NULL,0,(void*)&config.acwbsize,INT}, + { "erruser_down" ,NULL,0,(void*)&config.ErrUserDownFlg,INT}, + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + { "profession", config.profession, sizeof(config.profession) ,NULL , 0}, +#endif + +#ifdef _ITEM_QUITPARTY + { "itemquitparty", config.itemquitparty, sizeof(config.itemquitparty) ,NULL , 0}, +#endif + +#ifdef _DEL_DROP_GOLD + { "Golddeletetime" ,NULL,0,(void*)&config.Golddeletetime, INT}, +#endif + +#ifdef _MAP_HEAL + { "MAPHEAL1" ,NULL,0,(void*)&config.MapHeal[0], INT}, + { "MAPHEAL2" ,NULL,0,(void*)&config.MapHeal[1], INT}, + { "MAPHEAL3" ,NULL,0,(void*)&config.MapHeal[2], INT}, + { "MAPHEAL4" ,NULL,0,(void*)&config.MapHeal[3], INT}, + { "MAPHEAL5" ,NULL,0,(void*)&config.MapHeal[4], INT}, + { "MAPHEAL6" ,NULL,0,(void*)&config.MapHeal[5], INT}, + { "MAPHEAL7" ,NULL,0,(void*)&config.MapHeal[6], INT}, + { "MAPHEAL8" ,NULL,0,(void*)&config.MapHeal[7], INT}, + { "MAPHEAL9" ,NULL,0,(void*)&config.MapHeal[8], INT}, + { "MAPHEAL10" ,NULL,0,(void*)&config.MapHeal[9], INT}, +#endif + +#ifdef _NEW_PLAYER_CF + { "TRANS" ,NULL,0,(void*)&config.newplayertrans, INT}, + { "LV" ,NULL,0,(void*)&config.newplayerlv, INT}, + { "PET1" ,NULL,0,(void*)&config.newplayergivepet[1], INT}, + { "PET2" ,NULL,0,(void*)&config.newplayergivepet[2], INT}, + { "PET3" ,NULL,0,(void*)&config.newplayergivepet[3], INT}, + { "PET4" ,NULL,0,(void*)&config.newplayergivepet[4], INT}, + { "ITEM1" ,NULL,0,(void*)&config.newplayergiveitem[0], INT}, + { "ITEM2" ,NULL,0,(void*)&config.newplayergiveitem[1], INT}, + { "ITEM3" ,NULL,0,(void*)&config.newplayergiveitem[2], INT}, + { "ITEM4" ,NULL,0,(void*)&config.newplayergiveitem[3], INT}, + { "ITEM5" ,NULL,0,(void*)&config.newplayergiveitem[4], INT}, + { "ITEM6" ,NULL,0,(void*)&config.newplayergiveitem[5], INT}, + { "ITEM7" ,NULL,0,(void*)&config.newplayergiveitem[6], INT}, + { "ITEM8" ,NULL,0,(void*)&config.newplayergiveitem[7], INT}, + { "ITEM9" ,NULL,0,(void*)&config.newplayergiveitem[8], INT}, + { "ITEM10" ,NULL,0,(void*)&config.newplayergiveitem[9], INT}, + { "ITEM11" ,NULL,0,(void*)&config.newplayergiveitem[10], INT}, + { "ITEM12" ,NULL,0,(void*)&config.newplayergiveitem[11], INT}, + { "ITEM13" ,NULL,0,(void*)&config.newplayergiveitem[12], INT}, + { "ITEM14" ,NULL,0,(void*)&config.newplayergiveitem[13], INT}, + { "ITEM15" ,NULL,0,(void*)&config.newplayergiveitem[14], INT}, + { "PETLV" ,NULL,0,(void*)&config.newplayerpetlv, INT}, + { "GOLD" ,NULL,0,(void*)&config.newplayergivegold, INT}, + { "RIDEPETLEVEL" ,NULL,0,(void*)&config.ridepetlevel, INT}, +#ifdef _VIP_SERVER + { "GIVEVIPPOINT" ,NULL,0,(void*)&config.newplayerpetvip, INT}, + { "SAFEMODE" ,NULL,0,(void*)&config.safemode, INT}, +#endif +#endif + +#ifdef _USER_EXP_CF + { "USEREXP", config.expfile, sizeof( config.expfile),NULL,0}, +#endif + +#ifdef _UNLAW_WARP_FLOOR + { "FLOOR1" ,NULL,0,(void*)&config.unlawwarpfloor[0], INT}, + { "FLOOR2" ,NULL,0,(void*)&config.unlawwarpfloor[1], INT}, + { "FLOOR3" ,NULL,0,(void*)&config.unlawwarpfloor[2], INT}, + { "FLOOR4" ,NULL,0,(void*)&config.unlawwarpfloor[3], INT}, + { "FLOOR5" ,NULL,0,(void*)&config.unlawwarpfloor[4], INT}, + { "FLOOR6" ,NULL,0,(void*)&config.unlawwarpfloor[5], INT}, + { "FLOOR7" ,NULL,0,(void*)&config.unlawwarpfloor[6], INT}, + { "FLOOR8" ,NULL,0,(void*)&config.unlawwarpfloor[7], INT}, + { "FLOOR9" ,NULL,0,(void*)&config.unlawwarpfloor[8], INT}, + { "FLOOR10" ,NULL,0,(void*)&config.unlawwarpfloor[9], INT}, +#endif + +#ifdef _WATCH_FLOOR + { "WATCHFLOOR" ,NULL,0,(void*)&config.watchfloor[0], INT}, + { "WATCHFLOOR1" ,NULL,0,(void*)&config.watchfloor[1], INT}, + { "WATCHFLOOR2" ,NULL,0,(void*)&config.watchfloor[2], INT}, + { "WATCHFLOOR3" ,NULL,0,(void*)&config.watchfloor[3], INT}, + { "WATCHFLOOR4" ,NULL,0,(void*)&config.watchfloor[4], INT}, + { "WATCHFLOOR5" ,NULL,0,(void*)&config.watchfloor[5], INT}, +#endif + +#ifdef _BATTLE_FLOOR + { "BATTLEFLOOR" ,NULL,0,(void*)&config.battlefloor[0], INT}, + { "BATTLEFLOOR1" ,NULL,0,(void*)&config.battlefloor[1], INT}, + { "BATTLEFLOOR2" ,NULL,0,(void*)&config.battlefloor[2], INT}, + { "BATTLEFLOOR3" ,NULL,0,(void*)&config.battlefloor[3], INT}, + { "BATTLEFLOOR4" ,NULL,0,(void*)&config.battlefloor[4], INT}, + { "BATTLEFLOOR5" ,NULL,0,(void*)&config.battlefloor[5], INT}, +#endif +#ifdef _JK_CF_DELPETITEM //ɾCFָƷͳ + { "DELPET", config.DelPet, sizeof( config.DelPet),NULL,0}, + { "DELITEM", config.DelItem, sizeof( config.DelItem),NULL,0}, +#endif +#ifdef _UNREG_NEMA + { "NAME1" ,config.unregname[0], sizeof( config.unregname[0]),NULL,0}, + { "NAME2" ,config.unregname[1], sizeof( config.unregname[1]),NULL,0}, + { "NAME3" ,config.unregname[2], sizeof( config.unregname[2]),NULL,0}, + { "NAME4" ,config.unregname[3], sizeof( config.unregname[3]),NULL,0}, + { "NAME5" ,config.unregname[4], sizeof( config.unregname[4]),NULL,0}, + { "NAME6" ,config.unregname[5], sizeof( config.unregname[5]),NULL,0}, + { "NAME7" ,config.unregname[6], sizeof( config.unregname[6]),NULL,0}, + { "NAME8" ,config.unregname[7], sizeof( config.unregname[7]),NULL,0}, + { "NAME9" ,config.unregname[8], sizeof( config.unregname[8]),NULL,0}, +#endif +#ifdef _TRANS_LEVEL_CF + { "CHARTRANS" ,NULL,0,(void*)&config.chartrans, INT}, + { "PETTRANS" ,NULL,0,(void*)&config.pettrans, INT}, + { "LEVEL" ,NULL,0,(void*)&config.yblevel, INT}, + { "MAXLEVEL" ,NULL,0,(void*)&config.maxlevel, INT}, +#endif +#ifdef _POINT + { "POINT" ,NULL,0,(void*)&config.point, INT}, + { "TRANS0" ,NULL,0,(void*)&config.transpoint[0], INT}, + { "TRANS1" ,NULL,0,(void*)&config.transpoint[1], INT}, + { "TRANS2" ,NULL,0,(void*)&config.transpoint[2], INT}, + { "TRANS3" ,NULL,0,(void*)&config.transpoint[3], INT}, + { "TRANS4" ,NULL,0,(void*)&config.transpoint[4], INT}, + { "TRANS5" ,NULL,0,(void*)&config.transpoint[5], INT}, + { "TRANS6" ,NULL,0,(void*)&config.transpoint[6], INT}, + { "TRANS7" ,NULL,0,(void*)&config.transpoint[7], INT}, + { "TRANS8" ,NULL,0,(void*)&config.transpoint[8], INT}, + { "TRANS9" ,NULL,0,(void*)&config.transpoint[9], INT}, +#endif + +#ifdef _NOWEN_EV + { "endevent01" , NULL ,0 , (void*)&config.EndEvent[0] ,INT}, + { "endevent02" , NULL ,0 , (void*)&config.EndEvent[1] ,INT}, + { "endevent03" , NULL ,0 , (void*)&config.EndEvent[2] ,INT}, + { "endevent04" , NULL ,0 , (void*)&config.EndEvent[3] ,INT}, + { "endevent05" , NULL ,0 , (void*)&config.EndEvent[4] ,INT}, + { "endevent06" , NULL ,0 , (void*)&config.EndEvent[5] ,INT}, + { "endevent07" , NULL ,0 , (void*)&config.EndEvent[6] ,INT}, + { "endevent08" , NULL ,0 , (void*)&config.EndEvent[7] ,INT}, + { "endevent09" , NULL ,0 , (void*)&config.EndEvent[8] ,INT}, + { "endevent10" , NULL ,0 , (void*)&config.EndEvent[9] ,INT}, + { "nowevent01" , NULL ,0 , (void*)&config.NowEvent[0] ,INT}, + { "nowevent02" , NULL ,0 , (void*)&config.NowEvent[1] ,INT}, + { "nowevent03" , NULL ,0 , (void*)&config.NowEvent[2] ,INT}, + { "nowevent04" , NULL ,0 , (void*)&config.NowEvent[3] ,INT}, + { "nowevent05" , NULL ,0 , (void*)&config.NowEvent[4] ,INT}, + { "nowevent06" , NULL ,0 , (void*)&config.NowEvent[5] ,INT}, + { "nowevent07" , NULL ,0 , (void*)&config.NowEvent[6] ,INT}, + { "nowevent08" , NULL ,0 , (void*)&config.NowEvent[7] ,INT}, + { "nowevent09" , NULL ,0 , (void*)&config.NowEvent[8] ,INT}, + { "nowevent10" , NULL ,0 , (void*)&config.NowEvent[9] ,INT}, +#endif + { "battlepoint1" , NULL ,0 , (void*)&config.BattlePoint[0] ,INT}, + { "battlepoint2" , NULL ,0 , (void*)&config.BattlePoint[1] ,INT}, + { "battlepoint3" , NULL ,0 , (void*)&config.BattlePoint[2] ,INT}, + { "battlepoint4" , NULL ,0 , (void*)&config.BattlePoint[3] ,INT}, +#ifdef _ALL_TALK + { "THEWORLDTRANS" , NULL ,0 , (void*)&config.TheWorldTrans ,INT}, + { "THEWORLDFAME" , NULL ,0 , (void*)&config.TheWorldFame ,INT}, + { "THEWORLDTIME" , NULL ,0 , (void*)&config.TheWorldTime ,INT}, + { "THEWORLDCNT" , NULL ,0 , (void*)&config.TheWorldCnt ,INT}, +#endif +#ifdef _DIY_INSLAY + { "InslayNum" , NULL ,0 , (void*)&config.InslayNum ,INT}, +#endif + { "TradeTax" , NULL ,0 , (void*)&config.TradeTax ,INT}, + { "VipMsgType" , NULL ,0 , (void*)&config.VipMsgType ,INT}, +#ifdef _VIP_BATTLE_EXP + { "VipBattleExp" , NULL ,0 , (void*)&config.VipBattleExp ,INT}, +#endif + { "ItemPoolBug" , NULL ,0 , (void*)&config.ItemPoolBug ,INT}, +#ifdef _PET_UP + { "PETUP" ,NULL,0,(void*)&config.petup, INT}, +#endif +#ifdef _LOOP_ANNOUNCE + { "ANNOUNCEPATH" ,config.loopannouncepath, sizeof( config.loopannouncepath),NULL,0}, + { "ANNOUNCETIME" ,NULL,0,(void*)&config.loopannouncetime, INT}, +#endif +#ifdef _SKILLUPPOINT_CF + { "SKILLUPPOINT" ,NULL,0,(void*)&config.skup, INT}, +#endif +#ifdef _RIDELEVEL + { "RIDELEVEL" ,NULL,0,(void*)&config.ridelevel, INT}, +#endif + { "PETRIDETRANS" ,NULL,0,(void*)&config.PetRideTrans, INT}, +#ifdef _REVLEVEL + { "REVLEVEL" ,NULL,0,(void*)&config.revlevel, INT}, +#endif +#ifdef _NEW_PLAYER_RIDE + { "NPRIDE" ,NULL,0,(void*)&config.npride, INT}, +#endif +#ifdef _FIX_CHARLOOPS + { "CHARLOOPS" ,NULL,0,(void*)&config.charloops, INT}, +#endif +#ifdef _PLAYER_ANNOUNCE + { "PANNOUNCE" ,NULL,0,(void*)&config.pannounce, INT}, +#endif +#ifdef _PLAYER_MOVE + { "PMOVE" ,NULL,0,(void*)&config.pmove, INT}, +#endif + + { "recvbuffer" ,NULL,0,(void*)&config.recvbuffer, INT}, + { "sendbuffer" ,NULL,0,(void*)&config.sendbuffer, INT}, + { "recvlowatbuffer" ,NULL,0,(void*)&config.recvlowatbuffer, INT}, + { "runlevel" ,NULL,0,(void*)&config.runlevel, INT}, + +#ifdef _SHOW_VIP_CF + { "SHOWVIP" ,NULL,0,(void*)&config.showvip, INT}, +#endif + +#ifdef _PLAYER_NUM + { "PLAYERNUM" ,NULL,0,(void*)&config.playernum, INT}, + { "PLAYERBASE" , config.playerbase,sizeof(config.playerbase),NULL,0}, +#endif + +#ifdef _BATTLE_GOLD + { "BATTLEGOLD" ,NULL,0,(void*)&config.battlegold, INT}, +#endif +#ifdef _ANGEL_TIME + { "ANGELPLAYERTIME" ,NULL,0,(void*)&config.angelplayertime, INT}, + { "ANGELPLAYERMUN" ,NULL,0,(void*)&config.angelplayermun, INT}, +#endif +#ifdef _RIDEMODE_20 + { "RIDEMODE" ,NULL,0,(void*)&config.ridemode, INT}, +#endif +#ifdef _FM_POINT_PK + { "FMPOINTPK" ,NULL,0,(void*)&config.fmpointpk, INT}, +#endif +#ifdef _ENEMY_ACTION + { "ENEMYACTION" ,NULL,0,(void*)&config.enemyact, INT}, +#endif +#ifdef _FUSIONBEIT_TRANS + { "FUSIONBEIT" ,NULL,0,(void*)&config.fusionbeittrans, INT}, +#endif +#ifdef _CHECK_PEPEAT + { "CHECKPEPEAT" ,NULL,0,(void*)&config.CheckRepeat, INT}, +#endif + { "CPUUSE" ,NULL,0,(void*)&config.cpuuse, INT}, +#ifdef _FM_JOINLIMIT + { "JOINFAMILYTIME" ,NULL,0,(void*)&config.joinfamilytime, INT}, +#endif + { "SAMEIPLOGIN" ,NULL,0,(void*)&config.SameIpLogin, INT}, +#ifdef _LUCK_MAN + { "LUCKTIME" ,NULL,0,(void*)&config.lucktime, INT}, + { "LUCKITEM" , config.luckitem,sizeof(config.luckitem),NULL,0}, +#endif +#ifdef _QUESTION_ONLINE + { "QUESTIONTIME" ,NULL,0,(void*)&config.questiontime, INT}, + { "QUESTIONITEM" , config.questionitem,sizeof(config.questionitem),NULL,0}, +#endif +#ifdef _NO_STREET_MAP + { "NOSTREETMAP" , config.nostreetmap,sizeof(config.nostreetmap),NULL,0}, +#endif +#ifdef _STREET_FAX + { "STREETFAX" ,config.streetfax,sizeof(config.streetfax),NULL,0}, +#endif + { "FMWARTIME" , config.fmwartime,sizeof(config.fmwartime),NULL,0}, +#ifdef _JZ_NEWSCRIPT_LUA + { "LUAFILE" , config.luafile,sizeof(config.luafile),NULL,0}, +#endif +#ifdef _TRANS7_POINT + { "TRANS7POINT" ,NULL,0,(void*)&config.trans7point, INT}, +#endif +#ifdef _NOJOB_PK + { "NOJOBPKMAP" ,NULL,0,(void*)&config.nojobpkmap, INT}, +#endif +#ifdef _NO_ATTACK + { "ATTTIME" ,NULL,0,(void*)&config.atttime, INT}, + { "ATTSAFETIME" ,NULL,0,(void*)&config.attsafetime, INT}, + { "ATTCNT" ,NULL,0,(void*)&config.attcnt, INT}, + { "LATETIME" ,NULL,0,(void*)&config.latetime, INT}, + { "ATTDMETIME" ,NULL,0,(void*)&config.attdmetime, INT}, + { "ATTDMECNT" ,NULL,0,(void*)&config.attdmecnt, INT}, +#endif + { "NOATTIP1" ,config.noattip[0], sizeof( config.noattip[0]),NULL,0}, + { "NOATTIP2" ,config.noattip[1], sizeof( config.noattip[1]),NULL,0}, + { "NOATTIP3" ,config.noattip[2], sizeof( config.noattip[2]),NULL,0}, + { "NOATTIP4" ,config.noattip[3], sizeof( config.noattip[3]),NULL,0}, + { "NOATTIP5" ,config.noattip[4], sizeof( config.noattip[4]),NULL,0}, +#ifdef _NO_TRANS_ANGLE + { "TRANS6ANGLE" ,NULL,0,(void*)&config.trans6angle, INT}, +#endif +#ifdef _PET_BUG + { "PETVITAL" ,NULL,0,(void*)&config.petpoint[0], INT}, + { "PETSTR" ,NULL,0,(void*)&config.petpoint[1], INT}, + { "PETTOUGH" ,NULL,0,(void*)&config.petpoint[2], INT}, + { "PETDEX" ,NULL,0,(void*)&config.petpoint[3], INT}, +#endif +#ifdef _VIGOR_SYS + { "VIGORTR0TIME" ,NULL,0,(void*)&config.vigortime[0], INT}, + { "VIGORTR1TIME" ,NULL,0,(void*)&config.vigortime[1], INT}, + { "VIGORTR2TIME" ,NULL,0,(void*)&config.vigortime[2], INT}, + { "VIGORTR3TIME" ,NULL,0,(void*)&config.vigortime[3], INT}, + { "VIGORTR4TIME" ,NULL,0,(void*)&config.vigortime[4], INT}, + { "VIGORTR5TIME" ,NULL,0,(void*)&config.vigortime[5], INT}, + { "VIGORTR6TIME" ,NULL,0,(void*)&config.vigortime[6], INT}, + { "VIGORTR7TIME" ,NULL,0,(void*)&config.vigortime[7], INT}, + { "VIGORMAX" ,NULL,0,(void*)&config.vigormax, INT}, +#endif +#ifdef _AUTO_PK + { "AUTOPKTIME" ,NULL,0,(void*)&config.autopktime, INT}, + { "AUTOPKMINNUM" ,NULL,0,(void*)&config.autopkminnum, INT}, + { "AUTOPKBATTLETIME" ,NULL,0,(void*)&config.autopkbattletime, INT}, + { "AUTOPKMINLV" ,NULL,0,(void*)&config.autopkminlv, INT}, + { "AUTOPKVIGORPKNUM" ,NULL,0,(void*)&config.autopkvigorpknum, INT}, + { "AUTOPKVIGORPKCNT" ,NULL,0,(void*)&config.autopkvigorpkcnt, INT}, +#endif +#ifdef _BATTLEMAP_CTRL + { "BATTLETIME0" ,config.BattleTime[0], sizeof( config.BattleTime[0]),NULL,0}, + { "BATTLETIME1" ,config.BattleTime[1], sizeof( config.BattleTime[1]),NULL,0}, + { "BATTLETIME2" ,config.BattleTime[2], sizeof( config.BattleTime[2]),NULL,0}, + { "BATTLETIME3" ,config.BattleTime[3], sizeof( config.BattleTime[3]),NULL,0}, + { "BATTLETIME4" ,config.BattleTime[4], sizeof( config.BattleTime[4]),NULL,0}, + { "BATTLETIME5" ,config.BattleTime[5], sizeof( config.BattleTime[5]),NULL,0}, + { "BATTLETIME6" ,config.BattleTime[6], sizeof( config.BattleTime[6]),NULL,0}, + { "BATTLETIME7" ,config.BattleTime[7], sizeof( config.BattleTime[7]),NULL,0}, + { "BATTLETIME8" ,config.BattleTime[8], sizeof( config.BattleTime[8]),NULL,0}, + { "BATTLETIME9" ,config.BattleTime[9], sizeof( config.BattleTime[9]),NULL,0}, +#endif +#ifdef _FM_SERVERNO_SYS + { "FMSERVERNO" ,NULL,0,(void*)&config.fmserverno, INT}, + { "FMSERVERMSG" , config.fmservermsg,sizeof(config.fmservermsg),NULL,0}, +#endif +#ifdef _ZHIPIAO_SYSTEM + { "ZHIPIAO" ,NULL,0,(void*)&config.zhipiao, INT}, + { "PIAOTIME" ,NULL,0,(void*)&config.piaotime, INT}, +#endif +#ifdef _FMWAR_MSG + { "FMWARMSG" , config.fmwarmsg,sizeof(config.fmwarmsg),NULL,0}, +#endif +#ifdef _FM_WELFARE + { "FMWELFARE0" ,config.fmwelfare[0], sizeof( config.fmwelfare[0]),NULL,0}, + { "FMWELFARE1" ,config.fmwelfare[1], sizeof( config.fmwelfare[1]),NULL,0}, + { "FMWELFARE2" ,config.fmwelfare[2], sizeof( config.fmwelfare[2]),NULL,0}, + { "FMWELFARE3" ,config.fmwelfare[3], sizeof( config.fmwelfare[3]),NULL,0}, + { "FMWELFARE4" ,config.fmwelfare[4], sizeof( config.fmwelfare[4]),NULL,0}, + { "FMWELFARE5" ,config.fmwelfare[5], sizeof( config.fmwelfare[5]),NULL,0}, + { "FMWELFARE6" ,config.fmwelfare[6], sizeof( config.fmwelfare[6]),NULL,0}, + { "FMWELFARE7" ,config.fmwelfare[7], sizeof( config.fmwelfare[7]),NULL,0}, + { "FMWELFARE8" ,config.fmwelfare[8], sizeof( config.fmwelfare[8]),NULL,0}, + { "FMWELFARE9" ,config.fmwelfare[9], sizeof( config.fmwelfare[9]),NULL,0}, +#endif +#ifdef _FMZUZHANG_MSG + { "FMZUZHANG" ,config.fmzuzhang, sizeof( config.fmzuzhang),NULL,0}, +#endif +#ifdef _PETMAIL_LV + { "PETMAILLV" ,NULL,0,(void*)&config.petmaillv, INT}, + { "PETMAILCF" ,NULL,0,(void*)&config.petmailcf, INT}, +#endif +#ifdef _FMWAR_PLAYERNUM + { "FMWARPLAYERNUM" ,NULL,0,(void*)&config.fmwarplayernum, INT}, +#endif +#ifdef _WAN_FIX + { "VSFLG" ,NULL,0,(void*)&config.vsflg, INT}, +#endif +#ifdef _WARNPC_CTRL + { "PARTYMAP" ,config.partymap, sizeof( config.partymap),NULL,0}, + { "MAPSAMEIP" ,config.mapsameip, sizeof( config.mapsameip),NULL,0}, +#endif +#ifdef _NO_DAOLUAN + { "STREETTRN" ,NULL,0,(void*)&config.streettrn, INT}, + { "TALKTRN" ,NULL,0,(void*)&config.talktrn, INT}, + { "TALKLV" ,NULL,0,(void*)&config.talklv, INT}, + { "TALKMSG" ,config.talkmsg, sizeof( config.talkmsg),NULL,0}, + { "TALKNAME" ,config.talkname, sizeof( config.talkname),NULL,0}, +#endif +#ifdef _NO_FULLPLAYER_ATT + { "NOFULLPLAYER" ,NULL,0,(void*)&config.nofullplayer, INT}, + { "NOFULL2PLAYER" ,NULL,0,(void*)&config.nofull2player, INT}, + { "NOCDKEYPLAYER" ,NULL,0,(void*)&config.nocdkeyplayer, INT}, + { "NOCDKEYMODE" ,NULL,0,(void*)&config.nocdkeymode, INT}, + { "NOCDKEYTYPE" ,NULL,0,(void*)&config.nocdkeytype, INT}, + { "NOFULLTIME" ,NULL,0,(void*)&config.nofulltime, INT}, + { "FENGTYPE" ,NULL,0,(void*)&config.fengtype, INT}, + { "NOFULLENDPLAYER" ,NULL,0,(void*)&config.nofullendplayer, INT}, + { "NOFULLENDTIME" ,NULL,0,(void*)&config.nofullendtime, INT}, + { "MANRENNUM" ,NULL,0,(void*)&config.manrennum, INT}, + { "BIGBAO" ,NULL,0,(void*)&config.bigbao, INT}, + { "BIGBAO2" ,NULL,0,(void*)&config.bigbao2, INT}, + +#endif +#ifdef _ATTREVERSE_FIX + { "ATTREVERSE" ,NULL,0,(void*)&config.attreverse, INT}, +#endif +#ifdef _NEWFM_GOLD + { "NEWFMGOLD" ,NULL,0,(void*)&config.newfmgold, INT}, +#endif +#ifdef _MERGE_TIME + { "MERGETIME" ,NULL,0,(void*)&config.mergetime, INT}, +#endif +#ifdef _PETUP_GET_EXP + { "PETUPGETEXP" ,NULL,0,(void*)&config.petupgetexp, INT}, +#endif +#ifdef _MM_NO_JIAOBEN + { "NOMMJIAOBEN" ,NULL,0,(void*)&config.nommjiaoben, INT}, + { "EDITBASETIME" ,NULL,0,(void*)&config.editbasetime, INT}, +#endif +#ifdef _DP_140_160_MODE + { "NEWDPMODE" ,NULL,0,(void*)&config.newdpmode, INT}, +#endif +#ifdef _LOOK_STREET_TIME + { "LOOKSTREETTIME" ,NULL,0,(void*)&config.lookstreettime, INT}, +#endif +#ifdef _BATTLE_EQUIT_OTHER + { "BATTLEEQUITOTHER" ,NULL,0,(void*)&config.battleequitother, INT}, +#endif +#ifdef _PK_LUCK_MAN + { "PKLUCKFLOOR" ,config.pkluckfloor, sizeof( config.pkluckfloor),NULL,0}, + { "PKLUCKMAPNAME0" ,config.pkluckmapname[0], sizeof( config.pkluckmapname[0]),NULL,0}, + { "PKLUCKMAPNAME1" ,config.pkluckmapname[1], sizeof( config.pkluckmapname[1]),NULL,0}, + { "PKLUCKMAPNAME2" ,config.pkluckmapname[2], sizeof( config.pkluckmapname[2]),NULL,0}, + { "PKLUCKMAPNAME3" ,config.pkluckmapname[3], sizeof( config.pkluckmapname[3]),NULL,0}, + { "PKLUCKMAPNAME4" ,config.pkluckmapname[4], sizeof( config.pkluckmapname[4]),NULL,0}, + { "PKLUCKMAPNAME5" ,config.pkluckmapname[5], sizeof( config.pkluckmapname[5]),NULL,0}, + { "PKLUCKMAPNAME6" ,config.pkluckmapname[6], sizeof( config.pkluckmapname[6]),NULL,0}, + { "PKLUCKMAPNAME7" ,config.pkluckmapname[7], sizeof( config.pkluckmapname[7]),NULL,0}, + { "PKLUCKMAPNAME8" ,config.pkluckmapname[8], sizeof( config.pkluckmapname[8]),NULL,0}, + { "PKLUCKMAPNAME9" ,config.pkluckmapname[9], sizeof( config.pkluckmapname[9]),NULL,0}, + { "PKLUCKTIME" ,config.pklucktime, sizeof( config.pklucktime),NULL,0}, + { "PKLUCKNUM" ,config.pklucknum, sizeof( config.pklucknum),NULL,0}, + { "PKLUCKBUF" ,config.pkluckbuf, sizeof( config.pkluckbuf),NULL,0}, + { "PKLUCKLEVEL" ,NULL,0,(void*)&config.pklucklevel, INT}, + { "PKLUCKBATTLETURN" ,NULL,0,(void*)&config.pkluckbattleturn, INT}, +#endif +#ifdef _NO_DAOLUAN + { "TALKFLOOR" ,config.talkfloor, sizeof( config.talkfloor),NULL,0}, +#endif +#ifdef _SUPERMAN_FIX + { "SUPERMANPOINT" ,NULL,0,(void*)&config.supermanpoint, INT}, +#endif +#ifdef _PICKUP_ITEM_OTHER + { "PICKUPITEM" ,NULL,0,(void*)&config.pickupitem, INT}, + { "PICKITEMID" ,config.pickitemid, sizeof( config.pickitemid),NULL,0}, +#endif +#ifdef _FM_LIAOLI + { "FMLIAOLITYPE" ,NULL,0,(void*)&config.fmliaolitype, INT}, +#endif +#ifdef _TRADE_ITEM_FIX + { "TRADEITEMFIX" ,NULL,0,(void*)&config.tradeitemfix, INT}, +#endif +#ifdef _PETMAIL_TIME + { "PETMAILTIME" ,NULL,0,(void*)&config.petmailtime, INT}, +#endif + { "RANDMIN" ,NULL,0,(void*)&config.randmin, INT}, + { "RANDMAX" ,NULL,0,(void*)&config.randmax, INT}, +#ifdef _GJS_TYPE + { "GJSTYPE" ,NULL,0,(void*)&config.gjstype, INT}, +#endif + { "TICKETCF" ,NULL,0,(void*)&config.ticketcf, INT}, + { "TICKETMSG" ,config.ticketmsg, sizeof( config.ticketmsg),NULL,0}, + + { "SATYPE" ,NULL,0,(void*)&config.satype, INT}, +#ifdef _BATTLEEND_FIX + { "BATTLEENDMODE" ,NULL,0,(void*)&config.battleendmode, INT}, +#endif +#ifdef _BIG_POOL_TYPE + { "PETPOOLTYPE" ,NULL,0,(void*)&config.petpooltype, INT}, + { "ITEMPOOLTYPE" ,NULL,0,(void*)&config.itempooltype, INT}, + + { "NOSTAYBATTLE" ,NULL,0,(void*)&config.nostaybattle, INT}, + { "RIGHTNUM" ,NULL,0,(void*)&config.rightnum, INT}, + { "RIGHTMODE" ,NULL,0,(void*)&config.rightmode, INT}, + { "ERRORMODE" ,NULL,0,(void*)&config.errormode, INT}, +#endif +#ifdef _FLOOR_PARTY_CTRL + { "PARTYFLOOR" ,config.partyfloor, sizeof( config.partyfloor),NULL,0}, +#endif + { "BATTLETIMEOUT" ,NULL,0,(void*)&config.battletimeout, INT}, + { "RELOADNPCTIME" ,NULL,0,(void*)&config.reloadnpctime, INT}, + { "RELOADNPCTYPE" ,NULL,0,(void*)&config.reloadnpctype, INT}, + { "OFFLINEBATTLETIME" ,NULL,0,(void*)&config.offlinebattletime, INT}, + { "OFFLINECF" ,NULL,0,(void*)&config.offlinecf, INT}, + { "OFFLINEMAXNUM" ,NULL,0,(void*)&config.offlinemaxnum, INT}, + { "OFFLINEJQMMAXNUM" ,NULL,0,(void*)&config.offlinejqmmaxnum, INT}, + { "KONGTYPE" ,NULL,0,(void*)&config.kongtype, INT}, + { "JIFENBAITAN" ,NULL,0,(void*)&config.jifenbaitan, INT}, + { "STREETITEMUNNAME" ,config.streetitemunname, sizeof( config.streetitemunname),NULL,0}, + { "NOPKMAP" ,NULL,0,(void*)&config.nopkmap, INT}, + { "FMBUFFTRANS" ,NULL,0,(void*)&config.fmbufftrans, INT}, + { "NOMPMAGIC" ,config.nompmagic, sizeof( config.nompmagic),NULL,0}, + { "LOGINJQMTYPE" ,NULL,0,(void*)&config.loginjqmtype, INT}, + { "FMMAGICMPRATE1" ,config.fmmagicmprate[0], sizeof( config.fmmagicmprate[0]),NULL,0}, + { "FMMAGICMPRATE2" ,config.fmmagicmprate[1], sizeof( config.fmmagicmprate[1]),NULL,0}, + { "SAMEIPNUM" ,NULL,0,(void*)&config.sameipnum, INT}, + { "SAMEJQMNUM" ,NULL,0,(void*)&config.samejqmnum, INT}, + { "SAMEJQMALLNUM" ,NULL,0,(void*)&config.samejqmallnum, INT}, + + { "MMTYPE" ,NULL,0,(void*)&config.mmtype, INT}, + { "MMMSG" ,config.mmmsg, sizeof( config.mmmsg),NULL,0}, + + { "LOCKTYPE" ,NULL,0,(void*)&config.locktype, INT}, + { "ALLTALKPOINT" ,NULL,0,(void*)&config.alltalkpoint, INT}, +#ifdef _NO_RIDE_ID + { "NORIDEID" ,config.norideid, sizeof( config.norideid),NULL,0}, +#endif + { "LOGINTYPE" ,NULL,0,(void*)&config.logintype, INT}, + +#ifdef _PETTRANS_RANGE + { "PETTRANSRANGE_X" ,NULL,0,(void*)&config.pettransrangex, INT}, + { "PETTRANSRANGE_Y" ,NULL,0,(void*)&config.pettransrangey, INT}, + { "PETTRANSRANGE_Z" ,NULL,0,(void*)&config.pettransrangez, INT}, +#endif +#ifdef _ITEM_LUA + { "ITEMLUAFILE" , config.itemluafile,sizeof(config.itemluafile),NULL,0}, +#endif +#ifdef _SAME_IP_ONLINE_NUM + { "sameiponlinenum" ,NULL,0,(void*)&config.sameiponlinenum, INT}, +#endif +#ifdef _CHECK_SEVER_IP + { "serverip" ,config.serverip, sizeof( config.serverip),NULL,0}, +#endif +#ifdef _CAX_ESC_REPORT + { "REPORTITEM1", NULL, 0,(void*) &config.reportitem[0], INT }, + { "REPORTITEM2", NULL, 0,(void*) &config.reportitem[1], INT }, + { "REPORTITEM3", NULL, 0,(void*) &config.reportitem[2], INT }, + { "REPORTITEM4", NULL, 0,(void*) &config.reportitem[3], INT }, + { "REPORTITEM5", NULL, 0,(void*) &config.reportitem[4], INT }, + { "VIPREPORTITEM1", NULL, 0,(void*) &config.vipreportitem[0], INT }, + { "VIPREPORTITEM2", NULL, 0,(void*) &config.vipreportitem[1], INT }, + { "VIPREPORTITEM3", NULL, 0,(void*) &config.vipreportitem[2], INT }, + { "VIPREPORTITEM4", NULL, 0,(void*) &config.vipreportitem[3], INT }, + { "VIPREPORTITEM5", NULL, 0,(void*) &config.vipreportitem[4], INT }, + { "reportlv", NULL, 0,(void*) &config.reportlv, INT }, + { "reportta", NULL, 0,(void*) &config.reportta, INT }, +#endif +#ifdef _PETSKILL_SHOP_LUA + { "PETSKILLSHOPPATH" ,config.freepetskillshoppath, sizeof( config.freepetskillshoppath),NULL,0}, +#endif +#ifdef _CAX_FAMEBUTTON + { "famebutton" ,NULL,0,(void*)&config.famebutton, INT}, +#endif +#ifdef _PET_TRANS_ABILITY + { "PETTRANSABILITY" ,NULL,0,(void*)&config.pettransability, INT}, + { "PETTRANSABILITY1" ,NULL,0,(void*)&config.pettransability1, INT}, + { "PETTRANSABILITY2" ,NULL,0,(void*)&config.pettransability2, INT}, + { "PETTRANSABILITY3" ,NULL,0,(void*)&config.pettransability3, INT}, +#endif +#ifdef _PET_3TRANS + { "MMPETID1" ,NULL,0,(void*)&config.MMPETID1,INT}, + { "MMPETID2" ,NULL,0,(void*)&config.MMPETID2,INT}, +#endif +#ifdef _NO_MAGIC + { "NOMAGICMAP" ,config.nomagicmap, sizeof( config.nomagicmap),NULL,0}, +#endif +#ifdef _illegalpetskill_CF + { "IllegalPetskill1" ,NULL,0,(void*)&config.IllegalPetskill[0], INT}, + { "IllegalPetskill2" ,NULL,0,(void*)&config.IllegalPetskill[1], INT}, + { "IllegalPetskill3" ,NULL,0,(void*)&config.IllegalPetskill[2], INT}, + { "IllegalPetskill4" ,NULL,0,(void*)&config.IllegalPetskill[3], INT}, + { "IllegalPetskill5" ,NULL,0,(void*)&config.IllegalPetskill[4], INT}, + { "IllegalPetskill6" ,NULL,0,(void*)&config.IllegalPetskill[5], INT}, + { "IllegalPetskill7" ,NULL,0,(void*)&config.IllegalPetskill[6], INT}, + { "IllegalPetskill8" ,NULL,0,(void*)&config.IllegalPetskill[7], INT}, + { "IllegalPetskill9" ,NULL,0,(void*)&config.IllegalPetskill[8], INT}, + { "IllegalPetskill10" ,NULL,0,(void*)&config.IllegalPetskill[9], INT}, +#endif +#ifdef _CAX_PET_EVOLUTION + { "petevotyb" , NULL ,0 , (void*)&config.petevotyb ,CHAR}, + { "petevotyb1" , NULL ,0 , (void*)&config.petevotyb1 ,INT}, +#endif +#ifdef _TRANS_7_COLOR +// { "tranclolr_7" , NULL ,0 , (void*)&config.TranColor ,INT}, + { "ping" , NULL ,0 , (void*)&config.ping ,CHAR}, + { "petsummon" , NULL ,0 , (void*)&config.petsummon ,CHAR}, +#endif +#ifdef _CAX_PET_ITEMRIDE + { "petitemride" , NULL ,0 , (void*)&config.petitemride ,CHAR}, +#endif +#ifdef _DAMMAGE_CALC + { "dammagecalc" ,NULL,0,(void*)&config.dammagecalc, INT}, +#endif +#ifdef _CAX_FAME_KOUFEI + { "FAMEKOUFEI" ,NULL,0,(void*)&config.famekoufei, INT}, +#endif +#ifdef _CAX_ITEM_ADDEXP + { "EXPTIME" ,NULL,0,(void*)&config.exptime, INT}, +#endif +#ifdef _SHARE_EXP + { "EXPSHARE" , NULL ,0 , (void*)&config.expshare ,INT}, +#endif +#ifdef _TEAM_ADDEXP + { "TEAMADDEXP" , NULL ,0 , (void*)&config.teamaddexp ,INT}, +#endif +#ifdef _NO_STW_ENEMY + { "NOSTWENEMY" ,NULL,0,(void*)&config.nostwenemy, INT}, + { "NOSTWENEMYGOLD" ,NULL,0,(void*)&config.nostwenemypoint, INT}, +#endif +#ifdef _DEX_FIX + { "DEXFIXPER" ,NULL,0,(void*)&config.dexfixper, INT}, +#endif +#ifdef _FM_EXP_ADD + { "FMADDEXP", NULL ,0 , (void*)&config.fmaddexp, INT}, +#endif +}; + +// Arminius 7.12 login announce +char announcetext[8192]; +void AnnounceToPlayer(int charaindex) +{ + char *ptr,*qtr; + + ptr=announcetext; + while ((qtr=strstr(ptr,"\n"))!=NULL) { + qtr[0]='\0'; +// printf("ptr=%s\n",ptr); + CHAR_talkToCli(charaindex, -1, ptr, CHAR_COLORYELLOW); + qtr[0]='\n'; + ptr=qtr+1; + } + CHAR_talkToCli(charaindex, -1, ptr, CHAR_COLORYELLOW); + +} + +// Robin 0720 +void AnnounceToPlayerWN(int fd) +{ + char buf[8192]; + char token[8192]; + int charaindex = CONNECT_getCharaindex( fd ); + long lastleavetime = CHAR_getInt( charaindex , CHAR_LASTLEAVETIME); + struct tm *p; + p=localtime(&lastleavetime); + + sprintf( token , "һʱ %d%d%d %d:%d:%d\n%s",p->tm_year + 1900, + p->tm_mon + 1, + p->tm_mday, + p->tm_hour, + p->tm_min, + p->tm_sec, + announcetext); + lssproto_WN_send( fd , WINDOW_MESSAGETYPE_LOGINMESSAGE, + WINDOW_BUTTONTYPE_OK, + -1,-1, + makeEscapeString( token, buf, sizeof(buf))); +} + + +void LoadAnnounce(void) +{ + FILE *f; + + memset(announcetext, 0, sizeof(announcetext)); + if ((f=fopen("./announce.txt","r"))!=NULL) { + fread(announcetext, sizeof(announcetext), 1, f); + announcetext[sizeof(announcetext)-1]='\0'; + fclose(f); + } +} +#ifdef _PET_TALKPRO +PTALK pettalktext[PETTALK_MAXID]; + +void LoadPetTalk(void) +{ + FILE *fp; + char fn[256]; + char line[ 4096]; + char talkmem[4096]; + int maxid=0; + char buf1[256], buf2[256], buf3[256]; + int talkNO=-1, mark=-1, i; + int len = sizeof( talkmem); + + memset(talkmem, 0, sizeof(talkmem)); + sprintf(fn, "%s/pettalk/pettalk.menu", getNpcdir()); + + for( i=0;i= PETTALK_MAXID ) + break; + } + print("ID=%d...", maxid); + { + int haveid=0; + for( i=0;i= 0 ) { + haveid++; + } + } + print("=%d", haveid); + } + +} + +#else +char pettalktext[4096]; +void LoadPetTalk(void) +{ + FILE *fp; + char fn[256]; + char line[ 4096]; + int len = sizeof( pettalktext); + + memset(pettalktext, 0, sizeof(pettalktext)); + sprintf(fn, "%s/pettalk/pettalk.mem", getNpcdir()); + + fp = fopen( fn, "r"); + if( fp != NULL ) { + print("\n\n ȡ pettalk.mem"); + while( fgets( line, sizeof( line), fp)) { + if( strlen( pettalktext) != 0 ) { + if( pettalktext[strlen( pettalktext) -1] != '|' ) { + strcatsafe( pettalktext, len, "|"); + } + } + chompex( line); + strcatsafe( pettalktext,len, line); + } + fclose( fp); + print("\n %s", pettalktext); + }else { + print("\n ҵ pettalk.mem"); + } +} +#endif + +#ifdef _GAMBLE_BANK +GAMBLEBANK_ITEMS GB_ITEMS[GAMBLEBANK_ITEMSMAX]; + +void Load_GambleBankItems( void) +{ + + FILE *fp; + char filename[256]; + char buf1[256]; + char name[128]; + int num,ID,type; + int i=0; + sprintf(filename, "./data/gambleitems.txt" ); + print("\nضIJƷļ %s ...", filename); + fp = fopen( filename, "r"); + if( fp != NULL ) { + while( fgets( buf1, sizeof( buf1), fp) != NULL ) { + if( strstr( buf1, "#") != 0 ) continue; + sscanf( buf1,"%s %d %d %d", name, &ID, &num , &type); + strcpy( GB_ITEMS[i].name, name); + GB_ITEMS[i].Gnum = num; + GB_ITEMS[i].ItemId = ID; + GB_ITEMS[i].type = type; + i++; + } + print("ID: %d ", i); + fclose( fp); + }else { + print(" Ҳļ %s", filename); + } + +} +#endif + + +#ifdef _CFREE_petskill +PETSKILL_CODES Code_skill[PETSKILL_CODE]; +void Load_PetSkillCodes( void) +{ + FILE *fp; + char filename[256]; + char buf1[256]; + char name[128]; + char type[256]; + int num,ID; + int i=0; + sprintf(filename, "./data/skillcode.txt" ); + print("\nس\ܱļ:%s...", filename); + fp = fopen( filename, "r"); + if( fp != NULL ) { + while( fgets( buf1, sizeof( buf1), fp) != NULL ) { + sscanf( buf1,"%s %d %d %s", name, &num, &ID, type); + strcpy( Code_skill[i].name, name); + Code_skill[i].TempNo = num; + Code_skill[i].PetId = ID; + strcpy( Code_skill[i].Code, type); + //print("\n %s|%d|%d|%s|", Code_skill[i].name, Code_skill[i].TempNo, + // Code_skill[i].PetId, Code_skill[i].Code); + i++; + if( i >= PETSKILL_CODE ) break; + } + fclose( fp); + }else { + print("򲻵ļ %s", filename); + } + print("\n"); +} +#endif + +#ifdef _GMRELOAD +BOOL LoadGMSet( char* filename ) +{ + FILE* fp; + int i = 0, gm_num = 0; + fp = fopen(filename, "r"); + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + for (i = 0; i < GMMAXNUM; i++) + { + strcpy(gminfo[i].cdkey, ""); + gminfo[i].level = 0; + } + while(1){ + char line[64], cdkey[64], level[64]; + if (fgets(line, sizeof(line), fp) == NULL) break; + chop(line); + //change ʹgmset.txtע******* + if( line[0] == '#' ) + continue; + for( i=0; i GMMAXNUM) break; + easyGetTokenFromString(line, 1, cdkey, sizeof(cdkey)); + if (strcmp(cdkey, "") == 0) break; + strncpy(gminfo[gm_num].cdkey, cdkey, sizeof(gminfo[gm_num].cdkey)); + easyGetTokenFromString(line, 2, level, sizeof(level)); + if (strcmp(level, "") == 0) break; + gminfo[gm_num].level = atoi(level); +// print("\ncdkey:%s, level:%d", gminfo[gm_num].cdkey, gminfo[gm_num].level); + } + fclose(fp); + return TRUE; +} +#endif + +/*------------------------------------------------------------ + * ة ë + * ¦ + * ئ + * ߯Ի + * cahr* + ------------------------------------------------------------*/ +char* getProgname( void ) +{ + return config.progname; +} +/*------------------------------------------------------------ + * configfilename ë £ + * ¦ + * ئ + * ߯Ի + * char* + ------------------------------------------------------------*/ +char* getConfigfilename( void ) +{ + return config.configfilename; +} +/*------------------------------------------------------------ + * configfilename ëɬ£ + * ¦ + * newv char* ޥа + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void setConfigfilename( char* newv ) +{ + strcpysafe( config.configfilename, sizeof( config.configfilename ), + newv ); +} + +/*------------------------------------------------------------ + * ìë + * ¦ + * ئ + * ߯Ի + * unsigned int + ------------------------------------------------------------*/ +unsigned int getDebuglevel( void ) +{ + return config.debuglevel; +} +/*------------------------------------------------------------ + * ìëɬ + * ¦ + * newv int ޥа + * ߯Ի + * unsigned int ɼ + ------------------------------------------------------------*/ +unsigned int setDebuglevel( unsigned int newv ) +{ + int old; + old = config.debuglevel; + config.debuglevel = newv; + return old; +} +/*------------------------------------------------------------ + * memoryunit ë + * ¦ + * ئ + * ߯Ի + * unsigned int + ------------------------------------------------------------*/ +unsigned int getMemoryunit( void ) +{ + return config.usememoryunit; +} +/*------------------------------------------------------------ + * memoryunitnum ë + * ¦ + * ئ + * ߯Ի + * unsigned int + ------------------------------------------------------------*/ +unsigned int getMemoryunitnum( void ) +{ + return config.usememoryunitnum; +} + +/*------------------------------------------------------------ + * ʧӡPʧë + * ¦ + * ئ + * ߯Ի + * char* + ------------------------------------------------------------*/ +char* getAccountservername( void ) +{ + return config.asname; +} +/*------------------------------------------------------------ + * ʧӡP̡ë + * ¦ + * ئ + * ߯Ի + * unsigned short + ------------------------------------------------------------*/ +unsigned short getAccountserverport( void ) +{ + return config.acservport; +} +/*------------------------------------------------------------ + * ʧӡ߼ɵë £ + * ¦ + * ئ + * ߯Ի + * unsigned short + ------------------------------------------------------------*/ +char* getAccountserverpasswd( void ) +{ + return config.acpasswd; +} +/*------------------------------------------------------------ + * ʧӡᆴέ±ءةӡƻ ë £ + * ¦ + * ئ + * ߯Ի + * unsigned short + ------------------------------------------------------------*/ +char* getGameservername( void ) +{ + return config.gsnamefromas; +} + +// Arminius 7.24 manor pk +char* getGameserverID( void ) +{ + if (config.gsid[strlen(config.gsid)-1]=='\n') + config.gsid[strlen(config.gsid)-1]='\0'; + + return config.gsid; +} + +unsigned short getAllowManorPK( void ) +{ + return config.allowmanorpk; +} + +unsigned short getPortnumber( void ) +{ + return config.port; +} +/*------------------------------------------------------------ + * ءةӡP į įë + * ¦ + * ئ + * ߯Ի + * unsigned short + ------------------------------------------------------------*/ +int getServernumber( void ) +{ + return config.servernumber; +} +/*------------------------------------------------------------ + * reuseaddr ë + * ¦ + * ئ + * ߯Ի + * unsigned short + ------------------------------------------------------------*/ +int getReuseaddr( void ) +{ + return config.reuseaddr; +} + +int getNodelay( void ) +{ + return config.do_nodelay; +} +int getLogWriteTime(void) +{ + return config.log_write_time; +} +int getLogIOTime( void) +{ + return config.log_io_time; +} +int getLogGameTime(void) +{ + return config.log_game_time; +} +int getLogNetloopFaster(void) +{ + return config.log_netloop_faster; +} + +/*------------------------------------------------------------ + * saacwritenum ë £ + * ¦ + * ئ + * ߯Ի + * int + ------------------------------------------------------------*/ +int getSaacwritenum( void ) +{ + return config.saacwritenum; +} +/*------------------------------------------------------------ + * saacwritenum ëɬ£ + * ¦ + * ئ + * ߯Ի + * int + ------------------------------------------------------------*/ +void setSaacwritenum( int num ) +{ + config.saacwritenum = num; +} +/*------------------------------------------------------------ + * saacreadnum ë £ + * ¦ + * ئ + * ߯Ի + * int + ------------------------------------------------------------*/ +int getSaacreadnum( void ) +{ + return config.saacreadnum; +} +/*------------------------------------------------------------ + * saacreadnum ëɬ£ + * ¦ + * ئ + * ߯Ի + * int + ------------------------------------------------------------*/ +void setSaacreadnum( int num ) +{ + config.saacreadnum = num; +} +/*------------------------------------------------------------ + * fdnum ë £ + * ¦ + * ئ + * ߯Ի + * unsigned int + ------------------------------------------------------------*/ +unsigned int getFdnum( void ) +{ +#ifdef _TEST_SERVER + if(config.fdnum>30) + return 30; + else + return config.fdnum; +#else + return config.fdnum; +#endif +} + +unsigned int getPlayercharnum( void ) +{ + if(config.playercharnum ̻P + ------------------------------------------------------------*/ +BOOL readconfigfile( char* filename ) +{ + FILE* f=NULL; + char linebuf[256]; /* */ + int linenum=0; /* ë */ + char realopenfilename[256]; /* ˱open °̻ */ + + char hostname[128]; + + /* ʯ ëƻ */ + if( gethostname( hostname, sizeof(hostname) ) != -1 ){ + char* initdot; + initdot = index( hostname, '.' ); + if( initdot != NULL ) + *initdot = '\0'; + snprintf( realopenfilename, sizeof(realopenfilename), + "%s.%s" , filename, hostname); + + /* ̻P */ + f=fopen( realopenfilename, "r" ); + if( f == NULL ) + print( "Can't open %s. use %s instead\n", realopenfilename, + filename ); + } + if( f == NULL ){ + f=fopen( filename , "r" ); /* ̻P */ + if( f == NULL ){ + print( "Can't open %s\n", filename ); + return FALSE; + } + } + + /* */ + while( fgets( linebuf , sizeof( linebuf ), f ) ){ + char firstToken[256]; /*1 ٯ */ + int i; /* */ + int ret; /**/ + + linenum ++; + + deleteWhiteSpace(linebuf); /* remove whitespace */ + + if( linebuf[0] == '#' )continue; /* comment */ + if( linebuf[0] == '\n' )continue; /* none */ + + chomp( linebuf ); /* remove tail newline */ + + /* delim "=" ƥ (1)ͼë */ + ret = getStringFromIndexWithDelim( linebuf , "=", 1, firstToken, + sizeof(firstToken) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + + /* readconf ƥ */ + for( i = 0 ; i < arraysizeof( readconf ) ; i ++ ){ + if( strcmp( readconf[i].name ,firstToken ) == 0 ){ + /* match */ + char secondToken[256]; /*2 ٯ */ + /* delim "=" ƥ2 ͼë */ + ret = getStringFromIndexWithDelim( linebuf , "=" , 2 + , secondToken , + sizeof(secondToken) ); + + /* NULL ٯëƩ */ + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore", + filename , linenum); + break; + } + + + /*NULLҽ ئ*/ + if( readconf[i].charvalue != NULL ) + strcpysafe( readconf[i].charvalue + ,readconf[i].charsize, secondToken); + + /*NULLҽ ئ*/ + if( readconf[i].value != NULL ) { + if( strcmp( "ON" ,secondToken ) == 0 ) { + /*ON1ë ľ*/ + substitutePointerFromType( readconf[i].value, + readconf[i].valuetype, + 1.0); + + }else if( strcmp( "OFF" ,secondToken ) == 0 ) { + /*OFF1ë ľ*/ + substitutePointerFromType( readconf[i].value, + readconf[i].valuetype, + 1.0); + }else { + strtolchecknum(secondToken, + (int*)readconf[i].value, + 10, readconf[i].valuetype); + } + } + break; + } + } + } + fclose( f ); + lastConfig(); + return TRUE; +} +//ttom add this becaus the second had this function +/*------------------------------------------------------------ + * ޼ƽëɬ + * ¦ + * ئ + * ߯Ի + * unsigned int ƽë߯ +------------------------------------------------------------*/ +unsigned int setEncodeKey( void ) +{ + JENCODE_KEY = config.encodekey; + return JENCODE_KEY; +} +/*------------------------------------------------------------ +* ʧӡ̤ 뼰ëɬ +* ¦ +* ئ +* ߯Ի +* unsigned int ƽë߯ +------------------------------------------------------------*/ +unsigned int setAcWBSize( void ) +{ + AC_WBSIZE = config.acwbsize; + return AC_WBSIZE; +} +unsigned int getAcwriteSize( void ) +{ + return config.acwritesize; +} +unsigned int getErrUserDownFlg( void ) +{ + return config.ErrUserDownFlg; +} + + +#ifdef _DEL_DROP_GOLD +unsigned int getGolddeletetime( void ) +{ + if( config.Golddeletetime > 0 ) + return config.Golddeletetime; + else + return config.Itemdeletetime; +} +void setIGolddeletetime( unsigned int interval ) +{ + config.Golddeletetime = interval; +} +#endif + +#ifdef _NEW_PLAYER_CF +int getNewplayertrans( void ) +{ + if(config.newplayertrans > 7) + return 7; + else if(config.newplayertrans >= 0) + return config.newplayertrans; + else + return 0; +} +int getNewplayerlv( void ) +{ + if(config.newplayerlv > 160) + return 160; + else if(config.newplayerlv >0) + return config.newplayerlv; + else + return 0; +} +int getNewplayerpetlv( void ) +{ + if(config.newplayerpetlv > 160) + return 160; + else if(config.newplayerpetlv > 0) + return config.newplayerpetlv; + else + return 0; +} + +int getNewplayergivepet( unsigned int index ) +{ + if(config.newplayergivepet[index] > 0 ) + return config.newplayergivepet[index]; + else + return -1; +} + +int getNewplayergiveitem( unsigned int index ) +{ + if(config.newplayergiveitem[index] > 0 ) + return config.newplayergiveitem[index]; + else + return -1; +} + +void setNewplayergivepet( unsigned int index ,unsigned int interval) +{ + config.newplayergivepet[index] = interval; +} + +int getNewplayergivegold( void ) +{ + if(config.newplayergivegold > 1000000) + return 1000000; + else if(config.newplayergivegold < 0) + return 0; + else + return config.newplayergivegold; +} +int getRidePetLevel( void ) +{ + if(config.ridepetlevel > 0 ) + return config.ridepetlevel; + else + return -1; +} +#ifdef _VIP_SERVER +int getNewplayergivevip( void ) +{ + return config.newplayerpetvip < 0?0:config.newplayerpetvip; +} +#endif +#endif +#ifdef _JK_CF_DELPETITEM ////ɾCFָƷͳ +char *getDelPet(void) +{ + return config.DelPet; +} +char *getDelItem(void) +{ + return config.DelItem; +} +#endif +#ifdef _UNLAW_WARP_FLOOR +int getUnlawwarpfloor( unsigned int index ) +{ + if(config.unlawwarpfloor[index] > 0 ) + return config.unlawwarpfloor[index]; + else + return -1; +} +#endif + +#ifdef _WATCH_FLOOR +int getWatchFloor( unsigned int index ) +{ + if(config.watchfloor[index] > 0 ) + return config.watchfloor[index]; + else + return -1; +} +char* getWatchFloorCF( void ) +{ + return (config.watchfloor[0]>0)? "":""; +} +#endif + +#ifdef _BATTLE_FLOOR +int getBattleFloor( unsigned int index ) +{ + if(config.battlefloor[index] > 0 ) + return config.battlefloor[index]; + else + return -1; +} +char* getBattleFloorCF( void ) +{ + return (config.battlefloor[0]>0)? "":""; +} +#endif + +#ifdef _ANGEL_SUMMON + +extern int mission_num; + +BOOL LoadMissionList( ) +{ + FILE* fp; + int i = 0; + + mission_num = 0; + + fp = fopen("./data/mission.txt", "r"); + if (fp == NULL) + { + print("ļ򿪴\n"); + return FALSE; + } + + memset( missionlist, 0, sizeof(missionlist)); + + while(1){ + char line[1024]; + char token[1024]; + int mindex; + if (fgets(line, sizeof(line), fp) == NULL) break; +// print("\n %s ", line); + chop(line); + // #Ϊע******* + if( line[0] == '#' ) + continue; + for( i=0; i= MAXMISSION) + break; + + missionlist[mindex].id = mindex; + + getStringFromIndexWithDelim(line, ",", 2, token, sizeof(token)); + if (strcmp(token, "") == 0) break; + missionlist[mindex].level = atoi( token); + + getStringFromIndexWithDelim(line, ",", 3, token, sizeof(token)); + if (strcmp(token, "") == 0) break; + strcpy( missionlist[mindex].eventflag, token); + + getStringFromIndexWithDelim(line, ",", 4, token, sizeof(token)); + if (strcmp(token, "") == 0) break; + strcpy( missionlist[mindex].detail, token); + + //getStringFromIndexWithDelim(line, ",", 4, token, sizeof(token)); + //if (strcmp(token, "") == 0) break; + //strcpy( missionlist[mindex].bonus, token); + + getStringFromIndexWithDelim(line, ",", 5, token, sizeof(token)); + if (strcmp(token, "") == 0) break; + missionlist[mindex].limittime = atoi( token); +/* + print("\nMISSION[%d] lv:%d ef:%s detail:%s limit:%d ", mindex, + missionlist[mindex].level, missionlist[mindex].eventflag, + missionlist[mindex].detail, missionlist[mindex].limittime ); +*/ + mission_num++; + //if (mission_num > MAXMISSION) break; + } + fclose(fp); + return TRUE; +} + + + +BOOL LoadMissionCleanList( ) +{ + // ʽ... ʹ,,, + FILE* fp; + int listindex =0; + int i = 0; + + memset( missiontable, 0, sizeof(missiontable)); + fp = fopen("./data/missionclean.txt", "r"); + if (fp == NULL) + { + print("ļ򿪴\n"); + return FALSE; + } + + while(1){ + char line[1024]; + char token[1024]; + + if (fgets(line, sizeof(line), fp) == NULL) break; + print("\n %s ", line); + chop(line); + // #Ϊע******* + if( line[0] == '#' ) + continue; + for( i=0; i= MAXMISSIONTABLE) break; + } + fclose(fp); + return TRUE; +} + + +#endif + +#ifdef _JOBDAILY +extern DailyFileType dailyfile[MAXDAILYLIST]; +BOOL LoadJobdailyfile(void) +{ + char line[20000]; + char token[16384]; + int listindex =0; + int i; + FILE* fp; + + fp = fopen("./data/jobdaily.txt", "r"); + if (fp == NULL) + { + print("ճļ򿪴\n"); + return FALSE; + } + + memset( dailyfile, 0, sizeof(dailyfile)); + + while(1){ + line[0]='\0'; + if (fgets(line, sizeof(line), fp) == NULL) break; + //print("\n %s ", line); + chop(line); + + // #Ϊע + if( line[0] == '#' ) + continue; + for( i=0; i64){ + print("\n˵:%d\n",strlen(token)); + return FALSE; + } + strcpy( dailyfile[listindex].explain, token); + + getStringFromIndexWithDelim(line, "|", 4, token, sizeof(token)); + if (strcmp(token, "") == 0) break; + strcpy( dailyfile[listindex].state, token); + + /*print("\ndailyfile[%d] %s %s %s %s", listindex, + dailyfile[listindex].jobid, + dailyfile[listindex].rule, + dailyfile[listindex].explain, + dailyfile[listindex].state); + */ + listindex++; + if ( listindex >= MAXDAILYLIST) break; + } + fclose(fp); + return TRUE; +} +#endif + +#ifdef _USER_EXP_CF +BOOL LoadEXP( char* filename ) +{ + FILE* fp; + int i = 0; + int MaxLevel=0; + fp = fopen(filename, "r"); + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + + while(1){ + char line[64], exp[64]; + if (fgets(line, sizeof(line), fp) == NULL) break; + chop(line); + + if( line[0] == '#' ) + continue; + for( i=0; i= 200) break; + easyGetTokenFromString(line, 2, exp, sizeof(exp)); + NeedLevelUpTbls[MaxLevel]=atoi(exp); + } + fclose(fp); + return TRUE; +} + +char* getEXPfile( void ) +{ + return config.expfile; +} + +int getNeedLevelUpTbls( int level ) +{ + return NeedLevelUpTbls[level]; +} + +#endif + +#ifdef _UNREG_NEMA +char* getUnregname( int index ) +{ + return config.unregname[index]; +} +#endif + +#ifdef _TRANS_LEVEL_CF +int getChartrans( void ) +{ + if(config.chartrans>6) + config.chartrans=6; + return config.chartrans; +} +int getPettrans( void ) +{ + if(config.pettrans>2) + return 2; + else if(config.pettrans<-1) + return -1; + return config.pettrans; +} +int getYBLevel( void ) +{ + if(config.yblevel>config.maxlevel) + config.yblevel=config.maxlevel; + return config.yblevel; +} +int getMaxLevel( void ) +{ + return config.maxlevel; +} +#endif + +#ifdef _POINT +char* getPoint( void ) +{ + return (config.point>0)? "":""; +} +int getTransPoint( int index ) +{ + return config.transpoint[index]; +} +#endif + +#ifdef _PET_UP +int getPetup( void ) +{ + return config.petup; +} +#endif +#ifdef _LOOP_ANNOUNCE +char* getLoopAnnouncePath( void ) +{ + return config.loopannouncepath; +} +int loadLoopAnnounce( void ) +{ + FILE* fp; + int i = 0; + config.loopannouncemax=0; + fp = fopen(config.loopannouncepath, "r"); + if (fp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + while(1){ + char line[1024]; + if (fgets(line, sizeof(line), fp) == NULL) break; + chop(line); + + if( line[0] == '#' ) + continue; + for( i=0; i<10; i++ ){ + if( line[i] == '#' ){ + line[i] = '\0'; + break; + } + } + //************************************* + strcpy(config.loopannounce[config.loopannouncemax],line); + config.loopannouncemax++; + if(config.loopannouncemax>=10) break; + } + fclose(fp); + return TRUE; +} +int getLoopAnnounceTime( void ) +{ + return (config.loopannouncetime<0)?-1:config.loopannouncetime; +} +int getLoopAnnounceMax( void ) +{ + return (config.loopannouncemax>0)?config.loopannouncemax:0; +} +char* getLoopAnnounce( int index ) +{ + return config.loopannounce[index]; +} +#endif + +#ifdef _SKILLUPPOINT_CF +int getSkup( void ) +{ + return (config.skup>0)?config.skup:0; +} +#endif +#ifdef _RIDELEVEL +int getRideLevel( void ) +{ + return config.ridelevel; +} +#endif +#ifdef _REVLEVEL +char* getRevLevel( void ) +{ + return (config.revlevel>0)?"":""; +} +#endif +#ifdef _NEW_PLAYER_RIDE +char* getPlayerRide( void ) +{ + if(config.npride>2) + return "ͻ"; + else if(config.npride==2) + return ""; + else if(config.npride==1) + return "ͻ"; + else + return ""; +} +#endif + +#ifdef _FIX_CHARLOOPS +int getCharloops( void ) +{ + return config.charloops-1; +} +#endif + +#ifdef _PLAYER_ANNOUNCE +int getPAnnounce( void ) +{ + return (config.pannounce>-1)?config.pannounce:-1; +} +#endif +#ifdef _PLAYER_MOVE +int getPMove( void ) +{ + return (config.pmove>-1)?config.pmove:-1; +} +#endif + +int getrecvbuffer( void ) +{ + if(config.recvbuffer<0) + return 0; + else if(config.recvbuffer>128) + return 128; + else + return config.recvbuffer; +} + +int getsendbuffer( void ) +{ + if(config.sendbuffer<0) + return 0; + else if(config.sendbuffer>128) + return 128; + else + return config.sendbuffer; +} + +int getrecvlowatbuffer( void ) +{ + if(config.recvlowatbuffer<0) + return 0; + else if(config.recvlowatbuffer>1024) + return 1024; + else + return config.recvlowatbuffer; +} + +int getrunlevel( void ) +{ + if(config.runlevel<-20) + return -20; + else if(config.runlevel>19) + return 19; + else + return config.runlevel; + +} + +#ifdef _SHOW_VIP_CF +int getShowVip( void ) +{ + if(config.showvip>2) + return 2; + else if(config.showvip<0) + return 0; + else + return config.showvip; +} +#endif + + +#ifdef _PLAYER_NUM +int getPlayerNum( void ) +{ + return config.playernum; +} +void setPlayerNum( int num ) +{ + config.playernum=num; +} +char* getPlayerBase( void ) +{ + return config.playerbase; +} +#endif + +#ifdef _BATTLE_GOLD +int getBattleGold( void ) +{ + if(config.battlegold<0) + return 0; + else if(config.battlegold>100) + return 100; + else + return config.battlegold; + +} +#endif + +#ifdef _ANGEL_TIME +int getAngelPlayerTime( void ) +{ + return (config.angelplayertime>1)?config.angelplayertime:1; +} +int getAngelPlayerMun( void ) +{ + return (config.angelplayermun>2)?config.angelplayermun:2; +} +#endif + +#ifdef _RIDEMODE_20 +int getRideMode( void ) +{ + if(config.ridemode<0) + config.ridemode=0; + return config.ridemode; +} +#endif +#ifdef _FM_POINT_PK +char *getFmPointPK( void ) +{ + return (config.fmpointpk>0)?"":""; +} +#endif +#ifdef _ENEMY_ACTION +int getEnemyAction( void ) +{ + if(config.enemyact>100) + return 100; + else if(config.enemyact<1) + return 1; + else + return config.enemyact; +} +#endif + +#ifdef _FUSIONBEIT_TRANS +int getFusionbeitTrans( void ) +{ + if(config.fusionbeittrans>2) + return 2; + else if(config.fusionbeittrans<0) + return 0; + else + return config.fusionbeittrans; +} +#endif +int getCpuUse( void ) +{ + return config.cpuuse; +} +#ifdef _CHECK_PEPEAT +int getCheckRepeat( void ) +{ + return (config.CheckRepeat>0)?1:0; +} +#endif + +#ifdef _FM_JOINLIMIT +int getJoinFamilyTime( void ) +{ + return config.joinfamilytime; +} +#endif + +#ifdef _NOWEN_EV +int getNowEvent(int Num) +{ + int i = config.NowEvent[Num]; + if (i <= 0)return -1; + return i; +} + +int getEndEvent(int Num) +{ + int i = config.EndEvent[Num]; + if (i <= 0)return -1; + return i; +} + +#endif +int getBalltePoint(int Num) +{ + int i = config.BattlePoint[Num]; + if (i <= 0)return -1; + return i; +} +#ifdef _ALL_TALK +int getTheWorldTrans(void) +{ + int i = config.TheWorldTrans; + if (i <= 0)return -1; + return i; +} + +int getTheWorldFame(void) +{ + int i = config.TheWorldFame; + if (i <= 0)return -1; + return i; +} +int getTheWorldTime(void) +{ + int i = config.TheWorldTime; + if (i <= 0)return -1; + return i; +} +int getTheWorldCnt(void) +{ + int i = config.TheWorldCnt; + if (i <= 0)return -1; + return i; +} +#endif +#ifdef _DIY_INSLAY +int getInslayNum(void) +{ + int i = config.InslayNum; + if (i < 1)return 1; + if (i > 5)return 5; + return i; +} +#endif +int getSafeMode(void) +{ + int i = config.safemode; + if (i < 1)return 0; + if (i > 1)return 1; + return i; +} + +int getTradeTax(void) +{ + int i = config.TradeTax; + if (i < 1)return 1; + if (i > 100)return 100; + return i; +} + +#ifdef _MAP_HEAL +int getMapHeal(int Num) +{ + int i = config.MapHeal[Num]; + if(i>0) + return i; + else + return -1; +} +#endif + +#ifdef _VIP_RIDE +int getVipMsgType(void) +{ + int i = config.VipMsgType; + if (i < 0)return 0; + if (i > 3)return 3; + return i; +} +#endif + +#ifdef _VIP_BATTLE_EXP +int getVipBattleExp( void ) +{ + if(config.VipBattleExp<0) + return 0; + return config.VipBattleExp; +} +#endif + +int getItemPoolBug(void) +{ + int i = config.ItemPoolBug; + if (i < 0)return 0; + if (i > 1)return 1; + return i; +} + +int getSameIpLogin( void ) +{ + if(config.SameIpLogin<0) + return 0; + return config.SameIpLogin; +} + +int getPetRideTrans( void ) +{ + if(config.PetRideTrans<0) + return 0; + else if (config.PetRideTrans>2) + return 2; + return config.PetRideTrans; +} + +#ifdef _LUCK_MAN +int getLuckTime( void ) +{ + if(config.lucktime<0) + return 0; + return config.lucktime; +} + +int getLuckItem( void ) +{ + char *itemarg=NULL; + char itemnumstr[32]; + int itemnum=0; + int present[20]; + int si=0,i; + itemarg=config.luckitem; + if( getStringFromIndexWithDelim( itemarg, "|", 1, itemnumstr, sizeof( itemnumstr)) == FALSE ) + return; + itemnum = atoi(itemnumstr); + if( itemnum > 20 ) + itemnum = 20; + for(i=0;i3) num=3; + char *itemarg=NULL; + char itemnumstr[32]; + int itemnum1=-1; + int itemnum2=-1; + int itemnum3=-1; + itemarg=config.questionitem; + if( getStringFromIndexWithDelim( itemarg, "|", 1, itemnumstr, sizeof( itemnumstr)) == FALSE ) + return -1; + itemnum1 = atoi(itemnumstr); + if( getStringFromIndexWithDelim( itemarg, "|", 2, itemnumstr, sizeof( itemnumstr)) == FALSE ) + return -1; + itemnum2 = atoi(itemnumstr); + if( getStringFromIndexWithDelim( itemarg, "|", 3, itemnumstr, sizeof( itemnumstr)) == FALSE ) + return -1; + itemnum3 = atoi(itemnumstr); + + if(num==1) + return itemnum1; + else if(num==2) + return itemnum2; + else if(num==3) + return itemnum3; +} +#endif + +#ifdef _NO_STREET_MAP +int getNoStreetMap( int num ) +{ + if(num<1) num=1; + if(num>5) num=5; + char *maparg=NULL; + char mapnumstr[32]; + int mapnum1=-1; + int mapnum2=-1; + int mapnum3=-1; + int mapnum4=-1; + int mapnum5=-1; + maparg=config.nostreetmap; + if( getStringFromIndexWithDelim( maparg, ",", 1, mapnumstr, sizeof( mapnumstr)) == FALSE ) + return -1; + mapnum1 = atoi(mapnumstr); + if( getStringFromIndexWithDelim( maparg, ",", 2, mapnumstr, sizeof( mapnumstr)) == FALSE ) + return -1; + mapnum2 = atoi(mapnumstr); + if( getStringFromIndexWithDelim( maparg, ",", 3, mapnumstr, sizeof( mapnumstr)) == FALSE ) + return -1; + mapnum3 = atoi(mapnumstr); + if( getStringFromIndexWithDelim( maparg, ",", 4, mapnumstr, sizeof( mapnumstr)) == FALSE ) + return -1; + mapnum4 = atoi(mapnumstr); + if( getStringFromIndexWithDelim( maparg, ",", 5, mapnumstr, sizeof( mapnumstr)) == FALSE ) + return -1; + mapnum5 = atoi(mapnumstr); + + if(num==1) + return mapnum1; + else if(num==2) + return mapnum2; + else if(num==3) + return mapnum3; + else if(num==4) + return mapnum4; + else if(num==5) + return mapnum5; +} +#endif + +#ifdef _STREET_FAX +int getStreetFax( int num ) +{ + if(num<0 || num>4 ) + return 100; + char *streetfaxarg=config.streetfax; + char streetfaxstr[32]; + if( getStringFromIndexWithDelim( streetfaxarg, ",", num+1, streetfaxstr, sizeof( streetfaxstr)) != FALSE ) + return atoi(streetfaxstr); + return 100; +} +#endif + +int getFmWarTime( int num ) +{ + char *timearg=NULL; + char timestr[5]; + timearg = config.fmwartime; + if(num==1){ + if( getStringFromIndexWithDelim( timearg, ",", 1, timestr, sizeof( timestr)) == FALSE ) + return 18; + return atoi(timestr); + } + else if(num==2){ + if( getStringFromIndexWithDelim( timearg, ",", 2, timestr, sizeof( timestr)) == FALSE ) + return 1; + return atoi(timestr); + } + else{ + return -1; + } +} + +#ifdef _JZ_NEWSCRIPT_LUA +char *getLuaFile(void) +{ + return config.luafile; +} +#endif + +#ifdef _TRANS7_POINT +int getTrans7Point(void) +{ + return config.trans7point; +} +#endif +#ifdef _NOJOB_PK +int getNoJobPkMap(void) +{ + return config.nojobpkmap; +} +#endif + +#ifdef _UNTEXT_TALK +BOOL LoadUnText( void ) +{ + FILE* untextfp; + int uni; + textcnt = 0; +// untext = (char **)malloc(50 * sizeof(char *)); + untextfp = fopen("./data/untext.txt", "r"); + if (untextfp == NULL) + { + print("޷ļ\n"); + return FALSE; + } + + while(1){ + char untestline[64]; + if (fgets(untestline, sizeof(untestline), untextfp) == NULL) break; + chop(untestline); + + if( untestline[0] == '#' ) + continue; + for( uni=0; uni=100) break; + } + fclose(untextfp); + return TRUE; +} + +char *getUnText(int num) +{ + if(num30) num = 1; + if( getStringFromIndexWithDelim( streetarg, ",", num, streetstr, sizeof( streetstr)) == FALSE ) + return ""; + return streetstr; +} + +#ifdef _NO_ATTACK +int getAttTime(void) +{ + return config.atttime; +} +int getAttSafeTime(void) +{ + return config.attsafetime; +} +int getAttCnt(void) +{ + return config.attcnt; +} +int getLateTime(void) +{ + return config.latetime; +} +int getAttDmeTime(void) +{ + return config.attdmetime; +} +int getAttDmeCnt(void) +{ + return config.attdmecnt; +} +#endif +char* getNoAttIp(int num) +{ + if(num<0) num=0; + else if(num>4) num=4; + return config.noattip[num]; +} +#ifdef _NO_TRANS_ANGLE +int getTrans6Angle(void) +{ + if(config.trans6angle<0) + config.trans6angle=0; + else if(config.trans6angle>1) + config.trans6angle=1; + return config.trans6angle; +} +#endif +#ifdef _PET_BUG +int getPetPoint(int num) +{ + if(num<0) num=0; + else if(num>3) num=3; + return config.petpoint[num]; +} +#endif +#ifdef _VIGOR_SYS +int getVigorTime(int num) +{ + if(num<0) num==0; + else if(num >7) num==7; + int i; + i = config.vigortime[num]; + if(i<0) i=0; + return i; +} +int getVigorMax(void) +{ + return config.vigormax; +} +#endif +#ifdef _AUTO_PK +int getAutoPkTime(void) +{ + return config.autopktime; +} +int getAutoPkMinNum(void) +{ + return config.autopkminnum; +} +int getAutoPkBattleTime(void) +{ + return config.autopkbattletime; +} +int getAutoPkMinLv(void) +{ + return config.autopkminlv; +} +int getAutoPkVigorPkNum(void) +{ + return config.autopkvigorpknum; +} +int getAutoPkVigorPkCnt(void) +{ + return config.autopkvigorpkcnt; +} +#endif +#ifdef _BATTLEMAP_CTRL +int getBattleTimeFloor(int num) +{ + char *timearg=NULL; + char timestr[10]; + timearg = config.BattleTime[num]; + if( getStringFromIndexWithDelim( timearg, ",", 1, timestr, sizeof( timestr)) == FALSE ) + return -1; + return atoi(timestr); +} +int getBattleTimePlayerNum(int num) +{ + char *timearg=NULL; + char timestr[10]; + timearg = config.BattleTime[num]; + if( getStringFromIndexWithDelim( timearg, ",", 2, timestr, sizeof( timestr)) == FALSE ) + return -1; + return atoi(timestr); +} +int getBattleTimeSec(int num) +{ + char *timearg=NULL; + char timestr[10]; + timearg = config.BattleTime[num]; + if( getStringFromIndexWithDelim( timearg, ",", 3, timestr, sizeof( timestr)) == FALSE ) + return -1; + return atoi(timestr); +} +#endif +#ifdef _FM_SERVERNO_SYS +int getFmServerNo(void) +{ + return config.fmserverno; +} +char* getFmServerMsg(void) +{ + return config.fmservermsg; +} +#endif +#ifdef _ZHIPIAO_SYSTEM +int getZhiPiao(void) +{ + return config.zhipiao; +} +int getPiaoTime(void) +{ + return config.piaotime; +} +#endif +#ifdef _FMWAR_MSG +char* getFmWarMsg(void) +{ + return config.fmwarmsg; +} +#endif +#ifdef _FM_WELFARE +char* getFmWelfare(int num) +{ + return config.fmwelfare[num]; +} +#endif +#ifdef _FMZUZHANG_MSG +char* getFmZuzhang(void) +{ + return config.fmzuzhang; +} +#endif +#ifdef _PETMAIL_LV +int getPetMailLv(void){ + return config.petmaillv; +} +int getPetMailCf(void){ + return config.petmailcf; +} +#endif +#ifdef _FMWAR_PLAYERNUM +int getFmWarPlayerNum(void){ + if(config.fmwarplayernum<50) return 50; + return config.fmwarplayernum; +} +#endif +#ifdef _WAN_FIX +int getVsFlg(void){ + if(config.vsflg>3 || config.vsflg<0) return 0; + return config.vsflg; +} +#endif +#ifdef _WARNPC_CTRL +int getPartyMap(int num){ + char *patymaparg=NULL; + char patymapstr[10]; + patymaparg = config.partymap; + if( getStringFromIndexWithDelim( patymaparg, ",", num, patymapstr, sizeof( patymapstr)) == FALSE ) + return -1; + return atoi(patymapstr); +} +int getMapSameIp(int num){ + char *mapsameiparg=NULL; + char mapsameipstr[10]; + mapsameiparg = config.mapsameip; + if( getStringFromIndexWithDelim( mapsameiparg, ",", num, mapsameipstr, sizeof( mapsameipstr)) == FALSE ) + return -1; + return atoi(mapsameipstr); +} +#endif +#ifdef _NO_DAOLUAN +int getStreetTrn(void){ + return config.streettrn; +} +int getTalkTrn(void){ + return config.talktrn; +} +int getTalkLv(void){ + return config.talklv; +} +char* getTalkMsg(void){ + return config.talkmsg; +} +char* getTalkName(void){ + return config.talkname; +} +#endif +#ifdef _NO_FULLPLAYER_ATT +int getNoFullPlayer(void){ + return config.nofullplayer; +} +int getNoFull2Player(void){ + return config.nofull2player; +} +int getNoCdkeyPlayer(void){ + if(config.nocdkeyplayer<0 || config.nocdkeyplayer>2000) + return 0; + return config.nocdkeyplayer; +} +int getNoCdkeyMode(void){ + if(config.nocdkeymode<0 || config.nocdkeymode>2) + return 0; + return config.nocdkeymode; +} +int getNoCdkeyType(void){ + if(config.nocdkeytype<0 || config.nocdkeytype>2) + return 0; + return config.nocdkeytype; +} +int getNoFullTime(void){ + return config.nofulltime; +} +int getFengType(void){ + return config.fengtype; +} +int getNoFullEndPlayer(void){ + return config.nofullendplayer; +} +int getNoFullEndTime(void){ + return config.nofullendtime; +} +int getManRenNum(void){ + return config.manrennum; +} +int getBigBao(void){ + if(config.bigbao<=0) return 1024; + return config.bigbao; +} +int getBigBao2(void){ + if(config.bigbao2<=0) return 1024; + return config.bigbao2; +} +#endif +#ifdef _ATTREVERSE_FIX +int getAttReverse(void){ + return config.attreverse; +} +#endif +#ifdef _NEWFM_GOLD +int getNewFmGold(void){ + return config.newfmgold; +} +#endif +#ifdef _MERGE_TIME +int getMergeTime(void){ + if(config.mergetime<0) return 0; + else if(config.mergetime>5) return 5; + return config.mergetime; +} +#endif +#ifdef _PETUP_GET_EXP +int getPetUpGetExp(void){ + if(config.petupgetexp<0) return 0; + else if(config.petupgetexp>1) return 1; + return config.petupgetexp; +} +#endif +#ifdef _MM_NO_JIAOBEN +int getNoMMJiaoben(void){ + if(config.nommjiaoben<0) return 0; + else if(config.nommjiaoben>1) return 1; + return config.nommjiaoben; +} +int getEditBaseTime(void){ + if(config.editbasetime<0) return 0; + else if(config.editbasetime>100) return 100; + return config.editbasetime; +} +#endif +#ifdef _DP_140_160_MODE +int getNewDpMode(void){ + if(config.newdpmode!=1) return 0; + return 1; +} +#endif +#ifdef _LOOK_STREET_TIME +int getLookStreetTime(void){ + if(config.lookstreettime<0) return 0; + else if(config.lookstreettime>3600) return 3600; + return config.lookstreettime; +} +#endif +#ifdef _BATTLE_EQUIT_OTHER +int getBattleEquitOther(void){ + if(config.battleequitother<0) return 0; + else if(config.battleequitother>1) return 1; + return config.battleequitother; +} +#endif +#ifdef _PK_LUCK_MAN +int getPkLuckFloor(int floor){ + char *pkluckfloorarg=NULL; + char pkluckfloorstr[10]; + pkluckfloorarg = config.pkluckfloor; + int i; + for(i=1;i<=10;i++){ + if( getStringFromIndexWithDelim( pkluckfloorarg, ",", i, pkluckfloorstr, sizeof( pkluckfloorstr)) == FALSE ) + return -1; + if(floor == atoi(pkluckfloorstr)) + return i; + } + return -1; +} +char* getPkLuckMapName(int num){ + if(num<0) num = 0; + else if(num>9) num = 9; + return config.pkluckmapname[num]; +} +int getPkLuckTimeMin(void){ + char *pklucktimearg=NULL; + char pklucktimestr[10]; + pklucktimearg = config.pklucktime; + if( getStringFromIndexWithDelim( pklucktimearg, ",", 1, pklucktimestr, sizeof( pklucktimestr)) == FALSE ) + return -1; + return atoi(pklucktimestr); +} +int getPkLuckTimeMax(void){ + char *pklucktimearg=NULL; + char pklucktimestr[10]; + pklucktimearg = config.pklucktime; + if( getStringFromIndexWithDelim( pklucktimearg, ",", 2, pklucktimestr, sizeof( pklucktimestr)) == FALSE ) + return -1; + return atoi(pklucktimestr); +} +int getPkLuckNum(void){ + char *pklucknumarg=NULL; + char pklucknumstr[10]; + int pklucknummin,pklucknummax; + pklucknumarg = config.pklucknum; + if( getStringFromIndexWithDelim( pklucknumarg, "-", 1, pklucknumstr, sizeof( pklucknumstr)) == FALSE ) + pklucknummin = 1; + pklucknummin = atoi(pklucknumstr); + if( getStringFromIndexWithDelim( pklucknumarg, "-", 2, pklucknumstr, sizeof( pklucknumstr)) == FALSE ) + pklucknummax = 1; + pklucknummax = atoi(pklucknumstr); + if(pklucknummin == pklucknummax){ + return pklucknummin; + }else{ + return RAND(pklucknummin,pklucknummax); + } + return pklucknummin; +} +int getPkLuckFame(void){ + char *pkluckarg=NULL; + char pkluckstr[256]; + char pkluckbuf[10]; + pkluckarg = config.pkluckbuf; + if( getStringFromIndexWithDelim( pkluckarg, "|", 1, pkluckstr, sizeof( pkluckstr)) == FALSE ) + return 0; + int cnt = 1; + while(1){ + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + break; + cnt++; + } + if(cnt==1) + return atoi(pkluckstr); + else{ + cnt = RAND(1,cnt); + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + return 0; + return atoi(pkluckbuf); + } +} +int getPkLuckVigor(void){ + char *pkluckarg=NULL; + char pkluckstr[256]; + char pkluckbuf[10]; + pkluckarg = config.pkluckbuf; + if( getStringFromIndexWithDelim( pkluckarg, "|", 2, pkluckstr, sizeof( pkluckstr)) == FALSE ) + return 0; + int cnt = 1; + while(1){ + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + break; + cnt++; + } + if(cnt==1) + return atoi(pkluckstr); + else{ + cnt = RAND(1,cnt); + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + return 0; + return atoi(pkluckbuf); + } +} +int getPkLuckVipPoint(void){ + char *pkluckarg=NULL; + char pkluckstr[256]; + char pkluckbuf[10]; + pkluckarg = config.pkluckbuf; + if( getStringFromIndexWithDelim( pkluckarg, "|", 3, pkluckstr, sizeof( pkluckstr)) == FALSE ) + return 0; + int cnt = 1; + while(1){ + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + break; + cnt++; + } + if(cnt==1) + return atoi(pkluckstr); + else{ + cnt = RAND(1,cnt); + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + return 0; + return atoi(pkluckbuf); + } +} +int getPkLuckAmPoint(void){ + char *pkluckarg=NULL; + char pkluckstr[256]; + char pkluckbuf[10]; + pkluckarg = config.pkluckbuf; + if( getStringFromIndexWithDelim( pkluckarg, "|", 4, pkluckstr, sizeof( pkluckstr)) == FALSE ) + return 0; + int cnt = 1; + while(1){ + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + break; + cnt++; + } + if(cnt==1) + return atoi(pkluckstr); + else{ + cnt = RAND(1,cnt); + if(getStringFromIndexWithDelim( pkluckstr, ",", cnt, pkluckbuf, sizeof( pkluckbuf)) == FALSE) + return 0; + return atoi(pkluckbuf); + } +} +int getPkLuckLevel(void){ + return config.pklucklevel; +} +int getPkLuckBattleTurn(void){ + return config.pkluckbattleturn; +} +#endif +#ifdef _NO_DAOLUAN +int getTalkFloor(int num){ + char *talkfloorarg=NULL; + char talkfloorstr[10]; + talkfloorarg = config.talkfloor; + if( getStringFromIndexWithDelim( talkfloorarg, ",", num, talkfloorstr, sizeof( talkfloorstr)) == FALSE ) + return -1; + return atoi(talkfloorstr); +} +#endif +#ifdef _SUPERMAN_FIX +int getSuperManPoint(void){ + if(config.supermanpoint<=0) return -1; + return config.supermanpoint; +} +#endif +#ifdef _PICKUP_ITEM_OTHER +int getPickupItem(void){ + if(config.pickupitem<=0) return 0; + return 1; +} +char* getPickItemId(void){ + return config.pickitemid; +} +#endif +#ifdef _FM_LIAOLI +int getFmLiaoLiType(void){ + if(config.fmliaolitype<=0) return 0; + return 1; +} +#endif +#ifdef _TRADE_ITEM_FIX +int getTradeItemFix(void){ + if(config.tradeitemfix<=0) return 0; + return 1; +} +#endif +#ifdef _PETMAIL_TIME +int getPetMailTime(void){ + if(config.petmailtime<=0) return 0; + return config.petmailtime; +} +#endif +int getRandMin(void){ + if(config.randmin<=1) return 1; + return config.randmin; +} +int getRandMax(void){ + if(config.randmax<=1) return 1; + return config.randmax; +} +#ifdef _GJS_TYPE +int getGjsType(void){ + if(config.gjstype<1) return 0; + return 1; +} +#endif +int getTicketCf(void){ + if(config.ticketcf<1) return 0; + return 1; +} +char* getTicketMsg(void){ + return config.ticketmsg; +} + +char* getDefaultKey(int cli_fd){ + if(config.satype==95){ + if(cli_fd == -1) + return "www.longzoro.com";//2.5 + char fddefaultkey[32]; + memset(fddefaultkey, 0, sizeof(fddefaultkey)); + CONNECT_getDefaultKey( cli_fd, fddefaultkey, sizeof(fddefaultkey)); + if(strlen(fddefaultkey)<1) + return "www.longzoro.com";//2.5 + else + return fddefaultkey;//2.5 + } + return "www.longzoro.com"; +} +char* getRunningKey(void){ + return "www.longzoro.com";//2.5 +} +char* getSaVersion(void){ + if(config.satype==95){ + return "Z";//9.5 + } + return "K";//2.5 +} +int getSaType(void){ + return config.satype; +} +#ifdef _BATTLEEND_FIX +int getBattleEndMode(void){ + if(config.battleendmode!=1) return 0; + return 1; +} +#endif + +#ifdef _BIG_POOL_TYPE +int getPetPoolType(void){ + if(config.petpooltype!=1) return 0; + return 1; +} +int getItemPoolType(void){ + if(config.itempooltype!=1) return 0; + return 1; +} +#endif + +int getNoStayBattle(void){ + if(config.nostaybattle!=1) return 0; + return 1; +} + +int getRightNum(void){ + return config.rightnum; +} + +int getRightMode(void){ + if(config.rightmode!=1) return 0; + return 1; +} + +int getErrorMode(void){ + if(config.errormode!=1) return 0; + return 1; +} + +#ifdef _FLOOR_PARTY_CTRL +int getPartyFloor(int num){ + char *partyfloorarg=NULL; + char partyfloorstr[10]; + partyfloorarg = config.partyfloor; + if( getStringFromIndexWithDelim( partyfloorarg, ",", num, partyfloorstr, sizeof( partyfloorstr)) == FALSE ) + return -1; + return atoi(partyfloorstr); +} +#endif + +int getBattleTimtOut(void){ + if(config.battletimeout<=0) return 0; + return config.battletimeout; +} + +int getReloadNpcTime(void){ + if(config.reloadnpctime<=0) return 0; + return config.reloadnpctime; +} + +int getReloadNpcType(void){ + if(config.reloadnpctype<=0) return 0; + return 1; +} + +int getOfflineBattleTime(void){ + if(config.offlinebattletime<=0) return 2500; + return config.offlinebattletime; +} + +int getOfflineCf(void){ + if(config.offlinecf<=0 || config.offlinecf>2) return 0; + return config.offlinecf; +} + +int getOfflineMaxNum(void){ + if(config.offlinemaxnum<=0) return 0; + return config.offlinemaxnum; +} + +int getOfflineJqmMaxNum(void){ + if(config.offlinejqmmaxnum<=0) return 0; + return config.offlinejqmmaxnum; +} + +int getKongType(void){ + if(config.kongtype!=1) return 0; + return 1; +} + +int getJiFenBaiTan(void){ + if(config.jifenbaitan!=1) return 0; + return 1; +} + +int getNoPkMap(void){ + if(config.nopkmap<=0) return 0; + return config.nopkmap; +} + +int getFmBuffTrans(void){ + if(config.fmbufftrans<=0) return 0; + return config.fmbufftrans; +} + +char* getNoMpMagic(void){ + return config.nompmagic; +} + +int getLoginJqmType(void){ + if(config.loginjqmtype!=1) return 0; + return config.loginjqmtype; +} + +char* getFmMagicMpRate(int num){ + if(num<=0) return config.fmmagicmprate[0]; + else return config.fmmagicmprate[1]; +} + +int getSameIpNum(void){ + if(config.sameipnum<=0) return 0; + return config.sameipnum; +} + +int getSameJqmNum(void){ + if(config.samejqmnum<=0) return 0; + return config.samejqmnum; +} + +int getSameJqmAllNum(void){ + if(config.samejqmallnum<=0) return 0; + return config.samejqmallnum; +} + +int getMmType(void){ + if(config.mmtype<=0) return 0; + return 1; +} + +char* getMmMsg(void){ + return config.mmmsg; +} + +int getLockType(void){ + if(config.locktype<=0) return 0; + return config.locktype; +} + +int getAllTalkPoint(void){ + if(config.alltalkpoint<=0) return 0; + return config.alltalkpoint; +} + +#ifdef _NO_RIDE_ID +char* getNoRideId(void){ + return config.norideid; +} +#endif + +int getLoginType(void){ + if(config.logintype<=0) return 0; + return 1; +} + + + +#ifdef _PETTRANS_RANGE +void setPetTransRangeX(int num){ + if(config.pettransrangex<=0) return ; + if(config.pettransrangex>=4) return ; + config.pettransrangex=num; + return; +} + +int getPetTransRangeX(void){ + if(config.pettransrangex<=0) return 0; + return config.pettransrangex; +} + +void setPetTransRangeY(int num){ + if(config.pettransrangey<=0) return ; + if(config.pettransrangey>=8) return ; + config.pettransrangey=num; + return; +} + +int getPetTransRangeY(void){ + if(config.pettransrangey<=0) return 0; + return config.pettransrangey; +} + +void setPetTransRangeZ(int num){ + if(config.pettransrangez<=-5) return ; + if(config.pettransrangez>=5) return ; + config.pettransrangez=num; + return; +} + +int getPetTransRangeZ(void){ + if(config.pettransrangez<=-5) return -5; + return config.pettransrangez; +} +#endif + +#ifdef _ITEM_LUA +const char *getitemluafile(void){ + return config.itemluafile; +} +BOOL ITEM_LuaInit(const char * _FileName){ + if (strlen( _FileName) != 0) return TRUE; + return FALSE; +} + +#endif + +#ifdef _SAME_IP_ONLINE_NUM +int getSameIpOnlineNum() +{ + return config.sameiponlinenum; +} +#endif + +#ifdef _CHECK_SEVER_IP +int checkServerIp( unsigned int ip ) +{ + char serverip[64]; + char cliip[64]; + int i = 1; + + int a, b, c, d; + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + + sprintf(cliip, "%d.%d.%d.%d", a, b, c, d); + + while(getStringFromIndexWithDelim(config.serverip,",", i++, serverip, sizeof(serverip))==TRUE){ + if(strcmp(cliip, serverip) == 0){ + return TRUE; + } + } + + return FALSE; +} +#endif + +#ifdef _CAX_ESC_REPORT +/** + * ͨԱÿǩ + */ +int getReportItem(unsigned int index) { + if (config.reportitem[index] > 0) + return config.reportitem[index]; + else + return -1; +} + +/** + * VIPԱÿǩ + */ +int getVipReportItem(unsigned int index) { + if (config.vipreportitem[index] > 0) + return config.vipreportitem[index]; + else + return -1; +} +/** + * ǩȼ + */ +int getReportLv(void){ + return config.reportlv; +} +/** + * ǩת + */ +int getReportTa(void){ + return config.reportta; +} +#endif + +#ifdef _PETSKILL_SHOP_LUA +char *getFreePetSkillShopPath() +{ + return config.freepetskillshoppath; +} +#endif + +#ifdef _CAX_FAMEBUTTON +char* getfamebutton( void ) +{ + return (config.famebutton>0)? "":""; +} +#endif + +#ifdef _PET_TRANS_ABILITY +int getPetTransAbility() +{ + if(config.pettransability<=0)config.pettransability=0; + return config.pettransability; +} +int getPetTransAbility1() +{ + if(config.pettransability1<=0)config.pettransability1=150; + return config.pettransability1; +} +int getPetTransAbility2() +{ + if(config.pettransability2<=0)config.pettransability2=200; + return config.pettransability2; +} +int getPetTransAbility3() +{ + if(config.pettransability3<=0)config.pettransability3=250; + return config.pettransability3; +} +#endif + +#ifdef _PET_3TRANS +int getMMPETID1(void) +{ + return config.MMPETID1; +} +int getMMPETID2(void) +{ + return config.MMPETID2; +} +#endif + +#ifdef _NO_MAGIC +int getnomagicmap(int num ) +{ + char buf[128]; + getStringFromIndexWithDelim(config.nomagicmap,",", num+1, buf, sizeof(buf)); + return atoi(buf); +} +#endif + +#ifdef _illegalpetskill_CF +int getIllegalPetskill(int index) +{ + return config.IllegalPetskill[index]; +} +#endif + +#ifdef _CAX_PET_EVOLUTION +char getpetevotyb(void) +{ + return config.petevotyb; +} + +int getpetevotyb1(void) +{ + if(config.petevotyb1>250) + return 250; + else if(config.petevotyb1<1) + return 150; + else + return config.petevotyb1; +} + +#endif + +#ifdef _TRANS_7_COLOR +/* +int getTranColor(void) +{ + return config.TranColor; +} +*/ +char getping(void) +{ + return config.ping; +} + +char getpetsummon(void) +{ + return config.petsummon; +} + +#endif + +#ifdef _CAX_PET_ITEMRIDE +char getpetitemride(void) +{ + return config.petitemride; +} +#endif + +#ifdef _DAMMAGE_CALC +int getDamageCalc() +{ + if(config.dammagecalc > 0){ + return config.dammagecalc; + }else{ + return 70; + } +} +#endif + +#ifdef _CAX_FAME_KOUFEI +int getfamekoufei() +{ + if(config.famekoufei > 0){ + return config.famekoufei; + } +} +#endif + +#ifdef _CAX_ITEM_ADDEXP +int getexptime() +{ + if(config.exptime > 0 && config.exptime <= 72000 ){ + return config.exptime; + }else{ + return 72000; + } +} +#endif + +#ifdef _CAX_LNS_NLSUOXU +int GetConfigLineType(char *TM_ConfigName) +{ + int i; + + for( i = 0 ; i < arraysizeof( readconf ) ; i ++ ){ + if (strcmp(readconf[i].name,TM_ConfigName) == 0) break; + } + if (i == arraysizeof( readconf )) return -1; + switch( readconf[i].valuetype ){ + case CHAR: + return 0; + break; + case SHORT: + return 1; + break; + case INT: + return 2; + break; + case DOUBLE: + return 3; + break; + } +} + +char* GetConfigLineVal( char* TM_ConfigName ) +{ + char* filename = getConfigfilename(); + FILE* f=NULL; + char linebuf[256]; /* */ + int linenum=0; /* ë */ + char realopenfilename[256]; /* ˱open °̻ */ + char secondToken[256]; + char hostname[128]; + + + if( f == NULL ){ + f=fopen( filename , "r" ); /* ̻P */ + if( f == NULL ){ + print( "Can't open %s\n", filename ); + return FALSE; + } + } + + /* */ + while( fgets( linebuf , sizeof( linebuf ), f ) ){ + char firstToken[256]; /*1 ٯ */ + int i; /* */ + int ret; /**/ + + linenum ++; + + deleteWhiteSpace(linebuf); /* remove whitespace */ + + if( linebuf[0] == '#' )continue; /* comment */ + if( linebuf[0] == '\n' )continue; /* none */ + + chomp( linebuf ); /* remove tail newline */ + + /* delim "=" ƥ (1)ͼë */ + ret = getStringFromIndexWithDelim( linebuf , "=", 1, firstToken, + sizeof(firstToken) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + if (strcmp(firstToken,TM_ConfigName) != 0) continue; + /* readconf ƥ */ + for( i = 0 ; i < arraysizeof( readconf ) ; i ++ ){ + if( strcmp( readconf[i].name ,firstToken ) == 0 ){ + /* match */ + /* delim "=" ƥ2 ͼë */ + ret = getStringFromIndexWithDelim( linebuf , "=" , 2 + , secondToken , + sizeof(secondToken) ); + + /* NULL ٯëƩ */ + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore", + filename , linenum); + break; + } + return secondToken; + break; + } + } + break; + } + fclose( f ); + lastConfig(); + return NULL; +} + +int getCopymapstartingID( void ) +{ + return config.mapstart; +} +#endif + +#ifdef _SHARE_EXP +int getExpShare(void){ + if (config.expshare ==1) + return 1; + else + return 0; +} +#endif + +#ifdef _TEAM_ADDEXP +int getTeamAddExp(void){ + if (config.teamaddexp >0) + return config.teamaddexp; + else + return 0; +} +#endif + +#ifdef _NO_STW_ENEMY +int getNoSTWNenemy( void ) +{ + return config.nostwenemy; +} + +int getNoSTWNenemyPoint( void ) +{ + return config.nostwenemypoint; +} +#endif + +#ifdef _DEX_FIX +int getDexFixPer(void){ + if(config.dexfixper<=0) return 1; + return config.dexfixper; +} +#endif +#ifdef _FM_EXP_ADD +unsigned int getFmAddExp( void ) +{ + return config.fmaddexp; +} +#endif diff --git a/const.c b/const.c new file mode 100644 index 0000000..50b496b --- /dev/null +++ b/const.c @@ -0,0 +1,779 @@ +#include "version.h" +#include "common.h" + +#include "char.h" +#include "char_data.h" +#include "item.h" +#include "battle.h" +#include "object.h" +#ifdef _CAX_ADD_LUADX +#include "enemy.h" +#endif +//0-1999 CHAR_getInt +//2000-3999 CHAR_getChar +//4000-5999 CHAR_getWorkInt +//6000-7999 CHAR_getWorkChar +//8000-9999 CHAR_getFlg +#define LUA_DATALINE0 0 +#define LUA_DATALINE1 2000 +#define LUA_DATALINE2 4000 +#define LUA_DATALINE3 6000 +#define LUA_DATALINE4 8000 +#define LUA_DATALINE5 10000 + +typedef struct __lua_const { + const char *name; + unsigned int size; + int vl; +}lua_const; + +lua_const M_Lua_RegConstList[] = { + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_DATAPLACENUMBER}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_BASEIMAGENUMBER}, + {"_ԭ%", sizeof("_ԭ%"), LUA_DATALINE0 + CHAR_BASEBASEIMAGENUMBER}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FACEIMAGENUMBER}, + {"_ͼ%", sizeof("_ͼ%"), LUA_DATALINE0 + CHAR_FLOOR}, + {"_X%", sizeof("_X%"), LUA_DATALINE0 + CHAR_X}, + {"_Y%", sizeof("_Y%"), LUA_DATALINE0 + CHAR_Y}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_DIR}, + {"_ȼ%", sizeof("_ȼ%"), LUA_DATALINE0 + CHAR_LV}, + {"_ʯ%", sizeof("_ʯ%"), LUA_DATALINE0 + CHAR_GOLD}, + {"_Ѫ%", sizeof("_Ѫ%"), LUA_DATALINE0 + CHAR_HP}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_MP}, + {"_M%", sizeof("_M%"), LUA_DATALINE0 + CHAR_MAXMP}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_VITAL}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_STR}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_TOUGH}, + {"_ٶ%", sizeof("_ٶ%"), LUA_DATALINE0 + CHAR_DEX}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_CHARM}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LUCK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_EARTHAT}, + {"_ˮ%", sizeof("_ˮ%"), LUA_DATALINE0 + CHAR_WATERAT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FIREAT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_WINDAT}, + {"_ս%", sizeof("_ս%"), LUA_DATALINE0 + CHAR_DEFAULTPET}, + {"_CL%", sizeof("_CL%"), LUA_DATALINE0 + CHAR_CRITIAL}, + {"_CR%", sizeof("_CR%"), LUA_DATALINE0 + CHAR_COUNTER}, + {"_ϡ%", sizeof("_ϡ%"), LUA_DATALINE0 + CHAR_RARE}, + {"_RH%", sizeof("_RH%"), LUA_DATALINE0 + CHAR_RADARSTRENGTH}, + {"_CE%", sizeof("_CE%"), LUA_DATALINE0 + CHAR_CHATVOLUME}, + {"_ML%", sizeof("_ML%"), LUA_DATALINE0 + CHAR_MERCHANTLEVEL}, + {"_¼%", sizeof("_¼%"), LUA_DATALINE0 + CHAR_SAVEPOINT}, + {"_DM%", sizeof("_DM%"), LUA_DATALINE0 + CHAR_DETERMINEITEM}, + {"_ƺ%", sizeof("_ƺ%"), LUA_DATALINE0 + CHAR_INDEXOFEQTITLE}, + {"_ƶ%", sizeof("_ƶ%"), LUA_DATALINE0 + CHAR_POISON}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_PARALYSIS}, + {"_Ĭ%", sizeof("_Ĭ%"), LUA_DATALINE0 + CHAR_SLEEP}, + {"_ʯ%", sizeof("_ʯ%"), LUA_DATALINE0 + CHAR_STONE}, + {"_ư%", sizeof("_ư%"), LUA_DATALINE0 + CHAR_DRUNK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_CONFUSION}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LOGINCOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_DEADCOUNT}, + {"_ߴ%", sizeof("_ߴ%"), LUA_DATALINE0 + CHAR_WALKCOUNT}, + {"_˵%", sizeof("_˵%"), LUA_DATALINE0 + CHAR_TALKCOUNT}, + {"_˴%", sizeof("_˴%"), LUA_DATALINE0 + CHAR_DAMAGECOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_GETPETCOUNT}, + {"_ɱ%", sizeof("_ɱ%"), LUA_DATALINE0 + CHAR_KILLPETCOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_DEADPETCOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_SENDMAILCOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_MERGEITEMCOUNT}, + {"_PK%", sizeof("_PK%"), LUA_DATALINE0 + CHAR_DUELBATTLECOUNT}, + {"_PӮ%", sizeof("_PӮ%"), LUA_DATALINE0 + CHAR_DUELWINCOUNT}, + {"_P%", sizeof("_P%"), LUA_DATALINE0 + CHAR_DUELLOSECOUNT}, + {"_P%", sizeof("_P%"), LUA_DATALINE0 + CHAR_DUELSTWINCOUNT}, + {"_P%", sizeof("_P%"), LUA_DATALINE0 + CHAR_DUELMAXSTWINCOUNT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_WHICHTYPE}, + {"_Ƽ%", sizeof("_Ƽ%"), LUA_DATALINE0 + CHAR_WALKINTERVAL}, + {"_ѭʱ%", sizeof("_ѭʱ%"), LUA_DATALINE0 + CHAR_LOOPINTERVAL}, +#ifdef _NEWOPEN_MAXEXP + {"_ɾ%", sizeof("_ɾ%"), LUA_DATALINE0 + CHAR_OLDEXP}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_EXP}, +#else + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_EXP}, +#endif + +#ifdef _CAX_ADD_LUADX + {"_ѪMAX%", sizeof("_ѪMAX%"), LUA_DATALINE0 + CHAR_WORKMAXHP}, + {"_MAX%", sizeof("_MAX%"), LUA_DATALINE0 + CHAR_WORKMAXMP}, + {"_ͼ%", sizeof("_ͼ%"), LUA_DATALINE2 + CHAR_WORKFMFLOOR}, + {"_ɳ%", sizeof("_ɳ%"), LUA_DATALINE0 + CHAR_ALLOCPOINT}, + {"_PETRANK%", sizeof("_PETRANK%"), LUA_DATALINE0 + CHAR_PETRANK}, + {"_ENEMYBASE%", sizeof("_ENEMYBASE%"), LUA_DATALINE0 + CHAR_PETID}, + {"_̯%", sizeof("_̯%"), LUA_DATALINE0 + CHAR_WORKSTREETVENDOR}, + {"_̯%", sizeof("_̯%"), LUA_DATALINE0 + CHAR_WORKSTREETVENDOR_WHO}, + {"_̯%", sizeof("_̯%"), LUA_DATALINE0 + CHAR_STREETVENDOR_NAME}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LOVE}, + {"_ż%", sizeof("_ż%"), LUA_DATALINE0 + CHAR_LOVERID}, + {"_ż%", sizeof("_ż%"), LUA_DATALINE0 + CHAR_LOVERNAME}, + {"ɳ_ٶ%", sizeof("ɳ_ٶ%"), 0}, + {"ɳ_%", sizeof("ɳ_%"), 1}, + {"ɳ_%", sizeof("ɳ_%"), 2}, + {"ɳ_%", sizeof("ɳ_%"), 3}, + {"_ٶȳɳ%", sizeof("_ٶȳɳ%"), 0}, + {"_ɳ%", sizeof("_ɳ%"), 1}, + {"_ɳ%", sizeof("_ɳ%"), 2}, + {"_ɳ%", sizeof("_ɳ%"), 3}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_TEMPNO}, + {"ģ_ʼ%", sizeof("ģ_ʼ%"), LUA_DATALINE0 + E_T_INITNUM}, + {"ģ_%", sizeof("ģ_%"), E_T_LVUPPOINT}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_BASEVITAL}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_BASESTR}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_BASETGH}, + {"ģ_ٶ%", sizeof("ģ_ٶ%"), LUA_DATALINE0 + E_T_BASEDEX}, + {"ģ_AI%", sizeof("ģ_AI%"), LUA_DATALINE0 + E_T_MODAI}, + {"ģ_GET%", sizeof("ģ_GET%"), LUA_DATALINE0 + E_T_GET}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_EARTHAT}, + {"ģ_ˮ%", sizeof("ģ_ˮ%"), LUA_DATALINE0 + E_T_WATERAT}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_FIREAT}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_WINDAT}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_POISON}, + {"ģ_鿹%", sizeof("ģ_鿹%"), LUA_DATALINE0 + E_T_PARALYSIS}, + {"ģ_Ĭ%", sizeof("ģ_Ĭ%"), LUA_DATALINE0 + E_T_SLEEP}, + {"ģ_ʯ%", sizeof("ģ_ʯ%"), LUA_DATALINE0 + E_T_STONE}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_DRUNK}, + {"ģ_ҿ%", sizeof("ģ_ҿ%"), LUA_DATALINE0 + E_T_CONFUSION}, + {"ģ_輼1%", sizeof("ģ_輼1%"), LUA_DATALINE0 + E_T_PETSKILL1}, + {"ģ_輼2%", sizeof("ģ_輼2%"), LUA_DATALINE0 + E_T_PETSKILL2}, + {"ģ_輼3%", sizeof("ģ_輼3%"), LUA_DATALINE0 + E_T_PETSKILL3}, + {"ģ_輼4%", sizeof("ģ_輼4%"), LUA_DATALINE0 + E_T_PETSKILL4}, + {"ģ_輼5%", sizeof("ģ_輼5%"), LUA_DATALINE0 + E_T_PETSKILL5}, + {"ģ_輼6%", sizeof("ģ_輼6%"), LUA_DATALINE0 + E_T_PETSKILL6}, + {"ģ_輼7%", sizeof("ģ_輼7%"), LUA_DATALINE0 + E_T_PETSKILL7}, + {"ģ_ϡ%", sizeof("ģ_ϡ%"), LUA_DATALINE0 + E_T_RARE}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_CRITICAL}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_COUNTER}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_SLOT}, + {"ģ_ͼ%", sizeof("ģ_ͼ%"), LUA_DATALINE0 + E_T_IMGNUMBER}, + {"ģ_FLG%", sizeof("ģ_FLG%"), LUA_DATALINE0 + E_T_PETFLG}, + {"ģ_ߴ%", sizeof("ģ_ߴ%"), LUA_DATALINE0 + E_T_SIZE}, + {"ģ_%", sizeof("ģ_%"), LUA_DATALINE0 + E_T_LIMITLEVEL}, + {"ģ_ں%", sizeof("ģ_ں%"), LUA_DATALINE0 + E_T_FUSIONCODE}, + {"ģ_ԭ%", sizeof("ģ_ԭ%"), LUA_DATALINE1 + E_T_NAME}, +#endif + + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LASTTALKELDER}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_SKILLUPPOINT}, + {"_LT%", sizeof("_LT%"), LUA_DATALINE0 + CHAR_LEVELUPPOINT}, + {"_ͼ%", sizeof("_ͼ%"), LUA_DATALINE0 + CHAR_IMAGETYPE}, + {"_CLR%", sizeof("_CLR%"), LUA_DATALINE0 + CHAR_NAMECOLOR}, + {"_ɫ%", sizeof("_ɫ%"), LUA_DATALINE0 + CHAR_POPUPNAMECOLOR}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LASTTIMESETLUCK}, + {"_DP%", sizeof("_DP%"), LUA_DATALINE0 + CHAR_DUELPOINT}, + {"_ת%", sizeof("_ת%"), LUA_DATALINE0 + CHAR_TRANSMIGRATION}, + {"_ת%", sizeof("_ת%"), LUA_DATALINE0 + CHAR_TRANSEQUATION}, + {"_IA%", sizeof("_IA%"), LUA_DATALINE0 + CHAR_INITDATA}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_SILENT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FMINDEX}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + CHAR_FMLEADERFLAG}, + {"_ؾ%", sizeof("_ؾ%"), LUA_DATALINE0 + CHAR_FMSPRITE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_BANKGOLD}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_RIDEPET}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LEARNRIDE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_LIMITLEVEL}, +#ifdef _PET_FUSION + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FUSIONCODE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FUSIONINDEX}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FUSIONRAISE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FUSIONBEIT}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_FUSIONTIMELIMIT}, +#endif +#ifdef _DEATH_CONTEND + {"_ӱ%", sizeof("_ӱ%"), LUA_DATALINE0 + CHAR_PKLISTTEAMNUM}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_PKLISTLEADER}, +#endif +#ifdef _PERSONAL_FAME + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FAME}, +#endif +#ifdef _CAX_Mercenary + {"_Ӷ%", sizeof("_Ӷ%"), LUA_DATALINE0 + CHAR_MERCENARY}, //Ӷ +#endif +#ifdef _VIP_RIDE + {"_VIP%", sizeof("_VIP%"), LUA_DATALINE0 + CHAR_VIPRIDE}, + {"_VIPʱ%", sizeof("_VIPʱ%"), LUA_DATALINE0 + CHAR_VIPTIME}, +#endif +#ifdef _VIP_SERVER + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_AMPOINT}, +#endif +#ifdef _EV_NUM + {"_ܻ%", sizeof("_ܻ%"), LUA_DATALINE0 + CHAR_EVNUM}, +#endif + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_MISSIONTRAIN_NUM}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_MISSIONTRAIN_TIME}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_MISSIONTRAIN_NUM}, // ܻ + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_EVOLVE}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_ONLINE_TIME}, + {"_¥ʱ%", sizeof("_¥ʱ%"), LUA_DATALINE0 + CHAR_FLOORDIFI_TIME}, + {"_Ʒ%", sizeof("_Ʒ%"), LUA_DATALINE0 + CHAR_SUPER}, + {"_ƺŵȼ%", sizeof("_ƺŵȼ%"), LUA_DATALINE0 + CHAR_TITLE_LV}, + {"_ƺʱ%", sizeof("_ƺʱ%"), LUA_DATALINE0 + CHAR_TITLE_TIME}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_MISSION_TIME}, + +#ifdef _ATTACK_MAGIC + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_EARTH_EXP}, + {"_ˮħ%", sizeof("_ˮħ%"), LUA_DATALINE0 + CHAR_WATER_EXP}, + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_FIRE_EXP}, + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_WIND_EXP}, + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_EARTH_RESIST}, + {"_ˮħ%", sizeof("_ˮħ%"), LUA_DATALINE0 + CHAR_WATER_RESIST}, + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_FIRE_RESIST}, + {"_ħ%", sizeof("_ħ%"), LUA_DATALINE0 + CHAR_WIND_RESIST}, + {"_쾭%", sizeof("_쾭%"), LUA_DATALINE0 + CHAR_EARTH_ATTMAGIC_EXP}, + {"_ˮ쾭%", sizeof("_ˮ쾭%"), LUA_DATALINE0 + CHAR_WATER_ATTMAGIC_EXP}, + {"_쾭%", sizeof("_쾭%"), LUA_DATALINE0 + CHAR_FIRE_ATTMAGIC_EXP}, + {"_쾭%", sizeof("_쾭%"), LUA_DATALINE0 + CHAR_WIND_ATTMAGIC_EXP}, + {"_ؿ%", sizeof("_ؿ%"), LUA_DATALINE0 + CHAR_EARTH_DEFMAGIC_EXP}, + {"_ˮ%", sizeof("_ˮ%"), LUA_DATALINE0 + CHAR_WATER_DEFMAGIC_EXP}, + {"_𿹾%", sizeof("_𿹾%"), LUA_DATALINE0 + CHAR_FIRE_DEFMAGIC_EXP}, + {"_翹%", sizeof("_翹%"), LUA_DATALINE0 + CHAR_WIND_DEFMAGIC_EXP}, +#endif +#ifdef _GAMBLE_BANK + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_PERSONAGOLD}, +#endif +#ifdef _DROPSTAKENEW + {"_ķ%", sizeof("_ķ%"), LUA_DATALINE0 + CHAR_GAMBLENUM}, +#endif +#ifdef _AUCTIONEER + {"_ĵ%", sizeof("_ĵ%"), LUA_DATALINE0 + CHAR_AUCGOLD}, +#endif +#ifdef _PET_EVOLUTION + {"_Ѫҩ%", sizeof("_Ѫҩ%"), LUA_DATALINE0 + CHAR_EVOLUTIONBASEVTL}, + {"_ҩ%", sizeof("_ҩ%"), LUA_DATALINE0 + CHAR_EVOLUTIONBASESTR}, + {"_ҩ%", sizeof("_ҩ%"), LUA_DATALINE0 + CHAR_EVOLUTIONBASETGH}, + {"_ҩ%", sizeof("_ҩ%"), LUA_DATALINE0 + CHAR_EVOLUTIONBASEDEX}, +#endif +#ifdef _FAMILYBANKSTONELOG + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FMBANKGOLD}, +#endif +#ifdef _FM_JOINLIMIT + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_FMTIMELIMIT}, +#endif +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + {"_ְҵ%", sizeof("_ְҵ%"), LUA_DATALINE0 + PROFESSION_CLASS}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_LEVEL}, + //{"_ְ", sizeof("_ְ"), LUA_DATALINE0 + PROFESSION_EXP}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_SKILL_POINT}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + ATTACHPILE}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_FIRE_P}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_ICE_P}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_THUNDER_P}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_FIRE_R}, + {"_ְ%", sizeof("_ְ%"), LUA_DATALINE0 + PROFESSION_ICE_R}, + {"_ְ׿%", sizeof("_ְ׿%"), LUA_DATALINE0 + PROFESSION_THUNDER_R}, +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + {"_ս%", sizeof("_ս%"), LUA_DATALINE0 + CHAR_HEROFLOOR}, +#endif +#ifdef _PETSKILL_BECOMEPIG + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_BECOMEPIG}, + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_BECOMEPIG_BBI}, +#endif + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + CHAR_LASTLEAVETIME}, +#ifdef _NEW_MANOR_LAW + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_MOMENTUM}, +#endif +#ifdef _ANGEL_SUMMON + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_HEROCNT}, +#endif +#ifdef _TEACHER_SYSTEM + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_TEACHER_FAME}, +#endif +#ifdef _CAX_ESC_REPORT + {"_ǩ%", sizeof("_ǩ%"), LUA_DATALINE0 + CHAR_REPORT}, +#endif +#ifdef _RACEMAN + {"_CKN%", sizeof("_CKN%"), LUA_DATALINE0 + CHAR_CHECKIN}, + {"_CN1%", sizeof("_CN1%"), LUA_DATALINE0 + CHAR_CATCHCNT1}, + {"_CN2%", sizeof("_CN2%"), LUA_DATALINE0 + CHAR_CATCHCNT2}, + {"_CN3%", sizeof("_CN3%"), LUA_DATALINE0 + CHAR_CATCHCNT3}, + {"_CN4%", sizeof("_CN4%"), LUA_DATALINE0 + CHAR_CATCHCNT4}, + {"_CN5%", sizeof("_CN5%"), LUA_DATALINE0 + CHAR_CATCHCNT5}, + {"_KN1%", sizeof("_KN1%"), LUA_DATALINE0 + CHAR_KINDCNT1}, + {"_KN2%", sizeof("_KN2%"), LUA_DATALINE0 + CHAR_KINDCNT2}, + {"_KN3%", sizeof("_KN3%"), LUA_DATALINE0 + CHAR_KINDCNT3}, + {"_KN4%", sizeof("_KN4%"), LUA_DATALINE0 + CHAR_KINDCNT4}, + {"_KN5%", sizeof("_KN5%"), LUA_DATALINE0 + CHAR_KINDCNT5}, + {"_KN6%", sizeof("_KN6%"), LUA_DATALINE0 + CHAR_KINDCNT6}, + {"_KN7%", sizeof("_KN7%"), LUA_DATALINE0 + CHAR_KINDCNT7}, + {"_KN8%", sizeof("_KN8%"), LUA_DATALINE0 + CHAR_KINDCNT8}, + {"_KN9%", sizeof("_KN9%"), LUA_DATALINE0 + CHAR_KINDCNT9}, + {"_KN10%", sizeof("_KN10%"), LUA_DATALINE0 + CHAR_KINDCNT10}, +#endif + {"_ף%", sizeof("_ף%"), LUA_DATALINE0 + CHAR_BEATITUDE}, +#ifdef _VIGOR_SYS + {"_%", sizeof("_%"), LUA_DATALINE0 + CHAR_VIGOR}, +#endif + {"_1%", sizeof("_1%"), LUA_DATALINE0 + CHAR_LUASAVE_WORKINT_1}, //lua洢 + {"_2%", sizeof("_2%"), LUA_DATALINE0 + CHAR_LUASAVE_WORKINT_2}, //lua洢 + {"_3%", sizeof("_3%"), LUA_DATALINE0 + CHAR_LUASAVE_WORKINT_3}, //lua洢 + {"_洢1%", sizeof("_洢1%"), LUA_DATALINE0 + CHAR_LUASAVE_INT_1}, //洢浵 + {"_洢2%", sizeof("_洢2%"), LUA_DATALINE0 + CHAR_LUASAVE_INT_2}, //洢浵 + {"_洢3%", sizeof("_洢3%"), LUA_DATALINE0 + CHAR_LUASAVE_INT_3}, //洢浵 + // {"_IP%",sizeof("_IP%"),LUA_DATALINE1 + CHAR_CHARPLAYIP}, + + {"_Աȼ%", sizeof("_Աȼ%"), LUA_DATALINE0 + CHAR_VIPRIDE}, + {"_Աʱ%", sizeof("_Աʱ%"), LUA_DATALINE0 + CHAR_VIPTIME}, + + {"_NPCʱ%", sizeof("_NPCʱ%"), LUA_DATALINE0 + CHAR_NPCTIME}, + + {"_ԭ%", sizeof("_ԭ%"), LUA_DATALINE1 + CHAR_NAME}, + {"_%", sizeof("_%"), LUA_DATALINE1 + CHAR_USERPETNAME}, + {"_ʺ%", sizeof("_ʺ%"), LUA_DATALINE1 + CHAR_CDKEY}, + {"_%", sizeof("_%"), LUA_DATALINE1 + CHAR_OWNERCDKEY}, + {"_%", sizeof("_%"), LUA_DATALINE1 + CHAR_OWNERCHARANAME}, + {"_%", sizeof("_%"), LUA_DATALINE1 + CHAR_FMNAME}, +#ifdef _TEACHER_SYSTEM + {"_ʦ%", sizeof("_ʦ%"), LUA_DATALINE1 + CHAR_TEACHER_ID}, + {"_ʦ%", sizeof("_ʦ%"), LUA_DATALINE1 + CHAR_TEACHER_NAME}, +#endif +#ifdef _CAX_LUA_BETT01 + {"_ս1%", sizeof("_ս1%"), LUA_DATALINE2 + CHAR_WORKBATTLECOM1}, + {"_ս2%", sizeof("_ս2%"), LUA_DATALINE2 + CHAR_WORKBATTLECOM2}, + {"_սģ%", sizeof("_սģ%"), LUA_DATALINE2 + CHAR_WORKBATTLEMODE}, +#endif + {"_ģʽ%", sizeof("_ģʽ%"), LUA_DATALINE2 + CHAR_WORKPARTYMODE}, + {"_%", sizeof("_%"), LUA_DATALINE2 + CHAR_WORKOBJINDEX}, +#ifdef _ADD_ACTION //npc + {"_%", sizeof("_%"), LUA_DATALINE2 + CHAR_WORKACTION}, +#endif + {"_LUA%", sizeof("_LUA%"), LUA_DATALINE2 + CHAR_WORKLUANPCINT}, + {"_1LUA%", sizeof("_1LUA%"), LUA_DATALINE2 + CHAR_WORKLUANPCINT1}, + + {"_IAK%", sizeof("_IAK%"), LUA_DATALINE4 + CHAR_ISATTACK}, + {"_ս%", sizeof("_ս%"), LUA_DATALINE4 + CHAR_ISATTACKED}, + {"_IOR%", sizeof("_IOR%"), LUA_DATALINE4 + CHAR_ISOVER}, + {"_·%", sizeof("_·%"), LUA_DATALINE4 + CHAR_ISOVERED}, + {"_HHT%", sizeof("_HHT%"), LUA_DATALINE4 + CHAR_HAVEHEIGHT}, + {"_%", sizeof("_%"), LUA_DATALINE4 + CHAR_ISVISIBLE}, + {"_ITP%", sizeof("_ITP%"), LUA_DATALINE4 + CHAR_ISTRANSPARENT}, + {"_IFG%", sizeof("_IFG%"), LUA_DATALINE4 + CHAR_ISFLYING}, + {"_%", sizeof("_%"), LUA_DATALINE4 + CHAR_ISDIE}, + {"_IBIG%", sizeof("_IBIG%"), LUA_DATALINE4 + CHAR_ISBIG}, + {"_ս%", sizeof("_ս%"), LUA_DATALINE4 + CHAR_ISSHOWBATTLEMSG}, + {"_ӱ%", sizeof("_ӱ%"), LUA_DATALINE4 + CHAR_ISPARTY}, + {"_%", sizeof("_%"), LUA_DATALINE4 + CHAR_ISWARP}, + {"_ս%", sizeof("_ս%"), LUA_DATALINE4 + CHAR_ISDUEL}, + {"_ı%", sizeof("_ı%"), LUA_DATALINE4 + CHAR_ISPARTYCHAT}, + {"_Ƭ%", sizeof("_Ƭ%"), LUA_DATALINE4 + CHAR_ISTRADECARD}, + {"_ױ%", sizeof("_ױ%"), LUA_DATALINE4 + CHAR_ISTRADE}, +#ifdef _CHANNEL_MODIFY + {"_Ƶ%", sizeof("_Ƶ%"), LUA_DATALINE4 + CHAR_ISTELL}, + {"_Ƶ%", sizeof("_Ƶ%"), LUA_DATALINE4 + CHAR_ISFM}, + {"_ְƵ%", sizeof("_ְƵ%"), LUA_DATALINE4 + CHAR_ISOCC}, + {"_Ի%", sizeof("_Ի%"), LUA_DATALINE4 + CHAR_ISSAVE}, + {"_Ƶ%", sizeof("_Ƶ%"), LUA_DATALINE4 + CHAR_ISCHAT}, +#endif + + {"_ID%", sizeof("_ID%"), LUA_DATALINE0 + ITEM_ID}, + {"_ͼ%", sizeof("_ͼ%"), LUA_DATALINE0 + ITEM_BASEIMAGENUMBER}, + {"_ɱ%", sizeof("_ɱ%"), LUA_DATALINE0 + ITEM_COST}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_TYPE}, + {"_AUF%", sizeof("_AUF%"), LUA_DATALINE0 + ITEM_ABLEUSEFIELD}, + {"_TARGET%", sizeof("_TARGET%"), LUA_DATALINE0 + ITEM_TARGET}, + {"_ȼ%", sizeof("_ȼ%"), LUA_DATALINE0 + ITEM_LEVEL}, +#ifdef _ITEM_MAXUSERNUM + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_DAMAGEBREAK}, +#endif +#ifdef _ITEMSET4_TXT + {"_ѵ%", sizeof("_ѵ%"), LUA_DATALINE0 + ITEM_USEPILENUMS}, + {"_ɵ%", sizeof("_ɵ%"), LUA_DATALINE0 + ITEM_CANBEPILE}, + {"_STR%", sizeof("_STR%"), LUA_DATALINE0 + ITEM_NEEDSTR}, + {"_DEX%", sizeof("_DEX%"), LUA_DATALINE0 + ITEM_NEEDDEX}, + {"_ת%", sizeof("_ת%"), LUA_DATALINE0 + ITEM_NEEDTRANS}, + {"_ְҵ%", sizeof("_ְҵ%"), LUA_DATALINE0 + ITEM_NEEDPROFESSION}, +#endif +#ifdef _TAKE_ITEMDAMAGE + {"_;%", sizeof("_;%"), LUA_DATALINE0 + ITEM_DAMAGECRUSHE}, + {"_MAX;%", sizeof("_MAX;%"), LUA_DATALINE0 + ITEM_MAXDAMAGECRUSHE}, +#endif +#ifdef _ADD_DEAMGEDEFC + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_OTHERDAMAGE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_OTHERDEFC}, +#endif +#ifdef _SUIT_ITEM + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_SUITCODE}, +#endif + {"_AKMIN%", sizeof("_AKMIN%"), LUA_DATALINE0 + ITEM_ATTACKNUM_MIN}, + {"_AKMAX%", sizeof("_AKMAX%"), LUA_DATALINE0 + ITEM_ATTACKNUM_MAX}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYATTACK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYDEFENCE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYQUICK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYHP}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYMP}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYLUCK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYCHARM}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYAVOID}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYATTRIB}, + {"_ֵ%", sizeof("_ֵ%"), LUA_DATALINE0 + ITEM_MODIFYATTRIBVALUE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MAGICID}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MAGICPROB}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MAGICUSEMP}, +#ifdef _ITEMSET5_TXT + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYARRANGE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MODIFYSEQUENCE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_ATTACHPILE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_HITRIGHT}, +#endif +#ifdef _ITEMSET6_TXT + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_NEGLECTGUARD}, +#endif + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_POISON}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_PARALYSIS}, + {"_˯%", sizeof("_˯%"), LUA_DATALINE0 + ITEM_SLEEP}, + {"_ʯ%", sizeof("_ʯ%"), LUA_DATALINE0 + ITEM_STONE}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_DRUNK}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_CONFUSION}, + {"_һ%", sizeof("_һ%"), LUA_DATALINE0 + ITEM_CRITICAL}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_USEACTION}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_DROPATLOGOUT}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_VANISHATDROP}, + {"_·%", sizeof("_·%"), LUA_DATALINE0 + ITEM_ISOVERED}, + {"_ʼ%", sizeof("_ʼ%"), LUA_DATALINE0 + ITEM_CANPETMAIL}, + {"_Ӻϳ%", sizeof("_Ӻϳ%"), LUA_DATALINE0 + ITEM_CANMERGEFROM}, + {"_ϳɵ%", sizeof("_ϳɵ%"), LUA_DATALINE0 + ITEM_CANMERGETO}, + {"_0%", sizeof("_0%"), LUA_DATALINE0 + ITEM_INGVALUE0}, + {"_1%", sizeof("_1%"), LUA_DATALINE0 + ITEM_INGVALUE1}, + {"_2%", sizeof("_2%"), LUA_DATALINE0 + ITEM_INGVALUE2}, + {"_3%", sizeof("_3%"), LUA_DATALINE0 + ITEM_INGVALUE3}, + {"_4%", sizeof("_4%"), LUA_DATALINE0 + ITEM_INGVALUE4}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + ITEM_PUTTIME}, + {"_LL%", sizeof("_LL%"), LUA_DATALINE0 + ITEM_LEAKLEVEL}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_MERGEFLG}, + {"_%", sizeof("_%"), LUA_DATALINE0 + ITEM_CRUSHLEVEL}, + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE0 + ITEM_TIME}, + {"_VAR1%", sizeof("_VAR1%"), LUA_DATALINE0 + ITEM_VAR1}, + {"_VAR2%", sizeof("_VAR2%"), LUA_DATALINE0 + ITEM_VAR2}, + {"_VAR3%", sizeof("_VAR3%"), LUA_DATALINE0 + ITEM_VAR3}, + {"_VAR4%", sizeof("_VAR4%"), LUA_DATALINE0 + ITEM_VAR4}, + + {"_%", sizeof("_%"), LUA_DATALINE2 + ITEM_WORKOBJINDEX}, + {"_%", sizeof("_%"), LUA_DATALINE2 + ITEM_WORKCHARAINDEX}, +#ifdef _ITEM_TIME_LIMIT + {"_ʱ%", sizeof("_ʱ%"), LUA_DATALINE2 + ITEM_WORKTIMELIMIT}, +#endif + + {"_ԭ%", sizeof("_ԭ%"), LUA_DATALINE1 + ITEM_NAME}, + {"_%", sizeof("_%"), LUA_DATALINE1 + ITEM_SECRETNAME}, + {"_˵%", sizeof("_˵%"), LUA_DATALINE1 + ITEM_EFFECTSTRING}, + {"_%", sizeof("_%"), LUA_DATALINE1 + ITEM_ARGUMENT}, + {"_%", sizeof("_%"), LUA_DATALINE1 + ITEM_CDKEY}, + {"_%", sizeof("_%"), LUA_DATALINE1 + ITEM_FORUSERCDKEY}, + {"_0%", sizeof("_0%"), LUA_DATALINE1 + ITEM_INGNAME0}, + {"_1%", sizeof("_1%"), LUA_DATALINE1 + ITEM_INGNAME1}, + {"_2%", sizeof("_2%"), LUA_DATALINE1 + ITEM_INGNAME2}, + {"_3%", sizeof("_3%"), LUA_DATALINE1 + ITEM_INGNAME3}, + {"_4%", sizeof("_4%"), LUA_DATALINE1 + ITEM_INGNAME4}, + + {"_ͷλ%", sizeof("_ͷλ%"), CHAR_HEAD}, + {"_λ%", sizeof("_λ%"), CHAR_BODY}, + {"_%", sizeof("_%"), CHAR_ARM}, + {"_1%", sizeof("_1%"), CHAR_DECORATION1}, + {"_2%", sizeof("_2%"), CHAR_DECORATION2}, +#ifdef _ITEM_EQUITSPACE + {"_%", sizeof("_%"), CHAR_EQSHIELD}, + {"_λ%", sizeof("_λ%"), CHAR_EQBELT}, + {"_λ%", sizeof("_λ%"), CHAR_EQSHOES}, +#endif +#ifdef _EQUIT_NEWGLOVE + {"_%", sizeof("_%"), CHAR_EQGLOVE}, +#endif + {"_1%", sizeof("_1%"), CHAR_STARTITEMARRAY + 0}, + {"_2%", sizeof("_2%"), CHAR_STARTITEMARRAY + 1}, + {"_3%", sizeof("_3%"), CHAR_STARTITEMARRAY + 2}, + {"_4%", sizeof("_4%"), CHAR_STARTITEMARRAY + 3}, + {"_5%", sizeof("_5%"), CHAR_STARTITEMARRAY + 4}, + {"_6%", sizeof("_6%"), CHAR_STARTITEMARRAY + 5}, + {"_7%", sizeof("_7%"), CHAR_STARTITEMARRAY + 6}, + {"_8%", sizeof("_8%"), CHAR_STARTITEMARRAY + 7}, + {"_9%", sizeof("_9%"), CHAR_STARTITEMARRAY + 8}, + {"_10%", sizeof("_10%"), CHAR_STARTITEMARRAY + 9}, + {"_11%", sizeof("_11%"), CHAR_STARTITEMARRAY + 10}, + {"_12%", sizeof("_12%"), CHAR_STARTITEMARRAY + 11}, + {"_13%", sizeof("_13%"), CHAR_STARTITEMARRAY + 12}, + {"_14%", sizeof("_14%"), CHAR_STARTITEMARRAY + 13}, + {"_15%", sizeof("_15%"), CHAR_STARTITEMARRAY + 14}, + + {"_1%", sizeof("_1%"), 0}, + {"_2%", sizeof("_2%"), 1}, + {"_3%", sizeof("_3%"), 2}, + {"_4%", sizeof("_4%"), 3}, + {"_5%", sizeof("_5%"), 4}, + + {"Ա_1%", sizeof("Ա_1%"), 1}, + {"Ա_2%", sizeof("Ա_2%"), 2}, + {"Ա_3%", sizeof("Ա_3%"), 3}, + {"Ա_4%", sizeof("Ա_4%"), 4}, + + {"IT_צ%", sizeof("IT_צ%"), ITEM_FIST}, + {"IT_ͷ%", sizeof("IT_ͷ%"), ITEM_AXE}, + {"IT_%", sizeof("IT_%"), ITEM_CLUB}, + {"IT_ǹ%", sizeof("IT_ǹ%"), ITEM_SPEAR}, + {"IT_%", sizeof("IT_%"), ITEM_BOW}, + {"IT_SHIELD%", sizeof("IT_SHIELD%"), ITEM_SHIELD}, + {"IT_HELM%", sizeof("IT_HELM%"), ITEM_HELM}, + {"IT_ARMOUR%", sizeof("IT_ARMOUR%"), ITEM_ARMOUR}, + {"IT_ֻ%", sizeof("IT_ֻ%"), ITEM_BRACELET}, + {"IT_%", sizeof("IT_%"), ITEM_MUSIC}, + {"IT_%", sizeof("IT_%"), ITEM_NECKLACE}, + {"IT_%", sizeof("IT_%"), ITEM_RING}, + {"IT_BELT%", sizeof("IT_BELT%"), ITEM_BELT}, + {"IT_%", sizeof("IT_%"), ITEM_EARRING}, + {"IT_ǻ%", sizeof("IT_ǻ%"), ITEM_NOSERING}, + {"IT_%", sizeof("IT_%"), ITEM_AMULET}, + {"IT_%", sizeof("IT_%"), ITEM_OTHER}, + {"IT_%", sizeof("IT_%"), ITEM_BOOMERANG}, + {"IT_Ͷ%", sizeof("IT_Ͷ%"), ITEM_BOUNDTHROW}, + {"IT_Ͷʯ%", sizeof("IT_Ͷʯ%"), ITEM_BREAKTHROW}, + {"IT_DISH%", sizeof("IT_DISH%"), ITEM_DISH}, +#ifdef _ITEM_INSLAY + {"IT_%", sizeof("IT_%"), ITEM_METAL}, + {"IT_%", sizeof("IT_%"), ITEM_JEWEL}, +#endif +#ifdef _ITEM_CHECKWARES + {"IT_%", sizeof("IT_%"), ITEM_WARES}, +#endif +#ifdef _ITEM_EQUITSPACE + {"IT_%", sizeof("IT_%"), ITEM_WBELT}, + {"IT_%", sizeof("IT_%"), ITEM_WSHIELD}, + {"IT_Ь%", sizeof("IT_Ь%"), ITEM_WSHOES}, +#endif +#ifdef _EQUIT_NEWGLOVE + {"IT_%", sizeof("IT_%"), ITEM_WGLOVE}, +#endif +#ifdef _JZ_PETEQU + {"IT_ͷ%", sizeof("IT_ͷ%"), ITEM_PET_HEAD}, + {"IT_%", sizeof("IT_%"), ITEM_PET_WING}, + {"IT_%", sizeof("IT_%"), ITEM_PET_TOOTH}, + {"IT_ؼ%", sizeof("IT_ؼ%"), ITEM_PET_BREAST}, + {"IT_豳%", sizeof("IT_豳%"), ITEM_PET_BACK}, + {"IT_צ%", sizeof("IT_צ%"), ITEM_PET_CLAW}, + {"IT_軤2%", sizeof("IT_軤2%"), ITEM_PET_FEET}, + {"IT_軤4%", sizeof("IT_軤4%"), ITEM_PET_FEET4}, + {"IT_%", sizeof("IT_%"), ITEM_PET_FIN}, +#endif + + {"_û%", sizeof("_û%"), FMMEMBER_NONE}, + {"_һ%", sizeof("_һ%"), FMMEMBER_MEMBER}, + {"_%", sizeof("_%"), FMMEMBER_APPLY}, + {"_峤%", sizeof("_峤%"), FMMEMBER_LEADER}, + {"_%", sizeof("_%"), FMMEMBER_ELDER}, + //{"_˾", sizeof("_˾"), FMMEMBER_INVITE}, + //{"_", sizeof("_"), FMMEMBER_BAILEE}, + //{"_", sizeof("_"), FMMEMBER_VICELEADER}, + + {"ս_%", sizeof("ս_%"), BATTLE_TYPE_NONE}, + {"ս_˹%", sizeof("ս_˹%"), BATTLE_TYPE_P_vs_E}, + {"ս_%", sizeof("ս_%"), BATTLE_TYPE_P_vs_P}, + {"ս_ֹ%", sizeof("ս_ֹ%"), BATTLE_TYPE_E_vs_E}, + {"ս_%", sizeof("ս_%"), BATTLE_TYPE_WATCH}, + {"ս_DP%", sizeof("ս_DP%"), BATTLE_TYPE_DP_BATTLE}, + {"ս_BOSS%", sizeof("ս_BOSS%"), BATTLE_TYPE_BOSS_BATTLE}, + + {"ս_%", sizeof("ս_%"), BATTLE_MODE_NONE}, + {"ս_%", sizeof("ս_%"), BATTLE_MODE_INIT}, + {"ս_%", sizeof("ս_%"), BATTLE_MODE_BATTLE}, + {"ս_%", sizeof("ս_%"), BATTLE_MODE_FINISH}, + {"ս_%", sizeof("ս_%"), BATTLE_MODE_STOP}, + {"ս_۳%", sizeof("ս_۳%"), BATTLE_MODE_WATCHBC}, + {"ս_1%", sizeof("ս_1%"), BATTLE_MODE_WATCHPRE}, + {"ս_2%", sizeof("ս_2%"), BATTLE_MODE_WATCHWAIT}, + {"ս_3%", sizeof("ս_3%"), BATTLE_MODE_WATCHMOVIE}, + {"ս_4%", sizeof("ս_4%"), BATTLE_MODE_WATCHAFTER}, + + {"Ů%", sizeof("Ů%"), CHAR_IMAGETYPE_GIRL}, + {"к%", sizeof("к%"), CHAR_IMAGETYPE_BOY}, + {"ͯ%", sizeof("ͯ%"), CHAR_IMAGETYPE_CHILDBOY}, + {"Ůͯ%", sizeof("Ůͯ%"), CHAR_IMAGETYPE_CHILDGIRL}, + {"%", sizeof("%"), CHAR_IMAGETYPE_MAN}, + {"Ů%", sizeof("Ů%"), CHAR_IMAGETYPE_WOMAN}, + {"%", sizeof("%"), CHAR_IMAGETYPE_OLDMAN}, + {"%", sizeof("%"), CHAR_IMAGETYPE_DOG}, + + {"_%", sizeof("_%"), CHAR_TYPEPLAYER}, + {"_%", sizeof("_%"), CHAR_TYPEENEMY}, + {"_%", sizeof("_%"), CHAR_TYPEPET}, + {"_NPC1%", sizeof("_NPC1%"), CHAR_TYPEDOOR}, + {"_NPC2%", sizeof("_NPC2%"), CHAR_TYPEBOX}, + {"_NPC3%", sizeof("_NPC3%"), CHAR_TYPEMSG}, + {"_NPC4%", sizeof("_NPC4%"), CHAR_TYPEWARP}, + {"_NPC5%", sizeof("_NPC5%"), CHAR_TYPESHOP}, + {"_NPC6%", sizeof("_NPC6%"), CHAR_TYPEHEALER}, + {"_NPC7%", sizeof("_NPC7%"), CHAR_TYPEOLDMAN}, + {"_NPC8%", sizeof("_NPC8%"), CHAR_TYPEROOMADMIN}, + {"_NPC9%", sizeof("_NPC9%"), CHAR_TYPETOWNPEOPLE}, + {"_NPC10%", sizeof("_NPC10%"), CHAR_TYPEDENGON}, + {"_NPC11%", sizeof("_NPC11%"), CHAR_TYPEADM}, + {"_NPC12%", sizeof("_NPC12%"), CHAR_TYPETEMPLE}, + {"_NPC13%", sizeof("_NPC13%"), CHAR_TYPESTORYTELLER}, + {"_NPC14%", sizeof("_NPC14%"), CHAR_TYPERANKING}, + {"_NPC15%", sizeof("_NPC15%"), CHAR_TYPEOTHERNPC}, + {"_NPC16%", sizeof("_NPC16%"), CHAR_TYPEPRINTPASSMAN}, + {"_NPC17%", sizeof("_NPC17%"), CHAR_TYPENPCENEMY}, + {"_NPC18%", sizeof("_NPC18%"), CHAR_TYPEACTION}, + {"_NPC19%", sizeof("_NPC19%"), CHAR_TYPEWINDOWMAN}, + {"_NPC20%", sizeof("_NPC20%"), CHAR_TYPESAVEPOINT}, + {"_NPC21%", sizeof("_NPC21%"), CHAR_TYPEWINDOWHEALER}, + {"_NPC22%", sizeof("_NPC22%"), CHAR_TYPEITEMSHOP}, + {"_NPC23%", sizeof("_NPC23%"), CHAR_TYPESTONESHOP}, + {"_NPC24%", sizeof("_NPC24%"), CHAR_TYPEDUELRANKING}, + {"_NPC25%", sizeof("_NPC25%"), CHAR_TYPEWARPMAN}, + {"_NPC26%", sizeof("_NPC26%"), CHAR_TYPEEVENT}, + {"_NPC27%", sizeof("_NPC27%"), CHAR_TYPEMIC}, + {"_NPC28%", sizeof("_NPC28%"), CHAR_TYPELUCKYMAN}, + {"_NPC29%", sizeof("_NPC29%"), CHAR_TYPEBUS}, + {"_NPC30%", sizeof("_NPC30%"), CHAR_TYPECHARM}, + {"_NPC31%", sizeof("_NPC31%"), CHAR_TYPECHECKMAN}, + {"_NPC32%", sizeof("_NPC32%"), CHAR_TYPEJANKEN}, + {"_NPC33%", sizeof("_NPC33%"), CHAR_TYPETRANSMIGRATION}, + {"_NPC34%", sizeof("_NPC34%"), CHAR_TYPEFMWARPMAN}, + {"_NPC35%", sizeof("_NPC35%"), CHAR_TYPEFMSCHEDULEMAN}, + {"_NPC36%", sizeof("_NPC36%"), CHAR_TYPEMANORSCHEDULEMAN}, +#ifdef _SERVICE + {"_NPC37%", sizeof("_NPC37%"), CHAR_TYPESTONESERVICEMAN}, +#endif +#ifdef _GAMBLE_BANK + {"_NPC38%", sizeof("_NPC38%"), CHAR_GAMBLEBANK}, +#endif +#ifdef _NEW_WARPMAN + {"_NPC39%", sizeof("_NPC39%"), CHAR_NEWNPCMAN}, +#endif +#ifdef _MARKET_TRADE + {"_NPC40%", sizeof("_NPC40%"), CHAR_MAPTRADEMAN}, +#endif +#ifdef _GAMBLE_ROULETTE + {"_NPC41%", sizeof("_NPC41%"), CHAR_GAMBLEROULETTE}, + {"_NPC42%", sizeof("_NPC42%"), CHAR_GAMBLEMASTER}, +#endif +#ifdef _TRANSER_MAN + {"_NPC43%", sizeof("_NPC43%"), CHAR_TRANSERMANS}, +#endif +#ifdef _JZ_NEW_ADDMEMBERPOINT + {"_NPC44%", sizeof("_NPC44%"), CHAR_MEMBERMANS}, +#endif +#ifdef _NPC_SELLSTH + {"_NPC45%", sizeof("_NPC45%"), CHAR_SELLSTHMAN}, +#endif +#ifdef _NPC_MAKEPAIR + {"_NPC46%", sizeof("_NPC46%"), CHAR_MAKEPAIR}, +#endif +#ifdef _NPC_FUSION + {"_NPC47%", sizeof("_NPC47%"), CHAR_PETFUSIONMAN}, +#endif +#ifdef _PAUCTION_MAN + {"_NPC48%", sizeof("_NPC48%"), CHAR_PAUCTIONMAN}, +#endif +#ifdef _ITEM_NPCCHANGE + {"_NPC49%", sizeof("_NPC49%"), CHAR_ITEMCHANGENPC}, +#endif +#ifdef _CFREE_petskill + {"_NPC50%", sizeof("_NPC50%"), CHAR_FREESKILLSHOP}, +#endif +#ifdef _PETRACE + {"_NPC51%", sizeof("_NPC51%"), CHAR_PETRACEMASTER}, + {"_NPC52%", sizeof("_NPC52%"), CHAR_PETRACEPET}, +#endif +#ifdef _AUCTIONEER + {"_NPC53%", sizeof("_NPC53%"), CHAR_TYPEAUCTIONEER}, +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + {"_NPC54%", sizeof("_NPC54%"), CHAR_TYPEALLDOMAN}, +#endif + {"_NPC55%", sizeof("_NPC55%"), CHAR_TYPEPETMAKER}, +#ifdef _NPC_WELFARE + {"_NPC56%", sizeof("_NPC56%"), CHAR_TYPEWELFARE}, +#endif +#ifdef _NPC_VERYWELFARE + {"_NPC57%", sizeof("_NPC57%"), CHAR_TYPEVERYWELFARE}, +#endif +#ifdef _NPC_WELFARE_2 // WON ADD ְҵNPC-2 + {"_NPC58%", sizeof("_NPC58%"), CHAR_TYPEWELFARE2}, +#endif +#ifdef _RACEMAN + {"_NPC59%", sizeof("_NPC59%"), CHAR_RACEMAN}, +#endif + + {"_û%", sizeof("_û%"), OBJTYPE_NOUSE}, + {"_%", sizeof("_%"), OBJTYPE_CHARA}, + {"_%", sizeof("_%"), OBJTYPE_ITEM}, + {"_%", sizeof("_%"), OBJTYPE_GOLD}, +#ifdef _NPCSERVER_NEW + {"_NPC%", sizeof("_NPC%"), OBJTYPE_NPCSCHARA}, +#endif +#ifdef _MAP_WARPPOINT + {"_%", sizeof("_%"), OBJTYPE_WARPPOINT}, +#endif + + {"ť_û%", sizeof("ť_û%"), WINDOW_BUTTONTYPE_NONE}, + {"ť_ȷ%", sizeof("ť_ȷ%"), WINDOW_BUTTONTYPE_OK}, + {"ť_ر%", sizeof("ť_ر%"), WINDOW_BUTTONTYPE_CANCEL}, + {"ť_%", sizeof("ť_%"), WINDOW_BUTTONTYPE_YES}, + {"ť_%", sizeof("ť_%"), WINDOW_BUTTONTYPE_NO}, + {"ť_һҳ%", sizeof("ť_һҳ%"), WINDOW_BUTTONTYPE_PREV}, + {"ť_һҳ%", sizeof("ť_һҳ%"), WINDOW_BUTTONTYPE_NEXT}, + + {"_û%", sizeof("_û%"), CHAR_PARTY_NONE}, + {"_ӳ%", sizeof("_ӳ%"), CHAR_PARTY_LEADER}, + {"_Ա%", sizeof("_Ա%"), CHAR_PARTY_CLIENT}, + + {"%", sizeof("%"), 0}, + {"%", sizeof("%"), 1}, + {"%", sizeof("%"), 2}, + {"%", sizeof("%"), 3}, + {"%", sizeof("%"), 4}, + {"%", sizeof("%"), 5}, + {"%", sizeof("%"), 6}, + {"%", sizeof("%"), 7}, + + {"ɫ%", sizeof("ɫ%"), CHAR_COLORWHITE}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORCYAN}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORPURPLE}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORBLUE}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORYELLOW}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORGREEN}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORRED}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORGRAY}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORBLUE2}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORGREEN2}, + {"ɫ%", sizeof("ɫ%"), CHAR_COLORBLACK}, + + {"Ӹ_OBJ%", sizeof("Ӹ_OBJ%"), CHAR_N_STRING_OBJINDEX}, + {"Ӹ_LV%", sizeof("Ӹ_LV%"), CHAR_N_STRING_LV}, + {"Ӹ_MAXHP%", sizeof("Ӹ_MAXHP%"), CHAR_N_STRING_MAXHP}, + {"Ӹ_HP%", sizeof("Ӹ_HP%"), CHAR_N_STRING_HP}, + {"Ӹ_MP%", sizeof("Ӹ_MP%"), CHAR_N_STRING_MP}, + {"Ӹ_%", sizeof("Ӹ_%"), CHAR_N_STRING_NAME}, + + {"3_HP%", sizeof("3_HP%"), CHAR_P_STRING_HP}, + {"3_MAXHP%", sizeof("3_MAXHP%"), CHAR_P_STRING_MAXHP}, + {"3_MP%", sizeof("3_MP%"), CHAR_P_STRING_MP}, + {"3_MAXMP%", sizeof("3_MAXMP%"), CHAR_P_STRING_MAXMP}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_VITAL}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_STR}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_TOUGH}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_DEX}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_EXP}, + {"3_һ%", sizeof("3_һ%"), CHAR_P_STRING_NEXTEXP}, + {"3_ȼ%", sizeof("3_ȼ%"), CHAR_P_STRING_LV}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_ATK}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_DEF}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_QUICK}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_CHARM}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_LUCK}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_EARTH}, + {"3_ˮ%", sizeof("3_ˮ%"), CHAR_P_STRING_WATER}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_FIRE}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_WIND}, + {"3_ʯ%", sizeof("3_ʯ%"), CHAR_P_STRING_GOLD}, + {"3_ƺ%", sizeof("3_ƺ%"), CHAR_P_STRING_TITLE}, + {"3_DP%", sizeof("3_DP%"), CHAR_P_STRING_DUELPOINT}, + {"3_ת%", sizeof("3_ת%"), CHAR_P_STRING_TRANSMIGRATION}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_NAME}, + {"3_dz%", sizeof("3_dz%"), CHAR_P_STRING_OWNTITLE}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_RIDEPET}, + {"3_ѧȼ%", sizeof("3_ѧȼ%"), CHAR_P_STRING_LEARNRIDE}, + {"3_%", sizeof("3_%"), CHAR_P_STRING_BASEBASEIMAGENUMBER}, + {"3_ģʽ%", sizeof("3_ģʽ%"), CHAR_P_STRING_SKYWALKER}, + {"3_ģʽ%", sizeof("3_ģʽ%"), CHAR_P_STRING_DEBUGMODE}, + + {NULL, 0, 0}, +}; + diff --git a/des.c b/des.c new file mode 100644 index 0000000..c8eeece --- /dev/null +++ b/des.c @@ -0,0 +1,244 @@ +////////////////////////////////////////////////////////////////////////// +/* + Provided by , Northeastern University (www.neu.edu.cn) + Email: blackdrn@sohu.com + This product is free for use. +*/ +////////////////////////////////////////////////////////////////////////// + +#include +#include "des.h" + +////////////////////////////////////////////////////////////////////////// + +// initial permutation IP +const static char IP_Table[64] = { + 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, + 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, + 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, + 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 +}; +// final permutation IP^-1 +const static char IPR_Table[64] = { + 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, + 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, + 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, + 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 +}; +// expansion operation matrix +static const char E_Table[48] = { + 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, + 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, + 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, + 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 +}; +// 32-bit permutation function P used on the output of the S-boxes +const static char P_Table[32] = { + 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, + 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 +}; +// permuted choice table (key) +const static char PC1_Table[56] = { + 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, + 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, + 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, + 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 +}; +// permuted choice key (table) +const static char PC2_Table[48] = { + 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 +}; +// number left rotations of pc1 +const static char LOOP_Table[16] = { + 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1 +}; +// The (in)famous S-boxes +const static char S_Box[8][4][16] = { + // S1 + 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, + 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, + 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, + 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, + // S2 + 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, + 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, + 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, + 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, + // S3 + 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, + 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, + 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, + 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, + // S4 + 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, + 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, + 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, + 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, + // S5 + 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, + 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, + 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, + 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, + // S6 + 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, + 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, + 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, + 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, + // S7 + 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, + 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, + 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, + 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, + // S8 + 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, + 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, + 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, + 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 +}; + +////////////////////////////////////////////////////////////////////////// + +typedef bool (*PSubKey)[16][48]; + +////////////////////////////////////////////////////////////////////////// + +static void DES(char Out[8], char In[8], const PSubKey pSubKey, bool Type);//׼DES/ +static void SetKey(const char* Key, int len);// Կ +static void SetSubKey(PSubKey pSubKey, const char Key[8]);// Կ +static void F_func(bool In[32], const bool Ki[48]);// f +static void S_func(bool Out[32], const bool In[48]);// S д +static void Transform(bool *Out, bool *In, const char *Table, int len);// 任 +static void Xor(bool *InA, const bool *InB, int len);// +static void RotateL(bool *In, int len, int loop);// ѭ +static void ByteToBit(bool *Out, const char *In, int bits);// ֽתλ +static void BitToByte(char *Out, const bool *In, int bits);// λתֽ + +////////////////////////////////////////////////////////////////////////// + +static bool SubKey[2][16][48];// 16ȦԿ +static bool Is3DES;// 3DES־ +static char Tmp[256], deskey[16]; + +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Code starts from Line 130 +////////////////////////////////////////////////////////////////////////// +bool Des_Go(char *Out, char *In, long datalen, const char *Key, int keylen, bool Type) +{ + if( !( Out && In && Key && (datalen=(datalen+7)&0xfffffff8) ) ) + return false; + SetKey(Key, keylen); + if( !Is3DES ) { // 1DES + long i,j; + for(i=0,j=datalen>>3; i>3; i16?16:len); + SetSubKey(&SubKey[0], &deskey[0]); + Is3DES = len>8 ? (SetSubKey(&SubKey[1], &deskey[8]), true) : false; +} +void DES(char Out[8], char In[8], const PSubKey pSubKey, bool Type) +{ + static bool M[64], tmp[32], *Li=&M[0], *Ri=&M[32]; + ByteToBit(M, In, 64); + Transform(M, M, IP_Table, 64); + if( Type == ENCRYPT ){ + int i; + for(i=0; i<16; ++i) { + memcpy(tmp, Ri, 32); + F_func(Ri, (*pSubKey)[i]); + Xor(Ri, Li, 32); + memcpy(Li, tmp, 32); + } + }else{ + int i; + for(i=15; i>=0; --i) { + memcpy(tmp, Li, 32); + F_func(Li, (*pSubKey)[i]); + Xor(Li, Ri, 32); + memcpy(Ri, tmp, 32); + } + } + Transform(M, M, IPR_Table, 64); + BitToByte(Out, M, 64); +} +void SetSubKey(PSubKey pSubKey, const char Key[8]) +{ + static bool K[64], *KL=&K[0], *KR=&K[28]; + ByteToBit(K, Key, 64); + Transform(K, K, PC1_Table, 56); + int i; + for(i=0; i<16; ++i) { + RotateL(KL, 28, LOOP_Table[i]); + RotateL(KR, 28, LOOP_Table[i]); + Transform((*pSubKey)[i], K, PC2_Table, 48); + } +} +void F_func(bool In[32], const bool Ki[48]) +{ + static bool MR[48]; + Transform(MR, In, E_Table, 48); + Xor(MR, Ki, 48); + S_func(In, MR); + Transform(In, In, P_Table, 32); +} +void S_func(bool Out[32], const bool In[48]) +{ + char i,j,k; + for(i=0; i<8; ++i,In+=6,Out+=4) { + j = (In[0]<<1) + In[5]; + k = (In[1]<<3) + (In[2]<<2) + (In[3]<<1) + In[4]; + ByteToBit(Out, &S_Box[i][j][k], 4); + } +} +void Transform(bool *Out, bool *In, const char *Table, int len) +{ + int i; + for(i=0; i>3]>>(i&7)) & 1; +} +void BitToByte(char *Out, const bool *In, int bits) +{ + memset(Out, 0, bits>>3); + int i; + for(i=0; i>3] |= In[i]<<(i&7); +} +////////////////////////////////////////////////////////////////////////// +// Code ends at Line 231 +////////////////////////////////////////////////////////////////////////// diff --git a/function.c b/function.c new file mode 100644 index 0000000..cff1fdc --- /dev/null +++ b/function.c @@ -0,0 +1,924 @@ +#include "version.h" +#include +#include "common.h" +#include "util.h" +#include "char_event.h" +#include "char.h" +#include "item_event.h" +#include "magic.h" +#include "pet_event.h" +#include "npc_townpeople.h" +#include "npc_Dengon.h" +#include "npc_door.h" +#include "npc_healer.h" +#include "npc_oldman.h" +#include "npc_warp.h" +#include "npc_storyteller.h" +#include "npc_msg.h" +#include "npc_npcenemy.h" +#include "npc_action.h" +#include "npc_windowman.h" +#include "npc_savepoint.h" +#include "npc_windowhealer.h" +#include "npc_itemshop.h" +#ifdef _VIGOR_SYS +#include "npc_vigorshop.h" +#endif +#include "npc_sysinfo.h" +#include "npc_duelranking.h" +#include "npc_petskillshop.h" +#ifdef _PETSKILL_DEL_SHOP +#include "npc_petskilldelshop.h" +#endif +#include "npc_petshop.h" +#include "npc_signboard.h" +#include "npc_warpman.h" +#include "npc_exchangeman.h" +#include "petmail.h" +#include "npc_timeman.h" +#include "npc_bodylan.h" +#include "npc_mic.h" +#include "npc_luckyman.h" +#include "npc_bus.h" +#include "npc_charm.h" +#include "npc_poolitemshop.h" +#include "npc_quiz.h" +#include "npc_checkman.h" +#include "npc_janken.h" +#include "npc_transmigration.h" +#include "battle_event.h" +#include "enemy.h" +// Robin 0517 +#include "npc_familyman.h" +#include "npc_bankman.h" +// add code by shan +#include "npc_fmdengon.h" +#include "npc_fmhealer.h" +#include "npc_petmaker.h" +#ifdef _FMRANK_POINT +#include "npc_fmrank.h" +#endif +// CoolFish: Family 2001/6/4 +#include "npc_fmwarpman.h" +#include "npc_fmpkman.h" +#include "npc_fmpkcallman.h" + +// Arminius 7.7 Airplane +#include "npc_airplane.h" + +// Arminius 7.13 Scheduleman +#include "npc_scheduleman.h" + +// Arminius 7.24 manor scheduleman +#include "npc_manorsman.h" + +// Robin 0725 +#include "npc_riderman.h" +#include "npc_fmletter.h" + +#ifdef _GAMBLE_BANK +#include "npc_gamblebank.h" +#endif +#ifdef _NEW_WARPMAN +#include "npc_newnpcman.h" +#endif + +#ifdef _GAMBLE_ROULETTE +#include "npc_gambleroulette.h" +#include "npc_gamblemaster.h" +#endif + +#ifdef _TRANSER_MAN +#include "npc_transerman.h" +#endif + +#ifdef _VIP_SHOP +#include "npc_vipshop.h" +//#include "npc_vippoint.h" +#include "npc_newvipshop.h" +#endif +#ifdef _RMB_SYSTEM +#include "npc_rmbshop.h" +#endif +#ifdef _STU_SYS +#include "npc_stushop.h" +#endif +#ifdef _NPC_ITEMUP +#include "npc_itemup.h" +#endif +#ifdef _AUTO_PK +#include "npc_autopk.h" +#endif +#ifdef _CFREE_petskill +#include "npc_freepetskillshop.h" +#endif + +#ifdef _PETRACE +#include "npc_petracemaster.h" +#include "npc_petracepet.h" +#endif + +#ifdef _ITEM_NPCCHANGE +#include "npc_itemchange.h" +#endif + +#ifdef _NPC_MAKEPAIR +#include "npc_makepair.h" +#endif + +#ifdef _NPC_FUSION +#include "npc_petfusion.h" +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC +#include "npc_alldoman.h" +#endif + +#ifdef _NPC_WELFARE +#include "npc_welfare.h" +#endif +#ifdef _JZ_NEWSCRIPT_LUA +#include "npc_lua_interface.h" +#endif +#ifdef _FM_NPC_LOOK_WAR +#include "npc_fmlookwar.h" +#endif +#ifdef _FM_NPC_LOOK_WAR1 +#include "npc_fmlookwar1.h" +#endif +//#define DEBUG +#include "npc_itemvippointshop.h" +typedef struct tagCorrespondStringAndFunctionTable +{ + STRING32 functionName; + void* functionPointer; + int hashcode; +}CorrespondStringAndFunctionTable; + +static CorrespondStringAndFunctionTable +correspondStringAndFunctionTable[]= +{ + { {"core_PreWalk"}, CHAR_allprewalk, 0 }, + { {"core_PostWalk"}, CHAR_allpostwalk, 0 }, + { {"core_Loop"}, CHAR_loopFunc, 0 }, + { {"core_Dying"}, CHAR_die, 0 }, + { {"core_PlayerWatch"}, CHAR_playerWatchfunc, 0 }, + { {"core_PlayerTalked"}, CHAR_playerTalkedfunc, 0 }, + + + { {"MedicineInit"}, ITEM_MedicineInit, 0 }, + { {"MedicineUsed"}, ITEM_MedicineUsed, 0 }, + { {"SandClockDetach"}, ITEM_SandClockDetach, 0 }, + { {"addTitleAttach"}, ITEM_addTitleAttach, 0 }, + { {"delTitleDetach"}, ITEM_delTitleDetach, 0 }, + { {"ITEM_DeleteByWatched"}, ITEM_DeleteByWatched, 0 }, + { {"ITEM_DeleteTimeWatched"}, ITEM_DeleteTimeWatched, 0 }, + { {"ITEM_useEffectTohelos"}, ITEM_useEffectTohelos, 0 }, + +// { {"ITEM_useHpRecovery"}, ITEM_useHpRecovery, 0 }, + { {"ITEM_useRecovery"}, ITEM_useRecovery, 0 }, +#ifdef _ITEM_MAGICRECOVERY + { {"ITEM_useMRecovery"}, ITEM_useMRecovery, 0 }, +#endif +#ifdef _ITEM_USEMAGIC + { {"ITEM_useMagic"}, ITEM_useMagic, 0 }, +#endif + { {"ITEM_useStatusChange"}, ITEM_useStatusChange, 0 }, + { {"ITEM_useStatusRecovery"}, ITEM_useStatusRecovery, 0 }, + { {"ITEM_useMagicDef"}, ITEM_useMagicDef, 0 }, + { {"ITEM_useParamChange"}, ITEM_useParamChange, 0 }, + { {"ITEM_useFieldChange"}, ITEM_useFieldChange, 0 }, + { {"ITEM_useAttReverse"}, ITEM_useAttReverse, 0 }, + { {"ITEM_useRessurect"}, ITEM_useRessurect, 0 }, + { {"ITEM_useMic"}, ITEM_useMic, 0 }, + { {"ITEM_dropMic"}, ITEM_dropMic, 0 }, + { {"ITEM_useCaptureUp"}, ITEM_useCaptureUp, 0 }, + { {"ITEM_useRenameItem"}, ITEM_useRenameItem, 0 }, + { {"ITEM_pickupDice"}, ITEM_pickupDice, 0 }, + { {"ITEM_dropDice"}, ITEM_dropDice, 0 }, + { {"ITEM_initLottery"}, ITEM_initLottery, 0 }, + { {"ITEM_useLottery"}, ITEM_useLottery, 0 }, + { {"ITEM_useWarp"}, ITEM_useWarp, 0 }, + { {"ITEM_petFollow"}, ITEM_petFollow, 0 }, + { {"ITEM_useSkup"}, ITEM_useSkup, 0 }, // Nuke 0624: Hero's bless + { {"ITEM_useNoenemy"}, ITEM_useNoenemy, 0 }, // Nuke 0626: Dragon's help + { {"ITEM_equipNoenemy"},ITEM_equipNoenemy, 0 }, // Arminius 7.2 Ra's amulet + { {"ITEM_remNoenemy"}, ITEM_remNoenemy, 0 }, // Arminius 7.2 Ra's amulet + { {"ITEM_useEncounter"}, ITEM_useEncounter, 0}, // Arminius 7.31 cursed stone + + { {"ITEM_AddPRSkillPoint"}, ITEM_AddPRSkillPoint, 0}, + { {"ITEM_AddPRSkillPercent"}, ITEM_AddPRSkillPercent, 0}, + +#ifdef _ITEM_METAMO + { {"ITEM_metamo"}, ITEM_metamo, 0 }, + { {"ITEM_ColorMetamo"}, ITEM_ColorMetamo, 0 }, + { {"ITEM_CharaMetamo"}, ITEM_CharaMetamo, 0 }, + { {"ITEM_SexMetamo"}, ITEM_SexMetamo, 0 }, +#endif + +#ifdef _USEWARP_FORNUM + { {"ITEM_useWarpForNum"}, ITEM_useWarpForNum, 0 }, +#endif + +#ifdef _IMPRECATE_ITEM + { {"ITEM_useImprecate"}, ITEM_useImprecate, 0 }, +#endif +#ifdef _ITEM_FIRECRACKER //Terry add 2001/12/21 + { {"ITEM_firecracker"}, ITEM_firecracker, 0 }, +#endif +#ifdef _ITEM_CRACKER //vincent + { {"ITEM_Cracker"}, ITEM_Cracker, 0 }, +#endif +#ifdef _ITEM_ADDEXP //vincent + { {"ITEM_Addexp"}, ITEM_Addexp, 0 }, +#endif +#ifdef _ITEM_REFRESH //vincent 쳣״̬ + { {"ITEM_Refresh"}, ITEM_Refresh, 0 }, +#endif + + { {"ITEM_WearEquip"}, ITEM_WearEquip, 0 }, + { {"ITEM_ReWearEquip"}, ITEM_ReWearEquip, 0 }, + +#ifdef _ITEM_CONSTITUTION + { {"ITEM_Constitution"}, ITEM_Constitution, 0 }, +#endif + +#ifdef _Item_ReLifeAct + { {"ITEM_DIErelife"}, ITEM_DIErelife, 0 }, +#endif + +#ifdef _ITEM_ORNAMENTS + { {"ITEM_PutOrnaments"}, ITEM_PutOrnaments, 0}, +#endif +#ifdef _CHIKULA_STONE + { {"ITEM_ChikulaStone"}, ITEM_ChikulaStone, 0}, +#endif + +#ifdef _THROWITEM_ITEMS + { {"ITEM_ThrowItemBox"}, ITEM_ThrowItemBox, 0}, +#endif + +#ifdef _ITEM_WATERWORDSTATUS + { {"ITEM_WaterWordStatus"}, ITEM_WaterWordStatus, 0}, +#endif + +#ifdef _ITEM_LOVERPARTY + { {"ITEM_LoverSelectUser"}, ITEM_LoverSelectUser, 0}, +#endif + +#ifdef _Item_MoonAct + { {"ITEM_randEnemyEquipOne"}, ITEM_randEnemyEquipOne, 0 }, + + { {"ITEM_randEnemyEquip"}, ITEM_randEnemyEquip, 0 }, + { {"ITEM_RerandEnemyEquip"}, ITEM_RerandEnemyEquip, 0}, +#endif + +#ifdef _SUIT_ITEM + { {"ITEM_suitEquip"}, ITEM_suitEquip, 0 }, + { {"ITEM_ResuitEquip"}, ITEM_ResuitEquip, 0 }, +#endif + +#ifdef _Item_DeathAct + { {"ITEM_useDeathcounter"}, ITEM_UseDeathCounter, 0 }, +#endif +#ifdef _FEV_ADD_NEW_ITEM // FEV ADD Ӹؾ + { {"ITEM_ResAndDef"} , ITEM_ResAndDef, 0 }, +#endif + +#ifdef _CHRISTMAS_REDSOCKS + { {"ITEM_useMaxRedSocks"}, ITEM_useMaxRedSocks, 0 }, +#endif + +#ifdef _CHRISTMAS_REDSOCKS_NEW + { {"ITEM_useMaxRedSocksNew"}, ITEM_useMaxRedSocksNew, 0 }, +#endif + +#ifdef _PETSKILL_CANNEDFOOD + { {"ITEM_useSkillCanned"}, ITEM_useSkillCanned, 0}, +#endif + +#ifdef _NEW_RIDEPETS + { {"ITEM_useLearnRideCode"}, ITEM_useLearnRideCode, 0 }, +#endif + +#ifdef _EQUIT_DEFMAGIC + { {"ITEM_MagicEquitWear"}, ITEM_MagicEquitWear, 0 }, + { {"ITEM_MagicEquitReWear"}, ITEM_MagicEquitReWear, 0 }, +#endif +#ifdef _EQUIT_RESIST + { {"ITEM_MagicResist"}, ITEM_MagicResist, 0 }, + { {"ITEM_MagicReResist"}, ITEM_MagicReResist, 0 }, +#endif + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + { {"ITEM_P_MagicEquitWear"}, ITEM_P_MagicEquitWear, 0 }, + { {"ITEM_P_MagicEquitReWear"}, ITEM_P_MagicEquitReWear, 0 }, +#endif + +#ifdef _ANGEL_SUMMON + { {"ITEM_AngelToken"}, ITEM_AngelToken, 0 }, + { {"ITEM_HeroToken"}, ITEM_HeroToken, 0 }, +#endif +#ifdef _HALLOWEEN_EFFECT + { {"ITEM_MapEffect"}, ITEM_MapEffect, 0 }, +#endif + + { {"ITEM_changePetOwner"}, ITEM_changePetOwner, 0 }, + + { {"ITEM_useDelRenameItem"}, ITEM_useDelRenameItem, 0 }, + + { {"ITEM_DANMM"}, ITEM_DANMM, 0 }, + + { {"core_PetWatch"}, PET_Watchfunc, 0 }, + { {"PETMAIL_Loop"}, PETMAIL_Loopfunc, 0 }, +#ifdef _USER_CHARLOOPS + { {"CHAR_BattleStayLoop"}, CHAR_BattleStayLoop, 0 }, + { {"PET_CheckIncubateLoop"}, PET_CheckIncubate, 0 }, +#endif + +#ifdef _PETSKILL_PROPERTY + { {"PET_PetskillPropertyEvent"}, PET_PetskillPropertyEvent, 0 }, +#endif + { {"core_PetTalk"}, PET_Talkfunc, 0}, // Arminius 8.14 pet talk + + + /* warp */ + { {"WarpInit"}, NPC_WarpInit, 0 }, + { {"WarpPostOver"}, NPC_WarpPostOver, 0 }, + { {"WarpWatch"}, NPC_WarpWatch, 0 }, + + /* Dengon */ + { {"DengonInit"}, NPC_DengonInit, 0 }, + { {"DengonWindowTalked"}, NPC_DengonWindowTalked, 0 }, + { {"DengonLooked"}, NPC_DengonLooked, 0 }, + + /* FmDengon add code by shan */ + { {"FmDengonInit"}, NPC_FmDengonInit, 0 }, + { {"FmDengonWindowTalked"}, NPC_FmDengonWindowTalked, 0 }, + { {"FmDengonLooked"}, NPC_FmDengonLooked, 0 }, + + /* Healer */ + { {"HealerInit"} , NPC_HealerInit, 0 }, + { {"HealerTalked"} , NPC_HealerTalked , 0 }, + + /* FMHealer add code by shan */ + { {"FmHealerInit"} , NPC_FmHealerInit, 0 }, + { {"FmHealerTalked"} , NPC_FmHealerTalked , 0 }, + + /* petmaker add code by shan */ + { {"PetMakerInit"} , NPC_PetMakerInit, 0 }, + { {"PetMakerTalked"} , NPC_PetMakerTalked , 0 }, + + /* TownPeople */ + { {"TownPeopleTalked"}, NPC_TownPeopleTalked, 0 }, + { {"TownPeopleInit"}, NPC_TownPeopleInit, 0 }, + + /* TownPeople */ + { {"MsgLooked"}, NPC_MsgLooked , 0 }, + { {"MsgInit"}, NPC_MsgInit, 0 }, + + /* Oldman */ + { {"OldmanInit"} , NPC_OldmanInit , 0 }, + { {"OldmanTalked"} , NPC_OldmanTalked , 0 }, + + /* SavePOint */ + { {"SavePointInit"} , NPC_SavePointInit , 0 }, + { {"SavePointTalked"} , NPC_SavePointTalked , 0 }, + { {"SavePointWindowTalked"}, NPC_SavePointWindowTalked, 0 }, + + /* StoryTeller */ + { {"StoryTellerInit"} , NPC_StoryTellerInit , 0 }, + { {"StoryTellerTalked"} , NPC_StoryTellerTalked , 0 }, + + /* NPCEnemy */ + { {"NPCEnemyInit"} , NPC_NPCEnemyInit , 0 }, + { {"NPCEnemyTalked"} , NPC_NPCEnemyTalked , 0 }, + { {"NPCEnemyWatch"} , NPC_NPCEnemyWatch , 0 }, + { {"NPCEnemyLoop"}, NPC_NPCEnemyLoop, 0 }, + { {"NPCEnemyWindowTalked"}, NPC_NPCEnemyWindowTalked, 0 }, + + /* ʧ */ + { {"ActionInit"} , NPC_ActionInit , 0 }, + { {"ActionTalked"} , NPC_ActionTalked , 0 }, + { {"ActionWatch"} , NPC_ActionWatch , 0 }, + + /* ū */ + { {"WindowmanInit"} , NPC_WindowmanInit , 0 }, + { {"WindowmanTalked"} , NPC_WindowmanTalked , 0 }, + { {"WindowmanLooked"}, NPC_WindowmanLooked, 0 }, + { {"WindowmanWindowTalked"}, NPC_WindowmanWindowTalked, 0 }, + + /* ūס¡ */ + { {"WindowHealerInit"} , NPC_WindowHealerInit , 0 }, + { {"WindowHealerTalked"} , NPC_WindowHealerTalked, 0 }, + { {"WindowHealerLooked"} , NPC_WindowHealerLooked, 0 }, + { {"WindowHealerWindowTalked"}, NPC_WindowHealerWindowTalked, 0 }, + + { {"ItemShopInit"} , NPC_ItemShopInit , 0 }, + { {"ItemShopTalked"} , NPC_ItemShopTalked , 0 }, + { {"ItemShopWindowTalked"}, NPC_ItemShopWindowTalked, 0 }, + + { {"ItemVippointShopInit"} , NPC_ItemVippointShopInit , 0 }, + { {"ItemVippointShopTalked"} , NPC_ItemVippointShopTalked , 0 }, + { {"ItemVippointShopWindowTalked"}, NPC_ItemVippointShopWindowTalked, 0 }, + + /* Sysinfo */ + { {"SysinfoInit"}, NPC_SysinfoInit, 0 }, + { {"SysinfoLoop"}, NPC_SysinfoLoop, 0 }, + { {"SysinfoTalked"} , NPC_SysinfoTalked , 0 }, + + { {"DuelrankingInit"} , NPC_DuelrankingInit , 0 }, + { {"DuelrankingLooked"}, NPC_DuelrankingLooked, 0 }, + { {"DuelrankingWindowTalked"}, NPC_DuelrankingWindowTalked, 0 }, + + { {"PetSkillShopInit"} , NPC_PetSkillShopInit , 0 }, + { {"PetSkillShopTalked"} , NPC_PetSkillShopTalked, 0 }, + { {"PetSkillShopLooked"} , NPC_PetSkillShopLooked, 0 }, + { {"PetSkillShopWindowTalked"}, NPC_PetSkillShopWindowTalked, 0 }, +#ifdef _PETSKILL_DEL_SHOP + { {"PetSkillDelShopInit"} , NPC_PetSkillDelShopInit , 0 }, + { {"PetSkillDelShopTalked"} , NPC_PetSkillDelShopTalked, 0 }, + { {"PetSkillDelShopLooked"} , NPC_PetSkillDelShopLooked, 0 }, + { {"PetSkillDelShopWindowTalked"}, NPC_PetSkillDelShopWindowTalked, 0 }, +#endif + { {"PetShopInit"} , NPC_PetShopInit, 0 }, + { {"PetShopTalked"} , NPC_PetShopTalked, 0 }, + { {"PetShopLooked"} , NPC_PetShopLooked, 0 }, + { {"PetShopWindowTalked"}, NPC_PetShopWindowTalked,0 }, + + { {"SignBoardInit"} , NPC_SignBoardInit, 0 }, + { {"SignBoardLooked"} , NPC_SignBoardLooked, 0 }, + { {"SignBoardWindowTalked"}, NPC_SignBoardWindowTalked, 0 }, + + /*Ѩ */ + { {"WarpManInit"}, NPC_WarpManInit, 0 }, + { {"WarpManTalked"}, NPC_WarpManTalked, 0 }, + { {"WarpManWatch"}, NPC_WarpManWatch, 0 }, + { {"WarpManLoop"} , NPC_WarpManLoop, 0 }, + { {"WarpManWindowTalked"}, NPC_WarpManWindowTalked,0 }, + + + { {"ExChangeManInit"}, NPC_ExChangeManInit, 0 }, + { {"ExChangeManTalked"}, NPC_ExChangeManTalked, 0 }, + { {"ExChangeManWindowTalked"}, NPC_ExChangeManWindowTalked,0 }, + + /*ةѨ */ + { {"TimeManInit"}, NPC_TimeManInit, 0 }, + { {"TimeManTalked"}, NPC_TimeManTalked, 0 }, + { {"TimeManWatch"} , NPC_TimeManWatch , 0 }, + + /* ʾū¼ء */ + { {"BodyLanInit"}, NPC_BodyLanInit, 0 }, + { {"BodyLanTalked"}, NPC_BodyLanTalked, 0 }, + { {"BodyLanWatch"} , NPC_BodyLanWatch , 0 }, + { {"BodyLanWindowTalked"} , NPC_BodyLanWindowTalked,0 }, + + /* Ѩ */ + { {"MicInit"}, NPC_MicInit, 0 }, + { {"MicTalked"}, NPC_MicTalked, 0 }, + + /* ƽѨ */ + { {"LuckyManInit"} , NPC_LuckyManInit , 0 }, + { {"LuckyManTalked"} , NPC_LuckyManTalked, 0 }, + { {"LuckyManWindowTalked"}, NPC_LuckyManWindowTalked, 0 }, + + /* */ + { {"BusInit"} , NPC_BusInit , 0 }, + { {"BusTalked"} , NPC_BusTalked , 0 }, + { {"BusLoop"} , NPC_BusLoop , 0 }, + + /* */ // Arminius 7.7 Airplane + { {"AirInit"} , NPC_AirInit , 0 }, + { {"AirTalked"} , NPC_AirTalked , 0 }, + { {"AirLoop"} , NPC_AirLoop , 0 }, + + { {"CharmInit"} , NPC_CharmInit , 0 }, + { {"CharmTalked"} , NPC_CharmTalked, 0 }, + { {"CharmWindowTalked"}, NPC_CharmWindowTalked, 0 }, + + { {"PoolItemShopInit"} , NPC_PoolItemShopInit , 0 }, + { {"PoolItemShopLoop"} , NPC_PoolItemShopLoop , 0 }, + { {"PoolItemShopTalked"} , NPC_PoolItemShopTalked , 0 }, + { {"PoolItemShopWindowTalked"}, NPC_PoolItemShopWindowTalked, 0 }, + + { {"QuizInit"} , NPC_QuizInit , 0 }, + { {"QuizTalked"} , NPC_QuizTalked, 0 }, + { {"QuizWindowTalked"}, NPC_QuizWindowTalked, 0 }, + + + /* ֮ */ + { {"CheckManInit"} , NPC_CheckManInit , 0 }, + { {"CheckManTalked"} , NPC_CheckManTalked, 0 }, + { {"CheckManWindowTalked"}, NPC_CheckManWindowTalked, 0 }, + + /* Ԫ */ + { {"JankenInit"} , NPC_JankenInit , 0 }, + { {"JankenTalked"} , NPC_JankenTalked, 0 }, + { {"JankenWindowTalked"}, NPC_JankenWindowTalked, 0 }, + + /* Ϸ */ + { {"TransmigrationInit"} , NPC_TransmigrationInit , 0 }, + { {"TransmigrationTalked"} , NPC_TransmigrationTalked, 0 }, + { {"TransmigrationWindowTalked"}, NPC_TransmigrationWindowTalked, 0 }, + + /* Family man */ + { {"FamilymanInit"} , NPC_FamilymanInit , 0 }, + { {"FamilymanTalked"} , NPC_FamilymanTalked, 0 }, + { {"FamilymanLooked"}, NPC_FamilymanLooked,0 }, + { {"FamilymanWindowTalked"}, NPC_FamilymanWindowTalked, 0 }, + + /* CoolFish: Family WarpMan 2001/6/6 */ + { {"FMWarpManInit"}, NPC_FMWarpManInit, 0 }, + { {"FMWarpManTalked"}, NPC_FMWarpManTalked, 0 }, + { {"FMWarpManLoop"} , NPC_FMWarpManLoop, 0 }, + { {"FMWarpManWindowTalked"}, NPC_FMWarpManWindowTalked, 0 }, + + /* CoolFish: Family PKMan 2001/7/4 */ + { {"FMPKManInit"}, NPC_FMPKManInit, 0 }, + { {"FMPKManTalked"}, NPC_FMPKManTalked, 0 }, + { {"FMPKManWindowTalked"}, NPC_FMPKManWindowTalked, 0 }, + + /* CoolFish: Family PKCallMan 2001/7/13 */ + { {"FMPKCallManInit"}, NPC_FMPKCallManInit, 0 }, + { {"FMPKCallManTalked"}, NPC_FMPKCallManTalked, 0 }, + { {"FMPKCallManWindowTalked"}, NPC_FMPKCallManWindowTalked, 0 }, + + /* Bank man */ + { {"BankmanInit"} , NPC_BankmanInit , 0 }, + { {"BankmanTalked"} , NPC_BankmanTalked, 0 }, + { {"BankmanLooked"}, NPC_BankmanLooked,0 }, + { {"BankmanWindowTalked"}, NPC_BankmanWindowTalked, 0 }, + + /* Arminius 7.13 scheduleman */ + { {"SchedulemanInit"}, NPC_SchedulemanInit, 0}, + { {"SchedulemanTalked"}, NPC_SchedulemanTalked, 0}, + { {"SchedulemanWindowTalked"}, NPC_SchedulemanWindowTalked, 0}, + { {"SchedulemanLoop"}, NPC_SchedulemanLoop, 0}, + + /* Arminius 7.24 manor scheduleman */ + { {"ManorSmanInit"}, NPC_ManorSmanInit, 0}, + { {"ManorSmanTalked"}, NPC_ManorSmanTalked, 0}, + { {"ManorSmanWindowTalked"}, NPC_ManorSmanWindowTalked, 0}, + { {"ManorSmanLoop"}, NPC_ManorSmanLoop, 0}, + + /* Rider man */ + { {"RidermanInit"} , NPC_RidermanInit , 0 }, + { {"RidermanTalked"} , NPC_RidermanTalked, 0 }, + { {"RidermanLooked"}, NPC_RidermanLooked,0 }, + { {"RidermanWindowTalked"}, NPC_RidermanWindowTalked, 0 }, + + /* FmLetter man */ + { {"FmLetterInit"} , NPC_FmLetterInit , 0 }, + { {"FmLetterTalked"} , NPC_FmLetterTalked, 0 }, + { {"FmLetterLooked"}, NPC_FmLetterLooked,0 }, + { {"FmLetterWindowTalked"}, NPC_FmLetterWindowTalked, 0 }, + + +#ifdef _GAMBLE_BANK // + { {"GambleBankInit"}, NPC_GambleBankInit, 0}, + { {"GambleBankLoop"}, NPC_GambleBankLoop,0}, + { {"GambleBankTalked"}, NPC_GambleBankTalked,0}, + { {"GambleBankWindowTalked"}, NPC_GambleBankWindowTalked,0}, +#endif + + +#ifdef _PET_LIMITLEVEL + { {"ITEM_useOtherEditBase"}, ITEM_useOtherEditBase, 0}, +#endif +#ifdef _ITEM_EDITBASES + { {"ITEM_useFusionEditBase"}, ITEM_useFusionEditBase, 0}, +#endif +#ifdef _GAMBLE_ROULETTE //ij + { {"GambleRouletteInit"}, NPC_Gamble_RouletteInit, 0}, + { {"GambleRouletteLoop"}, NPC_Gamble_RouletteLoop, 0}, + { {"GambleRouletteTalked"}, NPC_Gamble_RouletteTalked, 0}, + { {"GambleRouletteWindowTalked"}, NPC_Gamble_RouletteWindowTalked, 0}, + + { {"GambleMasterInit"}, NPC_Gamble_MasterInit, 0}, + { {"GambleMasterLoop"}, NPC_Gamble_MasterLoop, 0}, + { {"GambleMasterTalked"}, NPC_Gamble_MasterTalked, 0}, + { {"GambleMasterWindowTalked"}, NPC_Gamble_MasterWindowTalked, 0}, +#endif + +#ifdef _TRANSER_MAN + { {"TranserManInit"}, NPC_TranserManInit, 0 }, + { {"TranserManTalked"}, NPC_TranserManTalked, 0 }, + { {"TranserManLoop"} , NPC_TranserManLoop, 0 }, + { {"TranserManWindowTalked"}, NPC_TranserManWindowTalked, 0 }, +#endif +#ifdef _FM_NPC_LOOK_WAR + { {"FmLookWarManInit"}, NPC_FmLookWarManInit, 0 }, + { {"FmLookWarManTalked"}, NPC_FmLookWarManTalked, 0 }, + { {"FmLookWarManLoop"} , NPC_FmLookWarManLoop, 0 }, + { {"FmLookWarManWindowTalked"}, NPC_FmLookWarManWindowTalked, 0 }, +#endif +#ifdef _FM_NPC_LOOK_WAR1 + { {"FmLookWarMan1Init"}, NPC_FmLookWarMan1Init, 0 }, + { {"FmLookWarMan1Talked"}, NPC_FmLookWarMan1Talked, 0 }, + { {"FmLookWarMan1Loop"} , NPC_FmLookWarMan1Loop, 0 }, + { {"FmLookWarMan1WindowTalked"}, NPC_FmLookWarMan1WindowTalked, 0 }, +#endif +#ifdef _VIP_SHOP + { {"VipShopInit"}, NPC_VipshopInit, 0 }, + { {"VipShopTalked"}, NPC_VipshopTalked, 0 }, + { {"VipShopLoop"} , NPC_VipshopLoop, 0 }, + { {"VipShopWindowTalked"}, NPC_VipshopWindowTalked, 0 }, +#endif + +#ifdef _VIP_SHOP + { {"NewVipShopInit"}, NPC_NewVipshopInit, 0 }, + { {"NewVipShopTalked"}, NPC_NewVipshopTalked, 0 }, + { {"NewVipShopLoop"} , NPC_NewVipshopLoop, 0 }, + { {"NewVipShopWindowTalked"}, NPC_NewVipshopWindowTalked, 0 }, +#endif + +#ifdef _RMB_SYSTEM + { {"RmbShopInit"}, NPC_RmbshopInit, 0 }, + { {"RmbShopTalked"}, NPC_RmbshopTalked, 0 }, + { {"RmbShopLoop"} , NPC_RmbshopLoop, 0 }, + { {"RmbShopWindowTalked"}, NPC_RmbshopWindowTalked, 0 }, +#endif + +#ifdef _STU_SYS + { {"StuShopInit"}, NPC_StushopInit, 0 }, + { {"StuShopTalked"}, NPC_StushopTalked, 0 }, + { {"StuShopLoop"} , NPC_StushopLoop, 0 }, + { {"StuShopWindowTalked"}, NPC_StushopWindowTalked, 0 }, +#endif + +#ifdef _AUTO_PK + { {"AutoPkInit"}, NPC_AutoPkInit, 0 }, + { {"AutoPkTalked"}, NPC_AutoPkTalked, 0 }, + { {"AutoPkLoop"} , NPC_AutoPkLoop, 0 }, + { {"AutoPkWindowTalked"}, NPC_AutoPkWindowTalked, 0 }, +#endif +#ifdef _FMRANK_POINT + { {"FmRankInit"}, NPC_FmRankInit, 0 }, + { {"FmRankTalked"}, NPC_FmRankTalked, 0 }, + { {"FmRankLoop"} , NPC_FmRankLoop, 0 }, + { {"FmRankWindowTalked"}, NPC_FmRankWindowTalked, 0 }, +#endif +#ifdef _NPC_MAKEPAIR + { {"MakePairManInit"}, NPC_MakePairManInit, 0 }, + { {"MakePairManTalked"}, NPC_MakePairManTalked, 0 }, + { {"MakePairManLoop"} , NPC_MakePairManLoop, 0 }, + { {"MakePairManWindowTalked"}, NPC_MakePairManWindowTalked,0 }, +#endif +#ifdef _NPC_FUSION + { {"PetFusionManInit"}, NPC_PetFusionManInit, 0 }, + { {"PetFusionManTalked"}, NPC_PetFusionManTalked, 0 }, + { {"PetFusionManLoop"} , NPC_PetFusionManLoop, 0 }, + { {"PetFusionManWindowTalked"}, NPC_PetFusionManWindowTalked,0 }, +#endif +#ifdef _ITEM_NPCCHANGE + { {"ItemchangeManInit"}, NPC_ItemchangeManInit, 0 }, + { {"ItemchangeManTalked"}, NPC_ItemchangeManTalked, 0 }, + { {"ItemchangeManLoop"} , NPC_ItemchangeManLoop, 0 }, + { {"ItemchangeManWindowTalked"}, NPC_ItemchangeManWindowTalked, 0 }, +#endif +#ifdef _NPC_ITEMUP + { {"ItemupManInit"}, NPC_ItemupManInit, 0 }, + { {"ItemupManTalked"}, NPC_ItemupManTalked, 0 }, + { {"ItemupManLoop"} , NPC_ItemupManLoop, 0 }, + { {"ItemupManWindowTalked"}, NPC_ItemupManWindowTalked, 0 }, +#endif +#ifdef _CFREE_petskill + { {"FreePetSkillInit"} , NPC_FreePetSkillShopInit, 0 }, + { {"FreePetSkillTalked"} , NPC_FreePetSkillShopTalked, 0 }, + { {"FreePetSkillWindowTalked"}, NPC_FreePetSkillShopWindowTalked, 0 }, +#endif + +#ifdef _PETRACE // ᄎ + { {"PetRaceMasterInit"}, NPC_PetRaceMasterInit, 0}, + { {"PetRaceMasterLoop"}, NPC_PetRaceMasterLoop, 0}, + { {"PetRaceMasterTalked"}, NPC_PetRaceMasterTalked, 0}, + { {"PetRaceMasterWindowTalked"}, NPC_PetRaceMasterWindowTalked, 0}, + + { {"PetRacePetInit"}, NPC_PetRacePetInit, 0}, + { {"PetRacePetLoop"}, NPC_PetRacePetLoop, 0}, + { {"PetRacePetTalked"}, NPC_PetRacePetTalked, 0}, +#endif + +#ifdef _NEW_WARPMAN + { {"NewNpcManInit"}, NPC_NewNpcManInit, 0}, + { {"NewNpcManLoop"}, NPC_NewNpcManLoop, 0}, + { {"NewNpcManTalked"}, NPC_NewNpcManTalked, 0}, + { {"NewNpcManWindowTalked"}, NPC_NewNpcManWindowTalked, 0}, +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + { {"AlldomanInit"} , NPC_AlldomanInit, 0 }, + { {"AlldomanTalked"} , NPC_AlldomanTalked , 0 }, + { {"AlldomanWindowTalked"}, NPC_AlldomanWindowTalked , 0}, +#endif + +#ifdef _NPC_WELFARE + { {"WelfareInit"} , NPC_WelfareInit, 0 }, + { {"WelfareTalked"} , NPC_WelfareTalked , 0 }, + { {"WelfareWindowTalked"}, NPC_WelfareWindowTalked , 0}, +#endif +#ifdef _VIGOR_SYS + { {"ItemVigorShopInit"} , NPC_ItemVigorShopInit , 0 }, + { {"ItemVigorShopTalked"} , NPC_ItemVigorShopTalked , 0 }, + { {"ItemVigorShopWindowTalked"}, NPC_ItemVigorShopWindowTalked, 0 }, +#endif +#ifdef _TIME_TICKET + { {"ITEM_timeticket"}, ITEM_timeticket, 0}, +#endif + +#ifdef _ITEM_SETLOVER // Ʒ + { {"ITEM_SetLoverUser"}, ITEM_SetLoverUser, 0 }, + { {"ITEM_LoverWarp"}, ITEM_LoverWarp, 0 }, + { {"ITEM_LoverUnmarry"}, ITEM_LoverUnmarry, 0 }, + { {"ITEM_LoverForceUnmarry"}, ITEM_LoverForceUnmarry, 0 }, //ǿ +#endif + +#ifdef _GM_ITEM // GMƷ + { {"ITEM_GMFUNCTION"}, ITEM_GMFUNCTION, 0 }, +#endif + +#ifdef _VIP_SERVER // Ա + { {"ITEM_AddMemberPoint"}, ITEM_AddMemberPoint, 0 }, + { {"ITEM_AddVipPoint"}, ITEM_AddVipPoint, 0 }, +#endif +#ifdef _VIP_RIDE + { {"ITEM_VipRide"}, ITEM_VipRide, 0 }, +#endif +#ifdef _NEW_NAME //Զƺ + { {"ITEM_NewName"}, ITEM_NewName, 0 }, +#endif +#ifdef _FM_ITEM + { {"ITEM_AddFame"}, ITEM_AddFame, 0 }, +#endif +#ifdef _LUCK_ITEM + { {"ITEM_Luck"}, ITEM_Luck, 0 }, +#endif +#ifdef _FM_METAMO + { {"ITEM_MetamoTime"}, ITEM_MetamoTime, 0 }, +#endif +#ifdef _ITEM_GOLD + { {"ITEM_Gold"}, ITEM_Gold, 0 }, +#endif +#ifdef _MYSTERIOUS_GIFT + { {"ITEM_MysteriousGift"}, ITEM_MysteriousGift, 0 }, +#endif +#ifdef _BATTLE_PK + { {"ITEM_BattlePK"}, ITEM_BattlePK, 0 }, +#endif +#ifdef _SILENTZERO + { {"ITEM_SetSilentZero"}, ITEM_SetSilentZero, 0 }, +#endif +#ifdef _PET_LEVEL_ITEM + { {"ITEM_PetLevelItem"}, ITEM_PetLevelItem, 0 }, +#endif + +#ifdef _ITEM_EFMETAMO + { {"ITEM_efMetamo"}, ITEM_efMetamo, 0 }, +#endif +#ifdef _PET_BEATITUDE + { {"PET_BEATITUDE"}, PET_BEATITUDE, 0 }, +#endif +#ifdef _GET_MULTI_ITEM + { {"ITEM_GetMultiItem"}, ITEM_GetMultiItem, 0 }, +#endif + { {"ITEM_OldToNew"}, ITEM_OldToNew, 0 }, +#ifdef _SAFE_PASSWORD + { {"ITEM_ItemPetLocked"}, ITEM_ItemPetLocked, 0 }, +#endif +#ifdef _POINT_CARD + { {"ITEM_OnlineCost"}, ITEM_OnlineCost, 0 }, +#endif +#ifdef _SUPER_MAN_ITEM + { {"ITEM_SuperManItem"}, ITEM_SuperManItem, 0 }, +#endif + { {"ITEM_CharSave"}, ITEM_CharSave, 0 }, + { {"ITEM_NoDelWarp"}, ITEM_NoDelWarp, 0 }, + { {"ITEM_RandWarp"}, ITEM_RandWarp, 0 }, + { {"ITEM_RandMsg"}, ITEM_RandMsg, 0 }, +#ifdef _SQL_BUY_FUNC + { {"ITEM_OnlineBuy_recv"}, ITEM_OnlineBuy_recv, 0 }, +#endif +#ifdef _JOB_AUTOPK + { {"ITEM_JobPk"}, ITEM_JobPk, 0 }, +#endif + { {"ITEM_SeeEquip"}, ITEM_SeeEquip, 0 }, +#ifdef _VIGOR_SYS + { {"ITEM_VigorSave"}, ITEM_VigorSave, 0 }, +#endif +#ifdef _EV_NUM + { {"ITEM_EvItem"}, ITEM_EvItem, 0 }, +#endif +#ifdef _OFFLINE_SYSTEM + { {"ITEM_OFFLINE"}, ITEM_OFFLINE, 0 }, +#endif + { {"ITEM_AddProfessionLevel"}, ITEM_AddProfessionLevel, 0 }, +#ifdef _ZHIPIAO_SYSTEM + { {"ITEM_ZhiPiao"}, ITEM_ZhiPiao, 0 }, +#endif + { {"ITEM_useRandEditBase"}, ITEM_useRandEditBase, 0 }, +#ifdef _DP_ZHIPIAO_ITEM + { {"ITEM_DpZhiPiao"}, ITEM_DpZhiPiao, 0 }, +#endif + { {"ITEM_UpPointResetItem"}, ITEM_UpPointResetItem, 0 }, + { {"ITEM_MM"}, ITEM_MM, 0 }, +#ifdef _XC_CANGKU + { {"ITEM_ICK"}, ITEM_ICK, 0 }, + { {"ITEM_PCK"}, ITEM_PCK, 0 }, +#endif +#ifdef _SPECIAL_SUIT + { {"ITEM_SpecialSuitEquip"}, ITEM_SpecialSuitEquip, 0 }, + { {"ITEM_SpecialResuitEquip"}, ITEM_SpecialResuitEquip, 0 }, +#endif +#ifdef _NULL_CHECK_ITEM + { {"ITEM_NullCheck"}, ITEM_NullCheck, 0 }, +#endif +#ifdef _MANOR_EQUIP + { {"ITEM_ManorEquip"}, ITEM_ManorEquip, 0 }, + { {"ITEM_ReManorEquip"}, ITEM_ReManorEquip, 0 }, +#endif + { {"ITEM_MakePet"}, ITEM_MakePet, 0 }, + { {"PET_OTHERBEATITUDE"}, PET_OTHERBEATITUDE, 0 }, + { {"PET_MYBEATITUDE"}, PET_MYBEATITUDE, 0 }, + { {"ITEM_useExpLv"}, ITEM_useExpLv, 0 }, +#ifdef _ITEM_LUA + { {"ITEM_Lua"}, ITEM_Lua, 0 }, +#endif +#ifdef _JZ_NEWSCRIPT_LUA + { {FUNCNAME_INITCALLBACK} , NPC_Lua_InitCallBack, 0 }, + { {FUNCNAME_WALKPRECALLBACK} , NPC_Lua_WalkPreCallBack, 0 }, + { {FUNCNAME_WALKPOSTCALLBACK} , NPC_Lua_WalkPostCallBack, 0 }, + { {FUNCNAME_PREOVERCALLBACK} , NPC_Lua_PreOverCallBack, 0 }, + { {FUNCNAME_POSTOVERCALLBACK} , NPC_Lua_PostOverCallBack, 0 }, + { {FUNCNAME_WATCHCALLBACK} , NPC_Lua_WatchCallBack, 0 }, + { {FUNCNAME_LOOPCALLBACK} , NPC_Lua_LoopCallBack, 0 }, + { {FUNCNAME_TALKEDCALLBACK} , NPC_Lua_TalkedCallBack, 0 }, + { {FUNCNAME_OFFCALLBACK} , NPC_Lua_OFFCallBack, 0 }, + { {FUNCNAME_LOOKEDCALLBACK} , NPC_Lua_LookedCallBack, 0 }, + { {FUNCNAME_ITEMPUTCALLBACK} , NPC_Lua_ItemPutCallBack, 0 }, + { {FUNCNAME_WINDOWTALKEDCALLBACK} , NPC_Lua_WindowTalkedCallBack, 0 }, +#ifdef _USER_CHARLOOPS + { {FUNCNAME_CHARLOOPSCALLBACK} , NPC_Lua_CharLoopsCallBack, 0 }, + { {FUNCNAME_BATTLEPROPERTYCALLBACK} , NPC_Lua_BattleProPertyCallBack, 0 }, +#endif + + { {FUNCNAME_ITEMPEROVERCALLBACK} , NPC_Lua_ItemPerOverCallBack, 0 }, + { {FUNCNAME_ITEMPOSTOVERCALLBACK} , NPC_Lua_ItemPostOverCallBack, 0 }, + { {FUNCNAME_ITEMWATCHCALLBACK} , NPC_Lua_ItemWatchCallBack, 0 }, + { {FUNCNAME_ITEMUSECALLBACK} , NPC_Lua_ItemUseCallBack, 0 }, + { {FUNCNAME_ITEMATTACHCALLBACK} , NPC_Lua_ItemAttachCallBack, 0 }, + { {FUNCNAME_ITEMDETACHCALLBACK} , NPC_Lua_ItemDetachCallBack, 0 }, + { {FUNCNAME_ITEMDROPCALLBACK} , NPC_Lua_ItemDropCallBack, 0 }, + { {FUNCNAME_ITEMPICKUPCALLBACK} , NPC_Lua_ItemPickUPCallBack, 0 }, +#ifdef _Item_ReLifeAct + { {FUNCNAME_ITEMDIERELIFECALLBACK} , NPC_Lua_ItemDieReLifeCallBack, 0 }, +#endif + + { {FUNCNAME_BATTLEWINCALLBACK} , NPC_Lua_BattleWinCallBack, 0 }, + { {FUNCNAME_BATTLEENDCALLBACK} , NPC_Lua_BattleEndCallBack, 0 }, +#endif //_JZ_NEWSCRIPT_LUA +}; + +BOOL initFunctionTable( void ) +{ + + int i; + { + char* strings[arraysizeof(correspondStringAndFunctionTable)]; + int stringnum=0; + for( i=0 ; i $OUT +cat $IN | grep -e "^#define" | cut -b 9- | sed "s/\"/\'/g" | \ + sed 's/\\/\\\\/g' >> $OUT +echo "<>" >> $OUT +echo "by : zoro\n\";" >> $OUT \ No newline at end of file diff --git a/genver.sh b/genver.sh new file mode 100644 index 0000000..9d31d6b --- /dev/null +++ b/genver.sh @@ -0,0 +1,9 @@ +#!/bin/sh +IN=./include/version.h +OUT=./genver.h +touch main.c +echo "char *genver=\"" > $OUT +cat $IN | grep -e "^#define" | cut -b 9- | sed "s/\"/\'/g" | \ + sed 's/\\/\\\\/g' >> $OUT +echo "<>" >> $OUT +echo "by : zoro\n\";" >> $OUT \ No newline at end of file diff --git a/handletime.c b/handletime.c new file mode 100644 index 0000000..c416550 --- /dev/null +++ b/handletime.c @@ -0,0 +1,281 @@ +#define __HANDLETIME_C__ +#include "version.h" +#include +#include + +#include "common.h" +#include "handletime.h" + +#define LSTIME_SECONDS_PER_DAY 5400 /* LSTIME ϼ */ + + +#define LSTIME_HOURS_PER_DAY 1024 /* LSTIME ϼLSTIME */ +#define LSTIME_DAYS_PER_YEAR 100 /* LSTIME ϼLSTIME */ + + +/* +// Nuke 0701: localtime + + struct timeval NowTime; +#ifdef localtime +#undef localtime +#endif + +struct tm *localtime(const time_t *timep) +{ + static struct tm lt; + memset(<,0,sizeof(lt)); + lt.tm_sec=*timep %60; + lt.tm_min=(*timep %3600) / 60; + lt.tm_hour=(*timep % 86400) / 3600; + return < +} +*/ + +/*------------------------------------------------------------ + * ¦ + * ئ + * ߯Ի + ------------------------------------------------------------*/ +BOOL setNewTime( void ) +{ + if( gettimeofday( &NowTime, (struct timezone*)NULL) != 0 ) { + NowTime.tv_sec = time(0); + // Nuke 0701: Localtime down + print("\n time err !! \n"); + return FALSE; + } + NowTime.tv_sec += DEBUG_ADJUSTTIME; + return TRUE; +} + + +/******************************************************************* +*******************************************************************/ +static long era = (long)912766409 + 5400; + /* SAб */ +void RealTimeToLSTime(long t , LSTIME *lstime) +{ + long lsseconds = t - era; /* LS ռ */ + long lsdays; /* LS ռ */ + + lstime->year = (int)( lsseconds/(LSTIME_SECONDS_PER_DAY*LSTIME_DAYS_PER_YEAR) ); + + lsdays = lsseconds/LSTIME_SECONDS_PER_DAY;/* ռ ëңƻ */ + lstime->day = lsdays % LSTIME_DAYS_PER_YEAR;/* Ի ƥؤԻ */ + + + lstime->hour = (int)(lsseconds % LSTIME_SECONDS_PER_DAY ) + * LSTIME_HOURS_PER_DAY / LSTIME_SECONDS_PER_DAY; + + return; +} + +/******************************************************************* + LS޾Ѩ˼ޱ +*******************************************************************/ +void LSTimeToRealTime( LSTIME *lstime, long *t) +{ + *t=(long)( + ( lstime->hour*LSTIME_DAYS_PER_YEAR+lstime->day) /* */ + *LSTIME_HOURS_PER_DAY + + + lstime->year) + + + *450; + return; +} + +/******************************************************************* +*******************************************************************/ +LSTIME_SECTION getLSTime (LSTIME *lstime) +{ + if (NIGHT_TO_MORNING < lstime->hour + && lstime->hour <= MORNING_TO_NOON) + return LS_MORNING; + else if(NOON_TO_EVENING < lstime->hour + && lstime->hour <= EVENING_TO_NIGHT) + return LS_EVENING; + else if(EVENING_TO_NIGHT < lstime->hour + && lstime->hour <= NIGHT_TO_MORNING) + return LS_NIGHT; + else + return LS_NOON; +} + + +#ifdef _ASSESS_SYSEFFICACY +static clock_t TotalClock = 0; +static clock_t StartClock = 0; +//static int EndClock = 0; +//static float SysTime=0.0; +static clock_t EndClock = 0; +static double SysTime=0.0; +static int Cnum = 0; + +#ifdef _ASSESS_SYSEFFICACY_SUB +static clock_t Net_TotalClock = 0; +static clock_t NPCGEN_TotalClock = 0; +static clock_t Battle_TotalClock = 0; +static clock_t Char_TotalClock = 0; +static clock_t Petmail_TotalClock = 0; +static clock_t Family_TotalClock = 0; +static clock_t SaveCheck_TotalClock = 0; +static clock_t GMBroadCast_TotalClock = 0; +static double Net_SysTime=0.0; +static double NPCGEN_SysTime=0.0; +static double Battle_SysTime=0.0; +static double Char_SysTime=0.0; +static double Petmail_SysTime=0.0; +static double Family_SysTime=0.0; +static double SaveCheck_SysTime=0.0; +static double GMBroadCast_SysTime=0.0; +static clock_t SubStartClock = 0; +#endif + +void Assess_InitSysEfficacy() +{ + TotalClock = 0; + StartClock = 0; + EndClock = 0; +#ifdef _ASSESS_SYSEFFICACY_SUB + Net_TotalClock = 0; + NPCGEN_TotalClock = 0; + Battle_TotalClock = 0; + Char_TotalClock = 0; + Petmail_TotalClock = 0; + Family_TotalClock = 0; + SaveCheck_TotalClock = 0; + GMBroadCast_TotalClock = 0; + + SubStartClock = 0; +#endif +} + +void Assess_SysEfficacy( int flg) +{ + if( flg == 0 ){ + StartClock=clock(); + }else if( flg == 1 ){ + EndClock = clock(); + if( EndClock < StartClock ) return; + TotalClock += (int)(EndClock-StartClock); + Cnum++; + if( Cnum%500 == 0 ){ + SysTime = (float)(TotalClock/Cnum)/CLOCKS_PER_SEC; + TotalClock = 0; +#ifdef _ASSESS_SYSEFFICACY_SUB + Net_SysTime = (float)(Net_TotalClock/Cnum)/CLOCKS_PER_SEC; + Net_TotalClock = 0; + NPCGEN_SysTime = (float)(NPCGEN_TotalClock/Cnum)/CLOCKS_PER_SEC; + NPCGEN_TotalClock = 0; + Battle_SysTime = (float)(Battle_TotalClock/Cnum)/CLOCKS_PER_SEC; + Battle_TotalClock = 0; + Char_SysTime = (float)(Char_TotalClock/Cnum)/CLOCKS_PER_SEC; + Char_TotalClock = 0; + Petmail_SysTime = (float)(Petmail_TotalClock/Cnum)/CLOCKS_PER_SEC; + Petmail_TotalClock = 0; + Family_SysTime = (float)(Family_TotalClock/Cnum)/CLOCKS_PER_SEC; + Family_TotalClock = 0; + SaveCheck_SysTime = (float)(SaveCheck_TotalClock/Cnum)/CLOCKS_PER_SEC; + SaveCheck_TotalClock = 0; + GMBroadCast_SysTime = (float)(GMBroadCast_TotalClock/Cnum)/CLOCKS_PER_SEC; + GMBroadCast_TotalClock = 0; +#endif + Cnum = 0; + } + } + /* + EndClock = clock(); + if( StartClock != 0 ){ + if( EndClock < StartClock ) return; + TotalClock += (int)(EndClock-StartClock); + Cnum++; + if( Cnum%500 == 0 ){ + SysTime = (float)TotalClock/Cnum; + TotalClock = 0; + } + } + StartClock = EndClock; + */ +} + +void ASSESS_getSysEfficacy( float *TVsec) +{ + *TVsec = SysTime; +} + +#ifdef _ASSESS_SYSEFFICACY_SUB +void Assess_SysEfficacy_sub( int flg, int loop) +{ + + if( flg == 0 ){ + SubStartClock = clock(); + }else if( flg == 1 ){ + EndClock = clock(); + if( EndClock < SubStartClock ) return; + + switch( loop) { + case 1: // Net_TotalClock + Net_TotalClock += (int)(EndClock-SubStartClock); + break; + case 2: // NPCGEN_TotalClock + NPCGEN_TotalClock += (int)(EndClock-SubStartClock); + break; + case 3: // Battle_TotalClock + Battle_TotalClock += (int)(EndClock-SubStartClock); + break; + case 4: // Char_TotalClock + Char_TotalClock += (int)(EndClock-SubStartClock); + break; + case 5: // Petmail_TotalClock + Petmail_TotalClock += (int)(EndClock-SubStartClock); + break; + case 6: // Family_TotalClock + Family_TotalClock += (int)(EndClock-SubStartClock); + break; + case 7: // SaveCheck_TotalClock + SaveCheck_TotalClock += (int)(EndClock-SubStartClock); + break; + case 8: // GMBroadCast_TotalClock + GMBroadCast_TotalClock += (int)(EndClock-SubStartClock); + break; + } + } +} + +void ASSESS_getSysEfficacy_sub( float *TVsec, int loop_index) +{ + switch( loop_index) { + case 1: + *TVsec = Net_SysTime; + break; + case 2: + *TVsec = NPCGEN_SysTime; + break; + case 3: + *TVsec = Battle_SysTime; + break; + case 4: + *TVsec = Char_SysTime; + break; + case 5: + *TVsec = Petmail_SysTime; + break; + case 6: + *TVsec = Family_SysTime; + break; + case 7: + *TVsec = SaveCheck_SysTime; + break; + case 8: + *TVsec = GMBroadCast_SysTime; + break; + } +} + +#endif + +#endif + diff --git a/include/addressbook.h b/include/addressbook.h new file mode 100644 index 0000000..0723cf7 --- /dev/null +++ b/include/addressbook.h @@ -0,0 +1,45 @@ +#ifndef __ADDRESSBOOK_H__ +#define __ADDRESSBOOK_H__ + +#include "common.h" +#include "util.h" +#include "net.h" + +#define ADDRESSBOOK_MAX 80 + +typedef struct +{ + int use; + BOOL online; /* ƽҷ»ӡ TRUE, + ƥئFALSE */ + int level; /* ƽҷ¼ì */ + int duelpoint; /* duelpoint*/ + int graphicsno; /* ƽҷ¼ į */ + char cdkey[CDKEYLEN]; /* CD ϼ */ + char charname[CHARNAMELEN]; /* ƽҷ¼ */ + int transmigration; /* Ϸ */ + +} ADDRESSBOOK_entry; + + + + +char *ADDRESSBOOK_makeAddressbookString( ADDRESSBOOK_entry *a ); +BOOL ADDRESSBOOK_makeAddressbookEntry( char *in , ADDRESSBOOK_entry *a ); +BOOL ADDRESSBOOK_deleteEntry( int meindex ,int index ); +BOOL ADDRESSBOOK_addEntry( int meindex ); +BOOL ADDRESSBOOK_sendAddressbookTable( int cindex ); +BOOL ADDRESSBOOK_sendAddressbookTableOne( int cindex, int num ); +BOOL ADDRESSBOOK_sendMessage( int cindex, int aindex , char *text , + int color ); +BOOL ADDRESSBOOK_sendMessage_FromOther( char *fromcdkey, char *fromcharaname, + char *tocdkey, char *tocharaname, + char* text , int color ); + +void ADDRESSBOOK_notifyLoginLogout( int cindex , int flg ); +void ADDRESSBOOK_addAddressBook( int meindex, int toindex); +void ADDRESSBOOK_DispatchMessage( char *cd, char *nm, char *value, int mode); +int ADDRESSBOOK_getIndexInAddressbook(int cindex , char *cdkey, char *charname); +BOOL ADDRESSBOOK_AutoaddAddressBook( int meindex, int toindex); + +#endif diff --git a/include/anim_tbl.h b/include/anim_tbl.h new file mode 100644 index 0000000..5065d93 --- /dev/null +++ b/include/anim_tbl.h @@ -0,0 +1,1006 @@ +#ifndef _ANIM_TBL_H_ +#define _ANIM_TBL_H_ + +//#define SPRSTART 30000 // SPRԻ į +#define SPRSTART 100000 // SPRԻ į + +// ƽҷ +#define SPR_001em 100000 // Ҽɨ +#define SPR_001ax 100001 // +#define SPR_001cl 100002 // +#define SPR_001sp 100003 // +#define SPR_001bw 100004 // + +#define SPR_002em 100005 // Ҽɨ +#define SPR_002ax 100006 // +#define SPR_002cl 100007 // +#define SPR_002sp 100008 // +#define SPR_002bw 100009 // + +#define SPR_003em 100010 // Ҽɨ +#define SPR_003ax 100011 // +#define SPR_003cl 100012 // +#define SPR_003sp 100013 // +#define SPR_003bw 100014 // + +#define SPR_004em 100015 // Ҽɨ +#define SPR_004ax 100016 // +#define SPR_004cl 100017 // +#define SPR_004sp 100018 // +#define SPR_004bw 100019 // + +#define SPR_011em 100020 // +#define SPR_011ax 100021 // +#define SPR_011cl 100022 // +#define SPR_011sp 100023 // +#define SPR_011bw 100024 // + +#define SPR_012em 100025 // +#define SPR_012ax 100026 // +#define SPR_012cl 100027 // +#define SPR_012sp 100028 // +#define SPR_012bw 100029 // + +#define SPR_013em 100030 // +#define SPR_013ax 100031 // +#define SPR_013cl 100032 // +#define SPR_013sp 100033 // +#define SPR_013bw 100034 // + +#define SPR_014em 100035 // +#define SPR_014ax 100036 // +#define SPR_014cl 100037 // +#define SPR_014sp 100038 // +#define SPR_014bw 100039 // + +#define SPR_021em 100040 // +#define SPR_021ax 100041 // +#define SPR_021cl 100042 // +#define SPR_021sp 100043 // +#define SPR_021bw 100044 // + +#define SPR_022em 100045 +#define SPR_022ax 100046 +#define SPR_022cl 100047 +#define SPR_022sp 100048 +#define SPR_022bw 100049 + +#define SPR_023em 100050 +#define SPR_023ax 100051 +#define SPR_023cl 100052 +#define SPR_023sp 100053 +#define SPR_023bw 100054 + +#define SPR_024em 100055 +#define SPR_024ax 100056 +#define SPR_024cl 100057 +#define SPR_024sp 100058 +#define SPR_024bw 100059 + +#define SPR_031em 100060 // +#define SPR_031ax 100061 // +#define SPR_031cl 100062 // +#define SPR_031sp 100063 // +#define SPR_031bw 100064 // + +#define SPR_032em 100065 +#define SPR_032ax 100066 +#define SPR_032cl 100067 +#define SPR_032sp 100068 +#define SPR_032bw 100069 + +#define SPR_033em 100070 +#define SPR_033ax 100071 +#define SPR_033cl 100072 +#define SPR_033sp 100073 +#define SPR_033bw 100074 + +#define SPR_034em 100075 +#define SPR_034ax 100076 +#define SPR_034cl 100077 +#define SPR_034sp 100078 +#define SPR_034bw 100079 + +#define SPR_041em 100080 // +#define SPR_041ax 100081 // +#define SPR_041cl 100082 // +#define SPR_041sp 100083 // +#define SPR_041bw 100084 // + +#define SPR_042em 100085 +#define SPR_042ax 100086 +#define SPR_042cl 100087 +#define SPR_042sp 100088 +#define SPR_042bw 100089 + +#define SPR_043em 100090 +#define SPR_043ax 100091 +#define SPR_043cl 100092 +#define SPR_043sp 100093 +#define SPR_043bw 100094 + +#define SPR_044em 100095 +#define SPR_044ax 100096 +#define SPR_044cl 100097 +#define SPR_044sp 100098 +#define SPR_044bw 100099 + +#define SPR_051em 100100 // +#define SPR_051ax 100101 // +#define SPR_051cl 100102 // +#define SPR_051sp 100103 // +#define SPR_051bw 100104 // + +#define SPR_052em 100105 +#define SPR_052ax 100106 +#define SPR_052cl 100107 +#define SPR_052sp 100108 +#define SPR_052bw 100109 + +#define SPR_053em 100110 +#define SPR_053ax 100111 +#define SPR_053cl 100112 +#define SPR_053sp 100113 +#define SPR_053bw 100114 + +#define SPR_054em 100115 +#define SPR_054ax 100116 +#define SPR_054cl 100117 +#define SPR_054sp 100118 +#define SPR_054bw 100119 + +#define SPR_061em 100120 // ҼԨ +#define SPR_061ax 100121 // +#define SPR_061cl 100122 // +#define SPR_061sp 100123 // +#define SPR_061bw 100124 // + +#define SPR_062em 100125 +#define SPR_062ax 100126 +#define SPR_062cl 100127 +#define SPR_062sp 100128 +#define SPR_062bw 100129 + +#define SPR_063em 100130 +#define SPR_063ax 100131 +#define SPR_063cl 100132 +#define SPR_063sp 100133 +#define SPR_063bw 100134 + +#define SPR_064em 100135 +#define SPR_064ax 100136 +#define SPR_064cl 100137 +#define SPR_064sp 100138 +#define SPR_064bw 100139 + +#define SPR_071em 100140 // Ԩ +#define SPR_071ax 100141 // +#define SPR_071cl 100142 // +#define SPR_071sp 100143 // +#define SPR_071bw 100144 // + +#define SPR_072em 100145 +#define SPR_072ax 100146 +#define SPR_072cl 100147 +#define SPR_072sp 100148 +#define SPR_072bw 100149 + +#define SPR_073em 100150 +#define SPR_073ax 100151 +#define SPR_073cl 100152 +#define SPR_073sp 100153 +#define SPR_073bw 100154 + +#define SPR_074em 100155 +#define SPR_074ax 100156 +#define SPR_074cl 100157 +#define SPR_074sp 100158 +#define SPR_074bw 100159 + +#define SPR_081em 100160 // Ԩ +#define SPR_081ax 100161 // +#define SPR_081cl 100162 // +#define SPR_081sp 100163 // +#define SPR_081bw 100164 // + +#define SPR_082em 100165 +#define SPR_082ax 100166 +#define SPR_082cl 100167 +#define SPR_082sp 100168 +#define SPR_082bw 100169 + +#define SPR_083em 100170 +#define SPR_083ax 100171 +#define SPR_083cl 100172 +#define SPR_083sp 100173 +#define SPR_083bw 100174 + +#define SPR_084em 100175 +#define SPR_084ax 100176 +#define SPR_084cl 100177 +#define SPR_084sp 100178 +#define SPR_084bw 100179 + +#define SPR_091em 100180 // Ԩ +#define SPR_091ax 100181 // +#define SPR_091cl 100182 // +#define SPR_091sp 100183 // +#define SPR_091bw 100184 // + +#define SPR_092em 100185 +#define SPR_092ax 100186 +#define SPR_092cl 100187 +#define SPR_092sp 100188 +#define SPR_092bw 100189 + +#define SPR_093em 100190 +#define SPR_093ax 100191 +#define SPR_093cl 100192 +#define SPR_093sp 100193 +#define SPR_093bw 100194 + +#define SPR_094em 100195 +#define SPR_094ax 100196 +#define SPR_094cl 100197 +#define SPR_094sp 100198 +#define SPR_094bw 100199 + +#define SPR_101em 100200 // +#define SPR_101ax 100201 // +#define SPR_101cl 100202 // +#define SPR_101sp 100203 // +#define SPR_101bw 100204 // + +#define SPR_102em 100205 +#define SPR_102ax 100206 +#define SPR_102cl 100207 +#define SPR_102sp 100208 +#define SPR_102bw 100209 + +#define SPR_103em 100210 +#define SPR_103ax 100211 +#define SPR_103cl 100212 +#define SPR_103sp 100213 +#define SPR_103bw 100214 + +#define SPR_104em 100215 +#define SPR_104ax 100216 +#define SPR_104cl 100217 +#define SPR_104sp 100218 +#define SPR_104bw 100219 + +#define SPR_111em 100220 // +#define SPR_111ax 100221 // +#define SPR_111cl 100222 // +#define SPR_111sp 100223 // +#define SPR_111bw 100224 // + +#define SPR_112em 100225 +#define SPR_112ax 100226 +#define SPR_112cl 100227 +#define SPR_112sp 100228 +#define SPR_112bw 100229 + +#define SPR_113em 100230 +#define SPR_113ax 100231 +#define SPR_113cl 100232 +#define SPR_113sp 100233 +#define SPR_113bw 100234 + +#define SPR_114em 100235 +#define SPR_114ax 100236 +#define SPR_114cl 100237 +#define SPR_114sp 100238 +#define SPR_114bw 100239 + + +// ʸ ƽҷ +#define SPR_pet001 100250 // +#define SPR_pet002 100251 // +#define SPR_pet003 100252 // ̼ +#define SPR_pet004 100253 // Ƥ + +#define SPR_pet011 100254 // Ƥū +#define SPR_pet012 100255 // Ƥ +#define SPR_pet013 100256 // Ƥ +#define SPR_pet014 100257 // Ƥ̡ +#define SPR_pet015 100258 // СƤ + +#define SPR_pet021 100259 // +#define SPR_pet022 100260 // +#define SPR_pet023 100261 // +#define SPR_pet024 100262 // ҡ + +#define SPR_pet031 100263 // ̺ +#define SPR_pet032 100264 // ūū +#define SPR_pet033 100265 // +#define SPR_pet034 100266 // ū + +#define SPR_pet041 100267 // ì +#define SPR_pet042 100268 // ì +#define SPR_pet043 100269 // ìͻ +#define SPR_pet044 100270 // ì + +#define SPR_pet051 100271 // ж +#define SPR_pet052 100272 // з´ +#define SPR_pet053 100273 // ж +#define SPR_pet054 100274 // з´ + +#define SPR_pet061 100275 // +#define SPR_pet062 100276 // ҵ +#define SPR_pet063 100277 // +#define SPR_pet064 100278 // ĸͻ + +#define SPR_pet071 100279 // ׻ +#define SPR_pet072 100280 // +#define SPR_pet073 100281 // ƽ +#define SPR_pet074 100282 // + +#define SPR_pet081 100283 // +#define SPR_pet082 100284 // е +#define SPR_pet083 100285 // +#define SPR_pet084 100286 // ҵ + +#define SPR_pet091 100287 // δ +#define SPR_pet092 100288 // ׷ +#define SPR_pet093 100289 // ʾ +#define SPR_pet094 100290 // ס + +#define SPR_pet101 100291 // +#define SPR_pet102 100292 // ͻ +#define SPR_pet103 100293 // ƽ +#define SPR_pet104 100294 // ƽ + +#define SPR_pet111 100295 // +#define SPR_pet112 100296 // +#define SPR_pet113 100297 // ƽب +#define SPR_pet114 100298 // ƽ + +#define SPR_pet121 100299 // ئ +#define SPR_pet122 100300 // ئ +#define SPR_pet123 100301 // ئ +#define SPR_pet124 100302 // ئ + +#define SPR_pet131 100303 // ئ +#define SPR_pet132 100304 // ئ +#define SPR_pet133 100305 // ئ +#define SPR_pet134 100306 // ئ + +#define SPR_pet141 100307 // +#define SPR_pet142 100308 // ׷ +#define SPR_pet143 100309 // ׷´ +#define SPR_pet144 100310 // + +#define SPR_pet151 100311 // ئ +#define SPR_pet152 100312 // ئ +#define SPR_pet153 100313 // ئ +#define SPR_pet154 100314 // ئ + +#define SPR_pet161 100315 // ئ +#define SPR_pet162 100316 // ئ +#define SPR_pet163 100317 // ئ +#define SPR_pet164 100318 // ئ + +#define SPR_pet171 100319 // بʾ +#define SPR_pet172 100320 // ʾ +#define SPR_pet173 100321 // +#define SPR_pet174 100322 // + +#define SPR_pet181 100323 // ʯ +#define SPR_pet182 100324 // ͡ +#define SPR_pet183 100325 // +#define SPR_pet184 100326 // ͻ + +#define SPR_pet191 100327 // ìﲼ +#define SPR_pet192 100328 // ì̲ +#define SPR_pet193 100329 // ˵ +#define SPR_pet194 100330 // ƽӡì + +#define SPR_pet201 100331 // ئ +#define SPR_pet202 100332 // ئ +#define SPR_pet203 100333 // ئ +#define SPR_pet204 100334 // ئ + +#define SPR_pet211 100335 // +#define SPR_pet212 100336 // ʸ +#define SPR_pet213 100337 // ¡ +#define SPR_pet214 100338 // + +#define SPR_pet221 100339 // +#define SPR_pet222 100340 // Һ +#define SPR_pet223 100341 // ҡ +#define SPR_pet224 100342 // + +#define SPR_pet231 100343 // ײ +#define SPR_pet232 100344 // ס +#define SPR_pet233 100345 // ײʾ +#define SPR_pet234 100346 // ׼ʾ + +#define SPR_pet241 100347 // ɡƽ +#define SPR_pet242 100348 // ة̡ +#define SPR_pet243 100349 // ʾ +#define SPR_pet244 100350 // ̡ + +#define SPR_pet251 100351 // Ƥ +#define SPR_pet252 100352 // Ƥ +#define SPR_pet253 100353 // Ƥƽ +#define SPR_pet254 100354 // + +#define SPR_pet261 100355 // Ѩƹ +#define SPR_pet262 100356 // ƹƹ +#define SPR_pet263 100357 // Ѩƹϵ +#define SPR_pet264 100358 // Ѩƹ + +#define SPR_pet271 100359 // ´ +#define SPR_pet272 100360 // ò +#define SPR_pet273 100361 // +#define SPR_pet274 100362 // ⵩ + +#define SPR_pet281 100363 // ئ +#define SPR_pet282 100364 // ئ +#define SPR_pet283 100365 // ئ +#define SPR_pet284 100366 // ئ + +#define SPR_pet291 100367 // ƽ +#define SPR_pet292 100368 // ͷ +#define SPR_pet293 100369 // ʯ +#define SPR_pet294 100370 // ƽūʾ + +#define SPR_pet301 100371 // 󲼷 +#define SPR_pet302 100372 // ūõ +#define SPR_pet303 100373 // ¼ +#define SPR_pet304 100374 // + +#define SPR_pet311 100375 // +#define SPR_pet312 100376 // ƹˡ +#define SPR_pet313 100377 // ʯ +#define SPR_pet314 100378 // ʯ + +#define SPR_pet321 100379 // ³ +#define SPR_pet322 100380 // Ƕ +#define SPR_pet323 100381 // ʧõ +#define SPR_pet324 100382 // ĸ÷ +#define SPR_pet325 100383 // + +#define SPR_pet331 100384 // ͵ +#define SPR_pet332 100385 // ¼ìﵩ +#define SPR_pet333 100386 // +#define SPR_pet334 100387 // á + +// ޥܰʸ +#define SPR_pet005 100388 // Ļ +#define SPR_pet085 100389 // е +#define SPR_pet086 100390 // +#define SPR_pet087 100391 // Ƥҵ +#define SPR_pet088 100392 // ʧʧ +#define SPR_pet065 100393 // +#define SPR_pet095 100394 // δ +#define SPR_pet175 100395 // بʾ +#define SPR_pet255 100396 // Ƥ + +// ޥܰƽҷ +#define SPR_121em 100400 // ʧ׷ +#define SPR_121ax 100401 // +#define SPR_121cl 100402 // +#define SPR_121sp 100403 // +#define SPR_121bw 100404 // + +#define SPR_122em 100405 // ʧ׷ +#define SPR_122ax 100406 // +#define SPR_122cl 100407 // +#define SPR_122sp 100408 // +#define SPR_122bw 100409 // + +#define SPR_123em 100410 // ʧ׷ +#define SPR_123ax 100411 // +#define SPR_123cl 100412 // +#define SPR_123sp 100413 // +#define SPR_123bw 100414 // + +#define SPR_124em 100415 // ʧ׷ +#define SPR_124ax 100416 // +#define SPR_124cl 100417 // +#define SPR_124sp 100418 // +#define SPR_124bw 100419 // + +#define SPR_131em 100420 // +#define SPR_131ax 100421 // +#define SPR_131cl 100422 // +#define SPR_131sp 100423 // +#define SPR_131bw 100424 // + +#define SPR_132em 100425 // +#define SPR_132ax 100426 // +#define SPR_132cl 100427 // +#define SPR_132sp 100428 // +#define SPR_132bw 100429 // + +#define SPR_pet315 100430 // ɼĸʯ + +#define SPR_141em 100431 // ؼϨ +#define SPR_141ax 100432 // +#define SPR_141cl 100433 // +#define SPR_141sp 100434 // +#define SPR_141bw 100435 // + +#define SPR_142em 100436 // ؼϨ +#define SPR_142ax 100437 // +#define SPR_142cl 100438 // +#define SPR_142sp 100439 // +#define SPR_142bw 100440 // + +#define SPR_133em 100441 // +#define SPR_133ax 100442 // +#define SPR_133cl 100443 // +#define SPR_133sp 100444 // +#define SPR_133bw 100445 // + +#define SPR_151em 100446 // Ԩ +#define SPR_151ax 100447 // +#define SPR_151cl 100448 // +#define SPR_151sp 100449 // +#define SPR_151bw 100450 // + +#define SPR_152em 100451 +#define SPR_152ax 100452 +#define SPR_152cl 100453 +#define SPR_152sp 100454 +#define SPR_152bw 100455 + +#define SPR_161em 100456 // Ԩ +#define SPR_161ax 100457 // +#define SPR_161cl 100458 // +#define SPR_161sp 100459 // +#define SPR_161bw 100460 // + +#define SPR_162em 100461 +#define SPR_162ax 100462 +#define SPR_162cl 100463 +#define SPR_162sp 100464 +#define SPR_162bw 100465 + +//ʧ߶ +#define SPR_leader 100500 // ĸѨʧ߶ +#define SPR_star 100501 // ززѨʧ߶ +#define SPR_boomerang 100502 // Ƥ¼ʧ߶ +#define SPR_stornbomb 100503 // ޼ʧ߶ +#define SPR_ono 100504 // ʧ߶ +#define SPR_onokage 100505 // ʧ߶ +#define SPR_isiware 100506 // ľʧ߶ +#define SPR_mail 100507 // ʧ߶ +//ʧ߶ +#define SPR_stone 100550 // ޼ʧ߶ +#define SPR_shock 100551 // ʧ߶ +#define SPR_drunk 100552 // жʧ߶ +#define SPR_sleep 100553 // Իʧ߶ +#define SPR_conf 100554 // ٶʧ߶ +#define SPR_poison 100555 // ʧ߶ +#define SPR_zokusei 100556 // ʧ߶ +//ްʧ߶ +#define SPR_effect01 100600 // ʧ߶ +#define SPR_heal 100601 // ʧ߶ +#define SPR_heal2 100602 // ʧ߶ +#define SPR_heal3 100603 // ʧ߶ +#define SPR_tyusya 100604 // ʧ߶ ټ +#define SPR_hoshi 100605 // ëľ弰ʧ߶ +#define SPR_kyu 100606 // ëľ弰ʧ߶ +#define SPR_fukkatu1 100607 // ëľ弰ʧ߶ +#define SPR_fukkatu2 100608 // ëľ弰ʧ߶ +#define SPR_fukkatu3 100609 // ëľ弰ʧ߶ +#define SPR_difence 100610 // ëľ弰ʧ߶ +#define SPR_item 100611 // ʧ ةë弰ʧ߶ +#define SPR_item3 100612 // ʧ ةë弰ʧ߶ +// ʧ߶ +#define SPR_mirror 100650 // ʧ߶ +#define SPR_barrior 100651 // ʧʧ߶ + +// շ ƥئ ****************************************************/ +#define CG_INVISIBLE 99 // ľƱ ľئ +//#define CG_GRID_CURSOR 99 +#define CG_MOUSE_CURSOR 25000 +#define CG_GRID_CURSOR 25001 + +// ʾ +#define CG_BTL_BUTTON_ATTACK_UP 25100 +#define CG_BTL_BUTTON_ATTACK_DOWN 25101 +#define CG_BTL_BUTTON_JUJUTU_UP 25102 +#define CG_BTL_BUTTON_JUJUTU_DOWN 25103 +#define CG_BTL_BUTTON_CAPTURE_UP 25104 +#define CG_BTL_BUTTON_CAPTURE_DOWN 25105 +#define CG_BTL_BUTTON_HELP_UP 25106 +#define CG_BTL_BUTTON_HELP_DOWN 25107 +#define CG_BTL_BUTTON_GUARD_UP 25108 +#define CG_BTL_BUTTON_GUARD_DOWN 25109 +#define CG_BTL_BUTTON_ITEM_UP 25110 +#define CG_BTL_BUTTON_ITEM_DOWN 25111 +#define CG_BTL_BUTTON_PET_UP 25112 +#define CG_BTL_BUTTON_PET_DOWN 25113 +#define CG_BTL_BUTTON_ESCAPE_UP 25114 +#define CG_BTL_BUTTON_ESCAPE_DOWN 25115 +#define CG_BTL_BUTTON_BASE 25116 // ʾܽ +#define CG_BTL_BUTTON_CROSS 25117 // ʾ + +// ʧ +#define CG_ATR_ICON_EARTH_BIG 25120 // +#define CG_ATR_ICON_EARTH_MDL 25121 // +#define CG_ATR_ICON_EARTH_SML 25122 // +#define CG_ATR_ICON_WATER_BIG 25123 // +#define CG_ATR_ICON_WATER_MDL 25124 // +#define CG_ATR_ICON_WATER_SML 25125 // +#define CG_ATR_ICON_FIRE_BIG 25126 // ܣ +#define CG_ATR_ICON_FIRE_MDL 25127 // ܣ +#define CG_ATR_ICON_FIRE_SML 25128 // ܣ +#define CG_ATR_ICON_WIND_BIG 25129 // 뮣 +#define CG_ATR_ICON_WIND_MDL 25130 // 뮣 +#define CG_ATR_ICON_WIND_SML 25131 // 뮣 + +// ʧ +#define CG_ATR_ICON_EARTH_BATTLE 25132 // +#define CG_ATR_ICON_WATER_BATTLE 25133 // +#define CG_ATR_ICON_FIRE_BATTLE 25134 // ܣ +#define CG_ATR_ICON_WIND_BATTLE 25135 // 뮣 + +// ʸʾ +#define CG_PET_BTL_BUTTON_BASE 25140 // ʾܽ +#define CG_PET_BTL_BUTTON_WAZA_UP 25141 // ʾ +#define CG_PET_BTL_BUTTON_WAZA_DOWN 25142 // ʾ +#define CG_PET_BTL_BUTTON_CANCEL_UP 25143 // ƽҼʾ + +// Ѩ +#define CG_HIT_MARK_00 25500 // +#define CG_HIT_MARK_01 25501 // + +#define CG_HIT_MARK_10 25502 // +#define CG_HIT_MARK_11 25503 +#define CG_HIT_MARK_12 25504 + +#define CG_HIT_MARK_20 25505 // ձ +#define CG_HIT_MARK_21 25506 +#define CG_HIT_MARK_22 25507 + +#define CG_HIT_MARK_30 25508 // +#define CG_HIT_MARK_31 25509 +#define CG_HIT_MARK_32 25510 + +#define CG_HIT_MARK_40 25511 // +#define CG_HIT_MARK_41 25512 +#define CG_HIT_MARK_42 25513 + +// +#define CG_SPEECH_BTL_OK 25520 +#define CG_SPEECH_CHANGE 25521 +#define CG_SPEECH_GROUP 25522 +#define CG_SPEECH_SUCCESS 25523 +#define CG_SPEECH_YATTA 25524 +#define CG_SPEECH_HELP 25525 + +// ޼Ѩ +#define CG_VS_MARK_1A 25610 +#define CG_VS_MARK_1B 25611 +#define CG_VS_MARK_2A 25612 +#define CG_VS_MARK_2B 25613 +#define CG_VS_MARK_3A 25614 +#define CG_VS_MARK_3B 25615 +#define CG_VS_MARK_4A 25616 +#define CG_VS_MARK_4B 25617 +#define CG_VS_MARK_5A 25618 +#define CG_VS_MARK_5B 25619 +#define CG_VS_MARK_6A 25620 +#define CG_VS_MARK_6B 25621 +#define CG_VS_MARK_7A 25622 +#define CG_VS_MARK_7B 25623 +#define CG_VS_MARK_8A 25624 +#define CG_VS_MARK_8B 25625 +#define CG_VS_MARK_9A 25626 +#define CG_VS_MARK_9B 25627 +#define CG_VS_MARK_10A 25628 +#define CG_VS_MARK_10B 25629 + +// +#define CG_ARROW_00 25630 +#define CG_ARROW_01 25631 +#define CG_ARROW_02 25632 +#define CG_ARROW_03 25633 +#define CG_ARROW_04 25634 +#define CG_ARROW_05 25635 +#define CG_ARROW_06 25636 +#define CG_ARROW_07 25637 +#define CG_ARROW_08 25638 +#define CG_ARROW_09 25639 +#define CG_ARROW_10 25640 +#define CG_ARROW_11 25641 +#define CG_ARROW_12 25642 +#define CG_ARROW_13 25643 +#define CG_ARROW_14 25644 +#define CG_ARROW_15 25645 + +// ĸٯ +#define CG_CNT_DOWN_0 25900 +#define CG_CNT_DOWN_1 25901 +#define CG_CNT_DOWN_2 25902 +#define CG_CNT_DOWN_3 25903 +#define CG_CNT_DOWN_4 25904 +#define CG_CNT_DOWN_5 25905 +#define CG_CNT_DOWN_6 25906 +#define CG_CNT_DOWN_7 25907 +#define CG_CNT_DOWN_8 25908 +#define CG_CNT_DOWN_9 25909 + +// ū +#define CG_WND_G_0 26001 +#define CG_WND_G_1 26002 +#define CG_WND_G_2 26003 +#define CG_WND_G_3 26004 +#define CG_WND_G_4 26005 +#define CG_WND_G_5 26006 +#define CG_WND_G_6 26007 +#define CG_WND_G_7 26008 +#define CG_WND_G_8 26009 + +// ū +#define CG_WND_TITLE_SYSTEM 26010 +#define CG_WND_TITLE_LOGOUT 26011 +#define CG_WND_TITLE_CHAT 26015 +#define CG_WND_TITLE_BGM 26016 +#define CG_WND_TITLE_SE 26017 +#define CG_WND_TITLE_RESULT 26018 + +// +#define CG_TASK_BAR_BACK 26012 + +// ݼ +#define CG_BATTLE_BAR_PLAYER 26013 // +#define CG_BATTLE_BAR_PLAYER_2 26019 // +#define CG_BATTLE_BAR_PET 26014 // ְ +#define CG_BATTLE_BAR_PET_2 26020 // ʸ + +// ū +#define CG_WND2_G_0 26021 +#define CG_WND2_G_1 26022 +#define CG_WND2_G_2 26023 +#define CG_WND2_G_3 26024 +#define CG_WND2_G_4 26025 +#define CG_WND2_G_5 26026 +#define CG_WND2_G_6 26027 +#define CG_WND2_G_7 26028 +#define CG_WND2_G_8 26029 + +// ū +#define CG_WND3_G_7 26037 // Ʊģ ٯë +#define CG_WND3_G_8 26038 +#define CG_WND3_G_9 26039 + +// ū +#define CG_BTL_PET_CHANGE_WND 26040 // ݼʸ ľ׸ū +#define CG_BTL_PET_RETURN_BTN 26041 // ݼʸ ʾ + +// ʾ +#define CG_CLOSE_BTN 26042 // Ԫʾ +#define CG_RETURN_BTN 26043 // ʾ +#define CG_OK_BTN 26093 // ʾ +#define CG_CANCEL_BTN 26050 // ƽҼʾ + +#define CG_YES_BTN 26094 // ""ʾ +#define CG_NO_BTN 26095 // ""ʾ +#define CG_EXIT_BTN 26096 // ""ʾ +#define CG_SEAL_BTN 26097 // ""ʾ +#define CG_BUY_BTN 26098 // ""ʾ + +// ʸū +#define CG_PET_WND_VIEW 26044 // ʸ ū +#define CG_PET_WND_DETAIL 26045 // ʸū + +#define CG_PET_WND_WAZA_BTN 26046 // ʾ +//#define CG_PREV_BTN 26047 // Ի׸ʾ +//#define CG_NEXT_BTN 26048 // ݱԻ׸ʾ +#define CG_NAME_CHANGE_WND 26049 // ū +//#define CG_NAME_CHANGE_BTN 26051 // ʾ +#define CG_NAME_CHANGE_BTN 26058 // ʾ +#define CG_NAME_CHANGE_BTN_DOWN 26059 // ʾ + +#define CG_PET_WND_REST_BTN 26052 // ʸʾ +#define CG_PET_WND_STANDBY_BTN 26053 // ʸʾ +#define CG_PET_WND_BTL_BTN 26054 // ʸʾ +#define CG_PET_WND_MAIL_BTN 26055 // ʸʾ +#define CG_PET_WND_STATUS_BTN 26056 // ʸʾ + + +// ʧ ةū +#define CG_ITEM_WND_0 26060 // ʧ ةū +#define CG_ITEM_WND_1 26061 // ʧ ةūƱ +#define CG_ITEM_WND_GOLD_DROP_BTN_UP 26062 // ʾ +#define CG_ITEM_WND_GOLD_DROP_BTN_DOWN 26063 // ʾ +#define CG_ITEM_WND_GOLD_INC_BTN_UP 26064 // ֧ʾ +#define CG_ITEM_WND_GOLD_INC_BTN_DOWN 26065 // ֧ʾ +#define CG_ITEM_WND_GOLD_DEC_BTN_UP 26066 // Ӽʾ +#define CG_ITEM_WND_GOLD_DEC_BTN_DOWN 26067 // Ӽʾ +#define CG_JUJUTU_WND 26068 // ū +#define CG_ITEM_WND_JUJUTU_BTN 26069 // ʧ ةūʾ +#define CG_ITEM_WND_SELECT_WND 26070 // ū +#define CG_STATUS_WND_GROUP_WND 26071 // ū +#define CG_BTL_ITEM_WND_TITLE 26072 // ݼʧ ةū + +// ū +#define CG_STATUS_WND 26073 // ū +#define CG_STATUS_WND_VICTORY_MARK 26074 // Ѩ +#define CG_STATUS_WND_LV_UP_POINT 26075 // ìʧ ٯ +#define CG_STATUS_WND_UP_BTN_UP 26076 // ʧʾ +#define CG_STATUS_WND_UP_BTN_DOWN 26077 // ʧʾ +#define CG_STATUS_WND_SHOUGOU_BTN_UP 26078 // įʾ +#define CG_STATUS_WND_SHOUGOU_BTN_DOWN 26079 // įʾ +#define CG_STATUS_WND_GROUP_BTN 26080 // ʾ + +// Ѩū +#define CG_MAP_WND 26081 // Ѩū + +// ū +#define CG_MAIL_WND 26082 // ū +#define CG_MAIL_WND_SEND_WND 26200 // ˪ū +#define CG_MAIL_WND_PET_SEND_WND 26201 // ʸ˪ū +#define CG_MAIL_WND_ITEM_BTN 26202 // ʧ ةʾ +#define CG_MAIL_WND_HISTORY_WND 26203 // ū + +//#define CG_MAIL_WND_MAIL_BTN 26083 // ʾ +#define CG_MAIL_WND_ON_LINE_SUN_BTN 26084 // ̼ʾ +#define CG_MAIL_WND_ON_LINE_MOON_BTN 26088 // ̼ʾ +#define CG_MAIL_WND_OFF_LINE_BTN 26085 // ̼ʾ +#define CG_MAIL_WND_MAIL_BTN 26086 // ʾ +#define CG_MAIL_WND_DELETE_BTN 26087 // ʾ +#define CG_MAIL_WND_CLEAR_BTN_UP 26172 // ʧʾ +#define CG_MAIL_WND_CLEAR_BTN_DOWN 26173 // ʧʾ +#define CG_SEND_BTN 26099 // ""ʾ +#define CG_SEND_BTN_DOWN 26174 // ""ʾ + +// ʧةū +#define CG_ALBUM_WND 26230 // ʧةū +#define CG_ALBUM_WND_NEW_ICON 26231 // ޥʧ +#define CG_ALBUM_WND_SNAP_BTN_UP 26170 // ީë +#define CG_ALBUM_WND_SNAP_BTN_DOWN 26171 // ީë + +// ٯ ū +#define CG_CHAT_REGISTY_WND 26232 + +// ٯ Ի ū +#define CG_COMMON_WIN_YORO 26090 // ""̤ľū +#define CG_COMMON_YES_BTN 26091 // ʾ +#define CG_COMMON_NO_BTN 26092 // ʾ + +// ū ʾ +#define CG_FIELD_MENU_LEFT 26100 // +#define CG_FIELD_MENU_BTN_OFF 26101 // بʾ +#define CG_FIELD_MENU_BTN_ON 26102 // بʾ +#define CG_FIELD_CARD_BTN_OFF 26103 // ͭʾ +#define CG_FIELD_CARD_BTN_ON 26104 // ͭʾ +#define CG_FIELD_GROUP_BTN_OFF 26105 // ʾ +#define CG_FIELD_GROUP_BTN_ON 26106 // ʾ +#define CG_FIELD_MAIL_LAMP 26107 // ﰾ¼ +#define CG_FIELD_MENU_RIGHT 26110 // +#define CG_FIELD_JOIN_BTL_BTN_OFF 26111 // ʾ +#define CG_FIELD_JOIN_BTL_BTN_ON 26112 // ʾ +#define CG_FIELD_DUEL_BTN_OFF 26113 // ʾ +#define CG_FIELD_DUEL_BTN_ON 26114 // ʾ +#define CG_FIELD_ACT_BTN_OFF 26115 // ʧʾ +#define CG_FIELD_ACT_BTN_ON 26116 // ʧʾ +#define CG_FIELD_AM_PM_00 26117 // ƻ °ū +#define CG_FIELD_AM_PM_01 26118 // ƻ °ū +#define CG_FIELD_AM_PM_02 26119 // ƻ °ū +#define CG_FIELD_AM_PM_03 26120 // ƻ °ū +#define CG_FIELD_MENU_RIGHT_BACK 26121 // 缰 + +// ʸ ū +#define CG_PET_WAZA_WND 26130 +#define CG_PET_WAZA_BAR_1 26131 +#define CG_PET_WAZA_BAR_2 26132 +#define CG_PET_WAZA_BAR_3 26133 +#define CG_PET_WAZA_BAR_4 26134 +#define CG_PET_WAZA_BAR_5 26135 +#define CG_PET_WAZA_BAR_6 26136 +#define CG_PET_WAZA_BAR_7 26137 + +// ʧ ةū +#define CG_ITEMSHOP_WIN 26138 + +// ū +#define CG_SKILLSHOP_WIN 26139 + +// 继 ū +#define CG_ITEMSHOP_KOSU_WIN 26140 + +// ʾ +#define CG_TASK_BAR_MAP_UP 26150 +#define CG_TASK_BAR_MAP_DOWM 26151 +#define CG_TASK_BAR_STATUS_UP 26152 +#define CG_TASK_BAR_STATUS_DOWN 26153 +#define CG_TASK_BAR_PET_UP 26154 +#define CG_TASK_BAR_PET_DOWN 26155 +#define CG_TASK_BAR_ITEM_UP 26156 +#define CG_TASK_BAR_ITEM_DOWN 26157 +#define CG_TASK_BAR_MAIL_UP 26158 +#define CG_TASK_BAR_MAIL_DOWN 26159 +#define CG_TASK_BAR_ALBUM_UP 26160 +#define CG_TASK_BAR_ALBUM_DOWN 26161 +#define CG_TASK_BAR_SYSTEM_UP 26162 +#define CG_TASK_BAR_SYSTEM_DOWN 26163 + +// ʾ +#define CG_PREV_BTN 26180 // ʾ +#define CG_PREV_BTN_DOWN 26181 // ʾ +#define CG_NEXT_BTN 26182 // ʾ +#define CG_NEXT_BTN_DOWN 26183 // ʾ + +#define CG_PREV_BTN2 26184 // ʾ +#define CG_PREV_BTN2_DOWN 26185 // ʾ +#define CG_NEXT_BTN2 26186 // ʾ +#define CG_NEXT_BTN2_DOWN 26187 // ʾ + +#define CG_UP_BTN 26188 // ʾ +#define CG_UP_BTN_DOWN 26189 // ʾ +#define CG_DOWN_BTN 26190 // ʾ +#define CG_DOWN_BTN_DOWN 26191 // ʾ + + +// ʧ +#define CG_ICON_FUKIDASI 26500 // +#define CG_ICON_COME_ON 26501 // Come On! +#define CG_ICON_GO 26502 // Go! +#define CG_ICON_WATCHING 26503 // Watching +#define CG_ICON_MISS 26504 // Miss... +#define CG_ICON_FAIL 26505 // Fail... +#define CG_ICON_GET 26506 // Get!! +#define CG_ICON_COUNTER 26507 // Counter! +#define CG_ICON_DANGER 26508 // Danger! +#define CG_ICON_NO 26509 // No! +#define CG_ICON_GUARD 26510 // Guard! +#define CG_ICON_ESCAPE 26511 // Escape! +#define CG_ICON_CAPTURE 26512 // Capture! +#define CG_ICON_LEAVE 26513 // Leave! +#define CG_ICON_GUARD_BREAK 26514 // Guard Break! + +// ʸӿ ƺ°ū +#define CG_NOW_PAINTING 28999 + +// +#define CG_LOGO 29000 +#define CG_TITLE 29001 +#define CG_TITLE_NAME_S 29002 +#define CG_TITLE_NAME_T 29003 +#define CG_TITLE_NAME_O 29004 +#define CG_TITLE_NAME_N 29005 +#define CG_TITLE_NAME_E 29006 +#define CG_TITLE_NAME_A 29007 +#define CG_TITLE_NAME_G 29008 +#define CG_TITLE_NAME_E2 29009 +#define CG_TITLE_NAME 29010 +#define CG_TITLE_NAME_FLASH 29011 +#define CG_TITLE_NAME_FLASH1 29012 +#define CG_TITLE_NAME_FLASH2 29013 +#define CG_TITLE_NAME_FLASH3 29014 +#define CG_TITLE_NAME_FLASH4 29015 +#define CG_TITLE_NAME_FLASH5 29016 +#define CG_TITLE_JSS_LOGO 29017 +#define CG_TITLE_DREAM_LOGO 29018 +#define CG_TITLE_NOW_LOADING 29019 +#define CG_TITLE_ID_PASS 29020 +#define CG_TITLE_ID_PASS_OK 29021 +#define CG_TITLE_ID_PASS_QUIT 29022 + +// ƽҷ +#define CG_CHR_MAKE_SEL_BG 29030 // ޥƽҷ¼ +#define CG_CHR_MAKE_BG 29031 // ޥƽҷɷ¶Ի +#define CG_CHR_SEL_BG 29032 // ƽҷ +#define CG_CHR_SEL_LOGIN_BTN 29033 // ̼ʾ +#define CG_CHR_SEL_NEW_BTN 29034 // ޥʾ +#define CG_CHR_SEL_DEL_BTN 29035 // ʾ +#define CG_CHR_SEL_BACK_BTN 29036 // ʾ +#define CG_CHR_MAKE_OK_BTN 29037 // ޥƽҷ ʾ +#define CG_CHR_MAKE_BACK_BTN 29038 // ޥƽҷ ʾ +#define CG_CHR_MAKE_SEL2_BG 29039 // 컩 +#define CG_CHR_MAKE_HOME_NAME0 29040 // 컩 ة׻P̣ +#define CG_CHR_MAKE_HOME_NAME1 29041 // 컩 Ѩϵ̣ +#define CG_CHR_MAKE_HOME_NAME2 29042 // 컩 ҳҼ̣ +#define CG_CHR_MAKE_HOME_NAME3 29043 // 컩 лϼ̣ +#define CG_CHR_MAKE_EYE_SEL 29044 // ޥƽҷ +#define CG_CHR_MAKE_NOSE_SEL 29045 // ޥƽҷ +#define CG_CHR_MAKE_FACE 30000 // ƽҷӿ 쫷 + +#endif diff --git a/include/attestation.h b/include/attestation.h new file mode 100644 index 0000000..7d521b4 --- /dev/null +++ b/include/attestation.h @@ -0,0 +1,6 @@ +#ifndef __ATTESTATION_H__ +#define __ATTESTATION_H__ + +int attestation( void ); + +#endif diff --git a/include/autil.h b/include/autil.h new file mode 100644 index 0000000..cf4ca47 --- /dev/null +++ b/include/autil.h @@ -0,0 +1,57 @@ +#include "version.h" +#include "common.h" + +#ifndef __UTIL_H_ +#define __UTIL_H_ + + +#define SLICE_MAX 20 +#define SLICE_SIZE 65500 + +extern char *MesgSlice[SLICE_MAX]; +extern int SliceCount; // count slices in MesgSlice + +extern char PersonalKey[4096]; + +#define DEFAULTTABLE \ + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz{}" +#define DEFAULTFUNCBEGIN "&" +#define DEFAULTFUNCEND "#" + +BOOL util_Init(void); + +// WON ADD +//void util_SplitMessage(char *source, char *separator); +BOOL util_SplitMessage(char *source, char *separator); + + +void util_EncodeMessage(char *dst, char *src); +void util_DecodeMessage(char *dst, char *src); +int util_GetFunctionFromSlice(int *func, int *fieldcount); +void util_DiscardMessage(void); +#define util_SendMesg( fd, func, buffer) _util_SendMesg( __FILE__, __LINE__, fd, func, buffer) +void _util_SendMesg(char *file, int line, int fd, int func, char *buffer); + +// ------------------------------------------------------------------- +// Encoding function units. Use in Encrypting functions. +int util_256to64(char *dst, char *src, int len, char *table); +int util_64to256(char *dst, char *src, char *table); +int util_256to64_shr(char *dst, char *src, int len, char *table, char *key); +int util_shl_64to256(char *dst, char *src, char *table, char *key); +int util_256to64_shl(char *dst, char *src, int len, char *table, char *key); +int util_shr_64to256(char *dst, char *src, char *table, char *key); + +void util_swapint(int *dst, int *src, char *rule); +void util_xorstring(char *dst, char *src); +void util_shrstring(char *dst, char *src, int offs); +void util_shlstring(char *dst, char *src, int offs); +// ------------------------------------------------------------------- +// Encrypting functions +int util_deint(int fd,int sliceno, int *value); +int util_mkint(int fd,char *buffer, int value); +int util_destring(int fd,int sliceno, char *value); +int util_mkstring(int fd,char *buffer, char *value); +#ifdef _FIX_LSSP_S_BUG +int is_digit(char *str); +#endif +#endif diff --git a/include/battle.h b/include/battle.h new file mode 100644 index 0000000..46a8511 --- /dev/null +++ b/include/battle.h @@ -0,0 +1,788 @@ +#ifndef __BATTLE_H__ +#define __BATTLE_H__ +#include "net.h" + +#ifdef _ALLBLUES_LUA_1_4 +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#endif + +#define BATTLE_ENTRY_MAX 10 +#define BATTLE_PLAYER_MAX 5 +#define SIDE_OFFSET 10 + +#define BATTLE_STRING_MAX 4096 +#define BATTLE_TIME_LIMIT (60*60) + + +#define DUELPOINT_RATE (0.1) + +enum{ + BATTLE_MODE_NONE = 0, // ս״̬ + BATTLE_MODE_INIT, // սʼ + BATTLE_MODE_BATTLE, // ս + BATTLE_MODE_FINISH, // ս + BATTLE_MODE_STOP, // ս(δʹ) + BATTLE_MODE_WATCHBC, // սʼ + BATTLE_MODE_WATCHPRE, // ս(û) + BATTLE_MODE_WATCHWAIT, // ս(û) + BATTLE_MODE_WATCHMOVIE, // ս(û) + BATTLE_MODE_WATCHAFTER, // ս(û) + BATTLE_MODE_END +}; + + +enum{ + BATTLE_TYPE_NONE = 0, + BATTLE_TYPE_P_vs_E = 1, + BATTLE_TYPE_P_vs_P = 2, + BATTLE_TYPE_E_vs_E = 3, + BATTLE_TYPE_WATCH = 4, + BATTLE_TYPE_DP_BATTLE = 5, + BATTLE_TYPE_BOSS_BATTLE = 6, + BATTLE_TYPE_END +}; + + +enum{ + BATTLE_CHARMODE_NONE = 0, // ս״̬ + BATTLE_CHARMODE_INIT, // սʼ + BATTLE_CHARMODE_C_WAIT, // ȴսָ + BATTLE_CHARMODE_C_OK, // սָ + BATTLE_CHARMODE_BATTLE, // δʹ + BATTLE_CHARMODE_RESCUE, // help״̬ + BATTLE_CHARMODE_FINAL, // ս + BATTLE_CHARMODE_WATCHINIT, // սʼ + BATTLE_CHARMODE_COMMAND, // δʹ + BATTLE_CHARMODE_END +}; + + + + +typedef enum{ + BATTLE_ERR_NONE = 0, + BATTLE_ERR_NOTASK, + BATTLE_ERR_NOUSE, + BATTLE_ERR_PARAM, + BATTLE_ERR_ENTRYMAX, + BATTLE_ERR_TYPE, + BATTLE_ERR_CHARAINDEX, + BATTLE_ERR_BATTLEINDEX, + BATTLE_ERR_NOENEMY, + BATTLE_ERR_ALREADYBATTLE, + BATTLE_ERR_SAMEPARTY, + BATTLE_ERR_END +}BATTLE_ERR; + + +enum{ + BATTLE_S_TYPE_PLAYER = 0, + BATTLE_S_TYPE_ENEMY, + BATTLE_S_TYPE_END +}; + + +typedef enum{ + BATTLE_COM_NONE, + BATTLE_COM_ATTACK, + BATTLE_COM_GUARD, + BATTLE_COM_CAPTURE, + BATTLE_COM_ESCAPE, + BATTLE_COM_PETIN, + BATTLE_COM_PETOUT, + BATTLE_COM_ITEM, + BATTLE_COM_BOOMERANG, + BATTLE_COM_COMBO, + BATTLE_COM_COMBOEND, + BATTLE_COM_WAIT, + + BATTLE_COM_SEKIBAN = 1000, + BATTLE_COM_S_RENZOKU, + BATTLE_COM_S_GBREAK, + BATTLE_COM_S_GUARDIAN_ATTACK, + BATTLE_COM_S_GUARDIAN_GUARD, + BATTLE_COM_S_CHARGE, + BATTLE_COM_S_MIGHTY, + BATTLE_COM_S_POWERBALANCE, + BATTLE_COM_S_STATUSCHANGE, + BATTLE_COM_S_EARTHROUND0, + BATTLE_COM_S_EARTHROUND1, + BATTLE_COM_S_LOSTESCAPE, + BATTLE_COM_S_ABDUCT, + BATTLE_COM_S_STEAL, + BATTLE_COM_S_NOGUARD, + BATTLE_COM_S_CHARGE_OK, + BATTLE_COM_JYUJYUTU = 2000, + + BATTLE_COM_COMPELESCAPE, //ǿ뿪 + +#ifdef _ATTACK_MAGIC + BATTLE_COM_S_ATTACK_MAGIC, // ħ +#endif + +#ifdef _PSKILL_FALLGROUND + BATTLE_COM_S_FALLRIDE, // +#endif +#ifdef _PETSKILL_TIMID + BATTLE_COM_S_TIMID, +#endif +#ifdef _PETSKILL_2TIMID + BATTLE_COM_S_2TIMID, +#endif +#ifdef _PETSKILL_ANTINTER + BATTLE_COM_S_ANTINTER, +#endif +#ifdef _PETSKILL_PROPERTY + BATTLE_COM_S_PROPERTYSKILL, +#endif +#ifdef _PETSKILL_TEAR + BATTLE_COM_S_PETSKILLTEAR, +#endif +#ifdef _BATTLE_LIGHTTAKE + BATTLE_COM_S_LIGHTTAKE, +#endif +#ifdef _BATTLE_ATTCRAZED // ANDY + BATTLE_COM_S_ATTCRAZED, +#endif +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 + BATTLE_COM_S_ATTSHOOT, +#endif +#ifdef _BATTLESTEAL_FIX + BATTLE_COM_S_STEALMONEY, +#endif +#ifdef _PRO_BATTLEENEMYSKILL + BATTLE_COM_S_ENEMYRELIFE, //NPC ENEMY  + BATTLE_COM_S_ENEMYREHP, //NPC ENEMY Ѫ + BATTLE_COM_S_ENEMYHELP, //NPC ENEMY +#endif +#ifdef _SKILL_DAMAGETOHP + BATTLE_COM_S_DAMAGETOHP, //Ѫ +#endif +#ifdef _Skill_MPDAMAGE + BATTLE_COM_S_MPDAMAGE, //MP˺ +#endif +#ifdef _SKILL_WILDVIOLENT_ATT + BATTLE_COM_S_WILDVIOLENTATTACK, //񱩹 vincent add 2002/05/16 +#endif + +#ifdef _SKILL_SPEEDY_ATT + BATTLE_COM_S_SPEEDYATTACK, //ٹ vincent add 2002/05/20 +#endif +#ifdef _SKILL_GUARDBREAK2 + BATTLE_COM_S_GBREAK2, //Ƴ2 vincent add 2002/05/20 +#endif +#ifdef _SKILL_SACRIFICE + BATTLE_COM_S_SACRIFICE, //Ԯ vincent add 2002/05/30 +#endif +#ifdef _SKILL_WEAKEN + BATTLE_COM_S_WEAKEN, // vincent add 2002/07/11 +#endif +#ifdef _SKILL_DEEPPOISON + BATTLE_COM_S_DEEPPOISON, //綾 vincent add 2002/07/16 +#endif +#ifdef _SKILL_BARRIER + BATTLE_COM_S_BARRIER, //ħ vincent add 2002/07/16 +#endif +#ifdef _SKILL_NOCAST + BATTLE_COM_S_NOCAST, //Ĭ vincent add 2002/07/16 +#endif +#ifdef _SKILL_ROAR + BATTLE_COM_S_ROAR, // vincent add 2002/07/11 +#endif +#ifdef _BATTLENPC_WARP_PLAYER + BATTLE_COM_WARP, // npc warp player +#endif +#ifdef _SKILL_TOOTH + BATTLE_COM_S_TOOTHCRUSHE, +#endif +#ifdef _PSKILL_MODIFY + BATTLE_COM_S_MODIFYATT, +#endif +#ifdef _PSKILL_MDFYATTACK + BATTLE_COM_S_MDFYATTACK, +#endif +#ifdef _MAGIC_SUPERWALL + BATTLE_COM_S_SUPERWALL, +#endif +#ifdef _SKILL_REFRESH + BATTLE_COM_S_REFRESH, +#endif +#ifdef _VARY_WOLF + BATTLE_COM_S_VARY, +#endif +#ifdef _PETSKILL_SETDUCK + BATTLE_COM_S_SETDUCK, +#endif +#ifdef _MAGICPET_SKILL + BATTLE_COM_S_SETMAGICPET, +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + +// ʦ + BATTLE_COM_S_VOLCANO_SPRINGS, // ɽȪ + BATTLE_COM_S_FIRE_BALL, // + BATTLE_COM_S_FIRE_SPEAR, // ǹ + BATTLE_COM_S_SUMMON_THUNDER, // + BATTLE_COM_S_CURRENT, // + BATTLE_COM_S_STORM, // + BATTLE_COM_S_ICE_ARROW, // + BATTLE_COM_S_ICE_CRACK, // + BATTLE_COM_S_ICE_MIRROR, // + BATTLE_COM_S_DOOM, // ĩ + BATTLE_COM_S_BLOOD, // Ѫ + BATTLE_COM_S_BLOOD_WORMS, // Ѫ + BATTLE_COM_S_SIGN, // һѪ + BATTLE_COM_S_FIRE_ENCLOSE, // + BATTLE_COM_S_ICE_ENCLOSE, // + BATTLE_COM_S_THUNDER_ENCLOSE, // ׸ + BATTLE_COM_S_ENCLOSE, // + BATTLE_COM_S_TRANSPOSE, // λλ +// ʿ + BATTLE_COM_S_BRUST, // + BATTLE_COM_S_CHAIN_ATK, // + BATTLE_COM_S_AVOID, // ر + BATTLE_COM_S_RECOVERY, // Ѫ + BATTLE_COM_S_WEAPON_FOCUS, // ר + BATTLE_COM_S_REBACK, // ״̬ظ + BATTLE_COM_S_CHAIN_ATK_2, // ˫ع + BATTLE_COM_S_SCAPEGOAT, // Ϊ + BATTLE_COM_S_ENRAGE, // + BATTLE_COM_S_COLLECT, // ۼ + BATTLE_COM_S_FOCUS, // רעս + BATTLE_COM_S_SHIELD_ATTACK, // ܻ + BATTLE_COM_S_DUAL_WEAPON, // + BATTLE_COM_S_DEFLECT, // + BATTLE_COM_S_THROUGH_ATTACK, // ᴩ + BATTLE_COM_S_CAVALRY, // ﹥ + BATTLE_COM_S_DEAD_ATTACK, // + BATTLE_COM_S_CONVOLUTE, // + BATTLE_COM_S_CHAOS, // ҹ +// + BATTLE_COM_S_TRAP, // + BATTLE_COM_S_TRACK, // ׷Ѱ + BATTLE_COM_S_DOCILE, // ѱ + BATTLE_COM_S_ENRAGE_PET, // ŭ + BATTLE_COM_S_DRAGNET, // ޵ + BATTLE_COM_S_ENTWINE, // + BATTLE_COM_S_AUTARKY, // Ը + BATTLE_COM_S_PLUNDER, // Ӷ + BATTLE_COM_S_TOXIN_WEAPON, // + BATTLE_COM_S_RESIST_FIRE, // + BATTLE_COM_S_RESIST_ICE, // + BATTLE_COM_S_RESIST_THUNDER, // ׿ + BATTLE_COM_S_G_RESIST_FIRE, // + BATTLE_COM_S_G_RESIST_ICE, // + BATTLE_COM_S_G_RESIST_THUNDER, // ׿ + BATTLE_COM_S_ATTACK_WEAK, // 㹥 + BATTLE_COM_S_INSTIGATE, // + BATTLE_COM_S_OBLIVION, // +#ifdef _PROFESSION_ADDSKILL + BATTLE_COM_S_RESIST_F_I_T, // Ȼ + BATTLE_COM_S_CALL_NATURE, // Ȼ + BATTLE_COM_S_BOUNDARY, // Խ +#endif +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + BATTLE_COM_S_SARS, +#endif +#ifdef _SONIC_ATTACK // WON ADD + BATTLE_COM_S_SONIC, + BATTLE_COM_S_SONIC2, +#endif +#ifdef _PETSKILL_REGRET + BATTLE_COM_S_REGRET, + BATTLE_COM_S_REGRET2, +#endif +#ifdef _PETSKILL_GYRATE + BATTLE_COM_S_GYRATE, +#endif +#ifdef _PETSKILL_ACUPUNCTURE + BATTLE_COM_S_ACUPUNCTURE, +#endif +#ifdef _PETSKILL_RETRACE + BATTLE_COM_S_RETRACE, +#endif +#ifdef _PETSKILL_HECTOR + BATTLE_COM_S_HECTOR, +#endif +#ifdef _PETSKILL_FIREKILL + BATTLE_COM_S_FIREKILL, +#endif +#ifdef _PETSKILL_DAMAGETOHP + BATTLE_COM_S_DAMAGETOHP2, //¿(Ѫı) +#endif +#ifdef _PETSKILL_BECOMEFOX + BATTLE_COM_S_BECOMEFOX, +#endif +#ifdef _PETSKILL_BECOMEPIG + BATTLE_COM_S_BECOMEPIG, +#endif +#ifdef _PETSKILL_SHOWMERCY + BATTLE_COM_S_SHOWMERCY, +#endif +#ifdef _PETSKILL_LER + BATTLE_COM_S_BAT_FLY, // ׶ - ȺĴ + BATTLE_COM_S_DIVIDE_ATTACK, // ׶ - +#endif +#ifdef _PETSKILL_BATTLE_MODEL + BATTLE_COM_S_BATTLE_MODEL, // \սģ +#endif + BATTLE_COM_S_ZIYUN1, +#ifdef _OFFLINE_SYSTEM + BATTLE_COM_S_OFFLINE_RECOVERY, +#endif + + BATTLE_COM_END +}BATTLE_COM; + + +enum{ + BATTLE_RET_NORMAL, + BATTLE_RET_CRITICAL, + BATTLE_RET_MISS, + BATTLE_RET_DODGE, + BATTLE_RET_ALLGUARD, +#ifdef _EQUIT_ARRANGE + BATTLE_RET_ARRANGE, +#endif + BATTLE_RET_END +}BATTLE_RET; + + +#define BC_FLG_NEW (1<<0) +#define BC_FLG_DEAD (1<<1) +#define BC_FLG_PLAYER (1<<2) +#define BC_FLG_POISON (1<<3) +#define BC_FLG_PARALYSIS (1<<4) +#define BC_FLG_SLEEP (1<<5) +#define BC_FLG_STONE (1<<6) +#define BC_FLG_DRUNK (1<<7) +#define BC_FLG_CONFUSION (1<<8) +#define BC_FLG_HIDE (1<<9) +#define BC_FLG_REVERSE (1<<10) +#ifdef _MAGIC_WEAKEN +#define BC_FLG_WEAKEN (1<<11) // +#endif +#ifdef _MAGIC_DEEPPOISON +#define BC_FLG_DEEPPOISON (1<<12) // 綾 +#endif +#ifdef _MAGIC_BARRIER +#define BC_FLG_BARRIER (1<<13) // ħ +#endif +#ifdef _MAGIC_NOCAST +#define BC_FLG_NOCAST (1<<14) // Ĭ +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ +#define BC_FLG_SARS (1<<15) // ɷ +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#define BC_FLG_DIZZY (1<<16) // ѣ +#define BC_FLG_ENTWINE (1<<17) // +#define BC_FLG_DRAGNET (1<<18) // ޵ +#define BC_FLG_ICECRACK (1<<19) // +#define BC_FLG_OBLIVION (1<<20) // +#define BC_FLG_ICEARROW (1<<21) // +#define BC_FLG_BLOODWORMS (1<<22) // Ѫ +#define BC_FLG_SIGN (1<<23) // һѪ +#define BC_FLG_CARY (1<<24) // +#define BC_FLG_F_ENCLOSE (1<<25) // +#define BC_FLG_I_ENCLOSE (1<<26) // +#define BC_FLG_T_ENCLOSE (1<<27) // ׸ +#ifdef _PROFESSION_ADDSKILL +#define BC_FLG_WATER (1<<28) // ˮ +#define BC_FLG_FEAR (1<<29) // ־ +#endif +#ifdef _PETSKILL_LER +#define BC_FLG_CHANGE (1<<30) // ׶ +#endif +#endif + + + + +#define BP_FLG_JOIN (1<<0) +#define BP_FLG_PLAYER_MENU_OFF (1<<1) +#define BP_FLG_BOOMERANG (1<<2) +#define BP_FLG_PET_MENU_OFF (1<<3) +#define BP_FLG_ENEMY_SURPRISAL (1<<4) +#define BP_FLG_PLAYER_SURPRISAL (1<<5) + + +#define CHAR_BATTLEFLG_ULTIMATE (1<<0) +#define CHAR_BATTLEFLG_AIBAD (1<<1) +#define CHAR_BATTLEFLG_REVERSE (1<<2) +#define CHAR_BATTLEFLG_GUARDIAN (1<<3) +#define CHAR_BATTLEFLG_NORETURN (1<<4) +#define CHAR_BATTLEFLG_RECOVERY (1<<5) +#define CHAR_BATTLEFLG_ABIO (1<<6) +#define CHAR_BATTLEFLG_NODUCK (1<<7) + +#define GETITEM_MAX 3 +typedef struct +{ + int attacker; +}INVADER; + +typedef struct +{ + int charaindex; + int bid; + int escape; + int flg; + int guardian; + int duelpoint; + int getitem[GETITEM_MAX]; +}BATTLE_ENTRY; +#define BENT_FLG_ULTIMATE (1<<0) + +typedef struct +{ + int type; + int flg; + int common_dp; + BATTLE_ENTRY Entry[BATTLE_ENTRY_MAX]; +}BATTLE_SIDE; + +#define BSIDE_FLG_SURPRISE ( 1 << 0 ) +#define BSIDE_FLG_HELP_OK ( 1 << 1 ) + +#ifdef _ALLBLUES_LUA_1_4 +typedef enum +{ + BATTLE_FINISH, + BATTLE_ESCAPE, + BATTLE_FUNCTABLENUM, +}BATTLE_FUNCTABLE; +#endif + +//typedef struct _Battle +//{ +// BOOL use; /* Ȼ¾ */ +// int battleindex; /* į */ +// int mode; /* ػ ƹ */ +// int type; /* (0:ɧ)(1:DUEL)(2:ʾ) */ +// int dpbattle; /* DPᆴ */ +// int norisk; /* ƥͼ ᆴ */ +// int turn; /* */ +// int timer; /* Ѩ */ +// int leaderindex; /* ޼ëڳƽҷ¼̼͵ */ +//#ifdef _AUTO_PK +// char leadercdkey[CDKEYLEN]; +// char leadername[CHARNAMELEN]; +// int rivalindex; +// char rivalcdkey[CDKEYLEN]; +// char rivalname[CHARNAMELEN]; +//#endif +// int winside; /* */ +// int field_att; /* ū */ +// int att_count; /* ū Ѩ */ +// int att_pow; /* ū ɷ */ +// int field_no; +// int flg; /* ˰׷º */ +// BATTLE_SIDE Side[2]; +//#ifdef _BATTLE_TIMESPEED +// unsigned int CreateTime; +// unsigned int EndTime; +// unsigned int PartTime; +// int flgTime; +// +//#endif +// +//#ifdef _PROFESSION_ADDSKILL +// // +// int ice_count;//ݴ +// int ice_bout[20];//غϼ +// BOOL ice_use[20];//Ƿʹ +// int ice_toNo[20];// +// int ice_level[20];// +// int ice_array[20]; +// int ice_charaindex[20]; +// int ice_attackNo[20]; +//#endif +// +// int iEntryBack[BATTLE_ENTRY_MAX*2]; // ľ׶ +// int iEntryBack2[BATTLE_ENTRY_MAX*2]; // ľ׶ +// int createindex; /* 𼰾 ëԻƽҷ̼͵(NPCئ) */ +// int (*WinFunc)( int battleindex, int charaindex ); +// struct _Battle *pNext; // ݼ +// struct _Battle *pBefore; // 󡼰 +//}BATTLE; + +typedef struct _Battle +{ + BOOL use; /* Ȼ¾ */ + int battleindex; /* į */ + int mode; /* ػ ƹ */ + int type; /* (0:ɧ)(1:DUEL)(2:ʾ) */ + int dpbattle; /* DPᆴ */ + int norisk; /* ƥͼ ᆴ */ + int turn; /*غ*/ + int timer; /* Ѩ */ + int leaderindex; /* ޼ëڳƽҷ¼̼͵ */ +#ifdef _AUTO_PK + char leadercdkey[CDKEYLEN]; + char leadername[CHARNAMELEN]; + int rivalindex; + char rivalcdkey[CDKEYLEN]; + char rivalname[CHARNAMELEN]; +#endif + int BattleFloor; /* */ + int winside; /* */ + int field_att; /* ū */ + int att_count; /* ū Ѩ */ + int att_pow; /* ū ɷ */ + int field_no; + int flg; /* ˰׷º */ + BATTLE_SIDE Side[2]; +#ifdef _BATTLE_TIMESPEED + unsigned int CreateTime; + unsigned int EndTime; + unsigned int PartTime; + int flgTime; + +#endif + +#ifdef _PROFESSION_ADDSKILL + // + int ice_count;//ݴ + int ice_bout[20];//غϼ + BOOL ice_use[20];//Ƿʹ + int ice_toNo[20];// + int ice_level[20];// + int ice_array[20]; + int ice_charaindex[20]; + int ice_attackNo[20]; +#endif + +#ifdef _DEATH_CONTEND + int menum; + int tonum; +#endif + +#ifdef _ACTION_BULLSCR + int enemynum; +#endif + int iEntryBack[BATTLE_ENTRY_MAX*2]; // ľ׶ + int iEntryBack2[BATTLE_ENTRY_MAX*2]; // ľ׶ + int createindex; /* 𼰾 ëԻƽҷ̼͵(NPCئ) */ + int (*WinFunc)( int battleindex, int charaindex ); +#ifdef _ALLBLUES_LUA_1_4 + lua_State *lua[BATTLE_FUNCTABLENUM]; + char *luafunctable[BATTLE_FUNCTABLENUM]; +#endif +#ifdef _DEATH_CONTEND//ʤfunc + int (*PkFunc)( int menum, int tonum, int winside, int battlemap); + int battlemap; +#endif + struct _Battle *pNext; // ݼ + struct _Battle *pBefore; // 󡼰 +/*#ifdef _JZ_NEWSCRIPT_LUA + int (*BakFunc)( int battleindex, int charaindex ); + char BakLuaFuncName[32]; +#endif*/ +#ifdef _JZ_NEWSCRIPT_LUA + int (*BakFunc)(int battleindex , int charaindex); + int (*EndFunc)( int battleindex ); + char BakLuaFuncName[32]; + char EndLuaFuncName[32]; +#endif + int floor; + int battletime; +}BATTLE; + + +#define BATTLE_FLG_FREEDP ( 1 << 0 ) // ͻ Ӽئ +#define BATTLE_FLG_CHARALOST ( 1 << 1 ) // ƽҷ»ϷԻ Իƻ + + + +enum{ // field_att ľ° + BATTLE_ATTR_NONE = 0, // + BATTLE_ATTR_EARTH, // + BATTLE_ATTR_WATER, // + BATTLE_ATTR_FIRE, // + BATTLE_ATTR_WIND, // + BATTLE_ATTR_END +}; + + +//krynn 2001/12/28 +enum +{ + BATTLE_SIDE_RIGHT, // սҲ right side of battle + BATTLE_SIDE_LEFT, // ս left side of battle + BATTLE_SIDE_WATCH, // ս watch battle player +}; +//krynn end + +#define TARGET_SIDE_0 20 // 㯴 ϶ +#define TARGET_SIDE_1 21 // ϶ +#define TARGET_ALL 22 // ϶ + +#ifdef _ATTACK_MAGIC + +#define TARGET_SIDE_0_B_ROW 26 // һ +#define TARGET_SIDE_0_F_ROW 25 // ǰһ +#define TARGET_SIDE_1_F_ROW 24 // ǰһ +#define TARGET_SIDE_1_B_ROW 23 // һ + +// won add +#define TARGER_THROUGH 27 + +#endif + +extern int gItemCrushRate; // ç ɻ +extern BATTLE *BattleArray; /* */ +extern int BATTLE_battlenum; /* */ +extern char szAllBattleString[BATTLE_STRING_MAX]; /* Ѩ ٯ */ +extern char *pszBattleTop, *pszBattleLast; /* ٯ */ +extern char szBadStatusString[1024]; // ٯ +extern int gWeponType; // ػ տ +extern float gDamageDiv; // ĸ + +#define BATTLE_CHECKINDEX( a ) ( ((a)>=BATTLE_battlenum || (a)<0 )?(FALSE):(TRUE) ) +#define BATTLE_CHECKSIDE( a ) ( ((a)>=2 || (a)<0)?(FALSE):( TRUE) ) +#define BATTLE_CHECKNO( a ) ( ((a)>=20 || (a)<0 )?(FALSE):(TRUE) ) +#define BATTLE_CHECKADDRESS( a ) ((&BattleArray[0])<=(a) && (a)<=(&BattleArray[BATTLE_battlenum-1] )?(TRUE):(FALSE) ) + +#define IsBATTLING( a ) (CHAR_getWorkInt((a),CHAR_WORKBATTLEMODE)?(TRUE):(FALSE)) + +#define STRCPY_TAIL( _pszTop, _pszLast, _szBuffer) { int _len = strlen( _szBuffer ); ( _pszTop + _len < (_pszLast)-1 )?( memcpy( _pszTop, _szBuffer, _len ), _pszTop += _len, _pszTop[0] = 0):(0); } + +#define BATTLESTR_ADD( _szBuffer ){ int _len = strlen( _szBuffer ); ( pszBattleTop + _len < ( pszBattleLast)-1 )?( memcpy( pszBattleTop, _szBuffer, _len ), pszBattleTop += _len, pszBattleTop[0] = 0):(0); } + +#define BATTLE_MAP_MAX 219 + +#define CH_FIX_PLAYERLEVELUP (+2) // ìﻥʧ +#define CH_FIX_PLAYERDEAD (-2) // ɧ +#define CH_FIX_PLAYEULTIMATE (-4) // ʧ ū +#define CH_FIX_PETESCAPE (-1) // ʸ + +#define AI_FIX_PETLEVELUP (+5*100) // ʸìʧ +#define AI_FIX_PETWIN (+1) // ʸë +#define AI_FIX_PETGOLDWIN (+2*10) // ʸìPгë +#define AI_FIX_PETRECOVERY (+10) // ƻ +#define AI_FIX_PETRESSURECT (+3*100) // ƻ +//#define AI_FIX_PETRECOVERY (+50) // ƻ + +#define AI_FIX_SEKKAN (-2*100) // мʸë +#define AI_FIX_PLAYERULTIMATE (-10*100) // мDZлʧ ū +#define AI_FIX_PETULTIMATE (-10*100) // ʸʧ ū +#define AI_FIX_PLAYERDEAD (-1*100) // мDZл +#define AI_FIX_PETDEAD (-5*100) // ʸ + + +#ifdef _Item_ReLifeAct +int BATTLE_getBattleDieIndex( int battleindex, int bid ); +#endif + +int BATTLE_No2Index( int battleindex, int No); + +int BATTLE_Index2No( int battleindex, int charaindex); + +BOOL BATTLE_initBattleArray( int battlenum); + +int BATTLE_CreateBattle( int charaindex ); +int BATTLE_DeleteBattle( int battleindex); + +int BATTLE_NewEntry( int charaindex, int battleindex, int side); + +#define BATTLE_Exit( charaindex, battleindex) _BATTLE_Exit( __FILE__, __LINE__, charaindex, battleindex) +INLINE int _BATTLE_Exit( char *file, int line, int charaindex ,int battleindex); + +#define BATTLE_ExitAll( battleindex) _BATTLE_ExitAll( __FILE__, __LINE__, battleindex) +INLINE void _BATTLE_ExitAll( char *file, int line, int battleindex); + +int BATTLE_CreateVsPlayer( int charaindex0, int charaindex1); + +int BATTLE_CreateVsEnemy( int charaindex, int mode, int npcindex); + +int BATTLE_CountEntry( int battleindex, int side); + +int BATTLE_Loop( void ); + +int BATTLE_FinishSet( int battleindex ); +int BATTLE_StopSet( int battleindex ); +int BATTLE_RescueEntry( int charaindex, int toindex); + +int BATTLE_PetDefaultExit( int charaindex, int battleindex); + +int BATTLE_PetDefaultEntry( + int charaindex, // ʸë Ȼ + int battleindex,// ̼͵ + int side +); + +BOOL BATTLE_RescueTry( int charaindex); + +BOOL BATTLE_RescueParentTry( + int charaindex, + int pindex + ); + +int BATTLE_DefaultAttacker( int battleindex, int side); + +BOOL BATTLE_IsThrowWepon( int itemindex); + +void BATTLE_BadStatusString( int defNo, int status ); +int BATTLE_MultiList( int battleindex, int toNo, int ToList[] ); +BOOL BATTLE_IsCharge( int com ); +BOOL BATTLE_CanMoveCheck( int charaindex ); +int BATTLE_TargetCheck( int battleindex, int defNo); +char *BATTLE_CharTitle( int charaindex ); +void BATTLE_EscapeDpSend( int battleindex, int charaindex ); +int BATTLE_GetDuelPoint( int battleindex, int side, int num); +int BATTLE_TargetCheckDead( int battleindex, int defNo); + +void BATTLE_MultiListDead( int battleindex, int toNo, int ToList[] ); +BOOL BATTLE_WatchTry( int charaindex); +int BATTLE_WatchEntry( int charaindex, int toindex); +void BATTLE_WatchStop( int charaindex ); +int BATTLE_WatchUnLink( int battleindex ); +void BATTLE_BpSendToWatch( BATTLE *pBattle, char *pszBcString); + +int BATTLE_GetWepon( int charaindex ); + +#ifdef _ITEM_EQUITSPACE +int BATTLE_GetEqShield( int charaindex ); +#endif + +int BATTLE_GetAttackCount( int charaindex ); +int DoujyouRandomWeponSet( int charaindex ); +void BATTLE_AttReverse( int charaindex ); +void BATTLE_BadStatusAllClr( int charaindex ); +#define CHAR_GETWORKINT_HIGH( index, pos ) ( CHAR_getWorkInt( (index), (pos) ) >> 16 ) +#define CHAR_SETWORKINT_HIGH( index, pos, set ) { int iTmp = CHAR_getWorkInt( (index), (pos) ) & 0xFFFF, work = (set); CHAR_setWorkInt( (index), (pos), (work << 16)|iTmp ); } +#define CHAR_GETWORKINT_LOW( index, pos ) ( CHAR_getWorkInt( (index), (pos) ) & 0xFFFF ) +#define CHAR_SETWORKINT_LOW( index, pos, set ) { int iTmp = CHAR_getWorkInt( index, pos ) & 0xFFFF0000, work = (set); CHAR_setWorkInt( (index), (pos), (work & 0x0000FFFF) | iTmp ); } + +int Battle_getTotalBattleNum(); + +#ifdef _TYPE_TOXICATION +void CHAR_ComToxicationHp( int charaindex); +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +void BATTLE_ProfessionStatus_init( int battleindex, int charaindex ); +void BATTLE_ProfessionStatusSeq( int battleindex, int charaindex); +#endif + + +#endif +#ifdef _FM_NPC_LOOK_WAR +int SearchFmWarRandIndex(int charaindex,int fmwarfloor); +char* SearchFmWar(int charaindex,int fmwarselect); +int LookFmWarIndex(int charaindex,int fmwarselect); + +#ifdef _ALLBLUES_LUA_1_4 +INLINE BOOL BATTLE_setLUAFunction( int battleindex, int functype, lua_State *L, const char *luafunctable); +INLINE lua_State *BATTLE_getLUAFunction( int battle, int functype); +#endif + +void Enemy_setStayLoop(int charaindex); +#endif diff --git a/include/battle_ai.h b/include/battle_ai.h new file mode 100644 index 0000000..a7fc394 --- /dev/null +++ b/include/battle_ai.h @@ -0,0 +1,10 @@ +#ifndef __BATTLE_AI_H__ +#define __BATTLE_AI_H__ + +/* Ի */ +int BATTLE_ai_all( int battleindex, int side, int turn); +int BATTLE_ai_one( int charaindex, int battleindex, int side, int turn); +#ifdef _ENEMY_ATTACK_AI +int GetSubdueAtt(int index); +#endif +#endif diff --git a/include/battle_command.h b/include/battle_command.h new file mode 100644 index 0000000..c98b697 --- /dev/null +++ b/include/battle_command.h @@ -0,0 +1,27 @@ +#ifndef __BATTLE_COMMAND_H__ +#define __BATTLE_COMMAND_H__ + +void BattleCommandDispach( + int fd, + char *command +); + +void BattleEncountOut( + int charaindex +); + +BOOL BATTLE_CommandSend( int charaindex, char *pszCommand ); + +BOOL BATTLE_MakeCharaString( + int battleindex, + char *pszCommand, // ƽҷ + int size // +); + +void BATTLE_CharSendAll( int battleindex ); + +BOOL BATTLE_PetDefaultCommand( int petindex ); + +void BATTLE_ActSettingSend( int battleindex ); + +#endif diff --git a/include/battle_event.h b/include/battle_event.h new file mode 100644 index 0000000..044b6fe --- /dev/null +++ b/include/battle_event.h @@ -0,0 +1,382 @@ +#ifndef __BATTLE_EVENT_H__ +#define __BATTLE_EVENT_H__ + +#define BCC_HIT 'H' +#define BCC_FIRE 'F' + +#define BCF_DEATH (1 << 0) +#define BCF_NORMAL (1 << 1) +#define BCF_KAISHIN (1 << 2) +#define BCF_GUARD (1 << 3) +#define BCF_COUNTER (1 << 4) +#define BCF_DODGE (1 << 5) +#define BCF_ULTIMATE_1 (1 << 6) +#define BCF_ULTIMATE_2 (1 << 7) +#define BCF_GBREAK (1 << 8) +#define BCF_GUARDIAN (1 << 9) +#define BCF_REFRECT (1 << 10) +#define BCF_ABSORB (1 << 11) +#define BCF_VANISH (1 << 12) +#define BCF_CRUSH (1 << 13) +#define BCF_FALL (1 << 14) // +#ifdef _SKILL_TOOTH +#define BCF_TOOTH (1 << 15) //ܳ +#endif +#ifdef _PSKILL_MODIFY +#define BCF_ATTDOUBLE (1 << 16) //ǿ +#endif +#ifdef _SKILL_ROAR +#define BCF_ROAR (1 << 17) //輼:() +#endif + +#ifdef _MAGIC_DEFMAGICATT +#define BCF_DEFMAGICATT (1 << 19) +#endif +#ifdef _MAGIC_SUPERWALL +#define BCF_SUPERWALL (1 << 20) +#endif +#ifdef _PSKILL_MDFYATTACK +#define BCF_MODIFY (1 << 21) +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#define BCF_F_SKILLACT (1 << 22) //ǰͼ +#define BCF_TRAP (1 << 25) // +#define BCF_NO_DAMAGE (1 << 26) //˫ع +#endif +#define BCF_B_SKILLACT (1 << 23) //ͼ + + + +#ifdef _EQUIT_ARRANGE +#define BCF_B_ARRANGE (1 << 24) //ͼ +#endif + +#ifdef _PETSKILL_ACUPUNCTURE +#define BCF_ACUPUNCTURE (1 << 27) +#endif + +#ifdef _PETSKILL_ANTINTER +#define BCF_ANTINTER (1 << 28) +#endif + +#ifdef _OTHER_MAGICSTAUTS +#ifdef _MAGICSTAUTS_RESIST +#define MAXSTATUSTYPE 6 +#else +#define MAXSTATUSTYPE 3 +#endif //_MAGICSTAUTS_RESIST +extern char MagicStatus[MAXSTATUSTYPE][36]; +extern int MagicTbl[]; +extern int MagicTypeTbl[]; +#endif + +extern char *aszStatus[]; +extern char *aszStatusFull[]; +extern int StatusTbl[]; +extern int RegTbl[]; +extern int MagicDefTbl[]; +extern char *aszMagicDefFull[]; +extern char *aszMagicDef[]; + +extern char *aszParamChange[]; +extern char *aszParamChangeFull[]; +extern int aParamChangeTbl[]; + +extern float gBattleDamageModyfy; +extern int gBattleDuckModyfy; +extern int gBattleStausChange; +extern int gBattleStausTurn; + +enum{ + BATTLE_ST_NONE, // 0 "", + BATTLE_ST_POISON, // 1 "", + BATTLE_ST_PARALYSIS, // 2 "", + BATTLE_ST_SLEEP, // 3 "", + BATTLE_ST_STONE, // 4 "ʯ", + BATTLE_ST_DRUNK, // 5 "", + BATTLE_ST_CONFUSION, // 6 "", + BATTLE_ST_WEAKEN, // 7 "" + BATTLE_ST_DEEPPOISON,// 8 "綾" + BATTLE_ST_BARRIER, // 9 "ħ" + BATTLE_ST_NOCAST, // 10 "Ĭ" +#ifdef _PET_SKILL_SARS // WON ADD ɷ + BATTLE_ST_SARS, // 11 "ɷ" +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + BATTLE_ST_DIZZY, // 12 "" + BATTLE_ST_ENTWINE, // 13 "" + BATTLE_ST_DRAGNET, // 14 "޵" + BATTLE_ST_ICECRACK, // 15 "" + BATTLE_ST_OBLIVION, // 16 "" + BATTLE_ST_ICEARROW, // 17 "" + BATTLE_ST_BLOODWORMS,// 18 "Ѫ" + BATTLE_ST_SIGN, // 19 "һѪ" + BATTLE_ST_INSTIGATE, // 20 "" + BATTLE_ST_F_ENCLOSE, // 21 "" + BATTLE_ST_I_ENCLOSE, // 22 "" + BATTLE_ST_T_ENCLOSE, // 23 "׸" + BATTLE_ST_FOCUS, // 24 "רעս" + BATTLE_ST_RESIST_F, // 25 "" + BATTLE_ST_RESIST_I, // 26 "" + BATTLE_ST_RESIST_T, // 27 "׿" + BATTLE_ST_F_ENCLOSE2, // 28 "" + BATTLE_ST_I_ENCLOSE2, // 29 "" + BATTLE_ST_T_ENCLOSE2, // 30 "׸" +#ifdef _PROFESSION_ADDSKILL + BATTLE_ST_RESIST_F_I_T, //31 "׿" + //BATTLE_ST_BOUNDARY_F, //32 " + BATTLE_ST_WATER, //32 "ˮ" + BATTLE_ST_WORKANNEX, //33 "" + BATTLE_ST_FEAR, //34 "־" + BATTLE_ST_ICECRACK2, // 35 "" + BATTLE_ST_ICECRACK3, // 36 + BATTLE_ST_ICECRACK4, // 37 + BATTLE_ST_ICECRACK5, // 38 + BATTLE_ST_ICECRACK6, // 39 + BATTLE_ST_ICECRACK7, // 40 + BATTLE_ST_ICECRACK8, // 41 + BATTLE_ST_ICECRACK9, // 42 + BATTLE_ST_ICECRACK10, // 43 +#endif + +#endif + + BATTLE_ST_END +}; + +#ifdef _OTHER_MAGICSTAUTS +enum{ + BATTLE_MST_NONE, + BATTLE_MST_DEFMAGIC, + BATTLE_MST_SUPERWALL, +#ifdef _MAGICSTAUTS_RESIST + BATTLE_MST_MAGICFIRE, + BATTLE_MST_MAGICTHUNDER, + BATTLE_MST_MAGICICE, +#endif + BATTLE_MST_END +}; +#endif + +enum{ + BATTLE_MD_NONE, + BATTLE_MD_ABSROB, + BATTLE_MD_REFLEC, + BATTLE_MD_VANISH, + BATTLE_MD_TRAP, +#ifdef _PETSKILL_ACUPUNCTURE + BATTLE_MD_ACUPUNCTURE, //Ƥ +#endif + BATTLE_MD_END +}; + +#ifdef _PETSKILL_RETRACE + //BATTLE_AttackʽִĹģʽ +typedef struct tagBattle_Attack_ReturnData_x1 +{ + int Battle_Attack_ReturnData; +}Battle_Attack_ReturnData_x1; +Battle_Attack_ReturnData_x1 Battle_Attack_ReturnData_x; + +#endif + +int BATTLE_DamageCalc( int attackindex, int defindex ); + +BOOL BATTLE_Attack( int battleindex, int attackNo, int defNo ); + +BOOL BATTLE_Counter( int battleindex, int attackNo, int defNo ); + +BOOL BATTLE_Capture( int battleindex, int attackNo, int defNo ); + +void BATTLE_Guard( int battleindex, int attackNo ); + +// Nuke 20040112 fix for performance +#define BATTLE_BroadCast(A,B,C) 0 +#define BATTLE_BroadCastOn(A,B,C) 0 +//int BATTLE_BroadCast( int battleindex, char *pszBuffer, int color ); +//int BATTLE_BroadCastOn( int battleindex, char *pszBuffer, int color ); + +BOOL BATTLE_Escape( int battleindex, int attackNo, int flag); + +int BATTLE_NoAction( int battleindex, int attackNo ); + +int BATTLE_PetIn( int battleindex, int attackNo ); + +int BATTLE_PetOut( int battleindex, int attackNo ); + +int BATTLE_SurpriseCheck( int battleindex ); + +int BATTLE_Magic( int battleindex, int attackNo ); + +int BATTLE_S_GBreak( int battleindex, int attackNo, int defNo ); + +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 +int BATTLE_S_GBreak2( int battleindex, int attackNo, int defNo ); +#endif + +#ifdef _SKILL_SACRIFICE +int BATTLE_S_Sacrifice( int battleindex, int attackNo, int defNo ); +#endif + +#ifdef _SKILL_REFRESH +int BATTLE_S_Refresh( int battleindex, int attackNo, int defNo, int marray ); +#endif + +#ifdef _SKILL_WEAKEN //vincent輼: +int BATTLE_S_Weaken( int battleindex, int attackNo, int defNo, int marray ); +#endif + +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 +int BATTLE_S_Deeppoison( int battleindex, int attackNo, int defNo, int marray ); +#endif + +#ifdef _SKILL_BARRIER //vincent輼:ħ +int BATTLE_S_Barrier( int battleindex, int attackNo, int defNo, int marray ); +#endif + +#ifdef _SKILL_NOCAST //vincent輼:Ĭ +int BATTLE_S_Nocast( int battleindex, int attackNo, int defNo, int marray ); +#endif + +#ifdef _SKILL_ROAR //vincent輼: +int BATTLE_S_Roar( int battleindex, int attackNo, int defNo, int marray ); +#endif + +int BATTLE_Charge( int battleindex, int attackNo ); + + +int BATTLE_StatusAttackCheck( + + int attackindex, + int defindex, + int status, + //BATTLE_ST_POISON, 1 "", + //BATTLE_ST_PARALYSIS, 2 "", + //BATTLE_ST_SLEEP, 3 "", + //BATTLE_ST_STONE, 4 "ʯ", + //BATTLE_ST_DRUNK, 5 "", + //BATTLE_ST_CONFUSION, 6 "" + int PerOffset, + int Range, + float Bai, + int *pPer +); + +int BATTLE_Combo( int battleindex, int *pAttackList, int defNo ); + +int BATTLE_EarthRoundHide( int battleindex, int attackNo ); + +int BATTLE_GetDamageReact( int charaindex ); + +void BATTLE_talkToCli( int charaindex, char *pszBuffer, int color ); + +#ifdef _PETSKILL_SETDUCK +BOOL BATTLE_CheckMySkillDuck( int charaindex ); +#endif + +BOOL BATTLE_LostEscape( int battleindex, int attackNo ); + +BOOL BATTLE_Abduct( int battleindex, int attackNo, int defNo, int array ); + +void BATTLE_Steal( int battleindex, int attackNo, int defNo ); + +int BATTLE_getReactFlg( int index, int react); + +#ifdef _BATTLESTEAL_FIX +void BATTLE_StealMoney( int battleindex, int attackNo, int defNo) ; +#endif + +#ifdef _PETSKILL_LER +void BATTLE_BatFly(int battleindex,int attackNo,int myside); +void BATTLE_DivideAttack(int battleindex,int attackNo,int myside); +void BATTLE_LerChange(int battleindex,int charaindex,int no); +#endif + +#ifdef _PETSKILL_BATTLE_MODEL +void BATTLE_BattleModel(int battleindex,int attackNo,int myside); +#endif + +// Robin 0727 Ride Pet +#define ATTACKSIDE 1 +#define DEFFENCESIDE 2 + +float BATTLE_adjustRidePet3A( int charaindex, int petindex, int workindex, int action ); + +int BATTLE_getRidePet( int charaindex ); + +#ifdef _PSKILL_FALLGROUND // +int BATTLE_S_FallGround( int battleindex, int attackNo, int defNo, int skill_type ); +#endif + +#ifdef _PETSKILL_PROPERTY +int BATTLE_S_PetSkillProperty( int battleindex, int attackNo, int skill_type, int skill); +#endif + +int BATTLE_S_AttackDamage( int battleindex, int attackNo, int defNo, int skill_type, int skill); + +#ifdef _MAGIC_SUPERWALL +int PETSKILL_MagicStatusChange_Battle( int battleindex, int attackNo, int toNo, int marray); +#endif + +#ifdef _PETSKILL_SETDUCK +int PETSKILL_SetDuckChange_Battle( int battleindex, int attackNo, int toNo, int marray); +#endif + +#ifdef _MAGICPET_SKILL +int PETSKILL_SetMagicPet_Battle( int battleindex, int attackNo, int toNo, int marray); +#endif + +#ifdef _TAKE_ITEMDAMAGE +int BATTLE_ItemCrushCheck( int charaindex , int flg); +int BATTLE_ItemCrush( int charaindex, int ItemEquip, int Damages, int flg); +#endif + +#ifdef _PRO_BATTLEENEMYSKILL +int BATTLE_E_ENEMYREFILE( int battleindex, int attackNo, int defNo, int skill_type ); + +int BATTLE_E_ENEMYREHP( int battleindex, int attackNo, int defNo, int skill_type ); + +int BATTLE_E_ENEMYHELP( int battleindex, int attackNo, int defNo, int skill_type ); +#endif + + +#ifdef _PREVENT_TEAMATTACK +int BATTLE_CheckSameSide( int charaindex, int toNo); +#endif + +#ifdef _USER_CHARLOOPS +int CHAR_BattleStayLoop( int charaindex);//ԭ +#endif + +#ifdef _PETSKILL_PROPERTY +int PET_PetskillPropertyEvent( int Myindex, int defindex, int *damage, int *T_Pow, int size); +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int battle_profession_attack_fun(int battleindex, int attackNo, int defNo, int charaindex); +int battle_profession_attack_magic_fun(int battleindex, int attackNo, int defNo, int charaindex); +int battle_profession_assist_fun(int battleindex, int attackNo, int defNo, int charaindex); +int battle_profession_status_chang_fun(int battleindex, int attackNo, int defNo, int charaindex); +int BATTLE_check_profession_duck( int charaindex, int per ); +int BATTLE_PROFESSION_ATK_PET_DamageSub( int attackindex, int defindex, int *pDamage, int *pPetDamage, int *pRefrect, int skill_level ); +int PROFESSION_BATTLE_StatusAttackCheck( int charaindex, int toindex, int status, int Success ); +int BATTLE_PROFESSION_CONVOLUTE_GET_DAMAGE( int attackindex, int defindex, int skill_level ); +int BATTLE_PROFESSION_THROUGH_ATTACK_GET_DAMAGE( int attackindex, int defindex ); +int BATTLE_PROFESSION_RANG_ATTACK_DAMAGE( int charaindex, int attackNo, int defNo, int skill_type, int status, int turn, int perStatus, int effect, int img1, int img2 ); + +#endif + +#ifdef _PETSKILL_FIREKILL //ɱר +int BATTLE_Attack_FIREKILL( int battleindex, int attackNo, int defNo ); +#endif +#ifdef _PROFESSION_ADDSKILL +BOOL BATTLE_BattleUltimate( int battleindex, int bid ); //λDǷ񱻴 +#endif +#ifdef _NEED_ITEM_ENEMY +int need_item_eneny_init(); +#endif +#ifdef _OFFLINE_SYSTEM +int OFFLINE_MultiRessurect( int battleindex, int attackNo, int toNo, int HP, int flg); +#endif +#endif diff --git a/include/battle_item.h b/include/battle_item.h new file mode 100644 index 0000000..483fa73 --- /dev/null +++ b/include/battle_item.h @@ -0,0 +1,36 @@ +#ifndef _BATTLE_ITEM_H_ +#define _BATTLE_ITEM_H_ +//-------------------------------------------------------------- +// ʧ ةë +//-------------------------------------------------------------- +// +void ITEM_useRecovery_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useStatusChange_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useMagicDef_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useParamChange_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useFieldChange_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useAttReverse_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useStatusRecovery_Battle( int charaindex, int toindex, int itemindex ); +void ITEM_useCaptureUp_Battle( int charaindex, int toindex, int itemindex ); +#ifdef _ITEM_CRACKER +void ITEM_useCracker_Effect( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ITEM_ADDEXP //vincent +void ITEM_useAddexp_Effect( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ITEM_REFRESH //vincent 쳣״̬ +void ITEM_useRefresh_Effect( int charaindex, int toindex, int haveitemindex); +#endif +//Terry add 2001/12/24 +#ifdef _ITEM_FIRECRACKER +void ITEM_useFirecracker_Battle(int charaindex,int toindex,int itemindex); +#endif +//Terry end + +#ifdef _ITEM_MAGICRECOVERY +void ITEM_useMRecovery_Battle( int charaindex, int toNo, int haveitemindex ); +#endif +#ifdef _ITEM_USEMAGIC +void ITEM_useMagic_Battle( int charaindex, int toNo, int haveitemindex ); +#endif +#endif diff --git a/include/battle_magic.h b/include/battle_magic.h new file mode 100644 index 0000000..0483a25 --- /dev/null +++ b/include/battle_magic.h @@ -0,0 +1,336 @@ +#ifndef _BATTLE_MAGIC_H_ +#define _BATTLE_MAGIC_H_ + +#define MAGIC_EFFECT_USER 100600 +#define SPR_heal 100601 +#define SPR_heal2 100602 +#define SPR_heal3 100603 +#define SPR_tyusya 100604 +#define SPR_hoshi 100605 + + +#define MAGIC_ID_RECOVERY 1 +#define MAGIC_ID_STATUS_RECOVERY 3 +#define MAGIC_ID_FIELD_CHANGE 4 +#define MAGIC_ID_BADSTATUS 5 + +enum{ + BFUKI_CAPTUREUP, + BFUKI_END +}; + + +enum{ + PC_KIND_NONE, + PC_KIND_ATTACK, + PC_KIND_DEFENSE, + PC_KIND_QUICK, + PC_KIND_CHARM, + PC_KIND_CAPTURE, + PC_KIND_END +}; + +int MAGIC_Recovery_Battle( + int charaindex, + int toindex, + int magicindex, + int mp +); + +int MAGIC_FieldAttChange_Battle( + int charaindex, + int toindex, + int marray, + int mp +); + +int MAGIC_StatusChange_Battle( + int charaindex, + int toindex, + int marray, + int mp +); + +#ifdef _MAGIC_DEEPPOISON +int MAGIC_StatusChange_Battle2( + int charaindex, + int toindex, + int marray, + int mp +); +#endif + +#ifdef _OTHER_MAGICSTAUTS +int MAGIC_MagicStatusChange_Battle( int charaindex, int toNo, int marray, int mp ); + +#endif + +int MAGIC_MagicDef_Battle( + int charaindex, + int toNo, + int marray, + int mp +); + +void BATTLE_MultiRecovery( + int battleindex, + int attackNo, + int toNo, + int kind, + int power, + int per, + int UseEffect, + int RecevEffect + +); + +#ifdef _IMPRECATE_ITEM +void BATTLE_ImprecateRecovery( + int battleindex, + int attackNo, + int toNo, + int kind, + int powers, + int rounds, + int UseEffect, + int RecevEffect +); +#endif +void BATTLE_MultiStatusChange( + int battleindex, + int attackNo, + int toNo, + int status, + int turn, + int UseEffect, + int RecevEffect, + int Success +); + +#ifdef _OTHER_MAGICSTAUTS +void BATTLE_MultiMagicStatusChange( + int battleindex, + int attackNo, + int toNo, + int status, + int turn, + int UseEffect, + int RecevEffect, + int nums +); +#endif + +void BATTLE_MultiMagicDef( + int battleindex, + int attackNo, + int toNo, + int kind, + int count, + int UseEffect, + int RecevEffect +); + +void BATTLE_MultiParamChange( + int battleindex, + int attackNo, + int toNo, + int kind, + int power, + int par, + int UseEffect, + int RecevEffect +); + +int MAGIC_FieldAttChange_Battle( + int charaindex, + int toNo, + int marray, + int mp +); + +int BATTLE_FieldAttChange( + int charaindex, + char *pArg +); + +void BATTLE_MultiAttReverse( + int battleindex, + int attackNo, + int toNo, + int UseEffect, + int RecevEffect +); + + +void BATTLE_MultiStatusRecovery( + int battleindex, + int attackNo, + int toNo, + int status, + int UseEffect, + int RecevEffect +); + +int MAGIC_StatusRecovery_Battle( + int charaindex, + int toNo, + int marray, + int mp +); + +void BATTLE_MultiRessurect( + int battleindex, + int attackNo, + int toNo, + int power, + int per, + int UseEffect, + int RecevEffect +); + +void BATTLE_MultiCaptureUp( + int battleindex, + int attackNo, + int toNo, + int power, + int UseEffect, + int RecevEffect +); +// +//*********************************************************** + +//**************************************************************** +// +// 姾 +// +int MAGIC_Ressurect_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +); +// TRUE +// FALSE +//**************************************************************** + +//**************************************************************** +// +// 뼰 ë +// +int MAGIC_AttReverse_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +); +// TRUE +// FALSE +//**************************************************************** +//**************************************************************** +// +// +// +int MAGIC_CaptureUp_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +); +// TRUE +// FALSE +//**************************************************************** + +//*********************************************************** +// +// ܷƥ Ѽƽҷëٽ½ձ ܷ ëܰ +// +void BATTLE_MultiResAndDef( + int battleindex, // ̼͵ + int attackNo, // į + int toNo, // ľ į + int power, // + int per, // Ѿ + int kind, // ܷ + int count, // ϼ ʲ + int UseEffect, // мް + int RecevEffect // ľмް +); +// +//*********************************************************** +//**************************************************************** +// +// ١ ܷ ëܸ +// +int MAGIC_ResAndDef_Battle( + int charaindex, // м̼͵ + int toNo, // ľм̼͵ + int marray, // magicindex + int mp // MP +); +// TRUE +// FALSE +//**************************************************************** + +#ifdef _ATTACK_MAGIC +int MAGIC_AttMagic_Battle( int charaindex , int toNo , int marray , int mp ); +#ifdef _FIX_MAGICDAMAGE +void BATTLE_MultiAttMagic( int battleindex, int attackNo, int toNo, + int attIdx ,int FieldAttr ,int Power, int MagicLv); + +#else +void BATTLE_MultiAttMagic( int battleindex , int attackNo , int toNo , int attIdx , int FieldAttr , int Power ); +#endif +int MAGIC_AttMagic_Battle( int charaindex , int toNo , int marray , int mp ); + +#endif + + + +#ifdef _MAGIC_TOCALL +int MAGIC_ToCallDragon_Battle( int charaindex , int toNo , int marray , int mp ); + +void BATTLE_MultiToCallDragonMagic( int battleindex, int attackNo, int toNo, + int attIdx ,int FieldAttr ,int Power, int ImageNo); + +#endif + +#ifdef _Item_ReLifeAct +void BATTLE_MultiReLife( int battleindex, int attackNo, int toNo, int power, int RecevEffect ); +#endif +#ifdef _MAGIC_WEAKEN +int MAGIC_ParamChange_Turn_Battle(int charaindex,int toNo,int marray,int mp); +void BATTLE_MultiParamChangeTurn( int battleindex,int attackNo,int toNo,int status,int UseEffect,int RecevEffect,int turn, int Success); +#endif +int BATTLE_MagicEffect( int battleindex,int attackNo,int ToList[],int MyEffect,int ToEffect ); + + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +void PROFESSION_MAGIC_ATTAIC( int battleindex, int attackNo, int toNo, int attIdx, int FieldAttr, int skill); +int PROFESSION_MAGIC_ATTAIC_Effect( int battleindex, int attackNo, int ToList[], int AttackMgcNo ); +int analysis_profession_parameter( int attIdx, int skill, int toNo, int charaindex ); +void PROFESSION_MAGIC_GET_PRACTICE( float *hp_power, float *mp_power, float *dec_hp, float *dec_mp, int charaindex ); +void PROFESSION_MAGIC_TOLIST_SORT( int *list, int *listidx, int charaindex ); +void PROFESSION_MAGIC_CHANGE_STATUS( int charaindex, int hp_power, float mp_power, float *add_hp, float *add_mp ); +void PROFESSION_MAGIC_GET_IMG2( int toNo, int charaindex, int attIdx, char *pszOption ); +#ifdef _PROFESSION_ADDSKILL +int PROFESSION_MAGIC_GET_DAMAGE( int attackindex, int defindex, int magic_type, int power, int command ); +#else +int PROFESSION_MAGIC_GET_DAMAGE( int attackindex, int defindex, int magic_type, int power ); +#endif +int PROFESSION_MAGIC_DODGE( int atk_index, int def_index, int magic_type ); +void PROFESSION_MAGIC_CHANG_IMG2( int img2, char *pszOption, int attIdx ); +int PROFESSION_MAGIC_CHANG_STATUS(int command,int battleindex, int charaindex, int charaidx, int power, int no); +int PROFESSION_MAGIC_GET_ICE_MIRROR_DAMAGE( int attackindex, int defindex, int command, int power ); +#endif + +#ifdef _PETSKILL_FIREKILL +void BATTLE_MultiAttMagic_Fire( int battleindex, int attackNo, int defNo, + int FieldAttr , int Power); +#endif + +#ifdef _PROFESSION_ADDSKILL +unsigned int GET_PROFESSION_magic_uiSpriteNum(int idx); +#endif + +#endif diff --git a/include/buf.h b/include/buf.h new file mode 100644 index 0000000..78665f0 --- /dev/null +++ b/include/buf.h @@ -0,0 +1,11 @@ +#ifndef __BUF_H__ +#define __BUF_H__ + +#include "common.h" +void memEnd( void ); +BOOL configmem( int unit , int unitnumber ); +BOOL memInit( void ); +void* allocateMemory( const unsigned int nbyte ); +void freeMemory( void* freepointer ); +void showMem( char *buf); +#endif diff --git a/include/char.h b/include/char.h new file mode 100644 index 0000000..99cade2 --- /dev/null +++ b/include/char.h @@ -0,0 +1,780 @@ +#ifndef __CHAR_H__ +#define __CHAR_H__ + +#include "common.h" +#include "char_base.h" +#include "net.h" +#include "char_data.h" + + +/*------------------------------------------------------------ + *ɼƼ + *------------------------------------------------------------*/ +typedef enum +{ + CHAR_COLORWHITE, + CHAR_COLORCYAN, + CHAR_COLORPURPLE, + CHAR_COLORBLUE, + CHAR_COLORYELLOW, + CHAR_COLORGREEN, + CHAR_COLORRED, + CHAR_COLORGRAY, + CHAR_COLORBLUE2, + CHAR_COLORGREEN2, + CHAR_COLORBLACK, +}CHAR_COLOR; +/*====================ƽҷ¼====================*/ +void CHAR_createNewChar( int clifd, int dataplacenum,char* charname , + int imgno,int faceimgno, + int vital,int str,int tgh,int dex, + int earth,int water,int fire,int wind, + int hometown , char *cdkey ); + +/*====================ƽҷ¼̼====================*/ + +void CHAR_login( int clifd, char* data, int saveindex ); + +#define CHAR_warpToSpecificPoint( cindex, fl, x, y) _CHAR_warpToSpecificPoint( __FILE__, __LINE__, cindex, fl, x, y) +BOOL _CHAR_warpToSpecificPoint( char *file, int line, + int charaindex, int fl, int x, int y); + + +/*====================ƽҷ¼Ƥ====================*/ +/*====================ƽҷ¼ʧ====================*/ +BOOL CHAR_charSaveFromConnectAndChar( int fd,Char* ch, int unlock ); +BOOL CHAR_charSaveFromConnect( int charaindex,int unlock ); +#define CHAR_logout( charindex, save) _CHAR_logout( __FILE__, __LINE__, charindex, save) +BOOL _CHAR_logout( char *file, int line, int charindex, BOOL save); + +/*====================watch event ====================*/ +void CHAR_sendWatchEvent( int objindex, int chac, int* opt,int optlen,BOOL myflg ); + +/*====================ƽ====================*/ +BOOL CHAR_Skillupsend(int charaindex ); +void CHAR_SkillUp( int charaindex, int skillid ); +void CHAR_useSkill( int charaindex, int dir ,int skindex ); + +typedef enum +{ + CHAR_WALKSUCCESSED, /* */ + CHAR_WALKSYSTEMERROR, /* ˵ ة޷¡ indexͱ + * Ⱦ羮 */ + CHAR_WALKEXTEND, /* ƻڳףNPC弰*/ + CHAR_WALKHITOBJECT, /* Ͼ Ȼئ */ + CHAR_WALKPREWALK, /* prewalkìƥئ( ޼ ) */ + CHAR_WALKDIE, /* ƥлئ */ + CHAR_WALK1357, /* 껧 ڳƻئ */ +}CHAR_WALKRET; + +/*====================ƽҷ¼ ====================*/ +void CHAR_ctodirmode(char moji , int* dir , int* mode); +INLINE void CHAR_getDXDY( int dir , int* dx, int* dy ); +INLINE int CHAR_getDX( int dir ); +INLINE int CHAR_getDY( int dir ); +int CHAR_getSameCoordinateObjects(int* objbuf, int siz,int ff, int fx, int fy); +void CHAR_walkcall( int index ); +void CHAR_walk_start(int index, int x, int y, char* dir, BOOL mapsendmode); +void CHAR_walk_init( int fd, int x, int y, char *direction, BOOL mapsendmode); + +CHAR_WALKRET CHAR_walk(int index, int dir, int mode); + +#ifdef _CAX_LNS_NLGSUOXU +CHAR_WALKRET CHAR_walk_jjc( int index, int floor, int ox, int oy, int dir); +CHAR_WALKRET CHAR_walk_jc( int charaindex, int of, int ox, int oy, int dir );//ǰϰ +#endif + +char* CHAR_makeOptionString( Char* ch ); +char* CHAR_makeStatusString( int index, char* category ); + +#define CHAR_makeObjectCString( objindex, buf, buflen) _CHAR_makeObjectCString( __FILE__, __LINE__, objindex, buf, buflen) +BOOL _CHAR_makeObjectCString( char *file, int line, int objindex, char* buf, int buflen ); + +//BOOL CHAR_sendStatusString( int charaindex, char* category ); +#define CHAR_sendStatusString( A, B) _CHAR_sendStatusString( A, B, __FILE__, __LINE__ ) +BOOL _CHAR_sendStatusString( int charaindex, char* category, char* file, int line ); +BOOL CHAR_sendItemData( int charaindex, int *itemgroup, int num); +BOOL CHAR_sendItemDataOne( int charaindex, int haveitemindex); +BOOL CHAR_send_P_StatusString( int charaindex, unsigned int indextable ); +BOOL CHAR_send_N_StatusString( int charaindex, int num, unsigned int indextable ); +BOOL CHAR_send_K_StatusString( int charaindex, int num, unsigned int indextable ); + +void CHAR_inputOwnTitle( int index ,char* name ); + +void CHAR_selectTitle( int index, int titleindex ); +void CHAR_deleteTitle( int index, int titleindex ); + +#define CHAR_complianceParameter( index) _CHAR_complianceParameter( index, __FILE__, __LINE__) +int _CHAR_complianceParameter( int index, char *FILE, int LINE); +int CHAR_complianceParameter2( int index); + +int CHAR_findSurplusItemBox( int index ); +int CHAR_findEmptyItemBox( int index ); +int CHAR_findEmptyPoolItemBox( int index ); +int CHAR_findEmptyItemBoxNo( int index ); + +void CHAR_moveEquipItem( int index, int fromindex, int toindex ); +#ifdef _PET_ITEM +void CHAR_movePetItem( int index, int petid, int fromindex, int toindex ); +void CHAR_sendPetItemData( int charaindex, int petid); +#endif +void CHAR_ItemUse( int charaindex, int to_charaindex, int haveitemindex ); +void CHAR_DropItem( int charaindex, int itemindex ); +int CHAR_DropItemAbsolute( int itemindex, int floor, int x, int y,BOOL net); +BOOL CHAR_DropItemFXY( int charaindex, int itemcharaindex, int fl, + int x, int y, int* objindex ); +int CHAR_addItemSpecificItemIndex( int charaindex, int itemindex ); + +void CHAR_PickUpItem( int charaindex, int dir ); +void CHAR_DropMoney( int charaindex, int amount ); +int CHAR_addItem( int charaindex, int itemid ); +int CHAR_addItemToChar( Char* ch, int itemid ); + +int CHAR_pickupFollowPet( int charaindex, int petindex ); + +#ifdef _GAMBLE_ROULETTE +int NPC_MAPCLEANGOLD( int meindex , int floor); +#endif + +#ifdef _DROPSTAKENEW +#define MAXSTAKENUM 5 +int CasinoAccumulation(int charindex, int npcindex, int floor, int wincasinotype); +void CHAR_talkToFloor(int floor, int talkindex, char* message, CHAR_COLOR color); +int SetCasinoMap(int npcindex, int casinotype, int mapdropflag); +int CasinoPay(int npcindex, int wincasinotype); +#endif + +void CHAR_sendCSpecifiedObjindex( int fd, int index); +void CHAR_sendSpecifiedobjindexCToCharaindex(int charaindex,int objindex); + +void CHAR_sendCToArroundCharacter( int charaindex ); + +void CHAR_sendArroundCharaData( int charaindex ); + +void CHAR_sendCDArroundChar( int fl, int x, int y, int objindex ); +void CHAR_sendCDArroundChar_Main( int fl, int x, int y, int objindex, BOOL mode ); + + +void CHAR_Look( int charaindex, int dir ); + +void CHAR_initChatMagic(void); + +char* CHAR_appendNameAndTitle( int charaindex, char* src, char* buf, + int buflen ); +void CHAR_Talk( int fd, int index,char* message,int color, int area ); + +void CHAR_Loop( void ); + +#ifdef _PET_ITEM +void CHAR_sendPetItemData( int charaindex, int petid); +void CHAR_sendPetItemEmpty( int charaindex, int petid); +#endif + +#define WINDOW_BUTTONTYPE_NONE (0) +#define WINDOW_BUTTONTYPE_OK (1 << 0) +#define WINDOW_BUTTONTYPE_CANCEL (1 << 1) +#define WINDOW_BUTTONTYPE_YES (1 << 2) +#define WINDOW_BUTTONTYPE_NO (1 << 3) +#define WINDOW_BUTTONTYPE_PREV (1 << 4) +#define WINDOW_BUTTONTYPE_NEXT (1 << 5) + +#define WINDOW_BUTTONTYPE_OKCANCEL (WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL) +#define WINDOW_BUTTONTYPE_YESNO (WINDOW_BUTTONTYPE_YES | WINDOW_BUTTONTYPE_NO) + + +typedef enum +{ + WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_MESSAGETYPE_SELECT, + WINDOW_MESSAGETYPE_PETSELECT, + WINDOW_MESSAGETYPE_PARTYSELECT, + WINDOW_MESSAGETYPE_PETANDPARTYSELECT, + WINDOW_MESSAGETYPE_ITEMSHOPMENU, + WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_MESSAGETYPE_LIMITITEMSHOPMAIN, + WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_MESSAGETYPE_WIDEMESSAGE, + WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT, + WINDOW_MESSAGETYPE_POOLITEMSHOPMENU, + WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, + + WINDOW_MESSAGETYPE_FAMILYADD, + WINDOW_MESSAGETYPE_FAMILYJOIN, + WINDOW_MESSAGETYPE_FAMILYOUT, + WINDOW_MESSAGETYPE_FAMILYEND, +//======================================= + // shan add + WINDOW_FMMESSAGETYPE_SELECT, + WINDOW_FMMESSAGETYPE_DENGON, + WINDOW_FMMESSAGETYPE_FMSDENGON, + WINDOW_FMMESSAGETYPE_POINTLIST, +#ifdef _FMVER21 + WINDOW_FMMESSAGETYPE_TOP30DP, +#endif + WINDOW_FMMESSAGETYPE_DP, + WINDOW_MESSAGETYPE_BANK, + + // Arminius 7.12 scheduleman + WINDOW_MESSAGETYPE_PKSCHEDULELIST, + WINDOW_MESSAGETYPE_PKSCHEDULESELECTFAMILY, + WINDOW_MESSAGETYPE_PKSCHEDULEDETAIL, + + // Robin + WINDOW_MESSAGETYPE_LOGINMESSAGE, + WINDOW_MESSAGETYPE_FAMILYTAX, + WINDOW_MESSAGETYPE_SHOWRIDEPET, + WINDOW_MESSAGETYPE_FAMILYDETAIL, + + WINDOW_MESSAGETYPE_LEADERSELECT, + WINDOW_MESSAGETYPE_LEADERSELECTQ, + WINDOW_MESSAGETYPE_LEADERSELECTA, + + // Arminius 1.3 Auctioneer + WINDOW_MESSAGETYPE_AUCTIONNEW, + WINDOW_MESSAGETYPE_AUCTIONLIST_BUY, + WINDOW_MESSAGETYPE_AUCTIONSURVEY, + WINDOW_MESSAGETYPE_AUCTIONMODIFY, + WINDOW_MESSAGETYPE_AUCTIONLIST_MODIFY, +#ifdef _NPC_FUSION + WINDOWS_MESSAGETYPE_PETFUSION, +#endif + +#ifdef _PETSKILL_CANNEDFOOD + WINDOWS_MESSAGETYPE_PETSKILLSHOW, +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + WINDOW_MESSAGETYPE_PROFESSIONSHOP, +#endif + +#ifdef _NEW_MANOR_LAW + WINDOW_FMMESSAGETYPE_10_MEMONTUM, // ʮƼ + WINDOW_FMMESSAGETYPE_FM_MEMONTUM, // Լ + WINDOW_FMMESSAGETYPE_MANOR_SCHEDULE, // սׯ԰ +#endif + +#ifdef _ANGEL_SUMMON + WINDOW_MESSAGETYPE_ANGELMESSAGE = 101, + WINDOW_MESSAGETYPE_ANGELASK, +#endif + +#ifdef _MOUSE_DBL_CLICK + WINDOW_MESSAGETYPE_MOUSEGETNAME, +#endif + +#ifdef _RACEMAN + WINDOW_MESSAGETYPE_RACEMAN_RANK, +#endif + + WINDOW_MESSAGETYPE_RANDMSG_PIC=999, + +}WINDOW_MESSAGETYPE; + +typedef enum +{ + CHAR_WINDOWTYPE_RETURNTOELDER=-1, /* Ӯ ū */ + CHAR_WINDOWTYPE_RESURRECTION=-2, /* ū */ + + CHAR_WINDOWTYPE_SELECTBATTLE = 1, /* ¾ ë ū */ + CHAR_WINDOWTYPE_SELECTDUEL = 2, /* DUELë ū */ + CHAR_WINDOWTYPE_SELECTTRADECARD = 3, /* ͭë ū */ + CHAR_WINDOWTYPE_SELECTPARTY = 4, /* ɡ ūë ū */ + CHAR_WINDOWTYPE_SELECTBATTLEWATCH = 5, /* ë ū */ + CHAR_WINDOWTYPE_MICMESSAGE = 6, /* MICNPCëȻū */ + + // CoolFish: Trade 2001/4/18 + CHAR_WINDOWTYPE_SELECTTRADE = 7, /* Window */ + + CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE1 = 10, /* ë ʧ ةë ū */ + CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE2 = 11, /* ë ʧ ةë ū */ + CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE3 = 12, /* ë ʧ ةë ū */ + CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE4 = 13, /* ë ʧ ةë ū */ + CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME = 14, /* ë ū */ + CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME_ATTENTION = 15, /* ë ū */ + + CHAR_WINDOWTYPE_DENGON = 50, /* */ + + CHAR_WINDOWTYPE_WINDOWMAN_START = 100, + CHAR_WINDOWTYPE_WINDOWMAN_STARTMSG = CHAR_WINDOWTYPE_WINDOWMAN_START, + CHAR_WINDOWTYPE_WINDOWMAN_END = 200, + + CHAR_WINDOWTYPE_JANKEN_START = 210, + CHAR_WINDOWTYPE_JANKEN_MAIN = 211, + CHAR_WINDOWTYPE_JANKEN_END = 212, + + CHAR_WINDOWTYPE_TRANSMIGRATION_START = 213, + CHAR_WINDOWTYPE_TRANSMIGRATION_MAIN = 214, + CHAR_WINDOWTYPE_TRANSMIGRATION_END = 215, + CHAR_WINDOWTYPE_TRANSMIGRATION_NONE = 216, + + + CHAR_WINDOWTYPE_WINDOWHEALER_START = 220, + CHAR_WINDOWTYPE_WINDOWHEALER_STARTMSG = CHAR_WINDOWTYPE_WINDOWHEALER_START, + CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG = 221, + CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG = 222, + CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG = 223, + CHAR_WINDOWTYPE_WINDOWHEALER_OKSPIRITMSG = 224, + CHAR_WINDOWTYPE_WINDOWHEALER_ALLMSG = 225, + CHAR_WINDOWTYPE_WINDOWHEALER_OKALLMSG = 226, + CHAR_WINDOWTYPE_WINDOWHEALER_END = 227, + + CHAR_WINDOWTYPE_WINDOWSAVEPOINT_START = 230, + + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG = 231, + CHAR_WINDOWTYPE_WINDOWEVENT_NOWEVENT = 232, + CHAR_WINDOWTYPE_WINDOWEVENT_ENDEVENT = 233, + CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG = 234, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG = 235, + CHAR_WINDOWTYPE_WINDOWEVENT_NOMALMSG = 236, + CHAR_WINDOWTYPE_WINDOWEVENT_CLEANMSG = 237, + CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK = 238, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCTHANK = 239, + + + CHAR_WINDOWTYPE_WINDOWITEMSHOP_START = 240, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG = CHAR_WINDOWTYPE_WINDOWITEMSHOP_START, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_MENU = 241, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG = 242, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG = 243, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_END = 244, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT = 245, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS = 246, + + CHAR_WINDOWTYPE_DUELRANKING_START = 250, + CHAR_WINDOWTYPE_DUELRANKING_TOPRANKING = 251, + CHAR_WINDOWTYPE_DUELRANKING_MYRANKING = 252, + CHAR_WINDOWTYPE_DUELRANKING_WAIT = 253, + CHAR_WINDOWTYPE_DEFEND_BILLDBOARD = 254, + + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP = 260, + + CHAR_WINDOWTYPE_WINDOWPETSHOP_START = 261, + CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT = 262, + CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN = 263, + CHAR_WINDOWTYPE_WINDOWPETSHOP_GOLDOVER = 264, + CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT2 = 265, + CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN2 = 266, + CHAR_WINDOWTYPE_WINDOWPETSHOP_DRAWSELECT = 267, + CHAR_WINDOWTYPE_WINDOWPETSHOP_ASKDRAW = 268, + CHAR_WINDOWTYPE_WINDOWPETSHOP_END = 269, + + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN = 271, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR = 272, + CHAR_WINDOWTYPE_WINDOWWARPMAN_END = 273, + + CHAR_WINDOWTYPE_NPCENEMY_START = 281, + + CHAR_WINDOWTYPE_CHARM_START = 282, + CHAR_WINDOWTYPE_CHARM_END = 283, + + CHAR_WINDOWTYPE_QUIZ_START = 284, + CHAR_WINDOWTYPE_QUIZ_MAIN = 285, + CHAR_WINDOWTYPE_QUIZ_END = 286, + + CHAR_WINDOWTYPE_CHECKMAN_START = 287, + CHAR_WINDOWTYPE_CHECKMAN_MAIN = 288, + CHAR_WINDOWTYPE_CHECKMAN_END = 289, + + CHAR_WINDOWTYPE_FAMILYMAN_START = 320, + CHAR_WINDOWTYPE_FAMILYMAN_ADD = 321, + CHAR_WINDOWTYPE_FAMILYMAN_JOIN = 322, + CHAR_WINDOWTYPE_FAMILYMAN_OUT = 323, + CHAR_WINDOWTYPE_FAMILYMAN_BROKEN = 324, + + CHAR_WINDOWTYPE_BANKMAN = 330, + + // CoolFish: FMPKMan 2001/7/4 + CHAR_WINDOWTYPE_FMPKMAN_START = 340, + CHAR_WINDOWTYPE_FMPKMAN_VIEW = 341, + CHAR_WINDOWTYPE_FMPKMAN_LEAVEPK = 342, + CHAR_WINDOWTYPE_FMPKCALLMAN_START = 345, + CHAR_WINDOWTYPE_FMPKCALLMAN_CALL = 346, + CHAR_WINDOWTYPE_FMPKCALLMAN_COME = 347, + CHAR_WINDOWTYPE_FMPKCALLMAN_LEAVE = 348, + + // Arminius 7.13 scheduleman + CHAR_WINDOWTYPE_SCHEDULEMAN_START = 350, + CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT = 351, + CHAR_WINDOWTYPE_SCHEDULEMAN_DETAIL = 352, + + // Arminius 7.27 + CHAR_WINDOWTYPE_MANORPK_START = 360, + CHAR_WINDOWTYPE_MANORPK_ASK = 361, + CHAR_WINDOWTYPE_MANORPK_END = 362, + + // shan + CHAR_WINDOWTYPE_FM_DENGON = 370, // ԰ + CHAR_WINDOWTYPE_FM_FMSDENGON = 371, // ֮԰ + CHAR_WINDOWTYPE_FM_MESSAGE1 = 372, // ˵Ӵ(ݵ) + CHAR_WINDOWTYPE_FM_MESSAGE2 = 373, // ˵Ӵ(Ա) + CHAR_WINDOWTYPE_FM_SELECT = 374, // ѡӴ + CHAR_WINDOWTYPE_FM_MEMBERLIST = 375, // Աб + CHAR_WINDOWTYPE_FM_POINTLIST = 376, // ݵб + CHAR_WINDOWTYPE_FM_DPTOP = 377, // ǿ߱(ǰʮа) + CHAR_WINDOWTYPE_FM_DPME = 378, // ǿ߱(Լа) + CHAR_WINDOWTYPE_FM_DPSELECT = 379, // ǿ߱ѡӴ + +#ifdef _PET_TRANS + CHAR_WINDOWTYPE_PETTRANS_START = 384, + CHAR_WINDOWTYPE_PETTRANS_SELECT = 385, + CHAR_WINDOWTYPE_PETTRANS_SELPET = 386, + CHAR_WINDOWTYPE_PETTRANS_MAIN1 = 387, + CHAR_WINDOWTYPE_PETTRANS_END = 389, +#endif + +#ifdef _GAMBLE_BANK + NPC_GambleBank_START = 390, + NPC_GambleBank_SELECT, + NPC_GambleBank_BANK, + NPC_GambleBank_CHANG1, + NPC_GambleBank_CHANG2, + NPC_GambleBank_END, +#endif + +#ifdef _PETRACE + CHAR_WINDOWTYPE_PETRACEMASTER_START = 410, + CHAR_WINDOWTYPE_PETRACEMASTER_RULE, + CHAR_WINDOWTYPE_PETRACEMASTER_PET, + CHAR_WINDOWTYPE_PETRACEMASTER_LEAVE, +#endif + +#ifdef _GAMBLE_ROULETTE + WINDOWTYPE_GAMBLEROULETTE_START = 415, + WINDOWTYPE_GAMBLEROULETTE_SELECT, + WINDOWTYPE_GAMBLEROULETTE_END, +#endif + +#ifdef _NEWEVENT + CHAR_WINDOWTYPE_WINDOWEVENT_ACCTHANKNEW = 430, +#endif + +#ifdef _TRANSER_MAN + NPC_TRANSERMAN_START = 440, + NPC_TRANSERMAN_SELECT, + NPC_TRANSERMAN_WARP, + NPC_TRANSERMAN_END, +#endif +#ifdef _ITEM_NPCCHANGE + NPC_ITEMCHANGE_START = 445, + NPC_ITEMCHANGE_SELECT, + NPC_ITEMCHANGE_MESSAGE, + NPC_ITEMCHANGE_END, +#endif +#ifdef _ADD_FAMILY_TAX // WON ADD ׯ԰˰ + CHAR_WINDOWTYPE_FAMILY_TAX = 450, +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + NPC_ALLDOMAN_START = 460, + NPC_ALLDOMAN_START2, + NPC_ALLDOMAN_START3, + NPC_ALLDOMAN_HEAL, + NPC_ALLDOMAN_GIVEMONEY, + NPC_ALLDOMAN_MAIN_WND , + NPC_ALLDOMAN_SELECT_WND , + NPC_ALLDOMAN_LIST_WND , +#endif + +#ifdef _PETSKILL_CANNEDFOOD + ITEM_WINDOWTYPE_SELECTPETSKILL_SELECT = 470, + ITEM_WINDOWTYPE_SELECTPETSKILL_END, +#endif + +#ifdef _NPC_WELFARE + NPC_WELFARE_START = 480, + NPC_WELFARE_END, +#endif + +#ifdef _NPC_DEPOTPET + CHAR_WINDOWTYPE_DEPOTPETSHOP_MENU = 510, + CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE, + CHAR_WINDOWTYPE_DEPOTPETSHOP_ADD, + CHAR_WINDOWTYPE_DEPOTPETSHOP_GET, + CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKADD, + CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKGET, +#endif + +#ifdef _ANGEL_SUMMON + CHAR_WINDOWTYPE_ANGEL_ASK = 520, + CHAR_WINDOWTYPE_ANGEL_CLEAN, +#endif + +#ifdef _SAFE_PASSWORD + CHAR_WINDOWTYPE_SAFE_PASSWORD1 = 530, + CHAR_WINDOWTYPE_SAFE_PASSWORD2 = 540, + CHAR_WINDOWTYPE_SAFE_PASSWORD3, +#endif + +#ifdef _POINT_CARD + CHAR_WINDOWTYPE_POINT_CARD = 550, +#endif + CHAR_WINDOWTYPE_RAND_WARP = 560, + CHAR_WINDOWTYPE_RAND_MSG = 561, + CHAR_WINDOWTYPE_ITEM_MSG = 562, + + CHAR_STREETVENDOR_SELECT = 570, + CHAR_WINDOWTYPE_QUESTIONONLINE = 580, +#ifdef _SQL_BUY_FUNC + CHAR_WINDOWTYPE_ONLINE_BUY, +#endif +#ifdef _PET_RESET + CHAR_WINDOWTYPE_RESETPET, + CHAR_WINDOWTYPE_RESETBDPET, +#endif +#ifdef _ZHIPIAO_SYSTEM + CHAR_WINDOWTYPE_ZHIPIAO_1, + CHAR_WINDOWTYPE_ZHIPIAO_2, + CHAR_WINDOWTYPE_ZHIPIAO_3, +#endif +#ifdef _NO_DROPITEM + CHAR_WINDOWTYPE_DROPITEM, +#endif +#ifdef _NPC_ITEMUP + NPC_ITEMUP_START, + NPC_ITEMUP_SELECT1, + NPC_ITEMUP_SELECT2, + NPC_ITEMUP_MESSAGE, + NPC_ITEMUP_END, +#endif +#ifdef _ITEM_RESET + CHAR_WINDOWTYPE_RESETITEM, + CHAR_WINDOWTYPE_DELITEM, +#endif + CHAR_WINDOWTYPE_RAND1_EDITBASE, + CHAR_WINDOWTYPE_RAND2_EDITBASE, + CHAR_WINDOWTYPE_RAND3_EDITBASE, + CHAR_WINDOWTYPE_RAND4_EDITBASE, +#ifdef _MM_NO_JIAOBEN + CHAR_WINDOWTYPE_RAND1_DROPMM, + CHAR_WINDOWTYPE_RAND2_DROPMM, + CHAR_WINDOWTYPE_RAND3_DROPMM, + CHAR_WINDOWTYPE_RAND4_DROPMM, + CHAR_WINDOWTYPE_RAND1_FLLOWMM, + CHAR_WINDOWTYPE_RAND2_FLLOWMM, + CHAR_WINDOWTYPE_RAND3_FLLOWMM, + CHAR_WINDOWTYPE_RAND4_FLLOWMM, +#endif +#ifdef _FM_NPC_LOOK_WAR + NPC_FMLOOKWARMAN_START, + NPC_FMLOOKWARMAN_SELECT, + NPC_FMLOOKWARMAN_LOOK, +#endif +#ifdef _FM_NPC_LOOK_WAR1 + NPC_FMLOOKWARMAN1_START, + NPC_FMLOOKWARMAN1_SELECT, + NPC_FMLOOKWARMAN1_LOOK, +#endif +#ifdef _DP_ZHIPIAO_ITEM + CHAR_WINDOWTYPE_DPZHIPIAO_1, + CHAR_WINDOWTYPE_DPZHIPIAO_2, + CHAR_WINDOWTYPE_DPZHIPIAO_3, +#endif +#ifdef _NPC_RAND_MSG + CHAR_WINDOWTYPE_NPC_RAND1_MSG, + CHAR_WINDOWTYPE_NPC_RAND2_MSG, + CHAR_WINDOWTYPE_NPC_RAND3_MSG, + CHAR_WINDOWTYPE_NPC_RAND4_MSG, +#endif + CHAR_WINDOWTYPE_NPCENEMY_RAND_MSG, + CHAR_WINDOWTYPE_LUANPC_RANDMSG, +#ifdef _NULL_CHECK_ITEM + CHAR_WINDOWTYPE_NULL_CHECK, +#endif +}CHAR_WINDOWTYPE; + +#ifdef _GMRELOAD +typedef struct tagGMInfo +{ + char cdkey[24]; + int level; +}GMInfo; +#endif + + +#ifdef _ANGEL_SUMMON + +#define MAXMISSION 100 +#define MAXMISSIONTABLE 200 + +struct MissionInfo +{ + int id; + char detail[1024]; + int level; + char eventflag[1024]; + //char bonus[1024]; + int limittime; +}; + +struct MissionTable +{ + char angelinfo[128]; + char heroinfo[128]; + int mission; + int flag; + int time; + int limittime; +}; + +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; + +#endif + +#ifdef _JOBDAILY + +#define MAXDAILYLIST 1000 +#define MAXMISSIONFLAG 1000 +typedef struct _DailyFileType +{ + int jobid; // + char rule[64]; //ж + char explain[64]; //˵ + char state[64]; //״̬˵ +}DailyFileType; +//extern struct DailyFileType dailyfile[MAXDAILYLIST]; + +#endif + +BOOL CHAR_talkToCli( int talkedcharaindex,int talkcharaindex, char* message, CHAR_COLOR color ); +void system_all_talk( char* data ); +void player_all_talk( int charaindex, char* data ); +void CHAR_talkToCliAndParty( int talkedcharaindex,int talkcharaindex,char* message, CHAR_COLOR color ); + +BOOL CHAR_talkToCharacter( int talkedcharaindex,int talkcharaindex, char* message ); +void CHAR_getCoordinationDir( int dir , int x, int y ,int c, + int *xout , int *yout ); +BOOL CHAR_createCharacter( int type, int floor, int x, int y, int dir, + int* charaindex, int* objindex, BOOL seemap ); +void CHAR_CharaDelete( int charaindex ); +void CHAR_ObjectDelete( int objindex ); +int CHAR_makeDBKey( int charaindex, char *pszBuffer, int size ); +int CHAR_getEmptyPartyArray( int charaindex); +int CHAR_getPartyNum( int charaindex); +BOOL CHAR_JoinParty( int charaindex ); +BOOL CHAR_JoinParty_Main( int charaindex, int targetindex); +BOOL CHAR_DischargeParty( int charaindex, int flg); +BOOL CHAR_DischargePartyNoMsg( int charaindex); +BOOL CHAR_setMyPosition_main( int index, int x, int y, int setdir, BOOL CAFlg); +BOOL CHAR_setMyPosition( int index, int x, int y, BOOL CAFlg); + +void CHAR_CharaDeleteHavePet( int charaindex); +int CHAR_sendAction( int charaindex, int action, int mode); +void CHAR_sendLeader( int objindex, int leader); +void CHAR_sendBattleWatch( int objindex, int onoff); +void CHAR_sendBattleEffect( int charaindex, int onoff); + +// shan +void CHAR_sendTradeEffect( int charaindex, int onoff); +#ifdef _MIND_ICON +void CHAR_sendMindEffect( int charaindex, int onoff); +#endif +#ifdef _ITEM_CRACKER +void CHAR_sendCrackerEffect( int charaindex, int onoff); +#endif + +void CHAR_inputUserPetName( int index , int havepetindex, char* name ); +int CHAR_getPartyIndex( int index, int num); +void CHAR_processWindow(int charaindex, int seqno, int select, + int objindex, char* data ); +void CHAR_AddCharm( int charaindex, int iValue ); +void CHAR_PetAddVariableAi( int petindex, int iValue ); +void CHAR_PartyUpdate( int charaindex, int senddata ); +char *CHAR_getUseName( int charaindex ); +char *CHAR_getUseID( int charaindex ); +EXTERN int EnemyMoveNum; /* ݱ ³ļ */ + +#define DB_DUELPOINT "db_duel" // ب޻̼ì +#define DB_ADDRESSBOOK "db_addressbook" // ʧƤͷì + +BOOL CHAR_send_DpDBUpdate( int charaindex ); +BOOL CHAR_send_DpDBUpdate_AddressBook( int charaindex, int mode ); + + +void CHAR_sendPMEToArroundCharacter( int charaindex, int petindex, int flg, int no ); +void CHAR_sendPMEToArroundCharacterFLXY( int petindex, + int fl, int x, int y, int dir, int flg, int no ); + +void CHAR_sendSEoArroundCharacter( int fl, int x, int y, int senumber, int sw ); + +BOOL CHAR_initEffectSetting( char* filename ); +void CHAR_checkEffect( int charaindex); +void CHAR_checkEffectLoop( void); +void CHAR_initDebugChatCdkey( void); +int CHAR_setChatMagicCDKey( int mode, char *cdkey); + + +float GetRecoveryRate( int charaindex ); +int storeCharaData( void ); +#ifdef _MAGIC_REHPAI //ѪAI +int Magic_RideGetHP( int toindex, int petindex, int flg); +#endif +// CoolFish: Trade 2001/4/18 +int CHAR_findTotalEmptyItem(int index); + + +#ifdef _FIX_METAMORIDE +int CHAR_CHECKJOINENEMY( int index); +#endif + +#ifdef _SEND_EFFECT // WON ADD ACѩЧ +#define CHAR_EFFECT_SETTINGBUFFER 256 +typedef struct tagCHAR_effectsetting +{ + int floor; // ׷ʧ + int effect; // į + int level; // 뼰ì ؼ۽ + int sendflg; // ްë˪׾ + char month[CHAR_EFFECT_SETTINGBUFFER]; // » + char day[CHAR_EFFECT_SETTINGBUFFER]; // + char hour[CHAR_EFFECT_SETTINGBUFFER]; // + char min[CHAR_EFFECT_SETTINGBUFFER]; // + char expire[CHAR_EFFECT_SETTINGBUFFER]; // ƻӮ( + +}CHAR_effectsetting; + +CHAR_effectsetting* CHAR_effect; +int CHAR_effectnum; +#endif + +#ifdef _ITEM_PILENUMS +int CHAR_getMyMaxPilenum( int charaindex); +#endif + +#ifdef _PET_LOSTPET +BOOL CHAR_CharSaveLostPet( int petindex, int type); +#endif +#ifdef _ALLDOMAN +void InitHeroList( void); +#endif +#endif + +#ifdef _STREET_VENDOR +void CHAR_sendStreetVendor(int charaindex,char *message); +void CHAR_sendStreetVendorDataToCli(int charaindex,int toindex); +void CHAR_sendStreetVendorOneDataToCli(int charaindex,int toindex,int sendindex); +#endif + +BOOL checkUnlawWarpFloor( int floor); + +#ifdef _HELP_NEWHAND +void CHAR_loginAddItemForNew( int charaindex ); +#endif + +#ifdef _JOBDAILY +void CHAR_JobDaily(int charaindex,char *data); +#endif + +#ifdef _TEACHER_SYSTEM +void CHAR_Teacher_system(int charaindex,char *data); +void CHAR_Teacher_system_View(int charaindex,int iOnLine,char *data); +#endif + +#ifdef _TIME_TICKET +void check_TimeTicket(); +int check_TimeTicketMap(int floor); +#endif + +void CHAR_CheckItemTime( int charaindex ); +void CHAR_loginCheckUserItem( int charaindex); diff --git a/include/char_base.h b/include/char_base.h new file mode 100644 index 0000000..54b000e --- /dev/null +++ b/include/char_base.h @@ -0,0 +1,2072 @@ +#ifndef __CHAR_BASE_H__ +#define __CHAR_BASE_H__ + +#include "version.h" +#include "skill.h" +#include "title.h" +/*#include "magicinfo.h"*/ +#include "addressbook.h" +#ifdef _ALLBLUES_LUA +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#endif +#define CHAR_DELIMITER "\n" + +#define NONCHAR_DELIMITER "|" + +#define STATUSSENDDELIMITER "|" + +#define CHAR_MAXGOLDHAVE (10000*10000) +#define CHAR_MAXBANKGOLDHAVE (10000*10000) +#define CHAR_MAXFMBANKGOLDHAVE (10000*100000) + +#ifdef _NEW_MANOR_LAW +#define MAX_PERSONAL_MOMENTUM 10000000 +#endif +#ifdef _PERSONAL_FAME // Arminius 8.30: +#define MAX_PERSONALFAME 100000000 +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#define CHAR_SKILLMAXHAVE 26 // ְҵ +#else +#define CHAR_SKILLMAXHAVE 5 +#endif + +#ifdef _STREET_VENDOR +#define MAX_SELL_ITEM 20 // ߼ӳﹲʮ +#endif +#define CHAR_TITLEMAXHAVE 30 + +#define NULLSKILL "0" + +#define CHAR_MAXPETHAVE 5 +#define CHAR_MAXPERSONAGOLD 50000000 + +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ +#define CHAR_MAXPOOLPETHAVE 15 +#else +#define CHAR_MAXPOOLPETHAVE 10 +#endif + +#define CHAR_MAXPETSKILLHAVE 7 +#define CHAR_PARTYMAX 5 +#define CHAR_PLAYERNPCMAX 4 +#define CHAR_MAXATTRIB 100 +#define CHAR_MAXUPLEVEL 200 +#define CHAR_MAXDUELPOINT 100000000 +#define CHAR_DEFAULTMAXAI (60) +#define CHAR_MAXVARIABLEAI (100*100) +#define CHAR_MINVARIABLEAI (-100*100) +#define CHAR_POISONSTRING "ж" +#define CHAR_RECOVERPOISONSTRING "ⶾ" +#define CHAR_PARALYSISSTRING "" +#define CHAR_RECOVERPARALYSISSTRING "" +#define CHAR_SILENCESTRING "޷ħ" +#define CHAR_RECOVERSILENCESTRING "ħ" +#define CHAR_STONESTRING "ʯ" +#define CHAR_RECOVERSTONESTRING "" +#define CHAR_DARKNESSSTRING "ܲ" +#define CHAR_RECOVERDARKNESSSTRING "ܳ" +#define CHAR_CONFUSIONSTRING "ֻ" +#define CHAR_RECOVERCONFUSIONSTRING "ָ" + +#define CHAR_DEFAULTSEESIZ 23 +#define MAP_CHAR_DEFAULTSEESIZ (CHAR_DEFAULTSEESIZ+4) + +typedef enum +{ + CHAR_HEAD, + CHAR_BODY, + CHAR_ARM, + CHAR_DECORATION1, + CHAR_DECORATION2, +#ifdef _ITEM_EQUITSPACE + CHAR_EQBELT, // + CHAR_EQSHIELD, // + CHAR_EQSHOES, //Ь +#endif +#ifdef _EQUIT_NEWGLOVE + CHAR_EQGLOVE, +#endif + CHAR_EQUIPPLACENUM, +}CHAR_EquipPlace; + + +#ifdef _PET_ITEM +typedef enum +{ + CHAR_PET_HEAD, //ͷ + CHAR_PET_TOOTH, // + CHAR_PET_CLAW, //צ + CHAR_PET_BREAST, // + CHAR_PET_BACK, // + CHAR_PET_WING, // + CHAR_PET_FEET, // + + CHAR_PETITEMNUM, +}CHAR_petitem; +#endif + + +typedef struct tagCharHaveSkill +{ + int use; + Skill skill; +}CHAR_HaveSkill; + +#ifdef _STREET_VENDOR +typedef struct STREET_VENDDOR_t{ + int pile; // + int price; // ۸ + int index; // + int kind; // ߻dz 0: 1: + BOOL usage; // Ƿʹ +}StreetVendor_t; + +enum{ + SV_PILE, + SV_PRICE, + SV_INDEX, + SV_KIND, + SV_USAGE, + MAX_SV +}; +#endif + +typedef enum +{ + CHAR_ACTSTAND, + CHAR_ACTWALK, + CHAR_ACTATTACK, + CHAR_ACTTHROW, + CHAR_ACTDAMAGE, + CHAR_ACTDEAD, + CHAR_ACTMAGIC, + CHAR_ACTITEM, + CHAR_ACTEFFECT, + CHAR_ACTDOWN = 10, + CHAR_ACTSIT, + CHAR_ACTHAND, + CHAR_ACTPLEASURE, + CHAR_ACTANGRY, + CHAR_ACTSAD, + CHAR_ACTGUARD, + CHAR_ACTACTIONWALK, + CHAR_ACTNOD, + CHAR_ACTACTIONSTAND, + CHAR_ACTBATTLE = 20, + CHAR_ACTLEADER, + CHAR_ACTBATTLEWATCH, + CHAR_ACTPOPUPNAME, + CHAR_ACTTURN = 30, + CHAR_ACTWARP, + CHAR_ACTTRADE, +#ifdef _ANGEL_SUMMON + CHAR_ACTANGEL = 34, +#endif + +#ifdef _MIND_ICON + CHAR_MIND = 40, +#endif +#ifdef _STREET_VENDOR + CHAR_STREETVENDOR_OPEN, + CHAR_STREETVENDOR_CLOSE, +#endif +#ifdef _ITEM_CRACKER + CHAR_ITEM_CRACKER = 50, +#endif +}CHAR_ACTION; + +typedef enum +{ + CHAR_CLIACTATTACK, + CHAR_CLIACTDAMAGE, + CHAR_CLIACTDOWN, + CHAR_CLIACTSTAND, + CHAR_CLIACTWALK, + CHAR_CLIACTSIT, + CHAR_CLIACTHAND, + CHAR_CLIACTPLEASURE, + CHAR_CLIACTANGRY, + CHAR_CLIACTSAD, + CHAR_CLIACTGUARD, + CHAR_CLIACTNOD, + CHAR_CLIACTTHROW, + +}CHAR_CLIENTACTION; + +typedef enum +{ + CHAR_TYPENONE, + CHAR_TYPEPLAYER, + CHAR_TYPEENEMY, + CHAR_TYPEPET, + CHAR_TYPEDOOR, + CHAR_TYPEBOX, + CHAR_TYPEMSG, + CHAR_TYPEWARP, + CHAR_TYPESHOP, + CHAR_TYPEHEALER, + CHAR_TYPEOLDMAN, + CHAR_TYPEROOMADMIN, + CHAR_TYPETOWNPEOPLE, + CHAR_TYPEDENGON, + CHAR_TYPEADM, + CHAR_TYPETEMPLE, + CHAR_TYPESTORYTELLER, + CHAR_TYPERANKING, + CHAR_TYPEOTHERNPC, + CHAR_TYPEPRINTPASSMAN, + CHAR_TYPENPCENEMY, + CHAR_TYPEACTION, + CHAR_TYPEWINDOWMAN, + CHAR_TYPESAVEPOINT, + CHAR_TYPEWINDOWHEALER, + CHAR_TYPEITEMSHOP, + CHAR_TYPESTONESHOP, + CHAR_TYPEDUELRANKING, + CHAR_TYPEWARPMAN, + CHAR_TYPEEVENT, + CHAR_TYPEMIC, + CHAR_TYPELUCKYMAN, + CHAR_TYPEBUS, + CHAR_TYPECHARM, + CHAR_TYPECHECKMAN, + CHAR_TYPEJANKEN, + CHAR_TYPETRANSMIGRATION, + CHAR_TYPEFMWARPMAN, // У˳Ա + CHAR_TYPEFMSCHEDULEMAN, // У˳ǼԱ + CHAR_TYPEMANORSCHEDULEMAN, // ׯ԰У˳ԤԼ +#ifdef _GAMBLE_BANK + CHAR_GAMBLEBANK, +#endif +#ifdef _NEW_WARPMAN + CHAR_NEWNPCMAN, +#endif + +#ifdef _GAMBLE_ROULETTE + CHAR_GAMBLEROULETTE, + CHAR_GAMBLEMASTER, +#endif +#ifdef _TRANSER_MAN + CHAR_TRANSERMANS, +#endif + +#ifdef _NPC_MAKEPAIR + CHAR_MAKEPAIR, +#endif +#ifdef _NPC_FUSION + CHAR_PETFUSIONMAN, +#endif + +#ifdef _ITEM_NPCCHANGE + CHAR_ITEMCHANGENPC, +#endif +#ifdef _CFREE_petskill + CHAR_FREESKILLSHOP, +#endif +#ifdef _PETRACE + CHAR_PETRACEMASTER, // ᄎ + CHAR_PETRACEPET, +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + CHAR_TYPEALLDOMAN, +#endif + + CHAR_TYPEPETMAKER, // petmaker + +#ifdef _NPC_WELFARE + CHAR_TYPEWELFARE, +#endif +#ifdef _ALLBLUES_LUA + CHAR_TYPELUANPC, +#endif +#ifdef _JZ_NEWSCRIPT_LUA + CHAR_LUANPC, +#endif + +#ifdef _PLAYER_NPC + CHAR_TYPEPLAYERNPC, + CHAR_TYPEPLAYERPETNPC, +#endif + CHAR_TYPENUM, +}CHAR_TYPE; + +typedef enum +{ + CHAR_EVENT_NONE, + CHAR_EVENT_NPC, + CHAR_EVENT_ENEMY, + CHAR_EVENT_WARP, + CHAR_EVENT_DOOR, + CHAR_EVENT_ALTERRATIVE, + CHAR_EVENT_WARP_MORNING, + CHAR_EVENT_WARP_NOON, + CHAR_EVENT_WARP_NIGHT, + CHAR_EVENTNUM, +}CHAR_EVENT; + +typedef enum +{ + CHAR_PARTY_NONE, + CHAR_PARTY_LEADER, + CHAR_PARTY_CLIENT, +}CHAR_PARTY_MODE; + +typedef enum +{ + CHAR_TRADE_FREE, /* ɽ */ + CHAR_TRADE_SENDING, /* */ + CHAR_TRADE_TRADING, /* */ + CHAR_TRADE_LOCK, /* */ +}CHAR_TRADE_MODE; + +typedef enum +{ + CHAR_PETMAIL_NONE, + CHAR_PETMAIL_IDLE1, + CHAR_PETMAIL_IDLE2, + CHAR_PETMAIL_RETURNWAIT, + CHAR_PETMAIL_IDLE3, + CHAR_PETMAIL_IDLE4, + CHAR_PETMAIL_IDLE5, +}CHAR_PETMAIL_MODE; + +typedef enum +{ + CHAR_PETFOLLOW_NONE, + CHAR_PETFOLLOW_NOW, +}CHAR_PETFOLLOW_MODE; + +#ifdef _DROPSTAKENEW +typedef enum +{ + DICE_BIG = 1, // _ + DICE_SMALL, // _С + DICE_ALLEAT, // _ͨ + PET_RACE1 = 5, // ٳ_1 + PET_RACE2, // ٳ_2 + PET_RACE3, // ٳ_3 + ROULETTE1 = 11, ROULETTE2, ROULETTE3, ROULETTE4, ROULETTE5, ROULETTE6, ROULETTE7, + ROULETTE8, ROULETTE9, ROULETTE10, ROULETTE11, ROULETTE12, ROULETTE13, ROULETTE14, + ROULETTE15, ROULETTE16, ROULETTE17, ROULETTE18, ROULETTE19, ROULETTE20, + ROULETTE21 = 41, ROULETTE22, ROULETTE23, ROULETTE24, ROULETTE25, ROULETTE26, + ROULETTE27, ROULETTE28, ROULETTE29, ROULETTE30, ROULETTE31, ROULETTE32, + ROULETTE33, ROULETTE34, ROULETTE35, ROULETTE36, ROULETTE37, ROULETTE38, + ROULETTE39, ROULETTE40, + ROULETTE41 = 71, ROULETTE42, ROULETTE43, ROULETTE44, ROULETTE45, + ROULETTE51 = 101, ROULETTE52, ROULETTE53, // + ROULETTE61 = 111, ROULETTE62, //110 1011 + PETFIGHT_WIN1 = 120, + PETFIGHT_WIN2, + PETFIGHT_DUEL, +}GAMBLE_TYPE; +#endif + +#ifdef _CHAR_POOLITEM +#ifdef _NPC_DEPOTPET // ųֿͬʱӵֿ߲ +#define CHAR_MAXDEPOTITEMHAVE 80 +#else +#define CHAR_MAXDEPOTITEMHAVE 60 +#endif +#endif + +#ifdef _CHAR_POOLPET +#define CHAR_MAXDEPOTPETHAVE 30 +#endif + + +#ifdef _ADD_POOL_ITEM // (ɿ) WON ADD ӿɼķŵĵ +#define CHAR_MAXPOOLITEMHAVE 30 +#else +#define CHAR_MAXPOOLITEMHAVE 20 +#endif + +#define CHAR_MAXITEMNUM 15 +#define CHAR_STARTITEMARRAY CHAR_EQUIPPLACENUM +#define CHAR_MAXITEMHAVE (CHAR_STARTITEMARRAY+CHAR_MAXITEMNUM) + +#ifdef _PET_ITEM +#define CHAR_MAXPETITEMHAVE CHAR_PETITEMNUM +#endif + +typedef enum +{ + CHAR_DATAPLACENUMBER, + CHAR_BASEIMAGENUMBER, + CHAR_BASEBASEIMAGENUMBER, + CHAR_FACEIMAGENUMBER, + CHAR_FLOOR, + CHAR_X, + CHAR_Y, + CHAR_DIR, + CHAR_LV, + CHAR_GOLD, + CHAR_HP, + CHAR_MP, + CHAR_MAXMP, + CHAR_VITAL, + CHAR_STR, + CHAR_TOUGH, + CHAR_DEX, + CHAR_CHARM, + CHAR_LUCK, + CHAR_EARTHAT, + CHAR_WATERAT, + CHAR_FIREAT, + CHAR_WINDAT, + CHAR_DEFAULTPET, + CHAR_CRITIAL, + CHAR_COUNTER, + CHAR_RARE, + CHAR_RADARSTRENGTH, + CHAR_CHATVOLUME, + CHAR_MERCHANTLEVEL, + CHAR_HEALERLEVEL, + CHAR_SAVEPOINT = CHAR_HEALERLEVEL, + CHAR_DETERMINEITEM, + CHAR_INDEXOFEQTITLE, + CHAR_POISON, + CHAR_PARALYSIS, + CHAR_SLEEP, + CHAR_STONE, + CHAR_DRUNK, + CHAR_CONFUSION, + CHAR_LOGINCOUNT, + CHAR_NPCCREATEINDEX=CHAR_LOGINCOUNT, + CHAR_DEADCOUNT, + CHAR_WALKCOUNT, + CHAR_TALKCOUNT, + CHAR_DAMAGECOUNT, + CHAR_GETPETCOUNT, + CHAR_KILLPETCOUNT, + CHAR_DEADPETCOUNT, + CHAR_SENDMAILCOUNT, + CHAR_MERGEITEMCOUNT, + CHAR_DUELBATTLECOUNT, + CHAR_DUELWINCOUNT, + CHAR_DUELLOSECOUNT, + CHAR_DUELSTWINCOUNT, + CHAR_DUELMAXSTWINCOUNT, + CHAR_WHICHTYPE, + CHAR_WALKINTERVAL, + CHAR_LOOPINTERVAL, +#ifdef _NEWOPEN_MAXEXP + CHAR_OLDEXP, + CHAR_EXP, +#else + CHAR_EXP, +#endif + CHAR_LASTTALKELDER, + CHAR_SKILLUPPOINT, + CHAR_LEVELUPPOINT, + CHAR_IMAGETYPE, + CHAR_NAMECOLOR, + CHAR_POPUPNAMECOLOR, + CHAR_LASTTIMESETLUCK, + CHAR_DUELPOINT, + CHAR_ENDEVENT, /* (0~31) */ + CHAR_ENDEVENT2, /* (32~63) */ + CHAR_ENDEVENT3, /* (64~96) */ +#ifdef _NEWEVENT + CHAR_ENDEVENT4, /* (96~127) */ + CHAR_ENDEVENT5, /* (128~159) */ + CHAR_ENDEVENT6, /* (160~191) */ +#endif +#ifdef _ADD_NEWEVENT // WON + CHAR_ENDEVENT7, + CHAR_ENDEVENT8, + CHAR_ENDEVENT9, + CHAR_ENDEVENT10, + CHAR_ENDEVENT11, + CHAR_ENDEVENT12, + CHAR_ENDEVENT13, + CHAR_ENDEVENT14, + CHAR_ENDEVENT15, + CHAR_ENDEVENT16, +#endif + + CHAR_NOWEVENT, /* (0~31) */ + CHAR_NOWEVENT2, /* (32~63) */ + CHAR_NOWEVENT3, /* (64~96) */ +#ifdef _NEWEVENT + CHAR_NOWEVENT4, /* (96~127) */ + CHAR_NOWEVENT5, /* (128~159) */ + CHAR_NOWEVENT6, /* (160~191) */ +#endif +#ifdef _ADD_NEWEVENT // WON + CHAR_NOWEVENT7, + CHAR_NOWEVENT8, // 224~255 ٻר + CHAR_NOWEVENT9, + CHAR_NOWEVENT10, + CHAR_NOWEVENT11, + CHAR_NOWEVENT12, + CHAR_NOWEVENT13, + CHAR_NOWEVENT14, + CHAR_NOWEVENT15, + CHAR_NOWEVENT16, +#endif + CHAR_TRANSMIGRATION, + CHAR_TRANSEQUATION, + CHAR_INITDATA, + CHAR_SILENT, /* char shutup time */ + CHAR_FMINDEX, // index + CHAR_FMLEADERFLAG, /* Ա + * FMMEMBER_NONE :ûмκμ + * FMMEMBER_APPLY : + * FMMEMBER_LEADER :峤 + * FMMEMBER_MEMBER :һԱ + * FMMEMBER_ELDER : + * FMMEMBER_INVITE :˾ // ʱ + * FMMEMBER_BAILEE : // ʱ + * FMMEMBER_VICELEADER :峤 // ʱ + */ + CHAR_FMSPRITE, // ػ + + CHAR_BANKGOLD, + CHAR_RIDEPET, + CHAR_LEARNRIDE, +#ifdef _NEW_RIDEPETS + CHAR_LOWRIDEPETS, +#endif + CHAR_LIMITLEVEL, +#ifdef _PET_FUSION + CHAR_FUSIONCODE, //ֱ + CHAR_FUSIONINDEX, // + CHAR_FUSIONRAISE, // + CHAR_FUSIONBEIT, //走 + CHAR_FUSIONTIMELIMIT, // ʱ +#endif + +#ifdef _PERSONAL_FAME // Arminius 8.30: + CHAR_FAME, +#endif + +#ifdef _NEWSAVE + CHAR_SAVEINDEXNUMBER, /* SaveFile .0.char or .1.char */ +#endif + +#ifdef _ATTACK_MAGIC + CHAR_EARTH_EXP, // ҵĵħ + CHAR_WATER_EXP, // ҵˮħ + CHAR_FIRE_EXP, // ҵĻħ + CHAR_WIND_EXP, // ҵķħ + CHAR_EARTH_RESIST, // ҵĵħ + CHAR_WATER_RESIST, // ҵˮħ + CHAR_FIRE_RESIST, // ҵĻħ + CHAR_WIND_RESIST, // ҵķħ + CHAR_EARTH_ATTMAGIC_EXP, // ҵĵħȾֵ + CHAR_WATER_ATTMAGIC_EXP, // ҵˮħȾֵ + CHAR_FIRE_ATTMAGIC_EXP, // ҵĻħȾֵ + CHAR_WIND_ATTMAGIC_EXP, // ҵķħȾֵ + CHAR_EARTH_DEFMAGIC_EXP, // ҵĵħԾֵ + CHAR_WATER_DEFMAGIC_EXP, // ҵˮħԾֵ + CHAR_FIRE_DEFMAGIC_EXP, // ҵĻħԾֵ + CHAR_WIND_DEFMAGIC_EXP, // ҵķħԾֵ +#endif + + +#ifdef _GAMBLE_BANK + CHAR_PERSONAGOLD, //ij +#endif +#ifdef _DROPSTAKENEW + CHAR_GAMBLENUM, //ij +#endif +#ifdef _ADD_ACTION //npc + CHAR_ACTIONSTYLE, +#endif +#ifdef _PET_EVOLUTION + CHAR_EVOLUTIONBASEVTL, + CHAR_EVOLUTIONBASESTR, + CHAR_EVOLUTIONBASETGH, + CHAR_EVOLUTIONBASEDEX, +#endif + +#ifdef _FM_JOINLIMIT + CHAR_FMTIMELIMIT, +#endif + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + PROFESSION_CLASS, // ְҵ + PROFESSION_LEVEL, // ְҵȼ +// PROFESSION_EXP, // ְҵֵ + PROFESSION_SKILL_POINT, // ܵ + ATTACHPILE, // Ӷѵ + PROFESSION_FIRE_P, // + PROFESSION_ICE_P, // + PROFESSION_THUNDER_P, // + PROFESSION_FIRE_R, // + PROFESSION_ICE_R, // + PROFESSION_THUNDER_R, // ׿ +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + CHAR_HEROFLOOR, +#endif +#ifdef _PETSKILL_BECOMEPIG + CHAR_BECOMEPIG, + CHAR_BECOMEPIG_BBI,//Ҫɵͼ +#endif + CHAR_LASTLEAVETIME, // Robin add ʱ + +#ifdef _NEW_MANOR_LAW + CHAR_MOMENTUM, +#endif + +#ifdef _ITEM_ADDEXP2 + CHAR_ADDEXPPOWER, + CHAR_ADDEXPTIME, +#endif + +#ifdef _VIP_BATTLE_EXP + CHAR_NVIPEXP, + CHAR_NVIPTIME, +#endif + +#ifdef _ANGEL_SUMMON + CHAR_HEROCNT, // Ĵ +#endif + +#ifdef _TEACHER_SYSTEM + CHAR_TEACHER_FAME, // ʦ쵼 +#endif + +#ifdef _GM_ITEM + CHAR_GMTIME, // GM +#endif + +#ifdef _VIP_SERVER + CHAR_AMPOINT, // Ա +#endif + +#ifdef _VIP_RIDE + CHAR_VIPRIDE, // Աڼ + CHAR_VIPTIME, // Աʱ +#endif +#ifdef _AUTO_PK + CHAR_AUTOPK, // ԶPK +#endif +#ifdef _BATTLE_PK + CHAR_BATTLEPK, +#endif + +#ifdef _PET_BEATITUDE + CHAR_BEATITUDE, +#endif +#ifdef _RIDE_CF + CHAR_LOWRIDEPETS1, + CHAR_HIGHRIDEPETS2, // +#endif +#ifdef _SUPER_MAN_ITEM + CHAR_SUPER, //Ʒ +#endif +#ifdef _EV_NUM + CHAR_EVNUM, + CHAR_EVITEM, +#endif +#ifdef _JOB_AUTOPK + CHAR_JOBPKMODE, + CHAR_JOBPKTIME, +#endif +#ifdef _VIGOR_SYS + CHAR_VIGOR, +#endif +#ifdef _STU_SYS + CHAR_STUNUM, +#endif +#ifdef _ALL_TALK + CHAR_ATDATE, + CHAR_ATCNT, +#endif +#ifdef _SAFE_PASSWORD + CHAR_LOCK, +#endif + CHAR_NPCTIME, +#ifdef _OFFLINE_SYSTEM + CHAR_OFFTIME, +#endif +#ifdef _CAMEO_MONEY + CHAR_CAMEO, +#endif +#ifdef _MISSION_TRAIN + CHAR_MISSIONTRAIN_NUM, + CHAR_MISSIONTRAIN_TIME, +#endif +#ifdef _PET_EVOLVE + CHAR_EVOLVE, +#endif +#ifdef _FLOOR_DIFI_FIELD + CHAR_FLOORDIFI_TIME, +#endif +#ifdef _MISSION_TIME + CHAR_MISSION_TIME, +#endif +#ifdef _PLAYER_TITLE + CHAR_TITLE_LV, + CHAR_TITLE_TIME, +#endif +#ifdef _COWRIE + CHAR_BJ, +#endif +#ifdef _ONLINE_TIME + CHAR_ONLINE_TIME, +#endif + CHAR_LUASAVE_WORKINT_1, + CHAR_LUASAVE_WORKINT_2, + CHAR_LUASAVE_WORKINT_3, + CHAR_LUASAVE_INT_1, + CHAR_LUASAVE_INT_2, + CHAR_LUASAVE_INT_3, +#ifdef _CAX_ESC_REPORT + CHAR_REPORT,//ÿǩ +#endif +#ifdef _CAX_Mercenary + CHAR_MERCENARY,//Ӷֶ +#endif +#ifdef _REGISTRATION_TIME + CHAR_REGISTRATION_TIME, + CHAR_REGISTRATION_COUNT, + CHAR_REGISTRATION_ONLINE_TIME, +#endif + CHAR_DATAINTNUM, + +}CHAR_DATAINT; + +typedef enum { + CHAR_MODAI = CHAR_CHARM, /* ʸ ĤҰ */ + CHAR_VARIABLEAI = CHAR_LUCK, /* ʸ ߨ װƥ Ȼ */ + CHAR_SLOT = CHAR_DEFAULTPET, /* ë µ ʸ */ + CHAR_PETGETLV = CHAR_CHATVOLUME, /* ľì ʸ */ + CHAR_PUTPETTIME = CHAR_LOGINCOUNT, /* ʸ ľ */ + CHAR_MAILMODE = CHAR_RADARSTRENGTH, /* ʸ ˪ */ + CHAR_ALLOCPOINT = CHAR_LEVELUPPOINT, /* ìʧݼԻԻ̼(ʸ) */ + CHAR_PETMAILBUFINDEX = CHAR_GETPETCOUNT, /* ʸ(offmsg)߼index */ + CHAR_PETMAILIDLETIME = CHAR_SENDMAILCOUNT, /* ʸPмئ */ + CHAR_PETMAILFROMFLOOR = CHAR_DUELBATTLECOUNT, /* ë˪ݼ׷ʧ */ + CHAR_PETMAILFROMX = CHAR_DUELWINCOUNT, /* ë˪ݼ */ + CHAR_PETMAILFROMY = CHAR_DUELLOSECOUNT, /* ë˪ݼ */ + CHAR_PETMAILEFFECT = CHAR_DUELSTWINCOUNT, /* ʸPؼް į */ + CHAR_PETSENDMAILCOUNT = CHAR_TALKCOUNT, /* ʸëϷּ */ + CHAR_PETRANK = CHAR_LASTTIMESETLUCK, /* ʸ¼(ʸ ۨ߷޷¡ */ + CHAR_PETID = CHAR_DUELMAXSTWINCOUNT,/* ʸ */ + CHAR_PETFAMILY = CHAR_FMLEADERFLAG, // CoolFish: Family жǷΪػ + CHAR_PETENEMYID = CHAR_GAMBLENUM, +}CHAR_PET; + + +typedef enum +{ + CHAR_NAME, + CHAR_OWNTITLE, + CHAR_USERPETNAME = CHAR_OWNTITLE, + CHAR_NPCARGUMENT, + CHAR_CDKEY = CHAR_NPCARGUMENT, + CHAR_OWNERCDKEY, + CHAR_OWNERCHARANAME, + CHAR_FMNAME, +#ifdef _UNIQUE_P_I + CHAR_UNIQUECODE, +#endif +#ifdef _ACTION_GMQUE + CHAR_GMQUESTR1, +#endif + +#ifdef _TEACHER_SYSTEM + CHAR_TEACHER_ID, // ʦʺ + CHAR_TEACHER_NAME, // ʦ +#endif +#ifdef _ITEM_SETLOVER + CHAR_LOVE, // ж + CHAR_LOVERID, // ʺ + CHAR_LOVERNAME, // +#endif + +#ifdef _GM_ITEM + CHAR_GMFUNCTION, // GM +#endif +#ifdef _NEW_NAME //Զƺ + CHAR_NEWNAME, +#endif +#ifdef _EV_NUM + CHAR_EVCODE, +#endif +#ifdef _ALL_RANDMODE + CHAR_RANDTYPE, +#endif +#ifdef _OFFLINE_SYSTEM + CHAR_OFFBUF, +#endif + // CHAR_CHARPLAYIP, //IP + CHAR_DATACHARNUM, +}CHAR_DATACHAR; + +typedef enum +{ + CHAR_ISATTACK, + CHAR_ISATTACKED, + CHAR_ISOVER, + CHAR_ISOVERED, + CHAR_HAVEHEIGHT, + CHAR_ISVISIBLE, + CHAR_ISTRANSPARENT, + CHAR_ISFLYING, + CHAR_ISDIE, + CHAR_ISBIG, + CHAR_ISSHOWBATTLEMSG, + CHAR_ISPARTY, + CHAR_ISWARP, + CHAR_ISDUEL, + CHAR_ISPARTYCHAT, + CHAR_ISTRADECARD, + CHAR_ISTRADE, +#ifdef _CHANNEL_MODIFY + CHAR_ISTELL, //Ƶ + CHAR_ISFM, //Ƶ + CHAR_ISOCC, //ְҵƵ + CHAR_ISSAVE, //Ի濪 + CHAR_ISCHAT, // + CHAR_ISWORLD, //Ƶ +#endif + CHAR_FLGNUM, +}CHAR_DATAFLG; + +#define CHAR_FS_PARTY (1 << 0) +#define CHAR_FS_BATTLE (1 << 1) +#define CHAR_FS_DUEL (1 << 2) +#define CHAR_FS_PARTYCHAT (1 << 3) //Ƶ +#define CHAR_FS_TRADECARD (1 << 4) +#define CHAR_FS_TRADE (1 << 5) +#ifdef _CHANNEL_MODIFY +#define CHAR_FS_TELL (1 << 6) //Ƶ +#define CHAR_FS_FM (1 << 7) //Ƶ +#define CHAR_FS_OCC (1 << 8) //ְҵƵ +#define CHAR_FS_SAVE (1 << 9) //Ի濪 +#define CHAR_FS_CHAT (1 << 10) //ҿ + +#define CHAR_FS_WORLD (1 << 11) //Ƶ +#endif +typedef enum +{ + CHAR_WORKBATTLEMODE, + CHAR_WORKBATTLEINDEX, + CHAR_WORKBATTLESIDE, + CHAR_WORKBATTLECOM1, + CHAR_WORKBATTLECOM2, + CHAR_WORKBATTLECOM3, +#ifdef _PSKILL_MDFYATTACK + CHAR_WORKBATTLECOM4, +#endif + CHAR_WORKBATTLEFLG, + CHAR_WORKBATTLEWATCH, + + CHAR_WORKFIXEARTHAT, + CHAR_WORKFIXWATERAT, + CHAR_WORKFIXFIREAT, + CHAR_WORKFIXWINDAT, +#ifdef _PROFESSION_ADDSKILL + CHAR_WORKFIXEARTHAT_BOUNDARY, //ؽ 16λԪżǿٷֱ 16λԪŻغ + CHAR_WORKFIXWATERAT_BOUNDARY, //ˮ + CHAR_WORKFIXFIREAT_BOUNDARY, // + CHAR_WORKFIXWINDAT_BOUNDARY, // +#endif + CHAR_WORKMAXHP, + CHAR_WORKMAXMP, + + CHAR_WORKATTACKPOWER, + CHAR_WORKDEFENCEPOWER, + CHAR_WORKQUICK, + + CHAR_WORKFIXVITAL, + CHAR_WORKFIXSTR, + CHAR_WORKFIXTOUGH, + CHAR_WORKFIXDEX, + +#ifdef _ITEMSET5_TXT + CHAR_WORKFIXARRANGE, + CHAR_WORKARRANGEPOWER, + CHAR_WORKFIXSEQUENCE, + CHAR_WORKSEQUENCEPOWER, + CHAR_WORKATTACHPILE, + CHAR_WORKHITRIGHT, // +#endif +#ifdef _ITEMSET6_TXT + CHAR_WORKNEGLECTGUARD, +#endif + CHAR_WORKMODATTACK, + CHAR_WORKMODDEFENCE, + CHAR_WORKMODQUICK, + + CHAR_WORKMODCAPTURE, + CHAR_WORKMODCHARM, + + CHAR_WORKFIXCHARM, + CHAR_WORKFIXLUCK, + CHAR_WORKFIXAI, + CHAR_WORKFIXAVOID, + + CHAR_WORKDAMAGEABSROB, + CHAR_WORKDAMAGEREFLEC, + CHAR_WORKDAMAGEVANISH, + CHAR_WORKPOISON, + CHAR_WORKPARALYSIS, + CHAR_WORKSLEEP, + CHAR_WORKSTONE, + CHAR_WORKDRUNK, + CHAR_WORKCONFUSION, + CHAR_WORKWEAKEN, // vincent add _MAGIC_WEAKEN + CHAR_WORKDEEPPOISON, //綾 vincent add _MAGIC_DEEPPOISON + CHAR_WORKBARRIER, //ħ vincent add _MAGIC_BARRIER + CHAR_WORKNOCAST, //Ĭ vincent add _MAGIC_NOCAST + CHAR_WORKMODPOISON, + CHAR_WORKMODPARALYSIS, + CHAR_WORKMODSLEEP, + CHAR_WORKMODSTONE, + CHAR_WORKMODDRUNK, + CHAR_WORKMODCONFUSION, + CHAR_WORKMODWEAKEN, + CHAR_WORKMODDEEPPOISON, + CHAR_WORKMODBARRIER, //ħ + CHAR_WORKMODNOCAST, //Ĭ + CHAR_WORKMODCRITICAL, //һɱ + CHAR_WORKULTIMATE, + CHAR_WORKPARTYMODE, + CHAR_WORKTRADEMODE, /* ģʽ + * 0: CHAR_TRADE_FREE :ɽ + * 1: CHAR_TRADE_SENDING: + * 2: CHAR_TRADE_TRADING: + * 3: CHAR_TRADE_LOCK : + */ + CHAR_WORKPARTYINDEX1, + CHAR_WORKPARTYINDEX2, + CHAR_WORKPARTYINDEX3, + CHAR_WORKPARTYINDEX4, + CHAR_WORKPARTYINDEX5, + CHAR_WORKOBJINDEX, + CHAR_WORKWALKSTARTSEC, + CHAR_WORKWALKSTARTMSEC, + CHAR_WORKLOOPSTARTSEC, + CHAR_WORKLOOPSTARTMSEC, + CHAR_WORKLASTATTACKCHARAINDEX, + CHAR_WORKEVENTTYPE, + CHAR_WORKGETEXP, + CHAR_WORKMODCAPTUREDEFAULT, + CHAR_WORKACTION, + CHAR_WORKFD, + CHAR_WORKFLG, + CHAR_WORKGMLEVEL, + CHAR_NPCWORKINT1, + CHAR_NPCWORKINT2, + CHAR_NPCWORKINT3, + CHAR_NPCWORKINT4, + CHAR_NPCWORKINT5, + CHAR_NPCWORKINT6, + CHAR_NPCWORKINT7, + CHAR_NPCWORKINT8, + CHAR_NPCWORKINT9, + CHAR_NPCWORKINT10, + CHAR_NPCWORKINT11, +#ifdef _PETRACE + CHAR_NPCWORKINT12, +#endif + CHAR_NPCWORKINT13, + CHAR_WORKWARPCHECK, + CHAR_TENSEICHECKED, + CHAR_WORKFMINDEXI, // index + CHAR_WORKFMCHANNEL, // Ƶ + CHAR_WORKFMCHANNELQUICK, + CHAR_WORKFMFLOOR, // ݵͼ + CHAR_WORKFMDP, // ģֵ + CHAR_WORKFMPKFLAG, // ǷУ 1:Yes + CHAR_WORKFMSETUPFLAG, // Ƿʽ + CHAR_WORKFMMANINDEX, // FMWARPMAN Index + CHAR_WORKFMCHARINDEX, // Ա index + CHAR_WORKBATTLEFLAG, // -1(ս)1(ս) + + CHAR_WORK_PET0_STAT, + CHAR_WORK_PET1_STAT, + CHAR_WORK_PET2_STAT, + CHAR_WORK_PET3_STAT, + CHAR_WORK_PET4_STAT, + + CHAR_WORKLOGINTIME, // ҵʱ + CHAR_WORKTALKCOUNT, + CHAR_WORKTALKTIME, + CHAR_WORKPETFOLLOW, // + CHAR_WORKPETFALL, // ս + CHAR_WORKLEADERCHANGE, // 峤λindex +#ifdef _EQUIT_DEFMAGIC + CHAR_EQUITDEFMAGIC_E, + CHAR_EQUITDEFMAGIC_WA, + CHAR_EQUITDEFMAGIC_F, + CHAR_EQUITDEFMAGIC_WI, + CHAR_EQUITQUIMAGIC, +#endif +#ifdef _EQUIT_RESIST + CHAR_WORKEQUITFIRE, //װ + CHAR_WORKEQUITTHUNDER,//װ + CHAR_WORKEQUITICE,//װ + CHAR_WORKEQUITWEAKEN,//װ + CHAR_WORKEQUITBARRIER,//װħ + CHAR_WORKEQUITNOCAST,//װĬ + CHAR_WORKEQUITFALLRIDE,//װ +#endif +#ifdef _PETMAIL_DEFNUMS + CHAR_PETMAILNUMS, + CHAR_PETMAILSENDTIME, +#endif +#ifdef _ITEM_METAMO + CHAR_WORKITEMMETAMO, +#endif +#ifdef _ADD_DEAMGEDEFC + CHAR_WORKOTHERDMAGE, + CHAR_WORKOTHERDEFC, +#endif + +#ifdef _LOSE_FINCH_ + CHAR_WORKSPETRELIFE, //︴ +#endif + +#ifdef _CHIKULA_STONE + CHAR_WORKCHIKULAHP, + CHAR_WORKCHIKULAMP, +#endif +#ifdef _PETSKILL_SETDUCK + CHAR_MYSKILLDUCKPOWER, + CHAR_MYSKILLDUCK, + CHAR_MYSKILLSTRPOWER, + CHAR_MYSKILLSTR, + CHAR_MYSKILLTGHPOWER, + CHAR_MYSKILLTGH, + CHAR_MYSKILLDEXPOWER, + CHAR_MYSKILLDEX, + CHAR_MAGICPETMP, +#endif + CHAR_SKILLSTRPOWER, + CHAR_SKILLDEXPOWER, +#ifdef _NPC_MAKEPAIR + CHAR_MYPAIRINDEX, + CHAR_MYPAIRFLG, + CHAR_MYPAIRCODE, +#endif +#ifdef _OTHER_MAGICSTAUTS + CHAR_DEFMAGICSTATUS, +#ifdef _MAGIC_SUPERWALL + CHAR_MAGICSUPERWALL, +#endif + CHAR_OTHERSTATUSNUMS, +#endif +#ifdef _NPCCHANGE_PLAYERIMG + CHAR_WORKNPCMETAMO, +#endif + CHAR_PickAllPet, +#ifdef _DROPSTAKENEW + CHAR_WORKSTAKEFLAG, + CHAR_WORKSTAKETYPE1, + CHAR_WORKSTAKETYPE2, + CHAR_WORKSTAKETYPE3, + CHAR_WORKSTAKETYPE4, + CHAR_WORKSTAKETYPE5, +#endif + + CHAR_WORKTOXICATION, + +#ifdef _SUIT_ITEM + CHAR_WORKSUITITEM, + CHAR_WORKROUNDHP, + CHAR_WORKROUNDMP, + CHAR_WORKSUITVIT, + CHAR_WORKSUITSTR, + CHAR_WORKSUITTGH, + CHAR_WORKSUITDEX, + CHAR_WORKSUITMODSTR, +#ifdef _SUIT_ADDENDUM + CHAR_WORKRESIST, //쳣 + CHAR_WORKCOUNTER,// + CHAR_WORKMPOWER, //ǿʦħ( Ӱķ:ɽȪ ĩ ǹ Ѫ Ѫ һѪ ) +#endif +#ifdef _SUIT_TWFWENDUM + CHAR_WORK_EA,// + CHAR_WORK_WR,//ˮ + CHAR_WORK_FI,// + CHAR_WORK_WI,// +#endif +#ifdef _SUIT_ADDPART3 + CHAR_WORKDUCKPOWER,//װر + CHAR_WORKRENOCAST, //Ĭ + CHAR_WORKSUITSTR_P,// λΪ% + CHAR_WORKSUITTGH_P,// λΪ% + CHAR_WORKSUITDEX_P,// λΪ% +#endif +#ifdef _SUIT_ADDPART4 + CHAR_SUITPOISON, //װ + CHAR_WORKMPOWER2, //CHAR_WORKMPOWERͬ + CHAR_WORKUNMPOWER, //ֿʦħ( Ӱķ:ɽȪ ĩ ǹ Ѫ Ѫ һѪ ) +#endif +#endif//_SUIT_ITEM + +#ifdef _IMPRECATE_ITEM + CHAR_WORKHURTMP, //˺ MP + CHAR_WORKWISHESHP, //ף hp + CHAR_WORKWISHESMP, //ף MP + CHAR_WORKIMPRECATENUM1, + CHAR_WORKIMPRECATENUM2, + CHAR_WORKIMPRECATENUM3, +#endif +#ifdef _STATUS_WATERWORD + CHAR_WORKMAPFLOORTYPE, + CHAR_WORKSTATUSWATER, +#endif +#ifdef _BATTLENPC_WARP_PLAYER + CHAR_WORKTURN, +#endif +#ifdef _MIND_ICON + CHAR_MIND_NUM, +#endif +#ifdef _ITEM_CRACKER + CHAR_WORKITEM_CRACKER, +#endif +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + CHAR_WORKHEROFLOOR, +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + CHAR_ENCOUNT_FIX, // + CHAR_ENCOUNT_NUM, + CHAR_WORK_F_PROFICIENCY,// + CHAR_WORK_I_PROFICIENCY,// + CHAR_WORK_T_PROFICIENCY,// + CHAR_WORK_F_RESIST, // + CHAR_WORK_I_RESIST, // + CHAR_WORK_T_RESIST, // 翹 + CHAR_MYSKILLHIT, // + CHAR_MYSKILLHIT_NUM, + CHAR_WORKDIZZY, // ѣ + CHAR_WORKMODDIZZY, + CHAR_WORKENTWINE, // + CHAR_WORKMODENTWINE, + CHAR_WORKTRAP, // + CHAR_WORKMODTRAP, + CHAR_WORKDRAGNET, // ޵ + CHAR_WORKMODDRAGNET, +#ifdef _PROFESSION_ADDSKILL + //***********ע:λòɸ************* + CHAR_WORKICECRACK, // + CHAR_WORKICECRACK2, // Ŵ2 + CHAR_WORKICECRACK3, // Ŵ3 + CHAR_WORKICECRACK4, // Ŵ4 + CHAR_WORKICECRACK5, // Ŵ5 + CHAR_WORKICECRACK6, // Ŵ6 + CHAR_WORKICECRACK7, // Ŵ7 + CHAR_WORKICECRACK8, // Ŵ8 + CHAR_WORKICECRACK9, // Ŵ9 + CHAR_WORKICECRACK10, // Ŵ10 + CHAR_WORKMODICECRACK, + CHAR_WORKMODICECRACK2, + CHAR_WORKMODICECRACK3, + CHAR_WORKMODICECRACK4, + CHAR_WORKMODICECRACK5, + CHAR_WORKMODICECRACK6, + CHAR_WORKMODICECRACK7, + CHAR_WORKMODICECRACK8, + CHAR_WORKMODICECRACK9, + CHAR_WORKMODICECRACK10, + //***************************************** +#else + CHAR_WORKICECRACK, // + CHAR_WORKMODICECRACK, +#endif //_PROFESSION_ADDSKILL + + CHAR_WORKOBLIVION, // + CHAR_WORKMODOBLIVION, + CHAR_WORKICEARROW, // + CHAR_WORKMODICEARROW, + CHAR_WORKBLOODWORMS, // Ѫ + CHAR_WORKMODBLOODWORMS, + CHAR_WORKBLOODWORMSID, + CHAR_WORKSIGN, // һѪ + CHAR_WORKMODSIGN, + CHAR_WORKSIGNID, + CHAR_WORK_P_DUCK, // ر + CHAR_WORKMOD_P_DUCK, + CHAR_WORK_WEAPON, // ר + CHAR_WORKMOD_WEAPON, + CHAR_WORK_FOCUS, // רעս + CHAR_WORKMOD_FOCUS, + CHAR_WORKINSTIGATE, // + CHAR_WORKMODINSTIGATE, + CHAR_WORK_F_ENCLOSE, // + CHAR_WORK_I_ENCLOSE, // + CHAR_WORK_T_ENCLOSE, // ׸ + CHAR_WORKMOD_F_ENCLOSE, + CHAR_WORKMOD_I_ENCLOSE, + CHAR_WORKMOD_T_ENCLOSE, + CHAR_WORK_F_ENCLOSE_2, // + CHAR_WORK_I_ENCLOSE_2, // + CHAR_WORK_T_ENCLOSE_2, // ׸ + CHAR_WORKMOD_F_ENCLOSE_2, + CHAR_WORKMOD_I_ENCLOSE_2, + CHAR_WORKMOD_T_ENCLOSE_2, + CHAR_WORKRESIST_F, // + CHAR_WORKRESIST_I, // + CHAR_WORKRESIST_T, // ׿ +#ifdef _PROFESSION_ADDSKILL + CHAR_WORKERSIST_F_I_T, // ׿ + CHAR_WORKANNEX, // + CHAR_WORKWATER, //ˮ + CHAR_WORKFEAR, //־ + CHAR_DOOMTIME, //ĩռ(ǹ) + CHAR_WORK_com1, + CHAR_WORK_toNo, + CHAR_WORK_mode, + CHAR_WORK_skill_level, + CHAR_WORK_array, +#endif + CHAR_WORKMODRESIST_F, // ԰ٷֱֵ + CHAR_WORKMODRESIST_I, // ԰ٷֱֵ + CHAR_WORKMODRESIST_T, // ׿԰ٷֱֵ +#endif + +#ifdef _MAGICSTAUTS_RESIST + CHAR_MAGICFIRE, //𿹾 + CHAR_MAGICTHUNDER,//翹 + CHAR_MAGICICE,// +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ + CHAR_WORKSARS, + CHAR_WORKMODSARS, +#endif + +#ifdef _PETSKILL_ACUPUNCTURE + CHAR_WORKACUPUNCTURE, +#endif +#ifdef _PETSKILL_RETRACE + CHAR_WORKRETRACE, +#endif + +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ + CHAR_WORKCHATROOMTYPE , + CHAR_WORKCHATROOMNUM , +#endif + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + CHAR_WORK_F_SUIT, + CHAR_WORK_I_SUIT, + CHAR_WORK_T_SUIT, +#endif + +#ifdef _PETSKILL_BECOMEFOX + CHAR_WORKFOXROUND, //غ +#endif + + CHAR_WORKSTANDBYPET, // Robin add +#ifdef _STREET_VENDOR + CHAR_WORKSTREETVENDOR, // ̯״̬ -1:ûڰ̯,Ҳûڰ̯;1:̯;2:ڽ;3:̯ + CHAR_WORKSTREETVENDOR_WHO, // ˭ҽ +#endif + +#ifdef _ANGEL_SUMMON + CHAR_WORKMISSION, + CHAR_WORKANGELMODE, +#endif +#ifdef _MAP_TIME + CHAR_WORK_MAP_TIME, // ͼ +#endif +#ifdef _PETSKILL_LER + CHAR_WORK_RELIFE, // ׶ +#endif +#ifdef _TEACHER_SYSTEM + CHAR_WORK_GET_TEACHER_FAME, // ʦ쵼 +#endif + + CHAR_WORKSKYWALKER, // GM?? + + CHAR_WORKLASTMERGETIME, // ϳʱ + +#ifdef _FONT_SIZE + CHAR_WORKFONTSIZE, // +#endif + +#ifdef _TIME_TICKET + CHAR_WORKTICKETTIME, + CHAR_WORKTICKETTIMESTART, +#endif +// CHAR_WORKAMPOINT, + CHAR_WORKDBATTLEESCAPE, +#ifdef _AUTO_PK + CHAR_WORK_AUTOPK, //ԶPK + CHAR_WORK_AUTOPK_DEAD, // +#endif + CHAR_WORKDEBUGMODE, // ģʽ +#ifdef _TRADE_PK + CHAR_WORKTRADEPK, +#endif + CHAR_WORKSAFEMODE, + CHAR_WORKTRADETYPE, + CHAR_WORKSAVETIME, +#ifdef _ALL_TALK + CHAR_WORKALLTALKTIME, + CHAR_WORKALLTALKTYPE, +#endif +#ifdef _QUESTION_ONLINE + CHAR_WORKQUESTIONFLG, +#endif + CHAR_WORKPETSKILLBT, +#ifdef _VIGOR_SYS + CHAR_WORKVIGORTIME, +#endif + CHAR_WORKBATTLECOM5, + CHAR_WORKBATTLECOM6, + CHAR_WORKBATTLECOM7, + CHAR_WORKLISTPAGE, + CHAR_WORKLISTSELECT, +#ifdef _NPCENEMY_1 + CHAR_WORKBATTLEHELP, +#endif +#ifdef _OFFLINE_SYSTEM + CHAR_WORK_OFFLINE, +#endif +#ifdef _PET_RESET + CHAR_WORKRESETPETINDEX, +#endif +#ifdef _BATTLEMAP_CTRL + CHAR_WORKBATTLETIME, +#endif +#ifdef _ZHIPIAO_SYSTEM + CHAR_WORKZHIPIAOPOINT, + CHAR_WORKZHIPIAOITEM, +#endif +#ifdef _NO_DROPITEM + CHAR_DROPITEMCHARAINDEX, +#endif +#ifdef _FMZUZHANG_MSG + CHAR_WORKLOGININTYPE, +#endif +#ifdef _WAN_FIX + CHAR_WORKBATTLEPROTYPE, +#endif +#ifdef _ITEM_RESET + CHAR_WORKFROMITEMINDEX, + CHAR_WORKTOITEMINDEX, +#endif +#ifdef _WARNPC_CTRL + CHAR_WORKNPCENEMYTIME, + CHAR_WORKNPCENEMYBATTLETIME, + CHAR_WORKNPCBATTLESAMEIP, +#endif +#ifdef _NO_DAOLUAN + CHAR_WORKNOTALKTRNTIME, +#endif +#ifdef _NPC_PETSKILLUP + CHAR_WORKPETSKILLUP, +#endif +#ifdef _DP_ZHIPIAO_ITEM + CHAR_WORKDPZHIPIAOITEM, + CHAR_WORKDPZHIPIAOSHUI, + CHAR_WORKDPZHIPIAORAND, + CHAR_WORKDPZHIPIAOPOINT, +#endif + CHAR_WORKRANDEDITBASETIME, + CHAR_WORKRANDTYPE, +#ifdef _LOOK_STREET_TIME + CHAR_LOOKSTREETTIME, +#endif + CHAR_WORKLUANPCINT, + CHAR_WORKLUANPCINT1, +#ifdef _BATTLEEND_FIX + CHAR_WORKBALLTELENDTIME, +#endif + CHAR_WORKBATTLEREVERSE, + CHAR_WORKNPCTYPE, + CHAR_WORKJILU, + CHAR_LASTCHARSAVETIME, + CHAR_WORKOFFLINETIME, + CHAR_WORKITEMEXP, +#ifdef _ONLINE_TIME + CHAR_WORK_LOGIN_TIME, +#endif +#ifdef _SPECIAL_COUNTER + CHAR_WORK_COUNTER, +#endif +#ifdef _SPECIAL_TIMER + CHAR_WORK_TIMER, +#endif +#ifdef _FIX_SAVE_CHAR + CHAR_WORK_SAVE_CHAR, +#endif +#ifdef _RECORD_IP + CHAR_WORK_RECORD_IP, +#endif +#ifdef _NULL_CHECK_ITEM + CHAR_WORKITEMINDEX, // Ʒ +#endif +#ifdef _FIX_STW_SPEED_ENEMY + CHAR_WORK_X, + CHAR_WORK_Y, + CHAR_WORK_W, + CHAR_WORK_DIR, +#endif + CHAR_WORKDATAINTNUM, + + + CHAR_WORKENCOUNTPROBABILITY_MIN = CHAR_NPCWORKINT1, + CHAR_WORKENCOUNTPROBABILITY_MAX = CHAR_NPCWORKINT2, + CHAR_WORK_TOHELOS_CUTRATE = CHAR_NPCWORKINT3, + CHAR_WORK_TOHELOS_COUNT = CHAR_NPCWORKINT4, + CHAR_WORKSHOPRELEVANT = CHAR_NPCWORKINT5, + CHAR_WORKSHOPRELEVANTSEC = CHAR_NPCWORKINT6, + CHAR_WORKSHOPRELEVANTTRD = CHAR_NPCWORKINT7, + CHAR_WORKTRADER = CHAR_NPCWORKINT8, + CHAR_WORKEFFECT = CHAR_NPCWORKINT9, + CHAR_WORKRENAMEITEMNUM = CHAR_NPCWORKINT10, + CHAR_WORKRENAMEITEMINDEX = CHAR_NPCWORKINT5, + CHAR_WORKPLAYERINDEX = CHAR_NPCWORKINT1, + CHAR_WORKTACTICS = CHAR_NPCWORKINT2, + CHAR_WORKPETFOLLOWMODE = CHAR_NPCWORKINT3, + CHAR_WORKPETFOLLOWCOUNT = CHAR_NPCWORKINT4, + CHAR_WORK_PETFLG = CHAR_NPCWORKINT1, + CHAR_WORKGENERATEINDEX = CHAR_NPCWORKINT1, + CHAR_WORKDOORCLOSETIME = CHAR_NPCWORKINT1, + CHAR_WORKDOORSWITCHCOUNT = CHAR_NPCWORKINT2, + CHAR_WORKDOOROPENG = CHAR_NPCWORKINT3, + CHAR_WORKDOORCLOSEG = CHAR_NPCWORKINT4, + CHAR_WORKDOORSOONFLG = CHAR_NPCWORKINT5, + CHAR_WORKDOORPASSFLG = CHAR_NPCWORKINT6, + CHAR_WORKDOORKEYITEMID = CHAR_NPCWORKINT7, + CHAR_WORKDOORSWITCHCURRENT = CHAR_NPCWORKINT8, + CHAR_WORKDOORORIGINALGRAPHIC = CHAR_NPCWORKINT9, + CHAR_WORKDOOREXPIRETIME = CHAR_NPCWORKINT10, + CHAR_WORKOLDMANID = CHAR_NPCWORKINT1, + CHAR_WORKSHOPCLIENTINDEX = CHAR_NPCWORKINT1, + CHAR_WORKDENGONMAXID = CHAR_NPCWORKINT1, +}CHAR_WORKDATAINT; + + +enum{ + WORKFLG_DEBUGMODE = ( 1 << 0 ), + WORKFLG_MICMODE = ( 2 << 0 ), +}; + +typedef enum +{ + CHAR_INITFUNC, + CHAR_FIRSTFUNCTION = CHAR_INITFUNC, + CHAR_WALKPREFUNC, + CHAR_WALKPOSTFUNC, + CHAR_PREOVERFUNC, + CHAR_POSTOVERFUNC, + CHAR_WATCHFUNC, + CHAR_LOOPFUNC, + CHAR_DYINGFUNC, + CHAR_TALKEDFUNC, + CHAR_PREATTACKEDFUNC, + CHAR_POSTATTACKEDFUNC, + CHAR_OFFFUNC, + CHAR_LOOKEDFUNC, + CHAR_ITEMPUTFUNC, + CHAR_SPECIALTALKEDFUNC, + CHAR_WINDOWTALKEDFUNC, +#ifdef _USER_CHARLOOPS + CHAR_LOOPFUNCTEMP1, + CHAR_LOOPFUNCTEMP2, + CHAR_BATTLEPROPERTY, +#endif +#ifdef _ALLBLUES_LUA + CHAR_OVERLAPEDFUNC, + CHAR_BATTLEOVERDFUNC, +#ifdef _ALLBLUES_LUA_1_4 + CHAR_LOGINOUTFUNC, +#endif +#ifdef _ALLBLUES_LUA_1_9 + CHAR_BATTLESETFUNC, +#endif +#endif + CHAR_LASTFUNCTION, + CHAR_FUNCTABLENUM = CHAR_LASTFUNCTION, +}CHAR_FUNCTABLE; + +typedef enum +{ + CHAR_WORKWALKARRAY, + CHAR_NPCWORKCHAR1, + CHAR_NPCWORKCHAR2, + CHAR_NPCWORKCHAR3, + CHAR_NPCWORKCHAR4, + CHAR_NPCWORKCHAR5, + CHAR_NPCWORKCHAR6, +#ifdef _ANGEL_SUMMON + CHAR_WORKHEROINFO, +#endif +#ifdef _STREET_VENDOR + CHAR_STREETVENDOR_NAME, +#endif +#ifdef _NO_QUICK_WAR + CHAR_WARWORKXYD, +#endif + CHAR_WORKDATACHARNUM, + CHAR_WORKBATTLE_TACTICSOPTION = CHAR_NPCWORKCHAR1, +#ifdef _BATTLENPC_WARP_PLAYER + CHAR_WORKBATTLE_ACT_CONDITION = CHAR_NPCWORKCHAR2, +#endif + CHAR_WORKDOORPASSWD = CHAR_NPCWORKCHAR1, + CHAR_WORKDOORNAME = CHAR_NPCWORKCHAR2, + CHAR_WORKDOORGOLDLIMIT = CHAR_NPCWORKCHAR3, + CHAR_WORKDOORWEEK = CHAR_NPCWORKCHAR4, + CHAR_WORKDOORHOUR = CHAR_NPCWORKCHAR5, + CHAR_WORKDOORMINUTE = CHAR_NPCWORKCHAR6, + CHAR_WORKDOORTITLE = CHAR_NPCWORKCHAR6, + CHAR_WORKDOORMANDOORNAME = CHAR_NPCWORKCHAR1, + CHAR_TIME1, + CHAR_TIME2 = CHAR_NPCWORKCHAR6, + CHAR_WORKRANDMSG, + CHAR_WORKRANDEDITBASE, +#ifdef _MM_NO_JIAOBEN + CHAR_WORKDROPMM, +#endif +}CHAR_WORKDATACHAR; + + +typedef enum +{ + CHAR_IMAGETYPE_GIRL, + CHAR_IMAGETYPE_BOY, + CHAR_IMAGETYPE_CHILDBOY, + CHAR_IMAGETYPE_CHILDGIRL, + CHAR_IMAGETYPE_MAN, + CHAR_IMAGETYPE_WOMAN, + CHAR_IMAGETYPE_OLDMAN, + CHAR_IMAGETYPE_DOG, + CHAR_IMAGETYPENUM +}CHAR_ImageType; + + +#define CHAR_P_STRING_HP ( 1 << 1 ) // 0x00000002 +#define CHAR_P_STRING_MAXHP ( 1 << 2 ) // 0x00000004 +#define CHAR_P_STRING_MP ( 1 << 3 ) // 0x00000008 +#define CHAR_P_STRING_MAXMP ( 1 << 4 ) // 0x00000010 +#define CHAR_P_STRING_VITAL ( 1 << 5 ) +#define CHAR_P_STRING_STR ( 1 << 6 ) +#define CHAR_P_STRING_TOUGH ( 1 << 7 ) +#define CHAR_P_STRING_DEX ( 1 << 8 ) +#define CHAR_P_STRING_EXP ( 1 << 9 ) +#define CHAR_P_STRING_NEXTEXP ( 1 << 10 ) +#define CHAR_P_STRING_LV ( 1 << 11 ) +#define CHAR_P_STRING_ATK ( 1 << 12 ) +#define CHAR_P_STRING_DEF ( 1 << 13 ) +#define CHAR_P_STRING_QUICK ( 1 << 14 ) +#define CHAR_P_STRING_CHARM ( 1 << 15 ) +#define CHAR_P_STRING_LUCK ( 1 << 16 ) +#define CHAR_P_STRING_EARTH ( 1 << 17 ) +#define CHAR_P_STRING_WATER ( 1 << 18 ) +#define CHAR_P_STRING_FIRE ( 1 << 19 ) +#define CHAR_P_STRING_WIND ( 1 << 20 ) +#define CHAR_P_STRING_GOLD ( 1 << 21 ) +#define CHAR_P_STRING_TITLE ( 1 << 22 ) +#define CHAR_P_STRING_DUELPOINT ( 1 << 23 ) +#define CHAR_P_STRING_TRANSMIGRATION ( 1 << 24 ) +#define CHAR_P_STRING_NAME ( 1 << 25 ) +#define CHAR_P_STRING_OWNTITLE ( 1 << 26 ) +#define CHAR_P_STRING_RIDEPET ( 1 << 27 ) // 0x08000000 +#define CHAR_P_STRING_LEARNRIDE ( 1 << 28 ) // 0x10000000 +#define CHAR_P_STRING_BASEBASEIMAGENUMBER ( 1 << 29 ) // 0x20000000 +//#define CHAR_P_STRING_PKDP ( 1 << 30 ) +//#ifdef _CHAR_PROFESSION +//#define CHAR_P_STRING_PROFESSION ( 1 << 30 ) +//#endif +#define CHAR_P_STRING_SKYWALKER ( 1 << 30 ) // 0x40000000 +#define CHAR_P_STRING_DEBUGMODE ( 1 << 31 ) // 0x80000000 + + +#define CHAR_N_STRING_OBJINDEX ( 1 << 1 ) +#define CHAR_N_STRING_LV ( 1 << 2 ) +#define CHAR_N_STRING_MAXHP ( 1 << 3 ) +#define CHAR_N_STRING_HP ( 1 << 4 ) +#define CHAR_N_STRING_MP ( 1 << 5 ) +#define CHAR_N_STRING_NAME ( 1 << 6 ) + +#define CHAR_K_STRING_BASEIMAGENUMBER ( 1 << 1 ) +#define CHAR_K_STRING_HP ( 1 << 2 ) +#define CHAR_K_STRING_MAXHP ( 1 << 3 ) +#define CHAR_K_STRING_MP ( 1 << 4 ) +#define CHAR_K_STRING_MAXMP ( 1 << 5 ) +#define CHAR_K_STRING_EXP ( 1 << 6 ) +#define CHAR_K_STRING_NEXTEXP ( 1 << 7 ) +#define CHAR_K_STRING_LV ( 1 << 8 ) +#define CHAR_K_STRING_ATK ( 1 << 9 ) +#define CHAR_K_STRING_DEF ( 1 << 10 ) +#define CHAR_K_STRING_QUICK ( 1 << 11 ) +#define CHAR_K_STRING_AI ( 1 << 12 ) +#define CHAR_K_STRING_EARTH ( 1 << 13 ) +#define CHAR_K_STRING_WATER ( 1 << 14 ) +#define CHAR_K_STRING_FIRE ( 1 << 15 ) +#define CHAR_K_STRING_WIND ( 1 << 16 ) +#define CHAR_K_STRING_SLOT ( 1 << 17 ) +#define CHAR_K_STRING_CHANGENAMEFLG ( 1 << 18 ) +#define CHAR_K_STRING_NAME ( 1 << 19 ) +#define CHAR_K_STRING_USERPETNAME ( 1 << 20 ) + +typedef union { + int indexOfPet[CHAR_MAXPETHAVE]; + int indexOfPetskill[CHAR_MAXPETSKILLHAVE]; +}CHAR_UNIONTABLE; + +typedef struct tagChar +{ + BOOL use; + + int data[CHAR_DATAINTNUM]; + STRING128 string[CHAR_DATACHARNUM]; + char flg[(CHAR_FLGNUM%(sizeof(char)*8)) + ? (CHAR_FLGNUM/(sizeof(char)*8))+1 + : (CHAR_FLGNUM/(sizeof(char)*8))]; + int indexOfExistItems[CHAR_MAXITEMHAVE]; + int indexOfExistPoolItems[CHAR_MAXPOOLITEMHAVE]; + +#ifdef _CHAR_POOLITEM + int *indexOfExistDepotItems; +#endif +#ifdef _CHAR_POOLPET + int *indexOfExistDepotPets; +#endif + + CHAR_HaveSkill haveSkill[CHAR_SKILLMAXHAVE]; + int indexOfHaveTitle[CHAR_TITLEMAXHAVE]; + ADDRESSBOOK_entry addressBook[ADDRESSBOOK_MAX]; + CHAR_UNIONTABLE unionTable; + int indexOfPoolPet[CHAR_MAXPOOLPETHAVE]; + STRING32 charfunctable[CHAR_FUNCTABLENUM]; + int workint[CHAR_WORKDATAINTNUM]; + STRING64 workchar[CHAR_WORKDATACHARNUM]; + int CharMakeSequenceNumber; + void* functable[CHAR_FUNCTABLENUM]; +#ifdef _JZ_NEWSCRIPT_LUA + STRING32 lua_charfunctable[CHAR_FUNCTABLENUM]; + + void* sur_functable[CHAR_FUNCTABLENUM]; + STRING32 sur_charfunctable[CHAR_FUNCTABLENUM]; +#endif + +#ifdef _STREET_VENDOR + StreetVendor_t StreetVendor[MAX_SELL_ITEM]; +#endif +#ifdef _ALLBLUES_LUA + lua_State *lua[CHAR_FUNCTABLENUM]; + char *luafunctable[CHAR_FUNCTABLENUM]; +#endif +}Char; + + +#define CHAR_CHECKINDEX( index) _CHAR_CHECKINDEX( __FILE__, __LINE__, index) +INLINE BOOL _CHAR_CHECKINDEX( char *file, int line, int index); +#define CHAR_CHECKITEMINDEX( charaindex, iindex) _CHAR_CHECKITEMINDEX( __FILE__, __LINE__, charaindex, iindex) +INLINE BOOL _CHAR_CHECKITEMINDEX( char *file, int line, int charaindex, int iindex ); +#define CHAR_CHECKPETINDEX( petindex) _CHAR_CHECKPETINDEX( __FILE__, __LINE__, petindex ) +INLINE BOOL _CHAR_CHECKPETINDEX( char *file, int line, int petindex ); +#define CHAR_CHECKPOOLPETINDEX( petindex) _CHAR_CHECKPOOLPETINDEX( __FILE__, __LINE__, petindex ) +INLINE BOOL _CHAR_CHECKPOOLPETINDEX( char *file, int line, int petindex ); +#define CHAR_CHECKPETSKILLINDEX( havepetskillindex) _CHAR_CHECKPETSKILLINDEX( __FILE__, __LINE__, havepetskillindex) +INLINE BOOL _CHAR_CHECKPETSKILLINDEX( char *file, int line, int havepetskillindex ); + +INLINE int CHAR_getInt( int index , CHAR_DATAINT element); +#define CHAR_setInt( index , element, data) _CHAR_setInt( __FILE__, __LINE__, index , element, data) +INLINE int _CHAR_setInt( char *file, int line, int index ,CHAR_DATAINT element, int data); +#ifdef _FIX_SETWORKINT +#define CHAR_getWorkInt( index , element) _CHAR_getWorkInt( __FILE__, __LINE__, index , element) +INLINE int _CHAR_getWorkInt( char *file, int line, int index ,CHAR_WORKDATAINT element); +#define CHAR_setWorkInt( index, element, data) _CHAR_setWorkInt( __FILE__, __LINE__, index , element, data) +INLINE int _CHAR_setWorkInt( char *file, int line, int index ,CHAR_WORKDATAINT element, int data); +#else +INLINE int CHAR_setWorkInt( int index ,CHAR_WORKDATAINT element, int data); +#endif +#define CHAR_getChar( index, elem) _CHAR_getChar( __FILE__, __LINE__, index, elem) +INLINE char* _CHAR_getChar( char *file, int line, int index ,CHAR_DATACHAR element ); +#define CHAR_setChar( index, elem, n) _CHAR_setChar( __FILE__, __LINE__, index, elem, n) +INLINE BOOL _CHAR_setChar( char *file, int line, int index ,CHAR_DATACHAR element, char* new ); +#define CHAR_getFlg( index, elem) _CHAR_getFlg( __FILE__, __LINE__, index, elem) +INLINE BOOL _CHAR_getFlg( char *file, int line, int index ,CHAR_DATAFLG element ); +#define CHAR_setFlg( index, elem, n) _CHAR_setFlg( __FILE__, __LINE__, index, elem, n) +INLINE BOOL _CHAR_setFlg( char *file, int line, int index , CHAR_DATACHAR element, int newdata ); +#define CHAR_getWorkChar( index, elem) _CHAR_getWorkChar( __FILE__, __LINE__, index, elem) +INLINE char * _CHAR_getWorkChar( char *file, int line, int index, CHAR_WORKDATACHAR element ); +#define CHAR_setWorkChar( index, elem, n) _CHAR_setWorkChar( __FILE__, __LINE__, index, elem, n) +INLINE BOOL _CHAR_setWorkChar( char *file, int line, int index, CHAR_WORKDATACHAR element, char * new); + +#define CHAR_getItemIndex( index, iindex) _CHAR_getItemIndex( __FILE__, __LINE__, index, iindex) +INLINE int _CHAR_getItemIndex( char *file, int line, int charaindex, int ti); +#define CHAR_setItemIndex( index, iindex,id) _CHAR_setItemIndex( __FILE__, __LINE__, index, iindex, id) +INLINE int _CHAR_setItemIndex( char *file, int line, int index ,int iindex,int id ); +#define CHAR_getPoolItemIndex( index, iindex) _CHAR_getPoolItemIndex( __FILE__, __LINE__, index, iindex) +INLINE int _CHAR_getPoolItemIndex( char *file, int line, int index, int iindex); +#define CHAR_setPoolItemIndex( index, iindex,id) _CHAR_setPoolItemIndex( __FILE__, __LINE__, index, iindex, id) +INLINE int _CHAR_setPoolItemIndex( char *file, int line, int index ,int iindex,int id ); +INLINE BOOL CHAR_setAddressbookEntry( int index , int aindex , ADDRESSBOOK_entry *a ); +INLINE ADDRESSBOOK_entry* CHAR_getAddressbookEntry( int index , int aindex); +INLINE Char* CHAR_getCharPointer( int index ); +INLINE int CHAR_getCharNum( void ); +INLINE int CHAR_getPlayerMaxNum( void ); +INLINE int CHAR_getPetMaxNum( void ); +INLINE int CHAR_getOthersMaxNum( void ); +INLINE BOOL CHAR_getCharUse( int index ); +INLINE CHAR_HaveSkill* CHAR_getCharHaveSkill( int index,int sindex ); +INLINE int CHAR_getCharHaveTitle( int index,int tindex ); +INLINE int CHAR_setCharHaveTitle( int charaindex,int tindex, int new ); +INLINE int CHAR_getCharPet( int charaindex,int petindex ); +INLINE int CHAR_setCharPet( int charaindex,int petindex, int new ); +INLINE int CHAR_getCharPoolPet( int charaindex,int petindex ); +INLINE int CHAR_setCharPoolPet( int charaindex,int petindex, int new ); +int CHAR_getCharPetElement( int charaindex ); +int CHAR_getCharPoolPetElement( int charaindex ); +int CHAR_getCharPoolItemIndexElement( int charaindex ); +int CHAR_getEmptyCharPoolItemIndexNum( int charaindex); +#ifdef _CHAR_POOLPET +int CHAR_getCharDepotPetElement( int charaindex ); +#endif +#define CHAR_getIntPSkill( index, skillti, ti) _CHAR_getIntPSkill( __FILE__, __LINE__, index, skillti, ti) +INLINE int _CHAR_getIntPSkill( char *file, int line, int index, int skillti, SKILL_DATAINT ti); + +#define CHAR_setIntPSkill( index, skillti, ti, data) _CHAR_setIntPSkill( __FILE__, __LINE__, index, skillti, ti, data) +INLINE void _CHAR_setIntPSkill( char *file, int line, int index, int skillti, SKILL_DATAINT ti, int data); + + +extern Char *CHAR_chara; + + +INLINE int CHAR_getCharMakeSequenceNumber( int charaindex ); +void CHAR_constructFunctable( int charaindex ); +void* CHAR_getFunctionPointer( int charaindex, int functype ); +#ifdef _ALLBLUES_LUA + +INLINE BOOL CHAR_setLUAFunction( int charaindex, int functype, lua_State *L, const char *luafunctable ); +INLINE BOOL CHAR_delLUAFunction( int charaindex, int functype); +INLINE lua_State *CHAR_getLUAFunction( int charaindex, int functype); +#endif +BOOL CHAR_initCharArray( int pnum, int petnum,int onum ); +BOOL CHAR_endCharArray( void ); +int CHAR_initCharOneArray( Char* ch ); +void CHAR_endCharOneArray( int index ); +void CHAR_removeHaveItem( Char* ch ); +void CHAR_endCharData( Char* ch ); +char* CHAR_makeStringFromCharData( Char* one ); +char* CHAR_makeStringFromCharIndex( int index ); +BOOL CHAR_makeCharFromStringToArg( char* data, Char* one); +int CHAR_makePetFromStringToArg( char *src, Char *ch, int ti); +char *CHAR_makePetStringFromPetIndex( int petindex); +#define CHAR_getPetSkillElement( petindex) _CHAR_getPetSkillElement( __FILE__, __LINE__, petindex) +int _CHAR_getPetSkillElement( char *file, int line, int petindex ); +#define CHAR_setPetSkill( petindex, havepetskillindex, n) _CHAR_setPetSkill( __FILE__, __LINE__, petindex, havepetskillindex, n) +INLINE int _CHAR_setPetSkill( char *file, int line, int petindex,int havepetskillindex, int new ); +#define CHAR_getPetSkill( petindex, havepetskillindex) _CHAR_getPetSkill( __FILE__, __LINE__, petindex, havepetskillindex) +INLINE int _CHAR_getPetSkill( char *file, int line, int petindex,int havepetskillindex ); +#define SETFLG(a,b,c,d,e,f,g,h) (((a)<<0)+((b)<<1)+((c)<<2)+((d)<<3)+((e)<<4)+((f)<<5)+((g)<<6)+((h)<<7)) + +INLINE int CHAR_AddMaxExp( int charaindex, int addexp); +INLINE int CHAR_setMaxExpFromLevel( int charaindex, int level); +INLINE int CHAR_setMaxExp( int charaindex, unsigned long int Setexp); +#ifdef _NEWOPEN_MAXEXP +INLINE int CHAR_ChangeExp( int charaindex ); +INLINE int CHAR_HandleExp( int charaindex ); + +#endif + +// ride Pet table +typedef struct tagtagRidePetTable +{ + int rideNo; + int charNo; + int petNo; + int petId; + +} tagRidePetTable; + + +// CoolFish: Family Member Kind 2001/8/28 +typedef enum +{ + FMMEMBER_NONE = -1, + FMMEMBER_MEMBER = 1, + FMMEMBER_APPLY, + FMMEMBER_LEADER, + FMMEMBER_ELDER, +} CHAR_FM_MEMBERKIND; + +// shan 2002/01/10 +typedef enum +{ + PET_STAT_NONE = 0, + PET_STAT_SELECT, + PET_STAT_MAIL = 4, +} CHAR_PET_STAT; + + +#ifdef _PERSONAL_FAME // Arminius: +void CHAR_earnFame(int index, int fame); +#endif + +// CoolFish: 2001/10/11 +#ifdef _UNIQUE_P_I +void CHAR_setPetUniCode(int petindex); +void ITEM_setItemUniCode(int itemindex); +void Check_P_I_UniCode(int charindex); +#endif + +// Arminius 12.15 жǷʿ +int IsMale(int charindex); + +// Arminius 12.15 жǷŮʿ +int IsFemale(int charindex); + + +#ifdef _NEW_RIDEPETS +#define RIDE_PET0 1 +#define RIDE_PET1 ( 1 << 1 ) +#define RIDE_PET2 ( 1 << 2 ) +#define RIDE_PET3 ( 1 << 3 ) +#define RIDE_PET4 ( 1 << 4 ) +#define RIDE_PET5 ( 1 << 5 ) +#define RIDE_PET6 ( 1 << 6 ) +#define RIDE_PET7 ( 1 << 7 ) +#define RIDE_PET8 ( 1 << 8 ) +#define RIDE_PET9 ( 1 << 9 ) +#define RIDE_PET10 ( 1 << 11 ) +#define RIDE_PET11 ( 1 << 10 ) +#define RIDE_PET12 ( 1 << 12 ) +#define RIDE_PET13 ( 1 << 13 ) +#define RIDE_PET14 ( 1 << 14 ) +#ifdef _RIDE_CF +#define RIDE_PET15 ( 1 << 15 ) +#define RIDE_PET16 ( 1 << 16 ) +#define RIDE_PET17 ( 1 << 17 ) +#define RIDE_PET19 ( 1 << 19 ) +#define RIDE_PET18 ( 1 << 18 ) +#define RIDE_PET20 ( 1 << 20 ) +#define RIDE_PET21 ( 1 << 21 ) +#define RIDE_PET22 ( 1 << 22 ) +#define RIDE_PET23 ( 1 << 23 ) +#define RIDE_PET24 ( 1 << 24 ) +#define RIDE_PET25 ( 1 << 25 ) +#define RIDE_PET26 ( 1 << 26 ) +#define RIDE_PET27 ( 1 << 27 ) +#define RIDE_PET28 ( 1 << 28 ) +#define RIDE_PET29 ( 1 << 29 ) +#define RIDE_PET30 ( 1 << 30 ) +#define RIDE_PET31 ( 1 << 31 ) + +#define RIDE_TPYE1 1 +#define RIDE_TPYE2 ( 1 << 1 ) + +#define RIDE_PET_ALL ( 0xFFFFFFFF ) +#define RIDE_TPYE_ALL ( 0xFFFFFFFF ) +#define MAXNOINDEX 32*3 +#else +#define RIDE_PET_ALL ( RIDE_PET0|RIDE_PET1|RIDE_PET2|RIDE_PET3|RIDE_PET4|RIDE_PET5|RIDE_PET6|RIDE_PET7|RIDE_PET8|RIDE_PET9|RIDE_PET10|RIDE_PET11 ) +#define MAXNOINDEX 15 +#endif + + +#ifdef _PET_BEATITUDE +#define BEATITUDE_VITAL ( 1 << 0 ) +#define BEATITUDE_STR ( 1 << 1 ) +#define BEATITUDE_TOUGH ( 1 << 2 ) +#define BEATITUDE_DEX ( 1 << 3 ) +#endif + +#ifdef _FM_LEADER_RIDE +typedef struct { + int fmfloor; + int ride[6]; +}tagFmLeaderRide; +#endif + +#ifdef _FM_LEADER_RIDE +int CHAR_FmLeaderRide(int meindex,int pet); +#endif + +typedef struct { + int petNo; +#ifdef _RIDE_CF + int petNo1; +#endif + unsigned int learnCode; +}tagRideCodeMode; + +typedef struct { + int RideNo[MAXNOINDEX]; + int flg; +}tagRideNoList; + +typedef struct { + int charNo; + int Noindex; + int sex; +}tagRidePetList; + +int RIDEPET_getNOindex( int baseNo); +#ifdef _RIDE_CF +int RIDEPET_getPETindex( int PetNo, unsigned int learnCode, unsigned int learnCode1, unsigned int learnCode2 ); +int CHAR_CheckLearnCode(int charindex, int ridno); +#else +int RIDEPET_getPETindex( int PetNo, unsigned int learnCode); +#endif +int RIDEPET_getRIDEno( int index, int ti); +#endif + +#ifdef _FUSION_TWO +int CHAR_OldFusion_init(); +#endif + +#ifdef _PET_EVOLUTION +int EVOLUTION_getPetTable( int charaindex, int petindex1, int petindex2); +int EVOLUTION_getPropertyTable( int charaindex, int petindex1, int petindex2); +int EVOLUTION_getFusionTable( int charaindex, int px, int py); +int EVOLUTION_getPetFusionCode( int petid); +#endif + +#ifdef _PET_AMOI__E +int EVOLUTION_getPetENABLETRADE( int petid); +int EVOLUTION_getPETTYPE( int petid); +int EVOLUTION_getPETTYPESUB( int petid); +#endif + +#ifdef _EMENY_CHANCEMAN +int CHAR_getSexInt( int baseNo ); +#endif +#ifdef _TYPE_TOXICATION +BOOL CHAR_CanCureFlg( int charaindex, char *arg); +#endif + +BOOL CHAR_getCharOnArrayPercentage( int mode, int *max, int *min, int *cnt); + + +#define CHAR_DelItemMess( index, ti, flg) _CHAR_DelItem( __FILE__, __LINE__, index, ti, 1, flg) +#define CHAR_DelItem( index, ti) _CHAR_DelItem( __FILE__, __LINE__, index, ti, 1, 1) +#define CHAR_DelPileItemMess( index, ti, num, flg) _CHAR_DelItem( __FILE__, __LINE__, index, ti, num, flg) + +#define CHAR_AddPileItem( index, itemindex) _CHAR_AddPileItem( __FILE__, __LINE__, index, itemindex) +INLINE int _CHAR_AddPileItem( char *file, int line, int charaindex, int itemindex); + +INLINE int _CHAR_DelItem( char *file, int line, int charaindex, int ti, int num, int flg); + +#define CHAR_AddGold( index, ti) _CHAR_AddGold( __FILE__, __LINE__, index, ti) +INLINE int _CHAR_AddGold( char *file, int line, int charaindex, int gold); +#define CHAR_DelGold( index, ti) _CHAR_DelGold( __FILE__, __LINE__, index, ti) +INLINE int _CHAR_DelGold( char *file, int line, int charaindex, int gold); +int CHAR_getMaxHaveGold( int charaindex); + + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + +int CHAR_getCharSkill( int index,int sindex ); +int CHAR_setCharSkill( int index,int sindex,int new ); +#define CHAR_CHECK_PROFESSION_SKILLINDEX( skillindex) _CHAR_CHECK_PROFESSION_SKILLINDEX( __FILE__, __LINE__, skillindex) +INLINE BOOL _CHAR_CHECK_PROFESSION_SKILLINDEX( char *file, int line, int skillindex ); +#define PROFESSION_SKILL_getSkill( charaindex, skillindex) _PROFESSION_SKILL_getSkill( __FILE__, __LINE__, charaindex, skillindex) +INLINE int _PROFESSION_SKILL_getSkill( char *file, int line, int charaindex, int skillindex ); +#define PROFESSION_SKILL_setSkill( charaindex, skillindex, n) _PROFESSION_SKILL_setSkill( __FILE__, __LINE__, charaindex, skillindex, n) +INLINE int _PROFESSION_SKILL_setSkill( char *file, int line, int charaindex,int skillindex, int new ); +#define PROFESSION_SKILL_getSkillElement(charaindex) _PROFESSION_SKILL_getSkillElement( __FILE__, __LINE__, charaindex) +int _PROFESSION_SKILL_getSkillElement( char *file, int line, int charaindex ); + +#endif + +#ifdef _NPC_SEPARATEDATA +void CHAR_showTempInt( int index); +BOOL CHAR_InitCharTempNum( Char* ch ); +void CHAR_EndCharTempNum( void); +void CHAR_getDefaultCharTempNum( Char* ch ); +#endif + +#ifdef _CHAR_POOLITEM + +#define CHAR_getDepotItemIndex( index, iindex) _CHAR_getDepotItemIndex( __FILE__, __LINE__, index, iindex) +INLINE int _CHAR_getDepotItemIndex( char *file, int line, int index ,int iindex); +#define CHAR_setDepotItemIndex( index, iindex,id) _CHAR_setDepotItemIndex( __FILE__, __LINE__, index, iindex, id) +INLINE int _CHAR_setDepotItemIndex( char *file, int line, int index ,int iindex,int id ); + +void CHAR_removeHaveDepotItem( Char* ch); +void CHAR_removeDepotItem( int charaindex); + +char *CHAR_makeDepotItemFromCharIndex( int charaindex); +BOOL CHAR_makeDepotItemStringToChar( int charaindex, char* data); + +BOOL CHAR_SaveDepotItem( int charaindex); +BOOL CHAR_GetDepotItem( int meindex, int charaindex); +void CHAR_ShowMyDepotItems( int charaindex); + +int CHAR_findEmptyDepotItem( int charaindex); +int CHAR_getfindEmptyDepotItem( int charaindex); +BOOL CHAR_CheckDepotItem( int charaindex); +#endif + +#ifdef _CHAR_POOLPET + +#define CHAR_getDepotPetIndex( index, iindex) _CHAR_getDepotPetIndex( __FILE__, __LINE__, index, iindex) +INLINE int _CHAR_getDepotPetIndex( char *file, int line, int index ,int iindex); +#define CHAR_setDepotPetIndex( index, iindex,id) _CHAR_setDepotPetIndex( __FILE__, __LINE__, index, iindex, id) +INLINE int _CHAR_setDepotPetIndex( char *file, int line, int index ,int iindex,int id ); + +void CHAR_removeHaveDepotPet( Char* ch); +void CHAR_removeDepotPet( int charaindex); + +char *CHAR_makeDepotPetFromCharIndex( int charaindex); +BOOL CHAR_makeDepotPetStringToChar( int charaindex, char* data); + +BOOL CHAR_SaveDepotPet( int charaindex); +BOOL CHAR_GetDepotPet( int meindex, int charaindex); +void CHAR_ShowMyDepotPets( int charaindex); + +int CHAR_findEmptyDepotPet( int charaindex); +int CHAR_getfindEmptyDepotPet( int charaindex); +BOOL CHAR_CheckDepotPet( int charaindex); +#endif + +#ifdef _RIDE_CF +int CHAR_Ride_CF_init(); +#endif + +void LodBadPetString( char *data, char *err, int ti); + +#ifdef _STREET_VENDOR +BOOL CHAR_setStreetVendor(int charindex,int index,int set,int num); +INLINE void CHAR_clearStreetVendor(int charindex,int index); +int CHAR_getStreetVendor(int charindex,int index,int set); +#endif +#ifdef _SAFE_PASSWORD +void CHAR_SafePassword(int charaindex); +void CHAR_AddSafePassword(int charaindex); +void CHAR_UnSafePassword(int charaindex); +#endif +char *replace_s(char *str, char *str1, char *str2, char *strretu); +char *str_ganrao(char *oldstr); +char *str_ganraoan(char *oldstr); +char *str_hanzi_ganrao(char *tmpbuff1,char *tmpbuff2,char *tmpbuff3,char *tmpbuff4,int flg,int rand1,int rand2,int rand3,int rand4,int rand5); +#ifdef _ANGEL_SUMMON + +#define ANGELITEM 2884 //20701 //ʹߵ ߱ +#define HEROITEM 2885 //20702 //ߵ ߱ + +typedef enum +{ + ANGEL_NONE =0, + ANGEL_ANGEL, + ANGEL_HERO, +}ANGEL_TYPE; + +typedef enum +{ + MISSION_NONE =0, + MISSION_WAIT_ANSWER, + MISSION_DOING, + MISSION_HERO_COMPLETE, + MISSION_TIMEOVER, +}ANGEL_MISSIONFLAG; +#endif + +#ifdef _CAX_LNS_CHARSUOXU +int CHAR_getEmptyItemBoxNum(int charaindex); +int CHAR_getEmptyPetBoxNum(int charaindex); +int CHAR_getPlayerPetNum(int charaindex,int petid); +int CHAR_getPlayerItemNum(int charaindex,int itemid,BOOL IsContainEquip,BOOL IsContainPile); +#endif + +#endif diff --git a/include/char_data.h b/include/char_data.h new file mode 100644 index 0000000..9101173 --- /dev/null +++ b/include/char_data.h @@ -0,0 +1,126 @@ +#ifndef __CHAR_DATA_H__ +#define __CHAR_DATA_H__ + +#include "item.h" +#include "char.h" + + +#define CHAR_CLASS01_PASSLV 20 + +#define BATEBAN 2 +#define FIRSTPOSITIONMAXINDEX 1 +#define ELDERINDEXSTART FIRSTPOSITIONMAXINDEX+BATEBAN+1 + +typedef struct tagLevelUpPattern +{ +#if 1 + struct Exptbl{ + int origin; + int multi; + }exptbl[3]; + int hpupminpoint; /* hp ؤ 쵰*/ + int hpupmaxpoint; /* hp ؤ 쵰*/ + + int needexp; /* ۢئ */ +#else + int uppoint[5]; +#endif +}LevelUpPattern; + +/*====================Ƥʧ====================*/ +BOOL CHAR_getDefaultChar( Char* nc, int imagenumber ); + +/*==================== į׸====================*/ +int CHAR_getNewImagenumberFromEquip( int basebaseimagenumber, + ITEM_CATEGORY category ); +/*==================== į ٯ -> į====================*/ +//void CHAR_initSeekGraphicNumberFromString(); +int CHAR_seekGraphicNumberFromString( char* string ); + + + +/*====================ƽҷ¼====================*/ +BOOL CHAR_getInitElderPosition( Char* ch,int hometown); +BOOL CHAR_getElderPosition( int elderindex, int* fl, int* x, int* y ); + +void CHAR_setInitValues( Char* ch ); + + +/*==================== ====================*/ +typedef enum +{ + CHAR_INVAREA, + CHAR_CANNOTDROPAREA, + CHAR_CANNOTMAGICAREA, + CHAR_AREAKIND_NONE, +}CHAR_AREAKIND; + +BOOL CHAR_initInvinciblePlace( char* filename ); +BOOL CHAR_isCannotMagicArea( int floor , int x, int y, int magicnum ); +BOOL CHAR_initAppearPosition( char* filename ); +BOOL CHAR_isInvincibleArea( int floor , int x, int y ); +BOOL CHAR_isAppearPosition( int floor, int *x, int *y); +BOOL CHAR_isCannotDropArea( int floor , int x, int y ); + + +/* Ӯ */ +BOOL CHAR_ElderSetPosition( int elderindex ,int fl,int x ,int y); + + + +/************************************************* +ìʧ +*************************************************/ + + +int GetEnemyExp( int level ); + +int CHAR_GetLevel(); +int CHAR_GetLevelExp( int charaindex, int level ); +int CHAR_GetOldLevelExp( int level); + +int CHAR_LevelUpCheck( int charaindex , int toindex); + +int CHAR_PetLevelUp( int petindex ); +#define CHAR_PetLevelUpExInfc(petindex, lv) CHAR_PetLevelUp(petindex ); + +BOOL CHAR_checkFaceImageNumber( int imagenumber, int faceimagenumber); +BOOL CHAR_checkPlayerImageNumber( int imagenumber); + +int CHAR_PetTakeLevelUp( int petindex, int lv); //ǿƳ +int CHAR_PetTakeDrop( int petindex, int floor, int ox, int oy); //ǿƶ + +#ifdef _NPC_FUSION +int PETFUSION_FusionPetSub( int charaindex, int Subindex1, int Subindex2, int *work, int *skill); +BOOL PETFUSION_FusionPetMain( int charaindex, int Mainindex, int *work, int *skill); +BOOL PETFUSION_DelPet( int toindex, int Mainindex, int Subindex1, int Subindex2, int flg); +int PETFUSION_Evolution( int charaindex, int petindex); +#endif +int PETTRANS_PetTransManStatus( int toindex, int petindex1, int petindex2); +#ifdef _PET_2TRANS +int NPC_PetTransManGetAns( int total1, int total2, int LV, int rank, int tran); +#else +int NPC_PetTransManGetAns( int total1, int total2, int LV, int rank); +#endif //_PET_2TRANS + +#ifdef _CHIKULA_STONE +void CHAR_AutoChikulaStone( int charaindex, int Dflg); +#endif + +#ifdef _STATUS_WATERWORD //ˮ״̬ +void CHAR_CheckWaterStatus( int charaindex); +#endif + +int CHAR_findSurplusPetBox( int charaindex ); + +#ifdef _USER_EXP_CF +void setNeedLevelUpTbls(int level,int exp); +void setMaxLevel(int level); +#endif +#ifdef _FM_METAMO +void CHAR_ReMetamo( int charaindex ); +#endif +#ifdef _NEW_PLAYER_RIDE +void CHAR_PlayerRide( int charaindex ); +#endif +#endif diff --git a/include/char_event.h b/include/char_event.h new file mode 100644 index 0000000..e48e1d3 --- /dev/null +++ b/include/char_event.h @@ -0,0 +1,31 @@ +#ifndef __CHAR_EVENT_H__ +#define __CHAR_EVENT_H__ + +#include "char_base.h" + +void CHAR_allpostwalk( int index ); +BOOL CHAR_allprewalk( int index,int* dir,int* mode); + +void CHAR_recoveryStatus( int charaindex ); +void CHAR_loopFunc( int index ); +void CHAR_playerWatchfunc( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); + +void CHAR_sendWallDamage( int charaindex,int x, int y, int damage ); +void CHAR_playerresurrect( int charaindex, int hp ); + +int CHAR_die( int charaindex ); +void CHAR_playerTalkedfunc( int charaindex, int talkindex,char* message, + int color, int channel ); + +void CHAR_recoveryStatus( int charaindex ); +BOOL CHAR_makeCADefaultString( int objindex,char* buf,int buflen, int act ); +BOOL CHAR_makeCAOPT1String( int objindex,char* buf, + int buflen, int act,int opt1 ); +BOOL CHAR_makeCAOPT3String( int objindex,char* buf, + int buflen, int act,int opt1,int opt2,int opt3 ); +#ifdef _STREET_VENDOR +BOOL CHAR_makeCAOPTString(int objindex,char* buf,int buflen,int act,char *string); +#endif + +#endif diff --git a/include/char_talk.h b/include/char_talk.h new file mode 100644 index 0000000..0ce151b --- /dev/null +++ b/include/char_talk.h @@ -0,0 +1,41 @@ +#ifndef __CHAR_TALK_H__ +#define __CHAR_TALK_H__ + +#include "common.h" +#include "util.h" +#include "net.h" +#ifdef _ALLBLUES_LUA +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#endif +void CHAR_getMessageBody(char* message, char* kind, int kindlen, + char** body); + +int CHAR_getChatMagicFuncLevel(char* name,BOOL isDebug); +int CHAR_getChatMagicFuncNameAndString( int ti, char* name, char *usestring, int level, BOOL isDebug); +int CHAR_getChatMagicFuncMaxNum( void); + +void OneByOneTkChannel ( int fd , char *tmp1 , char *tmp2 , int color) ; + +#ifdef _ALLBLUES_LUA_1_2 +typedef struct tagMAGIC_LuaFunc +{ + lua_State *lua; + char *luafuncname; + char *luafunctable; + int gmlevel; + char *usestring; + struct tagMAGIC_LuaFunc *next; +}MAGIC_LuaFunc; + +BOOL MAGIC_addLUAListFunction( lua_State *L, const char *luafuncname, const char *luafunctable, int gmlevel, char *usestring ); +BOOL MAGIC_getLUAListFunction( char *luafuncname, int gmlevel, int charaindex, char *data ); + +#endif + +#ifdef _RE_GM_COMMAND +int re_gm_command(); +#endif + +#endif diff --git a/include/chatmagic.h b/include/chatmagic.h new file mode 100644 index 0000000..4cf448c --- /dev/null +++ b/include/chatmagic.h @@ -0,0 +1,295 @@ +#ifndef __CHATMAGIC_H__ +#define __CHATMAGIC_H__ +#include "version.h" + +void CHAR_CHAT_DEBUG_hp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_mp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_setmp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_str( int charindex , char *message ); +void CHAR_CHAT_DEBUG_dex( int charindex , char *message ); +void CHAR_CHAT_DEBUG_tgh( int charindex , char *message ); +void CHAR_CHAT_DEBUG_vital( int charindex , char *message ); +void CHAR_CHAT_DEBUG_luck( int charindex , char *message ); +void CHAR_CHAT_DEBUG_gold( int charindex , char *message ); +void CHAR_CHAT_DEBUG_additem( int charindex , char *message ); +void CHAR_CHAT_DEBUG_metamo( int charindex , char *message ); +void CHAR_CHAT_DEBUG_warp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_info( int charindex , char *message ); +void CHAR_CHAT_DEBUG_sysinfo( int charindex , char *message ); +void CHAR_CHAT_DEBUG_announce(int charindex , char *message ); +void CHAR_CHAT_DEBUG_level( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_delitem( int charindex , char *message ); +void CHAR_CHAT_DEBUG_superman( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_battlein( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_battleout( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_petmake( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_enemyrestart( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_gb( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_gu( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_tame( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_fieldatt( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_ren( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_geki( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_s_hai( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_j_state( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_battlewatch( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_eventclean( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_eventsetend( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_eventsetnow( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_debug( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_exp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_dp( int charindex , char *message ); +void CHAR_CHAT_DEBUG_setTrans( int charaindex, char *message); +void CHAR_CHAT_DEBUG_getuser(int charindex ,char *message);//ttom +1 14/11/2000 +void CHAR_CHAT_DEBUG_shutup(int charindex ,char *message);//ttom 22/11/2000 +void CHAR_CHAT_DEBUG_waeikick( int charindex, char* message );//ttom 12/02/2000 +void CHAR_CHAT_DEBUG_effect( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_jail( int charindex, char* message );//ttom 01/11/2001 +void CHAR_CHAT_DEBUG_shutupall(int charindex ,char *message);//ttom 02/01/2001 +void CHAR_CHAT_DEBUG_send(int charindex ,char *message);//ttom 02/01/2001 +void CHAR_CHAT_DEBUG_noenemy(int charaindex, char *message); +void CHAR_CHAT_DEBUG_loginannounce(int charaindex, char* message); // Arminius 7.12 login announce +void CHAR_CHAT_DEBUG_deletepet(int charaindex, char* message); // Robin 0720 +void CHAR_CHAT_DEBUG_deleteitem(int charaindex, char* message); // Robin 0720 +void CHAR_CHAT_DEBUG_checklock(int charaindex, char* message); // Arminius 7.25 +void CHAR_CHAT_DEBUG_unlock(int charaindex, char* message); +void CHAR_CHAT_DEBUG_unlockserver(int charaindex, char* message); +void CHAR_CHAT_DEBUG_fixfmdata(int charaindex, char* message); // CoolFish: GM Family 2001/7/31 +void CHAR_CHAT_DEBUG_shutdown(int charaindex, char* message); // Robin 1008 +void CHAR_CHAT_DEBUG_manorpk(int charaindex, char *message); + +void CHAR_CHAT_DEBUG_watchevent( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_fixfmpk(int charaindex, char *message); +void CHAR_CHAT_DEBUG_reloadmsip( int charaindex, char *message); +void CHAR_CHAT_DEBUG_cleanfreepet(int charaindex, char *message); +void CHAR_CHAT_DEBUG_engineer( int charindex, char *message); +void CHAR_CHAT_DEBUG_waeikickall( int charindex, char* message ); +void CHAR_CHAT_DEBUG_showMem(int charaindex, char *message); +void CHAR_CHAT_DEBUG_playerspread( int charaindex, char *message); +void CHAR_CHAT_DEBUG_reset( int charaindex, char* message ); + +void CHAR_CHAT_DEBUG_laba(int charindex , char *message ); // С +void CHAR_CHAT_DEBUG_dalaba(int charindex , char *message ); // + +#ifdef _MAKE_MAP +void CHAR_CHAT_DelMap( int charaindex, char* message ); +void CHAR_CHAT_GetMap( int charaindex, char* message ); +void CHAR_CHAT_Map( int charaindex, char* message ); +void CHAR_CHAT_Fixtile( int charaindex, char* message ); +void CHAR_CHAT_Fixobj( int charaindex, char* message ); +void CHAR_CHAT_Fukuwa( int charaindex, char* message ); +#endif + +#ifdef _GMRELOAD +void CHAR_CHAT_DEBUG_gmreload(int charaindex, char *message); +#endif +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +void CHAR_CHAT_DEBUG_addsk( int charaindex, char *message ); +void CHAR_CHAT_DEBUG_delsk( int charaindex, char *message ); +#endif +void CHAR_CHAT_DEBUG_cleanfloor( int charaindex, char *message); + +#ifdef _GAMBLE_BANK +void CHAR_CHAT_DEBUG_setgamblenum( int charaindex, char *message ); +#endif +#ifdef _WAEI_KICK +void CHAR_CHAT_DEBUG_gmkick( int charindex, char* message); +#endif +// WON ADD 峤 +void CHAR_CHAT_DEBUG_fixfmleader(int charaindex, char *message); + +// WON ADD ָ +void CHAR_CHAT_DEBUG_crash(int charaindex, char *message); +void CHAR_CHAT_DEBUG_SAVESHH( int fd, int charaindex,char* message,int color, int area ); +#ifdef _PETSKILL_SETDUCK +void CHAR_CHAT_DEBUG_SetDuck( int charaindex, char *message); +#endif +#ifdef _TYPE_TOXICATION +void CHAR_CHAT_DEBUG_Toxication( int charaindex, char *message); +#endif + +#ifdef _SEND_EFFECT // WON ADD ACѩЧ +void CHAR_CHAT_DEBUG_sendeffect(int charaindex, char *message); +#endif +#ifdef _TEST_DROPITEMS +void CHAR_CHAT_DEBUG_dropmypet( int charindex, char *message ); +void CHAR_CHAT_DEBUG_dropmyitem( int charindex , char *message ); +#endif + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +void CHAR_CHAT_DEBUG_show_profession( int charaindex, char*message ); +void CHAR_CHAT_DEBUG_set_regist( int charaindex, char*message ); +#endif + +void CHAR_CHAT_DEBUG_checktrade( int charaindex, char*message); + +void CHAR_CHAT_DEBUG_checktime( int charaindex, char *message); +void CHAR_CHAT_DEBUG_samecode( int charaindex, char *message); +void CHAR_CHAT_DEBUG_silent(int charindex ,char *message); +void CHAR_CHAT_DEBUG_help( int charindex, char *message); +#ifdef _EQUIT_ARRANGE +void CHAR_CHAT_DEBUG_arrange( int charindex , char *message ); +#endif + +#ifdef _EQUIT_SEQUENCE +void CHAR_CHAT_DEBUG_sequence( int charindex , char *message ); +#endif + +#ifdef _EQUIT_NEGLECTGUARD +void CHAR_CHAT_DEBUG_setneguard( int charaindex, char* message ); +#endif + +void CHAR_CHAT_DEBUG_petlevelup( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_petexpup( int charaindex, char* message ); + +void CHAR_CHAT_DEBUG_reloadpkteamlist( int charaindex, char *message); +void CHAR_CHAT_DEBUG_setBattle( int charaindex, char *message ); + + +#ifdef _CHAR_POOLITEM +void CHAR_CHAT_DEBUG_saveditem(int charaindex, char *message); +void CHAR_CHAT_DEBUG_insertditem(int charaindex, char *message); +void CHAR_CHAT_DEBUG_ShowMyDepotItems( int charaindex, char *message ); +void CHAR_CHAT_DEBUG_InSideMyDepotItems( int charaindex, char *message ); +#endif + +#ifdef _CHAR_POOLPET +void CHAR_CHAT_DEBUG_savedpet(int charaindex, char *message); +void CHAR_CHAT_DEBUG_insertdpet(int charaindex, char *message); +void CHAR_CHAT_DEBUG_ShowMyDepotPets( int charaindex, char *message ); +void CHAR_CHAT_DEBUG_InSideMyDepotPets( int charaindex, char *message ); +#endif + +#ifdef _NEW_MANOR_LAW +void CHAR_CHAT_DEBUG_set_momentum( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_set_manor_owner( int charindex, char* message ); +void CHAR_CHAT_DEBUG_set_schedule_time( int charindex, char* message ); +#endif + +#ifdef _ANGEL_SUMMON +void CHAR_CHAT_DEBUG_angelinfo(int charindex ,char *message); +void CHAR_CHAT_DEBUG_angelclean(int charindex ,char *message); +void CHAR_CHAT_DEBUG_angelcreate(int charindex ,char *message); +void CHAR_CHAT_DEBUG_missionreload(int charindex ,char *message); +#endif + +void CHAR_CHAT_DEBUG_itemreload(int charindex ,char *message); + +void CHAR_CHAT_DEBUG_skywalker(int charaindex ,char *message); + +#ifdef _ITEM_ADDEXP +void CHAR_CHAT_DEBUG_itemaddexp(int charaindex ,char *message); +#endif + +#ifdef _DEF_GETYOU +void CHAR_CHAT_DEBUG_getyou(int charaindex,char *message); +#endif + +#ifdef _DEF_NEWSEND +void CHAR_CHAT_DEBUG_newsend(int charindex ,char *message); +#endif + +#ifdef _DEF_SUPERSEND +void CHAR_CHAT_DEBUG_supersend(int charindex ,char *message); +#endif + +#ifdef _FONT_SIZE +void CHAR_CHAT_DEBUG_fsize(int charindex ,char *message); +#endif + +#ifdef _JOBDAILY +void CHAR_CHAT_DEBUG_rejobdaily(int charindex ,char *message); +#endif + +#ifdef _CREATE_MM_1_2 +void CHAR_CHAT_DEBUG_MM(int charaindex , char *message ); +#endif + +#ifdef _SendTo +void CHAR_CHAT_DEBUG_Sendto( int charaindex , char *message ); +#endif + +void CHAR_CHAT_printcount( int charaindex, char* message ); + +#ifdef _GM_ITEM +void CHAR_CHAT_DEBUG_GMFUNCTION( int charindex , char *message ); +#endif + +#ifdef _GM_RIDE +void CHAR_CHAT_DEBUG_SETRIDE( int charindex , char *message ); +void CHAR_CHAT_DEBUG_MVRIDE( int charindex , char *message ); +#endif + +#ifdef _LOCK_IP +void CHAR_CHAT_DEBUG_ADD_LOCK( int charindex , char *message ); +void CHAR_CHAT_DEBUG_DEL_LOCK( int charindex , char *message ); +void CHAR_CHAT_DEBUG_SHOWIP( int charindex , char *message ); +#endif +void CHAR_CHAT_DEBUG_SET_FAME( int charaindex, char* message ); +#ifdef _AUTO_PK +void CHAR_CHAT_DEBUG_SET_AUTOPK( int charaindex, char* message ); +#endif + +#ifdef _PLAYER_NUM +void CHAR_CHAT_DEBUG_SET_PLAYERNUM( int charaindex, char* message ); +#endif +#ifdef _RELOAD_CF +void CHAR_CHAT_DEBUG_SET_RELOADCF( int charaindex, char* message ); +#endif +#ifdef _TRANS +void CHAR_CHAT_DEBUG_Trans( int charaindex, char *message); +#endif +#ifdef _FUSIONBEIT_FIX +void CHAR_CHAT_DEBUG_fusionbeit( int charaindex, char* message ); +#endif +#ifdef _MAKE_PET_CF +void CHAR_CHAT_DEBUG_petmakecf( int charaindex, char* message ); +#endif +#ifdef _MAKE_PET_ABILITY +void CHAR_CHAT_DEBUG_petmakeabi( int charaindex, char* message ); +#endif +void CHAR_CHAT_DEBUG_zynetwork( int charaindex, char* message ); +#ifdef _ALL_ITEM +void CHAR_CHAT_DEBUG_setallnum( int charaindex, char* message ); +#endif +#ifdef _JZ_NEWSCRIPT_LUA +void CHAR_CHAT_DEBUG_LUA_INIT( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_LUA_CLOSE( int charaindex, char* message ); +#endif +#ifdef _UNTEXT_TALK +void CHAR_CHAT_UnTextReload( int charaindex, char* message ); +#endif +void CHAR_CHAT_FengHao( int charaindex, char* message ); +#ifdef _NO_FULLPLAYER_ATT +void CHAR_CHAT_NoFullPlayer( int charaindex, char* message ); +#endif +void CHAR_CHAT_DelFm( int charaindex, char* message ); +void CHAR_CHAT_ExpBase( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_jilu( int charindex, char* message ); +void CHAR_CHAT_DEBUG_setfmpk( int charindex, char* message ); +void CHAR_CHAT_DEBUG_MMCDKEY( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_RELOADRIDE( int charaindex, char* message ); +#ifdef _ALLBLUES_LUA +void CHAR_CHAT_DEBUG_ReLoadLua( int charaindex, char* message ); +void CHAR_CHAT_DEBUG_NewLoadLua( int charaindex, char* message ); +#endif +#ifdef _CARD_PRODUCTION +void CHAR_CHAT_DEBUG_card(int charindex ,char *message); +#endif + +#ifdef _CAX_GM_RERIDE +void CHAR_CHAT_DEBUG_reride(int charindex ,char *message); +#endif +#ifdef _CAX_GM_RESKILLCODE +void CHAR_CHAT_DEBUG_reskillcode(int charindex ,char *message); +#endif +#ifdef _CAX_GM_RELEADERRIDE +void CHAR_CHAT_DEBUG_releaderride(int charindex ,char *message); +#endif +#ifdef _GM_SAVE_ALL_CHAR +void CHAR_CHAT_DEBUG_GmSaveAllChar( int charaindex, char* message ); +#endif +#ifdef _FIX_TRADE_COPYPET +void CHAR_CHAT_DEBUG_CLEANCOPYPET( int charaindex, char* message ); +#endif +#endif diff --git a/include/chatroom.h b/include/chatroom.h new file mode 100644 index 0000000..012abf2 --- /dev/null +++ b/include/chatroom.h @@ -0,0 +1,22 @@ +#ifndef __CHATROOM_H__ +#define __CHATROOM_H__ +#include "version.h" + +#define MAX_CHATROOM 10 +#define MAX_PPLINROOM 100 + +void InitChatRoom ( void ) ; +void ChatRoom_List ( int fd ); +BOOL ChatCheck_BeMaster( int myindex, int chatnum); +BOOL ChatCheck_Free( int myindex); +BOOL ChatRoom_Create ( int myindex , char *message); +BOOL ChatRoom_Destroy ( int myindex ) ; +void ChatRoom_Kick ( int myindex , int toindex ) ; +void ChatRoom_Make ( int myindex , int toindex ) ; +void ChatRoom_Leave ( int myindex ) ; +void ChatRoom_Join ( int myindex , int num ) ; +void ChatRoom_Agree ( int myindex , int toindex , int YesNo ) ; +void ChatRoom_Message ( int myindex , char *message ) ; +void ChatRoom_Refresh ( int Num ) ; +void ChatRoom_recvall ( int fd , char *data ) ; +#endif diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..5bb29c9 --- /dev/null +++ b/include/common.h @@ -0,0 +1,60 @@ +#ifndef __COMMON_H__ +#define __COMMON_H__ + +#include +#include + +/* MACROS */ +#define RETURNFALSEIFFALSE(x) if(!x)return FALSE; +#define EXITWITHEXITCODEIFFALSE(x,code) if(!x)exit(code); +#ifdef __GNUC__ +#define print(format,arg...) fprintf( stderr, format ,##arg) +#define fprint(format,arg...) fprintf( stderr, "%s:%d " format , __FILE__ , __LINE__ , ##arg) +#endif +#define debug(x,y) fprintf( stderr, #x " = %" #y "\n" , x) +#define arraysizeof( x ) (sizeof(x)/sizeof(x[0])) + +#define errorprint {extern int errno;fprint( "%s\n" ,strerror(errno));} + +#define BACKSLASH '\\' +#define NEWLINE '\n' +#define TAB '\t' +#define SPACE ' ' + +/*票及 define 方曰兜蝈卞允月 */ +/*#define min( x,y ) ((x)>(y)?(y):(x)) + #define max( x,y ) ((x)>(y)?(x):(y))*/ +#define min( x,y ) ({typeof(x) __x=(x),__y=(y);(__x < __y) ? __x : __y; }) +#define max( x,y ) ({typeof(x) __x=(x),__y=(y);(__x < __y) ? __y : __x; }) +#define swap( x,y )({typeof(x) __x=(y);(y)=(x);(x)=__x;}) +#define SUCCESSFUL "successful" +#define FAILED "failed" + +#define LOCK 1 +#define UNLOCK 0 + +#define STRINGBUFSIZ 4096 + +#define OPEN {FILE* f;f=fopen("a.txt","a"); +#define CLOSE fclose(f);} + +#define time_diff_us(new,old) ((unsigned)( (new.tv_sec - old.tv_sec)*1000000 + ( new.tv_usec - old.tv_usec ) )) + + + + +extern int snprintf (char* , size_t, const char* , ...) +#ifdef __GNUC__ + __attribute__ ((format (printf,3,4))); +#else + ; +#endif + +#define ON 1 +#define OFF 0 +#define BOOL int +#define FALSE 0 +#define TRUE 1 +#define INLINE inline + +#endif diff --git a/include/configfile.h b/include/configfile.h new file mode 100644 index 0000000..d49da21 --- /dev/null +++ b/include/configfile.h @@ -0,0 +1,715 @@ +#ifndef __CONFIGFILE_H__ +#define __CONFIGFILE_H__ + +#include "common.h" + +#undef EXTERN +#ifdef __CONFIGFILE_C__ +#define EXTERN +#else /* __CONFIGFILE_C__ */ +#define EXTERN extern +#endif /* __CONFIGFILE_C__ */ + +// Arminius 7.12 login announce +extern char announcetext[8192]; +void AnnounceToPlayer(int charaindex); +// Robin 0720 +void AnnounceToPlayerWN(int fd); +void LoadAnnounce(void); + +#ifdef _PET_TALKPRO + #define PETTALK_MAXID 10 //pettalk10 + typedef struct { + int ID; + char DATA[1024*64]; //1M + }PTALK; + extern PTALK pettalktext[PETTALK_MAXID]; + void LoadPetTalk(void); +#else + +extern char pettalktext[4096]; +void LoadPetTalk(void); +#endif + +#ifdef _GAMBLE_BANK +#define GAMBLEBANK_ITEMSMAX 100 +#define DEFEND_ITEMSMAX 40 +typedef struct REGAMBLEBANKITEMS { + char name[128]; + int Gnum; + int ItemId; + int type; +}GAMBLEBANK_ITEMS; + +extern GAMBLEBANK_ITEMS GB_ITEMS[GAMBLEBANK_ITEMSMAX]; + +void Load_GambleBankItems( void); +#endif + +#ifdef _CFREE_petskill +#define PETSKILL_CODE 500 +typedef struct REPETSKILL_CODES { + char name[128]; + int TempNo; + int PetId; + char Code[256]; +}PETSKILL_CODES; + +extern PETSKILL_CODES Code_skill[PETSKILL_CODE]; +void Load_PetSkillCodes( void); +#endif + +#ifdef _GMRELOAD +#define GMMAXNUM 100 +struct GMINFO +{ + char cdkey[24]; + int level; +}; +extern struct GMINFO gminfo[GMMAXNUM]; +#endif + +BOOL readconfigfile( char* filename ); + +void defaultConfig( char* argv0 ); +char* getProgname( void ); +char* getConfigfilename( void ); +void setConfigfilename( char* newv ); + +unsigned int getDebuglevel( void ); +unsigned int setDebuglevel( unsigned int newv ); +unsigned int getMemoryunit( void ); +unsigned int getMemoryunitnum( void ); +char* getAccountservername( void ); +unsigned short getAccountserverport( void ); +char* getAccountserverpasswd( void ); +char* getGameservername( void ); +unsigned short getPortnumber( void ); + +int getServernumber( void ); +int getReuseaddr( void ); +int getNodelay( void ); +int getLogWriteTime(void); +int getLogIOTime( void); +int getLogGameTime(void); +int getLogNetloopFaster(void); +int getSaacwritenum( void ); +void setSaacwritenum( int num ); +int getSaacreadnum( void ); +void setSaacreadnum( int num ); + +unsigned int getFdnum( void ); +unsigned int setFdnum(int temp_fdnum); +unsigned int getPlayercharnum( void ); +unsigned int getPetcharnum( void ); +unsigned int getOtherscharnum( void ); +unsigned int getObjnum( void ); +unsigned int getItemnum( void ); +unsigned int getBattlenum( void ); + +char* getTopdir( void ); +char* getMapdir( void ); +char* getMaptilefile( void ); +char* getBattleMapfile( void ); +char* getItemfile( void ); +char* getInvfile( void ); +char* getAppearfile( void ); +char* getEffectfile( void ); +char* getTitleNamefile( void ); +char* getTitleConfigfile( void ); +char* getLsgenlogfilename( void ); +char* getStoredir( void ); +#ifdef _STORECHAR +char* getStorechar( void ); +#endif +char* getNpcdir( void ); +char* getLogdir( void ); +char* getLogconffile( void ); +char* getChatMagicPasswd( void ); +unsigned int getChatMagicCDKeyCheck( void ); + + +unsigned int getFilesearchnum( void ); +unsigned int getNpctemplatenum( void ); +unsigned int getNpccreatenum( void ); +unsigned int getWalksendinterval( void ); +void setWalksendinterval( unsigned int ); +unsigned int getCAsendinterval_ms( void ); +void setCAsendinterval_ms( unsigned int ); +unsigned int getCDsendinterval_ms( void ); +void setCDsendinterval_ms( unsigned int ); +unsigned int getOnelooptime_ms( void ); +void setOnelooptime_ms( unsigned int ); +unsigned int getCharSavesendinterval( void ); +void setCharSavesendinterval( unsigned int interval); +unsigned int getAddressbookoffmsgnum( void ); +unsigned int getProtocolreadfrequency( void ); +unsigned int getAllowerrornum( void ); +unsigned int getFengerrornum( void ); +unsigned int getLogHour( void ); +unsigned int getBattleDebugMsg( void ); +void setBattleDebugMsg( unsigned int ); + +char* getEncountfile( void ); +char* getEnemyfile( void ); +char* getGroupfile( void ); +char* getEnemyBasefile( void ); +char* getMagicfile( void ); +#ifdef _ATTACK_MAGIC + +char* getAttMagicfileName( void ); + +#endif + +char* getPetskillfile( void ); +char *getItematomfile( void ); +char *getQuizfile( void ); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +char* getProfession( void ); +#endif + +unsigned int getPetdeletetime( void ); +void setPetdeletetime( unsigned int interval ); + +unsigned int getItemdeletetime( void ); +void setItemdeletetime( unsigned int interval ); +//ttom add this because the second have this function +//unsigned int getAcwriteSize( void ); + +#ifdef _DEL_DROP_GOLD +unsigned int getGolddeletetime( void ); +void setGolddeletetime( unsigned int interval ); +#endif + +unsigned int setEncodeKey( void ); +unsigned int setAcWBSize( void ); +//ttom end + +// CoolFish: +2 2001/4/18 +unsigned int getAcwriteSize( void ); +unsigned int getErrUserDownFlg( void ); + +// Arminius 7.24 manor pk +char* getGameserverID( void ); +unsigned short getAllowManorPK( void ); + +// Terry 2001/10/03 service ap +char* getApID(void); +unsigned short getApPort(void); +int getLoopTime(void); +int getEnableService(void); + +#ifdef _GMRELOAD +char* getGMSetfile(void); +BOOL LoadGMSet(char *filename); +#endif + +#ifdef _ITEM_QUITPARTY +char* getitemquitparty( void ); +#endif + +#ifdef _NEW_PLAYER_CF +int getNewplayertrans( void ); +int getNewplayerlv( void ); +int getNewplayergivepet( unsigned int index ); +void setNewplayergivepet( unsigned int index ,unsigned int interval); +int getNewplayerpetlv( void ); +int getNewplayergivegold( void ); +int getRidePetLevel( void ); +#ifdef _VIP_SERVER +int getNewplayergivevip( void ); +#endif +#endif + +#ifdef _USER_EXP_CF +BOOL LoadEXP( char* filename ); +char* getEXPfile( void ); +int getNeedLevelUpTbls( int level ); +#endif + +#ifdef _UNREG_NEMA +char* getUnregname( int index ); +#endif + +#ifdef _TRANS_LEVEL_CF +int getChartrans( void ); +int getPettrans( void ); +int getYBLevel( void ); +int getMaxLevel( void ); +#endif + +#ifdef _POINT +char* getPoint( void ); +int getTransPoint( int index ); +#endif + +#ifdef _PET_UP +int getPetup( void ); +#endif +#ifdef _WATCH_FLOOR +int getWatchFloor( unsigned int index ); +char* getWatchFloorCF( void ); +#endif + +#ifdef _BATTLE_FLOOR +int getBattleFloor( unsigned int index ); +char* getBattleFloorCF( void ); +#endif + +#ifdef _LOOP_ANNOUNCE +char* getLoopAnnouncePath( void ); +int loadLoopAnnounce( void ); +int getLoopAnnounceTime( void ); +char* getLoopAnnounce( int index ); +int getLoopAnnounceMax( void ); +#endif + +#ifdef _SKILLUPPOINT_CF +int getSkup( void ); +#endif +#ifdef _RIDELEVEL +int getRideLevel( void ); +#endif +#ifdef _REVLEVEL +char* getRevLevel( void ); +#endif +#ifdef _NEW_PLAYER_RIDE +char* getPlayerRide( void ); +#endif +#ifdef _FIX_CHARLOOPS +int getCharloops( void ); +#endif +#ifdef _PLAYER_ANNOUNCE +int getPAnnounce( void ); +#endif +#ifdef _PLAYER_MOVE +int getPMove( void ); +#endif + +int getrecvbuffer( void ); +int getsendbuffer( void ); +int getrecvlowatbuffer( void ); +int getrunlevel( void ); + +#ifdef _SHOW_VIP_CF +int getShowVip( void ); +#endif + +#ifdef _PLAYER_NUM +int getPlayerNum( void ); +void setPlayerNum( int num ); +char* getPlayerBase( void ); +#endif +#ifdef _BATTLE_GOLD +int getBattleGold( void ); +#endif + +#ifdef _ANGEL_TIME +int getAngelPlayerTime( void ); +int getAngelPlayerMun( void ); +#endif + +#ifdef _RIDEMODE_20 +int getRideMode( void ); +#endif + +#ifdef _FM_POINT_PK +char *getFmPointPK( void ); +#endif + +#ifdef _ENEMY_ACTION +int getEnemyAction( void ); +#endif + +#ifdef _FUSIONBEIT_TRANS +int getFusionbeitTrans( void ); +#endif + +char *getMacCheck( void ); +int getCpuUse( void ); + +#ifdef _CHECK_PEPEAT +int getCheckRepeat( void ); +#endif + +#ifdef _VIP_ALL +int getCheckVip( void ); +#endif +#ifdef _FM_JOINLIMIT +int getJoinFamilyTime( void ); +#endif + +#ifdef _NOWEN_EV +int getNowEvent(int Num); +int getEndEvent(int Num); +#endif + +#ifdef _JK_CF_DELPETITEM //ɾCFָƷͳ +char *getDelPet(void); +char *getDelItem(void); +#endif +int getBalltePoint(int Num); +#ifdef _ALL_TALK +int getTheWorldTrans( void ); +int getTheWorldFame( void ); +int getTheWorldTime( void ); +int getTheWorldCnt( void ); +#endif +#ifdef _DIY_INSLAY +int getInslayNum(void); +#endif +int getSafeMode(void); +int getTradeTax(void); +#ifdef _MAP_HEAL +int getMapHeal(int Num); +#endif +#ifdef _VIP_RIDE +int getVipMsgType(void); +#endif +#ifdef _VIP_BATTLE_EXP +int getVipBattleExp( void ); +#endif +int getItemPoolBug(void); +int getSameIpLogin(void); +int getPetRideTrans(void); +#ifdef _LUCK_MAN +int getLuckTime( void ); +int getLuckItem( void ); +#endif +#ifdef _QUESTION_ONLINE +int getQustionTime( void ); +int getQuestionItem( int num ); +#endif +#ifdef _NO_STREET_MAP +int getNoStreetMap( int num ); +#endif +#ifdef _STREET_FAX +int getStreetFax( int num ); +#endif +int getFmWarTime( int num ); +#endif +#ifdef _JZ_NEWSCRIPT_LUA +char *getLuaFile(void); +#endif +#ifdef _TRANS7_POINT +int getTrans7Point(void); +#endif +#ifdef _NOJOB_PK +int getNoJobPkMap(void); +#endif +#ifdef _UNTEXT_TALK +char *getUnText(int num); +#endif +BOOL LoadStreetItemUnText( void ); +char *getStreetItemUnName(int num); +#ifdef _NO_ATTACK +int getAttTime(void); +int getAttSafeTime(void); +int getAttCnt(void); +int getLateTime(void); +int getAttDmeTime(void); +int getAttDmeCnt(void); +#endif +char* getNoAttIp(int num); +#ifdef _NO_TRANS_ANGLE +int getTrans6Angle(void); +#endif +#ifdef _PET_BUG +int getPetPoint(int num); +#endif +#ifdef _VIGOR_SYS +int getVigorTime(int num); +int getVigorMax(void); +#endif +#ifdef _AUTO_PK +int getAutoPkTime(void); +int getAutoPkMinNum(void); +int getAutoPkBattleTime(void); +int getAutoPkMinLv(void); +int getAutoPkVigorPkNum(void); +int getAutoPkVigorPkCnt(void); +#endif +#ifdef _BATTLEMAP_CTRL +int getBattleTimeFloor(int num); +int getBattleTimePlayerNum(int num); +int getBattleTimeSec(int num); +#endif +#ifdef _FM_SERVERNO_SYS +int getFmServerNo(void); +char* getFmServerMsg(void); +#endif +#ifdef _ZHIPIAO_SYSTEM +int getZhiPiao(void); +int getPiaoTime(void); +#endif +#ifdef _FMWAR_MSG +char* getFmWarMsg(void); +#endif +#ifdef _FM_WELFARE +char* getFmWelfare(int num); +#endif +#ifdef _FMZUZHANG_MSG +char* getFmZuzhang(void); +#endif +#ifdef _PETMAIL_LV +int getPetMailLv(void); +int getPetMailCf(void); +#endif +#ifdef _FMWAR_PLAYERNUM +int getFmWarPlayerNum(void); +#endif +#ifdef _WAN_FIX +int getVsFlg(void); +#endif +#ifdef _WARNPC_CTRL +int getPartyMap(int num); +int getMapSameIp(int num); +#endif +#ifdef _NO_DAOLUAN +int getStreetTrn(void); +int getTalkTrn(void); +int getTalkLv(void); +char* getTalkMsg(void); +char* getTalkName(void); +#endif +#ifdef _NO_FULLPLAYER_ATT +int getNoFullPlayer(void); +int getNoFull2Player(void); +int getNoCdkeyPlayer(void); +int getNoCdkeyMode(void); +int getNoCdkeyType(void); +int getNoFullTime(void); +int getFengType(void); +int getNoFullEndPlayer(void); +int getNoFullEndTime(void); +int getManRenNum(void); +int getBigBao(void); +int getBigBao2(void); +#endif +#ifdef _ATTREVERSE_FIX +int getAttReverse(void); +#endif +#ifdef _NEWFM_GOLD +int getNewFmGold(void); +#endif +#ifdef _MERGE_TIME +int getMergeTime(void); +#endif +#ifdef _PETUP_GET_EXP +int getPetUpGetExp(void); +#endif +#ifdef _MM_NO_JIAOBEN +int getNoMMJiaoben(void); +int getEditBaseTime(void); +#endif +#ifdef _DP_140_160_MODE +int getNewDpMode(void); +#endif +#ifdef _LOOK_STREET_TIME +int getLookStreetTime(void); +#endif +#ifdef _BATTLE_EQUIT_OTHER +int getBattleEquitOther(void); +#endif +#ifdef _PK_LUCK_MAN +int getPkLuckFloor(int floor); +char* getPkLuckMapName(int num); +int getPkLuckTimeMin(void); +int getPkLuckTimeMax(void); +int getPkLuckNum(void); +int getPkLuckFame(void); +int getPkLuckVigor(void); +int getPkLuckVipPoint(void); +int getPkLuckAmPoint(void); +int getPkLuckLevel(void); +int getPkLuckBattleTurn(void); +#endif +#ifdef _NO_DAOLUAN +int getTalkFloor(int num); +#endif +#ifdef _SUPERMAN_FIX +int getSuperManPoint(void); +#endif +#ifdef _PICKUP_ITEM_OTHER +int getPickupItem(void); +char* getPickItemId(void); +#endif +#ifdef _FM_LIAOLI +int getFmLiaoLiType(void); +#endif +#ifdef _TRADE_ITEM_FIX +int getTradeItemFix(void); +#endif +#ifdef _PETMAIL_TIME +int getPetMailTime(void); +#endif +int getRandMin(void); +int getRandMax(void); +#ifdef _GJS_TYPE +int getGjsType(void); +#endif +int getTicketCf(void); +char* getTicketMsg(void); + +char* getDefaultKey(int cli_fd); +char* getRunningKey(void); +char* getSaVersion(void); +int getSaType(void); +#ifdef _BATTLEEND_FIX +int getBattleEndMode(void); +#endif +#ifdef _BIG_POOL_TYPE +int getPetPoolType(void); +int getItemPoolType(void); +#endif +int getNoStayBattle(void); +int getRightNum(void); +int getRightMode(void); +int getErrorMode(void); +#ifdef _FLOOR_PARTY_CTRL +int getPartyFloor(int num); +#endif +int getBattleTimtOut(void); +int getReloadNpcTime(void); +int getReloadNpcType(void); +int getOfflineBattleTime(void); +int getOfflineCf(void); +int getOfflineMaxNum(void); +int getOfflineJqmMaxNum(void); +int getKongType(void); +int getJiFenBaiTan(void); +int getNoPkMap(void); +int getFmBuffTrans(void); +char* getNoMpMagic(void); +int getLoginJqmType(void); +char* getFmMagicMpRate(int num); +int getSameIpNum(void); +int getSameJqmNum(void); +int getSameJqmAllNum(void); + +int getMmType(void); +char* getMmMsg(void); + +int getLockType(void); +int getAllTalkPoint(void); +#ifdef _NO_RIDE_ID +char* getNoRideId(void); +#endif +int getLoginType(void); + +#ifdef _GET_BATTLE_EXP +unsigned int getBattleexp( void ); +void setBattleexp( int exp ); +#endif + +#ifdef _PETTRANS_RANGE +void setPetTransRangeX(int num); +int getPetTransRangeX(void); +void setPetTransRangeY(int num); +int getPetTransRangeY(void); +void setPetTransRangeZ(int num); +int getPetTransRangeZ(void); +#endif + +#ifdef _ITEM_LUA +const char *getitemluafile(void); +BOOL ITEM_LuaInit(const char * _FileName); +#endif + +#ifdef _SAME_IP_ONLINE_NUM +int getSameIpOnlineNum(); +#endif + +#ifdef _CHECK_SEVER_IP +int checkServerIp( unsigned int ip ); +#endif +BOOL luareadconfigfile( char* data ); + +#ifdef _CAX_ESC_REPORT +int getReportItem(unsigned int index); +int getVipReportItem(unsigned int index); +int getReportLv(void); +int getReportTa(void); +#endif + +#ifdef _PETSKILL_SHOP_LUA +char *getFreePetSkillShopPath(); +#endif + +#ifdef _CAX_FAMEBUTTON +char* getfamebutton( void ); +#endif + +#ifdef _PET_TRANS_ABILITY +int getPetTransAbility(); +int getPetTransAbility1(); +int getPetTransAbility2(); +int getPetTransAbility3(); +#endif + +#ifdef _PET_3TRANS +int getMMPETID1(void); +int getMMPETID2(void); +#endif + +#ifdef _NO_MAGIC +int getnomagicmap(int num); +#endif + +#ifdef _illegalpetskill_CF +int getIllegalPetskill(int index); +#endif + +#ifdef _CAX_PET_EVOLUTION +char getpetevotyb(void); +int getpetevotyb1(void); +#endif + +#ifdef _TRANS_7_COLOR +//int getTranColor(void); +char getping(void); +char getpetsummon(void); +#endif + +#ifdef _CAX_PET_ITEMRIDE +char getpetitemride(void); +#endif + +#ifdef _DAMMAGE_CALC +int getDamageCalc(); +#endif + +#ifdef _CAX_LNS_NLSUOXU +int GetConfigLineType(char *TM_ConfigName); +char* GetConfigLineVal(char *TM_ConfigName); +int getCopymapstartingID( void ); +#endif + +#ifdef _CAX_FAME_KOUFEI +int getfamekoufei(); +#endif + +#ifdef _CAX_ITEM_ADDEXP +int getexptime(); +#endif + + +#ifdef _SHARE_EXP +int getExpShare(void); +#endif +#ifdef _TEAM_ADDEXP +int getTeamAddExp(void); +#endif + +#ifdef _NO_STW_ENEMY +int getNoSTWNenemy( void ); +int getNoSTWNenemyPoint( void ); +#endif + +#ifdef _DEX_FIX +int getDexFixPer(void); +#endif +#ifdef _FM_EXP_ADD +unsigned int getFmAddExp( void ); +#endif diff --git a/include/correct_bug.h b/include/correct_bug.h new file mode 100644 index 0000000..c9d6eb2 --- /dev/null +++ b/include/correct_bug.h @@ -0,0 +1,20 @@ +#ifndef __CORRECT_BUG_H__ +#define __CORRECT_BUG_H__ + +/* ----------------------- () ---------------------------*/ +#define _add_item_log_name // WON ADD itemlogitem +#define _PETSKILLBUG // Syu ADD +#define _FIXWOLF // Syu ADD ˱Bug +#define _FIXMAGICBUG // Syu ADD ħԱ +#define _FIXPETFALL // Syu ADD +#define _FIX_ITEMRELIFE // WON ADD +#define _FIX_SPEED_UPLEVEL // WON ADD +#define _FIX_PETMAIL // WON ADD +#define _FIX_EQUIP_ITEM // WON ADD װ +#define _ADD_PETMAIL_NUM // WON ADD GMָ +#define _FIX_equipNoenemy // WON ADD ̫ +#define _FIX_PETMAIL2 // WON ADD 2 +#define _FIXITEMANISHOW // Syu ADD غԲѪװʱﲻʾ +#define _kr_ip // WON ADD gmָip + +#endif diff --git a/include/deathcontend.h b/include/deathcontend.h new file mode 100644 index 0000000..7e8c117 --- /dev/null +++ b/include/deathcontend.h @@ -0,0 +1,44 @@ +002C:defend.h:032:1:14=48041e4b:16=47d21313:#ifndef __DEFEND_H__ +#define __DEFEND_H__ + +#endif +002E:encount.h:0638:1:14=48041e4b:16=47d21313:#ifndef __ENCOUNT_H__ +#define __ENCOUNT_H__ + +#define ENCOUNT_GROUPMAXNUM 10 + +BOOL ENCOUNT_initEncount( char* filename ); +BOOL ENCOUNT_reinitEncount( void ); +int ENCOUNT_getEncountAreaArray( int floor, int x, int y); +int ENCOUNT_getEncountPercentMin( int charaindex, int floor , int x, int y ); +int ENCOUNT_getEncountPercentMax( int charaindex, int floor , int x, int y ); +int ENCOUNT_getCreateEnemyMaxNum( int floor , int x, int y ); +int ENCOUNT_getEncountIndex( int floor , int x, int y ); +int ENCOUNT_getEncountIndexFromArray( int array ); +int ENCOUNT_getEncountPercentFromArray( int array ); +int ENCOUNT_getCreateEnemyMaxNumFromArray( int array ); +int ENCOUNT_getGroupIdFromArray( int array, int grouparray ); +int ENCOUNT_getGroupProbFromArray( int array, int grouparray ); +int ENCOUNT_getZorderFromArray( int array ); + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ +typedef struct tagENCOUNT_Table +{ + int index; + int floor; + int encountprob_min; /* ޼ */ + int encountprob_max; /* ޼ */ + int enemymaxnum; /* ľë¾ */ + int zorder; + int groupid[ENCOUNT_GROUPMAXNUM]; /* No */ + int createprob[ENCOUNT_GROUPMAXNUM]; /* */ + int event_now; + int event_end; + int enemy_group; // group + RECT rect; +}ENCOUNT_Table; + +ENCOUNT_Table *ENCOUNT_table; +#endif + +#endif diff --git a/include/defend.h b/include/defend.h new file mode 100644 index 0000000..7c701c0 --- /dev/null +++ b/include/defend.h @@ -0,0 +1,4 @@ +#ifndef __DEFEND_H__ +#define __DEFEND_H__ + +#endif diff --git a/include/des.h b/include/des.h new file mode 100644 index 0000000..04d5f46 --- /dev/null +++ b/include/des.h @@ -0,0 +1,22 @@ +////////////////////////////////////////////////////////////////////////// +/* + Provided by , Northeastern University (www.neu.edu.cn) + Email: blackdrn@sohu.com + This product is free for use. +*/ +////////////////////////////////////////////////////////////////////////// +#include +enum {ENCRYPT,DECRYPT}; +//enum bool{false,true}; // if bool is not supported,use this or just replace with char + // and use 1 for true,0 for false; +////////////////////////////////////////////////////////////////////////// + +// TypeENCRYPT:,DECRYPT: +// (Out)ij >= ((datalen+7)/8)*8,datalen8ıС +// In = Out,ʱ/ܺ󽫸뻺(In) +// keylen>8ʱϵͳԶʹ3DES/,ʹñ׼DES/.16ֽںֻȡǰ16ֽ + +bool Des_Go(char *Out,char *In,long datalen,const char *Key,int keylen,bool Type); + +////////////////////////////////////////////////////////////////////////// + diff --git a/include/encount.h b/include/encount.h new file mode 100644 index 0000000..e3762f8 --- /dev/null +++ b/include/encount.h @@ -0,0 +1,40 @@ +#ifndef __ENCOUNT_H__ +#define __ENCOUNT_H__ + +#define ENCOUNT_GROUPMAXNUM 10 + +BOOL ENCOUNT_initEncount( char* filename ); +BOOL ENCOUNT_reinitEncount( void ); +int ENCOUNT_getEncountAreaArray( int floor, int x, int y); +int ENCOUNT_getEncountPercentMin( int charaindex, int floor , int x, int y ); +int ENCOUNT_getEncountPercentMax( int charaindex, int floor , int x, int y ); +int ENCOUNT_getCreateEnemyMaxNum( int floor , int x, int y ); +int ENCOUNT_getEncountIndex( int floor , int x, int y ); +int ENCOUNT_getEncountIndexFromArray( int array ); +int ENCOUNT_getEncountPercentFromArray( int array ); +int ENCOUNT_getCreateEnemyMaxNumFromArray( int array ); +int ENCOUNT_getGroupIdFromArray( int array, int grouparray ); +int ENCOUNT_getGroupProbFromArray( int array, int grouparray ); +int ENCOUNT_getZorderFromArray( int array ); + +#ifdef _ADD_ENCOUNT // WON ADD ӵ޼ +typedef struct tagENCOUNT_Table +{ + int index; + int floor; + int encountprob_min; /* ޼ */ + int encountprob_max; /* ޼ */ + int enemymaxnum; /* ľë¾ */ + int zorder; + int groupid[ENCOUNT_GROUPMAXNUM]; /* No */ + int createprob[ENCOUNT_GROUPMAXNUM]; /* */ + int event_now; + int event_end; + int enemy_group; // group + RECT rect; +}ENCOUNT_Table; + +ENCOUNT_Table *ENCOUNT_table; +#endif + +#endif diff --git a/include/enemy.h b/include/enemy.h new file mode 100644 index 0000000..b311541 --- /dev/null +++ b/include/enemy.h @@ -0,0 +1,258 @@ +#ifndef __ENEMY_H__ +#define __ENEMY_H__ + +enum +{ + E_T_SIZE_NORMAL, + E_T_SIZE_BIG, +}; + +typedef enum +{ + E_T_TEMPNO, + E_T_INITNUM, + E_T_LVUPPOINT, + E_T_BASEVITAL, + E_T_BASESTR, + E_T_BASETGH, + E_T_BASEDEX, + E_T_MODAI, + E_T_GET, + E_T_EARTHAT, + E_T_WATERAT, + E_T_FIREAT, + E_T_WINDAT, + E_T_POISON, /* ̫ĸ */ + E_T_PARALYSIS, /* ̫ľ1 ƥئУ */ + E_T_SLEEP, /* Ի۵ ƥئ */ + E_T_STONE, /* ޣ۵ ƥئ */ + E_T_DRUNK, /* 쵤 Ʊ */ + E_T_CONFUSION, /* ٣ ë */ + E_T_PETSKILL1, + E_T_PETSKILL2, + E_T_PETSKILL3, + E_T_PETSKILL4, + E_T_PETSKILL5, + E_T_PETSKILL6, + E_T_PETSKILL7, + E_T_RARE, + E_T_CRITICAL, + E_T_COUNTER, + E_T_SLOT, + E_T_IMGNUMBER, + E_T_PETFLG, + E_T_SIZE, + E_T_ATOMBASEADD1, + E_T_ATOMFIXMIN1, + E_T_ATOMFIXMAX1, + E_T_ATOMBASEADD2, + E_T_ATOMFIXMIN2, + E_T_ATOMFIXMAX2, + E_T_ATOMBASEADD3, + E_T_ATOMFIXMIN3, + E_T_ATOMFIXMAX3, + E_T_ATOMBASEADD4, + E_T_ATOMFIXMIN4, + E_T_ATOMFIXMAX4, + E_T_ATOMBASEADD5, + E_T_ATOMFIXMIN5, + E_T_ATOMFIXMAX5, + E_T_LIMITLEVEL, // Arminius 7.30 limit level +#ifdef _PET_FUSION + E_T_FUSIONCODE, +#endif +#ifdef _PET_AMOI__E + E_T_ENABLETRADE, + E_T_PETTYPE, + E_T_PETTYPESUB, +#endif + E_T_DATAINTNUM, +}ENEMYTEMP_DATAINT; + +typedef enum +{ + E_T_NAME, + E_T_ATOMFIXNAME1, + E_T_ATOMFIXNAME2, + E_T_ATOMFIXNAME3, + E_T_ATOMFIXNAME4, + E_T_ATOMFIXNAME5, + E_T_DATACHARNUM, + +}ENEMYTEMP_DATACHAR; + +typedef enum +{ + ENEMY_ID, + ENEMY_TEMPNO, + ENEMY_LV_MIN, + ENEMY_LV_MAX, + ENEMY_CREATEMAXNUM, + ENEMY_CREATEMINNUM, + ENEMY_TACTICS, + ENEMY_EXP, + ENEMY_DUELPOINT, + ENEMY_STYLE, + ENEMY_PETFLG, /* ʸئ¾ */ + + ENEMY_ITEM1, + ENEMY_ITEM2, + ENEMY_ITEM3, + ENEMY_ITEM4, + ENEMY_ITEM5, + ENEMY_ITEM6, + ENEMY_ITEM7, + ENEMY_ITEM8, + ENEMY_ITEM9, + ENEMY_ITEM10, + ENEMY_ITEMPROB1, + ENEMY_ITEMPROB2, + ENEMY_ITEMPROB3, + ENEMY_ITEMPROB4, + ENEMY_ITEMPROB5, + ENEMY_ITEMPROB6, + ENEMY_ITEMPROB7, + ENEMY_ITEMPROB8, + ENEMY_ITEMPROB9, + ENEMY_ITEMPROB10, + + ENEMY_DATAINTNUM, + +}ENEMY_DATAINT; + +typedef enum +{ + ENEMY_NAME, + ENEMY_TACTICSOPTION, +#ifdef _BATTLENPC_WARP_PLAYER + ENEMY_ACT_CONDITION, +#endif + ENEMY_DATACHARNUM, +}ENEMY_DATACHAR; + +typedef enum +{ + GROUP_ID, + GROUP_APPEARBYITEMID, /* ʧ ةë Ȼ -1 */ + GROUP_NOTAPPEARBYITEMID, /* ʧ ةë Ȼئ -1 */ + ENEMY_ID1, + ENEMY_ID2, + ENEMY_ID3, + ENEMY_ID4, + ENEMY_ID5, + ENEMY_ID6, + ENEMY_ID7, + ENEMY_ID8, + ENEMY_ID9, + ENEMY_ID10, + CREATEPROB1, + CREATEPROB2, + CREATEPROB3, + CREATEPROB4, + CREATEPROB5, + CREATEPROB6, + CREATEPROB7, + CREATEPROB8, + CREATEPROB9, + CREATEPROB10, + GROUP_DATAINTNUM, +}GROUP_DATAINT; + +typedef enum +{ + GROUP_NAME, + GROUP_DATACHARNUM, + +}GROUP_DATACHAR; + + +typedef struct tagENEMY_EnemyTable +{ + int intdata[ENEMY_DATAINTNUM]; + STRING64 chardata[ENEMY_DATACHARNUM]; + int enemytemparray; +}ENEMY_EnemyTable; + +typedef struct tagENEMYTEMP_Table +{ + int intdata[E_T_DATAINTNUM]; + //ANDY_EDIT + STRING64 chardata[E_T_DATACHARNUM]; + +}ENEMYTEMP_Table; + +typedef struct tagGROUP_Table +{ + int intdata[GROUP_DATAINTNUM]; + STRING32 chardata[GROUP_DATACHARNUM]; + int enemyarray[CREATEPROB1 - ENEMY_ID1]; +}GROUP_Table; + + + +INLINE BOOL ENEMY_CHECKINDEX( int index); +INLINE int ENEMY_setInt( int index, ENEMY_DATAINT element, int data); +INLINE int ENEMY_getInt( int index, ENEMY_DATAINT element); + +INLINE int *ENEMY_getIntdata( int index); + +INLINE BOOL ENEMY_setChar( int index ,ENEMY_DATACHAR element, char* new ); +INLINE char *ENEMY_getChar( int index, ENEMY_DATACHAR element); +int ENEMY_getEnemyNum( void); +BOOL ENEMY_initEnemy( char* filename ); +BOOL ENEMY_reinitEnemy( void ); +int ENEMY_createEnemy( int array, int baselevel ); +int *ENEMY_getEnemy( int charaindex, int x, int y); +int ENEMY_createPetFromEnemyIndex( int charaindex, int array); +int ENEMY_createPet( int array, int vital, int str, int tgh, int dex); +int ENEMY_getEnemyArrayFromId( int EnemyId); +int ENEMY_getEnemyArrayFromTempNo( int EnemyTempNo); +int ENEMY_getEnemyIdFromTempNo( int EnemyTempNo); +int ENEMY_getEnemyTempNoFromId( int EnemyId); + +#ifdef _TEST_DROPITEMS +int ENEMY_TEST_createPetIndex( int array); +#endif + +int ENEMYTEMP_getEnemyNum( void);//krynn 2001/12/13 +INLINE BOOL ENEMYTEMP_CHECKINDEX( int index); +INLINE int ENEMYTEMP_setInt( int index, ENEMYTEMP_DATAINT element, int data); +INLINE int ENEMYTEMP_getInt( int index, ENEMYTEMP_DATAINT element); +INLINE char *ENEMYTEMP_getChar( int index, ENEMYTEMP_DATACHAR element); +INLINE BOOL ENEMYTEMP_getInt_setChar( int index ,ENEMYTEMP_DATACHAR element, char* new ); +INLINE char *ENEMYTEMP_getInt_getChar( int index, ENEMYTEMP_DATACHAR element); +int ENEMYTEMP_getInt_getEnemyNum( void); +BOOL ENEMYTEMP_getInt_initEnemy( char* filename ); +BOOL ENEMYTEMP_getInt_reinitEnemy( void ); +int ENEMYTEMP_getEnemyTempArray( int enemyindex); +int ENEMYTEMP_getEnemyTempArrayFromTempNo( int EnemyTempNo); +int ENEMYTEMP_getEnemyTempArrayFromInitnum( int EnemyTempNo); + +INLINE int GROUP_setInt( int index, GROUP_DATAINT element, int data); +INLINE int GROUP_getInt( int index, GROUP_DATAINT element); +INLINE BOOL GROUP_setChar( int index ,GROUP_DATACHAR element, char* new ); +INLINE char *GROUP_getChar( int index, GROUP_DATACHAR element); +int GROUP_getEnemyNum( void); + +BOOL ENEMYTEMP_initEnemy( char* filename ); +BOOL ENEMYTEMP_reinitEnemy( void ); +BOOL GROUP_initGroup( char* filename ); +BOOL GROUP_reinitGroup( void ); + +#ifdef _PET_EVOLUTION +int EVOLUTION_createPetFromEnemyIndex( int charaindex, int baseindex, int flg); +int PET_CheckIncubate( int charaindex); +BOOL PETFUSION_getIndexForChar( int toindex, int *MainIndex, int *Subindex1,int *Subindex2, char *data); +int NPC_getFusionTableForBase( int charaindex, int petindex1, int petindex2 ); +int NPC_getPetArrayForNo( int PetCode); +BOOL PET_getEvolutionAns( int petindex, int *base); +#endif + +int PETFUSION_SetNewEgg( int toindex , int petindex, int array, int *work, int *skill1, int *skill2); +BOOL PETFUSION_AddEgg(int toindex, int petID, int PetCode); + +#ifdef _PET_TRANS +int GetNewPet( int toindex , int petindex, int array, int *work); +#endif + +#endif diff --git a/include/enemyexptbl.h b/include/enemyexptbl.h new file mode 100644 index 0000000..5113dd4 --- /dev/null +++ b/include/enemyexptbl.h @@ -0,0 +1,207 @@ +#ifndef __ENEMY_EXPTBL_H__ +#define __ENEMY_EXPTBL_H__ + + +static int enemybaseexptbl[] = { +1, +2, +3, +4, +5, +6, +9, +12, +15, +18, +22, +26, +30, +35, +40, +46, +52, +58, +65, +72, +79, +87, +95, +104, +113, +122, +131, +141, +151, +162, +173, +184, +196, +208, +220, +233, +246, +260, +274, +288, +303, +318, +333, +348, +365, +381, +398, +415, +432, +450, +468, +486, +506, +525, +545, +564, +585, +606, +627, +648, +670, +692, +714, +737, +760, +784, +808, +832, +857, +882, +907, +933, +959, +956, +1012, +1040, +1067, +1095, +1123, +1152, +1181, +1210, +1240, +1270, +1300, +1331, +1362, +1394, +1426, +1458, +1490, +1524, +1557, +1590, +1625, +1659, +1694, +1729, +1764, +1800, // level 100 +1836, +1872, +1909, +1946, +1983, +2021, +2059, +2097, +2136, +2175, // level 110 +2214, +2254, +2294, +2334, +2374, +2414, +2455, +2496, +2537, +2578, // level 120 +2619, +2661, +2703, +2745, +2787, +2829, +2872, +2915, +2958, +3000, // level 130 +3043, +3088, +3132, +3176, +3220, +3264, +3309, +3354, +3399, +3444, // level 140 +3489, +3535, +3581, +3627, +3673, +3719, +3765, +3812, +3859, +3906, // level 150 +3953, +4000, +4047, +4095, +4143, +4191, +4239, +4287, +4335, +4384, // level 160 +4433, +4482, +4531, +4580, +4629, +4679, +4729, +4779, +4829, +4879, // level 170 +4929, +4980, +5031, +5082, +5133, +5184, +5235, +5287, +5339, +5391, // level 180 +5443, +5495, +5547, +5599, +5652, +5705, +5758, +5811, +5864, +5917, // level 190 +5970, +6024, +6078, +6132, +6186, +6240, +6295, +6350, +6405, +6460, // level 200 +}; +#endif diff --git a/include/event.h b/include/event.h new file mode 100644 index 0000000..17dec66 --- /dev/null +++ b/include/event.h @@ -0,0 +1,9 @@ +#ifndef __EVENT_H__ +#define __EVENT_H__ + +INLINE BOOL EVENT_CHECKEVENTINDEX( int event); +int EVENT_main( int charaindex,int event, int x, int y); + + +#endif + diff --git a/include/family.h b/include/family.h new file mode 100644 index 0000000..1ed8f7a --- /dev/null +++ b/include/family.h @@ -0,0 +1,225 @@ +#ifndef __FAMILY_H__ +#define __FAMILY_H__ + +#include "version.h" +#include "common.h" +#include "util.h" +#include "net.h" +#include "time.h" + +#define FAMILY_MAXNUM 1000 // +#ifdef _FMVER21 +#define FAMILY_MAXMEMBER 200 // +#define FAMILY_MAXCHANNELMEMBER 50 // Ƶ +#else +#define FAMILY_MAXMEMBER 50 // +#define FAMILY_MAXCHANNELMEMBER 10 // Ƶ +#endif +#define FAMILY_MAXCHANNEL 5 // Ƶ + +#define CHAR_MAXNAME 32 +#define CHAR_MAXID 20 +#define MINFMLEVLEFORPOINT 3 // 3 ׯ԰͵ȼ +#define FMLEADERLV 30 // 峤ȼ + +#ifdef _FAMILY_MANORNUM_CHANGE +#define FAMILY_FMPKFLOOR 15 // Уͼ +#else +#define FAMILY_FMPKFLOOR 9 // Уͼ +#define FMPOINTNUM 4 // оݵ +#define MANORNUM 4 +#define FAMILY_MAXHOME 4 // ݵ +#endif + +enum +{ + FM_TOP_INTEGRATE = 1, // DPTOP ۺ + FM_TOP_ADV, // DPTOP ð + FM_TOP_FEED, // DPTOP + FM_TOP_SYNTHESIZE, // DPTOP ϳ + FM_TOP_DEALFOOD, // DPTOP + FM_TOP_PK, // DPTOP У +#ifdef _NEW_MANOR_LAW + FM_TOP_MOMENTUM = 8, // DPTOP +#endif + FM_TOP_NUM, // DPTOP +}; + +enum +{ + FM_FIX_ACCEPTFLAG = 1, + FM_FIX_FMPK, + FM_FIX_FMPET, + FM_FIX_FMRULE, + FM_FIX_DELFMTIME, + FM_FIX_FMGOLD, + FM_FIX_FMADV, + FM_FIX_FMFEED, + FM_FIX_FMSYNTHESIZE, + FM_FIX_FMDEALFOOD, + FM_FIX_FMLEADERCHANGE, +#ifdef _NEW_MANOR_LAW + FM_FIX_FMMOMENTUM, + FM_FIX_FAME, +#endif +}; + +/* + * ӡ ְ缰 cdkey charname Ӯë׻ + * CHEKEYLEN, CHARNAMELEN + * ë ʣ + */ + +void CHAR_Family(int fd, int index, char* message); +void ACAddFM(int fd, int result, int fmindex, int index); +void ACJoinFM(int fd, int result, int recv); +void ACLeaveFM(int fd, int result, int resultflag); +void ACDelFM(int fd, int result); +void ACShowFMList(int ret, int fmnum, char *data); +void ACFMDetail(int ret, char *data, int charfdid); +void ACShowMemberList(int result, int index, int fmnumm, +int fmacceptflag, int fmjoinnum, char *data); +void ACShowDpTop(int result,int num, char *data, int kindflag); +void ACShowPointList(int result, char *data); +void ACShowFMMemo(int result, int index, int num, int dataindex, char *data); + +#ifdef _PERSONAL_FAME // Arminius: +void ACFMCharLogin(int fd, int ret, int index, int floor, int fmdp, + int joinflag, int fmsetupflag, int flag, int charindex, int charfame + #ifdef _NEW_MANOR_LAW + ,int momentum + #endif + ); +#else +void ACFMCharLogin(int fd, int ret, int index, int floor, int fmdp, + int joinflag, int fmsetupflag, int flag, int charindex); +#endif + +void ACFMPointList(int ret, char *data); +void ACSetFMPoint(int ret, int r, int clifd); +void ACFMAnnounce(int ret, char *fmname, int fmindex, int index, int kindflag, + char *data, int color); +void ACFixFMPK(int winindex, int loseindex, int data); +void ACFMJob( int fd, int ret, char* data1, char* data2 ); + +void FAMILY_Add(int fd, int meindex, char *message); +void FAMILY_Join(int fd, int meindex, char *message); +void FAMILY_Leave(int fd, int meindex, char *message); +void FAMILY_Detail(int fd, int meindex, char *message); +void FAMILY_CheckMember(int fd, int meindex, char *message); +void FAMILY_Channel(int fd, int meindex, char *message); +void FAMILY_Bank(int fd, int meindex, char *message); +void FAMILY_SetPoint(int fd, int meindex, char *message); +void FAMILY_Init(void); +void FAMILY_SetAcceptFlag(int fd, int meindex, char *message); +void FAMILY_FixRule( int fd, int meindex, char* message ); +int FAMILY_RidePet( int fd, int meindex, char* message ); +void FAMILY_LeaderFunc( int fd, int meindex, char* message ); + +#ifdef _ADD_FAMILY_TAX // WON ADD ׯ԰˰ +void GS_ASK_TAX(void); +void FAMILY_FIX_TAX( int fd, int index, char* message); +#endif + +void SetFMPetVarInit(int meindex); +void SetFMVarInit(int meindex); + + +int CheckFMLeader(int meindex); +int getFmLv(int playerindex); + +void getNewFMList( void ); +void checkFamilyIndex( void ); + +int CheckLeaderQ(int meindex); + + +// shan add Begin +struct FMMEMBER_LIST +{ +// int fmindex; + int fmnum; + int fmjoinnum; +// BOOL use; // 0->ûʹ 1->ʹ + int memberindex[FAMILY_MAXMEMBER]; + char numberlistarray[FAMILY_MAXMEMBER][64]; + char memo[35][220]; // family dengon + int accept; // ļԱ + int memonum; + int memoindex; +}; +// ֮԰ +struct FMS_MEMO +{ + char memo[140][220]; + int memonum; + int memoindex; +}; +// ǿ߱ +struct FMS_DPTOP +{ + int num; // ¼жٸ(ۺ) + char topmemo[FAMILY_MAXNUM][128]; + int fmtopid[FAMILY_MAXNUM]; // +#ifdef _FMVER21 + int fmtopdp[FAMILY_MAXNUM]; // ۺ +#endif +#ifdef _NEW_MANOR_LAW + int fmMomentum[FAMILY_MAXNUM]; // + char momentum_topmemo[FAMILY_MAXNUM][96]; // top + int momentum_topid[FAMILY_MAXNUM]; // top id +#endif + int adv_num; // ð + char adv_topmemo[30][96]; + int feed_num; // + char feed_topmemo[30][96]; + int syn_num; // ϳ + char syn_topmemo[30][96]; + int food_num; // + char food_topmemo[30][96]; + int pk_num; // У + char pk_topmemo[30][96]; +}; +// ݵ +struct FM_POINTLIST +{ + char pointlistarray[FAMILY_MAXHOME][1024]; // Arminius: 32->1024 +#ifdef _NEW_MANOR_LAW + int fm_momentum[FAMILY_MAXHOME]; // ¼սʱڿʼʱׯֵ + BOOL fm_inwar[FAMILY_MAXHOME]; // ׯ԰Ƿׯ԰ų +#endif +}; +// PKͼ +struct FM_PKFLOOR +{ + int fl; +}; +// End + +#ifdef _NEW_MANOR_LAW +typedef struct _ManorSchedule_t{ + int iFmIndex[10]; // սų̵ļ + int iFmMomentum[10]; // + int iSort[10]; // + char szMemo[10][256]; // ¼: |Լսʱ| + char szFmName[10][32]; // + struct tm tm1[10]; // ¼սʱ +}ManorSchedule_t; + +extern ManorSchedule_t ManorSchedule[MANORNUM]; +#endif + +#define MAXFAMILYLIST 64*1024 +extern char familyListBuf[MAXFAMILYLIST]; + +void JoinMemberIndex( int charaindex, int fmindexi); + +int channelMember[FAMILY_MAXNUM][FAMILY_MAXCHANNEL][FAMILY_MAXMEMBER]; +int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; + +#ifdef _CAX_LNS_CHARSUOXU +int Char_GetFm( int id, int x); +char * FM_getManorData(int ManorId,int Flg); +#endif + +#endif diff --git a/include/function.h b/include/function.h new file mode 100644 index 0000000..cd8d34d --- /dev/null +++ b/include/function.h @@ -0,0 +1,5 @@ +#ifndef __FUNCTION_H__ +#define __FUNCTION_H__ +BOOL initFunctionTable( void ); +void* getFunctionPointerFromName( char* funcname ); +#endif diff --git a/include/handletime.h b/include/handletime.h new file mode 100644 index 0000000..048ab78 --- /dev/null +++ b/include/handletime.h @@ -0,0 +1,59 @@ +#ifndef __HANDLETIME_H__ +#define __HANDLETIME_H__ + +#include + +#include "common.h" + +#undef EXTERN +#ifdef __HANDLETIME_C__ +#define EXTERN +#else /*__HANDLETIME_C__*/ +#define EXTERN extern +#endif + +EXTERN struct timeval NowTime; +EXTERN int DEBUG_ADJUSTTIME; + +BOOL setNewTime( void ); +#ifdef _ASSESS_SYSEFFICACY +void Assess_InitSysEfficacy( void); +void Assess_SysEfficacy( int flg); +void ASSESS_getSysEfficacy( float *TVsec); +#ifdef _ASSESS_SYSEFFICACY_SUB +void Assess_SysEfficacy_sub( int flg, int loop); +void ASSESS_getSysEfficacy_sub( float *TVsec, int loop); +#endif +#endif +// WON REM +//struct tm *localtime(const time_t *timep); + +/*ƱHiOLS*/ +/* 150()*60=9000 =750*12 ƥ LS1 */ +/* LS1200 LS1 */ +/* LS100 ƥ LS1 */ +typedef struct tagLSTIME +{ + int year; + int day; + int hour; +}LSTIME; + +#define NIGHT_TO_MORNING 700 +#define MORNING_TO_NOON 930 +#define NOON_TO_EVENING 200 +#define EVENING_TO_NIGHT 300 + +typedef enum +{ + LS_NIGHT = 0, + LS_MORNING , + LS_NOON , + LS_EVENING , +}LSTIME_SECTION; + +void RealTimeToLSTime(long t , LSTIME *lstime); +/*void LSTimeToRealTime( LSTIME *lstime, long *t);*/ +LSTIME_SECTION getLSTime (LSTIME *lstime); + +#endif diff --git a/include/init.h b/include/init.h new file mode 100644 index 0000000..121aca3 --- /dev/null +++ b/include/init.h @@ -0,0 +1,17 @@ +#ifndef __INIT_H__ +#define __INIT_H__ +#include "common.h" +BOOL init( int argc , char** argv, char** env ); +BOOL yanzheng_init( int argc , char** argv, char** env ); +#ifdef _ITEM_QUITPARTY + +typedef struct tagDisappearItem +{ + char string[64]; +}DisappearItem; +DisappearItem *Disappear_Item; +int itemquitparty_num; + +#endif + +#endif diff --git a/include/item.h b/include/item.h new file mode 100644 index 0000000..7956617 --- /dev/null +++ b/include/item.h @@ -0,0 +1,490 @@ + +#ifndef __ITEM_H__ +#define __ITEM_H__ + +//#include "char.h" + +#define NULLITEM "0" + +typedef enum +{ + ITEM_FIST =0, + ITEM_AXE, + ITEM_CLUB, + ITEM_SPEAR, + ITEM_BOW, + ITEM_SHIELD, + ITEM_HELM, + ITEM_ARMOUR, + + ITEM_BRACELET =8, + ITEM_MUSIC, + ITEM_NECKLACE, + ITEM_RING, + ITEM_BELT, + ITEM_EARRING, + ITEM_NOSERING, + ITEM_AMULET, + /* ****** */ + ITEM_OTHER =16, + ITEM_BOOMERANG, // + ITEM_BOUNDTHROW, // Ͷͷ + ITEM_BREAKTHROW, // Ͷʯ + ITEM_DISH =20, +#ifdef _ITEM_INSLAY + ITEM_METAL, + ITEM_JEWEL, +#endif +#ifdef _ITEM_CHECKWARES + ITEM_WARES, // +#endif + +#ifdef _ITEM_EQUITSPACE + ITEM_WBELT, // + ITEM_WSHIELD, // + ITEM_WSHOES, //Ь +#endif +#ifdef _EQUIT_NEWGLOVE + ITEM_WGLOVE, // +#endif + +#ifdef _ALCHEMIST + ITEM_ALCHEMIST =30, +#endif + +#ifdef _PET_ITEM + ITEM_PET_HEAD, + ITEM_PET_TOOTH, + ITEM_PET_CLAW, + ITEM_PET_BREAST, + ITEM_PET_BACK, + ITEM_PET_WING, + ITEM_PET_FEET, +#endif + +#ifdef _ANGEL_SUMMON + //ITEM_ANGELTOKEN, + //ITEM_HEROTOKEN, +#endif + + ITEM_CATEGORYNUM, + +}ITEM_CATEGORY; + +typedef enum +{ + ITEM_FIELD_ALL, + ITEM_FIELD_BATTLE, + ITEM_FIELD_MAP, +}ITEM_FIELDTYPE; + +typedef enum +{ + ITEM_TARGET_MYSELF, + ITEM_TARGET_OTHER, + ITEM_TARGET_ALLMYSIDE, + ITEM_TARGET_ALLOTHERSIDE, + ITEM_TARGET_ALL, +}ITEM_TARGETTYPE; + +typedef enum +{ + ITEM_ID, + ITEM_BASEIMAGENUMBER, + ITEM_COST, + ITEM_TYPE, + ITEM_ABLEUSEFIELD, + ITEM_TARGET, + ITEM_LEVEL, /* LEVEL */ +#ifdef _ITEM_MAXUSERNUM + ITEM_DAMAGEBREAK, //Ʒʹô +#endif + +#ifdef _ITEMSET4_TXT + ITEM_USEPILENUMS, //Ʒѵ + ITEM_CANBEPILE, //Ƿɶѵ + + ITEM_NEEDSTR, + ITEM_NEEDDEX, + ITEM_NEEDTRANS, + ITEM_NEEDPROFESSION, +#endif + +#ifdef _TAKE_ITEMDAMAGE + ITEM_DAMAGECRUSHE, + ITEM_MAXDAMAGECRUSHE, +#endif + +#ifdef _ADD_DEAMGEDEFC + ITEM_OTHERDAMAGE, + ITEM_OTHERDEFC, +#endif + +#ifdef _SUIT_ITEM + ITEM_SUITCODE, +#endif + + ITEM_ATTACKNUM_MIN, /* */ + ITEM_ATTACKNUM_MAX, /* */ + ITEM_MODIFYATTACK, /* */ + ITEM_MODIFYDEFENCE, /* */ + ITEM_MODIFYQUICK, /* QUICK */ + + ITEM_MODIFYHP, /* HP */ + ITEM_MODIFYMP, /* MP */ + ITEM_MODIFYLUCK, /* LUCK */ + ITEM_MODIFYCHARM, /* CHARM */ + ITEM_MODIFYAVOID, /* Ĥ */ + ITEM_MODIFYATTRIB, /* Ĥ */ + ITEM_MODIFYATTRIBVALUE, /* ĤҰ */ + ITEM_MAGICID, /* į */ + ITEM_MAGICPROB, /* */ + ITEM_MAGICUSEMP, /* MP */ + +#ifdef _ITEMSET5_TXT + ITEM_MODIFYARRANGE, + ITEM_MODIFYSEQUENCE, + + ITEM_ATTACHPILE, + ITEM_HITRIGHT, // +#endif +#ifdef _ITEMSET6_TXT + ITEM_NEGLECTGUARD, +// ITEM_BEMERGE, +#endif +#ifdef _PETITEM__AMOI_E + ITEM_PETFIX0, + ITEM_PETFIX1, + ITEM_PETFIX2, + ITEM_PETFIX3, + ITEM_PETFIX4, + ITEM_PETFIX5, + ITEM_PETFIX6, + ITEM_PETFIX7, +#endif + /* ĤҰ*/ + ITEM_POISON, /* ̫ĸ */ + ITEM_PARALYSIS, /* ̫ľ1 ƥئУ */ + ITEM_SLEEP, /* Ի۵ ƥئ */ + ITEM_STONE, /* ޣ۵ ƥئ */ + ITEM_DRUNK, /* 쵤 Ʊ */ + ITEM_CONFUSION, /* ٣ ë */ + + ITEM_CRITICAL, /* ūл Ĥ */ + + ITEM_USEACTION, /* ݼʧ */ + ITEM_DROPATLOGOUT, /* ʧݱ ʾ */ + ITEM_VANISHATDROP, /* ݱ¾ */ + ITEM_ISOVERED, /* Ⱦľ¾*/ + ITEM_CANPETMAIL, /* ʸƥ˪ľ¾ */ + ITEM_CANMERGEFROM, /* ئľ¾ */ + ITEM_CANMERGETO, /* Ʊئľ¾ */ + + ITEM_INGVALUE0, /* (5) */ + ITEM_INGVALUE1, + ITEM_INGVALUE2, + ITEM_INGVALUE3, + ITEM_INGVALUE4, +#ifdef _PETITEM__AMOI_E + ITEM_TYPEOFITEM, +#endif + ITEM_PUTTIME, /* ʧ ة ľ */ + ITEM_LEAKLEVEL, /* ľľ׾ */ + ITEM_MERGEFLG, /* ľʧ ة */ + ITEM_CRUSHLEVEL, /* çľպ 0 2 ߷çľئ 2ç */ + + ITEM_VAR1, /* ۽ */ + ITEM_VAR2, /* ۽ */ + ITEM_VAR3, /* ۽ */ + ITEM_VAR4, /* ۽ */ + ITEM_TIME, +#ifdef _ITEM_COLOER + ITEM_COLOER, +#endif + ITEM_DATAINTNUM, + +}ITEM_DATAINT; + +typedef enum +{ + ITEM_NAME, /* 񲼰 */ + ITEM_SECRETNAME, /* ʽľµ Ի */ + ITEM_EFFECTSTRING, /* ٯ */ + ITEM_ARGUMENT, /* ʧ ة¦ */ +#ifdef _ITEM_INSLAY + ITEM_TYPECODE, + ITEM_INLAYCODE, +#endif + ITEM_CDKEY, /* ʧ ة ë ٱ м */ +#ifdef _ITEM_FORUSERNAMES + ITEM_FORUSERNAME, + ITEM_FORUSERCDKEY, +#endif +// CoolFish: 2001/10/11 +#ifdef _UNIQUE_P_I + ITEM_UNIQUECODE, /* Ʒ */ +#endif + + ITEM_INGNAME0, /* м (5) */ + ITEM_INGNAME1, + ITEM_INGNAME2, + ITEM_INGNAME3, + ITEM_INGNAME4, + + + ITEM_INITFUNC, /* ¦ + * ITEM_Item* + * ߯Ի BOOL + * ߯Ի CHAR_INITFUNC + * Ԫ */ + ITEM_FIRSTFUNCTION = ITEM_INITFUNC, + ITEM_PREOVERFUNC, /* CHAR_PREOVERFUNC ë */ + ITEM_POSTOVERFUNC, /* CHAR_POSTOVERFUNC ë*/ + ITEM_WATCHFUNC, /* CHAR_WATCHFUNC ë */ + ITEM_USEFUNC, /* ¦ѷ + * int charaindex ƽҷ̼͵ + * int charitemindex м + * ʧ ة + * ë׾ + */ + ITEM_ATTACHFUNC, /* ¦ѷ + * int charaindex ƽҷ̼͵ + * int itemindex ʧ ة̼͵ + * ƽҷ Ȼʧ ة + * ʧ ة ƥ̼͵ + * ƥئDZ + */ + ITEM_DETACHFUNC, /* ¦ѷ + * int charaindex ƽҷ̼͵ + * int itemindex ʧ ة̼͵ + * ƽҷ Ȼʧ ة + * ʧ ة ƥ̼͵ + * ƥئDZ + */ + ITEM_DROPFUNC, /* + * ¦ѷ + * int charaindex ƽҷ + * int itemindex ʧ ة̼͵ + */ + ITEM_PICKUPFUNC, /* ʧ ةë + * ¦ѷ + * int charaindex ƽҷindex + * int itemindex ʧ ة̼͵ + */ +#ifdef _Item_ReLifeAct + ITEM_DIERELIFEFUNC, /*ANDY_ADD + + */ +#endif +#ifdef _PETITEM__AMOI_E + ITEM_PETEQUITALLOW, + ITEM_PETEQUITFORBIT, +#endif +#ifdef _PICKUP_ITEM_OTHER + ITEM_FROMCDKEY, +#endif + + ITEM_LASTFUNCTION, + + ITEM_DATACHARNUM = ITEM_LASTFUNCTION, + +#ifdef _ANGEL_SUMMON + ITEM_ANGELMISSION = ITEM_INGNAME0, + ITEM_ANGELINFO = ITEM_INGNAME1, + ITEM_HEROINFO = ITEM_INGNAME2, +#endif + +}ITEM_DATACHAR; + +typedef enum +{ + ITEM_WORKOBJINDEX, + ITEM_WORKCHARAINDEX, +#ifdef _ITEM_ORNAMENTS + ITEM_CANPICKUP, +#endif +#ifdef _ITEM_TIME_LIMIT + ITEM_WORKTIMELIMIT, +#endif + ITEM_WORKDATAINTNUM, +}ITEM_WORKDATAINT; + + + +//typedef struct tagItem +//{ +// int data[ITEM_DATAINTNUM]; +// STRING64 string[ITEM_DATACHARNUM]; +// int workint[ITEM_WORKDATAINTNUM]; +// +// void* functable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; +//}ITEM_Item; + +typedef struct tagItem +{ + int data[ITEM_DATAINTNUM]; + STRING64 string[ITEM_DATACHARNUM]; + int workint[ITEM_WORKDATAINTNUM]; + + void* functable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; +#ifdef _ALLBLUES_LUA_1_2 + lua_State *lua[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; + char *luafunctable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; +#endif +#ifdef _JZ_NEWSCRIPT_LUA + STRING32 lua_charfunctable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; + + void* sur_functable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; + STRING32 sur_charfunctable[ITEM_LASTFUNCTION-ITEM_FIRSTFUNCTION]; +#endif + +}ITEM_Item; + + +typedef struct tagITEM_table +{ + int use; + ITEM_Item itm; + int randomdata[ITEM_DATAINTNUM]; +}ITEM_table; + + +typedef struct tagITEM_exists +{ + BOOL use; + ITEM_Item itm; +}ITEM_exists; + +#ifdef _PETITEM__AMOI_E +#define ITEM_NOT_LIMIT 0x00000000 // +#define ITEM_NOT_DROP 0x00000010 // +#define ITEM_NOT_STREETVANDOR 0x00000100 //ɰڵ +#define ITEM_NOT_TRADE 0x00001000 //ɽ +#define ITEM_NOT_MAIL 0x00010000 //ʼ +#endif + +#define ITEM_CHECKINDEX(index) \ + _ITEM_CHECKINDEX( __FILE__, __LINE__, index) +INLINE BOOL _ITEM_CHECKINDEX( char *file, int line, int index); + + +BOOL ITEM_initExistItemsArray( int num ); +BOOL ITEM_endExistItemsArray( void ); +#define ITEM_initExistItemsOne( itm) \ + _ITEM_initExistItemsOne( __FILE__, __LINE__, itm) +int _ITEM_initExistItemsOne( char *file, int line, ITEM_Item* itm ); + +#define ITEM_endExistItemsOne( index ) \ + _ITEM_endExistItemsOne( index, __FILE__, __LINE__) + +void _ITEM_endExistItemsOne( int index , char *file, int line); + +#define ITEM_getInt( Index, element) _ITEM_getInt( __FILE__, __LINE__, Index, element ) +INLINE int _ITEM_getInt( char *file, int line, int index ,ITEM_DATAINT element); + + +#define ITEM_setInt( Index, element, data) _ITEM_setInt( __FILE__, __LINE__, Index, element, data) +INLINE int _ITEM_setInt( char *file, int line, int index ,ITEM_DATAINT element, int data); + + +INLINE char* ITEM_getChar( int index ,ITEM_DATACHAR element ); +INLINE BOOL ITEM_setChar( int index ,ITEM_DATACHAR element , char* new); + +INLINE int ITEM_getWorkInt( int index ,ITEM_WORKDATAINT element); +INLINE int ITEM_setWorkInt( int index ,ITEM_WORKDATAINT element, int data); +INLINE int ITEM_getITEM_itemnum( void ); +INLINE int ITEM_getITEM_UseItemnum( void ); +INLINE BOOL ITEM_getITEM_use( int index ); +void ITEM_constructFunctable( int itemindex ); +void* ITEM_getFunctionPointer( int itemindex, int functype ); +#ifdef _ALLBLUES_LUA_1_2 +typedef struct tagITEM_LuaFunc +{ + lua_State *lua; + char luafuncname[128]; + char luafunctable[128]; + struct tagITEM_LuaFunc *next; +}ITEM_LuaFunc; + + +INLINE BOOL ITEM_setLUAFunction( int itemindex, int functype, const char *luafuncname); +INLINE lua_State *ITEM_getLUAFunction( int itemindex, int functype); + +BOOL ITEM_addLUAListFunction( lua_State *L, const char *luafuncname, const char *luafunctable ); +#endif +INLINE ITEM_Item *ITEM_getItemPointer( int index ); +int ITEM_getItemMaxIdNum( void); + + + +char* ITEM_makeStringFromItemData( ITEM_Item* one, int mode ); +char* ITEM_makeStringFromItemIndex( int index, int mode ); + +BOOL ITEM_makeExistItemsFromStringToArg( char* src , ITEM_Item* item, int mode ); +void ITEM_getDefaultItemSetting( ITEM_Item* itm); + + +INLINE BOOL ITEM_CHECKITEMTABLE( int number ); +BOOL ITEM_readItemConfFile( char* filename ); + + +CHAR_EquipPlace ITEM_getEquipPlace( int charaindex, int itmid ); + + +char* ITEM_makeItemStatusString( int haveitemindex, int itemindex ); +char* ITEM_makeItemFalseString( void ); +char* ITEM_makeItemFalseStringWithNum( int haveitemindex ); + + +BOOL ITEM_makeItem( ITEM_Item* itm, int number ); +int ITEM_makeItemAndRegist( int number ); + + +void ITEM_equipEffect( int index ); + +void Other_DefcharWorkInt( int index); + +char* ITEM_getAppropriateName(int itemindex); +char* ITEM_getEffectString( int itemindex ); + + +int ITEM_getcostFromITEMtabl( int itemid ); + +#define ITEM_getNameFromNumber( id) _ITEM_getNameFromNumber( __FILE__, __LINE__, id) +INLINE char* _ITEM_getNameFromNumber( char *file, int line, int itemid ); + + +int ITEM_getlevelFromITEMtabl( int itemid ); +int ITEM_getgraNoFromITEMtabl( int itemid ); +char *ITEM_getItemInfoFromNumber( int itemid ); + +int ITEM_getdropatlogoutFromITEMtabl( int itemid ); +int ITEM_getvanishatdropFromITEMtabl( int itemid ); +int ITEM_getcanpetmailFromITEMtabl( int itemid ); +int ITEM_getmergeItemFromFromITEMtabl( int itemid ); + +#ifdef _ITEM_CHECKWARES +BOOL CHAR_CheckInItemForWares( int charaindex, int flg); +#endif + +BOOL ITEM_canuseMagic( int itemindex); +// Nuke +1 08/23 : For checking the validity of item target +int ITEM_isTargetValid( int charaindex, int itemindex, int toindex); + +int ITEMTBL_getInt( int ItemID, ITEM_DATAINT datatype); +char *ITEMTBL_getChar( int ItemID, ITEM_DATACHAR datatype); + +int ITEM_getItemDamageCrusheED( int itemindex); +void ITEM_RsetEquit( int charaindex);//Զжװλô֮Ʒ +void ITEM_reChangeItemToPile( int itemindex); +void ITEM_reChangeItemName( int itemindex); + +#ifdef _SIMPLIFY_ITEMSTRING +void ITEM_getDefaultItemData( int itemID, ITEM_Item* itm); +#endif + +#ifdef _PET_ITEM +char* ITEM_petmakeItemStatusString( int petindex, int itemid ); +#endif + +#endif diff --git a/include/item_event.h b/include/item_event.h new file mode 100644 index 0000000..f0f7185 --- /dev/null +++ b/include/item_event.h @@ -0,0 +1,342 @@ +#ifndef __ITEM_EVENT_H__ +#define __ITEM_EVENT_H__ +#include "item.h" +int ITEM_eventDrop( int itemindex, int charaindex, int itemcharaindex ); +BOOL ITEM_MedicineInit( ITEM_Item* itm ); +void ITEM_MedicineUsed( int charaindex, int to_charaindex, int itemindex ); +void ITEM_SandClockDetach( int charindex , int itemindex ); +void ITEM_SandClockLogin( int charaindex ); +void ITEM_SandClockLogout( int charaindex ); +void ITEM_chantMagicAttack( int charaindex, int itemindex, int toindex, float* damage ); +void ITEM_addTitleAttach( int charaindex, int itemindex ); +void ITEM_delTitleDetach( int charaindex, int itemindex ); +void ITEM_DeleteByWatched( int myobjindex, int moveobjindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +void ITEM_DeleteTimeWatched( int myobjindex, int moveobjindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +void ITEM_useEffectTohelos( int charaindex, int to_charaindex, int haveitemindex); +void ITEM_useRecovery( int charaindex, int toindex, int haveitemindex); + +void ITEM_useStatusChange( int charaindex, int toindex, int haveitemindex); +void ITEM_useMagicDef( int charaindex, int toindex, int haveitemindex); +void ITEM_useParamChange( int charaindex, int toindex, int haveitemindex); +void ITEM_useFieldChange( int charaindex, int toindex, int haveitemindex); +void ITEM_useAttReverse( int charaindex, int toindex, int haveitemindex); +void ITEM_useStatusRecovery( int charaindex, int toindex, int haveitemindex); +void ITEM_useRessurect( int charaindex, int toindex, int haveitemindex); +void ITEM_useMic( int charaindex, int to_charaindex, int haveitemindex ); +void ITEM_dropMic( int charaindex, int itemindex ); +void ITEM_useCaptureUp( int charaindex, int toindex, int haveitemindex); +void ITEM_useRenameItem( int charaindex, int toindex, int haveitemindex); +void ITEM_useRenameItem_WindowResult( int charaindex, int seqno, int select, char *data); +void ITEM_dropDice( int charaindex, int itemindex); +void ITEM_pickupDice( int charaindex, int itemindex); +void ITEM_useLottery( int charaindex, int toindex, int haveitemindex); +void ITEM_useWarp( int charaindex, int toindex, int haveitemindex ); +void ITEM_petFollow( int charaindex, int toindex, int haveitemindex ); +BOOL ITEM_initLottery(ITEM_Item* itm); +void ITEM_useSkup( int charaindex, int toindex, int haveitemindex ); // Nuke 0624 +void ITEM_useNoenemy( int charaindex, int toindex, int haveitemindex ); // Nuke 0626 +void ITEM_equipNoenemy( int charaindex, int itemindex ); // Arminius 7.2: Ra's amulet +void ITEM_remNoenemy( int charaindex, int itemindex ); // Arminius 7.2: Ra's amulet +BOOL ITEM_getArgument( char* argument , char* entryname , char* buf , int buflen ); // Arminius 7.2: Ra's amulet +void ITEM_useEncounter( int charaindex, int toindex, int haveitemindex); // Arminius 7.31 cursed stone +#ifdef _ITEM_METAMO +void ITEM_metamo( int charaindex, int toindex, int haveitemindex ); +void ITEM_ColorMetamo( int charaindex, int toindex, int haveitemindex); +void ITEM_CharaMetamo( int charaindex, int toindex, int haveitemindex); +void ITEM_SexMetamo( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ITEM_CRACKER +void ITEM_Cracker(int charaindex,int toindex,int haveitemindex); +#endif +#ifdef _ITEM_ADDEXP //vincent +void ITEM_Addexp(int charaindex,int toindex,int haveitemindex); +#endif +#ifdef _ITEM_REFRESH //vincent 쳣״̬ +void ITEM_Refresh(int charaindex,int toindex,int haveitemindex); +#endif +//Terry 2001/12/21 +#ifdef _ITEM_FIRECRACKER +void ITEM_firecracker(int charaindex,int toindex,int haveitemindex); +#endif +//Terry end + +#ifdef _PET_LIMITLEVEL +void ITEM_useOtherEditBase( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_EDITBASES +void ITEM_useFusionEditBase( int charaindex, int toindex, int haveitemindex); +#endif + +void ITEM_WearEquip( int charaindex, int itemindex); +void ITEM_ReWearEquip( int charaindex, int itemindex); + + +#ifdef _ITEM_CONSTITUTION +void ITEM_Constitution( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _Item_ReLifeAct +void ITEM_DIErelife( int charaindex, int itemindex, int eqw ); +#endif + +#ifdef _Item_MoonAct +void ITEM_randEnemyEquipOne( int charaindex, int toindex, int haveitemindex); +void ITEM_randEnemyEquip( int charaindex, int itemindex); +void ITEM_RerandEnemyEquip( int charaindex, int itemindex); +#endif + +#ifdef _ITEM_ORNAMENTS +void ITEM_PutOrnaments( int charaindex, int itemindex); +#endif + +#ifdef _CHIKULA_STONE +void ITEM_ChikulaStone( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _SUIT_ITEM +void ITEM_suitEquip( int charaindex, int itemindex); +void ITEM_ResuitEquip( int charaindex, int itemindex); +#endif + +#ifdef _EQUIT_DEFMAGIC +void ITEM_MagicEquitWear( int charaindex, int itemindex); +void ITEM_MagicEquitReWear( int charaindex, int itemindex); +#endif + +#ifdef _EQUIT_RESIST +void ITEM_MagicResist( int charaindex, int itemindex); +void ITEM_MagicReResist( int charaindex, int itemindex); +#endif + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ +void ITEM_P_MagicEquitWear( int charaindex, int itemindex ); +void ITEM_P_MagicEquitReWear( int charaindex, int itemindex ); +#endif + + +#ifdef _Item_DeathAct +void ITEM_UseDeathCounter( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _FEV_ADD_NEW_ITEM // FEV ADD Ӹؾ +void ITEM_ResAndDef( int charaindex, int toindex, int haveitemindex ); +#endif + +#ifdef _CHRISTMAS_REDSOCKS +void ITEM_useMaxRedSocks( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _CHRISTMAS_REDSOCKS_NEW +void ITEM_useMaxRedSocksNew( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _PETSKILL_CANNEDFOOD +void ITEM_useSkillCanned( int charaindex, int toindex, int itemNo); +#endif + +#ifdef _NEW_RIDEPETS +void ITEM_useLearnRideCode( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_WARP_FIX_BI +void recoverbi(int index); +#endif + +#ifdef _ITEM_TIME_LIMIT +void ITEM_TimeLimit( int charaindex); +#endif + +#ifdef _USEWARP_FORNUM +void ITEM_useWarpForNum( int charaindex, int toindex, int haveitemindex ); +#endif + +#ifdef _IMPRECATE_ITEM +void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex ); +#endif + +#ifdef _THROWITEM_ITEMS +void ITEM_ThrowItemBox( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_WATERWORDSTATUS +void ITEM_WaterWordStatus( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_LOVERPARTY +void ITEM_LoverSelectUser( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_MAGICRECOVERY +void ITEM_useMRecovery( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_USEMAGIC +void ITEM_useMagic( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _PETSKILL_CANNEDFOOD +void ITEM_usePetSkillCanned_WindowResult( int charaindex, int seqno, int select, char *data); +#endif + +void ITEM_AddPRSkillPoint(int charaindex,int toindex,int haveitemindex); +void ITEM_AddPRSkillPercent( int charaindex,int toindex,int haveitemindex); + +#ifdef _ANGEL_SUMMON +void ITEM_AngelToken( int charaindex, int toindex, int haveitemindex ); +void ITEM_HeroToken( int charaindex, int toindex, int haveitemindex ); +#endif +#ifdef _HALLOWEEN_EFFECT +void ITEM_MapEffect(int charaindex,int toindex,int haveitemindex); +#endif +void ITEM_changePetOwner( int charaindex, int toindex, int haveitemindex); + +#ifdef _TIME_TICKET +void ITEM_timeticket( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _ITEM_SETLOVER +void ITEM_SetLoverUser( int charaindex, int toindex, int haveitemindex); +void ITEM_LoverWarp( int charaindex, int toindex, int haveitemindex); +void ITEM_LoverUnmarry( int charaindex, int toindex, int haveitemindex); +void ITEM_LoverForceUnmarry( int charaindex, int toindex, int haveitemindex); //ǿ +#endif + +#ifdef _GM_ITEM +void ITEM_GMFUNCTION( int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _VIP_SERVER +void ITEM_AddMemberPoint( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _VIP_RIDE +void ITEM_VipRide( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _NEW_NAME //Զƺ +void ITEM_NewName( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _VIP_SERVER +void ITEM_AddVipPoint( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _FM_ITEM +void ITEM_AddFame( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _LUCK_ITEM +void ITEM_Luck( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ITEM_METAMO_TIME +void ITEM_MetamoTime( int charaindex, int toindex, int haveitemindex ); +#endif +#ifdef _ITEM_GOLD +void ITEM_Gold( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _MYSTERIOUS_GIFT +void ITEM_MysteriousGift( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _BATTLE_PK +void ITEM_BattlePK( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _SILENTZERO +void ITEM_SetSilentZero( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _PET_LEVEL_ITEM +void ITEM_PetLevelItem( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ITEM_EFMETAMO +void ITEM_efMetamo( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _PET_BEATITUDE +void PET_BEATITUDE( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _GET_MULTI_ITEM +void ITEM_GetMultiItem( int charaindex, int toindex, int haveitemindex); +#endif +void ITEM_OldToNew( int charaindex, int toindex, int haveitemindex); +#ifdef _SAFE_PASSWORD +void ITEM_ItemPetLocked( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _POINT_CARD +void ITEM_OnlineCost( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _SUPER_MAN_ITEM +void ITEM_SuperManItem( int charaindex, int toindex, int haveitemindex); +#endif +void ITEM_CharSave( int charaindex, int toindex, int haveitemindex); +void ITEM_NoDelWarp( int charaindex, int toindex, int haveitemindex ); +void ITEM_RandWarp( int charaindex, int toindex, int haveitemindex); +void ITEM_RandMsg( int charaindex, int toindex, int haveitemindex); +#ifdef _SQL_BUY_FUNC +void ITEM_OnlineBuy_recv( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _JOB_AUTOPK +void ITEM_JobPk( int charaindex, int toindex, int haveitemindex); +#endif +void ITEM_SeeEquip( int charaindex, int toindex, int haveitemindex); +#ifdef _VIGOR_SYS +void ITEM_VigorSave( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _EV_NUM +void ITEM_EvItem( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _OFFLINE_SYSTEM +void ITEM_OFFLINE( int charaindex, int toindex, int haveitemindex); +#endif +void ITEM_AddProfessionLevel( int charaindex, int toindex, int haveitemindex); +#ifdef _ZHIPIAO_SYSTEM +void ITEM_ZhiPiao( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _ALL_RANDMODE +void ITEM_useRandEditBase( int charaindex, int toindex, int haveitemindex); +#endif +#ifdef _DP_ZHIPIAO_ITEM +void ITEM_DpZhiPiao( int charaindex, int toindex, int haveitemindex); +#endif +void ITEM_UpPointResetItem( int charaindex, int toindex, int haveitemindex); +void ITEM_MM( int charaindex, int toindex, int haveitemindex); +#ifdef _XC_CANGKU +void ITEM_ICK( int charaindex, int toindex, int haveitemindex); +void ITEM_PCK( int charaindex, int toindex, int haveitemindex); +#endif + +void ITEM_MakePet( int charaindex, int toindex, int haveitemindex); +void PET_OTHERBEATITUDE( int charaindex, int toindex, int haveitemindex); +void PET_MYBEATITUDE( int charaindex, int toindex, int haveitemindex); +void ITEM_useDelRenameItem( int charaindex, int toindex, int haveitemindex); +void ITEM_DANMM( int charaindex, int toindex, int haveitemindex); +void ITEM_ExpLvBase( int charaindex, int exp); +void ITEM_useExpLv( int charaindex, int toindex, int haveitemindex); +enum{ + BD_KIND_HP, + BD_KIND_MP, + BD_KIND_CHARM, + BD_KIND_AI, + BD_KIND_CURSE, + BD_KIND_BESTOW, + BD_KIND_WISHES, +#ifdef _ITEM_UNBECOMEPIG + BD_KIND_UNBECOMEPIG, +#endif +#ifdef _ITEM_PROPERTY + BD_KIND_PROPERTY, +#endif + BD_KIND_END +}; +#ifdef _ITEM_LUA +void ITEM_Lua(int charaindex, int toindex, int haveitemindex); +#endif + +#ifdef _SPECIAL_SUIT +void ITEM_SpecialSuitEquip( int charaindex, int itemindex); +void ITEM_SpecialResuitEquip( int charaindex, int itemindex); +#endif +#ifdef _MANOR_EQUIP +void ITEM_ManorEquip( int charaindex, int itemindex); +void ITEM_ReManorEquip( int charaindex, int itemindex); +#endif +#ifdef _NULL_CHECK_ITEM +void ITEM_NullCheck( int charaindex, int toindex, int haveitemindex); +#endif +#endif + diff --git a/include/item_gen.h b/include/item_gen.h new file mode 100644 index 0000000..7174c87 --- /dev/null +++ b/include/item_gen.h @@ -0,0 +1,22 @@ +#ifndef __ITEM_GEN_H__ +#define __ITEM_GEN_H__ + + +int ITEM_initItemIngCache( void ); +int ITEM_initItemAtom( char *fn ); +int ITEM_initRandTable( void); +int ITEM_mergeItem( int charaindex, ITEM_Item *items, int num , int money, int petid, int searchtable, int petindex, int alchemist); +int ITEM_canDigest( ITEM_Item *t ); +int ITEM_mergeItem_merge( int charaindex,int petid, char *data, int petindex, int alchemist); + +#ifdef _ITEM_INSLAY +int PETSKILL_ITEM_inslay( int charindex, int inslayindex, int itemindex); +#endif + +#ifdef _PETSKILL_FIXITEM +int PETSKILL_ITEM_FixItem( int charindex, int fixindex, int *itemindex); +#endif + +#endif + + diff --git a/include/item_trade.h b/include/item_trade.h new file mode 100644 index 0000000..b389cdb --- /dev/null +++ b/include/item_trade.h @@ -0,0 +1,52 @@ +#ifndef __MAPTRADE_H__ +#define __MAPTRADE_H__ +#include "char.h" + +typedef struct tagMapTrade { + int masterindex; + int x; + int y; + int Ttime; + int Goodindex; + char Goodname[256]; +}MapTrade; + +#define TRADEMAP 1090 +#define TRADEXSIZE 4 +#define TRADEYSIZE 4 + +BOOL CHECKMAP_TRADE( int charindex, int floor, int x, int y); +int CHECKMAP_TRADEXY( int charindex, int floor, int x, int y); +BOOL MAP_TRADEDROP( int charindex, int itemindex,int floor, int x, int y); +BOOL MAP_TRADEPICKUP( int charindex, int itemindex, int floor, int x, int y, int flg); + +void InitMapTradeData( int index, int Stime); + +int TRADE_getMasterInt( int index); +int TRADE_getTimeInt( int index); +BOOL TRADE_setMasterInt( int index, int Num); +BOOL TRADE_setTimeInt( int index, int Num); +int TRADE_AddMasrerTrade( int toindex); //趨̯λ +int TRADE_getMaxNumInt(); +void MAPTRADE_CLEANGOLD( int floor, int num); +BOOL MAPTRADE_CHECKMASTERIN( int masterindex , int toindex, int num); +BOOL MAPTRADE_CHECKMAPFULL(int fl, int x, int y); +BOOL MAP_TRADEPETDROP( int charindex, int petindex,int floor, int x, int y); +int MAPTRADE_getItemSpace( int meindex, int itemindex); +int MAPTRADE_getPetSpace( int masterindex, int petindex); + +int MAPTRADE_getSellIndex( int index); +BOOL MAPTRADE_setSellIndex( int index, int num); +void MAPTRADE_setCharSellName( int index, char *buf); +char* MAPTRADE_getCharSellName( int index ); + +#define TRADESTARTNUM 1 +#define TRADETYPE_SELL (1<<3) +#define TRADEITEMID 0 +#define TRADEPETID 0 +#define TRADEPETUPLV ((1<<24)+(1<<16)+(1<<8)+1) +#define TRADEPETTYPE (1<<4) +#define TRADEITEMTYPE (1<<8) +#endif + + diff --git a/include/lapi.h b/include/lapi.h new file mode 100644 index 0000000..2c3fab2 --- /dev/null +++ b/include/lapi.h @@ -0,0 +1,16 @@ +/* +** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "lobject.h" + + +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); + +#endif diff --git a/include/lauxlib.h b/include/lauxlib.h new file mode 100644 index 0000000..3f17c2f --- /dev/null +++ b/include/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/include/lcode.h b/include/lcode.h new file mode 100644 index 0000000..b941c60 --- /dev/null +++ b/include/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/include/ldebug.h b/include/ldebug.h new file mode 100644 index 0000000..ba28a97 --- /dev/null +++ b/include/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/include/ldo.h b/include/ldo.h new file mode 100644 index 0000000..98fddac --- /dev/null +++ b/include/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/include/levelup.h b/include/levelup.h new file mode 100644 index 0000000..eb4b161 --- /dev/null +++ b/include/levelup.h @@ -0,0 +1,17 @@ +#ifndef _LEVELUP_H +#define _LEVELUP_H + +int GetEnemyExp( int level ); + +int BATTLE_GetLevelExp( + int charaindex, + int level +); + +int BATTLE_LevelUpCheck( + int charaindex +); + + +#endif + diff --git a/include/lfunc.h b/include/lfunc.h new file mode 100644 index 0000000..a68cf51 --- /dev/null +++ b/include/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/include/lgc.h b/include/lgc.h new file mode 100644 index 0000000..5a8dc60 --- /dev/null +++ b/include/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/include/link.h b/include/link.h new file mode 100644 index 0000000..f9f6ba2 --- /dev/null +++ b/include/link.h @@ -0,0 +1,22 @@ +#ifndef __LINK_H__ +#define __LINK_H__ + +#include "common.h" + +/* + * հë + * val 巴ئУ۹Ի̼ + * 浤 + */ +typedef struct tagNode +{ + struct tagNode* next; /*ݼá߼̼*/ + char* val; /* ٯ */ + int size; /*val*/ +}Node; + +BOOL Nodeappendhead( Node** top , Node* add ); +BOOL Nodeappendtail( Node** top , Node* add ); +BOOL Noderemovehead( Node** top , Node* ret); +BOOL Noderemovetail( Node** top , Node* ret); +#endif diff --git a/include/llex.h b/include/llex.h new file mode 100644 index 0000000..a9201ce --- /dev/null +++ b/include/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/include/llimits.h b/include/llimits.h new file mode 100644 index 0000000..ca8dcb7 --- /dev/null +++ b/include/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/include/lmem.h b/include/lmem.h new file mode 100644 index 0000000..7c2dcb3 --- /dev/null +++ b/include/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/include/lobject.h b/include/lobject.h new file mode 100644 index 0000000..f1e447e --- /dev/null +++ b/include/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/include/log.h b/include/log.h new file mode 100644 index 0000000..05ecd21 --- /dev/null +++ b/include/log.h @@ -0,0 +1,320 @@ +#ifndef __LOG_H__ +#define __LOG_H__ +#include +typedef enum +{ + LOG_TALK, + LOG_PROC, + LOG_ITEM, + LOG_STONE, + LOG_PET, + LOG_TENSEI, + LOG_KILL, //ttom 12/26/2000 kill the pet & items + LOG_TRADE, // CoolFish: 2001/4/19 + LOG_HACK, // Arminius 2001/6/14 + LOG_SPEED, // Nuke 0626 + LOG_FMPOP, // CoolFish: 2001/9/12 + LOG_FAMILY, // Robin 10/02 + LOG_GM, // Shan +#ifdef _GAMBLE_ROULETTE + LOG_GAMBLE, +#endif + + LOG_LOGIN, + PETTRANS, +//Syu ׯ԰սʤLog + LOG_FMPKRESULT, + +// Syu ADD дȡLog () + LOG_BANKSTONELOG, + + LOG_ACMESS, + LOG_PKCONTEND, +#ifdef _STREET_VENDOR + LOG_STREET_VENDOR, +#endif + +#ifdef _ANGEL_SUMMON + LOG_ANGEL, +#endif + +#ifdef _NEW_MANOR_LAW + LOG_FMPK_GETMONEY, + LOG_FM_FAME_SHOP, +#endif + LOG_LOGOUT, + + LOG_TYPE_NUM, +}LOG_TYPE; + +void closeAllLogFile( void ); +BOOL initLog( char* filename ); +void printl( LOG_TYPE logtype, char* format , ... ); + + +void LogAcMess( int fd, char *type, char *mess ); + +void LogItem( + char *CharName, /* ƽҷ */ + char *CharID, + int ItemNo, /* ʧ ة į */ + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + char *uniquecode, // shan 2001/12/14 + char *itemname, int itemID +); +void LogPkContend( char *teamname1, char *teamname2, + int floor, int x, int y, int flg ); + +void LogPetTrans( + char *cdkey, char *uniwuecde, char *uniwuecde2, char *CharName, int floor, int x, int y, + int petID1, char *PetName1, int petLV, int petrank, int vital1, int str1, int tgh1, int dex1, int total1, + int petID2, char *PetName2, int vital2, int str2, int tgh2, int dex2, int total2, + int work0, int work1, int work2, int work3, int ans, int trans +); + +void LogPet( + char *CharName, /* ƽҷ */ + char *CharID, + char *PetName, + int PetLv, + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + char *uniquecode // shan 2001/12/14 +); + +#ifdef _STREET_VENDOR +void LogStreetVendor( + char *SellName, + char *SellID, + char *BuyName, + char *BuyID, + char *ItemPetName, + int PetLv, //ǵߴֵΪ -1 + int iPrice, + char *Key, + int Sfloor, + int Sx, + int Sy, + int Bfloor, + int Bx, + int By, + char *uniquecode, + int streettype +); +#endif + +void LogTensei( + char *CharName, /* ƽҷ */ + char *CharID, + char *Key, /* ƽ */ + int level, //ì + int transNum, //Ϸ + int quest, //;޵ + int home, //컩 + int item, // ʧ ة Ի + int pet, // ʸ Ի + int vital, // Vital + int b_vital, // vital + int str, // str + int b_str, // str + int tgh, // + int b_tgh, // + int dex, // + int b_dex // +); +// Syu ADD дȡLog () +void LogFamilyBankStone( + char *CharName, + char *CharId, + int Gold, + int MyGold, + char *Key, + int floor, + int x, + int y, + int banksum +); + +void LogStone( + int TotalGold, + char *CharName, /* ƽҷ */ + char *CharId, /* ǡID */ + int Gold, /* ź */ + int MyGold, + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y +); + +void LogTalk( + char *CharName, /* ƽҷ */ + char *CharID, + int floor, /* */ + int x, + int y, + char *message +); +//ttom 12/26/2000 kill pet & items +void LogKill( + char *CharName, + char *CharId, + char *CharPet_Item +); +//ttom + +// CoolFish: 2001/4/19 +void LogTrade(char *message); +// CoolFish: 2001/9/12 +void LogFMPOP(char *message); + +// Arminius 2001/6/14 +enum +{ + HACK_NOTHING, + HACK_GETFUNCFAIL, + HACK_NOTDISPATCHED, + HACK_CHECKSUMERROR, + HACK_HP, + HACK_CDKEYWRONG, + HACK_TYPE_NUM, +}HACK_TYPE; +void logHack(int fd, int errcode); +void logHackKick(int fd); +// Nuke 0626 +void logSpeed(int fd); + +void closeAllLogFile( void ); +int openAllLogFile( void ); + +// Robin 10/02 +void LogFamily( + char *FMName, + int fmindex, + char *charName, + char *charId, + char *keyWord, + char *data +); + +// Shan 11/02 +void LogGM( + char *CharName, //ɫ + char *CharID, //ID + char *Message, //ָ + int floor, + int x, + int y +); + +void LogLogin( + char *CharID, //ID + char *CharName, //ɫ + int saveIndex, + char *ipadress,char *pcid +); +void LogLogout( + char *CharID, //ID + char *CharName, //ɫ + int floor, + int hp, + char *file, + int line +); +void LogCreatFUPet( + char *PetName, int petid, int lv, int hp, + int vital, int str, int tgh, int dex, + int fixstr, int fixtgh, int fixdex, int trans, int flg); + +#ifdef _GAMBLE_ROULETTE + +void LogGamble( + char *CharName, //ɫ + char *CharID, //ID + char *Key, //˵ + int floor, + int x, + int y, + int player_stone, //ӵнǮ + int Gamble_stone, //ע + int get_stone, // + int Gamble_num, + int flg //flg = 1 2 ׯ +); +#endif + +void LogBankStone( + char *CharName, /* ƽҷ */ + char *CharId, /* ǡID */ + int meindex, + int Gold, /* ź */ + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + int my_gold, + int my_personagold +); + +//Syu ׯ԰սʤLog +void Logfmpk( + char *winner, int winnerindex, int num1, + char *loser, int loserindex, int num2, char *date, char *buf1, char *buf2, int flg); + +#ifdef _NEW_MANOR_LAW +void LogFMPKGetMomey( + char *szFMName, + char *szID, + char *szCharName, + int iMomentum, + int iGetMoney, + int iDest +); +void LogFMFameShop( + char *szFMName, + char *szID, + char *szCharName, + int iFame, + int iCostFame +); +#endif + +void backupAllLogFile( struct tm *ptm ); + +void LogPetPointChange( + char * CharName, char *CharID, char *PetName, int petindex, int errtype, + int PetLv, char *Key,int floor, int x, int y); + +void LogPetFeed( + char * CharName, char *CharID, char *PetName, int petindex, + int PetLv, char *Key,int floor, int x, int y, char *ucode); + +#ifdef _ANGEL_SUMMON +void LogAngel( char *msg); +#endif +void Logfmpk_war(int dueltime,int mytime); +void warplog_to_file( void ); +void warplog_from_file( void ); + +typedef struct { + int floor; + int incount; + int outcount; +}tagWarplog; +#define MAXMAPNUM 700 +extern tagWarplog warplog[MAXMAPNUM]; + +typedef struct { + int floor1; + int floor2; + int count; +}tagWarpCount; +#define MAXMAPLINK 1000 +extern tagWarpCount warpCount[MAXMAPLINK]; + +#endif diff --git a/include/lopcodes.h b/include/lopcodes.h new file mode 100644 index 0000000..41224d6 --- /dev/null +++ b/include/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)< C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) =) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/include/lparser.h b/include/lparser.h new file mode 100644 index 0000000..18836af --- /dev/null +++ b/include/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/include/lssproto_serv.h b/include/lssproto_serv.h new file mode 100644 index 0000000..6daab59 --- /dev/null +++ b/include/lssproto_serv.h @@ -0,0 +1,400 @@ +#ifndef _PROTOCOL_H_ +#define _PROTOCOL_H_ + +#include "lssproto_util.h" // for StoneAge + +#ifdef MAXLSRPCARGS +#if ( MAXLSRPCARGS <= ( 13 + 1 ) ) +#undef MAXLSRPCARGS +#define MAXLSRPCARGS ( 13 + 1 ) +#endif +#else +#define MAXLSRPCARGS ( 13 + 1 ) +#endif + +int lssproto_InitServer(int (*writefunc)(int,char*,int) , int worksiz ); +void lssproto_SetServerLogFiles( char *read , char *write ); +void lssproto_CleanupServer( void ); +int lssproto_ServerDispatchMessage(int fd, char *encoded); +//int cdkeyinit(void); +#define SEPARATOR ";" + +#define LSSPROTO_W_RECV 0 +#define LSSPROTO_W2_RECV 1 +#define LSSPROTO_XYD_SEND 2 +#define LSSPROTO_EV_RECV 3 +#define LSSPROTO_EV_SEND 4 +#define LSSPROTO_EN_RECV 5 +#define LSSPROTO_DU_RECV 6 +#define LSSPROTO_EN_SEND 7 +#define LSSPROTO_EO_RECV 8 +#define LSSPROTO_BU_RECV 9 +#define LSSPROTO_JB_RECV 10 +#define LSSPROTO_LB_RECV 11 +#define LSSPROTO_RS_SEND 12 +#define LSSPROTO_RD_SEND 13 +#define LSSPROTO_B_RECV 14 +#define LSSPROTO_B_SEND 15 +#define LSSPROTO_SKD_RECV 16 +#define LSSPROTO_ID_RECV 17 +#define LSSPROTO_PI_RECV 18 +#define LSSPROTO_DI_RECV 19 +#define LSSPROTO_DG_RECV 20 +#define LSSPROTO_DP_RECV 21 +#define LSSPROTO_I_SEND 22 +#define LSSPROTO_MI_RECV 23 +#define LSSPROTO_SI_SEND 24 +#define LSSPROTO_MSG_RECV 25 +#define LSSPROTO_MSG_SEND 26 +#define LSSPROTO_PMSG_RECV 27 +#define LSSPROTO_PME_SEND 28 +#define LSSPROTO_AB_RECV 29 +#define LSSPROTO_AB_SEND 30 +#define LSSPROTO_ABI_SEND 31 +#define LSSPROTO_DAB_RECV 32 +#define LSSPROTO_AAB_RECV 33 +#define LSSPROTO_L_RECV 34 +#define LSSPROTO_TK_RECV 35 +#define LSSPROTO_TK_SEND 36 +#define LSSPROTO_MC_SEND 37 +#define LSSPROTO_M_RECV 38 +#define LSSPROTO_M_SEND 39 +#define LSSPROTO_C_RECV 40 +#define LSSPROTO_C_SEND 41 +#define LSSPROTO_CA_SEND 42 +#define LSSPROTO_CD_SEND 43 +#define LSSPROTO_R_SEND 44 +#define LSSPROTO_S_RECV 45 +#define LSSPROTO_S_SEND 46 +#define LSSPROTO_D_SEND 47 +#define LSSPROTO_FS_RECV 48 +#define LSSPROTO_FS_SEND 49 +#define LSSPROTO_HL_RECV 50 +#define LSSPROTO_HL_SEND 51 +#define LSSPROTO_PR_RECV 52 +#define LSSPROTO_PR_SEND 53 +#define LSSPROTO_KS_RECV 54 +#define LSSPROTO_KS_SEND 55 +#define LSSPROTO_AC_RECV 56 +#define LSSPROTO_MU_RECV 57 +#define LSSPROTO_PS_RECV 58 +#define LSSPROTO_PS_SEND 59 +#define LSSPROTO_ST_RECV 60 +#define LSSPROTO_DT_RECV 61 +#define LSSPROTO_FT_RECV 62 +#define LSSPROTO_SKUP_SEND 63 +#define LSSPROTO_SKUP_RECV 64 +#define LSSPROTO_KN_RECV 65 +#define LSSPROTO_WN_SEND 66 +#define LSSPROTO_WN_RECV 67 +#define LSSPROTO_EF_SEND 68 +#define LSSPROTO_SE_SEND 69 +#define LSSPROTO_SP_RECV 70 +#define LSSPROTO_CLIENTLOGIN_RECV 71 +#define LSSPROTO_CLIENTLOGIN_SEND 72 +#define LSSPROTO_CREATENEWCHAR_RECV 73 +#define LSSPROTO_CREATENEWCHAR_SEND 74 +#define LSSPROTO_CHARDELETE_RECV 75 +#define LSSPROTO_CHARDELETE_SEND 76 +#define LSSPROTO_CHARLOGIN_RECV 77 +#define LSSPROTO_CHARLOGIN_SEND 78 +#define LSSPROTO_CHARLIST_RECV 79 +#define LSSPROTO_CHARLIST_SEND 80 +#define LSSPROTO_CHARLOGOUT_RECV 81 +#define LSSPROTO_CHARLOGOUT_SEND 82 +#define LSSPROTO_PROCGET_RECV 83 +#define LSSPROTO_PROCGET_SEND 84 +#define LSSPROTO_PLAYERNUMGET_RECV 85 +#define LSSPROTO_PLAYERNUMGET_SEND 86 +#define LSSPROTO_ECHO_RECV 87 +#define LSSPROTO_ECHO_SEND 88 +#define LSSPROTO_SHUTDOWN_RECV 89 +#define LSSPROTO_NU_SEND 90 +#define LSSPROTO_TD_RECV 91 +#define LSSPROTO_TD_SEND 92 +#define LSSPROTO_FM_SEND 93 +#define LSSPROTO_FM_RECV 94 +#define LSSPROTO_WO_SEND 95 +#define LSSPROTO_PETST_RECV 96 + +#ifdef _MIND_ICON +#define LSSPROTO_MA_RECV 98 +#endif + +#ifdef _ITEM_CRACKER +#define LSSPROTO_IC_SEND 100 +#endif + +#ifdef _MAGIC_NOCAST // :Ĭ +#define LSSPROTO_NC_SEND 101 +#endif + +#ifdef _TEAM_KICKPARTY +#define LSSPROTO_KTEAM_RECV 106 +#endif +#ifdef _PETS_SELECTCON +#define LSSPROTO_PETST_SEND 107 +#endif +#ifdef _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ +#define LSSPROTO_RESIST_RECV 108 +#define LSSPROTO_RESIST_SEND 109 +#endif +#ifdef _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol +#define LSSPROTO_BATTLESKILL_RECV 110 +#define LSSPROTO_BATTLESKILL_SEND 111 +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +#define LSSPROTO_CHATROOM_RECV 112 +#define LSSPROTO_CHATROOM_SEND 113 +#endif + +#define LSSPROTO_SPET_RECV 114 // Robin +#define LSSPROTO_SPET_SEND 115 + +#ifdef _STREET_VENDOR +#define LSSPROTO_STREET_VENDOR_RECV 116 // ̯ +#define LSSPROTO_STREET_VENDOR_SEND 117 +#endif + +#ifdef _RIGHTCLICK +#define LSSPROTO_RCLICK_RECV 118 +#define LSSPROTO_RCLICK_SEND 119 +#endif + +#ifdef _JOBDAILY +#define LSSPROTO_JOBDAILY_SEND 120 // CYG־ +#define LSSPROTO_JOBDAILY_RECV 121 +#endif + +#ifdef _TEACHER_SYSTEM +#define LSSPROTO_TEACHER_SYSTEM_RECV 122 // ʦ +#define LSSPROTO_TEACHER_SYSTEM_SEND 123 +#endif + +#ifdef _ADD_STATUS_2 +#define LSSPROTO_S2_RECV 124 +#define LSSPROTO_S2_SEND 125 +#endif + +#ifdef _PET_ITEM +#define LSSPROTO_PET_ITEM_RECV 127 +#endif + +#ifdef _ONLINE_SHOP +#define LSSPROTO_SHOP_RECV 140 +#define LSSPROTO_SHOP_SEND 141 + +#define LSSPROTO_SHOPBUY_RECV 143 +#endif + +#ifdef _CAX_LNS_MAPSUOXU +#define LSSPROTO_UPMAP 145 +#endif + +#ifdef _CAX_DENGON_GG +#define LSSPROTO_DENGON_SEND 200 +#endif + +#ifdef _CAX_ESC_FENGBAO +#define LSSPROTO_ESC_RECV 202 //ESCť +#endif + +void lssproto_W_recv(int fd,int x,int y,char* direction); +void lssproto_W2_recv(int fd,int x,int y,char* direction); +void lssproto_XYD_send(int fd,int x,int y,int dir); +void lssproto_EV_recv(int fd,int event,int seqno,int x,int y,int dir); +void lssproto_EV_send(int fd,int seqno,int result); +void lssproto_EN_recv(int fd,int x,int y); +void lssproto_DU_recv(int fd,int x,int y); +void lssproto_EN_send(int fd,int result,int field); +void lssproto_EO_recv(int fd,int dummy); +void lssproto_BU_recv(int fd,int dummy); +void lssproto_JB_recv(int fd,int x,int y); +void lssproto_LB_recv(int fd,int x,int y); +void lssproto_RS_send(int fd,char* data); +void lssproto_RD_send(int fd,char* data); +void lssproto_B_recv(int fd,char* command); +void lssproto_B_send(int fd,char* command); +void lssproto_SKD_recv(int fd,int dir,int index); +void lssproto_ID_recv(int fd,int x,int y,int haveitemindex,int toindex); +void lssproto_PI_recv(int fd,int x,int y,int dir); +void lssproto_DI_recv(int fd,int x,int y,int itemindex); +void lssproto_DG_recv(int fd,int x,int y,int amount); +void lssproto_DP_recv(int fd,int x,int y,int petindex); +void lssproto_I_send(int fd,char* data); +void lssproto_MI_recv(int fd,int fromindex,int toindex); +void lssproto_SI_send(int fd,int fromindex,int toindex); +void lssproto_MSG_recv(int fd,int index,char* message,int color); +void lssproto_MSG_send(int fd,int aindex,char* text,int color); +void lssproto_PMSG_recv(int fd,int index,int petindex,int itemindex,char* message,int color); +void lssproto_PME_send(int fd,int objindex,int graphicsno,int x,int y,int dir,int flg,int no,char* cdata); +void lssproto_AB_recv(int fd); +void lssproto_AB_send(int fd,char* data); +void lssproto_ABI_send(int fd,int num,char* data); +void lssproto_DAB_recv(int fd,int index); +void lssproto_AAB_recv(int fd,int x,int y); +void lssproto_L_recv(int fd,int dir); +void lssproto_TK_recv(int fd,int x,int y,char* message,int color,int area); +void lssproto_TK_send(int fd,int index,char* message,int color); +void lssproto_MC_send(int fd,int fl,int x1,int y1,int x2,int y2,int tilesum,int objsum,int eventsum,char* data); +void lssproto_M_recv(int fd,int fl,int x1,int y1,int x2,int y2); +void lssproto_M_send(int fd,int fl,int x1,int y1,int x2,int y2,char* data); +void lssproto_C_recv(int fd,int index); +void lssproto_C_send(int fd,char* data); +void lssproto_CA_send(int fd,char* data); +void lssproto_CD_send(int fd,char* data); +void lssproto_R_send(int fd,char* data); +void lssproto_S_recv(int fd,char* category); +void lssproto_S_send(int fd,char* data); +void lssproto_D_send(int fd,int category,int dx,int dy,char* data); +void lssproto_FS_recv(int fd,int flg); +void lssproto_FS_send(int fd,int flg); +void lssproto_HL_recv(int fd,int flg); +void lssproto_HL_send(int fd,int flg); +void lssproto_PR_recv(int fd,int x,int y,int request); +void lssproto_PR_send(int fd,int request,int result); +void lssproto_KS_recv(int fd,int petarray); +void lssproto_KS_send(int fd,int petarray,int result); + +#ifdef _STANDBYPET +void lssproto_SPET_recv(int fd,int standbypet); +void lssproto_SPET_send(int fd,int standbypet,int result); +#endif + +void lssproto_AC_recv(int fd,int x,int y,int actionno); +void lssproto_MU_recv(int fd,int x,int y,int array,int toindex); +void lssproto_PS_recv(int fd,int havepetindex,int havepetskill,int toindex,char* data); +void lssproto_PS_send(int fd,int result,int havepetindex,int havepetskill,int toindex); +void lssproto_ST_recv(int fd,int titleindex); +void lssproto_DT_recv(int fd,int titleindex); +void lssproto_FT_recv(int fd,char* data); +void lssproto_SKUP_send(int fd,int point); +void lssproto_SKUP_recv(int fd,int skillid); +void lssproto_KN_recv(int fd,int havepetindex,char* data); +void lssproto_WN_send(int fd,int windowtype,int buttontype,int seqno,int objindex,char* data); +void lssproto_WN_recv(int fd,int x,int y,int seqno,int objindex,int select,char* data); +void lssproto_EF_send(int fd,int effect,int level,char* option); +void lssproto_SE_send(int fd,int x,int y,int senumber,int sw); +void lssproto_SP_recv(int fd,int x,int y,int dir); +void lssproto_ClientLogin_recv(int fd,char* cdkey,char* passwd); +void lssproto_ClientLogin_send(int fd,char* result); +void lssproto_CreateNewChar_recv(int fd,int dataplacenum,char* charname,int imgno,int faceimgno,int vital,int str,int tgh,int dex,int earth,int water,int fire,int wind,int hometown); +void lssproto_CreateNewChar_send(int fd,char* result,char* data); +void lssproto_CharDelete_recv( int fd , char* charname,char* safepass); +void lssproto_CharDelete_send(int fd,char* result,char* data); +void lssproto_CharLogin_recv(int fd,char* charname); +void lssproto_CharLogin_send(int fd,char* result,char* data); + +#ifdef _PKSEVER_VER +void lssproto_CharList_recv( int fd, int star); +#else +void lssproto_CharList_recv(int fd); +#endif + +void lssproto_CharList_send(int fd,char* result,char* data); +void lssproto_CharLogout_recv(int fd, int flg); +void lssproto_CharLogout_send(int fd,char* result,char* data); +void lssproto_ProcGet_recv(int fd); +void lssproto_ProcGet_send(int fd,char* data); +void lssproto_PlayerNumGet_recv(int fd); +void lssproto_PlayerNumGet_send(int fd,int logincount,int player); +void lssproto_Echo_recv(int fd,char* test); +void lssproto_Echo_send(int fd,char* test); +void lssproto_Shutdown_recv(int fd,char* passwd,int min); + +void lssproto_TD_send(int fd, int index, char* message); +void lssproto_TD_recv(int fd, char* message); + +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +void lssproto_CHATROOM_recv(int fd , char *data) ; +void lssproto_CHATROOM_send(int fd , char* message ) ; +#endif + +#ifdef _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ +void lssproto_RESIST_recv(int fd ) ; +void lssproto_RESIST_send(int fd , char* message ) ; +#endif +#ifdef _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol +void lssproto_BATTLESKILL_recv(int fd, int iNum) ; +void lssproto_BATTLESKILL_send(int fd , char* message ) ; +#endif + +void lssproto_NU_send(int fd, int nu); + +void lssproto_FM_send(int fd, char* message); +void lssproto_FM_recv(int fd, char* message); + +void lssproto_WO_send(int fd,int effect); +void lssproto_PETST_recv( int fd, int nPet, int sPet); +void lssproto_BM_recv(int fd, int iindex); + +#ifdef _MIND_ICON +void lssproto_MA_recv(int fd, int x, int y, int nMind); +#endif + +#ifdef _ITEM_CRACKER +void lssproto_IC_send(int fd, int x, int y); +#endif + +#ifdef _ITEM_CRACKER +void lssproto_NC_send(int fd,int flg); +#endif + +#ifdef _TEAM_KICKPARTY +void lssproto_KTEAM_recv( int fd, int si); +#endif + +#ifdef _PETS_SELECTCON +void lssproto_PETS_send(int fd,int petarray,int result); +//#define LSSPROTO_PETST_SEND 107 +#endif + +#ifdef _STREET_VENDOR +void lssproto_STREET_VENDOR_recv(int fd,char *message); +void lssproto_STREET_VENDOR_send(int fd,char *message); +#endif + +#ifdef _RCLICK +void lssproto_RCLICK_recv(int fd, int type, char* data); +void lssproto_RCLICK_send(int fd, int type, char* data); +#endif + +#ifdef _JOBDAILY +void lssproto_JOBDAILY_recv(int fd,char *data); +void lssproto_JOBDAILY_send(int fd,char *data); +#endif + +#ifdef _TEACHER_SYSTEM +void lssproto_TEACHER_SYSTEM_recv(int fd,char *data); +void lssproto_TEACHER_SYSTEM_send(int fd,char *data); +#endif + +#ifdef _ADD_STATUS_2 +void lssproto_S2_recv(int fd,char *data); +void lssproto_S2_send(int fd,char *data); +#endif + +#ifdef _PET_ITEM +void lssproto_PETITEM_recv( int fd,int x,int y,int petindex,int fromindex,int toindex ); +#endif + +#ifdef _ONLINE_SHOP +void lssproto_SHOP_recv(int fd,int shopflag,int piece); +void lssproto_SHOP_send(int fd,int shopnum,int vippoint,int piece,int pieces,int shopflag,char* res); +void lssproto_SHOPBUY_recv(int fd,int shopflag,int piece,int shopno,int buynum); +#endif +void lssproto_ClientLoginJqm_recv( int fd,char* cdkey, char* passwd, char* jqm +#ifdef _CAX_NEWMAC_LOGIN + , char*mac +#endif +#ifdef _MO_LOGINCHECK +,char* szdata +#endif + ); +#endif + +#ifdef _CAX_DENGON_GG +void lssproto_DENGON_send(int fd, char *data, int color, int num); +#endif + +void lssproto_Upmap_send(int fd,int formmap,int tomap); diff --git a/include/lssproto_util.h b/include/lssproto_util.h new file mode 100644 index 0000000..c06730c --- /dev/null +++ b/include/lssproto_util.h @@ -0,0 +1,110 @@ +#ifndef _LSSPROTOUTIL_H_ +#define _LSSPROTOUTIL_H_ +#include +#include +#ifndef WIN32 +#include +#include +#endif +//#define lssproto__ENCRYPT +#define lssproto__NODEBUG +struct lssproto_ { + int (*write_func)(int,char*,int) ; /* write function */ + size_t workbufsize; /* size of work area */ + char *work,*arraywork,*escapework,*val_str,*ret_work; /* work areas which have same size */ + char *cryptwork,*jencodecopy,*jencodeout,*compresswork; /* these work has bigger size (3times)*/ + char** token_list; /* token list */ + unsigned long message_id; /*= 1, */ /* for generating message IDs */ +}; +#ifdef _LSSPROTOUTIL_C_ +struct lssproto_ lssproto = { + NULL, + 0, + NULL,NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL, + NULL, + 1, +}; +char **lssproto_stringwrapper; +char lssproto_readlogfilename[1024]; +char lssproto_writelogfilename[1024]; +#else +extern char **lssproto_stringwrapper; +extern struct lssproto_ lssproto; +extern char lssproto_readlogfilename[1024]; +extern char lssproto_writelogfilename[1024]; +#endif + +char* lssproto_escapeString( char*a ); +char* lssproto_descapeString( char*a ); +void lssproto_splitString( char *src ); +void lssproto_strcpysafe( char *dest, char *src, int len ); +void lssproto_strcatsafe( char *dest , char *src , int maxlen ); +char*lssproto_mkstr_int( int i ); +char*lssproto_mkstr_u_int( unsigned int i ); +char*lssproto_mkstr_long( long l ); +char*lssproto_mkstr_u_long( unsigned long l ); +char*lssproto_mkstr_short( short s ); +char*lssproto_mkstr_u_short( short s ); +char*lssproto_mkstr_char( char c ); +char*lssproto_mkstr_u_char( char c); +char*lssproto_mkstr_string( char*a ); +char*lssproto_mkstr_float( float f ); +char*lssproto_mkstr_double( double d ); +char*lssproto_mkstr_int_array( int size , int *array ); +char*lssproto_mkstr_u_int_array( int size , int *array ); +char*lssproto_mkstr_short_array( int size , short *array ); +char*lssproto_mkstr_u_short_array(int size , short *array ); +char *lssproto_mkstr_char_array( int size , char *array ); +char *lssproto_mkstr_u_char_array( int size , unsigned char *array ); +char *lssproto_mkstr_float_array( int size , float *array ); +char *lssproto_mkstr_double_array( int size , double *array ); +int lssproto_demkstr_int( char*a ); +unsigned int lssproto_demkstr_u_int( char*a ); +long lssproto_demkstr_long( char*a ); +unsigned long lssproto_demkstr_u_long(char*a ); +short lssproto_demkstr_short( char*a ); +unsigned short lssproto_demkstr_u_short( char*a ); +char lssproto_demkstr_char( char*a ); +unsigned char lssproto_demkstr_u_char( char*a ); +float lssproto_demkstr_float( char*a ); +double lssproto_demkstr_double(char*a ); +char* lssproto_demkstr_string( char*a); +int *lssproto_demkstr_int_array( char**tk ,int *buf ,int start , int size ); +int *lssproto_demkstr_u_int_array( char **tk , int *buf , int start , int size ); +unsigned int *lssproto_demkstr_long_array( + char **tk , unsigned int *buf , int start , int size ); +unsigned long *lssproto_demkstr_u_long_array( + char **tk , unsigned long *buf , int start , int size ); +short *lssproto_demkstr_short_array( char **tk , short *buf , int start , int size ); +unsigned short*lssproto_demkstr_u_short_array( + char **tk , unsigned short *buf , int start , int size ); +char *lssproto_demkstr_char_array( char **tk , char *buf , int start , int size ); +unsigned char *lssproto_demkstr_u_char_array( + char **tk , unsigned char*buf , int start , int size ); +float *lssproto_demkstr_float_array( char **tk , float *buf , int start , int size ); +double *lssproto_demkstr_u_double_array( char **tk , double *buf , int start , int size ); +char *lssproto_wrapStringAddr( char *copy , int maxcopylen , char*src ); + +void lssproto_GetMessageInfo( int *id , char *funcname , int len,char **tk ); +int lssproto_ClientRead(void); +void lssproto_consumeLine(char *buf , int ofs ); +void lssproto_copyLine( char*src , char *out , int maxoutlen ); +void lssproto_Send( int fd , char *msg ); +int lssproto_AllocateCommonWork(int bufsiz); +unsigned int lssproto_GetNewMessageID(void); +void lssproto_CreateHeader(char*out, char *fname ); +void lssproto_CreateHeaderID( char *out,unsigned long msgid , char *fname ); +int lssproto_default_write_wrap( int fd , char *buf , int size ); +void lssproto_bzero( char *b , int siz ); +void lssproto_bcopy(char*s , char *d , int siz ); +char *lssproto_Ltoa( long v ); +char *lssproto_Ultoa( unsigned long v ); +void lssproto_DebugSend( int fd , char *msg ); +/* Modified by ringo to fasten int type transfer */ +char *lssproto_cnv10to62( int a, char *out, int outlen ); +int lssproto_a62toi( char *a ); +extern int JENCODE_KEY; +#endif + + diff --git a/include/lstate.h b/include/lstate.h new file mode 100644 index 0000000..3bc575b --- /dev/null +++ b/include/lstate.h @@ -0,0 +1,169 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/include/lstring.h b/include/lstring.h new file mode 100644 index 0000000..73a2ff8 --- /dev/null +++ b/include/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/include/ltable.h b/include/ltable.h new file mode 100644 index 0000000..f5b9d5e --- /dev/null +++ b/include/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/include/ltm.h b/include/ltm.h new file mode 100644 index 0000000..64343b7 --- /dev/null +++ b/include/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/include/lua.h b/include/lua.h new file mode 100644 index 0000000..e4bdfd3 --- /dev/null +++ b/include/lua.h @@ -0,0 +1,388 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/include/lua/Makefile b/include/lua/Makefile new file mode 100644 index 0000000..5518ad8 --- /dev/null +++ b/include/lua/Makefile @@ -0,0 +1,182 @@ +# makefile for building Lua +# see ../INSTALL for installation instructions +# see ../Makefile and luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +CC= gcc +CFLAGS=-w -O3 -rdynamic $(INCFLAGS) +AR= ar rcu +RANLIB= ranlib +RM= rm -f +LIBS= -lm $(MYLIBS) + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ + lstrlib.o loadlib.o linit.o + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o print.o + +ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(CORE_O) $(LIB_O) + $(AR) $@ $? + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c print.c + +echo: + @echo "PLAT = $(PLAT)" + @echo "CC = $(CC)" + @echo "CFLAGS = $(CFLAGS)" + @echo "AR = $(AR)" + @echo "RANLIB = $(RANLIB)" + @echo "RM = $(RM)" + @echo "MYCFLAGS = $(MYCFLAGS)" + @echo "MYLDFLAGS = $(MYLDFLAGS)" + @echo "MYLIBS = $(MYLIBS)" + +# convenience targets for popular platforms + +none: + @echo "Please choose a platform:" + @echo " $(PLATS)" + +aix: + $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" + +ansi: + $(MAKE) all MYCFLAGS=-DLUA_ANSI + +bsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" + +freebsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" + +generic: + $(MAKE) all MYCFLAGS= + +linux: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" + +macosx: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" +# use this on Mac OS X 10.3- +# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX + +mingw: + $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX + +solaris: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ + lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ + lundump.h lvm.h +lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ + ltable.h +ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ + llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ + ltable.h lundump.h lvm.h +ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ + lstate.h ltm.h lzio.h +lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h +lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h +loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h +lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h +lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ + ltm.h lzio.h lstring.h lgc.h +lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h +ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ + lmem.h lstring.h lgc.h ltable.h +lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ + lundump.h +lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h +lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h +lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ + lzio.h +print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h lopcodes.h lundump.h + +# (end of Makefile) diff --git a/include/lua/lapi.c b/include/lua/lapi.c new file mode 100644 index 0000000..5d5145d --- /dev/null +++ b/include/lua/lapi.c @@ -0,0 +1,1087 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + diff --git a/include/lua/lapi.h b/include/lua/lapi.h new file mode 100644 index 0000000..2c3fab2 --- /dev/null +++ b/include/lua/lapi.h @@ -0,0 +1,16 @@ +/* +** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Lua API +** See Copyright Notice in lua.h +*/ + +#ifndef lapi_h +#define lapi_h + + +#include "lobject.h" + + +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); + +#endif diff --git a/include/lua/lauxlib.c b/include/lua/lauxlib.c new file mode 100644 index 0000000..10f14e2 --- /dev/null +++ b/include/lua/lauxlib.c @@ -0,0 +1,652 @@ +/* +** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include +#include + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; ifunc, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/include/lua/lauxlib.h b/include/lua/lauxlib.h new file mode 100644 index 0000000..3f17c2f --- /dev/null +++ b/include/lua/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/include/lua/lbaselib.c b/include/lua/lbaselib.c new file mode 100644 index 0000000..2a4c079 --- /dev/null +++ b/include/lua/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include +#include +#include +#include + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/include/lua/lcode.c b/include/lua/lcode.c new file mode 100644 index 0000000..cff626b --- /dev/null +++ b/include/lua/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/include/lua/lcode.h b/include/lua/lcode.h new file mode 100644 index 0000000..b941c60 --- /dev/null +++ b/include/lua/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/include/lua/ldblib.c b/include/lua/ldblib.c new file mode 100644 index 0000000..67de122 --- /dev/null +++ b/include/lua/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/include/lua/ldebug.c b/include/lua/ldebug.c new file mode 100644 index 0000000..50ad3d3 --- /dev/null +++ b/include/lua/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; il.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/include/lua/ldebug.h b/include/lua/ldebug.h new file mode 100644 index 0000000..ba28a97 --- /dev/null +++ b/include/lua/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/include/lua/ldo.c b/include/lua/ldo.c new file mode 100644 index 0000000..8de05f7 --- /dev/null +++ b/include/lua/ldo.c @@ -0,0 +1,518 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; itop - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; itop++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/include/lua/ldo.h b/include/lua/ldo.h new file mode 100644 index 0000000..98fddac --- /dev/null +++ b/include/lua/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/include/lua/ldump.c b/include/lua/ldump.c new file mode 100644 index 0000000..c9d3d48 --- /dev/null +++ b/include/lua/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; ik[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; ip[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; ilocvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; iupvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/include/lua/lfunc.c b/include/lua/lfunc.c new file mode 100644 index 0000000..813e88f --- /dev/null +++ b/include/lua/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/include/lua/lfunc.h b/include/lua/lfunc.h new file mode 100644 index 0000000..a68cf51 --- /dev/null +++ b/include/lua/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/include/lua/lgc.c b/include/lua/lgc.c new file mode 100644 index 0000000..d9e0b78 --- /dev/null +++ b/include/lua/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; isizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; isizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; isizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; isizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; ic.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; il.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; imt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/include/lua/lgc.h b/include/lua/lgc.h new file mode 100644 index 0000000..5a8dc60 --- /dev/null +++ b/include/lua/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/include/lua/linit.c b/include/lua/linit.c new file mode 100644 index 0000000..c1f90df --- /dev/null +++ b/include/lua/linit.c @@ -0,0 +1,38 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/include/lua/liolib.c b/include/lua/liolib.c new file mode 100644 index 0000000..e79ed1c --- /dev/null +++ b/include/lua/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/include/lua/llex.c b/include/lua/llex.c new file mode 100644 index 0000000..6dc3193 --- /dev/null +++ b/include/lua/llex.c @@ -0,0 +1,461 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "", "", "", "", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + struct lconv *cv = localeconv(); + char old = ls->decpoint; + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/include/lua/llex.h b/include/lua/llex.h new file mode 100644 index 0000000..a9201ce --- /dev/null +++ b/include/lua/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/include/lua/llimits.h b/include/lua/llimits.h new file mode 100644 index 0000000..ca8dcb7 --- /dev/null +++ b/include/lua/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/include/lua/lmathlib.c b/include/lua/lmathlib.c new file mode 100644 index 0000000..441fbf7 --- /dev/null +++ b/include/lua/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include +#include + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/include/lua/lmem.c b/include/lua/lmem.c new file mode 100644 index 0000000..ae7d8c9 --- /dev/null +++ b/include/lua/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/include/lua/lmem.h b/include/lua/lmem.h new file mode 100644 index 0000000..7c2dcb3 --- /dev/null +++ b/include/lua/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/include/lua/loadlib.c b/include/lua/loadlib.c new file mode 100644 index 0000000..cbcaf9d --- /dev/null +++ b/include/lua/loadlib.c @@ -0,0 +1,667 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include +#include +#include + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/include/lua/lobject.c b/include/lua/lobject.c new file mode 100644 index 0000000..4ff5073 --- /dev/null +++ b/include/lua/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include +#include + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/include/lua/lobject.h b/include/lua/lobject.h new file mode 100644 index 0000000..f1e447e --- /dev/null +++ b/include/lua/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/include/lua/lopcodes.c b/include/lua/lopcodes.c new file mode 100644 index 0000000..4cc7452 --- /dev/null +++ b/include/lua/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/include/lua/lopcodes.h b/include/lua/lopcodes.h new file mode 100644 index 0000000..41224d6 --- /dev/null +++ b/include/lua/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)< C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) =) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/include/lua/loslib.c b/include/lua/loslib.c new file mode 100644 index 0000000..da06a57 --- /dev/null +++ b/include/lua/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/include/lua/lparser.c b/include/lua/lparser.c new file mode 100644 index 0000000..1e2a9a8 --- /dev/null +++ b/include/lua/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; inups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; if->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/include/lua/lparser.h b/include/lua/lparser.h new file mode 100644 index 0000000..18836af --- /dev/null +++ b/include/lua/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/include/lua/lstate.c b/include/lua/lstate.c new file mode 100644 index 0000000..4313b83 --- /dev/null +++ b/include/lua/lstate.c @@ -0,0 +1,214 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; imt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/include/lua/lstate.h b/include/lua/lstate.h new file mode 100644 index 0000000..3bc575b --- /dev/null +++ b/include/lua/lstate.h @@ -0,0 +1,169 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/include/lua/lstring.c b/include/lua/lstring.c new file mode 100644 index 0000000..4911315 --- /dev/null +++ b/include/lua/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; isize; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/include/lua/lstring.h b/include/lua/lstring.h new file mode 100644 index 0000000..73a2ff8 --- /dev/null +++ b/include/lua/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/include/lua/lstrlib.c b/include/lua/lstrlib.c new file mode 100644 index 0000000..1b4763d --- /dev/null +++ b/include/lua/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (ssrc_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = ssrc_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/include/lua/ltable.c b/include/lua/ltable.c new file mode 100644 index 0000000..ec84f4f --- /dev/null +++ b/include/lua/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; ilsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/include/lua/ltable.h b/include/lua/ltable.h new file mode 100644 index 0000000..f5b9d5e --- /dev/null +++ b/include/lua/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/include/lua/ltablib.c b/include/lua/ltablib.c new file mode 100644 index 0000000..b6d9cb4 --- /dev/null +++ b/include/lua/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/include/lua/ltm.h b/include/lua/ltm.h new file mode 100644 index 0000000..64343b7 --- /dev/null +++ b/include/lua/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/include/lua/lua.c b/include/lua/lua.c new file mode 100644 index 0000000..c28c8c0 --- /dev/null +++ b/include/lua/lua.c @@ -0,0 +1,391 @@ +/* +** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lua_c + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (void) { + fprintf(stderr, + "usage: %s [options] [script [args]].\n" + "Available options are:\n" + " -e stat execute string " LUA_QL("stat") "\n" + " -l name require library " LUA_QL("name") "\n" + " -i enter interactive mode after executing " LUA_QL("script") "\n" + " -v show version information\n" + " -- stop handling options\n" + " - execute stdin and stop handling options\n" + , + progname); + fflush(stderr); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +static void print_version (void) { + l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); +} + + +static int getargs (lua_State *L, char **argv, int n) { + int narg; + int i; + int argc = 0; + while (argv[argc]) argc++; /* count total number of arguments */ + narg = argc - (n + 1); /* number of arguments to the script */ + luaL_checkstack(L, narg + 3, "too many arguments to script"); + for (i=n+1; i < argc; i++) + lua_pushstring(L, argv[i]); + lua_createtable(L, narg, n + 1); + for (i=0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - n); + } + return narg; +} + + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dolibrary (lua_State *L, const char *name) { + lua_getglobal(L, "require"); + lua_pushstring(L, name); + return report(L, docall(L, 1, 1)); +} + + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); + if (strstr(msg, LUA_QL("")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} + + +static int handle_script (lua_State *L, char **argv, int n) { + int status; + const char *fname; + int narg = getargs(L, argv, n); /* collect arguments */ + lua_setglobal(L, "arg"); + fname = argv[n]; + if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + lua_insert(L, -(narg+1)); + if (status == 0) + status = docall(L, narg, 0); + else + lua_pop(L, narg); + return report(L, status); +} + + +/* check that argument has no extra characters at the end */ +#define notail(x) {if ((x)[2] != '\0') return -1;} + + +static int collectargs (char **argv, int *pi, int *pv, int *pe) { + int i; + for (i = 1; argv[i] != NULL; i++) { + if (argv[i][0] != '-') /* not an option? */ + return i; + switch (argv[i][1]) { /* option */ + case '-': + notail(argv[i]); + return (argv[i+1] != NULL ? i+1 : 0); + case '\0': + return i; + case 'i': + notail(argv[i]); + *pi = 1; /* go through */ + case 'v': + notail(argv[i]); + *pv = 1; + break; + case 'e': + *pe = 1; /* go through */ + case 'l': + if (argv[i][2] == '\0') { + i++; + if (argv[i] == NULL) return -1; + } + break; + default: return -1; /* invalid option */ + } + } + return 0; +} + + +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + if (argv[i] == NULL) continue; + lua_assert(argv[i][0] == '-'); + switch (argv[i][1]) { /* option */ + case 'e': { + const char *chunk = argv[i] + 2; + if (*chunk == '\0') chunk = argv[++i]; + lua_assert(chunk != NULL); + if (dostring(L, chunk, "=(command line)") != 0) + return 1; + break; + } + case 'l': { + const char *filename = argv[i] + 2; + if (*filename == '\0') filename = argv[++i]; + lua_assert(filename != NULL); + if (dolibrary(L, filename)) + return 1; /* stop if file fails */ + break; + } + default: break; + } + } + return 0; +} + + +static int handle_luainit (lua_State *L) { + const char *init = getenv(LUA_INIT); + if (init == NULL) return 0; /* status OK */ + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, "=" LUA_INIT); +} + + +struct Smain { + int argc; + char **argv; + int status; +}; + + +static int pmain (lua_State *L) { + struct Smain *s = (struct Smain *)lua_touserdata(L, 1); + char **argv = s->argv; + int script; + int has_i = 0, has_v = 0, has_e = 0; + globalL = L; + if (argv[0] && argv[0][0]) progname = argv[0]; + lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(L); /* open libraries */ + lua_gc(L, LUA_GCRESTART, 0); + s->status = handle_luainit(L); + if (s->status != 0) return 0; + script = collectargs(argv, &has_i, &has_v, &has_e); + if (script < 0) { /* invalid args? */ + print_usage(); + s->status = 1; + return 0; + } + if (has_v) print_version(); + s->status = runargs(L, argv, (script > 0) ? script : s->argc); + if (s->status != 0) return 0; + if (script) + s->status = handle_script(L, argv, script); + if (s->status != 0) return 0; + if (has_i) + dotty(L); + else if (script == 0 && !has_e && !has_v) { + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } + else dofile(L, NULL); /* executes stdin as a file */ + } + return 0; +} + +int main (int argc, char **argv) { + int status; + struct Smain s; + lua_State *L = lua_open(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + s.argc = argc; + s.argv = argv; + status = lua_cpcall(L, &pmain, &s); + report(L, status); + lua_close(L); + return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; +} + diff --git a/include/lua/lua.h b/include/lua/lua.h new file mode 100644 index 0000000..e4bdfd3 --- /dev/null +++ b/include/lua/lua.h @@ -0,0 +1,388 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/include/lua/luac.c b/include/lua/luac.c new file mode 100644 index 0000000..d070173 --- /dev/null +++ b/include/lua/luac.c @@ -0,0 +1,200 @@ +/* +** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $ +** Lua compiler (saves bytecodes to files; also list bytecodes) +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include + +#define luac_c +#define LUA_CORE + +#include "lua.h" +#include "lauxlib.h" + +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstring.h" +#include "lundump.h" + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames].\n" + "Available options are:\n" + " - process stdin\n" + " -l list\n" + " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n", + progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop+(i))->l.p) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + int i,pc; + Proto* f=luaF_newproto(L); + setptvalue2s(L,L->top,f); incr_top(L); + f->source=luaS_newliteral(L,"=(" PROGNAME ")"); + f->maxstacksize=1; + pc=2*n+1; + f->code=luaM_newvector(L,pc,Instruction); + f->sizecode=pc; + f->p=luaM_newvector(L,n,Proto*); + f->sizep=n; + pc=0; + for (i=0; ip[i]=toproto(L,i-n-1); + f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i); + f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1); + } + f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0); + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +struct Smain { + int argc; + char** argv; +}; + +static int pmain(lua_State* L) +{ + struct Smain* s = (struct Smain*)lua_touserdata(L, 1); + int argc=s->argc; + char** argv=s->argv; + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + struct Smain s; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=lua_open(); + if (L==NULL) fatal("not enough memory for state"); + s.argc=argc; + s.argv=argv; + if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} diff --git a/include/lua/luaconf.h b/include/lua/luaconf.h new file mode 100644 index 0000000..e2cb261 --- /dev/null +++ b/include/lua/luaconf.h @@ -0,0 +1,763 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include +#include + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include +#include +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/include/lua/lualib.h b/include/lua/lualib.h new file mode 100644 index 0000000..469417f --- /dev/null +++ b/include/lua/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/include/lua/lundump.c b/include/lua/lundump.c new file mode 100644 index 0000000..8010a45 --- /dev/null +++ b/include/lua/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; ik[i]); + for (i=0; ik[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; ip[i]=NULL; + for (i=0; ip[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; + for (i=0; ilocvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; + for (i=0; iupvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/include/lua/lundump.h b/include/lua/lundump.h new file mode 100644 index 0000000..c80189d --- /dev/null +++ b/include/lua/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/include/lua/lvm.c b/include/lua/lvm.c new file mode 100644 index 0000000..ee3256a --- /dev/null +++ b/include/lua/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/include/lua/lvm.h b/include/lua/lvm.h new file mode 100644 index 0000000..bfe4f56 --- /dev/null +++ b/include/lua/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/include/lua/lzio.c b/include/lua/lzio.c new file mode 100644 index 0000000..293edd5 --- /dev/null +++ b/include/lua/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/include/lua/lzio.h b/include/lua/lzio.h new file mode 100644 index 0000000..51d695d --- /dev/null +++ b/include/lua/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/include/lua/print.c b/include/lua/print.c new file mode 100644 index 0000000..e240cfc --- /dev/null +++ b/include/lua/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; iupvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; ip[i],full); +} diff --git a/include/luaconf.h b/include/luaconf.h new file mode 100644 index 0000000..e2cb261 --- /dev/null +++ b/include/luaconf.h @@ -0,0 +1,763 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include +#include + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include +#include +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/include/lualib.h b/include/lualib.h new file mode 100644 index 0000000..469417f --- /dev/null +++ b/include/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/include/lundump.h b/include/lundump.h new file mode 100644 index 0000000..c80189d --- /dev/null +++ b/include/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/include/lvm.h b/include/lvm.h new file mode 100644 index 0000000..bfe4f56 --- /dev/null +++ b/include/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/include/lzio.h b/include/lzio.h new file mode 100644 index 0000000..51d695d --- /dev/null +++ b/include/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/include/magic.h b/include/magic.h new file mode 100644 index 0000000..ef56015 --- /dev/null +++ b/include/magic.h @@ -0,0 +1,67 @@ +#ifndef __MAGIC_H__ +#define __MAGIC_H__ + +/* */ +int MAGIC_Use( int charaindex, int haveitemindex, int toindex); +int MAGIC_Recovery( int charaindex, int toindex,int marray, int mp ); +int MAGIC_OtherRecovery( int charaindex, int toindex, int marray, int mp ); +int MAGIC_FieldAttChange( int charaindex, int toindex, int marray, int mp ); +int MAGIC_StatusChange( int charaindex, int toindex, int marray, int mp ); +#ifdef _MAGIC_DEEPPOISON +int MAGIC_StatusChange2( int charaindex, int toindex, int marray, int mp ); +#endif +int MAGIC_StatusRecovery( int charaindex, int toindex, int marray, int mp ); +int MAGIC_MagicDef( int charaindex, int toindex, int marray, int mp ); +int MAGIC_Ressurect( int charaindex, int toindex, int marray, int mp ); +int MAGIC_AttReverse( int charaindex, int toindex, int marray, int mp ); +int MAGIC_ResAndDef( int charaindex, int toindex, int marray, int mp ); +#ifdef _OTHER_MAGICSTAUTS +int MAGIC_MagicStatusChange( int charaindex, int toindex, int marray, int mp ); +#endif +#ifdef _ATTACK_MAGIC +int MAGIC_AttMagic( int charaindex , int toindex , int marray , int mp ); +#endif +#ifdef _ITEM_METAMO +int MAGIC_Metamo( int charaindex, int toindex,int marray, int mp ); +#endif + +#ifdef _ITEM_ATTSKILLMAGIC +int MAGIC_AttSkill( int charaindex, int toindex,int marray, int mp ); +#endif +#ifdef _MAGIC_WEAKEN// vincent : +int MAGIC_Weaken( int charaindex, int toindex, int marray, int mp ); +#endif +#ifdef _MAGIC_BARRIER// vincent :ħ +int MAGIC_Barrier( int charaindex, int toindex, int marray, int mp ); +#endif +#ifdef _MAGIC_NOCAST// vincent :Ĭ +int MAGIC_Nocast( int charaindex, int toindex, int marray, int mp ); +#endif +#ifdef _MAGIC_TOCALL +int MAGIC_ToCallDragon( int charaindex, int toindex,int marray, int mp ); +#endif + +//---------------------------------------------------------------------- +// ʧ ة įë߯ +// +int MAGIC_GetArrayNo( + int charaindex, // ƽҷ̼͵ + int haveitemindex // Ȼʧ ة +); +// +//---------------------------------------------------------------------- +//------------------------------------------------------------------- +// +// ë +// +int MAGIC_DirectUse( + int charaindex, // ƽҷ¼̼͵ + int marray, // ̼͵ + int toindex, // + int itemnum +); +// +//------------------------------------------------------------------- + +#endif + diff --git a/include/magic_base.h b/include/magic_base.h new file mode 100644 index 0000000..a8d4f36 --- /dev/null +++ b/include/magic_base.h @@ -0,0 +1,142 @@ +#ifndef __MAGIC_BASE_H__ +#define __MAGIC_BASE_H__ + +#include "util.h" + +typedef enum +{ + MAGIC_FIELD_ALL, /* ͻƥ */ + MAGIC_FIELD_BATTLE, /* */ + MAGIC_FIELD_MAP, /* ɧѨ */ + +}MAGIC_FIELDTYPE; + +typedef enum +{ + MAGIC_TARGET_MYSELF, /* м */ + MAGIC_TARGET_OTHER, /* ְ ֳ) */ + MAGIC_TARGET_ALLMYSIDE, /* */ + MAGIC_TARGET_ALLOTHERSIDE, /* 촡 */ + MAGIC_TARGET_ALL, /* 廯 */ + MAGIC_TARGET_NONE, /* ּ ئУ ֧׻ */ + MAGIC_TARGET_OTHERWITHOUTMYSELF,/* ְ ֳئ) */ + MAGIC_TARGET_WITHOUTMYSELFANDPET, /* ʸ½ */ + MAGIC_TARGET_WHOLEOTHERSIDE,/* */ + +#ifdef _ATTACK_MAGIC + + MAGIC_TARGET_SINGLE, // Եзijһ + MAGIC_TARGET_ONE_ROW, // Եзijһ + MAGIC_TARGET_ALL_ROWS, // Եз + +#endif +}MAGIC_TARGETTYPE; + +typedef enum +{ + MAGIC_ID, /* į */ + MAGIC_FIELD, /* */ + MAGIC_TARGET, /* */ + MAGIC_TARGET_DEADFLG, /* Ϸַָޱֳ¾ */ +#ifdef _ATTACK_MAGIC + MAGIC_IDX , +#endif + MAGIC_DATAINTNUM, +}MAGIC_DATAINT; + +typedef enum +{ + MAGIC_NAME, /* */ + MAGIC_COMMENT, /* 춪*/ + MAGIC_FUNCNAME, /* */ + MAGIC_OPTION, /* */ + MAGIC_DATACHARNUM, +}MAGIC_DATACHAR; + +typedef struct tagMagic +{ + int data[MAGIC_DATAINTNUM]; + STRING64 string[MAGIC_DATACHARNUM]; + +}Magic; + +#ifdef _ATTACK_MAGIC + +typedef struct tagAttMagic +{ + unsigned int uiSpriteNum;// Spr_x.binı + unsigned int uiAttackType;// ķʽˣ( ) , ( ) , ( ͬʱ ) , ȫ( ) , ȫ( ͬʱ ) + unsigned int uiSliceTime;// ʱʱ + unsigned int uiShowType; // ʾλ÷ʽ롢ָ + int siSx; // ʾλ - X + int siSy; // ʾλ - Y + unsigned int uiShowBehindChar; // ʾǰ· + unsigned int uiShakeScreen; // Ƿ𶯻 + unsigned int uiShakeFrom; // 𶯻ʼʱ( ) + unsigned int uiShakeTo; // 𶯻Ľʱ( _ + unsigned int uiPrevMagicNum; // ǰ( 0XFFFFFFFFFF ʾǰ ) + int siPrevMagicSx; // ǰʾλ - X + int siPrevMagicSy; // ǰʾλ - Y + int siPrevMagicOnChar; // ǰʾǰ· + unsigned int uiPostMagicNum; // ( 0XFFFFFFFF ʾ ) + int siPostMagicSx; // ʾλ - X + int siPostMagicSy; // ʾλ - Y + int siPostMagicOnChar; // ʾǰ· + int siField[3][5]; // +}AttMagic; + +#endif + +#ifdef _MAGIC_TOCALL + +typedef struct tagToCallMagic +{ + unsigned int uiSpriteNum;// Spr_x.binı + unsigned int uiAttackType;// ķʽˣ( ) , ( ) , ( ͬʱ ) , ȫ( ) , ȫ( ͬʱ ) + unsigned int uiSliceTime;// ʱʱ + unsigned int uiShowType; // ʾλ÷ʽ롢ָ + int siSx; // ʾλ - X + int siSy; // ʾλ - Y + unsigned int uiShowBehindChar; // ʾǰ· + unsigned int uiShakeScreen; // Ƿ𶯻 + unsigned int uiShakeFrom; // 𶯻ʼʱ( ) + unsigned int uiShakeTo; // 𶯻Ľʱ( _ + unsigned int uiPrevMagicNum; // ǰ( 0XFFFFFFFFFF ʾǰ ) + int siPrevMagicSx; // ǰʾλ - X + int siPrevMagicSy; // ǰʾλ - Y + int siPrevMagicOnChar; // ǰʾǰ· + unsigned int uiPostMagicNum; // ( 0XFFFFFFFF ʾ ) + int siPostMagicSx; // ʾλ - X + int siPostMagicSy; // ʾλ - Y + int siPostMagicOnChar; // ʾǰ· + int isPostDisappear; // һ㹥ʱǷʧ + int ToCallMagicNo; // ٻı +}ToCallMagic; + +#endif + +typedef int (*MAGIC_CALLFUNC)( int, int, int, int ); + +INLINE BOOL MAGIC_CHECKINDEX( int index ); +INLINE int MAGIC_getInt( int index, MAGIC_DATAINT element); +INLINE int MAGIC_setInt( int index, MAGIC_DATAINT element, int data); +INLINE char* MAGIC_getChar( int index, MAGIC_DATACHAR element); +INLINE BOOL MAGIC_setChar( int index ,MAGIC_DATACHAR element, char* new ); +int MAGIC_getMagicNum( void); +BOOL MAGIC_initMagic( char *filename); +BOOL MAGIC_reinitMagic( void ); + +#ifdef _ATTACK_MAGIC + +BOOL ATTMAGIC_initMagic( char *filename ); +BOOL ATTMAGIC_reinitMagic( void ); + +#endif + +int MAGIC_getMagicArray( int magicid); +MAGIC_CALLFUNC MAGIC_getMagicFuncPointer(char* name); +// Nuke +1 08/23 : For checking the validity of magic target +int MAGIC_isTargetValid( int magicid, int toindex); + +#endif + diff --git a/include/magic_field.h b/include/magic_field.h new file mode 100644 index 0000000..414195f --- /dev/null +++ b/include/magic_field.h @@ -0,0 +1,10 @@ +#ifndef __MAGIC_FIELD_H__ +#define __MAGIC_FIELD_H__ + +/* ūƥ */ + +int MAGIC_Recovery_Field( int charaindex, int magicindex); +int MAGIC_OtherRecovery_Field( int charaindex, int toindex, int magicindex); + +#endif + diff --git a/include/map_deal.h b/include/map_deal.h new file mode 100644 index 0000000..b9f3cb7 --- /dev/null +++ b/include/map_deal.h @@ -0,0 +1,15 @@ +#ifndef __MAP_DEAL_H__ +#define __MAP_DEAL_H__ +BOOL MAP_walkAbleFromPoint( int ff, int fx, int fy, BOOL isfly ); +BOOL MAP_walkAble( int index,int ff, int fx, int fy); +void MAP_preovered( int index ); +void MAP_postovered( int index ); +BOOL MAP_sendArroundCharNeedFD( int fd,int charaindex ); +BOOL MAP_sendArroundChar(int charaindex); + +#ifdef _CAX_LNS_NLGSUOXU +int QuBiao (int MapId); +#endif + +#endif + diff --git a/include/map_util.h b/include/map_util.h new file mode 100644 index 0000000..77e4b7a --- /dev/null +++ b/include/map_util.h @@ -0,0 +1,7 @@ +#ifndef __MAP_UTIL_H__ +#define __MAP_UTIL_H__ + +BOOL MAP_getMapDataFromCharIndex( int index , int* map ); +BOOL MAP_getMapDataFromFXY( int f , int x , int y, int* map ); + +#endif diff --git a/include/map_warppoint.h b/include/map_warppoint.h new file mode 100644 index 0000000..8337f75 --- /dev/null +++ b/include/map_warppoint.h @@ -0,0 +1,26 @@ +#ifndef __MAPWARPPOINT_H__ +#define __MAPWARPPOINT_H__ + +#include "common.h" +#include "util.h" + +int MAPPOINT_InitMapWarpPoint( void); +void MAPPOINT_resetMapWarpPoint( int flg); +int MAPPOINT_loadMapWarpPoint( void); + +BOOL MAPPOINT_CHECKINDEX( int ps); +int MAPPOINT_getMPointEVType( int ps); + +int MAPPOINT_creatMapWarpObj( int pointindex, char *buf, int objtype); +int MAPPOINT_setMapWarpGoal( int ps, char *buf); +int MAPPOINT_setMapWarpFrom( int ps, char *buf); +int MAPPOINT_getMapWarpGoal( int ps, int ofl, int ox, int oy, int *fl, int *x, int *y); + +void MAPPOINT_MapWarpHandle( int charaindex, int ps, int ofl, int ox, int oy ); + +#ifdef _CAX_LNS_MAPSUOXU +int DelMapPoint( int ps); +int SetMapPoint( char* buf); +#endif + +#endif diff --git a/include/mclient.h b/include/mclient.h new file mode 100644 index 0000000..553de42 --- /dev/null +++ b/include/mclient.h @@ -0,0 +1,51 @@ +#ifndef __MCLIENT_H__ +#define __MCLIENT_H__ + +#define MSPERSIONALKEY "20020729" + + +#define MPROTO_QUE_SEND 1001 +#define MPROTO_QUE_RECV 1002 + +#define MPROTO_NOTALK_RECV 1004 +#define MPROTO_GMTALK_SEND 1005 +#define MPROTO_GMTALK_RECV 1006 +#define MPROTO_HELLO_SEND 1007 +#define MPROTO_HELLO_RECV 1008 +#define MPROTO_WAEIKICK_SEND 1009 +#define MPROTO_WAEIKICK_RECV 1010 + +#define MPROTO_JAIL_RECV 1012 +#define MPROTO_MESSAGE_RECV 1014 + +#define MPROTO_TYPE_SEND 1016 + +#ifdef _GSERVER_RUNTIME //GSERVERִжʱMSERVER +#define MPROTO_RECALL_GSERVER_RUNTIME 1026 +#endif + +int mproto_ClientDispatchMessage(int fd,char* data); + +void mproto_Que_Recv(int fd,char* uid,int userfdid,char* ans); +void mproto_Que_Send( int fd, int uid, int index, char* question); + +void mproto_NoTalk_Recv(int fd,char* uid,int userfdid,int nTime); +void mproto_GMTalk_Recv(int fd,char* uid,int ntime,char* data); +void mproto_WaeiKick_Recv(int fd,char* uid,int userfdid); +void mproto_Jail_Recv(int fd,char* uid,int userfdid); + +void mproto_Message_Recv(int fd,char* uid,int userfdid,char* ans); + +int connectmServer(char* hostname,unsigned short port); +void mproto_Type_Send( int fd, int playernum, int itemuse); + +#ifdef _RECAL_ASK_PLAYER // WON Ҫ +void mproto_RECALL_ASK_PLAYER_Recv(int fd, char *uid, int userfdid, int GmCliId, char *id, int char_num, int date, int backup_flag); +void mproto_RECALL_BACKUP_PLAYER_Recv(int fd, char *uid, int userfdid, int GmCliId, char *id, int char_num, int date, char *char_data, int backup_flag); +#endif + +#ifdef _GSERVER_RUNTIME +void gserver_runtime(); +#endif + +#endif diff --git a/include/msignal.h b/include/msignal.h new file mode 100644 index 0000000..452994b --- /dev/null +++ b/include/msignal.h @@ -0,0 +1,8 @@ +#ifndef __SIGNAL_H__ +#define __SIGNAL_H__ + +void signalset( void ); +void shutdownProgram( void ); +void sigshutdown( int number ); + +#endif diff --git a/include/mylua/ablua.h b/include/mylua/ablua.h new file mode 100644 index 0000000..d5e85a6 --- /dev/null +++ b/include/mylua/ablua.h @@ -0,0 +1,8 @@ +#ifndef __ABLUA_H__ +#define __ABLUA_H__ + +void LoadAllbluesLUA(char *path); +void ReLoadAllbluesLUA(); +void NewLoadAllbluesLUA(char *filename); + +#endif diff --git a/include/mylua/base.h b/include/mylua/base.h new file mode 100644 index 0000000..f85e74b --- /dev/null +++ b/include/mylua/base.h @@ -0,0 +1,46 @@ +#ifndef __CHARBASE_H__ +#define __CHARBASE_H__ +#include "char_base.h" +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + +typedef struct tagCharBase +{ + char field[128]; + int element; +}CharBase; + +const int getCharBaseValue(lua_State *L, int narg, CharBase *charbase, int num); + +LUALIB_API int luaopen_Char (lua_State *L); +LUALIB_API int luaopen_NPC (lua_State *L); +LUALIB_API int luaopen_Lssproto (lua_State *L); +LUALIB_API int luaopen_Battle (lua_State *L); +LUALIB_API int luaopen_Object (lua_State *L); + +#ifdef _ALLBLUES_LUA_1_1 +LUALIB_API int luaopen_Map (lua_State *L); +LUALIB_API int luaopen_Other (lua_State *L); +LUALIB_API int luaopen_Config (lua_State *L); +#endif +#ifdef _ALLBLUES_LUA_1_2 +LUALIB_API int luaopen_Item (lua_State *L); +LUALIB_API int luaopen_Magic (lua_State *L); +#endif +#ifdef _ALLBLUES_LUA_1_2 +LUALIB_API int luaopen_Offline (lua_State *L); +#endif +#ifdef _ALLBLUES_LUA_1_4 +LUALIB_API int luaopen_Enemytemp (lua_State *L); +LUALIB_API int luaopen_Sasql (lua_State *L); +#endif + +LUALIB_API int luaopen_Net (lua_State *L); + +LUALIB_API int luaopen_Saacproto (lua_State *L); + +LUALIB_API int luaopen_Family (lua_State *L); +LUALIB_API int luaopen_PetSkill (lua_State *L); +#endif diff --git a/include/mylua/function.h b/include/mylua/function.h new file mode 100644 index 0000000..964101e --- /dev/null +++ b/include/mylua/function.h @@ -0,0 +1,63 @@ + +#ifndef __MYLUA_FUNCTION_H__ +#define __MYLUA_FUNCTION_H__ + +BOOL RunCharTalkedEvent(int meindex, int toindex, char *messageeraseescape, int color, int channel); +BOOL RunCharLoopEvent(int meindex); +BOOL RunCharOverlapEvent( int meindex, int toindex); +BOOL RunCharBattleOverEvent( int meindex, int toindex, int iswin); +BOOL RunCharWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#ifdef _ALLBLUES_LUA_1_2 +BOOL RunItemUseEvent( int itemindex, int charaindex, int toindex, int haveitemindex ); +BOOL RunItemDieReLifeEvent( int toindex, int itemindex, int haveitemindex ); +BOOL RunItemDetachEvent( int charaindex, int itemindex ); +BOOL RunItemAttachEvent( int charaindex, int itemindex ); +BOOL RunItemPickupEvent( int charaindex, int itemindex ); +BOOL RunItemPostOverEvent( int itemindex, int charaindex ); +BOOL RunItemPreOverEvent( int itemindex, int charaindex ); +BOOL RunItemDropEvent( int charaindex, int itemindex ); +BOOL RunUseChatMagic( int charaindex, char *data, lua_State *lua); +#endif +#ifdef _PETSKILL_SHOP_LUA +BOOL FreePetSkillShop( int talkerindex, int petindex, int oldSkillID, int newSkillID); +#endif +//#ifdef _PETSKILL_SHOP_LUA +//BOOL OffLineCommand( int battleindex, int charindex, int side); +//#endif +#ifdef _ALLBLUES_LUA_1_4 +BOOL BattleFinish( int battleindex, int charaindex); +BOOL BattleEscape( int battleindex, int charaindex); +BOOL RunCharLogOutEvent( int charaindex); +#endif +#ifdef _ALLBLUES_LUA_1_5 +BOOL FreePartyJoin( int charaindex, int toindex ); +BOOL FreeVsPlayer( int charaindex, int toindex ); +BOOL FreeCharLogin( int charaindex ); +BOOL FreeCharCreate( int charaindex ); +BOOL NetLoopFunction( void ); +#endif +#ifdef _ALLBLUES_LUA_1_6 +BOOL FamilyRideFunction( int meindex, int petindex, int petid ); +BOOL CharTalkFunction( int charaindex, char *message, int color ); +#endif +#ifdef _ALLBLUES_LUA_1_7 +BOOL CharVsEnemyFunction( int charaindex ); +#endif +#ifdef _ALLBLUES_LUA_1_8 +BOOL CaptureOkFunction( int attackindex, int defindex ); +BOOL CaptureCheckFunction( int attackindex, int defindex ); +#endif +#ifdef _ALLBLUES_LUA_1_9 +BOOL SetBattleEnmeyFunction(int meindex, int enemyindex, int id ); +BOOL BattleFinishFunction( int charaindex, int battletime, int battleturn, int battletype ); +#endif +#ifdef _ALLBLUES_LUA_2_0 +BOOL fameButton( int index); //ťӿ +BOOL FreeSamenu(int* function,int id, int charaindex ); //ESC +BOOL FreeLoginCheck(int fd);//ҵ½ص +BOOL TeacherButton(int* function,int charaindex );//ʦťص +BOOL FreeCharExpSave(int charaindex, int exp ); +BOOL FreeModeExp(int charaindex, int exp );//ص +#endif +#endif diff --git a/include/mylua/mylua.h b/include/mylua/mylua.h new file mode 100644 index 0000000..968c2d1 --- /dev/null +++ b/include/mylua/mylua.h @@ -0,0 +1,53 @@ +#define __MYLUA__H__ +#ifdef __MYLUA__H__ + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" +int myluaload (char *filename); +int remyluaload (char *filename); +int closemyluaload(); +void CryptoAllbluesLUA(char *path, int flg, int id); +int dofile (lua_State *L, const char *name); +int docall (lua_State *L, int narg, int clear); +int getArrayInt(lua_State *L, int idx); +LUALIB_API void luaAB_openlibs (lua_State *L); + +typedef struct tagMYLua +{ + lua_State *lua; + char *luapath; + struct tagMYLua *next; +}MY_Lua; + +#endif + + +//һintLUA +#define LRetInt(L, i) \ +{ \ + lua_pushinteger(L, i); \ + LRet(1); \ +} + +#define LRet(r) \ +{ \ + NPC_Lua_SetErrorStr(NULL); \ + return r; \ +} + +#define CheckEx2(L, t, n) \ +{ \ + if(lua_gettop(L) < (t) || lua_gettop(L) > n) \ + { \ + luaL_argerror(L, 1, ""); \ + } \ +} + +//һBOOLLUA +#define LRetBool(L, b) \ +{ \ + lua_pushboolean(L, b); \ + LRet(1); \ +} diff --git a/include/net.h b/include/net.h new file mode 100644 index 0000000..07f2f06 --- /dev/null +++ b/include/net.h @@ -0,0 +1,310 @@ +#ifndef __NET_H__ +#define __NET_H__ + +#include "common.h" + +#include +#include +// Nuke +1 0902: For queuing control +#include + +#include + +#include "link.h" + + +#undef EXTERN +#ifdef __NET_C__ +#define EXTERN +#else +#define EXTERN extern +#endif + + + +/* + * ̼ƻئУ ̼ƻ£ ̼ ƽҷԻ + * ʧ ( Ƥ ) , ʧ ( ʧ ) + * N NOT W WHILE , UL UNLOCK + */ +typedef enum +{ + NOTLOGIN, /* ̼ƻئ */ + LOGIN, /* ̼ */ + WHILELOGIN, /* ̼ƻ */ + WHILECREATE, /* Ȼ */ + WHILELOGOUTSAVE, /* ʧƤ */ + WHILECANNOTLOGIN, /* ̼ƥئݼʧ */ + WHILECHARDELETE, /* ƽҷ´ */ + WHILEDOWNLOADCHARLIST, /* ƽҷĸ */ + WHILECHANGEPASSWD, /* ɵ */ + + WHILELOSTCHARSAVE, /* ƥƽҷ±Ƥ */ + WHILELOSTCHARDELETE,/* ƥƽҷ */ + + WHILECLOSEALLSOCKETSSAVE, /* closeallsockets ƥƽҷ±Ƥ */ + WHILESAVEWAIT, /* ʧƤ󡼰 */ +}LoginType; + +/* ƻئУʧӡͷʧʧة */ +typedef enum +{ + NOTDETECTED,AC,CLI,ADM +}ConnectType; + + +/* ӡﻥƻӮ */ +#define CDKEYLEN 16 +#define PASSWDLEN 16 +/* ľ ʷص(ئ Char STRING64 ئԻ³*/ +#define CHARNAMELEN 32 + +#define CLITIMEOUT_SEC 120 /* ͷʧreadئգ + ƥةʧʧ */ + +#define NET_STRING_SUCCESSFULL "successful" +#define NET_STRING_FAILED "failed" + +// ׹ ݷ +#define RBSIZE (1024*64*8) +#define WBSIZE (1024*64*8) +// ʧӡ + +//#define AC_RBSIZE (65536*48) +//#define AC_RBSIZE (65536*32) +#define AC_RBSIZE (1024*64*8) +//ttom modify because the second version had this +//#define AC_WBSIZE (65536*16) +extern int AC_WBSIZE; + +EXTERN int bindedfd; /*лʧ̼ĩ*/ +EXTERN int acfd; /*ʧӡĩ*/ +EXTERN int ConnectLen; /*ƱӮ*/ +#define CONNECT_WINDOWBUFSIZE 7 + +/* */ +BOOL initConnect( int size ); +void endConnect( void ); +#define CONNECT_endOne( sockfd, lin) \ + _CONNECT_endOne( __FILE__, __LINE__, sockfd, lin) +BOOL _CONNECT_endOne( char *file, int fromline, int sockfd , int lin); +#define CONNECT_attendOne( sockfd, lin) \ + _CONNECT_attendOne( __FILE__, __LINE__, sockfd, lin) +BOOL _CONNECT_attendOne( char *file, int fromline, int sockfd , int lin); +BOOL netloop( void ); +BOOL netloop_faster( void ); +int lsrpcClientWriteFunc( int fd , char* buf , int size ); +char* GetOneLine( int fd ); +BOOL initConnectOne( int sockfd, struct sockaddr_in* sin ,int len ); + +#ifdef _CAX_LNS_NLSUOXU +void SetTimerLua( void ); +BOOL DelTimer_net(int ID); +#endif + +/* CA , CD */ +void CAcheck( void ); +void CAflush( int charaindex ); +void CAsend( int fd ); +void CDcheck( void ); +void CDflush( int charaindex ); +void CDsend( int fd ); +BOOL CONNECT_appendCAbuf( int fd , char* data, int size ); +BOOL CONNECT_appendCDbuf( int fd , char* data, int size ); + +/* Serverstate */ +void SERVSTATE_decrementCloseallsocketnum(void); +int SERVSTATE_getCloseallsocketnum( void ); +int SERVSTATE_SetAcceptMore( int nvalue ); +int SERVSTATE_getShutdown(void); +void SERVSTATE_setShutdown(int a); +int SERVSTATE_getLimittime(void); +int SERVSTATE_getDsptime(void); +void SERVSTATE_setDsptime(int a); +void SERVSTATE_setLimittime(int a); + + +/* þ */ +void outputNetProcLog( int fd, int mode); +void chardatasavecheck( void ); +void closeAllConnectionandSaveData( void ); +BOOL SetShutdown( BOOL nvalue ); +int GetShutdown( void ); + +/* ƻ */ +int getfdFromCdkey( char* cd ); +int getfdFromCharaIndex( int charaindex ); +int getcdkeyFromCharaIndex( int charaindex , char *out, int outlen ); +int getCharindexFromFdid( int fdid ); +int getFdidFromCharaIndex( int charind ); +int getfdFromFdid( int fdid ); +int getfdFromCdkeyWithLogin( char* cd ); + + +/* */ +INLINE int CONNECT_checkfd( int fd ); +BOOL CONNECT_isCLI( int fd ); +BOOL CONNECT_isAC( int fd ); +BOOL CONNECT_isUnderLogin( int fd ); +BOOL CONNECT_isWhileLogout( int fd ); +BOOL CONNECT_isWhileLogin( int fd ); +BOOL CONNECT_isNOTLOGIN( int fd ); +BOOL CONNECT_isLOGIN( int fd ); + +int CONNECT_getUse( int fd ); +int CONNECT_getUse_debug( int fd, int i ); + +void CONNECT_setCharaindex( int fd, int a ); +int CONNECT_getCharaindex( int fd ); +void CONNECT_getCdkey( int fd , char *out, int outlen ); +void CONNECT_setCdkey( int fd , char *in); +void CONNECT_getPcid( int fd , char *out, int outlen ); +void CONNECT_setPcid( int sockfd, char *pcid ); +#ifdef _CAX_NEWMAC_LOGIN +void CONNECT_getMAC( int fd , char *out, int outlen ); +void CONNECT_setMAC( int sockfd, char *mac ); +#endif +void CONNECT_getOldPcid( int fd , char *out, int outlen ); +void CONNECT_setOldPcid( int sockfd, char *pcid ); +void CONNECT_getDefaultKey( int fd , char *out, int outlen ); +void CONNECT_setDefaultKey( int sockfd, char *defaultkey ); +void CONNECT_getPasswd( int fd , char *out, int outlen ); +void CONNECT_setPasswd( int fd, char *in ); +void CONNECT_getCharname( int fd , char *out, int outlen ); +void CONNECT_setCharname( int fd, char *in ); +int CONNECT_getFdid( int fd ); +int CONNECT_getCtype( int fd ); +void CONNECT_setCtype( int fd , int a ); +void CONNECT_setDuelcharaindex( int fd, int i , int a ); +int CONNECT_getDuelcharaindex( int fd, int i ); +void CONNECT_setBattlecharaindex( int fd, int i , int a ); +int CONNECT_getBattlecharaindex( int fd, int i ); +void CONNECT_setJoinpartycharaindex( int fd, int i , int a); +int CONNECT_getJoinpartycharaindex( int fd, int i ); +void CONNECT_setTradecardcharaindex( int fd, int i , int a ); +int CONNECT_getTradecardcharaindex( int fd, int i ); +/* MTѨͷ */ +#define CONNECT_endOne_debug(a) CONNECT_endOne( (a) , __LINE__ ) +#define CONNECT_attendOne_debug(a) CONNECT_attendOne( (a) , __LINE__ ) +/* (ľɱ) */ +void CONNECT_setCDKEY( int sockfd, char *cd ); +void CONNECT_getCDKEY( int sockfd , char *out, int outlen ); +void CONNECT_setState( int fd, int s ); +int CONNECT_getState( int fd ); +void CONNECT_checkStatecount( int a ); +int CONNECT_checkStateSomeOne( int a, int maxcount); + +BOOL CONNECT_acfdInitRB( int fd ); +BOOL CONNECT_acfdInitWB( int fd ); + +// Nuke +3 +int checkWalkTime(int fd); +int setBtime(int fd); + +#ifdef _BATTLE_TIMESPEED +//void setDefBTime( int fd, unsigned int times); +//unsigned int getDefBTime( int fd); +BOOL CheckDefBTime( int charaindex, int fd, unsigned int lowTime, unsigned int battletime, unsigned int addTime); +#endif + +#ifdef _TYPE_TOXICATION +void setToxication( int fd, int flg); +int getToxication( int fd); +#endif +int checkBEOTime(int fd); +void sigusr1(int i); +void sigusr2(int i); // Arminius 6.26 signal +//ttom start +void CONNECT_set_watchmode(int fd, BOOL B_Watch); +BOOL CONNECT_get_watchmode(int fd); +void CONNECT_set_shutup(int fd,BOOL b_shut);//the avoid the user wash the screen +BOOL CONNECT_get_shutup(int fd); +unsigned long CONNECT_get_userip(int fd); +void CONNECT_set_pass(int fd,BOOL b_ps); +BOOL CONNECT_get_pass(int fd); +void CONNECT_set_state_trans(int fd,int a); +int CONNECT_get_state_trans(int fd); +//ttom end + +// CoolFish: +9 2001/4/18 +void CONNECT_setCloseRequest( int fd, int count); +void CONNECT_set_first_warp(int fd, BOOL b_ps); +BOOL CONNECT_get_first_warp(int fd); +int isDie(int fd); +void setDie(int fd); + +// Arminius 6/22 encounter +int CONNECT_get_CEP(int fd); +void CONNECT_set_CEP(int fd, int cep); + +// Arminius 7.12 login announce +int CONNECT_get_announced(int fd); +void CONNECT_set_announced(int fd, int a); + +// shan trade(DoubleCheck) begin +int CONNECT_get_confirm(int fd); +void CONNECT_set_confirm(int fd, BOOL b); +// end + +void CONNECT_setTradecharaindex( int fd, int i , int a); + +void CONNECT_setLastrecvtime( int fd, struct timeval *a ); +void CONNECT_getLastrecvtime( int fd, struct timeval *a ); +void CONNECT_setLastrecvtime_D( int fd, struct timeval *a ); +void CONNECT_getLastrecvtime_D( int fd, struct timeval *a ); +void CONNECT_SetBattleRecvTime( int fd, struct timeval *a ); +void CONNECT_GetBattleRecvTime( int fd, struct timeval *a ); +void CONNECT_setTradeTmp(int fd, char* a); +void CONNECT_getTradeTmp(int fd, char *trademsg, int trademsglen); +int checkNu(int fd); + +#ifdef _NO_WARP +// shan hjj add Begin +int CONNECT_get_seqno(int fd); +void CONNECT_set_seqno(int fd,int a); +int CONNECT_get_selectbutton(int fd); +void CONNECT_set_selectbutton(int fd, int a); +// shan End +#endif + +// Arminius 7.2 Ra's amulet +void setNoenemy(int fd); +void clearNoenemy(int fd); +int getNoenemy(int fd); +void setEqNoenemy(int fd, int level); +void clearEqNoenemy(int fd); +int getEqNoenemy(int fd); + +#ifdef _Item_MoonAct +void setEqRandenemy(int fd, int level); +void clearEqRandenemy(int fd); +int getEqRandenemy(int fd); +#endif + +#ifdef _CHIKULA_STONE +void setChiStone(int fd, int nums); +int getChiStone(int fd); +#endif + +// Arminius 7.31 cursed stone +void setStayEncount(int fd); +void clearStayEncount(int fd); +int getStayEncount(int fd); +void CONNECT_setBDTime( int fd, int nums); +int CONNECT_getBDTime( int fd); + +// Arminius debug +void CONNECT_setUse( int fd , int a); +void CONNECT_setStarttime( int fd , int a); +#ifdef _ITEM_PILEFORTRADE +void CONNECT_setTradeList( int fd, int num); +int CONNECT_getTradeList(int fd); +#endif + +#define QUEUE_LENGTH1 6 +#define QUEUE_LENGTH2 7 + +BOOL MSBUF_CHECKbuflen( int size, float defp); + +void SetTcpBuf( int sockfd); +#endif diff --git a/include/npc_Dengon.h b/include/npc_Dengon.h new file mode 100644 index 0000000..b8835a1 --- /dev/null +++ b/include/npc_Dengon.h @@ -0,0 +1,10 @@ +#ifndef __NPC_DENGON_H__ +#define __NPC_DENGON_H__ +BOOL NPC_DengonInit( int meindex ); +//void NPC_DengonSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_DengonLooked( int meindex, int lookedindex ); +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data); + +#endif + diff --git a/include/npc_action.h b/include/npc_action.h new file mode 100644 index 0000000..f19d6df --- /dev/null +++ b/include/npc_action.h @@ -0,0 +1,12 @@ +#ifndef __NPC_ACTION_H__ +#define __NPC_ACTION_H__ + +void NPC_ActionTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_ActionInit( int meindex ); +void NPC_ActionWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); + +#endif + diff --git a/include/npc_airplane.h b/include/npc_airplane.h new file mode 100644 index 0000000..6e02872 --- /dev/null +++ b/include/npc_airplane.h @@ -0,0 +1,12 @@ +#ifndef __NPC_AIRPLANE_H__ +#define __NPC_AIRPLANE_H__ + +BOOL NPC_AirInit( int meindex ); +void NPC_AirLoop( int meindex ); +void NPC_AirTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_AirCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_AirCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif +/*__NPC_AIRPLANE_H__*/ diff --git a/include/npc_alldoman.h b/include/npc_alldoman.h new file mode 100644 index 0000000..bc879a1 --- /dev/null +++ b/include/npc_alldoman.h @@ -0,0 +1,10 @@ +#ifndef __NPC_ALLDOMAN_H__ +#define __NPC_ALLDOMAN_H__ + +BOOL NPC_AlldomanInit( int meindex ); +void NPC_AlldomanTalked( int meindex , int talker , char *msg ,int color ); +void NPC_AlldomanWindowTalked(int meindex, int talkerindex, int seqno, int select,char *data); +void NPC_AlldomanWriteStele( char *token ) ; +void NPC_Alldoman_S_WriteStele( char *ocdkey , char *oname , char *ncdkey , + char *nname , char *title , int level , int trns , int floor ) ; +#endif diff --git a/include/npc_auctioneer.h b/include/npc_auctioneer.h new file mode 100644 index 0000000..dc9f331 --- /dev/null +++ b/include/npc_auctioneer.h @@ -0,0 +1,377 @@ +0031:npc_autopk.h:0302:1:14=48041e4b:16=47d21313:#ifndef _AUTO_PK_H +#define _AUTO_PK_H + +void NPC_AutoPkTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_AutoPkInit( int meindex ); +void NPC_AutoPkWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_AutoPkLoop( void ); +void AutoPk_PKSystemTalk( char *token1, char *token2 ); +void AutoPk_PKSystemInfo(); +void AutoPk_PKTimeSet( int pktime ); +int AutoPk_PKTimeGet( void ); +void AutoPk_AwardSet( int petid, char *pet, int itemid, char *item ); +void AutoPk_ChampionShipSet( char *cdkey, char *name, int winnum, int win ); +void NPC_AUTOPKHealerTalked( int meindex ); +void AutoPk_SetHistoryStr( void ); +void AutoPk_SetAwardStr( char *token ); +BOOL AutoPk_GetAwardStr( void ); +void AutoPk_GetChampionShip( void ); +#endif +0032:npc_bankman.h:0163:1:14=48041e4b:16=47d21313:#ifndef __NPC_BANKMAN_H__ +#define __NPC_BANKMAN_H__ + +void NPC_BankmanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_BankmanInit( int meindex ); +void NPC_BankmanLooked( int meindex, int lookedindex ); +void NPC_BankmanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +0037:npc_bigsmallmaster.h:00:1:14=48041e4b:16=47d21313:0034:npc_bigsmallpet.h:00:1:14=48041e4b:16=47d21313:0034:npc_blackmarket.h:00:1:14=48041e4b:16=47d21313:0032:npc_bodylan.h:0166:1:14=48041e4b:16=47d21313:#ifndef __NPC_BODYLAN_H__ +#define __NPC_BODYLAN_H__ + +void NPC_BodyLanTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_BodyLanInit( int meindex ); +void NPC_BodyLanWatch( int meindex , int lookedindex); +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +); + +#endif +002E:npc_bus.h:016E:1:14=48041e4b:16=47d21313:#ifndef __NPC_BUS_H__ +#define __NPC_BUS_H__ + +BOOL NPC_BusInit( int meindex ); +void NPC_BusLoop( int meindex ); +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif + +0030:npc_charm.h:0156:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHARM_H__ +#define __NPC_CHARM_H__ + +void NPC_CharmTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CharmInit( int meindex ); +void NPC_CharmWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CharmLooked( int meindex , int lookedindex); + +#endif + +0033:npc_checkman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHECKMAN_H__ +#define __NPC_CHECKMAN_H__ + +void NPC_CheckManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CheckManInit( int meindex ); +void NPC_CheckManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CheckManLooked( int meindex , int lookedindex); + +#endif + +0031:npc_Dengon.h:0146:1:14=48041e4b:16=47d21313:#ifndef __NPC_DENGON_H__ +#define __NPC_DENGON_H__ +BOOL NPC_DengonInit( int meindex ); +//void NPC_DengonSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_DengonLooked( int meindex, int lookedindex ); +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data); + +#endif + +002F:npc_door.h:0470:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOOR_H__ +#define __NPC_DOOR_H__ + +BOOL NPC_DoorInit(int meindex ); +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_DoorPreAttacked(int meindex , int attacker , float *dm); +void NPC_DoorPostOver( int meindex , int movedindex ); +void NPC_DoorOff( int meindex , int movedindex ); +void NPC_DoorWatch( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +int NPC_DoorSearchByName( char *name ); +int NPC_DoorSearchByPosition( int fl , int x, int y ); +void NPC_DoorLooked( int meindex , int lookedindex ); +BOOL NPC_DoorRefreshOverFlg( int meind ); + + +/* ְNPCճ۽ľãNPC年л npc_stepswitch.cëǷ */ +int NPC_DoorSetPasswd( int meindex, char *pas ); +int NPC_DoorGetPasswd( int meindex, char *out , int len ); +void NPC_DoorFlip(int meindex , int doindex); +void NPC_DoorClose(int meindex , int doindex); +void NPC_DoorOpen(int meindex , int doindex ); +void NPC_DoorAddSwitchCounter( int meindex , int i , int talker ); +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ); + +#endif + + + + + +0031:npc_doorman.h:0CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOORMAN_H__ +#define __NPC_DOORMAN_H__ + +BOOL NPC_DoormanInit( int meindex ); +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ); + +#endif + +0036:npc_duelranking.h:01AD:1:14=48041e4b:16=47d21313:#ifndef __NPC_DUELRANKING_H__ +#define __NPC_DUELRANKING_H__ + +BOOL NPC_DuelrankingInit( int meindex ); +void NPC_DuelrankingLooked( int meindex, int lookedindex ); +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2); +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2); + +#endif + +0037:npc_eventaction.h:01505:1:14=48041e4b:16=47d21313:#ifndef _PRO_NPCFIX_H +#define _PRO_NPCFIX_H +//ANDY_Edit +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums); +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg); +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1); +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg); +BOOL Action_PartyCheck( int meindex, int talker); +BOOL NPC_ActionAddGold( int talker, int Golds); +BOOL NPC_ActionDelGold( int talker,char *buf); +BOOL NPC_ActionDelFame( int talker,char *buf); +BOOL NPC_ActionAddFame( int talker,char *buf); +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentum( int talker,char *buf); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDP( int talker,char *buf); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionDelVipPoint( int talker,char *buf); +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf); +BOOL NPC_ActionTransNew7( int talker, char *buf); +BOOL NPC_ActionTransNewSeven( int talker, char *buf); +#endif +// WON ADD +BOOL NPC_ActionAddGold2( int talker,char *buf); +BOOL NPC_ActionDelPet( int toindex,char *buf); +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int talker,char *msg); +#endif +BOOL NPC_ActionAddPet( int talker, char *buf); +BOOL NPC_ActionDelItem( int talker,char *buf); +BOOL NPC_ActionAddItem( int talker, char *buf); +BOOL NPC_ActionSetEend( int talkerindex, char * buf); +BOOL NPC_ActionSetNow( int toindex, char * buf); +BOOL NPC_ActionClearEvent( int toindex, char * buf); + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg); +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentumCheck(int meindex,int talker,int Momentum,int flg); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDPCheck(int meindex,int talker,int DP,int flg); +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck( int meindex,int talker,int p_class,int flg); + +BOOL NPC_ActionSkillCheck( int meindex,int talker,int skillId,int flg); +BOOL NPC_ActionSkillNumCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg); +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg); + +BOOL NPC_ActionCleanProfession( int toindex, char *buf); +BOOL NPC_ActionAddProfessionSkillPoint( int toindex, char *buf ); +#endif + +BOOL NPC_ActionGoldCheck(int meindex,int talker,int Golds,int flg); +BOOL NPC_ActionPartyCheck( int toindex, int nums, int flg); +BOOL NPC_ActionReItemCheck( int toindex, int nums, int flg); +BOOL NPC_ActionRePetCheck( int toindex, int nums, int flg); +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPC_ActionBigSmallLastCheck(int point1,int mypoint,int flg); + +BOOL NPC_ActionItemCheck(int meindex,int talker,int itemNo, int flg); +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg); + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp); + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf); +BOOL NPC_ActionWarpManReduce(int meindex,int talker,char *buf); +#ifdef _NPC_ActionFreeCmp +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf); +#endif +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img); +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif + +BOOL showString( int meindex, char *showstr,int flg); +BOOL NPC_getTimeXYPoint( int meindex, int Mode); +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed); +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode); +BOOL NPC_CheckTimeDefine( char *timetype); + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ); +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg); +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex); +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg); +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg); + +#ifdef _TREASURE_BOX +BOOL NPC_ActionTreasureTypeCheck( int meindex, int level, int type, int flg); +#endif +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, + int skillpoint, int exp, int ridepet); +#ifdef _ITEM_PILENUMS +BOOL NPC_ActionDoPileDelItem( int toindex, int itemID, int num); +BOOL NPC_DelItem( int toindex, int ti, int num); +#endif +void NPC_ActionDoPileClearItem( int toindex, int itemID); + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_RESTORE_POINT( int charaindex ); +#endif + + +#ifdef _NPC_ADDWARPMAN1 +BOOL NPC_ActionPartyCountCheck( int toindex, int nums, int flg); +BOOL NPC_ActionManCountCheck( int toindex, int nums, int flg);// +BOOL NPC_ActionWomanCountCheck( int toindex, int nums, int flg);//Ů +#endif + +#endif +0036:npc_exchangeman.h:0235:1:14=48041e4b:16=47d21313:#ifndef __NPC_EXCHANGEMAN_H__ +#define __NPC_EXCHANGEMAN_H__ + +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ExChangeManInit( int meindex ); +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + + +BOOL NPC_EventCheckFlg( int talker, int shiftbit); +BOOL NPC_NowEventCheckFlg( int talker, int shiftbit); + +// Arminius 8.14 move from .c (for pet talk) +BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); + +#endif + + + /*__NPC_EXCHANGEMAN_H__*/ + + +0034:npc_familyman.h:0187:1:14=48041e4b:16=47d21313:#ifndef __NPC_FAMILYMAN_H__ +#define __NPC_FAMILYMAN_H__ + +void NPC_FamilymanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FamilymanInit( int meindex ); +void NPC_FamilymanLooked( int meindex, int lookedindex ); +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FAMILYMAN_H__*/ +0033:npc_fmdengon.h:0111:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMDENGON_H__ +#define __NPC_FMDENGON_H__ + +BOOL NPC_FmDengonInit( int meindex ); +void NPC_FmDengonLooked( int meindex, int lookedindex ); +void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); + +#endif + +/*__NPC_FMDENGON_H__*/ +0032:npc_fmhealer.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMHEALER_H__ +#define __NPC_FMHEALER_H__ + +void NPC_FmHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_FmHealerInit( int meindex ); + +#endif +/*__NPC_FMHEALER_H__*/ +0033:npc_fmletter.h:0180:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMLETTER_H__ +#define __NPC_FMLETTER_H__ + +void NPC_FmLetterTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FmLetterInit( int meindex ); +void NPC_FmLetterLooked( int meindex, int lookedindex ); +void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FMLETTER_H__*/ +0036:npc_fmpkcallman.h:013B:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKCALLMAN_H__ +#define __NPC_FMPKCALLMAN_H__ + +void NPC_FMPKCallManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKCallManInit(int meindex); +void NPC_FMPKCallManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKCALLMAN_H__*/ +0032:npc_fmpkman.h:0123:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKMAN_H__ +#define __NPC_FMPKMAN_H__ + +void NPC_FMPKManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKManInit(int meindex); +void NPC_FMPKManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKMAN_H__*/ +0034:npc_fmwarpman.h:01A6:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMWARPMAN_H__ +#define __NPC_FMWARPMAN_H__ + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMWarpManInit(int meindex); +void NPC_FMWarpManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_FMWarpManLoop(int meindex); +void NPC_GetPKFMNum(int floor, int fmindex1, int fmindex2, int *num1, int *num2); + +#endif +/*__NPC_FMWARPMAN_H__*/ +003B:npc_freepetskillshop.h:01C4:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npc_autopk.h b/include/npc_autopk.h new file mode 100644 index 0000000..9c972f0 --- /dev/null +++ b/include/npc_autopk.h @@ -0,0 +1,21 @@ +#ifndef _AUTO_PK_H +#define _AUTO_PK_H + +void NPC_AutoPkTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_AutoPkInit( int meindex ); +void NPC_AutoPkWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_AutoPkLoop( void ); +void AutoPk_PKSystemTalk( char *token1, char *token2 ); +void AutoPk_PKSystemInfo(); +void AutoPk_PKTimeSet( int pktime ); +void AutoPk_PKTimeSetOnly( int pktime ); +int AutoPk_PKTimeGet( void ); +void AutoPk_AwardSet( int petid, char *pet, int itemid, char *item ); +void AutoPk_ChampionShipSet( char *cdkey, char *name, int winnum, int win ); +void NPC_AUTOPKHealerTalked( int meindex ); +void AutoPk_SetHistoryStr( void ); +void AutoPk_SetAwardStr( char *token ); +BOOL AutoPk_GetAwardStr( void ); +void AutoPk_GetChampionShip( void ); +void AutoPk_PKSystemStart( void ); +#endif diff --git a/include/npc_bankman.h b/include/npc_bankman.h new file mode 100644 index 0000000..8cd40c7 --- /dev/null +++ b/include/npc_bankman.h @@ -0,0 +1,12 @@ +#ifndef __NPC_BANKMAN_H__ +#define __NPC_BANKMAN_H__ + +void NPC_BankmanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_BankmanInit( int meindex ); +void NPC_BankmanLooked( int meindex, int lookedindex ); +void NPC_BankmanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + diff --git a/include/npc_bigsmallmaster.h b/include/npc_bigsmallmaster.h new file mode 100644 index 0000000..53ba813 --- /dev/null +++ b/include/npc_bigsmallmaster.h @@ -0,0 +1,346 @@ +0034:npc_bigsmallpet.h:00:1:14=48041e4b:16=47d21313:0034:npc_blackmarket.h:00:1:14=48041e4b:16=47d21313:0032:npc_bodylan.h:0166:1:14=48041e4b:16=47d21313:#ifndef __NPC_BODYLAN_H__ +#define __NPC_BODYLAN_H__ + +void NPC_BodyLanTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_BodyLanInit( int meindex ); +void NPC_BodyLanWatch( int meindex , int lookedindex); +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +); + +#endif +002E:npc_bus.h:016E:1:14=48041e4b:16=47d21313:#ifndef __NPC_BUS_H__ +#define __NPC_BUS_H__ + +BOOL NPC_BusInit( int meindex ); +void NPC_BusLoop( int meindex ); +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif + +0030:npc_charm.h:0156:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHARM_H__ +#define __NPC_CHARM_H__ + +void NPC_CharmTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CharmInit( int meindex ); +void NPC_CharmWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CharmLooked( int meindex , int lookedindex); + +#endif + +0033:npc_checkman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHECKMAN_H__ +#define __NPC_CHECKMAN_H__ + +void NPC_CheckManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CheckManInit( int meindex ); +void NPC_CheckManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CheckManLooked( int meindex , int lookedindex); + +#endif + +0031:npc_Dengon.h:0146:1:14=48041e4b:16=47d21313:#ifndef __NPC_DENGON_H__ +#define __NPC_DENGON_H__ +BOOL NPC_DengonInit( int meindex ); +//void NPC_DengonSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_DengonLooked( int meindex, int lookedindex ); +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data); + +#endif + +002F:npc_door.h:0470:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOOR_H__ +#define __NPC_DOOR_H__ + +BOOL NPC_DoorInit(int meindex ); +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_DoorPreAttacked(int meindex , int attacker , float *dm); +void NPC_DoorPostOver( int meindex , int movedindex ); +void NPC_DoorOff( int meindex , int movedindex ); +void NPC_DoorWatch( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +int NPC_DoorSearchByName( char *name ); +int NPC_DoorSearchByPosition( int fl , int x, int y ); +void NPC_DoorLooked( int meindex , int lookedindex ); +BOOL NPC_DoorRefreshOverFlg( int meind ); + + +/* ְNPCճ۽ľãNPC年л npc_stepswitch.cëǷ */ +int NPC_DoorSetPasswd( int meindex, char *pas ); +int NPC_DoorGetPasswd( int meindex, char *out , int len ); +void NPC_DoorFlip(int meindex , int doindex); +void NPC_DoorClose(int meindex , int doindex); +void NPC_DoorOpen(int meindex , int doindex ); +void NPC_DoorAddSwitchCounter( int meindex , int i , int talker ); +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ); + +#endif + + + + + +0031:npc_doorman.h:0CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOORMAN_H__ +#define __NPC_DOORMAN_H__ + +BOOL NPC_DoormanInit( int meindex ); +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ); + +#endif + +0036:npc_duelranking.h:01AD:1:14=48041e4b:16=47d21313:#ifndef __NPC_DUELRANKING_H__ +#define __NPC_DUELRANKING_H__ + +BOOL NPC_DuelrankingInit( int meindex ); +void NPC_DuelrankingLooked( int meindex, int lookedindex ); +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2); +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2); + +#endif + +0037:npc_eventaction.h:01505:1:14=48041e4b:16=47d21313:#ifndef _PRO_NPCFIX_H +#define _PRO_NPCFIX_H +//ANDY_Edit +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums); +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg); +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1); +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg); +BOOL Action_PartyCheck( int meindex, int talker); +BOOL NPC_ActionAddGold( int talker, int Golds); +BOOL NPC_ActionDelGold( int talker,char *buf); +BOOL NPC_ActionDelFame( int talker,char *buf); +BOOL NPC_ActionAddFame( int talker,char *buf); +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentum( int talker,char *buf); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDP( int talker,char *buf); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionDelVipPoint( int talker,char *buf); +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf); +BOOL NPC_ActionTransNew7( int talker, char *buf); +BOOL NPC_ActionTransNewSeven( int talker, char *buf); +#endif +// WON ADD +BOOL NPC_ActionAddGold2( int talker,char *buf); +BOOL NPC_ActionDelPet( int toindex,char *buf); +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int talker,char *msg); +#endif +BOOL NPC_ActionAddPet( int talker, char *buf); +BOOL NPC_ActionDelItem( int talker,char *buf); +BOOL NPC_ActionAddItem( int talker, char *buf); +BOOL NPC_ActionSetEend( int talkerindex, char * buf); +BOOL NPC_ActionSetNow( int toindex, char * buf); +BOOL NPC_ActionClearEvent( int toindex, char * buf); + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg); +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentumCheck(int meindex,int talker,int Momentum,int flg); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDPCheck(int meindex,int talker,int DP,int flg); +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck( int meindex,int talker,int p_class,int flg); + +BOOL NPC_ActionSkillCheck( int meindex,int talker,int skillId,int flg); +BOOL NPC_ActionSkillNumCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg); +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg); + +BOOL NPC_ActionCleanProfession( int toindex, char *buf); +BOOL NPC_ActionAddProfessionSkillPoint( int toindex, char *buf ); +#endif + +BOOL NPC_ActionGoldCheck(int meindex,int talker,int Golds,int flg); +BOOL NPC_ActionPartyCheck( int toindex, int nums, int flg); +BOOL NPC_ActionReItemCheck( int toindex, int nums, int flg); +BOOL NPC_ActionRePetCheck( int toindex, int nums, int flg); +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPC_ActionBigSmallLastCheck(int point1,int mypoint,int flg); + +BOOL NPC_ActionItemCheck(int meindex,int talker,int itemNo, int flg); +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg); + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp); + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf); +BOOL NPC_ActionWarpManReduce(int meindex,int talker,char *buf); +#ifdef _NPC_ActionFreeCmp +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf); +#endif +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img); +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif + +BOOL showString( int meindex, char *showstr,int flg); +BOOL NPC_getTimeXYPoint( int meindex, int Mode); +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed); +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode); +BOOL NPC_CheckTimeDefine( char *timetype); + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ); +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg); +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex); +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg); +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg); + +#ifdef _TREASURE_BOX +BOOL NPC_ActionTreasureTypeCheck( int meindex, int level, int type, int flg); +#endif +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, + int skillpoint, int exp, int ridepet); +#ifdef _ITEM_PILENUMS +BOOL NPC_ActionDoPileDelItem( int toindex, int itemID, int num); +BOOL NPC_DelItem( int toindex, int ti, int num); +#endif +void NPC_ActionDoPileClearItem( int toindex, int itemID); + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_RESTORE_POINT( int charaindex ); +#endif + + +#ifdef _NPC_ADDWARPMAN1 +BOOL NPC_ActionPartyCountCheck( int toindex, int nums, int flg); +BOOL NPC_ActionManCountCheck( int toindex, int nums, int flg);// +BOOL NPC_ActionWomanCountCheck( int toindex, int nums, int flg);//Ů +#endif + +#endif +0036:npc_exchangeman.h:0235:1:14=48041e4b:16=47d21313:#ifndef __NPC_EXCHANGEMAN_H__ +#define __NPC_EXCHANGEMAN_H__ + +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ExChangeManInit( int meindex ); +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + + +BOOL NPC_EventCheckFlg( int talker, int shiftbit); +BOOL NPC_NowEventCheckFlg( int talker, int shiftbit); + +// Arminius 8.14 move from .c (for pet talk) +BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); + +#endif + + + /*__NPC_EXCHANGEMAN_H__*/ + + +0034:npc_familyman.h:0187:1:14=48041e4b:16=47d21313:#ifndef __NPC_FAMILYMAN_H__ +#define __NPC_FAMILYMAN_H__ + +void NPC_FamilymanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FamilymanInit( int meindex ); +void NPC_FamilymanLooked( int meindex, int lookedindex ); +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FAMILYMAN_H__*/ +0033:npc_fmdengon.h:0111:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMDENGON_H__ +#define __NPC_FMDENGON_H__ + +BOOL NPC_FmDengonInit( int meindex ); +void NPC_FmDengonLooked( int meindex, int lookedindex ); +void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); + +#endif + +/*__NPC_FMDENGON_H__*/ +0032:npc_fmhealer.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMHEALER_H__ +#define __NPC_FMHEALER_H__ + +void NPC_FmHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_FmHealerInit( int meindex ); + +#endif +/*__NPC_FMHEALER_H__*/ +0033:npc_fmletter.h:0180:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMLETTER_H__ +#define __NPC_FMLETTER_H__ + +void NPC_FmLetterTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FmLetterInit( int meindex ); +void NPC_FmLetterLooked( int meindex, int lookedindex ); +void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FMLETTER_H__*/ +0036:npc_fmpkcallman.h:013B:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKCALLMAN_H__ +#define __NPC_FMPKCALLMAN_H__ + +void NPC_FMPKCallManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKCallManInit(int meindex); +void NPC_FMPKCallManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKCALLMAN_H__*/ +0032:npc_fmpkman.h:0123:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKMAN_H__ +#define __NPC_FMPKMAN_H__ + +void NPC_FMPKManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKManInit(int meindex); +void NPC_FMPKManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKMAN_H__*/ +0034:npc_fmwarpman.h:01A6:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMWARPMAN_H__ +#define __NPC_FMWARPMAN_H__ + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMWarpManInit(int meindex); +void NPC_FMWarpManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_FMWarpManLoop(int meindex); +void NPC_GetPKFMNum(int floor, int fmindex1, int fmindex2, int *num1, int *num2); + +#endif +/*__NPC_FMWARPMAN_H__*/ +003B:npc_freepetskillshop.h:01C4:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npc_bigsmallpet.h b/include/npc_bigsmallpet.h new file mode 100644 index 0000000..3d6a851 --- /dev/null +++ b/include/npc_bigsmallpet.h @@ -0,0 +1,346 @@ +0034:npc_blackmarket.h:00:1:14=48041e4b:16=47d21313:0032:npc_bodylan.h:0166:1:14=48041e4b:16=47d21313:#ifndef __NPC_BODYLAN_H__ +#define __NPC_BODYLAN_H__ + +void NPC_BodyLanTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_BodyLanInit( int meindex ); +void NPC_BodyLanWatch( int meindex , int lookedindex); +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +); + +#endif +002E:npc_bus.h:016E:1:14=48041e4b:16=47d21313:#ifndef __NPC_BUS_H__ +#define __NPC_BUS_H__ + +BOOL NPC_BusInit( int meindex ); +void NPC_BusLoop( int meindex ); +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif + +0030:npc_charm.h:0156:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHARM_H__ +#define __NPC_CHARM_H__ + +void NPC_CharmTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CharmInit( int meindex ); +void NPC_CharmWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CharmLooked( int meindex , int lookedindex); + +#endif + +0033:npc_checkman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHECKMAN_H__ +#define __NPC_CHECKMAN_H__ + +void NPC_CheckManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CheckManInit( int meindex ); +void NPC_CheckManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CheckManLooked( int meindex , int lookedindex); + +#endif + +0031:npc_Dengon.h:0146:1:14=48041e4b:16=47d21313:#ifndef __NPC_DENGON_H__ +#define __NPC_DENGON_H__ +BOOL NPC_DengonInit( int meindex ); +//void NPC_DengonSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_DengonLooked( int meindex, int lookedindex ); +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data); + +#endif + +002F:npc_door.h:0470:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOOR_H__ +#define __NPC_DOOR_H__ + +BOOL NPC_DoorInit(int meindex ); +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_DoorPreAttacked(int meindex , int attacker , float *dm); +void NPC_DoorPostOver( int meindex , int movedindex ); +void NPC_DoorOff( int meindex , int movedindex ); +void NPC_DoorWatch( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +int NPC_DoorSearchByName( char *name ); +int NPC_DoorSearchByPosition( int fl , int x, int y ); +void NPC_DoorLooked( int meindex , int lookedindex ); +BOOL NPC_DoorRefreshOverFlg( int meind ); + + +/* ְNPCճ۽ľãNPC年л npc_stepswitch.cëǷ */ +int NPC_DoorSetPasswd( int meindex, char *pas ); +int NPC_DoorGetPasswd( int meindex, char *out , int len ); +void NPC_DoorFlip(int meindex , int doindex); +void NPC_DoorClose(int meindex , int doindex); +void NPC_DoorOpen(int meindex , int doindex ); +void NPC_DoorAddSwitchCounter( int meindex , int i , int talker ); +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ); + +#endif + + + + + +0031:npc_doorman.h:0CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOORMAN_H__ +#define __NPC_DOORMAN_H__ + +BOOL NPC_DoormanInit( int meindex ); +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ); + +#endif + +0036:npc_duelranking.h:01AD:1:14=48041e4b:16=47d21313:#ifndef __NPC_DUELRANKING_H__ +#define __NPC_DUELRANKING_H__ + +BOOL NPC_DuelrankingInit( int meindex ); +void NPC_DuelrankingLooked( int meindex, int lookedindex ); +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2); +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2); + +#endif + +0037:npc_eventaction.h:01505:1:14=48041e4b:16=47d21313:#ifndef _PRO_NPCFIX_H +#define _PRO_NPCFIX_H +//ANDY_Edit +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums); +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg); +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1); +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg); +BOOL Action_PartyCheck( int meindex, int talker); +BOOL NPC_ActionAddGold( int talker, int Golds); +BOOL NPC_ActionDelGold( int talker,char *buf); +BOOL NPC_ActionDelFame( int talker,char *buf); +BOOL NPC_ActionAddFame( int talker,char *buf); +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentum( int talker,char *buf); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDP( int talker,char *buf); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionDelVipPoint( int talker,char *buf); +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf); +BOOL NPC_ActionTransNew7( int talker, char *buf); +BOOL NPC_ActionTransNewSeven( int talker, char *buf); +#endif +// WON ADD +BOOL NPC_ActionAddGold2( int talker,char *buf); +BOOL NPC_ActionDelPet( int toindex,char *buf); +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int talker,char *msg); +#endif +BOOL NPC_ActionAddPet( int talker, char *buf); +BOOL NPC_ActionDelItem( int talker,char *buf); +BOOL NPC_ActionAddItem( int talker, char *buf); +BOOL NPC_ActionSetEend( int talkerindex, char * buf); +BOOL NPC_ActionSetNow( int toindex, char * buf); +BOOL NPC_ActionClearEvent( int toindex, char * buf); + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg); +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentumCheck(int meindex,int talker,int Momentum,int flg); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDPCheck(int meindex,int talker,int DP,int flg); +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck( int meindex,int talker,int p_class,int flg); + +BOOL NPC_ActionSkillCheck( int meindex,int talker,int skillId,int flg); +BOOL NPC_ActionSkillNumCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg); +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg); + +BOOL NPC_ActionCleanProfession( int toindex, char *buf); +BOOL NPC_ActionAddProfessionSkillPoint( int toindex, char *buf ); +#endif + +BOOL NPC_ActionGoldCheck(int meindex,int talker,int Golds,int flg); +BOOL NPC_ActionPartyCheck( int toindex, int nums, int flg); +BOOL NPC_ActionReItemCheck( int toindex, int nums, int flg); +BOOL NPC_ActionRePetCheck( int toindex, int nums, int flg); +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPC_ActionBigSmallLastCheck(int point1,int mypoint,int flg); + +BOOL NPC_ActionItemCheck(int meindex,int talker,int itemNo, int flg); +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg); + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp); + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf); +BOOL NPC_ActionWarpManReduce(int meindex,int talker,char *buf); +#ifdef _NPC_ActionFreeCmp +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf); +#endif +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img); +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif + +BOOL showString( int meindex, char *showstr,int flg); +BOOL NPC_getTimeXYPoint( int meindex, int Mode); +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed); +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode); +BOOL NPC_CheckTimeDefine( char *timetype); + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ); +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg); +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex); +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg); +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg); + +#ifdef _TREASURE_BOX +BOOL NPC_ActionTreasureTypeCheck( int meindex, int level, int type, int flg); +#endif +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, + int skillpoint, int exp, int ridepet); +#ifdef _ITEM_PILENUMS +BOOL NPC_ActionDoPileDelItem( int toindex, int itemID, int num); +BOOL NPC_DelItem( int toindex, int ti, int num); +#endif +void NPC_ActionDoPileClearItem( int toindex, int itemID); + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_RESTORE_POINT( int charaindex ); +#endif + + +#ifdef _NPC_ADDWARPMAN1 +BOOL NPC_ActionPartyCountCheck( int toindex, int nums, int flg); +BOOL NPC_ActionManCountCheck( int toindex, int nums, int flg);// +BOOL NPC_ActionWomanCountCheck( int toindex, int nums, int flg);//Ů +#endif + +#endif +0036:npc_exchangeman.h:0235:1:14=48041e4b:16=47d21313:#ifndef __NPC_EXCHANGEMAN_H__ +#define __NPC_EXCHANGEMAN_H__ + +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ExChangeManInit( int meindex ); +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + + +BOOL NPC_EventCheckFlg( int talker, int shiftbit); +BOOL NPC_NowEventCheckFlg( int talker, int shiftbit); + +// Arminius 8.14 move from .c (for pet talk) +BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); + +#endif + + + /*__NPC_EXCHANGEMAN_H__*/ + + +0034:npc_familyman.h:0187:1:14=48041e4b:16=47d21313:#ifndef __NPC_FAMILYMAN_H__ +#define __NPC_FAMILYMAN_H__ + +void NPC_FamilymanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FamilymanInit( int meindex ); +void NPC_FamilymanLooked( int meindex, int lookedindex ); +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FAMILYMAN_H__*/ +0033:npc_fmdengon.h:0111:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMDENGON_H__ +#define __NPC_FMDENGON_H__ + +BOOL NPC_FmDengonInit( int meindex ); +void NPC_FmDengonLooked( int meindex, int lookedindex ); +void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); + +#endif + +/*__NPC_FMDENGON_H__*/ +0032:npc_fmhealer.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMHEALER_H__ +#define __NPC_FMHEALER_H__ + +void NPC_FmHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_FmHealerInit( int meindex ); + +#endif +/*__NPC_FMHEALER_H__*/ +0033:npc_fmletter.h:0180:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMLETTER_H__ +#define __NPC_FMLETTER_H__ + +void NPC_FmLetterTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FmLetterInit( int meindex ); +void NPC_FmLetterLooked( int meindex, int lookedindex ); +void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FMLETTER_H__*/ +0036:npc_fmpkcallman.h:013B:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKCALLMAN_H__ +#define __NPC_FMPKCALLMAN_H__ + +void NPC_FMPKCallManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKCallManInit(int meindex); +void NPC_FMPKCallManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKCALLMAN_H__*/ +0032:npc_fmpkman.h:0123:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKMAN_H__ +#define __NPC_FMPKMAN_H__ + +void NPC_FMPKManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKManInit(int meindex); +void NPC_FMPKManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKMAN_H__*/ +0034:npc_fmwarpman.h:01A6:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMWARPMAN_H__ +#define __NPC_FMWARPMAN_H__ + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMWarpManInit(int meindex); +void NPC_FMWarpManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_FMWarpManLoop(int meindex); +void NPC_GetPKFMNum(int floor, int fmindex1, int fmindex2, int *num1, int *num2); + +#endif +/*__NPC_FMWARPMAN_H__*/ +003B:npc_freepetskillshop.h:01C4:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npc_blackmarket.h b/include/npc_blackmarket.h new file mode 100644 index 0000000..2a3347a --- /dev/null +++ b/include/npc_blackmarket.h @@ -0,0 +1,346 @@ +0032:npc_bodylan.h:0166:1:14=48041e4b:16=47d21313:#ifndef __NPC_BODYLAN_H__ +#define __NPC_BODYLAN_H__ + +void NPC_BodyLanTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_BodyLanInit( int meindex ); +void NPC_BodyLanWatch( int meindex , int lookedindex); +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +); + +#endif +002E:npc_bus.h:016E:1:14=48041e4b:16=47d21313:#ifndef __NPC_BUS_H__ +#define __NPC_BUS_H__ + +BOOL NPC_BusInit( int meindex ); +void NPC_BusLoop( int meindex ); +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif + +0030:npc_charm.h:0156:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHARM_H__ +#define __NPC_CHARM_H__ + +void NPC_CharmTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CharmInit( int meindex ); +void NPC_CharmWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CharmLooked( int meindex , int lookedindex); + +#endif + +0033:npc_checkman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_CHECKMAN_H__ +#define __NPC_CHECKMAN_H__ + +void NPC_CheckManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CheckManInit( int meindex ); +void NPC_CheckManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CheckManLooked( int meindex , int lookedindex); + +#endif + +0031:npc_Dengon.h:0146:1:14=48041e4b:16=47d21313:#ifndef __NPC_DENGON_H__ +#define __NPC_DENGON_H__ +BOOL NPC_DengonInit( int meindex ); +//void NPC_DengonSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_DengonLooked( int meindex, int lookedindex ); +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data); + +#endif + +002F:npc_door.h:0470:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOOR_H__ +#define __NPC_DOOR_H__ + +BOOL NPC_DoorInit(int meindex ); +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_DoorPreAttacked(int meindex , int attacker , float *dm); +void NPC_DoorPostOver( int meindex , int movedindex ); +void NPC_DoorOff( int meindex , int movedindex ); +void NPC_DoorWatch( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +int NPC_DoorSearchByName( char *name ); +int NPC_DoorSearchByPosition( int fl , int x, int y ); +void NPC_DoorLooked( int meindex , int lookedindex ); +BOOL NPC_DoorRefreshOverFlg( int meind ); + + +/* ְNPCճ۽ľãNPC年л npc_stepswitch.cëǷ */ +int NPC_DoorSetPasswd( int meindex, char *pas ); +int NPC_DoorGetPasswd( int meindex, char *out , int len ); +void NPC_DoorFlip(int meindex , int doindex); +void NPC_DoorClose(int meindex , int doindex); +void NPC_DoorOpen(int meindex , int doindex ); +void NPC_DoorAddSwitchCounter( int meindex , int i , int talker ); +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ); + +#endif + + + + + +0031:npc_doorman.h:0CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_DOORMAN_H__ +#define __NPC_DOORMAN_H__ + +BOOL NPC_DoormanInit( int meindex ); +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ); + +#endif + +0036:npc_duelranking.h:01AD:1:14=48041e4b:16=47d21313:#ifndef __NPC_DUELRANKING_H__ +#define __NPC_DUELRANKING_H__ + +BOOL NPC_DuelrankingInit( int meindex ); +void NPC_DuelrankingLooked( int meindex, int lookedindex ); +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2); +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2); + +#endif + +0037:npc_eventaction.h:01505:1:14=48041e4b:16=47d21313:#ifndef _PRO_NPCFIX_H +#define _PRO_NPCFIX_H +//ANDY_Edit +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums); +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg); +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1); +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg); +BOOL Action_PartyCheck( int meindex, int talker); +BOOL NPC_ActionAddGold( int talker, int Golds); +BOOL NPC_ActionDelGold( int talker,char *buf); +BOOL NPC_ActionDelFame( int talker,char *buf); +BOOL NPC_ActionAddFame( int talker,char *buf); +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentum( int talker,char *buf); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDP( int talker,char *buf); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionDelVipPoint( int talker,char *buf); +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf); +BOOL NPC_ActionTransNew7( int talker, char *buf); +BOOL NPC_ActionTransNewSeven( int talker, char *buf); +#endif +// WON ADD +BOOL NPC_ActionAddGold2( int talker,char *buf); +BOOL NPC_ActionDelPet( int toindex,char *buf); +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int talker,char *msg); +#endif +BOOL NPC_ActionAddPet( int talker, char *buf); +BOOL NPC_ActionDelItem( int talker,char *buf); +BOOL NPC_ActionAddItem( int talker, char *buf); +BOOL NPC_ActionSetEend( int talkerindex, char * buf); +BOOL NPC_ActionSetNow( int toindex, char * buf); +BOOL NPC_ActionClearEvent( int toindex, char * buf); + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg); +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentumCheck(int meindex,int talker,int Momentum,int flg); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDPCheck(int meindex,int talker,int DP,int flg); +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck( int meindex,int talker,int p_class,int flg); + +BOOL NPC_ActionSkillCheck( int meindex,int talker,int skillId,int flg); +BOOL NPC_ActionSkillNumCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg); +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg); + +BOOL NPC_ActionCleanProfession( int toindex, char *buf); +BOOL NPC_ActionAddProfessionSkillPoint( int toindex, char *buf ); +#endif + +BOOL NPC_ActionGoldCheck(int meindex,int talker,int Golds,int flg); +BOOL NPC_ActionPartyCheck( int toindex, int nums, int flg); +BOOL NPC_ActionReItemCheck( int toindex, int nums, int flg); +BOOL NPC_ActionRePetCheck( int toindex, int nums, int flg); +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPC_ActionBigSmallLastCheck(int point1,int mypoint,int flg); + +BOOL NPC_ActionItemCheck(int meindex,int talker,int itemNo, int flg); +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg); + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp); + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf); +BOOL NPC_ActionWarpManReduce(int meindex,int talker,char *buf); +#ifdef _NPC_ActionFreeCmp +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf); +#endif +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img); +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif + +BOOL showString( int meindex, char *showstr,int flg); +BOOL NPC_getTimeXYPoint( int meindex, int Mode); +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed); +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode); +BOOL NPC_CheckTimeDefine( char *timetype); + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ); +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg); +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex); +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg); +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg); + +#ifdef _TREASURE_BOX +BOOL NPC_ActionTreasureTypeCheck( int meindex, int level, int type, int flg); +#endif +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, + int skillpoint, int exp, int ridepet); +#ifdef _ITEM_PILENUMS +BOOL NPC_ActionDoPileDelItem( int toindex, int itemID, int num); +BOOL NPC_DelItem( int toindex, int ti, int num); +#endif +void NPC_ActionDoPileClearItem( int toindex, int itemID); + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_RESTORE_POINT( int charaindex ); +#endif + + +#ifdef _NPC_ADDWARPMAN1 +BOOL NPC_ActionPartyCountCheck( int toindex, int nums, int flg); +BOOL NPC_ActionManCountCheck( int toindex, int nums, int flg);// +BOOL NPC_ActionWomanCountCheck( int toindex, int nums, int flg);//Ů +#endif + +#endif +0036:npc_exchangeman.h:0235:1:14=48041e4b:16=47d21313:#ifndef __NPC_EXCHANGEMAN_H__ +#define __NPC_EXCHANGEMAN_H__ + +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ExChangeManInit( int meindex ); +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + + +BOOL NPC_EventCheckFlg( int talker, int shiftbit); +BOOL NPC_NowEventCheckFlg( int talker, int shiftbit); + +// Arminius 8.14 move from .c (for pet talk) +BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); + +#endif + + + /*__NPC_EXCHANGEMAN_H__*/ + + +0034:npc_familyman.h:0187:1:14=48041e4b:16=47d21313:#ifndef __NPC_FAMILYMAN_H__ +#define __NPC_FAMILYMAN_H__ + +void NPC_FamilymanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FamilymanInit( int meindex ); +void NPC_FamilymanLooked( int meindex, int lookedindex ); +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FAMILYMAN_H__*/ +0033:npc_fmdengon.h:0111:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMDENGON_H__ +#define __NPC_FMDENGON_H__ + +BOOL NPC_FmDengonInit( int meindex ); +void NPC_FmDengonLooked( int meindex, int lookedindex ); +void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); + +#endif + +/*__NPC_FMDENGON_H__*/ +0032:npc_fmhealer.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMHEALER_H__ +#define __NPC_FMHEALER_H__ + +void NPC_FmHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_FmHealerInit( int meindex ); + +#endif +/*__NPC_FMHEALER_H__*/ +0033:npc_fmletter.h:0180:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMLETTER_H__ +#define __NPC_FMLETTER_H__ + +void NPC_FmLetterTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FmLetterInit( int meindex ); +void NPC_FmLetterLooked( int meindex, int lookedindex ); +void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FMLETTER_H__*/ +0036:npc_fmpkcallman.h:013B:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKCALLMAN_H__ +#define __NPC_FMPKCALLMAN_H__ + +void NPC_FMPKCallManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKCallManInit(int meindex); +void NPC_FMPKCallManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKCALLMAN_H__*/ +0032:npc_fmpkman.h:0123:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMPKMAN_H__ +#define __NPC_FMPKMAN_H__ + +void NPC_FMPKManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKManInit(int meindex); +void NPC_FMPKManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKMAN_H__*/ +0034:npc_fmwarpman.h:01A6:1:14=48041e4b:16=47d21313:#ifndef __NPC_FMWARPMAN_H__ +#define __NPC_FMWARPMAN_H__ + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMWarpManInit(int meindex); +void NPC_FMWarpManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_FMWarpManLoop(int meindex); +void NPC_GetPKFMNum(int floor, int fmindex1, int fmindex2, int *num1, int *num2); + +#endif +/*__NPC_FMWARPMAN_H__*/ +003B:npc_freepetskillshop.h:01C4:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npc_bodylan.h b/include/npc_bodylan.h new file mode 100644 index 0000000..57f2e30 --- /dev/null +++ b/include/npc_bodylan.h @@ -0,0 +1,16 @@ +#ifndef __NPC_BODYLAN_H__ +#define __NPC_BODYLAN_H__ + +void NPC_BodyLanTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_BodyLanInit( int meindex ); +void NPC_BodyLanWatch( int meindex , int lookedindex); +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +); + +#endif diff --git a/include/npc_bus.h b/include/npc_bus.h new file mode 100644 index 0000000..98d5d6a --- /dev/null +++ b/include/npc_bus.h @@ -0,0 +1,12 @@ +#ifndef __NPC_BUS_H__ +#define __NPC_BUS_H__ + +BOOL NPC_BusInit( int meindex ); +void NPC_BusLoop( int meindex ); +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ); +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode); +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg); + +#endif + diff --git a/include/npc_charm.h b/include/npc_charm.h new file mode 100644 index 0000000..73785a7 --- /dev/null +++ b/include/npc_charm.h @@ -0,0 +1,11 @@ +#ifndef __NPC_CHARM_H__ +#define __NPC_CHARM_H__ + +void NPC_CharmTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CharmInit( int meindex ); +void NPC_CharmWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CharmLooked( int meindex , int lookedindex); + +#endif + diff --git a/include/npc_checkman.h b/include/npc_checkman.h new file mode 100644 index 0000000..77fbf31 --- /dev/null +++ b/include/npc_checkman.h @@ -0,0 +1,11 @@ +#ifndef __NPC_CHECKMAN_H__ +#define __NPC_CHECKMAN_H__ + +void NPC_CheckManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_CheckManInit( int meindex ); +void NPC_CheckManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_CheckManLooked( int meindex , int lookedindex); + +#endif + diff --git a/include/npc_door.h b/include/npc_door.h new file mode 100644 index 0000000..003c71a --- /dev/null +++ b/include/npc_door.h @@ -0,0 +1,31 @@ +#ifndef __NPC_DOOR_H__ +#define __NPC_DOOR_H__ + +BOOL NPC_DoorInit(int meindex ); +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_DoorPreAttacked(int meindex , int attacker , float *dm); +void NPC_DoorPostOver( int meindex , int movedindex ); +void NPC_DoorOff( int meindex , int movedindex ); +void NPC_DoorWatch( int meindex, int moveindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ); +int NPC_DoorSearchByName( char *name ); +int NPC_DoorSearchByPosition( int fl , int x, int y ); +void NPC_DoorLooked( int meindex , int lookedindex ); +BOOL NPC_DoorRefreshOverFlg( int meind ); + + +/* ְNPCճ۽ľãNPC年л npc_stepswitch.cëǷ */ +int NPC_DoorSetPasswd( int meindex, char *pas ); +int NPC_DoorGetPasswd( int meindex, char *out , int len ); +void NPC_DoorFlip(int meindex , int doindex); +void NPC_DoorClose(int meindex , int doindex); +void NPC_DoorOpen(int meindex , int doindex ); +void NPC_DoorAddSwitchCounter( int meindex , int i , int talker ); +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ); + +#endif + + + + + diff --git a/include/npc_doorman.h b/include/npc_doorman.h new file mode 100644 index 0000000..52e32de --- /dev/null +++ b/include/npc_doorman.h @@ -0,0 +1,9 @@ +#ifndef __NPC_DOORMAN_H__ +#define __NPC_DOORMAN_H__ + +BOOL NPC_DoormanInit( int meindex ); +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ); + +#endif + diff --git a/include/npc_duelranking.h b/include/npc_duelranking.h new file mode 100644 index 0000000..74dbe35 --- /dev/null +++ b/include/npc_duelranking.h @@ -0,0 +1,11 @@ +#ifndef __NPC_DUELRANKING_H__ +#define __NPC_DUELRANKING_H__ + +BOOL NPC_DuelrankingInit( int meindex ); +void NPC_DuelrankingLooked( int meindex, int lookedindex ); +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2); +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2); + +#endif + diff --git a/include/npc_eventaction.h b/include/npc_eventaction.h new file mode 100644 index 0000000..4f264bd --- /dev/null +++ b/include/npc_eventaction.h @@ -0,0 +1,137 @@ +#ifndef _PRO_NPCFIX_H +#define _PRO_NPCFIX_H +//ANDY_Edit +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums); +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg); +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1); +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg); +BOOL Action_PartyCheck( int meindex, int talker); +BOOL NPC_ActionAddGold( int talker, int Golds); +BOOL NPC_ActionDelGold( int talker,char *buf); +BOOL NPC_ActionDelFame( int talker,char *buf); +BOOL NPC_ActionAddFame( int talker,char *buf); +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentum( int talker,char *buf); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDP( int talker,char *buf); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionDelVipPoint( int talker,char *buf); +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf); +BOOL NPC_ActionTransNew7( int talker, char *buf); +BOOL NPC_ActionTransNewSeven( int talker, char *buf); +#endif +// WON ADD +BOOL NPC_ActionAddGold2( int talker,char *buf); +BOOL NPC_ActionDelPet( int toindex,char *buf); +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int talker,char *msg); +#endif +BOOL NPC_ActionAddPet( int talker, char *buf); +BOOL NPC_ActionDelItem( int talker,char *buf); +BOOL NPC_ActionAddItem( int talker, char *buf); +BOOL NPC_ActionSetEend( int talkerindex, char * buf); +BOOL NPC_ActionSetNow( int toindex, char * buf); +BOOL NPC_ActionClearEvent( int toindex, char * buf); + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg); +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg); +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg); +#endif +#ifdef _MOMENTUM_NPC +BOOL NPC_ActionMomentumCheck(int meindex,int talker,int Momentum,int flg); +#endif +#ifdef _DP_NPC +BOOL NPC_ActionDPCheck(int meindex,int talker,int DP,int flg); +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck( int meindex,int talker,int p_class,int flg); + +BOOL NPC_ActionSkillCheck( int meindex,int talker,int skillId,int flg); +BOOL NPC_ActionSkillNumCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg); + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg); +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg); + +BOOL NPC_ActionCleanProfession( int toindex, char *buf); +BOOL NPC_ActionAddProfessionSkillPoint( int toindex, char *buf ); +#endif + +BOOL NPC_ActionGoldCheck(int meindex,int talker,int Golds,int flg); +BOOL NPC_ActionPartyCheck( int toindex, int nums, int flg); +BOOL NPC_ActionReItemCheck( int toindex, int nums, int flg); +BOOL NPC_ActionRePetCheck( int toindex, int nums, int flg); +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPC_ActionBigSmallLastCheck(int point1,int mypoint,int flg); + +BOOL NPC_ActionItemCheck(int meindex,int talker,int itemNo, int flg); +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg); + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp); + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf); +BOOL NPC_ActionWarpManReduce(int meindex,int talker,char *buf); +#ifdef _NPC_ActionFreeCmp +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf); +#endif +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img); +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg); +#endif + +BOOL showString( int meindex, char *showstr,int flg); +BOOL NPC_getTimeXYPoint( int meindex, int Mode); +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed); +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode); +BOOL NPC_CheckTimeDefine( char *timetype); + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ); +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg); +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex); +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg); +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg); + +#ifdef _TREASURE_BOX +BOOL NPC_ActionTreasureTypeCheck( int meindex, int level, int type, int flg); +#endif +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, + int skillpoint, int exp, int ridepet); +#ifdef _ITEM_PILENUMS +BOOL NPC_ActionDoPileDelItem( int toindex, int itemID, int num); +BOOL NPC_DelItem( int toindex, int ti, int num); +#endif +void NPC_ActionDoPileClearItem( int toindex, int itemID); + + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_RESTORE_POINT( int charaindex ); +#endif + + +#ifdef _NPC_ADDWARPMAN1 +BOOL NPC_ActionPartyCountCheck( int toindex, int nums, int flg); +BOOL NPC_ActionManCountCheck( int toindex, int nums, int flg);// +BOOL NPC_ActionWomanCountCheck( int toindex, int nums, int flg);//Ů +#endif + +BOOL NPC_ActionWarpNpc(int meindex,char *buf); + +#endif diff --git a/include/npc_exchangeman.h b/include/npc_exchangeman.h new file mode 100644 index 0000000..b3faa4a --- /dev/null +++ b/include/npc_exchangeman.h @@ -0,0 +1,22 @@ +#ifndef __NPC_EXCHANGEMAN_H__ +#define __NPC_EXCHANGEMAN_H__ +BOOL NPC_TypeCheck(int meindex,int talker,char *szMes); +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ExChangeManInit( int meindex ); +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + + +BOOL NPC_EventCheckFlg( int talker, int shiftbit); +BOOL NPC_NowEventCheckFlg( int talker, int shiftbit); + +// Arminius 8.14 move from .c (for pet talk) +BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); + +#endif + + + /*__NPC_EXCHANGEMAN_H__*/ + + diff --git a/include/npc_familyman.h b/include/npc_familyman.h new file mode 100644 index 0000000..57e08d4 --- /dev/null +++ b/include/npc_familyman.h @@ -0,0 +1,13 @@ +#ifndef __NPC_FAMILYMAN_H__ +#define __NPC_FAMILYMAN_H__ + +void NPC_FamilymanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FamilymanInit( int meindex ); +void NPC_FamilymanLooked( int meindex, int lookedindex ); +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FAMILYMAN_H__*/ diff --git a/include/npc_fmdengon.h b/include/npc_fmdengon.h new file mode 100644 index 0000000..858f170 --- /dev/null +++ b/include/npc_fmdengon.h @@ -0,0 +1,10 @@ +#ifndef __NPC_FMDENGON_H__ +#define __NPC_FMDENGON_H__ + +BOOL NPC_FmDengonInit( int meindex ); +void NPC_FmDengonLooked( int meindex, int lookedindex ); +void NPC_FmDengonWindowTalked( int index, int talker, int seqno, int select, char *data); + +#endif + +/*__NPC_FMDENGON_H__*/ diff --git a/include/npc_fmhealer.h b/include/npc_fmhealer.h new file mode 100644 index 0000000..2c62fce --- /dev/null +++ b/include/npc_fmhealer.h @@ -0,0 +1,9 @@ +#ifndef __NPC_FMHEALER_H__ +#define __NPC_FMHEALER_H__ + +void NPC_FmHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_FmHealerInit( int meindex ); + +#endif +/*__NPC_FMHEALER_H__*/ diff --git a/include/npc_fmletter.h b/include/npc_fmletter.h new file mode 100644 index 0000000..f60aef5 --- /dev/null +++ b/include/npc_fmletter.h @@ -0,0 +1,13 @@ +#ifndef __NPC_FMLETTER_H__ +#define __NPC_FMLETTER_H__ + +void NPC_FmLetterTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_FmLetterInit( int meindex ); +void NPC_FmLetterLooked( int meindex, int lookedindex ); +void NPC_FmLetterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_FMLETTER_H__*/ diff --git a/include/npc_fmlookwar.h b/include/npc_fmlookwar.h new file mode 100644 index 0000000..2a7f8a5 --- /dev/null +++ b/include/npc_fmlookwar.h @@ -0,0 +1,6 @@ +#ifdef _FM_NPC_LOOK_WAR +void NPC_FmLookWarManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_FmLookWarManInit( int meindex ); +void NPC_FmLookWarManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_FmLookWarManLoop( int meindex); +#endif diff --git a/include/npc_fmlookwar1.h b/include/npc_fmlookwar1.h new file mode 100644 index 0000000..35f1142 --- /dev/null +++ b/include/npc_fmlookwar1.h @@ -0,0 +1,6 @@ +#ifdef _FM_NPC_LOOK_WAR1 +void NPC_FmLookWarMan1Talked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_FmLookWarMan1Init( int meindex ); +void NPC_FmLookWarMan1WindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_FmLookWarMan1Loop( int meindex); +#endif diff --git a/include/npc_fmpkcallman.h b/include/npc_fmpkcallman.h new file mode 100644 index 0000000..8702b1c --- /dev/null +++ b/include/npc_fmpkcallman.h @@ -0,0 +1,10 @@ +#ifndef __NPC_FMPKCALLMAN_H__ +#define __NPC_FMPKCALLMAN_H__ + +void NPC_FMPKCallManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKCallManInit(int meindex); +void NPC_FMPKCallManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKCALLMAN_H__*/ diff --git a/include/npc_fmpkman.h b/include/npc_fmpkman.h new file mode 100644 index 0000000..2053f02 --- /dev/null +++ b/include/npc_fmpkman.h @@ -0,0 +1,10 @@ +#ifndef __NPC_FMPKMAN_H__ +#define __NPC_FMPKMAN_H__ + +void NPC_FMPKManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMPKManInit(int meindex); +void NPC_FMPKManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); + +#endif +/*__NPC_FMPKMAN_H__*/ diff --git a/include/npc_fmrank.h b/include/npc_fmrank.h new file mode 100644 index 0000000..7af32fc --- /dev/null +++ b/include/npc_fmrank.h @@ -0,0 +1,4 @@ +void NPC_FmRankTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_FmRankInit( int meindex ); +void NPC_FmRankWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_FmRankLoop( void ); diff --git a/include/npc_fmwarpman.h b/include/npc_fmwarpman.h new file mode 100644 index 0000000..5b8e4ac --- /dev/null +++ b/include/npc_fmwarpman.h @@ -0,0 +1,12 @@ +#ifndef __NPC_FMWARPMAN_H__ +#define __NPC_FMWARPMAN_H__ + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *msg, int color); +BOOL NPC_FMWarpManInit(int meindex); +void NPC_FMWarpManWindowTalked(int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_FMWarpManLoop(int meindex); +void NPC_GetPKFMNum(int floor, int fmindex1, int fmindex2, int *num1, int *num2); + +#endif +/*__NPC_FMWARPMAN_H__*/ diff --git a/include/npc_freepetskillshop.h b/include/npc_freepetskillshop.h new file mode 100644 index 0000000..73bc822 --- /dev/null +++ b/include/npc_freepetskillshop.h @@ -0,0 +1,10 @@ +#ifndef __NPC_FREEPETSKILLSHOP_H__ +#define __NPC_FREEPETSKILLSHOP_H__ + +BOOL NPC_FreePetSkillShopInit( int meindex ); +void NPC_FreePetSkillShopTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_FreePetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +//void NPC_PetSkillShopLooked( int meindex , int lookedindex); +BOOL NPC_CHECKFREEPETSKILL( int toindex, int petindex, int skillID); +#endif + diff --git a/include/npc_gamblebank.h b/include/npc_gamblebank.h new file mode 100644 index 0000000..017f2c1 --- /dev/null +++ b/include/npc_gamblebank.h @@ -0,0 +1,9 @@ +#ifndef __NPC_GAMBLEBANK_H__ +#define __NPC_GAMBLEBANK_H__ +BOOL NPC_GambleBankInit( int meindex ); +void NPC_GambleBankLoop( int meindex); +void NPC_GambleBankTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_GambleBankWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +#endif + + diff --git a/include/npc_gamblemaster.h b/include/npc_gamblemaster.h new file mode 100644 index 0000000..9c28474 --- /dev/null +++ b/include/npc_gamblemaster.h @@ -0,0 +1,9 @@ +#ifndef NPC_Gamble_Master_ +#define NPC_Gamble_Master_ + +BOOL NPC_Gamble_MasterInit( int meindex ); +void NPC_Gamble_MasterLoop( int meindex ); +void NPC_Gamble_MasterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Gamble_MasterTalked( int meindex , int talkerindex , char *szMes , int color ); +#endif + diff --git a/include/npc_gambleroulette.h b/include/npc_gambleroulette.h new file mode 100644 index 0000000..0dacc59 --- /dev/null +++ b/include/npc_gambleroulette.h @@ -0,0 +1,9 @@ +#ifndef NPC_Gamble_Roulette_ +#define NPC_Gamble_Roulette_ + +BOOL NPC_Gamble_RouletteInit( int meindex ); +void NPC_Gamble_RouletteLoop( int meindex ); +void NPC_Gamble_RouletteWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_Gamble_RouletteTalked( int meindex , int talkerindex , char *szMes , int color ); +#endif + diff --git a/include/npc_healer.h b/include/npc_healer.h new file mode 100644 index 0000000..70ff815 --- /dev/null +++ b/include/npc_healer.h @@ -0,0 +1,10 @@ +#ifndef __NPC_HEALER_H__ +#define __NPC_HEALER_H__ + +void NPC_HealerTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_HealerInit( int meindex ); + +#endif + /*__NPC_HEALER_H__*/ diff --git a/include/npc_itemchange.h b/include/npc_itemchange.h new file mode 100644 index 0000000..63ac849 --- /dev/null +++ b/include/npc_itemchange.h @@ -0,0 +1,12 @@ +#ifndef _ITEM_CHANGE_ +#define _ITEM_CHANGE_ + +//#ifdef _CFREE_petskill +BOOL NPC_ItemchangeManInit( int meindex ); +void NPC_ItemchangeManTalked( int meindex, int talkerindex, char *msg, int color ); +void NPC_ItemchangeManWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_ItemchangeManLoop( int meindex); + +#endif + diff --git a/include/npc_itemshop.h b/include/npc_itemshop.h new file mode 100644 index 0000000..f6d757b --- /dev/null +++ b/include/npc_itemshop.h @@ -0,0 +1,12 @@ +#ifndef __NPC_ITEMSHOP_H__ +#define __NPC_ITEMSHOP_H__ + +void NPC_ItemShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ItemShopInit( int meindex ); +void NPC_ItemShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_ItemShopLooked( int meindex , int lookedindex); + + +#endif + /*__NPC_ITEMSHOP_H__*/ diff --git a/include/npc_itemup.h b/include/npc_itemup.h new file mode 100644 index 0000000..4309579 --- /dev/null +++ b/include/npc_itemup.h @@ -0,0 +1,7 @@ +BOOL NPC_ItemupManInit( int meindex ); +void NPC_ItemupManTalked( int meindex, int talkerindex, char *msg, int color ); +void NPC_ItemupManWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data); +void NPC_ItemupManLoop( int meindex); + + diff --git a/include/npc_itemvippointshop.h b/include/npc_itemvippointshop.h new file mode 100644 index 0000000..9312879 --- /dev/null +++ b/include/npc_itemvippointshop.h @@ -0,0 +1,10 @@ + + +void NPC_ItemVippointShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ItemVippointShopInit( int meindex ); +void NPC_ItemVippointShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_ItemVippointShopLooked( int meindex , int lookedindex); + + + /*__NPC_ITEMSHOP_H__*/ diff --git a/include/npc_janken.h b/include/npc_janken.h new file mode 100644 index 0000000..411abb8 --- /dev/null +++ b/include/npc_janken.h @@ -0,0 +1,10 @@ +#ifndef __NPC_JANKEN_H__ +#define __NPC_JANKEN_H__ + +void NPC_JankenTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_JankenInit( int meindex ); +void NPC_JankenWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + /*__NPC_JANKEN_H__*/ diff --git a/include/npc_lua.h b/include/npc_lua.h new file mode 100644 index 0000000..ce22cae --- /dev/null +++ b/include/npc_lua.h @@ -0,0 +1,516 @@ +#ifndef __NPC_LUA__ +#define __NPC_LUA__ + +#include "npc_lua_interface.h" +#include "../lua/lua.h" +#include "../lua/lauxlib.h" +#include +#include +#include +#include + +#define LUA_DATALINE0 0 +#define LUA_DATALINE1 2000 +#define LUA_DATALINE2 4000 +#define LUA_DATALINE3 6000 +#define LUA_DATALINE4 8000 +#define LUA_DATALINE5 10000 + +typedef struct __CREATEENEMY +{ + int EnemyId; + int BaseLevel; + int SkillType; +}CREATEENEMY,*PCREATEENEMY; + +typedef struct __SCRIPTREGLIB +{ + const char *LibName; // + luaL_reg *FuncRegList; //Ҫעĺ⺯б +}SCRIPTREGLIB,*PSCRIPTREGLIB; + +typedef struct __SCRIPTREGCLASS +{ + const char *ClassName; // + PSCRIPTREGLIB NewLib; //ʵ SCRIPTREGLIB + luaL_reg *FuncRegList; //Ҫעຯб +}SCRIPTREGCLASS,*PSCRIPTREGCLASS; + +typedef struct __SCRIPTREGARRAY +{ + const char *ArrayName; // + const char **SetMetaTable; //Ӧ + const char **SetFuncName; //Ӧĺ + PSCRIPTREGLIB FuncList; //ӦӦ SetMetaTable Ĵб +}SCRIPTREGARRAY,*PSCRIPTREGARRAY; + +typedef struct __ARRAY_NTINT +{ + size_t Size; + int Num[1]; +}ARRAY_NTINT,*PARRAY_NTINT; + +//NPC-NPCΨһ +int NPC_Lua_Create(const char *_DoFile, const char *_InitFuncName, char *_seek, BOOL _IsFly); + +//ɾNPC NPCΨһ +int NPC_Lua_Del(int _index); + +//ս +int NPC_Lua_CreateVsEnemy(lua_State *_NLL, int _CharaIndex, int _NpcIndex, const char *_DoFunc, PCREATEENEMY _CreateEnemy, int _ARLen, int _Flg); + +const char *NPC_Lua_SetErrorStr(const char *ErrStr); + +//עչýӿ +int NPC_Lua_RegCallEx(lua_State * _NLL, luaL_Reg *_RegList); +//עչӿ +int NPC_Lua_RegLibEx(lua_State * _NLL, PSCRIPTREGLIB _RegLib); +//עչӿ +int NPC_Lua_RegClassEx(lua_State * _NLL, PSCRIPTREGCLASS _RegClass); +//עչӿ +int NPC_Lua_RegArrayEx(lua_State * _NLL, PSCRIPTREGARRAY _RegArray); + +//չͽӿں +//NTInt +int NPC_Lua_NTInt_New(lua_State *_NLL); +int NPC_Lua_NTInt_Get(lua_State *_NLL); +int NPC_Lua_NTInt_Set(lua_State *_NLL); +int NPC_Lua_NTInt_Len(lua_State *_NLL); + +//ӿں +////////////////////////////////////////////////NL///////////////////////////////////////////////// +int NPC_Lua_NL_GetErrorStr(lua_State *_NLL); //شϢ +int NPC_Lua_NL_CreateNpc(lua_State *_NLL); //NPC +int NPC_Lua_NL_DelNpc(lua_State *_NLL); //ɾNPC +int NPC_Lua_NL_Mod(lua_State *_NLL); // +int NPC_Lua_NL_GetStringFromIndexWithDelim(lua_State *_NLL); //ʹַַָָصָindexλõַ +//int NPC_Lua_NL_ANSI_PlayerLoop(lua_State *_NLL); //д +int NPC_Lua_NL_PetLoopGetNext(lua_State *_NLL); //дڳس дƶʱ +int NPC_Lua_NL_ItemLoopGetNext(lua_State *_NLL); //дڵߣص +int NPC_Lua_NL_PlayerLoopGetNext(lua_State *_NLL); //д +int NPC_Lua_NL_GetConfigLineType(lua_State *_NLL); //0ΪַΡ1ΪSHORTΡ2ΪINT͡3ΪDOUBLE͡ڸֶΣ-1. +int NPC_Lua_NL_GetConfigLineVal(lua_State *_NLL); //Ƿ[ַ]ҪתΪ֣tonumber()Ҳֶηnil +BOOL NPC_Lua_CheckNpcEventFree(lua_State *_NLL); //Ƿij +int NPC_Lua_DoNpcEventAction(lua_State *_NLL); //ִNPCű +int NPC_Lua_NL_SetTimer(lua_State *_NLL); //趨һʱĺ趨ļʱڵá +int NPC_Lua_NL_DelTimer(lua_State *_NLL); //ɾһʱһʱɾͲٱڵã +int NPC_Lua_NL_RunSaFuncII(lua_State *_NLL); //һڶõ2INTĺ +int NPC_Lua_NL_RunSaFuncIII(lua_State *_NLL); //һڶõ3INTĺ(ITEM_USEʹõߺĻص +int NPC_Lua_NL_ANSI_PlayerLoop(lua_State *_NLL); //д +int NPC_Lua_NL_ANSI_PetLoop(lua_State *_NLL); //дڳ +int NPC_Lua_NL_ANSI_ItemLoop(lua_State *_NLL); //дڵߣ +int NPC_Lua_NL_ClsMk(lua_State *_NLL); +int NPC_Lua_NL_AddCheckNum(lua_State *_NLL); +int NPC_Lua_NL_Mkstring(lua_State *_NLL); +int NPC_Lua_NL_Mkint(lua_State *_NLL); +int NPC_Lua_NL_SendMesg(lua_State *_NLL); + +////////////////////////////////////////////////NLG//////////////////////////////////////////////// +//ܽӿ +int NPC_Lua_NLG_UpItem(lua_State *_NLL); +int NPC_Lua_NLG_GiveItemOne(lua_State *_NLL); +int NPC_Lua_NLG_GivePetOne(lua_State *_NLL); +int NPC_Lua_NLG_DelItemByIndex(lua_State *_NLL); +int NPC_Lua_NLG_FindPet(lua_State *_NLL); //ҳλ +int NPC_Lua_NLG_GetMap(lua_State *_NLL); //õǰλõĽ +int NPC_Lua_NLG_PetUp(lua_State *_NLL); // +int NPC_Lua_NLG_AddSk(lua_State *_NLL); //ְҵ +int NPC_Lua_NLG_SetZy(lua_State *_NLL); //趨ְҵ +int NPC_Lua_Char_GetPlayerMaxNum(lua_State *_NLL); //ȡ +int NPC_Lua_NLG_GetXY(lua_State *_NLL); //ȡһͼ +int NPC_Lua_NLG_WalkJc(lua_State *_NLL); //ϰ +int NPC_Lua_NLG_KickPlayer(lua_State *_NLL); //Tָ +int NPC_Lua_NLG_HealOne(lua_State *_NLL); //ָһ ظHP MP +int NPC_Lua_NLG_HealAll(lua_State *_NLL); //ָһMP ظаHP +int NPC_Lua_NLG_LevelUpTo(lua_State *_NLL); //ĵȼ +int NPC_Lua_NLG_AddExp(lua_State *_NLL); //һ顣 +int NPC_Lua_NLG_UpPet(lua_State *_NLL); //¶ijڸ¡ͻˡݣijЩ̨Ա޸ĵ²ܰѸݷ͵ǰ̨ +int NPC_Lua_NLG_DelPetByPos(lua_State *_NLL); //ɾ ָλij +int NPC_Lua_NLG_DelPetByIndex(lua_State *_NLL); //ɾ ָţIDij +int NPC_Lua_NLG_GivePetByIndex(lua_State *_NLL); //һָֻŵijָ سλ +int NPC_Lua_NLG_GiveItemByIndex(lua_State *_NLL); //һindexָ صλ +int NPC_Lua_NLG_WarpToSpecificPoint(lua_State *_NLL); //ƶNPC ƶ +BOOL NPC_Lua_NLG_UpSkillupPoint(lua_State *_NLL); // +int NPC_Lua_NLG_StayEncount(lua_State *_NLL); //ԭ + +int NPC_Lua_NLG_CheckInFront(lua_State *_NLL); //ڼijǷijǰ +int NPC_Lua_NLG_CheckObj(lua_State *_NLL); //ijͼλǷж +int NPC_Lua_NLG_CharLook(lua_State *_NLL); //﷽(͸·) +int NPC_Lua_NLG_CreateBattle(lua_State *_NLL); //ս +int NPC_Lua_NLG_InputCard(lua_State *_NLL); //һԻ⿨ +int NPC_Lua_NLG_CreateBattlePvP(lua_State *_NLL); + +int NPC_Lua_NLG_SearchWatchBattleRandIndex(lua_State *_NLL); + +int NPC_Lua_NLG_DelPet(lua_State *_NLL); //ɾָҳһ +int NPC_Lua_NLG_DelHaveIndexPet(lua_State *_NLL); +int NPC_Lua_NLG_DelItem(lua_State *_NLL); //ɾָҵһ +int NPC_Lua_NLG_DelItemByPos(lua_State *_NLL); //ɾָҵһ +int NPC_Lua_NLG_DischargeParty(lua_State *_NLL); //ɢ Ŷ + +int NPC_Lua_NLG_GivePet(lua_State *_NLL); //ָһ +int NPC_Lua_NLG_GiveOnePet(lua_State *_NLL); //ָһ +int NPC_Lua_NLG_GiveItem(lua_State *_NLL); //ָһ +int NPC_Lua_NLG_GiveOneItem(lua_State *_NLL); //ָһ +int NPC_Lua_NLG_GiveRandItem(lua_State *_NLL); +int NPC_Lua_Char_GetOnLinePlayer(lua_State *_NLL); //ȡǰ + +int NPC_Lua_NLG_ShowWindowTalked(lua_State *_NLL); //ָҿͻʾָݡ͵ĶԻ +int NPC_Lua_NLG_SetAction(lua_State *_NLL); //öĶ + +int NPC_Lua_NLG_TalkToCli(lua_State *_NLL); //ͨ˵Զȫ˵ +int NPC_Lua_NLG_TalkToFloor(lua_State *_NLL); //ijһָͼڵ˵ + +int NPC_Lua_NLG_UpChar(lua_State *_NLL); //NPCΧҷNPCݸ· +int NPC_Lua_NLG_UpStateBySecond(lua_State *_NLL); //ָҷ͵2״̬· +int NPC_Lua_NLG_UpStateByThird(lua_State *_NLL); //ָҷ͵3״̬· +int NPC_Lua_NLG_Update_Party(lua_State *_NLL); //ڵŶӳԱҵ״̬· + +int NPC_Lua_NLG_Warp(lua_State *_NLL); //һ +int NPC_Lua_NLG_WalkMove(lua_State *_NLL); //ƶһ +int NPC_Lua_NLG_WatchEntry(lua_State *_NLL); //ս +int NPC_Lua_NLG_HealerAllHeal(lua_State *_NLL); //Ѫ +int NPC_Lua_NLG_GetMaxPlayNum(lua_State *_NLL); //ȡ +int NPC_Lua_NLG_CheckPlayIndex(lua_State *_NLL); //Ƿ +int NPC_Lua_NLG_Save(lua_State *_NLL); +////add by mo +int NPC_Lua_NLG_SetExp(lua_State *_NLL); //÷鱶 +int NPC_Lua_NLG_GetExp(lua_State *_NLL); //ȡ鱶 +#ifdef _PETTRANS_RANGE +int NPC_Lua_NLG_SetPetTransRange(lua_State *_NLL); //óתΧ +int NPC_Lua_NLG_GetPetTransRange(lua_State *_NLL); //óתΧ +#endif +///////////////////////////////////////////////Char//////////////////////////////////////////////// +//ݵĽӿ +int NPC_Lua_Char_ClrEvtEnd(lua_State *_NLL); //־ +int NPC_Lua_Char_ClrEvtNow(lua_State *_NLL); //־ +int NPC_Lua_Char_ClrEvt(lua_State *_NLL); //־ +int NPC_Lua_Char_GetAllocPoint(lua_State *_NLL); //ȡCharIndexάɳ +int NPC_Lua_Char_GetDataFromEnemyBase(lua_State *_NLL); //ȡӦ ־ ijģݣenemybaseX.txt +int NPC_Lua_Char_GetPlayerIndex(lua_State *_NLL); // +int NPC_Lua_Char_FindItemIndex(lua_State *_NLL); //ָǷӵijΪָ +int NPC_Lua_Char_FindPetIndex(lua_State *_NLL); //ָǷӵгΪָ +int NPC_Lua_CHAR_CHECKINDEX(lua_State *_NLL); // +int NPC_Lua_Char_GetPetSkill(lua_State *_NLL); //ȡóָļܱ +int NPC_Lua_Char_GetPetSkillNo(lua_State *_NLL); //ȡChar +int NPC_Lua_Char_RidNo(lua_State *_NLL); //־ +int NPC_Lua_Char_GetEmptyItemBoxNum(lua_State *_NLL); //ָϵλ +int NPC_Lua_Char_GetEmptyPetBoxNum(lua_State *_NLL); //ָϳλ +int NPC_Lua_Char_GetPlayerItemNum(lua_State *_NLL); //ָΪijIDĵߵ +int NPC_Lua_Char_GetPlayerPetNum(lua_State *_NLL); //ָΪijIDij +int NPC_ABLua_char_getPlayerMaxNum(lua_State *_NLL); // +int NPC_ABLua_char_getBattleexp(lua_State *_NLL); //ս鱶 +int NPC_Lua_Char_SetPetSkill(lua_State *_NLL); //óָļܱ +int NPC_Lua_Char_SetPetSkillNo(lua_State *_NLL); +int NPC_Lua_Char_ComplianceParameter(lua_State *_NLL); //ݶ¼㲢WORKԣԴﵽЧĿġ +int NPC_Lua_Char_HcItemId(lua_State *_NLL); //ϳõϷƷ +int NPC_Lua_Char_DelHcItem(lua_State *_NLL); //ɾijλõƷ +int NPC_Lua_Char_GETFM(lua_State *_NLL); //ȡ ʽ +int NPC_Lua_Char_FindPetEnemyBaseId(lua_State *_NLL); //ָǷӵгEnemyBaseļĶӦID +int NPC_Lua_Char_ITEMID_NAME(lua_State *_NLL); //ָID +int NPC_Lua_Char_ITEMID_NAME2(lua_State *_NLL); //ָID˵ +int NPC_Lua_Char_ITEMID_LEVEL(lua_State *_NLL); //ָIDĵȼ +int NPC_Lua_Char_ITEMID_GOLD(lua_State *_NLL); //ָIDļ۸ +int NPC_Lua_Char_ITEMID_RANO(lua_State *_NLL); //ָIDͼ +//int NPC_Lua_Char_CharRidNo(lua_State *_NLL); //ǷѾij֤ +int NPC_Lua_Char_GetPetOwner(lua_State *_NLL); //ó˵ +int NPC_Lua_Char_GetEnemyBaseIdFromEnemyId(lua_State *_NLL); //ͨenemy.txtõijenemybase.txt趨ijš +int NPC_Lua_Char_GetEnemyIdFromEnemyBaseId(lua_State *_NLL); //ͨenemybase.txtõijenemy.txt趨ijš +int NPC_Lua_Char_GetIp(lua_State *_NLL); //ȡָIPַ +int NPC_Lua_Char_SetAllocPoint(lua_State *_NLL); //óCharIndexάɳ +int NPC_Lua_Char_GetMaxPetIndex(lua_State *_NLL); //ȡ +int NPC_Lua_Char_GetMaxPlayerIndex(lua_State *_NLL); //ȡ +int NPC_Lua_Char_SavePetToString(lua_State *_NLL); //һַ +int NPC_Lua_Char_LoadPetFromString(lua_State *_NLL); //һַһ +int NPC_Lua_Char_GetPlayerFromAccAndName(lua_State *_NLL);//ҵʺźѰҡʺźҲɲҡɶ +int NPC_Lua_Char_CheckPet(lua_State *_NLL); //ǷЧ +int NPC_Lua_Char_CheckPlayer(lua_State *_NLL); //ǷЧ +BOOL NPC_Lua_Char_JoinParty(lua_State *_NLL); //Ŷ +int NPC_Lua_Char_getFamilyPlayIndex(lua_State *_NLL); //ü + +int NPC_Lua_Char_SetEvtEnd(lua_State *_NLL); //־Ϊ״̬ +int NPC_Lua_Char_SetEvtNow(lua_State *_NLL); //־Ϊ״̬ +int NPC_Lua_Char_SetData(lua_State *_NLL); //Char + +int NPC_Lua_Char_getVipPoint(lua_State *_NLL); //Ա +int NPC_Lua_Char_getjfPoint(lua_State *_NLL); //ָ +int NPC_Lua_Char_getxjPoint(lua_State *_NLL); //ֽ +int NPC_Lua_Char_setVipPoint(lua_State *_NLL); //Ա +int NPC_Lua_Char_setjfPoint(lua_State *_NLL); //ֲ +int NPC_Lua_Char_setxjPoint(lua_State *_NLL); //ֽ + +//¼õĽӿ +int NPC_Lua_Char_SetWalkPreEvent(lua_State *_NLL); //WalkPre¼Ӧ +int NPC_Lua_Char_SetWalkPostEvent(lua_State *_NLL); //WalkPost¼Ӧ +int NPC_Lua_Char_SetPreOverEvent(lua_State *_NLL); //PreOver¼Ӧ +int NPC_Lua_Char_SetPostOverEvent(lua_State *_NLL); //PostOver¼Ӧ +int NPC_Lua_Char_SetWatchEvent(lua_State *_NLL); //Watch¼Ӧ +int NPC_Lua_Char_SetLoopEvent(lua_State *_NLL); //Loop¼Ӧ +int NPC_Lua_Char_SetTalkedEvent(lua_State *_NLL); //Talked¼Ӧ +int NPC_Lua_Char_SetOFFEvent(lua_State *_NLL); //OFF¼Ӧ +int NPC_Lua_Char_SetLookedEvent(lua_State *_NLL); //Looked¼Ӧ +int NPC_Lua_Char_SetItemPutEvent(lua_State *_NLL); //ItemPut¼Ӧ +int NPC_Lua_Char_SetWindowTalkedEvent(lua_State *_NLL); //WindowTalked¼Ӧ +#ifdef _USER_CHARLOOPS +int NPC_Lua_Char_SetCharLoopsEvent(lua_State *_NLL); //CharLoops¼Ӧ +int NPC_Lua_Char_SetBattleProPertyEvent(lua_State *_NLL);//BattleProPerty¼Ӧ +#endif + +//ȡݵĽӿ +int NPC_Lua_Char_IsEventEnd(lua_State *_NLL); //Ƿ־ +int NPC_Lua_Char_IsEventNow(lua_State *_NLL); //Ƿ־ + +int NPC_Lua_Char_FindItemId(lua_State *_NLL); //ָǷӵijID +int NPC_Lua_Char_FindPetEnemyId(lua_State *_NLL); //ָǷӵгEnemyļĶӦID + +int NPC_Lua_Char_GetData(lua_State *_NLL); //ȡChar +int NPC_Lua_Char_GetItemId(lua_State *_NLL); //ȡָָλõĵID +int NPC_Lua_Char_GetPetEnemyId(lua_State *_NLL); //ȡָָλõijEnemyļĶӦID +int NPC_Lua_Char_GetItemIndex(lua_State *_NLL); //ȡָָλõĵ +int NPC_Lua_Char_GetPetIndex(lua_State *_NLL); //ȡָָλõij +int NPC_Lua_Char_GetTeamIndex(lua_State *_NLL); //ȡԱĶ +int NPC_Lua_Char_GetPlayerIndexByCdkey(lua_State *_NLL); //ͨʺŲѯ +int NPC_Lua_Char_VipPoint(lua_State *_NLL); +int NPC_Lua_Char_HealAll(lua_State *_NLL); +int NPC_Lua_Char_GetPetSkillId(lua_State *_NLL); +int NPC_Lua_Char_GetPetSkillName(lua_State *_NLL); +int NPC_Lua_Char_GetPetSkillMsg(lua_State *_NLL); +int NPC_Lua_Char_SetPetSkill(lua_State *_NLL); +int NPC_Lua_Char_RandMsg(lua_State *_NLL); +int NPC_Lua_Char_GetBeatitudeNum(lua_State *_NLL); +///////////////////////////////////////////////GAME//////////////////////////////////////////////// +int NPC_Lua_Game_FMPOINT_GetData(lua_State *_NLL); //ׯ԰ݵϢ +int NPC_Lua_Game_FMPOINT_ACSetFMPoint(lua_State *_NLL); //趨ݵϢݵδռʱЧ +int NPC_Lua_Game_FMPOINT_ACFixFMPoint(lua_State *_NLL); //޸ļݵϢơһս +int NPC_Lua_Game_FMPOINT_ACCleanFMPoint(lua_State *_NLL); //ݵ㡣 +///////////////////////////////////////////////Item//////////////////////////////////////////////// +//ȡݵĽӿ +int NPC_Lua_Item_GetData(lua_State *_NLL); //ȡ +int NPC_Lua_Item_GetDataFromItemSet(lua_State *_NLL); //ȡITEMSETXļ +//ݵĽӿ +int NPC_Lua_Item_SetData(lua_State *_NLL); //ȡ + +//¼õĽӿ +int NPC_Lua_Item_SetPreOverEvent(lua_State *_NLL); //PreOver¼Ӧ +int NPC_Lua_Item_SetPostOverEvent(lua_State *_NLL); //PostOver¼Ӧ +int NPC_Lua_Item_SetWatchEvent(lua_State *_NLL); //Watch¼Ӧ +int NPC_Lua_Item_SetUseEvent(lua_State *_NLL); //Use¼Ӧ +int NPC_Lua_Item_SetAttachEvent(lua_State *_NLL); //Attach¼Ӧ +int NPC_Lua_Item_SetDetachEvent(lua_State *_NLL); //Detach¼Ӧ +int NPC_Lua_Item_SetDropEvent(lua_State *_NLL); //Drop¼Ӧ +int NPC_Lua_Item_SetPickUPEvent(lua_State *_NLL); //PickUP¼Ӧ +#ifdef _Item_ReLifeAct +int NPC_Lua_Item_SetDieReLifeEvent(lua_State *_NLL); //DieReLife¼Ӧ +#endif +///////////////////////////////////////////////BIT/////////////////////////////////////////////// +int NPC_Lua_Bit_band(lua_State *_NLL); +int NPC_Lua_Bit_bor(lua_State *_NLL); +int NPC_Lua_Bit_bxor(lua_State *_NLL); +int NPC_Lua_Bit_lshift(lua_State *_NLL); +int NPC_Lua_Bit_rshift(lua_State *_NLL); +///////////////////////////////////////////////Obj//////////////////////////////////////////////// +//ȡݵĽӿ +int NPC_Lua_Obj_GetType(lua_State *_NLL); //ȡOBJ +/* +int NPC_Lua_Obj_GetName(lua_State *_NLL); //ȡOBJ +int NPC_Lua_Obj_GetDIR(lua_State *_NLL); //ȡOBJķ +int NPC_Lua_Obj_GetImageNum(lua_State *_NLL); //ȡOBJ +*/ +int NPC_Lua_Obj_GetCharType(lua_State *_NLL); //ȡOBJӦCharݽṹ +int NPC_Lua_Obj_GetCharIndex(lua_State *_NLL); //ȡOBJӦCharݽṹ +int NPC_Lua_Obj_GetX(lua_State *_NLL); //ȡOBJX +int NPC_Lua_Obj_GetY(lua_State *_NLL); //ȡOBJY +int NPC_Lua_Obj_GetFloor(lua_State *_NLL); //ȡOBJڵĵͼ +//int NPC_Lua_Obj_GetDelTime(lua_State *_NLL); //ȡOBJɾʱ + +int NPC_Lua_Obj_SetType(lua_State *_NLL); //ȡOBJ +/* +int NPC_Lua_Obj_SetName(lua_State *_NLL); //ȡOBJ +int NPC_Lua_Obj_SetDIR(lua_State *_NLL); //ȡOBJķ +int NPC_Lua_Obj_SetImageNum(lua_State *_NLL); //ȡOBJ +*/ +int NPC_Lua_Obj_SetCharType(lua_State *_NLL); //ȡOBJӦCharݽṹ +int NPC_Lua_Obj_SetX(lua_State *_NLL); //ȡOBJX +int NPC_Lua_Obj_SetY(lua_State *_NLL); //ȡOBJY +int NPC_Lua_Obj_SetFloor(lua_State *_NLL); //ȡOBJڵĵͼ +//int NPC_Lua_Obj_SetDelTime(lua_State *_NLL); //ȡOBJɾʱ + +//////////////////////////////////////////////Battle/////////////////////////////////////////////// +//ȡݵĽӿ +int NPC_Lua_Battle_GetPlayIndex(lua_State *_NLL); //ȡսе +int NPC_Lua_Battle_GetData(lua_State *_NLL); //ȡս +int NPC_Lua_Battle_SetData(lua_State *_NLL); //ս +int NPC_Lua_Battle_IndexToNo(lua_State *_NLL); //ͨȡڵս +int NPC_Lua_Battle_NoToIndex(lua_State *_NLL); //ͨսŻȡ +int NPC_Lua_Battle_CheckIndex(lua_State *_NLL); //սǷЧ +//ݵĽӿ +int NPC_Lua_Battle_SetNORisk(lua_State *_NLL); //Ƿ޷ģʽ +int NPC_Lua_Battle_SetMod(lua_State *_NLL); //սģʽ־ +int NPC_Lua_Battle_SetType(lua_State *_NLL); //ս +int NPC_Lua_Battle_Exit(lua_State *_NLL); //˳ս +//¼õĽӿ +int NPC_Lua_Battle_SetWinEvent(lua_State *_NLL); //Win¼Ӧ +int NPC_Lua_Battle_SetEndEvent(lua_State *_NLL); //Win¼Ӧ +///////////////////////////////////////////////Other/////////////////////////////////////////////// +int NPC_Lua_GetFuncPoint(lua_State *_NLL); //ȡָ + +////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////MAP//////////////////////////////////////////////// +int NPC_Lua_Map_CheckCoordinates(lua_State *_NLL); //ijǷڵͼΧڡ +int NPC_Lua_Map_GetExitFloorXY(lua_State *_NLL); //ͼǷֵ֧dz +int NPC_Lua_Map_GetfloorX(lua_State *_NLL); //ȡͼX +int NPC_Lua_Map_GetfloorY(lua_State *_NLL); //ȡͼY +int NPC_Lua_Map_GetTileAndObjId(lua_State *_NLL); //ȡͼijĵذװβ +int NPC_Lua_Map_SetTileAndObjId(lua_State *_NLL); //õͼijĵذװβ +int NPC_Lua_Map_GetWalkAbleFromPoint(lua_State *_NLL); //ȡijǷ +int NPC_Lua_Map_GetImageData(lua_State *_NLL); //ȡͼƬ +int NPC_Lua_Map_SetImageData(lua_State *_NLL); //ͼƬ +int NPC_Lua_Map_GetTopObj(lua_State *_NLL); //ȡͼij϶ +int NPC_Lua_Map_GetNextObj(lua_State *_NLL); //ȡһ +int NPC_Lua_Map_CheckImageIndex(lua_State *_NLL); //ijͼͼƬǷ +int NPC_Lua_Map_CheckIndex(lua_State *_NLL); //ijͼŵͼǷ +int NPC_Lua_Map_MakeNewMap(lua_State *_NLL); //һµĵͼ صͼID +int NPC_Lua_Map_DelNewMap(lua_State *_NLL); //ɾһͼ +int NPC_Lua_Map_SetExWarp(lua_State *_NLL); //dzͼĴ͵ +int NPC_Lua_Map_SetMapPoint(lua_State *_NLL); //ӵͼ͵ +int NPC_Lua_Map_DelMapPoint(lua_State *_NLL); //ɾͼ͵ +int NPC_Lua_Map_getFloorName(lua_State *_NLL); //õͼ +int NPC_Lua_Map_Upmap(lua_State *_NLL); //µͼ +///////////////////////////////////////////////MAP//////////////////////////////////////////////// +///////////////////////////////////////////////Spell//////////////////////////////////////////////// +int NPC_Lua_Spell_PETSKILL_GetData(lua_State *_NLL); //ȡ\ID +int NPC_Lua_Spell_PROFESSION_GetData(lua_State *_NLL); //ȡְҵID +int NPC_Lua_Spell_MAGIC_GetData(lua_State *_NLL); //ȡ鼼ID +int NPC_Lua_Spell_PETSKILL_SetData(lua_State *_NLL); //öӦIDļݣ +int NPC_Lua_Spell_PROFESSION_SetData(lua_State *_NLL); //öӦIDļݣ +int NPC_Lua_Spell_MAGIC_SetData(lua_State *_NLL); //öӦIDļݣ +///////////////////////////////////////////////Spell//////////////////////////////////////////////// +///////////////////////////////////////////////SQL///////////////////////////////////////////////// +int NPC_Lua_SQL_Push(lua_State *_NLL); //MySQLָ +int NPC_Lua_SQL_PushPop(lua_State *_NLL); //MySQLָӦ +int NPC_Lua_SQL_PushPopAdv(lua_State *_NLL); //SAACһSQLѯ󣬲ָSAACشʱԽдĻص,úصһнͷŽ +int NPC_Lua_SQL_QueryFirstRow(lua_State *_NLL); //ص,úصһнͷŽ +int NPC_Lua_SQL_FetchRow(lua_State *_NLL); //һ +int NPC_Lua_SQL_FreeResult(lua_State *_NLL); //ͷŽ +///////////////////////////////////////////////SQL/////////////////////////////////////////////// +#define LRet(r) \ +{ \ + NPC_Lua_SetErrorStr(NULL); \ + return r; \ +} + +#define LRetErr(c,r) \ +{ \ + NPC_Lua_SetErrorStr(c); \ + return r; \ +} + +////////////////////////////////////////////////////////////////////// +//һnil +#define LRetNull(L) \ +{ \ + lua_pushnil(L); \ + LRet(1); \ +} + +//һBOOLLUA +#define LRetBool(L, b) \ +{ \ + lua_pushboolean(L, b); \ + LRet(1); \ +} + +//һintLUA +#define LRetInt(L, i) \ +{ \ + lua_pushinteger(L, i); \ + LRet(1); \ +} + +#define LRetMsg(L, c) \ +{ \ + lua_pushstring(L, c); \ + LRet(1); \ +} +//////////////////////////////////////////////////////////////////// +//һ״̬һϢ +#define LRetErrInt(L, i, c) \ +{ \ + lua_pushinteger(L, i); \ + LRetErr(c,1); \ +} + +//һַLUA +#define LRetErrNull(L, c) \ +{ \ + lua_pushnil(L); \ + LRetErr(c,1); \ +} + +//һַLUA +#define LRetErrMsg(L, c) \ +{ \ + lua_pushstring(L, c); \ + LRetErr(c,1); \ +} + +//ڼǷ㹻 +#define CheckEx(L, n) \ +{ \ + if(lua_gettop(L) != n) \ + { \ + luaL_argerror(L, 1, ""); \ + } \ +} + +#define CheckEx2(L, t, n) \ +{ \ + if(lua_gettop(L) < (t) || lua_gettop(L) > n) \ + { \ + luaL_argerror(L, 1, ""); \ + } \ +} + +#define CheckIndexNull(L, n) \ +{ \ + if(lua_isnil((L), (n))) \ + { \ + luaL_argerror((L), 1, "Ϊnil"); \ + } \ +} + +#define CheckBattleIndexNull(L, n) \ +{ \ + if(lua_isnil((L), (n))) \ + { \ + luaL_argerror((L), 1, "սΪnil"); \ + } \ +} + +#define CheckItemIndexNull(L, n) \ +{ \ + if(lua_isnil((L), (n))) \ + { \ + luaL_argerror((L), 1, "Ϊnil"); \ + } \ +} + +#define CheckObjIndexNull(L, n) \ +{ \ + if(lua_isnil((L), (n))) \ + { \ + luaL_argerror((L), 1, "Ϊnil"); \ + } \ +} + +#define LRetArray(L, Array, num) \ +{ \ + Lua_ReturnArray(L, Array, num); \ + LRet(1); \ +} + +#ifdef _LUA_Debug +int pcall_callback_err_fun(lua_State* L,const char *_InitFuncName); //LUAűϢ +#endif + +#endif //#ifndef __NPC_LUA__ diff --git a/include/npc_lua_interface.h b/include/npc_lua_interface.h new file mode 100644 index 0000000..4e301af --- /dev/null +++ b/include/npc_lua_interface.h @@ -0,0 +1,121 @@ +#ifndef __NPC_LUA_INTERFACE__ +#define __NPC_LUA_INTERFACE__ + +#include "version.h" +#include "common.h" + +/////////////////////////////////////////ⲿӿ///////////////////////////////////////////////////////////////// +#define FUNCNAME_INITCALLBACK "NPC_Lua_InitCallBack" //CHAR_INITFUNC +#define FUNCNAME_WALKPRECALLBACK "NPC_Lua_WalkPreCallBack" //CHAR_WALKPREFUNC +#define FUNCNAME_WALKPOSTCALLBACK "NPC_Lua_WalkPostCallBack" //CHAR_WALKPOSTFUNC +#define FUNCNAME_PREOVERCALLBACK "NPC_Lua_PreOverCallBack" //CHAR_PREOVERFUNC +#define FUNCNAME_POSTOVERCALLBACK "NPC_Lua_PostOverCallBack" //CHAR_POSTOVERFUNC +#define FUNCNAME_WATCHCALLBACK "NPC_Lua_WatchCallBack" //CHAR_WATCHFUNC +#define FUNCNAME_LOOPCALLBACK "NPC_Lua_LoopCallBack" //CHAR_LOOPFUNC +#define FUNCNAME_TALKEDCALLBACK "NPC_Lua_TalkedCallBack" //CHAR_TALKEDFUNC +#define FUNCNAME_OFFCALLBACK "NPC_Lua_OFFCallBack" //CHAR_OFFFUNC +#define FUNCNAME_LOOKEDCALLBACK "NPC_Lua_LookedCallBack" //CHAR_LOOKEDFUNC +#define FUNCNAME_ITEMPUTCALLBACK "NPC_Lua_ItemPutCallBack" //CHAR_ITEMPUTFUNC +#define FUNCNAME_WINDOWTALKEDCALLBACK "NPC_Lua_WindowTalkedCallBack" //CHAR_WINDOWTALKEDFUNC +#ifdef _USER_CHARLOOPS +#define FUNCNAME_CHARLOOPSCALLBACK "NPC_Lua_CharLoopsCallBack" //CHAR_LOOPFUNCTEMP1 ﵰιҩԭеLOOP +#define FUNCNAME_BATTLEPROPERTYCALLBACK "NPC_Lua_BattleProPertyCallBack" //CHAR_BATTLEPROPERTY +#endif +/* + CHAR_DYINGFUNC, + , + CHAR_PREATTACKEDFUNC, + CHAR_POSTATTACKEDFUNC, + + CHAR_SPECIALTALKEDFUNC, + , +#ifdef _USER_CHARLOOPS + , + CHAR_LOOPFUNCTEMP2, + , +#endif +*/ +#define FUNCNAME_ITEMPEROVERCALLBACK "NPC_Lua_ItemPerOverCallBack" //LUAITEM_PREOVERFUNC = ITEM_PREOVERFUNC +#define FUNCNAME_ITEMPOSTOVERCALLBACK "NPC_Lua_ItemPostOverCallBack" //LUAITEM_POSTOVERFUNC = ITEM_POSTOVERFUNC +#define FUNCNAME_ITEMWATCHCALLBACK "NPC_Lua_ItemWatchCallBack" //LUAITEM_WATCHFUNC = ITEM_WATCHFUNC +#define FUNCNAME_ITEMUSECALLBACK "NPC_Lua_ItemUseCallBack" //LUAITEM_USEFUNC = ITEM_USEFUNC +#define FUNCNAME_ITEMATTACHCALLBACK "NPC_Lua_ItemAttachCallBack" //LUAITEM_ATTACHFUNC = ITEM_ATTACHFUNC +#define FUNCNAME_ITEMDETACHCALLBACK "NPC_Lua_ItemDetachCallBack" //LUAITEM_DETACHFUNC = ITEM_DETACHFUNC +#define FUNCNAME_ITEMDROPCALLBACK "NPC_Lua_ItemDropCallBack" //LUAITEM_DROPFUNC = ITEM_DROPFUNC +#define FUNCNAME_ITEMPICKUPCALLBACK "NPC_Lua_ItemPickUPCallBack" //LUAITEM_PICKUPFUNC = ITEM_PICKUPFUNC +#ifdef _Item_ReLifeAct +#define FUNCNAME_ITEMDIERELIFECALLBACK "NPC_Lua_ItemDieReLifeCallBack" //LUAITEM_DIERELIFEFUNC = ITEM_DIERELIFEFUNC +#endif + +#define FUNCNAME_BATTLEWINCALLBACK "NPC_Lua_BattleWinCallBack" //BATTLE WinFunc +#define FUNCNAME_BATTLEENDCALLBACK "NPC_Lua_BattleEndCallBack" //BATTLE WinFunc +//ʼLUA +int NPC_Lua_Init(const char *_DoFile); + +//رLUA +int NPC_Lua_Close(void); + +//̬ؽűļ +int NPC_Lua_DoFile(const char *_DoFile); + +//LUAűջһ +const char *NPC_Lua_popstring(int _ArgNum); + +//ָĽű +const char *NPC_Lua_CallFunc(const char *_FuncName, char *_RetBuff, size_t _n, int index); + +//ս +int NPC_Lua_getBattleFieldNo(int _Floor, int _X, int _Y); + +//ȡ +int NPC_GivePet(int charaindex, int lv, int enemyid); +//ȡ +int NPC_GiveItem(int charaindex, int itemid); +//ɾ +int NPC_DelPet(int charaindex, int petsel); + +//ص +BOOL NPC_Lua_InitCallBack(int _meindex); +BOOL NPC_Lua_WalkPreCallBack(int _meindex, int *_dir, int *_mode); +void NPC_Lua_WalkPostCallBack(int _meindex); +void NPC_Lua_PreOverCallBack(int _meindex, int _desindex); +void NPC_Lua_PostOverCallBack(int _meindex, int _desindex); +void NPC_Lua_WatchCallBack(int _meindex, int _objindex, int _chac, int _x, int _y, int _dir, int *_watchopt, int _watchoptlen); +int NPC_Lua_LoopCallBack(int _meindex); +void NPC_Lua_TalkedCallBack(int _meindex, int _tomeindex,const char *_messageeraseescape, int _color, int _channel); +void NPC_Lua_OFFCallBack(int _meindex, int _desindex); +void NPC_Lua_LookedCallBack(int _meindex, int _desindex); +BOOL NPC_Lua_ItemPutCallBack(int _meindex, int _itemindex); +void NPC_Lua_WindowTalkedCallBack(int _meindex, int _talkindex, int _seqno, int _select,const char *_data); +#ifdef _USER_CHARLOOPS +int NPC_Lua_CharLoopsCallBack( int _meindex); +int NPC_Lua_BattleProPertyCallBack(int _attackindex, int _defindex, int *_damage, int *_powarray, int _arraynum); +#endif + +/* ʱδʹõ¼ +int NPC_Lua_DyingCallBack(int meindex); +NPC_Lua_PreAttackedCallBack +NPC_Lua_PostAttackedCallBack +NPC_Lua_SpecialTalkedCallBack +*/ + +void NPC_Lua_ItemPerOverCallBack(int _itemindex, int _playindex); +void NPC_Lua_ItemPostOverCallBack(int _itemindex, int _playindex); +void NPC_Lua_ItemWatchCallBack(int _meindex, int _objindex, int _chac, int _x, int _y, int _dir, int *_watchopt, int _watchoptlen); +void NPC_Lua_ItemUseCallBack(int _playindex, int _to_charindex, int _haveitemindex); +void NPC_Lua_ItemAttachCallBack(int _playindex, int _itemindex); +void NPC_Lua_ItemDetachCallBack(int _playindex, int _itemindex); +void NPC_Lua_ItemDropCallBack(int _playindex, int _itemindex); +void NPC_Lua_ItemPickUPCallBack(int _playindex, int _itemindex); +#ifdef _Item_ReLifeAct +void NPC_Lua_ItemDieReLifeCallBack(int _playindex, int _itemindex, int _haveitem); +#endif + +void NPC_Lua_BattleWinCallBack(int _battleindex, int _createindex); +void NPC_Lua_BattleEndCallBack(int _battleindex); +#ifdef _CAX_LNS_MYSQLSUOXU +void NPC_Lua_SQLPushCallBack(char* _result,char* _filename,char* _function,int _npcindex,int _playerindex, char* _msg); +void NPC_Lua_SQLPushAdvCallBack(int luaresult,int luaflg,int luaerrnono,char* luaerrstr,int luafileCount,int rowCount,int rowAt,char* row,char* _filename,char* _function,int npcindex,int charaindex,char* msg); +#endif +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#endif //#ifndef __NPC_LUA_INTERFACE__ diff --git a/include/npc_luckyman.h b/include/npc_luckyman.h new file mode 100644 index 0000000..36c4db4 --- /dev/null +++ b/include/npc_luckyman.h @@ -0,0 +1,10 @@ +#ifndef __NPC_LUCKYMAN_H__ +#define __NPC_LUCKYMAN_H__ + +void NPC_LuckyManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_LuckyManInit( int meindex ); +void NPC_LuckyManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif +/*__NPC_LUCKYMAN_H__*/ diff --git a/include/npc_makepair.h b/include/npc_makepair.h new file mode 100644 index 0000000..f0d775d --- /dev/null +++ b/include/npc_makepair.h @@ -0,0 +1,22 @@ +#ifndef _MAKEPAIR_MAN_H +#define _MAKEPAIR_MAN_H + +void NPC_MakePairManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_MakePairManInit( int meindex ); +void NPC_MakePairManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_MakePairManLoop( int meindex); + +typedef struct _tagPairMenu{ + char cdKey[256]; + char name[256]; + int pindex; + int forindex; + int code; + int use; +}PairMenu; + + + +#endif + + diff --git a/include/npc_manorsman.h b/include/npc_manorsman.h new file mode 100644 index 0000000..ce84694 --- /dev/null +++ b/include/npc_manorsman.h @@ -0,0 +1,19 @@ +#ifndef __NPC_MANORSMAN_H__ +#define __NPC_MANORSMAN_H__ +#include +BOOL NPC_ManorSmanInit(int meindex); +void NPC_ManorSmanTalked(int meindex, int talkerindex, char *msg, int color); +void NPC_ManorSmanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data); +void NPC_ManorSmanLoop(int meindex); +//andy_123 +int NPC_getManorsmanListIndex( int ID); +#ifndef _NEW_MANOR_LAW +void NPC_ManorSavePKSchedule(int meindex, int toindex, int flg); +#else +void NPC_ManorSavePKSchedule(int meindex, int toindex, int flg,int setTime,struct tm tm1); +void NPC_ManorAddToSchedule(int meindex,int charaindex); +#endif + +#endif +/*__NPC_MANORSMAN_H__*/ diff --git a/include/npc_mic.h b/include/npc_mic.h new file mode 100644 index 0000000..501e0d4 --- /dev/null +++ b/include/npc_mic.h @@ -0,0 +1,9 @@ +#ifndef __NPC_MIC_H__ +#define __NPC_MIC_H__ + +BOOL NPC_MicInit(int meindex ); +void NPC_MicTalked( int meindex , int talkerindex , char *msg , int color ); + +#endif + /*__NPC_MIC_H__*/ + diff --git a/include/npc_msg.h b/include/npc_msg.h new file mode 100644 index 0000000..f0f875b --- /dev/null +++ b/include/npc_msg.h @@ -0,0 +1,9 @@ +#ifndef _NPC_MSG_H_ +#define _NPC_MSG_H_ + +BOOL NPC_MsgInit( int meindex ); +void NPC_MsgLooked( int meindex , int lookedindex ); + + +#endif + diff --git a/include/npc_mtradenpcman.h b/include/npc_mtradenpcman.h new file mode 100644 index 0000000..93135bf --- /dev/null +++ b/include/npc_mtradenpcman.h @@ -0,0 +1,10 @@ +#ifndef __NPC_MAPTRADEMAN_H__ +#define __NPC_MAPTRADEMAN_H__ + +BOOL MapTradeManInit( int meindex ); +void MapTradeManLoop( int meindex); +void MapTradeManTalked( int meindex , int talkerindex , char *msg , int color ); +void MapTradeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + diff --git a/include/npc_newnpcman.h b/include/npc_newnpcman.h new file mode 100644 index 0000000..9ad31b7 --- /dev/null +++ b/include/npc_newnpcman.h @@ -0,0 +1,8 @@ +#ifndef __NPC_NEWNPCMAN_H__ +#define __NPC_NEWNPCMAN_H__ +BOOL NPC_NewNpcManInit( int meindex ); +void NPC_NewNpcManLoop( int meindex); +void NPC_NewNpcManTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_NewNpcManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +#endif + diff --git a/include/npc_newvipshop.h b/include/npc_newvipshop.h new file mode 100644 index 0000000..afcb6de --- /dev/null +++ b/include/npc_newvipshop.h @@ -0,0 +1,8 @@ + + +void NPC_NewVipshopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_NewVipshopInit( int meindex ); +void NPC_NewVipshopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_NewVipshopLoop( int meindex); + + diff --git a/include/npc_npcenemy.h b/include/npc_npcenemy.h new file mode 100644 index 0000000..62134e4 --- /dev/null +++ b/include/npc_npcenemy.h @@ -0,0 +1,17 @@ +#ifndef __NPC_NPCENEMY_H__ +#define __NPC_NPCENEMY_H__ + +void NPC_NPCEnemyTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_NPCEnemyInit( int meindex ); +int NPC_NPCEnemy_Dying( int battleindex, int meindex ); +int NPC_NPCEnemy_Encount( int meindex, int charaindex, int mode); +void NPC_NPCEnemyWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); +void NPC_NPCEnemyLoop( int meindex ); +BOOL NPC_NPCEnemy_BattleIn( int meindex, int charaindex); +void NPC_NPCEnemyWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + /*__NPC_NPCENEMY_H__*/ diff --git a/include/npc_oldman.h b/include/npc_oldman.h new file mode 100644 index 0000000..2b457b9 --- /dev/null +++ b/include/npc_oldman.h @@ -0,0 +1,12 @@ +#ifndef __NPC_OLDMAN_H__ +#define __NPC_OLDMAN_H__ + + +void NPC_OldmanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_OldmanInit( int meindex ); + + +#endif +/*__NPC_OLDMAN_H__*/ diff --git a/include/npc_pauctionman.h b/include/npc_pauctionman.h new file mode 100644 index 0000000..8fbaeb2 --- /dev/null +++ b/include/npc_pauctionman.h @@ -0,0 +1,372 @@ +0034:npc_petfusion.h:014E:1:14=48041e4b:16=47d21313:#ifndef __NPC_PETFUSION_H__ +#define __NPC_PETFUSION_H__ + + +void NPC_PetFusionManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_PetFusionManInit( int meindex ); +void NPC_PetFusionManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetFusionManLoop( int meindex); + +#endif + +0032:npc_petmaker.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_PETMAKER_H__ +#define __NPC_PETMAKER_H__ + +void NPC_PetMakerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetMakerInit( int meindex ); + +#endif + /*__NPC_PETMAKER_H__*/ +0038:npc_petracemaster.h:0156:1:14=48041e4b:16=47d21313:#ifndef NPC_PetRace_Master_ +#define NPC_PetRace_Master_ + +BOOL NPC_PetRaceMasterInit( int meindex ); +void NPC_PetRaceMasterLoop( int meindex ); +void NPC_PetRaceMasterTalked( int meindex , int talkerindex , char *szMes , int color ); +void NPC_PetRaceMasterWindowTalked(int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +0034:npc_petracepet.h:0E2:1:14=48041e4b:16=47d21313:#ifndef NPC_PetRace_Pet_ +#define NPC_PetRace_Pet_ + +BOOL NPC_PetRacePetInit( int meindex ); +void NPC_PetRacePetLoop( int meindex ); +void NPC_PetRacePetTalked( int meindex , int talkerindex , char *szMes , int color ); + +#endif + +0032:npc_petshop.h:0178:1:14=48041e4b:16=47d21313:#ifndef __NPC_PETSHOP_H__ +#define __NPC_PETSHOP_H__ + +void NPC_PetShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetShopInit( int meindex ); +void NPC_PetShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetShopLooked( int meindex , int lookedindex); + + +#endif +/*__NPC_PETSHOP_H__*/ +0037:npc_petskillshop.h:01E1:1:14=48041e4b:16=47d21313:#ifndef __NPC_PETSKILLSHOP_H__ +#define __NPC_PETSKILLSHOP_H__ + +void NPC_PetSkillShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetSkillShopInit( int meindex ); +void NPC_PetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetSkillShopLooked( int meindex , int lookedindex); + +void NPC_PetSkillMakeStr(int meindex,int toindex,int select); + +#endif + /*__NPC_WINDOWPETSKILLSHOP_H__*/ +0036:npc_pettransman.h:0206:1:14=48041e4b:16=47d21313:#ifndef __NPC_PETTRANSMAN_H__ +#define __NPC_PETTRANSMAN_H__ + +BOOL NPC_PetTransManInit(int meindex); +void NPC_PetTransMan_selectWindow(int meindex,int toindex,int num,int select); +void NPC_PetTransManWindowTalked(int meindex,int talkerindex,int seqno,int select,char *data); +void NPC_PetTransManTalked(int meindex,int talkerindex,char *szMes,int color); +int NPC_PetTransManCheck( int meindex, int toindex, int select); +BOOL NPC_PetTransManStatus( int meindex, int toindex, int petNo); +#endif + /*__NPC_PETTRANSMAN_H__*/ +0032:npc_pkpetshop.h:00:1:14=48041e4b:16=47d21313:0037:npc_poolitemshop.h:0184:1:14=48041e4b:16=47d21313:#ifndef __NPC_POOLITEMSHOP_H__ +#define __NPC_POOLITEMSHOP_H__ + + +void NPC_PoolItemShopLoop( int meindex); +BOOL NPC_PoolItemShopInit( int meindex); +void NPC_PoolItemShopTalked( int meindex , int talkerindex , + char *szMes ,int color ); +void NPC_PoolItemShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data); + + +#endif + /*__NPC_POOLITEMSHOP_H__*/ +002F:npc_quiz.h:02C0:1:14=48041e4b:16=47d21313:#ifndef __NPC_QUIZ_H__ +#define __NPC_QUIZ_H__ + +typedef struct NPC_Quiz{ + + int no; // į + int type; // ءة ̡֭) + int level; // ì + int answertype; //̫( ǩѨ + int answerNo; // + char question[512]; // + char select1[128]; // 1 + char select2[128]; // 2 + char select3[128]; // 3 + +}NPC_QUIZ; + + +void NPC_QuizTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_QuizInit( int meindex ); +void NPC_QuizWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +BOOL QUIZ_initQuiz( char *filename); + + +#endif + +/*__NPC_QUIZ_H__*/ +0033:npc_riderman.h:017F:1:14=48041e4b:16=47d21313:#ifndef __NPC_RIDERMAN_H__ +#define __NPC_RIDERMAN_H__ + +void NPC_RidermanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_RidermanInit( int meindex ); +void NPC_RidermanLooked( int meindex, int lookedindex ); +void NPC_RidermanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + /*__NPC_RIDERMAN_H__*/ +0037:npc_roomadminnew.h:03CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_ROOMADMINNEW_H__ +#define __NPC_ROOMADMINNEW_H__ + + +void NPC_RoomAdminNewTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_RoomAdminNewLoop( int meindex ); +BOOL NPC_RoomAdminNewInit( int meindex ); + +BOOL NPC_RankingInit( int meindex ); +void NPC_RankingTalked( int meindex , int talkerindex , char *msg ,int color ); + +BOOL NPC_PrintpassmanInit( int meindex ); +void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg ,int color ); + +typedef struct npc_roomadminnew_tag { + int expire; + char cdkey[CDKEYLEN]; + char charaname[32]; + char passwd[9]; +}NPC_ROOMINFO; + +typedef struct npc_roomadminnew_ranking_tag { + int gold; /* ڿź */ + int biddate; /* ڿ */ + char cdkey[CDKEYLEN]; /* м ƽ */ + char charaname[32]; /* м */ + char owntitle[32]; /* į*/ + +}NPC_RANKING_INFO; + +#endif /*__NPC_ROOMADMINNEW_H__*/ + +BOOL NPC_RoomAdminNew_ReadFile( char *roomname, NPC_ROOMINFO *data); +0030:npc_sample.h:075:1:14=48041e4b:16=47d21313:#ifndef __NPC_SAMPLE_H__ +#define __NPC_SAMPLE_H__ + +void NPC_SampleLoop( int index ); + +#endif + + /*__NPC_SAMPLE_H__*/ +0034:npc_savepoint.h:014F:1:14=48041e4b:16=47d21313:#ifndef __NPC_SAVEPOINT_H__ +#define __NPC_SAVEPOINT_H__ + + +void NPC_SavePointTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_SavePointInit( int meindex ); +void NPC_SavePointWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + +#endif + +/*__NPC_SAVEPOINT_H__*/ +0036:npc_scheduleman.h:0A5A:1:14=48041e4b:16=47d21313:#ifndef __NPC_SCHEDULEMAN_H__ +#define __NPC_SCHEDULEMAN_H__ + +#define CHARNAME_MAX 32 + +// scheduleman +#ifdef _FAMILY_MANORNUM_CHANGE +#define MAX_SCHEDULEMAN 20 +#else +#define MAX_SCHEDULEMAN 12 +#endif + +// ÿһ scheduleman عܵ schedule +#define MAX_SCHEDULE 24 + +// schedule бһҳг +#define MAXSCHEDULEINONEWINDOW 10 + +// family бһҳг +#define MAXFAMILYINONEWINDOW 10 + +// ÿһ scheduleman ʹõ schedule λ +// Ӧ fmpks ID*MAX_SCHEDULE (ID=0~MAX_SCHEDULEMAN-1) +// ID д data/npc ָ "id:" ֵ + +// dueltime = (?10000:0) + (Сʱ*100) + +typedef struct tagFamilyPKSchedule { + int dueltime; // ʱ + int host_index; // Ӽ + char host_name[CHARNAME_MAX]; // Ӽ + int guest_index; // ͶӼ + char guest_name[CHARNAME_MAX]; // ͶӼ + int prepare_time; // ׼ʱ (1~40 ) + int max_player; // (1~) + int flag; // ״̬ + int win; // ʤ趨 + int challenge_timeout; // սʱ + int setting_timeout; // 趨״̬ timeout + char gmsv_name[256]; +} FamilyPKSchedule; + +// ¼ FamilyPKSchedule (fmpks) flag ֵ +#define FMPKS_FLAG_NONE -1 // ûκų +#define FMPKS_FLAG_CHALLENGE 0 // ȴͶͬ +#define FMPKS_FLAG_SETTING 1 // 趨ų (ȡʱ NONE) +#define FMPKS_FLAG_CONFIRMING 2 // Ͷͬ +#define FMPKS_FLAG_SCHEDULED 3 // Ѿźų̣δ +#define FMPKS_FLAG_DUEL 4 // +#define FMPKS_FLAG_HOSTWIN 5 // ʤ +#define FMPKS_FLAG_GUESTWIN 6 // Ͷʤ +#define FMPKS_FLAG_MANOR_BATTLEBEGIN 7 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PREPARE 8 // ׯ԰ս ׼ +#define FMPKS_FLAG_MANOR_PEACE 9 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_OTHERPLANET 10 // ׯ԰ս ڱս +#define FMPKS_FLAG_MANOR_BATTLEEND 11 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PEACE_SAVE 12 // ׯ԰ս浵 +#define FMPKS_FLAG_MANOR_READYTOFIGHT 13 // (GM: manorpk) ȫϵɿԼս״̬ +#define FMPKS_FLAG_MANOR_CLEANFLAG 14 // (GM: manorpk) ״̬ +#ifdef _NEW_MANOR_LAW +#define FMPKS_FLAG_WAIT 15 // ս,Ѽ¼,ȴսų +#endif + +// client flag +#define FLAG_NONE -1 +#define FLAG_MODIFY 0 +#define FLAG_ACCEPT 1 +#define FLAG_SETTING 2 +#define FLAG_CONFIRM 3 +#define FLAG_SCHEDULED 4 + +extern FamilyPKSchedule fmpks[MAX_SCHEDULE*MAX_SCHEDULEMAN]; + +BOOL NPC_SchedulemanInit(int meindex); +void NPC_SchedulemanTalked(int meindex, int talkerindex, char *msg, int color); +void NPC_SchedulemanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data); +void NPC_SchedulemanLoop(int meindex); + +#endif + +/*__NPC_SCHEDULEMAN_H__*/ +0035:npc_sellsthman.h:013A:1:14=48041e4b:16=47d21313:#ifndef _SELLSTH_MAN_H +#define _SELLSTH_MAN_H + +void NPC_SellsthManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_SellsthManInit( int meindex ); +void NPC_SellsthManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SellsthManLoop( int meindex); + +#endif +0034:npc_signboard.h:0124:1:14=48041e4b:16=47d21313:#ifndef __NPC_SIGNBOARD_H__ +#define __NPC_SIGNBOARD_H__ + + +BOOL NPC_SignBoardInit( int meindex ); +void NPC_SignBoardWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SignBoardLooked( int meindex , int lookedindex); + + +#endif + /*__NPC_WINDOWSIGNBOAD_H__*/ +0035:npc_simpleshop.h:0176:1:14=48041e4b:16=47d21313:#ifndef __NPC_SIMPLESHOP_H__ +#define __NPC_SIMPLESHOP_H__ + +void NPC_SimpleShopTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_LimitBuyInShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopInit( int meindex ); + +#endif + /*__NPC_SIMPLESHOP_H__*/ +003A:npc_stoneserviceman.h:02AE:1:14=48041e4b:16=47d21313:#ifndef __NPC_STONESERVICEMAN_H__ +#define __NPC_STONESERVICEMAN_H__ + +// ϴ +typedef struct _List +{ + char Data[32]; // + struct _List *Next; // ָһList +}List,*LPList; + +BOOL NPC_StoneServiceManInit(int meindex); +void NPC_StoneServiceManLoop(int meindex); +void NPC_StoneServiceManTalked(int meindex,int talkerindex,char *msg,int color); +void NPC_StoneServiceManWindowTalked(int meindex,int talkerindex,int seqno, + int select,char *data); +int SendToAP(int nAid,int nIndex,int nLen,void *Data1,void *Data2); +int RecvFromAP(int *nAid,int nIndex,int *nLen,LPList *Data); +int GetMsg(int meindex); +int ConnectToAP(void); +#endif +0035:npc_storyteller.h:0B9:1:14=48041e4b:16=47d21313:#ifndef _NPC_STORYTELLER_H_ +#define _NPC_STORYTELLER_H_ + +BOOL NPC_StoryTellerInit( int meindex ); +void NPC_StoryTellerTalked( int meindex , int talker , char *msg , int col ); + +#endif + +0031:npc_sysinfo.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_SYSINFO_H__ +#define __NPC_SYSINFO_H__ + +BOOL NPC_SysinfoInit( int meindex ); +void NPC_SysinfoLoop( int meindex ); +void NPC_SysinfoTalked( int meindex, int tindex, char *msg, int color); +#endif /*__NPC_SYSINFO_H__*/ +0032:npc_timeman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_TIMEMAN_H__ +#define __NPC_TIMEMAN_H__ + + +void NPC_TimeManTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_TimeManInit( int meindex ); + +void NPC_TimeManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); + +#endif /*__NPC_TIMEMAN_H__*/ +0034:npc_townpeople.h:0D1:1:14=48041e4b:16=47d21313:#ifndef __NPC_TOWNPEOPLE_H__ +#define __NPC_TOWNPEOPLE_H__ + +void NPC_TownPeopleTalked( int index, int talker, char *msg, int color ); +void NPC_TownPeopleInit( int meindex ); + +#endif /* __NPC_TOWNPEOPLE_H__ */ +0035:npc_transerman.h:013A:1:14=48041e4b:16=47d21313:#ifndef _TRANSER_MAN_H +#define _TRANSER_MAN_H + +void NPC_TranserManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_TranserManInit( int meindex ); +void NPC_TranserManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_TranserManLoop( int meindex); + +#endif +0039:npc_transmigration.h:016A:1:14=48041e4b:16=47d21313:#ifndef __NPC_TRANSMIGRATION_H__ +#define __NPC_TRANSMIGRATION_H__ + +void NPC_TransmigrationTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_TransmigrationInit( int meindex ); +void NPC_TransmigrationWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_TRANSMIGRATION_H__*/ diff --git a/include/npc_petfusion.h b/include/npc_petfusion.h new file mode 100644 index 0000000..3fbe665 --- /dev/null +++ b/include/npc_petfusion.h @@ -0,0 +1,11 @@ +#ifndef __NPC_PETFUSION_H__ +#define __NPC_PETFUSION_H__ + + +void NPC_PetFusionManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_PetFusionManInit( int meindex ); +void NPC_PetFusionManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetFusionManLoop( int meindex); + +#endif + diff --git a/include/npc_petmaker.h b/include/npc_petmaker.h new file mode 100644 index 0000000..2754e9b --- /dev/null +++ b/include/npc_petmaker.h @@ -0,0 +1,9 @@ +#ifndef __NPC_PETMAKER_H__ +#define __NPC_PETMAKER_H__ + +void NPC_PetMakerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetMakerInit( int meindex ); + +#endif + /*__NPC_PETMAKER_H__*/ diff --git a/include/npc_petracemaster.h b/include/npc_petracemaster.h new file mode 100644 index 0000000..c8caa27 --- /dev/null +++ b/include/npc_petracemaster.h @@ -0,0 +1,10 @@ +#ifndef NPC_PetRace_Master_ +#define NPC_PetRace_Master_ + +BOOL NPC_PetRaceMasterInit( int meindex ); +void NPC_PetRaceMasterLoop( int meindex ); +void NPC_PetRaceMasterTalked( int meindex , int talkerindex , char *szMes , int color ); +void NPC_PetRaceMasterWindowTalked(int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + diff --git a/include/npc_petracepet.h b/include/npc_petracepet.h new file mode 100644 index 0000000..f421126 --- /dev/null +++ b/include/npc_petracepet.h @@ -0,0 +1,9 @@ +#ifndef NPC_PetRace_Pet_ +#define NPC_PetRace_Pet_ + +BOOL NPC_PetRacePetInit( int meindex ); +void NPC_PetRacePetLoop( int meindex ); +void NPC_PetRacePetTalked( int meindex , int talkerindex , char *szMes , int color ); + +#endif + diff --git a/include/npc_petshop.h b/include/npc_petshop.h new file mode 100644 index 0000000..7b985ca --- /dev/null +++ b/include/npc_petshop.h @@ -0,0 +1,12 @@ +#ifndef __NPC_PETSHOP_H__ +#define __NPC_PETSHOP_H__ + +void NPC_PetShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetShopInit( int meindex ); +void NPC_PetShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetShopLooked( int meindex , int lookedindex); + + +#endif +/*__NPC_PETSHOP_H__*/ diff --git a/include/npc_petskilldelshop.h b/include/npc_petskilldelshop.h new file mode 100644 index 0000000..56654e9 --- /dev/null +++ b/include/npc_petskilldelshop.h @@ -0,0 +1,10 @@ + +void NPC_PetSkillDelShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetSkillDelShopInit( int meindex ); +void NPC_PetSkillDelShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetSkillDelShopLooked( int meindex , int lookedindex); + +void NPC_PetSkillDelMakeStr(int meindex,int toindex,int select); + + /*__NPC_WINDOWPETSKILLSHOP_H__*/ diff --git a/include/npc_petskillshop.h b/include/npc_petskillshop.h new file mode 100644 index 0000000..ca603bb --- /dev/null +++ b/include/npc_petskillshop.h @@ -0,0 +1,13 @@ +#ifndef __NPC_PETSKILLSHOP_H__ +#define __NPC_PETSKILLSHOP_H__ + +void NPC_PetSkillShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_PetSkillShopInit( int meindex ); +void NPC_PetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_PetSkillShopLooked( int meindex , int lookedindex); + +void NPC_PetSkillMakeStr(int meindex,int toindex,int select); + +#endif + /*__NPC_WINDOWPETSKILLSHOP_H__*/ diff --git a/include/npc_pettransman.h b/include/npc_pettransman.h new file mode 100644 index 0000000..c840706 --- /dev/null +++ b/include/npc_pettransman.h @@ -0,0 +1,11 @@ +#ifndef __NPC_PETTRANSMAN_H__ +#define __NPC_PETTRANSMAN_H__ + +BOOL NPC_PetTransManInit(int meindex); +void NPC_PetTransMan_selectWindow(int meindex,int toindex,int num,int select); +void NPC_PetTransManWindowTalked(int meindex,int talkerindex,int seqno,int select,char *data); +void NPC_PetTransManTalked(int meindex,int talkerindex,char *szMes,int color); +int NPC_PetTransManCheck( int meindex, int toindex, int select); +BOOL NPC_PetTransManStatus( int meindex, int toindex, int petNo); +#endif + /*__NPC_PETTRANSMAN_H__*/ diff --git a/include/npc_pkpetshop.h b/include/npc_pkpetshop.h new file mode 100644 index 0000000..8e29511 --- /dev/null +++ b/include/npc_pkpetshop.h @@ -0,0 +1,297 @@ +0037:npc_poolitemshop.h:0184:1:14=48041e4b:16=47d21313:#ifndef __NPC_POOLITEMSHOP_H__ +#define __NPC_POOLITEMSHOP_H__ + + +void NPC_PoolItemShopLoop( int meindex); +BOOL NPC_PoolItemShopInit( int meindex); +void NPC_PoolItemShopTalked( int meindex , int talkerindex , + char *szMes ,int color ); +void NPC_PoolItemShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data); + + +#endif + /*__NPC_POOLITEMSHOP_H__*/ +002F:npc_quiz.h:02C0:1:14=48041e4b:16=47d21313:#ifndef __NPC_QUIZ_H__ +#define __NPC_QUIZ_H__ + +typedef struct NPC_Quiz{ + + int no; // į + int type; // ءة ̡֭) + int level; // ì + int answertype; //̫( ǩѨ + int answerNo; // + char question[512]; // + char select1[128]; // 1 + char select2[128]; // 2 + char select3[128]; // 3 + +}NPC_QUIZ; + + +void NPC_QuizTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_QuizInit( int meindex ); +void NPC_QuizWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +BOOL QUIZ_initQuiz( char *filename); + + +#endif + +/*__NPC_QUIZ_H__*/ +0033:npc_riderman.h:017F:1:14=48041e4b:16=47d21313:#ifndef __NPC_RIDERMAN_H__ +#define __NPC_RIDERMAN_H__ + +void NPC_RidermanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_RidermanInit( int meindex ); +void NPC_RidermanLooked( int meindex, int lookedindex ); +void NPC_RidermanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + /*__NPC_RIDERMAN_H__*/ +0037:npc_roomadminnew.h:03CA:1:14=48041e4b:16=47d21313:#ifndef __NPC_ROOMADMINNEW_H__ +#define __NPC_ROOMADMINNEW_H__ + + +void NPC_RoomAdminNewTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_RoomAdminNewLoop( int meindex ); +BOOL NPC_RoomAdminNewInit( int meindex ); + +BOOL NPC_RankingInit( int meindex ); +void NPC_RankingTalked( int meindex , int talkerindex , char *msg ,int color ); + +BOOL NPC_PrintpassmanInit( int meindex ); +void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg ,int color ); + +typedef struct npc_roomadminnew_tag { + int expire; + char cdkey[CDKEYLEN]; + char charaname[32]; + char passwd[9]; +}NPC_ROOMINFO; + +typedef struct npc_roomadminnew_ranking_tag { + int gold; /* ڿź */ + int biddate; /* ڿ */ + char cdkey[CDKEYLEN]; /* м ƽ */ + char charaname[32]; /* м */ + char owntitle[32]; /* į*/ + +}NPC_RANKING_INFO; + +#endif /*__NPC_ROOMADMINNEW_H__*/ + +BOOL NPC_RoomAdminNew_ReadFile( char *roomname, NPC_ROOMINFO *data); +0030:npc_sample.h:075:1:14=48041e4b:16=47d21313:#ifndef __NPC_SAMPLE_H__ +#define __NPC_SAMPLE_H__ + +void NPC_SampleLoop( int index ); + +#endif + + /*__NPC_SAMPLE_H__*/ +0034:npc_savepoint.h:014F:1:14=48041e4b:16=47d21313:#ifndef __NPC_SAVEPOINT_H__ +#define __NPC_SAVEPOINT_H__ + + +void NPC_SavePointTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_SavePointInit( int meindex ); +void NPC_SavePointWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + +#endif + +/*__NPC_SAVEPOINT_H__*/ +0036:npc_scheduleman.h:0A5A:1:14=48041e4b:16=47d21313:#ifndef __NPC_SCHEDULEMAN_H__ +#define __NPC_SCHEDULEMAN_H__ + +#define CHARNAME_MAX 32 + +// scheduleman +#ifdef _FAMILY_MANORNUM_CHANGE +#define MAX_SCHEDULEMAN 20 +#else +#define MAX_SCHEDULEMAN 12 +#endif + +// ÿһ scheduleman عܵ schedule +#define MAX_SCHEDULE 24 + +// schedule бһҳг +#define MAXSCHEDULEINONEWINDOW 10 + +// family бһҳг +#define MAXFAMILYINONEWINDOW 10 + +// ÿһ scheduleman ʹõ schedule λ +// Ӧ fmpks ID*MAX_SCHEDULE (ID=0~MAX_SCHEDULEMAN-1) +// ID д data/npc ָ "id:" ֵ + +// dueltime = (?10000:0) + (Сʱ*100) + +typedef struct tagFamilyPKSchedule { + int dueltime; // ʱ + int host_index; // Ӽ + char host_name[CHARNAME_MAX]; // Ӽ + int guest_index; // ͶӼ + char guest_name[CHARNAME_MAX]; // ͶӼ + int prepare_time; // ׼ʱ (1~40 ) + int max_player; // (1~) + int flag; // ״̬ + int win; // ʤ趨 + int challenge_timeout; // սʱ + int setting_timeout; // 趨״̬ timeout + char gmsv_name[256]; +} FamilyPKSchedule; + +// ¼ FamilyPKSchedule (fmpks) flag ֵ +#define FMPKS_FLAG_NONE -1 // ûκų +#define FMPKS_FLAG_CHALLENGE 0 // ȴͶͬ +#define FMPKS_FLAG_SETTING 1 // 趨ų (ȡʱ NONE) +#define FMPKS_FLAG_CONFIRMING 2 // Ͷͬ +#define FMPKS_FLAG_SCHEDULED 3 // Ѿźų̣δ +#define FMPKS_FLAG_DUEL 4 // +#define FMPKS_FLAG_HOSTWIN 5 // ʤ +#define FMPKS_FLAG_GUESTWIN 6 // Ͷʤ +#define FMPKS_FLAG_MANOR_BATTLEBEGIN 7 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PREPARE 8 // ׯ԰ս ׼ +#define FMPKS_FLAG_MANOR_PEACE 9 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_OTHERPLANET 10 // ׯ԰ս ڱս +#define FMPKS_FLAG_MANOR_BATTLEEND 11 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PEACE_SAVE 12 // ׯ԰ս浵 +#define FMPKS_FLAG_MANOR_READYTOFIGHT 13 // (GM: manorpk) ȫϵɿԼս״̬ +#define FMPKS_FLAG_MANOR_CLEANFLAG 14 // (GM: manorpk) ״̬ +#ifdef _NEW_MANOR_LAW +#define FMPKS_FLAG_WAIT 15 // ս,Ѽ¼,ȴսų +#endif + +// client flag +#define FLAG_NONE -1 +#define FLAG_MODIFY 0 +#define FLAG_ACCEPT 1 +#define FLAG_SETTING 2 +#define FLAG_CONFIRM 3 +#define FLAG_SCHEDULED 4 + +extern FamilyPKSchedule fmpks[MAX_SCHEDULE*MAX_SCHEDULEMAN]; + +BOOL NPC_SchedulemanInit(int meindex); +void NPC_SchedulemanTalked(int meindex, int talkerindex, char *msg, int color); +void NPC_SchedulemanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data); +void NPC_SchedulemanLoop(int meindex); + +#endif + +/*__NPC_SCHEDULEMAN_H__*/ +0035:npc_sellsthman.h:013A:1:14=48041e4b:16=47d21313:#ifndef _SELLSTH_MAN_H +#define _SELLSTH_MAN_H + +void NPC_SellsthManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_SellsthManInit( int meindex ); +void NPC_SellsthManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SellsthManLoop( int meindex); + +#endif +0034:npc_signboard.h:0124:1:14=48041e4b:16=47d21313:#ifndef __NPC_SIGNBOARD_H__ +#define __NPC_SIGNBOARD_H__ + + +BOOL NPC_SignBoardInit( int meindex ); +void NPC_SignBoardWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SignBoardLooked( int meindex , int lookedindex); + + +#endif + /*__NPC_WINDOWSIGNBOAD_H__*/ +0035:npc_simpleshop.h:0176:1:14=48041e4b:16=47d21313:#ifndef __NPC_SIMPLESHOP_H__ +#define __NPC_SIMPLESHOP_H__ + +void NPC_SimpleShopTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_LimitBuyInShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopInit( int meindex ); + +#endif + /*__NPC_SIMPLESHOP_H__*/ +003A:npc_stoneserviceman.h:02AE:1:14=48041e4b:16=47d21313:#ifndef __NPC_STONESERVICEMAN_H__ +#define __NPC_STONESERVICEMAN_H__ + +// ϴ +typedef struct _List +{ + char Data[32]; // + struct _List *Next; // ָһList +}List,*LPList; + +BOOL NPC_StoneServiceManInit(int meindex); +void NPC_StoneServiceManLoop(int meindex); +void NPC_StoneServiceManTalked(int meindex,int talkerindex,char *msg,int color); +void NPC_StoneServiceManWindowTalked(int meindex,int talkerindex,int seqno, + int select,char *data); +int SendToAP(int nAid,int nIndex,int nLen,void *Data1,void *Data2); +int RecvFromAP(int *nAid,int nIndex,int *nLen,LPList *Data); +int GetMsg(int meindex); +int ConnectToAP(void); +#endif +0035:npc_storyteller.h:0B9:1:14=48041e4b:16=47d21313:#ifndef _NPC_STORYTELLER_H_ +#define _NPC_STORYTELLER_H_ + +BOOL NPC_StoryTellerInit( int meindex ); +void NPC_StoryTellerTalked( int meindex , int talker , char *msg , int col ); + +#endif + +0031:npc_sysinfo.h:0E4:1:14=48041e4b:16=47d21313:#ifndef __NPC_SYSINFO_H__ +#define __NPC_SYSINFO_H__ + +BOOL NPC_SysinfoInit( int meindex ); +void NPC_SysinfoLoop( int meindex ); +void NPC_SysinfoTalked( int meindex, int tindex, char *msg, int color); +#endif /*__NPC_SYSINFO_H__*/ +0032:npc_timeman.h:0167:1:14=48041e4b:16=47d21313:#ifndef __NPC_TIMEMAN_H__ +#define __NPC_TIMEMAN_H__ + + +void NPC_TimeManTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_TimeManInit( int meindex ); + +void NPC_TimeManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); + +#endif /*__NPC_TIMEMAN_H__*/ +0034:npc_townpeople.h:0D1:1:14=48041e4b:16=47d21313:#ifndef __NPC_TOWNPEOPLE_H__ +#define __NPC_TOWNPEOPLE_H__ + +void NPC_TownPeopleTalked( int index, int talker, char *msg, int color ); +void NPC_TownPeopleInit( int meindex ); + +#endif /* __NPC_TOWNPEOPLE_H__ */ +0035:npc_transerman.h:013A:1:14=48041e4b:16=47d21313:#ifndef _TRANSER_MAN_H +#define _TRANSER_MAN_H + +void NPC_TranserManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_TranserManInit( int meindex ); +void NPC_TranserManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_TranserManLoop( int meindex); + +#endif +0039:npc_transmigration.h:016A:1:14=48041e4b:16=47d21313:#ifndef __NPC_TRANSMIGRATION_H__ +#define __NPC_TRANSMIGRATION_H__ + +void NPC_TransmigrationTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_TransmigrationInit( int meindex ); +void NPC_TransmigrationWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_TRANSMIGRATION_H__*/ diff --git a/include/npc_poolitemshop.h b/include/npc_poolitemshop.h new file mode 100644 index 0000000..11d7e43 --- /dev/null +++ b/include/npc_poolitemshop.h @@ -0,0 +1,14 @@ +#ifndef __NPC_POOLITEMSHOP_H__ +#define __NPC_POOLITEMSHOP_H__ + + +void NPC_PoolItemShopLoop( int meindex); +BOOL NPC_PoolItemShopInit( int meindex); +void NPC_PoolItemShopTalked( int meindex , int talkerindex , + char *szMes ,int color ); +void NPC_PoolItemShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data); + + +#endif + /*__NPC_POOLITEMSHOP_H__*/ diff --git a/include/npc_quiz.h b/include/npc_quiz.h new file mode 100644 index 0000000..31290c1 --- /dev/null +++ b/include/npc_quiz.h @@ -0,0 +1,29 @@ +#ifndef __NPC_QUIZ_H__ +#define __NPC_QUIZ_H__ + +typedef struct NPC_Quiz{ + + int no; // į + int type; // ءة ̡֭) + int level; // ì + int answertype; //̫( ǩѨ + int answerNo; // + char question[512]; // + char select1[128]; // 1 + char select2[128]; // 2 + char select3[128]; // 3 + +}NPC_QUIZ; + + +void NPC_QuizTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_QuizInit( int meindex ); +void NPC_QuizWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +BOOL QUIZ_initQuiz( char *filename); + + +#endif + +/*__NPC_QUIZ_H__*/ diff --git a/include/npc_riderman.h b/include/npc_riderman.h new file mode 100644 index 0000000..bfaa48f --- /dev/null +++ b/include/npc_riderman.h @@ -0,0 +1,12 @@ +#ifndef __NPC_RIDERMAN_H__ +#define __NPC_RIDERMAN_H__ + +void NPC_RidermanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_RidermanInit( int meindex ); +void NPC_RidermanLooked( int meindex, int lookedindex ); +void NPC_RidermanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + /*__NPC_RIDERMAN_H__*/ diff --git a/include/npc_rmbshop.h b/include/npc_rmbshop.h new file mode 100644 index 0000000..68c3406 --- /dev/null +++ b/include/npc_rmbshop.h @@ -0,0 +1,4 @@ +void NPC_RmbshopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_RmbshopInit( int meindex ); +void NPC_RmbshopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_RmbshopLoop( int meindex); diff --git a/include/npc_roomadminnew.h b/include/npc_roomadminnew.h new file mode 100644 index 0000000..a89c700 --- /dev/null +++ b/include/npc_roomadminnew.h @@ -0,0 +1,33 @@ +#ifndef __NPC_ROOMADMINNEW_H__ +#define __NPC_ROOMADMINNEW_H__ + + +void NPC_RoomAdminNewTalked( int meindex , int talkerindex , char *msg , int color ); +void NPC_RoomAdminNewLoop( int meindex ); +BOOL NPC_RoomAdminNewInit( int meindex ); + +BOOL NPC_RankingInit( int meindex ); +void NPC_RankingTalked( int meindex , int talkerindex , char *msg ,int color ); + +BOOL NPC_PrintpassmanInit( int meindex ); +void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg ,int color ); + +typedef struct npc_roomadminnew_tag { + int expire; + char cdkey[CDKEYLEN]; + char charaname[32]; + char passwd[9]; +}NPC_ROOMINFO; + +typedef struct npc_roomadminnew_ranking_tag { + int gold; /* ڿź */ + int biddate; /* ڿ */ + char cdkey[CDKEYLEN]; /* м ƽ */ + char charaname[32]; /* м */ + char owntitle[32]; /* į*/ + +}NPC_RANKING_INFO; + +#endif /*__NPC_ROOMADMINNEW_H__*/ + +BOOL NPC_RoomAdminNew_ReadFile( char *roomname, NPC_ROOMINFO *data); diff --git a/include/npc_sample.h b/include/npc_sample.h new file mode 100644 index 0000000..b648598 --- /dev/null +++ b/include/npc_sample.h @@ -0,0 +1,8 @@ +#ifndef __NPC_SAMPLE_H__ +#define __NPC_SAMPLE_H__ + +void NPC_SampleLoop( int index ); + +#endif + + /*__NPC_SAMPLE_H__*/ diff --git a/include/npc_savepoint.h b/include/npc_savepoint.h new file mode 100644 index 0000000..80edab6 --- /dev/null +++ b/include/npc_savepoint.h @@ -0,0 +1,14 @@ +#ifndef __NPC_SAVEPOINT_H__ +#define __NPC_SAVEPOINT_H__ + + +void NPC_SavePointTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_SavePointInit( int meindex ); +void NPC_SavePointWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + + +#endif + +/*__NPC_SAVEPOINT_H__*/ diff --git a/include/npc_scheduleman.h b/include/npc_scheduleman.h new file mode 100644 index 0000000..fd23c3a --- /dev/null +++ b/include/npc_scheduleman.h @@ -0,0 +1,82 @@ +#ifndef __NPC_SCHEDULEMAN_H__ +#define __NPC_SCHEDULEMAN_H__ + +#define CHARNAME_MAX 32 + +// scheduleman +#ifdef _FAMILY_MANORNUM_CHANGE +#define MAX_SCHEDULEMAN 20 +#else +#define MAX_SCHEDULEMAN 12 +#endif + +// ÿһ scheduleman عܵ schedule +#define MAX_SCHEDULE 24 + +// schedule бһҳг +#define MAXSCHEDULEINONEWINDOW 10 + +// family бһҳг +#define MAXFAMILYINONEWINDOW 10 + +// ÿһ scheduleman ʹõ schedule λ +// Ӧ fmpks ID*MAX_SCHEDULE (ID=0~MAX_SCHEDULEMAN-1) +// ID д data/npc ָ "id:" ֵ + +// dueltime = (?10000:0) + (Сʱ*100) + +typedef struct tagFamilyPKSchedule { + int dueltime; // ʱ + int host_index; // Ӽ + char host_name[CHARNAME_MAX]; // Ӽ + int guest_index; // ͶӼ + char guest_name[CHARNAME_MAX]; // ͶӼ + int prepare_time; // ׼ʱ (1~40 ) + int max_player; // (1~) + int flag; // ״̬ + int win; // ʤ趨 + int challenge_timeout; // սʱ + int setting_timeout; // 趨״̬ timeout + char gmsv_name[256]; +} FamilyPKSchedule; + +// ¼ FamilyPKSchedule (fmpks) flag ֵ +#define FMPKS_FLAG_NONE -1 // ûκų +#define FMPKS_FLAG_CHALLENGE 0 // ȴͶͬ +#define FMPKS_FLAG_SETTING 1 // 趨ų (ȡʱ NONE) +#define FMPKS_FLAG_CONFIRMING 2 // Ͷͬ +#define FMPKS_FLAG_SCHEDULED 3 // Ѿźų̣δ +#define FMPKS_FLAG_DUEL 4 // +#define FMPKS_FLAG_HOSTWIN 5 // ʤ +#define FMPKS_FLAG_GUESTWIN 6 // Ͷʤ +#define FMPKS_FLAG_MANOR_BATTLEBEGIN 7 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PREPARE 8 // ׯ԰ս ׼ +#define FMPKS_FLAG_MANOR_PEACE 9 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_OTHERPLANET 10 // ׯ԰ս ڱս +#define FMPKS_FLAG_MANOR_BATTLEEND 11 // ׯ԰ս ս +#define FMPKS_FLAG_MANOR_PEACE_SAVE 12 // ׯ԰ս浵 +#define FMPKS_FLAG_MANOR_READYTOFIGHT 13 // (GM: manorpk) ȫϵɿԼս״̬ +#define FMPKS_FLAG_MANOR_CLEANFLAG 14 // (GM: manorpk) ״̬ +#ifdef _NEW_MANOR_LAW +#define FMPKS_FLAG_WAIT 15 // ս,Ѽ¼,ȴսų +#endif + +// client flag +#define FLAG_NONE -1 +#define FLAG_MODIFY 0 +#define FLAG_ACCEPT 1 +#define FLAG_SETTING 2 +#define FLAG_CONFIRM 3 +#define FLAG_SCHEDULED 4 + +extern FamilyPKSchedule fmpks[MAX_SCHEDULE*MAX_SCHEDULEMAN]; + +BOOL NPC_SchedulemanInit(int meindex); +void NPC_SchedulemanTalked(int meindex, int talkerindex, char *msg, int color); +void NPC_SchedulemanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data); +void NPC_SchedulemanLoop(int meindex); + +#endif + +/*__NPC_SCHEDULEMAN_H__*/ diff --git a/include/npc_sellsthman.h b/include/npc_sellsthman.h new file mode 100644 index 0000000..6ce6165 --- /dev/null +++ b/include/npc_sellsthman.h @@ -0,0 +1,9 @@ +#ifndef _SELLSTH_MAN_H +#define _SELLSTH_MAN_H + +void NPC_SellsthManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_SellsthManInit( int meindex ); +void NPC_SellsthManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SellsthManLoop( int meindex); + +#endif diff --git a/include/npc_signboard.h b/include/npc_signboard.h new file mode 100644 index 0000000..ed96680 --- /dev/null +++ b/include/npc_signboard.h @@ -0,0 +1,11 @@ +#ifndef __NPC_SIGNBOARD_H__ +#define __NPC_SIGNBOARD_H__ + + +BOOL NPC_SignBoardInit( int meindex ); +void NPC_SignBoardWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_SignBoardLooked( int meindex , int lookedindex); + + +#endif + /*__NPC_WINDOWSIGNBOAD_H__*/ diff --git a/include/npc_simpleshop.h b/include/npc_simpleshop.h new file mode 100644 index 0000000..3b0da80 --- /dev/null +++ b/include/npc_simpleshop.h @@ -0,0 +1,10 @@ +#ifndef __NPC_SIMPLESHOP_H__ +#define __NPC_SIMPLESHOP_H__ + +void NPC_SimpleShopTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_LimitBuyInShopSpecialTalked( int index, int talker, char *msg, int color ); +void NPC_SimpleShopInit( int meindex ); + +#endif + /*__NPC_SIMPLESHOP_H__*/ diff --git a/include/npc_stoneserviceman.h b/include/npc_stoneserviceman.h new file mode 100644 index 0000000..9d9feb1 --- /dev/null +++ b/include/npc_stoneserviceman.h @@ -0,0 +1,20 @@ +#ifndef __NPC_STONESERVICEMAN_H__ +#define __NPC_STONESERVICEMAN_H__ + +// ϴ +typedef struct _List +{ + char Data[32]; // + struct _List *Next; // ָһList +}List,*LPList; + +BOOL NPC_StoneServiceManInit(int meindex); +void NPC_StoneServiceManLoop(int meindex); +void NPC_StoneServiceManTalked(int meindex,int talkerindex,char *msg,int color); +void NPC_StoneServiceManWindowTalked(int meindex,int talkerindex,int seqno, + int select,char *data); +int SendToAP(int nAid,int nIndex,int nLen,void *Data1,void *Data2); +int RecvFromAP(int *nAid,int nIndex,int *nLen,LPList *Data); +int GetMsg(int meindex); +int ConnectToAP(void); +#endif diff --git a/include/npc_storyteller.h b/include/npc_storyteller.h new file mode 100644 index 0000000..a8a17cf --- /dev/null +++ b/include/npc_storyteller.h @@ -0,0 +1,8 @@ +#ifndef _NPC_STORYTELLER_H_ +#define _NPC_STORYTELLER_H_ + +BOOL NPC_StoryTellerInit( int meindex ); +void NPC_StoryTellerTalked( int meindex , int talker , char *msg , int col ); + +#endif + diff --git a/include/npc_stushop.h b/include/npc_stushop.h new file mode 100644 index 0000000..b9ebff2 --- /dev/null +++ b/include/npc_stushop.h @@ -0,0 +1,9 @@ +#ifndef _STU_SHOP_H +#define _STU_SHOP_H + +void NPC_StushopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_StushopInit( int meindex ); +void NPC_StushopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_StushopLoop( int meindex); + +#endif diff --git a/include/npc_sysinfo.h b/include/npc_sysinfo.h new file mode 100644 index 0000000..37b6b4b --- /dev/null +++ b/include/npc_sysinfo.h @@ -0,0 +1,7 @@ +#ifndef __NPC_SYSINFO_H__ +#define __NPC_SYSINFO_H__ + +BOOL NPC_SysinfoInit( int meindex ); +void NPC_SysinfoLoop( int meindex ); +void NPC_SysinfoTalked( int meindex, int tindex, char *msg, int color); +#endif /*__NPC_SYSINFO_H__*/ diff --git a/include/npc_timeman.h b/include/npc_timeman.h new file mode 100644 index 0000000..0611141 --- /dev/null +++ b/include/npc_timeman.h @@ -0,0 +1,13 @@ +#ifndef __NPC_TIMEMAN_H__ +#define __NPC_TIMEMAN_H__ + + +void NPC_TimeManTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_TimeManInit( int meindex ); + +void NPC_TimeManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); + +#endif /*__NPC_TIMEMAN_H__*/ diff --git a/include/npc_townpeople.h b/include/npc_townpeople.h new file mode 100644 index 0000000..745317b --- /dev/null +++ b/include/npc_townpeople.h @@ -0,0 +1,7 @@ +#ifndef __NPC_TOWNPEOPLE_H__ +#define __NPC_TOWNPEOPLE_H__ + +void NPC_TownPeopleTalked( int index, int talker, char *msg, int color ); +void NPC_TownPeopleInit( int meindex ); + +#endif /* __NPC_TOWNPEOPLE_H__ */ diff --git a/include/npc_transerman.h b/include/npc_transerman.h new file mode 100644 index 0000000..2acca4e --- /dev/null +++ b/include/npc_transerman.h @@ -0,0 +1,9 @@ +#ifndef _TRANSER_MAN_H +#define _TRANSER_MAN_H + +void NPC_TranserManTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_TranserManInit( int meindex ); +void NPC_TranserManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_TranserManLoop( int meindex); + +#endif diff --git a/include/npc_transmigration.h b/include/npc_transmigration.h new file mode 100644 index 0000000..b5040fe --- /dev/null +++ b/include/npc_transmigration.h @@ -0,0 +1,11 @@ +#ifndef __NPC_TRANSMIGRATION_H__ +#define __NPC_TRANSMIGRATION_H__ + +void NPC_TransmigrationTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_TransmigrationInit( int meindex ); +void NPC_TransmigrationWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +#endif + +/*__NPC_TRANSMIGRATION_H__*/ diff --git a/include/npc_verywelfare.h b/include/npc_verywelfare.h new file mode 100644 index 0000000..af1c468 --- /dev/null +++ b/include/npc_verywelfare.h @@ -0,0 +1,80 @@ +0034:npc_vigorshop.h:013D:1:14=48041e4b:16=47d21313: +void NPC_ItemVigorShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ItemVigorShopInit( int meindex ); +void NPC_ItemVigorShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_ItemVigorShopLooked( int meindex , int lookedindex); + +0038:npc_vigorshop.h.bak:017F:1:14=48041e4b:16=47d21313:#ifndef __NPC_ITEMSHOP_H__ +#define __NPC_ITEMSHOP_H__ + +void NPC_ItemShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ItemShopInit( int meindex ); +void NPC_ItemShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_ItemShopLooked( int meindex , int lookedindex); + + +#endif + /*__NPC_ITEMSHOP_H__*/ +0033:npc_vippoint.h:0128:1:14=48041e4b:16=47d21313:#ifndef _VIP_SHOP_H +#define _VIP_SHOP_H + +void NPC_VipshopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_VipshopInit( int meindex ); +void NPC_VipshopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_VipshopLoop( int meindex); + +#endif +0032:npc_vipshop.h:0128:1:14=48041e4b:16=47d21313:#ifndef _VIP_SHOP_H +#define _VIP_SHOP_H + +void NPC_VipshopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_VipshopInit( int meindex ); +void NPC_VipshopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_VipshopLoop( int meindex); + +#endif +002F:npc_warp.h:019C:1:14=48041e4b:16=47d21313:#ifndef __NPC_WARP_H__ +#define __NPC_WARP_H__ +BOOL NPC_WarpInit( int charaindex ); +void NPC_WarpPostOver( int meindex,int charaindex ); +void NPC_WarpWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); +int NPC_WarpSearchByPosition( int fl , int x, int y); +void NPC_WarpWarpCharacter( int warpnpcindex, int charaindex ); +#endif + /*__NPC_WARP_H__*/ +0032:npc_warpman.h:021D:1:14=48041e4b:16=47d21313:#ifndef __NPC_WARPMAN_H__ +#define __NPC_WARPMAN_H__ + +void NPC_WarpManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_WarpManInit( int meindex ); +void NPC_WarpManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_GetDuelRank(int rank,int msgid,int msgid2); +void NPC_WarpManLoop( int meindex); +void NPC_WarpManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); +#endif +/*__NPC_WARPMAN_H__*/ +0032:npc_welfare.h:0149:1:14=48041e4b:16=47d21313:#ifndef __NPC_WELFARE_H__ +#define __NPC_WELFARE_H__ + +BOOL NPC_WelfareInit( int meindex ); +void NPC_WelfareTalked( int meindex , int talker , char *msg ,int color ); +void NPC_WelfareWindowTalked(int meindex, int talkerindex, int seqno, int select,char *data); +void NPC_WelfareMakeStr(int meindex,int toindex,int select); + + +#endif +0033:npc_welfare2.h:014E:1:14=48041e4b:16=47d21313:#ifndef __NPC_WELFARE2_H__ +#define __NPC_WELFARE2_H__ + +BOOL NPC_WelfareInit2( int meindex ); +void NPC_WelfareTalked2( int meindex , int talker , char *msg ,int color ); +void NPC_WelfareWindowTalked2(int meindex, int talkerindex, int seqno, int select,char *data); +void NPC_WelfareMakeStr2(int meindex,int toindex,int select); + +#endif +0037:npc_windowhealer.h:019A:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npc_vigorshop.h b/include/npc_vigorshop.h new file mode 100644 index 0000000..4c38453 --- /dev/null +++ b/include/npc_vigorshop.h @@ -0,0 +1,7 @@ + +void NPC_ItemVigorShopTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_ItemVigorShopInit( int meindex ); +void NPC_ItemVigorShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_ItemVigorShopLooked( int meindex , int lookedindex); + diff --git a/include/npc_vipshop.h b/include/npc_vipshop.h new file mode 100644 index 0000000..01133ff --- /dev/null +++ b/include/npc_vipshop.h @@ -0,0 +1,9 @@ +#ifndef _VIP_SHOP_H +#define _VIP_SHOP_H + +void NPC_VipshopTalked( int meindex, int talkerindex, char *msg, int color ); +BOOL NPC_VipshopInit( int meindex ); +void NPC_VipshopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_VipshopLoop( int meindex); + +#endif diff --git a/include/npc_warp.h b/include/npc_warp.h new file mode 100644 index 0000000..4caafbc --- /dev/null +++ b/include/npc_warp.h @@ -0,0 +1,10 @@ +#ifndef __NPC_WARP_H__ +#define __NPC_WARP_H__ +BOOL NPC_WarpInit( int charaindex ); +void NPC_WarpPostOver( int meindex,int charaindex ); +void NPC_WarpWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); +int NPC_WarpSearchByPosition( int fl , int x, int y); +void NPC_WarpWarpCharacter( int warpnpcindex, int charaindex ); +#endif + /*__NPC_WARP_H__*/ diff --git a/include/npc_warpman.h b/include/npc_warpman.h new file mode 100644 index 0000000..ee48e0a --- /dev/null +++ b/include/npc_warpman.h @@ -0,0 +1,13 @@ +#ifndef __NPC_WARPMAN_H__ +#define __NPC_WARPMAN_H__ + +void NPC_WarpManTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_WarpManInit( int meindex ); +void NPC_WarpManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_GetDuelRank(int rank,int msgid,int msgid2); +void NPC_WarpManLoop( int meindex); +void NPC_WarpManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ); +#endif +/*__NPC_WARPMAN_H__*/ diff --git a/include/npc_welfare.h b/include/npc_welfare.h new file mode 100644 index 0000000..4aa9037 --- /dev/null +++ b/include/npc_welfare.h @@ -0,0 +1,10 @@ +#ifndef __NPC_WELFARE_H__ +#define __NPC_WELFARE_H__ + +BOOL NPC_WelfareInit( int meindex ); +void NPC_WelfareTalked( int meindex , int talker , char *msg ,int color ); +void NPC_WelfareWindowTalked(int meindex, int talkerindex, int seqno, int select,char *data); +void NPC_WelfareMakeStr(int meindex,int toindex,int select); + + +#endif diff --git a/include/npc_welfare2.h b/include/npc_welfare2.h new file mode 100644 index 0000000..0bbb309 --- /dev/null +++ b/include/npc_welfare2.h @@ -0,0 +1,9 @@ +#ifndef __NPC_WELFARE2_H__ +#define __NPC_WELFARE2_H__ + +BOOL NPC_WelfareInit2( int meindex ); +void NPC_WelfareTalked2( int meindex , int talker , char *msg ,int color ); +void NPC_WelfareWindowTalked2(int meindex, int talkerindex, int seqno, int select,char *data); +void NPC_WelfareMakeStr2(int meindex,int toindex,int select); + +#endif diff --git a/include/npc_windowhealer.h b/include/npc_windowhealer.h new file mode 100644 index 0000000..2c8f62a --- /dev/null +++ b/include/npc_windowhealer.h @@ -0,0 +1,11 @@ +#ifndef __NPC_WINDOWHEALER_H__ +#define __NPC_WINDOWHEALER_H__ + +void NPC_WindowHealerTalked( int meindex , int talkerindex , char *msg , + int color ); +BOOL NPC_WindowHealerInit( int meindex ); +void NPC_WindowHealerWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); +void NPC_WindowHealerLooked( int meindex , int lookedindex); + +#endif + /*__NPC_WINDOWHEALER_H__*/ diff --git a/include/npc_windowman.h b/include/npc_windowman.h new file mode 100644 index 0000000..3cf1dde --- /dev/null +++ b/include/npc_windowman.h @@ -0,0 +1,16 @@ +#ifndef __NPC_WINDOWMAN_H__ +#define __NPC_WINDOWMAN_H__ + +void NPC_WindowmanTalked( int meindex , int talkerindex , char *msg , + int color ); + +BOOL NPC_WindowmanInit( int meindex ); +void NPC_WindowmanLooked( int meindex, int lookedindex ); +void NPC_WindowmanWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data); + +void NPC_Windowman_selectWindow( int meindex, int toindex, int num); +BOOL NPC_Windowman_readData( int meindex, int windowno, BOOL chkflg); +int NPC_Windowman_restoreButtontype( char *data ); + +#endif +/*__NPC_WINDOWMAN_H__*/ diff --git a/include/npccreate.h b/include/npccreate.h new file mode 100644 index 0000000..7109410 --- /dev/null +++ b/include/npccreate.h @@ -0,0 +1,93 @@ +#ifndef __READNPCCREATE_H__ +#define __READNPCCREATE_H__ + +#include "util.h" + +#define NPC_CREATEFILEMAGIC "NPCCREATE\n" + + +#undef EXTERN +#ifdef __NPCCREATE__ +#define EXTERN +#else +#define EXTERN extern +#endif /*__NPCCREATE__*/ + + +typedef enum +{ + NPC_CREATEFLOORID, /* ׷ʧID */ + NPC_CREATEBORNLEFTUPX, /* X */ + NPC_CREATEBORNLEFTUPY, /* Y */ + NPC_CREATEBORNRIGHTDOWNX, /* ƱX */ + NPC_CREATEBORNRIGHTDOWNY, /* ƱY */ + + NPC_CREATEMOVELEFTUPX, /* X */ + NPC_CREATEMOVELEFTUPY, /* Y */ + NPC_CREATEMOVERIGHTDOWNX, /* ƱX */ + NPC_CREATEMOVERIGHTDOWNY, /* ƱY */ + + NPC_CREATEDIR, /* ݼ */ + NPC_CREATEBASEIMAGENUMBER, /* template ɬë̤ + į */ + NPC_CREATETIME, /* */ + NPC_CREATEBORNNUM, /* ؽ */ + + NPC_CREATEENEMYNUM, /* ļ */ + NPC_CREATEBOUNDARY, + NPC_CREATEDATE, + NPC_CREATEIGNOREINVINCIBLE, + NPC_CREATEFAMILY, // Robin 0731 Family +#ifdef _ADD_ACTION //jeffrey 1231 npcaction + NPC_CREATEACTION, +#endif + NPC_CREATEINTNUM, + +}NPC_CREATEINT; + +typedef enum +{ + NPC_CREATENAME, /* templateë̤¾ľئ */ + NPC_CREATECHARNUM, +}NPC_CREATECHAR; + + +typedef enum +{ + NPC_CREATEWORKENEMYNUM, + NPC_CREATEWORKMAKESTARTSEC, + NPC_CREATEWORKMAKESTARTUSEC, + NPC_CREATEWORKNEVERMAKE, + NPC_CREATEWORKNUM, + +}NPC_CREATEWORK; + +typedef struct tagNPC_Create +{ + int intdata[NPC_CREATEINTNUM]; + STRING64 chardata[NPC_CREATECHARNUM]; + int workdata[NPC_CREATEWORKNUM]; + int templateindex[8]; + STRING64 arg[8]; +}NPC_Create; + + +EXTERN NPC_Create* NPC_create; +EXTERN int NPC_createnum; +EXTERN int NPC_create_readindex; + +INLINE int NPC_CHECKCREATEINDEX(int index); + +BOOL NPC_isBoundarySet( int createindex ); +BOOL NPC_createGetRECT( int createindex,RECT* r ); +BOOL NPC_readNPCCreateFiles( char* topdirectory ,int createsize); +int NPC_getCreateInt( int index , NPC_CREATEINT element ); + +BOOL NPC_createCheckGenerateFromTime( int tindex ); +void NPC_createInitTime( int index ); +void NPC_createIncreaseEnemynum( int index ); +void NPC_createDecreaseEnemynum( int index ); +BOOL NPC_createCheckMaxEnemynum( int index ); + +#endif +/*__READNPCCREATE_H__*/ diff --git a/include/npcgen.h b/include/npcgen.h new file mode 100644 index 0000000..f7ab71a --- /dev/null +++ b/include/npcgen.h @@ -0,0 +1,13 @@ +#ifndef __NPCGEN_H__ +#define __NPCGEN_H__ + + +void NPC_generateLoop( BOOL FlgInit ); + +EXTERN int all_nosee; /* ༰ݣ廯ë no_see */ +EXTERN int all_nobody; /* ༰ݣ廯ë no_body */ +EXTERN int one_loop_born; /* ƥ Ϸ oneloop_born */ + + +#endif +/*__NPCGEN_H__*/ diff --git a/include/npcserver.h b/include/npcserver.h new file mode 100644 index 0000000..2798a55 --- /dev/null +++ b/include/npcserver.h @@ -0,0 +1,38 @@ +#ifndef _NPCSERVER_H +#define _NPCSERVER_H + + +int NSproto_DispatchMessage(int fd,char* encoded); +int connectNpcServer(char* hostname,unsigned short port); +void NPCS_SendProbe( int fd); + +typedef struct _NPCMessCommand +{ + char buf[4096]; + int len; + struct _NPCMessCommand *next; +}NPCMessC; + +BOOL NPCMESS_setChar( char *buf); +BOOL NPCMESS_getChar( char *buf, int len); +NPCMessC *MESS_getNew(); + + +void NPCS_AskNpcList_recv( int fd, char *Nlist); +void NPCS_AskNpcList_send( int fd); + +void NPCS_NpcSLogin_recv( int fd, char *Mess); +void NPCS_NpcSLogin_send( int fd); + +void NPCS_AskNpcTalk_send( int objindex, int npcsindex, int charaindex, char *Nlist); + +void NPCS_NpcTalkMess_recv( int npcobjindex, int charaindex, int charobjindex, char *TalkMess, int Color); +void NPCS_NpcWinMess_recv( int npcobjindex, int charaindex, int charobjindex, char *WinMess, + int seqno, int windowtype, int buttontype, int page); +void NPCS_NpcWinMess_send( int npcobjindex, int npcindex, int charaindex, char *WinMess, + int seqno, int select); +void NPCS_NpcCheckFreeMess_recv( int npcobjindex, int charaindex, int charobjindex, + char *CheckfreeMess); + +#endif + diff --git a/include/npcshandle.h b/include/npcshandle.h new file mode 100644 index 0000000..f4ad347 --- /dev/null +++ b/include/npcshandle.h @@ -0,0 +1,198 @@ +0032:npctemplate.h:0DDE:1:14=48041e4b:16=47d21313:#ifndef __READNPCTEMPLATE_H__ +#define __READNPCTEMPLATE_H__ + +#include "util.h" +#include "char_base.h" + +#define NPC_TEMPLATEFILEMAGIC "NPCTEMPLATE\n" + +#undef EXTERN +#ifdef __NPCTEMPLATE__ +#define EXTERN +#else +#define EXTERN extern +#endif /*__NPCTEMPLATE__*/ + + + +typedef struct tagNPC_haveItem +{ + int itemnumber; + int haverate; + int havenum; +}NPC_haveItem; + +typedef enum +{ + NPC_TEMPLATENAME, /* */ + NPC_TEMPLATECHARNAME, /* */ + + NPC_TEMPLATEINITFUNC, /* CHAR_INITFUNC */ + NPC_TEMPLATEWALKPREFUNC, /* CHAR_WALKPREFUNC */ + NPC_TEMPLATEWALKPOSTFUNC, /* CHAR_WALKPOSTFUNC */ + NPC_TEMPLATEPREOVERFUNC, /* CHAR_PREOVERFUNC */ + NPC_TEMPLATEPOSTOVERFUNC, /* CHAR_POSTOVERFUNC */ + NPC_TEMPLATEWATCHFUNC, /* CHAR_WATCHFUNC */ + NPC_TEMPLATELOOPFUNC, /* CHAR_LOOPFUNC */ + NPC_TEMPLATEDYINGFUNC, /* CHAR_DYINGFUNC */ + NPC_TEMPLATETALKEDFUNC, /* CHAR_TALKEDFUNC */ + + NPC_TEMPLATEPREATTACKEDFUNC, /* CHAR_PREATTACKEDFUNC */ + NPC_TEMPLATEPOSTATTACKEDFUNC, /* CHAR_POSTATTACKEDFUNC */ + + NPC_TEMPLATEOFFFUNC, /* CHAR_OFFFUNC */ + NPC_TEMPLATELOOKEDFUNC, /* CHAR_LOOKEDFUNC */ + NPC_TEMPLATEITEMPUTFUNC, /* CHAR_ITEMPUTFUNC */ + + NPC_TEMPLATESPECIALTALKEDFUNC, /* CHAR_SPECIALTALKEDFUNC */ + NPC_TEMPLATEWINDOWTALKEDFUNC, /* CHAR_WINDOWTALKEDFUNC */ +#ifdef _USER_CHARLOOPS + NPC_TEMPLATELOOPFUNCTEMP1, //CHAR_LOOPFUNCTEMP1, + NPC_TEMPLATELOOPFUNCTEMP2, //CHAR_LOOPFUNCTEMP2, + NPC_TEMPLATEBATTLEPROPERTY, //CHAR_BATTLEPROPERTY, +#endif + NPC_TEMPLATECHARNUM, +}NPC_TEMPLATECHAR; + +typedef enum +{ + NPC_TEMPLATEMAKEATNOBODY, /* ئݱ¾ */ + NPC_TEMPLATEMAKEATNOSEE, /* έئƥ¾ */ + NPC_TEMPLATEIMAGENUMBER, /* į */ + NPC_TEMPLATETYPE, /* 裻ݱ裻 */ + + NPC_TEMPLATEMINHP, /* HP */ + + NPC_TEMPLATEMINMP, /* MP */ + + NPC_TEMPLATEMINSTR, /* STR */ + + NPC_TEMPLATEMINTOUGH, /* TOUGH */ + + NPC_TEMPLATEISFLYING, /* ƥ¾ */ + + NPC_TEMPLATEITEMNUM, /* еʧ ة */ + + NPC_TEMPLATELOOPFUNCTIME, /* + * + * ëپ + */ + NPC_TEMPLATEFUNCTIONINDEX, /* + * fucntionSet + * ̼͵ + */ + + NPC_TEMPLATEINTNUM, +}NPC_TEMPLATEINT; + +typedef struct tagNPC_Template +{ + STRING64 chardata[NPC_TEMPLATECHARNUM]; + int intdata[NPC_TEMPLATEINTNUM]; + int randomdata[NPC_TEMPLATEINTNUM]; /* ¼ĸة + Ȼ */ + int hash; + NPC_haveItem* haveitem; +}NPC_Template; + + +EXTERN NPC_Template* NPC_template; +EXTERN int NPC_templatenum; +EXTERN int NPC_template_readindex; + +INLINE int NPC_CHECKTEMPLATEINDEX(int index); + +BOOL NPC_copyFunctionSetToChar( int id, Char* ch ); + +BOOL NPC_readNPCTemplateFiles( char* topdirectory ,int templatesize); +int NPC_templateGetTemplateIndex( char* templatename ); + +#endif + /*__READNPCTEMPLATE_H__*/ +002E:npcutil.h:0D63:1:14=48041e4b:16=47d21313:#ifndef _NPCUTIL_H_ +#define _NPCUTIL_H_ + +BOOL NPC_Util_AddOneTitle( int charindex, int titleindex ); +BOOL NPC_Util_HaveTitle( int charindex , int titleindex ); +BOOL NPC_Util_Nearby( int x1 , int y1, int x2 , int y2 ); +BOOL NPC_Util_CharNearby(int ind1,int ind2); +int NPC_Util_YN(char *input ); +int NPC_Util_getDirFromTwoPoint( POINT* pstart, POINT* pend ); +int NPC_Util_countHaveItem( int meindex , int itemid ); +BOOL NPC_Util_isBackContact( int frontindex , int backindex ); + +void NPC_Util_AnnounceFloor( int floorid , char *msg ); + + +BOOL NPC_Util_moveItemToChar( int charindex, int itemindex,BOOL net ); +BOOL NPC_Util_createItemToChar( int charindex, int itemid , BOOL net); +int NPC_Util_CharDistance( int index1, int index2 ); +int NPC_Util_SearchNear( int meindex, int maxlen, int type ); +int NPC_Util_SearchNearPlayer( int meindex, int maxlen ); +int NPC_Util_SearchNearEnemy( int meindex, int maxlen ); +int NPC_Util_SuberiWalk( int index, int dir ); +int NPC_Util_GetNumFromArg( int meindex, char* in); + +int NPC_Util_GetDirCharToChar( int fromindex, int toindex, int mode); +int NPC_Util_WalkCharToChar( int fromindex, int toindex, int mode, int suberi); +BOOL NPC_Util_isFaceToFace( int index1, int index2, int distance ); +BOOL NPC_Util_isFaceToChara( int index1, int index2, int distance ); +BOOL NPC_Util_charIsInFrontOfChar( int index1, int index2, int distance ); + +int NPC_Util_SearchItemInChar( int charindex , int itemindex); +int NPC_Util_GiveAllItemToChar( int give , int take ); +/* +int NPC_Util_ControlOtherNPC( CHAR_TYPE chartype , + char *npcname, + char *command ); +*/ +void NPC_Util_NPCDelete( int srcindex ); +BOOL NPC_Util_moveItemToMap( int itemindex , int fl , int x , int y, + BOOL net ); +char *NPC_Util_GetArgStr( int index, char *argstr, int len); +int NPC_Util_GetNumFromStrWithDelim( char *srcstr, char* in); +char *NPC_Util_GetStrFromStrWithDelim( char *srcstr, char *srhstr, + char *buf, int len); +inline double NPC_Util_sellRate( int seller ); +inline double NPC_Util_buyRate( int buyer ); +BOOL NPC_Util_IsVisiblePlayer( int meindex); +BOOL NPC_Util_WordInclude( char *text , char *word ); +void NPC_Util_RandomToken(char *in, char *out, int outbufsize ); + +void cutDotsTail( char *s ); +int NPC_Util_FrontItem( int meindex ); +void NPC_Util_Boss2KingStart( int bossindex ); +int NPC_Util_FrontChar( int meindex ); +int *NPC_Util_getEnemy( int meindex, int charaindex); + +void NPC_NowEndEventSetFlgCls(int talker,int shiftbit); +void NPC_EventSetFlg(int talker,int shiftbit); +BOOL NPC_EventCheckFlg(int point,int shiftbit); +void NPC_NowEventSetFlg(int talker,int shiftbit); +void NPC_NowEventSetFlgCls(int talker,int shiftbit); +BOOL NPC_NowEventCheckFlg(int point,int shiftbit); +void NPC_EndEventSetFlgCls(int talker,int shiftbit); +char *NPC_Util_CheckAssignArgFile( int index, char *filename); + +// CoolFish: Family Adv 2001/8/4 +void AddFMAdv(int talker, int shiftbit); + +// Robin 0817 family income +int addNpcFamilyTax( int meindex, int talkerindex, int income ); + +#define NPC_ENEMY_ENEMYNUMBER 10 /* س */ + +/* ¦Ѱ̻ ļ漰 ٯ */ +#define NPC_UTIL_GETARGSTR_LINEMAX 4096 +/* ¦Ѱ̻P */ +#ifdef _NEWEVENT +//#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*1200 +#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*32 +#else +#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*12 +#endif +#endif + + + +0031:npc_action.h:014C:1:14=48041e4b:16=47d21313: \ No newline at end of file diff --git a/include/npctemplate.h b/include/npctemplate.h new file mode 100644 index 0000000..48aa0f8 --- /dev/null +++ b/include/npctemplate.h @@ -0,0 +1,111 @@ +#ifndef __READNPCTEMPLATE_H__ +#define __READNPCTEMPLATE_H__ + +#include "util.h" +#include "char_base.h" + +#define NPC_TEMPLATEFILEMAGIC "NPCTEMPLATE\n" + +#undef EXTERN +#ifdef __NPCTEMPLATE__ +#define EXTERN +#else +#define EXTERN extern +#endif /*__NPCTEMPLATE__*/ + + + +typedef struct tagNPC_haveItem +{ + int itemnumber; + int haverate; + int havenum; +}NPC_haveItem; + +typedef enum +{ + NPC_TEMPLATENAME, /* */ + NPC_TEMPLATECHARNAME, /* */ + + NPC_TEMPLATEINITFUNC, /* CHAR_INITFUNC */ + NPC_TEMPLATEWALKPREFUNC, /* CHAR_WALKPREFUNC */ + NPC_TEMPLATEWALKPOSTFUNC, /* CHAR_WALKPOSTFUNC */ + NPC_TEMPLATEPREOVERFUNC, /* CHAR_PREOVERFUNC */ + NPC_TEMPLATEPOSTOVERFUNC, /* CHAR_POSTOVERFUNC */ + NPC_TEMPLATEWATCHFUNC, /* CHAR_WATCHFUNC */ + NPC_TEMPLATELOOPFUNC, /* CHAR_LOOPFUNC */ + NPC_TEMPLATEDYINGFUNC, /* CHAR_DYINGFUNC */ + NPC_TEMPLATETALKEDFUNC, /* CHAR_TALKEDFUNC */ + + NPC_TEMPLATEPREATTACKEDFUNC, /* CHAR_PREATTACKEDFUNC */ + NPC_TEMPLATEPOSTATTACKEDFUNC, /* CHAR_POSTATTACKEDFUNC */ + + NPC_TEMPLATEOFFFUNC, /* CHAR_OFFFUNC */ + NPC_TEMPLATELOOKEDFUNC, /* CHAR_LOOKEDFUNC */ + NPC_TEMPLATEITEMPUTFUNC, /* CHAR_ITEMPUTFUNC */ + + NPC_TEMPLATESPECIALTALKEDFUNC, /* CHAR_SPECIALTALKEDFUNC */ + NPC_TEMPLATEWINDOWTALKEDFUNC, /* CHAR_WINDOWTALKEDFUNC */ +#ifdef _USER_CHARLOOPS + NPC_TEMPLATELOOPFUNCTEMP1, //CHAR_LOOPFUNCTEMP1, + NPC_TEMPLATELOOPFUNCTEMP2, //CHAR_LOOPFUNCTEMP2, + NPC_TEMPLATEBATTLEPROPERTY, //CHAR_BATTLEPROPERTY, +#endif + NPC_TEMPLATECHARNUM, +}NPC_TEMPLATECHAR; + +typedef enum +{ + NPC_TEMPLATEMAKEATNOBODY, /* ئݱ¾ */ + NPC_TEMPLATEMAKEATNOSEE, /* έئƥ¾ */ + NPC_TEMPLATEIMAGENUMBER, /* į */ + NPC_TEMPLATETYPE, /* 裻ݱ裻 */ + + NPC_TEMPLATEMINHP, /* HP */ + + NPC_TEMPLATEMINMP, /* MP */ + + NPC_TEMPLATEMINSTR, /* STR */ + + NPC_TEMPLATEMINTOUGH, /* TOUGH */ + + NPC_TEMPLATEISFLYING, /* ƥ¾ */ + + NPC_TEMPLATEITEMNUM, /* еʧ ة */ + + NPC_TEMPLATELOOPFUNCTIME, /* + * + * ëپ + */ + NPC_TEMPLATEFUNCTIONINDEX, /* + * fucntionSet + * ̼͵ + */ + + NPC_TEMPLATEINTNUM, +}NPC_TEMPLATEINT; + +typedef struct tagNPC_Template +{ + STRING64 chardata[NPC_TEMPLATECHARNUM]; + int intdata[NPC_TEMPLATEINTNUM]; + int randomdata[NPC_TEMPLATEINTNUM]; /* ¼ĸة + Ȼ */ + int hash; + NPC_haveItem* haveitem; +}NPC_Template; + + +EXTERN NPC_Template* NPC_template; +EXTERN int NPC_templatenum; +EXTERN int NPC_template_readindex; + +INLINE int NPC_CHECKTEMPLATEINDEX(int index); + +BOOL NPC_copyFunctionSetToChar( int id, Char* ch ); + +BOOL NPC_readNPCTemplateFiles( char* topdirectory ,int templatesize); +int NPC_templateGetTemplateIndex( char* templatename ); + +#endif + /*__READNPCTEMPLATE_H__*/ diff --git a/include/npcutil.h b/include/npcutil.h new file mode 100644 index 0000000..22cc817 --- /dev/null +++ b/include/npcutil.h @@ -0,0 +1,86 @@ +#ifndef _NPCUTIL_H_ +#define _NPCUTIL_H_ + +BOOL NPC_Util_AddOneTitle( int charindex, int titleindex ); +BOOL NPC_Util_HaveTitle( int charindex , int titleindex ); +BOOL NPC_Util_Nearby( int x1 , int y1, int x2 , int y2 ); +BOOL NPC_Util_CharNearby(int ind1,int ind2); +int NPC_Util_YN(char *input ); +int NPC_Util_getDirFromTwoPoint( POINT* pstart, POINT* pend ); +int NPC_Util_countHaveItem( int meindex , int itemid ); +BOOL NPC_Util_isBackContact( int frontindex , int backindex ); + +void NPC_Util_AnnounceFloor( int floorid , char *msg ); + + +BOOL NPC_Util_moveItemToChar( int charindex, int itemindex,BOOL net ); +BOOL NPC_Util_createItemToChar( int charindex, int itemid , BOOL net); +int NPC_Util_CharDistance( int index1, int index2 ); +int NPC_Util_SearchNear( int meindex, int maxlen, int type ); +int NPC_Util_SearchNearPlayer( int meindex, int maxlen ); +int NPC_Util_SearchNearEnemy( int meindex, int maxlen ); +int NPC_Util_SuberiWalk( int index, int dir ); +int NPC_Util_GetNumFromArg( int meindex, char* in); + +int NPC_Util_GetDirCharToChar( int fromindex, int toindex, int mode); +int NPC_Util_WalkCharToChar( int fromindex, int toindex, int mode, int suberi); +BOOL NPC_Util_isFaceToFace( int index1, int index2, int distance ); +BOOL NPC_Util_isFaceToChara( int index1, int index2, int distance ); +BOOL NPC_Util_charIsInFrontOfChar( int index1, int index2, int distance ); + +int NPC_Util_SearchItemInChar( int charindex , int itemindex); +int NPC_Util_GiveAllItemToChar( int give , int take ); +/* +int NPC_Util_ControlOtherNPC( CHAR_TYPE chartype , + char *npcname, + char *command ); +*/ +void NPC_Util_NPCDelete( int srcindex ); +BOOL NPC_Util_moveItemToMap( int itemindex , int fl , int x , int y, + BOOL net ); +char *NPC_Util_GetArgStr( int index, char *argstr, int len); +int NPC_Util_GetNumFromStrWithDelim( char *srcstr, char* in); +char *NPC_Util_GetStrFromStrWithDelim( char *srcstr, char *srhstr, + char *buf, int len); +inline double NPC_Util_sellRate( int seller ); +inline double NPC_Util_buyRate( int buyer ); +BOOL NPC_Util_IsVisiblePlayer( int meindex); +BOOL NPC_Util_WordInclude( char *text , char *word ); +void NPC_Util_RandomToken(char *in, char *out, int outbufsize ); + +void cutDotsTail( char *s ); +int NPC_Util_FrontItem( int meindex ); +void NPC_Util_Boss2KingStart( int bossindex ); +int NPC_Util_FrontChar( int meindex ); +int *NPC_Util_getEnemy( int meindex, int charaindex); + +void NPC_NowEndEventSetFlgCls(int talker,int shiftbit); +void NPC_EventSetFlg(int talker,int shiftbit); +BOOL NPC_EventCheckFlg(int point,int shiftbit); +void NPC_NowEventSetFlg(int talker,int shiftbit); +void NPC_NowEventSetFlgCls(int talker,int shiftbit); +BOOL NPC_NowEventCheckFlg(int point,int shiftbit); +void NPC_EndEventSetFlgCls(int talker,int shiftbit); +char *NPC_Util_CheckAssignArgFile( int index, char *filename); + +// CoolFish: Family Adv 2001/8/4 +void AddFMAdv(int talker, int shiftbit); + +// Robin 0817 family income +int addNpcFamilyTax( int meindex, int talkerindex, int income ); + +#define NPC_ENEMY_ENEMYNUMBER 10 /* س */ + +/* ¦Ѱ̻ ļ漰 ٯ */ +#define NPC_UTIL_GETARGSTR_LINEMAX 4096 +/* ¦Ѱ̻P */ +#ifdef _NEWEVENT +//#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*1200 +#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*32 +#else +#define NPC_UTIL_GETARGSTR_BUFSIZE 1024*12 +#endif +#endif + + + diff --git a/include/object.h b/include/object.h new file mode 100644 index 0000000..c6b9cff --- /dev/null +++ b/include/object.h @@ -0,0 +1,75 @@ +#ifndef __OBJECT_h__ +#define __OBJECT_h__ + +#include "common.h" + +typedef enum +{ + OBJTYPE_NOUSE, /* ̼͵Ȼئеë*/ + OBJTYPE_CHARA, /* ƽҷ CHAR_chara߼̼͵ */ + OBJTYPE_ITEM, /* ʧ ة ITEM_item ߼̼͵ */ + OBJTYPE_GOLD, /* żڻindex Ȼ */ + OBJTYPE_NPCSCHARA, +#ifdef _MAP_WARPPOINT + OBJTYPE_WARPPOINT, +#endif + OBJTYPE_NUM +}OBJTYPE; + +typedef struct tagObject +{ + OBJTYPE type; + + char objname[256]; + int npcsindex; + int dir; + int imagenum; + + int chartype; + int index; + int x; + int y; + int floor; +#ifdef _DEL_DROP_GOLD + int time; +#endif +}Object; + +BOOL CHECKOBJECT( int index ); +BOOL CHECKOBJECTUSE( int index ); +BOOL initObjectArray( int num ); +BOOL endObjectArray( void ); + +INLINE int _initObjectOne( char *file, int line, Object* ob ); +#define initObjectOne( ob ) _initObjectOne( __FILE__, __LINE__, ob) + +void endObjectOne( int index ); +int initObjectFromObjectMember(OBJTYPE type, int index, int x, int y , int floor ); + +INLINE int OBJECT_getType( int index ); +INLINE int OBJECT_setType( int index, int newvalue ); +INLINE int OBJECT_getFloor( int index ); +INLINE int OBJECT_setFloor( int index, int newvalue ); +INLINE int OBJECT_getX( int index ); +INLINE int OBJECT_setX( int index, int newvalue ); +INLINE int OBJECT_getY( int index ); +INLINE int OBJECT_setY( int index, int newvalue ); +INLINE int OBJECT_getIndex( int index ); +INLINE int OBJECT_setIndex( int index, int newvalue ); +INLINE int OBJECT_getNum( void ); + +INLINE int OBJECT_getchartype( int index ); +INLINE void OBJECT_setchartype( int index, int flg); + +#ifdef _PET_ITEM +BOOL storeObjects( char* dirname ); +BOOL restoreObjects( char* dirname ); +#endif + +int searchObjectFromCharaIndex( int index ); +#ifdef _CAX_LNS_MAPSUOXU +INLINE int get_mappointindex( int fl, int x,int y ); +#endif + +#endif +/*__OBJECT_h__*/ diff --git a/include/pet.h b/include/pet.h new file mode 100644 index 0000000..73770f4 --- /dev/null +++ b/include/pet.h @@ -0,0 +1,51 @@ +#ifndef __PET_H__ +#define __PET_H__ + +/* + * ʸ ɬƥʣ + */ +#include "version.h" +#include "common.h" + +#define PETFEEDTIME 60*60 // ﵰιʱ() +//#define PETFEEDTIME 5 // ﵰιʱ() + +int PET_DEBUG_initPetOne( int charaindex); +int PET_dropPet( int charaindex, int havepetindex); +int PET_dropPetFollow( int charaindex, int havepetindex, int fl, int x, int y); +int PET_dropPetFLXY( int charaindex, int havepetindex, int fl, int x, int y); +int PET_dropPetAbsolute( int petindex, int floor, int x, int y,BOOL net); +int PET_createPetFromCharaIndex( int charaindex, int enemyindex); +BOOL PET_SelectBattleEntryPet( int charaindex, int petarray); +int PET_initCharOneArray( Char *ch); +BOOL PET_isPutPoint( int fl,int x, int y); + + +BOOL PET_getBaseForAllocpoint( int toindex, int *work); +void PET_showEditBaseMsg( int charaindex, int toindex, int itemindex, int *work); + +#ifdef _PET_EVOLUTION +BOOL PET_getBaseAndSkill( int charaindex, int baseindex, int *base, int *skill, int flg); +#endif +BOOL CHAR_DelPetForIndex( int charaindex, int petindex); + +#endif + +#ifdef _PET_AMOI__E +//typedef enum +//{ +// PET_NOT_LIMIT = 0,// +// PET_NOT_DropTradeStreetVandor = 1,//ɶɽ +// PET_NOT_Drop = 2,//ɶ +// PET_NOT_Trade = 3,//ɽ +// PET_NOT_StreetVandor = 4,//ô˿ +// PET_NOT_TradeAndStreetVandor = 5,//ô˿ +//}PET_DUALTYPE; + +#define PET_NOT_LIMIT 0x00000000 +#define PET_NOT_DROP 0x00000010 +#define PET_NOT_STREETVANDOR 0x00000100 +#define PET_NOT_TRADE 0x00001000 +#define PET_NOT_MAIL 0x00010000 + +#endif diff --git a/include/pet_event.h b/include/pet_event.h new file mode 100644 index 0000000..bce25ff --- /dev/null +++ b/include/pet_event.h @@ -0,0 +1,18 @@ +#ifndef __PET_EVENT_H__ +#define __PET_EVENT_H__ + +/* + * ʸ ɬƥʣ + * ʸì + */ + +void PET_Talkfunc( int meindex, int talkerindex, char *msg, int color); + +void PET_Watchfunc( int objmeindex, int objmoveindex, + CHAR_ACTION act, int x, int y, int dir, + int* opt, int optlen ); +int PET_CleanPetdeletetime( int objmeindex); +void PET_CleanFreePetAll(); + + +#endif diff --git a/include/pet_skill.h b/include/pet_skill.h new file mode 100644 index 0000000..e45425f --- /dev/null +++ b/include/pet_skill.h @@ -0,0 +1,542 @@ +#ifndef __PET_SKILL_H__ +#define __PET_SKILL_H__ + +#include "util.h" + +typedef enum +{ + PETSKILL_FIELD_ALL, /* ͻƥ */ + PETSKILL_FIELD_BATTLE, /* */ + PETSKILL_FIELD_MAP, /* ɧѨ */ + +}PETSKILL_FIELDTYPE; + +typedef enum +{ + PETSKILL_TARGET_MYSELF, /* м */ + PETSKILL_TARGET_OTHER, /* ְ ֳ) */ + PETSKILL_TARGET_ALLMYSIDE, /* */ + PETSKILL_TARGET_ALLOTHERSIDE, /* 촡 */ + PETSKILL_TARGET_ALL, /* 廯 */ + PETSKILL_TARGET_NONE, /* ּ ئУ ֧׻ */ + PETSKILL_TARGET_OTHERWITHOUTMYSELF,/* ְ ֳئ) */ + PETSKILL_TARGET_WITHOUTMYSELFANDPET, /* ʸ½ */ +}PETSKILL_TARGETTYPE; + +typedef enum +{ + PETSKILL_ID, + PETSKILL_FIELD, + PETSKILL_TARGET, +#ifdef _PETSKILL2_TXT + PETSKILL_USETYPE, +#endif + PETSKILL_COST, + PETSKILL_ILLEGAL, + PETSKILL_DATAINTNUM, +}PETSKILL_DATAINT; + +typedef enum +{ + PETSKILL_NAME, /* */ + PETSKILL_COMMENT, /* 춪*/ + PETSKILL_FUNCNAME, /* */ + PETSKILL_OPTION, /* */ +#ifdef _CFREE_petskill + PETSKILL_FREE, /**/ + PETSKILL_KINDCODE, /**/ +#endif + + PETSKILL_DATACHARNUM, +}PETSKILL_DATACHAR; + +typedef struct tagPetskill +{ + int data[PETSKILL_DATAINTNUM]; + STRING64 string[PETSKILL_DATACHARNUM]; + +}Petskill; + +typedef int (*PETSKILL_CALLFUNC)( int, int, int, char * ); + +INLINE BOOL PETSKILL_CHECKINDEX( int index ); +INLINE int PETSKILL_getInt( int index, PETSKILL_DATAINT element); +INLINE int PETSKILL_setInt( int index, PETSKILL_DATAINT element, int data); +INLINE char* PETSKILL_getChar( int index, PETSKILL_DATACHAR element); +INLINE BOOL PETSKILL_setChar( int index ,PETSKILL_DATACHAR element, char* new ); +int PETSKILL_getPetskillNum( void); + +#define PETSKILL_GetArray( charaindex, havepetskill) _PETSKILL_GetArray( __FILE__, __LINE__, charaindex, havepetskill) +int _PETSKILL_GetArray( char *file, int line, int charaindex, int havepetskill ); + +BOOL PETSKILL_initPetskill( char *filename); +BOOL PETSKILL_reinitPetskill( void ); +int PETSKILL_getPetskillArray( int petskillid); +PETSKILL_CALLFUNC PETSKILL_getPetskillFuncPointer(char* name); + +int PETSKILL_Use( + int charaindex, + int toindex, + int array, + char *data + //BOOL isCLI // Robin 2001/02/26 if owner is player +); + +int PETSKILL_ContinuationAttack( + int charaindex, + int toindex, + int array, + char *data +); +int PETSKILL_ChargeAttack( + int charaindex, + int toindex, + int array, + char *data +); + + +#define PETSKILL_ID_GBREAK 0 // Ƥ +#define PETSKILL_ID_RENZOKU 1 // +#define PETSKILL_ID_GUARDIAN 2 // ˦ +#define PETSKILL_ID_CHARGE 3 // ҡ +#define PETSKILL_ID_ICHIGEKI 100 // ڽ +#define PETSKILL_ID_POWERBALANCE 110 // + +//********************************************************************** +// +// -- ְëԻئ +// +int PETSKILL_Guardian( + int charaindex, + int toindex, + int array, + char *data +); +// +//********************************************************************** + +int PETSKILL_PowerBalance( + int charaindex, + int toindex, + int array, + char *data +); + +//********************************************************************** +// +// -- ֻ ľ¸ +// +int PETSKILL_Mighty( + int charaindex, + int toindex, + int array, + char *data +); +// +//********************************************************************** + + +//********************************************************************** +// +// -- +// +int PETSKILL_StatusChange( + int charaindex, + int toindex, + int array, + char *data + +); +// +//********************************************************************** + + +//******************************************************* +// +// -- ɧ +// +int PETSKILL_NormalAttack( + int charaindex, + int toindex, + int array, + char *data + +); +// +//******************************************************* + +//******************************************************* +// +// -- ɧ +// +int PETSKILL_NormalGuard( + int charaindex, + int toindex, + int array, + char *data + +); +// +//******************************************************* + +//******************************************************* +// -- (ئ) +// +int PETSKILL_None( + int charaindex, + int toindex, + int array, + char *data + +); +// +//******************************************************* + +//******************************************************* +// -- (ľ 켰 ) +// +int PETSKILL_EarthRound( + int charaindex, + int toNo, + int array, + char *data + +); +// +//******************************************************* + +//******************************************************* +// -- Ƥ +// +int PETSKILL_GuardBreak( + int charaindex, + int toNo, + int array, + char *data + +); +/////////////////////////////////////////// +#ifdef _SKILL_GUARDBREAK2//Ƴ2 vincent add 2002/05/20 +int PETSKILL_GuardBreak2( + int charaindex, + int toNo, + int array, + char *data + +); +#endif +// +//******************************************************* +//******************************************************* +// -- ľ +// +int PETSKILL_Abduct( + int charaindex, + int toNo, + int array, + char *data + +); +// +//******************************************************* +//******************************************************* +// -- +int PETSKILL_Steal( + int charaindex, + int toNo, + int array, + char *data + +); +//******************************************************* +#ifdef _BATTLESTEAL_FIX +int PETSKILL_StealMoney( + int charaindex, + int toNo, + int array, + char *data + +); +#endif + +#ifdef _ITEM_INSLAY +int PETSKILL_Inslay( + int index, + int toNo, + int array, + char *data + +); +#endif + +#ifdef _PETSKILL_FIXITEM +int PETSKILL_Fixitem( + int index, + int toNo, + int array, + char *data + +); +#endif + +// -- ʧ ة +// +int PETSKILL_Merge( + int charaindex, + int toNo, + int array, + char *data + +); +// +//******************************************************* + +//******************************************************* +// -- á +// +int PETSKILL_NoGuard( + int charaindex, + int toNo, + int array, + char *data + +); +// +//******************************************************* + + + +// Terry add 2001/11/05 +#ifdef _ATTACK_MAGIC +int PETSKILL_AttackMagic( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _VARY_WOLF +int PETSKILL_Vary( int cindex, int tindex, int id, char* data); +#endif + +#ifdef _SKILL_WILDVIOLENT_ATT +//vincent add 2002/05/16 +int PETSKILL_WildViolentAttack( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_SPEEDY_ATT +//vincent add 2002/05/16 +int PETSKILL_SpeedyAttack( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_SACRIFICE +//vincent add 2002/05/30 +int PETSKILL_Sacrifice( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_REFRESH +//vincent add 2002/08/08 +int PETSKILL_Refresh( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_WEAKEN //vincent輼: +int PETSKILL_Weaken( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_DEEPPOISON //vincent輼:綾 +int PETSKILL_Deeppoison( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_BARRIER //vincent輼:ħ +int PETSKILL_Barrier( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_NOCAST //vincent輼:Ĭ +int PETSKILL_Nocast( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _SKILL_ROAR //vincent輼: +int PETSKILL_Roar( + int charaindex, + int toindex, + int array, + char *data +); +#endif + +#ifdef _PSKILL_FALLGROUND +int PETSKILL_FallGround( int charaindex, int toNo, int array, char *data ); +#endif +#ifdef _PRO_BATTLEENEMYSKILL +int ENEMYSKILL_ReLife( int enemyindex, int toNo, int array, char *data ); +int ENEMYSKILL_ReHP( int enemyindex, int toNo, int array, char *data ); + +int ENEMYSKILL_EnemyHelp( int enemyindex, int toNo, int array, char *data ); +#endif + +#ifdef _SKILL_DAMAGETOHP +int PETSKILL_DamageToHp( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_TIMID +int PETSKILL_BattleTimid( int charaindex, int toNo, int array, char *data ); +#endif +#ifdef _PETSKILL_2TIMID +int PETSKILL_2BattleTimid( int charaindex, int toNo, int array, char *data ); +#endif +#ifdef _PETSKILL_ANTINTER +int PETSKILL_AntInter(int charaindex, int toindex, int array, char* data); // \սģ +#endif + +#ifdef _PETSKILL_PROPERTY +int PETSKILL_BattleProperty( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_TEAR +int PETSKILL_BattleTearDamage( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _BATTLE_LIGHTTAKE +int PETSKILL_Lighttakeed( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _BATTLE_ATTCRAZED +int PETSKILL_AttackCrazed( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 +int PETSKILL_AttackShoot( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _Skill_MPDAMAGE +int PETSKILL_MpDamage( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_SETDUCK +int PETSKILL_SetDuck( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _MAGICPET_SKILL +int PETSKILL_SetMagicPet( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _SKILL_TOOTH +int PETSKILL_ToothCrushe( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PSKILL_MODIFY +int PETSKILL_Modifyattack( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PSKILL_MDFYATTACK +int PETSKILL_Mdfyattack( int charaindex, int toNo, int array, char *data ); +#endif + + +#ifdef _MAGIC_SUPERWALL +int PETSKILL_MagicStatusChange( int charaindex, int toindex, int array, char *data ); +#endif + +#ifdef _PET_SKILL_SARS // WON ADD ɷ +int PETSKILL_Sars( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _SONIC_ATTACK // WON ADD +int PETSKILL_Sonic( int charaindex, int toNo, int array, char *data ); +#endif +#ifdef _PETSKILL_REGRET +int PETSKILL_Regret( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_GYRATE +int PETSKILL_Gyrate( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_ACUPUNCTURE //Ƥ +int PETSKILL_Acupuncture( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_RETRACE +int PETSKILL_Retrace( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_HECTOR +int PETSKILL_Hector( int charaindex, int toNo, int array, char *data ); +#endif +int PETSKILL_ZiYun1( int charaindex, int toNo, int array, char *data ); +#ifdef _PETSKILL_FIREKILL +int PETSKILL_Firekill( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_DAMAGETOHP //¿(Ѫı) +int PETSKILL_DamageToHp2( int charaindex, int toNo, int array, char *data ); +#endif + +#ifdef _PETSKILL_BECOMEFOX +int PETSKILL_BecomeFox( int charaindex, int toNo, int array, char* data); +#endif + +#ifdef _PETSKILL_BECOMEPIG +int PETSKILL_BecomePig( int charaindex, int toNo, int array, char* data); +#endif + +#ifdef _PETSKILL_SHOWMERCY +int PETSKILL_ShowMercy(int charaindex, int toNo, int array, char* data); +#endif + +#ifdef _PETSKILL_COMBINED +int PETSKILL_Combined(int charaindex, int toNo, int array, char* data); +#endif + +#ifdef _PETSKILL_LER +int PETSKILL_BatFly(int charaindex, int toNo, int array, char* data); // ׶ - ȺĴ +int PETSKILL_DivideAttack(int charaindex, int toNo, int array, char* data); // ׶ - +#endif + +#ifdef _PETSKILL_BATTLE_MODEL +int PETSKILL_BattleModel(int charaindex, int toindex, int array, char* data); // \սģ +#endif + +#endif diff --git a/include/pet_skillinfo.h b/include/pet_skillinfo.h new file mode 100644 index 0000000..db735e1 --- /dev/null +++ b/include/pet_skillinfo.h @@ -0,0 +1,139 @@ +/* generated by makedefs.perl */ +#include "version.h" + +#define PETSKILL_NONE ( 0 ) +#define PETSKILL_NORMALATTACK ( 1 ) +#define PETSKILL_NORMALGUARD ( 2 ) +#define PETSKILL_GUARDBREAK ( 3 ) +#define PETSKILL_CONTINUATIONATTACK1 ( 10 ) +#define PETSKILL_CONTINUATIONATTACK2 ( 11 ) +#define PETSKILL_CONTINUATIONATTACK3 ( 12 ) +#define PETSKILL_CONTINUATIONATTACK4 ( 13 ) +#define PETSKILL_GUARDIAN ( 25 ) +#define PETSKILL_CHARGE1 ( 30 ) +#define PETSKILL_CHARGE2 ( 31 ) +#define PETSKILL_MIGHTY1 ( 40 ) +#define PETSKILL_MIGHTY2 ( 41 ) +#define PETSKILL_POWERBALANCE1 ( 50 ) +#define PETSKILL_POWERBALANCE2 ( 51 ) +#define PETSKILL_POWERBALANCE3 ( 52 ) +#define PETSKILL_POISON_ATTACK1 ( 60 ) +#define PETSKILL_POISON_ATTACK2 ( 61 ) +#define PETSKILL_STONE ( 80 ) +#define PETSKILL_CONFUSION_ATTACK ( 90 ) +#define PETSKILL_DRUNK_ATTACK ( 100 ) +#define PETSKILL_SLEEP_ATTACK ( 110 ) +#define PETSKILL_EARTHROUND1 ( 120 ) +#define PETSKILL_Abduct ( 130 ) +#define PETSKILL_STEAL ( 140 ) +#define PETSKILL_NOGUARD1 ( 150 ) +#define PETSKILL_NOGUARD2 ( 151 ) +#define PETSKILL_NOGUARD3 ( 152 ) +#define PETSKILL_MERGE ( 200 ) +#define PETSKILL_MERGE2 ( 201 ) +#ifdef _ALCHEMIST +#define PETSKILL_ALCHEMIST ( 202 ) +#endif +#ifdef _PSKILL_FALLGROUND +#define PETSKILL_FALLGROUND ( 210 ) +#endif +#ifdef _BATTLESTEAL_FIX +#define PETSKILL_STEALMONEY ( 211 ) +#endif +#ifdef _PRO_BATTLEENEMYSKILL +#define ENEMYSKILL_RELIFES ( 500 ) +#define ENEMYSKILL_RELIFHP ( 501 ) +#define ENEMYSKILL_HELP ( 502 ) +#endif +#ifdef _SKILL_DAMAGETOHP +#define PETSKILL_DAMAGETOHP ( 503) +#endif +#ifdef _Skill_MPDAMAGE +#define PETSKILL_MPDAMAGE ( 504) +#endif +#ifdef _SKILL_WILDVIOLENT_ATT +#define PETSKILL_WILDVIOLENTATTACK ( 540)// vincent add 2002/05/16 +#endif +#ifdef _SKILL_SPEEDY_ATT +#define PETSKILL_SPEEDYATTACK ( 541) // vincent add 2002/05/16 +#endif +#ifdef _SKILL_GUARDBREAK2 +#define PETSKILL_GUARDBREAK2 ( 542) //Ƴ2 vincent add 2002/05/20 +#endif +#ifdef _SKILL_SACRIFICE +#define PETSKILL_SACRIFICE ( 543) //Ԯ vincent add 2002/05/30 +#endif + +#ifdef _SKILL_WEAKEN +#define PETSKILL_WEAKEN ( 544) // vincent add 2002/07/11 +#endif + +#ifdef _SKILL_DEEPPOISON +#define PETSKILL_DEEPPOISON ( 545) //綾 vincent add 2002/07/16 +#endif + +#ifdef _SKILL_BARRIER +#define PETSKILL_BARRIER ( 546) //ħ vincent add 2002/07/16 +#endif + +#ifdef _SKILL_NOCAST +#define PETSKILL_NOCAST ( 547) //Ĭ vincent add 2002/07/16 +#endif + + +#ifdef _SKILL_ROAR +#define PETSKILL_ROAR ( 548) // vincent add 2002/07/11 +#endif + +#ifdef _ITEM_INSLAY +#define PETSKILL_INSLAY (572) +#endif + +#ifdef _PETSKILL_FIXITEM +#define PETSKILL_FIXITEM (573) +#endif + +#ifdef _SKILL_TOOTH +#define PETSKILL_TOOTHCRUSHE (574) +#endif + +#ifdef _SKILL_REFRESH +#define PETSKILL_REFRESH ( 575) //vincent add 2002/08/08 +#endif + +#ifdef _VARY_WOLF +#define PETSKILL_VARY ( 600 ) +#endif + +#ifdef _PETSKILL_SETDUCK +#define PETSKILL_SETDUCK ( 600 ) +#endif + +#ifdef _MAGICPET_SKILL +#define PETSKILL_SETMAGICPET ( 601 ) +#endif + +#ifdef _BATTLE_LIGHTTAKE +#define PETSKILL_Light ( 608) +#endif + +#ifdef _BATTLE_ATTCRAZED +#define PETSKILL_AttCrazed ( 608) +#endif + +#ifdef _SHOOTCHESTNUT // Syu ADD 輼 +#define PETSKILL_AttShoot ( 609 ) +#endif + +#ifdef _PETSKILL_BECOMEPIG +#define PETSKILL_BECOMEPIG ( 628 ) +#endif + +#ifdef _PETSKILL_LER +#define PETSKILL_BATFLY ( 633 ) +#define PETSKILL_DIVIDEATTACK ( 634 ) +#endif + +#ifdef _PETSKILL_BATTLE_MODEL +#define PETSKILL_BATTLE_MODEL ( 635 ) +#endif diff --git a/include/petmail.h b/include/petmail.h new file mode 100644 index 0000000..8a18fab --- /dev/null +++ b/include/petmail.h @@ -0,0 +1,57 @@ +#ifndef __PETMAIL_H__ +#define __PETMAIL_H__ +#include "version.h" +/* + * ʸ ɬƥʣ + */ +#define PETMAIL_OFFMSG_MAX 10000 +#define PETMAIL_OFFMSG_TIMEOUT ( 3 * 24 * 3600 ) +#define PETMAIL_CHECK_OFFMSG_EXPIRE_INTERVAL 3600 +#define PETMAIL_OFFMSG_TEXTLEN 512 + +/* ʸPضѣ ˼ѷԻئ³ */ +#define PETMAIL_EFFECTMAX 1 + +#define PETMAIL_SPOOLFLOOR 777 +#define PETMAIL_SPOOLX 30 +#define PETMAIL_SPOOLY 30 + +#define PETMAIL_LOOPINTERVAL1 500 +#define PETMAIL_LOOPINTERVAL2 5000 + +/* ׷̼ƽҷ³߼ë */ +typedef struct +{ + int use; + time_t send_tm; /* ǻë˪+TIMEOUT */ + int color; /* ƽ */ + char text[PETMAIL_OFFMSG_TEXTLEN]; /* ƽ */ + char destcd[CDKEYLEN]; /* ˪CDKEY */ + char destcharname[CHARNAMELEN]; /* ˪Ƽƽҷ */ + char srccd[CDKEYLEN]; /* ˪缰cdkey */ + char srccharname[CHARNAMELEN]; /* ˪缰ƽҷ */ + +} PETMAIL_offmsg; + +void PETMAIL_Loopfunc( int index); +BOOL PETMAIL_CheckPlayerExist( int index, int mode); + +BOOL PETMAIL_initOffmsgBuffer( int count ); +BOOL PETMAIL_addOffmsg( int fromindex, char *tocdkey, char *tocharaname, + char *text, int color ); +PETMAIL_offmsg *PETMAIL_getOffmsg( int offmsgindex); +BOOL PETMAIL_deleteOffmsg( int offmsgindex); +void PETMAIL_proc( void ); +BOOL storePetmail( void); +BOOL PETMAIL_sendPetMail( int cindex, int aindex, + int havepetindex, int haveitemindex, char* text , int color ); + +#ifdef _PETMAIL_DEFNUMS +void CHAR_AutoPickupMailPet( int charaindex, int petindex ); +#endif +int PETMAIL_getPetMailTotalnums( void); +void PETMAIL_delPetMailTotalnums( int numflg); +void PETMAIL_setPetMailTotalnums( int numflg); +int PETMAIL_CheckIsMyOffmsg( int fromindex, char *tocdkey, char *tocharaname); + +#endif diff --git a/include/profession_skill.h b/include/profession_skill.h new file mode 100644 index 0000000..3606c73 --- /dev/null +++ b/include/profession_skill.h @@ -0,0 +1,165 @@ +#include "version.h" + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "common.h" +#include "util.h" +#include "skill.h" + +#define PROFESSION_MAX_LEVEL 26 // ְҵȼ 26 +#define PROFESSION_SKILL_MAX_LEVEL 100 // ܵȼ 100 +#define PROFESSION_SKILL_ADD_POINT 1 // 춨ͨӾֵ +// ְҵ +typedef enum +{ + PROFESSION_CLASS_NONE=0, // ְҵ + PROFESSION_CLASS_FIGHTER, // ʿ + PROFESSION_CLASS_WIZARD, // ʦ + PROFESSION_CLASS_HUNTER, // + PROFESSION_CLASS_NUM, +}PROFESSION_CLASS_TYPE; + +typedef enum +{ + PROFESSION_SKILL_NAME, // + PROFESSION_SKILL_TXT, // ˵ + PROFESSION_SKILL_FUNCNAME, // ʹú + PROFESSION_SKILL_OPTION, // + PROFESSION_SKILL_DATACHARNUM, +}PROFESSION_SKILL_DATACHAR; + + +typedef enum +{ + PROFESSION_SKILL_ID, // ܱ + PROFESSION_SKILL_PROFESSION_CLASS, // ְҵ + PROFESSION_SKILL_TARGET, // Ŀ + PROFESSION_SKILL_COST_MP, // ķMP + PROFESSION_SKILL_USE_FLAG, // ʹ + PROFESSION_SKILL_KIND, // + PROFESSION_SKILL_ICON, // ICONͼ + PROFESSION_SKILL_IMG_1, // ǰͼ(״̬) + PROFESSION_SKILL_IMG_2, // ͼ() + PROFESSION_SKILL_COST, // + PROFESSION_SKILL_FIX_VALUE, // ֵ + + //ɫѧϰ趨Ⱦﵽʱſѧϰ + PROFESSION_SKILL_LIMIT1, // ޼ 1 + PROFESSION_SKILL_PERCENT1, // ޼Ӧ% 1 + PROFESSION_SKILL_LIMIT2, // ޼ 2 + PROFESSION_SKILL_PERCENT2, // ޼Ӧ% 2 + PROFESSION_SKILL_LIMIT3, // ޼ 3 + PROFESSION_SKILL_PERCENT3, // ޼Ӧ% 3 + PROFESSION_SKILL_LIMIT4, // ޼ 4 + PROFESSION_SKILL_PERCENT4, // ޼Ӧ% 4 + PROFESSION_SKILL_DATAINTNUM, +}PROFESSION_SKILL_DATAINT; + + +typedef struct tagProfessionkill +{ + STRING64 string[PROFESSION_SKILL_DATACHARNUM]; + int data[PROFESSION_SKILL_DATAINTNUM]; +}Professionskill; + + +//---------------------------------------------------------------------------- +typedef int (*PROFESSION_SKILL_CALLFUNC)( int, int, int, char *, int ); +BOOL PROFESSION_initSkill( char *filename); +void rePROFESSION_initSkill(); + +//---------------------------------------------------------------------------- +INLINE BOOL PROFESSION_SKILL_CHECKINDEX( int index ); +INLINE int PROFESSION_SKILL_getInt( int index, PROFESSION_SKILL_DATAINT element); +INLINE int PROFESSION_SKILL_setInt( int index, PROFESSION_SKILL_DATAINT element, int data); +INLINE char* PROFESSION_SKILL_getChar( int index, PROFESSION_SKILL_DATACHAR element); +INLINE BOOL PROFESSION_SKILL_setChar( int index ,PROFESSION_SKILL_DATACHAR element, char* new ); +int PROFESSION_SKILL_getskillNum( void ); + +//---------------------------------------------------------------------------- +int PROFESSION_SKILL_getskillArray( int skillid); +PROFESSION_SKILL_CALLFUNC PROFESSION_SKILL_getskillFuncPointer(char* name ); +#define PROFESSION_SKILL_GetArray( charaindex, skill) _PROFESSION_SKILL_GetArray( __FILE__, __LINE__, charaindex, skill) +int _PROFESSION_SKILL_GetArray( char *file, int line, int charaindex, int skill ); +int PROFESSION_SKILL_Use( int charaindex, int skill, int toNo, char *data ); +void PROFESSION_SKILL_LVEVEL_UP( int charaindex, char *name ); +void PROFESSION_LEVEL_CHECK_UP( int charaindex ); +void PROFESSION_NORMAL_SKILL_LEVLE_UP(Skill* skill, int Pskillid, int charaindex ); +void PROFESSION_SKILL_WEAPON_FOCUS_LVEVEL_UP( int charaindex, char *name ); +void PROFESSION_SKILL_DUAL_WEAPON_LVEVEL_UP( int charaindex, char *name ); +int PROFESSION_SKILL_DEC_COST_MP( int charaindex, int skill, int Pskillid, int skill_level ); +int PROFESSION_SKILL_ADDSK( int charaindex, int skill, int level ); + +//---------------------------------------------------------------------------- +// ְҵ +void profession_common_fun( int charaindex, int toNo, int skill_level, int array, int com1 ); +int PROFESSION_brust( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_chain_atk( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_avoid( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_recovery( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_weapon_focus( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_volcano_springs( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_fire_ball( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_fire_spear( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_summon_thunder( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_current( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_storm( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_ice_arrow( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_ice_crack( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_ice_mirror( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_doom( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_blood( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_blood_worms( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_sign( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_fire_enclose( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_ice_eclose( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_thunder_enclose( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_fire_practice( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_ice_practice( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_thunder_practice( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_enclose( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_transpose( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_reback( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_chain_atk_2( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_scapegoat( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_enrage( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_energy_collect( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_focus( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_shield_attack( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_dual_weapon( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_deflect( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_through_attack( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_cavalry( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_dead_attack( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_convolute( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_chaos( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_docile( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_trap( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_enrage_pet( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_dragnet( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_entwine( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_autarky( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_plunder( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_toxin_weapon( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_resist_fire( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_resist_ice( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_resist_thunder( int charaindex, int toindex, int array, char *data, int skill_level ); +#ifdef _PROFESSION_ADDSKILL +int PROFESSION_resist_f_i_t( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_call_nature( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_boundary( int charaindex, int toindex, int array, char *data, int skill_level ); +#endif +int PROFESSION_attack_weak( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_instigate( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_track( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_oblivion( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_full_mp( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_strong_back( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_strengthen( int charaindex, int toindex, int array, char *data, int skill_level ); +int PROFESSION_escape( int charaindex, int toNo, int array, char *data, int skill_level ); +int PROFESSION_g_resist_fire( int charaindex, int toNo, int array, char *data, int skill_level ); +int PROFESSION_g_resist_ice( int charaindex, int toNo, int array, char *data, int skill_level ); +int PROFESSION_g_resist_thunder( int charaindex, int toNo, int array, char *data, int skill_level ); + +//---------------------------------------------------------------------------- + +#endif diff --git a/include/readmap.h b/include/readmap.h new file mode 100644 index 0000000..1391f3a --- /dev/null +++ b/include/readmap.h @@ -0,0 +1,140 @@ +#ifndef __MAP_H__ +#define __MAP_H__ +#include "common.h" +#include "util.h" + +typedef struct tagMAP_Objlink +{ + int objindex; + struct tagMAP_Objlink* next; +}MAP_Objlink, *OBJECT; + +#define GET_OBJINDEX(x) ((x)->objindex) +#define NEXT_OBJECT(x) ((x)->next) + +typedef struct tagMAP_Map +{ + int id; /* ID */ + int xsiz,ysiz; /* */ + char string[64]; /* ʾ */ + unsigned short* tile; /* */ + unsigned short* obj; /* */ + MAP_Objlink** olink; +#ifdef _MAP_NOEXIT + unsigned int startpoint; + int MapType; +#endif +}MAP_Map; + + +typedef enum +{ + MAP_WALKABLE, /* + * + * ? Q 0 + * ? M 1 + * ? M 2 + */ + MAP_HAVEHEIGHT, /* 0 0 */ + MAP_DEFENCE, /* \ ر0 \ */ + + MAP_INTODAMAGE, /* ʱ HP ? */ + MAP_OUTOFDAMAGE, /* ʱ HP ? */ + + MAP_SETED_BATTLEMAP, /* 趨? */ + MAP_BATTLEMAP, /* A */ + MAP_BATTLEMAP2, /* A */ + MAP_BATTLEMAP3, /* A */ + +/* ̣ӣ ʹ ӣ ʹ (? X ? @) */ + + MAP_INTODARKNESS, /* ʱ */ + MAP_INTOCONFUSION, /* ʱ ? */ + + MAP_OUTOFPOISON, /* ʱ */ + MAP_OUTOFPARALYSIS, /* ʱ */ + MAP_OUTOFSILENCE, /* ʱ ? */ + MAP_OUTOFSTONE, /* ʱ ʯ */ + MAP_OUTOFDARKNESS, /* ʱ */ + MAP_OUTOFCONFUSION, /* ʱ ? */ + + MAP_DATAINT_NUM, +}MAP_DATAINT; +typedef enum +{ + MAP_DATACHAR_NUM, +}MAP_DATACHAR; +typedef struct tagMAP_ImageData +{ + int data[MAP_DATAINT_NUM]; + STRING32 string[MAP_DATACHAR_NUM]; +}MAP_ImageData; + +typedef enum +{ + MAP_KINDWALKABLE, /* ? F 1 */ + + MAP_KINDNUM, +}MAP_kind; + + +INLINE int MAP_getfloorIndex( int floorid ); +int MAP_getfloorX( int floorid ); +int MAP_getfloorY( int floorid ); + +BOOL MAP_initReadMap( char* maptilefile , char* mapdir ); +BOOL MAP_initMapArray( int num ); +void MAP_endMapArray( void ); + +char* MAP_getdataFromRECT( int floor, RECT* seekr, RECT* realr ); +char *MAP_getChecksumFromRECT( int floor, RECT* seekr, RECT* realr, + int *tilesum, int *objsum, int *eventsum ); + +BOOL MAP_checkCoordinates( int mapid, int x, int y ); + +BOOL MAP_setTileAndObjData( int ff ,int fx, int fy, int tile, int obj); +BOOL MAP_getTileAndObjData( int ff ,int fx, int fy, int* tile, int* obj); +void MAP_sendAroundMapdata( int fl, int x, int y); +int MAP_getImageInt( int imagenumber, int element ); +BOOL MAP_setImageInt( int imagenumber, int element, int value ); +BOOL IsValidImagenumber( int imagenumber ); + +char* MAP_getfloorShowstring( int floorid ); +BOOL MAP_makeVariousMap(char* atile, char* aobj, int floor, int startx, int starty, int xsiz, int ysiz, MAP_kind kind ); +BOOL MAP_makeWalkableMap( char* data, int floor, int startx, int starty,int xsiz, int ysiz ); +BOOL MAP_IsThereSpecificFloorid( int floorid ); +BOOL MAP_IsValidCoordinate( int floorid, int x, int y ); + +BOOL MAP_addNewObj( int floor, int x, int y, int objindex ); +BOOL MAP_removeObj( int floor, int x, int y, int objindex ); +#define MAP_getTopObj( fl, x, y) _MAP_getTopObj( __FILE__, __LINE__, fl, x, y) +MAP_Objlink* _MAP_getTopObj( char *file, int line, int floor, int x, int y ); +#define MAP_objmove( objindex, of, ox, oy, nfl, nx, ny) _MAP_objmove( __FILE__, __LINE__, objindex, of, ox, oy, nfl, nx, ny) +BOOL _MAP_objmove( char *file, int line, int objindex, int ofloor, int ox, int oy, int nfloor, + int nx, int ny ); +char *MAP_getFloorName( int floor); +BOOL MAP_setObjData( int ff ,int fx, int fy, int obj, int objhp ); + +#ifdef _MAKE_MAP +int MAP_getFloorXY( int floor, int *x, int *y); +#endif + +#ifdef _STATUS_WATERWORD //ˮ״̬ +int MAP_getMapFloorType( int floor); +#endif + +#ifdef _MAP_NOEXIT +unsigned int MAP_getExFloor_XY( int floor , int *map_type); +BOOL CHECKFLOORID( int id); +#endif +int MAP_getMapNum(); +int MAP_getfloorId(int index); + +#ifdef _CAX_LNS_MAPSUOXU +BOOL MAP_SetExWarp(int mapid , int fl, int x, int y, int type); +BOOL MAP_DelMap(int mapid ); +int MAP_makenew( int mapid ,char* map_name); +#endif + +#endif +/*__MAP_H__*/ diff --git a/include/readnpc.h b/include/readnpc.h new file mode 100644 index 0000000..4356168 --- /dev/null +++ b/include/readnpc.h @@ -0,0 +1,6 @@ +#ifndef __READNPC_H__ +#define __READNPC_H__ +BOOL NPC_readNPCSettingFiles( char* topdirectory ,int templatesize,int createsize); +BOOL NPC_reloadNPC(void); +#endif + /*__READNPC_H__*/ diff --git a/include/saacproto_cli.h b/include/saacproto_cli.h new file mode 100644 index 0000000..cb757ba --- /dev/null +++ b/include/saacproto_cli.h @@ -0,0 +1,320 @@ +/* output by ../../bin/lsgen.perl 0.41 ( 1998 May) + * made Mon Oct 9 10:21:40 2000 + * user ttom + * host proxy1 + * file /home/ttom/gmsv2/src/gmsv/include/saacproto_cli.h + * util ./saacproto_util.c , include/saacproto_util.h + * src /home/ttom/gmsv2/src/gmsv/../../doc/saacproto.html + */ +#ifndef _SAACPROTOCLI_H_ +#define _SAACPROTOCLI_H_ +#include "version.h" +#include "saacproto_util.h" + +#ifdef MAXLSRPCARGS +#if ( MAXLSRPCARGS <= ( 7 + 1 ) ) +#undef MAXLSRPCARGS +#define MAXLSRPCARGS ( 7 + 1 ) +#endif +#else +#define MAXLSRPCARGS ( 7 + 1 ) +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC +void saacproto_UpdataStele_send( int fd , char *cdkey , char *name , char *title , int level , int trns , int time , int floor) ; +void saacproto_UpdataStele_recv( int fd , char *token) ; +void saacproto_S_UpdataStele_recv( int i , char *ocdkey , char *oname , char *ncdkey , + char *nname , char *title , int level , int trns , int floor ); +#endif + +void saacproto_ACGmsvDownRequest_recv( int fd,int min ) ; /* ../../doc/saacproto.html line 80 */ +void saacproto_ACServerLogin_send( int fd,char* servername,char* serverpas ) ; +void saacproto_ACServerLogin_recv( int fd,char* result,char* data ) ; /* ../../doc/saacproto.html line 101 */ +void saacproto_ACServerLogout_send( int fd ) ; /* ../../doc/saacproto.html line 114 */ + +#ifdef _PKSEVER_VER +void saacproto_ACCharList_send( int fd,char* id,char* pas,int mesgid, int star); +#else +void saacproto_ACCharList_send( int fd,char* id,char* pas,int mesgid ) ; /* ../../doc/saacproto.html line 123 */ +#endif + +void saacproto_ACCharList_recv( int fd,char* result,char* output,int id ) ; /* ../../doc/saacproto.html line 135 */ +void saacproto_ACCharLoad_send( int fd,char* id,char* pas,char* charname,int lock,char* opt,int mesgid,char* ip ) ; /* ../../doc/saacproto.html line 158 */ +void saacproto_ACCharLoad_recv( int fd,char* result,char* data,int id,int saveindex ) ; /* ../../doc/saacproto.html line 185 */ +#ifdef _NEWSAVE +void saacproto_ACCharSave_send( int fd,char* id,char* charname,char* opt,char* charinfo,int unlock,int mesgid,int saveindex ) ; /* ../../doc/saacproto.html line 201 */ +#else +void saacproto_ACCharSave_send( int fd,char* id,char* charname,char* opt,char* charinfo,int unlock,int mesgid ) ; /* ../../doc/saacproto.html line 201 */ +#endif +void saacproto_ACCharSave_recv( int fd,char* result,char* data,int id ) ; /* ../../doc/saacproto.html line 224 */ +void saacproto_ACCharDelete_send( int fd,char* id,char* passwd,char* charname,char* option,int mesgid, char* userip ) ; /* ../../doc/saacproto.html line 241 */ +void saacproto_ACCharDelete_recv( int fd,char* result,char* data,int id ) ; /* ../../doc/saacproto.html line 266 */ +void saacproto_ACLock_send( int fd,char* id,int lock,int mesgid ) ; /* ../../doc/saacproto.html line 281 */ +void saacproto_ACLock_recv( int fd,char* result,char* data,int id ) ; /* ../../doc/saacproto.html line 300 */ +void saacproto_ACUCheck_send( int fd,char* mem_id,int status ) ; /* ../../doc/saacproto.html line 314 */ +void saacproto_ACUCheck_recv( int fd,char* mem_id ) ; /* ../../doc/saacproto.html line 328 */ +void saacproto_DBUpdateEntryString_send( int fd,char* table,char* key,char* value,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 339 */ +void saacproto_DBUpdateEntryString_recv( int fd,char* result,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 354 */ +void saacproto_DBDeleteEntryString_send( int fd,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 367 */ +void saacproto_DBDeleteEntryString_recv( int fd,char* result,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 379 */ +void saacproto_DBGetEntryString_send( int fd,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 394 */ +void saacproto_DBGetEntryString_recv( int fd,char* result,char* value,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 406 */ +void saacproto_DBUpdateEntryInt_send( int fd,char* table,char* key,int value,char* info,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 423 */ +void saacproto_DBUpdateEntryInt_recv( int fd,char* result,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 445 */ +void saacproto_DBGetEntryRank_send( int fd,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 459 */ +void saacproto_DBGetEntryRank_recv( int fd,char* result,int rank,int count,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 473 */ +void saacproto_DBDeleteEntryInt_send( int fd,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 492 */ +void saacproto_DBDeleteEntryInt_recv( int fd,char* result,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 504 */ +void saacproto_DBGetEntryInt_send( int fd,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 518 */ +void saacproto_DBGetEntryInt_recv( int fd,char* result,int value,char* table,char* key,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 530 */ +void saacproto_DBGetEntryByRank_send( int fd,char* table,int rank_start,int rank_end,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 547 */ +void saacproto_DBGetEntryByRank_recv( int fd,char* result,char* list,char* table,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 562 */ +void saacproto_DBGetEntryByCount_send( int fd,char* table,int count_start,int num,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 581 */ +void saacproto_DBGetEntryByCount_recv( int fd,char* result,char* list,char* table,int count_start,int msgid,int msgid2 ) ; /* ../../doc/saacproto.html line 593 */ +void saacproto_Broadcast_send( int fd,char* id,char* charname,char* message,int flag ) ; /* ../../doc/saacproto.html line 608 */ +void saacproto_Broadcast_recv( int fd,char* id,char* charname,char* message ) ; /* ../../doc/saacproto.html line 621 */ +void saacproto_Message_send( int fd,char* id_from,char* charname_from,char* id_to,char* charname_to,char* message,int option ) ; /* ../../doc/saacproto.html line 634 */ +void saacproto_Message_recv( int fd,char* id_from,char* charname_from,char* id_to,char* charname_to,char* message,int option,int mesgid ) ; /* ../../doc/saacproto.html line 652 */ +void saacproto_MessageAck_send( int fd,char* id,char* charname,char* result,int mesgid ) ; /* ../../doc/saacproto.html line 671 */ +void saacproto_MessageFlush_send( int fd,char* id,char* charname ) ; /* ../../doc/saacproto.html line 690 */ +int saacproto_InitClient( int(*)(int,char*,int) , int bufsiz , int fd); +void saacproto_SetClientLogFiles( char *read , char *write); +void saacproto_CleanupClient(void); +int saacproto_ClientDispatchMessage(int fd ,char*line); + +// +#ifdef _PERSONAL_FAME +void saacproto_ACAddFM_send(int fd, char *fmname, char *fmleadername, + char *fmleaderid, int fmleaderlv, char *petname, char *petarrt, + char *fmrule, int fmsprite, int fmleadergrano, int fame, int charfdid); +#else +void saacproto_ACAddFM_send(int fd, char *fmname, char *fmleadername, + char *fmleaderid, int fmleaderlv, char *petname, char *petarrt, + char *fmrule, int fmsprite, int fmleadergrano, int charfdid); +#endif +void saacproto_ACAddFM_recv(int fd, char *result, int fmindex, int index, + int charfdid); +// +// #ifdef _PERSONAL_FAME // Arminius: +void saacproto_ACJoinFM_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int index, int fame, int charfdid); +// #else +// void saacproto_ACJoinFM_send(int fd, char *fmname, int fmindex, char *charname, +// char *charid, int charlv, int index, int charfdid); +// #endif +void saacproto_ACJoinFM_recv(int fd, char *result, int recv, int charfdid); +// ˳ +void saacproto_ACLeaveFM_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int index, int charfdid); +void saacproto_ACLeaveFM_recv(int fd, char *result, int resultflag, int charfdid); +// ɢ +void saacproto_ACDelFM_send(int fd, char *fmname, int fmindex, int index, + char *charname, char *charid, int charfdid); + +void saacproto_ACDelFM_recv(int fd, char *result, int charfdid); +// гб +void saacproto_ACShowFMList_send(int fd); +void saacproto_ACShowFMList_recv(int fd, char *result, int num, char *data); +// гԱб +void saacproto_ACShowMemberList_send(int fd, int index); +void saacproto_ACShowMemberList_recv(int fd, char *result, int index, int num, + int fmacceptflag, int fmjoinnum, char *data); +// гϸ +void saacproto_ACFMDetail_send(int fd, char *fmname, int fmindex, + int index, int charfdid); +void saacproto_ACFMDetail_recv(int fd, char *result, char *data, int charfdid); +//峤˳Ա塢޸ļԱְλ +#ifdef _FMVER21 +void saacproto_ACMemberJoinFM_send(int fd, char *fmname, int fmindex, char *charname, + int charindex, int index, int result, int meindex, int charfdid); +#else +void saacproto_ACMemberJoinFM_send(int fd, char *fmname, int fmindex, char *charname, + int charindex, int index, int result, int charfdid); +#endif +void saacproto_ACMemberJoinFM_recv(int fd, char *result, char *data, int charfdid); +//峤˳Ա뿪 +#ifdef _FMVER21 +void saacproto_ACMemberLeaveFM_send(int fd, char *fmname, int fmindex, char *charname, + int charindex, int index, int meindex, int charfdid); +#else +void saacproto_ACMemberLeaveFM_send(int fd, char *fmname, int fmindex, char *charname, + int charindex, int index, int charfdid); +#endif +void saacproto_ACMemberLeaveFM_recv(int fd, char *result, char *data, int charfdid); +// Login +#ifdef _FM_MODIFY +void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int eventflag, int charfdid,int gsnum); +#else + #ifdef _FMVER21 + void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int result, int eventflag, int charfdid); + #else + void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int result, int charfdid); + #endif +#endif +#ifdef _PERSONAL_FAME // Arminius: +void saacproto_ACFMCharLogin_recv(int fd, char *result, int index, int floor, + int fmdp, int joinflag, int fmsetupflag, int flag, int charindex, + int charfame, int charfdid +#ifdef _NEW_MANOR_LAW + ,int momentum +#endif + ); +#else +void saacproto_ACFMCharLogin_recv(int fd, char *result, int index, int floor, + int fmdp, int joinflag, int fmsetupflag, int flag, int charindex, + int charfdid); +#endif +// Logout +void saacproto_ACFMCharLogout_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int result, int index, int charfdid); +void saacproto_ACFMCharLogout_recv(int fd, char *result, int charfdid); +// г԰ +void saacproto_ACFMReadMemo_send(int fd, int index); +void saacproto_ACFMReadMemo_recv(int fd, char *result, int index, int num, + int dataindex, char *data); +// д԰ +void saacproto_ACFMWriteMemo_send(int fd, char *fmname, int fmindex, + char *data, int index); +void saacproto_ACFMWriteMemo_recv(int fd, char *result, int index); +// гݵ +void saacproto_ACFMPointList_send(int fd); +void saacproto_ACFMPointList_recv(int fd, char *result, char *data); + +// ݵ +void saacproto_ACSetFMPoint_send(int fd, char* fmname, int fmindex, int index, + int fmpointindex, int fl, int x, int y, int charfdid); +void saacproto_ACSetFMPoint_recv(int fd, char *result, int r, int charfdid); +// 趨ݵ +void saacproto_ACFixFMPoint_send(int fd, char *winfmname, int winfmindex, + int winindex, char *losefmname, int losefmindex, int loseindex, + int village); +void saacproto_ACFixFMPoint_recv(int fd, char *result, int r); +// 峤ϵԱ㲥 +// kindflag 1:峤㲥 2:屻ϵͳɾ 3:ϵͳ֪ͨѶϢ +void saacproto_ACFMAnnounce_send(int fd, char *fmname, int fmindex, int index, + char *data, int color); +void saacproto_ACFMAnnounce_recv(int fd, char *result, char *fmname, + int fmindex, int index, int kindflag, char *data, int color); +// г TOP 50 б +void saacproto_ACShowTopFMList_send(int fd, int kindflag); +void saacproto_ACShowTopFMList_recv(int fd, char *result, int kindflag, + int num, char *data); +// (ǷճԱ) +// flag 1:acceptjoinflag 2:dpchanged 3:change fmpet 4:change fminfo 5:predel FM Time +void saacproto_ACFixFMData_send(int fd, char *fmname, int fmindex, int index, + int kindflag,char *data1,char *data2,int charindex, int charfdid); + +void saacproto_ACFixFMData_recv(int fd, char *result, int kindflag, char *data1, + char *data2, int charfdid); + +// У¼ +void saacproto_ACFixFMPK_send(int fd, char *winfmname, int winfmindex, + int winindex, char *losefmname, int losefmindex, int loseindex); +void saacproto_ACFixFMPK_recv(int fd, char *result, int data, int winindex, + int loseindex); +// ȡü +// kindflag 1: +void saacproto_ACGetFMData_send(int fd, char *fmname, int fmindex, int index, + int kindflag, int charfdid); +void saacproto_ACGetFMData_recv(int fd, char *result, int kindflag, int data, + int charfdid); +// ǣ +void saacproto_ACGMFixFMData_send(int fd, int index, char *charid, char *cmd, + char *data, int charfdid); +void saacproto_ACGMFixFMData_recv(int fd, char *result, char *fmindex, int charfdid); +// ɾսų +void saacproto_ACFMClearPK_recv(int fd, char *result, char *fmname, int fmindex, + int index); + +// Arminius 7.26 manor pk acknowledge +void saacproto_ACManorPKAck_send(int fd, char *data); +void saacproto_ACManorPKAck_recv(int fd, char *data); + +void saacproto_ACreLoadFmData_send( int fd, int type, int data); + +#ifdef _ACFMPK_LIST +void saacproto_ACLoadFmPk_recv(int fd, char *data); +void saacproto_ACLoadFmPk_send(int fd, int fmpks_pos); +void saacproto_ACSendFmPk_recv( int fd, int toindex, int flg); +void saacproto_ACSendFmPk_send(int fd, int toindex, int PkFlg, int fmpks_pos, char *msg); +#endif + +void saacproto_ACAuctionSold_send(int fd, char *data); +void saacproto_ACAuctionSold_recv(int fd, char *data); + +#ifdef _WAEI_KICK // +void saacproto_ACKick_send( int fd, char* kickid,int kickfd, int flg); +void saacproto_ACKick_recv(int fd , int act, char* data ,int retfd); +#endif + +#ifdef _CHAR_POOLITEM +void saacproto_ACCharInsertPoolItem_send( int acfd, int charaindex, int clifdid, char *CdKey, char *Pooldataarg, int TYPE); + +void saacproto_ACCharSavePoolItem_recv(int fd ,char* result, char* data,int retfd); +void saacproto_ACCharSavePoolItem_send( int acfd, int charaindex, int clifdid, char *CdKey, char *Pooldataarg); + +void saacproto_ACCharGetPoolItem_recv(int fd ,char* result, char* data,int retfd, int meindex); +void saacproto_ACCharGetPoolItem_send( int acfd, int meindex, int charaindex, int clifdid, char * CdKey); +#endif + +#ifdef _CHAR_POOLPET +void saacproto_ACCharInsertPoolPet_send( int acfd, int charaindex, int clifdid, char *CdKey, char *Pooldataarg, int TYPE); + +void saacproto_ACCharSavePoolPet_recv(int fd ,char* result, char* data,int retfd); +void saacproto_ACCharSavePoolPet_send( int acfd, int charaindex, int clifdid, char *CdKey, char *Pooldataarg); + +void saacproto_ACCharGetPoolPet_recv(int fd ,char* result, char* data,int retfd, int meindex); +void saacproto_ACCharGetPoolPet_send( int acfd, int meindex, int charaindex, int clifdid, char * CdKey); +#endif + +#ifdef _ANGEL_SUMMON +void saacproto_ACMissionTable_recv( int fd, int num, int type, char *data, char* angelinfo); +void saacproto_ACMissionTable_send( int fd, int num, int type, char *data, char* angelinfo); +#endif + +#ifdef _TEACHER_SYSTEM +// RETURN_FUNCTION -> R_F_XXXXXXX +enum{ + R_F_TEACHER_SYSTEM, + R_F_END +}; +void saacproto_ACCheckCharacterOnLine_recv( int acfd, int charaindex, int iOnline,char *data,int flag); +void saacproto_ACCheckCharacterOnLine_send( int acfd, int charaindex, char *id, char *name, int flag); +#endif +void saacproto_ACCharLogin_recv(int fd , int clifd, int flag); +void saacproto_AddVipPoint_recv( int fd, char* id, int point, int charaindex ); + +void saacproto_QuerySafePasswd_recv( int fd, char* id, int res, int charaindex ); +void saacproto_AddSafePasswd_recv( int fd, char* id, int res, int charaindex ); + +void saacproto_PointCardSucces_recv( int fd, char* id, int res, int point, int charaindex ); +void saacproto_PointCardErr_recv( int fd, char* id, int res, int charaindex ); +void saacproto_LoginTime_recv( int fd, char* id, char* res, int charaindex ); +void saacproto_ACDelFmPoint_send(int fd, int fmindex); +#ifdef _ONLINE_SHOP +void saacproto_ACShop_recv( int fd, int charaindex, int shopnum, int vippoint, int piece, int pieces, int shopflag, char* res ); +void saacproto_ACShopBuy_recv( int charaindex, int shopflag, int shopno, int buynum ); +#endif +void saacproto_ACQuestion_recv(char* res); +#ifdef _ALL_ITEM +void saacproto_ACAllnum_recv(int flag,int allnum); +#endif +#endif +#ifdef _SQL_BUY_FUNC +void saacproto_OnlineBuy_send( int fd, char* id, char *costpasswd ); +void saacproto_OnlineBuy_recv(int fd, char *data); +#endif +void saacproto_ACFmPkOnlineSn_send( int acfd, int manorindex, int flag); +void saacproto_ACFmPkOnlineSn_recv(int manorindex,char* gsname, int flag); + +void saacproto_ACNewDelFM_send(int acfd, int index, int charfdid); +void saacproto_ACSystemAllTalk_send( int acfd, char *data); +void saacproto_ACSystemAllTalk_recv(char* data); +void saacproto_ACPlayerAllTalk_send( int acfd, char *servername,char *playname,char *data); +void saacproto_ACPlayerAllTalk_recv(char* servername,char* playername,char* data); +/* end of the generated client header code */ + + diff --git a/include/saacproto_util.h b/include/saacproto_util.h new file mode 100644 index 0000000..e65a2e2 --- /dev/null +++ b/include/saacproto_util.h @@ -0,0 +1,114 @@ +#ifndef _SAACPROTOUTIL_H_ +#define _SAACPROTOUTIL_H_ +#include +#include +#ifndef WIN32 +#include +#include +#endif +#define saacproto__NOENCRYPT +#define saacproto__NODEBUG +struct saacproto_ { + int (*write_func)(int,char*,int) ; /* write function */ + size_t workbufsize; /* size of work area */ + char *work,*arraywork,*escapework,*val_str,*ret_work; /* work areas which have same size */ + char *cryptwork,*jencodecopy,*jencodeout,*compresswork; /* these work has bigger size (3times)*/ + char** token_list; /* token list */ + unsigned long message_id; /*= 1, */ /* for generating message IDs */ + +}; +#ifdef _SAACPROTOUTIL_C_ +struct saacproto_ saacproto = { + NULL, + 0, + NULL,NULL,NULL,NULL,NULL, + NULL,NULL,NULL,NULL, + NULL, + 1, +}; +char **saacproto_stringwrapper; +char saacproto_readlogfilename[1024]; +char saacproto_writelogfilename[1024]; +#else +extern char **saacproto_stringwrapper; +extern struct saacproto_ saacproto; +extern char saacproto_readlogfilename[1024]; +extern char saacproto_writelogfilename[1024]; +#endif +char* saacproto_escapeString( char*a ); +char* saacproto_descapeString( char*a ); +void saacproto_splitString( char *src ); +void saacproto_strcpysafe( char *dest, char *src, int len ); +void saacproto_strcatsafe( char *dest , char *src , int maxlen ); +char*saacproto_mkstr_int( int i ); +char*saacproto_mkstr_u_int( unsigned int i ); +char*saacproto_mkstr_long( long l ); +char*saacproto_mkstr_u_long( unsigned long l ); +char*saacproto_mkstr_short( short s ); +char*saacproto_mkstr_u_short( short s ); +char*saacproto_mkstr_char( char c ); +char*saacproto_mkstr_u_char( char c); +char*saacproto_mkstr_string( char*a ); +char*saacproto_mkstr_float( float f ); +char*saacproto_mkstr_double( double d ); +char*saacproto_mkstr_int_array( int size , int *array ); +char*saacproto_mkstr_u_int_array( int size , int *array ); +char*saacproto_mkstr_short_array( int size , short *array ); +char*saacproto_mkstr_u_short_array(int size , short *array ); +char *saacproto_mkstr_char_array( int size , char *array ); +char *saacproto_mkstr_u_char_array( int size , unsigned char *array ); +char *saacproto_mkstr_float_array( int size , float *array ); +char *saacproto_mkstr_double_array( int size , double *array ); +int saacproto_demkstr_int( char*a ); +unsigned int saacproto_demkstr_u_int( char*a ); +long saacproto_demkstr_long( char*a ); +unsigned long saacproto_demkstr_u_long(char*a ); +short saacproto_demkstr_short( char*a ); +unsigned short saacproto_demkstr_u_short( char*a ); +char saacproto_demkstr_char( char*a ); +unsigned char saacproto_demkstr_u_char( char*a ); +float saacproto_demkstr_float( char*a ); +double saacproto_demkstr_double(char*a ); +char* saacproto_demkstr_string( char*a); +int *saacproto_demkstr_int_array( char**tk ,int *buf ,int start , int size ); +int *saacproto_demkstr_u_int_array( char **tk , int *buf , int start , int size ); +unsigned int *saacproto_demkstr_long_array( + char **tk , unsigned int *buf , int start , int size ); +unsigned long *saacproto_demkstr_u_long_array( + char **tk , unsigned long *buf , int start , int size ); +short *saacproto_demkstr_short_array( char **tk , short *buf , int start , int size ); +unsigned short*saacproto_demkstr_u_short_array( + char **tk , unsigned short *buf , int start , int size ); +char *saacproto_demkstr_char_array( char **tk , char *buf , int start , int size ); +unsigned char *saacproto_demkstr_u_char_array( + char **tk , unsigned char*buf , int start , int size ); +float *saacproto_demkstr_float_array( char **tk , float *buf , int start , int size ); +double *saacproto_demkstr_u_double_array( char **tk , double *buf , int start , int size ); +char *saacproto_wrapStringAddr( char *copy , int maxcopylen , char*src ); + +void saacproto_GetMessageInfo( int *id , char *funcname , int len,char **tk ); +int saacproto_ClientRead(void); +void saacproto_consumeLine(char *buf , int ofs ); +void saacproto_copyLine( char*src , char *out , int maxoutlen ); +void saacproto_Send( int fd , char *msg ); +int saacproto_AllocateCommonWork(int bufsiz); +int saacproto_StringRest(); + +// WON ADD +unsigned long saacproto_GetNewMessageID(void); + + +void saacproto_CreateHeader(char*out, char *fname ); +void saacproto_CreateHeaderID( char *out,unsigned long msgid , char *fname ); +int saacproto_default_write_wrap( int fd , char *buf , int size ); +void saacproto_bzero( char *b , int siz ); +void saacproto_bcopy(char*s , char *d , int siz ); +char *saacproto_Ltoa( long v ); +char *saacproto_Ultoa( unsigned long v ); +void saacproto_DebugSend( int fd , char *msg ); +/* Modified by ringo to fasten int type transfer */ +char *saacproto_cnv10to62( int a, char *out, int outlen ); +int saacproto_a62toi( char *a ); +extern int JENCODE_KEY; +#endif + diff --git a/include/sasql.h b/include/sasql.h new file mode 100644 index 0000000..307f1f0 --- /dev/null +++ b/include/sasql.h @@ -0,0 +1,128 @@ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#define BOOL int +#define FALSE 0 +#define TRUE 1 + +void sasql_close( void ); +BOOL sasql_init( void ); +int sasql_query(char *nm, char *pas); +BOOL sasql_update(char *nm, char *path); +BOOL sasql_logindate(char *nm); +BOOL sasql_online( char *ID, char *NM, char *IP,int fame,int vigor, int flag ); +BOOL sasql_register(char *id, char *ps); +BOOL sasql_craete_userinfo( void ); +BOOL sasql_craete_lock( void ); +BOOL sasql_chehk_lock( char *idip ); +BOOL sasql_add_lock( char *idip ); +BOOL sasql_del_lock( char *idip ); +int sasql_vippoint( char *ID, int point,int flag ); +int sasql_query_safepasswd(char *id, char *safepasswd); +int sasql_add_safepasswd(char *id, char *safepasswd); +int sasql_load_query(char *nm, char *pas); +int sasql_del_query(char *nm, char *pas); +BOOL sasql_add_card(char *pas, int num); +void sasql_query_card(char *id, char *cardps,int charaindex); +#ifdef _ONLINE_SHOP +int sasql_chehk_shop( char *dataname ); +char* sasql_query_shop( char *dataname, int startrow, int shopnum ); +int sasql_buy_shop( char *dataname, int startrow, int shopnum, int shopno ); +#endif +#ifdef _ALL_ITEM +int sasql_allnum( int flag, int num, int flag1 ); +#endif +char* sasql_query_question(void); +#ifdef _SQL_BUY_FUNC +char *sasql_OnlineBuy( char *id, char *costpasswd ); +void sasql_OnlineBuy_add( char *coststr, int type, int num ); +#endif +#ifdef _PET_RESET +int sasql_resetpet_point(int petno); +int sasql_resetbdpet_point(int petno); +#endif +#ifdef _ZHIPIAO_SYSTEM +int sasql_zhipiao_insert(char *petno,char *cdkey,int point); +int sasql_zhipiao_query(char *piaono); +int sasql_zhipiao_update(char *cdkey,char *piaono,int checktype); +#endif +#ifdef _FMRANK_POINT +int sasql_fm_query(void); +int sasql_fmpoint_query(int fmindex); +int sasql_fmno_query(int fmindex); +int sasql_fmpoint_add(int fmindex,int point); +int sasql_fmindex_add(int fmindex,char *fmname,int point); +int sasql_fmindex_del(int fmindex); +#endif +#ifdef _ITEM_RESET +int sasql_itemreset_query(int itemid); +int sasql_itemdel_query(int itemid); +#endif +int sasql_cdkey_lock(char *cdkey,int locktype); +int sasql_ampoint( char *ID, int point, int flag ); +int sasql_cdkey_online( char *cdkey ); +int sasql_check_iponline( char *IP ); +#ifdef _EV_NUM +char* sasql_ev_npcmsg( int npcno ); +char* sasql_ev_item( void ); +char* sasql_ev_pet( void ); +#endif +#ifdef _RMB_SYSTEM +int sasql_rmbpoint( char *ID, int point, int flag ); +#endif +char* sasql_rand_buf( void ); +int sasql_check_lockip( char *IP ,int type); +int sasql_check_lockmac( char *mac); +int sasql_check_lockpcid( char *pcid); + +int sasql_add_lockip(char *IP,int type,int online,int mode); +int sasql_query_online_ip(char *IP); +int sasql_online_ip(char *cdkey,char *IP); +int sasql_offlinenum( char *IP ); +int sasql_offlinejqmnum( char *cdkey ); +char* sasql_ip( char *cdkey ); +BOOL sasql_online_jqm( char *ID, char *jqm, char *IP,int logintype ); +int sasql_onlinejqmnum( char *jqm, int flag ); +char* sasql_query_jqm( char *cdkey ); + +int sasql_getVipPoint( int charaindex ); +int sasql_setVipPoint( int charaindex, int point ); +int sasql_setVipPointForCdkey( char *id, int point ); +int sasql_getVipPointForCdkey( char *id ); +BOOL sasql_ckeckStrint( char *str ); +#ifdef _CARD_PRODUCTION +void sasql_OnlineCost_add( int cost, int num); +#endif + +int sasql_jifenPoint( int charaindex ); +int sasql_setJfPoint( int charaindex, int point ); +int sasql_xjPoint( int charaindex ); +int sasql_setxjPoint( int charaindex, int point ); + +#ifdef _CAX_LNS_MYSQLSUOXU +void sasql_LUASQLAdv(char* sqlstr,char* filepath,char* function,int npcindex ,int charaindex,char* msg,int flg); +void sasql_LUASQL(char* sqlstr,int row,char* filepath,char* function,int npcindex ,int charaindex,char* msg); + +char* sasql_Lua_QueryR(int row,char *sqlstr); +char* sasql_LuaAdv_QueryR(char *sqlstr,int flg); +#endif + +#ifdef _CAX_NEWMAC_LOGIN +char* sasql_query_mac( char *cdkey ); +BOOL sasql_online_mac( char *ID, char *mac, char *IP,int logintype ); +int sasql_onlinemacnum( char *mac, int flag ); +#endif diff --git a/include/skill.h b/include/skill.h new file mode 100644 index 0000000..9d41159 --- /dev/null +++ b/include/skill.h @@ -0,0 +1,121 @@ +#ifndef __SKILL_H__ +#define __SKILL_H__ + +#include "common.h" +#include "util.h" + +typedef struct tagSKILL_intDataSetting +{ + char *dumpskill; +}SKILL_intDataSetting; + +typedef struct tagSKILL_charDataSetting +{ + char *dumpskill; +}SKILL_charDataSetting; + + +typedef enum +{ +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + SKILL_1, + SKILL_2, + SKILL_3, + SKILL_4, + SKILL_5, + SKILL_6, + SKILL_7, + SKILL_8, + SKILL_9, + SKILL_10, + SKILL_11, + SKILL_12, + SKILL_13, + SKILL_14, + SKILL_15, + SKILL_16, + SKILL_NUM +#else + SKILL_FIRE, + SKILL_MAGICIAN, + SKILL_PRIEST, + SKILL_ALOTOFTHINGS, + SKILL_AVOIDRATEUP, + SKILL_DETERMINEITEM, + SKILL_DETERMINEOTHERS, + SKILL_FIRECUT, + SKILL_THUNDERCUT, + SKILL_ICECUT, + SKILL_MERCHANT, + SKILL_HEALER, + SKILL_FIST, + SKILL_SWORD, + SKILL_AXE, + SKILL_SPEAR, + SKILL_BOW, + SKILL_CANE, + SKILL_LARGEVOICE, + SKILL_NUM +#endif +}SKILL_ID; + + +typedef struct tagSkillTable +{ + const int maxlevel; + void* effectfunc; +}SKILL_table; + + +typedef enum +{ + SKILL_LEVEL, // ܵȼ + SKILL_IDENTITY, // ܱ + SKILL_DATAINTNUM, +}SKILL_DATAINT; + +typedef enum +{ + SKILL_DATACHARNUM, +}SKILL_DATACHAR; + + +typedef struct tagSkill +{ + int data[SKILL_DATAINTNUM]; + STRING32 string[SKILL_DATACHARNUM]; +}Skill; + +char* SKILL_makeStringFromSkillData( Skill* sk ); +BOOL SKILL_makeSkillFromStringToArg( char* src, Skill* sk ); + +int SKILL_getInt( Skill* skill, int element); +int SKILL_setInt( Skill* skill, int element, int new); + +#ifdef _CHAR_PROFESSION // WON ADD ְҵ +char* SKILL_makeSkillStatusString( Skill* skill, int charaindex, int skill_num ); +#else +char* SKILL_makeSkillStatusString( Skill* skill ); +#endif + +char* SKILL_makeSkillFalseString( void ); + +BOOL SKILL_makeSkillData( Skill* sk ,int skid, int lev ); + +int SKILL_levelup( Skill* sk ); +int SKILL_getLevelFromSkillID( int charaindex, SKILL_ID id ); +BOOL SKILL_getUpableSkillID( int charaindex,char* buf, int buflen ); +void SKILL_skillEffect( int charaindex ); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +int PROFESSION_MAGIC_COST_MP( int charaindex, int skill_num ); +INLINE int PROFESSION_CHANGE_SKILL_LEVEL_M( int skill_level ); +INLINE int PROFESSION_CHANGE_SKILL_LEVEL_A( int skill_level ); +INLINE int SKILL_getRealInt( Skill* skill, int element); +#endif + + +#endif +/*__SKILL_H__*/ + + diff --git a/include/sndcnf.h b/include/sndcnf.h new file mode 100644 index 0000000..449efd4 --- /dev/null +++ b/include/sndcnf.h @@ -0,0 +1,147 @@ +// į̻ ʾبة ǩ ׷º Ѩ޷ūƥέ춪 +// SA Serverƥƻϣ +// SE įñߣ + +SNDCONFIG sndconfig[] = +{ + // + { 1, "data\\se\\sap_01.wav", 85, 0, 0 /*, "aֿȭ"*/ }, + { 2, "data\\se\\sap_02.wav", 85, 0, 0 /*, "a"*/ }, + { 3, "data\\se\\sap_03.wav", 85, 0, 0 /*, "a"*/ }, + { 4, "data\\se\\sap_04.wav", 100, 0, 0 /*, "a"*/ }, + { 5, "data\\se\\sap_05.wav", 85, 0, 0 /*, "a"*/ }, + { 6, "data\\se\\sap_06.wav", 60, 0, 0 /*, "a"*/ }, + { 7, "data\\se\\sap_07.wav", 123, 0, 0 /*, "aͿռ"*/ }, + { 8, "data\\se\\sap_08.wav", 80, 0, 0 /*, ""*/ }, + { 9, "data\\se\\sap_09.wav", 80, 0, 0 /*, "aǹ"*/ }, + { 10, "data\\se\\sap_10.wav", 80, 0, 0 /*, "aʸ"*/ }, +//x { 11, "data\\se\\sap_11.wav", 105, 7, 0 /*, ""*/ }, + { 11, "data\\se\\sap_11.wav", 105, 0, 0 /*, ""*/ }, + { 12, "data\\se\\sap_14.wav", 100, 0, 0 /*, ""*/ }, + { 13, "data\\se\\sap_12.wav", 90, 0, 0 /*, ""*/ }, + { 14, "data\\se\\sap_13.wav", 105, 0, 0 /*, ""*/ }, + + // ƹ + { 51, "data\\se\\sae_01.wav", 123, 0, 0 /*, ""*/ }, + { 52, "data\\se\\sae_02.wav", 123, 0, 0 /*, ""*/ }, + { 53, "data\\se\\sae_03.wav", 123, 0, 0 /*, ""*/ }, + { 54, "data\\se\\sae_04.wav", 123, 0, 0 /*, ""*/ }, + { 55, "data\\se\\sae_05.wav", 123, 0, 0 /*, ""*/ }, + { 56, "data\\se\\sae_06.wav", 105, 0, 0 /*, "˹"*/ }, + { 57, "data\\se\\sae_07.wav", 80, 0, 0 /*, "˹ɫ"*/ }, + { 58, "data\\se\\sae_08.wav", 123, 0, 0 /*, ""*/ }, + { 59, "data\\se\\sae_09.wav", 123, 0, 0 /*, ""*/ }, + { 60, "data\\se\\sae_10.wav", 80, 0, 0 /*, "Ħ˹"*/ }, + { 61, "data\\se\\sae_11.wav", 123, 0, 0 /*, ""*/ }, + { 62, "data\\se\\sae_12.wav", 95, 0, 0 /*, "濨˹"*/ }, + { 63, "data\\se\\sae_13.wav", 80, 0, 0 /*, "˹̹˹"*/ }, + { 64, "data\\se\\sae_14.wav", 90, 0, 0 /*, ""*/ }, + { 65, "data\\se\\sae_15.wav", 95, 0, 0 /*, "³"*/ }, + { 66, "data\\se\\sae_16.wav", 95, 0, 0 /*, "ص"*/ }, + { 67, "data\\se\\sae_17.wav", 123, 0, 0 /*, ""*/ }, + { 68, "data\\se\\sae_18.wav", 123, 0, 0 /*, ""*/ }, + { 69, "data\\se\\sae_19.wav", 123, 0, 0 /*, ""*/ }, + { 70, "data\\se\\sae_20.wav", 123, 0, 0 /*, ""*/ }, + { 71, "data\\se\\sae_21.wav", 123, 0, 0 /*, ""*/ }, + { 72, "data\\se\\sae_22.wav", 123, 0, 0 /*, ""*/ }, + { 73, "data\\se\\sae_23.wav", 90, 0, 0 /*, ""*/ }, + { 74, "data\\se\\sae_24.wav", 90, 0, 0 /*, "Ұ"*/ }, + { 75, "data\\se\\sae_25.wav", 100, 0, 0 /*, "Ը"*/ }, + { 76, "data\\se\\sae_26.wav", 123, 0, 0 /*, ""*/ }, + { 77, "data\\se\\sae_27.wav", 123, 0, 0 /*, ""*/ }, + { 78, "data\\se\\sae_28.wav", 90, 0, 0 /*, ""*/ }, + { 79, "data\\se\\sae_29.wav", 123, 0, 0 /*, ""*/ }, + { 80, "data\\se\\sae_30.wav", 100, 0, 0 /*, "֮"*/ }, + { 81, "data\\se\\sae_31.wav", 123, 0, 0 /*, ""*/ }, + { 82, "data\\se\\sae_32.wav", 123, 0, 0 /*, ""*/ }, + + // ܷ + { 100, "data\\se\\sam_01.wav", 75, 0, 0 /*, "ʹ"*/ }, + { 101, "data\\se\\sam_02.wav", 75, 0, 0 /*, "ż"*/ }, + { 102, "data\\se\\sam_03.wav", 75, 0, 0 /*, "ָ"*/ }, + { 103, "data\\se\\sam_04.wav", 123, 0, 0 /*, "棨С"*/ }, + { 104, "data\\se\\sam_05.wav", 123, 0, 0 /*, "棨У"*/ }, + { 105, "data\\se\\sam_06.wav", 123, 0, 0 /*, "棨"*/ }, + { 106, "data\\se\\sam_07.wav", 123, 0, 0 /*, "С"*/ }, + { 107, "data\\se\\sam_08.wav", 123, 0, 0 /*, "У"*/ }, + { 108, "data\\se\\sam_09.wav", 123, 0, 0 /*, ""*/ }, + { 109, "data\\se\\sam_10.wav", 123, 0, 0 /*, "С"*/ }, + { 110, "data\\se\\sam_11.wav", 123, 0, 0 /*, "У"*/ }, + { 111, "data\\se\\sam_12.wav", 123, 0, 0 /*, ""*/ }, + { 112, "data\\se\\sam_13.wav", 123, 0, 0 /*, "׻С"*/ }, + { 113, "data\\se\\sam_14.wav", 123, 0, 0 /*, "׻У"*/ }, + { 114, "data\\se\\sam_15.wav", 85, 0, 0 /*, "׻ɱ"*/ }, + { 115, "data\\se\\sam_16.wav", 123, 0, 0 /*, ""*/ }, + { 116, "data\\se\\sam_17.wav", 123, 0, 0 /*, ""*/ }, + { 117, "data\\se\\sam_18.wav", 123, 0, 0 /*, ""*/ }, + { 118, "data\\se\\sam_19.wav", 123, 0, 0 /*, "Ѫ"*/ }, + { 119, "data\\se\\sam_20.wav", 123, 0, 0 /*, ""*/ }, + { 120, "data\\se\\sam_21.wav", 123, 0, 0 /*, "ʯ"*/ }, + { 121, "data\\se\\sam_22.wav", 123, 0, 0 /*, ""*/ }, + { 122, "data\\se\\sam_23.wav", 123, 0, 0 /*, "ħ"*/ }, + { 123, "data\\se\\sam_24.wav", 123, 0, 0 /*, ""*/ }, + + // +// { 151, "data\\se\\sak_01.wav", 121, 0, 1 /*, ""*/ }, +// { 152, "data\\se\\sak_02.wav", 121, 0, 1 /*, "Ǻ"*/ }, + { 151, "data\\se\\sak_01.wav", 127, 0, 1 /*, ""*/ }, +//x { 152, "data\\se\\sak_02.wav", 127, 4, 1 /*, ""*/ }, + { 152, "data\\se\\sak_02.wav", 127, 0, 1 /*, ""*/ }, + { 153, "data\\se\\sak_03.wav", 121, 0, 1 /*, ""*/ }, + { 154, "data\\se\\sak_04.wav", 90, 0, 1 /*, ""*/ }, + { 155, "data\\se\\sak_05.wav", 95, 0, 1 /*, "Ʈѩ"*/ }, + { 156, "data\\se\\sak_06.wav", 127, 0, 1 /*, ""*/ }, + { 157, "data\\se\\sak_07.wav", 125, 0, 1 /*, "ˮ"*/ }, + { 158, "data\\se\\sak_08.wav", 125, 0, 1 /*, ""*/ }, + { 159, "data\\se\\sak_09a.wav", 120, 0, 1 /*, ""*/ }, + { 160, "data\\se\\sak_10.wav", 115, 0, 1 /*, ""*/ }, + { 161, "data\\se\\sak_11.wav", 85, 0, 1 /*, "ˮ"*/ }, + { 162, "data\\se\\sak_12.wav", 120, 0, 1 /*, "糵"*/ }, + { 163, "data\\se\\sak_13.wav", 100, 0, 1 /*, "ˮ"*/ }, + { 164, "data\\se\\sak_14.wav", 127, 0, 1 /*, "ԭ"*/ }, + { 165, "data\\se\\sak_15.wav", 120, 0, 1 /*, ""*/ }, + { 166, "data\\se\\sak_16.wav", 120, 0, 1 /*, "ʯӵˮ"*/ }, + { 167, "data\\se\\sak_17.wav", 110, 0, 1 /*, "Ҷȡů"*/ }, + { 168, "data\\se\\sak_09b.wav", 120, 0, 1 /*, "ɭ֣"*/ }, + + // ˵ ة + { 201, "data\\se\\sas_01.wav", 90, 0, 0 /*, ""*/ }, + { 202, "data\\se\\sas_02.wav", 80, 0, 0 /*, "Ӵ"*/ }, + { 203, "data\\se\\sas_03.wav", 75, 0, 0 /*, "رӴ"*/ }, + { 204, "data\\se\\sas_04.wav", 80, 0, 0 /*, "Ӵ"*/ }, + { 205, "data\\se\\sas_05.wav", 80, 0, 0 /*, "رӴ"*/ }, + { 206, "data\\se\\sas_06.wav", 80, 0, 0 /*, ""*/ }, + { 207, "data\\se\\sas_07.wav", 123, 0, 0 /*, ""*/ }, + { 208, "data\\se\\sas_08.wav", 123, 0, 0 /*, ""*/ }, + { 209, "data\\se\\sas_09.wav", 123, 0, 0 /*, ""*/ }, + { 210, "data\\se\\sas_10.wav", 123, 0, 0 /*, ""*/ }, + { 211, "data\\se\\sas_11.wav", 65, 0, 0 /*, ìʧ""*/ }, + { 212, "data\\se\\sas_12.wav", 80, 0, 0 /*, "ʹĿ"*/ }, + { 213, "data\\se\\sas_13.wav", 123, 0, 0 /*, "Σdz"*/ }, +// { 214, "data\\se\\sas_14.wav", 127, 0, 0 /*, "ʤ"*/ }, + { 215, "data\\se\\sas_15.wav", 82, 0, 0 /*, ""*/ }, + { 216, "data\\se\\sas_16.wav", 110, 0, 0 /*, ""*/ }, + { 217, "data\\se\\sas_17.wav", 85, 0, 0 /*, "㻬"*/ }, + { 218, "data\\se\\sas_18.wav", 123, 0, 0 /*, ""*/ }, + { 219, "data\\se\\sas_19.wav", 82, 0, 0 /*, ""*/ }, + { 220, "data\\se\\sas_20.wav", 60, 0, 0 /*, "ΣǶ"*/ }, + { 221, "data\\se\\sas_21.wav", 123, 0, 0 /*, ""*/ }, + + // ĸ + { 250, "data\\se\\sad_01.wav", 85, 0, 0 /*, "𺦣ֿȭ"*/ }, + { 251, "data\\se\\sad_02.wav", 80, 0, 0 /*, "𺦣"*/ }, +//x { 252, "data\\se\\sad_03.wav", 95, -3, 0 /*, "𺦣ǹ"*/ }, + { 252, "data\\se\\sad_03.wav", 95, 0, 0 /*, "𺦣ǹ"*/ }, + { 253, "data\\se\\sad_04.wav", 85, 0, 0 /*, "𺦣"*/ }, + { 254, "data\\se\\sad_05.wav", 90, 0, 0 /*, "𺦣צ"*/ }, + + // BGM +// { 401, "data\\bgm\\ls2b_01.wav", 5 /*, "ģʽ֮"*/ }, +// { 402, "data\\bgm\\ls2b_02.wav", 5 /*, "Ϸе"*/ }, +// { 403, "data\\bgm\\ls2b_03.wav", 5 /*, "֮"*/ }, +// { 404, "data\\bgm\\ls2b_04.wav", 5 /*, "ͷĿ֮"*/ }, + + { -1 } // θį սئз +}; + + diff --git a/include/title.h b/include/title.h new file mode 100644 index 0000000..4fd63a1 --- /dev/null +++ b/include/title.h @@ -0,0 +1,21 @@ +#ifndef __TITLE_H__ +#define __TITLE_H__ + +#include "common.h" +#include "util.h" + +INLINE BOOL TITLE_CHECKTABLEINDEX( int index ); +int TITLE_getTitleIndex( int index); +#define TimeLimitLocal "2013-12-30 00:00:00" +char* TITLE_makeTitleStatusString( int charaindex, int havetitleindex ); +char* TITLE_makeSkillFalseString( void ); + +BOOL TITLE_addtitle( int charaindex, int titleindex ); +BOOL TITLE_deltitle( int charaindex, int titleindex ); +BOOL TITLE_initTitleName( char* filename ); +BOOL TITLE_reinitTitleName( void); +BOOL TITLE_initTitleConfig( char* filename ); +BOOL TITLE_TitleCheck( int charaindex, BOOL mode); +BOOL TITLE_TitleCheck_Nomsg( int charaindex, BOOL mode, int *addcnt, int *delcnt); +#endif + /*__TITLE_H__*/ diff --git a/include/trade.h b/include/trade.h new file mode 100644 index 0000000..3b0b6c5 --- /dev/null +++ b/include/trade.h @@ -0,0 +1,17 @@ +#ifndef __TRADE_H__ +#define __TRADE_H__ +#include "version.h" +#include "common.h" +#include "util.h" +#include "net.h" + +BOOL TRADE_Search(int fd, int meindex, char* message); + +void CHAR_Trade(int fd, int index, char* message); + +#ifdef _ITEM_PILEFORTRADE +void TRADE_InitTradeList( void); +#endif + +void TRADE_CheckTradeListUser( void); +#endif diff --git a/include/type_def.h b/include/type_def.h new file mode 100644 index 0000000..9b230f9 --- /dev/null +++ b/include/type_def.h @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////// +// : type_def.h +// ļ : һЩó, ṹ弰ضһЩƵ +// : ˫ȫ +// ʱ : 200692 +// Ŀ : DES㷨 +// ע : +// ʷ¼ : +/////////////////////////////////////////////////////////////// +#ifndef _TYPE_DEF_ +#define _TYPE_DEF_ + +//岿 +typedef unsigned char uint8; +typedef signed char int8; +typedef unsigned char BOOLEAN; + +#define TRUE 1 +#define FALSE 0 + +#endif diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..946a8a8 --- /dev/null +++ b/include/util.h @@ -0,0 +1,142 @@ +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include +#include +#include + +#include "common.h" + + +typedef struct tagSTRING32 +{ + char string[32]; +}STRING32; +typedef struct tagSTRING64 +{ + char string[64]; +}STRING64; +typedef struct tagSTRING128 +{ + char string[128]; +}STRING128; + +typedef struct tagRECT +{ + int x; + int y; + int width; + int height; +}RECT; +typedef struct tagPOINT +{ + int x; + int y; +}POINT; + +/* strtol ɡñ */ +typedef enum +{ + CHAR,SHORT,INT,DOUBLE +}CTYPE; + +void chop( char* src ); +void dchop( char* src , char* del); +#define chomp(src) dchop(src,"\n"); +void chompex( char *buf ); +void pohcd( char* src , char* del); +void strcpysafe( char* dest ,size_t n,const char* src ); +void strncpysafe( char* dest ,const size_t n , + const char* src ,const int length ); +char* strcatsafe( char* src, int size, char* ap ); +BOOL strtolchecknum( char* arg , void* number,int base ,CTYPE type); +int strcmptail( char *s1 , char *s2 ); +int texttoiTail( char *hoge); +int textToInt( char *str ); +void deleteCharFromString( char* src , char* dels ); +void deleteCharFromStringNoEscape( char* src , char* dels ); +#define deleteWhiteSpace( src ) deleteCharFromStringNoEscape( src," \t" ) +char* replaceString( char* src, char oldc ,char newc ); + +char* escapeStrStr( char* src, char* needle ); +BOOL getStringFromIndexWithDelim_body( char* src ,char* delim ,int index, char* buf , int buflen, char *file, int line ); +#define getStringFromIndexWithDelim( src, delim, index, buf, buflen ) getStringFromIndexWithDelim_body( src, delim, index, buf, buflen, __FILE__, __LINE__ ) + +void getFourIntsFromString(char* src,int* int1,int* int2,int* int3, + int* int4); +void deleteSequentChar( char* src , char* dels ); +int hashpjw ( char* s ); +double gettimemillis( void ); +double gettimemicros( void ); + +int bindlocalhost( int port ); +int connectHost( char* hostname , unsigned short port ); +int existsNewLineCharacter( char* line ); +int hashpjw ( char* s ); +int charInclude( char* src, char* include ); +char* nindex( char* string, int c , int number ); +int rgetFileName( char* dirname , STRING64* string, int size); +//int RAND (int x,int y); +#define RAND(x,y) ((x-1)+1+ \ + (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) +/*#define RAND(x,y) (x+(int)( (double)(y)*rand() / (RAND_MAX+1.0)) )*/ +void makeRandomString( char *cand , char *out , int len ); +BOOL checkStringsUnique( char** strings, int num ,int verbose); + +char* makeEscapeString( char* src , char* dest, int sizeofdest); +char* makeStringFromEscaped( char* src ); +INLINE double time_diff(struct timeval subtrahend,struct timeval subtractor); +BOOL PointInRect( RECT* rect, POINT* p ); +BOOL CoordinateInRect( RECT* rect, int x, int y); +int clipRect( RECT *rect1, RECT *rect2, RECT *ret ); +BOOL isstring1or0( char* string ); +void easyGetTokenFromString( char *src , int count , char*output , int len ); + +float linearDiv( float val1 , float val2 , float d ); +BOOL isExistFile( char* filename ); +char *cnv10to62( int a, char *out, int outlen ); +BOOL checkRedundancy( int *src, int srclen); +void shuffle_ints( int num, int *a, int t ); +unsigned short CheckCRC( unsigned char *p , int size ); +// Shan Add +INLINE double time_diff(struct timeval subtrahend,struct timeval subtractor); + + +/* ѨͷئԻ */ +#define ABS(x) ((x)>=0 ? (x) : -(x)) + +/* ë 0 - 7 姸 */ +#define VALIDATEDIR(x) ({(x)%=8;(x)=((x)+8)%8;}) + +/* 4ë2ƻ */ +#define GETLOWVALUE(x) ( (x)&0x0000ffff) +#define GETHIGHVALUE(x) ((((x)&0xffff0000)>>16)&0x0000ffff) +#define SETLOWVALUE(x,y) ((x)=((x)&0xffff0000)|( (y) &0x0000ffff)) +#define SETHIGHVALUE(x,y) ((x)=((x)&0x0000ffff)|(((y)<<16)&0xffff0000)) +#define MAKE2VALUE(x,y) ((((x)<<16)&0xffff0000)|((y)&0x0000ffff)) + +/* 4ë1*4ƻؤѨͷ */ +#define GETFIRSTVALUE(x) ( (x)&0x000000ff ) +#define GETSECONDVALUE(x) ((((x)&0x0000ff00)>>8 )&0x000000ff) +#define GETTHIRDVALUE(x) ((((x)&0x00ff0000)>>16)&0x000000ff) +#define GETFOURTHVALUE(x) ((((x)&0xff000000)>>24)&0x000000ff) + +#define SETFIRSTVALUE(x,y) ((x)=(((x)&0xffffff00)\ + |( y &0x000000ff))) +#define SETSECONDVALUE(x,y) ((x)=(((x)&0xffff00ff)\ + |(((y)<<8 )&0x0000ff00))) +#define SETTHIRDVALUE(x,y) ((x)=(((x)&0xff00ffff)\ + |(((y)<<16)&0x00ff0000))) +#define SETFOURTHVALUE(x,y) ((x)=(((x)&0x00ffffff)\ + |(((y)<<24)&0xff000000))) + +#define MAKE4VALUE(a,b,c,d) ( (((a)<<24)&0xff000000)\ + |(((b)<<16)&0x00ff0000)\ + |(((c)<< 8)&0x0000ff00)\ + |( (d) &0x000000ff)) + +#endif +char *strcpy_s(char *des, size_t n, const char *src); +char *replace(char *source,char *sub,char *rep); +int getHash ( char* s ); + /* __UTIL_H__ */ diff --git a/include/version.h b/include/version.h new file mode 100644 index 0000000..3ebe1f7 --- /dev/null +++ b/include/version.h @@ -0,0 +1,808 @@ +#include "sasql.h" +#ifndef __VERSION_H__ +#define __VERSION_H__ +#include "correct_bug.h" //BUG FIX + +/*Server 汾*/ +#define _NEW_SERVER_ +#define _SERVER_NUMS + +#define UNIQUE_KEYCODEITEM 100 +#define UNIQUE_KEYCODEPET "i" +//#define _DEFAULT_PKEY "Wonwonwon" // (ɿ)( ʯ 6.0 ) +//#define _RUNNING_KEY "11111111" // (ɿ)( ʯ 6.0 ) +//#define _DEFAULT_PKEY "ttttttttt" // (ɿ)( ʯ 6.0 ) +//#define _RUNNING_KEY "20041215" // (ɿ)( ʯ 6.0 ) + +/* ------------------------------------------------------------------- + * רׯ԰޸ ԱС褡ѫ־ΰС + */ + +/* +޸װ԰ʽ +Account Server ʽ: + acfamily.h MAX_FMPOINTҪ޸ +Account Server Ϸ: + saac/family/fmpoint/db_fmpointׯ԰趨 + ׯ԰ͼ|ׯ԰|ׯ԰|ׯ԰峤ͼ|ׯ԰ڽ֮ׯ|ռׯ԰֮ index|ռׯ԰֮ name|ռׯ԰֮ۺֵ + 磺 + 100|607|563|1041|1|3|shan|3132238 + 200|73|588|2031|2||| +Game Server ʽ + version.h FAMILY_MAXHOMEMANORNUMҪ + family.c FM_PKFLOOR սͼ + FAMILY_RidePet() 峤ͼ + FAMILY_LeaderFunc() 뺯id + npcutil.c addNpcFamilyTax function(ׯ԰ͼ%100)Ϊׯ԰˰ղ +Game Server Ϸ: + gmsv_v2/data/npc/family/manorsman.arg* id + gmsv_v2/data/npc/family/scheduleman.arg* id +*/ + +// ---------------------------BOXC޸---------------------------------------- +// --------------------------------------------------------------------------- +#define CAX_STOP_FUN // εһЩ,رմΪ +#ifndef CAX_STOP_FUN +#define CAX_RIDE_GENXIN // ·ɻ費 +#define _NO_QUICK_WAR // ֹ +#define _CAX_NPCTIME_OFF // ɾʱжNPC䣨CAX޸ģΪԵNPC䣬֧ijЩF +#endif + +#define _ITEM_COLOER // Ʒɫ +#define _SAME_IP_ONLINE_NUM // ͬIP½ +#define _CHECK_SEVER_IP // жϷIP +#define _FIX_CORE_LOOP // ޸CORE_LOOP +#define _FIX_CHAR_LOOP // ѭ +#define _FIX_SAVE_CHAR // 浵 +#define _CAX_ESC_FENGBAO // ESC +//#define _CAX_ESC_REPORT // ÿǩ +//#define _CAX_ESC_SAVE_DATA // ݱ +#define _FIX_COPY_MM_BUG // ޸MMBUG +//#define _TAKE_ITEMDAMAGE_FIX // װ +//#define _TAKE_ITEMDAMAGE_FOR_PET // װװ +#define _PETSKILL_SHOP_LUA // \̵LUA +#define _PLAYER_NPC // +#define _SERVER_DEF // ȫ +#define _CARD_PRODUCTION // 㿨[gm card ֵ]LNSֵӿ +#define _RECORD_IP // ¼IP +#define _CAX_FAMEBUTTON // ص-AB棬CFǷ񿪷 +#define _CAX_Mercenary // Ӷֶ +#define _PET_TRANS_ABILITY // ת +#define _PET_3TRANS // ת +#define _NO_MAGIC // ֹʹþͼ +#define _illegalpetskill_CF // ԶֹŴ\ +#define _FIX_SUPERPERSON_STRANS // ԼƷ˴ﵽ5תǿת6 +#define _CAX_LUA_BETT01 // LUAӽӿ +#define _LUA_Debug // LUA +#define _CAX_ADD_LUADX // LUAһЩչ +#define _CAX_PET_EVOLUTION // 2תںϿء// ںϳֵCF޸ // +#define _TRANS_7_COLOR // ͻǷPING// CFǷԻ +#define _CAX_PET_ITEMRIDE // װCF +#define _CAX_ZHUANGYUAN_QTJ // սʱֹʹõ߾ +#define _CAX_GM_RERIDE // ضride.exeļ +#define _CAX_GM_RESKILLCODE // ضskillcode.exeļ +#define _CAX_GM_RELEADERRIDE // ضleaderride.exeļ +#define _RIDEBUG // սBUGΪֹսͬһֻ +#define _DAMMAGE_CALC // Զ˺ +#define _FREE_SAVE // ¼ +#define _GM_SAVE_ALL_CHAR // GM浵 +#define _SPECIAL_SUIT // װ +#define _MANOR_EQUIP // ׯ԰רװ +#define _NULL_CHECK_ITEM // ͷ֧Ʊ +#define _RE_GM_COMMAND // ԶGM +#define _CAX_LNS_NLSUOXU // LNS-NL +#define _CAX_LNS_CHARSUOXU // LNS-CHAR +#define _CAX_LNS_NLGSUOXU // LNS-NLG +#define _CAX_LNS_MAPSUOXU // LNS-MAP +#define _CAX_LNS_MYSQLSUOXU // LNS-MYSQL +//#define _CAX_OFF_IPTABLES // ر˿Զǽã򿪴Ч +#define _CAX_FAME_KOUFEI // 10ÿ֤۷ +#define _CAX_ITEM_ADDEXP // Զǻ۹ʱ +//#define _CAX_FM_QISHINUM // رΪ1Ϊ2 #### 1.ǷΪС500ƹ 2.Ϊׯ԰ƵɣرΪ1Ϊ2 +//#define _CAX_METAMO_OFF // 򿪿ſͻ˱ɫ +#define _CAX_NEWMAC_LOGIN // 71ŷMACַ +#define _NO_STW_ENEMY // ֹҿ +#define _FM_FMPOINTPK_LIST // ׯ԰սб +#define _FM_NPC_LOOK_WAR // 岼Կսб,ۿսNPCBOXCɾĶսб +#define _FM_FMPOINTPK_LIST // ׯ԰սб +#define _CAX_NPCTIME_IF // NPCʱж +//########################CAXӶ0985ͻӦ޸################## +#define _CAX_TALK_LJIU // ֧˵ +#define _CAX_DENGON_GG // ֹ֧ +//###################################added by mo############################# +#define _SHARE_EXP // 鹲 +#define _TEAM_ADDEXP // Ӿӳ +#define _FIX_EARTHROUND // ޸һܳBUG +#define _FIX_ContinuationAttack //޸عĿ(3 5֮) +#define _TEAM_WARP // ޸ESCΪŶӴ +#define _FM_NPC_LOOK_WAR1 // 岼Կսб(Ӹ߰汾ׯ԰) +#define _DEX_FIX //ϵ +#define _LOCK_PET_ITEM // 󶨳 +//#define _PET_TRANS_SETANS //ֳ֧ת(ɾ˹) +#define _MAX_BEATITUDE_BUFF //ףӳ +#define _PETTRANS_RANGE //ֳ֧תΧ +#define _ITEM_LUA //LUA֧ +#define _FM_EXP_ADD //ׯ԰徭ӳ +#define _FIX_STW_SPEED_ENEMY // ޸ҿ +#define _NO_QUICK_WAR //ֹҿ +#define _FIX_LSSP_S_BUG //޸Sķֵͣ˵BUG +#define _UNLAW_THIS_LOGOUT // ֹԭ +#define _NO_JOINFLOOR //ֹӵͼ +#define _NO_HELP_MAP //ֹhelpͼ +#define _REGISTRATION_TIME //09ǩֶ +#define _FIX_TRADE_COPYPET //޸׸ƳBUG +#define _MO_LOGINCHECK //ֹСӹҵȷǷҵĵ¼֤ +#ifdef _MO_LOGINCHECK //XXTEA㷨һЩ +#define XXTEA_ROUND 8 // +#define XXTEA_KEY_1 1241503322 //key1 +#define XXTEA_KEY_2 1241503322 //key2 +#define XXTEA_KEY_3 1241503322 //key3 +#define XXTEA_KEY_4 1241503322 //key4 +#endif +#define _FIX_PLAYER_NPC_PET //ӼNPCɾĽӿ +#define _UNTEXT_TALK // ιؼ +#define _FIX_LONGCHARNAME_ATTACK //޸ֳ + +#define _AVOIEDamageCharName // ֹΣյ +#define _AVOIDATTACK_IN_CHAR_Talk_messageToLong // ֹ CHAR_Talk message ̫ +#define _AVOIDATTACK_IN_ADDRESSBOOK_sendMessage_textToLong // ֹ ADDRESSBOOK_sendMessage text ̫ +#define _AVOIDATTACK_IN_PETMAIL_sendPetMail_textToLong // ֹ PETMAIL_sendPetMail text ̫ +#define _AVOIDATTACK_IN_lssproto_WN_recv_dataToLong // ֹ lssproto_WN_recv data ̫ +#define _AVOIDATTACK_IN_ChatRoom_Create_messageToLong // ֹ ChatRoom_Create message ̫ +#define CC_ADD_ADDEXPCHECKDEGREE // (ɿ) ٷֱ ʱ:ͬɵ + + +//#define CXC_BOXC_WUGUA // ޹FãҵFر +#ifdef CXC_BOXC_WUGUA +#define _CAX_GUANZHAN // ޹Fʹõս /gz +#define _CAX_LVTISHI // ȼ1ijʾΪץȡԶɾ +#endif + +//##########ʯרԵdataʯҪر############################# +//#define _PET_AMOI__E // ٷļʽ +//#define _PETITEM__AMOI_E // ٷļʽ +//##################################################################################### +// +// + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +#define _FAMILY_MANORNUM_CHANGE // CoolFish ޸װ԰(4.0) +#ifdef _FAMILY_MANORNUM_CHANGE +#ifdef CXC_BOXC_WUGUA +#define FAMILY_MAXHOME 2 // (4.0) ݵ +#define MANORNUM 2 // (4.0) ׯ԰ +#define FMPOINTNUM 2 // (4.0) оݵ +#else +#define FAMILY_MAXHOME 4 // (4.0) ݵ +#define MANORNUM 4 // (4.0) ׯ԰ +#define FMPOINTNUM 4 // (4.0) оݵ +#endif +#endif +#define _FMVER21 // (ɿ) ְƹ +#define _PERSONAL_FAME // (ɿ) Arminius 8.30 +// ------------------------------------------------------------------- +//רʯԶ Ա + +#define _EVERYONE_RIDE // (ɿ) Robin 0924 ƽ +// ------------------------------------------------------------------- +//ר Ա־ +#define _ATTACK_MAGIC // (ɿ) ṩսеĹ +#define _ADD_ACTION // (ɿ) һNPC״趨 + +// ------------------------------------------------------------------- +//ר߱ ԱС +#define _UNIQUE_P_I // (ɿ) CoolFish 2001/10/11 + +// ------------------------------------------------------------------- +//ר°ﴢpn ˷ 1018 Աѫ +#define _NEWSAVE // (ɿ) Robin +#define _STORECHAR // (ɿ) Robin +#define _DROPCHECK // (ɿ) Robin ֹظ +#define _DROPCHECK2 // (ɿ) Robin ֹظ +// ------------------------------------------------------------------- +//ר : Ա : +#define _PET_TRANS // (ɿ) ת +#define _NEW_WARPMAN // (ɿ) NPCWARP +#define _PET_TALK // (ɿ) Ի +#define _PET_LIMITLEVEL // (ɿ) () +#define _MAP_NOEXIT // (ɿ) ͼԭ&ԭǻָ +// ------------------------------------------------------------------- +// רGMָ㼶Reload ԱС +#define _GMRELOAD // (ɿ) CoolFish: 2001/11/12 +// ------------------------------------------------------------------- +// ר½ ԱС +#define _GAMBLE_ROULETTE // (ɿ) ij С +#define _FIX_GAMBLENUM // (ɿ) : ߿ۻ +#define _GAMBLE_BANK // (ɿ) ij +#define _DROPSTAKENEW // (ɿ) CoolFish: ijע +#define _PETRACE // (ɿ) CoolFish: 2001/12/3 ᄎٳ +#define _NEWEVENT // (ɿ) CoolFish: 2001/12/5 µ +// ------------------------------------------------------------------- +//ר Ա +#define _ITEM_FIRECRACKER // (ɿ) սʹñڿ԰ +// ------------------------------------------------------------------- +//¹ܣׯ԰PK(綨) Ա־ΰ־ +#define _MANOR_PKRULE // (ɿ) +// ------------------------------------------------------------------- +// ¹ܣ¹&\ Ա +#define _PSKILL_FALLGROUND // (ɿ) \ () +#define _ENEMY_FALLGROUND // (ɿ) NPC +#define _BATTLE_NEWPOWER // (ɿ) +#define _Item_MoonAct // (ɿ) ػ +#define _Item_DeathAct // (ɿ) ħ +#define _Item_PetAct // (ɿ) ѱ޽ָ +#define _Item_ReLifeAct // (ɿ) Ҫitemset1.txt ܿ) +#define _BATTLESTEAL_FIX // (ɿ) ͵ +#define _CFREE_petskill // (ɿ) Ҫpetskill1.txt ܿ) ѧϰ\ܼ +#define _data_newreadfile // (ɿ) µserver setup.cf itemset1.txt petskill1.txt µ +#define _ITEM_MAXUSERNUM // (ɿ) itemset1.txt ITEM ʹô +// ------------------------------------------------------------------- +//¹ܣ Ա +#define _PET_TALKPRO // (ɿ) Իǿ & END +#define _PRO_NPCFIX // (ɿ) NPCܼǿ +#define _PRO_BATTLEENEMYSKILL // (ɿ) սǿ NPCAI +#define _NEW_WARPPOINT // (ɿ) ͵жWARP +#define _FIX_CHECKITEM // (ɿ) ߲Ƿ +// ------------------------------------------------------------------- +//¹ܣ ԱС,WON +#define _ADD_ENCOUNT // (ɿ) WON ӵ޼ +#define _WON_PET_MAIL_LOG // (ɿ) WON Ҽij LOG +// ------------------------------------------------------------------- +// ¹ܣ 4.0 Ա, ־ΰ , , ־ +//#define _LOSE_FINCH_ // (ɿ) ANDY ȸ +#define _FIX_FAMILY_PK_LIMIT // (ɿ) WON սׯ԰ǰʮΪǰʮ +#define _ADD_POOL_ITEM // (ɿ) WON ӿɼķŵĵ +#define _ITEM_METAMO // (ɿ) shan metamo sprite. code:robin->shan +#define _ENEMY_ATTACK_AI // (ɿ) shan enemy attack mode. code:shan +#define _ITEM_TIME_LIMIT // (ɿ) shan time limit of item. code:shan +#define _MIND_ICON // (ɿ) shan show icon from char mind. code:shan +#define _BATTLENPC_WARP_PLAYER // (ɿ) shan npc warp player when n round. code:shan +#define _ITEM_WARP_FIX_BI // (ɿ) shan fix bbi to bi. code:shan +#define _SKILL_DAMAGETOHP // (ɿ) ANDY Ѫ +#define _Skill_MPDAMAGE // (ɿ) ANDY MP˺ +#define _WAEI_KICK // (ɿ) ANDY +#define _BATTLE_TIMESPEED // (ɿ) ANDY սʱ (ؿٹ) +#define _NEW_RIDEPETS // (ɿ) ANDY +#define _FIXBUG_ATTACKBOW // (ɿ) ANDY ʹͶbug +#define _NPCCHANGE_PLAYERIMG // (ɿ) ANDY NPCıͼ, ǿ,ͼ () +#define _ITEM_ATTSKILLMAGIC // (ɿ) ANDY ߼ +#define _EQUIT_DEFMAGIC // (ɿ) ANDY ħװ +#define _FIX_MAGICDAMAGE // (ɿ) ANDY ħʽ ڿ +#define _ITEM_CONSTITUTION // (ɿ) ANDY +#define _MAGIC_REHPAI // (ɿ) ANDY ѪAI +#define _TRANSER_MAN // (ɿ) ANDY ʦ +#define _TAKE_ITEMDAMAGE // (ɿ) ANDY ITEMSET2 +#define _FIX_FIRECRACKER // (ɿ) ANDY +#define _FIX_ITEMPROB // (ɿ) ANDY +#define _ADD_DEAMGEDEFC // (ɿ) ANDY ˺ & ӹ ITEMSET2 +#define _FIX_MAXCHARMP // (ɿ) ANDY MP +#define _ITEM_INSLAY // (ɿ) ANDY ⱦʯ +#define _ITEMSET2_ITEM // (ɿ) ANDY ITEMSET2 +#define _ITEM_NPCCHANGE // (ɿ) ANDY (, ) +#define _PETSKILL_FIXITEM // (ɿ) ANDY ޸ && ͬ +#define _FIX_SETWORKINT // (ɿ) ANDY (FIXWORKINT) +#define _ITEM_ADDEXP // (ɿ) vincent :ָʱӾֵ +#define _ITEM_ADDEXP2 // ǹʱۼ Robin +#define _FIX_METAMORIDE // (ɿ) ANDY +#define _CHECK_ITEMDAMAGE // (ɿ) 7/26 +#define _SKILL_WILDVIOLENT_ATT // (ɿ) vincent 輼:񱩹 +#define _MAGIC_WEAKEN // (ɿ) vincent : +#define _SKILL_WEAKEN // (ɿ) vincent 輼://Ҫ#define _MAGIC_WEAKEN +#define _SKILL_SPEEDY_ATT // (ɿ) vincent 輼:ٹ +#define _SKILL_GUARDBREAK2 // (ɿ) vincent 輼:Ƴ2 +#define _SKILL_SACRIFICE // (ɿ) vincent 輼:Ԯ +#define _PSKILL_MODIFY // (ɿ) ANDY ǿ +#define _PSKILL_MDFYATTACK // (ɿ) ANDY ת +#define _MAGIC_DEFMAGICATT // (ɿ) ANDY ħ +#define _MAGIC_SUPERWALL // (ɿ) ANDY ڷ +#define _OTHER_MAGICSTAUTS // (ɿ) ANDY +#define _SKILL_TOOTH // (ɿ) ANDY +#define _MAGIC_DEEPPOISON // (ɿ) vincent :綾 +#define _MAGIC_BARRIER // (ɿ) vincent :ħ +#define _MAGIC_NOCAST // (ɿ) vincent :Ĭ +#define _ITEM_CRACKER // (ɿ) vincent : //Ҫ#define _MIND_ICON +#define _SKILL_DEEPPOISON // (ɿ) vincent 輼:綾 //Ҫ#define _MAGIC_DEEPPOISON +#define _SKILL_BARRIER // (ɿ) vincent 輼:ħ //Ҫ#define _MAGIC_BARRIER +#define _SKILL_NOCAST // (ɿ) vincent 輼:Ĭ //Ҫ#define _MAGIC_NOCAST +#define _SKILL_ROAR // (ɿ) vincent 輼:() +#define _SKILL_REFRESH // (ɿ) vincent 輼:쳣״̬ +#define _ITEM_REFRESH // (ɿ) vincent 쳣״̬ +#define _MAGIC_TOCALL // (ɿ) kjl ٻ 02/06/20 kjl + +// ------------------------------------------------------------------- +// ¹ܣ Ա +#define _ITEMSET3_ITEM // (ɿ) ANDY itemset3.txt +#define _SUIT_ITEM // (ɿ) ANDY (װ) itemset3.txt +#define _PETSKILL_SETDUCK // (ɿ) ANDY 漼 +#define _VARY_WOLF // (ɿ) pet skill : vary wolf. code:shan +// ------------------------------------------------------------------- +// ¹ܣר5.0 Ա +#define _USEWARP_FORNUM // (ɿ) ANDY ë +#define _IMPRECATE_ITEM // (ɿ) ANDY +#define _MAGICPET_SKILL // (ɿ) ANDY ħ輼 +#define _ITEM_CHECKWARES // (ɿ) ANDY Ͳ +#define _NPC_REPLACEMENT // (ɿ) ANDY ûսnpc +#define _EMENY_CHANCEMAN // (ɿ) ANDY EMENY ѡ +#define _TYPE_TOXICATION // (ɿ) ANDY ж޷Ѫ +#define _PET_FUSION // (ɿ) ANDY ں enemybase1.txt +#define _NPC_FUSION // (ɿ) ANDY NPCں +#define _ITEM_EDITBASES // (ɿ) ANDY Ӫ +#define _PET_EVOLUTION // (ɿ) ANDY + +// ------------------------------------------------------------------- +// ¹ܣ5.0׷Ӳ Ա +#define _AVID_TRADETRYBUG // (ɿ) ANDY ֹж/ ()ʼ ʯ +#define _ASSESS_SYSEFFICACY // (ɿ) ANDY ϵͳЧ 12/04 +#define _ASSESS_SYSEFFICACY_SUB // (ɿ) Robin ϵͳЧ ӼڻȦ +#define _PREVENT_TEAMATTACK // (ɿ) ANDY ֹͬӻ 12/04 +#define _ITEM_ORNAMENTS // (ɿ) ANDY װε 12/04 //沿 +#define _CHIKULA_STONE // (ɿ) ANDY ֮ʯ 12/04 // +#define _SEND_EFFECT // (ɿ) WON ACѩЧ 12/04 +#define _PETMAIL_DEFNUMS // (ɿ) ANDY ʼ +#define _TEAM_KICKPARTY // (ɿ) ANDY ӳ(ս״̬) +#define _PETSKILL_TIMID // (ɿ) ANDY 輼-ս +#define _PETS_SELECTCON // (ɿ) ANDY ﲻɵѡս +#define _CHRISTMAS_REDSOCKS // (ɿ) ANDY ʥ +#define _FIX_ARRAYBUG // (ɿ) ANDY array λ +#define _USER_CHARLOOPS // (ɿ) ANDY LOOP +#define _BATTLE_PROPERTY // (ɿ) ANDY ս +#define _PETSKILL_PROPERTY // (ɿ) ANDY ħ޳輼 +#define _ITEM_FIXALLBASE // (ɿ) ANDY ޸֮ʯ +#define _ITEM_LOVERPARTY // (ɿ) ANDY ˽ڵ +#define _ITEM_FORUSERNAMES // (ɿ) ANDY +#define _BATTLECOMMAND_TIME // (ɿ) ANDY ֹҿ(غսʱ) +#define _NPCENEMY_ADDPOWER // (ɿ) ANDY ޸Ĺֵ + + +// ------------------------------------------------------------------- +// ¹ܣר6.0 Ա +// +#define _PETSKILL_CANNEDFOOD // (ɿ) ANDY \ܹͷ for 6.0 +#define _TEST_DROPITEMS // (ɿ) ANDY Զ +#define _MAP_WARPPOINT // (ɿ) ANDY Map WarpPoint +#define _TREASURE_BOX // (ɿ) ANDY +#define _BENEMY_EVENTRUN // (ɿ) ANDY սnpc +#define _BATTLE_ABDUCTII // (ɿ) ANDY ;ⷰ2 +#define _BATTLE_LIGHTTAKE // (ɿ) ANDY ɹ +#define _BATTLE_ATTCRAZED // (ɿ) ANDY +#define _STATUS_WATERWORD // (ɿ) ANDY ˮ״̬ +#define _ITEM_WATERWORDSTATUS // (ɿ) ANDY ˮ״̬ +#define _CAPTURE_FREES // (ɿ) ANDY ץ +#define _THROWITEM_ITEMS // (ɿ) нƷ +#define _OBJSEND_C // (ɿ) ANDY _OBJSEND_C +#define _ADD_SHOW_ITEMDAMAGE // (ɿ) WON ʾƷ;ö + +//-------------------------------------------------------------------------- +//ר 7.0 ְҵϵͳ Ա ־ + +#define _CHANGETRADERULE // (ɿ) Syu ADD ׹޶ +#define _TRADE_SHOWHP // (ɿ) Syu ADD ʾѪ +#define _SHOOTCHESTNUT // (ɿ) Syu ADD 輼 +#define _SKILLLIMIT // (ɿ) Syu ADD ùҷ +#define _TRADESYSTEM2 // (ɿ) Syu ADD ½ϵͳ +#define _NPC_NOSAVEPOINT // (ɿ) ANDY ¼㲻 +#define _ACFMPK_LIST // (ɿ) ANDY սб +#define _PETSKILL2_TXT // (ɿ) ANDY petskill2.txt +#define _PETSKILL_CHECKTYPE // (ɿ) ANDY \ʹʱ +#define _PETSKILL_TEAR // (ɿ) ANDY 輼 ˺˿ +#define _NPC_MAKEPAIR // (ɿ) ANDY NPC +#define _ITEMSET4_TXT // (ɿ) ANDY itemset4.txt +#define _ITEM_PILENUMS // (ɿ) ANDY زĶѵ itemset4 +#define _ITEM_PILEFORTRADE // (ɿ) ANDY ׶ѵ +#define _ITEM_EQUITSPACE // (ɿ) ANDY װλ +#define _PET_LOSTPET // (ɿ) ANDY ʧѰƻ +#define _ITEMSET5_TXT // (ɿ) ANDY itemset5.txt +#define _ITEMSET6_TXT // (ɿ) ANDY itemset6.txt +#define _EQUIT_ARRANGE // (ɿ) ANDY Ҫ itemset5.txt +#define _EQUIT_SEQUENCE // (ɿ) ANDY ˳ Ҫ itemset5.txt +#define _EQUIT_ADDPILE // (ɿ) ANDY ӿɶѵ Ҫ itemset5.txt +#define _EQUIT_HITRIGHT // (ɿ) ANDY Ҫ itemset5.txt +#define _EQUIT_NEGLECTGUARD // (ɿ) ANDY Ŀ% Ҫ itemset6.txt +#define _EQUIT_NEWGLOVE // (ɿ) ANDY λ +#define _FIX_MAX_GOLD // (ɿ) WON ADD Ǯ +#define _PET_SKILL_SARS // (ɿ) WON ADD ɷ +#define _SONIC_ATTACK // (ɿ) WON ADD +#define _NET_REDUCESEND // (ɿ) ANDY DBϴ +#define _FEV_ADD_NEW_ITEM // (ɿ) Change Ӹؾ +#define _ALLDOMAN // (ɿ) Syu ADD аNPC +#define _LOCKHELP_OK // (ɿ) Syu ADD ɼս +#define _TELLCHANNEL // (ɿ) Syu ADD Ƶ +// ¹ܣְҵ +#define _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ +#define _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol +#define _CHAR_PROFESSION // (ɿ) WON ADD ְҵλ +#define _PROFESSION_SKILL // (ɿ) WON ADD ְҵ +#define _NPC_WELFARE // (ɿ) WON ADD ְҵNPC +#define _NPC_ADDLEVELUP // (ɿ) ANDY NPCҵȼ +#define _CHAR_FIXDATADEF // (ɿ) ANDY ϳʼ +//ϵͳ +#define _SIMPLIFY_ITEMSTRING // (ɿ) ANDY 򻯵ִ +#define _CHAR_NEWLOGOUT // (ɿ) ANDY dz» +#define _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ 8/27 + +#define _CHAR_POOLITEM // (ɿ) ANDY ֿ߲⹲ +#define _NPC_DEPOTITEM // (ɿ) ANDY ֿ߲⹲ + +#define _SIMPLIFY_PETSTRING // (ɿ) ANDY 򻯳浵ִ +#define _SIMPLIFY_ITEMSTRING2 // (ɿ) ANDY 򻯵ִ2 +#define _WOLF_TAKE_AXE // (ɿ) WON ADD ץ˫ͷǵ +#define _FIX_UNNECESSARY // (ɿ) ANDY Ҫж +#define _ITEM_MAGICRECOVERY // (ɿ) ANDY ¹⾵ +//9/17 +#define _PETSKILL_GYRATE // (ɿ) Change 輼: +#define _PETSKILL_ACUPUNCTURE // (ɿ) Change 輼:Ƥ (client˵_PETSKILL_ACUPUNCTUREҲҪ) +#define _PETSKILL_RETRACE // (ɿ) Change 輼:׷ +#define _PETSKILL_HECTOR // (ɿ) Change 輼: +//10/13 +#define _PETSKILL_FIREKILL // (ɿ) Change 輼:ɱ +#define _PETSKILL_DAMAGETOHP // (ɿ) Change 輼:¿(Ѫı) +#define _PETSKILL_BECOMEFOX // (ɿ) Change 輼:Ļ + +//11/12 +#define _PETSKILL_SHOWMERCY // (ɿ) Change 輼: +#define _NPC_ActionFreeCmp // (ɿ) Change NPCµıȽϷʽ +//-------------------------------------------------------------------------- + + +//11/26 +#define _NPC_ProfessionTrans // (ɿ) Change ְҵNPCжת +#define _NPC_NewDelPet // (ɿ) Change NPCɾ(ԭ,ֻwarpmanʹʱɹ,һһ) +#define _ALLDOMAN_DEBUG // (ɿ) Change serverаʧbug +//20031217 +#define _CHRISTMAS_REDSOCKS_NEW // (ɿ) Change ʥ +#define _PETSKILL_COMBINED // (ɿ) Change 輼:ѵúͿ [ۺħ(ȡħ)] +//˽ڻ +#define _NPC_ADDWARPMAN1 // (ɿ) Change npcgen_warpmanӹ(趨趨Ů) +#define _ITEM_QUITPARTY // (ɿ) Change ɢʱض߼ʧ +#define _ITEM_ADDEQUIPEXP // (ɿ) Change װᾭֵ +//2004/2/18 +#define _ITEM_LVUPUP // (ɿ) Change ͻƳȼƵҩ(ר) +//2004/02/25 +#define _PETSKILL_BECOMEPIG // (ɿ) Change 輼: +#define _ITEM_UNBECOMEPIG // (ɿ) Change Ľҩ +#define _PET_TALKBBI // (ɿ) Change жbbi +#define _ITEM_USEMAGIC // (ɿ) Change ɵʹħ +//2004/04/07 +#define _ITEM_PROPERTY // (ɿ) Change ıԵ +#define _SUIT_ADDENDUM // (ɿ) Change װӹ (_SUIT_ITEMҪ) +//2004/05/05 +#define _ITEM_CHECKDROPATLOGOUT // (ɿ) Change ؼ¼ʱ޵dzʧ,,ɻؼ¼ +#define _FM_MODIFY // 幦޸() +#define _CHANNEL_MODIFY // Ƶ() +#define _STANDBYPET // Robin +#define _PROSKILL_OPTIMUM // Robin ְҵܴѻ +#define _PETSKILL_OPTIMUM // Robin \ܴѻ +#define _MAGIC_OPTIMUM // Robin Magic table ѻ +#define _AC_PIORITY // Nuke ACȨ(ɿ) +//2004/05/12 +#define _CHAR_POOLPET // (ɿ) Robin ֿ⹲ +#define _NPC_DEPOTPET // (ɿ) Robin ֿ⹲ +#define _MAGIC_RESIST_EQUIT // (ɿ) WON ADD ְҵװ + +// ------------------------------------------------------------------- +// +#define _NEWOPEN_MAXEXP // (ɿ) ANDY MAXֵ +// ------------------------------------------------------------------- +// ¹ܣGMƵ +//̰ +#define _REDHAT_V9 //(ɿ) Change REDHAT9.0İ汾±ʱ +//-------------------------------------------------------------------------- +//ר 7.5 л Աѫ С +#define _NPC_EXCHANGEMANTRANS // (ɿ) Change exchangemanжת +#define _ANGEL_SUMMON // Robin ʹٻ +#ifdef _ANGEL_SUMMON + #define _ADD_NEWEVENT +#endif +// Terry define start ------------------------------------------------------------------- +#define _STREET_VENDOR // ̯() +#define _WATCH_EVENT // ѯ() +#define _NEW_MANOR_LAW // ׯ԰() +#define _MAP_TIME // ͼ,ᵹ() +#define _PETSKILL_LER // ׶() + +// Terry define end ------------------------------------------------------------------- +#define _FIX_MAGIC_RESIST // (ɿ) Change ְҵħ +#define _ADD_DUNGEON // (ɿ) Change ׷ӵ +#define _PROFESSION_ADDSKILL // (ɿ) Change ׷ְҵ +#define _ITEM_ADDPETEXP // (ɿ) Change ӳᆳֵ(ɳԴ˵߳,ƽɻþֵ) +#define _TRANS_6 // (ɿ) Change 6ת +#define _PET_2TRANS // (ɿ) Change 2ת +#define _PET_2LIMITLEVEL // (ɿ) Change 2ת +#define _MAGICSTAUTS_RESIST // (ɿ) Change ()Ծ +#define _EQUIT_RESIST // (ɿ) Change һװ(ɿһ쳣״̬)п ħ Ĭ +#define _SUIT_TWFWENDUM // (ɿ) Change װ (_SUIT_ITEMҪ) +#define _EXCHANGEMAN_REQUEST_DELPET // (ɿ) Change exchangemanTYPE:REQUESTɾ +//-------------------------------------------------------------------------- +#define _DEL_DROP_GOLD // ɾϹʱʯ Robin +#define _ITEM_STONE // cyg ֵʯͷ +#define _HELP_NEWHAND // cyg ´ɫֵ) +#define _DEF_GETYOU // cyg GMָ ѯԼ Χڵʺ +#define _DEF_NEWSEND // cyg GMָ ʱɼӾҲɲ +#define _DEF_SUPERSEND // cyg GMָ ɴijʺΪĸ3 +#define _SUIT_ADDPART3 // (ɿ) Change װܵ ر% Ĭ% % % % +#define _PETSKILL_2TIMID // (ɿ) Change սڶ(ʨŭ) +#define _SHOW_FUSION // (ɿ) Change ںϳCLIENTֻʾת,޸ΪںϳʾΪں(clientҲҪ) +#define _FONT_SIZE // (ɿ) Robin ʹС +#define _PROSK99 // (ɿ) Change ְȼͰ +#define _TIME_TICKET // Robin ʱ볡 ɭ׽ +#define _HALLOWEEN_EFFECT // ʥЧ +#define _ADD_STATUS_2 // ״̬ڶ +#define _ADD_reITEM // (ɿ) Change λո +#define _ADD_NOITEM_BATTLE // NPCû߻ս +#define _PETSKILL_BATTLE_MODEL // \սģ +#define _PETSKILL_ANTINTER // (ɿ) Change 輼:֮ ο_PETSKILL_2TIMID +#define _PETSKILL_REGRET // (ɿ) Change 輼:һ ο_SONIC_ATTACK +#define _SUIT_ADDPART4 // (ɿ) Change װܵĵ ж% ǿʦħ(30%) ֿʦħ + +//ͨ------------------------------------- +#define _PUB_ALL +#ifdef _PUB_ALL +//#define _PROSKILL_ERR_KICK // ǷԶT +#define _ITEM_SETLOVER // 鹦 +#define _CREATE_MM_1_2 // Ʒٷ +#define _SendTo // ͵ +#define _GET_BATTLE_EXP // +#define _NEW_PLAYER_CF // ״̬ +#define _USER_EXP_CF // ûԶ徭 +#define _TRANS_LEVEL_CF // תԽ160 +#define _UNLAW_WARP_FLOOR // ֹ͵ +#define _UNREG_NEMA // ֹ +#define _GM_ITEM // GMƷ +#define _GM_METAMO_RIDE // GMг +#define _GM_RIDE // GMȨ +#define _LOCK_IP // IP +#define _POINT // +#define _VIP_SERVER // Ա +#define _WATCH_FLOOR // Զɹսͼ +#define _BATTLE_FLOOR // Զǿսͼ +#define _VIP_SHOP // Ա̵ +#define _LOOP_ANNOUNCE // ѭ +#define _SKILLUPPOINT_CF // Զ +#define _RIDELEVEL // Զȼ +#define _REVLEVEL // Զԭȼ +#define _FM_ITEM // +#define _LUCK_ITEM // +#define _NEW_PLAYER_RIDE // +#define _FIX_CHARLOOPS // ħʯʱ +#define _PLAYER_ANNOUNCE // +#define _BATTLE_GOLD // ȡͬʱýǮ +#define _ITEM_GOLD // ǮƷ +#define _PLAYER_NUM // +#define _PET_MM // ʯMM +#define _MYSTERIOUS_GIFT // +#define _RELOAD_CF // ضCF +#define _PET_UP // ɼ˶ij +#define _TRANS // ת +#define _TRANS_7 // ʵ7ת +#define _RIDEMODE_20 // 2.0ģʽ +#define _TALK_ACTION // ˵ +#define _ENEMY_ACTION // Ҳл +#define _CHAR_CDKEY // ֹ +#define _GMSV_DEBUG // GMSVϢ +#define _CHECK_PEPEAT // Ƿ +#define _SILENTZERO // Ʒ +#define _SAVE_GAME_ID // ʾķ +#define _ANGLE_EMAIL // ٺԶƬ +#define _ALL_TALK // Ƶ +#endif +//Ա׷ӹ-------------------------------------- +#define _VIP_ALL +#ifdef _VIP_ALL +#define _VIP_RIDE // Աڼ +#define _AUTO_PK // ԶPKϵͳ +#define _FM_METAMO // רñָ +#define _ITEM_METAMO_TIME // ԶĽָ +#define _SHOW_VIP_CF // ԶVIPˣ壬ʾʽ +#define _GM_KING // GMħ +//#define _MULTI_THREAD_KERNEL // д̺߳ +#define _ANGEL_TIME // Զ徫ٻʱ +#define _FM_POINT_PK // ׯ԰廥ׯ԰ +#define _PLAYER_MOVE // ˳ƹ +#define _BATTLE_PK // ǿPKߣ˻ؼ¼ +#define _FUSIONBEIT_TRANS // ںϳת +#define _FUSIONBEIT_FIX // ȡںϳ +#define _TRANS_7_NPC // תNPC +#define _MOMENTUM_NPC // ƽű +#define _DP_NPC // DPű +#define _RIDE_CF // Զ +#define _PET_LEVEL_ITEM // ȼƷ +#define _FM_LEADER_RIDE // 峤ר +//#define _DBSAVE_CHAR // ˫浵 +#define _FM_JOINLIMIT // ٴμʱ +#define _PET_BEATITUDE // ף +#define _ITEM_EFMETAMO // ñָ +#define _OPEN_E_PETSKILL // ųE +#define _ITEM_RIDE // ѱװ +#define _MAKE_MAP // ͼ +#define _MAKE_PET_CF // Զɳ +#define _GET_MULTI_ITEM // һθƷ +#define _VIP_ANNOUNCE // Աϵͳ +#define _NOWEN_EV // ԶNOWEN +#define _NEW_NAME // Զƺ +#define _MAKE_PET_ABILITY // Χ +#define _ZANZHU_SERVER // ϵͳ +#define _TRADE_PK // IJPK +#define _JK_CF_DELPETITEM // ɾCFõij͵ +#define _SAFE_PASSWORD // ȫ +#define _POINT_CARD // ֵ +#define _NEED_ITEM_ENEMY // Զץ +#define _SUPER_MAN_ITEM // Ʒ˵ +#define _DIY_INSLAY // ԶװǶ +#define _MAP_HEAL // Զͼսָ +#define _NO_WARP +//#define _BATTLE_NO_WANG // ׶ħŲ +#define _LUCK_MAN // +#define _QUESTION_ONLINE // ʴ +#define _ONLINE_SHOP // ̳ +#define _SQL_BUY_FUNC // +#define _MYSQL_GMSV // MYSQL +#ifdef _MYSQL_GMSV + #define _SASQL +#endif +#define _8018_SA // 8018֧ +//ӹܿʼ +#define _NO_STREET_MAP // ɰ̯ͼ +#define _TRANS7_POINT // ת +#define _PET_BUG // BUG +//#define _JOB_AUTOPK // ְҵԶPK +#define _EV_NUM // ܻ +#define _ALL_ITEM // ȫֱ +#define _NOJOB_PK // ְҵPK +#define _NONUM_AUTOPK // ̭ԶPK +//#define _NO_ATTACK // CC +#define _NO_TRANS_ANGLE // 6ת辫ٻ +#define _VIGOR_SYS // ϵͳ +#define _OFFLINE_SYSTEM // ߹һ +#define _NPCENEMY_1 // NPCENEMY +#define _WAN_FIX // Ż޸ +#define _WARNPC_CTRL // ħϵͳٺͬһIPӣ +#define _ITEM_RESET // ߻¯ͻ +#define _NO_DAOLUAN // ֹϵͳ +#define _FMWAR_PLAYERNUM // Զս +#define _PETMAIL_LV // ʼʼijȼƺͿ +#define _FMZUZHANG_MSG // ׯ԰峤֪ͨ +#define _FM_WELFARE // ׯ԰帣 +#define _FMWAR_MSG // Զׯ԰սش +#define _ZHIPIAO_SYSTEM // ֧Ʊϵͳ +#define _FM_SERVERNO_SYS // ָ·崴ͽɢ +#define _BATTLEMAP_CTRL // ָͼսʱ +#define _STU_SYS // ʦͽϵͳǿ +#define _NPC_ITEMUP // NPC +#define _NO_DROPITEM // 󶨵ߣʱʾ +#define _PET_RESET // ¯ +#define _FMRANK_POINT // 徺 +#define _PETSKILL_DEL_SHOP // \ܻ¯ +#define _ASSA_TOP // С֧ +#define _NPC_PETSKILLUP // NPC\ܽ +#define _PETSKILL_BINDING // \ܰ󶨣żܵijﲻܽףӳ̯ +#define _PETSKILL_DEL_NPC // \ܻ¯ +#define _NO_FULLPLAYER_ATT // ˹ +#define _ATTREVERSE_FIX // Իԭ޸ +#define _NEWFM_GOLD // ½ҪǮ +#define _PSKILL_GYRATE // GYRATE\ǿ +#define _PSKILL_BATTLE_MODEL // Ⱥ\ǿ +#define _JOB_FIX // ְҵƽ +#define _RMB_SYSTEM // ֽ˻ϵͳ +#define _PET_STANDBY // սв +#define _MERGE_TIME // Զϳʱ +#define _EXP_TIME_OUT // ϢʾЧʱ +#define _PETUP_GET_EXP // ǿƶ131-140飬131ǰ60000 +//#define _MM_NO_JIAOBEN // ֹMMű +#define _CHANGE_PETNAME_FIX // ޸ݻBUG +#define _DP_ZHIPIAO_ITEM // DP֧Ʊ +#define _DP_140_160_MODE // ȡԭDPģʽΪ14010W160100W +//#define _NPC_RAND_MSG // NPCм֤Ӽж +#define _PETSKILL_NONO_FIX // ޸\صBUG +#define _LOOK_STREET_TIME // ̯ʱ䣬ֹ̯ +#define _BATTLE_EQUIT_OTHER // սǷɻԼƷ +#define _PK_LUCK_MAN // PK˶ +#define _SUPERMAN_FIX // Ʒ˵ʱ +#define _DROPITEM_COLOR // ʧĵ߸ıɫ +#define _ALL_RANDMODE // ű֤ģʽ +#define _PICKUP_ITEM_OTHER // ӵߺǷֻԼȡ +#define _FM_LIAOLI // ͿԼ +#define _TRADE_ITEM_FIX // ̯ʱʾʵ +#define _PETMAIL_TIME // ʼԶʱ䣨Ҳdzݣ +#define _GJS_TYPE // ⾵ǷԶԶԷʹ +#define _PET_BINDING // 󶨣*ֵijﲻܽףӳ̯ +//#define _NOT_PETRIDE // ƣ*ֵijﲻˣ +#define _BATTLEEND_FIX // ͼս˳ʱ䱣120 +#define _BIG_POOL_TYPE // ֻֿȡԴ +#define _ONLINENUM_FIX // ͻ1024 +#define _FLOOR_PARTY_CTRL // ָͼ +#define _NO_RIDE_ID // CFָﲻҪ֤ +#define _STREET_FAX // ̯˰ +#define _XC_CANGKU // ֿ +#endif + +//1717sq------------------------------------------ +//ABLUA------------------------------------------- +#define _ALLBLUES_LUA // ʹLUAű +#ifdef _ALLBLUES_LUA + #define _ALLBLUES_LUA_1_1 + #define _ALLBLUES_LUA_1_2 + #define _ALLBLUES_LUA_1_3 + #define _ALLBLUES_LUA_1_4 + #define _ALLBLUES_LUA_1_5 + #define _ALLBLUES_LUA_1_6 + #define _ALLBLUES_LUA_1_7 + #define _ALLBLUES_LUA_1_8 + #define _ALLBLUES_LUA_1_9 + #define _ALLBLUES_LUA_2_0 // LUA2.0 +#endif + +#define _NEW_CurrencyShow // µĻʾ +#define _CAMEO_MONEY // ֧ABֶ +#define _MISSION_TRAIN // ֧ABֶ +#define _PET_EVOLVE // ֧ABֶ +#define _FLOOR_DIFI_FIELD // ֧AB¥ֶ +#define _MISSION_TIME // ֧ABʱֶ +#define _PLAYER_TITLE // ֧ABƺŵȼֶ +#define _COWRIE // ֧ABֶ +#define _ONLINE_TIME // ֧ABʱֶ +#define _SPECIAL_COUNTER // ֧ABֶ +#define _SPECIAL_TIMER // ֧ABʱֶ +#define _setVipPointForCdkey // ֧ABsetVipPointForCdkeySQL(setVipPointgetVipPoint֧) +#define _VIP_BATTLE_EXP // Աս޸IJ +#define _ALLBLUES_LUA_NEWADD // ӵABLUAӿ +#ifdef _ALLBLUES_LUA_NEWADD + #define _AutoBattle_LUA // ԭ +#endif + + +//˽汾---------------------------------------- +#define _SA80 +#ifdef _SA80 +//#define _TEST +#ifndef _TEST +//#define _DEFAULT_PKEY "17csajkjz" // ( ʯ 8.0 ) +//#define _RUNNING_KEY "20081026" // ( ʯ 8.0 ) +//#define _SA_VERSION 'C' +#define _DEFAULT_PKEY "www.longzoro.com" // ( ʯ 8.0 ) +#define _RUNNING_KEY "www.longzoro.com" // ( ʯ 8.0 ) +#define _SA_VERSION 'L' +#define _ITEM_TYPETABLE // (ɿ) Change ׷typetable +#define _RIGHTCLICK // Robin Ҽ +#define _JOBDAILY // cyg ־ +#define _ALCHEMIST // Robin +#define _TEACHER_SYSTEM // ʦϵͳ() +#define _PET_ITEM // װ +#else +#define _SA_VERSION 'F' +#define _DEFAULT_PKEY "upupupupp"// ( ʯ 7.5 ) +#define _RUNNING_KEY "20060707" // ( ʯ 7.5 ) +#endif +#define SERVER_VERSION "GMSV-v1.0.0" +#else +//#define _SA75 +#ifdef _SA75 +#define _DEFAULT_PKEY "ttttttttt"// ( ʯ 7.5 ) +#define _RUNNING_KEY "20041215" // ( ʯ 7.5 ) +#else +#define _DEFAULT_PKEY "upupupupp"// ( ʯ 7.5 ) +#define _RUNNING_KEY "20060427" // ( ʯ 7.5 ) +#define _SA_VERSION_80 // ʯʱ8.0 İ汾 +#endif +#define _SA_VERSION 'F' +#define _FIX_FM_FMPOINT // ޸ļݵʾʽ +#define SERVER_VERSION "GMSV-v1.0.0" +#endif + +#define _JZ_NEWSCRIPT_LUA // LUAű + +//⹦ܿ---------------------------------------- +#define _YUANGUSA +#define _FreeServerVersion // Ź +#ifdef _FreeServerVersion + #define _NOT_POJIE // GM + #define _LUA_RootSSH // LUAȡroot(1717sqʾ:лʹõ) +#endif + + +//#define _DEBUG // +//#define _TEST_SERVER // Է +#endif + +#define _17CSA_VERSION "8002" +//#define _17CSA_YANZHENG //ǿ֤ diff --git a/include/version_pk.h b/include/version_pk.h new file mode 100644 index 0000000..dd5b101 --- /dev/null +++ b/include/version_pk.h @@ -0,0 +1,9 @@ +#ifndef _PKSERVER_VERSION_H_ +#define _PKSERVER_VERSION_H_ + +//#define _PKSEVER_VER // (ɿ) ϵpkŷ + +// +// +//ּ +#endif diff --git a/include/vssver.scc b/include/vssver.scc new file mode 100644 index 0000000000000000000000000000000000000000..2902d887cbdc13ea4e8d2a79cd8dea725b0c74a3 GIT binary patch literal 685 zcmYL{%PWLY7{=%GxlCU(GOo$yF-aCkjLEe|`pErSB4J@rBvz7ZN~Ec2a_JbCru+l$ zw_G+BN+~JDf>@ZMEUYY@!#iir=IeK!=REKE-uKv|6+`arc>yq1a&_4Y%mHSt2Yea+ zmiP)X&I6%*NAL{iA*GC|#Ix>VEv2B8X~ag~>gnVodN18nxP2;$@od-dw+zGaBGrNON2yZ~*3%KwFx-DeTO z;>oZw{jt4}Ho?M(9bO?%F(Yxeg;iS0fobCLn-lBanaTnUsOjHG-`fG=NY}Fxosms( zY?;`1|2_#M${$P>@nK1_zI#P%K<4RcUagID2%UG;oE>}fc>=L8^CrqXV0mf1(Z)OIvSAhOtF3MSd~3bb7Xj<1zmRwg__`6HLADM!f&*?68Xr;MK2HzY#d#7C72*N!(JOBWF;ECxK1x4-hY8o;!Ft)9 IRpMFx0=<-gTL1t6 literal 0 HcmV?d00001 diff --git a/init.c b/init.c new file mode 100644 index 0000000..89a0d9c --- /dev/null +++ b/init.c @@ -0,0 +1,814 @@ +#include "version.h" +#include +#include +#include +#include + + +#include "configfile.h" +#include "util.h" +#include "net.h" +#include "msignal.h" +#include "buf.h" +#include "object.h" +#include "char.h" +#include "char_data.h" +#include "item.h" +#include "readmap.h" +#include "function.h" +#include "saacproto_cli.h" +#include "lssproto_serv.h" +#include "readnpc.h" +#include "log.h" +#include "handletime.h" +#include "title.h" +#include "encount.h" +#include "enemy.h" +#include "battle.h" +#include "magic_base.h" +#include "pet_skill.h" +#include "item_gen.h" +#include "petmail.h" +#include "npc_quiz.h" +#ifdef _ALLBLUES_LUA +#include "mylua/mylua.h" +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#endif + +#ifdef _ITEM_QUITPARTY +#include "init.h" +//int itemquitparty_num = 0; +//static DisappearItem *Disappear_Item; +#endif + +#define MESSAGEFILE "hoge.txt" + +#define OPTIONSTRING "d:f:h" +#define usage() print( "Usage: %s ["OPTIONSTRING"]\n", getProgname() ); +extern int yzflg; +void printUsage( void ) +{ + usage(); + /*print( "Usage: %s ["OPTIONSTRING"]\n", progname );*/ + print( " [-d debuglevel] default value is 0\n" ); + print( " [-f configfilename] default value is setup.cf\n" + ); +} + +/* + * + * ¦ + * ߯Ի + * TRUE(1) ئѨ̼¦ѷ + * FALSE(0) ئѨ̼¦ѷ + */ +BOOL parseCommandLine( int argc , char** argv ) +{ + int c; /* getopt ƥ */ + extern char* optarg; /* getopt ƥ */ + + + while( ( c = getopt( argc, argv ,OPTIONSTRING )) != -1 ){ + switch( c ){ + case 'd': + { + int debuglevel; + if( !strtolchecknum( optarg, (int*)&debuglevel, 10, + INT)){ + print( "Specify digit number\n" ); + return FALSE; + } + setDebuglevel( debuglevel ); + break; + } + case 'f': + setConfigfilename( optarg ); + break; + case 'h': + printUsage(); + return FALSE; + break; + + default: + printUsage(); + return FALSE; + break; + + } + } + return TRUE; +} + + +/* + * ¦ + * + * ἰئ + */ +BOOL parseEnvironment( char** env ) +{ + if( getDebuglevel() >= 3 ){ + int index=0; + while( env[index] != NULL )print( "%s " , env[index++] ); + print( "\n" ); + } + return TRUE; +} + + + + +#define LSGENWORKINGBUFFER 65536*4 + + + +#define GOTORETURNFALSEIFFALSE(x) if(!(x))goto RETURNFALSE +/* + * + * ¦ + * argc argv + * argv Ѩ̼¦ + * ߯Ի + */ +BOOL init(int argc , char** argv , char** env ) +{ +#ifdef _ITEM_QUITPARTY + FILE *f; + int i; + char line[256]; +#endif + srand( getpid()); + print( "This Program is compiled at %s %s by gcc %s\n", + __DATE__ , __TIME__ , __VERSION__ ); + + defaultConfig( argv[0] ); + signalset(); + + GOTORETURNFALSEIFFALSE(parseCommandLine( argc , argv )); + GOTORETURNFALSEIFFALSE(parseEnvironment( env )); + + { + Char aho; + debug( sizeof( aho ), d); + debug( sizeof( aho.data ), d); + debug( sizeof( aho.string ), d); + debug( sizeof( aho.flg ),d); + debug( sizeof( aho.indexOfExistItems ), d); + debug( sizeof( aho.haveSkill ), d); + debug( sizeof( aho.indexOfHaveTitle ), d); + debug( sizeof( aho.addressBook ),d); + debug( sizeof( aho.workint ),d); + debug( sizeof( aho.workchar ),d); + } + + print( "ļ: %s\n" , getConfigfilename() ); + + GOTORETURNFALSEIFFALSE(readconfigfile( getConfigfilename() ) ); + + nice(getrunlevel()); + //ttom start + { int iWork = setEncodeKey(); + if( iWork == 0 ){ + // ޼ƽëɬ + printf( "----------------------------------------\n" ); + printf( "-------------[] ޷ %s\n", getConfigfilename() ); + printf( "----------------------------------------\n" ); + exit( 1 ); + }else{ + // ޼ƽëɬ + printf( " = %d\n", iWork ); + } + } + // AcWBuffëɬ + { int iWork = setAcWBSize(); + if( iWork == 0 ){ + printf( "----------------------------------------\n" ); + printf( "-------------[AC] ޷ %s\n", getConfigfilename() ); + printf( "----------------------------------------\n" ); + exit( 1 ); + }else{ + printf( "AC = %d\n", iWork ); + } + } + //ttom end + + if( getDebuglevel() >= 1 ){ +// print("ServerType: %d\n", getServerType() ); + print("Եȼ: %d\n", getDebuglevel() ); + print("еȼ: %d\n", getrunlevel() ); + print("ջ: %d\n", getrecvbuffer()*1024); + print("ͻ: %d\n", getsendbuffer()*1024); + print("ջ: %d\n", getrecvlowatbuffer()); + print("ڴ浥ԪС: %d\n", getMemoryunit() ); + print("ڴ浥Ԫ: %d\n", getMemoryunitnum() ); + + print("˺ŷַ: %s\n", getAccountservername() ); + print("˺ŷ˿: %d\n", getAccountserverport() ); + print("½: %s\n", + getGameservername()); + print("½: %s\n", getAccountserverpasswd()); + + print("ȴӶ˿: %d\n", getPortnumber() ); + + print("к: %d\n", getServernumber() ); + + print("ظַʹ: %d\n", getReuseaddr() ); + + + print(": %d\n", getFdnum() ); + print("߳: %d\n", getPetcharnum() ); + print("Ŀ: %d\n", getOtherscharnum() ); + print("Ŀ: %d\n", getObjnum() ); + print("ƷĿ: %d\n", getItemnum() ); + print("սĿ: %d\n", getBattlenum() ); + print("ļĿ¼: %s\n", getTopdir()); + print("ͼļĿ¼: %s\n", getMapdir()); + print("ͼʶļ: %s\n", getMaptilefile()); + print("Ʒļ: %s\n", getItemfile()); + print("սļ: %s\n", getInvfile()); + print("ʾλļ: %s\n", getAppearfile()); + print("ļ: %s\n", getEffectfile()); + print("ͷļ: %s\n", getTitleNamefile()); + print("ͷļ: %s\n", getTitleConfigfile()); + print("ļ: %s\n", getEncountfile()); + print("Ⱥļ: %s\n", getGroupfile()); + print("ļ: %s\n", getEnemyBasefile()); + print("ļ: %s\n", getEnemyfile()); + print("ħļ: %s\n", getMagicfile()); + +#ifdef _ATTACK_MAGIC + print("ħļ: %s\n", getAttMagicfileName() ); +#endif + + print("\ļ: %s\n", getPetskillfile()); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + print("ְҵļ: %s\n", getProfession()); +#endif + + print("Ʒɷļ: %s\n", getItematomfile()); + print("ļ: %s\n", getQuizfile()); +#ifdef _GMRELOAD + print("G M ļ: %s\n", getGMSetfile()); +#endif + print("־¼ļ: %s\n", getLsgenlogfilename() ); + print("ԭĿ¼: %s\n", getStoredir()); + print("NPC Ŀ¼: %s\n", getNpcdir()); + print("־ļ: %s\n", getLogdir()); + print("־ļ: %s\n", getLogconffile() ); + print("GMָ: %s\n", getChatMagicPasswd() ); + print("ʹGMȨ: %d\n", getChatMagicCDKeyCheck() ); + + print("NPC ģĿ: %d\n", getNpctemplatenum() ); + print("NPC Ŀ: %d\n", getNpccreatenum() ); + + print("·ʱ: %d\n", getWalksendinterval()); + print("м: %d\n", getCAsendinterval_ms()); + print("Ŀ: %d\n", getCDsendinterval_ms()); + print("ִһʱ: %d\n", getOnelooptime_ms()); + print("ʱ: %d\n", getPetdeletetime()); + print("ʱ: %d\n", getItemdeletetime()); +#ifdef _DEL_DROP_GOLD + print("ʯʱ: %d\n", getGolddeletetime()); +#endif + print("ݱ: %d\n", getCharSavesendinterval()); + + print("ƬĿ: %d\n", getAddressbookoffmsgnum()); + print("ȡƵЭ: %d\n" ,getProtocolreadfrequency()); + + print("Ӵ: %d\n", getAllowerrornum()); +#ifdef _GET_BATTLE_EXP + print("ս鱶: %d\n", getBattleexp() ); +#endif +#ifdef _NEW_PLAYER_CF + print("ת: %dת\n", getNewplayertrans()); + print("ȼ: %d\n", getNewplayerlv()); + print("Ǯ: %d S\n", getNewplayergivegold()); + print("ȼ: %d\n", getNewplayerpetlv()); +#ifdef _VIP_SERVER + print("ӵе: %d\n", getNewplayergivevip()); +#endif + print("ȼ: %d\n", getRidePetLevel()); +#ifdef _NEW_PLAYER_RIDE + print(": %s\n", getPlayerRide()); +#endif + print("ӵг: NO1:%d NO2:%d NO3:%d NO4:%d NO5:%d\n",getNewplayergivepet(0), + getNewplayergivepet(1), + getNewplayergivepet(2), + getNewplayergivepet(3), + getNewplayergivepet(4)); + print("ӵƷ: ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n" + "ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n" + "ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n" + ,getNewplayergiveitem(0) + ,getNewplayergiveitem(1) + ,getNewplayergiveitem(2) + ,getNewplayergiveitem(3) + ,getNewplayergiveitem(4) + ,getNewplayergiveitem(5) + ,getNewplayergiveitem(6) + ,getNewplayergiveitem(7) + ,getNewplayergiveitem(8) + ,getNewplayergiveitem(9) + ,getNewplayergiveitem(10) + ,getNewplayergiveitem(11) + ,getNewplayergiveitem(12) + ,getNewplayergiveitem(13) + ,getNewplayergiveitem(14)); +#endif +#ifdef _UNREG_NEMA + print("ֹ: 1:%s 2:%s 3:%s 4:%s 5:%s\n",getUnregname(0), + getUnregname(1), + getUnregname(2), + getUnregname(3), + getUnregname(4)); +#endif +#ifdef _UNLAW_WARP_FLOOR + print("ֹ͵ͼ: ͼ1:%d ͼ2:%d ͼ3:%d ͼ4:%d ͼ5:%d\n" + " ͼ1:%d ͼ2:%d ͼ3:%d ͼ4:%d ͼ5:%d\n",getUnlawwarpfloor(0), + getUnlawwarpfloor(1), + getUnlawwarpfloor(2), + getUnlawwarpfloor(3), + getUnlawwarpfloor(4), + getUnlawwarpfloor(5), + getUnlawwarpfloor(6), + getUnlawwarpfloor(7), + getUnlawwarpfloor(8), + getUnlawwarpfloor(9)); +#endif +#ifdef _WATCH_FLOOR + print("Ƿȫͼս: %s\n",getWatchFloorCF()); + if(strcmp(getWatchFloorCF(),"")) + print("սͼ: ͼ1:%d ͼ2:%d ͼ3:%d ͼ4:%d ͼ5:%d\n",getWatchFloor(1), + getWatchFloor(2), + getWatchFloor(3), + getWatchFloor(4), + getWatchFloor(5)); +#endif + +#ifdef _BATTLE_FLOOR + print("Ƿǿս: %s\n",getBattleFloorCF()); + if(strcmp(getBattleFloorCF(),"")) + print("ǿսͼ: ͼ1:%d ͼ2:%d ͼ3:%d ͼ4:%d ͼ5:%d\n",getBattleFloor(1), + getBattleFloor(2), + getBattleFloor(3), + getBattleFloor(4), + getBattleFloor(5)); +#endif + +#ifdef _TRANS_LEVEL_CF + print("ȼת: %d\n",getChartrans()); + print("ȼת: %d\n",getPettrans()); +#endif + +#ifdef _POINT + print("ֹ: %s\n",getPoint()); + if(strcmp(getPoint(),"")) + print("ÿת: 0ת:%d 1ת:%d 2ת:%d 3ת:%d 4ת:%d 5ת:%d 6ת:%d\n",getTransPoint(0), + getTransPoint(1), + getTransPoint(2), + getTransPoint(3), + getTransPoint(4), + getTransPoint(5), + getTransPoint(6)); +#endif +//#ifdef _PET_UP +// print("ܷ: %s\n",getPetup()); +//#endif +#ifdef _LOOP_ANNOUNCE + print("ѭ·: %s\n",getLoopAnnouncePath()); + print("ѭʱ: %d\n",getLoopAnnounceTime()); +#endif +#ifdef _SKILLUPPOINT_CF + print("ÿ: %d\n",getSkup()); +#endif + +#ifdef _RIDELEVEL + print("ȼ: %d\n",getRideLevel()); +#endif +#ifdef _REVLEVEL + print("ԭ޵ȼ: %s\n",getRevLevel()); +#endif +#ifdef _TRANS_LEVEL_CF + print("һȼ: %d\n",getYBLevel()); + print("ߵȼ: %d\n",getMaxLevel()); +#endif +#ifdef _FIX_CHARLOOPS + print("ħʱ䱶: %d\n",getCharloops()); +#endif +#ifdef _PLAYER_ANNOUNCE + if(getPAnnounce()==-1) + print("ĵ: رʹ\n"); + else + print("ĵ: %d\n",getPAnnounce()); +#endif +#ifdef _PLAYER_MOVE + if(getPMove()==-1) + print("˳ĵ: رʹ\n"); + else + print("˳ĵ: %d\n",getPMove()); +#endif +#ifdef _BATTLE_GOLD + print("սýǮ: %d%\n",getBattleGold()); +#endif +#ifdef _ANGEL_TIME + print("ٻʱ: (%d/)\n",getAngelPlayerTime()); + print("ٻ: %d\n",getAngelPlayerMun()); +#endif +#ifdef _RIDEMODE_20 + print("2.0 ģʽ: %d\n",getRideMode()); +#endif +#ifdef _FM_POINT_PK + print("ׯ԰ģʽ: %s\n",getFmPointPK()); +#endif +#ifdef _CAX_ESC_REPORT + print("ͨԱǩ: ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n" + ,getReportItem(0) + ,getReportItem(1) + ,getReportItem(2) + ,getReportItem(3) + ,getReportItem(4)); + print("VIP Աǩ: ITEM1:%d ITEM2:%d ITEM3:%d ITEM4:%d ITEM5:%d\n" + ,getVipReportItem(0) + ,getVipReportItem(1) + ,getVipReportItem(2) + ,getVipReportItem(3) + ,getVipReportItem(4)); +#endif + } + + { //andy_add 2003/05/05 check GameServer Name + char *GameServerName; + GameServerName = getGameserverID(); + if( GameServerName == NULL || strlen( GameServerName) <= 0 ) + return FALSE; + print("\nϷID: %s\n", GameServerName ); + } + print("ʼʼ\n" ); + #ifdef _TRANS_7_COLOR + if(getping()) + { + print("ʾ\n"); + system("echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all"); + }else + { + print("ʾ\n"); + system("echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"); + } +#endif +//#define DEBUG1( arg... ) if( getDebuglevel()>1 ){##arg} + print( "ڴռ..." ); + GOTORETURNFALSEIFFALSE(configmem( getMemoryunit(), + getMemoryunitnum() ) ); + GOTORETURNFALSEIFFALSE(memInit()); + print( "\n" ); + + print( "ʼջӿռ..." ); + if( !initConnect(getFdnum()) ) + goto MEMEND; + print( "\n" ); + while( 1 ){ + print( "԰󶨱ض˿ %d... " , getPortnumber()); + bindedfd = bindlocalhost( getPortnumber() ); + if( bindedfd == -1 ) + sleep( 10 ); + else + break; + } + print( "\n" ); + + print( "..." ); + if( !initObjectArray( getObjnum()) ) + goto CLOSEBIND; + print( "\n" ); + + print( "..." ); +#ifdef _OFFLINE_SYSTEM + if(!CHAR_initCharArray( getPlayercharnum(), getPetcharnum(),getOtherscharnum()) ) +#else + if(!CHAR_initCharArray( getFdnum(), getPetcharnum(),getOtherscharnum()) ) +#endif + goto CLOSEBIND; + print( "\n" ); + print( "Ʒ..."); + if(!ITEM_readItemConfFile( getItemfile()) ) + goto CLOSEBIND; + if(!ITEM_initExistItemsArray( getItemnum() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ս..." ); + if(!BATTLE_initBattleArray( getBattlenum() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ģ..." ); + if( !initFunctionTable() ) + goto CLOSEBIND; + print( "\n" ); + +// print("ʼ˺Űȫ..."); +// if( !cdkeyinit() ) +// goto CLOSEBIND; +// print( "\n" ); + + print( "ʼʼ..." ); + if( !PETMAIL_initOffmsgBuffer( getAddressbookoffmsgnum() )) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡսļ..." ); + if( !CHAR_initInvinciblePlace( getInvfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡʾλļ..." ); + if( !CHAR_initAppearPosition( getAppearfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡͷļ..." ); + if( !TITLE_initTitleName( getTitleNamefile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡͷļ..." ); + if( !TITLE_initTitleConfig( getTitleConfigfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡļ..." ); + if( !ENCOUNT_initEncount( getEncountfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡļ..." ); + if( !ENEMYTEMP_initEnemy( getEnemyBasefile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡļ..." ); + if( !ENEMY_initEnemy( getEnemyfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + print( "ȡȺļ..." ); + if( !GROUP_initGroup( getGroupfile() ) ) + goto CLOSEBIND; + print( "\n" ); + print( "ȡħļ..." ); + if( !MAGIC_initMagic( getMagicfile() ) ) + goto CLOSEBIND; + print( "\n" ); + + #ifdef _ATTACK_MAGIC + + print( "ȡħļ..." ); + + if( !ATTMAGIC_initMagic( getAttMagicfileName() ) ) +// if( !ATTMAGIC_initMagic( getMagicfile() ) ) + goto CLOSEBIND; + + print( "ħļ -->%s..." , getAttMagicfileName()); + print( "\n" ); + + #endif + + print( "ȡ\ļ..." ); + if( !PETSKILL_initPetskill( getPetskillfile() ) ) + goto CLOSEBIND; + print( "\n" ); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + print( "ȡְҵļ..." ); + if( !PROFESSION_initSkill( getProfession() ) ){ + goto CLOSEBIND; + } + print( "\n" ); +#endif + + /* ʧ ة ë */ + print( "ȡƷɷļ..." ); + if( !ITEM_initItemAtom( getItematomfile()) ) + goto CLOSEBIND; + print("\n" ); + + print( "ʼϳƷ..." ); + if( !ITEM_initItemIngCache() ) + goto CLOSEBIND; + print("\n" ); + + print( "ʼϳ趨..." ); + if( !ITEM_initRandTable() ) + goto CLOSEBIND; + print("\n" ); + + print( "ȡļ..." ); + if( !CHAR_initEffectSetting( getEffectfile() ) ) + goto CLOSEBIND; + print( "\n" ); + print( "ȡļ..." ); + if( !QUIZ_initQuiz( getQuizfile() ) ) + goto CLOSEBIND; + print( "\n" ); +#ifdef _GMRELOAD + print( "ȡGMļ..." ); + if ( !LoadGMSet( getGMSetfile() ) ) + goto CLOSEBIND; + print( "\n" ); +#endif +#ifdef _UNTEXT_TALK + print("ȡֹؼļ..."); + if(!LoadUnText()) + goto CLOSEBIND; + print( "\n" ); +#endif +#ifdef _USER_EXP_CF + print( "ȡļ..." ); + if ( !LoadEXP( getEXPfile() ) ) + goto CLOSEBIND; + print("ߵȼ: %d...",getMaxLevel()); + print("һȼ: %d...",getYBLevel()); + print( "\n" ); +#endif + +#ifdef _ANGEL_SUMMON + print("ȡٻбļ..."); + if( !LoadMissionList( ) ) + goto CLOSEBIND; + print("\n"); +#endif + +#ifdef _JOBDAILY + print("ȡ־ļ..."); + if(!LoadJobdailyfile()) + print("...ʧ\n"); + else + print("\n"); +#endif + +#ifdef _LOOP_ANNOUNCE + print("ȡѭļ..."); + if(!loadLoopAnnounce()) + print("...ʧ\n"); + else + print("\n"); +#endif +#ifdef _RIDE_CF + print( "ȡԶļ..." ); + if(!CHAR_Ride_CF_init()) + print("...ʧ\n"); + print("\n"); +#endif +#ifdef _FM_LEADER_RIDE + print( "ȡׯ԰峤רļ..." ); + if(!CHAR_FmLeaderRide_init()) + print("...ʧ\n"); + print("\n"); +#endif +#ifdef _RE_GM_COMMAND + print( "ԶGMļ..." ); + if(!re_gm_command()) + print("...ʧ\n"); + print("\n"); +#endif +#ifdef _NEED_ITEM_ENEMY + print( "ȡץҪƷļ..." ); + if(!need_item_eneny_init()) + print("...ʧ\n"); + print("\n"); +#endif + print( "ͼ..." ); + if( !MAP_initReadMap( getMaptilefile() , getMapdir() )) + goto CLOSEBIND; + print( "\n" ); + print( "ȡNPCļ..." ); + if( !NPC_readNPCSettingFiles( getNpcdir(), getNpctemplatenum(), + getNpccreatenum() ) ) + goto CLOSEBIND; + print( "\n" ); + print( "ʼ NPC ... " ); + if( lssproto_InitServer( lsrpcClientWriteFunc, LSGENWORKINGBUFFER ) < 0 ) + goto CLOSEBIND; + print( "\n" ); + print( "˺ŷ... " ); + acfd = connectHost( getAccountservername(), getAccountserverport()); + if(acfd == -1) + goto CLOSEBIND; + +/* + { + int errorcode; + int errorcodelen; + int qs; + + errorcodelen = sizeof(errorcode); + qs = getsockopt( acfd, SOL_SOCKET, SO_RCVBUF , &errorcode, &errorcodelen); + //andy_log + print("\n\n GETSOCKOPT SO_RCVBUF: [ %d, %d, %d] \n", qs, errorcode, errorcodelen); + } +*/ + + print( "\n" ); + initConnectOne( acfd, NULL , 0 ); + if( !CONNECT_acfdInitRB( acfd)) goto CLOSEAC; + if( !CONNECT_acfdInitWB( acfd)) goto CLOSEAC; + CONNECT_setCtype( acfd, AC ); + + print( "ʼ NPC ͻ ... " ); + /* rpc(client) */ + if( saacproto_InitClient( lsrpcClientWriteFunc,LSGENWORKINGBUFFER, acfd) < 0) + goto CLOSEAC; + print( "\n" ); + + print( "˺ŷ͵½... " ); + /* ̼ۢë */ + { + char buff[50]; +#ifdef _TEST_SERVER + sprintf(buff,"ziyunjack8-%s-%d",getAccountserverpasswd(),987); + saacproto_ACServerLogin_send(acfd, getGameservername(), buff); +#else + sprintf(buff,"ziyunjack8-%s-%d",getAccountserverpasswd(),789); + saacproto_ACServerLogin_send(acfd, getGameservername(), buff); +#endif + } + print( "\n" ); + // if (strcmp(getlocaltime(), TimeLimitLocal)>0)exit(0); + if( isExistFile( getLsgenlogfilename() ) ){ + lssproto_SetServerLogFiles( getLsgenlogfilename(), + getLsgenlogfilename() ); + saacproto_SetClientLogFiles( getLsgenlogfilename(), + getLsgenlogfilename() ); + } + + + print( "ʼ\n" ); + + print( "ʼʼ־\n" ); + { + char logconffile[512]; + snprintf( logconffile, sizeof( logconffile), "%s/%s" , + getLogdir(), getLogconffile() ); + if( !initLog( logconffile ) ) + goto CLOSEAC; + } +#ifdef _PET_ITEM + restoreObjects( getStoredir() ); +#endif +#ifdef _ITEM_QUITPARTY + print( "ȡɢƷʧļ..." ); + + //ȡ + f = fopen( getitemquitparty(), "r" ); + if( f != NULL ){ + while( fgets( line, sizeof( line ), f ) ){ + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + itemquitparty_num++; + } + if( fseek( f, 0, SEEK_SET ) == -1 ){ + print( "Ʒ¼Ҵ\n" ); + fclose(f); + goto CLOSEAC; + } + // + Disappear_Item = allocateMemory( sizeof(struct tagDisappearItem) * itemquitparty_num ); + if( Disappear_Item == NULL ){ + print( "޷ڴ %d\n", sizeof(struct tagDisappearItem) * itemquitparty_num ); + fclose( f ); + goto CLOSEAC; + } + + i = 0; + //߱Ŵ Disappear_Item.string + while( fgets( line, sizeof( line ), f ) ){ + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + sprintf( Disappear_Item[i].string,"%s",line ); + print("\n߱:%s", Disappear_Item[i].string ); + i++; + } + fclose(f); + } +#endif + + DEBUG_ADJUSTTIME = 0; + print( "\n" ); + return TRUE; + +CLOSEAC: + close( acfd ); +CLOSEBIND: + close( bindedfd ); + endConnect(); +MEMEND: + memEnd(); +RETURNFALSE: + return FALSE; +} + diff --git a/item/item.c b/item/item.c new file mode 100644 index 0000000..e3d4364 --- /dev/null +++ b/item/item.c @@ -0,0 +1,2402 @@ +#include "version.h" +#include +#include +#include +#include +#include +#include "common.h" +#include "char.h" +#include "char_data.h" +#include "battle.h" +#include "item.h" +#include "buf.h" +#include "function.h" +#include "magic_base.h" + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#endif +#ifdef _ALLBLUES_LUA_1_2 +ITEM_LuaFunc ITEM_luaFunc; +#endif + +static int ITEM_tblen = 0; +static ITEM_exists* ITEM_item; +static int ITEM_itemnum; +static int ITEM_UseItemnum=0; +static char* ITEM_checkString( char* string ); +static int ITEM_getRandomValue( char* string,int* randomwidth, int num ); +static int ITEM_isstring1or0( char* string,int* randomwidth, int num ); + +#ifdef _SIMPLIFY_ITEMSTRING +typedef struct ITEM_tag_intDataSetting +{ + char* dumpchar; + int defaults; + int table; +}ITEM_intDataSetting; + +typedef struct ITEM_tag_charDataSetting +{ + char* dumpchar; + char* defaults; + int table; +}ITEM_charDataSetting; + +static ITEM_intDataSetting ITEM_setintdata[]={ + {"id", 0, ITEM_ID }, + {"bi", 0, ITEM_BASEIMAGENUMBER }, + {"cs", 0, ITEM_COST }, + {"ep", ITEM_OTHER, ITEM_TYPE }, + {"ft", 0, ITEM_ABLEUSEFIELD }, + {"tg", 0, ITEM_TARGET }, + {"lv", 0, ITEM_LEVEL }, +#ifdef _ITEM_MAXUSERNUM + {"dib", -1, ITEM_DAMAGEBREAK }, +#endif +#ifdef _ITEMSET4_TXT + {"upin", 1, ITEM_USEPILENUMS }, + {"canpile", 0, ITEM_CANBEPILE }, + {"nestr", 0, ITEM_NEEDSTR }, + {"nedex", 0, ITEM_NEEDDEX }, + {"netra", 0, ITEM_NEEDTRANS }, + {"neprof", 0, ITEM_NEEDPROFESSION }, +#endif +#ifdef _TAKE_ITEMDAMAGE + {"dmce", 0, ITEM_DAMAGECRUSHE }, + {"mdmce", 0, ITEM_MAXDAMAGECRUSHE }, +#endif +#ifdef _ADD_DEAMGEDEFC + {"otdmag", 0, ITEM_OTHERDAMAGE }, + {"otdefc", 0, ITEM_OTHERDEFC }, +#endif +#ifdef _SUIT_ITEM + {"nsuit", 0, ITEM_SUITCODE }, +#endif + {"ann", 0, ITEM_ATTACKNUM_MIN }, + {"anx", 0, ITEM_ATTACKNUM_MAX }, + {"ma", 0, ITEM_MODIFYATTACK }, + {"md", 0, ITEM_MODIFYDEFENCE }, + + {"mh", 0, ITEM_MODIFYQUICK}, //ITEM_MODIFYHP }, ITEM_MODIFYQUICK + {"mm", 0, ITEM_MODIFYHP}, //ITEM_MODIFYMP }, ITEM_MODIFYHP + {"mq", 0, ITEM_MODIFYMP}, //ITEM_MODIFYQUICK }, ITEM_MODIFYMP + {"ml", 0, ITEM_MODIFYLUCK }, + {"mc", 0, ITEM_MODIFYCHARM }, + {"mv", 0, ITEM_MODIFYAVOID }, + {"mat", 0, ITEM_MODIFYATTRIB }, + {"mav", 0, ITEM_MODIFYATTRIBVALUE }, + {"mid", -1, ITEM_MAGICID }, + {"mpr", 0, ITEM_MAGICPROB }, + {"mu", 0, ITEM_MAGICUSEMP }, +#ifdef _ITEMSET5_TXT + {"arr", 0, ITEM_MODIFYARRANGE }, + {"seqce", 0, ITEM_MODIFYSEQUENCE }, + {"iapi", 0, ITEM_ATTACHPILE }, + {"hirt", 0, ITEM_HITRIGHT }, +#endif + +#ifdef _ITEMSET6_TXT + {"neguard", 0, ITEM_NEGLECTGUARD}, +#endif + {"mrf", 0, ITEM_MERGEFLG}, + {"itime", 0, ITEM_TIME}, +#ifdef _ITEM_COLOER + {"coloer", 0, ITEM_COLOER }, /* ITEM_COLOER */ +#endif +}; + +static ITEM_charDataSetting ITEM_setchardata[]={ + {"na", "", ITEM_NAME }, /* ITEM_NAME */ + {"sn", "", ITEM_SECRETNAME }, /* ITEM_SCRETNAME */ + {"en", "", ITEM_EFFECTSTRING }, /* ITEM_EFFECTSTRING */ + {"ar", "", ITEM_ARGUMENT }, /* ITEM_ARGUMENT */ +#ifdef _ITEM_INSLAY + {"acode", "", ITEM_TYPECODE }, /*ITEM_TYPECODE,*/ + {"inlaycode", "", ITEM_INLAYCODE}, /*ITEM_INLAYCODE,*/ +#endif + {"cdk", "", ITEM_CDKEY }, /* ITEM_CDKEY */ +#ifdef _ITEM_FORUSERNAMES + {"forname", "", ITEM_FORUSERNAME }, //ITEM_FORUSERNAME, + {"forcdkey", "", ITEM_FORUSERCDKEY }, //ITEM_FORUSERCDKEY +#endif + +#ifdef _ANGEL_SUMMON + {"mindex", "", ITEM_ANGELMISSION}, + {"angel", "", ITEM_ANGELINFO}, + {"hero", "", ITEM_HEROINFO}, +#endif + +#ifdef _UNIQUE_P_I + {"ucode", "", ITEM_UNIQUECODE}, /* ITEM_UNIQUECODE */ +#endif +}; + +static ITEM_charDataSetting ITEM_setmemdata={ + "", "", -1 /* ITEM_MEMO */ +}; + + +#else +typedef struct ITEM_tag_intDataSetting +{ + char* dumpchar; + int defaults; +}ITEM_intDataSetting; + +typedef struct ITEM_tag_charDataSetting +{ + char* dumpchar; + char* defaults; +}ITEM_charDataSetting; + +static ITEM_intDataSetting ITEM_setintdata[ITEM_DATAINTNUM]={ + {"id", 0}, /* ITEM_ID */ + {"bi", 0}, /* ITEM_ITEMBASEIMAGENUMBER */ + {"cs", 0}, /* ITEM_COST */ + {"ep", ITEM_OTHER}, /* ITEM_TYPE */ + {"ft", 0}, /* ITEM_ABLEUSEFIELD */ + {"tg", 0}, /* ITEM_TARGET */ + {"lv", 0}, /* ITEM_LEVEL */ + +#ifdef _ITEM_MAXUSERNUM + {"dib", -1}, /*ITEM_DAMAGEBREAK*/ +#endif + +#ifdef _ITEMSET4_TXT + {"upin", 1}, //ITEM_USEPILENUMS, + {"canpile", 0}, //ITEM_CANBEPILE + {"nestr", 0}, //ITEM_NEEDSTR, + {"nedex", 0}, //ITEM_NEEDDEX, + {"netra", 0}, //ITEM_NEEDTRANS, + {"neprof", 0}, //ITEM_NEEDPROFESSION, +#endif + +#ifdef _TAKE_ITEMDAMAGE + {"dmce", 0}, /*ITEM_DAMAGECRUSHE*/ + {"mdmce",0}, //ITEM_MAXDAMAGECRUSHE +#endif + +#ifdef _ADD_DEAMGEDEFC + {"otdmag", 0}, //ITEM_OTHERDAMAGE, + {"otdefc", 0}, //ITEM_OTHERDEFC, +#endif + +#ifdef _SUIT_ITEM + {"nsuit", 0}, //ITEM_SUITCODE, +#endif + {"ann", 0}, /* ITEM_ATTACKNUM_MIN */ + {"anx", 0}, /* ITEM_ATTACKNUM_MAX */ + {"ma", 0}, /* ITEM_MODIFYATTACK */ + {"md", 0}, /* ITEM_MODIFYDEFENCE */ + {"mh", 0}, /* ITEM_MODIFYHP */ + {"mm", 0}, /* ITEM_MODIFYMP */ + + {"mq", 0}, /* ITEM_MODIFYQUICK */ + + {"ml", 0}, /* ITEM_MODIFYLUCK */ + {"mc", 0}, /* ITEM_MODIFYCHARM */ + {"mv", 0}, /* ITEM_MODIFYAVOID */ + {"mat", 0}, /* ITEM_MODIFYATTRIB */ + {"mav", 0}, /* ITEM_MODIFYATTRIBVALUE */ + + {"mid", -1}, /* ITEM_MAGICID */ + {"mpr", 0}, /* ITEM_MAGICPROB */ + {"mu", 0}, /* ITEM_MAGICUSEMP */ +#ifdef _ITEMSET5_TXT + {"arr", 0}, /*ITEM_MODIFYARRANGE*/ + {"seqce", 0}, //ITEM_MODIFYSEQUENCE, + {"iapi", 0}, //ITEM_ATTACHPILE + {"hirt", 0}, //ITEM_HITRIGHT // +#endif + +#ifdef _ITEMSET6_TXT + {"neguard", 0}, //ITEM_NEGLECTGUARD +// {"bemerge", 0}, //ITEM_BEMERGE +#endif + {"mpo", 0}, /* ITEM_POISON */ + {"mpa", 0}, /* ITEM_PARALYSIS */ + {"msl", 0}, /* ITEM_SLEEP */ + {"mst", 0}, /* ITEM_STONE */ + {"mdr", 0}, /* ITEM_DRUNK */ + {"mco", 0}, /* ITEM_CONFUSION */ + + {"mcr", 0}, /* ITEM_CRITICAL */ + + {"ua", -1}, /* ITEM_USEACTION */ + {"drlo",FALSE}, /* ITEM_DROPATLOGOUT */ + {"valo",FALSE}, /* ITEM_VANISHATLOGOUT */ + {"ioed",TRUE}, /* ITEM_ISOVERED */ + {"cpm", TRUE}, /* ITEM_CANPETMAIL */ + {"cmf", TRUE}, /* ITEM_CANMERGEFROM */ + {"cmt", TRUE}, /* ITEM_CANMERGETO */ + + {"ingv0",0}, /* ITEM_INGVALUE0 */ + {"ingv1",0}, + {"ingv2",0}, + {"ingv3",0}, + {"ingv4",0}, + + {"ipt", 0}, /* ITEM_PUTTIME */ + {"ll", 0}, /* ITEM_LEAKLEVEL */ + {"mrf", 0}, /* ITEM_MERGEFLG */ + {"clv", 0}, /* ITEM_CRUSHLEVEL */ + + {"v1", 0}, /* ITEM_VAR1 */ + {"v2", 0}, /* ITEM_VAR2 */ + {"v3", 0}, /* ITEM_VAR3 */ + {"v4", 0}, /* ITEM_VAR4 */ + {"itime", 0}, +}; + +static ITEM_charDataSetting ITEM_setchardata[ITEM_DATACHARNUM]={ + {"na", ""}, /* ITEM_NAME */ + {"sn", ""}, /* ITEM_SCRETNAME */ + {"en", ""}, /* ITEM_EFFECTSTRING */ + {"ar", ""}, /* ITEM_ARGUMENT */ +#ifdef _ITEM_INSLAY + {"acode", ""}, /*ITEM_TYPECODE,*/ + {"inlaycode", ""}, /*ITEM_INLAYCODE,*/ +#endif + {"cdk", ""}, /* ITEM_CDKEY */ +#ifdef _ITEM_FORUSERNAMES + {"forname", ""}, //ITEM_FORUSERNAME, + {"forcdkey", ""}, //ITEM_FORUSERCDKEY +#endif +// CoolFish: 2001/10/11 +#ifdef _UNIQUE_P_I + {"ucode", ""}, /* ITEM_UNIQUECODE */ +#endif + {"ingn0", ""}, /* ITEM_INGNAME0 */ + {"ingn1", ""}, + {"ingn2", ""}, + {"ingn3", ""}, + {"ingn4", ""}, + + {"inif", ""}, /* ITEM_PREOVERFUNC */ + {"preof", ""}, /* ITEM_PREOVERFUNC */ + {"posof", ""}, /* ITEM_POSTOVERFUNC */ + {"wf", "ITEM_DeleteTimeWatched"}, /* ITEM_WATCHFUNC */ + {"usef", ""}, /* ITEM_USEFUNC */ + {"atchf", ""}, /* ITEM_ATTACH */ + {"dtchf", ""}, /* ITEM_DETACH */ + {"attaf", ""}, /* ITEM_ATTACKFUNC */ + {"pickupf", ""}, /* ITEM_PICKUPFUNC */ +#ifdef _Item_ReLifeAct + {"relifes", ""}, /*ITEM_DIERELIFEFUNC*/ +#endif +#ifdef _PICKUP_ITEM_OTHER + {"fromcd", ""}, +#endif + +}; + +static ITEM_charDataSetting ITEM_setmemdata={ + "", "" /* ITEM_MEMO */ +}; +#endif + +typedef enum +{ + ITEM_INTENTRY=0, + ITEM_CHARENTRY=1, + ITEM_INTFUNC=2, + ITEM_CHARFUNC=3, +}ITEM_DATATYPECATEGORY; + +static struct ITEM_itemconfentry +{ + char* entryname; + ITEM_DATATYPECATEGORY type; + int index; + void* func; +}ITEM_itemconfentries[]={ + {"name", ITEM_CHARFUNC, ITEM_NAME, ITEM_checkString}, + {"secretname", ITEM_CHARFUNC, ITEM_SECRETNAME, ITEM_checkString}, + {"effectstring",ITEM_CHARFUNC, ITEM_EFFECTSTRING, ITEM_checkString}, + {"argument", ITEM_CHARENTRY, ITEM_ARGUMENT, NULL}, +#ifdef _ITEM_INSLAY + {"acode", ITEM_CHARENTRY, ITEM_TYPECODE, NULL}, + {"inlaycode", ITEM_CHARENTRY, ITEM_INLAYCODE, NULL}, +#endif + {"initfunc", ITEM_CHARENTRY, ITEM_INITFUNC, NULL}, + {"preoverfunc", ITEM_CHARENTRY, ITEM_PREOVERFUNC, NULL}, + {"postoverfunc",ITEM_CHARENTRY, ITEM_POSTOVERFUNC, NULL}, + {"watchfunc", ITEM_CHARENTRY, ITEM_WATCHFUNC, NULL}, + {"usefunc", ITEM_CHARENTRY, ITEM_USEFUNC, NULL}, + {"attachfunc", ITEM_CHARENTRY, ITEM_ATTACHFUNC, NULL}, + {"detachfunc", ITEM_CHARENTRY, ITEM_DETACHFUNC, NULL}, + {"dropfunc", ITEM_CHARENTRY, ITEM_DROPFUNC, NULL}, + {"pickupfunc", ITEM_CHARENTRY, ITEM_PICKUPFUNC, NULL}, +#ifdef _Item_ReLifeAct + {"relifefunc", ITEM_CHARENTRY, ITEM_DIERELIFEFUNC, NULL}, +#endif + {"id", ITEM_INTENTRY, ITEM_ID, NULL}, + {"imagenumber", ITEM_INTENTRY, ITEM_BASEIMAGENUMBER, NULL}, + {"cost", ITEM_INTENTRY, ITEM_COST, NULL}, + {"type", ITEM_INTENTRY, ITEM_TYPE, NULL}, + {"fieldtype", ITEM_INTENTRY, ITEM_ABLEUSEFIELD, NULL}, + {"target", ITEM_INTENTRY, ITEM_TARGET, NULL}, + + {"level", ITEM_INTENTRY, ITEM_LEVEL, NULL}, +#ifdef _ITEM_MAXUSERNUM + {"dambreak", ITEM_INTENTRY, ITEM_DAMAGEBREAK, NULL}, +#endif + +#ifdef _ITEMSET4_TXT + {"upinums", ITEM_INTENTRY, ITEM_USEPILENUMS, NULL}, + {"campile", ITEM_INTENTRY, ITEM_CANBEPILE, NULL}, + {"nestr", ITEM_INTENTRY, ITEM_NEEDSTR, NULL}, + {"nedex", ITEM_INTENTRY, ITEM_NEEDDEX, NULL}, + {"netra", ITEM_INTENTRY, ITEM_NEEDTRANS, NULL}, + {"neprof", ITEM_INTENTRY, ITEM_NEEDPROFESSION, NULL}, +#endif + +#ifdef _TAKE_ITEMDAMAGE + {"damcrushe", ITEM_INTENTRY, ITEM_DAMAGECRUSHE, NULL}, + {"maxdmce", ITEM_INTENTRY, ITEM_MAXDAMAGECRUSHE, NULL}, +#endif + +#ifdef _ADD_DEAMGEDEFC + {"otdmags", ITEM_INTENTRY, ITEM_OTHERDAMAGE, NULL}, + {"otdefcs", ITEM_INTENTRY, ITEM_OTHERDEFC, NULL}, +#endif +#ifdef _SUIT_ITEM + {"nsuit", ITEM_INTENTRY, ITEM_SUITCODE, NULL}, //ITEM_SUITCODE, +#endif + {"attacknum_min",ITEM_INTENTRY, ITEM_ATTACKNUM_MIN, NULL}, + {"attacknum_max",ITEM_INTENTRY, ITEM_ATTACKNUM_MAX, NULL}, + {"attack", ITEM_INTFUNC, ITEM_MODIFYATTACK, ITEM_getRandomValue}, + {"defence", ITEM_INTFUNC, ITEM_MODIFYDEFENCE, ITEM_getRandomValue}, + {"quick", ITEM_INTFUNC, ITEM_MODIFYQUICK, ITEM_getRandomValue}, + + {"hp", ITEM_INTFUNC, ITEM_MODIFYHP, ITEM_getRandomValue}, + {"mp", ITEM_INTFUNC, ITEM_MODIFYMP, ITEM_getRandomValue}, + {"luck", ITEM_INTFUNC, ITEM_MODIFYLUCK, ITEM_getRandomValue}, + {"charm", ITEM_INTFUNC, ITEM_MODIFYCHARM, ITEM_getRandomValue}, + {"avoid", ITEM_INTFUNC, ITEM_MODIFYAVOID, ITEM_getRandomValue}, + {"attrib", ITEM_INTENTRY, ITEM_MODIFYATTRIB, NULL}, + {"attribvalue", ITEM_INTENTRY, ITEM_MODIFYATTRIBVALUE,NULL}, + + {"magicid", ITEM_INTENTRY, ITEM_MAGICID, NULL}, + {"magicprob", ITEM_INTENTRY, ITEM_MAGICPROB, NULL}, + {"magicusemp", ITEM_INTENTRY, ITEM_MAGICUSEMP, NULL}, +#ifdef _ITEMSET5_TXT + {"arr", ITEM_INTENTRY, ITEM_MODIFYARRANGE, NULL}, + {"seqce", ITEM_INTENTRY, ITEM_MODIFYSEQUENCE, NULL}, + {"iapi", ITEM_INTENTRY, ITEM_ATTACHPILE, NULL}, + {"hirt", ITEM_INTENTRY, ITEM_HITRIGHT, NULL}, +#endif +#ifdef _ITEMSET6_TXT + {"neguard", ITEM_INTENTRY, ITEM_NEGLECTGUARD, NULL}, +// {"bemerge", ITEM_INTENTRY, ITEM_BEMERGE, NULL}, +#endif +#ifdef _PETITEM__AMOI_E + {"petfix0", ITEM_INTENTRY, ITEM_PETFIX0, NULL}, + {"petfix1", ITEM_INTENTRY, ITEM_PETFIX1, NULL}, + {"petfix2", ITEM_INTENTRY, ITEM_PETFIX2, NULL}, + {"petfix3", ITEM_INTENTRY, ITEM_PETFIX3, NULL}, + {"petfix4", ITEM_INTENTRY, ITEM_PETFIX4, NULL}, + {"petfix5", ITEM_INTENTRY, ITEM_PETFIX5, NULL}, + {"petfix6", ITEM_INTENTRY, ITEM_PETFIX6, NULL}, + {"petfix7", ITEM_INTENTRY, ITEM_PETFIX7, NULL}, + {"petequitallow", ITEM_CHARENTRY, ITEM_PETEQUITALLOW, NULL}, + {"petequitforbit", ITEM_CHARENTRY, ITEM_PETEQUITFORBIT, NULL}, +#endif + {"poison", ITEM_INTFUNC, ITEM_POISON, ITEM_getRandomValue}, + {"paralysis", ITEM_INTFUNC, ITEM_PARALYSIS, ITEM_getRandomValue}, + {"sleep", ITEM_INTFUNC, ITEM_SLEEP, ITEM_getRandomValue}, + {"stone", ITEM_INTFUNC, ITEM_STONE, ITEM_getRandomValue}, + {"drunk", ITEM_INTFUNC, ITEM_DRUNK, ITEM_getRandomValue}, + {"confusion", ITEM_INTFUNC, ITEM_CONFUSION, ITEM_getRandomValue}, + + {"critical", ITEM_INTFUNC, ITEM_CRITICAL, ITEM_getRandomValue}, + + {"useaction", ITEM_INTENTRY, ITEM_USEACTION, NULL}, + + {"dropatlogout",ITEM_INTFUNC, ITEM_DROPATLOGOUT, ITEM_isstring1or0}, + {"vanishatdrop",ITEM_INTFUNC, ITEM_VANISHATDROP, ITEM_isstring1or0}, + {"isovered", ITEM_INTFUNC, ITEM_ISOVERED, ITEM_isstring1or0}, + {"canpetmail", ITEM_INTFUNC, ITEM_CANPETMAIL, ITEM_isstring1or0}, + {"canmergefrom",ITEM_INTFUNC, ITEM_CANMERGEFROM, ITEM_isstring1or0}, + {"canmergeto", ITEM_INTFUNC, ITEM_CANMERGETO, ITEM_isstring1or0}, + + {"ingname0", ITEM_CHARENTRY, ITEM_INGNAME0, NULL}, + {"ingvalue0", ITEM_INTENTRY, ITEM_INGVALUE0, NULL}, + {"ingname1", ITEM_CHARENTRY, ITEM_INGNAME1, NULL}, + {"ingvalue1", ITEM_INTENTRY, ITEM_INGVALUE1, NULL}, + {"ingname2", ITEM_CHARENTRY, ITEM_INGNAME2, NULL}, + {"ingvalue2", ITEM_INTENTRY, ITEM_INGVALUE2, NULL}, + {"ingname3", ITEM_CHARENTRY, ITEM_INGNAME3, NULL}, + {"ingvalue3", ITEM_INTENTRY, ITEM_INGVALUE3, NULL}, + {"ingname4", ITEM_CHARENTRY, ITEM_INGNAME4, NULL}, + {"ingvalue4", ITEM_INTENTRY, ITEM_INGVALUE4, NULL}, +#ifdef _PETITEM__AMOI_E + {"shopitem", ITEM_INTENTRY, ITEM_TYPEOFITEM, NULL}, +#endif +}; + + +#ifdef _ITEMTBL_STAIC +ITEM_table ITEM_tbl[24000]; +#else +ITEM_table* ITEM_tbl=NULL; +#endif + +static INLINE BOOL ITEM_CHECKARRAYINDEX(int index) +{ + if( ITEM_itemnum<=(index) || (index)<0 )return FALSE; + return TRUE; +} + +INLINE BOOL _ITEM_CHECKINDEX( char *file, int line, int index) +{ + if( !ITEM_CHECKARRAYINDEX(index) ) { + if( index != -1 ) { + print( "err %s:%d \n", file, line); + } + return FALSE; + } + if( ITEM_item[index].use == FALSE ) { + return FALSE; + } + return TRUE; +} + +static INLINE int ITEM_CHECKINTDATAINDEX(int index) +{ + if( ITEM_DATAINTNUM <= index || index < 0 )return FALSE; + return TRUE; +} + +static INLINE int ITEM_CHECKCHARDATAINDEX(int index) +{ + if( ITEM_DATACHARNUM<=index || index<0 )return FALSE; + return TRUE; +} + +BOOL ITEM_initExistItemsArray( int num ) +{ + int i; + + BOOL ITEM_checksetdata( void ); + if( ITEM_checksetdata() == FALSE )return FALSE; + + ITEM_itemnum = num; + + ITEM_item = allocateMemory( sizeof( ITEM_exists ) * num ); + if( ITEM_item == NULL ) return FALSE; + +#ifdef _ALLBLUES_LUA_1_2 + memset( &ITEM_luaFunc, 0 , sizeof( ITEM_LuaFunc )); +#endif + + for( i = 0 ; i < num ; i ++ ){ + memset( &ITEM_item[i], 0 , sizeof( ITEM_exists )); + ITEM_item[i].use = FALSE; + } + print("ڶη %4.2f MB ռ...", sizeof( ITEM_exists ) * num /1024.0/1024.0); + return TRUE; +} + +BOOL ITEM_endExistItemsArray( void ) +{ + freeMemory( ITEM_item ); + return TRUE; +} + +int _ITEM_initExistItemsOne( char *file, int line, ITEM_Item* itm ) +{ + int i; + int itemID=-1; + static int Sindex=1; + itemID = itm->data[ITEM_ID]; + if( ITEM_CHECKITEMTABLE(itm->data[ITEM_ID] ) == FALSE){ + print("CHAR itemData err Item_id:%d=%s%d!!\n", itm->data[ITEM_ID], file, line); + return -1; + } + for( i = 0 ; i < ITEM_itemnum ; i ++ ) { + Sindex++; + if( Sindex >= ITEM_itemnum ) Sindex = 1; + if( Sindex < 1 ) Sindex = 1; + if( !ITEM_item[Sindex].use){ + int charaindex; + charaindex = ITEM_item[Sindex].itm.workint[ITEM_WORKCHARAINDEX]; + if( CHAR_CHECKINDEX( charaindex) && + CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + int j; + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + if( CHAR_getItemIndex( charaindex, j) == Sindex) { + print( "item.c: error! chara have this item charaindex[%d] " + "itemindex[%d] Name(%s)POS(%d)NAME(%s)\n", + charaindex, Sindex, + CHAR_getUseName( charaindex ), j, + ITEM_item[Sindex].itm.string[ITEM_NAME].string ); + print( "from %s:%d\n", file, line); + ITEM_item[Sindex].use = TRUE; + break; + } + } + if( j != CHAR_MAXITEMHAVE ) continue; + } + memcpy( &ITEM_item[Sindex].itm , itm , sizeof( ITEM_Item ) ); + ITEM_item[Sindex].use = TRUE; + { + BOOL (*initfunc)(ITEM_Item*)=NULL; + initfunc = (BOOL(*)(ITEM_Item*)) getFunctionPointerFromName( itm->string[ITEM_INITFUNC].string ); + if( initfunc ){ + if( initfunc( &ITEM_item[Sindex].itm ) == FALSE ){ + ITEM_item[Sindex].use = FALSE; + fprint( "Error:Can't init item\n" ); + return -1; + } + } + } + ITEM_UseItemnum++; + ITEM_constructFunctable( Sindex); + return Sindex; + } + } + fprint( "Ʒ\n" ); + return -1; +} + +void _ITEM_endExistItemsOne( int index , char *file, int line) +{ + int i,j; + int hitcnt = 0; + int playernum = CHAR_getPlayerMaxNum(); + + if( !ITEM_CHECKINDEX(index)) return; + + for( i = 0; i < playernum; i ++ ) { + if( CHAR_CHECKINDEX( i)) { + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + if( CHAR_getItemIndex( i, j) == index) { + print( "warning !! player have this item:%d call from [%s:%d](%s)(%s)\n", + index, file,line, CHAR_getUseName(i),ITEM_item[index].itm.string[ITEM_NAME].string ); + hitcnt ++; + if( hitcnt > 1 ) { + print( "ITEM_INDEX(%d) duplicate!!\n", index); + } + } + } + } + } + + if( hitcnt < 1 ){ + ITEM_item[index].use = FALSE; + ITEM_item[index].itm.workint[ITEM_WORKCHARAINDEX] = -1; + ITEM_UseItemnum--; + } +} + +INLINE int ITEM_getIntStrict( int index ,ITEM_DATAINT element,int* error) +{ + if(!ITEM_CHECKINDEX(index))return *error=FALSE; + if(!ITEM_CHECKINTDATAINDEX(element))return *error=FALSE; + return ITEM_item[index].itm.data[element]; +} + +INLINE int _ITEM_getInt( char *file, int line, int index ,ITEM_DATAINT element) +{ + if(!ITEM_CHECKINDEX(index)){ + return -1; + } + if(!ITEM_CHECKINTDATAINDEX(element)) { + return -1; + } + return ITEM_item[index].itm.data[element]; +} + +INLINE int ITEM_setIntStrict( int index ,ITEM_DATAINT element,int data, + int* error) +{ + int buf; + if(!ITEM_CHECKINDEX(index)) + return *error=FALSE; + if(!ITEM_CHECKINTDATAINDEX(element)) + return *error=FALSE; + buf = ITEM_item[index].itm.data[element]; + ITEM_item[index].itm.data[element] = data; + return buf; +} + +INLINE int _ITEM_setInt( char *file, int line, int index ,ITEM_DATAINT element, int data) +{ + int buf; + if( !ITEM_CHECKINDEX( index) ){ + return -1; + } + + if( !ITEM_CHECKINTDATAINDEX( element) ){ + return -1; + } + + buf = ITEM_item[ index].itm.data[ element]; + ITEM_item[ index].itm.data[ element] = data; + return buf; +} + +INLINE char* ITEM_getChar( int index ,ITEM_DATACHAR element ) +{ + if(!ITEM_CHECKINDEX(index))return "\0"; + if(!ITEM_CHECKCHARDATAINDEX(element))return "\0"; + return ITEM_item[index].itm.string[element].string; +} + +INLINE BOOL ITEM_setChar( int index ,ITEM_DATACHAR element , char* new) +{ + if(!ITEM_CHECKINDEX(index))return FALSE; + if(!ITEM_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( ITEM_item[index].itm.string[element].string, + sizeof( ITEM_item[index].itm.string[element].string ), + new ); + return TRUE; +} + +INLINE int ITEM_getWorkInt( int index ,ITEM_WORKDATAINT element) +{ + if( !ITEM_CHECKINDEX(index) ) return -1; + if( element >= ITEM_WORKDATAINTNUM || element < 0 ) return -1; + return ITEM_item[index].itm.workint[element]; +} + +INLINE int ITEM_setWorkInt( int index ,ITEM_WORKDATAINT element, int data) +{ + int buf; + if( !ITEM_CHECKINDEX( index) ) return -1; + if( element >= ITEM_WORKDATAINTNUM || element < 0 ) return -1; + + buf = ITEM_item[index].itm.workint[element]; + ITEM_item[index].itm.workint[element] = data; + return buf; +} + +INLINE int ITEM_getITEM_itemnum( void ) +{ + return ITEM_itemnum; +} + +INLINE int ITEM_getITEM_UseItemnum( void ) +{ + return ITEM_UseItemnum; +} + + +INLINE BOOL ITEM_getITEM_use( int index ) +{ + if( !ITEM_CHECKINDEX(index))return FALSE; + return ITEM_item[index].use; +} + +void ITEM_constructFunctable( int itemindex ) +{ + int i; + if( !ITEM_CHECKINDEX(itemindex))return; + + for( i=ITEM_FIRSTFUNCTION; i < ITEM_LASTFUNCTION ; i++ ) { + ITEM_item[itemindex].itm.functable[i-ITEM_FIRSTFUNCTION] + = getFunctionPointerFromName( ITEM_getChar( itemindex,i ) ); +#ifdef _ALLBLUES_LUA_1_2 + if(ITEM_item[itemindex].itm.functable[i-ITEM_FIRSTFUNCTION] == NULL){ + ITEM_setLUAFunction(itemindex, i, ITEM_getChar( itemindex,i )); + } +#endif + } +} + +void* ITEM_getFunctionPointer( int itemindex, int functype ) +{ + if( !ITEM_CHECKINDEX(itemindex) )return NULL; + if( functype < ITEM_FIRSTFUNCTION || functype >= ITEM_LASTFUNCTION ){ + print( "ʹ:%d\n", functype); + return NULL; + } + return ITEM_item[itemindex].itm. + functable[functype-ITEM_FIRSTFUNCTION]; +} + +#ifdef _ALLBLUES_LUA_1_2 +INLINE BOOL ITEM_setLUAFunction( int itemindex, int functype, const char *luafuncname) +{ + if( !ITEM_CHECKINDEX(itemindex) )return FALSE; + if( functype < ITEM_FIRSTFUNCTION || functype >= ITEM_LASTFUNCTION ){ + print( "ʹ1:%d\n", functype); + return FALSE; + } + ITEM_LuaFunc *luaFunc = &ITEM_luaFunc; + + while(luaFunc->next != NULL){ + if(strcmp(luaFunc->luafuncname, luafuncname) == 0){ + ITEM_item[itemindex].itm.lua[functype-ITEM_FIRSTFUNCTION] = luaFunc->lua; + ITEM_item[itemindex].itm.luafunctable[functype-ITEM_FIRSTFUNCTION] = allocateMemory( strlen(luaFunc->luafunctable) ); + memset(ITEM_item[itemindex].itm.luafunctable[functype-ITEM_FIRSTFUNCTION], 0, strlen(luaFunc->luafunctable)); + strcpy(ITEM_item[itemindex].itm.luafunctable[functype-ITEM_FIRSTFUNCTION], luaFunc->luafunctable); + return TRUE; + } + luaFunc = luaFunc->next; + } + + ITEM_item[itemindex].itm.lua[functype-ITEM_FIRSTFUNCTION] = NULL; + ITEM_item[itemindex].itm.luafunctable[functype-ITEM_FIRSTFUNCTION] = NULL; + + return FALSE; +} + +BOOL ITEM_addLUAListFunction( lua_State *L, const char *luafuncname, const char *luafunctable ) +{ + ITEM_LuaFunc *luaFunc = &ITEM_luaFunc; + + while(luaFunc->next != NULL){ + luaFunc = luaFunc->next; + } + + luaFunc->next = allocateMemory( sizeof(ITEM_LuaFunc) ); + memset( luaFunc->next, 0 , sizeof(ITEM_luaFunc) ); + if(luaFunc->next == NULL)return FALSE; + + luaFunc->lua = L; + strcpysafe( luaFunc->luafuncname, 128, luafuncname ); + strcpysafe( luaFunc->luafunctable, 128, luafunctable ); + + return TRUE; +} + + +INLINE lua_State *ITEM_getLUAFunction( int itemindex, int functype) +{ + if( !ITEM_CHECKINDEX(itemindex) )return NULL; + if( functype < ITEM_FIRSTFUNCTION || functype >= ITEM_LASTFUNCTION ){ + print( "ʹ2:%d\n", functype); + return NULL; + } + + if(ITEM_item[itemindex].itm.lua[functype-ITEM_FIRSTFUNCTION] == NULL){ + return NULL; + } + + lua_getglobal( ITEM_item[itemindex].itm.lua[functype-ITEM_FIRSTFUNCTION], ITEM_item[itemindex].itm.luafunctable[functype-ITEM_FIRSTFUNCTION]); + + return ITEM_item[itemindex].itm.lua[functype-ITEM_FIRSTFUNCTION]; +} + +#endif + +int ITEM_getItemMaxIdNum( void) +{ + return ITEM_tblen; +} + +BOOL ITEM_checksetdata( void ) +{ + int i; + char* strings[ITEM_DATAINTNUM + ITEM_DATACHARNUM + 1]; +#ifdef _SIMPLIFY_ITEMSTRING + int num=0; + for(i = 0; i < arraysizeof( ITEM_setintdata) ; i ++ ) + strings[ num++ ] = ITEM_setintdata[i].dumpchar; + for( i = 0 ; i < arraysizeof( ITEM_setchardata) ; i ++ ) + strings[ num++ ] = ITEM_setchardata[i].dumpchar; + strings[ITEM_DATAINTNUM+ITEM_DATACHARNUM] = ITEM_setmemdata.dumpchar; + + if( ! checkStringsUnique( strings, num,1 ) ){ + fprint( "ITEM_set????data is overlapped.\nIt is not allowed\n"); + return FALSE; + } +#else + for(i = 0; i < ITEM_DATAINTNUM ; i ++ ) + strings[i] = ITEM_setintdata[i].dumpchar; + for( i = 0 ; i < ITEM_DATACHARNUM ; i ++ ) + strings[ITEM_DATAINTNUM+i] = ITEM_setchardata[i].dumpchar; + + + strings[ITEM_DATAINTNUM+ITEM_DATACHARNUM] = ITEM_setmemdata.dumpchar; + + if( ! checkStringsUnique( strings, arraysizeof( strings ),1 ) ){ + fprint( "ITEM_set????data is overlapped.\nIt is not allowed\n"); + return FALSE; + } +#endif + return TRUE; +} + +static char ITEM_dataString[STRINGBUFSIZ]; +char* ITEM_makeStringFromItemIndex( int index, int mode ) +{ + if( 0 <= index && index < ITEM_itemnum && ITEM_item[index].use == TRUE) + ; + else + return "\0"; + return ITEM_makeStringFromItemData( &ITEM_item[index].itm, mode ); +} + +#ifdef _SIMPLIFY_ITEMSTRING2 +BOOL CHECK_HaveBeSave( int itemID, int oneNum, int type ) +{ + if( ITEM_ID == type ) return TRUE; + if( ITEMTBL_getInt( itemID, type) == oneNum ) return FALSE; + return TRUE; +} +#endif + +char* ITEM_makeStringFromItemData( ITEM_Item* one, int mode ) +{ + int i; + char delim1 = '\0'; + char delim2 = '\0'; + int strlength=0; + +#ifdef _SIMPLIFY_ITEMSTRING2 + int itemID = one->data[ ITEM_ID]; + if( !ITEM_CHECKITEMTABLE( itemID) ) return "\0"; +#endif + if( mode == 0 ) { + delim1 = '='; delim2 = '|'; + }else { + delim1 = ':'; delim2 = ','; + } + +#ifdef _SIMPLIFY_ITEMSTRING + for(i = 0; i < arraysizeof( ITEM_setintdata) ; i ++ ){ + char linedata[128]; +#ifdef _SIMPLIFY_ITEMSTRING2 + if( !CHECK_HaveBeSave( itemID, one->data[ ITEM_setintdata[i].table], ITEM_setintdata[i].table) ) continue; +#endif + snprintf( linedata , sizeof(linedata), + "%s%c%d%c", ITEM_setintdata[i].dumpchar, delim1, + one->data[ ITEM_setintdata[i].table], delim2 ); + strcpysafe( &ITEM_dataString[strlength], sizeof( ITEM_dataString ) - strlength, linedata ); + strlength += strlen( linedata ); + } + + for( i = 0 ; i < arraysizeof( ITEM_setchardata) ; i ++ ){ + char linedata[128]; + char escapebuffer[128]; + if( strlen( one->string[ ITEM_setchardata[i].table].string) == 0 ) continue; + + snprintf( linedata , sizeof(linedata), + "%s%c%s%c", ITEM_setchardata[i].dumpchar,delim1, + makeEscapeString( one->string[ITEM_setchardata[i].table].string, escapebuffer, + sizeof(escapebuffer)), delim2); + strcpysafe( &ITEM_dataString[strlength], sizeof( ITEM_dataString ) - strlength, linedata ); + strlength += strlen( linedata ); + } +#else + for( i = 0 ; i < ITEM_DATAINTNUM ; i ++ ) { + char linedata[128]; + snprintf( linedata , sizeof(linedata), + "%s%c%d%c", ITEM_setintdata[i].dumpchar, delim1, one->data[i], delim2 ); + strcpysafe( &ITEM_dataString[strlength], sizeof( ITEM_dataString ) - strlength, linedata ); + strlength += strlen( linedata ); + } + + for( i = 0 ; i < ITEM_DATACHARNUM ; i ++ ){ + char linedata[128]; + char escapebuffer[128]; + if( strlen( one->string[i].string) != 0 ) { + snprintf( linedata , sizeof(linedata), + "%s%c%s%c", ITEM_setchardata[i].dumpchar,delim1, + makeEscapeString(one->string[i].string,escapebuffer, + sizeof(escapebuffer)), delim2); + strcpysafe( &ITEM_dataString[strlength], sizeof( ITEM_dataString ) - strlength, linedata ); + strlength += strlen( linedata ); + } + } +#endif + dchop( ITEM_dataString, (mode == 0 ) ? "|" : ","); + return ITEM_dataString; +} + +BOOL ITEM_makeExistItemsFromStringToArg( char* src , ITEM_Item* item, int mode ) +{ + int readindex=1; + char delim1[2]; + char delim2[2]; + + if( mode == 0 ) { + strcpy( delim1, "="); + strcpy( delim2, "|"); + } + else { + strcpy( delim1, ":"); + strcpy( delim2, ","); + } +#ifdef _SIMPLIFY_ITEMSTRING + { + + int itemID=-1; + while( 1 ){ + char linebuf[512]; + char firstToken[256]; + char secondToken[256]; + if( getStringFromIndexWithDelim( src ,delim2 , readindex, linebuf, sizeof( linebuf)) == FALSE ) break; + + readindex++; + if( getStringFromIndexWithDelim( linebuf, delim1, 1, firstToken, sizeof( firstToken )) == FALSE )return FALSE; + if( strcmp( firstToken, "id" ) ) continue; + strcpysafe( secondToken , sizeof( secondToken ), linebuf + strlen( firstToken) + strlen( delim1) ); + itemID = atoi( secondToken); + if( !ITEM_CHECKITEMTABLE( itemID) ) return FALSE; + ITEM_getDefaultItemData( itemID, item); + break; + } + readindex =1; + } +#else + ITEM_getDefaultItemSetting(item); +#endif + + while( 1 ){ + BOOL ret; + char linebuf[512]; + + char firstToken[256]; + char secondToken[256]; + int i; + + ret = getStringFromIndexWithDelim( src ,delim2 , readindex,linebuf, sizeof(linebuf) ); + if( ret == FALSE ) + break; + ret = getStringFromIndexWithDelim( linebuf, delim1, 1, firstToken, sizeof( firstToken ) ); + if( ret == FALSE ) return FALSE; + strcpysafe( secondToken , sizeof( secondToken ), + linebuf + strlen(firstToken) + strlen(delim1) ); +#ifdef _SIMPLIFY_ITEMSTRING + for(i = 0; i < arraysizeof( ITEM_setintdata) ; i ++ ){ + if( strcmp( firstToken , ITEM_setintdata[i].dumpchar) ) continue; + item->data[ITEM_setintdata[i].table] = atoi( secondToken ); + goto NEXT; + } + + for(i = 0; i < arraysizeof( ITEM_setchardata) ; i ++ ){ + if( strcmp(firstToken ,ITEM_setchardata[i].dumpchar ) ) continue; + strcpysafe( item->string[ ITEM_setchardata[i].table].string, + sizeof(item->string[ITEM_setchardata[i].table].string), + makeStringFromEscaped(secondToken)); + goto NEXT; + } +#else + for( i = 0 ; i < ITEM_DATAINTNUM ; i ++ ){ + if( strcmp(firstToken ,ITEM_setintdata[i].dumpchar) == 0 ){ + item->data[i] = atoi( secondToken ); + goto NEXT; + } + } + + for( i = 0 ; i < ITEM_DATACHARNUM ; i ++ ){ + if( strcmp(firstToken ,ITEM_setchardata[i].dumpchar ) == 0 ){ + strcpysafe( item->string[i].string, + sizeof(item->string[i].string), + makeStringFromEscaped(secondToken)); + goto NEXT; + } + } +#endif + fprint( "??? : %s[%s]\n" , src , firstToken ); + + NEXT: + readindex++; + } + + return TRUE; +} + +void ITEM_getDefaultItemSetting(ITEM_Item* itm) +{ + int i; + memset( itm, 0 , sizeof( ITEM_Item )); +#ifdef _SIMPLIFY_ITEMSTRING + for(i = 0; i < arraysizeof( ITEM_setintdata) ; i ++ ){ + itm->data[ITEM_setintdata[i].table] = ITEM_setintdata[i].defaults; + } + for(i = 0; i < arraysizeof( ITEM_setchardata) ; i ++ ){ + strcpysafe( itm->string[ITEM_setchardata[i].table].string, + sizeof( itm->string[ITEM_setchardata[i].table].string), + ITEM_setchardata[i].defaults); + } +#else + for(i=0;idata[i] = ITEM_setintdata[i].defaults; + for(i=0;istring[i].string, + sizeof(itm->string[i].string), + ITEM_setchardata[i].defaults); +#endif + + strcpysafe( itm->string[ITEM_WATCHFUNC].string, + sizeof(itm->string[ITEM_WATCHFUNC].string), "ITEM_DeleteTimeWatched" ); + + + for(i=0;iworkint[i] = -1; + } + +} + +#ifdef _SIMPLIFY_ITEMSTRING +void ITEM_getDefaultItemData( int itemID, ITEM_Item* itm) +{ + int i; +// memset( itm, 0 , sizeof( ITEM_Item )); + + for(i=0;idata[i] = ITEMTBL_getInt( itemID, i); + } + for(i=0;istring[i].string, sizeof( itm->string[i].string), + ITEMTBL_getChar( itemID, i) ); + } + for(i=0;iworkint[i] = -1; + } + + strcpysafe( itm->string[ITEM_WATCHFUNC].string, sizeof( itm->string[ITEM_WATCHFUNC].string), + "ITEM_DeleteTimeWatched" ); + +} +#endif + +static int ITEM_getRandomValue( char* string,int* randomwidth, int num ) +{ + int minvalue; + int maxvalue; + char token[64]; + int ret; +#if 1 + *randomwidth = 0; + + ret = getStringFromIndexWithDelim( string,",",num -1,token, sizeof( token)); + if( ret == FALSE ) { + return 0; + } + minvalue = atoi( token); + ret = getStringFromIndexWithDelim( string,",",num ,token, sizeof( token)); + if( ret == FALSE ) { + return minvalue; + } + maxvalue = atoi( token); + *randomwidth = ABS( maxvalue - minvalue); + return min( minvalue, maxvalue); + +#else + minvalue = atoi( string ); + startmax = index( string,',' ); + if( startmax != NULL ){ + maxvalue = atoi(startmax+1); + *randomwidth = ABS(maxvalue - minvalue); + return min(minvalue,maxvalue); + } + *randomwidth = 0; + return minvalue; +#endif +} +static int ITEM_isstring1or0( char* string,int* randomwidth, int num ) +{ + char token[64]; + int ret; + + ret = getStringFromIndexWithDelim( string,",",num -1,token, sizeof( token)); + if( ret == FALSE ) { + return FALSE; + } + + return isstring1or0( token); +} + +static char* ITEM_checkString( char* string ) +{ +#define ITEM_STRINGLEN 64 + if( strlen(string) >= ITEM_STRINGLEN ) + print( "Over %d:[%s]\n",ITEM_STRINGLEN ,string ); + return string; +#undef ITEM_STRINGLEN +} + +BOOL ITEM_readItemConfFile( char* filename ) +{ + FILE* f; + char line[512]; + char token[64]; + int linenum=0; + int i; + int maxid=0, itemid; + int ret; + int intdata[ITEM_DATAINTNUM]; + + f = fopen(filename,"r"); + if( f == NULL ){ + print( "ܴļ\n"); + return FALSE; + } +#ifdef _ITEMSET2_ITEM + +#define ITEM_ID_TOKEN_INDEX 17 + +#else + +#ifdef _ITEM_MAXUSERNUM +#define ITEM_ID_TOKEN_INDEX 15 +#endif + +#endif + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + ret = getStringFromIndexWithDelim( line, ",", ITEM_ID_TOKEN_INDEX, token, sizeof(token)); + if( ret == FALSE ){ + fprint("ļ:%s :%d\n",filename,linenum); + continue; + } + itemid = atoi( token); + if( itemid > maxid ){ + maxid = itemid; + } + } + + if( maxid <=0 ) { + print( "ID\n"); + fclose(f); + return FALSE; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "\n" ); + fclose(f); + return FALSE; + } + print( "ƷID %d...", maxid); + ITEM_tblen = maxid + 1; +#ifdef _ITEMTBL_STAIC + for( i = 0 ; i < 24000 ; i ++ ) { + ITEM_tbl[i].use = FALSE; + } +#else + if( ITEM_tbl != NULL ) + freeMemory( ITEM_tbl); + ITEM_tbl = allocateMemory( sizeof(ITEM_table) * ITEM_tblen ); + + if( ITEM_tbl == NULL ){ + fprint( "޷ڴ %d\n" , sizeof(ITEM_table)*ITEM_tblen ); + fclose( f ); + return FALSE; + } + + print("һη %4.2f MB ռ...", sizeof(ITEM_table) * ITEM_tblen /1024.0/1024.0); + for( i = 0 ; i < ITEM_tblen ; i ++ ) { + ITEM_tbl[i].use = FALSE; + } +#endif + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + replaceString( line, '\t' , ' ' ); + +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + int readpos = 1; + BOOL dataerror = FALSE; + ITEM_Item itm; + + ITEM_getDefaultItemSetting(&itm); + + for( i=0 ; i< ITEM_DATAINTNUM ; i++ ) { + intdata[i] = 0; + } + itemid = 0; + for( i = 0 ; i < arraysizeof( ITEM_itemconfentries) ; i ++ ){ + ret = getStringFromIndexWithDelim( line,",",readpos,token, sizeof(token)); + if( ret == FALSE ) { +#ifdef _Item_ReLifeAct + { + char buf[256]; + char buf1[256]; + sscanf( line,"%s,%s", buf, buf1); + print("[ITEM data Error] tbl=%d:%s line:%d[%s]\n", + readpos, ITEM_itemconfentries[i].entryname, linenum, line); + } +#else + fprint("Syntax Error tki:%d file:%s line:%d[%s]\n", + i , filename,linenum,line); +#endif + dataerror = TRUE; + break; + } + + if( readpos == ITEM_ID_TOKEN_INDEX ) + itemid = atoi( token); + + readpos ++; + + if( strlen( token ) != 0 ) { + switch(ITEM_itemconfentries[i].type){ + case ITEM_INTENTRY: + itm.data[ITEM_itemconfentries[i].index] = atoi( token ); + break; + case ITEM_CHARENTRY: + strcpysafe( itm.string[ITEM_itemconfentries[i].index].string, + sizeof(itm.string[ITEM_itemconfentries[i].index].string), + token); + break; + case ITEM_INTFUNC: + { + int (*intfunction)(char*,int*, int ); + intfunction = ITEM_itemconfentries[i].func; + itm.data[ITEM_itemconfentries[i].index] + = intfunction(line, + &intdata[ITEM_itemconfentries[i].index],readpos); + if( intfunction == ITEM_getRandomValue) readpos ++; + + } + break; + case ITEM_CHARFUNC: + { + char* (*charfunction)(char* ); + charfunction = ITEM_itemconfentries[i].func; + strcpysafe( itm.string[ITEM_itemconfentries[i].index].string, + sizeof(itm.string[ITEM_itemconfentries[i].index].string), + charfunction( token)); + break; + } + default: + break; + } + } + } + if( !dataerror) { + if( itemid >= ITEM_tblen ){ + print( "ITEM_tbl full:%d err !!\n" , itemid ); + }else if( ITEM_tbl[itemid].use == TRUE ) { + fprint( "Duplicate Itemid %d.ignore\n" , itemid ); + }else{ + if( itm.string[ITEM_SECRETNAME].string[0] == '\0') { + fprint( "ERROR: ID %d item doesn't have secretname\n" + ,itemid ); + memcpy( &itm.string[ITEM_SECRETNAME].string, + &itm.string[ITEM_NAME].string, + sizeof(itm.string[ITEM_NAME].string)); + } +{ + int attacknum_min, attacknum_max; + attacknum_min = itm.data[ITEM_ATTACKNUM_MIN]; + attacknum_max = itm.data[ITEM_ATTACKNUM_MAX]; + if( attacknum_min == 0 ) attacknum_min = attacknum_max; + itm.data[ITEM_ATTACKNUM_MIN] = min( attacknum_min, + attacknum_max); + itm.data[ITEM_ATTACKNUM_MAX] = max( attacknum_min, + attacknum_max); +} + memcpy( &ITEM_tbl[itemid].itm, &itm, sizeof(ITEM_Item)); + ITEM_tbl[itemid].use = TRUE; + + for( i=0 ; i< ITEM_DATAINTNUM ; i++ ){ + ITEM_tbl[itemid].randomdata[i] = intdata[i]; + } + } + } +} + } + fclose(f); + return TRUE; +} + +CHAR_EquipPlace ITEM_getEquipPlace( int charaindex, int itmid ) +{ + ITEM_CATEGORY cat; + cat = ITEM_getInt( itmid , ITEM_TYPE ); + switch( cat ){ + case ITEM_FIST: + case ITEM_SPEAR: + case ITEM_AXE: + case ITEM_CLUB: +// case ITEM_SHIELD: + case ITEM_BOOMERANG: + case ITEM_BREAKTHROW: + case ITEM_BOUNDTHROW: + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + { + int i=0; + + // ʿְҵܶ + for( i=0; i 0 ) return -1; +#endif + return CHAR_ARM; + break; + +#ifdef _ITEM_EQUITSPACE + case ITEM_WBELT: + return CHAR_EQBELT; + break; + case ITEM_WSHIELD: + if( BATTLE_GetWepon( charaindex ) != ITEM_BOW ) + return CHAR_EQSHIELD; + break; + case ITEM_WSHOES: + return CHAR_EQSHOES; + break; +#endif + +#ifdef _EQUIT_NEWGLOVE + case ITEM_WGLOVE: + return CHAR_EQGLOVE; + break; +#endif + default: + break; + } + return -1; +} +#define ITEMSTRINGBUFSIZ 512 +static char ITEM_itemStatusStringBuffer[ITEMSTRINGBUFSIZ]; +char* ITEM_makeItemStatusString( int haveitemindex, int itemindex ) +{ + char escapename[256]; + char escapeeffectstring[256]; + char paramshow[256]; + int leaklevel; + int itemcolor = 0; + int flg; + + if( !ITEM_CHECKINDEX(itemindex) ) return "\0"; + leaklevel = ITEM_getInt(itemindex,ITEM_LEAKLEVEL); + + //if( leaklevel >= 1 ) // Nuke debug + { + makeEscapeString( ITEM_getChar(itemindex, ITEM_SECRETNAME), + escapename, sizeof(escapename) ); + /*if( leaklevel >= 2 ) + { + static struct Showparamint{ + char* name; + int intindex; + }showparamint[]={ + { "ATK" , ITEM_MODIFYATTACK }, + { "DEF" , ITEM_MODIFYDEFENCE }, + { "HP" , ITEM_MODIFYHP }, + { "MP" , ITEM_MODIFYMP }, + { "QUICK" , ITEM_MODIFYQUICK }, + { "LUCK" , ITEM_MODIFYLUCK }, + { "CHARM" , ITEM_MODIFYCHARM }, + }; + int i; + int stringlen=0; + + paramshow[0] = '\0'; + + for( i = 0 ; i < arraysizeof( showparamint ); i ++ ){ + int value; + char sign; + char tmpbuf[128]; + value = ITEM_getInt(itemindex,showparamint[i].intindex); + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + + + +#endif + + if( value == 0 )continue; + else if( value > 0 ) sign = '+'; + else sign = '-'; + + snprintf( tmpbuf,sizeof( tmpbuf ), "%s%c%d ", + showparamint[i].name,sign,ABS(value) ); + + strcpysafe( paramshow + stringlen , + sizeof(paramshow) - stringlen, tmpbuf ); + stringlen +=strlen(tmpbuf); + if( stringlen >= arraysizeof( paramshow )) + break; + } + dchop( paramshow , " " ); + } + else*/ + paramshow[0] = '\0'; + + } + /*else{ + if(strlen(ITEM_getChar(itemindex,ITEM_SECRETNAME)) > 0){ + makeEscapeString(ITEM_getChar(itemindex,ITEM_SECRETNAME),escapename,sizeof(escapename)); + } + else makeEscapeString( ITEM_getChar(itemindex,ITEM_NAME),escapename,sizeof(escapename)); + paramshow[0] = '\0'; + }*/ + makeEscapeString( ITEM_getChar( itemindex, ITEM_EFFECTSTRING), + escapeeffectstring, + sizeof(escapeeffectstring)); + int itemtime = ITEM_getInt(itemindex,ITEM_TIME); + if(itemtime>0){ + time_t timep; + struct tm *p; + timep = itemtime; + p=localtime(&timep); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + char tmbuf[256]; + strcpy(tmbuf,escapeeffectstring); + sprintf(escapeeffectstring,"Ч:%d.%s.%s %s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,tmbuf); + } +#ifdef _ITEM_COLOER + itemcolor = ITEM_getInt( itemindex, ITEM_COLOER); +#else + itemcolor = CHAR_COLORWHITE; +#endif + if( strlen( ITEM_getChar( itemindex, ITEM_CDKEY)) != 0 ) { + itemcolor = CHAR_COLORGREEN; + }else { + if( ITEM_getInt( itemindex, ITEM_MERGEFLG) ) { + itemcolor = CHAR_COLORYELLOW; + } + } +#ifdef _DROPITEM_COLOR + if(ITEM_getInt( itemindex, ITEM_VANISHATDROP) == 1 ){ + itemcolor = CHAR_COLORGREEN2; + } +#endif + flg = 0; + if( ITEM_getInt( itemindex, ITEM_CANPETMAIL)) { + flg |= 1 << 0; + } + if( ITEM_getInt( itemindex, ITEM_CANMERGEFROM)) { + flg |= 1 << 1; + } + if( ITEM_getInt( itemindex, ITEM_TYPE) == ITEM_DISH ) { + flg |= 1 << 2; + } +#ifdef _ITEM_INSLAY + if( ITEM_getInt( itemindex, ITEM_TYPE) == ITEM_METAL ) { + flg |= 1 << 3; + }else if( ITEM_getInt( itemindex, ITEM_TYPE) == ITEM_JEWEL ) { + flg |= 1 << 4; + } +#endif +#ifdef _PETSKILL_FIXITEM + if( ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE) + != ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) ){ + flg |= 1 << 5; + } +#endif + +#ifdef _ALCHEMIST + char INGNAME0[16]; + char INGNAME1[16]; + strcpy( INGNAME0, ITEM_getChar( itemindex, ITEM_INGNAME0) ); + strcpy( INGNAME1, ITEM_getChar( itemindex, ITEM_INGNAME1) ); + if( (INGNAME0[0] != '\0' && INGNAME1[0] != '\0') || (INGNAME0[0] == '\0') ) { + strcpy( INGNAME0, "" ); + } +#endif + + if( haveitemindex == -1 ) { +#ifdef _ADD_SHOW_ITEMDAMAGE // WON ADD ʾƷ;ö + char buff1[256]; + int crushe = ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE); + int maxcrushe = ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE); + if(crushe < 1) crushe = 1; + if(maxcrushe < 1){ + sprintf(buff1, ""); // + }else{ + maxcrushe = maxcrushe/1000; + crushe = crushe/1000; + if( maxcrushe <= 0 ) maxcrushe = 1; + snprintf(buff1, sizeof(buff1), "%d%%", (int)((crushe*100)/maxcrushe) ); + } + + snprintf(ITEM_itemStatusStringBuffer, + sizeof( ITEM_itemStatusStringBuffer), + +#ifdef _ITEM_PILENUMS +#ifdef _PET_ITEM + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d|%s|%d|", +#else +#ifdef _ALCHEMIST + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d|%s", +#else + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d", +#endif +#endif +#else + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s", +#endif + escapename, paramshow, + itemcolor, escapeeffectstring , + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + ITEM_getInt( itemindex, ITEM_ABLEUSEFIELD), + ITEM_getInt( itemindex, ITEM_TARGET), + ITEM_getInt( itemindex, ITEM_LEVEL), + flg, + buff1 +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#ifdef _ALCHEMIST + ,INGNAME0 //,ITEM_getInt( itemindex, ITEM_ALCHEMIST) +#ifdef _PET_ITEM + , ITEM_getInt( itemindex, ITEM_TYPE) +#endif +#endif +#endif + ); +#else + snprintf(ITEM_itemStatusStringBuffer, + sizeof( ITEM_itemStatusStringBuffer), + "%s|%s|%d|%s|%d|%d|%d|%d|%d", + escapename, paramshow, + itemcolor, escapeeffectstring , + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + ITEM_getInt( itemindex, ITEM_ABLEUSEFIELD), + ITEM_getInt( itemindex, ITEM_TARGET), + ITEM_getInt( itemindex, ITEM_LEVEL), + flg + ); +#endif + }else { +#ifdef _ADD_SHOW_ITEMDAMAGE // WON ADD ʾƷ;ö + char buff1[256]; + int crushe = ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE); + int maxcrushe = ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE); + if(crushe < 1) crushe = 1; + if(maxcrushe < 1){ + sprintf(buff1, ""); // + }else{ + maxcrushe = maxcrushe/1000; + crushe = crushe/1000; + if( maxcrushe <= 0 ) maxcrushe = 1; + snprintf(buff1, sizeof(buff1), "%d%%", (int)((crushe*100)/maxcrushe) ); + } + snprintf(ITEM_itemStatusStringBuffer, sizeof( ITEM_itemStatusStringBuffer), + +#ifdef _ITEM_PILENUMS +#ifdef _PET_ITEM + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d|%s|%d|", +#else +#ifdef _ALCHEMIST + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d|%s", +#else + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s|%d", +#endif +#endif +#else + "%s|%s|%d|%s|%d|%d|%d|%d|%d|%s", +#endif + escapename, paramshow, + itemcolor, escapeeffectstring , + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + ITEM_getInt( itemindex, ITEM_ABLEUSEFIELD), + ITEM_getInt( itemindex, ITEM_TARGET), + ITEM_getInt( itemindex, ITEM_LEVEL), + flg, + buff1 +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#ifdef _ALCHEMIST + ,INGNAME0 //,ITEM_getInt( itemindex, ITEM_ALCHEMIST) +#ifdef _PET_ITEM + , ITEM_getInt( itemindex, ITEM_TYPE) +#endif +#endif +#endif + ); +#else + snprintf(ITEM_itemStatusStringBuffer, + sizeof( ITEM_itemStatusStringBuffer), + "%d|%s|%s|%d|%s|%d|%d|%d|%d|%d", + haveitemindex, + escapename, paramshow, + itemcolor, escapeeffectstring , + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + ITEM_getInt( itemindex, ITEM_ABLEUSEFIELD), + ITEM_getInt( itemindex, ITEM_TARGET), + ITEM_getInt( itemindex, ITEM_LEVEL), + flg + ); +#endif + } + + return ITEM_itemStatusStringBuffer; +} + +char* ITEM_makeItemFalseString( void ) +{ + +#ifdef _ADD_SHOW_ITEMDAMAGE // WON ADD ʾƷ;ö + strcpysafe( ITEM_itemStatusStringBuffer, + sizeof( ITEM_itemStatusStringBuffer), +#ifdef _ITEM_PILENUMS +#ifdef _ALCHEMIST +#ifdef _PET_ITEM + "|||||||||||||" +#else + "|||||||||||" +#endif +#else + "||||||||||" +#endif +#else + "|||||||||" +#endif + ); + +#else + strcpysafe( ITEM_itemStatusStringBuffer, + sizeof( ITEM_itemStatusStringBuffer), + "||||||||" ); +#endif + return ITEM_itemStatusStringBuffer; +} + +char* ITEM_makeItemFalseStringWithNum( int haveitemindex ) +{ +#ifdef _ADD_SHOW_ITEMDAMAGE // WON ADD ʾƷ;ö + snprintf( ITEM_itemStatusStringBuffer, sizeof( ITEM_itemStatusStringBuffer), + +#ifdef _ITEM_PILENUMS +#ifdef _ALCHEMIST + "%d||||||||||||", +#else + "%d|||||||||||", +#endif +#else + "%d||||||||||", +#endif + haveitemindex ); +#else + snprintf( ITEM_itemStatusStringBuffer, sizeof( ITEM_itemStatusStringBuffer), + "%d|||||||||", haveitemindex); +#endif + return ITEM_itemStatusStringBuffer; +} + +BOOL ITEM_makeItem( ITEM_Item* itm, int number ) +{ + int i; + if( ITEM_CHECKITEMTABLE(number) == FALSE ){ + print(" Can't makeItem for itemid:%d!!\n", number); + return FALSE; + } + memcpy( itm, &ITEM_tbl[number].itm , sizeof( ITEM_Item ) ); //new + for( i=0 ; idata[i] = ITEM_tbl[number].itm.data[i] + randomvalue; //new + } + itm->data[ITEM_LEAKLEVEL] = 1; + return TRUE; +} + +int ITEM_makeItemAndRegist( int number ) +{ + ITEM_Item itm; + memset( &itm, 0, sizeof( itm)); + if( ITEM_makeItem( &itm, number ) == FALSE ) + return -1; + return ITEM_initExistItemsOne( &itm ); +} + +#define EQUIP_FIX_MAX 10000000 +void ITEM_equipEffect( int index ) +{ + int i; + int attribaccum[4] = { 0,0,0,0}; +#ifdef _ANGEL_SUMMON + int angelmode, angelequip =0; +#endif + static struct itmeffectstruct{ + int itemdataintindex; + int charmodifyparamindex; + int accumulation; + int min; + int max; + int type; + }itemEffect[]={ + { ITEM_MODIFYATTACK, CHAR_WORKATTACKPOWER, 0, 0, EQUIP_FIX_MAX, 0}, + { ITEM_MODIFYDEFENCE, CHAR_WORKDEFENCEPOWER, -100, 0, EQUIP_FIX_MAX, 0}, + { ITEM_MODIFYQUICK, CHAR_WORKQUICK, -100, 0, EQUIP_FIX_MAX, 0}, + { ITEM_MODIFYHP, CHAR_WORKMAXHP, 0, 0, EQUIP_FIX_MAX, 0}, + { ITEM_MODIFYMP, CHAR_WORKMAXMP, 0, 0, 1000, 0}, // MP 100ƥ + + { ITEM_MODIFYLUCK, CHAR_WORKFIXLUCK, 0, 1, 5, 0}, + { ITEM_MODIFYCHARM, CHAR_WORKFIXCHARM, 0, 0, 100, 0}, + { ITEM_MODIFYAVOID, CHAR_WORKFIXAVOID, 0, 0, EQUIP_FIX_MAX, 0}, + { ITEM_POISON, CHAR_WORKMODPOISON, 0, -100, 100, 0}, + { ITEM_PARALYSIS, CHAR_WORKMODPARALYSIS, 0, -100, 100, 0}, + { ITEM_SLEEP, CHAR_WORKMODSLEEP, 0, -100, 100, 0}, + { ITEM_STONE, CHAR_WORKMODSTONE, 0, -100, 100, 0}, + { ITEM_DRUNK, CHAR_WORKMODDRUNK, 0, -100, 100, 0}, + { ITEM_CONFUSION, CHAR_WORKMODCONFUSION, 0, -100, 100, 0}, + { ITEM_CRITICAL, CHAR_WORKMODCRITICAL, 0, -100, 100, 0}, +#ifdef _ADD_DEAMGEDEFC + { ITEM_OTHERDAMAGE, CHAR_WORKOTHERDMAGE, 0, -100, 100, 0}, + { ITEM_OTHERDEFC, CHAR_WORKOTHERDEFC, 0, -100, 100, 0}, +#endif + +#ifdef _ITEMSET5_TXT + { ITEM_MODIFYARRANGE, CHAR_WORKFIXARRANGE, 0, 0, 1000, 0}, + { ITEM_MODIFYSEQUENCE, CHAR_WORKFIXSEQUENCE, 0, 0, 100, 1}, + { ITEM_ATTACHPILE, CHAR_WORKATTACHPILE, 0, 0, 10, 1}, + { ITEM_HITRIGHT, CHAR_WORKHITRIGHT, 0, 0, 40, 1}, +#endif +#ifdef _ITEMSET6_TXT + { ITEM_NEGLECTGUARD, CHAR_WORKNEGLECTGUARD, 0, 0, 30, 1}, +#endif + }; + + for( i = 0 ; i < arraysizeof( itemEffect ); i ++ ) + itemEffect[i].accumulation = 0; + + if( !CHAR_CHECKINDEX(index) )return; + +#ifdef _ANGEL_SUMMON + angelmode = CHAR_getWorkInt( index, CHAR_WORKANGELMODE); +#endif + + for( i = 0 ; i < CHAR_EQUIPPLACENUM ; i ++ ){ + +#ifdef _ALLBLUES_LUA_1_9 + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + if(EquipEffectFunction(index, i) == FALSE){ + continue; + } + } + +#endif + + int id = CHAR_getItemIndex(index,i); + if( ITEM_CHECKINDEX(id) ){ + int j; + int attrib = 0; + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( i == CHAR_ARM +#ifdef _WAN_FIX + && CHAR_getWorkInt(index,CHAR_WORKBATTLEINDEX)==-1 +#endif + ){ +#ifdef _WAN_FIX + if(CHAR_getWorkInt(index,CHAR_WORKBATTLEPROTYPE)==1) + CHAR_setWorkInt(index,CHAR_WORKBATTLEPROTYPE,0); + else +#endif + CHAR_sendStatusString( index , "S"); + } +#endif + + + + for( j=0; j < arraysizeof( itemEffect ); j ++ ) { +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + + if( i == CHAR_EQSHIELD && CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPET){ + int item_type = ITEM_FIST; + item_type = ITEM_getInt( id, ITEM_TYPE ); + + // װʱ + if( item_type != ITEM_WSHIELD ){ + int k; + // ʿְҵܶ + for( k=0; kskill, SKILL_LEVEL); + skill_level = PROFESSION_CHANGE_SKILL_LEVEL_A( skill_level ); + rate = (skill_level * 3 + 20); + value = ITEM_getInt( id, itemEffect[j].itemdataintindex ) * rate / 100; + itemEffect[j].accumulation += value; + } + } + }else + itemEffect[j].accumulation += ITEM_getInt( id, itemEffect[j].itemdataintindex ); + }else +#endif + itemEffect[j].accumulation += ITEM_getInt( id, itemEffect[j].itemdataintindex ); + } + + attrib = ITEM_getInt( id, ITEM_MODIFYATTRIB); + if( attrib > 0 && attrib < 5) { + attribaccum[attrib - 1] += ITEM_getInt( id, ITEM_MODIFYATTRIBVALUE); + } + +#ifdef _ANGEL_SUMMON + //if( !strcmp( ITEM_getChar( id, ITEM_USEFUNC), "ITEM_AngelToken") ) { + if( ITEM_getInt( id, ITEM_ID) == ANGELITEM ) { + //print(" ʹװ "); + angelequip = TRUE; + } +#endif + + + } + } + +#ifdef _WAN_FIX + if(CHAR_getWorkInt(index,CHAR_WORKBATTLEPROTYPE)==1 && CHAR_getWorkInt(index,CHAR_WORKBATTLEINDEX)==-1) + CHAR_setWorkInt(index,CHAR_WORKBATTLEPROTYPE,0); +#endif + +#ifdef _ANGEL_SUMMON + if( angelmode == TRUE && angelequip == FALSE ) { + CHAR_setWorkInt( index, CHAR_WORKANGELMODE, FALSE); + CHAR_sendAngelMark( CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), 0); + print(" жʹ "); + } + if( angelmode == FALSE && angelequip == TRUE ) { + CHAR_setWorkInt( index, CHAR_WORKANGELMODE, TRUE); + CHAR_sendAngelMark( CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), 1); + CHAR_talkToCli( index, -1, "ܵ˾鱣ᱻ˹", CHAR_COLORYELLOW ); + print(" װʹ "); + } +#endif + +#ifdef _FIX_MAXCHARMP + for(i = 3 ; i < arraysizeof( itemEffect ) ; i ++ ){ +#else + for(i = 5 ; i < arraysizeof( itemEffect ) ; i ++ ){ +#endif + int work=0; + if( itemEffect[i].type == 1 ){ + work = itemEffect[i].accumulation; + }else{ + work = CHAR_getWorkInt(index,itemEffect[i].charmodifyparamindex) + itemEffect[i].accumulation; + work = min( itemEffect[i].max, work ); + work = max( itemEffect[i].min, work ); + } + CHAR_setWorkInt( index, itemEffect[i].charmodifyparamindex, work ); + } + + for( i = 0; i < 4; i ++ ) { + CHAR_setWorkInt( index, CHAR_WORKFIXEARTHAT + i, + CHAR_getWorkInt( index, CHAR_WORKFIXEARTHAT + i) + + attribaccum[i]); + } + + for( i = 0; i < 4; i ++ ) { + int j; + for( j = 0; j < 4; j ++ ) { + if( i != j ) { + CHAR_setWorkInt( index, CHAR_WORKFIXEARTHAT + j, + CHAR_getWorkInt(index, CHAR_WORKFIXEARTHAT + j) - attribaccum[i]); + } + } + } + + for( i = 0; i < 4; i ++ ) { + if( CHAR_getWorkInt( index, CHAR_WORKFIXEARTHAT + i) > CHAR_MAXATTRIB) { + CHAR_setWorkInt( index, CHAR_WORKFIXEARTHAT + i, CHAR_MAXATTRIB); + } + } + + { + int work; + work = CHAR_getWorkInt(index,CHAR_WORKFIXSTR)+ itemEffect[0].accumulation; + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, max( 0, work ) ); + work = CHAR_getWorkInt(index,CHAR_WORKFIXTOUGH) + itemEffect[1].accumulation; + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, max( -100, work ) ); + work = CHAR_getWorkInt( index, CHAR_WORKFIXDEX) + itemEffect[2].accumulation; + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, max( -100, work ) ); + } + +} + +void Other_DefcharWorkInt( int index) +{ + +#ifdef _SUIT_ITEM + int mfix,mtgh,mdex,mods,maxhp; + mfix = CHAR_getWorkInt( index, CHAR_WORKFIXSTR); + mtgh = CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH); + mdex = CHAR_getWorkInt( index, CHAR_WORKFIXDEX); + maxhp = CHAR_getWorkInt( index, CHAR_WORKMAXHP); + + mods = CHAR_getWorkInt( index, CHAR_WORKSUITMODSTR); + mfix = mfix+((mfix*mods)/100); + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, mfix+CHAR_getWorkInt( index, CHAR_WORKSUITSTR)); + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, mtgh+CHAR_getWorkInt( index, CHAR_WORKSUITTGH)); + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, mdex+CHAR_getWorkInt( index, CHAR_WORKSUITDEX)); + CHAR_setWorkInt( index, CHAR_WORKMAXHP, maxhp+ CHAR_getWorkInt( index, CHAR_WORKSUITVIT)); +#ifdef _SUIT_ADDPART3 + if( mfix > 0 ) + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, CHAR_getWorkInt( index, CHAR_WORKFIXSTR)+mfix*CHAR_getWorkInt( index, CHAR_WORKSUITSTR_P)/100.0); + if( mtgh > 0 ) + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH)+mtgh*CHAR_getWorkInt( index, CHAR_WORKSUITTGH_P)/100.0); + if( mdex > 0) + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, CHAR_getWorkInt( index, CHAR_WORKFIXDEX)+mdex*CHAR_getWorkInt( index, CHAR_WORKSUITDEX_P)/100.0); +#endif +#endif//_SUIT_ITEM + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + /*{ + int f_res = -1, i_res = -1, t_res = -1; + f_res = CHAR_getWorkInt( index, CHAR_WORK_F_RESIST ); + i_res = CHAR_getWorkInt( index, CHAR_WORK_I_RESIST ); + t_res = CHAR_getWorkInt( index, CHAR_WORK_T_RESIST ); + + CHAR_setWorkInt( index, CHAR_WORK_F_RESIST, f_res+CHAR_getWorkInt( index, CHAR_WORK_F_SUIT ) ); + CHAR_setWorkInt( index, CHAR_WORK_I_RESIST, i_res+CHAR_getWorkInt( index, CHAR_WORK_I_SUIT ) ); + CHAR_setWorkInt( index, CHAR_WORK_T_RESIST, t_res+CHAR_getWorkInt( index, CHAR_WORK_T_SUIT ) ); + }*/ +#endif + + +#ifdef _PETSKILL_SETDUCK + //profession fix + //ʹûرʽʱ,Ὣֵȥ30%Ȼ趨ɻرֵ,ֵ趨,Ҳԭ趨Ļرֵûһ,(Change)Ȱõ + /*if( CHAR_getWorkInt( index, CHAR_MYSKILLDUCK) > 0 ){ + int mtgh = CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH); + mtgh -= (mtgh*30)/100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_MYSKILLDUCKPOWER, mtgh); + }*/ +#endif +#ifdef _MAGICPET_SKILL + if( CHAR_getWorkInt( index, CHAR_MYSKILLSTR) > 0 ){ + int mpower, mdef; + mpower = CHAR_getWorkInt( index, CHAR_WORKFIXSTR); + mdef = CHAR_getWorkInt( index, CHAR_MYSKILLSTRPOWER); + mpower += (mtgh*mdef)/100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, mpower); + } + if( CHAR_getWorkInt( index, CHAR_MYSKILLTGH) > 0 ){ + int mpower, mdef; + mpower = CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH); + mdef = CHAR_getWorkInt( index, CHAR_MYSKILLTGHPOWER); + mpower += (mtgh*mdef)/100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, mpower); + } + if( CHAR_getWorkInt( index, CHAR_MYSKILLDEX) > 0 ){ + int mpower, mdef; + mpower = CHAR_getWorkInt( index, CHAR_WORKFIXDEX); + mdef = CHAR_getWorkInt( index, CHAR_MYSKILLDEXPOWER); + mpower += (mtgh*mdef)/100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, mpower); + } +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( CHAR_getWorkInt( index, CHAR_MYSKILLHIT) > 0 ){ + int mpower, mdef; + mpower = CHAR_getWorkInt( index, CHAR_MYSKILLHIT); + mdef = CHAR_getWorkInt( index, CHAR_WORKHITRIGHT); + mpower += (mtgh*mdef)/100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_MYSKILLHIT, mpower); + } + if( CHAR_getWorkInt( index, CHAR_WORK_WEAPON) > 0 ){ // ר + int mpower, mdef; + mpower = CHAR_getWorkInt( index, CHAR_WORKFIXSTR); + mdef = CHAR_getWorkInt( index, CHAR_WORKMOD_WEAPON); + mpower = mpower * ( 100 + mdef ) /100; + if( mtgh < 0 ) mtgh=0; + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, mpower); + } +#endif + +#ifdef _VARY_WOLF + if(CHAR_getInt( index, CHAR_BASEIMAGENUMBER)==101428){ + int Rands=0, power; + Rands = CHAR_getWorkInt( index, CHAR_SKILLSTRPOWER); + power = CHAR_getWorkInt( index, CHAR_WORKFIXSTR); + power = power + (power*Rands)/100; + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, power); + + Rands = CHAR_getWorkInt( index, CHAR_SKILLDEXPOWER); + power = CHAR_getWorkInt( index, CHAR_WORKFIXDEX); + power = power + (power*Rands)/100; + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, power); + } +#endif + +#ifdef _PROFESSION_ADDSKILL + if( CHAR_getWorkInt( index, CHAR_WORKFEAR ) > 0 ){ + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, CHAR_getWorkInt( index, CHAR_WORKFIXSTR ) - mfix*0.1 ); + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH ) - mtgh*0.1 ); + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, CHAR_getWorkInt( index, CHAR_WORKFIXDEX ) - mdex*0.2 ); + } +#endif + +#ifdef _MAGIC_WEAKEN + if(CHAR_getWorkInt(index,CHAR_WORKWEAKEN)>0){ + CHAR_setWorkInt( index, CHAR_WORKFIXSTR, CHAR_getWorkInt( index, CHAR_WORKFIXSTR)*0.8); + CHAR_setWorkInt( index, CHAR_WORKFIXTOUGH, CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH)*0.8); + CHAR_setWorkInt( index, CHAR_WORKFIXDEX, CHAR_getWorkInt( index, CHAR_WORKFIXDEX)*0.8); + CHAR_setWorkInt( index, CHAR_WORKWEAKEN, CHAR_getWorkInt( index, CHAR_WORKWEAKEN)-1); + } +#endif +#ifdef _MAGIC_BARRIER// vincent :ħ + if( CHAR_getWorkInt( index, CHAR_WORKBARRIER) > 0){ + CHAR_setWorkInt( index, CHAR_WORKBARRIER, CHAR_getWorkInt( index, CHAR_WORKBARRIER) - 1); + } +#endif + + CHAR_setWorkInt(index, CHAR_WORKATTACKPOWER, CHAR_getWorkInt( index, CHAR_WORKFIXSTR ) ); + CHAR_setWorkInt(index, CHAR_WORKDEFENCEPOWER, CHAR_getWorkInt( index, CHAR_WORKFIXTOUGH ) ); + CHAR_setWorkInt(index, CHAR_WORKQUICK, CHAR_getWorkInt( index, CHAR_WORKFIXDEX ) ); +} + +char* ITEM_getAppropriateName(int itemindex) +{ + int nameindex; + if( !ITEM_CHECKINDEX(itemindex ) )return "\0"; + if( ITEM_getInt(itemindex,ITEM_LEAKLEVEL) <= 0 ) + nameindex = ITEM_NAME; + else + nameindex = ITEM_SECRETNAME; + return ITEM_getChar(itemindex,nameindex); + +} + +char* ITEM_getEffectString( int itemindex ) +{ + if( !ITEM_CHECKINDEX(itemindex))return "\0"; + return ITEM_item[itemindex].itm.string[ITEM_EFFECTSTRING].string; +} + +char *ITEM_getItemInfoFromNumber( int itemid ) +{ + return ITEMTBL_getChar( itemid, ITEM_EFFECTSTRING); +} + +INLINE char* _ITEM_getNameFromNumber( char *file, int line, int itemid ) +{ + if( ITEM_CHECKITEMTABLE(itemid) == FALSE ){ + print("Can't Get ItemTable for:%d! - %s:%d\n",itemid, file, line); + return "\0"; + } + return ITEMTBL_getChar( itemid, ITEM_NAME); +} + +int ITEM_getcostFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_COST); +} + +int ITEM_getlevelFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_LEVEL); +} + +int ITEM_getgraNoFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_BASEIMAGENUMBER); +} + +int ITEM_getcanpetmailFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_CANPETMAIL); +} + +int ITEM_getvanishatdropFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_VANISHATDROP); +} + +int ITEM_getdropatlogoutFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_DROPATLOGOUT); +} + +int ITEM_getmergeItemFromFromITEMtabl( int itemid ) +{ + return ITEMTBL_getInt( itemid, ITEM_CANMERGEFROM); +} + +BOOL ITEM_canuseMagic( int itemindex) +{ + if( !ITEM_CHECKINDEX(itemindex))return FALSE; + if( MAGIC_getMagicArray( ITEM_item[itemindex].itm.data[ITEM_MAGICID]) != -1 ) { + return TRUE; + } + return FALSE; +} + +INLINE ITEM_Item *ITEM_getItemPointer( int index ) +{ + if(!ITEM_CHECKINDEX(index))return NULL; + return &ITEM_item[index].itm; +} + +int ITEM_isTargetValid( int charaindex, int itemindex, int toindex) +{ + int itemtarget; + int Myside; + itemtarget = ITEM_getInt( itemindex, ITEM_TARGET ); + + Myside = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLESIDE ); + if ((toindex >= 0x0) && (toindex <= 0x13)) return 0; + + if (toindex == 0x14) {//20 ȫ 0 + if (itemtarget == ITEM_TARGET_ALLMYSIDE){ + if( Myside == 0 )return 0; + }else if(itemtarget == ITEM_TARGET_ALLOTHERSIDE ){ + if( Myside == 1 )return 0; + } + }else if (toindex == 0x15) {//21 ȫ 1 + if (itemtarget == ITEM_TARGET_ALLMYSIDE){ + if( Myside == 1 )return 0; + }else if( itemtarget == ITEM_TARGET_ALLOTHERSIDE ){ + if( Myside == 0 )return 0; + } + }else if (toindex == 0x16) { + if (itemtarget == ITEM_TARGET_ALL) + return 0; + } + return -1; +} +// Nuke end + + +#ifdef _ITEM_CHECKWARES +BOOL CHAR_CheckInItemForWares( int charaindex, int flg) +{ + int itemindex, i; + char token[256]; + + for( i=0; i<24; i++) { + itemindex = CHAR_getItemIndex( charaindex, i); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + if( ITEM_getInt( itemindex, ITEM_TYPE) == ITEM_WARES ) { + if( flg == 0 ){ + return FALSE; + } + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + + CHAR_setItemIndex( charaindex, i ,-1); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( charaindex, i); + } + } + return TRUE; +} +#endif + +int ITEMTBL_getInt( int ItemID, ITEM_DATAINT datatype) +{ + if( datatype >= ITEM_DATAINTNUM || datatype < 0 ) return -1; + if( ITEM_CHECKITEMTABLE(ItemID) == FALSE )return -1; + return ITEM_tbl[ItemID].itm.data[datatype]; //new +} + +char *ITEMTBL_getChar( int ItemID, ITEM_DATACHAR datatype) +{ + if( datatype >= ITEM_DATACHARNUM || datatype < 0 ) return "\0"; + if( ITEM_CHECKITEMTABLE(ItemID) == FALSE )return "\0"; + return ITEM_tbl[ItemID].itm.string[datatype].string; //new +} + +INLINE BOOL ITEM_CHECKITEMTABLE( int number ) +{ + if( number < 0 || number >= ITEM_tblen ){ + //andy_log + print("ITEM_CHECKITEMTABLE() number:%d ITEM_tblen:%d !!\n", number, ITEM_tblen ); + return FALSE; + } + return ITEM_tbl[number].use; //new +} + +int ITEM_getItemDamageCrusheED( int itemindex) +{ + int crushe = ITEM_getInt( itemindex, ITEM_DAMAGECRUSHE); + int maxcrushe = ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE); + if(maxcrushe < 1)return -1; + if( maxcrushe > 1000000) maxcrushe = 1000000; + if( crushe > 1000000) crushe = 1000000; + + return ((int) (crushe*100)/maxcrushe); +} + +void ITEM_RsetEquit( int charaindex) +{ + int i, itemindex, ti=-1; + for( i=0; i /* strstr */ +#include /* isdigit, isalnum */ +#include "common.h" +#include "char.h" +#include "char_base.h" +#include "char_data.h" +#include "configfile.h" +#include "item.h" +#include "item_event.h" +#include "object.h" +#include "anim_tbl.h" +#include "magic.h" +#include "handletime.h" +#include "log.h" +#include "util.h" +#include "encount.h" +#include "battle.h" +#include "battle_item.h" +#include "lssproto_serv.h" +#include "net.h" +#include "pet.h" +#include "npcutil.h" +#include "enemy.h" +#ifdef _Item_ReLifeAct +#include "battle_magic.h" +#endif +#ifdef _ITEM_WARP_FIX_BI +extern tagRidePetTable ridePetTable[296]; +#endif +#include "pet_skill.h" + +#ifdef _CFREE_petskill +#include "npc_freepetskillshop.h" +#endif +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#endif +#include "sasql.h" + +#ifdef _ITEM_LUA +#include "npc_lua.h" +#include "npc_lua_interface.h" +#endif +extern int playeronlinenum; +extern char hanzibuf[5000][8]; +int ITEM_TimeDelCheck( int itemindex ) +{ + int icnt, jcnt, playernum; + playernum = CHAR_getPlayerMaxNum(); + for( icnt = 0; icnt < playernum; icnt ++ ) { + if( CHAR_CHECKINDEX( icnt ) ) { + for( jcnt = 0; jcnt < CHAR_MAXITEMHAVE; jcnt ++ ) { + if( CHAR_getItemIndex( icnt, jcnt ) == itemindex ) { + print( "Чʱѵֵߴ(%s)(%s)\n", + CHAR_getUseName(icnt),ITEM_getAppropriateName(itemindex) ); + return FALSE; + } + } + } + } + return TRUE; +} + +int ITEM_eventDrop( int itemindex, int charaindex, int itemcharaindex ) +{ + typedef void (*DROPF)(int,int); + char szBuffer[256]=""; + DROPF dropfunc=NULL; + + if( ITEM_CHECKINDEX(itemindex) == FALSE )return -1; + + dropfunc=(DROPF)ITEM_getFunctionPointer( itemindex, ITEM_DROPFUNC ); + if( dropfunc ){ + dropfunc( charaindex, itemindex ); + } +#ifdef _ALLBLUES_LUA_1_2 + else{ + RunItemDropEvent(charaindex, itemindex ); + } +#endif + if( ITEM_getInt( itemindex, ITEM_VANISHATDROP) != 1 && ITEM_getInt( itemindex, ITEM_TIME) < 1)return 0; + snprintf( szBuffer, sizeof( szBuffer), "%s ˡ", + ITEM_getAppropriateName(itemindex) ); + CHAR_talkToCli( charaindex, -1, szBuffer, CHAR_COLORWHITE ); + + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +#endif + "Drop&Delete(ʧ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + CHAR_setItemIndex( charaindex, itemcharaindex, -1); + ITEM_endExistItemsOne( itemindex ); + return 1; +} + +#undef UNDEF +#define UNDEF (-1) + +typedef struct { + char* cmd; /* ġ ٯ */ + char* onmessage; /* ٯ */ + char* offmessage; /* ٯ */ + int element; /* ޱئۢ */ + int maxElement; /* elementƥ϶ýľۢټ ëֹۢ */ +} ITEM_EFFECTPARAM; +static ITEM_EFFECTPARAM ITEM_restorableParam[] = { + {"hp", "HPظˡ", "HPˡ",CHAR_HP, CHAR_WORKMAXHP}, + {"mp", "MPظˡ", "MPˡ",CHAR_MP, CHAR_WORKMAXMP}, +}; +static ITEM_EFFECTPARAM ITEM_statusParam[] = { + {"po", CHAR_POISONSTRING, CHAR_RECOVERPOISONSTRING, + CHAR_POISON, UNDEF}, + + {"pa", CHAR_PARALYSISSTRING, CHAR_RECOVERPARALYSISSTRING, + CHAR_PARALYSIS, UNDEF}, + + {"si", CHAR_SILENCESTRING, CHAR_RECOVERSILENCESTRING, + CHAR_SLEEP,UNDEF}, + + {"st", CHAR_STONESTRING, CHAR_RECOVERSTONESTRING, CHAR_STONE, UNDEF}, + + {"da", CHAR_DARKNESSSTRING, CHAR_RECOVERDARKNESSSTRING, + CHAR_DRUNK,UNDEF}, + + {"co", CHAR_CONFUSIONSTRING,CHAR_RECOVERCONFUSIONSTRING, + CHAR_CONFUSION, UNDEF}, +}; + +/*#define LOCAL_DEBUG*/ +#ifdef LOCAL_DEBUG +#define DOUTFILE "doutfile" +#include +#include +static int eprintf(char* format, ...){ + va_list arg; + long len; + FILE* fp; + fp = fopen(DOUTFILE, "a"); + va_start(arg, format); + len = vfprintf(stderr, format, arg); + if(fp){ vfprintf(fp, format, arg); fclose(fp); } + va_end(arg); + return len; +} + +#define fprint eprintf +#endif + +static BOOL ITEM_isValidEffect(char* cmd, int value){ + int i; + + for(i=0; istring[ITEM_ARGUMENT].string; + if(* effectarg == '\0') return TRUE; + for(p=effectarg; *p != '\0'; ){ + int i; + if(*p == SEPARATORI) p++; + for(q=cmd, i=0; isalnum(*p) && i 0 ) + onoroff=ITEM_restorableParam[i].onmessage; + else if( amount < 0 ) + onoroff=ITEM_restorableParam[i].offmessage; + else + return FALSE; + strcpysafe( ansmsg, sizeof(ansmsg), onoroff ); + CHAR_talkToCli( charaindex, -1, ansmsg, CHAR_COLORWHITE); + return TRUE; +#else + if(value == ITEM_EFFECT_RESTORE_NORMAL){ + int maxv, curv, amount; + maxv =CHAR_getWorkInt(charaindex, ITEM_restorableParam[i].maxElement); + curv =CHAR_getInt(charaindex, ITEM_restorableParam[i].element); + amount = 30; + if(curv + amount < 0) amount = -curv; + CHAR_setInt(charaindex, ITEM_restorableParam[i].element, min((curv+amount), maxv)); + snprintf( ansmsg, sizeof(ansmsg), "%sظˡ", + ITEM_restorableParam[i].onmessage ); + CHAR_talkToCli( charaindex, -1, ansmsg, CHAR_COLORWHITE); + return TRUE; + }else if(value == ITEM_EFFECT_RESTORE_COMPLETE){ + int maxv; + maxv =CHAR_getWorkInt(charaindex, ITEM_restorableParam[i].maxElement); + CHAR_setInt(charaindex, ITEM_restorableParam[i].element, maxv); + snprintf( ansmsg, sizeof(ansmsg), "%sȫظ", ITEM_restorableParam[i].onmessage ); + CHAR_talkToCli( charaindex, -1, ansmsg, CHAR_COLORWHITE ); + return TRUE; + }else + return FALSE; +#endif + + } + } + if( value >= 0 ){ + int found = 0; + for(i=0; i (int)( itemputtime + getItemdeletetime() ) ) { + if( ITEM_TimeDelCheck( itemindex ) == FALSE ){ + return ; + } + { + LogItem( + "NULL", + "NULL", +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "TiemDelete", + OBJECT_getFloor( objindex ), + OBJECT_getX( objindex ), + OBJECT_getY( objindex ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + ITEM_endExistItemsOne(itemindex); + CHAR_ObjectDelete(objindex); + } +} + +void ITEM_useEffectTohelos( int charaindex, int to_charaindex, int haveitemindex) +{ + char buf[64]; + char msgbuf[64]; + int ret; + int itemindex; + int cutrate, limitcount; + int per; + int sendcharaindex = charaindex; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ret = getStringFromIndexWithDelim( ITEM_getChar(itemindex, ITEM_ARGUMENT) , + "|", 1, buf, sizeof( buf)); + if( ret != TRUE ) { + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "FieldErrorUse", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + ITEM_endExistItemsOne( itemindex); + return; + } + cutrate = atoi( buf); + if( cutrate < 0 ) cutrate = 0; + ret = getStringFromIndexWithDelim( ITEM_getChar(itemindex, ITEM_ARGUMENT) , + "|", 2, buf, sizeof( buf)); + if( ret != TRUE ) { + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "FieldUse", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + ITEM_endExistItemsOne( itemindex); + return; + } + limitcount = atoi( buf); + if( limitcount < 0) limitcount = 0; + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT) { + sendcharaindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + } + CHAR_setWorkInt( sendcharaindex, CHAR_WORK_TOHELOS_CUTRATE, cutrate); + CHAR_setWorkInt( sendcharaindex, CHAR_WORK_TOHELOS_COUNT, limitcount); + + snprintf( msgbuf, sizeof(msgbuf), + "ץ%s ", ITEM_getChar(itemindex, ITEM_NAME) ); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE ); + + if( sendcharaindex != charaindex ) { + snprintf( msgbuf, sizeof(msgbuf), + "%s ץ %s ", + CHAR_getChar( charaindex, CHAR_NAME), + ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( sendcharaindex, -1, msgbuf, CHAR_COLORWHITE ); + } + + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "FieldUse", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + ITEM_endExistItemsOne( itemindex); + per = ENCOUNT_getEncountPercentMin( sendcharaindex, + CHAR_getInt( sendcharaindex, CHAR_FLOOR), + CHAR_getInt( sendcharaindex, CHAR_X), + CHAR_getInt( sendcharaindex, CHAR_Y)); + if( per != -1) { + CHAR_setWorkInt( sendcharaindex, CHAR_WORKENCOUNTPROBABILITY_MIN, per); + } + per = ENCOUNT_getEncountPercentMax( sendcharaindex, + CHAR_getInt( sendcharaindex, CHAR_FLOOR), + CHAR_getInt( sendcharaindex, CHAR_X), + CHAR_getInt( sendcharaindex, CHAR_Y)); + if( per != -1) { + CHAR_setWorkInt( sendcharaindex, CHAR_WORKENCOUNTPROBABILITY_MAX, per); + } + CHAR_sendStatusString( sendcharaindex, "E" ); +} + +void ITEM_dropMic( int charaindex , int itemindex ) +{ + if( !ITEM_CHECKINDEX( itemindex )) return; + + CHAR_setWorkInt( charaindex, CHAR_WORKFLG, + CHAR_getWorkInt( charaindex, CHAR_WORKFLG ) & ~WORKFLG_MICMODE ); +} + +void ITEM_useMic_Field( int charaindex, int to_charaindex, int haveitemindex ) +{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKFLG ) & WORKFLG_MICMODE ){ + CHAR_setWorkInt( charaindex, CHAR_WORKFLG, + CHAR_getWorkInt( charaindex, CHAR_WORKFLG ) & ~WORKFLG_MICMODE ); + CHAR_talkToCli( charaindex, -1, "˷趨ΪOFF", CHAR_COLORWHITE); + }else{ + CHAR_setWorkInt( charaindex, CHAR_WORKFLG, + CHAR_getWorkInt( charaindex, CHAR_WORKFLG ) | WORKFLG_MICMODE ); + CHAR_talkToCli( charaindex, -1, "˷趨ΪON", CHAR_COLORWHITE); + } +} +#if 1 +char *aszHealStringByOwn[] = { + "%s;ظ%d", + "%sظ%d", + "%s%d", + "%sҳ϶%d", + "" +}; + +char *aszDownStringByOwn[] = { + "%s;%d", + "%s%d", + "%s½%d", + "%sҳ϶½%d", + "" +}; + +char *aszHealStringByOther[] = { + "%s%s;ظ%d", + "%s%sظ%d", + "%s%s%d", + "%s%sҳ϶%d", + "" +}; + +char *aszDownStringByOther[] = { + "%s%s;%d", + "%s%s%d", + "%s%s%d", + "%s%sҳ϶ȼ%d", + "" +}; + +char *aszKeyString[] = {"", "", "", "", ""}; +int aHealInt[] = { CHAR_HP, CHAR_MP, CHAR_CHARM, CHAR_VARIABLEAI, -1 }; +int aHealMaxWork[] = { CHAR_WORKMAXHP, CHAR_WORKMAXMP, -1, -1, -1 }; + +void ITEM_useRecovery_Field( + int charaindex, + int toindex, + int haveitemindex +){ + int work, workmax, workmin; + int power[BD_KIND_END] = {0,0,0}, + prevhp = 0, + workhp = 0, + recovery[BD_KIND_END] = {0,0,0}; + int itemindex, kind = BD_KIND_HP, HealFlg = 0, j; + char *p = NULL, *arg, msgbuf[256]; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_CHECKINDEX( toindex ) == FALSE )return ; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( arg == "\0" ) return; + +#ifdef _ITEM_UNBECOMEPIG + if( (p = strstr( arg, "" )) != NULL ){ + if( CHAR_getInt( toindex, CHAR_BECOMEPIG ) > -1 ){ + CHAR_setInt( toindex, CHAR_BECOMEPIG, -1 ); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_talkToCli( toindex,-1,"ʧЧˡ",CHAR_COLORWHITE); + CHAR_DelItemMess( charaindex, haveitemindex, 0); + } + return; + } +#endif +#ifdef _ITEM_LVUPUP + if( (p = strstr( arg, "LVUPUP" ) ) != NULL ){ + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + int pidx=0,lvup=0,lv=0; + sprintf( msgbuf, "%s", p+7 ); + pidx = atoi( strtok( msgbuf, " " ) ); + if( pidx != CHAR_getInt( toindex, CHAR_PETID) || CHAR_getInt(toindex, CHAR_LIMITLEVEL) == 0 ){ + CHAR_talkToCli( charaindex,-1,"޷ʹ",CHAR_COLORWHITE); + return; + } + lv = CHAR_getInt( toindex, CHAR_LV ); + if( lv < 10 || lv >= 140 ){ + CHAR_talkToCli( charaindex,-1,"Ŀǰȼ޷ʹ",CHAR_COLORWHITE); + return; + } + if( (p = strstr( arg, "" )) != NULL ) + lvup=2; + if( (p = strstr( arg, "ˮ" )) != NULL ) + lvup=3; + if( (p = strstr( arg, "" )) != NULL ) + lvup=0; + if( (p = strstr( arg, "" )) != NULL ) + lvup=1; + if( lv%4 != lvup || CHAR_getInt(toindex, CHAR_LIMITLEVEL)-lv >= 1 ){// + CHAR_talkToCli( charaindex,-1,"Ƴӡʧ",CHAR_COLORWHITE); + CHAR_DelItemMess( charaindex, haveitemindex, 0); + return; + } + CHAR_setInt(toindex, CHAR_LIMITLEVEL, CHAR_getInt(toindex, CHAR_LIMITLEVEL)+1); + CHAR_talkToCli( charaindex,-1,"ӡħߵȼ",CHAR_COLORWHITE); + if( CHAR_getInt(toindex, CHAR_LIMITLEVEL) == 140 ){ + CHAR_setInt(toindex, CHAR_LIMITLEVEL, 0); + CHAR_talkToCli( charaindex,-1,"ӡħ",CHAR_COLORWHITE); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + } + return; + } + if( (p = strstr( arg, "UPUPLV" ) ) != NULL ){ + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + int pidx=0,lv=0; + sprintf( msgbuf, "%s", p+7 ); + pidx = atoi( strtok( msgbuf, " " ) ); + if( pidx != CHAR_getInt( toindex, CHAR_PETID) || CHAR_getInt(toindex, CHAR_LIMITLEVEL) == 0 ){ + CHAR_talkToCli( charaindex,-1,"޷ʹ",CHAR_COLORWHITE); + return; + } + lv = CHAR_getInt( toindex, CHAR_LV ); + if( lv < 125 || lv > 140 ){ + CHAR_talkToCli( charaindex,-1,"Ŀǰȼ޷ʹ",CHAR_COLORWHITE); + return; + } + CHAR_setInt(toindex, CHAR_LIMITLEVEL, 0); + CHAR_talkToCli( charaindex,-1,"ӡħ",CHAR_COLORWHITE); + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + } + return; + } +#endif +#ifdef _ITEM_PROPERTY + if( (p = strstr( arg, "PROPERTY" ) ) != NULL ){ + //print("ˮ:%s", arg ); + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) + return; + if( (p = strstr( arg, "+" ) ) != NULL ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + } + if( (p = strstr( arg, "-" ) ) != NULL ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( toindex , + CHAR_P_STRING_EARTH | + CHAR_P_STRING_WATER | + CHAR_P_STRING_FIRE | + CHAR_P_STRING_WIND + ); + return; + } +#endif +#ifdef _ITEM_PROPERTY + if( (p = strstr( arg, "PROPETPERTY" ) ) != NULL ){ + //print("ˮ:%s", arg ); + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)!=CHAR_TYPEPET) + return; + if( (p = strstr( arg, "+" ) ) != NULL ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + } + if( (p = strstr( arg, "-" ) ) != NULL ){//ת ת + if( CHAR_getInt( toindex, CHAR_EARTHAT ) == 100 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) == 100 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) == 100 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ); + else if( CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 && CHAR_getInt( toindex, CHAR_WATERAT ) > 0 ) + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )+10 ), + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WATERAT ) > 0 && CHAR_getInt( toindex, CHAR_FIREAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WATERAT, CHAR_getInt( toindex, CHAR_WATERAT )+10 ), + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_FIREAT ) > 0 && CHAR_getInt( toindex, CHAR_WINDAT ) > 0 ) + CHAR_setInt( toindex, CHAR_FIREAT, CHAR_getInt( toindex, CHAR_FIREAT )+10 ), + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )-10 ); + else if( CHAR_getInt( toindex, CHAR_WINDAT ) > 0 && CHAR_getInt( toindex, CHAR_EARTHAT ) > 0 ) + CHAR_setInt( toindex, CHAR_WINDAT, CHAR_getInt( toindex, CHAR_WINDAT )+10 ), + CHAR_setInt( toindex, CHAR_EARTHAT, CHAR_getInt( toindex, CHAR_EARTHAT )-10 ); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); +// CHAR_complianceParameter( charaindex ); +// CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + int z; + for( z = 0; z < CHAR_MAXPETHAVE; z ++ ) { + int workpetindex = CHAR_getCharPet( charaindex, z ); + if( workpetindex == toindex ){ + CHAR_send_K_StatusString( charaindex, z, CHAR_K_STRING_EARTH|CHAR_K_STRING_WATER|CHAR_K_STRING_FIRE|CHAR_K_STRING_WIND); + } + } + return; + } +#endif +#ifdef _PET_RESET + if( (p = strstr( arg, "RESETPET" ) ) != NULL ){ + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)!=CHAR_TYPEPET) + return; + if(CHAR_getInt(toindex, CHAR_PETENEMYID)<=0){ + CHAR_talkToCli( charaindex,-1,"˳ϻ޷¯",CHAR_COLORRED); + return; + } + int petpoint = sasql_resetpet_point(CHAR_getInt(toindex, CHAR_PETENEMYID)); + if(petpoint<0){ + CHAR_talkToCli( charaindex,-1,"˳޷¯",CHAR_COLORRED); + return; + }else{ + CHAR_setWorkInt(charaindex,CHAR_WORKRESETPETINDEX,toindex); + int fd = getfdFromCharaIndex( charaindex); + char petbuf[512]; + sprintf(petbuf,"Ҫ¯ֻ%s\n" + "¯ֻҪʷѣ%d\n\n" + "رע\n" + "1¯ɾԭһֻ\n" + "2¯зգɳδҪϸġ",CHAR_getChar(toindex,CHAR_NAME),petpoint); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_RESETPET, + -1, + petbuf); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + return; + } + + if( (p = strstr( arg, "RESETBDPET" ) ) != NULL ){ + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)!=CHAR_TYPEPET) + return; + if(CHAR_getInt(toindex, CHAR_PETENEMYID)<=0){ + CHAR_talkToCli( charaindex,-1,"˳ϻ޷¯",CHAR_COLORRED); + return; + } + int petpoint = sasql_resetbdpet_point(CHAR_getInt(toindex, CHAR_PETENEMYID)); + if(petpoint<0){ + CHAR_talkToCli( charaindex,-1,"˳޷¯",CHAR_COLORRED); + return; + }else{ + CHAR_setWorkInt(charaindex,CHAR_WORKRESETPETINDEX,toindex); + int fd = getfdFromCharaIndex( charaindex); + char petbuf[512]; + sprintf(petbuf,"Ҫ󶨻¯ֻ%s\n" + "󶨻¯ֻҪʷѣ%d\n\n" + "رע\n" + "1¯ɾԭһֻ\n" + "2¯зգɳδҪϸġ\n" + "3󶨻¯󣬸ó޷װ̯",CHAR_getChar(toindex,CHAR_NAME),petpoint); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_RESETBDPET, + -1, + petbuf); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + return; + } +#endif +#ifdef _ITEM_ADDPETEXP + if( (p = strstr( arg, "GETEXP" )) != NULL ){ + if (CHAR_getInt(toindex, CHAR_WHICHTYPE)==CHAR_TYPEPET){ + getStringFromIndexWithDelim( arg, "|", 2, msgbuf,sizeof( msgbuf));// + if( atoi(msgbuf) == CHAR_getInt( toindex, CHAR_PETID) ){ + getStringFromIndexWithDelim( arg, "|", 3, msgbuf,sizeof( msgbuf));//ȼ(ȼſ) + if( CHAR_getInt( toindex, CHAR_LV ) >= atoi(msgbuf) ){ + getStringFromIndexWithDelim( arg, "|", 4, msgbuf,sizeof( msgbuf));//ֵ + if( CHAR_getInt( toindex, CHAR_LV) < CHAR_MAXUPLEVEL ){ + int UpLevel = 0; + CHAR_setWorkInt( toindex, CHAR_WORKGETEXP, atoi(msgbuf) );//شCHAR_WORKGETEXP + CHAR_AddMaxExp( toindex, CHAR_getWorkInt( toindex, CHAR_WORKGETEXP ) ); + sprintf( msgbuf,"ʯͷ治֪ʲĿҿ(Ӿ%d)", CHAR_getWorkInt( toindex, CHAR_WORKGETEXP ) ); + CHAR_talkToCli( charaindex,-1,msgbuf,CHAR_COLORWHITE); + UpLevel = CHAR_LevelUpCheck( toindex , charaindex); + if( UpLevel > 0 ){ + if( getBattleDebugMsg( ) != 0 ){ + snprintf( msgbuf, sizeof(msgbuf), + "(%s) %d", + CHAR_getUseName( toindex ), + CHAR_getInt( toindex, CHAR_LV ) ); + BATTLE_talkToCli( charaindex, msgbuf, CHAR_COLORYELLOW ); + } + } + for( j = 0; j < UpLevel; j ++ ){ + CHAR_PetLevelUp( toindex ); + CHAR_PetAddVariableAi( toindex, AI_FIX_PETLEVELUP ); + } + CHAR_complianceParameter( toindex ); + } + else{ + CHAR_talkToCli( charaindex,-1,"ʹ",CHAR_COLORWHITE); + } + /*CHAR_send_P_StatusString( charindex, CHAR_P_STRING_DUELPOINT| + CHAR_P_STRING_TRANSMIGRATION| CHAR_P_STRING_RIDEPET| + CHAR_P_STRING_BASEBASEIMAGENUMBER| CHAR_P_STRING_GOLD| + CHAR_P_STRING_EXP| CHAR_P_STRING_LV| CHAR_P_STRING_HP|CHAR_P_STRING_LEARNRIDE); + */ + } + else + CHAR_talkToCli( charaindex,-1,"ʯͷ....(޷б޷Ӿ)",CHAR_COLORWHITE); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + return; + } + else{ + CHAR_talkToCli( charaindex,-1,"ʹ",CHAR_COLORWHITE); + } + } +#endif + for( j = 0; j < BD_KIND_END; j ++ ){ + power[j] = 0; + recovery[j] = 0; + } + if( (p = strstr( arg, "ȫ" )) != NULL ){ + HealFlg = ( 1 << BD_KIND_HP ); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){ + }else{ + HealFlg |= ( 1 << BD_KIND_MP ); + } + power[BD_KIND_HP] = 10000000; + power[BD_KIND_MP] = 100; + } + kind = BD_KIND_HP; + if( (p = strstr( arg, aszKeyString[kind] )) != NULL ){ + HealFlg |= ( 1 << kind ); + if( sscanf( p+2, "%d", &work ) != 1 ){ + power[kind] = 1; + }else{ + power[kind] = RAND( (work*0.9), (work*1.1) ); + } +#ifndef _MAGIC_REHPAI + power[kind] *= GetRecoveryRate( toindex ); +#endif + } + kind = BD_KIND_MP; + if( (p = strstr( arg, aszKeyString[kind] )) != NULL + && CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + HealFlg |= ( 1 << kind ); + if( sscanf( p+2, "%d", &work ) != 1 ){ + power[kind] = 1; + }else{ + power[kind] = RAND( (work*0.9), (work*1.1) ); + } + } + kind = BD_KIND_AI; + if( (p = strstr( arg, aszKeyString[kind] )) != NULL + && CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET){ + HealFlg |= ( 1 << kind ); + if( sscanf( p+2, "%d", &work ) != 1 ){ + power[kind] = 1; + }else{ + power[kind] = RAND( (work*0.9), (work*1.1) ); + } + power[kind] *= 100; + } + kind = BD_KIND_CHARM; + if( (p = strstr( arg, aszKeyString[kind] )) != NULL + && CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ + HealFlg |= ( 1 << kind ); + if( sscanf( p+2, "%d", &work ) != 1 ){ + power[kind] = 1; + }else{ + power[kind] = RAND( (work*0.9), (work*1.1) ); + } + } + if( HealFlg == 0 )return; +#ifdef _TYPE_TOXICATION + if( CHAR_CanCureFlg( toindex, "HP") == FALSE )return; +#endif + + for( j = 0; j < BD_KIND_END; j ++ ){ + if( ( HealFlg & ( 1 << j ) ) == 0 )continue; + prevhp = CHAR_getInt( toindex, aHealInt[j] ); + workhp = prevhp + (int)power[j]; + + if( j == BD_KIND_CHARM ){ + workmax = 100; + workmin = 0; + }else + if( j == BD_KIND_AI ){ + workmax = 10000; + workmin = -10000; + }else{ + workmax = CHAR_getWorkInt( toindex, aHealMaxWork[j] ); + workmin = 1; + } + workhp = min( workhp, workmax ); + workhp = max( workhp, workmin ); + CHAR_setInt( toindex, aHealInt[j], workhp ); + recovery[j] = workhp - prevhp; + if( j == BD_KIND_AI ){ + recovery[j] *= 0.01; + } + } + CHAR_complianceParameter( toindex ); + + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + if( charaindex != toindex ) { + CHAR_send_P_StatusString( toindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP|CHAR_P_STRING_CHARM); + } + } + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP|CHAR_P_STRING_CHARM); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && + CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ){ + CHAR_PartyUpdate( toindex, CHAR_N_STRING_HP|CHAR_N_STRING_MP ); + } + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){ + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int workindex = CHAR_getCharPet( charaindex, i ); + if( workindex == toindex ){ + CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP|CHAR_K_STRING_AI); + } + } + } + + + for( j = 0; j < BD_KIND_END; j ++ ){ + if( ( HealFlg & ( 1 << j ) ) == 0 )continue; + if( charaindex != toindex) { + if( power[j] >= 0 ){ + snprintf( msgbuf, sizeof( msgbuf), + aszHealStringByOwn[j], + CHAR_getUseName( toindex ), recovery[j] ); + }else{ + snprintf( msgbuf, sizeof( msgbuf), + aszDownStringByOwn[j], + CHAR_getUseName( toindex ), -recovery[j] ); + } + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + if( power[j] >= 0 ){ + snprintf( msgbuf, sizeof( msgbuf), + aszHealStringByOther[j], + CHAR_getUseName( charaindex ), + CHAR_getUseName( toindex ), recovery[j] ); + }else{ + snprintf( msgbuf, sizeof( msgbuf), + aszDownStringByOther[j], + CHAR_getUseName( charaindex ), + CHAR_getUseName( toindex ), -recovery[j] ); + } + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE); + } + }else { + if( power[j] >= 0 ){ + snprintf( msgbuf, sizeof( msgbuf), + aszHealStringByOwn[j], + CHAR_getUseName( charaindex ), recovery[j] ); + }else{ + snprintf( msgbuf, sizeof( msgbuf), + aszDownStringByOwn[j], + CHAR_getUseName( charaindex ), -recovery[j] ); + } + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + } + } + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "FieldUse", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + CHAR_DelItemMess( charaindex, haveitemindex, 0); + +} + +#endif + +void ITEM_useRecovery( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useRecovery_Battle( charaindex, toindex, haveitemindex ); + }else{ + ITEM_useRecovery_Field( charaindex, toindex, haveitemindex ); + } + +} + +#ifdef _ITEM_MAGICRECOVERY +void ITEM_useMRecovery( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useMRecovery_Battle( charaindex, toindex, haveitemindex ); + }else{ +// ITEM_useRecovery_Field( charaindex, toindex, haveitemindex ); + } + +} + +#endif + +#ifdef _ITEM_USEMAGIC +void ITEM_useMagic( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useMagic_Battle( charaindex, toindex, haveitemindex ); + } +} +#endif + +#ifdef _PET_LIMITLEVEL +void ITEM_useOtherEditBase( int charaindex, int toindex, int haveitemindex) +{ + int itemindex,i; + int work[4]; + int num=-1,type; + int LevelUpPoint,petrank; + char buf1[256]; + char buf2[][32]={"ɳ",";ɳ","ٶȳɳ","ɳ",""}; + char buf3[][32]={"","Ϊ","Ϊ"}; + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( CHAR_getInt( toindex, CHAR_PETID) == 718 +#ifdef _PET_2LIMITLEVEL + || CHAR_getInt( toindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( toindex, CHAR_PETID) == getMMPETID2() +#endif + ) { + + int maxnums=50; + + if( CHAR_getInt( toindex,CHAR_LV ) < 74 ) { + sprintf(buf1,"ҵ𣿺ร˱仯"); + CHAR_talkToCli( charaindex, toindex, buf1, CHAR_COLORWHITE); + num = ITEM_MODIFYATTACK; + LevelUpPoint = CHAR_getInt( toindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( toindex, CHAR_PETRANK ); + work[3] =(( LevelUpPoint >> 24 ) & 0xFF); + work[0] = (( LevelUpPoint >> 16 ) & 0xFF); + work[1] = (( LevelUpPoint >> 8 ) & 0xFF); + work[2] = (( LevelUpPoint >> 0 ) & 0xFF); + for( i=0; i<4; i++) { + type = ITEM_getInt( itemindex, (num + i)); + work[i] += type; + strcpy( buf1,"\0"); + if( work[i] > maxnums ) { + sprintf(buf1,"%s Ѿﵽˡ", buf2[i]); + work[i] = maxnums; + }else if( work[i] < 0 ) { + sprintf(buf1,"%s ѾΪˡ", buf2[i]); + work[i] = 0; + }else { + if( type > 0 ) { + if( type > 2 ) + sprintf(buf1,"%s %s %s", buf2[i], buf3[0], ""); + else + sprintf(buf1,"%s %s %s", buf2[i], buf3[1], ""); + }else if( type < 0 ){ + sprintf(buf1,"%s %s %s", buf2[i], buf3[2], ""); + } + } + if( strcmp( buf1, "\0")) { + CHAR_talkToCli( charaindex, toindex, buf1, CHAR_COLORWHITE); + } + } + + LevelUpPoint = ( work[3]<< 24) + ( work[0]<< 16) + ( work[1]<< 8) + ( work[2]<< 0); + CHAR_setInt( toindex, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_setInt( toindex, CHAR_PETRANK, petrank); + LogPetPointChange( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ) + ); + } + + }else { + sprintf(buf1,""); + } + CHAR_DelItem( charaindex, haveitemindex); + return; +} +#endif + +void ITEM_useStatusChange( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; // + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useStatusChange_Battle( charaindex, toindex, haveitemindex ); + }else{ + } + +} + +void ITEM_useStatusRecovery( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; // + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useStatusRecovery_Battle( charaindex, toindex, haveitemindex ); + }else{ + } +} + +void ITEM_useMagicDef( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useMagicDef_Battle( charaindex, toindex, haveitemindex ); + }else{ + } + +} + +void ITEM_useParamChange( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useParamChange_Battle( charaindex, toindex, haveitemindex ); + } +} + +void ITEM_useFieldChange( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useFieldChange_Battle( charaindex, toindex, haveitemindex ); + } +} + +void ITEM_useAttReverse( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useAttReverse_Battle( charaindex, toindex, haveitemindex ); + }else{ + } +} + +void ITEM_useMic( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + }else{ + ITEM_useMic_Field( charaindex, toindex, haveitemindex ); + } + +} + +void ITEM_useCaptureUp( int charaindex, int toindex, int haveitemindex) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return ; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + }else + if( battlemode ){ + ITEM_useCaptureUp_Battle( charaindex, toindex, haveitemindex ); + }else{ + } + +} + +#ifdef _PETSKILL_CANNEDFOOD +static void ITEM_usePetSkillCanned_PrintWindow( int charaindex, int flg) +{ + int fd; + char message[256], buf[2048]; + if( !CHAR_CHECKINDEX( charaindex )) return; + fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + + sprintf( message, "%d", flg); + lssproto_WN_send( fd, WINDOWS_MESSAGETYPE_PETSKILLSHOW, + WINDOW_BUTTONTYPE_NONE, + ITEM_WINDOWTYPE_SELECTPETSKILL_SELECT, + -1, + makeEscapeString( message, buf, sizeof( buf))); +} + +void ITEM_usePetSkillCanned_WindowResult( int charaindex, int seqno, int select, char * data) +{ + int itemindex=-1, itemNo, petindex=-1, petNo; + int SkillNo, SkillID; + char buf1[256]; + char *skillarg=NULL; + + petNo = CHAR_getWorkInt( charaindex, CHAR_WORKRENAMEITEMNUM); + itemNo = CHAR_getWorkInt( charaindex, CHAR_WORKRENAMEITEMINDEX); + + + itemindex = CHAR_getItemIndex( charaindex, itemNo); + if( !ITEM_CHECKINDEX( itemindex) ) return; + petindex = CHAR_getCharPet( charaindex, petNo); + if( !CHAR_CHECKINDEX(petindex) ) return; + SkillNo = atoi( data); + if( SkillNo < 0 || SkillNo >= CHAR_MAXPETSKILLHAVE ) return; + + if(strcmp(ITEM_getChar( itemindex, ITEM_USEFUNC),"ITEM_useSkillCanned")){ + CHAR_talkToCli( charaindex, -1, "ֹǷѧϰ\ܣ", CHAR_COLORRED); + return; + } + + skillarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + SkillID = atoi( skillarg); + +#ifdef _PETSKILL_SHOP_LUA + if(FreePetSkillShop(charaindex, petindex, CHAR_getPetSkill(petindex, SkillNo), SkillID) == FALSE ) { + return; + } +#endif +#ifdef _CFREE_petskill + if( NPC_CHECKFREEPETSKILL( charaindex, petindex, SkillID) == FALSE ){ + CHAR_talkToCli( charaindex, -1, "ó޷ѧϰܣ", CHAR_COLORYELLOW); + return; + } +#endif + + CHAR_setPetSkill( petindex, SkillNo, SkillID); + snprintf( buf1, sizeof( buf1 ), "W%d", petNo); + CHAR_sendStatusString( charaindex, buf1 ); + CHAR_sendStatusString( charaindex, "P"); + { + int skillarray = PETSKILL_getPetskillArray( SkillID); + sprintf( buf1, "%sѧϰ%s %sʧˡ", + CHAR_getUseName( petindex), PETSKILL_getChar( skillarray, PETSKILL_NAME), + ITEM_getChar( itemindex, ITEM_NAME) ); + } + + CHAR_talkToCli( charaindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_setItemIndex( charaindex, itemNo ,-1); + CHAR_sendItemDataOne( charaindex, itemNo); + ITEM_endExistItemsOne( itemindex); +} + +#endif + +static void ITEM_useRenameItem_PrintWindow( int charaindex, int page) +{ + int fd; + int pos = 0; + int i; + int btntype = WINDOW_BUTTONTYPE_CANCEL; + char message[1024]; + char msgwk[1024]; + char buf[2048]; + + if( !CHAR_CHECKINDEX( charaindex )) return; + if( page < 0 || page > 3 ) { + print( "%s:%d err\n", __FILE__, __LINE__); + return; + } + fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + + snprintf( message, sizeof( message), + "2\n ҪǸĿ\n" + " Page:%d\n", page +1); + + for( i = page *5; i < page *5 +5; i ++ ) { + int itemindex = CHAR_getItemIndex( charaindex, i); + BOOL flg = FALSE; + while( 1 ) { + char *cdkey; + if( !ITEM_CHECKINDEX( itemindex)) break; + cdkey = ITEM_getChar( itemindex, ITEM_CDKEY); + if( !cdkey) { + print( "%s:%d err\n", __FILE__, __LINE__); + break; + } + if( ITEM_getInt( itemindex, ITEM_MERGEFLG) != 1) break; + if( ITEM_getInt( itemindex, ITEM_TYPE) == ITEM_DISH) break; + if( ITEM_getInt( itemindex, ITEM_CRUSHLEVEL) != 0 ) break; + if( strlen( cdkey) != 0 ) { + if( strcmp( cdkey, CHAR_getChar( charaindex, CHAR_CDKEY)) != 0 ) { + break; + } + } + flg = TRUE; + break; + } + if( flg ) { + char *nm = ITEM_getChar( itemindex, ITEM_SECRETNAME); + char wk[256]; + if( pos +strlen( nm) +1 > sizeof( msgwk)) { + print( "buffer over error %s:%d\n", __FILE__, __LINE__); + break; + } + snprintf( wk, sizeof( wk), "%s\n", nm); + strncpy( &msgwk[pos], wk, sizeof( msgwk) -pos -1); + pos += strlen( wk); + } + else { + if( pos +2 > sizeof( msgwk)) { + print( "buffer over error %s:%d\n", __FILE__, __LINE__); + break; + } + strncpy( &msgwk[pos], "\n", sizeof( msgwk) -pos -1 ); + pos += 1; + } + } + strcat( message, msgwk); + switch( page){ + case 0: + btntype |= WINDOW_BUTTONTYPE_NEXT; + break; + case 3: + btntype |= WINDOW_BUTTONTYPE_PREV; + break; + case 1: + case 2: + btntype |= WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + break; + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + btntype, + CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE1+page, + -1, + makeEscapeString( message, buf, sizeof(buf))); +} + +void ITEM_useRenameItem( int charaindex, int toindex, int haveitemindex) +{ + + ITEM_useRenameItem_PrintWindow( charaindex, 0); + + CHAR_setWorkInt( charaindex, CHAR_WORKRENAMEITEMNUM, -1); + CHAR_setWorkInt( charaindex, CHAR_WORKRENAMEITEMINDEX, haveitemindex); +/* + char buf[256]; + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) ) return; + sprintf( buf, "%sѱȡ", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, "ѱȡ", CHAR_COLORRED ); + + { + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + itemindex, + "ħDEL", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + + CHAR_setItemIndex( charaindex, haveitemindex, -1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne( itemindex ); +*/ +} + +void ITEM_useRenameItem_WindowResult( int charaindex, int seqno, int select, char * data) +{ + int page = 0; + int fd; + if( select == WINDOW_BUTTONTYPE_CANCEL) return; + + fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + if( seqno != CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME ) { + if( select == WINDOW_BUTTONTYPE_NEXT ) page = 1; + else if( select == WINDOW_BUTTONTYPE_PREV ) page = -1; + if( select == WINDOW_BUTTONTYPE_NEXT || select == WINDOW_BUTTONTYPE_PREV ) { + int winno = seqno - CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE1; + winno += page; + if( winno < 0 ) winno = 0; + if( winno > 3 ) winno = 3; + ITEM_useRenameItem_PrintWindow( charaindex, winno); + }else { + char message[1024]; + char buf[2048]; + char haveitemindex = CHAR_getWorkInt( charaindex, CHAR_WORKRENAMEITEMNUM); + int itemindex; + if( haveitemindex == -1 ) { + haveitemindex = (seqno - CHAR_WINDOWTYPE_SELECTRENAMEITEM_PAGE1) * 5 + + ( atoi(data)-1); + CHAR_setWorkInt( charaindex, CHAR_WORKRENAMEITEMNUM, haveitemindex); + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + + snprintf( message, sizeof( message), + "%s Ҫ\n" + "\n" + "ȫ13, 26", + ITEM_getChar( itemindex, ITEM_NAME)); + + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME, + -1, + makeEscapeString( message, buf, sizeof(buf))); + + } + } + else { + BOOL flg = FALSE; + char message[1024]; + char buf[2048]; + while( 1 ) { + char *p; + if( strlen( data) > 26 || strlen( data) < 1) { + if( strlen( data) > 26 ) { + strcpy( message, ""); + }else { + strcpy( message, "һ"); + } + break; + } + + // WON ADD ħʸ + flg = TRUE; + + for( p = data; *p ; p ++) { + if( *p == ' '){ + strcpy( message, "ɿհ"); + flg = FALSE; + break; + } + if( strncmp( p, "",2) == 0 ) { + strcpy( message, "ɿհ"); + flg = FALSE; + break; + } + if( *p == '|'){ + strcpy( message, ""); + flg = FALSE; + break; + } + } + + break; + } + + + if( !flg ) { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_SELECTRENAMEITEM_RENAME_ATTENTION, + -1, + makeEscapeString( message, buf, sizeof(buf))); + } + else { + char haveitemindex = CHAR_getWorkInt( charaindex, CHAR_WORKRENAMEITEMNUM); + int itemindex; + int renameitemindex; + int renameitemhaveindex; + int remain; + char msgbuf[128]; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex)) { + print( "%s %d err\n", __FILE__, __LINE__); + return; + } + ITEM_setChar( itemindex, ITEM_SECRETNAME, data); + ITEM_setChar( itemindex, ITEM_CDKEY, + CHAR_getChar( charaindex, CHAR_CDKEY)); + CHAR_sendItemDataOne( charaindex, haveitemindex); + snprintf( msgbuf, sizeof(msgbuf)," %s %s ", + ITEM_getChar( itemindex, ITEM_NAME), data); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + renameitemhaveindex = CHAR_getWorkInt( charaindex, CHAR_WORKRENAMEITEMINDEX); + renameitemindex = CHAR_getItemIndex( charaindex, renameitemhaveindex); + if( !ITEM_CHECKINDEX( renameitemindex)) { + print( "%s %d err\n", __FILE__, __LINE__); + return; + } + remain = atoi( ITEM_getChar( renameitemindex, ITEM_ARGUMENT)); + if( remain != 0 ) { + remain --; + if( remain <= 0 ) { + snprintf( msgbuf, sizeof(msgbuf),"%s ʧ", + ITEM_getChar( renameitemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_setItemIndex( charaindex, renameitemhaveindex, -1); + CHAR_sendItemDataOne( charaindex, renameitemhaveindex); + ITEM_endExistItemsOne( renameitemindex ); + }else { + char buf[32]; + snprintf( buf, sizeof( buf),"%d", remain); + ITEM_setChar( renameitemindex, ITEM_ARGUMENT, buf); + } + } + } + } +} + +//------------------------------------------------------------------------- +// гǷë ѣ +// ݱݷ¼ĸة ë̫ įë £ +//------------------------------------------------------------------------- +void ITEM_dropDice( int charaindex, int itemindex) +{ + char *dicename[] = { "һ", "", "", "", "", ""}; + int diceimagenumber[] = { 24298,24299,24300,24301,24302,24303}; + int r = RAND( 0,5); + + // įë + ITEM_setInt( itemindex, ITEM_VAR1, ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER)); + // įޥ + ITEM_setInt( itemindex, ITEM_BASEIMAGENUMBER, diceimagenumber[r]); + // ޥ + ITEM_setChar( itemindex, ITEM_SECRETNAME, dicename[r]); + + // ͷʧ߼˪ƥ浤ƥݳƥ֧ئУ +} +//------------------------------------------------------------------------- +// гǷë ѣ +// ݱ įë ʣ +//------------------------------------------------------------------------- +void ITEM_pickupDice( int charaindex, int itemindex) +{ + // įë ʣ + ITEM_setInt( itemindex, ITEM_BASEIMAGENUMBER, ITEM_getInt( itemindex, ITEM_VAR1)); + // + ITEM_setChar( itemindex, ITEM_SECRETNAME, ITEM_getChar( itemindex, ITEM_NAME)); +} +enum { + ITEM_LOTTERY_1ST, // 1 + ITEM_LOTTERY_2ND, + ITEM_LOTTERY_3RD, + ITEM_LOTTERY_4TH, + ITEM_LOTTERY_5TH, // 5 + ITEM_LOTTERY_6TH, // 6 + ITEM_LOTTERY_NONE, // ½ľ + ITEM_LOTTERY_NUM, +}; +//------------------------------------------------------------------------- +// Ԫľݼѣ +// ƥٱئ¾ë裻£ +// ƱɧԻ + +#define PRE_6 (10000) +#define PRE_5 (1300 + PRE_6) +#define PRE_4 (600 + PRE_5) +#define PRE_3 (300 + PRE_4) +#define PRE_2 (8 + PRE_3) +#define PRE_1 (1 + PRE_2) + + +//#define PRE_5 (13000) +//#define PRE_4 (2300 + PRE_5) +//#define PRE_3 (540 + PRE_4) +//#define PRE_2 (8 + PRE_3) +//#define PRE_1 (1 + PRE_2) + + +//#define PRE_5 (16000) +//#define PRE_4 (2500 + PRE_5) +//#define PRE_3 (400 + PRE_4) +//#define PRE_2 (10 + PRE_3) +//#define PRE_1 (1 + PRE_2) +//#define PRE_5 (27000) +//#define PRE_4 (4000 + PRE_5) +//#define PRE_3 (400 + PRE_4) +//#define PRE_2 (10 + PRE_3) +//#define PRE_1 (1 + PRE_2) +// +//------------------------------------------------------------------------- +BOOL ITEM_initLottery(ITEM_Item* itm) +{ + int r = RAND( 0, 49999); + int hit = ITEM_LOTTERY_NONE; // + char result[7]; // + int countnum[6]; + int count; + int i; + int len; + // Ȼ¼ƥ۷ 羮Իئƽľئз + if( itm->data[ITEM_VAR3] == 1 ) return TRUE; + + // £ + if( r < PRE_6 ) hit = ITEM_LOTTERY_6TH; + else if( r < PRE_5 ) hit = ITEM_LOTTERY_5TH; + else if( r < PRE_4 ) hit = ITEM_LOTTERY_4TH; + else if( r < PRE_3 ) hit = ITEM_LOTTERY_3RD; + else if( r < PRE_2 ) hit = ITEM_LOTTERY_2ND; + else if( r < PRE_1 ) hit = ITEM_LOTTERY_1ST; + else hit = ITEM_LOTTERY_NONE; + + // ë£ + count = 0; + if( hit != ITEM_LOTTERY_NONE ) { + // Իë + result[0] = result[1] = result[2] = hit+1; + count = 3; + countnum[hit] = 3; + } + while( count < 6 ) { + int r = RAND( ITEM_LOTTERY_1ST, ITEM_LOTTERY_6TH); + if( countnum[r] >= 2 ) continue; + // 2/3м ƥְ½ľ ë֧£ + // + if( ( hit != ITEM_LOTTERY_NONE && count == 3 ) + || ( hit == ITEM_LOTTERY_NONE && count == 0 ) ) + { + if( RAND( 0,2)) { + result[count] = result[count+1] = r+1; + countnum[r] += 2; + count += 2; + continue; + } + } + countnum[r] ++; + result[count] = r+1; + count++; + } + // ë׻£ + // Իݷ2/3 ƥԻٯë Ƿ£ + // ƽƽëѵУ + len = sizeof( result)-2; + if( hit != ITEM_LOTTERY_NONE ) { + if( RAND( 0,2) ) { + // Իٯë Ƿ + char s = result[0]; + result[0] = result[5]; + result[5] = s; + len = sizeof( result)-3; + } + } + for( i = 0; i < 10; i ++) { + int x = RAND( 0, len); + int y = RAND( 0, len); + int s; + s = result[x]; + result[x] = result[y]; + result[y] = s; + } + // ׻ ٯ бƻʣ + result[sizeof(result)-1] = '\0'; + itm->data[ITEM_VAR1] = hit; + // + itm->data[ITEM_VAR2] = 0; + itm->data[ITEM_VAR3] = 1; + memcpy( itm->string[ITEM_ARGUMENT].string, result, sizeof( result)); + + return TRUE; +} +//------------------------------------------------------------------------- +// Ԫëݼѣ +// پʧ ة £ +//------------------------------------------------------------------------- +void ITEM_useLottery( int charaindex, int toindex, int haveitemindex) +{ + int i,j; + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int count = ITEM_getInt( itemindex, ITEM_VAR2); + int hit = ITEM_getInt( itemindex, ITEM_VAR1); + char buff[1024]; + char num[6][3] = { {""},{""},{""},{""},{""}, {""}}; + char numbuff[128]; + char *n; + int result; + BOOL flg; + if( !ITEM_CHECKINDEX( itemindex) ) return; + if( count == 0 ) { + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, ""); + } + // ÷½ľƾؤԻ ئмƥݳƥʧ ةë + else if( count == 6 ) { + CHAR_setItemIndex( charaindex , haveitemindex, -1 ); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne( itemindex ); + return; + } + n = ITEM_getChar( itemindex, ITEM_ARGUMENT); + // for debug + result = (int)n[count]-1; + // Ʃ + flg = FALSE; + for( i = 0; i < count+1 && flg == FALSE; i ++ ) { + for( j = i+1; j < count+1 && flg == FALSE; j ++ ) { + if( i != j ) { + if( n[i] == n[j] ) { + flg = TRUE; + } + } + } + } + memcpy( numbuff, ITEM_getChar( itemindex, ITEM_EFFECTSTRING), (count)*2); + // ٯ ëʣ + snprintf( buff, sizeof( buff), "%s%s", numbuff, num[result]); + count ++; + ITEM_setInt( itemindex, ITEM_VAR2, count); + // ƥԻئԻʧ ة ʣ½ľئ½ľ + // ݼĸƤƥʣ + if( count >= 6 ) { + // Ի + if( hit != ITEM_LOTTERY_NONE ) { + int newitemindex; + char strbuff[1024]; + char msgbuff[1024]; + // ƻ + CHAR_setItemIndex( charaindex , haveitemindex, -1 ); + ITEM_endExistItemsOne( itemindex ); + // 2729 - 2734 Ԫ1 6 + newitemindex = ITEM_makeItemAndRegist( 2729 + hit); + CHAR_setItemIndex( charaindex , haveitemindex, newitemindex ); + // + snprintf( strbuff, sizeof( strbuff), "%s %s", buff, + ITEM_getChar( newitemindex, ITEM_EFFECTSTRING)); + ITEM_setChar( newitemindex, ITEM_EFFECTSTRING, strbuff); + CHAR_sendItemDataOne( charaindex, haveitemindex); + snprintf( msgbuff, sizeof( msgbuff), "˵%d", hit+1 ); + CHAR_talkToCli( charaindex, -1, + msgbuff, + CHAR_COLORYELLOW ); + } + // ½ľ + else { +// CHAR_setItemIndex( charaindex , haveitemindex, -1 ); + // + char strbuff[1024]; + snprintf( strbuff, sizeof( strbuff), "%s û,´", buff); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, strbuff); + CHAR_sendItemDataOne( charaindex, haveitemindex); +// ITEM_endExistItemsOne( itemindex ); +// CHAR_talkToCli( charaindex, -1, +// "ľ", +// CHAR_COLORWHITE ); + } + } + // Ԫ ݷݷë˪Իئʷ + else { + char strbuff[1024]; + if( flg) { + // ʸң + // ʧ ة 춪ݨ ٯƥ + // ʸëȻݱƻ£ + int spc = 16 + ( 6-count)*2; + char space[17]; + space[spc] = '\0'; + snprintf( strbuff, sizeof( strbuff), "%s%s", buff, space); + } + else { + strcpy( strbuff, buff); + } + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, strbuff); + CHAR_sendItemDataOne( charaindex, haveitemindex); + } +} + +void ITEM_WarpDelErrorItem( int charaindex ) +{ + int j; + for(j=0; j= 12 ){ + CHAR_talkToCli(charaindex, -1, "˴޷ʹá", CHAR_COLORYELLOW); + return; + } + sprintf( buf, "%d %d %d %d", flg, Mf, Mx, My); + ITEM_setChar(itemindex, ITEM_ARGUMENT, buf); + ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, usenum); + sprintf( buf, "м¼(%s,%d,%d)", MapString[i], Mx, My); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, buf); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORYELLOW); + CHAR_sendItemDataOne( charaindex, haveitemindex); + } + + // WON ADD + if( ITEM_WarpForAny(charaindex, haveitemindex, ff, fx, fy, flg) == FALSE ) + return; +} +#endif + +// Robin 0707 petFollow +void ITEM_petFollow( int charaindex, int toindex, int haveitemindex ) +{ + char *arg; + int itemindex, followLv, haveindex, i; + //print(" PetFollow_toindex:%d ", toindex); + if( CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW ) != -1 ){ + if( CHAR_CHECKINDEX( CHAR_getWorkInt( charaindex, CHAR_WORKPETFOLLOW ) ) ){ + CHAR_talkToCli( charaindex, -1, "ջطųij", CHAR_COLORWHITE ); + return; + } + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, -1); + } +#ifdef _FIX_METAMORIDE + if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){ + CHAR_talkToCli( charaindex, -1, "޷ʹã", CHAR_COLORWHITE ); + return; + } +#endif + + if( CHAR_CHECKINDEX( toindex ) == FALSE ) return; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( arg == "\0" )return; + + if( sscanf( arg, "%d", &followLv) != 1 ) + return; + if( CHAR_getInt( toindex, CHAR_LV ) > followLv ){ + CHAR_talkToCli( charaindex, -1, "ߵĵȼ㣡", CHAR_COLORWHITE ); + return; + } + if( CHAR_getWorkInt( toindex, CHAR_WORKFIXAI ) < 80 ) + { + //CHAR_talkToCli( charaindex, -1, "ҳ϶Ȳ㣡", CHAR_COLORWHITE ); + //return; + } + + + haveindex = -1; + for( i = 0; i < 5; i++ ) + { + if( CHAR_getCharPet( charaindex, i) == toindex ) { + haveindex = i; + break; + } + } + if( haveindex == -1) return; +#ifdef _MM_NO_JIAOBEN +if(getNoMMJiaoben()==1){ + if(CHAR_getInt(toindex,CHAR_PETID)==718 || CHAR_getInt(toindex,CHAR_PETID)==401){ + if(getMmType()==0){ + CHAR_talkToCli(charaindex, -1, getMmMsg(), CHAR_COLORRED); + return; + } + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(charaindex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + return; + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtime = atoi(tempbuff); + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); + return; + } + } + } +// if(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME)>=getEditBaseTime()) +// CHAR_setWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME,timep); +// else{ +// char errbuf[256]; +// sprintf(errbuf,"%dſԼ˲",getEditBaseTime()-(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME))); +// CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); +// return; +// } + int fd = getfdFromCharaIndex( charaindex); + char arg[255]; + char buf[128]; + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","",""}; + char chengbuf[][5]={"","*","x","X","","",""}; + char numbuf[][5]={"","","","","","","","","",""}; + int i,j,k,l,m; + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; +// if(randtype == 0){ +// randtype = RAND(1,10); +// if(randtype<=5){ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=1; +// else randtype=2; +// }else{ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=3; +// else randtype=4; +// } +// } + randtype = 4; + if(randtype==1){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else{ + typebuf=jianbuf[l-1]; + k = i-j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + sprintf(arg,"%d|%d",haveindex,k); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"ʽĽ(%s%s%s=?)",ibuf,typebuf,jbuf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND1_FLLOWMM, + -1, + buf); + }else if(randtype==2){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else if(m==2){ + typebuf=jianbuf[l-1]; + k = i-j; + }else{ + typebuf=chengbuf[l-1]; + k = i*j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + int n; + int randnum1; + char tempret[5][32]; + randnum1 = RAND(1,5); + int randnumbuf[4]; + int tmpi=0; + while(tmpi<100){ + randnumbuf[0] = RAND(1,100); + randnumbuf[1] = RAND(1,100); + randnumbuf[2] = RAND(1,100); + randnumbuf[3] = RAND(1,100); + if(randnumbuf[0]!=randnumbuf[1]!=randnumbuf[2]!=randnumbuf[3]!=k){ + break; + } + tmpi++; + } + tmpi=0; + for(n=1;n<=5;n++){ + if(n==randnum1){ + sprintf(tempret[n-1],"%d",k); + }else if(tmpi<4){ + sprintf(tempret[n-1],"%d",randnumbuf[tmpi]); + tmpi++; + } + } + sprintf(arg,"%d|%d",haveindex,randnum1); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"3\nѡʽĽ(%s%s%s=?)\n \n \nѡһ%s\nѡ%s\nѡ%s\nѡģ%s\nѡ壺%s\n",ibuf,typebuf,jbuf,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND2_FLLOWMM, + -1, + buf); + }else if(randtype==3){ + sprintf(arg,"%s",sasql_rand_buf()); + if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randquestion,tempbuf); + if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randrightanswer,tempbuf); + sprintf(arg,"%d|%s",haveindex,randrightanswer); + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"%s:",randquestion); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND3_FLLOWMM, + -1, + buf); + }else{ +// sprintf(arg,"%s",sasql_rand_buf()); +// if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; +// if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randquestion,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randrightanswer,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 3, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer1,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 4, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer2,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 5, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer3,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 6, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer4,tempbuf); + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬӢģ",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + //char *tempbuff2 = "ABCDE"; + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=30) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + if(selecttype<=50){ + sprintf(arg,"%d|%d|%d",haveindex,rightnum); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(arg,"%d|%d|%d",haveindex,randnum1); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(charaindex, CHAR_WORKDROPMM, arg); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND4_FLLOWMM, + -1, + buf); + CHAR_setWorkInt(charaindex,CHAR_WORKLUANPCINT,0); + } + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(charaindex,CHAR_RANDTYPE,tempbuff); + return; + } +} +#endif + + + if( !PET_dropPetFollow( charaindex, haveindex, -1, -1, -1 ) ) { + CHAR_talkToCli( charaindex, -1, "ʧܣ", CHAR_COLORWHITE ); + return; + } + +} + +// Nuke start 0624: Hero's bless +void ITEM_useSkup( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + if(CHAR_getInt(charaindex,CHAR_SUPER)==1) + { + CHAR_talkToCli(charaindex, -1, "Ʒ޷ʹøõߣ", CHAR_COLORRED); + return; + } + CHAR_setInt(charaindex,CHAR_SKILLUPPOINT, + CHAR_getInt(charaindex,CHAR_SKILLUPPOINT)+1); + CHAR_Skillupsend(charaindex); + CHAR_talkToCli(charaindex, -1, "ܵԼˡ", CHAR_COLORWHITE); + + CHAR_DelItem( charaindex, haveitemindex); +} +// Nuke end +extern void setNoenemy(); +// Nuke start 0626: Dragon's bless +void ITEM_useNoenemy( int charaindex, int toindex, int haveitemindex) +{ + int itemindex,fd; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setNoenemy(fd); + CHAR_talkToCli(charaindex, -1, "ܱܵߵɱʧˡ", CHAR_COLORWHITE); + CHAR_DelItem( charaindex, haveitemindex); + +} +// Nuke end + +// Arminius 7.2: Ra's amulet +void ITEM_equipNoenemy( int charaindex, int itemindex ) +{ + char buf[4096]; + int evadelevel; + int fl,fd; + + if( ITEM_CHECKINDEX(itemindex) == FALSE )return; + + if( ITEM_getArgument( ITEM_getChar(itemindex,ITEM_ARGUMENT),"noen", buf, sizeof(buf) ) + == FALSE ){ + return; + } + + evadelevel=atoi(buf); + fl=CHAR_getInt(charaindex, CHAR_FLOOR); + fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + if (evadelevel>=200) { + setEqNoenemy(fd, 200); + CHAR_talkToCli(charaindex, -1, "һĹâ١", CHAR_COLORWHITE); + return; + } else if (evadelevel>=120) { + setEqNoenemy(fd, 120); + + if ( (fl==100)||(fl==200)||(fl==300)||(fl==400)||(fl==500) ){ + CHAR_talkToCli(charaindex, -1, "һĹâ١", CHAR_COLORWHITE); + return; + } + } else if (evadelevel>=80) { + setEqNoenemy(fd, 80); + if ( (fl==100)||(fl==200)||(fl==300)||(fl==400) ){ + + CHAR_talkToCli(charaindex, -1, "һĹâ١", CHAR_COLORWHITE); + return; + } + } else if (evadelevel>=40) { + setEqNoenemy(fd, 40); + if ( (fl==100)||(fl==200) ) { + CHAR_talkToCli(charaindex, -1, "һĹâ١", CHAR_COLORWHITE); + return; + } + } + CHAR_talkToCli(charaindex, -1, "ʲҲûз", CHAR_COLORWHITE); +} + +#ifdef _Item_MoonAct +void ITEM_randEnemyEquipOne( int charaindex, int toindex, int haveitemindex) +{ + int itemindex, RandNum=0; + char buf[256]; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex)) return; + + if( ITEM_getArgument( ITEM_getChar( itemindex,ITEM_ARGUMENT), "rand", buf, sizeof(buf) ) == FALSE ){ + return; + } + + if( (RandNum=atoi( buf)) > 0 ){ + int fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setEqRandenemy(fd, RandNum); + CHAR_talkToCli(charaindex, -1, "ʽˡ", CHAR_COLORWHITE); + sprintf( buf, " %sʧˡ", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + return; + } + + +} + +void ITEM_randEnemyEquip( int charaindex, int itemindex) +{ + char buf[4096]; + int RandNum=0; + int fd; + + if( ITEM_CHECKINDEX(itemindex) == FALSE )return; + if( ITEM_getArgument( ITEM_getChar(itemindex,ITEM_ARGUMENT),"rand", buf, sizeof(buf) ) + == FALSE ){ + return; + } + + RandNum=atoi( buf); + fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + if (RandNum > 0 ) { + setEqRandenemy(fd, RandNum); + CHAR_talkToCli(charaindex, -1, "ʽˡ", CHAR_COLORWHITE); + return; + } + +} +void ITEM_RerandEnemyEquip( int charaindex, int itemindex) +{ + int RandNum=0; + int fd; + + if( ITEM_CHECKINDEX(itemindex) == FALSE )return; + + fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + RandNum = getEqRandenemy( fd); + + if (RandNum > 0 ) { + clearEqRandenemy( fd); + CHAR_talkToCli(charaindex, -1, "ʻظ", CHAR_COLORWHITE); + return; + } +} +#endif + +#ifdef _ITEM_WATERWORDSTATUS +void ITEM_WaterWordStatus( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + char itemarg[256]; + + if( !CHAR_CHECKINDEX( charaindex) ){ + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) ){ + return; + } + + if( ITEM_getArgument( ITEM_getChar( itemindex, ITEM_ARGUMENT),"time", itemarg, sizeof(itemarg) ) != FALSE ){ + char token[256]; + int nums = CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER); + if( nums < 0 ) nums = 0; + if( nums > 0 ){ + CHAR_talkToCli( charaindex, -1, "ˮкʱ䲻ۻ", CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( charaindex, CHAR_WORKSTATUSWATER, nums+atoi(itemarg)); + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne(itemindex); + + sprintf( token, "ˮкʱ%d֣ܼ%d֡", atoi(itemarg), + CHAR_getWorkInt( charaindex, CHAR_WORKSTATUSWATER)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli(charaindex, -1, "ʲҲû", CHAR_COLORYELLOW); + } +} +#endif + +#ifdef _CHIKULA_STONE +void ITEM_ChikulaStone( int charaindex, int toindex, int haveitemindex) +{ + int itemindex,fd; + char itemarg[256]; + + if( !CHAR_CHECKINDEX( charaindex) ) return; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) ) return; + + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + CHAR_setWorkInt( charaindex, CHAR_WORKCHIKULAHP, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKCHIKULAMP, 0 ); + setChiStone( fd, 0); //1hp 2mp + + if( ITEM_getArgument( ITEM_getChar( itemindex, ITEM_ARGUMENT),"hp", itemarg, sizeof(itemarg) ) != FALSE ){ + setChiStone( fd, 1); + CHAR_setWorkInt( charaindex, CHAR_WORKCHIKULAHP, atoi( itemarg) ); + }else if( ITEM_getArgument( ITEM_getChar( itemindex, ITEM_ARGUMENT),"mp", itemarg, sizeof(itemarg) ) != FALSE ){ + setChiStone( fd, 2); + CHAR_setWorkInt( charaindex, CHAR_WORKCHIKULAMP, atoi( itemarg) ); + }else{ + } + + CHAR_talkToCli(charaindex, -1, "ף", CHAR_COLORWHITE); + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne(itemindex); +} +#endif + +#ifdef _ITEM_ORNAMENTS +void ITEM_PutOrnaments( int charaindex, int itemindex) +{ + char *arg=NULL; + char itemname[256]; + int bbnums=0; + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( !ITEM_CHECKINDEX( itemindex) ) return; + arg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( arg == "\0" ) return;//ITEM_BASEIMAGENUMBER + bbnums = atoi( arg); + ITEM_setInt( itemindex, ITEM_BASEIMAGENUMBER, bbnums); + ITEM_setWorkInt( itemindex, ITEM_CANPICKUP, 1); + + sprintf( itemname,"%s%s%s",CHAR_getChar( charaindex, CHAR_NAME), "", ITEM_getChar( itemindex, ITEM_SECRETNAME)); + ITEM_setChar( itemindex, ITEM_SECRETNAME, itemname); +} +#endif + +#ifdef _SUIT_ITEM + +/* +#ifdef _SUIT_TWFWENDUM + #define MAX_SUITTYPE 18 +#else + #ifdef _SUIT_ADDENDUM + #define MAX_SUITTYPE 14 + #else + #ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + #define MAX_SUITTYPE 11 + #else + #define MAX_SUITTYPE 8 + #endif//_MAGIC_RESIST_EQUIT + #endif//_SUIT_ADDENDUM +#endif//_SUIT_TWFWENDUM +*/ +void ITEM_CheckSuitEquip( int charaindex) +{ + int i, j, itemindex, defCode=-1, same=0; + int nItem[CHAR_STARTITEMARRAY]; + int maxitem; + struct tagIntSuit{ + char fun[256]; + int intfun; //CHAR_getInt + }; + struct tagIntSuit ListSuit[]={ + {"VIT",CHAR_WORKSUITVIT}, + {"FSTR",CHAR_WORKSUITMODSTR}, + {"MSTR",CHAR_WORKSUITSTR}, + {"MTGH",CHAR_WORKSUITTGH}, + {"MDEX",CHAR_WORKSUITDEX}, + {"WAST",CHAR_WORKSTATUSWATER}, + {"HP", CHAR_WORKROUNDHP}, + {"MP", CHAR_WORKROUNDMP} +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ + ,{"FRES", CHAR_WORK_F_SUIT}, + {"IRES", CHAR_WORK_I_SUIT}, + {"TRES", CHAR_WORK_T_SUIT} +#endif +#ifdef _SUIT_ADDENDUM + ,{"RESIST",CHAR_WORKRESIST}, //쳣 + {"COUNTER",CHAR_WORKCOUNTER}, // + {"M_POW",CHAR_WORKMPOWER} //ǿʦħ +#endif +#ifdef _SUIT_TWFWENDUM + ,{"EARTH",CHAR_WORK_EA}, // + {"WRITER",CHAR_WORK_WR}, //ˮ + {"FIRE",CHAR_WORK_FI}, // + {"WIND",CHAR_WORK_WI} // +#endif +#ifdef _SUIT_ADDPART3 + ,{"WDUCKPOWER",CHAR_WORKDUCKPOWER},//װر + {"RENOCASE",CHAR_WORKRENOCAST}, //Ĭ + {"SUITSTRP",CHAR_WORKSUITSTR_P},// λΪ% + {"SUITTGH_P",CHAR_WORKSUITTGH_P},// λΪ% + {"SUITDEXP",CHAR_WORKSUITDEX_P}// λΪ% +#endif +#ifdef _SUIT_ADDPART4 + ,{"SUITPOISON",CHAR_SUITPOISON},//װ + {"M2_POW",CHAR_WORKMPOWER2}, //ǿʦħ,M_POWͬ(30%) + {"UN_POW_M",CHAR_WORKUNMPOWER} //ֿʦħ +#endif + }; + maxitem = sizeof(ListSuit)/sizeof(ListSuit[0]); + CHAR_setWorkInt( charaindex, CHAR_WORKSUITITEM, 0); + for( i=0; i=0; k-- ){ + if( nItem[i] == nItem[k] ) same++; + } + if( same >= 3 && nItem[i] != 0 )defCode = nItem[i]; + } + if( defCode == -1 ) return; + CHAR_setWorkInt( charaindex, CHAR_WORKSUITITEM, defCode); + for( i=0; i=200) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + return; + } else if (el>=120) { + if ( (fl==100)||(fl==200)||(fl==300)||(fl==400)||(fl==500) ) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + return; + } + } else if (el>=80) { + if ( (fl==100)||(fl==200)||(fl==300)||(fl==400) ) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + return; + } + } else if (el>=40) { + if ( (fl==100)||(fl==200) ) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + return; + } + } + CHAR_talkToCli(charaindex, -1, "ʲҲûз", CHAR_COLORWHITE); +} + +extern void setStayEncount(int fd); +void ITEM_useEncounter( int charaindex, int toindex, int haveitemindex) +{ + int itemindex,fd; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); +#ifdef _USER_CHARLOOPS + { + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( charaindex); + } +#endif + CHAR_talkToCli(charaindex, -1, "ܱܵͻȻɱ", CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + +} + +#ifdef _Item_DeathAct +void ITEM_UseDeathCounter( int charaindex, int toindex, int haveitemindex) +{ + int itemindex,fd; + int itemmaxuse=-1; + char buf1[256]; + char *itemarg; + char itemnumstr[32]; + int okfloor = 0; + BOOL Useflag=FALSE; + int i = 1; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + +#ifdef _ITEM_STONE + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + while(1){ + if( getStringFromIndexWithDelim( itemarg, "|", i , itemnumstr, sizeof( itemnumstr)) == FALSE ) + break; + okfloor = atoi(itemnumstr); + if( CHAR_getInt( charaindex, CHAR_FLOOR ) == okfloor ){ + Useflag = TRUE; + break; + } + i++; + } + if(okfloor != 0){ // ֵʯͷ + itemmaxuse = ITEM_getInt( itemindex, ITEM_DAMAGEBREAK); + if( itemmaxuse != -1 ) { + itemmaxuse--; + ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, itemmaxuse); + if( itemmaxuse < 1 ) { + sprintf( buf1, "%sʧˡ", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli(charaindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + if(Useflag==FALSE) { + CHAR_talkToCli(charaindex, -1, "ûзκ飡", CHAR_COLORYELLOW); + return; + } + }else{ + sprintf( buf1, "ԭУʹôʣ%dΡ", itemmaxuse); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, buf1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + if(Useflag==FALSE) { + CHAR_talkToCli(charaindex, -1, "ûзκ飡", CHAR_COLORYELLOW); + return; + } + } + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); + CHAR_talkToCli(charaindex, -1, "Ϣ", CHAR_COLORYELLOW); + }else{ + sprintf( buf1, "%sʧˡ", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli(charaindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + if(Useflag==FALSE) { + CHAR_talkToCli(charaindex, -1, "ûзκ飡", CHAR_COLORYELLOW); + return; + } + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); + CHAR_talkToCli(charaindex, -1, "Ϣ", CHAR_COLORYELLOW); + } + }else{ //ħʯ +#endif +#ifdef _ITEM_MAXUSERNUM + itemmaxuse = ITEM_getInt( itemindex, ITEM_DAMAGEBREAK); + if( itemmaxuse != -1 ) { + itemmaxuse--; + ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, itemmaxuse); + if( itemmaxuse < 1 ) { + sprintf( buf1, " %sʧˡ", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli(charaindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + }else{ + sprintf( buf1, "ԭУʹôʣ%dΡ", itemmaxuse); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, buf1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + } + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); + CHAR_talkToCli(charaindex, -1, "ܱܵͻȻɱ", CHAR_COLORYELLOW); + }else{ + CHAR_DelItem( charaindex, haveitemindex); + return; + } +#else + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); + sprintf( buf1, " %sʧˡ", ITEM_getChar( itemindex, ITEM_NAME) ); + CHAR_talkToCli(charaindex, -1, buf1, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); +#endif +#ifdef _ITEM_STONE + } +#endif +#ifdef _USER_CHARLOOPS + { + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( charaindex); + } +#endif +} +#endif + +#ifdef _CHRISTMAS_REDSOCKS +void ITEM_useMaxRedSocks( int charaindex, int toindex, int haveitemindex) +{ + int itemtimes = -1, itemindex; + char *itemarg=NULL; + int present[13]={ 13061, 13062, 13063, 13064, 13088, 13089, 13090, 13091, //1. + 14756, 17256, + 13092,19692,20594}; + int nowtimes = time( NULL); + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "\0" ) { + CHAR_talkToCli(charaindex, -1, "Ч!", CHAR_COLORYELLOW); + return; + } + itemtimes = atoi( itemarg); + if( nowtimes >= itemtimes && nowtimes <= itemtimes+(60*60*24) ){ //ʱڿɻ + int si=0, ret; + char token[256]; + //ɾ + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne(itemindex); + itemindex = -1; + // + si = rand()%100; + if( si > 70 ){ + si = rand()%3+10; + }else if( si > 60 ){ + si = rand()%2+8; + }else { + si = rand()%8; + } + itemindex = ITEM_makeItemAndRegist( present[ si]); + if( !ITEM_CHECKINDEX( itemindex)){ + CHAR_talkToCli(charaindex, -1, "Ч!", CHAR_COLORYELLOW); + return; + } + ret = CHAR_addItemSpecificItemIndex( charaindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + CHAR_talkToCli(charaindex, -1, "÷λ!", CHAR_COLORYELLOW); + return; + } + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charaindex, ret); + }else{ + char token[256]; + if( nowtimes < itemtimes ){ + int days, hours, minute, second; + int defTimes = itemtimes - nowtimes; + + days = defTimes/(24*60*60); + defTimes = defTimes-( days*(24*60*60)); + hours = defTimes/(60*60); + defTimes = defTimes-( hours*(60*60)); + minute = defTimes/60; + defTimes = defTimes-( minute*60); + second = defTimes; + sprintf( token,"%s%d%dСʱ%d%dſʹ!", + ITEM_getChar( itemindex, ITEM_NAME), days, hours, minute, second); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + }else if( nowtimes > itemtimes+(60*60*24) ){ + sprintf( token,"%sʹѹ!", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + } + } +} +#endif + +#ifdef _CHRISTMAS_REDSOCKS_NEW +void ITEM_useMaxRedSocksNew( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + char *itemarg=NULL; + char itemnumstr[32]; + int itemnum=0; + int present[20]; + int si=0, ret,i; + char token[256]; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "\0" ){ + CHAR_talkToCli(charaindex, -1, "Ǹʥ!", CHAR_COLORYELLOW); + return; + } + + // + if( getStringFromIndexWithDelim( itemarg, "|", 1, itemnumstr, sizeof( itemnumstr)) == FALSE ) + return; + itemnum = atoi(itemnumstr); + if( itemnum > 20 ) + itemnum = 20; + for(i=0;i= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + CHAR_talkToCli(charaindex, -1, "÷λ!", CHAR_COLORYELLOW); + return; + } + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charaindex, ret); + +} +#endif + +#ifdef _PETSKILL_CANNEDFOOD +void ITEM_useSkillCanned( int charaindex, int toindex, int itemNo) +{ + int itemindex; + char buf1[256]; + itemindex = CHAR_getItemIndex( charaindex, itemNo); + if(!ITEM_CHECKINDEX( itemindex)) return; + if( !CHAR_CHECKINDEX( toindex) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET) { + int i, petNo=-1; + for( i=0; i -1 ){// + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return; + } +#endif + + +#ifdef _FIXBUG_ATTACKBOW + { + int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM); + if( ITEM_CHECKINDEX( armindex) == TRUE ) { + int armtype = BATTLE_GetWepon( charaindex); + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( charaindex, -1, "ʹԶ޷", CHAR_COLORYELLOW ); + return; + } + } + } +#endif + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return; + } + // + if( IsBATTLING( charaindex ) == TRUE ){ + toindex = BATTLE_No2Index(CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex ); + + } + + if( CHAR_CHECKINDEX( toindex ) == FALSE ) return; + + haveindex = -1; + for( i = 0; i < 5; i++ ){ + if( CHAR_getCharPet( charaindex, i) == toindex ) { + haveindex = i; + break; + } + } + if( haveindex == -1 && charaindex != toindex ){ + CHAR_talkToCli( charaindex, -1, "޷ֻܱԼij", CHAR_COLORYELLOW ); + return; + } + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( arg == "\0" )return; + if( sscanf( arg, "%d", &metamoTime) != 1 ) + return; + + + if( toindex != charaindex ){ + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +metamoTime); + sprintf( msg, "%s", CHAR_getChar( toindex, CHAR_NAME) ); + } + else { + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0); + sprintf( msg, "Լ"); + } + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW ); + + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( charaindex); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + + CHAR_DelItem( charaindex, haveitemindex); + +} +#endif +#ifdef _ITEM_CRACKER +void ITEM_Cracker(int charaindex,int toindex,int haveitemindex) +{ + int battlemode; + // ǷЧ + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; //ʧ + battlemode = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE); + // սʹЧ + if(!battlemode) ITEM_useCracker_Effect(charaindex,toindex,haveitemindex); + else CHAR_talkToCli(charaindex,-1,"ʲҲû",CHAR_COLORWHITE); +} +#endif + +void ITEM_AddPRSkillPercent( int charaindex,int toindex,int haveitemindex) +{ +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + int level; + char token[64]; + int MySKPercent=0, itemindex=-1, i; + + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( CHAR_getInt( charaindex, PROFESSION_CLASS ) == 0 ) return; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) )return; + level=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + + for( i=0; i 10000 ) MySKPercent = 10000; + CHAR_setIntPSkill( charaindex, i, SKILL_LEVEL, MySKPercent); + } + + CHAR_setItemIndex( charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne( itemindex ); + CHAR_sendStatusString( charaindex , "S"); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + sprintf( token, "ְҵ%d", level); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); +#endif +} + +void ITEM_AddPRSkillPoint( int charaindex,int toindex,int haveitemindex) +{ +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + int point; + char token[64]; + int MyPRpoint=0, itemindex=-1; + if( !CHAR_CHECKINDEX( charaindex) ) return; + if( CHAR_getInt( charaindex, PROFESSION_CLASS ) == 0 ) return; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) )return; + point=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + + MyPRpoint = CHAR_getInt( charaindex, PROFESSION_SKILL_POINT); + CHAR_setInt( charaindex, PROFESSION_SKILL_POINT, MyPRpoint+point ); + + + CHAR_setItemIndex( charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex); + ITEM_endExistItemsOne( itemindex ); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + + CHAR_talkToCli( charaindex, -1, "һְҵܵ", CHAR_COLORYELLOW); + sprintf( token, "%dְҵܵ", point); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); +#endif +} + +#ifdef _ITEM_ADDEXP //vincent +void ITEM_Addexp(int charaindex,int toindex,int haveitemindex) +{ + // ǷЧ + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; //ʧ +#if 1 + ITEM_useAddexp_Effect(charaindex,toindex,haveitemindex); +#else + if( !CHAR_getInt(charaindex,CHAR_ADDEXPPOWER)){ + ITEM_useAddexp_Effect(charaindex,toindex,haveitemindex); + }else{ + CHAR_talkToCli(charaindex,-1,"ǰʹ֮ҩЧȻ",CHAR_COLORYELLOW); + } +#endif +} +#endif + +#ifdef _ITEM_REFRESH //vincent 쳣״̬ +void ITEM_Refresh(int charaindex,int toindex,int haveitemindex) +{ + int battlemode,itemindex; +print("\nvincent--ITEM_Refresh"); + // ǷЧ + if(CHAR_CHECKINDEX(charaindex) == FALSE) + { +print("\nvincent--(charaindex) == FALSE"); + return; //ʧ + } + itemindex = CHAR_getItemIndex(charaindex,haveitemindex); + + battlemode = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE); + if(battlemode) + { +print("\nvincent--enter ITEM_useAddexp_Effect"); +print("\nvincent-->charaindex:%d,toindex:%d",charaindex,toindex); + ITEM_useRefresh_Effect(charaindex,toindex,haveitemindex); + } + else CHAR_talkToCli(charaindex,-1,"ʲҲû",CHAR_COLORWHITE); + + /* ƽҷ ջ */ + CHAR_setItemIndex(charaindex, haveitemindex ,-1); + CHAR_sendItemDataOne( charaindex, haveitemindex);/* ʧ ةޥ */ + /* */ + ITEM_endExistItemsOne( itemindex ); +} +#endif +//Terry 2001/12/21 +#ifdef _ITEM_FIRECRACKER +void ITEM_firecracker(int charaindex,int toindex,int haveitemindex) +{ + int battlemode; + + // ǷЧ + if(CHAR_CHECKINDEX(charaindex) == FALSE) return; //ʧ + + battlemode = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEMODE); + + if( battlemode // Ƿս +#ifdef _PETSKILL_BECOMEPIG + && CHAR_getInt( charaindex, CHAR_BECOMEPIG) == -1 +#endif + ) + ITEM_useFirecracker_Battle(charaindex,toindex,haveitemindex); + else + CHAR_talkToCli(charaindex,-1,"ʲҲû",CHAR_COLORWHITE); +} +#endif +//Terry end + + +void ITEM_WearEquip( int charaindex, int itemindex) +{ + // WON ADD +// if( ITEM_getInt(itemindex,ITEM_ID) == 20130 ){ + CHAR_setWorkInt( charaindex, CHAR_PickAllPet, TRUE); +/// } + return; +} +void ITEM_ReWearEquip( int charaindex, int itemindex) +{ + CHAR_setWorkInt( charaindex, CHAR_PickAllPet, FALSE); + return; +} + + +#ifdef _Item_ReLifeAct +void ITEM_DIErelife( int charaindex, int itemindex, int eqw) +{ + int ReceveEffect=-1; + int toNo; + int battleindex=-1; + int attackNo=-1; + int WORK_HP=1; + char buf[256]; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) { + print("\n battleindex =%d return", battleindex); + return; + } + if( CHAR_CHECKINDEX( charaindex) == FALSE ) + return; + if( ITEM_CHECKINDEX( itemindex) == FALSE ) + return; +#ifdef _DUMMYDIE + if( CHAR_getFlg( charaindex, CHAR_ISDUMMYDIE) == FALSE ) { +#else + if( CHAR_getFlg( charaindex, CHAR_ISDIE) == FALSE ) { +#endif + print("\n [ %d, CHAR_ISDIE DUMMY FALSE] return !", charaindex); + return; + } + + if( ITEM_getArgument( ITEM_getChar(itemindex,ITEM_ARGUMENT),"HP", buf, sizeof(buf) ) + == FALSE ){ + WORK_HP = 1; + }else { + if( !strcmp( buf, "FULL") ) { + WORK_HP = CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ); + }else { + WORK_HP=atoi( buf); + } + } + + ReceveEffect = SPR_fukkatu3; + toNo = BATTLE_Index2No( battleindex, charaindex ); + attackNo = -1; + + BATTLE_MultiReLife( battleindex, attackNo, toNo, WORK_HP, ReceveEffect ); + CHAR_setItemIndex( charaindex, eqw ,-1); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( charaindex, eqw); + return; +} +#endif + +#ifdef _EQUIT_DEFMAGIC +void ITEM_MagicEquitWear( int charaindex, int itemindex) +{ + char buf[256]; + char *itemarg; + char Free[][128]={"EA","WA","FI","WI","QU"}; + int index=0; + int dMagic=0; + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + while( index < arraysizeof( Free) ) { + if( ITEM_getArgument( itemarg, Free[ index], buf, sizeof(buf)) == TRUE ) { + dMagic = atoi( buf); + if( dMagic <= 100 && dMagic >= -100 ) { + int def_magic = CHAR_getWorkInt( charaindex, CHAR_EQUITDEFMAGIC_E+index); + CHAR_setWorkInt( charaindex, CHAR_EQUITDEFMAGIC_E+index, def_magic + dMagic); + } + dMagic = 0; + } + index++; + if( (CHAR_EQUITDEFMAGIC_E+index) > CHAR_EQUITQUIMAGIC ) + break; + } + + return; +} + +void ITEM_MagicEquitReWear( int charaindex, int itemindex){ + char buf[256]; + char *itemarg; + char Free[][128]={"EA","WA","FI","WI","QU"}; + int index=0; + int dMagic=0; + + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + while( index < arraysizeof( Free) ) { + if( ITEM_getArgument( itemarg, Free[ index], buf, sizeof(buf)) == TRUE ) { + dMagic = atoi( buf); + if( dMagic <= 100 && dMagic >= -100 ) { + int def_magic = CHAR_getWorkInt( charaindex, CHAR_EQUITDEFMAGIC_E+index); + CHAR_setWorkInt( charaindex, CHAR_EQUITDEFMAGIC_E+index, def_magic - dMagic); + } + dMagic = 0; + } + index++; + if( (CHAR_EQUITDEFMAGIC_E+index) > CHAR_EQUITQUIMAGIC ) + break; + } + + return; +} +#endif + +#ifdef _EQUIT_RESIST +void ITEM_MagicResist( int charaindex, int itemindex) +{ + char *itemarg,*p=NULL; + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, atoi( p+4 ) ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITTHUNDER, atoi( p+4 ) ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITICE, atoi( p+4 ) ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITWEAKEN, atoi( p+4 ) ); + } + else if( strstr( itemarg, "ħ" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITBARRIER, atoi( p+4 ) ); + } + else if( strstr( itemarg, "Ĭ" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITNOCAST, atoi( p+4 ) ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFALLRIDE, atoi( p+4 ) ); + } + +} + +void ITEM_MagicReResist( int charaindex, int itemindex) +{ + char *itemarg,*p=NULL; + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "ħ" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "Ĭ" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } + else if( strstr( itemarg, "" ) ){ + p = itemarg; + CHAR_setWorkInt( charaindex, CHAR_WORKEQUITFIRE, 0 ); + } +} +#endif + +#ifdef _MAGIC_RESIST_EQUIT // WON ADD ְҵװ +void ITEM_P_MagicEquitWear( int charaindex, int itemindex ) +{ + char buf[256] = {0}; + char *itemarg; + char Free[][128]={"FR","IR","TR"}; + int dMagic=0; + int i; + + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + +// print("\n won test 10.0 ==> itemarg(%s)", itemarg ); + + for( i=0; i<3; i++ ){ + if( ITEM_getArgument( itemarg, Free[ i ], buf, sizeof(buf)) == TRUE ) { + dMagic = atoi( buf); +// print("\n won test 10.1 ==> i(%d) dMagic(%d)", i, dMagic ); + + if( dMagic <= 100 && dMagic >= -100 ){ + int def_magic = CHAR_getWorkInt( charaindex, CHAR_WORK_F_SUIT+i ); + CHAR_setWorkInt( charaindex, CHAR_WORK_F_SUIT+i, def_magic + dMagic); + +// print("\n won test 10.2 ==> i(%d)(%d)", i, CHAR_getWorkInt( charaindex, CHAR_WORK_F_SUIT+i ) ); + } + dMagic = 0; + } + } + + return; +} + + +void ITEM_P_MagicEquitReWear( int charaindex, int itemindex ) +{ + char buf[256] = {0}; + char *itemarg; + char Free[][128]={"FR","IR","TR"}; + int dMagic=0; + int i; + + itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + +// print("\n won test 10.0 ==> itemarg(%s)", itemarg ); + + for( i=0; i<3; i++ ){ + if( ITEM_getArgument( itemarg, Free[ i ], buf, sizeof(buf)) == TRUE ) { + dMagic = atoi( buf); +// print("\n won test 10.1 ==> i(%d) dMagic(%d)", i, dMagic ); + + if( dMagic <= 100 && dMagic >= -100 ){ + int def_magic = CHAR_getWorkInt( charaindex, CHAR_WORK_F_SUIT+i ); + CHAR_setWorkInt( charaindex, CHAR_WORK_F_SUIT+i, def_magic - dMagic); + +// print("\n won test 10.2 ==> i(%d)(%d)", i, CHAR_getWorkInt( charaindex, CHAR_WORK_F_SUIT+i ) ); + } + dMagic = 0; + } + } + + return; + +} +#endif + + + +#ifdef _ITEM_WARP_FIX_BI +void recoverbi(int index) +{ + int eBbi=-1, eArm=-1, eNum=-1, eBi=-1, bi=-1; + + bi = CHAR_getInt( index, CHAR_BASEIMAGENUMBER); + eBbi = CHAR_getInt( index, CHAR_BASEBASEIMAGENUMBER); + eArm = CHAR_getItemIndex( index, CHAR_ARM); + eNum = ITEM_FIST; + if(ITEM_CHECKINDEX(eArm)) + eNum = ITEM_getInt( eArm, ITEM_TYPE); + + eBi = CHAR_getNewImagenumberFromEquip( eBbi, eNum); + + if(CHAR_getInt( index, CHAR_RIDEPET)!=-1) // + CHAR_complianceParameter(index); + else // + if((eBi!=-1)&&(eBi!=bi)) + CHAR_setInt( index, CHAR_BASEIMAGENUMBER, eBi); +} +#endif + +#ifdef _ITEM_TIME_LIMIT +void ITEM_TimeLimit( int charaindex) +{ + int i = 0; + int iid = 0; + long lTime = 0; + char buff[256]; + + if( !CHAR_CHECKINDEX( charaindex) ) return; + for( i=0; i < CHAR_MAXITEMHAVE ; i++ ){ + int itemindex = CHAR_getItemIndex( charaindex , i ); + if( !ITEM_CHECKINDEX( itemindex ) ) continue; + lTime = ITEM_getWorkInt( itemindex, ITEM_WORKTIMELIMIT); + if( ITEM_getInt( itemindex, ITEM_ID) == 20173 //ȼջ + || ITEM_getInt( itemindex, ITEM_ID) == 20704 ){ + if( lTime > 0 && NowTime.tv_sec > lTime ){ + iid = ITEM_getInt( itemindex, ITEM_ID) + 1; + snprintf( buff, sizeof( buff), "%sЧʧ..", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, buff, CHAR_COLORGREEN); + CHAR_DelItemMess( charaindex, i, 0); + itemindex = ITEM_makeItemAndRegist( iid); + if(itemindex!=-1){ + CHAR_setItemIndex( charaindex, i, itemindex); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charaindex); + CHAR_sendItemDataOne( charaindex, i); + } + } + } + } + +} +#endif + +#ifdef _ITEM_CONSTITUTION +void ITEM_Constitution( int charaindex, int toindex, int haveitemindex) +{ + char buf[256]; + char *itemarg; + char Free[][128]={"VI","ST","TG","DE"}; + int index=0, FixPoint=0, itemindex; + BOOL FIXs=FALSE; + int AllPoint=0; + + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) + return; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + + AllPoint = CHAR_getInt( charaindex, CHAR_VITAL) + +CHAR_getInt( charaindex, CHAR_VITAL+1) + +CHAR_getInt( charaindex, CHAR_VITAL+2) + +CHAR_getInt( charaindex, CHAR_VITAL+3); + + while( index < arraysizeof( Free) ) { + if( ITEM_getArgument( itemarg, Free[ index], buf, sizeof(buf)) == TRUE ) { + FixPoint = atoi( buf); + if( FixPoint <= 100 && FixPoint > 0 ) { + int points = CHAR_getInt( charaindex, CHAR_VITAL+index); + //Change Fix + //if( points < (FixPoint*100) ) break; + if( points < (FixPoint*100) || AllPoint-(FixPoint*100) <= 0 ) + { + CHAR_talkToCli( charaindex, -1, "ƷЧ", CHAR_COLORYELLOW); + return; + } + CHAR_setInt( charaindex, CHAR_VITAL+index, (points-(FixPoint*100))); + CHAR_setInt( charaindex, CHAR_SKILLUPPOINT, CHAR_getInt( charaindex, CHAR_SKILLUPPOINT) + FixPoint); + FIXs = TRUE; + } + FixPoint = 0; + } + index++; + if( (CHAR_VITAL+index) > CHAR_DEX ) + break; + } + CHAR_complianceParameter( charaindex); + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_MAXHP|CHAR_P_STRING_HP|CHAR_P_STRING_LV|CHAR_P_STRING_EXP| + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF|CHAR_P_STRING_QUICK| + CHAR_P_STRING_VITAL|CHAR_P_STRING_STR|CHAR_P_STRING_TOUGH|CHAR_P_STRING_DEX); + + CHAR_Skillupsend( charaindex); + if( FIXs == TRUE ) { + sprintf( buf, "%s", "е仯"); + }else { + sprintf( buf, "%s", "ƷЧ"); + } + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _NEW_RIDEPETS +void ITEM_useLearnRideCode( int charaindex, int toindex, int haveitemindex) +{//CHAR_LOWRIDEPETS + + if(getRideMode()==2){ + CHAR_talkToCli( charaindex, -1, "Ϊ2.0֤ģʽ޷ʹøƷ", CHAR_COLORYELLOW); + return; + } + int itemindex, i; + char buf1[256]; + char *itemarg=NULL; + int ridetrans; + typedef struct{ + char arg[32]; + int Code; + }tagNewRideCode; + tagNewRideCode NewRides[]={ + { "RIDE_PET0", RIDE_PET0}, { "RIDE_PET1", RIDE_PET1}, { "RIDE_PET2", RIDE_PET2}, + { "RIDE_PET3", RIDE_PET3}, { "RIDE_PET4", RIDE_PET4}, { "RIDE_PET5", RIDE_PET5}, + { "RIDE_PET6", RIDE_PET6}, { "RIDE_PET7", RIDE_PET7}, { "RIDE_PET8", RIDE_PET8}, + { "RIDE_PET9", RIDE_PET9}, { "RIDE_PET10", RIDE_PET10}, { "RIDE_PET11", RIDE_PET11}, + { "RIDE_PET12", RIDE_PET12}, { "RIDE_PET13", RIDE_PET13}, { "RIDE_PET14", RIDE_PET14}, +#ifdef _RIDE_CF + { "RIDE_PET15", RIDE_PET15}, { "RIDE_PET16", RIDE_PET16}, { "RIDE_PET17", RIDE_PET17}, + { "RIDE_PET18", RIDE_PET18}, { "RIDE_PET19", RIDE_PET19}, { "RIDE_PET20", RIDE_PET20}, + { "RIDE_PET21", RIDE_PET21}, { "RIDE_PET22", RIDE_PET22}, { "RIDE_PET23", RIDE_PET23}, + { "RIDE_PET24", RIDE_PET24}, { "RIDE_PET25", RIDE_PET25}, { "RIDE_PET26", RIDE_PET26}, + { "RIDE_PET27", RIDE_PET27}, { "RIDE_PET28", RIDE_PET28}, { "RIDE_PET29", RIDE_PET29}, + { "RIDE_PET30", RIDE_PET30}, { "RIDE_PET31", RIDE_PET31}, + { "RIDE_PET32", RIDE_PET0 }, { "RIDE_PET33", RIDE_PET1 }, { "RIDE_PET34", RIDE_PET2 }, + { "RIDE_PET35", RIDE_PET3 }, { "RIDE_PET36", RIDE_PET4 }, { "RIDE_PET37", RIDE_PET5 }, + { "RIDE_PET38", RIDE_PET6 }, { "RIDE_PET39", RIDE_PET7 }, { "RIDE_PET40", RIDE_PET8 }, + { "RIDE_PET41", RIDE_PET9 }, { "RIDE_PET42", RIDE_PET10}, { "RIDE_PET43", RIDE_PET11}, + { "RIDE_PET44", RIDE_PET12}, { "RIDE_PET45", RIDE_PET13}, { "RIDE_PET46", RIDE_PET14}, + { "RIDE_PET47", RIDE_PET15}, { "RIDE_PET48", RIDE_PET16}, { "RIDE_PET49", RIDE_PET17}, + { "RIDE_PET50", RIDE_PET18}, { "RIDE_PET51", RIDE_PET19}, { "RIDE_PET52", RIDE_PET20}, + { "RIDE_PET53", RIDE_PET21}, { "RIDE_PET54", RIDE_PET22}, { "RIDE_PET55", RIDE_PET23}, + { "RIDE_PET56", RIDE_PET24}, { "RIDE_PET57", RIDE_PET25}, { "RIDE_PET58", RIDE_PET26}, + { "RIDE_PET59", RIDE_PET27}, { "RIDE_PET60", RIDE_PET28}, { "RIDE_PET61", RIDE_PET29}, + { "RIDE_PET62", RIDE_PET30}, { "RIDE_PET63", RIDE_PET31}, + { "RIDE_PET64", RIDE_PET0 }, { "RIDE_PET65", RIDE_PET1 }, { "RIDE_PET66", RIDE_PET2 }, + { "RIDE_PET67", RIDE_PET3 }, { "RIDE_PET68", RIDE_PET4 }, { "RIDE_PET69", RIDE_PET5 }, + { "RIDE_PET70", RIDE_PET6 }, { "RIDE_PET71", RIDE_PET7 }, { "RIDE_PET72", RIDE_PET8 }, + { "RIDE_PET73", RIDE_PET9 }, { "RIDE_PET74", RIDE_PET10}, { "RIDE_PET75", RIDE_PET11}, + { "RIDE_PET76", RIDE_PET12}, { "RIDE_PET77", RIDE_PET13}, { "RIDE_PET78", RIDE_PET14}, + { "RIDE_PET79", RIDE_PET15}, { "RIDE_PET80", RIDE_PET16}, { "RIDE_PET81", RIDE_PET17}, + { "RIDE_PET82", RIDE_PET18}, { "RIDE_PET83", RIDE_PET19}, { "RIDE_PET84", RIDE_PET20}, + { "RIDE_PET85", RIDE_PET21}, { "RIDE_PET86", RIDE_PET22}, { "RIDE_PET87", RIDE_PET23}, + { "RIDE_PET88", RIDE_PET24}, { "RIDE_PET89", RIDE_PET25}, { "RIDE_PET90", RIDE_PET26}, + { "RIDE_PET91", RIDE_PET27}, { "RIDE_PET92", RIDE_PET28}, { "RIDE_PET93", RIDE_PET29}, + { "RIDE_PET94", RIDE_PET30}, { "RIDE_PET95", RIDE_PET31} +#endif + }; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + + if( getStringFromIndexWithDelim(itemarg,"|", 3, buf1, sizeof(buf1)) == FALSE ) + ridetrans=0; + else + ridetrans=atoi(buf1); + if( getStringFromIndexWithDelim(itemarg,"|", 1, buf1, sizeof(buf1)) == FALSE ) + return; + for( i=0; i=1 && + CHAR_getInt( toindex, CHAR_FUSIONRAISE) > 0 ){//ǷΪںϳ + int time_l; + int nowTime; // Robin fix + time_l = CHAR_getInt( toindex, CHAR_FUSIONTIMELIMIT); + nowTime = (int)time(NULL); +#if 1 // ҩ + { + char *arg = NULL; + char deltime[8]; + char msg[1024]; + arg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( arg != "\0" && !strncmp( arg, "", 2) ) { +// sscanf( arg, " %d", &deltime); + getStringFromIndexWithDelim( arg, "|", 2, deltime, sizeof( deltime)); + time_l -= (atoi(deltime)*60); + CHAR_setInt( toindex, CHAR_FUSIONTIMELIMIT, time_l); + CHAR_DelItem( charaindex, haveitemindex); + sprintf( msg, "ӿﵰٶ %s ӡ", deltime); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + if( (time_l + anhour) <= nowTime ) { + int min, sec, deftime; + deftime = nowTime - (time_l + anhour); + min = deftime/60; + sec = deftime%60; + sprintf( msg, "ﵰѾιʳˣιʳʱ%d%d롣", min, sec); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + return; + } + } + } +#endif + if( (time_l + anhour) > nowTime ){ //ڵʱҪ(time_l+anhour)ſ ʳ + char Mess1[256]; + int min, sec, deftime; + //int nowTime = (int)time(NULL); + deftime = (time_l + anhour) - nowTime; + min = deftime/60; + sec = deftime%60; + sprintf( Mess1, "ﵰ%d%dſιʳ", min, sec); + CHAR_talkToCli( charaindex, -1, Mess1, CHAR_COLORYELLOW); + return; + } +//--------------------------------------------- + work[3] = CHAR_getInt( toindex, CHAR_EVOLUTIONBASEVTL); + work[0] = CHAR_getInt( toindex, CHAR_EVOLUTIONBASESTR); + work[1] = CHAR_getInt( toindex, CHAR_EVOLUTIONBASETGH); + work[2] = CHAR_getInt( toindex, CHAR_EVOLUTIONBASEDEX); + PET_showEditBaseMsg( charaindex, toindex, itemindex, work); + CHAR_setInt( toindex, CHAR_EVOLUTIONBASEVTL, work[3]); + CHAR_setInt( toindex, CHAR_EVOLUTIONBASESTR, work[0]); + CHAR_setInt( toindex, CHAR_EVOLUTIONBASETGH, work[1]); + CHAR_setInt( toindex, CHAR_EVOLUTIONBASEDEX, work[2]); +//--------------------------------------------- + LogPetPointChange( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( charaindex, CHAR_NAME), + toindex, 4, + CHAR_getInt( toindex, CHAR_LV), + "item_use", + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ) + ); + + LogPetFeed( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( toindex, CHAR_NAME), + toindex, + CHAR_getInt( toindex, CHAR_LV), + ITEM_getChar( itemindex, CHAR_NAME), // Key + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + CHAR_getChar( toindex, CHAR_UNIQUECODE) ); + +#ifdef _PET_EVOLUTION + { + int raise = CHAR_getInt( toindex, CHAR_FUSIONRAISE); + CHAR_setInt( toindex, CHAR_FUSIONRAISE, --raise); + CHAR_setInt( toindex, CHAR_FUSIONTIMELIMIT, nowTime); + if( CHAR_getInt( toindex, CHAR_FUSIONRAISE) <= 0 ){// + char buf[256], buf1[256]; + int newindex; + sprintf( buf, "%s", CHAR_getUseName( toindex )); + + newindex = EVOLUTION_createPetFromEnemyIndex( charaindex, toindex, 1); + if( !CHAR_CHECKINDEX( newindex) ){ + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + return; + } + sprintf( buf1, "%s", CHAR_getChar( newindex, CHAR_NAME)); + strcat( buf, buf1); + CHAR_talkToCli( charaindex, -1, buf, CHAR_COLORYELLOW); + + LogPetFeed( + CHAR_getChar( charaindex, CHAR_NAME), + CHAR_getChar( charaindex, CHAR_CDKEY), + CHAR_getChar( toindex, CHAR_NAME), + toindex, + CHAR_getInt( toindex, CHAR_LV), + buf, // Key + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + CHAR_getChar( toindex, CHAR_UNIQUECODE) ); + + } + } +#endif + }else { + CHAR_talkToCli( charaindex, -1, "", CHAR_COLORYELLOW); + } + CHAR_DelItem( charaindex, haveitemindex); + return; +} +#endif + +#ifdef _THROWITEM_ITEMS +static int Niceitem = 0; + int golds[3]={ 10000, 20000, 50000}; + int items1[18] = { 13092, 13091, 20439, 20417, 1284, 20172, 18210, 19014, 18360, 18362, 18364, + 18359, 18356, 18357, 18510, 20418, 20419, 1452}; + int items2[11] = { 15842, 16136, 14334, 14034, 14634, 14934, 15534, 14934, 16432, 17057, 19695}; + + int items3[10] = { 16014, 16314, 14515, 14215, 14815, 15115, 15715, 15295, 16552, 17157}; + + int items4[18] = { 14516, 14513, 14216, 14213, 14816, 14813, 15116, 15716, 15415, 17360, 20279, + 20282, 20276, 20270, 20288, 20290, 20291, 20289}; + int items5[5] = { 20280, 20283, 20277, 20271, 20274}; + int items6[5] = { 20284, 20272, 20275, 20281, 20278}; +void ITEM_ThrowItemBox( int charaindex, int toindex, int haveitemindex) +{ + int i, ret, Iindex, ItemID=-1, itemindex; + char token[256]; + + if( !CHAR_CHECKINDEX(charaindex) ) return; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + + if( Niceitem > 10 ) ret = rand()%920; + else ret = rand()%1000; + + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + Iindex = CHAR_getItemIndex( charaindex , i ); + if( !ITEM_CHECKINDEX(itemindex) ) continue; + if( itemindex == Iindex ){ + CHAR_DelItem( charaindex, i); + + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "WarpManDelItem", + CHAR_getInt( charaindex, CHAR_FLOOR), CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + break; + } + } + if( i >= CHAR_MAXITEMHAVE ){ + return; + } + + if( ret <= 774 ){ + int Golds=0; + Golds = golds[ RAND(0,2)]; + CHAR_AddGold( charaindex, Golds); + }else { + if( ret < 924 ){ + ItemID = items1[RAND(0,17)]; + }else if( ret < 964 ){ + ItemID = items2[RAND(0,10)]; + }else if( ret < 984 ){ + ItemID = items3[RAND(0,9)]; + Niceitem++; + }else if( ret < 994 ){ + ItemID = items4[RAND(0,17)]; + Niceitem++; + }else if( ret < 999 ){ + ItemID = items5[RAND(0,4)]; + Niceitem++; + }else { + ItemID = items6[RAND(0,4)]; + Niceitem++; + } + + Iindex = ITEM_makeItemAndRegist( ItemID); + if( !ITEM_CHECKINDEX( Iindex) ){ + return; + } + ret = CHAR_addItemSpecificItemIndex( charaindex, Iindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( Iindex); + return; + } + sprintf( token,"õ%s", ITEM_getChar( Iindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charaindex, ret); + } +} +#endif + +#ifdef _ITEM_LOVERPARTY +void ITEM_LoverSelectUser( int charaindex, int toindex, int haveitemindex) +{ + int itemindex, i; + int playernum = CHAR_getPlayerMaxNum(); + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){ + CHAR_talkToCli( charaindex, -1, "Ʒʹá", CHAR_COLORYELLOW); + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + if( ITEM_getInt( itemindex, ITEM_TYPE) != 16 ){ + ITEM_setInt( itemindex, ITEM_TYPE, 16); + return; + } + if( !strcmp( ITEM_getChar( itemindex, ITEM_FORUSERNAME), "") || + !strcmp( ITEM_getChar( itemindex, ITEM_FORUSERCDKEY), "") ){//Ѱ趨 + if( charaindex == toindex ){ + CHAR_talkToCli( charaindex, -1, "ѡԼʹá", CHAR_COLORYELLOW); + return; + } + ITEM_setChar( itemindex, ITEM_FORUSERNAME, CHAR_getChar( toindex, CHAR_NAME) ); + ITEM_setChar( itemindex, ITEM_FORUSERCDKEY, CHAR_getChar( toindex, CHAR_CDKEY) ); + ITEM_setInt( itemindex, ITEM_TARGET, 0); + { + char token[256]; + sprintf( token, "%s(%s)", + ITEM_getChar( itemindex, ITEM_SECRETNAME), CHAR_getChar( toindex, CHAR_NAME)); + ITEM_setChar( itemindex, ITEM_SECRETNAME, token); + sprintf( token, "Ͷ趨Ϊ%s", CHAR_getChar( toindex, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } + CHAR_sendItemDataOne( charaindex, haveitemindex); + }else{ + char buf1[256]; + //if( CHAR_getInt( charaindex, CHAR_FLOOR) == 117 || CHAR_getInt( charaindex, CHAR_FLOOR) == 887 || + //CHAR_getInt( charaindex, CHAR_FLOOR) == 1042 || CHAR_getInt( charaindex, CHAR_FLOOR) == 2032 || + //CHAR_getInt( charaindex, CHAR_FLOOR) == 3032 || CHAR_getInt( charaindex, CHAR_FLOOR) == 4032 || + //CHAR_getInt( charaindex, CHAR_FLOOR) == 5032 || CHAR_getInt( charaindex, CHAR_FLOOR) == 6032 || + //CHAR_getInt( charaindex, CHAR_FLOOR) == 7032 || CHAR_getInt( charaindex, CHAR_FLOOR) == 8032 || + //CHAR_getInt( charaindex, CHAR_FLOOR) == 9032 ){ + if( checkUnlawWarpFloor( CHAR_getInt( charaindex, CHAR_FLOOR) ) ) { + CHAR_talkToCli( charaindex, -1, "λ޷͡", CHAR_COLORYELLOW ); + return; + } + + for( i=0; i= 10000) continue; + + if( (int)NowTime.tv_sec > (int)( OBJECT_getTime( objindex) + getGolddeletetime() ) ) { + + LogStone( + -1, + "NULL", + "NULL", + amount, + 0, + "Del(ɾʱǮ)", + OBJECT_getFloor( objindex ), + OBJECT_getX( objindex ), + OBJECT_getY( objindex ) + ); + + CHAR_ObjectDelete(objindex); + } + } +} + +void GOLD_DeleteTimeCheckOne( int objindex) +{ + int amount; + + if( CHECKOBJECT( objindex ) == FALSE ) return; + if( OBJECT_getType( objindex) != OBJTYPE_GOLD) return; + +// amount = OBJECT_getIndex( objindex); +// if( amount >= 10000) return; + + if( (int)NowTime.tv_sec > (int)( OBJECT_getTime( objindex) + getGolddeletetime() ) ) { + + LogStone( + -1, + "NULL", + "NULL", + amount, + 0, + "Del(ɾʱǮ)", + OBJECT_getFloor( objindex ), + OBJECT_getX( objindex ), + OBJECT_getY( objindex ) + ); + + CHAR_ObjectDelete(objindex); + } + +} + +#endif + +#ifdef _TIME_TICKET +void ITEM_timeticketEx( int charaindex, int toindex, int haveitemindex, int flag); +void ITEM_timeticket( int charaindex, int toindex, int haveitemindex) +{ + if(getTicketCf()==1){ + CHAR_talkToCli( charaindex, -1, getTicketMsg(), CHAR_COLORYELLOW); + return; + } + if( check_TimeTicketMap( CHAR_getInt( charaindex, CHAR_FLOOR)) == FALSE){ + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIME, 0); + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIMESTART, 0); + CHAR_warpToSpecificPoint( charaindex, 7025, 143, 134 ); + } + ITEM_timeticketEx( charaindex, toindex, haveitemindex, 0); +} + +void ITEM_timeticketEx( int charaindex, int toindex, int haveitemindex, int flag) +{ + int itemindex; + int addtime; + int nowtime = time(NULL); + int tickettime; + int lefttime; + char msg[1024]; + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + + if( check_TimeTicketMap( CHAR_getInt( charaindex, CHAR_FLOOR)) == FALSE + && flag == 0 ) { + CHAR_talkToCli( charaindex, -1, "ص㲻ʹá", CHAR_COLORYELLOW); + return; + } + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + + tickettime = CHAR_getWorkInt( charaindex, CHAR_WORKTICKETTIME); + if( tickettime > nowtime+20 ) { + CHAR_talkToCli( charaindex, -1, "ʱʣ£ڲſʹá", CHAR_COLORYELLOW); + return; + } + // һʹõĻ + if( tickettime == 0 ) { + tickettime = nowtime; + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIMESTART, nowtime); + } + // սҳʱʱʹ + //if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE + // && tickettime < nowtime ) { + //tickettime = nowtime; + // sprintf(msg, "ʱ䲻%d롣", nowtime - tickettime ); + // CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + //} + + addtime = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT)); + tickettime += addtime; + CHAR_setWorkInt( charaindex, CHAR_WORKTICKETTIME, tickettime ); + lefttime = tickettime - nowtime; + if( lefttime > 0 ) + sprintf(msg, "ʱ%d룬ʣ%d%d롣", addtime, lefttime/60, lefttime%60 ); + else + sprintf(msg, "ʱ%d룬%d%d롣", addtime, (-lefttime)/60, (-lefttime)%60 ); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif +#ifdef _ITEM_SETLOVER +void ITEM_SetLoverUser( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int playernum = CHAR_getPlayerMaxNum(); + char token[256], szMsg[128]; + int floor = CHAR_getInt(charaindex,CHAR_FLOOR); + + if( !strcmp( CHAR_getChar( charaindex, CHAR_LOVE), "YES")) + { + CHAR_talkToCli( charaindex, -1, "ػΥģѾŶ~", CHAR_COLORYELLOW); + return; + } + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) + { + CHAR_talkToCli( charaindex, -1, "ֻܺҽŶ", CHAR_COLORYELLOW); + return; + } + if( CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)<3 ||CHAR_getInt(toindex,CHAR_TRANSMIGRATION)<3) + { + CHAR_talkToCli( charaindex, -1, "Ļ˫3תŶ~", CHAR_COLORYELLOW); + return; + } + if( charaindex == toindex ) + { + CHAR_talkToCli( charaindex, -1, "ѵԼ", CHAR_COLORYELLOW); + return; + } + if ( IsMale(charaindex)==IsMale(toindex)) + { + CHAR_talkToCli( charaindex, -1, "ͬôأ", CHAR_COLORYELLOW); + return; + } + if( !ITEM_CHECKINDEX(itemindex) ) return; + int id = ITEM_getInt( itemindex, ITEM_ID); + itemindex = ITEM_makeItemAndRegist( id ); + + if( strcmp( CHAR_getChar( charaindex, CHAR_LOVE), "YES") && + strcmp( CHAR_getChar( toindex, CHAR_LOVE), "YES"))//ڶж˫ǷѾ + { + if( itemindex != -1 ){ + CHAR_setChar( charaindex, CHAR_LOVERID, CHAR_getChar( toindex, CHAR_CDKEY) ); + CHAR_setChar( charaindex, CHAR_LOVERNAME, CHAR_getChar( toindex, CHAR_NAME) ); + if (strcmp(CHAR_getChar( toindex, CHAR_LOVERID), CHAR_getChar( charaindex, CHAR_CDKEY))==0 && + strcmp(CHAR_getChar( toindex, CHAR_LOVERNAME), CHAR_getChar( charaindex, CHAR_NAME))==0){ + int i; + sprintf( token, "ѾӦ%s", CHAR_getChar( toindex, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + sprintf( token, "%sѾӦ", CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); + CHAR_setChar( toindex, CHAR_LOVE,"YES"); + CHAR_setChar( charaindex, CHAR_LOVE,"YES"); + CHAR_setChar( charaindex, CHAR_LOVERID, CHAR_getChar( toindex, CHAR_CDKEY) ); + CHAR_setChar( charaindex, CHAR_LOVERNAME, CHAR_getChar( toindex, CHAR_NAME) ); + CHAR_setChar( toindex, CHAR_LOVERID, CHAR_getChar( charaindex, CHAR_CDKEY) ); + CHAR_setChar( toindex, CHAR_LOVERNAME, CHAR_getChar( charaindex, CHAR_NAME) ); + sprintf(szMsg,"%d 8 101883",floor); + CHAR_CHAT_DEBUG_effect(charaindex,szMsg); + CHAR_DelItem( charaindex, haveitemindex); + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "ܱǸİ˲Ŷ~", CHAR_COLORYELLOW ); + return; + } + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( i ) ) return; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX(itemindex) ) return; + + if( checkUnlawWarpFloor( CHAR_getInt( charaindex, CHAR_FLOOR) ) ) { + CHAR_talkToCli( charaindex, -1, "ܱǸİңԶط޷͡", CHAR_COLORYELLOW ); + return; + }//UNWARPͼֹʹ + if( checkUnlawWarpFloor( CHAR_getInt( i, CHAR_FLOOR) ) ) { + CHAR_talkToCli( charaindex, -1, "ܱǸİңԶط޷͡", CHAR_COLORYELLOW ); + return; + }//UNWARPͼֹʹ + if(strcmp(CHAR_getChar(i,CHAR_LOVERID),CHAR_getChar(charaindex,CHAR_CDKEY)) == 0 && + strcmp(CHAR_getChar(i,CHAR_LOVERNAME),CHAR_getChar(charaindex,CHAR_NAME)) == 0) + { + CHAR_DischargePartyNoMsg( charaindex);//ɢŶ + int floor, x, y; + char token[256]; + floor = CHAR_getInt( i, CHAR_FLOOR); + x = CHAR_getInt( i, CHAR_X); + y = CHAR_getInt( i, CHAR_Y); + + CHAR_warpToSpecificPoint( charaindex, floor, x, y ); + sprintf( token, "%s:װģˣ", CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW ); + sprintf( token, "Ѵ͵%sߣ", CHAR_getChar( i, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + print("\n%s ͵%s", CHAR_getChar( charaindex, CHAR_NAME),CHAR_getChar(i, CHAR_NAME)); + return; + } + }else + CHAR_talkToCli( charaindex, -1, "ûнŶ~", CHAR_COLORYELLOW ); +} + +void ITEM_LoverUnmarry( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int i; + char token[256]; + int playernum = CHAR_getPlayerMaxNum(); + //Ƿ + if( !strcmp( CHAR_getChar( charaindex, CHAR_LOVE), "YES")) + { + for(i=0;i=playernum) + { + CHAR_talkToCli( charaindex, -1, "ܱǸİ˲Ŷ~", CHAR_COLORYELLOW ); + return; + } + + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( i ) ) return; + if( !ITEM_CHECKINDEX(itemindex) ) return; + + if(strcmp(ITEM_getChar( itemindex, ITEM_SECRETNAME), "ָͬ")){ + int id = ITEM_getInt( itemindex, ITEM_ID); + itemindex = ITEM_makeItemAndRegist( id ); + + if( itemindex != -1 ){ + + int emptyitemindexinchara = CHAR_findEmptyItemBox( toindex ); + + if( emptyitemindexinchara < 0 ){ + sprintf( token, "%sƷʧ" , CHAR_getChar( i, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + sprintf( token, "%s飬Ʒ" , CHAR_getChar( charaindex, CHAR_NAME)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW);} + else{ + CHAR_setItemIndex( i, emptyitemindexinchara, itemindex); + ITEM_setChar( itemindex, ITEM_NAME, "ָͬ"); + ITEM_setChar( itemindex, ITEM_SECRETNAME, "ָͬ"); + sprintf( token, "%s飬ͬʹøýָ!", CHAR_getChar( charaindex, CHAR_NAME)); + ITEM_setChar( itemindex, ITEM_EFFECTSTRING, token); + CHAR_sendItemDataOne( i, emptyitemindexinchara); + ITEM_endExistItemsOne(itemindex); + sprintf( token, " %s鲢 %s 㣡", CHAR_getChar( charaindex, CHAR_NAME),ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( i, -1, token, CHAR_COLORYELLOW); + sprintf( token, "Ѿ%s", CHAR_getChar( i, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + return;}} + }else{ + CHAR_setChar( i, CHAR_LOVE,""); + CHAR_setChar( i, CHAR_LOVERID,""); + CHAR_setChar( i, CHAR_LOVERNAME,""); + CHAR_setChar( charaindex, CHAR_LOVE,""); + CHAR_setChar( charaindex, CHAR_LOVERID,""); + CHAR_setChar( charaindex, CHAR_LOVERNAME,""); + CHAR_talkToCli( i, -1, "˫ɹ", CHAR_COLORYELLOW); + CHAR_talkToCli( charaindex, -1, "˫ɹ", CHAR_COLORYELLOW);} + CHAR_DelItem( charaindex, haveitemindex); + }else + CHAR_talkToCli( charaindex, -1, "ûнŶ~", CHAR_COLORYELLOW ); +} + +void ITEM_LoverForceUnmarry( int charaindex, int toindex, int haveitemindex) //ǿ +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char token[256]; + //Ƿ + if( !strcmp( CHAR_getChar( charaindex, CHAR_LOVE), "YES")) + { + CHAR_setChar( charaindex, CHAR_LOVE,""); + CHAR_setChar( charaindex, CHAR_LOVERID,""); + CHAR_setChar( charaindex, CHAR_LOVERNAME,""); + CHAR_talkToCli( charaindex, -1, "Ѿǿɹ!", CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + }else + CHAR_talkToCli( charaindex, -1, "ûнŶ~", CHAR_COLORYELLOW ); +} + +#endif + +#ifdef _ITEM_METAMO +void ITEM_ColorMetamo( int charaindex, int toindex, int haveitemindex) +{ + int MetamoList[13][7]={ + /*{ , , , , , , }, //Ϊ˵*/ + { 100000, 100000, 100005, 100010, 100015, 100700, 100705}, //С + { 100020, 100025, 100030, 100035, 100020, 100710, 100715}, // + { 100040, 100055, 100050, 100045, 100040, 100720, 100725}, //к + { 100060, 100060, 100065, 100070, 100075, 100730, 100735}, // + { 100080, 100095, 100085, 100090, 100080, 100740, 100745}, //Ƥ + { 100100, 100100, 100115, 100110, 100105, 100750, 100755}, // + { 100120, 100135, 100120, 100125, 100130, 100760, 100765}, //С + { 100140, 100145, 100140, 100150, 100155, 100770, 100775}, //Ƥ + { 100160, 100165, 100170, 100160, 100175, 100780, 100785}, //ñ + { 100180, 100190, 100195, 100185, 100180, 100790, 100795}, //̷ + { 100200, 100200, 100210, 100215, 100205, 100800, 100805}, //Ů + { 100220, 100230, 100225, 100220, 100235, 100810, 100815}, // + { 100240, 0 , 0 , 0 , 0 , 100820, 0 }, // + }; + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + int OldMetamoId, NewMetamoId, i; + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + OldMetamoId=CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER); + for(i=0;i<12;i++) + if((OldMetamoId>=MetamoList[i][0] && OldMetamoId=MetamoList[i][5] && OldMetamoId= 100000 && OldMetamoId < 100240 ) + || (OldMetamoId >= 100700 && OldMetamoId < 100820)){ + if( strstr( itemarg, "" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[0][rand()%4+1]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[1][rand()%4+1]; + }else if( strstr( itemarg, "к" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "Ϊк", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[2][rand()%4+1]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[3][rand()%4+1]; + }else if( strstr( itemarg, "Ƥ" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "ΪƤ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[4][rand()%4+1]; + }else if( strstr( itemarg, "ֻ" ) && OldMetamoId >= 100000 && OldMetamoId < 100120){ + CHAR_talkToCli( charaindex, -1, "Ϊֻ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[5][rand()%4+1]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[6][rand()%4+1]; + }else if( strstr( itemarg, "Ƥ" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "ΪƤ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[7][rand()%4+1]; + }else if( strstr( itemarg, "ñ" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "Ϊñ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[8][rand()%4+1]; + }else if( strstr( itemarg, "̷" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "Ϊ̷", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[9][rand()%4+1]; + }else if( strstr( itemarg, "Ů" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "ΪŮ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[10][rand()%4+1]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100120 && OldMetamoId < 100240){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + NewMetamoId=MetamoList[11][rand()%4+1]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[0][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[0][6]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[1][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[1][6]; + }else if( strstr( itemarg, "к" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "Ϊк", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[2][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[2][6]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[3][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[3][6]; + }else if( strstr( itemarg, "Ƥ" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "ΪƤ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[4][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[4][6]; + }else if( strstr( itemarg, "ֻ" ) && OldMetamoId >= 100700 && OldMetamoId < 100760){ + CHAR_talkToCli( charaindex, -1, "Ϊֻ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[5][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[5][6]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[6][6]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[6][6]; + }else if( strstr( itemarg, "Ƥ" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "ΪƤ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[7][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[7][6]; + }else if( strstr( itemarg, "ñ" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "Ϊñ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[8][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[8][6]; + }else if( strstr( itemarg, "̷" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "Ϊ̷", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[9][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[9][6]; + }else if( strstr( itemarg, "Ů" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "ΪŮ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[10][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[10][6]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100760 && OldMetamoId < 100820){ + CHAR_talkToCli( charaindex, -1, "Ϊ", CHAR_COLORYELLOW); + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[11][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[11][6]; + }else if( strstr( itemarg, "" ) && OldMetamoId >= 100000 && OldMetamoId < 100240){ + do + if( OldMetamoId >= 100000 && OldMetamoId < 100120 ){ + NewMetamoId=MetamoList[rand()%6][rand()%4+1]; + }else if( OldMetamoId >= 100120 && OldMetamoId < 100240 ){ + NewMetamoId=MetamoList[rand()%6+6][rand()%4+1]; + }else if( OldMetamoId >= 100700 && OldMetamoId < 100760 ){ + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[rand()%6][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[rand()%6][6]; + }else if( OldMetamoId >= 100760 && OldMetamoId < 100820 ){ + if( ( OldMetamoId - 100700 ) % 10 == 0 ) + NewMetamoId=MetamoList[rand()%6+6][5]; + else if( ( OldMetamoId - 100700 ) % 10 == 5 ) + NewMetamoId=MetamoList[rand()%6+6][6]; + } + while(NewMetamoId==OldMetamoId); + CHAR_talkToCli( charaindex, -1, "ͳɹ", CHAR_COLORYELLOW); + } + }else{ + CHAR_talkToCli( charaindex, -1, "㲢!", CHAR_COLORYELLOW); + return; + } + if(NewMetamoId==0){ + CHAR_talkToCli( charaindex, -1, "ԱͬûĴ!", CHAR_COLORYELLOW); + return;} + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , NewMetamoId ); + CHAR_setInt( charaindex , CHAR_BASEBASEIMAGENUMBER , NewMetamoId ); + + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_DelItem( charaindex, haveitemindex); +} + +void ITEM_SexMetamo( int charaindex, int toindex, int haveitemindex) +{ + int OldMetamoId, NewMetamoId; + OldMetamoId=CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER); + if(OldMetamoId >=100000 && OldMetamoId <100020){ // + NewMetamoId=OldMetamoId+120; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100020 && OldMetamoId <100040){ // + NewMetamoId=OldMetamoId+160; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ̷!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100040 && OldMetamoId <100060){ //к + NewMetamoId=OldMetamoId+120; + CHAR_talkToCli( charaindex, -1, "ϲԳñ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100060 && OldMetamoId <100080){ // + NewMetamoId=OldMetamoId+160; + CHAR_talkToCli( charaindex, -1, "ϲԳ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100080 && OldMetamoId <100100){ //Ƥ + NewMetamoId=OldMetamoId+60; + CHAR_talkToCli( charaindex, -1, "ϲԳƤ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100100 && OldMetamoId <100120){ //ֻ + NewMetamoId=OldMetamoId+100; + CHAR_talkToCli( charaindex, -1, "ϲԳŮ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100120 && OldMetamoId <100140){ // + NewMetamoId=OldMetamoId-120; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100140 && OldMetamoId <100160){ //Ƥ + NewMetamoId=OldMetamoId-60; + CHAR_talkToCli( charaindex, -1, "ϲԳƤ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100160 && OldMetamoId <100180){ //ñ + NewMetamoId=OldMetamoId-120; + CHAR_talkToCli( charaindex, -1, "ϲԳɱк!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100180 && OldMetamoId <100200){ //̷ + NewMetamoId=OldMetamoId-160; + CHAR_talkToCli( charaindex, -1, "ϲԳ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100200 && OldMetamoId <100220){ //Ů + NewMetamoId=OldMetamoId-100; + CHAR_talkToCli( charaindex, -1, "ϲԳɴֻ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100220 && OldMetamoId <100240){ // + NewMetamoId=OldMetamoId-160; + CHAR_talkToCli( charaindex, -1, "ϲԳɿ!", CHAR_COLORYELLOW); + }else if(OldMetamoId >=100700 && OldMetamoId <100710){ // + NewMetamoId=OldMetamoId+60; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100710 && OldMetamoId <100720){ // + NewMetamoId=OldMetamoId+80; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ̷!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100720 && OldMetamoId <100730){ //к + NewMetamoId=OldMetamoId+60; + CHAR_talkToCli( charaindex, -1, "ϲԳñ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100730 && OldMetamoId <100740){ // + NewMetamoId=OldMetamoId+80; + CHAR_talkToCli( charaindex, -1, "ϲԳ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100740 && OldMetamoId <100750){ //Ƥ + NewMetamoId=OldMetamoId+30; + CHAR_talkToCli( charaindex, -1, "ϲԳƤ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100750 && OldMetamoId <100760){ //ֻ + NewMetamoId=OldMetamoId+50; + CHAR_talkToCli( charaindex, -1, "ϲԳŮ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100760 && OldMetamoId <100770){ // + NewMetamoId=OldMetamoId-60; + CHAR_talkToCli( charaindex, -1, "ϲԳɶ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100770 && OldMetamoId <100780){ //Ƥ + NewMetamoId=OldMetamoId-30; + CHAR_talkToCli( charaindex, -1, "ϲԳƤ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100780 && OldMetamoId <100790){ //ñ + NewMetamoId=OldMetamoId-60; + CHAR_talkToCli( charaindex, -1, "ϲԳɱк!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100790 && OldMetamoId <100800){ //̷ + NewMetamoId=OldMetamoId-80; + CHAR_talkToCli( charaindex, -1, "ϲԳ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100810 && OldMetamoId <100820){ //Ů + NewMetamoId=OldMetamoId-50; + CHAR_talkToCli( charaindex, -1, "ϲԳɴֻ!", CHAR_COLORYELLOW); + }else if(OldMetamoId>=100820 && OldMetamoId <100830){ // + NewMetamoId=OldMetamoId-80; + CHAR_talkToCli( charaindex, -1, "ϲԳɿ!", CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli( charaindex, -1, "㲢ͣ޷!", CHAR_COLORYELLOW); + return;} + if(NewMetamoId==0)return; + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , NewMetamoId ); + CHAR_setInt( charaindex , CHAR_BASEBASEIMAGENUMBER , NewMetamoId ); + + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _GM_ITEM +void ITEM_GMFUNCTION( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char gmtime[16]; + char gmfunction[16]; + char token[64]; + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + + getStringFromIndexWithDelim(itemarg,"|", 1, gmfunction, sizeof(gmfunction)); + getStringFromIndexWithDelim(itemarg,"|", 2, gmtime, sizeof(gmtime)); + CHAR_setChar( charaindex , CHAR_GMFUNCTION, gmfunction ); + CHAR_setInt( charaindex , CHAR_GMTIME, atoi(gmtime) ); + sprintf( token, "ʹ%sȨ%d!", gmfunction, atoi(gmtime)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + sprintf( token, "ʹ鿴[help %s]GM!",CHAR_getChar( charaindex, CHAR_GMFUNCTION)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _VIP_SERVER +void ITEM_AddMemberPoint( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char token[64]; + int point=sasql_ampoint( CHAR_getChar(charaindex,CHAR_CDKEY), 0,0); + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + sasql_ampoint( CHAR_getChar(charaindex,CHAR_CDKEY), atoi(itemarg),1); + sprintf( token, "û%d,ĿǰӵлΪ%d!", atoi(itemarg),point+atoi(itemarg)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _VIP_SERVER +void ITEM_AddVipPoint( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char token[64]; + int fd = getfdFromCharaIndex( charaindex); + char* id = CHAR_getChar( charaindex, CHAR_CDKEY ); + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + int point = atoi(itemarg); + if( itemarg == "\0" ) return; + sprintf( token, "ûԱ%d!", point); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + sasql_vippoint( id, point, 1 ); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _NEW_NAME //Զƺ +void ITEM_NewName( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char token[64]; + //char MyNewName=CHAR_getChar( charaindex , CHAR_NEWNAME); + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + CHAR_setChar( charaindex , CHAR_NEWNAME, itemarg); + sprintf( token, "ϲ,ѻá%s³ƺ!", itemarg); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + int i; + int playernum = CHAR_getPlayerMaxNum(); + char NameMsg[256]; + char *MyName = CHAR_getChar( charaindex,CHAR_NAME ); + for( i = 0 ; i < playernum ; i++) + { + sprintf( NameMsg, "ϲҡ%sá%s۳ƺ!", MyName, itemarg ); + CHAR_talkToCli( i, -1, NameMsg, CHAR_COLORBLUE2); + } + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _VIP_RIDE //Ա֤ +void ITEM_VipRide( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char buf[32]; + int viptype; + int viptime; + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + int fd = getfdFromCharaIndex( charaindex); + if(getStringFromIndexWithDelim(itemarg,"|", 1, buf, sizeof(buf)) == FALSE) + return; + viptype = atoi(buf); + if(getStringFromIndexWithDelim(itemarg,"|", 2, buf, sizeof(buf)) == FALSE) + return; + viptime = atoi(buf); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(viptime!=0) + { + viptime = 60*60*24*viptime; + } + if(CHAR_getInt( charaindex , CHAR_VIPRIDE)0) + CHAR_setInt( charaindex , CHAR_VIPTIME, timep+viptime); + if(viptype==1) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪʽԱˣ", CHAR_COLORYELLOW ); + if(viptype==2) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪƽԱˣ", CHAR_COLORYELLOW ); + if(viptype==3) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪʯԱˣ", CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); + }else{ + if(CHAR_getInt( charaindex , CHAR_VIPRIDE)==viptype && CHAR_getInt( charaindex , CHAR_VIPTIME)>0 && viptime>0){ + CHAR_setInt( charaindex , CHAR_VIPTIME, CHAR_getInt( charaindex , CHAR_VIPTIME)+viptime); + CHAR_talkToCli( charaindex, -1, "ĻԱʱѾӣ", CHAR_COLORRED ); + CHAR_DelItem( charaindex, haveitemindex); + }else if(CHAR_getInt( charaindex , CHAR_VIPRIDE)0){ + CHAR_setInt( charaindex , CHAR_VIPTIME, timep+viptime); + } + CHAR_setInt( charaindex , CHAR_VIPRIDE, viptype); + if(viptype==1) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪʽԱˣ", CHAR_COLORYELLOW ); + if(viptype==2) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪƽԱˣ", CHAR_COLORYELLOW ); + if(viptype==3) + CHAR_talkToCli( charaindex, -1, "ϲ㣬ѳΪʯԱˣ", CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); + }else{ + CHAR_talkToCli( charaindex, -1, "ǻԱˣûҪʹã", CHAR_COLORRED ); + } + } +} +#endif + +#ifdef _VIP_RIDE //SQLԱת +void ITEM_OldToNew( int charaindex, int toindex, int haveitemindex) +{ + int point = CHAR_getInt( charaindex , CHAR_AMPOINT); + if(point>0){ + int fd = getfdFromCharaIndex( charaindex); + char* id = CHAR_getChar( charaindex, CHAR_CDKEY ); + char tmg[256]; + sprintf(tmg,"%dϸ˻תݿУ",point); + CHAR_talkToCli( charaindex, -1, tmg, CHAR_COLORYELLOW ); + CHAR_setInt( charaindex, CHAR_AMPOINT, 0); + sasql_ampoint(id, point, 1); + CHAR_DelItem( charaindex, haveitemindex); + }else + CHAR_talkToCli( charaindex, -1, "ûϸ˻ֿת", CHAR_COLORRED ); +} +#endif + +#ifdef _SAFE_PASSWORD //ȫ +void ITEM_ItemPetLocked( int charaindex, int toindex, int haveitemindex) +{ + int safemode = CHAR_getInt( charaindex , CHAR_LOCK); + if(safemode==0){ + CHAR_UnSafePassword(charaindex); + }else{ + CHAR_setWorkInt( charaindex , CHAR_WORKSAFEMODE, 0); + CHAR_setInt( charaindex , CHAR_LOCK, 0); + CHAR_talkToCli( charaindex, -1, "ϵͳѾΪϰȫ", CHAR_COLORRED ); + } +} +#endif + +#ifdef _FM_ITEM //ָ +void ITEM_AddFame( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char *itemarg="\0"; + char token[64]; + int fame=CHAR_getInt( charaindex , CHAR_FAME); + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if( itemarg == "\0" ) return; + if(fame < 100000000) + { + int NewFame = fame+atoi(itemarg)*100; + if(NewFame < 100000000) + { + CHAR_setInt( charaindex , CHAR_FAME, NewFame); + sprintf( token, "%d,Ŀǰ%d!", atoi(itemarg),NewFame/100); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); + }else + { + sprintf( token, ",100W!"); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORRED ); + } + }else + { + sprintf( token, "Ѿ100W!"); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORRED ); + } + +} +#endif + +#ifdef _LUCK_ITEM //ָ +void ITEM_Luck( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int i; + char *itemarg="\0"; + char token[64]; + char luck[][5]={"","һ","С","м",""}; + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + for(i=0;i<5;i++) + if(strstr( itemarg, luck[i])) + break; + if(i==6)i=0; + CHAR_setInt( charaindex , CHAR_LUCK, i+1); + sprintf( token, "ڵΪ%s", luck[i]); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _ITEM_METAMO_TIME +void ITEM_MetamoTime( int charaindex, int toindex, int haveitemindex ) +{ + char *itemarg="\0", msg[128], buff[32]; + int itemindex, metamoTime, battlemode, metamoNo; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return; + //print(" PetMetamo_toindex:%d ", toindex); + + if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return; + } +#ifdef _FIX_METAMORIDE + if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return; + } +#else + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return; + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){// + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return; + } +#endif + + +#ifdef _FIXBUG_ATTACKBOW + { + int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM); + if( ITEM_CHECKINDEX( armindex) == TRUE ) { + int armtype = BATTLE_GetWepon( charaindex); + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( charaindex, -1, "ʹԶ޷", CHAR_COLORYELLOW ); + return; + } + } + } +#endif + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return; + } + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + itemarg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( itemarg == "\0" )return; + if( getStringFromIndexWithDelim(itemarg,"|", 1, buff, sizeof(buff)) ) + metamoNo=atoi(buff); + if( getStringFromIndexWithDelim(itemarg,"|", 2, buff, sizeof(buff)) ) + metamoTime=atoi(buff); + getStringFromIndexWithDelim(itemarg,"|", 3, buff, sizeof(buff)); + + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec + metamoTime); + if(metamoTime>60) + sprintf( msg, "%sɳ%dСʱ", buff, metamoTime / 60 ); + else + sprintf( msg, "%sɳ%dӣ", buff, metamoTime ); + + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW ); + + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, metamoNo ); + CHAR_complianceParameter( charaindex); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + + CHAR_DelItem( charaindex, haveitemindex); + +} +#endif + +#ifdef _ITEM_GOLD +void ITEM_Gold( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char itemarg[10]; + char token[64]; + int gold=CHAR_getInt( charaindex , CHAR_GOLD); + strcpy(itemarg,ITEM_getChar(itemindex,ITEM_ARGUMENT)); + gold+=atoi(itemarg); + if(gold>CHAR_MAXGOLDHAVE) + gold=CHAR_MAXGOLDHAVE; + CHAR_setInt( charaindex , CHAR_GOLD, gold); + CHAR_complianceParameter( charaindex); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + sprintf( token, "ʯ%dS", atoi(itemarg)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + + +#ifdef _MYSTERIOUS_GIFT +void ITEM_MysteriousGift( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + char *itemarg=NULL; + char petnumstr[32]; + int petnum=0; + int present[20]={0}; + int si=0, ret,i; + char token[256]; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "" ){ + CHAR_talkToCli(charaindex, -1, "Ǹ!", CHAR_COLORYELLOW); + return; + } + + if( getStringFromIndexWithDelim( itemarg, "|", 1, petnumstr, sizeof( petnumstr)) == FALSE ) + return; + petnum = atoi(petnumstr); + if( petnum > 20 ) + petnum = 20; + for(i=0;i0 && CHAR_getInt(toindex, CHAR_LIMITLEVEL)=atoi(hight) || CHAR_getInt(toindex, CHAR_LIMITLEVEL)>=atoi(hight)){ + CHAR_talkToCli( charaindex, -1, "ĿǰijﲻʹøƷ", CHAR_COLORYELLOW); + return; + } + CHAR_setInt(toindex, CHAR_LIMITLEVEL, atoi(hight)); + if(CHAR_getInt( toindex, CHAR_EXP)<0){ + int nextexp = CHAR_GetLevelExp( toindex, CHAR_getInt(toindex, CHAR_LV)); + CHAR_setInt( charaindex, CHAR_EXP , nextexp ); + } + + char token[256]; + sprintf(token, "%sȼͻ%d",CHAR_getChar( toindex, CHAR_NAME), atoi(hight)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _ITEM_EFMETAMO +void ITEM_efMetamo( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "" ){ + CHAR_talkToCli(charaindex, -1, "Ǹñָ!", CHAR_COLORYELLOW); + return; + } + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , atoi(itemarg) ); + CHAR_setInt( charaindex , CHAR_BASEBASEIMAGENUMBER , atoi(itemarg)); + + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _PET_BEATITUDE +void PET_BEATITUDE( int charaindex, int toindex, int haveitemindex) +{ + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + CHAR_talkToCli( charaindex, -1, "Ʒֻܸʹã", CHAR_COLORYELLOW); + return; + } + if( CHAR_getInt( toindex, CHAR_PETID) == 718 || CHAR_getInt( toindex, CHAR_PETID) == 401 +#ifdef _PET_3TRANS + || CHAR_getInt( toindex, CHAR_PETID) == getMMPETID2() +#endif + ) + { + CHAR_talkToCli( charaindex, -1, "ƷܸMMʹã", CHAR_COLORYELLOW); + return; + } + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + //|2500|777 + char beatitude[12],mun[12],buf1[256]; + int targetpetid=-1; + getStringFromIndexWithDelim( itemarg, "|", 1, beatitude, sizeof(beatitude)); + getStringFromIndexWithDelim( itemarg, "|", 2, mun, sizeof(mun)); + if( getStringFromIndexWithDelim(itemarg,"|", 3, buf1, sizeof(buf1)) == FALSE ) + targetpetid=-1; + else + targetpetid=atoi(buf1); + + if( CHAR_getInt( toindex, CHAR_PETID) != targetpetid) + { + CHAR_talkToCli( charaindex, -1, "ףͲƥ䣡", CHAR_COLORYELLOW); + return; + } + + char token[256]; + int beat=CHAR_getInt( toindex, CHAR_BEATITUDE); + if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_VITAL){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun))); + beat|=BEATITUDE_VITAL; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_STR){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_STR, (CHAR_getInt( toindex, CHAR_STR)+atoi(mun))); + beat|=BEATITUDE_STR; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_TOUGH){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_TOUGH, (CHAR_getInt( toindex, CHAR_TOUGH)+atoi(mun))); + beat|=BEATITUDE_TOUGH; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_DEX){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_DEX, (CHAR_getInt( toindex, CHAR_DEX)+atoi(mun))); + beat|=BEATITUDE_DEX; + } + }else{ + sprintf(token, "%sǰΪ:%d,:%d,:%d,:%d", CHAR_getChar( toindex, CHAR_NAME), + CHAR_getInt( toindex, CHAR_VITAL), + CHAR_getInt( toindex, CHAR_STR), + CHAR_getInt( toindex, CHAR_TOUGH), + CHAR_getInt( toindex, CHAR_DEX)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charaindex, -1, "ˣⶫ̫ˣѳˣ", CHAR_COLORYELLOW); + CHAR_setInt( toindex, CHAR_BEATITUDE,beat); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == toindex )break; + } + if( i == CHAR_MAXPETHAVE )return; + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + + + int mybeatitude = CHAR_getInt( toindex, CHAR_BEATITUDE); + if(mybeatitude&BEATITUDE_VITAL && mybeatitude&BEATITUDE_STR && mybeatitude&BEATITUDE_TOUGH && mybeatitude&BEATITUDE_DEX){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun))); + beat|=BEATITUDE_VITAL; + return; + } + +} +#endif + + + + +#ifdef _GET_MULTI_ITEM +void ITEM_GetMultiItem( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + char *itemarg=NULL; + char buf[32]; + int itemnum=0; + int itemid={-1}; + char itemname[512]=""; + int si=0, ret,i; + char token[256]; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "" ){ + CHAR_talkToCli(charaindex, -1, "Ǹպ!", CHAR_COLORYELLOW); + return; + } + + if( getStringFromIndexWithDelim( itemarg, "|", 1, buf, sizeof( buf)) == FALSE ){ + CHAR_talkToCli(charaindex, -1, "!", CHAR_COLORYELLOW); + return; + } + itemnum = atoi(buf); + if( itemnum > 10 ){ + itemnum = 10; + }else if( itemnum < 0 ){ + CHAR_talkToCli(charaindex, -1, "Ǹպ!", CHAR_COLORYELLOW); + return; + } + if( (itemnum - 1) <= CHAR_findSurplusItemBox( charaindex )){ + CHAR_DelItem( charaindex, haveitemindex); + }else{ + sprintf( token, "%dƷƷλ㡣", itemnum); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + + for(i=0;i -1){ + if( CHAR_getCharPetElement( charaindex) < 0 ) { + CHAR_talkToCli( charaindex, -1, "ϳλ", CHAR_COLORYELLOW); + return; + } + int i,j,enemynum,ret; + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex( charaindex, i); + if( !CHAR_CHECKINDEX( ret))return; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )return; + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_complianceParameter( ret ); + char token[128]; + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + } + CHAR_DelItem( charaindex, haveitemindex); + CHAR_setInt(charaindex, CHAR_TRANSMIGRATION, supertrans); + CHAR_setInt(charaindex, CHAR_LV, superlevel); + CHAR_setInt(charaindex, CHAR_VITAL, 1000); + CHAR_setInt(charaindex, CHAR_STR, 0); + CHAR_setInt(charaindex, CHAR_TOUGH, 0); + CHAR_setInt(charaindex, CHAR_DEX, 0); + CHAR_setInt(charaindex, CHAR_SKILLUPPOINT, superpoint-10); + CHAR_setInt(charaindex, CHAR_SUPER, 1); + + int shiftbit[] = {4,39,40,41,42,46,49,50,69,70}; + int index; + for(index=0;index<10;index++){ + int point=0; + int array; + int shift; + array = shiftbit[index] / 32; + shift = shiftbit[index] % 32; + point = CHAR_getInt( charaindex, CHAR_ENDEVENT+array); + point = point | (1 << shift); + CHAR_setInt( charaindex, CHAR_ENDEVENT+array, point); + } + + lssproto_SKUP_send( fd, superpoint-10 ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_DUELPOINT| + CHAR_P_STRING_VITAL| + CHAR_P_STRING_STR| + CHAR_P_STRING_TOUGH| + CHAR_P_STRING_DEX + ); + CHAR_talkToCli( charaindex, -1, "ѾΪƷˣ", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex, -1, "ɡ񡿡ĴѨ񡿺͡MMת񡿣", CHAR_COLORYELLOW ); +} +#endif + +void ITEM_CharSave( int charaindex, int toindex, int haveitemindex) +{ + int savetime; + savetime = CHAR_getWorkInt( charaindex, CHAR_WORKSAVETIME)+(60*30); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(savetime>timep) + { + CHAR_talkToCli( charaindex, -1, "洢ʱδ", CHAR_COLORRED ); + return; + } + else + { + //int fd = getfdFromCharaIndex( charaindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_setWorkInt(charaindex,CHAR_WORKSAVETIME,timep); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } +} + +void ITEM_NoDelWarp( int charaindex, int toindex, int haveitemindex ) +{ + char *arg; + int itemindex, warp_t, warp_fl, warp_x, warp_y; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ){ + CHAR_talkToCli(charaindex, -1, "Я޷ʹá", CHAR_COLORYELLOW); + return; + } +#endif + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + if( arg == "\0" ) return; + if( sscanf( arg, "%d %d %d %d", &warp_t, &warp_fl, &warp_x, &warp_y) != 4 ) + return; + if( ITEM_WarpForAny(charaindex, haveitemindex, warp_fl, warp_x, warp_y, warp_t) == FALSE ) + return; + CHAR_sendStatusString(charaindex, "P"); +} + +void ITEM_RandWarp( int charaindex, int toindex, int haveitemindex) +{ + int fd = getfdFromCharaIndex( charaindex); + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char arg[255]; + int len=4; + int id,j; + char pass[len]; + char *password= "0123456789"; + char buf[255]; + char *buff = (char *)malloc(len + 1); + srand((unsigned)time(NULL)); + for(j=0; j < len; j++) + { + id = rand() % strlen(password); + pass[j] = password[id]; /**/ + } + buff = pass; + buff[j]= 0; + sprintf(arg,"%d|%d|%s",haveitemindex,atoi(buff),ITEM_getChar(itemindex, ITEM_ARGUMENT )); + CHAR_setWorkChar(charaindex, CHAR_WORKRANDMSG, arg); + sprintf(buf,"Сڵ֤(%d)",atoi(buff)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_RAND_WARP, + -1, + buf); +} + +void ITEM_RandMsg( int charaindex, int toindex, int haveitemindex) +{ + int fd = getfdFromCharaIndex( charaindex); + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char arg[255]; + int len=4; + int id,j; + char pass[len]; + char *password= "0123456789"; + char buf[255]; + char *buff = (char *)malloc(len + 1); + srand((unsigned)time(NULL)); + for(j=0; j < len; j++) + { + id = rand() % strlen(password); + pass[j] = password[id]; /**/ + } + buff = pass; + buff[j]= 0; + sprintf(arg,"%d|%d|%s",haveitemindex,atoi(buff),ITEM_getChar(itemindex, ITEM_ARGUMENT )); + CHAR_setWorkChar(charaindex, CHAR_WORKRANDMSG, arg); + sprintf(buf,"Сڵ֤(%d)",atoi(buff)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_RAND_MSG, + -1, + buf); +} + +#ifdef _SQL_BUY_FUNC +void ITEM_OnlineBuy_recv( int charaindex, int toindex, int haveitemindex) +{ + char buf[256]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + int i; + int petindex; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + petindex = CHAR_getCharPet( charaindex, i); + if( petindex == -1 ) + break; + } + if( i == CHAR_MAXPETHAVE ){ + CHAR_talkToCli( charaindex, -1, "ʾΪ˱֤Ԥһλ", CHAR_COLORYELLOW ); + return; + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_ONLINE_BUY, + -1, + makeEscapeString( "봮\n", buf, sizeof(buf))); + + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +#ifdef _JOB_AUTOPK +void ITEM_JobPk( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[32]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + char *itemarg="\0"; + int jobmode,jobtime; + itemarg=ITEM_getChar(itemindex,ITEM_ARGUMENT); + if(getStringFromIndexWithDelim(itemarg,"|", 1, buf, sizeof(buf)) == FALSE) + return; + jobmode = atoi(buf); + if(getStringFromIndexWithDelim(itemarg,"|", 2, buf, sizeof(buf)) == FALSE) + return; + jobtime = atoi(buf); + CHAR_setInt(charaindex,CHAR_JOBPKMODE,jobmode); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + jobtime = timep + jobtime*60*24*60; + CHAR_setInt(charaindex,CHAR_JOBPKTIME,jobtime); + + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +void ITEM_SeeEquip( int charaindex, int toindex, int haveitemindex) +{ + int ix,iy,iPlayerNum,objbuf[16];; + CHAR_getCoordinationDir(CHAR_getInt(charaindex,CHAR_DIR),CHAR_getInt(charaindex,CHAR_X), + CHAR_getInt(charaindex,CHAR_Y),1,&ix,&iy); + iPlayerNum = CHAR_getSameCoordinateObjects(objbuf,arraysizeof(objbuf),CHAR_getInt(charaindex,CHAR_FLOOR),ix,iy); + if(iPlayerNum <= 0){ + CHAR_talkToCli(charaindex, -1, "ǰûˡ", CHAR_COLORRED); + }else if(iPlayerNum == 1){ + int objindex,index,itemindex; + char equipbuf[256]; + objindex = objbuf[0]; + index = OBJECT_getIndex(objindex); + itemindex = CHAR_getItemIndex(index,CHAR_HEAD); + if(itemindex>0){ + sprintf(equipbuf,"ͷ:%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, "ͷ:", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_BODY); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_EQSHIELD); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_DECORATION1); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_DECORATION2); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_ARM); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_EQGLOVE); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_EQBELT); + if(itemindex>0){ + sprintf(equipbuf,":%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, ":", CHAR_COLORGREEN); + } + itemindex = CHAR_getItemIndex(index,CHAR_EQSHOES); + if(itemindex>0){ + sprintf(equipbuf,"Ь:%s:%s",ITEM_getChar(itemindex,ITEM_NAME),ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + CHAR_talkToCli(charaindex, -1, equipbuf, CHAR_COLORGREEN); + }else{ + CHAR_talkToCli(charaindex, -1, "Ь:", CHAR_COLORGREEN); + } + }else{ + CHAR_talkToCli(charaindex, -1, "ǰֻһˡ", CHAR_COLORRED); + } +} + +#ifdef _VIGOR_SYS +void ITEM_VigorSave( int charaindex, int toindex, int haveitemindex) +{ + int fd = getfdFromCharaIndex( charaindex); + char vigormsg[256]; + if(CHAR_getInt(charaindex,CHAR_VIPRIDE)>0 && getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))>0){ + if(CHAR_getInt(charaindex,CHAR_VIGOR)=getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))){ + CHAR_setInt(charaindex,CHAR_VIGOR,min(CHAR_getInt(charaindex,CHAR_VIGOR)+(int)(curtime/getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))*2),getVigorMax())); + //CHAR_setWorkInt(charaindex,CHAR_WORKVIGORTIME,CHAR_getWorkInt(charaindex,CHAR_WORKVIGORTIME)+(int)(curtime/getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)))*getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))); + CHAR_setWorkInt(charaindex,CHAR_WORKVIGORTIME,timep); + sprintf(vigormsg,"ֵѸ£ĿǰĻֵΪ%dϵͳԶΪ浵",CHAR_getInt(charaindex,CHAR_VIGOR)); + CHAR_talkToCli(charaindex, -1, vigormsg, CHAR_COLORRED); + CHAR_charSaveFromConnect(charaindex, FALSE); + }else{ + CHAR_talkToCli(charaindex, -1, "ȡʱ̣Ժԣ", CHAR_COLORRED); + } + }else{ + CHAR_talkToCli(charaindex, -1, "ĻѾֵ", CHAR_COLORRED); + } + }else if(CHAR_getInt(charaindex,CHAR_VIPRIDE)<=0 && getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))>0){ + if(CHAR_getInt(charaindex,CHAR_VIGOR)=getVigorTime(0)){ + CHAR_setInt(charaindex,CHAR_VIGOR,min(CHAR_getInt(charaindex,CHAR_VIGOR)+(int)(curtime/getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))),getVigorMax())); + //CHAR_setWorkInt(charaindex,CHAR_WORKVIGORTIME,CHAR_getWorkInt(charaindex,CHAR_WORKVIGORTIME)+(int)(curtime/getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)))*getVigorTime(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION))); + CHAR_setWorkInt(charaindex,CHAR_WORKVIGORTIME,timep); + sprintf(vigormsg,"ֵѸ£ĿǰĻֵΪ%dϵͳԶΪ浵",CHAR_getInt(charaindex,CHAR_VIGOR)); + CHAR_talkToCli(charaindex, -1, vigormsg, CHAR_COLORRED); + CHAR_charSaveFromConnect(charaindex, FALSE); + }else{ + CHAR_talkToCli(charaindex, -1, "ȡʱ̣Ժԣ", CHAR_COLORRED); + } + }else{ + CHAR_talkToCli(charaindex, -1, "ĻѾֵ", CHAR_COLORRED); + } + }else{ + CHAR_talkToCli(charaindex, -1, "Ŀǰ޷ȡֵ", CHAR_COLORRED); + } +} +#endif + +#ifdef _EV_NUM +void ITEM_EvItem( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[256]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + CHAR_talkToCli(charaindex, -1, "ʾΪֹűɫΪȷɫΪ", CHAR_COLORYELLOW); + int i = RAND(1,2); + int evitem = CHAR_getInt(charaindex,CHAR_EVITEM); + int evi,evj; + if(i==1){ + if(evitem>0){ + sprintf(buf,"뵽%sҪ<%s>",ITEM_getChar(itemindex,ITEM_ARGUMENT),ITEM_getNameFromNumber( evitem)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORGREEN); + evi = RAND(32700,32714); + evj = RAND(32750,32799); + sprintf(buf,"뵽%sҪ<%s>",ITEMTBL_getChar(evj,ITEM_ARGUMENT),ITEM_getNameFromNumber( evi)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORRED); + }else{ + sprintf(buf,"뵽%s",ITEM_getChar(itemindex,ITEM_ARGUMENT)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORGREEN); + evi = RAND(32700,32714); + evj = RAND(32750,32799); + sprintf(buf,"뵽%sҪ<%s>",ITEMTBL_getChar(evj,ITEM_ARGUMENT),ITEM_getNameFromNumber( evi)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORRED); + } + }else{ + if(evitem>0){ + evi = RAND(32700,32714); + evj = RAND(32750,32799); + sprintf(buf,"뵽%sҪ<%s>",ITEMTBL_getChar(evj,ITEM_ARGUMENT),ITEM_getNameFromNumber( evi)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORRED); + sprintf(buf,"뵽%sҪ<%s>",ITEM_getChar(itemindex,ITEM_ARGUMENT),ITEM_getNameFromNumber( evitem)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORGREEN); + }else{ + evi = RAND(32700,32714); + evj = RAND(32750,32799); + sprintf(buf,"뵽%sҪ<%s>",ITEMTBL_getChar(evj,ITEM_ARGUMENT),ITEM_getNameFromNumber( evi)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORRED); + sprintf(buf,"뵽%s",ITEM_getChar(itemindex,ITEM_ARGUMENT)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORGREEN); + } + } +} +#endif + +#ifdef _OFFLINE_SYSTEM +void ITEM_OFFLINE( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[256]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + int offtime=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + int myofftime = offtime+CHAR_getInt(charaindex,CHAR_OFFTIME); + if(myofftime >= 60*60*24*300){ + CHAR_talkToCli(charaindex, -1, "ʱѾֵ޷ʹøõߡ", CHAR_COLORRED); + return; + } + CHAR_setInt(charaindex,CHAR_OFFTIME,myofftime); + sprintf(buf,"ʱ%dӡ",(int)(offtime/60)); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); +} +#endif + +void ITEM_AddProfessionLevel( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[256]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + int addprolv=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + int myprolv = CHAR_getInt( charaindex, PROFESSION_LEVEL ); + if(CHAR_getInt( charaindex, PROFESSION_CLASS ) == PROFESSION_CLASS_NONE){ + CHAR_talkToCli(charaindex, -1, "㻹ûоְ", CHAR_COLORRED); + return; + } + if(myprolv + addprolv > PROFESSION_MAX_LEVEL){ + CHAR_talkToCli(charaindex, -1, "ĵȼְҵȼ", CHAR_COLORRED); + return; + }else{ + CHAR_setInt( charaindex, PROFESSION_LEVEL, myprolv + addprolv ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + sprintf(buf,"ְҵȼɹ%d",CHAR_getInt( charaindex, PROFESSION_LEVEL )); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORYELLOW); + } + CHAR_DelItem( charaindex, haveitemindex); +} +#ifdef _ZHIPIAO_SYSTEM +void ITEM_ZhiPiao( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[256]; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + int zhipiaoindex=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + if(zhipiaoindex == -1){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_ZHIPIAO_1, + -1, + makeEscapeString( "ҪһĻԱ\n", buf, sizeof(buf))); + CHAR_setWorkInt(charaindex,CHAR_WORKZHIPIAOITEM,haveitemindex); + }else{ + int vippoint = sasql_zhipiao_query(ITEM_getChar(itemindex,ITEM_UNIQUECODE)); + if(vippoint>0){ + char piaomsg[256]; + sprintf(piaomsg,"\nȷҪ֧Ʊô\n\n֧ƱֺԻ%d\n\nȷĻ[OK]\n",vippoint); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_ZHIPIAO_3, + -1, + piaomsg); + CHAR_setWorkInt(charaindex,CHAR_WORKZHIPIAOITEM,haveitemindex); + }else if(vippoint==0){ + CHAR_talkToCli(charaindex, -1, "֧ƱѾ֧ȡظ֧ȡ", CHAR_COLORRED); + CHAR_DelItem( charaindex, haveitemindex); + return; + } + } +} +#endif + +#ifdef _ALL_RANDMODE +void ITEM_useRandEditBase( int charaindex, int toindex, int haveitemindex) +{ + if(getMmType()==0){ + CHAR_talkToCli(charaindex, -1, getMmMsg(), CHAR_COLORRED); + return; + } + int fd = getfdFromCharaIndex( charaindex); + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(charaindex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + return; + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtime = atoi(tempbuff); +#ifdef _MM_NO_JIAOBEN + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); + return; + } +#endif + } + } +// if(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME)>=getEditBaseTime()) +// CHAR_setWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME,timep); +// else{ +// char errbuf[256]; +// sprintf(errbuf,"%dſԼ˲",getEditBaseTime()-(timep-CHAR_getWorkInt(charaindex,CHAR_WORKRANDEDITBASETIME))); +// CHAR_talkToCli(charaindex, -1, errbuf, CHAR_COLORRED); +// return; +// } + char arg[255]; + char buf[128]; + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","",""}; + char chengbuf[][5]={"","*","x","X","","",""}; + char numbuf[][5]={"","","","","","","","","",""}; + int i,j,k,l,m; +// if(randtype == 0){ +// randtype = RAND(1,10); +// if(randtype<=5){ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=1; +// else randtype=2; +// }else{ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=3; +// else randtype=4; +// } +// } + randtype = 4; + if(randtype==1){ + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else{ + typebuf=jianbuf[l-1]; + k = i-j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + sprintf(arg,"%d|%d|%d|%d",itemindex,toindex,haveitemindex,k); + CHAR_setWorkChar(charaindex, CHAR_WORKRANDEDITBASE, arg); + sprintf(buf,"ʽĽ(%s%s%s=?)",ibuf,typebuf,jbuf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND1_EDITBASE, + -1, + buf); + }else if(randtype==2){ + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else if(m==2){ + typebuf=jianbuf[l-1]; + k = i-j; + }else{ + typebuf=chengbuf[l-1]; + k = i*j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + int n; + int randnum1; + char tempret[5][32]; + randnum1 = RAND(1,5); + int randnumbuf[4]; + int tmpi=0; + while(tmpi<100){ + randnumbuf[0] = RAND(1,100); + randnumbuf[1] = RAND(1,100); + randnumbuf[2] = RAND(1,100); + randnumbuf[3] = RAND(1,100); + if(randnumbuf[0]!=randnumbuf[1]!=randnumbuf[2]!=randnumbuf[3]!=k){ + break; + } + tmpi++; + } + tmpi=0; + for(n=1;n<=5;n++){ + if(n==randnum1){ + sprintf(tempret[n-1],"%d",k); + }else if(tmpi<4){ + sprintf(tempret[n-1],"%d",randnumbuf[tmpi]); + tmpi++; + } + } + sprintf(arg,"%d|%d|%d|%d",itemindex,toindex,haveitemindex,randnum1); + CHAR_setWorkChar(charaindex, CHAR_WORKRANDEDITBASE, arg); + sprintf(buf,"3\nѡʽĽ(%s%s%s=?)\n \n \nѡһ%s\nѡ%s\nѡ%s\nѡģ%s\nѡ壺%s\n",ibuf,typebuf,jbuf,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND2_EDITBASE, + -1, + buf); + }else if(randtype==3){ + sprintf(arg,"%s",sasql_rand_buf()); + if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randquestion,tempbuf); + if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randrightanswer,tempbuf); + sprintf(arg,"%d|%d|%d|%s",itemindex,toindex,haveitemindex,randrightanswer); + CHAR_setWorkChar(charaindex, CHAR_WORKRANDEDITBASE, arg); + sprintf(buf,"%s:",randquestion); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND3_EDITBASE, + -1, + buf); + }else{ +// sprintf(arg,"%s",sasql_rand_buf()); +// if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; +// if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randquestion,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randrightanswer,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 3, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer1,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 4, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer2,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 5, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer3,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 6, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer4,tempbuf); + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬӢģ",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + //char *tempbuff2 = "ABCDE"; + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=30) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + if(selecttype<=50){ + sprintf(arg,"%d|%d|%d|%d",itemindex,toindex,haveitemindex,rightnum); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(arg,"%d|%d|%d|%d",itemindex,toindex,haveitemindex,randnum1); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(charaindex, CHAR_WORKRANDEDITBASE, arg); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_RAND4_EDITBASE, + -1, + buf); + CHAR_setWorkInt(charaindex,CHAR_WORKLUANPCINT,0); + } + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(charaindex,CHAR_RANDTYPE,tempbuff); +} +#endif +#ifdef _DP_ZHIPIAO_ITEM +void ITEM_DpZhiPiao( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[256]; + char tmpbuf[10]; + int itemtype,itemdp=0; + int fd = getfdFromCharaIndex( charaindex); + if( fd == - 1 ) return; + char *itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + if(strlen(itemarg)<1) return; + if(getStringFromIndexWithDelim(itemarg,"|", 1, tmpbuf, sizeof(tmpbuf)) == FALSE) + return; + itemtype = atoi(tmpbuf); + if(getStringFromIndexWithDelim(itemarg,"|", 2, tmpbuf, sizeof(tmpbuf)) == FALSE) + return; + itemdp = atoi(tmpbuf); + if(itemdp<0) return; + if(itemtype==0){ + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","","",}; + char numbuf[][5]={"","","","","","","","","",""}; + int i,j,k,l,m; + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else{ + typebuf=jianbuf[l-1]; + k = i-j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + sprintf(buf,"ʽĽ(%s%s%s=?)",ibuf,typebuf,jbuf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_DPZHIPIAO_1, + -1, + buf); + CHAR_setWorkInt(charaindex,CHAR_WORKDPZHIPIAOITEM,haveitemindex); + CHAR_setWorkInt(charaindex,CHAR_WORKDPZHIPIAOSHUI,itemdp); + CHAR_setWorkInt(charaindex,CHAR_WORKDPZHIPIAORAND,k); + }else{ + CHAR_setInt(charaindex,CHAR_DUELPOINT,min(CHAR_getInt(charaindex,CHAR_DUELPOINT)+itemdp,CHAR_MAXDUELPOINT)); + CHAR_DelItem( charaindex, haveitemindex); + sprintf(buf,"%dDP",itemdp); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( charaindex ,CHAR_P_STRING_DUELPOINT); + CHAR_send_DpDBUpdate_AddressBook( charaindex, TRUE ); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } +} +#endif + +void ITEM_UpPointResetItem( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + char buf[32]; + int fd = getfdFromCharaIndex( charaindex); + int vital,str,tough,dex,uppoint; + CHAR_DelItem( charaindex, haveitemindex); + vital = CHAR_getInt(charaindex, CHAR_VITAL)/100; + str = CHAR_getInt(charaindex, CHAR_STR)/100; + tough = CHAR_getInt(charaindex, CHAR_TOUGH)/100; + dex = CHAR_getInt(charaindex, CHAR_DEX)/100; + uppoint = CHAR_getInt(charaindex, CHAR_SKILLUPPOINT)+vital+str+tough+dex; + CHAR_setInt(charaindex, CHAR_VITAL, CHAR_getInt(charaindex, CHAR_VITAL)-vital*100); + CHAR_setInt(charaindex, CHAR_STR, CHAR_getInt(charaindex, CHAR_STR)-str*100); + CHAR_setInt(charaindex, CHAR_TOUGH, CHAR_getInt(charaindex, CHAR_TOUGH)-tough*100); + CHAR_setInt(charaindex, CHAR_DEX, CHAR_getInt(charaindex, CHAR_DEX)-dex*100); + CHAR_setInt(charaindex, CHAR_SKILLUPPOINT, CHAR_getInt(charaindex, CHAR_SKILLUPPOINT)+vital+str+tough+dex); + lssproto_SKUP_send( fd, uppoint ); + CHAR_complianceParameter( charaindex ); + CHAR_send_P_StatusString( charaindex, + CHAR_P_STRING_DUELPOINT| + CHAR_P_STRING_VITAL| + CHAR_P_STRING_STR| + CHAR_P_STRING_TOUGH| + CHAR_P_STRING_DEX + ); + CHAR_talkToCli( charaindex, -1, "ϴɣ¼ӵ㣡", CHAR_COLORYELLOW ); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} +#ifdef _XC_CANGKU +extern int ickmeindex; +extern int pckmeindex; +void NPC_PoolItemShop_printWindow_Start( int meindex, int talkerindex); +void NPC_PetShop_selectWindow1( int meindex, int toindex, int num,int select); +void ITEM_ICK( int charaindex, int toindex, int haveitemindex) +{ + NPC_PoolItemShop_printWindow_Start(ickmeindex, charaindex); +} +void ITEM_PCK( int charaindex, int toindex, int haveitemindex) +{ + CHAR_setWorkInt(charaindex,CHAR_WORKSHOPRELEVANT,0); + NPC_PetShop_selectWindow1(pckmeindex, charaindex,0,-1); +} +#endif +void ITEM_MM( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int fd = getfdFromCharaIndex( charaindex); + int i,j,petindex,petid,ret; + int mmtype=atoi(ITEM_getChar(itemindex,ITEM_ARGUMENT)); + char msgbuf[64]; + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charaindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ){ + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + return; + } + + if(mmtype==1) + petid = 1479; + else if(mmtype==2) + petid = 2547; + else + return; + + int enemynum = ENEMY_getEnemyNum(); + + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID ) == petid ) + //if( ENEMY_getInt( i, ENEMY_TEMPNO ) == petid ) + break; + } + + if( i == enemynum ) + return; + + ret = ENEMY_createPetFromEnemyIndex( charaindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charaindex, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + i = 0; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + int petindex2 = CHAR_getCharPet(charaindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charaindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + } + CHAR_DelItem( charaindex, haveitemindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex2, CHAR_NAME), + CHAR_getInt( petindex2, CHAR_LV), + "MMGet", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex2, CHAR_UNIQUECODE) // shan 2001/12/14 + ); +} + +void ITEM_MakePet( int charaindex, int toindex, int haveitemindex) +{ + int itemindex; + char *itemarg=NULL; + int ret,i; + char pettemp[32]; + char token[256]; + int petid,pethp,petvital,petstr,pettgh,petdex,petlv,pettrn; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + + itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + if( itemarg == "" ){ + CHAR_talkToCli(charaindex, -1, "Ǹ!", CHAR_COLORYELLOW); + return; + } + + if( getStringFromIndexWithDelim( itemarg, "|", 1, pettemp, sizeof( pettemp)) == FALSE ) + return; + petid = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 2, pettemp, sizeof( pettemp)) == FALSE ) + return; + petlv = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 3, pettemp, sizeof( pettemp)) == FALSE ) + return; + pettrn = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 4, pettemp, sizeof( pettemp)) == FALSE ) + return; + pethp = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 5, pettemp, sizeof( pettemp)) == FALSE ) + return; + petvital = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 6, pettemp, sizeof( pettemp)) == FALSE ) + return; + petstr = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 7, pettemp, sizeof( pettemp)) == FALSE ) + return; + pettgh = atoi(pettemp); + if( getStringFromIndexWithDelim( itemarg, "|", 8, pettemp, sizeof( pettemp)) == FALSE ) + return; + petdex = atoi(pettemp); + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + if( CHAR_getCharPet( charaindex, i) == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ){ + snprintf( token,sizeof( token), ""); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + + int enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum )return; + + ret = ENEMY_createPetFromEnemyIndex( charaindex, i); + if(!CHAR_CHECKINDEX( ret)) + return; + + sprintf( token,"õ%s",ENEMY_getChar( i, ENEMY_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE )i = 0; + + CHAR_setInt(ret,CHAR_LV,petlv); + CHAR_setInt(ret,CHAR_TRANSMIGRATION,pettrn); + CHAR_setInt(ret,CHAR_VITAL,petvital); + CHAR_setInt(ret,CHAR_STR,petstr); + CHAR_setInt(ret,CHAR_TOUGH,pettgh); + CHAR_setInt(ret,CHAR_DEX,petdex); + CHAR_setInt(ret,CHAR_HP,pethp); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + CHAR_complianceParameter( ret ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + CHAR_DelItem( charaindex, haveitemindex); +} + +void PET_OTHERBEATITUDE( int charaindex, int toindex, int haveitemindex) +{ + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + CHAR_talkToCli( charaindex, -1, "Ʒֻܸʹã", CHAR_COLORYELLOW); + return; + } + if( CHAR_getInt( toindex, CHAR_PETID) == 718 || CHAR_getInt( toindex, CHAR_PETID) == 401 +#ifdef _PET_3TRANS + || CHAR_getInt( toindex, CHAR_PETID) == getMMPETID2() +#endif + ) + { + CHAR_talkToCli( charaindex, -1, "ƷܸMMʹã", CHAR_COLORYELLOW); + return; + } + + if( CHAR_getInt( toindex, CHAR_LV) <140) + { + CHAR_talkToCli( charaindex, -1, "Ʒֻܸ140ʹã", CHAR_COLORYELLOW); + return; + } + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + //91-95|Ѫ-3000|XX-XX-XX-XX + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + char beatitude[12],mun[12],petid[64],otherbuf[32],maxbuf[32]; + getStringFromIndexWithDelim( itemarg, "|", 1, petid, sizeof(petid)); + getStringFromIndexWithDelim( itemarg, "|", 2, otherbuf, sizeof(otherbuf)); + getStringFromIndexWithDelim( itemarg, "|", 3, maxbuf, sizeof(maxbuf)); + + char fromid[12],toid[12]; + getStringFromIndexWithDelim( petid, "-", 1, fromid, sizeof(fromid)); + getStringFromIndexWithDelim( petid, "-", 2, toid, sizeof(toid)); + +/* + if(strstr(petid,temppetid)==NULL){ + CHAR_talkToCli( charaindex, -1, "Ʒܸ˳ʹã", CHAR_COLORYELLOW); + return; + } +*/ + if(CHAR_getInt( toindex, CHAR_PETID)atoi(toid) ){ + CHAR_talkToCli( charaindex, -1, "Ʒܸ˳ʹã", CHAR_COLORYELLOW); + return; + } + + getStringFromIndexWithDelim( otherbuf, "-", 1, beatitude, sizeof(beatitude)); + getStringFromIndexWithDelim( otherbuf, "-", 2, mun, sizeof(mun)); + char token[256]; + int beat=CHAR_getInt( toindex, CHAR_BEATITUDE); + if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_VITAL){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun)*100)); + beat|=BEATITUDE_VITAL; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_STR){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_STR, (CHAR_getInt( toindex, CHAR_STR)+atoi(mun)*100)); + beat|=BEATITUDE_STR; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_TOUGH){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_TOUGH, (CHAR_getInt( toindex, CHAR_TOUGH)+atoi(mun)*100)); + beat|=BEATITUDE_TOUGH; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_DEX){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%sٶ%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_DEX, (CHAR_getInt( toindex, CHAR_DEX)+atoi(mun)*100)); + beat|=BEATITUDE_DEX; + } + }else{ + sprintf(token, "%sǰΪ:%d,:%d,:%d,:%d", CHAR_getChar( toindex, CHAR_NAME), + CHAR_getInt( toindex, CHAR_VITAL), + CHAR_getInt( toindex, CHAR_STR), + CHAR_getInt( toindex, CHAR_TOUGH), + CHAR_getInt( toindex, CHAR_DEX)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charaindex, -1, "ˣⶫ̫ˣѳˣ", CHAR_COLORYELLOW); + CHAR_setInt( toindex, CHAR_BEATITUDE,beat); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == toindex )break; + } + if( i == CHAR_MAXPETHAVE )return; + if(strstr(CHAR_getChar(toindex,CHAR_NAME),"+")==NULL){ + char petnamebuf[64]; + sprintf(petnamebuf,"%s+",CHAR_getChar(toindex,CHAR_NAME)); + CHAR_setChar(toindex,CHAR_NAME,petnamebuf); + } + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + + //CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + +#ifdef _MAX_BEATITUDE_BUFF + int mybeati = CHAR_getInt( toindex, CHAR_BEATITUDE); + int mypetid = CHAR_getInt( toindex, CHAR_PETID); + char ex_vit[12],ex_str[12],ex_tou[12],ex_dex[12]; + getStringFromIndexWithDelim( maxbuf, "-", 1, ex_vit, sizeof(ex_vit)); + getStringFromIndexWithDelim( maxbuf, "-", 2, ex_str, sizeof(ex_str)); + getStringFromIndexWithDelim( maxbuf, "-", 3, ex_tou, sizeof(ex_tou)); + getStringFromIndexWithDelim( maxbuf, "-", 4, ex_dex, sizeof(ex_dex)); + + + if(mybeati&BEATITUDE_VITAL && mybeati&BEATITUDE_STR && mybeati&BEATITUDE_TOUGH && mybeati&BEATITUDE_DEX){ + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_vit)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(ex_vit)*100)); + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_str)); + CHAR_setInt( toindex, CHAR_STR, (CHAR_getInt( toindex, CHAR_STR)+atoi(ex_str)*100)); + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_tou)); + CHAR_setInt( toindex, CHAR_TOUGH, (CHAR_getInt( toindex, CHAR_TOUGH)+atoi(ex_tou)*100)); + + //sprintf(token, "%sٶ%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_dex)); + CHAR_setInt( toindex, CHAR_DEX, (CHAR_getInt( toindex, CHAR_DEX)+atoi(ex_dex)*100)); + + CHAR_talkToCli( charaindex, -1, "ףBUFFЧԭʼˣ", CHAR_COLORRED); + + int j; + for( j = 0; j < CHAR_MAXPETHAVE; j ++ ){ + if( CHAR_getCharPet( charaindex, j ) == toindex )break; + } + if( j == CHAR_MAXPETHAVE )return; + if(strstr(CHAR_getChar(toindex,CHAR_NAME),"++")==NULL){ + char petnamebuf[64]; + sprintf(petnamebuf,"%s+",CHAR_getChar(toindex,CHAR_NAME)); + CHAR_setChar(toindex,CHAR_NAME,petnamebuf); + } + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", j ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", j ); + CHAR_sendStatusString( charaindex, token ); + } + +#endif +} + +void PET_MYBEATITUDE( int charaindex, int toindex, int haveitemindex) +{ + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + CHAR_talkToCli( charaindex, -1, "Ʒֻܸʹã", CHAR_COLORYELLOW); + return; + } + if( CHAR_getInt( toindex, CHAR_PETID) == 718 || CHAR_getInt( toindex, CHAR_PETID) == 401 +#ifdef _PET_3TRANS + || CHAR_getInt( toindex, CHAR_PETID) == getMMPETID2() +#endif + ) + { + CHAR_talkToCli( charaindex, -1, "ƷܸMMʹã", CHAR_COLORYELLOW); + return; + } + + if( CHAR_getInt( toindex, CHAR_LV) < 140) + { + CHAR_talkToCli( charaindex, -1, "Ʒֻܸ140ʹã", CHAR_COLORYELLOW); + return; + } + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + //91-95|Ѫ-3000|XX-XX-XX-XX + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + char beatitude[12],mun[12],petid[64],otherbuf[32],maxbuf[32]; + getStringFromIndexWithDelim( itemarg, "|", 1, petid, sizeof(petid)); + getStringFromIndexWithDelim( itemarg, "|", 2, otherbuf, sizeof(otherbuf)); + getStringFromIndexWithDelim( itemarg, "|", 3, maxbuf, sizeof(maxbuf)); + + char fromid[12],toid[12]; + getStringFromIndexWithDelim( petid, "-", 1, fromid, sizeof(fromid)); + getStringFromIndexWithDelim( petid, "-", 2, toid, sizeof(toid)); + +/* + if(strstr(petid,temppetid)==NULL){ + CHAR_talkToCli( charaindex, -1, "Ʒܸ˳ʹã", CHAR_COLORYELLOW); + return; + } +*/ + if(CHAR_getInt( toindex, CHAR_PETID)atoi(toid) ){ + CHAR_talkToCli( charaindex, -1, "Ʒܸ˳ʹã", CHAR_COLORYELLOW); + return; + } + + getStringFromIndexWithDelim( otherbuf, "-", 1, beatitude, sizeof(beatitude)); + getStringFromIndexWithDelim( otherbuf, "-", 2, mun, sizeof(mun)); + char token[256]; + int beat=CHAR_getInt( toindex, CHAR_BEATITUDE); + if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_VITAL){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun)*100)); + CHAR_setInt( toindex, CHAR_STR,(CHAR_getInt( toindex, CHAR_STR)-atoi(mun)*10)); + CHAR_setInt( toindex, CHAR_TOUGH,(CHAR_getInt( toindex, CHAR_TOUGH)-atoi(mun)*10)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun)*5)); + beat|=BEATITUDE_VITAL; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_STR){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_STR, (CHAR_getInt( toindex, CHAR_STR)+atoi(mun)*100)); + CHAR_setInt( toindex, CHAR_TOUGH,(CHAR_getInt( toindex, CHAR_TOUGH)-atoi(mun)*10)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun)*3)); + beat|=BEATITUDE_STR; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_TOUGH){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_TOUGH, (CHAR_getInt( toindex, CHAR_TOUGH)+atoi(mun)*100)); + CHAR_setInt( toindex, CHAR_STR,(CHAR_getInt( toindex, CHAR_STR)-atoi(mun)*10)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(mun)*3)); + beat|=BEATITUDE_TOUGH; + } + }else if(strcmp( beatitude, "")==0){ + if(CHAR_getInt( toindex, CHAR_BEATITUDE)&BEATITUDE_DEX){ + CHAR_talkToCli( charaindex, -1, "ijˣ", CHAR_COLORYELLOW); + return; + }else{ + sprintf(token, "%sٶ%d", CHAR_getChar( toindex, CHAR_NAME),atoi(mun)); + CHAR_setInt( toindex, CHAR_DEX, (CHAR_getInt( toindex, CHAR_DEX)+atoi(mun)*100)); + beat|=BEATITUDE_DEX; + } + }else{ + sprintf(token, "%sǰΪ:%d,:%d,:%d,:%d", CHAR_getChar( toindex, CHAR_NAME), + CHAR_getInt( toindex, CHAR_VITAL), + CHAR_getInt( toindex, CHAR_STR), + CHAR_getInt( toindex, CHAR_TOUGH), + CHAR_getInt( toindex, CHAR_DEX)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + CHAR_talkToCli( charaindex, -1, "׳ʿˮ", CHAR_COLORYELLOW); + CHAR_setInt( toindex, CHAR_BEATITUDE,beat); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( charaindex, i ) == toindex )break; + } + if( i == CHAR_MAXPETHAVE )return; + if(strstr(CHAR_getChar(toindex,CHAR_NAME),"")==NULL){ + char petnamebuf[64]; + sprintf(petnamebuf,"%s",CHAR_getChar(toindex,CHAR_NAME)); + CHAR_setChar(toindex,CHAR_NAME,petnamebuf); + } + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + + //CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( charaindex, haveitemindex); + +#ifdef _MAX_BEATITUDE_BUFF + int mybeati = CHAR_getInt( toindex, CHAR_BEATITUDE); + int mypetid = CHAR_getInt( toindex, CHAR_PETID); + char ex_vit[12],ex_str[12],ex_tou[12],ex_dex[12]; + getStringFromIndexWithDelim( maxbuf, "-", 1, ex_vit, sizeof(ex_vit)); + getStringFromIndexWithDelim( maxbuf, "-", 2, ex_str, sizeof(ex_str)); + getStringFromIndexWithDelim( maxbuf, "-", 3, ex_tou, sizeof(ex_tou)); + getStringFromIndexWithDelim( maxbuf, "-", 4, ex_dex, sizeof(ex_dex)); + + + if(mybeati&BEATITUDE_VITAL && mybeati&BEATITUDE_STR && mybeati&BEATITUDE_TOUGH && mybeati&BEATITUDE_DEX){ + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_vit)); + CHAR_setInt( toindex, CHAR_VITAL,(CHAR_getInt( toindex, CHAR_VITAL)+atoi(ex_vit)*100)); + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_str)); + CHAR_setInt( toindex, CHAR_STR, (CHAR_getInt( toindex, CHAR_STR)+atoi(ex_str)*100)); + + //sprintf(token, "%s%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_tou)); + CHAR_setInt( toindex, CHAR_TOUGH, (CHAR_getInt( toindex, CHAR_TOUGH)+atoi(ex_tou)*100)); + + //sprintf(token, "%sٶ%d", CHAR_getChar( toindex, CHAR_NAME),atoi(ex_dex)); + CHAR_setInt( toindex, CHAR_DEX, (CHAR_getInt( toindex, CHAR_DEX)+atoi(ex_dex)*100)); + + CHAR_talkToCli( charaindex, -1, "ףBUFFЧԭʼˣ", CHAR_COLORRED); + + int j; + for( j = 0; j < CHAR_MAXPETHAVE; j ++ ){ + if( CHAR_getCharPet( charaindex, j ) == toindex )break; + } + if( j == CHAR_MAXPETHAVE )return; + if(strstr(CHAR_getChar(toindex,CHAR_NAME),"")==NULL){ + char petnamebuf[64]; + sprintf(petnamebuf,"%s",CHAR_getChar(toindex,CHAR_NAME)); + CHAR_setChar(toindex,CHAR_NAME,petnamebuf); + } + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", j ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", j ); + CHAR_sendStatusString( charaindex, token ); + } + +#endif +} + +void ITEM_useDelRenameItem( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + int toitemindex = CHAR_getItemIndex( charaindex, 9); + if(!ITEM_CHECKINDEX(toitemindex)) return; + if(strcmp(ITEM_getChar(toitemindex,ITEM_SECRETNAME),ITEM_getChar(toitemindex,ITEM_NAME))!=0){ + ITEM_setChar(toitemindex,ITEM_SECRETNAME,ITEM_getChar(toitemindex,ITEM_NAME)); + ITEM_setChar(toitemindex,ITEM_CDKEY,""); + CHAR_sendItemDataOne( charaindex, 9); + CHAR_DelItem( charaindex, haveitemindex); + CHAR_talkToCli( charaindex, -1, "ĵһԶѻԭɹʹħٴԶơ", CHAR_COLORYELLOW); + }else{ + CHAR_talkToCli( charaindex, -1, "ĵһԶƣ޷лԭ", CHAR_COLORYELLOW); + } +} + +void ITEM_DANMM( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + int fd = getfdFromCharaIndex( charaindex); + int i,j,petindex,petid,ret,mmtype; + char *itemarg = ITEM_getChar(itemindex,ITEM_ARGUMENT); + char itembuf[64],itembuff[64]; + getStringFromIndexWithDelim( itemarg, "|", 1, itembuf, sizeof(itembuf)); + mmtype=atoi(itembuf); + getStringFromIndexWithDelim( itemarg, "|", 2, itembuf, sizeof(itembuf)); + strcpy(itembuff,itembuf); + char msgbuf[64]; + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charaindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ){ + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + return; + } + + if(mmtype==1) + petid = 1479; + else if(mmtype==2) + petid = 2547; + else + return; + + int enemynum = ENEMY_getEnemyNum(); + + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID ) == petid ) + //if( ENEMY_getInt( i, ENEMY_TEMPNO ) == petid ) + break; + } + + if( i == enemynum ) + return; + + ret = ENEMY_createPetFromEnemyIndex( charaindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charaindex, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + i = 0; + int petwork[4] = {0,0,0,0}; + if(strstr(itembuff,"")!=NULL) petwork[3]=50; + if(strstr(itembuff,"")!=NULL) petwork[0]=50; + if(strstr(itembuff,"")!=NULL) petwork[1]=50; + if(strstr(itembuff,"")!=NULL) petwork[2]=50; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( petwork[3]<< 24) + ( petwork[0]<< 16) + ( petwork[1]<< 8) + ( petwork[2]<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + int petindex2 = CHAR_getCharPet(charaindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charaindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charaindex, msgbuf ); + } + CHAR_DelItem( charaindex, haveitemindex); + CHAR_charSaveFromConnect(charaindex, FALSE); + CHAR_talkToCli(charaindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex2, CHAR_NAME), + CHAR_getInt( petindex2, CHAR_LV), + "MMGet", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex2, CHAR_UNIQUECODE) // shan 2001/12/14 + ); +} + +void ITEM_ExpLvBase( int charaindex, int exp) +{ + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER && CHAR_getInt( charaindex, CHAR_LV) >= 140 ){ + char token[256]; + int toitemindex = -1; + toitemindex = CHAR_getItemIndex( charaindex, 9); + if(ITEM_CHECKINDEX(toitemindex)){ + if( strlen(ITEM_getChar( toitemindex, ITEM_USEFUNC))>0 && strcmp(ITEM_getChar( toitemindex, ITEM_USEFUNC),"ITEM_useExpLv")==0 ){ + char* itemarg = ITEM_getChar(toitemindex,ITEM_ARGUMENT); + char buftest[128]; + int itemlv = 0; + int itemexp = 0; + int itembase = 0; + int itemlvmax = 0; + if(getStringFromIndexWithDelim(itemarg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemlv = atoi(buftest); + if(getStringFromIndexWithDelim(itemarg,"|", 2, buftest, sizeof(buftest)) == FALSE) + return; + itemexp = atoi(buftest); + if(getStringFromIndexWithDelim(itemarg,"|", 3, buftest, sizeof(buftest)) == FALSE) + return; + itembase = atoi(buftest); + if(getStringFromIndexWithDelim(itemarg,"|", 4, buftest, sizeof(buftest)) == FALSE) + return; + itemlvmax = atoi(buftest); + if(itemlv>=itemlvmax){ + if(RAND(1,10)==1){ + sprintf(token,"ǰ鵤ȼLv%d޷澭顣",itemlv); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } + return; + } + itemexp = itemexp + exp/100*itembase; + int nextexp = 0; + int uplvtype = 0; + while(1){ + if(itemlv>=itemlvmax){ + break; + } + nextexp = getNeedLevelUpTbls(itemlv+1); + if(itemexp>=nextexp){ + itemlv = itemlv + 1; + itemexp = itemexp - nextexp; + uplvtype = 1; + }else{ + break; + } + } + char newitembuf[256]; + sprintf(newitembuf,"%d|%d|%d|%d",itemlv,itemexp,itembase,itemlvmax); + ITEM_setChar(toitemindex,ITEM_ARGUMENT,newitembuf); + sprintf(newitembuf,"%s[Lv%d]",ITEM_getChar(toitemindex,ITEM_NAME),itemlv); + ITEM_setChar(toitemindex,ITEM_SECRETNAME,newitembuf); + CHAR_sendItemDataOne( charaindex, 9); + if(RAND(1,10)==1){ + sprintf(token,"ǰ鵤ȼLv%dǷ飺%d",itemlv,nextexp-itemexp); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } + if(uplvtype == 1){ + sprintf(token,"鵤ĿǰĵȼLv%dٽŶ",itemlv); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } + } + } + } +} + +void ITEM_useExpLv( int charaindex, int toindex, int haveitemindex) +{ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) return; + if( !CHAR_CHECKINDEX( charaindex ) ) return; + if( !CHAR_CHECKINDEX( toindex ) ) return; + char *itemarg = ITEM_getChar( itemindex, ITEM_ARGUMENT); + char buftest[128]; + int itemlevel; + char token[256]; + if(getStringFromIndexWithDelim(itemarg,"|", 1, buftest, sizeof(buftest)) == FALSE) + return; + itemlevel = atoi(buftest); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + /* + int myupcnt = itemlevel - CHAR_getInt( toindex, CHAR_LV); + if(myupcnt<=0){ + CHAR_talkToCli( charaindex, -1, "˾鵤ĵȼûҪõŶ", CHAR_COLORYELLOW); + return; + } + if(CHAR_GetLevelExp(toindex,itemlevel)<0){ + sprintf(token,"Ŀǰ㲻%dȼþ鵤޷ʹá",itemlevel); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + CHAR_setInt(toindex,CHAR_LV,itemlevel); + CHAR_setInt( toindex, CHAR_SKILLUPPOINT, + CHAR_getInt( toindex, CHAR_SKILLUPPOINT) + myupcnt*getSkup()); + CHAR_setInt(toindex,CHAR_EXP,RAND(100,20000)); + CHAR_complianceParameter( toindex ); + CHAR_send_P_StatusString( toindex , + CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP|CHAR_P_STRING_DUELPOINT + ); + sprintf(token,"ϲѾͨ鵤[Lv%d]ѸLv%d",itemlevel,CHAR_getInt( toindex, CHAR_LV)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + */ + CHAR_talkToCli( charaindex, -1, "Ʒֻܸʹã", CHAR_COLORYELLOW); + return; + }else{ + if( CHAR_getInt( toindex, CHAR_PETID) == 718 || CHAR_getInt( toindex, CHAR_PETID) == 401 +#ifdef _PET_3TRANS + || CHAR_getInt( toindex, CHAR_PETID) == getMMPETID2() +#endif + ) + { + CHAR_talkToCli( charaindex, -1, "ƷܸMMʹã", CHAR_COLORYELLOW); + return; + } + int myupcnt = itemlevel - CHAR_getInt( toindex, CHAR_LV); + if(myupcnt<=0){ + CHAR_talkToCli( charaindex, -1, "˾鵤ĵȼûҪõŶ", CHAR_COLORYELLOW); + return; + } + if(CHAR_GetLevelExp(toindex,itemlevel)<0){ + sprintf(token,"Ŀǰijﲻ%dȼþ鵤޷ʹá",itemlevel); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return; + } + int j; + for( j = 1; j <= myupcnt; j ++ ){ // + CHAR_setWorkInt(toindex,CHAR_WORKJILU,1); + CHAR_PetLevelUp( toindex ); + CHAR_PetAddVariableAi( toindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( toindex, CHAR_LV, CHAR_getInt( toindex, CHAR_LV) +1 ); + } + CHAR_setWorkInt(toindex,CHAR_WORKJILU,0); + CHAR_setInt(toindex,CHAR_EXP,RAND(100,20000)); + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int workindex = CHAR_getCharPet( charaindex, i ); + if( workindex == toindex ){ + char token[64]; + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + CHAR_setInt( toindex , CHAR_HP ,CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( toindex , CHAR_MP ,CHAR_getWorkInt( toindex, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( toindex ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( charaindex, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( charaindex, token ); + break; + } + } + sprintf(token,"ϲij[%s]Ѿͨ鵤[Lv%d]ѸLv%d",CHAR_getChar( toindex, CHAR_NAME),itemlevel,CHAR_getInt( toindex, CHAR_LV)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + } + + CHAR_DelItem( charaindex, haveitemindex); +} + +typedef enum +{ + LUAITEM_PREOVERFUNC = ITEM_PREOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_POSTOVERFUNC = ITEM_POSTOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_WATCHFUNC = ITEM_WATCHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_USEFUNC = ITEM_USEFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_ATTACHFUNC = ITEM_ATTACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DETACHFUNC = ITEM_DETACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DROPFUNC = ITEM_DROPFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_PICKUPFUNC = ITEM_PICKUPFUNC - ITEM_FIRSTFUNCTION, +#ifdef _Item_ReLifeAct + LUAITEM_DIERELIFEFUNC = ITEM_DIERELIFEFUNC - ITEM_FIRSTFUNCTION, +#endif +}LUAITEM_FUNC; + +#ifdef _ITEM_LUA +void ITEM_Lua(int charaindex, int toindex, int haveitemindex){ + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + ITEM_Item *TM_Item = ITEM_getItemPointer(itemindex); + char funcname[48]; + memcpy(&funcname[0],ITEM_getChar(itemindex,ITEM_ARGUMENT), sizeof(funcname) ); + NPC_Lua_DoFile( getitemluafile() ); + + if(TM_Item->functable[LUAITEM_USEFUNC] != (void *)NPC_Lua_ItemUseCallBack) + { + if(TM_Item->functable[LUAITEM_USEFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_USEFUNC] = TM_Item->functable[LUAITEM_USEFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string), TM_Item->string[ITEM_USEFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_USEFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string[0] = '\0'; + } + TM_Item->functable[LUAITEM_USEFUNC] = (void *)NPC_Lua_ItemUseCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string), funcname); + strcpy_s(TM_Item->string[ITEM_USEFUNC].string, sizeof(TM_Item->string[ITEM_USEFUNC].string), FUNCNAME_ITEMUSECALLBACK); + } + + NPC_Lua_ItemUseCallBack(charaindex, toindex, haveitemindex); +} +#endif + +#ifdef _SPECIAL_SUIT +void ITEM_SpecialCheckSuitEquip( int charaindex, int itemindex) +{ + int i, num=0; + int defCode = ITEM_getInt( itemindex, ITEM_SUITCODE); + + for( i=0; i=5){ + if(defCode>=100000){ + CHAR_setInt( charaindex , CHAR_BASEIMAGENUMBER , defCode ); + + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + } + }else{ + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER) ); + + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + } + } +} + +void ITEM_SpecialSuitEquip( int charaindex, int itemindex) +{ + int ff=0, fx=0, fy=0; + char buf[256]; + char *arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + + if( sscanf( arg, "%d %d %d", &ff, &fx, &fy) != 3 ){ + ff = CHAR_getInt( charaindex, CHAR_FLOOR ); + fx = CHAR_getInt( charaindex, CHAR_X ); + fy = CHAR_getInt( charaindex, CHAR_Y ); + // WON ADD + if( checkUnlawWarpFloor( ff) ) { + CHAR_talkToCli(charaindex, -1, "˴޷ʹá", CHAR_COLORYELLOW); + return; + } + + sprintf( buf, "%d %d %d", ff, fx, fy); + ITEM_setChar(itemindex, ITEM_ARGUMENT, buf); + + } + char escapeshowstring[64]; + char *showstr = MAP_getfloorShowstring(ff); + if( checkUnlawWarpFloor( ff) ) { + CHAR_talkToCli(charaindex, -1, "˴޷ʹá", CHAR_COLORYELLOW); + return; + } + getStringFromIndexWithDelim( showstr, "|", 1, escapeshowstring, sizeof( escapeshowstring)); + sprintf( buf, "װ¼λ(%s,%d,%d)", escapeshowstring, fx, fy); + CHAR_talkToCli(charaindex, -1, buf, CHAR_COLORYELLOW); + + ITEM_SpecialCheckSuitEquip( charaindex, itemindex); +} + +void ITEM_SpecialResuitEquip( int charaindex, int itemindex) +{ + ITEM_SpecialCheckSuitEquip( charaindex, itemindex); +} +#endif + +#ifdef _MANOR_EQUIP +void ITEM_CheckManorEquip( int charaindex, int itemindex) +{ + int floor = CHAR_getWorkInt( charaindex, CHAR_WORKFMFLOOR); + + if(floor == ITEM_getInt( itemindex, ITEM_SUITCODE)){ + char *arg = ITEM_getChar(itemindex, ITEM_ARGUMENT ); + ITEM_setInt( itemindex, ITEM_MAGICID, atoi(arg)); + }else{ + ITEM_setInt( itemindex, ITEM_MAGICID, -1); + } + int i; + for(i=0;i0){ + CHAR_setInt( charaindex , CHAR_AMPOINT, CHAR_getInt( charaindex , CHAR_AMPOINT)+atoi(itemarg)); + +#ifdef _AMPOINT_LOG + LogAmPoint(CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + atoi(itemarg), + CHAR_getInt( charaindex, CHAR_AMPOINT ), + "(֧Ʊ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y )); +#endif + + sprintf( token, "ûֵ%d,ĿǰӵлֵΪ%d!", atoi(itemarg), CHAR_getInt( charaindex , CHAR_AMPOINT)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + + CHAR_DelItem( charaindex, haveitemindex); + }else{ + char buf[256]; + int fd = getfdFromCharaIndex(charaindex); + + CHAR_setWorkInt(charaindex, CHAR_WORKITEMINDEX, itemindex); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL, + CHAR_WINDOWTYPE_NULL_CHECK, + -1, + makeEscapeString( "ҪдĻ֧Ʊ(ַֹ֣)\n", buf, sizeof(buf))); + } +} +#endif diff --git a/item/item_gen.c b/item/item_gen.c new file mode 100644 index 0000000..382db45 --- /dev/null +++ b/item/item_gen.c @@ -0,0 +1,1524 @@ +/*********************************************** + * ʧ ة + **********************************************/ +#include "version.h" +#include +#include +#include +#include +#include +#include +#include + +#include "configfile.h" +#include "util.h" +#include "buf.h" + +#include "char.h" +#include "item.h" +#include "item_gen.h" +#include "enemy.h" +#include "log.h" +#include "saacproto_cli.h" +#include "family.h" +#include "magic_base.h" + +#define DEBUGPRINT 0 +#define DEBUGPRINT_DETAIL 0 + +// shan begin +#define FOOD_HP_RATE 200 +#define FOOD_MP_RATE 200 +#define FOOD_SUCCESS_RATE 150 +#define FOOD_TURN_ADDPOINT 1 +// shan end + +static int ITEM_getTableNum( int num); + +/* ټ㼰MAX */ +#define ITEM_ATOMIND_MAX 1000 +// shan add +#define ITEM_ATOMIND_FM_MAX 4000 + +#define ITEM_RANDRANGEDOM 1000 +#define ITEM_RANDRANGEDOM_BASE 0 +// shan add +#define ITEM_FM_RANDRANGEDOM 4000 + +/*********************************************** + * (ITEM_GEN_RAND_MIN/1000) * ITEN_GEN_SEARCH_MIN + * - (ITEM_GEN_RAND_MAX/1000) * ITEN_GEN_SEARCH_MAX + * ľ꼰༰ټ㼰 ëԻDZئ£ + **********************************************/ + +/* ټ㼰 ¼ĸة༰ ߨߨ */ +#define ITEM_GEN_RAND_MIN 700 +#define ITEM_GEN_RAND_MAX 1200 + +/* ʧ ةëټ㼰༰ (double) */ +#define ITEN_GEN_SEARCH_MIN (0.7) +#define ITEN_GEN_SEARCH_MAX (1.10) + +static struct tagItemSearchRangeTable { + double searchmin; + double searchmax; +}ItemSearchTable[2] = { +// { 0.7, 1.1}, +// shan add +// { 0.7, 1.3}, +// { 0.5, 1.5} + { 0.8, 1.2}, + { 0.7, 1.3} +}; + +static struct tagItemRandRangeTable { + int randmin; + int randmax; +}ItemRandTable[2] = { +// { 700, 1200}, + { 700, 1300}, + { 900, 1100} +}; + +#define ITEM_GEN_RATE 0.7 + +static struct _tagItemRandRangeTableForItem { + int num; /* ټ㼰¼ͼ */ + int minnum; /* ¼ Ի°Min */ + int maxnum; /* ¼ Ի°MAX num +ݼ¼ͼ*ITEM_GEN_RATE) */ + double rate; /* maxnum / num*/ +}ItemRandTableForItem[] = { + { 10, 0,0,0 }, + { 30, 0,0,0 }, + { 65, 0,0,0 }, + { 125, 0,0,0 }, + { 205, 0,0,0 }, + { 305, 0,0,0 }, + { 425, 0,0,0 }, + { 565, 0,0,0 }, + { 725, 0,0,0 }, + { 905, 0,0,0 }, + { 1125, 0,0,0 }, // shan add + { 1354, 0,0,0 }, + { 1594, 0,0,0 }, + { 1825, 0,0,0 }, + { 2105, 0,0,0 }, + { 2405, 0,0,0 }, + { 2725, 0,0,0 }, + { 3065, 0,0,0 }, + { 3425, 0,0,0 }, + { 3805, 0,0,0 } +}; + +#define ATOM_LEVEL_MAX 16 +struct item_atom +{ + char name[32]; + unsigned int name_hash; + int magicflg; +}; + + +struct item_atom *item_atoms; +int item_atoms_size; +#define MAX_ITEM_ATOMS_SIZE 256 + +struct item_ingindtable { + double data[MAX_ITEM_ATOMS_SIZE]; + int index; + int num; +}; + +static int ITEM_getAtomIndexByName( char *nm ) // زȡزindex +{ + int i; + unsigned int h = hashpjw( nm ); + for( i = 0; i < item_atoms_size; i ++ ){ + if( item_atoms[i].name_hash == h && + strcmp( item_atoms[i].name, nm) == 0 ){ + return i; + } + } + return -1; +} + +#ifdef _ITEMTBL_STAIC +extern ITEM_table ITEM_tbl[24000]; +#else +extern ITEM_table *ITEM_tbl; +#endif + +struct ingcache +{ + int use; +#define MAXING_ONE 5 + int inguse; + int canmergefrom; + int canmergeto; + int hitnum; + int ingind[MAXING_ONE]; + int ingval[MAXING_ONE]; +}; + +int ITEM_initRandTable( void) +{ + int i; + for( i = 0; i < arraysizeof( ItemRandTableForItem); i ++) { + if( i == 0 ) ItemRandTableForItem[i].minnum = 0; + else { + ItemRandTableForItem[i].minnum = ItemRandTableForItem[i-1].maxnum+1; + } + if( i + 1 != arraysizeof( ItemRandTableForItem)) { + ItemRandTableForItem[i].maxnum = + ItemRandTableForItem[i].num + + (ItemRandTableForItem[i+1].num - ItemRandTableForItem[i].num) + *ITEM_GEN_RATE; + + } + else { + // shan add + ItemRandTableForItem[i].maxnum = 4000; + //ItemRandTableForItem[i].maxnum = 1000; + } + ItemRandTableForItem[i].rate = ItemRandTableForItem[i].maxnum + / (double)ItemRandTableForItem[i].num; + } + /*for( i = 0; i < arraysizeof( ItemRandTableForItem); i ++) { + print( "\ntable num:[%d] min:[%d] max:[%d] rate:[%3.3f] ", + ItemRandTableForItem[i].num, + ItemRandTableForItem[i].minnum, + ItemRandTableForItem[i].maxnum, + ItemRandTableForItem[i].rate); + }*/ + return TRUE; +} + +static struct ingcache *icache; +int icache_num; + +int ITEM_initItemIngCache( void ) +{ + int i; +// print ( "\nʼƷ: Ʒ:%d ", ITEM_getItemMaxIdNum() ); + icache_num = ITEM_getItemMaxIdNum( ); + print(" :%d ", icache_num); + icache = calloc(1, sizeof( struct ingcache ) * icache_num ); + if( icache == NULL ){ + print( "ʼƷ: ûƷ\n" ); + return FALSE; + } + + print(" %4.2f MB ռ...", sizeof( struct ingcache ) * icache_num /1024.0/1024.0); + + remove( "old_icache.txt"); + memset( icache, 0, icache_num * sizeof( struct ingcache) ); + for( i=0; i= MAX_ITEM_ATOMS_SIZE ){ + print( "ʼƷɷ: Ʒɷ̫\n" ); + return FALSE; + } + + item_atoms_size = count; + print( "ʼƷɷ: ȡ %d Ʒɷ...", count ); + + return TRUE; +} + +/* + + Ѽ + + base 100 ƥ min 0.7 ƥ max 1.3 գ + 70 ~ 130 £Իؤ + ԪئԻ¾ľئмƥ + ʧ ةûƻ by ringo 1999Oct1 + 1000мmin_rate,max_rateƥ + double ֧float ֧֧мƥئУ + */ +static int +ITEM_randRange( int base, int min_rate , int max_rate ) +{ + int minnum; + int maxnum; + int range; + + if( min_rate > max_rate) { + int tmp; + tmp = min_rate; + min_rate = max_rate; + max_rate = tmp; + } + minnum = rint((double)base / ITEM_RANDRANGEDOM * min_rate); + maxnum = rint((double)base / ITEM_RANDRANGEDOM * max_rate); + range = ( maxnum - minnum ); + + if( min_rate == max_rate && min_rate == 0 ) return 0; + if( range == 0 ) return base; + if( range < 0 ) return 0; + return minnum + RAND( 0, range); +} + +typedef int (*FUNC)( const void *, const void * ); + +static int cmprutine( double *p1, double *p2) +{ + if( *p1 < *p2 ) return -1; + if( *p1 > *p2 ) return 1; + return 0; +} +/* + * мؤ + * ߯Ի ʹئ׾ + * ĩƻͻ + * table Уƻʣ + */ + +static void ITEM_simplify_atoms( struct item_ingindtable *inds, int num, + int *retinds, int *retvals, int petindex, int alchemist) +{ + //int newinds[MAX_ITEM_ATOMS_SIZE]; + //int newvals[MAX_ITEM_ATOMS_SIZE]; + int i; + double oddstable[] = { + 0.1, + 0.25, + 0.35, + 0.4, + 0.42, + 0.44, + 0.46, + 0.47, + 0.48, + 0.49, + 0.5, + 0.51, + 0.52, + 0.53 + }; + + for( i = 0; i < num; i ++ ) { + int datacnt = (inds + i)->num; + if( datacnt > 1 ) { + int j; + qsort( (inds + i)->data, datacnt, + sizeof( double ), (FUNC)cmprutine); + for( j = 1; j < datacnt; j ++ ) { + int tablenum; + double rate; + tablenum = ITEM_getTableNum( (inds + i)->data[j-1]); + rate = ItemRandTableForItem[tablenum].rate / ItemRandTableForItem[0].rate; + (inds + i)->data[j] += (inds + i)->data[j-1] * oddstable[j-1] * rate; + } + } + *(retinds + i) = ( inds + i)->index; + *(retvals + i) = (int)( inds + i)->data[ datacnt-1]; + // shan add begin + if( petindex != -1 ){ + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + if( *( retvals + i) > ITEM_ATOMIND_FM_MAX ){ + *( retvals + i) = ITEM_ATOMIND_FM_MAX; + } + }else{ + if( *( retvals + i) > ITEM_ATOMIND_MAX ){ + *( retvals + i) = ITEM_ATOMIND_MAX; + } + } + } + // shan end + } +} + +/* +PET_ADD_INGRED( nm,vl1,vl2,vl3) +{ + if( strlen( ENEMYTEMP_getChar( petarray, nm)) != 0 ) + { + fixatom[ingnum] =ITEM_getAtomIndexByName( ENEMYTEMP_getChar( petarray, nm) ); + if( fixatom[ingnum] < 0 ) + { + print( "\nfucking atom:[%s] for pet id %d", ENEMYTEMP_getChar( petarray, nm), petid ); + continue; + } + + baseup[ingnum] = ENEMYTEMP_getInt( petarray, vl1); + minadd[ingnum] = ENEMYTEMP_getInt( petarray, vl2); + maxadd[ingnum] = ENEMYTEMP_getInt( petarray, vl3); + + if( petindex != -1) + { + if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ) + { + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + if (!CHAR_CHECKINDEX(ownerindex)) + { + print("ownerindex err!\n"); + return; + } + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER) + { + print("\n Pet Ownerindex Error"); + return; + } + baseup[ingnum] = PetLv[getFmLv(ownerindex)]; + } + } + + if( minadd[ingnum] > maxadd[ingnum] ) + { + int tmp = minadd[ingnum]; + minadd[ingnum] = maxadd[ingnum];maxadd[ingnum] = tmp; + } + + if( CHAR_getInt(petid, CHAR_PETFAMILY) == 1 ) + { + if( minadd[ingnum]<0 ) + minadd[ingnum] = ITEM_FM_RANDRANGEDOM; + if( maxadd[ingnum]<0 ) + maxadd[ingnum] = ITEM_FM_RANDRANGEDOM; + } + else + { + if( minadd[ingnum]<0 ) + minadd[ingnum] = ITEM_RANDRANGEDOM; + if( maxadd[ingnum]<0 ) + maxadd[ingnum] = ITEM_RANDRANGEDOM; + } + ingnum++; + } +} +*/ + +/* + ʸIDգѼĤɬëԻʣ + + int *fixuse : ¦ѣ ëԻëľ + + int *fixatom : ټ帲Ĥئ + int *baseup : µң + int *minadd : ң µң + int *maxadd : ң µң + + */ + +static void +ITEM_merge_getPetFix( int petid, int *fixuse, int *fixatom, + int *baseup, + int *minadd, + int *maxadd, + int petindex, + int *fm_fix) +{ + int i; + int ingnum = 0; + int petarray; + +// shan begin +#define FamilyLv 11 + //int PetLv[FamilyLv]; + //for(i=0; i maxadd[ingnum] ) { int tmp = minadd[ingnum];minadd[ingnum] = maxadd[ingnum];maxadd[ingnum] = tmp;}if( CHAR_getInt(petid, CHAR_PETFAMILY) == 1 ){if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_FM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_FM_RANDRANGEDOM;}else{if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_RANDRANGEDOM;}ingnum++;} +#define PET_ADD_INGRED( nm,vl1,vl2,vl3) if( strlen( ENEMYTEMP_getChar( petarray, nm)) != 0 ) { fixatom[ingnum] =ITEM_getAtomIndexByName( ENEMYTEMP_getChar( petarray, nm) ); if( fixatom[ingnum] < 0 ){ print( "\nfucking atom:[%s] for pet id %d", ENEMYTEMP_getChar( petarray, nm), petid ); continue;} baseup[ingnum] = ENEMYTEMP_getInt( petarray, vl1); minadd[ingnum] = ITEM_RANDRANGEDOM_BASE + ENEMYTEMP_getInt( petarray, vl2); maxadd[ingnum] = ITEM_RANDRANGEDOM_BASE + ENEMYTEMP_getInt( petarray, vl3); if( petindex != -1){ if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ){ int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); if (!CHAR_CHECKINDEX(ownerindex)){print("ownerindex err!\n");return;}if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){print("\n Pet Ownerindex Error");return;}baseup[ingnum] = PetLv[getFmLv(ownerindex)];}}if( minadd[ingnum] > maxadd[ingnum] ) { int tmp = minadd[ingnum];minadd[ingnum] = maxadd[ingnum];maxadd[ingnum] = tmp;}if( CHAR_getInt(petid, CHAR_PETFAMILY) == 1 ){if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_FM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_FM_RANDRANGEDOM;}else{if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_RANDRANGEDOM;}ingnum++;} +#else +#define PET_ADD_INGRED( nm,vl1,vl2,vl3) if( strlen( ENEMYTEMP_getChar( petarray, nm)) != 0 ) { fixatom[ingnum] =ITEM_getAtomIndexByName( ENEMYTEMP_getChar( petarray, nm) ); if( fixatom[ingnum] < 0 ){ print( "\nfucking atom:[%s] for pet id %d", ENEMYTEMP_getChar( petarray, nm), petid ); continue;} baseup[ingnum] = ENEMYTEMP_getInt( petarray, vl1); minadd[ingnum] = ENEMYTEMP_getInt( petarray, vl2); maxadd[ingnum] = ENEMYTEMP_getInt( petarray, vl3); if( petindex != -1){ if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ){ int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); if (!CHAR_CHECKINDEX(ownerindex)){print("ownerindex err!\n");return;}if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != 1){print("\n Pet Ownerindex Error");return;}baseup[ingnum] = PetLv[getFmLv(ownerindex)];}}if( minadd[ingnum] > maxadd[ingnum] ) {int tmp = minadd[ingnum];minadd[ingnum] = maxadd[ingnum];maxadd[ingnum] = tmp;}if( CHAR_getInt(petid, CHAR_PETFAMILY) == 1 ){if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_FM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_FM_RANDRANGEDOM;}else{if( minadd[ingnum]<0 ) minadd[ingnum] = ITEM_RANDRANGEDOM;if( maxadd[ingnum]<0 ) maxadd[ingnum] = ITEM_RANDRANGEDOM;}ingnum++;} +#endif + + PET_ADD_INGRED( E_T_ATOMFIXNAME1, E_T_ATOMBASEADD1, E_T_ATOMFIXMIN1, E_T_ATOMFIXMAX1); + PET_ADD_INGRED( E_T_ATOMFIXNAME2, E_T_ATOMBASEADD2, E_T_ATOMFIXMIN2, E_T_ATOMFIXMAX2); + PET_ADD_INGRED( E_T_ATOMFIXNAME3, E_T_ATOMBASEADD3, E_T_ATOMFIXMIN3, E_T_ATOMFIXMAX3); + PET_ADD_INGRED( E_T_ATOMFIXNAME4, E_T_ATOMBASEADD4, E_T_ATOMFIXMIN4, E_T_ATOMFIXMAX4); + PET_ADD_INGRED( E_T_ATOMFIXNAME5, E_T_ATOMBASEADD5, E_T_ATOMFIXMIN5, E_T_ATOMFIXMAX5); + } + + if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ) { + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + if( CHAR_CHECKINDEX(ownerindex) ) { + *fm_fix = PetLv[getFmLv(ownerindex)]; + } + } + + *fixuse = ingnum; + return; +} + +/* + * ʧ ةؤFALSEë߯ + */ + +static BOOL ITEM_merge_checkitem( ITEM_Item *items, int itemsnum, int id) +{ + int loop; + for( loop = 0; loop < itemsnum; loop ++ ) { + if( items[loop].data[ITEM_ID] == id ) break; + } + if( loop == itemsnum ) return TRUE; + return FALSE; +} + +static int ITEM_merge_with_retry( ITEM_Item *items,int itemsnum, + int *ingindtable, int ingnum, + int *ingtable, int searchtable, int petindex ) +{ + + int ideal; + int idel_num[5][5] = { { 0}, + { 250,0 }, + { 400,150,0}, + { 700,260,70,0}, + { 740,500,200,40,0} + }; + int endflg[5]; + BOOL first = TRUE; + int extractcnt = 0; +#define MAXMATCH 2048 + int matchid[MAXMATCH]; + int i,j,k; + if( ingnum > 5 ) ideal = 5; + else ideal = ingnum; + memset( endflg, 0, sizeof( endflg)); + while( 1 ) { + int r = RAND( 0, 999); + int extractnum; + int match = 0; + if( extractcnt >= ideal ) break; + // ϳɵߵı + for( extractnum = 0; extractnum < ideal; extractnum ++ ) { + if( r >= idel_num[ideal-1][extractnum] ) { + break; + } + } + if( endflg[extractnum] == TRUE ) continue; + endflg[extractnum] = TRUE; + extractcnt++; + extractnum = ideal - ( extractnum ); + + if( first ) { + for( i = 0; i < icache_num; i++ ){ // ѰȫITEM + if( icache[i].use && icache[i].canmergeto) { // ǿɺϳɵITEM + icache[i].hitnum = 0; + for( j = 0; j < icache[i].inguse; j ++ ) { // ITEMIJ + for( k = 0; k < ingnum ; k ++){ // ϳɵIJ + if( icache[i].ingind[j] == ingindtable[k] ) { // Ϸ + if( searchtable == 0 ) { // ߺϳɵĻ + int tablenum = ITEM_getTableNum( ingtable[k]); // ϵȼ + // shan begin + if( petindex != -1){ + if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ){ // ػ޵Ļ + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + int familyLevel = getFmLv(ownerindex); + if (!CHAR_CHECKINDEX(ownerindex)){ + print("!\n"); + return -1; + } +#ifdef _FMVER21 + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){ +#else + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != 1){ +#endif + print("\n "); + return -1; + } + // + if( icache[i].ingval[j] <= ingtable[k]*ItemRandTableForItem[tablenum].rate && + icache[i].ingval[j] >= ingtable[k]*(1/ItemRandTableForItem[tablenum].rate) && + icache[i].ingval[j] <= ItemRandTableForItem[familyLevel+9].maxnum) { + icache[i].hitnum++; + break; + } + }else{ // ػ޵Ļ + float toplimit = ingtable[k]*ItemRandTableForItem[tablenum].rate; + if( toplimit > 1000) toplimit = 1000; + // + if( icache[i].ingval[j] <= toplimit && + icache[i].ingval[j] >= ingtable[k]*(1/ItemRandTableForItem[tablenum].rate)){ + icache[i].hitnum++; + break; + } + } + } + // shan end + }else { // ʳϳɵĻ + // shan begin + if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ){ + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + int familyLevel = getFmLv(ownerindex); + if (!CHAR_CHECKINDEX(ownerindex)){ + print("!\n"); + return -1; + } +#ifdef _FMVER21 + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){ +#else + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != 1){ +#endif + print("\n "); + return -1; + } + if( ingtable[k] > ItemRandTableForItem[familyLevel+9].maxnum / + ItemSearchTable[searchtable].searchmax ){ + ingtable[k] = ItemRandTableForItem[familyLevel+9].maxnum / + ItemSearchTable[searchtable].searchmax; + } + }else{ + if( ingtable[k] > ItemRandTableForItem[9].maxnum / + ItemSearchTable[searchtable].searchmax ){ + ingtable[k] = ItemRandTableForItem[9].maxnum / + ItemSearchTable[searchtable].searchmax; + } + } + // shan end + + if( icache[i].ingval[j] <= ingtable[k]*ItemSearchTable[searchtable].searchmax && + icache[i].ingval[j] >= ingtable[k]*ItemSearchTable[searchtable].searchmin){ + icache[i].hitnum++; + break; + } + } + } + } + } + // ϵIJͬ + if( icache[i].hitnum == icache[i].inguse && icache[i].hitnum == extractnum ){ + if( ITEM_merge_checkitem(items,itemsnum,i)) { + matchid[match++] = i; + } + } + } + } + first = FALSE; + }else { + for( i = 0; i < icache_num; i++ ){ + if( icache[i].use && icache[i].canmergeto) { + if( icache[i].hitnum == icache[i].inguse && icache[i].hitnum == extractnum ){ + if( ITEM_merge_checkitem(items,itemsnum,i)) { + matchid[match++] = i; + } + } + } + } + } + if( match > 0 ) { + return matchid[ random() % match ]; + }else { + + } + } + return -1; + +} + +#ifdef _NEW_MANOR_LAW +extern struct FM_POINTLIST fmpointlist; +#endif + +int ITEM_mergeItem( int charaindex, ITEM_Item *items, int num , int money, int petid, int searchtable, int petindex, int alchemist) +{ + int i; + // shan add + int item_type = -1; + int ingnum =0; + struct item_ingindtable ingindtable[MAX_ITEM_ATOMS_SIZE]; + int sortedingindtable[MAX_ITEM_ATOMS_SIZE]; + int sortedingtable[MAX_ITEM_ATOMS_SIZE]; + /* ʸ巽Ĥ */ + int pet_fixatom[MAX_ITEM_ATOMS_SIZE]; + int pet_baseup[MAX_ITEM_ATOMS_SIZE]; + int pet_minadd[MAX_ITEM_ATOMS_SIZE]; + int pet_maxadd[MAX_ITEM_ATOMS_SIZE]; + int pet_fixuse = MAX_ITEM_ATOMS_SIZE; + int fm_fix; + int nowtime; + + nowtime = time( NULL); + // ϳɷƵ... + if( nowtime - CHAR_getWorkInt( charaindex, CHAR_WORKLASTMERGETIME) < +#ifdef _MERGE_TIME + getMergeTime() +#else + 5 +#endif + +(num-2) ) { + CHAR_setWorkInt( charaindex, CHAR_WORKLASTMERGETIME, nowtime); + CHAR_talkToCli( charaindex, -1 ,"ϳƵϢһ±ȽϺӴ", CHAR_COLORRED); + //print(" ϳƵ "); + return items[RAND( 0, (num-1))].data[ITEM_ID]; + } + CHAR_setWorkInt( charaindex, CHAR_WORKLASTMERGETIME, nowtime); + for( i = 0; i < arraysizeof( ingindtable); i ++ ) { + int j; + for( j = 0; j < MAX_ITEM_ATOMS_SIZE; j ++ ) { + ingindtable[i].data[j] = 0.0; + } + ingindtable[i].num = 0; + ingindtable[i].index = -1; + } + for(i=0; i ItemRandTableForItem[familyLevel+9].maxnum ){ + sortedingtable[i] = RAND(ItemRandTableForItem[familyLevel+9].minnum, + ItemRandTableForItem[familyLevel+9].maxnum); + } + }else{ + sortedingtable[i] = ITEM_randRange( sortedingtable[i], + ItemRandTable[searchtable].randmin , + ItemRandTable[searchtable].randmax); + } + } + else{ + if( searchtable == 0 ) { + sortedingtable[i] = ITEM_randRange( sortedingtable[i], + ((1/ItemRandTableForItem[tablenum].rate)*ITEM_MERGE_RANGEWIDTH_FORMIN) + * ITEM_RANDRANGEDOM, + ItemRandTableForItem[tablenum].rate * ITEM_MERGE_RANGEWIDTH_FORMAX + * ITEM_RANDRANGEDOM); + if(sortedingtable[i] > 905) sortedingtable[i] = 905; + } + else { + sortedingtable[i] = ITEM_randRange( sortedingtable[i], + ItemRandTable[searchtable].randmin , + ItemRandTable[searchtable].randmax); + } + } + } + // shan end + } + } + + if( ingnum == 0 ) + return -1; + { + int created; + for( i = 0 ; i < 5; i++ ) { + created = ITEM_merge_with_retry( items, num, sortedingindtable,ingnum, + sortedingtable, searchtable, petindex); + if( created >= 0 ) { + // shan begin + if( petindex != -1){ +#ifdef _FMVER21 +#else + if( CHAR_getInt( CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX), CHAR_FMLEADERFLAG ) > 0 ){ +#endif + int kind_num = 0; + int syndp = 0; + int fooddp = 0; + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + if (!CHAR_CHECKINDEX(ownerindex)){ + print("ownerindex err!\n"); + return -1; + } + if( searchtable == 1 ){ + + if( ITEMTBL_getInt( created, ITEM_INGVALUE0) != 0 ) kind_num++; + if( ITEMTBL_getInt( created, ITEM_INGVALUE1) != 0 ) kind_num++; + if( ITEMTBL_getInt( created, ITEM_INGVALUE2) != 0 ) kind_num++; + if( ITEMTBL_getInt( created, ITEM_INGVALUE3) != 0 ) kind_num++; + if( ITEMTBL_getInt( created, ITEM_INGVALUE4) != 0 ) kind_num++; + + fooddp = ITEMTBL_getInt( created, ITEM_INGVALUE0) + + ITEMTBL_getInt( created, ITEM_INGVALUE1) + + ITEMTBL_getInt( created, ITEM_INGVALUE2) + + ITEMTBL_getInt( created, ITEM_INGVALUE3) + + ITEMTBL_getInt( created, ITEM_INGVALUE4); +#ifndef _NEW_MANOR_LAW + #ifdef _PERSONAL_FAME // Arminius: + fooddp = sqrt(fooddp) * pow(2,kind_num-2) * RAND(0,6) / 200; + #else + fooddp = sqrt(fooddp) * pow(2,kind_num-2) * RAND(0,6) / 100; + #endif + print("FoodDP: num->%d sumdp->%d", kind_num, fooddp); + sprintf(buf, "%d", fooddp); + + #ifdef _PERSONAL_FAME // Arminius 8.30: + CHAR_earnFame(ownerindex, fooddp); + #endif + + #ifdef _FMVER21 + if( CHAR_getInt( CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX), CHAR_FMLEADERFLAG ) > 0 && + CHAR_getInt( CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX), CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY ) + { + // CoolFish: 2001/10/03 + int fd = getfdFromCharaIndex(ownerindex); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(ownerindex, CHAR_FMNAME), + CHAR_getInt(ownerindex, CHAR_FMINDEX), + CHAR_getWorkInt(ownerindex, CHAR_WORKFMINDEXI), + FM_FIX_FMDEALFOOD, buf, "", + // CoolFish: 2001/10/03 + CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + // CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), 0); + } + #else + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(ownerindex, CHAR_FMNAME), + CHAR_getInt(ownerindex, CHAR_FMINDEX), + CHAR_getWorkInt(ownerindex, CHAR_WORKFMINDEXI), + FM_FIX_FMDEALFOOD, buf, "", + CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), 0); + #endif +#endif + }else{ + syndp = ITEMTBL_getInt( created, ITEM_INGVALUE0) + + ITEMTBL_getInt( created, ITEM_INGVALUE1) + + ITEMTBL_getInt( created, ITEM_INGVALUE2) + + ITEMTBL_getInt( created, ITEM_INGVALUE3) + + ITEMTBL_getInt( created, ITEM_INGVALUE4); +#ifndef _NEW_MANOR_LAW + #ifdef _PERSONAL_FAME // Arminius: + syndp = syndp / 200; + #else + syndp = syndp / 100; + #endif + sprintf(buf, "%d", syndp); + + #ifdef _PERSONAL_FAME // Arminius 8.30: + CHAR_earnFame(ownerindex, syndp); + #endif + + #ifdef _FMVER21 + if( CHAR_getInt( CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX), CHAR_FMLEADERFLAG ) > 0 && + CHAR_getInt( CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX), CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY ) + { + // CoolFish: 2001/10/03 + int fd = getfdFromCharaIndex(ownerindex); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(ownerindex, CHAR_FMNAME), + CHAR_getInt(ownerindex, CHAR_FMINDEX), + CHAR_getWorkInt(ownerindex, CHAR_WORKFMINDEXI), + FM_FIX_FMSYNTHESIZE, buf, "", + // CoolFish: 2001/10/03 + CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + } + #else + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(ownerindex, CHAR_FMNAME), + CHAR_getInt(ownerindex, CHAR_FMINDEX), + CHAR_getWorkInt(ownerindex, CHAR_WORKFMINDEXI), + FM_FIX_FMSYNTHESIZE, buf, "", + CHAR_getWorkInt(ownerindex, CHAR_WORKFMCHARINDEX), 0); + #endif +#endif + } +#ifdef _FMVER21 +#else + } +#endif + } + return created; + } + } + return items[RAND( 0, (num-1))].data[ITEM_ID]; + } + return -3; +} + +int ITEM_canDigest( ITEM_Item *itm ) +{ + /* 1 󡻥ɬýľ1 + ƥئئ0 */ + if( itm->string[ITEM_INGNAME0].string[0] ) return 1; else return 0; +} + + + +int ITEM_merge_test(void) +{ + int iid,i,k; + ITEM_Item itm[1]; + + for( k = 0 ; k < 10 ; k ++ ){ + iid = 1; + for( i = 0 ; i < 20 ; i ++ ){ + ITEM_makeItem( &itm[0] , iid ); + print( "%d RETURN: %d\n", i, + // shan + iid = ITEM_mergeItem( -1, itm, 1 , 0, -1,0,-1,0) ); + } + print( "------\n" ); + } + return 0; +} + +int ITEM_mergeItem_merge( int charaindex, int petid, char *data, int petindex, int alchemist) +{ + BOOL result = FALSE; + int i; + int ret; + int cnt = 0; + int itemindexs[CHAR_MAXITEMHAVE - CHAR_STARTITEMARRAY]; + int haveitemindexs[CHAR_MAXITEMHAVE - CHAR_STARTITEMARRAY]; + // Nuke +2 1026: Avoid merge cheat + int itemflag[CHAR_MAXITEMHAVE - CHAR_STARTITEMARRAY]; + int j,collision=0; + + char buff[64]; + + ITEM_Item items[CHAR_MAXITEMHAVE - CHAR_STARTITEMARRAY]; + // Nuke +1 1026 + memset(itemflag,0,sizeof(itemflag)); + + { + int emptyindex = CHAR_findEmptyItemBox( charaindex ); + if( emptyindex == -1 ){ + CHAR_talkToCli( charaindex, -1, "ϳʱһƷλ", CHAR_COLORYELLOW); + return -1; + } + } + + for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) { + int haveitemindex; + ret = getStringFromIndexWithDelim( data , "|", + i - CHAR_STARTITEMARRAY+1, + buff, sizeof( buff ) ); + if( ret == FALSE ) break; + haveitemindex = atoi( buff); + if( CHAR_CHECKITEMINDEX( charaindex, haveitemindex) ) { + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( ITEM_CHECKINDEX( itemindex)) { + if(ITEM_getInt(itemindex,ITEM_TIME)>0){ + CHAR_talkToCli( charaindex, -1, "ʱ޷ϳɻ", CHAR_COLORYELLOW); + return FALSE; + } +#ifdef _ITEM_INSLAY + char *code; + if( (code = ITEM_getChar( itemindex, ITEM_TYPECODE)) == "\0" ) { + if( strcmp( code, "\0") ) { + char token[256]; + snprintf( token, sizeof( token), "ƺ%sûȤ", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + if( ITEM_getmergeItemFromFromITEMtabl( ITEM_getInt( itemindex, ITEM_ID)) == TRUE ){ //Ƿɺϳ + ITEM_Item *itm; + itm = ITEM_getItemPointer(itemindex); + if( itm != NULL ) { + ITEM_makeItem( &items[cnt], ITEM_getInt( itemindex, ITEM_ID)); + itemindexs[cnt] = itemindex; + haveitemindexs[cnt] = haveitemindex; + // Nuke start 1026 + for (j=0;j 1 ) { + int randtable = 0; + if( items[0].data[ITEM_TYPE] == ITEM_DISH ) { + randtable = 1; + } + ret = ITEM_mergeItem( charaindex, items, cnt, 0, petid, randtable, petindex, alchemist); + if( ret == -10) + CHAR_talkToCli( charaindex, -1, "Ƿĺϳɷ", CHAR_COLORWHITE); + CHAR_setInt( charaindex, CHAR_MERGEITEMCOUNT, + CHAR_getInt( charaindex, CHAR_MERGEITEMCOUNT)+1); + for( i = 0; i < cnt; i ++ ) { +#ifdef _ITEM_PILENUMS + int pilenum=0; + int itemindex = CHAR_getItemIndex( charaindex, haveitemindexs[i]); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + pilenum -= 1; + ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum); + if( pilenum <= 0 ){ +#endif + CHAR_setItemIndex( charaindex, haveitemindexs[i], -1); + CHAR_sendItemDataOne( charaindex, haveitemindexs[i]); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindexs[i], +#else + ITEM_getInt( itemindexs[i], ITEM_ID), /* ʧ ة į */ +#endif + "mergedel(ϳɾĵ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindexs[i], ITEM_UNIQUECODE), + ITEM_getChar( itemindexs[i], ITEM_NAME), + ITEM_getInt( itemindexs[i], ITEM_ID) + ); + ITEM_endExistItemsOne( itemindexs[i]); +#ifdef _ITEM_PILENUMS + } +#endif + } + CHAR_sendItemData( charaindex, haveitemindexs, cnt); + if( ret >= 0 ) { + int rc; + int createitemindex = ITEM_makeItemAndRegist( ret); + // shan begin + if( createitemindex != -1 ){ + if( petindex != -1){ +#ifdef _FM_LIAOLI + if(getFmLiaoLiType()==1 || CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ +#else + if( CHAR_getInt(petindex, CHAR_PETFAMILY) == 1 ){ +#endif + int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + if (!CHAR_CHECKINDEX(ownerindex)){ + print("ownerindex err!\n"); + return -1; + } +#ifdef _FM_LIAOLI + if(getFmLiaoLiType()!=1 && CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){ +#else +#ifdef _FMVER21 + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != FMMEMBER_LEADER){ +#else + if( CHAR_getInt( ownerindex, CHAR_FMLEADERFLAG) != 1){ +#endif +#endif + print("\n Pet Ownerindex Error"); + return -1; + } + if( randtable == 1){ + char *p; + char charbuf1[512]="",charbuf2[1024]="",charbuf[128]=""; + char argbuf[256]; + int arg1 = 0, arg2 = 0; + if( ITEM_getInt( createitemindex, ITEM_TYPE) == 20){ + if( (p = strstr( ITEM_getChar(createitemindex, ITEM_ARGUMENT), "")) ){ + strcpy( argbuf, (p+2)); + arg1 = atoi(argbuf); + arg1 = arg1 * FOOD_MP_RATE / 100; + } + if( (p = strstr( ITEM_getChar(createitemindex, ITEM_ARGUMENT), "")) ){ + strcpy( argbuf, (p+2)); + arg2 = atoi(argbuf); + arg2 = arg2 * FOOD_HP_RATE / 100; + } + if( arg1 != 0 && arg2 != 0 ){ + sprintf( charbuf1, "%d%d", arg1, arg2); + } + else if( arg1 != 0){ + sprintf( charbuf1, "%d", arg1); + } + else if( arg2 != 0){ + sprintf( charbuf1, "%d", arg2); + } + if(arg1!=0 || arg2!=0){ +#ifdef _FM_LIAOLI + sprintf( charbuf, "(Ч)"); +#else + sprintf( charbuf, "()"); +#endif + strcpy( charbuf2, ITEM_getChar( createitemindex, ITEM_EFFECTSTRING)); + strncat( charbuf2, charbuf, 10); + ITEM_setChar( createitemindex, ITEM_ARGUMENT, charbuf1); + ITEM_setChar( createitemindex, ITEM_EFFECTSTRING, charbuf2); + } + } + } + } + } + } + // shan end + ITEM_setInt( createitemindex, ITEM_MERGEFLG, TRUE); + if( createitemindex != -1 ) { + rc = CHAR_addItemSpecificItemIndex( charaindex, createitemindex); + if( rc >= 0 && rc < CHAR_MAXITEMHAVE) { + CHAR_sendItemDataOne( charaindex, rc); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + createitemindex, +#else + ITEM_getInt( createitemindex, ITEM_ID), +#endif + "mergeadd(ϳɳĵ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( createitemindex, ITEM_UNIQUECODE), + ITEM_getChar( createitemindex, ITEM_NAME), + ITEM_getInt( createitemindex, ITEM_ID) + ); + result = TRUE; + } + else { + ITEM_endExistItemsOne( createitemindex); + } + } + } + } + return result; +} + +static int ITEM_getTableNum( int num) +{ + int i; + for( i = 0; i < arraysizeof( ItemRandTableForItem); i ++) { + if( num <= ItemRandTableForItem[i].maxnum ) { + break; + } + } + if( i == arraysizeof( ItemRandTableForItem)) i--; + return i; +} + +#ifdef _ITEM_INSLAY +int PETSKILL_ITEM_inslay( int charindex, int inslayindex, int itemindex) +{ + char *inslaystr , *code=NULL; + char codeTemp[][32]={ "NULL", "NULL", "NULL"}; + char codeTemp1[][32]={ "NULL", "NULL", "NULL", "NULL"}; + char codeTemp2[][32]={ "NULL", "NULL", "NULL", "NULL", "NULL"}; + char buf1[256], buf2[256]; + char TypeName[][256]={ + "", "", "", "HP", "MP", "", "", "", "ħID" + }; + int worktyp[] = { + ITEM_MODIFYATTACK, ITEM_MODIFYDEFENCE, ITEM_MODIFYQUICK, + ITEM_MODIFYHP, ITEM_MODIFYMP, ITEM_MODIFYLUCK, + ITEM_OTHERDAMAGE, ITEM_OTHERDEFC, ITEM_MAGICID + }; + int worknum[ arraysizeof(worktyp)]; + + int i; +#ifdef _DIY_INSLAY +int MAXCANINSLAY=getInslayNum(); +#else +int MAXCANINSLAY=3; +#endif + + memset( worknum, 0, sizeof( worknum)); + if( !CHAR_CHECKINDEX( charindex) ) return FALSE; + if( !ITEM_CHECKINDEX( inslayindex) ) return FALSE; + if( !ITEM_CHECKINDEX( itemindex) ) return FALSE; + if( itemindex == inslayindex ) return FALSE; + if( ITEM_getInt(itemindex,ITEM_TIME)>0 || ITEM_getInt(inslayindex,ITEM_TIME)>0){ + CHAR_talkToCli( charindex, -1, "ʱ޷ϳɻ", CHAR_COLORYELLOW); + return FALSE; + } + if( (code = ITEM_getChar( itemindex, ITEM_TYPECODE)) == "\0" ) { + print(" ITEM_TYPECODE == NULL error !!\n"); + return FALSE; + } + if( !strcmp( code, "NULL" ) ) return FALSE; + if( (inslaystr = ITEM_getChar( inslayindex, ITEM_INLAYCODE)) == "\0" ) { + print(" ITEM_INLAYCODE == NULL error !!\n"); + return FALSE; + } + + for( i = 0; i < MAXCANINSLAY; i ++ ) { + if( getStringFromIndexWithDelim( inslaystr , "|", i+1, buf1, sizeof( buf1 ) ) == TRUE ){ + if( strcmp( buf1, "\0")){ + if(MAXCANINSLAY == 4){ + sprintf( codeTemp1[i], "%s", buf1); + }else if(MAXCANINSLAY == 5){ + sprintf( codeTemp2[i], "%s", buf1); + }else{ + sprintf( codeTemp[i], "%s", buf1); + } + } + continue; + } + break; + } + + for( i = 0; i < MAXCANINSLAY; i ++ ) { + if(MAXCANINSLAY == 4){ + if( strcmp( codeTemp1[i], "NULL") ) continue; + sprintf( codeTemp1[i], "%s", code); + break; + }else if(MAXCANINSLAY == 5){ + if( strcmp( codeTemp2[i], "NULL") ) continue; + sprintf( codeTemp2[i], "%s", code); + break; + }else{ + if( strcmp( codeTemp[i], "NULL") ) continue; + sprintf( codeTemp[i], "%s", code); + break; + } + } + if( i == MAXCANINSLAY ) { + CHAR_talkToCli( charindex, -1, "Ѿˡ", CHAR_COLORYELLOW); + return FALSE; + } + memset( buf2, 0, sizeof( buf2)); + if(MAXCANINSLAY==4){ + sprintf( buf2, "%s|%s|%s|%s", codeTemp1[0], codeTemp1[1], codeTemp1[2], codeTemp1[3]); + }else if(MAXCANINSLAY==5){ + sprintf( buf2, "%s|%s|%s|%s|%s", codeTemp2[0], codeTemp2[1], codeTemp2[2], codeTemp2[3], codeTemp2[4]); + }else{ + sprintf( buf2, "%s|%s|%s", codeTemp[0], codeTemp[1], codeTemp[2]); + } +// sprintf( buf2, "%s|%s|%s", codeTemp[0], codeTemp[1], codeTemp[2]); +// print("buf2:%s\n", buf2); + ITEM_setChar( inslayindex, ITEM_INLAYCODE, buf2); + + for( i=0; i 0 ) { //ħ ID + int magicid,mp; + magicid = ITEM_getInt( itemindex, ITEM_MAGICID); + ITEM_setInt( inslayindex, ITEM_MAGICID, magicid); + mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP ); + ITEM_setInt( inslayindex, ITEM_MAGICUSEMP, mp); + } + for( i=ITEM_FIRSTFUNCTION; i 0 ) { //ȡħ + int marray = MAGIC_getMagicArray( ITEM_getInt( inslayindex, ITEM_MAGICID)); + if( marray != -1 ){ + if( (magicname = MAGIC_getChar( marray, MAGIC_NAME)) != NULL ){ + sprintf( Mname, "%s", magicname); + } + } + ITEM_setInt( inslayindex, ITEM_MAGICID, ITEM_getInt( inslayindex, ITEM_MAGICID)); + } + sprintf( secretname, "%s%s%d %s%s%d %s%s%d %s%s%d %s%s%d %s%s%d %s%s%d %s", + TypeName[0],(worknum[0]>=0)?"+":"",worknum[0], + TypeName[1],(worknum[1]>=0)?"+":"",worknum[1], + TypeName[2],(worknum[2]>=0)?"+":"",worknum[2], + TypeName[3],(worknum[3]>=0)?"+":"",worknum[3], + TypeName[4],(worknum[4]>=0)?"+":"",worknum[4], + TypeName[6],(worknum[6]>=0)?"+":"",worknum[6], + TypeName[7],(worknum[7]>=0)?"+":"",worknum[7], Mname); + ITEM_setChar( inslayindex, ITEM_EFFECTSTRING, secretname); + } + + return TRUE; +} + +#endif + +#ifdef _PETSKILL_FIXITEM +int PETSKILL_ITEM_FixItem( int charindex, int fixindex, int *itemindex) +{ + int index, i; + char *buf2; + int crushes, maxcrushes; +#define MAXFIXNUM 2 + index = 0; + for( i=0; i= 5 ){ +#ifdef _ITEM_FIXALLBASE + char *ITEM_ARG = ITEM_getChar( index, ITEM_ARGUMENT); + if( ITEM_ARG != "\0" && !strcmp( ITEM_ARG, "FIXITEMALL") ){ + }else{ +#endif + CHAR_talkToCli( charindex, -1, "ϲ", CHAR_COLORYELLOW); + return FALSE; +#ifdef _ITEM_FIXALLBASE + } +#endif + } + + crushes = ITEM_getInt( fixindex, ITEM_DAMAGECRUSHE); + maxcrushes = ITEM_getInt( fixindex, ITEM_MAXDAMAGECRUSHE); + if( crushes >= (maxcrushes*0.80) ) { + char buff[256]; + sprintf( buff, "%sû𻵵Ҫ޸", ITEM_getChar( fixindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1, buff, CHAR_COLORYELLOW); + return FALSE; + }else { + char *buf1; + if( maxcrushes < 500 ){ + CHAR_talkToCli( charindex, -1, "ƷѲ޸", CHAR_COLORYELLOW); + return FALSE; + } + if( crushes <= 0 ) return FALSE; + maxcrushes = maxcrushes*0.85; + crushes = maxcrushes; + ITEM_setInt( fixindex, ITEM_DAMAGECRUSHE, crushes); + ITEM_setInt( fixindex, ITEM_MAXDAMAGECRUSHE, maxcrushes); + // + buf1 = ITEM_getChar( fixindex, ITEM_SECRETNAME); + if( strstr( buf1, "(") != 0 ) { + char buf5[256]; + if( getStringFromIndexWithDelim( buf1,"(",1, buf5, sizeof( buf5)) != FALSE ) { + sprintf( buf1, buf5); + } + } + ITEM_setChar( fixindex, ITEM_SECRETNAME, buf1); + ITEM_setInt( fixindex, ITEM_CRUSHLEVEL, 0); + } + return TRUE; +} +#endif + + + diff --git a/item/item_trade.c b/item/item_trade.c new file mode 100644 index 0000000..e69de29 diff --git a/item/makefile b/item/makefile new file mode 100644 index 0000000..16e2669 --- /dev/null +++ b/item/makefile @@ -0,0 +1,216 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libitem.a + +SRC=item.c item_event.c item_gen.c item_trade.c item_contract.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +item.o: item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/battle.h ../include/item.h \ + ../include/buf.h ../include/function.h ../include/magic_base.h \ + ../include/profession_skill.h +item_event.o: item_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/configfile.h \ + ../include/item.h ../include/item_event.h ../include/object.h \ + ../include/anim_tbl.h ../include/magic.h ../include/handletime.h \ + ../include/log.h ../include/util.h ../include/encount.h \ + ../include/battle.h ../include/battle_item.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/net.h ../include/pet.h \ + ../include/npcutil.h ../include/enemy.h ../include/battle_magic.h \ + ../include/pet_skill.h ../include/npc_freepetskillshop.h \ + ../include/mylua/function.h ../include/profession_skill.h \ + ../include/sasql.h ../include/npc_lua.h ../include/npc_lua_interface.h \ + ../include/../lua/lua.h ../include/../lua/lauxlib.h \ + /usr/include/assert.h ../include/npc_lua_interface.h +item_gen.o: item_gen.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + ../include/configfile.h ../include/common.h ../include/util.h \ + ../include/buf.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/item.h ../include/item_gen.h ../include/enemy.h \ + ../include/log.h ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/family.h ../include/magic_base.h +item_trade.o: item_trade.c +item_contract.o: item_contract.c diff --git a/item/makefile.bak b/item/makefile.bak new file mode 100644 index 0000000..16e2669 --- /dev/null +++ b/item/makefile.bak @@ -0,0 +1,216 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libitem.a + +SRC=item.c item_event.c item_gen.c item_trade.c item_contract.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +item.o: item.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/battle.h ../include/item.h \ + ../include/buf.h ../include/function.h ../include/magic_base.h \ + ../include/profession_skill.h +item_event.o: item_event.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/common.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/configfile.h \ + ../include/item.h ../include/item_event.h ../include/object.h \ + ../include/anim_tbl.h ../include/magic.h ../include/handletime.h \ + ../include/log.h ../include/util.h ../include/encount.h \ + ../include/battle.h ../include/battle_item.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/net.h ../include/pet.h \ + ../include/npcutil.h ../include/enemy.h ../include/battle_magic.h \ + ../include/pet_skill.h ../include/npc_freepetskillshop.h \ + ../include/mylua/function.h ../include/profession_skill.h \ + ../include/sasql.h ../include/npc_lua.h ../include/npc_lua_interface.h \ + ../include/../lua/lua.h ../include/../lua/lauxlib.h \ + /usr/include/assert.h ../include/npc_lua_interface.h +item_gen.o: item_gen.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + ../include/configfile.h ../include/common.h ../include/util.h \ + ../include/buf.h ../include/char.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/item.h ../include/item_gen.h ../include/enemy.h \ + ../include/log.h ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/family.h ../include/magic_base.h +item_trade.o: item_trade.c +item_contract.o: item_contract.c diff --git a/link.c b/link.c new file mode 100644 index 0000000..8bd2066 --- /dev/null +++ b/link.c @@ -0,0 +1,135 @@ +#include +#include "version.h" +#include "link.h" +#include "buf.h" + +/* + * ¦ + * top á + * ߯Ի + */ +BOOL Nodeappendtail( Node** top , Node* add ) +{ + Node* c; /**/ + Node* next; /*ޥá*/ + + /*NULL*/ + if( *top == NULL ){ + *top = allocateMemory( sizeof( Node ) ); + if( *top== NULL ) return FALSE; + (*top)->next = NULL; /*巴 */ + (*top)->size = add->size; /*Ӯ綰*/ + (*top)->val = add->val; /*̼*/ + return TRUE; + } + + for( c = *top ; c->next ; c = c->next ); /* c ë */ + next = allocateMemory( sizeof(Node) ); + if( next == NULL )return FALSE; + c->next = next; /* nextëɬ */ + next->next = NULL; /*巴 */ + next->val = add->val; /*̼*/ + next->size = add->size; /*Ӯ綰*/ + return TRUE; +} + + + + +/* + * ͼ年 + * ¦ + * top á + * ߯Ի + */ +BOOL Nodeappendhead( Node** nowtop , Node* add ) +{ + Node* newtop; /*ޥ */ + + /*NULL*/ + if( *nowtop == NULL ){ + *nowtop = allocateMemory( sizeof( Node ) ); + if( *nowtop == NULL ) return FALSE; + (*nowtop)->next = NULL; /*巴 */ + (*nowtop)->size = add->size; /*Ӯ綰*/ + (*nowtop)->val = add->val; /*̼*/ + return TRUE; + } + + /* + * ޥáë + */ + newtop = allocateMemory( sizeof(Node) ); + newtop->next = *nowtop; + newtop->val = add->val; + newtop->size = add->size; + *nowtop = newtop; + return TRUE; +} + + + + +/* + * ¦ + * ret Իá + * ߯Ի + */ +BOOL Noderemovehead( Node** top , Node* ret) +{ + Node* newtop; /*ޥ ئá*/ + + if( *top == NULL )return FALSE; + + ret->val = (*top)->val; + ret->size = (*top)->size; + newtop = (*top)->next; + freeMemory( *top ); + *top = newtop; + + return TRUE; +} + + + + + +/* + * ¦ + * ret Իá + * ߯Ի + */ +BOOL Noderemovetail( Node** top , Node* ret) +{ + Node* c; /**/ + Node* c1; /* йƥ c->nextë϶*/ + + if( *top == NULL )return FALSE; + + c = *top; /*ɬ*/ + c1 = c->next; /*ɬ*/ + while(1){ + if( c1->next == NULL ) + /* + * ƥ c1 + * | + * | next |---->+------+ + * |------| | next |---->NULL + * | | +------+ + * +------+ | | + * +------+ + *ئȻ + */ + break; + c=c->next; + c1=c->next; + } + c->next = NULL; /*c1ؤּë¼ƥnextNULL*/ + /**/ + ret->val = c1->val; + ret->size = c1->size; + + freeMemory( c1 ); + + return TRUE; +} diff --git a/log.c b/log.c new file mode 100644 index 0000000..858ab62 --- /dev/null +++ b/log.c @@ -0,0 +1,942 @@ +#include "version.h" +#include +#include +#include +#include + +#include "common.h" +#include "util.h" +#include "log.h" +#include "handletime.h" +#include "net.h" +#include "char_base.h" + +/* + * + * ƥئּ̤ļ̫fopen(..,"w") + * by ringo + */ + +struct tagLogconf{ + char* label; + char* entry; + char filename[256]; + FILE* f; + BOOL append; /* append ¾̤ļ̫SEEK_SET¾ */ +}LogConf[LOG_TYPE_NUM]={ + { "TALK: ", "talklog" ,"", NULL , TRUE}, + { "PROC: ", "proc" , "" , NULL , FALSE}, + { "ITEM: ", "itemlog" ,"", NULL , TRUE}, + { "STONE: ", "stonelog" ,"", NULL , TRUE}, + { "PET: ", "petlog" ,"", NULL , TRUE}, + { "TENSEI: ", "tenseilog" ,"", NULL , TRUE}, + { "KILL: ", "killlog","",NULL,TRUE}, + // CoolFish: 2001/4/19 + { "TRADE: ", "tradelog", "", NULL, TRUE}, + // Arminius: 2001/6/14 + { "HACK: ", "hacklog", "", NULL, TRUE}, + // Nuke: 0626 Speed + { "SPEED: ", "speedlog", "", NULL, TRUE}, + // CoolFish: FMPopular 2001/9/12 + { "FMPOP: ", "fmpoplog", "", NULL, TRUE}, + // Robin 10/02 + { "FAMILY: ", "familylog", "", NULL, TRUE}, + // Shan 11/02 + { "GM: ", "gmlog", "", NULL, TRUE}, + +#ifdef _GAMBLE_ROULETTE + { "", "gamblelog", "", NULL, TRUE}, +#endif + { "LOGIN: ", "loginlog", "", NULL, TRUE}, + { "", "pettranslog", "", NULL, TRUE}, +//Syu ׯ԰սʤLog + { "FMPKRESULT: ", "fmpkresultlog" ,"", NULL , TRUE}, + +// Syu ADD дȡLog () + { "BANKSTONELOG: ", "bankstonelog" ,"", NULL , TRUE}, + + { "ACMESSAGE: ", "acmessagelog" ,"", NULL , TRUE}, + { "PKCONTEND:", "pkcontendlog", "", NULL, TRUE}, +#ifdef _STREET_VENDOR + { "STREETVENDOR: ", "StreetVendorlog" ,"", NULL , TRUE}, +#endif +#ifdef _ANGEL_SUMMON + { "ANGEL: ", "angellog" ,"", NULL , TRUE}, +#endif +#ifdef _NEW_MANOR_LAW + { "FMPKGETMONEY: ","FMPKGetMoneylog","",NULL,TRUE}, + { "FMFAMESHOP: ","FMFameShoplog","",NULL,TRUE}, +#endif + + { "LOGOUT: ", "logoutlog", "", NULL, TRUE}, +}; + +tagWarplog warplog[MAXMAPNUM]; +tagWarpCount warpCount[MAXMAPLINK]; + +/*------------------------------------------------------------ + * ¦ + * ߯Ի + ------------------------------------------------------------*/ +static BOOL readLogConfFile( char* filename ) +{ + FILE* f; + char line[256]; + char basedir[256]; + int linenum=0; + + { + char* r; + r = rindex( filename, '/' ); + if( r == NULL )snprintf(basedir,sizeof(basedir),"." ); + else{ + memcpy( basedir,filename,r-filename ); + basedir[r-filename] = '\0'; + } + } + + f = fopen( filename , "r"); + if( f == NULL ){ + print( "Can't open %s\n" , filename ); + return FALSE; + } + while( fgets( line, sizeof( line ) ,f ) ){ + char firstToken[256]; + int i; + BOOL ret; + + linenum++; + deleteWhiteSpace(line); /* remove whitespace */ + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); /* remove tail newline */ + ret = getStringFromIndexWithDelim( line , "=", 1, firstToken, sizeof(firstToken) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + for( i=0 ; i= LOG_TYPE_NUM )return; + if( LogConf[logtype].append ){ + if( !LogConf[logtype].f )return; + fputs( LogConf[logtype].label, LogConf[logtype].f); + va_start(arg,format); + vfprintf( LogConf[logtype].f,format,arg ); + va_end( arg ); + fputc( '\n', LogConf[logtype].f ); + } else { + FILE *f = fopen( LogConf[logtype].filename ,"w" ); + if( !f ) return; + fputs(LogConf[logtype].label , f ); + va_start(arg,format); + vfprintf( f , format,arg); + va_end(arg); + fputc( '\n' , f); + fclose(f); + } +} + +BOOL initLog( char* filename ) +{ + if( readLogConfFile( filename ) == FALSE )return FALSE; + openAllLogFile(); + return TRUE; +} + +//Syu ׯ԰սʤLog +void Logfmpk( + char *winner, int winnerindex, int num1, + char *loser, int loserindex, int num2, + char *date, char *buf1, char *buf2, int flg) +{ + switch( flg){ + case 1: + { + struct tm tm1; + char buf[256]; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + sprintf( buf, " (%d:%d)", tm1.tm_hour, tm1.tm_min); + printl( LOG_FMPKRESULT, "\nFMPK: [%s]ص:%s %s(%d) ԼսҪ %s(%d) time:%s", + buf1, buf2, + winner, winnerindex, loser, loserindex, buf); + } + break; + case 2: + printl( LOG_FMPKRESULT, "\nFMPK: Winner %s(%d)=>%d Loser %s(%d)=>%d time:%s", + winner, winnerindex, num1, + loser, loserindex, num2 ,date); + break; + } +} + +void Logfmpk_war(int dueltime,int mytime){ + printl( LOG_FMPKRESULT, "\nFMPK_WAR: dueltime=%d,mytime=%d", + dueltime,mytime); +} + +#ifdef _NEW_MANOR_LAW +void LogFMPKGetMomey(char *szFMName,char *szID,char *szCharName,int iMomentum,int iGetMoney,int iDest) +{ + struct tm tm1; + char szDest[3][6] = {"","",""}; + + if(iDest < 0 || iDest > 1) iDest = 2; + memcpy(&tm1,localtime((time_t*)&NowTime.tv_sec),sizeof(tm1)); + printl(LOG_FMPK_GETMONEY,"FMName:%s\tID:%s\tName:%s\tMomentum:%d\tGetMoney:%d\tAddTo:%s\t(%d:%d)", + szFMName,szID,szCharName,iMomentum,iGetMoney,szDest[iDest],tm1.tm_hour,tm1.tm_min); +} + +void LogFMFameShop(char *szFMName,char *szID,char *szCharName,int iFame,int iCostFame) +{ + struct tm tm1; + + memcpy(&tm1,localtime((time_t*)&NowTime.tv_sec),sizeof(tm1)); + printl(LOG_FM_FAME_SHOP,"FMName:%s\tID:%s\tName:%s\tFame:%d\tCostFame:%d\t(%d:%d)", + szFMName,szID,szCharName,iFame,iCostFame,tm1.tm_hour,tm1.tm_min); +} +#endif + +void LogAcMess( int fd, char *type, char *mess ) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + if( strstr( mess, "Broadcast") != NULL ) return; + printl( LOG_ACMESS, "%d %s [%s] (%d:%d)" , fd, type, mess, tm1.tm_hour, tm1.tm_min); +} + +void LogItem( + char *CharName, /* ƽҷ */ + char *CharID, /* ƽҷID */ + int ItemNo, /* ʧ ة į */ + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + char *uniquecode, // shan 2001/12/14 + char *itemname, int itemID +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + printl( LOG_ITEM, "%s\t%s\t%d(%s)=%s,(%d,%d,%d)(%d:%d),%s" , CharName, CharID, + itemID, itemname, + Key, floor, x, y, tm1.tm_hour, tm1.tm_min, uniquecode ); + + +} +void LogPkContend( char *teamname1, char *teamname2, + int floor, + int x, + int y, + int flg +) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + if( flg == 0 ) { + printl( LOG_PKCONTEND, "[%32s ʤ %32s],(%5d,%4d,%4d)(%d:%d)" , + teamname1, teamname2, + floor, x, y, tm1.tm_hour, tm1.tm_min); + }else{ + printl( LOG_PKCONTEND, "Msg:[%s],(%5d,%4d,%4d)(%d:%d)" , + teamname1, floor, x, y, tm1.tm_hour, tm1.tm_min); + } + +} + +void LogPetTrans( + char *cdkey, char *uniwuecde, char *uniwuecde2, + char *CharName, int floor, int x, int y, + int petID1, char *PetName1, int petLV, int petrank, int vital1, int str1, int tgh1, int dex1, int total1, + int petID2, char *PetName2, int vital2, int str2, int tgh2, int dex2, int total2, + int work0, int work1, int work2, int work3, int ans, int trans + ){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( PETTRANS, "\n*PETTRANS cdkey=%s unid=%s munid=%s %s (%d:%d) %d=%s LV:%d rand:%d trans:%d :[ %d, %d, %d, %d]=%d %d=%s :[ %d, %d, %d, %d]=%d [ %d, %d, %d, %d]=%d\n", + cdkey, uniwuecde, uniwuecde2, + CharName, tm1.tm_hour, tm1.tm_min, + petID1, PetName1, petLV, petrank, trans, vital1, str1, tgh1, dex1, total1, + petID2, PetName2, vital2, str2, tgh2, dex2, total2, + work0, work1, work2, work3, ans ); +} +/*------------------------------------------------------------ + * + * ʸë + * +-------------------------------------------------------------*/ +void LogPet( + char *CharName, /* ƽҷ */ + char *CharID, + char *PetName, + int PetLv, + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + char *uniquecode // shan 2001/12/14 +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + // shan 2001/12/14 + //printl( LOG_PET, "%s\t%s\t%s:%d=%s,(%d,%d,%d)(%d:%d)" , CharName, CharID, + // PetName, PetLv, + // Key, + // floor, x, y, tm1.tm_hour, tm1.tm_min ); + printl( LOG_PET, "%s\t%s\t%s:%d=%s,(%d,%d,%d)(%d:%d),%s" , CharName, CharID, + PetName, PetLv, + Key, + floor, x, y, tm1.tm_hour, tm1.tm_min, uniquecode); +} + +#ifdef _STREET_VENDOR +void LogStreetVendor( + char *SellName, + char *SellID, + char *BuyName, + char *BuyID, + char *ItemPetName, + int PetLv, //ǵߴֵΪ -1 + int iPrice, + char *Key, + int Sfloor, + int Sx, + int Sy, + int Bfloor, + int Bx, + int By, + char *uniquecode, + int streettype +){ + struct tm tm1; + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + char *streetmsg=NULL; + if (streettype==0) streetmsg="ʯ"; + if (streettype==1) streetmsg=""; + if (streettype==2) streetmsg="Ա"; + if (streettype==3) streetmsg=""; + if (streettype==4) streetmsg=""; + printl(LOG_STREET_VENDOR,"type:%s Sell:%s\t%s\tBuy:%s\t%s\tName=%s:Lv=%d|Price:%d,%s,SXY(%d,%d,%d)BXY(%d,%d,%d)(%d%d%d %d:%d),%s",streetmsg,SellName,SellID,BuyName,BuyID, + ItemPetName,PetLv,iPrice,Key,Sfloor,Sx,Sy,Bfloor,Bx,By,tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour,tm1.tm_min,uniquecode); +} +#endif + +void LogBankStone( + char *CharName, /* ƽҷ */ + char *CharId, /* ǡID */ + int meindex, + int Gold, /* ź */ + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y, + int my_gold, + int my_personagold + +){ + struct tm tm1; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_STONE, "%s:%s\ts:%d=%s,(%d,%d,%d)(%d:%d) <>" , + CharId, CharName, Gold, Key, + floor, x, y, tm1.tm_hour, tm1.tm_min , my_gold, my_personagold ); +} + +void LogPetPointChange( + char * CharName, char *CharID, char *PetName, int petindex, int errtype, + int PetLv, char *Key,int floor, int x, int y) { + + struct tm tm1; + int vit,str,tgh,dex; + int l_vit,l_str,l_tgh,l_dex; + int pet_ID, levellvup; + + pet_ID = CHAR_getInt( petindex, CHAR_PETID ); + vit = CHAR_getInt( petindex, CHAR_VITAL ); + str = CHAR_getInt( petindex, CHAR_STR ); + tgh = CHAR_getInt( petindex, CHAR_TOUGH ); + dex = CHAR_getInt( petindex, CHAR_DEX ); + levellvup = CHAR_getInt( petindex, CHAR_ALLOCPOINT); + + l_vit = (levellvup >> 24); + l_str = (levellvup >> 16)&0xff; + l_tgh = (levellvup >> 8 )&0xff; + l_dex = (levellvup >> 0 )&0xff; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_PET, "%s\t%s\t%s:%d=%s,(%d,%d,%d)(%d:%d),err:%d %d<<%d,%d,%d,%d>>lvup<<%d,%d,%d,%d>>" , + CharName, CharID, PetName, PetLv, Key, floor, x, y, tm1.tm_hour, tm1.tm_min , errtype, + pet_ID ,vit,str,tgh,dex,l_vit,l_str,l_tgh,l_dex); +} + +/*------------------------------------------------------------ + * + * Ϸë + * +-------------------------------------------------------------*/ +void LogTensei( + char *CharName, /* ƽҷ */ + char *CharID, + char *Key, /* ƽ */ + int level, //ì + int transNum, //Ϸ + int quest, //;޵ + int home, //컩 + int item, // ʧ ة Ի + int pet, // ʸ Ի + int vital, // Vital + int b_vital, // vital + int str, // str + int b_str, // str + int tgh, // + int b_tgh, // + int dex, // + int b_dex // +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_TENSEI, "%s\t%s\t%s=(%d,%d,%d,%d,%d,%d),(vi=%d->%d,str=%d->%d,tgh=%d->%d,dex=%d->%d),(%d,%d)" + ,CharName, + CharID, + Key, + level, + transNum, + quest, + home, + item, + pet, + vital, + b_vital, + str, + b_str, + tgh, + b_tgh, + dex, + b_dex, + tm1.tm_hour, tm1.tm_min + ); +} + +// LOG_TALK +void LogTalk( + char *CharName, /* ƽҷ */ + char *CharID, + int floor, /* */ + int x, + int y, + char *message +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + printl( LOG_TALK, "%2d:%2d\t%s\t%s\t%d_%d_%d\tT=%s" , + tm1.tm_hour, tm1.tm_min, + (CharID==NULL) ? "(null)" :CharID, + (CharName==NULL) ? "(null)" :CharName, + floor, x, y, + message ); + + +} +/*------------------------------------------------------------ + * ɬñ׻Ȼͻ̻ëʧ + * ̻ﷴͷľئľͷ + * ¦ struct tm + * ئ + * ߯Ի + * װ̻P + ------------------------------------------------------------*/ +void backupAllLogFile( struct tm *ptm ) +{ + int i; + char szBuffer[256]; + + for( i=0 ; itm_year+1900, ptm->tm_mon+1, ptm->tm_mday ); + + if( LogConf[i].f != NULL ){ + /* ľͷ */ + fclose( LogConf[i].f ); + /* ة */ + rename( LogConf[i].filename, szBuffer ); + /* ̫ */ + LogConf[i].f = fopen( LogConf[i].filename , "a" ); + + }else{ + /* ة */ + rename( LogConf[i].filename, szBuffer ); + /* ̫ */ + LogConf[i].f = fopen( LogConf[i].filename , "a" ); + + } + } +} +/*------------------------------------------------------------ +* +* ë +* +-------------------------------------------------------------*/ +// Syu ADD дȡLog () +void LogFamilyBankStone( + char *CharName, + char *CharId, + int Gold, + int MyGold, + char *Key, + int floor, + int x, + int y, + int banksum +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_BANKSTONELOG, "%s:%s\t%d=%s [%d] CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key,banksum, + MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); + print("\n%s:%s\t%d=%s [%d] CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)\n" , CharId, CharName, Gold, Key,banksum, + MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); +} + +void LogStone( + int TotalGold, + char *CharName, /* ƽҷ */ + char *CharId, /* ǡID */ + int Gold, /* ź */ + int MyGold, + char *Key, /* ƽ */ + int floor, /* */ + int x, + int y +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + if(TotalGold == -1){ + printl( LOG_STONE, "%s:%s\t%d=%s TOTAL_GOLD(%d),CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key,TotalGold, + MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); + } + else{ + printl( LOG_STONE, "%s:%s\t%d=%s CHAR_GOLD(%d),(%d,%d,%d)(%d:%d)" , CharId, CharName, Gold, Key, + MyGold, floor, x, y, tm1.tm_hour, tm1.tm_min ); + } +} + +//ttom 12/26/2000 print the kill log +void LogKill( + char *CharName, + char *CharId, + char *CharPet_Item +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_KILL, "Name=%s:ID=%s\t%s (%d:%d)" ,CharName,CharId, CharPet_Item, + tm1.tm_hour, tm1.tm_min ); +} +//ttom + +// CoolFish: Trade 2001/4/19 +void LogTrade(char *message) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_TRADE, "%s (%d%d%d %d:%d)" , message, tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min ); +} + +// CoolFish: Family Popular 2001/9/12 +void LogFMPOP(char *message) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + printl( LOG_FMPOP, "%s (%d:%d)" , message, tm1.tm_hour, tm1.tm_min ); +} + +// Arminius 2001/6/14 +char hackmsg[HACK_TYPE_NUM][4096]= + { "??? ʲҲûз", + "޷ȡͨѶЭ", + "յ޷ʶͨѶЭ", + "", + "HPΪ", + "˺ŷ", + }; + +void logHack(int fd, int errcode) +{ + struct tm tm1; + char cdkey[4096]; + char charname[4096]; + unsigned long ip; + char ipstr[4096]; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + CONNECT_getCdkey( fd, cdkey, 4096); + CONNECT_getCharname( fd, charname, 4096); + ip=CONNECT_get_userip(fd); + sprintf(ipstr,"%d.%d.%d.%d", + ((unsigned char *)&ip)[0], + ((unsigned char *)&ip)[1], + ((unsigned char *)&ip)[2], + ((unsigned char *)&ip)[3]); + if ((errcode<0) || (errcode>=HACK_TYPE_NUM)) errcode=HACK_NOTHING; + + printl( LOG_HACK, "(%d:%d) %s ip=%s cdkey=%s charname=%s", + tm1.tm_hour, tm1.tm_min, hackmsg[errcode], ipstr, cdkey, charname); +} + +void logHackKick(int fd) +{ + struct tm tm1; + char cdkey[4096]; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + CONNECT_getCdkey( fd, cdkey, 4096); + if(strlen(cdkey)<1) + strcpy(cdkey,""); + printl( LOG_LOGIN, "hack:(%d%d%d %d:%d) cdkey=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min, cdkey); +} + +void logKong(char *ip) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ӱ,IP=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip); +} + +void logCC(char *ip) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ,IP=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip); +} + +void logWrongCdkey(char *ip) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ˺,IP=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip); +} + +void logWrongBao(char *ip) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ,IP=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip); +} + +void logRightBao(char *ip,int baolen) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ȷ,IP=%s,len=%d ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip,baolen); +} + +void logBigBao(char *ip,int baolen) +{ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ,IP=%s,len=%d ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,ip,baolen); +} + +void logFengBao(int clifd,char *cdkey,int funcid,char *buf) +{ + /* + int clicharaindex = CONNECT_getCharaindex( clifd ); + if(CHAR_getWorkInt(clicharaindex,CHAR_WORKJILU)==1){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ȡ,cdkey=%s,funcid=%d,buf=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,cdkey,funcid,buf); + } + */ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + printl( LOG_HACK, "(%d%d%d %d:%d) ȡ,cdkey=%s,funcid=%d,buf=%s ", + tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour, tm1.tm_min,cdkey,funcid,buf); + +} + +// Nuke 0626 +void logSpeed(int fd) +{ + struct tm tm1; + char cdkey[4096]; + char charname[4096]; + unsigned long ip; + char ipstr[4096]; + + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + CONNECT_getCdkey( fd, cdkey, 4096); + CONNECT_getCharname( fd, charname, 4096); + ip=CONNECT_get_userip(fd); + sprintf(ipstr,"%d.%d.%d.%d", + ((unsigned char *)&ip)[0], + ((unsigned char *)&ip)[1], + ((unsigned char *)&ip)[2], + ((unsigned char *)&ip)[3]); + printl( LOG_SPEED, "(%d:%d) ip=%s cdkey=%s charname=%s", + tm1.tm_hour, tm1.tm_min, ipstr, cdkey, charname); +} + +// Shan +void LogGM( + char *CharName, //ɫ + char *CharID, //ID + char *Message, //ָ + int floor, + int x, + int y +) +{ + struct tm tm1; + + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + printl(LOG_GM,"%s\t%s\t%s\t(%d,%d,%d)\t(%d%d%d %d:%d)", + CharName,CharID,Message,floor,x,y,tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour,tm1.tm_min); +} + +// Robin 10/02 +void LogFamily( + char *FMName, + int fmindex, + char *charName, + char *charID, + char *keyWord, + char *data +){ + struct tm tm1; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + // CoolFish: 2001/10/11 log time + printl( LOG_FAMILY, "%s\t%d\t%s\t%s\t= %s, %s (%d:%d)", + FMName, fmindex, charName, charID, + keyWord, data, tm1.tm_hour, tm1.tm_min ); +} + +#ifdef _GAMBLE_ROULETTE +void LogGamble( + char *CharName, //ɫ + char *CharID, //ID + char *Key, //˵ + int floor, + int x, + int y, + int player_stone, //ӵнǮ + int Gamble_stone, //ע + int get_stone, // + int Gamble_num, + int flg //flg = 1 2 ׯ +) +{ + struct tm tm1; + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + + if( flg == 1 ) { + printl(LOG_GAMBLE,"%s\t%s\t TYPE:%s <>\t(%d,%d,%d)-(%d:%d) GAMBLENUM=%d", + CharName,CharID,Key, player_stone, Gamble_stone, get_stone, floor,x,y,tm1.tm_hour,tm1.tm_min, Gamble_num); + }else if( flg == 2 ) { + printl(LOG_GAMBLE,"%s\tROULETTE MASTER\t TYPE:%s <>\t(%d,%d,%d)-(%d:%d)", + CharName,Key, player_stone, floor,x,y,tm1.tm_hour,tm1.tm_min); + } +} + +#endif + +void LogLogin( + char *CharID, //ID + char *CharName, //ɫ + int saveIndex, + char *ipadress,char *pcid +) +{ + struct tm tm1; + + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + + printl(LOG_LOGIN,"%s\t%s\ti=%d\t%s\tPCID=%s\t(%d%d%d %d:%d)", + CharID,CharName,saveIndex,ipadress,pcid,tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour,tm1.tm_min); + +} + +void LogLogout( + char *CharID, //ID + char *CharName, //ɫ + int floor, + int hp, + char *file, + int line +) +{ + struct tm tm1; + + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + + printl(LOG_LOGIN,"%s\t%s\tfloor=%d\thp=%d\t(%d%d%d %d:%d)\tfile=%s%d", + CharID,CharName,floor,hp,tm1.tm_year+1900,tm1.tm_mon+1,tm1.tm_mday,tm1.tm_hour,tm1.tm_min,file,line); + +} + + + +void warplog_to_file() +{ + int i =0; + char outbuf[128]; + FILE *f; + f = fopen("log/warp1.log" ,"w" ); + if( !f ) return; + + for( i=0; i +#include +#include + + +void lssproto_SetServerLogFiles( char *r , char *w ) +{ + lssproto_strcpysafe( lssproto_writelogfilename , w , sizeof(lssproto_writelogfilename )); + lssproto_strcpysafe( lssproto_readlogfilename , r , sizeof(lssproto_readlogfilename )); +} +int lssproto_InitServer( int (*writefunc)(int,char*,int) , int worksiz ) +{ + int i; + if( (void*)writefunc == NULL) { + lssproto.write_func = lssproto_default_write_wrap; + } else { + lssproto.write_func = writefunc; + } + lssproto_AllocateCommonWork(worksiz); + lssproto_stringwrapper = (char**)calloc( 1,sizeof(char*) * MAXLSRPCARGS); + if(lssproto_stringwrapper ==NULL) + return -1; + memset( lssproto_stringwrapper , 0, sizeof(char*)*MAXLSRPCARGS); + for(i=0;i",fd,__LINE__,func) +extern int cliretfunc; +extern char playcdkey[16]; +extern char *errraw; +extern char *MesgSlice[SLICE_MAX]; + +int lssproto_ServerDispatchMessage(int fd, char *encoded) +{ + //print("\ntest=%s,state=%d\n",encoded,CONNECT_getState(fd)); + if(strlen(encoded)>getBigBao() && CONNECT_getState(fd) == NOTLOGIN){ + unsigned long tmpip; + int a,b,c,d; + char ip[32]; + tmpip=CONNECT_get_userip(fd); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + //print("\nIP=%s\n",ip); + logBigBao(ip,strlen(encoded)); + } +#endif + CONNECT_endOne_debug(fd); + return -1; + } + } + + int func,fieldcount; + char raw[1024 * 64]; +#ifdef _SERVER_DEF + util_DiscardMessage(); +#endif + + if(strlen(encoded)>getBigBao2()){ + CONNECT_endOne_debug(fd); + return -1; + } + + memset(raw, 0, sizeof(raw)); + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + //printf("\nKey1=%s,KEY2=$s\n",PersonalKey,getRunningKey()); + + util_DecodeMessage(raw,encoded); + //print("\nraw=%s\n",raw); + if(strlen(raw)<1){ + //DME(); + return -1; + } + + errraw = raw; + + if( !util_SplitMessage(raw,SEPARATOR) ){ + print("\nDME1:package=%s\n",raw); + //DME(); + return -1; + } + + if (!util_GetFunctionFromSlice(&func, &fieldcount)) { + //logHack(fd,HACK_GETFUNCFAIL); + //DME(); + return -1; + } + //printf("\nͻ˽ӿ=%d\n",func); +#ifdef _SERVER_DEF +if (func != 71 && func != 79 && func != 87 && func != 77 && func != 81 && func != 73 && func != 75)//¼ǰ ȫִУǷѾߣ + { + if( !CHAR_CHECKINDEX( CONNECT_getCharaindex(fd) ) )//ûеһӣ + { + close(fd);//Ͽ֮ + return -1;//Ҫ! + } + } +#endif + cliretfunc=func; + CONNECT_getCdkey( fd, playcdkey, sizeof( playcdkey )); + + + if (func==LSSPROTO_W_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + char direction[1024 * 64]; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_destring(fd,4, direction); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + ////logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%s",x,y,direction); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_W_recv(fd, x, y, direction); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_W2_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + char direction[1024 * 64]; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_destring(fd,4, direction); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + ////logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%s",x,y,direction); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_W2_recv(fd, x, y, direction); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_EV_RECV) { + int checksum=0, checksumrecv; + int event; + int seqno; + int x; + int y; + int dir; + + checksum += util_deint(fd,2, &event); + checksum += util_deint(fd,3, &seqno); + checksum += util_deint(fd,4, &x); + checksum += util_deint(fd,5, &y); + checksum += util_deint(fd,6, &dir); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d|%d",event,seqno,x,y,dir); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_EV_recv(fd, event, seqno, x, y, dir); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DU_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",x,y); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DU_recv(fd, x, y); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_EO_RECV) { + int checksum=0, checksumrecv; + int dummy; + + checksum += util_deint(fd,2, &dummy); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",dummy); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_EO_recv(fd, dummy); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_BU_RECV) { + int checksum=0, checksumrecv; + int dummy; + + checksum += util_deint(fd,2, &dummy); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",dummy); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_BU_recv(fd, dummy); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_JB_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",x,y); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_JB_recv(fd, x, y); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_LB_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",x,y); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_LB_recv(fd, x, y); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_B_RECV) { + int checksum=0, checksumrecv; + char command[1024 * 64]; + + checksum += util_destring(fd,2, command); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",command); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_B_recv(fd, command); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_SKD_RECV) { + int checksum=0, checksumrecv; + int dir; + int index; + + checksum += util_deint(fd,2, &dir); + checksum += util_deint(fd,3, &index); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",dir,index); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SKD_recv(fd, dir, index); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_ID_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int haveitemindex; + int toindex; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &haveitemindex); + checksum += util_deint(fd,5, &toindex); + util_deint(fd,6, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d",x,y,haveitemindex,toindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_ID_recv(fd, x, y, haveitemindex, toindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PI_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int dir; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &dir); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,dir); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PI_recv(fd, x, y, dir); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DI_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int itemindex; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &itemindex); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,itemindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DI_recv(fd, x, y, itemindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DG_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int amount; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &amount); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,amount); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DG_recv(fd, x, y, amount); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DP_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int petindex; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &petindex); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,petindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DP_recv(fd, x, y, petindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_MI_RECV) { + int checksum=0, checksumrecv; + int fromindex; + int toindex; + + checksum += util_deint(fd,2, &fromindex); + checksum += util_deint(fd,3, &toindex); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",fromindex,toindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_MI_recv(fd, fromindex, toindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_MSG_RECV) { + int checksum=0, checksumrecv; + int index; + char message[1024 * 64]; + int color; + + checksum += util_deint(fd,2, &index); + checksum += util_destring(fd,3, message); + checksum += util_deint(fd,4, &color); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%s|%d",index,message,color); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_MSG_recv(fd, index, message, color); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PMSG_RECV) { + int checksum=0, checksumrecv; + int index; + int petindex; + int itemindex; + char message[1024 * 64]; + int color; + + checksum += util_deint(fd,2, &index); + checksum += util_deint(fd,3, &petindex); + checksum += util_deint(fd,4, &itemindex); + checksum += util_destring(fd,5, message); + checksum += util_deint(fd,6, &color); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%s|%d",index,petindex,itemindex,message,color); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PMSG_recv(fd, index, petindex, itemindex, message, color); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_AB_RECV) { + int checksum=0, checksumrecv; + util_deint(fd,2, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_AB_recv(fd); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DAB_RECV) { + int checksum=0, checksumrecv; + int index; + + checksum += util_deint(fd,2, &index); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",index); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DAB_recv(fd, index); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_AAB_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",x,y); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_AAB_recv(fd, x, y); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_L_RECV) { + int checksum=0, checksumrecv; + int dir; + + checksum += util_deint(fd,2, &dir); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",dir); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_L_recv(fd, dir); + util_DiscardMessage(); + return 0; + } + +#ifdef _CAX_TALK_LJIU + if (func==LSSPROTO_TK_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + char message[1024 * 64]; + int color; + int area; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_destring(fd,4, message); + checksum += util_deint(fd,5, &color); + checksum += util_deint(fd,6, &area); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + + sprintf(errraw,"%d|%d|%s|%d|%d",x,y,message,color,area); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + if(strcmp( message , "P|" ) == 0) + { + lssproto_TK_recv(fd, x, y, "P|hi", color, area); + }else{ + lssproto_TK_recv(fd, x, y, message, color, area); + } + util_DiscardMessage(); + return 0; + } +#else + if (func==LSSPROTO_TK_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + char message[1024 * 64]; + int color; + int area; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_destring(fd,4, message); + checksum += util_deint(fd,5, &color); + checksum += util_deint(fd,6, &area); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%s|%d|%d",x,y,message,color,area); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_TK_recv(fd, x, y, message, color, area); + util_DiscardMessage(); + return 0; + } +#endif + + if (func==LSSPROTO_M_RECV) { + int checksum=0, checksumrecv; + int fl; + int x1; + int y1; + int x2; + int y2; + + checksum += util_deint(fd,2, &fl); + checksum += util_deint(fd,3, &x1); + checksum += util_deint(fd,4, &y1); + checksum += util_deint(fd,5, &x2); + checksum += util_deint(fd,6, &y2); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d|%d",fl,x1,y1,x2,y2); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_M_recv(fd, fl, x1, y1, x2, y2); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_C_RECV) { + int checksum=0, checksumrecv; + int index; + + checksum += util_deint(fd,2, &index); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",index); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_C_recv(fd, index); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_S_RECV) { + int checksum=0, checksumrecv; + char category[1024 * 64]; + + checksum += util_destring(fd,2, category); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } +#ifdef _FIX_LSSP_S_BUG + if (is_digit(category)<0) return -1; +#endif + sprintf(errraw,"%s",category); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_S_recv(fd, category); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_FS_RECV) { + int checksum=0, checksumrecv; + int flg; + + checksum += util_deint(fd,2, &flg); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",flg); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_FS_recv(fd, flg); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_HL_RECV) { + int checksum=0, checksumrecv; + int flg; + + checksum += util_deint(fd,2, &flg); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",flg); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_HL_recv(fd, flg); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PR_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int request; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &request); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,request); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PR_recv(fd, x, y, request); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_KS_RECV) { + int checksum=0, checksumrecv; + int petarray; + checksum += util_deint(fd,2, &petarray); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",petarray); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_KS_recv(fd, petarray); + util_DiscardMessage(); + return 0; + } + +#ifdef _STANDBYPET + if (func==LSSPROTO_SPET_RECV) { + int checksum=0, checksumrecv; + int standbypet; + checksum += util_deint(fd,2, &standbypet); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",standbypet); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SPET_recv(fd, standbypet); + util_DiscardMessage(); + return 0; + } +#endif + +#ifdef _RIGHTCLICK + if (func==LSSPROTO_RCLICK_RECV) { + int checksum=0, checksumrecv; + int type; + char data[1024]; + checksum += util_deint(fd,2, &type); + checksum += util_destring(fd,3, data); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%s",type,data); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_RCLICK_recv(fd, type, data); + util_DiscardMessage(); + return 0; + } +#endif + + if (func==LSSPROTO_AC_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int actionno; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &actionno); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,actionno); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_AC_recv(fd, x, y, actionno); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_MU_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int array; + int toindex; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &array); + checksum += util_deint(fd,5, &toindex); + util_deint(fd,6, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d",x,y,array,toindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_MU_recv(fd, x, y, array, toindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PS_RECV) { + int checksum=0, checksumrecv; + int havepetindex; + int havepetskill; + int toindex; + char data[1024 * 64]; + + checksum += util_deint(fd,2, &havepetindex); + checksum += util_deint(fd,3, &havepetskill); + checksum += util_deint(fd,4, &toindex); + checksum += util_destring(fd,5, data); + util_deint(fd,6, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%s",havepetindex,havepetskill,toindex,data); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PS_recv(fd, havepetindex, havepetskill, toindex, data); + + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_ST_RECV) { + int checksum=0, checksumrecv; + int titleindex; + + checksum += util_deint(fd,2, &titleindex); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",titleindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_ST_recv(fd, titleindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_DT_RECV) { + int checksum=0, checksumrecv; + int titleindex; + + checksum += util_deint(fd,2, &titleindex); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",titleindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_DT_recv(fd, titleindex); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_FT_RECV) { + int checksum=0, checksumrecv; + char data[1024 * 64]; + + checksum += util_destring(fd,2, data); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",data); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_FT_recv(fd, data); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_SKUP_RECV) { + int checksum=0, checksumrecv; + int skillid; + + checksum += util_deint(fd,2, &skillid); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",skillid); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SKUP_recv(fd, skillid); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_KN_RECV) { + int checksum=0, checksumrecv; + int havepetindex; + char data[1024 * 64]; + + checksum += util_deint(fd,2, &havepetindex); + checksum += util_destring(fd,3, data); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%s",havepetindex,data); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_KN_recv(fd, havepetindex, data); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_WN_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int seqno; + int objindex; + int select; + char data[1024 * 64]; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &seqno); + checksum += util_deint(fd,5, &objindex); + checksum += util_deint(fd,6, &select); + checksum += util_destring(fd,7, data); + + util_deint(fd,8, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d|%d|%d|%s",CHAR_getInt(CONNECT_getCharaindex(fd),CHAR_FLOOR),x,y,seqno,objindex,select,data); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_WN_recv(fd, x, y, seqno, objindex, select, data); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_SP_RECV) { + int checksum=0, checksumrecv; + int x; + int y; + int dir; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &dir); + util_deint(fd,5, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,dir); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SP_recv(fd, x, y, dir); + util_DiscardMessage(); + return 0; + } +#ifdef _CAX_NEWMAC_LOGIN +if (func==LSSPROTO_CLIENTLOGIN_RECV) { + int checksum=0, checksumrecv; + char cdkey[CDKEYLEN]; + char passwd[PASSWDLEN]; + char cpuid[1024]; + char mac[1024]; +#ifdef _MO_LOGINCHECK + char szdata[1024]; +#endif + strcpy(PersonalKey, getDefaultKey(fd)); + + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + checksum += util_destring(fd,4, cpuid); + checksum += util_destring(fd,5, mac); +#ifdef _MO_LOGINCHECK + checksum += util_destring(fd,6, szdata); + util_deint(fd,7, &checksumrecv); +#else + util_deint(fd,6, &checksumrecv); +#endif + + if (checksum!=checksumrecv) { +#ifndef _MO_LOGINCHECK + checksum = 0; + checksumrecv = 0; + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + return -1; + } + sprintf(errraw,"%s|%s",cdkey,passwd); + logFengBao(fd,playcdkey,func,errraw); + // print("\n 1cdkey=%s,passwd=%s\n",cdkey, passwd); + lssproto_ClientLogin_recv(fd, cdkey, passwd); + util_DiscardMessage(); + return 0; +#else + util_DiscardMessage(); + return -1; +#endif + } else{ + sprintf(errraw,"%s|%s|%s|%s|%s",cdkey,passwd,cpuid,mac,szdata); + // logFengBao(fd,playcdkey,func,errraw); +#ifndef _MO_LOGINCHECK + if(strlen(cpuid)<20) + lssproto_ClientLogin_recv(fd, cdkey, passwd); + else + // print("\n 2cdkey=%s,passwd=%s,cpuid=%s mac=%s\n",cdkey, passwd,cpuid,mac); + lssproto_ClientLoginJqm_recv(fd, cdkey, passwd,cpuid,mac); +#else + //printf("\n 2cdkey=%s,passwd=%s,cpuid=%s mac=%s\n szdata=%s\n",cdkey, passwd,cpuid,mac,szdata); + if(strlen(cpuid)<40){ + util_DiscardMessage(); + return -1; + } + if(strlen(mac)>13){ + util_DiscardMessage(); + return -1; + } + if(strlen(szdata)!=(XXTEA_ROUND*8)){ + util_DiscardMessage(); + return -1; + } + lssproto_ClientLoginJqm_recv(fd, cdkey, passwd,cpuid,mac,szdata); +#endif + util_DiscardMessage(); + return 0; + } + return 0; + } +#else + if (func==LSSPROTO_CLIENTLOGIN_RECV) { + int checksum=0, checksumrecv; + char cdkey[CDKEYLEN]; + char passwd[PASSWDLEN]; + char cpuid[128]; + + strcpy(PersonalKey, getDefaultKey(fd)); + + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + checksum += util_destring(fd,4, cpuid); + util_deint(fd,5, &checksumrecv); + + if (checksum!=checksumrecv) { + checksum = 0; + checksumrecv = 0; + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + return -1; + } + sprintf(errraw,"%s|%s",cdkey,passwd); + logFengBao(fd,playcdkey,func,errraw); + lssproto_ClientLogin_recv(fd, cdkey, passwd); + util_DiscardMessage(); + return 0; + }else{ + sprintf(errraw,"%s|%s",cdkey,passwd); + logFengBao(fd,playcdkey,func,errraw); + if(strlen(cpuid)<20) + lssproto_ClientLogin_recv(fd, cdkey, passwd); + else + lssproto_ClientLoginJqm_recv(fd, cdkey, passwd,cpuid); + //print("\ncdkey=%s,passwd=%s,cpuid=%s\n",cdkey, passwd,cpuid); + util_DiscardMessage(); + return 0; + } + return 0; + } +#endif +/* +if (func==LSSPROTO_CLIENTLOGIN_RECV) { + int checksum=0, checksumrecv; + char cdkey[CDKEYLEN]; + char passwd[PASSWDLEN]; + char cpuid[128]; + char GHid[128]; + char GHic[128]; + char GHsp[128]; + + strcpy(PersonalKey, getDefaultKey(fd)); + + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + checksum += util_destring(fd,4, cpuid); + checksum += util_destring(fd,5, GHid); + checksum += util_destring(fd,6, GHic); + checksum += util_destring(fd,7, GHsp); + util_deint(fd,8, &checksumrecv); + + if (checksum!=checksumrecv) { + checksum = 0; + checksumrecv = 0; + checksum += util_destring(fd,2, cdkey); + checksum += util_destring(fd,3, passwd); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + return -1; + } + sprintf(errraw,"%s|%s",cdkey,passwd); + logFengBao(fd,playcdkey,func,errraw); + lssproto_ClientLogin_recv(fd, cdkey, passwd); + util_DiscardMessage(); + return 0; + }else{ + sprintf(errraw,"%s|%s",cdkey,passwd); + logFengBao(fd,playcdkey,func,errraw); + if(strlen(cpuid)<20) + lssproto_ClientLogin_recv(fd, cdkey, passwd); + else + lssproto_ClientLoginJqm_recv(fd, cdkey, passwd,cpuid,GHid,GHic,GHsp); + //print("\ncdkey=%s,passwd=%s,cpuid=%s\n",cdkey, passwd,cpuid); + util_DiscardMessage(); + return 0; + } +// if (checksum!=checksumrecv) { +// util_DiscardMessage(); +// +// //logHack(fd, HACK_CHECKSUMERROR); +// //DME(); +// return -1; +// } +// sprintf(errraw,"%s|%s",cdkey,passwd); +// logFengBao(fd,playcdkey,func,errraw); +// //print("\nfunc=%d,raw=%s\n",func,errraw); +// lssproto_ClientLogin_recv(fd, cdkey, passwd); +// util_DiscardMessage(); + return 0; + } +*/ + if (func==LSSPROTO_CREATENEWCHAR_RECV) { + int checksum=0, checksumrecv; + int dataplacenum; +#ifdef _FIX_LONGCHARNAME_ATTACK + char charname[1024]; +#else + char charname[CHARNAMELEN]; +#endif + int imgno; + int faceimgno; + int vital; + int str; + int tgh; + int dex; + int earth; + int water; + int fire; + int wind; + int hometown; + + checksum += util_deint(fd,2, &dataplacenum); + checksum += util_destring(fd,3, charname); + checksum += util_deint(fd,4, &imgno); + checksum += util_deint(fd,5, &faceimgno); + checksum += util_deint(fd,6, &vital); + checksum += util_deint(fd,7, &str); + checksum += util_deint(fd,8, &tgh); + checksum += util_deint(fd,9, &dex); + checksum += util_deint(fd,10, &earth); + checksum += util_deint(fd,11, &water); + checksum += util_deint(fd,12, &fire); + checksum += util_deint(fd,13, &wind); + checksum += util_deint(fd,14, &hometown); + util_deint(fd,15, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } +#ifdef _FIX_LONGCHARNAME_ATTACK + if(strlen(charname)>CHARNAMELEN){ + util_DiscardMessage(); + return -1; + } +#endif + sprintf(errraw,"%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d",dataplacenum,charname,imgno,faceimgno,vital,str,tgh,dex,earth,water,fire,wind,hometown); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CreateNewChar_recv(fd, dataplacenum, charname, imgno, faceimgno, vital, str, tgh, dex, earth, water, fire, wind, hometown); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_CHARDELETE_RECV) { + int checksum=0, checksumrecv; +#ifdef _FIX_LONGCHARNAME_ATTACK + char charname[1024]; +#else + char charname[CHARNAMELEN]; +#endif + char safepass[32]; + + checksum += util_destring(fd,2, charname); + checksum += util_destring(fd,3, safepass); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } +#ifdef _FIX_LONGCHARNAME_ATTACK + if(strlen(charname)>CHARNAMELEN){ + util_DiscardMessage(); + return -1; + } +#endif + sprintf(errraw,"%s|%s",charname,safepass); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CharDelete_recv(fd, charname,safepass); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_CHARLOGIN_RECV) { + int checksum=0, checksumrecv; +#ifdef _FIX_LONGCHARNAME_ATTACK + char charname[1024]; +#else + char charname[CHARNAMELEN]; +#endif + checksum += util_destring(fd,2, charname); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } +#ifdef _FIX_LONGCHARNAME_ATTACK + if(strlen(charname)>CHARNAMELEN){ + util_DiscardMessage(); + return -1; + } +#endif + sprintf(errraw,"%s",charname); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CharLogin_recv(fd, charname); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_CHARLIST_RECV) { + int checksum=0, checksumrecv; + util_deint(fd,2, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CharList_recv( fd); + + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_CHARLOGOUT_RECV) { + int checksum=0, checksumrecv; + int Flg=1; +#ifdef _CHAR_NEWLOGOUT + checksum += util_deint(fd,2, &Flg); + util_deint(fd,3, &checksumrecv); +#else + util_deint(fd,2, &checksumrecv); +#endif + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",Flg); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CharLogout_recv(fd, Flg); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PROCGET_RECV) { + int checksum=0, checksumrecv; + + strcpy( PersonalKey, getDefaultKey(fd)); + + util_deint(fd,2, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_ProcGet_recv(fd); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PLAYERNUMGET_RECV) { + int checksum=0, checksumrecv; + util_deint(fd,2, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PlayerNumGet_recv(fd); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_ECHO_RECV) { + int checksum=0, checksumrecv; + char test[1024 * 64]; + memset(test, 0, sizeof(test)); + checksum += util_destring(fd,2, test); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",test); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); +// if(strlen(test)>10){ +// unsigned long tmpip; +// int a,b,c,d; +// char ip[32]; +// tmpip=CONNECT_get_userip(fd); +// a=(tmpip % 0x100); tmpip=tmpip / 0x100; +// b=(tmpip % 0x100); tmpip=tmpip / 0x100; +// c=(tmpip % 0x100); tmpip=tmpip / 0x100; +// d=(tmpip % 0x100); +// sprintf(ip,"%d.%d.%d.%d",a,b,c,d); +// if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ +// char systemstr[128]; +// sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); +// CONNECT_endOne_debug(fd); +// system(systemstr); +// print("\nIP=%s,test=%s\n",ip,test); +// return -1; +// } +// } + lssproto_Echo_recv(fd, test); + util_DiscardMessage(); + return 0; + } + + + if (func==LSSPROTO_TD_RECV) { + int checksum=0, checksumrecv; + char message[1024 * 64]; + + checksum += util_destring(fd,2, message); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",message); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_TD_recv(fd, message); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_FM_RECV) { + int checksum=0, checksumrecv; + char message[1024 * 64]; + + checksum += util_destring(fd,2, message); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",message); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_FM_recv(fd, message); + util_DiscardMessage(); + return 0; + } + + if (func==LSSPROTO_PETST_RECV) { + int checksum=0, checksumrecv; + int nPet; + int sPet; + + checksum += util_deint(fd,2, &nPet); + checksum += util_deint(fd,3, &sPet); + util_deint(fd,4, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",nPet,sPet); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PETST_recv(fd, nPet, sPet); + util_DiscardMessage(); + return 0; + } + +#ifdef _CHECK_GAMESPEED + if (func==LSSPROTO_CS_RECV) { + char buffer[2]; + buffer[0] = '\0'; + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CS_recv( fd ); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _TEAM_KICKPARTY + if ( func == LSSPROTO_KTEAM_RECV ) { + int checksum = 0, checksumrecv; + int sindex; + checksum += util_deint(fd, 2, &sindex); + util_deint(fd, 3, &checksumrecv); + if(checksum!=checksumrecv){ + util_DiscardMessage(); + logHack( fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",sindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_KTEAM_recv( fd, sindex); + util_DiscardMessage(); + return 0; + } +#endif + +#ifdef _MIND_ICON + if(func==LSSPROTO_MA_RECV){ + int checksum = 0, checksumrecv; + int nMind; + int x, y; + + checksum += util_deint(fd, 2, &nMind); + checksum += util_deint(fd, 3, &x); + checksum += util_deint(fd, 4, &y); + util_deint(fd, 5, &checksumrecv); + if(checksum!=checksumrecv){ + util_DiscardMessage(); + logHack( fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d",x,y,nMind); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_MA_recv(fd, x, y, nMind); + util_DiscardMessage(); + return 0; + } +#endif + +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ + if (func==LSSPROTO_CHATROOM_RECV) { + int checksum=0, checksumrecv; + char test[1024 * 64]; + + checksum += util_destring(fd,2, test); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",test); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_CHATROOM_recv(fd, test); + util_DiscardMessage(); + return 0; + } +#endif + +#ifdef _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ + if ( func==LSSPROTO_RESIST_RECV ) { + char buffer[2]; + buffer[0] = '\0'; + sprintf(errraw,"%s",""); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_RESIST_recv( fd ); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol + if(func==LSSPROTO_BATTLESKILL_RECV){ + int checksum = 0, checksumrecv; + int iNum; + + checksum += util_deint(fd, 2, &iNum); + util_deint(fd, 3, &checksumrecv); + if(checksum!=checksumrecv){ + util_DiscardMessage(); + logHack( fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d",iNum); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_BATTLESKILL_recv(fd, iNum); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _STREET_VENDOR + if(func == LSSPROTO_STREET_VENDOR_RECV){ + int checksum = 0,checksumrecv; + char message[1024 * 64]; + + checksum += util_destring(fd,2,message); + util_deint(fd,3,&checksumrecv); + if(checksum != checksumrecv){ + util_DiscardMessage(); + logHack(fd,HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",message); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_STREET_VENDOR_recv(fd,message); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _JOBDAILY + if(func == LSSPROTO_JOBDAILY_RECV){ + int checksum = 0,checksumrecv; + char buffer[1024 * 32]; + + checksum += util_destring(fd,2,buffer); + util_deint(fd,3,&checksumrecv); + if(checksum != checksumrecv){ + util_DiscardMessage(); + logHack(fd,HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",buffer); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_JOBDAILY_recv(fd,buffer); + util_DiscardMessage(); + return 0; + + } +#endif +#ifdef _TEACHER_SYSTEM + if(func == LSSPROTO_TEACHER_SYSTEM_RECV){ + int checksum = 0,checksumrecv; + char message[1024 * 64]; + + checksum += util_destring(fd,2,message); + util_deint(fd,3,&checksumrecv); + if(checksum != checksumrecv){ + util_DiscardMessage(); + logHack(fd,HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%s",message); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_TEACHER_SYSTEM_recv(fd,message); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _ADD_STATUS_2 + if(func == LSSPROTO_S2_RECV){ + return 0; + } +#endif + +#ifdef _PET_ITEM + if (func==LSSPROTO_PET_ITEM_RECV) { + int checksum=0, checksumrecv; + int petindex; + int x,y; + int i,j,k,l,m,n; + int fromindex; + int toindex; + + checksum += util_deint(fd,2, &x); + checksum += util_deint(fd,3, &y); + checksum += util_deint(fd,4, &petindex); + checksum += util_deint(fd,5, &fromindex); + checksum += util_deint(fd,6, &toindex); + util_deint(fd,7, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + //logHack(fd, HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d|%d",x,y,petindex,fromindex,toindex); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_PETITEM_recv( fd, x, y, petindex, fromindex, toindex ); + util_DiscardMessage(); + return 0; + } +#endif + +#ifdef _ONLINE_SHOP + if(func == LSSPROTO_SHOP_RECV){ + int checksum = 0,checksumrecv; + int shopflag,piece; + + checksum += util_deint(fd,2,&shopflag); + checksum += util_deint(fd,3,&piece); + util_deint(fd,4,&checksumrecv); + if(checksum != checksumrecv){ + util_DiscardMessage(); + logHack(fd,HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d",shopflag,piece); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SHOP_recv(fd,shopflag,piece); + util_DiscardMessage(); + return 0; + } + + if(func == LSSPROTO_SHOPBUY_RECV){ + int checksum = 0,checksumrecv; + int shopflag,piece,shopno,buynum; + + checksum += util_deint(fd,2,&shopflag); + checksum += util_deint(fd,3,&piece); + checksum += util_deint(fd,4,&shopno); + checksum += util_deint(fd,5,&buynum); + util_deint(fd,6,&checksumrecv); + if(checksum != checksumrecv){ + util_DiscardMessage(); + logHack(fd,HACK_CHECKSUMERROR); + //DME(); + return -1; + } + sprintf(errraw,"%d|%d|%d|%d",shopflag,piece,shopno,buynum); + logFengBao(fd,playcdkey,func,errraw); + //print("\nfunc=%d,raw=%s\n",func,errraw); + lssproto_SHOPBUY_recv(fd,shopflag,piece,shopno,buynum); + util_DiscardMessage(); + return 0; + } +#endif +#ifdef _CAX_ESC_FENGBAO + if (func==LSSPROTO_ESC_RECV) { + int escindex,checksumrecv; + int checksum = 0; + checksum += util_deint(fd,2, &escindex); + util_deint(fd,3, &checksumrecv); + if (checksum!=checksumrecv) { + util_DiscardMessage(); + // DME(); + return -1; + } + sprintf(errraw,"%d",escindex); + logFengBao(fd,playcdkey,func,errraw); + FreeSamenu("ESC_Recv",escindex,CONNECT_getCharaindex(fd)); + util_DiscardMessage(); + return 0; + } +#endif + printf("\n޷ҵͻ˽ӿ=%d\n",func); + + util_DiscardMessage(); + logHack(fd,HACK_NOTDISPATCHED); + //DME(); + return -1; +} + +/* + servertoclient XYD( int x, int y, int dir ); +*/ +void lssproto_XYD_send(int fd,int x,int y,int dir) +{ + if(fd<0) return; + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, x); + checksum += util_mkint(fd,buffer, y); + checksum += util_mkint(fd,buffer, dir); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_XYD_SEND, buffer); +} + +void lssproto_EV_send(int fd,int seqno,int result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, seqno); + checksum += util_mkint(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_EV_SEND, buffer); +} + +void lssproto_EN_send(int fd,int result,int field) +{ + char buffer[1024 * 64]; + int checksum=0; + + //print(" EN_send "); + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, result); + checksum += util_mkint(fd,buffer, field); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_EN_SEND, buffer); +} + + +void lssproto_RS_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_RS_SEND, buffer); +} + + +void lssproto_RD_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_RD_SEND, buffer); +} + +void lssproto_B_send(int fd,char* command) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + checksum += util_mkstring(fd,buffer, command); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_B_SEND, buffer); +} + +void lssproto_I_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_I_SEND, buffer); +} + +void lssproto_SI_send(int fd,int fromindex,int toindex) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + checksum += util_mkint(fd,buffer, fromindex); + checksum += util_mkint(fd,buffer, toindex); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_SI_SEND, buffer); +} + +void lssproto_MSG_send(int fd,int aindex,char* text,int color) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, aindex); + checksum += util_mkstring(fd,buffer, text); + checksum += util_mkint(fd,buffer, color); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_MSG_SEND, buffer); +} + + +void lssproto_PME_send(int fd,int objindex,int graphicsno,int x,int y,int dir,int flg,int no,char* cdata) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, objindex); + checksum += util_mkint(fd,buffer, graphicsno); + checksum += util_mkint(fd,buffer, x); + checksum += util_mkint(fd,buffer, y); + checksum += util_mkint(fd,buffer, dir); + checksum += util_mkint(fd,buffer, flg); + checksum += util_mkint(fd,buffer, no); + checksum += util_mkstring(fd,buffer, cdata); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PME_SEND, buffer); +} + + +void lssproto_AB_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_AB_SEND, buffer); +} + + +void lssproto_ABI_send(int fd,int num,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, num); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_ABI_SEND, buffer); +} + +void lssproto_TK_send(int fd,int index,char* message,int color) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, index); + checksum += util_mkstring(fd,buffer, message); + checksum += util_mkint(fd,buffer, color); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_TK_SEND, buffer); +} + +void lssproto_MC_send(int fd,int fl,int x1,int y1,int x2,int y2,int tilesum,int objsum,int eventsum,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, fl); + checksum += util_mkint(fd,buffer, x1); + checksum += util_mkint(fd,buffer, y1); + checksum += util_mkint(fd,buffer, x2); + checksum += util_mkint(fd,buffer, y2); + checksum += util_mkint(fd,buffer, tilesum); + checksum += util_mkint(fd,buffer, objsum); + checksum += util_mkint(fd,buffer, eventsum); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_MC_SEND, buffer); +} + + +void lssproto_M_send(int fd,int fl,int x1,int y1,int x2,int y2,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, fl); + checksum += util_mkint(fd,buffer, x1); + checksum += util_mkint(fd,buffer, y1); + checksum += util_mkint(fd,buffer, x2); + checksum += util_mkint(fd,buffer, y2); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_M_SEND, buffer); +} + +void lssproto_C_send(int fd,char* data) +{ +#ifdef _WAN_FIX + if(getVsFlg()==2){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(getStayEncount(fd)==1 && strstr(data,sendmsg)==NULL && CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE) + return; + } + }else if(getVsFlg()==1){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(getStayEncount(fd)==1 && strstr(data,sendmsg)==NULL && CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_LEADER) + return; + if(CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT){ + int partyindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if(CHAR_CHECKINDEX(partyindex)){ + int partyfd = getfdFromCharaIndex( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1)); + if(getStayEncount(partyfd)==1) + return; + } + } + } + }else if(getVsFlg()==3){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT){ + int partyindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if(CHAR_CHECKINDEX(partyindex)){ + int partyfd = getfdFromCharaIndex( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1)); + if(getStayEncount(partyfd)==1) + return; + } + } + } + } +#endif + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_C_SEND, buffer); +} + +void lssproto_CA_send(int fd,char* data) +{ +#ifdef _WAN_FIX + if(getVsFlg()==2){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(getStayEncount(fd)==1 && strstr(data,sendmsg)==NULL && CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE) + return; + } + }else if(getVsFlg()==1){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(getStayEncount(fd)==1 && strstr(data,sendmsg)==NULL && CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_LEADER) + return; + if(CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT){ + int partyindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if(CHAR_CHECKINDEX(partyindex)){ + int partyfd = getfdFromCharaIndex( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1)); + if(getStayEncount(partyfd)==1) + return; + } + } + } + }else if(getVsFlg()==3){ + int charaindex = -1; + charaindex = CONNECT_getCharaindex( fd ); + if(CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER){ + char sendmsg[20]; + sprintf(sendmsg,"%d|%d",CHAR_getInt(charaindex,CHAR_X),CHAR_getInt(charaindex,CHAR_Y)); + if(CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT){ + int partyindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if(CHAR_CHECKINDEX(partyindex)){ + int partyfd = getfdFromCharaIndex( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1)); + if(getStayEncount(partyfd)==1) + return; + } + } + } + } +#endif + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CA_SEND, buffer); +} + +void lssproto_CD_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CD_SEND, buffer); +} + +void lssproto_R_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_R_SEND, buffer); +} + +void lssproto_S_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_S_SEND, buffer); +} + +void lssproto_D_send(int fd,int category,int dx,int dy,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, category); + checksum += util_mkint(fd,buffer, dx); + checksum += util_mkint(fd,buffer, dy); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_D_SEND, buffer); +} + +void lssproto_FS_send(int fd,int flg) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, flg); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_FS_SEND, buffer); +} + +void lssproto_HL_send(int fd,int flg) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, flg); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_HL_SEND, buffer); +} + +void lssproto_PR_send(int fd,int request,int result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, request); + checksum += util_mkint(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PR_SEND, buffer); +} + +#ifdef _PETS_SELECTCON +void lssproto_PETS_send(int fd,int petarray,int result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, petarray); + checksum += util_mkint(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PETST_SEND, buffer); +} +#endif + +void lssproto_KS_send(int fd,int petarray,int result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, petarray); + checksum += util_mkint(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_KS_SEND, buffer); +} + +void lssproto_SPET_send(int fd, int standbypet, int result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, standbypet); + checksum += util_mkint(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_SPET_SEND, buffer); +} + +void lssproto_PS_send(int fd,int result,int havepetindex,int havepetskill,int toindex) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, result); + checksum += util_mkint(fd,buffer, havepetindex); + checksum += util_mkint(fd,buffer, havepetskill); + checksum += util_mkint(fd,buffer, toindex); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PS_SEND, buffer); +} + +void lssproto_SKUP_send(int fd,int point) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, point); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_SKUP_SEND, buffer); +} +void lssproto_WN_send(int fd,int windowtype,int buttontype,int seqno,int objindex,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; +#ifdef _NO_WARP + // shan hanjj add Begin + CONNECT_set_seqno(fd,seqno); + CONNECT_set_selectbutton(fd,buttontype); + // shan End +#endif + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, windowtype); + checksum += util_mkint(fd,buffer, buttontype); + checksum += util_mkint(fd,buffer, seqno); + checksum += util_mkint(fd,buffer, objindex); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_WN_SEND, buffer); + +} + +void lssproto_EF_send(int fd,int effect,int level,char* option) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, effect); + checksum += util_mkint(fd,buffer, level); + checksum += util_mkstring(fd,buffer, option); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_EF_SEND, buffer); +} +void lssproto_SE_send(int fd,int x,int y,int senumber,int sw) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, x); + checksum += util_mkint(fd,buffer, y); + checksum += util_mkint(fd,buffer, senumber); + checksum += util_mkint(fd,buffer, sw); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_SE_SEND, buffer); +} + +void lssproto_ClientLogin_send(int fd,char* result) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + checksum += util_mkstring(fd,buffer, result); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CLIENTLOGIN_SEND, buffer); +} + +void lssproto_CreateNewChar_send(int fd,char* result,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, result); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CREATENEWCHAR_SEND, buffer); +} + +void lssproto_CharDelete_send(int fd,char* result,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, result); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CHARDELETE_SEND, buffer); +} + +void lssproto_CharLogin_send(int fd,char* result,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, result); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CHARLOGIN_SEND, buffer); +} + +void lssproto_CharList_send(int fd,char* result,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, result); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CHARLIST_SEND, buffer); +} + +void lssproto_CharLogout_send(int fd,char* result,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, result); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CHARLOGOUT_SEND, buffer); +} + +void lssproto_ProcGet_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PROCGET_SEND, buffer); +} + +void lssproto_PlayerNumGet_send(int fd,int logincount,int player) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, logincount); + checksum += util_mkint(fd,buffer, player); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_PLAYERNUMGET_SEND, buffer); +} + +void lssproto_Echo_send(int fd,char* test) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, test); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_ECHO_SEND, buffer); +} + +// CoolFish: Trade 2001/4/18 + +void lssproto_TD_send(int fd, int index, char* message) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, message); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_TD_SEND, buffer); +} +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +void lssproto_CHATROOM_send ( int fd , char* message ) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, message); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_CHATROOM_SEND, buffer); +} +#endif +#ifdef _NEWREQUESTPROTOCOL // (ɿ) Syu ADD ProtocolҪϸ +void lssproto_RESIST_send ( int fd , char* message ) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, message); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_RESIST_SEND, buffer); +} +#endif +#ifdef _OUTOFBATTLESKILL // (ɿ) Syu ADD սʱProtocol +void lssproto_BATTLESKILL_send ( int fd , char* message ) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, message); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_BATTLESKILL_SEND, buffer); +} +#endif +void lssproto_NU_send(int fd, int nu) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, nu); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_NU_SEND, buffer); +} + + +void lssproto_FM_send(int fd, char* message) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, message); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_FM_SEND, buffer); +} + + +void lssproto_WO_send(int fd,int effect) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, effect); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_WO_SEND, buffer); +} +#ifdef _ITEM_CRACKER +void lssproto_IC_send(int fd, int x, int y) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, x); + checksum += util_mkint(fd,buffer, y); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_IC_SEND, buffer); +} +#endif +#ifdef _MAGIC_NOCAST // :Ĭ +void lssproto_NC_send(int fd,int flg) +{ + if(fd<0) return; + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, flg); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_NC_SEND, buffer); +} +#endif + +#ifdef _STREET_VENDOR +void lssproto_STREET_VENDOR_send(int fd,char *message) +{ + char buffer[1024 * 64]; + int checksum = 0; + + strcpy(buffer,""); + + CONNECT_getCdkey(fd,PersonalKey,4096); + strcat(PersonalKey,getRunningKey()); + + checksum += util_mkstring(fd,buffer,message); + util_mkint(fd,buffer,checksum); + util_SendMesg(fd,LSSPROTO_STREET_VENDOR_SEND,buffer); +} +#endif + +#ifdef _RIGHTCLICK +void lssproto_RCLICK_send(int fd, int type, char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + print("\n RCLICK_send( type=%d data=%s) ", type, data ); + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, type); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_RCLICK_SEND, buffer); +} +#endif + +#ifdef _JOBDAILY +void lssproto_JOBDAILY_send(int fd,char *data) +{ + char buffer[1024 * 32]; + int checksum = 0; + + strcpy(buffer,""); + + CONNECT_getCdkey(fd,PersonalKey,4096); + strcat(PersonalKey,getRunningKey()); + + checksum += util_mkstring(fd,buffer,data); + util_mkint(fd,buffer,checksum); + util_SendMesg(fd,LSSPROTO_JOBDAILY_SEND,buffer); +} +#endif + +#ifdef _TEACHER_SYSTEM +void lssproto_TEACHER_SYSTEM_send(int fd,char *data) +{ + char buffer[1024 * 64]; + int checksum = 0; + + strcpy(buffer,""); + + CONNECT_getCdkey(fd,PersonalKey,4096); + strcat(PersonalKey,getRunningKey()); + + checksum += util_mkstring(fd,buffer,data); + util_mkint(fd,buffer,checksum); + util_SendMesg(fd,LSSPROTO_TEACHER_SYSTEM_SEND,buffer); +} +#endif + +#ifdef _ADD_STATUS_2 +void lssproto_S2_send(int fd,char* data) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_S2_SEND, buffer); +} +#endif + +#ifdef _ONLINE_SHOP +void lssproto_SHOP_send(int fd,int shopnum,int vippoint,int piece,int pieces,int shopflag,char* res) +{ + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkint(fd,buffer, shopnum); + checksum += util_mkint(fd,buffer, vippoint); + checksum += util_mkint(fd,buffer, piece); + checksum += util_mkint(fd,buffer, pieces); + checksum += util_mkint(fd,buffer, shopflag); + checksum += util_mkstring(fd,buffer, res); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_SHOP_SEND, buffer); +} +#endif + +void lssproto_Upmap_send(int fd,int formmap,int tomap) +{ + char buffer[1024 * 64]; + int checksum=0; + fd = getfdFromCharaIndex(fd); + strcpy(buffer,""); + checksum+=util_mkint(fd,buffer, formmap); + checksum+=util_mkint(fd,buffer, tomap); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_UPMAP, buffer); +} + +#ifdef _CAX_DENGON_GG +void lssproto_DENGON_send(int fd, char *data, int color, int num) +{ + if( CONNECT_checkfd(fd) == FALSE )return; +#ifdef _DEBUG_SEND_CLI + printf("[]lssproto_DENGON_send-data:%s,%d,%d\n", data, color, num); +#endif + char buffer[65500]; + int checksum=0; + + strcpy(buffer,""); + + CONNECT_getCdkey( fd, PersonalKey, 4096); + strcat(PersonalKey, getRunningKey()); + + checksum += util_mkstring(fd,buffer, data); + checksum += util_mkint(fd,buffer, color); + checksum += util_mkint(fd,buffer, num); + util_mkint(fd,buffer, checksum); + util_SendMesg(fd, LSSPROTO_DENGON_SEND, buffer); +} +#endif diff --git a/lssproto_util.c b/lssproto_util.c new file mode 100644 index 0000000..ca66441 --- /dev/null +++ b/lssproto_util.c @@ -0,0 +1,1475 @@ +#define _LSSPROTOUTIL_C_ +#include "version.h" +#include +#include +#include +#ifndef WIN32 +#include +#include +#endif +#include "lssproto_util.h" +//ttom +2 for degug +#define IS_2BYTEWORD( _a_ ) ( (char)(0x80) <= (_a_) && (_a_) <= (char)(0xFF) ) + +#include "common.h" +#ifdef lssproto__ENCRYPT +long lssproto_ringoCompressor( unsigned char *code , long codelen , unsigned char *text , long textlen); +long lssproto_ringoDecompressor( unsigned char *text , long textlen , unsigned char *code , long codelen); +#endif +/* + lsrpc routines +*/ +int lssproto_AllocateCommonWork(int bufsiz) +{ + lssproto.workbufsize = bufsiz; + lssproto.work = NULL; + lssproto.arraywork = NULL; + lssproto.escapework = NULL; + lssproto.val_str = NULL; + lssproto.token_list = NULL; + lssproto.cryptwork = NULL; + lssproto.jencodecopy = NULL; + lssproto.jencodeout = NULL; + lssproto.compresswork = NULL; + lssproto.work = (char*)calloc( 1, lssproto.workbufsize ); + lssproto.arraywork = (char*)calloc( 1, lssproto.workbufsize ); + lssproto.escapework = (char*)calloc( 1, lssproto.workbufsize ); + lssproto.val_str = (char*)calloc( 1, lssproto.workbufsize ); + lssproto.token_list = (char**)calloc( 1, lssproto.workbufsize *sizeof( char** ) ); + lssproto.cryptwork = (char*)calloc( 1, lssproto.workbufsize * 3 ); + lssproto.jencodecopy = (char*)calloc( 1, lssproto.workbufsize * 3 ); + lssproto.jencodeout = (char*)calloc( 1, lssproto.workbufsize * 3 ); + lssproto.compresswork = (char*)calloc( 1, lssproto.workbufsize * 3 ); + memset( lssproto.work , 0, lssproto.workbufsize ); + memset( lssproto.arraywork , 0, lssproto.workbufsize ); + memset( lssproto.escapework , 0, lssproto.workbufsize ); + memset( lssproto.val_str , 0, lssproto.workbufsize ); + memset( (char*)lssproto.token_list ,0, lssproto.workbufsize*sizeof(char**) ); + memset( lssproto.cryptwork , 0, lssproto.workbufsize*3 ); + memset( lssproto.jencodecopy , 0, lssproto.workbufsize*3 ); + memset( lssproto.jencodeout , 0, lssproto.workbufsize*3 ); + memset( lssproto.compresswork , 0, lssproto.workbufsize*3 ); + if( lssproto.work == NULL || + lssproto.arraywork == NULL || + lssproto.escapework == NULL || + lssproto.val_str == NULL || + lssproto.token_list == NULL || + lssproto.cryptwork == NULL || + lssproto.jencodecopy == NULL || + lssproto.jencodeout == NULL || + lssproto.compresswork == NULL ){ + free( lssproto.work);free( lssproto.val_str); + free( lssproto.escapework);free( lssproto.arraywork ); + free( lssproto.token_list);free( lssproto.cryptwork ); + free( lssproto.jencodecopy);free( lssproto.jencodeout ); + free( lssproto.compresswork ); + return -1; + } + return 0; +} +/********** + Get message information from a network input +**********/ +void lssproto_GetMessageInfo( int *id , char *funcname , int len, char **tk ) +{ + if( tk[0] == NULL || tk[1] == NULL ){ + *id = 0; + lssproto_strcpysafe( funcname , "" , len ); + return; + } + *id = strtoul( tk[0] ,NULL,10); + lssproto_strcpysafe( funcname , tk[1] , len ); + return; +} +/******************************************** + string utilities +*********************************************/ +void lssproto_strcpysafe( char *dest, char *src, int maxlen ) +{ + int i; + for(i=0;i (int)( lssproto.workbufsize*3-2) ){ + fprintf( stderr, "lsgen: badly configured work buflen\n" ); + exit(1); + } + if( (flag%2) == 1 ) flag ++; + lssproto.compresswork[0] = flag; + memcpy( lssproto.compresswork+1,src,srclen ); + compressed_l = srclen + 1; + } else { + if((flag%2)==0)flag++; + lssproto.compresswork[0] = flag; + compressed_l = lssproto_ringoCompressor( + (unsigned char*)lssproto.compresswork + 1 , + (long)lssproto.workbufsize*3 - 1, + (unsigned char*)src , + (long)strlen(src) ) + 1; /* be careful! */ + } + /* return empty line if error or buffer excess */ + if( compressed_l <= 0 ){ + lssproto_strcpysafe( out , "\n" , maxoutlen ); + return; + } + memcpy( lssproto.jencodecopy ,lssproto.compresswork ,compressed_l ); + lssproto_jEncode( lssproto.jencodecopy , compressed_l , JENCODE_KEY , + lssproto.jencodeout, &jencodedlen , lssproto.workbufsize*3 -1 ); + lssproto_encode64( (unsigned char*)lssproto.jencodeout , jencodedlen, (unsigned char*)out ); +} +/* translate code64 text to original lsrpc text */ +static void lssproto_decodeString( char *src , char *out ) +{ + int compressed_l =0, outlen64; + int l; + long decompressed_l = 0; + /* copy src to copybuffer because jencoder modifies the input buffer */ + l = strlen( src ); + if( src[l-1]=='\n' || src[l-1]=='\r' )src[l-1]=0; + if( src[l-2]=='\n' || src[l-2]=='\r' )src[l-2]=0; + outlen64 = lssproto_decode64( (unsigned char*)src , (unsigned char*)lssproto.jencodecopy ); + lssproto_jDecode( lssproto.jencodecopy , outlen64 , JENCODE_KEY, + lssproto.compresswork , &compressed_l); + /*out[outlen]=0; PENDING*/ + if( (lssproto.compresswork[0] % 2 ) == 0 ){ + if( compressed_l <= 0 ){ + decompressed_l = 0; + fprintf( stderr, "LSRPC: too short:[%s]\n", src ); + } else { + memcpy( out, lssproto.compresswork+1, compressed_l -1 ); + decompressed_l = compressed_l -1; + } + } else { + decompressed_l = + lssproto_ringoDecompressor( (unsigned char*)out , + (long)lssproto.workbufsize , + (unsigned char*)lssproto.compresswork+1 , + (long)compressed_l -1 ); + } + out[decompressed_l] = 0; +} +/* followings are taken from code64.c */ +char lssproto_charset[64]={ + 'A','B','C','D', 'E','F','G','H', + 'I','J','K','L', 'M','N','O','P', + 'Q','R','S','T', 'U','V','W','X', + 'Y','Z','a','b', 'c','d','e','f', + 'g','h','i','j', 'k','l','m','n', + 'o','p','q','r', 's','t','u','v', + 'w','x','y','z', '0','1','2','3', + '4','5','6','7', '8','9','+','-' +}; +char lssproto_reversecharset[256]={ + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,62, 0,63,0,0, + 52,53,54,55, 56,57,58,59, + 60,61,0,0, 0,0,0,0, + 0,0,1,2, 3,4,5,6, + 7,8,9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, + 23,24,25,0, 0,0,0,0, + 0,26,27,28, 29,30,31,32, + 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, + 49,50,51,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0 +}; + +static void lssproto_encode64( unsigned char *in , int len , unsigned char *out ) +{ + int i; + int use_bytes; + int address = 0; + out[0] = 0; + for(i=0;;i+=3){ + unsigned char in1 , in2 , in3; + unsigned char out1 ,out2 , out3 , out4; + if( i >= len ) break; + if( i >= (len-1)){ /* the last letter ( to be thrown away ) */ + in1 = in[i] & 0xff; + in2 = in3 = 0; + use_bytes = 2; + } else if( i >= (len-2)){ /* the last 2 letters ( process only 1 byte)*/ + in1 = in[i] & 0xff; + in2 = in[i+1] & 0xff; + in3 = 0; + use_bytes = 3; + } else { /* there are more or equal than 3 letters */ + in1 = in[i] & 0xff; + in2 = in[i+1] & 0xff; + in3 = in[i+2] & 0xff; + use_bytes = 4; + } + out1 = ((in1 & 0xfc)>>2) & 0x3f; + out2 = ((in1 & 0x03)<<4) | ((( in2 & 0xf0)>>4)&0x0f); + out3 = ((in2 & 0x0f)<<2) | ((( in3 & 0xc0)>>6)&0x03); + out4 = (in3 & 0x3f ); + if( use_bytes >= 2 ){ + out[address++] = lssproto_charset[out1]; + out[address++] = lssproto_charset[out2]; + out[address]=0; + } + if( use_bytes >= 3 ){ + out[address++] = lssproto_charset[out3]; + out[address]=0; + } + if( use_bytes >= 4 ){ + out[address++] = lssproto_charset[out4]; + out[address]=0; + } + } +} +/* + * Decode it + * char *in : encoded ascii chars + * char *out : decoded( output) + * return value : output byte count + * + * note: no need to have bigger buffer. because output is to + * be smaller than input string size + */ +static int lssproto_decode64( unsigned char *in , unsigned char *out ) +{ + unsigned char in1 , in2 , in3 , in4; + unsigned char out1 , out2 , out3; + int use_bytes; + int address= 0; + int i; + for(i=0;;i+=4 ){ + if( in[i] == 0 ){ + break; + } else if( in[i+1] == 0 ){ /* the last letter */ + break; + } else if( in[i+2] == 0 ){ /* the last 2 letters */ + in1 = lssproto_reversecharset[in[i]]; + in2 = lssproto_reversecharset[in[i+1]]; + in3 = in4 = 0; + use_bytes = 1; + } else if( in[i+3] == 0 ){ /* the last 3 letters */ + in1 = lssproto_reversecharset[in[i]]; + in2 = lssproto_reversecharset[in[i+1]]; + in3 = lssproto_reversecharset[in[i+2]]; + in4 = 0; + use_bytes = 2; + } else { /* process 4 letters */ + in1 = lssproto_reversecharset[in[i]]; + in2 = lssproto_reversecharset[in[i+1]]; + in3 = lssproto_reversecharset[in[i+2]]; + in4 = lssproto_reversecharset[in[i+3]]; + use_bytes = 3; + } + out1 = (in1<<2) | (((in2 & 0x30)>>4)&0x0f) ; + out2 = ((in2 & 0x0f )<<4) | ((( in3 & 0x3c)>>2)&0x0f); + out3 = ( (in3 &0x03)<<6) | ( in4 & 0x3f ); + if( use_bytes >= 1 ){ + out[address++] = out1; + } + if( use_bytes >= 2 ){ + out[address++] = out2; + } + if( use_bytes >= 3 ){ + out[address++] = out3; + } + if( use_bytes != 3 ){ + break; + } + } + return address; +} + +/* followings are taken from Jencode.c by jun */ +static void lssproto_jEncode(char *src,int srclen,int key,char *encoded,int *encodedlen,int maxencodedlen) +{ + char sum=0; + int i; + if(srclen+1 > maxencodedlen){ + *encodedlen = maxencodedlen; + for(i=0;i<(*encodedlen);i++)encoded[i] = src[i]; + } + if(srclen+1 <= maxencodedlen){ + *encodedlen=srclen+1; + for(i=0;i i) encoded[i] = src[i] + sum*((i*i)%3); + if(abs((key%srclen)) == i) encoded[i] = sum; + if(abs((key%srclen)) < i) encoded[i] = src[i-1] + sum*((i*i)%7); + } + } +} +static void lssproto_jDecode(char *src,int srclen,int key,char *decoded,int *decodedlen) +{ + char sum=0; + int i; + *decodedlen=srclen-1; + if( *decodedlen == 0 ){ + return; /* return error if length is 0 */ + } + sum = src[abs(key%(*decodedlen))]; + for(i=0;i i) decoded[i] = src[i] - sum*((i*i)%3); + if(abs((key%(*decodedlen))) < i) decoded[i-1] = src[i] - sum*((i*i)%7); + } + for(i=0;i<(*decodedlen);i++){ + if(((key%7) == (i%5))||((key%2) == (i%2)))decoded[i] = ~decoded[i]; + } +} + +/*****************************************************************/ +/* Compress / Decompress routine */ +/*****************************************************************/ +#define B00000000 0 +#define B00000001 1 +#define B00000010 2 +#define B00000011 3 +#define B00000100 4 +#define B00000101 5 +#define B00000110 6 +#define B00000111 7 +#define B00001000 8 +#define B00001001 9 +#define B00001010 10 +#define B00001011 11 +#define B00001100 12 +#define B00001101 13 +#define B00001110 14 +#define B00001111 15 +#define B00010000 16 +#define B00010001 17 +#define B00010010 18 +#define B00010011 19 +#define B00010100 20 +#define B00010101 21 +#define B00010110 22 +#define B00010111 23 +#define B00011000 24 +#define B00011001 25 +#define B00011010 26 +#define B00011011 27 +#define B00011100 28 +#define B00011101 29 +#define B00011110 30 +#define B00011111 31 +#define B00100000 32 +#define B00100001 33 +#define B00100010 34 +#define B00100011 35 +#define B00100100 36 +#define B00100101 37 +#define B00100110 38 +#define B00100111 39 +#define B00101000 40 +#define B00101001 41 +#define B00101010 42 +#define B00101011 43 +#define B00101100 44 +#define B00101101 45 +#define B00101110 46 +#define B00101111 47 +#define B00110000 48 +#define B00110001 49 +#define B00110010 50 +#define B00110011 51 +#define B00110100 52 +#define B00110101 53 +#define B00110110 54 +#define B00110111 55 +#define B00111000 56 +#define B00111001 57 +#define B00111010 58 +#define B00111011 59 +#define B00111100 60 +#define B00111101 61 +#define B00111110 62 +#define B00111111 63 +#define B01000000 64 +#define B01000001 65 +#define B01000010 66 +#define B01000011 67 +#define B01000100 68 +#define B01000101 69 +#define B01000110 70 +#define B01000111 71 +#define B01001000 72 +#define B01001001 73 +#define B01001010 74 +#define B01001011 75 +#define B01001100 76 +#define B01001101 77 +#define B01001110 78 +#define B01001111 79 +#define B01010000 80 +#define B01010001 81 +#define B01010010 82 +#define B01010011 83 +#define B01010100 84 +#define B01010101 85 +#define B01010110 86 +#define B01010111 87 +#define B01011000 88 +#define B01011001 89 +#define B01011010 90 +#define B01011011 91 +#define B01011100 92 +#define B01011101 93 +#define B01011110 94 +#define B01011111 95 +#define B01100000 96 +#define B01100001 97 +#define B01100010 98 +#define B01100011 99 +#define B01100100 100 +#define B01100101 101 +#define B01100110 102 +#define B01100111 103 +#define B01101000 104 +#define B01101001 105 +#define B01101010 106 +#define B01101011 107 +#define B01101100 108 +#define B01101101 109 +#define B01101110 110 +#define B01101111 111 +#define B01110000 112 +#define B01110001 113 +#define B01110010 114 +#define B01110011 115 +#define B01110100 116 +#define B01110101 117 +#define B01110110 118 +#define B01110111 119 +#define B01111000 120 +#define B01111001 121 +#define B01111010 122 +#define B01111011 123 +#define B01111100 124 +#define B01111101 125 +#define B01111110 126 +#define B01111111 127 +#define B10000000 128 +#define B10000001 129 +#define B10000010 130 +#define B10000011 131 +#define B10000100 132 +#define B10000101 133 +#define B10000110 134 +#define B10000111 135 +#define B10001000 136 +#define B10001001 137 +#define B10001010 138 +#define B10001011 139 +#define B10001100 140 +#define B10001101 141 +#define B10001110 142 +#define B10001111 143 +#define B10010000 144 +#define B10010001 145 +#define B10010010 146 +#define B10010011 147 +#define B10010100 148 +#define B10010101 149 +#define B10010110 150 +#define B10010111 151 +#define B10011000 152 +#define B10011001 153 +#define B10011010 154 +#define B10011011 155 +#define B10011100 156 +#define B10011101 157 +#define B10011110 158 +#define B10011111 159 +#define B10100000 160 +#define B10100001 161 +#define B10100010 162 +#define B10100011 163 +#define B10100100 164 +#define B10100101 165 +#define B10100110 166 +#define B10100111 167 +#define B10101000 168 +#define B10101001 169 +#define B10101010 170 +#define B10101011 171 +#define B10101100 172 +#define B10101101 173 +#define B10101110 174 +#define B10101111 175 +#define B10110000 176 +#define B10110001 177 +#define B10110010 178 +#define B10110011 179 +#define B10110100 180 +#define B10110101 181 +#define B10110110 182 +#define B10110111 183 +#define B10111000 184 +#define B10111001 185 +#define B10111010 186 +#define B10111011 187 +#define B10111100 188 +#define B10111101 189 +#define B10111110 190 +#define B10111111 191 +#define B11000000 192 +#define B11000001 193 +#define B11000010 194 +#define B11000011 195 +#define B11000100 196 +#define B11000101 197 +#define B11000110 198 +#define B11000111 199 +#define B11001000 200 +#define B11001001 201 +#define B11001010 202 +#define B11001011 203 +#define B11001100 204 +#define B11001101 205 +#define B11001110 206 +#define B11001111 207 +#define B11010000 208 +#define B11010001 209 +#define B11010010 210 +#define B11010011 211 +#define B11010100 212 +#define B11010101 213 +#define B11010110 214 +#define B11010111 215 +#define B11011000 216 +#define B11011001 217 +#define B11011010 218 +#define B11011011 219 +#define B11011100 220 +#define B11011101 221 +#define B11011110 222 +#define B11011111 223 +#define B11100000 224 +#define B11100001 225 +#define B11100010 226 +#define B11100011 227 +#define B11100100 228 +#define B11100101 229 +#define B11100110 230 +#define B11100111 231 +#define B11101000 232 +#define B11101001 233 +#define B11101010 234 +#define B11101011 235 +#define B11101100 236 +#define B11101101 237 +#define B11101110 238 +#define B11101111 239 +#define B11110000 240 +#define B11110001 241 +#define B11110010 242 +#define B11110011 243 +#define B11110100 244 +#define B11110101 245 +#define B11110110 246 +#define B11110111 247 +#define B11111000 248 +#define B11111001 249 +#define B11111010 250 +#define B11111011 251 +#define B11111100 252 +#define B11111101 253 +#define B11111110 254 +#define B11111111 255 +/* masks for first byte ( write )*/ +int lssproto_modifymask_first[8][9]={ + {0, B00000001,B00000011,B00000111,B00001111,B00011111,B00111111,B01111111,B11111111},/* mod 0*/ + {0, B00000011,B00000111,B00001111,B00011111,B00111111,B01111111,B11111111,B11111111},/* mod 1*/ + {0, B00000111,B00001111,B00011111,B00111111,B01111111,B11111111,B11111111,B11111111},/* mod 2*/ + {0, B00001111,B00011111,B00111111,B01111111,B11111111,B11111111,B11111111,B11111111},/* mod 3*/ + {0, B00011111,B00111111,B01111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 4*/ + {0, B00111111,B01111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 5*/ + {0, B01111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 6*/ + {0, B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 7*/ +}; +/* masks for second byte ( write ) */ +int lssproto_modifymask_second[8][9]={ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000},/* mod 0 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001},/* mod 1 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000011},/* mod 2 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000011,B00000111},/* mod 3 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000001,B00000011,B00000111,B00001111},/* mod 4 */ + {0, B00000000,B00000000,B00000000,B00000001,B00000011,B00000111,B00001111,B00011111},/* mod 5 */ + {0, B00000000,B00000000,B00000001,B00000011,B00000111,B00001111,B00011111,B00111111},/* mod 6 */ + {0, B00000000,B00000001,B00000011,B00000111,B00001111,B00011111,B00111111,B01111111},/* mod 7 */ +}; +/* + * used by bitstream routines + */ +int bitstream_maxbyte, bitstream_bitaddr ; +char *bitstream_buf; +/* initialize bitstream for output */ +static int initOutputBitStream( char *buf ,int buflen) +{ + bitstream_bitaddr = 0; + bitstream_maxbyte = buflen; + bitstream_buf = buf; + memset( buf,0, buflen); + return 0; +} +/* initialize bitstream for input */ +static int initInputBitStream( char *buf , int buflen) +{ + bitstream_bitaddr = 0; + bitstream_maxbyte = buflen; + bitstream_buf = buf; + return 0; +} +/* + * read from bit stream. used only from 1 bit to 8 bits + * this is a base routine + */ +static unsigned int readInputBitStreamBody( int bwidth ) +{ + int mod = bitstream_bitaddr % 8; + int byteaddr = bitstream_bitaddr / 8; + /* return if excess */ + if( byteaddr >= bitstream_maxbyte)return 0; + if( bwidth >= 1 && bwidth <= 8){ + int b1 = (( bitstream_buf[byteaddr] & lssproto_modifymask_first[mod][bwidth] )>>mod); + int b2 = (( bitstream_buf[byteaddr+1] & lssproto_modifymask_second[mod][bwidth])<<(8-mod)); + bitstream_bitaddr += bwidth; + return b1 | b2; + } else { + return 0; + } +} +/* + * read from bit stream. used from 1 bit to 32 bits + * + */ +static unsigned int readInputBitStream( int bwidth ) +{ + if( bwidth <= 0 ){ + return 0; + } else if( bwidth >= 1 && bwidth <= 8 ){ + return readInputBitStreamBody( bwidth ); + } else if( bwidth >= 9 && bwidth <= 16 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody( bwidth-8); + return first + (second << 8 ); + } else if( bwidth >= 17 && bwidth <= 24 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody(8); + unsigned int third = readInputBitStreamBody(bwidth-8); + return first + ( second << 8 ) + ( third << 16 ); + } else if( bwidth >= 25 && bwidth <= 32 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody(8); + unsigned int third = readInputBitStreamBody(8); + unsigned int forth = readInputBitStreamBody(bwidth-8); + return first + ( second << 8 ) + ( third << 16 ) + ( forth << 24 ); + } + return 0; +} +/* + * write to a bitstream. only used from 1 bit to 8 bits + * this is a base routine. + */ +static int writeOutputBitStreamBody( int bwidth , unsigned char b) +{ + int mod = bitstream_bitaddr % 8; + int byteaddr = bitstream_bitaddr / 8; + /* return error if excess */ + if( bitstream_maxbyte <= (byteaddr+1)) return -1; + bitstream_buf[byteaddr] &= lssproto_modifymask_first[mod][bwidth]; + bitstream_buf[byteaddr] |= (b << mod) & lssproto_modifymask_first[mod][bwidth]; + bitstream_buf[byteaddr+1] &= lssproto_modifymask_second[mod][bwidth]; + bitstream_buf[byteaddr+1] |= (b>>(8-mod))& lssproto_modifymask_second[mod][bwidth]; + bitstream_bitaddr += bwidth; + return byteaddr+1; +} +/* + * write to a bitstream. used from 1 bits to 32 bits + * returns -1 if error or buffer excession + */ +static int writeOutputBitStream( int bwidth, unsigned int dat) +{ + int ret; + if( bwidth <= 0){ + return -1; + } else if( bwidth >= 1 && bwidth <= 8 ){ + if((ret=writeOutputBitStreamBody( bwidth , (unsigned char)dat))<0)return -1; + } else if( bwidth > 8 && bwidth <= 16 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth - 8 , ( unsigned char)((dat>>8)&0xff)))<0)return -1; + } else if( bwidth > 16 && bwidth <= 24 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>8)&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth-16,(unsigned char)((dat>>16)&0xff)))<0)return -1; + } else if( bwidth > 24 && bwidth <= 32 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>8)&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>16)&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth-24,(unsigned char)((dat>>24)&0xff)))<0)return -1; + } else { + return -1; + } + return ret; +} +#define CHAR_SIZE 256 +#define NODE_SIZE 512 +#define BITS_LEN 9 /* 9 bit lzw compression */ +typedef struct { + unsigned char chr; + int parent; + int brother; + int child; +}NODE; +long lssproto_ringoCompressor( unsigned char *code , long codelen , + unsigned char *text , long textlen) +{ + NODE node[NODE_SIZE]; + int freeNode; + int w,k; /* used in this algo */ + int textind; /* index to text buffer */ + int i; + int position = 0; /* indicates the last byte of code buffer */ + if( textlen <= 0 ) return -1; + initOutputBitStream((char*) code,codelen); + /* fill characters ( 0 ~ 255 ) in the beggining part of + Node list */ + for(i=0; i<= CHAR_SIZE; i++){ + node[i].chr = (unsigned char)i; + node[i].brother = i + 1; + node[i].parent = 0; + node[i].child = 0; + } + node[CHAR_SIZE].brother = 0; + freeNode = CHAR_SIZE + 1; + w = text[0]; + textind = 1; + while(1){ + int rv; + if( textind >= textlen ){ + k = CHAR_SIZE; /* indicates EOF */ + } else { + k = text[textind]; + } + /* search if pattern 'wk' is registered or not. */ + rv = node[w].child; + while(1){ + if( rv <= 0 ) break; + if( node[rv].chr == k ) break; + rv = node[rv].brother; + } + if( rv > 0 ){ + /* found it */ + w = rv; + } else { + position = writeOutputBitStream( BITS_LEN ,w ); + /* return if buffer excession */ + if( position > codelen ) return -1; + /* register pattern 'wk' in the dictionary */ + if( freeNode < NODE_SIZE ){ + node[freeNode].parent = w; + node[freeNode].chr = k; + node[freeNode].brother = node[w].child; + node[freeNode].child = 0; + node[w].child = freeNode; + freeNode++; + } + w = k; + } + if( textind == ( textlen + 1 ) ) break; + textind++; + } + return position; +} + +/* + * Decoder. + * return -1 if buffer excession. Notice buffer text + * is modified . + */ +long lssproto_ringoDecompressor( unsigned char *text , long textlen , + unsigned char *code , long codelen) +{ + NODE node[NODE_SIZE]; + int stack[NODE_SIZE]; + int sp; + int freeNode; + int len; + int i; + int k = 0; + int w = 0; + if( codelen <= 0 ) return -1; + initInputBitStream( (char*)code , codelen ); + for(i=0;i= freeNode ){ + stack[sp++] = k; /* exception */ + if( sp >=( sizeof( stack ) /sizeof(stack[0] )) )return -1; + k = w; + } else { + k = rv; + } + while(k> CHAR_SIZE ){ + if( k >= (sizeof(node)/sizeof(node[0]))) return -1; + stack[sp++] = node[k].chr; + k = node[k].parent; + if( sp >=( sizeof( stack ) /sizeof(stack[0] )) ) return -1; + } + stack[sp++] = k; + if( sp >= ( sizeof( stack ) /sizeof(stack[0] )) ) return -1; + /* output to text buffer from stack.*/ + while(sp){ + if( ++len > textlen ) return -1; + *text++ = stack[--sp]; + } + /* register the pattern 'wk'*/ + if( len > 1 && freeNode < NODE_SIZE ){ + node[freeNode].parent = w; + node[freeNode].chr = k; + if( w >= (sizeof(node)/sizeof(node[0])))return -1; + node[freeNode].brother = node[w].child; + node[freeNode].child = 0; + node[w].child = freeNode; + freeNode++; + } + w = rv; + } + return len; +} +#endif /* ifdef lssproto__ENCRYPT */ + +/* Convert 62-base digits to 10 digits */ +int lssproto_a62toi( char *a ) +{ + int ret = 0; + int minus ; + if( a[0] == '-' ){ + minus = -1; + a++; + } else { + minus = 1; + } + + while( *a != '\0' ) + { + ret *= 62; + if( '0' <= (*a) && (*a) <= '9' ) + ret += (*a)-'0'; + else + if( 'a' <= (*a) && (*a) <= 'z' ) + ret += (*a)-'a'+10; + else + if( 'A' <= (*a) && (*a) <= 'Z' ) + ret += (*a)-'A'+36; + else + return 0; + a++; + } + return ret * minus; +} + +/* Convert 10-base digits into 62-base digits. */ +char *lssproto_cnv10to62( int a, char *out, int outlen ) +{ + int i, j; + char base[] = { "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + int tmp[64]; + int src; + int minus; + int baselen = sizeof( base)-1; + if( a < 0 ){ + minus = 1; + a *= -1; + } else { + minus = 0; + } + /* special case */ + if( a < baselen) { + if( minus ){ + *(out) = '-'; + *(out+1) = base[a]; + *(out+2) = '\0'; + return (out); + } else { + *out = base[a]; + *(out+1) = '\0'; + return( out); + } + } + src = a; + for( i = 0; src >= baselen; i ++ ) { + tmp[i] = src % baselen; + src /= baselen; + } + i--; + if( minus ){ + *out = '-'; + *(out+1) = base[src]; + for( j = 2; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } else { + *out = base[src]; + for( j = 1; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } + *(out+j) = '\0'; + return( out); +} diff --git a/lua/Makefile b/lua/Makefile new file mode 100644 index 0000000..f3d644d --- /dev/null +++ b/lua/Makefile @@ -0,0 +1,184 @@ +# makefile for building Lua +# see ../INSTALL for installation instructions +# see ../Makefile and luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +INCFLAGS=-Iinclude + +CC= gcc +CFLAGS= -O3 -w -pipe $(INCFLAGS) $(MYCFLAGS) +AR= ar rcu +RANLIB= ranlib +RM= rm -f +LIBS= -lm $(MYLIBS) + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ + lstrlib.o loadlib.o linit.o + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o print.o + +ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(CORE_O) $(LIB_O) + $(AR) $@ $? + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c print.c + +echo: + @echo "PLAT = $(PLAT)" + @echo "CC = $(CC)" + @echo "CFLAGS = $(CFLAGS)" + @echo "AR = $(AR)" + @echo "RANLIB = $(RANLIB)" + @echo "RM = $(RM)" + @echo "MYCFLAGS = $(MYCFLAGS)" + @echo "MYLDFLAGS = $(MYLDFLAGS)" + @echo "MYLIBS = $(MYLIBS)" + +# convenience targets for popular platforms + +none: + @echo "Please choose a platform:" + @echo " $(PLATS)" + +aix: + $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" + +ansi: + $(MAKE) all MYCFLAGS=-DLUA_ANSI + +bsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" + +freebsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" + +generic: + $(MAKE) all MYCFLAGS= + +linux: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" + +macosx: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" +# use this on Mac OS X 10.3- +# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX + +mingw: + $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX + +solaris: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ + lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ + lundump.h lvm.h +lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ + ltable.h +ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ + llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ + ltable.h lundump.h lvm.h +ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ + lstate.h ltm.h lzio.h +lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h +lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h +loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h +lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h +lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ + ltm.h lzio.h lstring.h lgc.h +lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h +ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ + lmem.h lstring.h lgc.h ltable.h +lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ + lundump.h +lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h +lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h +lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ + lzio.h +print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h lopcodes.h lundump.h + +# (end of Makefile) diff --git a/lua/ReadMe.txt b/lua/ReadMe.txt new file mode 100644 index 0000000..8a04ce9 --- /dev/null +++ b/lua/ReadMe.txt @@ -0,0 +1,25 @@ +======================================================================== + 静态库:lua 项目概述 +======================================================================== + +应用程序向导已为您创建了此 lua 库项目。 + +本文件概要介绍组成 lua 应用程序的每个文件的内容。 + + +lua.vcproj + 这是使用应用程序向导生成的 VC++ 项目的主项目文件, + 其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 + + +///////////////////////////////////////////////////////////////////////////// + +StdAfx.h, StdAfx.cpp + 这些文件用于生成名为 lua.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 + +///////////////////////////////////////////////////////////////////////////// +其他注释: + +应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 + +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/lua/lapi.c b/lua/lapi.c new file mode 100644 index 0000000..84113dd --- /dev/null +++ b/lua/lapi.c @@ -0,0 +1,1100 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + + +LUA_API void Lua_ReturnArray(lua_State *L,int Array[],int num) +{ + lua_newtable( L ); + int i; + for (i=0;i +#include +#include +#include +#include +#include + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; ifunc, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/lua/lauxlib.h b/lua/lauxlib.h new file mode 100644 index 0000000..3425823 --- /dev/null +++ b/lua/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/lua/lbaselib.c b/lua/lbaselib.c new file mode 100644 index 0000000..2a4c079 --- /dev/null +++ b/lua/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include +#include +#include +#include + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/lua/lcode.c b/lua/lcode.c new file mode 100644 index 0000000..cff626b --- /dev/null +++ b/lua/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/lua/lcode.h b/lua/lcode.h new file mode 100644 index 0000000..b941c60 --- /dev/null +++ b/lua/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/lua/ldblib.c b/lua/ldblib.c new file mode 100644 index 0000000..67de122 --- /dev/null +++ b/lua/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/lua/ldebug.c b/lua/ldebug.c new file mode 100644 index 0000000..50ad3d3 --- /dev/null +++ b/lua/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; il.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/lua/ldebug.h b/lua/ldebug.h new file mode 100644 index 0000000..ba28a97 --- /dev/null +++ b/lua/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/lua/ldo.c b/lua/ldo.c new file mode 100644 index 0000000..a8b6ca4 --- /dev/null +++ b/lua/ldo.c @@ -0,0 +1,527 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; itop - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; itop++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +#ifdef _JZ_LUA_CODE +LUA_API int lua_setconstlist(lua_State *L, lua_const *constlist) +{ + L->constlist = constlist; + return 0; +} +#endif + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/lua/ldo.h b/lua/ldo.h new file mode 100644 index 0000000..98fddac --- /dev/null +++ b/lua/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/lua/ldump.c b/lua/ldump.c new file mode 100644 index 0000000..c9d3d48 --- /dev/null +++ b/lua/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; ik[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; ip[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; ilocvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; iupvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/lua/lfunc.c b/lua/lfunc.c new file mode 100644 index 0000000..813e88f --- /dev/null +++ b/lua/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/lua/lfunc.h b/lua/lfunc.h new file mode 100644 index 0000000..a68cf51 --- /dev/null +++ b/lua/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/lua/lgc.c b/lua/lgc.c new file mode 100644 index 0000000..d9e0b78 --- /dev/null +++ b/lua/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; isizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; isizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; isizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; isizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; ic.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; il.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; imt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/lua/lgc.h b/lua/lgc.h new file mode 100644 index 0000000..5a8dc60 --- /dev/null +++ b/lua/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/lua/linit.c b/lua/linit.c new file mode 100644 index 0000000..16c72ac --- /dev/null +++ b/lua/linit.c @@ -0,0 +1,37 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} diff --git a/lua/liolib.c b/lua/liolib.c new file mode 100644 index 0000000..e79ed1c --- /dev/null +++ b/lua/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/lua/llex.c b/lua/llex.c new file mode 100644 index 0000000..1cb43ae --- /dev/null +++ b/lua/llex.c @@ -0,0 +1,486 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "", "", "", "", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + struct lconv *cv = localeconv(); + char old = ls->decpoint; + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } +#ifdef _JZ_LUA_CODE + case '%': { + lua_const *tm_constlist = ls->L->constlist; + unsigned int i = 0; + if(tm_constlist != NULL) + { + while(tm_constlist->name != NULL) + { + if(tm_constlist->size < ls->z->n) + { + if(memcmp(ls->z->p, tm_constlist->name, tm_constlist->size - 1) == 0) + { + for(i = 0; i < tm_constlist->size; i++) + { + save_and_next(ls); + } + seminfo->r = tm_constlist->vl; + return TK_NUMBER; + } + } + tm_constlist++; + } + } + } +#endif + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/lua/llex.h b/lua/llex.h new file mode 100644 index 0000000..a9201ce --- /dev/null +++ b/lua/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/lua/llimits.h b/lua/llimits.h new file mode 100644 index 0000000..ca8dcb7 --- /dev/null +++ b/lua/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/lua/lmathlib.c b/lua/lmathlib.c new file mode 100644 index 0000000..441fbf7 --- /dev/null +++ b/lua/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include +#include + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/lua/lmem.c b/lua/lmem.c new file mode 100644 index 0000000..ae7d8c9 --- /dev/null +++ b/lua/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/lua/lmem.h b/lua/lmem.h new file mode 100644 index 0000000..7c2dcb3 --- /dev/null +++ b/lua/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/lua/loadlib.c b/lua/loadlib.c new file mode 100644 index 0000000..0d401eb --- /dev/null +++ b/lua/loadlib.c @@ -0,0 +1,666 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include +#include + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/lua/lobject.c b/lua/lobject.c new file mode 100644 index 0000000..4ff5073 --- /dev/null +++ b/lua/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include +#include + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/lua/lobject.h b/lua/lobject.h new file mode 100644 index 0000000..f1e447e --- /dev/null +++ b/lua/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/lua/lopcodes.c b/lua/lopcodes.c new file mode 100644 index 0000000..4cc7452 --- /dev/null +++ b/lua/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/lua/lopcodes.h b/lua/lopcodes.h new file mode 100644 index 0000000..41224d6 --- /dev/null +++ b/lua/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)< C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) =) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/lua/loslib.c b/lua/loslib.c new file mode 100644 index 0000000..da06a57 --- /dev/null +++ b/lua/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/lua/lparser.c b/lua/lparser.c new file mode 100644 index 0000000..1e2a9a8 --- /dev/null +++ b/lua/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; inups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; if->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/lua/lparser.h b/lua/lparser.h new file mode 100644 index 0000000..18836af --- /dev/null +++ b/lua/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/lua/lstate.c b/lua/lstate.c new file mode 100644 index 0000000..fcb9d90 --- /dev/null +++ b/lua/lstate.c @@ -0,0 +1,217 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; +#ifdef _JZ_LUA_CODE + L->constlist = NULL; +#endif + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; imt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/lua/lstate.h b/lua/lstate.h new file mode 100644 index 0000000..13281ca --- /dev/null +++ b/lua/lstate.h @@ -0,0 +1,172 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +#ifdef _JZ_LUA_CODE + lua_const *constlist; +#endif +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/lua/lstring.c b/lua/lstring.c new file mode 100644 index 0000000..4911315 --- /dev/null +++ b/lua/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; isize; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/lua/lstring.h b/lua/lstring.h new file mode 100644 index 0000000..73a2ff8 --- /dev/null +++ b/lua/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/lua/lstrlib.c b/lua/lstrlib.c new file mode 100644 index 0000000..1b4763d --- /dev/null +++ b/lua/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (ssrc_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = ssrc_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/lua/ltable.c b/lua/ltable.c new file mode 100644 index 0000000..ec84f4f --- /dev/null +++ b/lua/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; ilsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/lua/ltable.h b/lua/ltable.h new file mode 100644 index 0000000..f5b9d5e --- /dev/null +++ b/lua/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/lua/ltablib.c b/lua/ltablib.c new file mode 100644 index 0000000..b6d9cb4 --- /dev/null +++ b/lua/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/lua/ltm.h b/lua/ltm.h new file mode 100644 index 0000000..64343b7 --- /dev/null +++ b/lua/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/lua/lua.c b/lua/lua.c new file mode 100644 index 0000000..3a46609 --- /dev/null +++ b/lua/lua.c @@ -0,0 +1,392 @@ +/* +** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lua_c + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (void) { + fprintf(stderr, + "usage: %s [options] [script [args]].\n" + "Available options are:\n" + " -e stat execute string " LUA_QL("stat") "\n" + " -l name require library " LUA_QL("name") "\n" + " -i enter interactive mode after executing " LUA_QL("script") "\n" + " -v show version information\n" + " -- stop handling options\n" + " - execute stdin and stop handling options\n" + , + progname); + fflush(stderr); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +static void print_version (void) { + l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); +} + + +static int getargs (lua_State *L, char **argv, int n) { + int narg; + int i; + int argc = 0; + while (argv[argc]) argc++; /* count total number of arguments */ + narg = argc - (n + 1); /* number of arguments to the script */ + luaL_checkstack(L, narg + 3, "too many arguments to script"); + for (i=n+1; i < argc; i++) + lua_pushstring(L, argv[i]); + lua_createtable(L, narg, n + 1); + for (i=0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - n); + } + return narg; +} + + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dolibrary (lua_State *L, const char *name) { + lua_getglobal(L, "require"); + lua_pushstring(L, name); + return report(L, docall(L, 1, 1)); +} + + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); + if (strstr(msg, LUA_QL("")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} + + +static int handle_script (lua_State *L, char **argv, int n) { + int status; + const char *fname; + int narg = getargs(L, argv, n); /* collect arguments */ + lua_setglobal(L, "arg"); + fname = argv[n]; + if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + lua_insert(L, -(narg+1)); + if (status == 0) + status = docall(L, narg, 0); + else + lua_pop(L, narg); + return report(L, status); +} + + +/* check that argument has no extra characters at the end */ +#define notail(x) {if ((x)[2] != '\0') return -1;} + + +static int collectargs (char **argv, int *pi, int *pv, int *pe) { + int i; + for (i = 1; argv[i] != NULL; i++) { + if (argv[i][0] != '-') /* not an option? */ + return i; + switch (argv[i][1]) { /* option */ + case '-': + notail(argv[i]); + return (argv[i+1] != NULL ? i+1 : 0); + case '\0': + return i; + case 'i': + notail(argv[i]); + *pi = 1; /* go through */ + case 'v': + notail(argv[i]); + *pv = 1; + break; + case 'e': + *pe = 1; /* go through */ + case 'l': + if (argv[i][2] == '\0') { + i++; + if (argv[i] == NULL) return -1; + } + break; + default: return -1; /* invalid option */ + } + } + return 0; +} + + +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + if (argv[i] == NULL) continue; + lua_assert(argv[i][0] == '-'); + switch (argv[i][1]) { /* option */ + case 'e': { + const char *chunk = argv[i] + 2; + if (*chunk == '\0') chunk = argv[++i]; + lua_assert(chunk != NULL); + if (dostring(L, chunk, "=(command line)") != 0) + return 1; + break; + } + case 'l': { + const char *filename = argv[i] + 2; + if (*filename == '\0') filename = argv[++i]; + lua_assert(filename != NULL); + if (dolibrary(L, filename)) + return 1; /* stop if file fails */ + break; + } + default: break; + } + } + return 0; +} + + +static int handle_luainit (lua_State *L) { + const char *init = getenv(LUA_INIT); + if (init == NULL) return 0; /* status OK */ + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, "=" LUA_INIT); +} + + +struct Smain { + int argc; + char **argv; + int status; +}; + + +static int pmain (lua_State *L) { + struct Smain *s = (struct Smain *)lua_touserdata(L, 1); + char **argv = s->argv; + int script; + int has_i = 0, has_v = 0, has_e = 0; + globalL = L; + if (argv[0] && argv[0][0]) progname = argv[0]; + lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(L); /* open libraries */ + lua_gc(L, LUA_GCRESTART, 0); + s->status = handle_luainit(L); + if (s->status != 0) return 0; + script = collectargs(argv, &has_i, &has_v, &has_e); + if (script < 0) { /* invalid args? */ + print_usage(); + s->status = 1; + return 0; + } + if (has_v) print_version(); + s->status = runargs(L, argv, (script > 0) ? script : s->argc); + if (s->status != 0) return 0; + if (script) + s->status = handle_script(L, argv, script); + if (s->status != 0) return 0; + if (has_i) + dotty(L); + else if (script == 0 && !has_e && !has_v) { + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } + else dofile(L, NULL); /* executes stdin as a file */ + } + return 0; +} + + +int main (int argc, char **argv) { + int status; + struct Smain s; + lua_State *L = lua_open(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + s.argc = argc; + s.argv = argv; + status = lua_cpcall(L, &pmain, &s); + report(L, status); + lua_close(L); + return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; +} + diff --git a/lua/lua.h b/lua/lua.h new file mode 100644 index 0000000..1cc26e9 --- /dev/null +++ b/lua/lua.h @@ -0,0 +1,398 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + +#define _JZ_LUA_CODE +#ifdef _JZ_LUA_CODE +typedef struct __lua_const { + const char *name; + unsigned int size; + int vl; +}lua_const; + +LUA_API int lua_setconstlist(lua_State *L, lua_const *constlist); +#endif + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/lua/luac.c b/lua/luac.c new file mode 100644 index 0000000..d070173 --- /dev/null +++ b/lua/luac.c @@ -0,0 +1,200 @@ +/* +** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $ +** Lua compiler (saves bytecodes to files; also list bytecodes) +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include + +#define luac_c +#define LUA_CORE + +#include "lua.h" +#include "lauxlib.h" + +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstring.h" +#include "lundump.h" + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames].\n" + "Available options are:\n" + " - process stdin\n" + " -l list\n" + " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n", + progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop+(i))->l.p) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + int i,pc; + Proto* f=luaF_newproto(L); + setptvalue2s(L,L->top,f); incr_top(L); + f->source=luaS_newliteral(L,"=(" PROGNAME ")"); + f->maxstacksize=1; + pc=2*n+1; + f->code=luaM_newvector(L,pc,Instruction); + f->sizecode=pc; + f->p=luaM_newvector(L,n,Proto*); + f->sizep=n; + pc=0; + for (i=0; ip[i]=toproto(L,i-n-1); + f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i); + f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1); + } + f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0); + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +struct Smain { + int argc; + char** argv; +}; + +static int pmain(lua_State* L) +{ + struct Smain* s = (struct Smain*)lua_touserdata(L, 1); + int argc=s->argc; + char** argv=s->argv; + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + struct Smain s; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=lua_open(); + if (L==NULL) fatal("not enough memory for state"); + s.argc=argc; + s.argv=argv; + if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} diff --git a/lua/luaconf.h b/lua/luaconf.h new file mode 100644 index 0000000..e2cb261 --- /dev/null +++ b/lua/luaconf.h @@ -0,0 +1,763 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include +#include + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include +#include +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/lua/lualib.h b/lua/lualib.h new file mode 100644 index 0000000..469417f --- /dev/null +++ b/lua/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/lua/lundump.c b/lua/lundump.c new file mode 100644 index 0000000..8010a45 --- /dev/null +++ b/lua/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; ik[i]); + for (i=0; ik[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; ip[i]=NULL; + for (i=0; ip[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; + for (i=0; ilocvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; + for (i=0; iupvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/lua/lundump.h b/lua/lundump.h new file mode 100644 index 0000000..c80189d --- /dev/null +++ b/lua/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/lua/lvm.c b/lua/lvm.c new file mode 100644 index 0000000..ee3256a --- /dev/null +++ b/lua/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/lua/lvm.h b/lua/lvm.h new file mode 100644 index 0000000..bfe4f56 --- /dev/null +++ b/lua/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/lua/lzio.c b/lua/lzio.c new file mode 100644 index 0000000..293edd5 --- /dev/null +++ b/lua/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/lua/lzio.h b/lua/lzio.h new file mode 100644 index 0000000..51d695d --- /dev/null +++ b/lua/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/lua/print.c b/lua/print.c new file mode 100644 index 0000000..e240cfc --- /dev/null +++ b/lua/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; iupvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; ip[i],full); +} diff --git a/lua/stdafx.cpp b/lua/stdafx.cpp new file mode 100644 index 0000000..e9688b2 --- /dev/null +++ b/lua/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : ֻ׼ļԴļ +// lua.pch ΪԤͷ +// stdafx.obj ԤϢ + +#include "stdafx.h" + +// TODO: STDAFX.H +// κĸͷļڴļ diff --git a/lua/stdafx.h b/lua/stdafx.h new file mode 100644 index 0000000..a767d59 --- /dev/null +++ b/lua/stdafx.h @@ -0,0 +1,14 @@ +// stdafx.h : ׼ϵͳļİļ +// Ǿʹõĵ +// ضĿİļ +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Windows ͷųʹõ + + + +// TODO: ڴ˴óҪͷļ diff --git a/lua/targetver.h b/lua/targetver.h new file mode 100644 index 0000000..91794a5 --- /dev/null +++ b/lua/targetver.h @@ -0,0 +1,13 @@ +#pragma once + +// º궨Ҫƽ̨Ҫƽ̨ +// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ +// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ +// + +// ҪԵָ汾ƽ̨޸ж塣 +// йزͬƽ̨ӦֵϢο MSDN +#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista +#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 +#endif + diff --git a/magic/magic.c b/magic/magic.c new file mode 100644 index 0000000..9d11a35 --- /dev/null +++ b/magic/magic.c @@ -0,0 +1,906 @@ +#include "version.h" +#include +#include + +#include "common.h" +#include "char_base.h" +#include "char_data.h" +#include "item.h" +#include "battle.h" +#include "magic_base.h" +#include "magic.h" +#include "magic_field.h" +#include "family.h" +#include "handletime.h" +#include "battle_magic.h" +#include "battle_event.h" +#include"lssproto_serv.h" +#ifdef _ITEM_ATTSKILLMAGIC +#include "pet_skill.h" +#endif +//#include "battle_event.h" +// shan add code +#define MP_RATE 0.7 + +int MAGIC_Use( int charaindex, int haveitemindex, int toindex) +{ + int itemindex; + int magicid,marray,mp; + int ret; + MAGIC_CALLFUNC func; + + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) ) return FALSE; + magicid = ITEM_getInt( itemindex, ITEM_MAGICID); + marray = MAGIC_getMagicArray( magicid); + if( marray == -1 ) return FALSE; + + func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME));//MAGIC_NAME + if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP)) < 0 ){ + print("err mp:%d -%s-%d\n", mp, ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) ); + + } + + if(CHAR_getInt(charaindex,CHAR_LV)<100 && CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)<1){ //CFָ0ת100֮ǰ + char magictmpbuf[32]; + sprintf(magictmpbuf,",%d,",ITEM_getInt( itemindex, ITEM_MAGICID)); + if(strstr(getNoMpMagic(),magictmpbuf)!=NULL){ + mp = 0; + } + } + + // shan add begin + if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){ + // ⾫ + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){ + + // if( (marray >=0 && marray <=121) || (marray >= 190 && marray <=300 )){ + mp *= atof(getFmMagicMpRate(0)); + //printf("\n⵽壡mp=%d",mp); + + // } + //if(strstr(MAGIC_getChar( marray, MAGIC_COMMENT),"[]")!=NULL){ + //mp *= atof(getFmMagicMpRate(0)); + // } + + } + // + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){ + // if( (marray >=130 && marray <=189) || (marray >= 300 && marray <=500 )){ + mp *= atof(getFmMagicMpRate(1)); + // printf("\n⵽ڰ壡mp=%d",mp); + // } + // if(strstr(MAGIC_getChar( marray, MAGIC_COMMENT),"[]")!=NULL){ + // mp *= atof(getFmMagicMpRate(1)); + // } + } + } + // shan end + if( func ) { + ret = func( charaindex, toindex, marray, mp ); + }else { + ret = FALSE; + } + return ret; +} + +int MAGIC_GetArrayNo( int charaindex, int haveitemindex) +{ + int itemindex; + int magicid; + itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if( !ITEM_CHECKINDEX( itemindex) ) return FALSE; + + magicid = ITEM_getInt( itemindex, ITEM_MAGICID); + + return magicid; +} +int MAGIC_DirectUse( + int charaindex, + int magicid, + int toindex, + int itemnum +) +{ + MAGIC_CALLFUNC func; + int mp=0, ret, marray=0; + int itemindex=-1; +#ifdef _MAGIC_NOCAST//Ĭ״̬޷ʩ + if( CHAR_getWorkInt( charaindex, CHAR_WORKNOCAST ) > 0 ){ + CHAR_talkToCli(charaindex, -1, "Ĭ޷", CHAR_COLORYELLOW); + return FALSE; + } +#endif +#ifdef _NO_MAGIC + int nomagicmap = CHAR_getInt(charaindex,CHAR_FLOOR); + int max; + for( max = 0 ; max < 30 ; max++){ + if (nomagicmap == getnomagicmap(max)){ + CHAR_talkToCli(charaindex, -1, "޷ʹκξ", CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + itemindex = CHAR_getItemIndex( charaindex, itemnum); + if( !ITEM_CHECKINDEX( itemindex) ){ + //print("ANDY err MAGIC_DirectUse() itemindex:%d !\n", itemindex); + return FALSE; + } + }else{ + itemindex = itemnum; + } + marray = MAGIC_getMagicArray( magicid ); + func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME ) ); + if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP )) < 0 ){ + //return FALSE; + } + // shan add begin + if(CHAR_getInt(charaindex,CHAR_LV)<100 && CHAR_getInt(charaindex,CHAR_TRANSMIGRATION)<1){ //CFָ0ת100֮ǰ + char magictmpbuf[32]; + sprintf(magictmpbuf,",%d,",ITEM_getInt( itemindex, ITEM_MAGICID)); + //print("\nid=%s\n",magictmpbuf); + if(strstr(getNoMpMagic(),magictmpbuf)!=NULL){ + mp = 0; + } + } + if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){ + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){ + mp *= atof(getFmMagicMpRate(0)); + } + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){ + mp *= atof(getFmMagicMpRate(1)); + } + } + /* + if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){ + // ⾫ + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){ + //if( (marray >=0 && marray <=31) ){ + //mp *= MP_RATE; + // } + if(strstr(MAGIC_getChar( marray, MAGIC_COMMENT),"[]")!=NULL){ + mp *= atof(getFmMagicMpRate(0)); + } + } + // + if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){ + //if( marray >=32 && marray <=81 ){ + //mp *= MP_RATE; + // } + if(strstr(MAGIC_getChar( marray, MAGIC_COMMENT),"[]")!=NULL){ + mp *= atof(getFmMagicMpRate(1)); + } + } + } + */ + if( func ) { + ret = func( charaindex, toindex, marray, mp ); + } + else { + ret = FALSE; + } + return ret; +} + +int MAGIC_Recovery( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + if( IsBATTLING( charaindex ) == TRUE ){ +#ifdef _PREVENT_TEAMATTACK //ݲ ʹõз + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + + if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ){//ͬ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "ݾ..ʩҵз", CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + if (toindex==22){print("jinchao err\n");return FALSE;} // shan(ȫʹħbug)޸jinchao+2001/12/07 + MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); + }else{ + if( CHAR_CHECKINDEX( toindex ) == FALSE )return FALSE; // shan(ȫʹħbug)޸jinchao+2001/12/07 + MAGIC_Recovery_Field( charaindex, marray); + } + + return TRUE; +} + +int MAGIC_OtherRecovery( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + if( IsBATTLING( charaindex ) == TRUE ){ +#ifdef _PREVENT_TEAMATTACK // ʹõз + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ){//ͬ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "..ʩҵз", CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); + }else{ + if( CHAR_CHECKINDEX( toindex ) == FALSE )return FALSE; // + MAGIC_OtherRecovery_Field( charaindex, toindex, marray); + } + return TRUE; +} + +// ūë ܷ +int MAGIC_FieldAttChange( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + // ܷ ɧ ƻ УѨ̹ϵئ³練 + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + // + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_FieldAttChange_Battle( charaindex, toindex, marray, mp ); + }else{ + // ƥئ + return FALSE; + } +} +int MAGIC_StatusChange( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); + if( IsBATTLING( charaindex ) == TRUE ){ +#ifdef _PREVENT_TEAMATTACK //쳣״̬ʹѷ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER && + BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ){ + if( BATTLE_CheckSameSide( charaindex, toindex) == 1 ){//ͬ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "쳣״̬..ʩѷ", CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + return MAGIC_StatusChange_Battle( charaindex, toindex, marray, mp ); + }else{ + return FALSE; + } +} + +#ifdef _OTHER_MAGICSTAUTS +int MAGIC_MagicStatusChange( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_MagicStatusChange_Battle( charaindex, toindex, marray, mp ); + }else{ + return FALSE; + } +} +#endif + +#ifdef _MAGIC_DEEPPOISON//ver2,Ҫ趨״̬5δʱ +// ëܸ ܷ +int MAGIC_StatusChange2( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + //call func + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_StatusChange_Battle2( charaindex, toindex, marray, mp ); + }else{ + return FALSE; + } +} +#endif +// ټ ܷ +int MAGIC_StatusRecovery( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + // ܷ ɧ ƻ УѨ̹ϵئ³練 + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + // + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_StatusRecovery_Battle( charaindex, toindex, marray, mp ); + }else{ + // ƥئ + return FALSE; + } +} + +int MAGIC_MagicDef( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); + if( IsBATTLING( charaindex ) == TRUE ){ +#ifdef _PREVENT_TEAMATTACK //⾵..ʹõз +#ifdef _GJS_TYPE + if(getGjsType()==0){ +#endif + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER + /*&& BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P*/ ){ + if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ){//ͬ + int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) ); + CHAR_talkToCli( charaindex, -1, "⾵..ʩз", CHAR_COLORYELLOW); + return FALSE; + } + } +#ifdef _GJS_TYPE + } +#endif +#endif + return MAGIC_MagicDef_Battle( charaindex, toindex, marray, mp ); + }else{ + return FALSE; + } +} + + +// 姾ٽ ܷ +int MAGIC_Ressurect( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + // ܷ ɧ ƻ УѨ̹ϵئ³練 + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + // + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_Ressurect_Battle( charaindex, toindex, marray, mp ); + }else{ + // ƥئ + return FALSE; + } +} + +// ë ܷ +int MAGIC_AttReverse( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + // ܷ ɧ ƻ УѨ̹ϵئ³練 + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + // + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_AttReverse_Battle( charaindex, toindex, marray, mp ); + }else{ + // ƥئ + return FALSE; + } +} + + + +// 姾١ ܷ +int MAGIC_ResAndDef( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode; + + // INDEX + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; // + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + // + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; // ĸ + // ܷ ɧ ƻ УѨ̹ϵئ³練 + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + // + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_ResAndDef_Battle( charaindex, toindex, marray, mp ); + }else{ + // ƥئ + return FALSE; + } +} + + + +#ifdef _ATTACK_MAGIC + +int MAGIC_AttMagic( int charaindex , int toindex , int marray , int mp ) +{ + int battlemode; + + if( FALSE == CHAR_CHECKINDEX( charaindex ) ) + return FALSE; + + battlemode = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEMODE ); + if( BATTLE_CHARMODE_INIT == battlemode ) + return FALSE; + // dzħ,mp + if(CHAR_getInt(charaindex,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) + { + if( CHAR_getInt( charaindex , CHAR_MP ) < mp ) + return FALSE; + + CHAR_setInt( charaindex , CHAR_MP , CHAR_getInt( charaindex , CHAR_MP ) - mp ); + } + + if( TRUE == IsBATTLING( charaindex ) ) + return MAGIC_AttMagic_Battle( charaindex , toindex , marray , mp ); + + return FALSE; + +} + +#endif + +#ifdef _ITEM_METAMO +int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp ) +{ + int battlemode, haveindex, power, i; + char msg[128]; + + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + // ݷ + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + // + if( IsBATTLING( charaindex ) == TRUE ){ + //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); + //return FALSE; + toindex = BATTLE_No2Index( + CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex ); + //print(" battle_metamo:%d ", toindex); + } + + if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE; + + if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORWHITE ); + return FALSE; + } +#ifdef _FIX_METAMORIDE + if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return FALSE; + } +#else + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ){ + CHAR_talkToCli( charaindex, -1, "޷вܱ", CHAR_COLORWHITE ); + return FALSE; + } +#endif +#ifdef _FIXBUG_ATTACKBOW + { + int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM); + if( ITEM_CHECKINDEX( armindex) == TRUE ) { + int armtype = BATTLE_GetWepon( charaindex); + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( charaindex, -1, "ʹԶ޷", CHAR_COLORYELLOW ); + return FALSE; + } + } + } +#endif + haveindex = -1; + for( i = 0; i < 5; i++ ) + { + if( CHAR_getCharPet( charaindex, i) == toindex ) { + haveindex = i; + break; + } + } + if( haveindex == -1 && charaindex != toindex ) + { + CHAR_talkToCli( charaindex, -1, "޷ֻܱԼij", CHAR_COLORWHITE ); + return FALSE; + } + + if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ){ + CHAR_talkToCli( charaindex, -1, "ܱɼ", CHAR_COLORWHITE ); + return FALSE; + } + + power = atoi(MAGIC_getChar( marray, MAGIC_OPTION )); + + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP); + + if( toindex != charaindex ) { + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power); + sprintf( msg, "%s", CHAR_getChar( toindex, CHAR_NAME) ); + } + else { + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0); + sprintf( msg, "Լ"); + } + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE ); + + CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER, + CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); + CHAR_complianceParameter( charaindex); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); +//#endif + + return TRUE; +} +#endif + +#ifdef _ITEM_ATTSKILLMAGIC +int MAGIC_AttSkill( int charaindex, int toindex,int marray, int mp ) +{ + int battlemode; + int battleindex=-1; + char *magicarg, funName[256]; + int skillID=-1; + PETSKILL_CALLFUNC func; + if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE; + if( IsBATTLING( charaindex ) == FALSE ) return FALSE; + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + if( battlemode == BATTLE_CHARMODE_INIT ) return FALSE; + if( toindex < 0 || toindex > 19 ) return FALSE; + if( CHAR_getInt( charaindex, CHAR_MP ) < mp ) return FALSE; + + memset( funName, 0, sizeof( char)*256 ); + //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp ); + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + if ( magicarg == "\0") return FALSE; + if( strstr( magicarg, ";" ) != NULL ) { + char buff1[256]; + if( getStringFromIndexWithDelim( magicarg, ";", 1, buff1, sizeof( buff1)) == FALSE ) + return FALSE; + snprintf( funName, sizeof(funName), buff1); + if( getStringFromIndexWithDelim( magicarg, ";", 2, buff1, sizeof( buff1)) == FALSE ) + return FALSE; + skillID = atoi( buff1); + }else + return FALSE; + func = PETSKILL_getPetskillFuncPointer( funName); + if( !func ){ + print("\n *func not FOUND !!"); + return FALSE; + } + if( func( charaindex, toindex, skillID, "MAGICSKILL" ) == FALSE ) return FALSE; + CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp ); + return TRUE; + +} +#endif +#ifdef _MAGIC_BARRIER// vincent :ħ +int MAGIC_Barrier( int charaindex, int toindex, int marray, int mp ) +{ + + int battlemode; + int i,turn,perStatus; + int ToList[SIDE_OFFSET*2+1]; + char *magicarg; + int attackNo=0; + int battleindex,Success = 0; + char szTurn[] = "turn"; + char szSuccess[] = ""; + char *pszP; + + //check index + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ //?? + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + //mp + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + //mp + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + //ħ + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + if( magicarg == "\0" ) { + print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + + //ȡûغ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + // ɬ// + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } + + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + BATTLE_MultiList( battleindex, toindex, ToList ); +//ʩħЧ + BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi); + + charaindex = BATTLE_No2Index( battleindex, attackNo ); + //checkǷս + if( IsBATTLING( charaindex ) == TRUE ) + { + + for( i = 0; ToList[i] != -1; i ++ ) + { + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_BARRIER, Success, 30, 1.0, &perStatus ) == TRUE ) + { + CHAR_setWorkInt( toindex, CHAR_WORKBARRIER, turn+1 ); +// BATTLE_BadStatusString( ToList[i], BATTLE_ST_BARRIER ); + } + } + return TRUE; + }else{ + return FALSE; + } +} +#endif +#ifdef _MAGIC_NOCAST// vincent :Ĭ +int MAGIC_Nocast( int charaindex, int toindex, int marray, int mp ) +{ + + int battlemode; + int i,turn,perStatus; + int ToList[SIDE_OFFSET*2+1]; + char *magicarg; + int attackNo=0; + int battleindex,Success = 0; + char szTurn[] = "turn"; + char szSuccess[] = ""; + char *pszP; + + //check index + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ //?? + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + //mp + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + //mp + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + //ħ + magicarg = MAGIC_getChar( marray, MAGIC_OPTION ); + if( magicarg == "\0" ) { + print("\n magicarg == NULL "); + return FALSE; + } + pszP = magicarg; + + //ȡûغ + if( ( pszP = strstr( pszP, szTurn ) ) != NULL){ + pszP += sizeof( szTurn ); + sscanf( pszP, "%d", &turn ); + } + // ɬ// + if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){ + pszP += sizeof( szSuccess ); + sscanf( pszP, "%d", &Success ); + } +// print("\nvincent-->MAGIC_Nocast use"); + battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ); + attackNo = BATTLE_Index2No( battleindex, charaindex ); + BATTLE_MultiList( battleindex, toindex, ToList ); +//ʩħЧ + BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi); + charaindex = BATTLE_No2Index( battleindex, attackNo ); + //checkǷս + if( IsBATTLING( charaindex ) == TRUE ) + { + + for( i = 0; ToList[i] != -1; i ++ ) + { + toindex = BATTLE_No2Index( battleindex, ToList[i] ); + if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_NOCAST, Success, 30, 1.0, &perStatus ) == TRUE + && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET) + { + CHAR_setWorkInt( toindex, CHAR_WORKNOCAST, turn ); +//޷չҳ + lssproto_NC_send( getfdFromCharaIndex( toindex ), 1); + //print("\nvincent-->NOCASTING2"); +// BATTLE_BadStatusString( ToList[i], BATTLE_ST_NOCAST ); + } + } + return TRUE; + }else{ + return FALSE; + } +} +#endif + +#ifdef _MAGIC_WEAKEN// vincent : +int MAGIC_Weaken( int charaindex, int toindex, int marray, int mp ) +{ + + int battlemode; + //check index + if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; + + battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ); + + // ݷ //?? + if( battlemode == BATTLE_CHARMODE_INIT ){ + return FALSE; + } + + //mp + if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; + //mp + CHAR_setInt( charaindex, CHAR_MP, + CHAR_getInt( charaindex, CHAR_MP ) - mp ); + + //checkǷս + if( IsBATTLING( charaindex ) == TRUE ){ + return MAGIC_ParamChange_Turn_Battle( charaindex, toindex, marray, mp ); + }else{ + return FALSE; + } +} +#endif + +#ifdef _MAGIC_TOCALL +int MAGIC_ToCallDragon( int charaindex, int toindex,int marray, int mp ) +{ + int battlemode; + + //print("MAGIC_ToCallDragon in .................\n"); + if( FALSE == CHAR_CHECKINDEX( charaindex ) ) + return FALSE; + + battlemode = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEMODE ); + if( BATTLE_CHARMODE_INIT == battlemode ) + return FALSE; + if( CHAR_getInt( charaindex , CHAR_MP ) < mp ) + return FALSE; + + CHAR_setInt( charaindex , CHAR_MP , CHAR_getInt( charaindex , CHAR_MP ) - mp ); + + if( TRUE == IsBATTLING( charaindex ) ) + return MAGIC_ToCallDragon_Battle( charaindex , toindex , marray , mp ); + + return FALSE; +} +#endif + + + + diff --git a/magic/magic_base.c b/magic/magic_base.c new file mode 100644 index 0000000..04e43a3 --- /dev/null +++ b/magic/magic_base.c @@ -0,0 +1,509 @@ +#include "version.h" +#include +#include + +#include "common.h" +#include "buf.h" +#include "configfile.h" +#include "magic_base.h" +#include "magic.h" + +static Magic *MAGIC_magic; +static int MAGIC_magicnum; + + + +#ifdef _ATTACK_MAGIC + +AttMagic *ATTMAGIC_magic; +int ATTMAGIC_magicnum; + +#endif + + + +typedef struct tagMagic_MagicFunctionTable +{ + char *functionname; /* ɬð̻̤Ѽ */ + MAGIC_CALLFUNC func; /* ˱̫ľ */ + int hash; /* hash */ +}MAGIC_MagicFunctionTable; + +/* ë ֧ճ */ +static MAGIC_MagicFunctionTable MAGIC_functbl[] = { + { "MAGIC_Recovery", MAGIC_Recovery, 0}, + { "MAGIC_OtherRecovery", MAGIC_OtherRecovery, 0}, + { "MAGIC_FieldAttChange", MAGIC_FieldAttChange, 0}, + { "MAGIC_StatusChange", MAGIC_StatusChange, 0}, + { "MAGIC_MagicDef", MAGIC_MagicDef, 0}, + { "MAGIC_StatusRecovery", MAGIC_StatusRecovery, 0}, + { "MAGIC_Ressurect", MAGIC_Ressurect, 0}, + { "MAGIC_AttReverse", MAGIC_AttReverse, 0}, + { "MAGIC_ResAndDef", MAGIC_ResAndDef, 0}, + +#ifdef _ATTACK_MAGIC + { "MAGIC_AttMagic" , MAGIC_AttMagic , 0 }, +#endif +#ifdef _OTHER_MAGICSTAUTS + { "MAGIC_MagicStatusChange", MAGIC_MagicStatusChange, 0}, +#endif +#ifdef _ITEM_METAMO + { "MAGIC_Metamo", MAGIC_Metamo, 0}, +#endif +#ifdef _ITEM_ATTSKILLMAGIC + //{ "MAGIC_AttSkill", MAGIC_AttSkill, 0}, +#endif +#ifdef _MAGIC_WEAKEN // vincent : + { "MAGIC_Weaken", MAGIC_Weaken, 0}, +#endif +#ifdef _MAGIC_DEEPPOISON // vincent :綾 + { "MAGIC_StatusChange2", MAGIC_StatusChange2,0}, +#endif +#ifdef _MAGIC_BARRIER // vincent :ħ + { "MAGIC_Barrier", MAGIC_Barrier, 0}, +#endif +#ifdef _MAGIC_NOCAST // vincent :Ĭ + { "MAGIC_Nocast", MAGIC_Nocast, 0}, +#endif +#ifdef _MAGIC_TOCALL // + { "MAGIC_ToCallDragon", MAGIC_ToCallDragon, 0}, +#endif +}; + +/*----------------------------------------------------------------------*/ + + +/* ͣʧͱ */ +/*----------------------------------------------------------------------*/ +INLINE BOOL MAGIC_CHECKINDEX( int index ) +{ + if( MAGIC_magicnum<=index || index<0 )return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +static INLINE BOOL MAGIC_CHECKINTDATAINDEX( int index) +{ + if( MAGIC_DATAINTNUM <= index || index < 0 ) return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +static INLINE BOOL MAGIC_CHECKCHARDATAINDEX( int index) +{ + if( MAGIC_DATACHARNUM <= index || index < 0 ) return FALSE; + return TRUE; +} +/*----------------------------------------------------------------------*/ +INLINE int MAGIC_getInt( int index, MAGIC_DATAINT element) +{ + return MAGIC_magic[index].data[element]; +} +/*----------------------------------------------------------------------*/ +INLINE int MAGIC_setInt( int index, MAGIC_DATAINT element, int data) +{ + int buf; + buf = MAGIC_magic[index].data[element]; + MAGIC_magic[index].data[element]=data; + return buf; +} +/*----------------------------------------------------------------------*/ +INLINE char* MAGIC_getChar( int index, MAGIC_DATACHAR element) +{ + if( !MAGIC_CHECKINDEX( index)) return "\0"; + if( !MAGIC_CHECKCHARDATAINDEX( element)) return "\0"; + return MAGIC_magic[index].string[element].string; +} + +/*----------------------------------------------------------------------*/ +INLINE BOOL MAGIC_setChar( int index ,MAGIC_DATACHAR element, char* new ) +{ + if(!MAGIC_CHECKINDEX(index))return FALSE; + if(!MAGIC_CHECKCHARDATAINDEX(element))return FALSE; + strcpysafe( MAGIC_magic[index].string[element].string, + sizeof(MAGIC_magic[index].string[element].string), + new ); + return TRUE; +} +/*---------------------------------------------------------------------- + * ܷë£ + *---------------------------------------------------------------------*/ +int MAGIC_getMagicNum( void) +{ + return MAGIC_magicnum; +} + +/*---------------------------------------------------------------------- + * ܷɬð̻ë + *---------------------------------------------------------------------*/ +BOOL MAGIC_initMagic( char *filename) +{ + FILE* f; + char line[256]; + int linenum=0; + int magic_readlen=0; + int i,j; + + int max_magicid =0; + char token[256]; + + f = fopen(filename,"r"); + if( f == NULL ){ + print( "ļʧ\n"); + return FALSE; + } + + MAGIC_magicnum=0; + + /* ئ滥ϵؤ¾Ʃ */ + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + +#ifdef _MAGIC_OPTIMUM // Robin ȡMAGIC ID + if( getStringFromIndexWithDelim( line, ",", MAGIC_DATACHARNUM+MAGIC_ID+1, + token, sizeof(token)) == FALSE ) + continue; + max_magicid = max( atoi( token), max_magicid); +#endif + + MAGIC_magicnum++; + } + +#ifdef _MAGIC_OPTIMUM + print("Чħ:%d ħ:%d ...", MAGIC_magicnum, max_magicid); + MAGIC_magicnum = max_magicid +1; +#endif + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "\n" ); + fclose(f); + return FALSE; + } + + MAGIC_magic = allocateMemory( sizeof(struct tagMagic) + * MAGIC_magicnum ); + if( MAGIC_magic == NULL ){ + fprint( "޷ڴ %d\n" , + sizeof(struct tagMagic)*MAGIC_magicnum); + fclose( f ); + return FALSE; + } + + /* */ + for( i = 0; i < MAGIC_magicnum; i ++ ) { + for( j = 0; j < MAGIC_DATAINTNUM; j ++ ) { + MAGIC_setInt( i,j,-1); + } + for( j = 0; j < MAGIC_DATACHARNUM; j ++ ) { + MAGIC_setChar( i,j,""); + } + } + + /* */ + linenum = 0; + while( fgets( line, sizeof( line ), f ) ){ + linenum ++; + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ +{ + char buf[256]; + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } +} +{ + char token[256]; + int ret; + +#ifdef _MAGIC_OPTIMUM + if( getStringFromIndexWithDelim( line, ",", MAGIC_DATACHARNUM+MAGIC_ID+1, + token, sizeof(token)) == FALSE ) + continue; + magic_readlen = atoi( token); +#endif + + for( i = 0; i < MAGIC_DATACHARNUM; i ++ ) { + + /* ٯ ͼëέ */ + ret = getStringFromIndexWithDelim( line,",", + i + 1, + token,sizeof(token)); + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + MAGIC_setChar( magic_readlen, i, token); + } + /* 4 ϷѰ */ +#define MAGIC_STARTINTNUM 5 + for( i = MAGIC_STARTINTNUM; i < MAGIC_DATAINTNUM+MAGIC_STARTINTNUM; i ++ ) { + ret = getStringFromIndexWithDelim( line,",",i,token, + sizeof(token)); + +#ifdef _ATTACK_MAGIC + + if( FALSE == ret ) + + break; + + if( 0 != strlen( token ) ) + { + MAGIC_setInt( magic_readlen , i - MAGIC_STARTINTNUM , atoi( token ) ); + } + +#else + + if( ret==FALSE ){ + fprint("ļ﷨:%s %d\n",filename,linenum); + break; + } + if( strlen( token) != 0 ) { + MAGIC_setInt( magic_readlen, i - MAGIC_STARTINTNUM, atoi( token)); + } + + #endif + } + +#ifdef _ATTACK_MAGIC + + if( i != MAGIC_STARTINTNUM + MAGIC_IDX && i != MAGIC_DATAINTNUM + MAGIC_STARTINTNUM ) + continue; + +#else + + if( i < MAGIC_DATAINTNUM+MAGIC_STARTINTNUM ) + continue; + +#endif + /* нسƶ£ */ + if( MAGIC_getInt( magic_readlen, MAGIC_TARGET_DEADFLG) == 1 ) { + MAGIC_setInt( magic_readlen, MAGIC_TARGET, + MAGIC_getInt( magic_readlen, MAGIC_TARGET)+100); + } + + magic_readlen ++; +} + } + fclose(f); + + MAGIC_magicnum = magic_readlen; + + + print( "Чħ %d...", MAGIC_magicnum ); + + /* hash */ + for( i = 0; i < arraysizeof( MAGIC_functbl); i ++ ) { + MAGIC_functbl[i].hash = hashpjw( MAGIC_functbl[i].functionname); + } + return TRUE; +} +/*------------------------------------------------------------------------ + * Magicɬð̻ + *-----------------------------------------------------------------------*/ +BOOL MAGIC_reinitMagic( void ) +{ + freeMemory( MAGIC_magic); + return( MAGIC_initMagic( getMagicfile())); +} + + +#ifdef _ATTACK_MAGIC + +/*------------------------------------------------------------------------ + * AttMagicijʼ + *-----------------------------------------------------------------------*/ +BOOL ATTMAGIC_initMagic( char *filename ) +{ + FILE *file; + + // Open file + if( NULL == ( file = fopen( filename , "r" ) ) ) + { + ATTMAGIC_magicnum = 0; + ATTMAGIC_magic = NULL; + + return TRUE; + } + + fseek( file , 0 , SEEK_END ); + + // Calculate the number of attack magics + ATTMAGIC_magicnum = ftell( file ) / sizeof( struct tagAttMagic ); + if( ATTMAGIC_magicnum % 2 ) + { + fprint( "ļʧ\n" ); + fclose( file ); + + return FALSE; + } + + fseek( file , 0 , SEEK_SET ); + + // Allocate memory to attack magics + ATTMAGIC_magic = allocateMemory( sizeof( struct tagAttMagic ) * ATTMAGIC_magicnum ); + if( NULL == ATTMAGIC_magic ) + { + fprint( "޷ڴ %d\n" , sizeof( struct tagAttMagic ) * ATTMAGIC_magicnum ); + fclose( file ); + + return FALSE; + } + + // Read attack magics information + memset( ATTMAGIC_magic , 0 , sizeof( struct tagAttMagic ) * ATTMAGIC_magicnum ); + fread( ATTMAGIC_magic , 1 , sizeof( struct tagAttMagic ) * ATTMAGIC_magicnum , file ); + + fclose( file ); + + ATTMAGIC_magicnum = ATTMAGIC_magicnum / 2; + + print( "ЧĹħ %d\n" , ATTMAGIC_magicnum ); + + return TRUE; +} + + + +/*------------------------------------------------------------------------ + * AttMagicٶȳʼ + *-----------------------------------------------------------------------*/ +BOOL ATTMAGIC_reinitMagic( void ) +{ + freeMemory( ATTMAGIC_magic ); + ATTMAGIC_magicnum = 0; + + return ATTMAGIC_initMagic( getAttMagicfileName() ); +// return ATTMAGIC_initMagic( getMagicfile() ); +} + +#endif + +/*------------------------------------------------------------------------ + * MAGIC_IDսٯë + * ߯Ի + * : ٯ + * : -1 + *-----------------------------------------------------------------------*/ +int MAGIC_getMagicArray( int magicid) +{ +#ifdef _MAGIC_OPTIMUM + if( magicid >= 0 && magicid < MAGIC_magicnum) + return magicid; +#else + int i; + for( i = 0; i < MAGIC_magicnum; i ++ ) { + if( MAGIC_magic[i].data[MAGIC_ID] == magicid ) { + return i; + } + } +#endif + return -1; +} +/*------------------------------------------------------------ + *  պ̼ë߯ + * ¦ + * name char*  + * ߯Ի + * ѳ߼̼ئ巴NULL + ------------------------------------------------------------*/ +MAGIC_CALLFUNC MAGIC_getMagicFuncPointer(char* name) +{ + int i; + int hash; //ttom + //ttom 12/18/2000 + if(name==NULL) return NULL; + //ttom + //int hash = hashpjw( name ); + hash=hashpjw(name); + for( i = 0 ; i< arraysizeof( MAGIC_functbl) ; i++ ) { + if( MAGIC_functbl[i].hash == hash ) { + if( strcmp( MAGIC_functbl[i].functionname, name ) == 0 ) { + return MAGIC_functbl[i].func; + } + } + } + return NULL; +} + + +// Nuke start (08/23) +/* + Nuke ϼͣ + ܷ ë£ + + Check the validity of the target of a magic. + Return value: + 0: Valid + -1: Invalid +*/ +int MAGIC_isTargetValid( int magicid, int toindex) +{ + int marray; + marray= MAGIC_getMagicArray( magicid); + + #ifdef _ATTACK_MAGIC + + if( toindex >= 0 && toindex <= 19 ) + return 0; + + // One side of players + if( 20 == toindex || 21 == toindex ) + { + if( MAGIC_TARGET_WHOLEOTHERSIDE == MAGIC_magic[marray].data[MAGIC_TARGET] || MAGIC_TARGET_ALL_ROWS == MAGIC_magic[marray].data[MAGIC_TARGET] ) + return 0; + else + return -1; + } + + // All players + if( 22 == toindex ) + { + if( MAGIC_TARGET_ALL == MAGIC_magic[marray].data[MAGIC_TARGET] ) + return 0; + else + return -1; + } + + // One row + if( 23 == toindex || 24 == toindex || 25 == toindex || 26 == toindex ) + { + if( MAGIC_TARGET_ONE_ROW == MAGIC_magic[marray].data[MAGIC_TARGET] ) + return 0; + else + return -1; + } + + #else + + // Single player + if ((toindex >= 0x0) && (toindex <= 0x13)) return 0; + // All players + if (toindex == 0x16) { + if (MAGIC_magic[marray].data[MAGIC_TARGET] == MAGIC_TARGET_ALL) + return 0; else return -1; + } + // One side of players + if ((toindex == 0x14) || (toindex == 0x15)) { + if (MAGIC_magic[marray].data[MAGIC_TARGET] == MAGIC_TARGET_WHOLEOTHERSIDE) + return 0; else return -1; + } + + #endif + + // Others: Error + return -1; +} +// Nuke end diff --git a/magic/magic_field.c b/magic/magic_field.c new file mode 100644 index 0000000..ecf2255 --- /dev/null +++ b/magic/magic_field.c @@ -0,0 +1,149 @@ +#include "version.h" +#include + +#include "common.h" +#include "char_base.h" +#include "char.h" +#include "magic_base.h" +#include "magic.h" +#include "magic_field.h" + +/* + * ƥ ܷ + */ +/*---------------------------------------------------------------------- + * мļ + * ¦ + * charaindex int мindex + * magicindex int ܷindex + *---------------------------------------------------------------------*/ +int MAGIC_Recovery_Field( int charaindex, int magicindex) +{ + char *magicarg; + float power; + int workhp; + int prevhp; + char msgbuf[64]; + +#ifdef _TYPE_TOXICATION + if( CHAR_CanCureFlg( charaindex, "HP") == FALSE ) return TRUE; +#endif + magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION ); + power = atoi( magicarg ); + power = RAND( (power*0.9), (power*1.1) ); +#ifndef _MAGIC_REHPAI + power *= GetRecoveryRate( charaindex ); +#endif + prevhp = CHAR_getInt( charaindex, CHAR_HP ); + workhp = prevhp + (int)power; + CHAR_setInt( charaindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ) ) ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_HP|CHAR_P_STRING_MP); + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) { + int mypartyarray = -1; + int oyaindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( oyaindex )) { + int i; + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i); + if( CHAR_CHECKINDEX( workindex) ) { + if( workindex == charaindex ) { + mypartyarray = i; + break; + } + } + } + if( mypartyarray != -1 ) { + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getPartyIndex( charaindex, i); + if( CHAR_CHECKINDEX( index) ) { + if( index != charaindex) { + CHAR_send_N_StatusString( index, mypartyarray, + CHAR_N_STRING_HP|CHAR_N_STRING_MP); + } + } + } + } + } + } + snprintf( msgbuf, sizeof( msgbuf), ";ظ%d", + min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + return TRUE; + +} +/*---------------------------------------------------------------------- + * ְë + * ¦ + * charaindex int мindex + * toindex int мindex + * magicindex int ܷindex + *---------------------------------------------------------------------*/ +int MAGIC_OtherRecovery_Field( int charaindex, int toindex, int magicindex) +{ + char *magicarg; + float power; + int workhp; + int prevhp; + char msgbuf[64]; + +#ifdef _TYPE_TOXICATION + if( CHAR_CanCureFlg( charaindex, "HP") == FALSE )return FALSE; +#endif + magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION ); + power = atoi( magicarg ); + power = RAND( (power*0.9), (power*1.1) ); +#ifndef _MAGIC_REHPAI + power *= GetRecoveryRate( toindex ); +#endif + prevhp = CHAR_getInt( toindex, CHAR_HP ); + workhp = prevhp + (int)power; + CHAR_setInt( toindex, CHAR_HP, + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) ); + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + if( charaindex != toindex ) { + CHAR_send_P_StatusString( toindex, CHAR_P_STRING_HP); + } + } + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP); + if( charaindex != toindex) { + CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP); + CHAR_PartyUpdate( toindex, CHAR_N_STRING_HP); + } + else { + CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP|CHAR_N_STRING_HP); + } + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){ + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int workindex = CHAR_getCharPet( charaindex, i ); + if( workindex == toindex ){ + CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP); + } + } + } + + if( charaindex != toindex) { + snprintf( msgbuf, sizeof( msgbuf), "%s;ظ%d", + CHAR_getUseName( toindex ), + min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + + if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + snprintf( msgbuf, sizeof( msgbuf), "%s;ظ%d", + CHAR_getUseName( charaindex ), + min( workhp,CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp); + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE); + } + } + else { + snprintf( msgbuf, sizeof( msgbuf), ";ظ%d", + min( workhp,CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE); + + } + + return TRUE; + +} + diff --git a/magic/makefile b/magic/makefile new file mode 100644 index 0000000..ac4e1ac --- /dev/null +++ b/magic/makefile @@ -0,0 +1,194 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmagic.a + +SRC=magic.c magic_base.c magic_field.c +OBJ=$(SRC:.c=.o) + + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +magic.o: magic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/battle.h ../include/magic_base.h ../include/magic.h \ + ../include/magic_field.h ../include/family.h ../include/handletime.h \ + ../include/battle_magic.h ../include/battle_event.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h +magic_base.o: magic_base.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/buf.h ../include/common.h ../include/configfile.h \ + ../include/magic_base.h ../include/util.h ../include/magic.h +magic_field.o: magic_field.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/magic_base.h \ + ../include/magic.h ../include/magic_field.h diff --git a/magic/makefile.bak b/magic/makefile.bak new file mode 100644 index 0000000..ac4e1ac --- /dev/null +++ b/magic/makefile.bak @@ -0,0 +1,194 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmagic.a + +SRC=magic.c magic_base.c magic_field.c +OBJ=$(SRC:.c=.o) + + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +magic.o: magic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/battle.h ../include/magic_base.h ../include/magic.h \ + ../include/magic_field.h ../include/family.h ../include/handletime.h \ + ../include/battle_magic.h ../include/battle_event.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h +magic_base.o: magic_base.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/buf.h ../include/common.h ../include/configfile.h \ + ../include/magic_base.h ../include/util.h ../include/magic.h +magic_field.o: magic_field.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/magic_base.h \ + ../include/magic.h ../include/magic_field.h diff --git a/main.c b/main.c new file mode 100644 index 0000000..21c1a67 --- /dev/null +++ b/main.c @@ -0,0 +1,409 @@ +#include "version.h" +#include +#include +#include +#include +#include +#include + +#include "init.h" +#include "net.h" +#include "handletime.h" +#include "char.h" +#include "map_warppoint.h" +#include "npcgen.h" +#include "log.h" +#include "configfile.h" +#include "battle.h" +#include "petmail.h" +#include "autil.h" +#include "family.h" +#include "trade.h" +#include "title.h" +#include "attestation.h" +#ifdef _ALLBLUES_LUA +#include "mylua/ablua.h" +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ +#include "chatroom.h" +#endif + +#include "sasql.h" + +static void ShutdownProc( void); +void mainloop( void ); +struct tm tmNow, tmOld; +void family_proc(); + +#ifdef _CHANNEL_MODIFY +extern int InitOccChannel(void); +#endif + +#ifdef _GMSV_DEBUG +extern char *DebugMainFunction; +#endif + +#ifdef _ANGEL_SUMMON +#define ANGELTIMELIMIT 3*24*60*60 // ʱ() +int AngelReady =0; +int AngelTimelimit = ANGELTIMELIMIT; +time_t AngelNextTime; +void AngelReadyProc(); +#endif +int yzflg=0; +//#include "genver.h" + +void warplog_proc(); + + +int main( int argc , char** argv, char** env ) +{ + + //if(attestation()<1) + // { + // print("޷֤ͨϵߣ\n"); + // exit(0); + // } + //if (strcmp(getlocaltime(), TimeLimitLocal)>0)exit(0); +#ifdef _ONLINENUM_FIX + system("ulimit -HSn 2048"); +#endif + + /* ȤꤢrgOƤ */ + setNewTime(); + +/* if ( argc > 1 && 0==strcmp(argv[1],"-v")) + { + printf("%s",genver); + exit(0); + } + else fprintf(stderr,"%s",genver);*/ + readconfigfile(getConfigfilename()); + EXITWITHEXITCODEIFFALSE( util_Init() , 1); + + LoadAnnounce(); // Arminius 7.12 loginannounce + + /* O */ + memcpy( &tmOld, localtime( (time_t *)&NowTime.tv_sec), sizeof( tmNow ) ); + + sasql_init(); + + EXITWITHEXITCODEIFFALSE( init(argc , argv ,env ) , 1); + sasql_online(NULL,NULL,NULL,NULL,NULL,3); + LoadPetTalk(); // Arminius 8.14 pet talk + +#ifdef _GAMBLE_BANK + Load_GambleBankItems(); +#endif + +#ifdef _CFREE_petskill + Load_PetSkillCodes(); +#endif + +#ifdef _ITEM_PILEFORTRADE + TRADE_InitTradeList(); +#endif + mainloop(); + + return 0; +} + +void mainloop( void ) +{ + print("ʼNPC..."); + NPC_generateLoop( 1 ); + print("\n"); + print("ʼsignal1..."); + signal(SIGUSR1,sigusr1); + print("\n"); + print("ʼsignal2..."); + signal(SIGUSR2,sigusr2); + print("\n"); +#ifdef _MAP_WARPPOINT + print("ʼͼ͵..."); + MAPPOINT_InitMapWarpPoint(); + print("\n"); + if( !MAPPOINT_loadMapWarpPoint() ){ + return; + } +#endif + +#ifdef _ASSESS_SYSEFFICACY + Assess_InitSysEfficacy(); +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ + print("ʼƵ..."); + InitChatRoom(); + print("\n"); +#endif +#ifdef _CHANNEL_MODIFY + print("ʼְҵƵ..."); + if(!InitOccChannel()) return; // ʼְҵƵ + print("\n"); +#endif +#ifdef _ANGEL_SUMMON + print("ʼۼʱ..."); + AngelReady = 0; +#ifdef _ANGEL_TIME + AngelNextTime = time(NULL) + getAngelPlayerTime(); +#else + AngelNextTime = time(NULL) + 1*60; +#endif + print("\n"); +#endif +#ifdef _JZ_NEWSCRIPT_LUA + print("ʼLNS..."); + NPC_Lua_Init(getLuaFile()); + print("\n"); +#endif + +#ifdef _ITEM_LUA + print("ʼLUA..."); + int itemluaflg=ITEM_LuaInit(getitemluafile()); + if(itemluaflg==TRUE){ + print("\n"); + }else{ + print("ʧ\n"); + } +#endif +#ifdef _ALLBLUES_LUA + print("ʼLUAű..."); + LoadAllbluesLUA("data/ablua"); + print("\n"); +#endif +//if (strcmp(getlocaltime(), TimeLimitLocal)>0)exit(0); +//#ifdef _ALLDOMAN +// print("ʼӢ۱..."); +// InitHeroList(); +// print("\n"); +//#endif + + int itime=0; + while(1){ + if(getCpuUse()!=-1){ + itime++; + if(itime>getCpuUse()){ + itime=0; + usleep(1); + } + } +#ifdef _ASSESS_SYSEFFICACY +Assess_SysEfficacy( 0 ); +#endif + + setNewTime(); + memcpy(&tmNow, localtime( (time_t *)&NowTime.tv_sec), + sizeof( tmNow ) ); + if( tmOld.tm_hour != getLogHour( ) && tmNow.tm_hour == getLogHour( ) ){ +#ifdef _GMSV_DEBUG + DebugMainFunction="backupAllLogFile"; +#endif + backupAllLogFile( &tmOld ); + } + + setNewTime(); +#ifdef _ASSESS_SYSEFFICACY_SUB //ʾLOOPʱ +//Assess_SysEfficacy_sub( 0, 1); +#ifdef _GMSV_DEBUG + DebugMainFunction="netloop_faster"; +#endif + netloop_faster(); +//Assess_SysEfficacy_sub( 1, 1); + +//Assess_SysEfficacy_sub( 0, 2); +#ifdef _GMSV_DEBUG + DebugMainFunction="NPC_generateLoop"; +#endif + NPC_generateLoop( 0 ); +//Assess_SysEfficacy_sub( 1, 2); + +//Assess_SysEfficacy_sub( 0, 3); +#ifdef _GMSV_DEBUG + DebugMainFunction="BATTLE_Loop"; +#endif + BATTLE_Loop(); +//Assess_SysEfficacy_sub( 1, 3); + +//Assess_SysEfficacy_sub( 0, 4); +#ifdef _GMSV_DEBUG + DebugMainFunction="CHAR_Loop"; +#endif + CHAR_Loop(); +//Assess_SysEfficacy_sub( 1, 4); + +#ifdef _GMSV_DEBUG + DebugMainFunction="PETMAIL_proc"; +#endif + PETMAIL_proc(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="family_proc"; +#endif + family_proc(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="chardatasavecheck"; +#endif + chardatasavecheck(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="AngelReadyProc"; +#endif + AngelReadyProc(); + + //tmOld = tmNow; + if( tmOld.tm_sec != tmNow.tm_sec ) { +/*#ifdef _CAX_YANZHENG +if(yanzheng != 0){ + exit(1); + } +#endif*/ +#ifdef _GMSV_DEBUG + DebugMainFunction="CHAR_checkEffectLoop"; +#endif + CHAR_checkEffectLoop(); + } + if( SERVSTATE_getShutdown()> 0 ) { + ShutdownProc(); +#ifdef _GMSV_DEBUG + DebugMainFunction="ShutdownProc"; +#endif + } + tmOld = tmNow; + +#ifdef _ASSESS_SYSEFFICACY +Assess_SysEfficacy( 1 ); +#endif +#endif + } +} + +static void sendmsg_toall( char *msg ) +{ + int i; + int playernum = CHAR_getPlayerMaxNum(); + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, msg, CHAR_COLORYELLOW); + } + } +} +static void ShutdownProc( void) +{ +#define SYSINFO_SHUTDOWN_MSG "%d Ӻʼϵͳͣά, ǰݶʧ" +#define SYSINFO_SHUTDOWN_MSG_COMP "ѹرա" + int diff,hun; + + diff = NowTime.tv_sec - SERVSTATE_getShutdown(); + hun = SERVSTATE_getLimittime() - (diff/60); + if( hun != SERVSTATE_getDsptime() ){ + char buff[256]; + if( hun != 0 ) { + snprintf( buff, sizeof(buff), SYSINFO_SHUTDOWN_MSG, hun); + } + else { + strcpy( buff, SYSINFO_SHUTDOWN_MSG_COMP); + } + sendmsg_toall( buff); + SERVSTATE_setDsptime(hun); + if( hun == 1 ) { + int i=0; + unsigned int MAX_USER=0; + + MAX_USER=getPlayercharnum(); + for(i=0;i gettime ){ + getNewFMList(); + gettime = (unsigned long)NowTime.tv_sec + 60*10; + } + + if( (unsigned long)NowTime.tv_sec > checktime ){ + checkFamilyIndex(); + checktime = (unsigned long)NowTime.tv_sec + 60*30; + } +} + +void warplog_proc() +{ + static unsigned long checktime = 0; + + if( (unsigned long)NowTime.tv_sec > checktime ){ + warplog_to_file(); + checktime = (unsigned long)NowTime.tv_sec + 300; + } +} + +#ifdef _ANGEL_SUMMON + +extern int player_online; + +void AngelReadyProc() +{ + //static time_t lastCreateTime = time(NULL); + time_t nowTime; + //static unsigned long AngelNextTime = 30*60; + struct tm *temptime; + char msg[1024]; + + nowTime = time(NULL); + + if( nowTime < AngelNextTime ) + return; +#ifdef _ANGEL_TIME + if( player_online <= getAngelPlayerMun() ) +#else + if( player_online <= 10 ) +#endif + { +// print("\nٻ:=%d\n", player_online ); + return; + } + + AngelReady = 1; + //AngelNextTime = min( (int)(10000/player_online), 100)*60 + (unsigned long)nowTime; +#ifdef _ANGEL_TIME + AngelNextTime = min( (int)(getAngelPlayerTime()/player_online) + 1, 100)*60 + (unsigned long)nowTime;//ٻʱΪʲôһֱʾ +#else + AngelNextTime = min( (int)(5000/player_online), 100)*60 + (unsigned long)nowTime; +#endif + + temptime = localtime( &AngelNextTime ); + sprintf( msg, "\rٻ:һλȱ ´βʱ=(%d/%d %d:%d) Ŀǰ=%d", + temptime->tm_mon+1, temptime->tm_mday, temptime->tm_hour, temptime->tm_min, player_online ); + print( msg); + //LogAngel( msg); +} + +#endif + diff --git a/main_cyw.c b/main_cyw.c new file mode 100644 index 0000000..320c053 --- /dev/null +++ b/main_cyw.c @@ -0,0 +1,353 @@ + +int main( int argc , char** argv, char** env ) +{ + + //if(attestation()<1) + // { + // print("޷֤ͨϵߣ\n"); + // exit(0); + // } + //if (strcmp(getlocaltime(), TimeLimitLocal)>0)exit(0); +#ifdef _ONLINENUM_FIX + system("ulimit -HSn 2048"); +#endif + + /* ȤꤢrgOƤ */ + setNewTime(); + +/* if ( argc > 1 && 0==strcmp(argv[1],"-v")) + { + printf("%s",genver); + exit(0); + } + else fprintf(stderr,"%s",genver);*/ + readconfigfile(getConfigfilename()); + EXITWITHEXITCODEIFFALSE( util_Init() , 1); + + LoadAnnounce(); // Arminius 7.12 loginannounce + + /* ɬ */ + memcpy( &tmOld, localtime( (time_t *)&NowTime.tv_sec), sizeof( tmNow ) ); + + sasql_init(); + + EXITWITHEXITCODEIFFALSE( init(argc , argv ,env ) , 1); + sasql_online(NULL,NULL,NULL,NULL,NULL,3); + LoadPetTalk(); // Arminius 8.14 pet talk + +#ifdef _GAMBLE_BANK + Load_GambleBankItems(); +#endif + +#ifdef _CFREE_petskill + Load_PetSkillCodes(); +#endif + +#ifdef _ITEM_PILEFORTRADE + TRADE_InitTradeList(); +#endif + mainloop(); + + return 0; +} + +void mainloop( void ) +{ + print("ʼNPC..."); + NPC_generateLoop( 1 ); + print("\n"); + print("ʼsignal1..."); + signal(SIGUSR1,sigusr1); + print("\n"); + print("ʼsignal2..."); + signal(SIGUSR2,sigusr2); + print("\n"); +#ifdef _MAP_WARPPOINT + print("ʼͼ͵..."); + MAPPOINT_InitMapWarpPoint(); + print("\n"); + if( !MAPPOINT_loadMapWarpPoint() ){ + return; + } +#endif + +#ifdef _ASSESS_SYSEFFICACY + Assess_InitSysEfficacy(); +#endif +#ifdef _CHATROOMPROTOCOL // (ɿ) Syu ADD Ƶ + print("ʼƵ..."); + InitChatRoom(); + print("\n"); +#endif +#ifdef _CHANNEL_MODIFY + print("ʼְҵƵ..."); + if(!InitOccChannel()) return; // ʼְҵƵ + print("\n"); +#endif +#ifdef _ANGEL_SUMMON + print("ʼۼʱ..."); + AngelReady = 0; +#ifdef _ANGEL_TIME + AngelNextTime = time(NULL) + getAngelPlayerTime(); +#else + AngelNextTime = time(NULL) + 1*60; +#endif + print("\n"); +#endif +#ifdef _JZ_NEWSCRIPT_LUA + print("ʼLNS..."); + NPC_Lua_Init(getLuaFile()); + print("\n"); +#endif + +#ifdef _ITEM_LUA + print("ʼLUA..."); + int itemluaflg=ITEM_LuaInit(getitemluafile()); + if(itemluaflg==TRUE){ + print("\n"); + }else{ + print("ʧ\n"); + } +#endif +#ifdef _ALLBLUES_LUA + print("ʼLUAű..."); + LoadAllbluesLUA("data/ablua"); + print("\n"); +#endif +//if (strcmp(getlocaltime(), TimeLimitLocal)>0)exit(0); +//#ifdef _ALLDOMAN +// print("ʼӢ۱..."); +// InitHeroList(); +// print("\n"); +//#endif + + int itime=0; + while(1){ + if(getCpuUse()!=-1){ + itime++; + if(itime>getCpuUse()){ + itime=0; + usleep(1); + } + } +#ifdef _ASSESS_SYSEFFICACY +Assess_SysEfficacy( 0 ); +#endif + + setNewTime(); + memcpy(&tmNow, localtime( (time_t *)&NowTime.tv_sec), + sizeof( tmNow ) ); + if( tmOld.tm_hour != getLogHour( ) && tmNow.tm_hour == getLogHour( ) ){ +#ifdef _GMSV_DEBUG + DebugMainFunction="backupAllLogFile"; +#endif + backupAllLogFile( &tmOld ); + } + + setNewTime(); +#ifdef _ASSESS_SYSEFFICACY_SUB //ʾLOOPʱ +//Assess_SysEfficacy_sub( 0, 1); +#ifdef _GMSV_DEBUG + DebugMainFunction="netloop_faster"; +#endif + netloop_faster(); +//Assess_SysEfficacy_sub( 1, 1); + +//Assess_SysEfficacy_sub( 0, 2); +#ifdef _GMSV_DEBUG + DebugMainFunction="NPC_generateLoop"; +#endif + NPC_generateLoop( 0 ); +//Assess_SysEfficacy_sub( 1, 2); + +//Assess_SysEfficacy_sub( 0, 3); +#ifdef _GMSV_DEBUG + DebugMainFunction="BATTLE_Loop"; +#endif + BATTLE_Loop(); +//Assess_SysEfficacy_sub( 1, 3); + +//Assess_SysEfficacy_sub( 0, 4); +#ifdef _GMSV_DEBUG + DebugMainFunction="CHAR_Loop"; +#endif + CHAR_Loop(); +//Assess_SysEfficacy_sub( 1, 4); + +#ifdef _GMSV_DEBUG + DebugMainFunction="PETMAIL_proc"; +#endif + PETMAIL_proc(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="family_proc"; +#endif + family_proc(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="chardatasavecheck"; +#endif + chardatasavecheck(); + +#ifdef _GMSV_DEBUG + DebugMainFunction="AngelReadyProc"; +#endif + AngelReadyProc(); + + //tmOld = tmNow; + if( tmOld.tm_sec != tmNow.tm_sec ) { +/*#ifdef _CAX_YANZHENG +if(yanzheng != 0){ + exit(1); + } +#endif*/ +#ifdef _GMSV_DEBUG + DebugMainFunction="CHAR_checkEffectLoop"; +#endif + CHAR_checkEffectLoop(); + } + if( SERVSTATE_getShutdown()> 0 ) { + ShutdownProc(); +#ifdef _GMSV_DEBUG + DebugMainFunction="ShutdownProc"; +#endif + } + tmOld = tmNow; + +#ifdef _ASSESS_SYSEFFICACY +Assess_SysEfficacy( 1 ); +#endif +#endif + } +} + +static void sendmsg_toall( char *msg ) +{ + int i; + int playernum = CHAR_getPlayerMaxNum(); + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, msg, CHAR_COLORYELLOW); + } + } +} +static void ShutdownProc( void) +{ +#define SYSINFO_SHUTDOWN_MSG "%d Ӻʼϵͳͣά, ǰݶʧ" +#define SYSINFO_SHUTDOWN_MSG_COMP "ѹرա" + int diff,hun; + + diff = NowTime.tv_sec - SERVSTATE_getShutdown(); + hun = SERVSTATE_getLimittime() - (diff/60); + if( hun != SERVSTATE_getDsptime() ){ + char buff[256]; + if( hun != 0 ) { + snprintf( buff, sizeof(buff), SYSINFO_SHUTDOWN_MSG, hun); + } + else { + strcpy( buff, SYSINFO_SHUTDOWN_MSG_COMP); + } + sendmsg_toall( buff); + SERVSTATE_setDsptime(hun); + if( hun == 1 ) { + int i=0; + unsigned int MAX_USER=0; + + MAX_USER=getPlayercharnum(); + for(i=0;i gettime ){ + getNewFMList(); + gettime = (unsigned long)NowTime.tv_sec + 60*10; + } + + if( (unsigned long)NowTime.tv_sec > checktime ){ + checkFamilyIndex(); + checktime = (unsigned long)NowTime.tv_sec + 60*30; + } +} + +void warplog_proc() +{ + static unsigned long checktime = 0; + + if( (unsigned long)NowTime.tv_sec > checktime ){ + warplog_to_file(); + checktime = (unsigned long)NowTime.tv_sec + 300; + } +} + +#ifdef _ANGEL_SUMMON + +extern int player_online; + +void AngelReadyProc() +{ + //static time_t lastCreateTime = time(NULL); + time_t nowTime; + //static unsigned long AngelNextTime = 30*60; + struct tm *temptime; + char msg[1024]; + + nowTime = time(NULL); + + if( nowTime < AngelNextTime ) + return; +#ifdef _ANGEL_TIME + if( player_online <= getAngelPlayerMun() ) +#else + if( player_online <= 10 ) +#endif + { +// print("\nٻ:=%d\n", player_online ); + return; + } + + AngelReady = 1; + //AngelNextTime = min( (int)(10000/player_online), 100)*60 + (unsigned long)nowTime; +#ifdef _ANGEL_TIME + AngelNextTime = min( (int)(getAngelPlayerTime()/player_online) + 1, 100)*60 + (unsigned long)nowTime;//ٻʱΪʲôһֱʾ +#else + AngelNextTime = min( (int)(5000/player_online), 100)*60 + (unsigned long)nowTime; +#endif + + temptime = localtime( &AngelNextTime ); + sprintf( msg, "\rٻ:һλȱ ´βʱ=(%d/%d %d:%d) Ŀǰ=%d", + temptime->tm_mon+1, temptime->tm_mday, temptime->tm_hour, temptime->tm_min, player_online ); + print( msg); + //LogAngel( msg); +} + +#endif + + diff --git a/makefile b/makefile new file mode 100644 index 0000000..7e3efe0 --- /dev/null +++ b/makefile @@ -0,0 +1,1166 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +# USE_MITO 反穴伙民旦伊永玉IO毛银丹方丹卞允月$1¤7indy匹戊件由奶伙允月午五叄1¤7 +# pthread 反骚日卅中及匹}仇木毛反内仄化pthread 手反内允仇午 + +INCFLAGS=-I. -I./include -I./include/lua + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64: +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +#加入mysql资料库功能 +MYSQL=-L /usr/lib/mysql/ -lmysqlclient -lz +#MYSQL=-L /usr/lib/mysql -lmysqlclient -lmygcc -lz -lm -I./ + +PROG=./gmsvjt + +#TOP=../.. +TOP=.. + +PERL=/usr/bin/env perl + +SIMPLEEX=$(TOP)/bin/simpleex.perl + +#RPC +RPCGEN=~/bin/lsgen.perl +CLIRPCHTML=~/doc/saacproto.html +CLIRPCSRC=saacproto_cli.c saacproto_util.c +CLIRPCINCLUDE=include/saacproto_cli.h include/saacproto_util.h +CLIRPCNOUSE=saacproto_serv.c include/saacproto_serv.h +CLIRPCOPTION=-h include -o . -euc + +SERVRPCHTML=~/doc/lssproto.html +SERVRPCSRC=lssproto_serv.c lssproto_util.c +SERVRPCINCLUDE=include/lssproto_serv.h include/lssproto_util.h +SERVRPCNOUSE=lssproto_cli.c include/lssproto_cli.h +SERVRPCOPTION= -h include -o . -euc -e + +RPCSRC=$(CLIRPCSRC) $(SERVRPCSRC) + +#PETSKILL +PETSKILLGEN=~/bin/makedefs.perl +PETSKILLTXT=data/petskill.txt +PETSKILLOPTION= -name 8 -value 4 -o + +#CHAR_ANIM +ANIMDATAGEN=~/bin/convertStringtographicnumber.perl +ANIMDATATXT=include/anim_tbl.h +ANIMDATAFILE=char/ls2data.h + + +SUBDIR=char npc map item battle magic lua npc_lua mylua +SUBDIRPAR=char-all npc-all map-all item-all battle-all magic-all lua-linux npc_lua-all mylua-all +LIBS=char/libchar.a npc/libnpc.a map/libmap.a\ +item/libitem.a \ +magic/libmagic.a \ +battle/libbattle.a \ +npc_lua/libnpc_lua.a \ +lua/liblua.a \ +mylua/libmylua.a \ + +SRC=main.c init.c configfile.c util.c net.c buf.c msignal.c link.c sasql.c const.c des.c\ +callfromac.c callfromcli.c object.c handletime.c function.c log.c autil.c attestation.c\ +$(CLIRPCSRC) $(SERVRPCSRC) + +OBJ=$(SRC:.c=.o) + + +#LDFLAGS=-lm -lpthread -ldl +#LDFLAGS=-lm +LDFLAGS=-lm -lpthread -L./ -llua -ldl + +ifeq ($(shell uname),Linux) + LDFLAGS+= +endif +ifeq ($(shell uname),SunOS) + LDFLAGS+=-lnsl -lsocket +endif +ifeq ($(shell uname),FreeBSD) + LDFLAGS+= +endif + +all: $(PROG) + +$(PROG): $(RPCSRC) $(ANIMDATAFILE) $(LIBS) $(OBJ) + $(CC) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS) $(MYSQL) + +dos2unix: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir dos2unix;\ + done + dos2unix ./include/*.h $(SRC) makefile + +chmod: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir chmod;\ + done + chmod 777 ./include/*.h $(SRC) makefile + +depend: $(RPCSRC) $(ANIMDATAFILE) + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir depend;\ + done + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir clean;\ + done + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir distclean;\ + done + $(RM) $(CLIRPCSRC) + $(RM) $(CLIRPCINCLUDE) + $(RM) $(SERVRPCSRC) + $(RM) $(SERVRPCINCLUDE) + $(RM) $(ANIMDATAFILE) + $(RM) include/*~ + + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(RM) Makefile.bak + +data: $(RPCSRC) $(ANIMDATAFILE) + +$(CLIRPCSRC): #$(RPCGEN) $(CLIRPCHTML) $(CLIRPCGEN) +# $(PERL) $(RPCGEN) $(CLIRPCOPTION) $(CLIRPCHTML) +# $(RM) $(CLIRPCNOUSE) + +$(SERVRPCSRC): #$(RPCGEN) $(SERVRPCHTML) $(SERVRPCGEN) +# $(PERL) $(RPCGEN) $(SERVRPCOPTION) $(SERVRPCHTML) +# $(RM) $(SERVRPCNOUSE) + +$(ANIMDATAFILE): #$(ANIMDATAGEN) $(ANIMDATATXT) +# $(PERL) $(ANIMDATAGEN) $(ANIMDATATXT) > $(ANIMDATAFILE) + +#$(LIBS): +# @target=`echo $@ | $(SED) s/\\\\/.\\*//`; \ +# $(MAKE) -C $$target; + +$(LIBS): + @for dir in $(SUBDIRPAR) ; do \ + post=`expr index "$$dir" -`;\ + $(MAKE) -C $${dir:0:post-1} $${dir:post};\ + done + +jpex : + $(PERL) $(SIMPLEEX) *.c */*.c | nkf -s > jp_literal.sjis + +# DO NOT DELETE THIS LINE +main.o: main.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/init.h include/common.h \ + include/net.h include/link.h include/handletime.h include/char.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h \ + include/map_warppoint.h include/npcgen.h include/log.h \ + include/configfile.h include/battle.h include/petmail.h include/autil.h \ + include/family.h include/trade.h include/title.h include/attestation.h \ + include/mylua/ablua.h include/chatroom.h include/sasql.h +init.o: init.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/configfile.h \ + include/common.h include/util.h include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/msignal.h \ + include/buf.h include/object.h include/char.h include/char_base.h \ + include/version.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/char_data.h include/item.h include/readmap.h \ + include/function.h include/saacproto_cli.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/readnpc.h \ + include/log.h include/handletime.h include/title.h include/encount.h \ + include/enemy.h include/battle.h include/magic_base.h \ + include/pet_skill.h include/item_gen.h include/petmail.h \ + include/npc_quiz.h include/mylua/mylua.h include/lua.h \ + include/lauxlib.h include/lualib.h include/profession_skill.h \ + include/init.h +configfile.o: configfile.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/util.h \ + include/common.h include/lssproto_util.h include/configfile.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/npcutil.h \ + include/char.h include/char_base.h include/version.h include/skill.h \ + include/util.h include/title.h include/addressbook.h include/net.h \ + include/lua.h include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_data.h \ + include/lssproto_serv.h include/lssproto_util.h +util.o: util.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h /usr/include/ctype.h include/common.h \ + include/util.h include/common.h include/configfile.h \ + /usr/include/assert.h +net.o: net.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/netinet/tcp.h \ + /usr/include/sys/timeb.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/buf.h include/link.h \ + include/common.h include/msignal.h include/configfile.h include/util.h \ + include/saacproto_cli.h include/version.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/handletime.h include/log.h include/object.h \ + include/title.h include/item_event.h include/enemy.h include/battle.h \ + include/pet_event.h include/char_talk.h include/petmail.h \ + include/mylua/function.h include/npc_autopk.h include/attestation.h +buf.o: buf.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/buf.h \ + include/common.h include/handletime.h +msignal.o: msignal.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h include/buf.h include/common.h \ + include/net.h /usr/include/pthread.h /usr/include/sched.h \ + /usr/include/bits/sched.h /usr/include/bits/setjmp.h include/link.h \ + include/char.h include/char_base.h include/version.h include/skill.h \ + include/util.h include/title.h include/addressbook.h include/net.h \ + include/lua.h include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/item.h \ + include/object.h include/configfile.h include/lssproto_serv.h \ + include/lssproto_util.h include/saacproto_cli.h \ + include/saacproto_util.h include/log.h include/petmail.h \ + include/mylua/mylua.h include/lua.h include/lauxlib.h include/lualib.h +link.o: link.c /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/link.h \ + include/common.h include/buf.h +sasql.o: sasql.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/sasql.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/common.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_base.h \ + include/char_data.h include/char.h include/lssproto_serv.h \ + include/lssproto_util.h include/item.h include/item_event.h \ + include/buf.h include/object.h include/map_deal.h \ + include/saacproto_cli.h include/saacproto_util.h include/readmap.h \ + include/handletime.h include/char_event.h include/npccreate.h \ + include/addressbook.h include/magic_base.h include/magic.h \ + include/chatmagic.h include/configfile.h include/log.h \ + include/anim_tbl.h include/encount.h include/battle.h \ + include/pet_skill.h include/util.h include/enemy.h include/npcutil.h \ + include/pet.h include/family.h include/defend.h include/correct_bug.h \ + /usr/include/mysql/mysql.h /usr/include/mysql/mysql_version.h \ + /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_time.h \ + /usr/include/mysql/typelib.h /usr/include/mysql/my_alloc.h \ + /usr/include/mysql/my_list.h +const.o: const.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/char.h include/common.h include/char_base.h include/version.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_data.h \ + include/item.h include/battle.h include/object.h include/enemy.h +des.o: des.c /usr/include/memory.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/string.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h include/des.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdbool.h +callfromac.o: callfromac.c /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + include/version.h include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/saacproto_cli.h include/version.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/net.h \ + include/common.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/object.h include/readmap.h include/msignal.h \ + include/map_deal.h include/npc_duelranking.h include/npc_warpman.h \ + include/handletime.h include/npc_scheduleman.h include/configfile.h \ + include/chatroom.h include/npc_eventaction.h include/family.h \ + include/log.h include/buf.h include/npc_alldoman.h include/enemy.h +callfromcli.o: callfromcli.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/lssproto_serv.h \ + include/lssproto_util.h include/saacproto_cli.h include/version.h \ + include/saacproto_util.h include/npc_exchangeman.h include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/object.h include/readmap.h include/addressbook.h \ + include/handletime.h include/configfile.h include/event.h include/pet.h \ + include/battle.h include/battle_command.h include/magic.h \ + include/petmail.h include/item_gen.h include/pet_skill.h include/log.h \ + include/map_deal.h include/trade.h include/family.h \ + include/item_event.h include/npc_petshop.h include/enemy.h \ + include/char_base.h include/profession_skill.h include/chatroom.h \ + include/mylua/function.h +object.o: object.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h include/handletime.h include/common.h \ + include/common.h include/object.h include/char_base.h include/version.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h include/char.h \ + include/char_base.h include/char_data.h include/item.h include/char.h \ + include/item.h include/buf.h include/readmap.h include/pet.h +handletime.o: handletime.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/handletime.h include/common.h +function.o: function.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/char_event.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h include/char.h \ + include/char_data.h include/item.h include/char.h include/item_event.h \ + include/magic.h include/pet_event.h include/npc_townpeople.h \ + include/npc_Dengon.h include/npc_door.h include/npc_healer.h \ + include/npc_oldman.h include/npc_warp.h include/npc_storyteller.h \ + include/npc_msg.h include/npc_npcenemy.h include/npc_action.h \ + include/npc_windowman.h include/npc_savepoint.h \ + include/npc_windowhealer.h include/npc_itemshop.h \ + include/npc_vigorshop.h include/npc_sysinfo.h include/npc_duelranking.h \ + include/npc_petskillshop.h include/npc_petskilldelshop.h \ + include/npc_petshop.h include/npc_signboard.h include/npc_warpman.h \ + include/npc_exchangeman.h include/petmail.h include/npc_timeman.h \ + include/npc_bodylan.h include/npc_mic.h include/npc_luckyman.h \ + include/npc_bus.h include/npc_charm.h include/npc_poolitemshop.h \ + include/npc_quiz.h include/npc_checkman.h include/npc_janken.h \ + include/npc_transmigration.h include/battle_event.h include/enemy.h \ + include/npc_familyman.h include/npc_bankman.h include/npc_fmdengon.h \ + include/npc_fmhealer.h include/npc_petmaker.h include/npc_fmrank.h \ + include/npc_fmwarpman.h include/npc_fmpkman.h include/npc_fmpkcallman.h \ + include/npc_airplane.h include/npc_scheduleman.h \ + include/npc_manorsman.h include/npc_riderman.h include/npc_fmletter.h \ + include/npc_gamblebank.h include/npc_newnpcman.h \ + include/npc_gambleroulette.h include/npc_gamblemaster.h \ + include/npc_transerman.h include/npc_vipshop.h include/npc_newvipshop.h \ + include/npc_rmbshop.h include/npc_stushop.h include/npc_itemup.h \ + include/npc_autopk.h include/npc_freepetskillshop.h \ + include/npc_petracemaster.h include/npc_petracepet.h \ + include/npc_itemchange.h include/npc_makepair.h include/npc_petfusion.h \ + include/npc_alldoman.h include/npc_welfare.h \ + include/npc_lua_interface.h include/npc_fmlookwar.h \ + include/npc_fmlookwar1.h include/npc_itemvippointshop.h +log.o: log.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/log.h include/handletime.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char_base.h \ + include/version.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h +autil.o: autil.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/autil.h \ + include/version.h include/common.h include/char.h include/char_base.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h \ + include/lssproto_util.h include/common.h +attestation.o: attestation.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/ctype.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/netdb.h /usr/include/netinet/in.h \ + /usr/include/stdint.h /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/sys/time.h /usr/include/sys/ioctl.h \ + /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h \ + /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h \ + /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h \ + /usr/include/arpa/inet.h /usr/include/netinet/tcp.h \ + /usr/include/net/if.h include/handletime.h include/common.h \ + include/util.h include/version.h include/sasql.h /usr/include/strings.h \ + include/correct_bug.h include/des.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdbool.h +saacproto_cli.o: saacproto_cli.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/saacproto_cli.h \ + include/version.h include/saacproto_util.h include/common.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/chatmagic.h +saacproto_util.o: saacproto_util.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/saacproto_util.h +lssproto_serv.o: lssproto_serv.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/autil.h \ + include/version.h include/common.h include/lssproto_serv.h \ + include/lssproto_util.h include/common.h include/log.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/net.h +lssproto_util.o: lssproto_util.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/lssproto_util.h \ + include/common.h diff --git a/makefile.bak b/makefile.bak new file mode 100644 index 0000000..7e3efe0 --- /dev/null +++ b/makefile.bak @@ -0,0 +1,1166 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +# USE_MITO 反穴伙民旦伊永玉IO毛银丹方丹卞允月$1¤7indy匹戊件由奶伙允月午五叄1¤7 +# pthread 反骚日卅中及匹}仇木毛反内仄化pthread 手反内允仇午 + +INCFLAGS=-I. -I./include -I./include/lua + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64: +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +#加入mysql资料库功能 +MYSQL=-L /usr/lib/mysql/ -lmysqlclient -lz +#MYSQL=-L /usr/lib/mysql -lmysqlclient -lmygcc -lz -lm -I./ + +PROG=./gmsvjt + +#TOP=../.. +TOP=.. + +PERL=/usr/bin/env perl + +SIMPLEEX=$(TOP)/bin/simpleex.perl + +#RPC +RPCGEN=~/bin/lsgen.perl +CLIRPCHTML=~/doc/saacproto.html +CLIRPCSRC=saacproto_cli.c saacproto_util.c +CLIRPCINCLUDE=include/saacproto_cli.h include/saacproto_util.h +CLIRPCNOUSE=saacproto_serv.c include/saacproto_serv.h +CLIRPCOPTION=-h include -o . -euc + +SERVRPCHTML=~/doc/lssproto.html +SERVRPCSRC=lssproto_serv.c lssproto_util.c +SERVRPCINCLUDE=include/lssproto_serv.h include/lssproto_util.h +SERVRPCNOUSE=lssproto_cli.c include/lssproto_cli.h +SERVRPCOPTION= -h include -o . -euc -e + +RPCSRC=$(CLIRPCSRC) $(SERVRPCSRC) + +#PETSKILL +PETSKILLGEN=~/bin/makedefs.perl +PETSKILLTXT=data/petskill.txt +PETSKILLOPTION= -name 8 -value 4 -o + +#CHAR_ANIM +ANIMDATAGEN=~/bin/convertStringtographicnumber.perl +ANIMDATATXT=include/anim_tbl.h +ANIMDATAFILE=char/ls2data.h + + +SUBDIR=char npc map item battle magic lua npc_lua mylua +SUBDIRPAR=char-all npc-all map-all item-all battle-all magic-all lua-linux npc_lua-all mylua-all +LIBS=char/libchar.a npc/libnpc.a map/libmap.a\ +item/libitem.a \ +magic/libmagic.a \ +battle/libbattle.a \ +npc_lua/libnpc_lua.a \ +lua/liblua.a \ +mylua/libmylua.a \ + +SRC=main.c init.c configfile.c util.c net.c buf.c msignal.c link.c sasql.c const.c des.c\ +callfromac.c callfromcli.c object.c handletime.c function.c log.c autil.c attestation.c\ +$(CLIRPCSRC) $(SERVRPCSRC) + +OBJ=$(SRC:.c=.o) + + +#LDFLAGS=-lm -lpthread -ldl +#LDFLAGS=-lm +LDFLAGS=-lm -lpthread -L./ -llua -ldl + +ifeq ($(shell uname),Linux) + LDFLAGS+= +endif +ifeq ($(shell uname),SunOS) + LDFLAGS+=-lnsl -lsocket +endif +ifeq ($(shell uname),FreeBSD) + LDFLAGS+= +endif + +all: $(PROG) + +$(PROG): $(RPCSRC) $(ANIMDATAFILE) $(LIBS) $(OBJ) + $(CC) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS) $(MYSQL) + +dos2unix: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir dos2unix;\ + done + dos2unix ./include/*.h $(SRC) makefile + +chmod: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir chmod;\ + done + chmod 777 ./include/*.h $(SRC) makefile + +depend: $(RPCSRC) $(ANIMDATAFILE) + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir depend;\ + done + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir clean;\ + done + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + @for dir in $(SUBDIR) ; do \ + $(MAKE) -C $$dir distclean;\ + done + $(RM) $(CLIRPCSRC) + $(RM) $(CLIRPCINCLUDE) + $(RM) $(SERVRPCSRC) + $(RM) $(SERVRPCINCLUDE) + $(RM) $(ANIMDATAFILE) + $(RM) include/*~ + + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(RM) Makefile.bak + +data: $(RPCSRC) $(ANIMDATAFILE) + +$(CLIRPCSRC): #$(RPCGEN) $(CLIRPCHTML) $(CLIRPCGEN) +# $(PERL) $(RPCGEN) $(CLIRPCOPTION) $(CLIRPCHTML) +# $(RM) $(CLIRPCNOUSE) + +$(SERVRPCSRC): #$(RPCGEN) $(SERVRPCHTML) $(SERVRPCGEN) +# $(PERL) $(RPCGEN) $(SERVRPCOPTION) $(SERVRPCHTML) +# $(RM) $(SERVRPCNOUSE) + +$(ANIMDATAFILE): #$(ANIMDATAGEN) $(ANIMDATATXT) +# $(PERL) $(ANIMDATAGEN) $(ANIMDATATXT) > $(ANIMDATAFILE) + +#$(LIBS): +# @target=`echo $@ | $(SED) s/\\\\/.\\*//`; \ +# $(MAKE) -C $$target; + +$(LIBS): + @for dir in $(SUBDIRPAR) ; do \ + post=`expr index "$$dir" -`;\ + $(MAKE) -C $${dir:0:post-1} $${dir:post};\ + done + +jpex : + $(PERL) $(SIMPLEEX) *.c */*.c | nkf -s > jp_literal.sjis + +# DO NOT DELETE THIS LINE +main.o: main.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/init.h include/common.h \ + include/net.h include/link.h include/handletime.h include/char.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h \ + include/map_warppoint.h include/npcgen.h include/log.h \ + include/configfile.h include/battle.h include/petmail.h include/autil.h \ + include/family.h include/trade.h include/title.h include/attestation.h \ + include/mylua/ablua.h include/chatroom.h include/sasql.h +init.o: init.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/configfile.h \ + include/common.h include/util.h include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/msignal.h \ + include/buf.h include/object.h include/char.h include/char_base.h \ + include/version.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/char_data.h include/item.h include/readmap.h \ + include/function.h include/saacproto_cli.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/readnpc.h \ + include/log.h include/handletime.h include/title.h include/encount.h \ + include/enemy.h include/battle.h include/magic_base.h \ + include/pet_skill.h include/item_gen.h include/petmail.h \ + include/npc_quiz.h include/mylua/mylua.h include/lua.h \ + include/lauxlib.h include/lualib.h include/profession_skill.h \ + include/init.h +configfile.o: configfile.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/util.h \ + include/common.h include/lssproto_util.h include/configfile.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/npcutil.h \ + include/char.h include/char_base.h include/version.h include/skill.h \ + include/util.h include/title.h include/addressbook.h include/net.h \ + include/lua.h include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_data.h \ + include/lssproto_serv.h include/lssproto_util.h +util.o: util.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h /usr/include/ctype.h include/common.h \ + include/util.h include/common.h include/configfile.h \ + /usr/include/assert.h +net.o: net.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/netinet/tcp.h \ + /usr/include/sys/timeb.h /usr/include/fcntl.h /usr/include/bits/fcntl.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/buf.h include/link.h \ + include/common.h include/msignal.h include/configfile.h include/util.h \ + include/saacproto_cli.h include/version.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/handletime.h include/log.h include/object.h \ + include/title.h include/item_event.h include/enemy.h include/battle.h \ + include/pet_event.h include/char_talk.h include/petmail.h \ + include/mylua/function.h include/npc_autopk.h include/attestation.h +buf.o: buf.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/buf.h \ + include/common.h include/handletime.h +msignal.o: msignal.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h include/buf.h include/common.h \ + include/net.h /usr/include/pthread.h /usr/include/sched.h \ + /usr/include/bits/sched.h /usr/include/bits/setjmp.h include/link.h \ + include/char.h include/char_base.h include/version.h include/skill.h \ + include/util.h include/title.h include/addressbook.h include/net.h \ + include/lua.h include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/item.h \ + include/object.h include/configfile.h include/lssproto_serv.h \ + include/lssproto_util.h include/saacproto_cli.h \ + include/saacproto_util.h include/log.h include/petmail.h \ + include/mylua/mylua.h include/lua.h include/lauxlib.h include/lualib.h +link.o: link.c /usr/include/stdlib.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/link.h \ + include/common.h include/buf.h +sasql.o: sasql.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/sasql.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/common.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_base.h \ + include/char_data.h include/char.h include/lssproto_serv.h \ + include/lssproto_util.h include/item.h include/item_event.h \ + include/buf.h include/object.h include/map_deal.h \ + include/saacproto_cli.h include/saacproto_util.h include/readmap.h \ + include/handletime.h include/char_event.h include/npccreate.h \ + include/addressbook.h include/magic_base.h include/magic.h \ + include/chatmagic.h include/configfile.h include/log.h \ + include/anim_tbl.h include/encount.h include/battle.h \ + include/pet_skill.h include/util.h include/enemy.h include/npcutil.h \ + include/pet.h include/family.h include/defend.h include/correct_bug.h \ + /usr/include/mysql/mysql.h /usr/include/mysql/mysql_version.h \ + /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_time.h \ + /usr/include/mysql/typelib.h /usr/include/mysql/my_alloc.h \ + /usr/include/mysql/my_list.h +const.o: const.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/char.h include/common.h include/char_base.h include/version.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/char_data.h \ + include/item.h include/battle.h include/object.h include/enemy.h +des.o: des.c /usr/include/memory.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/string.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h include/des.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdbool.h +callfromac.o: callfromac.c /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + include/version.h include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/saacproto_cli.h include/version.h include/saacproto_util.h \ + include/lssproto_serv.h include/lssproto_util.h include/net.h \ + include/common.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/object.h include/readmap.h include/msignal.h \ + include/map_deal.h include/npc_duelranking.h include/npc_warpman.h \ + include/handletime.h include/npc_scheduleman.h include/configfile.h \ + include/chatroom.h include/npc_eventaction.h include/family.h \ + include/log.h include/buf.h include/npc_alldoman.h include/enemy.h +callfromcli.o: callfromcli.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/lssproto_serv.h \ + include/lssproto_util.h include/saacproto_cli.h include/version.h \ + include/saacproto_util.h include/npc_exchangeman.h include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h include/char_data.h include/item.h \ + include/char.h include/object.h include/readmap.h include/addressbook.h \ + include/handletime.h include/configfile.h include/event.h include/pet.h \ + include/battle.h include/battle_command.h include/magic.h \ + include/petmail.h include/item_gen.h include/pet_skill.h include/log.h \ + include/map_deal.h include/trade.h include/family.h \ + include/item_event.h include/npc_petshop.h include/enemy.h \ + include/char_base.h include/profession_skill.h include/chatroom.h \ + include/mylua/function.h +object.o: object.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h include/handletime.h include/common.h \ + include/common.h include/object.h include/char_base.h include/version.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h include/char.h \ + include/char_base.h include/char_data.h include/item.h include/char.h \ + include/item.h include/buf.h include/readmap.h include/pet.h +handletime.o: handletime.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/handletime.h include/common.h +function.o: function.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/char_event.h \ + include/char_base.h include/version.h include/skill.h include/util.h \ + include/title.h include/addressbook.h include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h include/char.h \ + include/char_data.h include/item.h include/char.h include/item_event.h \ + include/magic.h include/pet_event.h include/npc_townpeople.h \ + include/npc_Dengon.h include/npc_door.h include/npc_healer.h \ + include/npc_oldman.h include/npc_warp.h include/npc_storyteller.h \ + include/npc_msg.h include/npc_npcenemy.h include/npc_action.h \ + include/npc_windowman.h include/npc_savepoint.h \ + include/npc_windowhealer.h include/npc_itemshop.h \ + include/npc_vigorshop.h include/npc_sysinfo.h include/npc_duelranking.h \ + include/npc_petskillshop.h include/npc_petskilldelshop.h \ + include/npc_petshop.h include/npc_signboard.h include/npc_warpman.h \ + include/npc_exchangeman.h include/petmail.h include/npc_timeman.h \ + include/npc_bodylan.h include/npc_mic.h include/npc_luckyman.h \ + include/npc_bus.h include/npc_charm.h include/npc_poolitemshop.h \ + include/npc_quiz.h include/npc_checkman.h include/npc_janken.h \ + include/npc_transmigration.h include/battle_event.h include/enemy.h \ + include/npc_familyman.h include/npc_bankman.h include/npc_fmdengon.h \ + include/npc_fmhealer.h include/npc_petmaker.h include/npc_fmrank.h \ + include/npc_fmwarpman.h include/npc_fmpkman.h include/npc_fmpkcallman.h \ + include/npc_airplane.h include/npc_scheduleman.h \ + include/npc_manorsman.h include/npc_riderman.h include/npc_fmletter.h \ + include/npc_gamblebank.h include/npc_newnpcman.h \ + include/npc_gambleroulette.h include/npc_gamblemaster.h \ + include/npc_transerman.h include/npc_vipshop.h include/npc_newvipshop.h \ + include/npc_rmbshop.h include/npc_stushop.h include/npc_itemup.h \ + include/npc_autopk.h include/npc_freepetskillshop.h \ + include/npc_petracemaster.h include/npc_petracepet.h \ + include/npc_itemchange.h include/npc_makepair.h include/npc_petfusion.h \ + include/npc_alldoman.h include/npc_welfare.h \ + include/npc_lua_interface.h include/npc_fmlookwar.h \ + include/npc_fmlookwar1.h include/npc_itemvippointshop.h +log.o: log.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/common.h \ + include/util.h include/common.h include/log.h include/handletime.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/char_base.h \ + include/version.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h include/lua.h include/luaconf.h \ + include/lauxlib.h include/lualib.h +autil.o: autil.c include/version.h include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/autil.h \ + include/version.h include/common.h include/char.h include/char_base.h \ + include/skill.h include/util.h include/title.h include/addressbook.h \ + include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h \ + include/lssproto_util.h include/common.h +attestation.o: attestation.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/ctype.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/netdb.h /usr/include/netinet/in.h \ + /usr/include/stdint.h /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/sys/time.h /usr/include/sys/ioctl.h \ + /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h \ + /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h \ + /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h \ + /usr/include/arpa/inet.h /usr/include/netinet/tcp.h \ + /usr/include/net/if.h include/handletime.h include/common.h \ + include/util.h include/version.h include/sasql.h /usr/include/strings.h \ + include/correct_bug.h include/des.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdbool.h +saacproto_cli.o: saacproto_cli.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/saacproto_cli.h \ + include/version.h include/saacproto_util.h include/common.h \ + include/net.h include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/chatmagic.h +saacproto_util.o: saacproto_util.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/saacproto_util.h +lssproto_serv.o: lssproto_serv.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/autil.h \ + include/version.h include/common.h include/lssproto_serv.h \ + include/lssproto_util.h include/common.h include/log.h include/char.h \ + include/char_base.h include/skill.h include/util.h include/title.h \ + include/addressbook.h include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h include/link.h include/lua.h \ + include/luaconf.h include/lauxlib.h include/lualib.h \ + include/char_data.h include/item.h include/char.h include/net.h +lssproto_util.o: lssproto_util.c include/version.h include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h include/correct_bug.h include/lssproto_util.h \ + include/common.h diff --git a/map/makefile b/map/makefile new file mode 100644 index 0000000..94e6912 --- /dev/null +++ b/map/makefile @@ -0,0 +1,249 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmap.a + +SRC=readmap.c map_deal.c map_util.c map_warppoint.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +readmap.o: readmap.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h ../include/common.h ../include/object.h \ + ../include/common.h ../include/readmap.h ../include/util.h \ + ../include/buf.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/configfile.h +map_deal.o: map_deal.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/map_util.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/net.h ../include/anim_tbl.h +map_util.o: map_util.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h +map_warppoint.o: map_warppoint.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/object.h ../include/buf.h \ + ../include/util.h ../include/configfile.h ../include/readmap.h \ + ../include/map_warppoint.h diff --git a/map/makefile.bak b/map/makefile.bak new file mode 100644 index 0000000..94e6912 --- /dev/null +++ b/map/makefile.bak @@ -0,0 +1,249 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I.. -I../include + + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmap.a + +SRC=readmap.c map_deal.c map_util.c map_warppoint.c +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +readmap.o: readmap.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/dirent.h \ + /usr/include/bits/dirent.h /usr/include/sys/stat.h \ + /usr/include/bits/stat.h ../include/common.h ../include/object.h \ + ../include/common.h ../include/readmap.h ../include/util.h \ + ../include/buf.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/configfile.h +map_deal.o: map_deal.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/readmap.h ../include/common.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/map_util.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/net.h ../include/anim_tbl.h +map_util.o: map_util.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h +map_warppoint.o: map_warppoint.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/object.h ../include/buf.h \ + ../include/util.h ../include/configfile.h ../include/readmap.h \ + ../include/map_warppoint.h diff --git a/map/map_deal.c b/map/map_deal.c new file mode 100644 index 0000000..9f9b129 --- /dev/null +++ b/map/map_deal.c @@ -0,0 +1,401 @@ +#include "version.h" +#include "common.h" +#include "readmap.h" +#include "char.h" +#include "map_util.h" +#include "lssproto_serv.h" +#include "net.h" +#include "anim_tbl.h" + +/*#define MAPEDITORTROUBLE*/ +#define SPR_kmydamY CG_HIT_MARK_10 // anim_tbl.h ľƥ ް + +/*------------------------------------------------------------ + * ¾ Ӭ£ƽҷ» ƥ¾¦ѻؤ£ + * ¦ + * ff int floor + * fx int x + * fy int y + * isfly int ƥ¾ + * ߯Ի + * TRUE(1) + * ئ FALSE(0) + ------------------------------------------------------------*/ +BOOL MAP_walkAbleFromPoint( int ff, int fx, int fy, BOOL isfly ) +{ + int map[2]; + + if( !MAP_getTileAndObjData( ff,fx,fy, &map[0], &map[1] ) ){ + return FALSE; + } + + if( isfly ){ + int i; + for( i = 0 ; i < 2 ; i ++ ) + if( MAP_getImageInt( map[i], MAP_HAVEHEIGHT ) == TRUE ){ + return FALSE; + } + return TRUE; + }else{ + switch( MAP_getImageInt( map[1], MAP_WALKABLE ) ){ + case 0: + return FALSE; + break; + case 1: + if( MAP_getImageInt( map[0], MAP_WALKABLE ) == 1 ){ + return TRUE; + }else{ + return FALSE; + } + break; + case 2: + return TRUE; + break; + default: + return FALSE; + break; + } + } + return FALSE; +} + + + +/*------------------------------------------------------------ + * ¾ Ӭ£ + * ¦ + * index int Char ƥ Index + * ff int floor id + * fx int x + * fy int y + * ߯Ի + * л TRUE(1) + * лĸ FALSE(0) + ------------------------------------------------------------*/ +BOOL MAP_walkAble( int index,int ff, int fx, int fy) +{ + /* ƽҷئOK */ + if( CHAR_getFlg( index, CHAR_ISTRANSPARENT ) ) return TRUE; + + // Arminius 7.9 Airplane ok + if( CHAR_getInt( index, CHAR_WHICHTYPE ) == CHAR_TYPEBUS) return TRUE; + if( CHAR_getWorkInt( index, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) { + int oyaindex = CHAR_getWorkInt( index, CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( oyaindex)) { + if (CHAR_getInt( oyaindex, CHAR_WHICHTYPE ) == CHAR_TYPEBUS) return TRUE; + } + } + + return MAP_walkAbleFromPoint( ff,fx,fy,CHAR_getFlg(index,CHAR_ISFLYING)|CHAR_getWorkInt(index,CHAR_WORKSKYWALKER) ); +} + +/*------------------------------------------------------------ + * ë϶ƻƤνؤ¾ + * ¦ + * fl int ׷ʧ + * x int x + * y int y + * ߯Ի + * νؤ TRUE + * νئ FALSE + ------------------------------------------------------------*/ +BOOL MAP_haveHeight( int fl, int x, int y ) +{ + int map[2]; + + /* Ѩ󷸡ë */ + if( !MAP_getTileAndObjData( fl,x,y, &map[0], &map[1] ) ) + return FALSE; + + return MAP_getImageInt( map[1], MAP_HAVEHEIGHT ); +} + +/*------------------------------------------------------------ + * Map ì pre postë + * ¦ + * index int Ƿƻƽҷ¼̼͵ + * mode BOOL TRUEݷin FALSEݷ out 帲ɱ + * ߯Իئ + ------------------------------------------------------------*/ +static void MAP_dealprepostevent( int index, BOOL mode ) +{ + int map[2]; + int i; + int damaged=FALSE; + + if( CHAR_getFlg(index,CHAR_ISFLYING) ) + /* ƥ֧巴ئ */ + return; + + if( !MAP_getMapDataFromCharIndex( index , map ) ) return; + + for( i = 0 ; i < 2 ; i ++ ){ + /* damage */ + int damage; + damage = MAP_getImageInt(map[i], + mode ? MAP_INTODAMAGE : MAP_OUTOFDAMAGE); + if( damage != 0 ){ + /* ĸëƥ ¼ƥ į ľ׸ */ + int opt[2]={SPR_kmydamY,-damage}; + damaged=TRUE; + CHAR_setInt(index, CHAR_HP, + CHAR_getInt(index,CHAR_HP) + damage ); + CHAR_complianceParameter(index); + /* ĸⰾ׾ް */ + CHAR_sendWatchEvent(CHAR_getWorkInt(index,CHAR_WORKOBJINDEX), + CHAR_ACTDAMAGE,opt,2,TRUE); + } + } + if( damaged ) + CHAR_sendStatusString(index,"M"); +} + + +/*---------------------------------------- + * ̻ľ£۳ƥתxxx̼ + * ë £ + * ¦ + * index int Ƿƻƽҷ¼̼͵ + * flooor int ׷ʧID + * fx int x + * fy int y + * ߯Ի + * ئ + ----------------------------------------*/ +void MAP_preovered( int index ) +{ + MAP_dealprepostevent( index, FALSE ); +} + +/*---------------------------------------- + * ̻ ľ£ + * ¦ + * index int Ƿƻƽҷ¼̼͵ + * ߯Ի + * ئ + ----------------------------------------*/ +void MAP_postovered( int index ) +{ + MAP_dealprepostevent( index, TRUE ); +} + + +/*---------------------------------------- + * ƽҷ¼ԻѨëͻ˪ + * ¦ + * fd int + * charaindex int ƽҷ¼̼͵ + * ߯Ի + * TRUE(1) + * FALSE(0) + ----------------------------------------*/ +BOOL MAP_sendArroundCharNeedFD( int fd,int charaindex ) +{ + char* stringdata; + int x=CHAR_getInt(charaindex,CHAR_X); + int y=CHAR_getInt(charaindex,CHAR_Y); + int fl=CHAR_getInt(charaindex,CHAR_FLOOR); + int size=MAP_CHAR_DEFAULTSEESIZ; + RECT seekr,retr; + seekr.x = x - (int)(size/2); + seekr.y = y - (int)(size/2); + seekr.width = size; + seekr.height = size; +#if 1 +{ + int tilesum, objsum, eventsum; + stringdata = MAP_getChecksumFromRECT(fl,&seekr,&retr, &tilesum,&objsum,&eventsum); + if( stringdata == NULL ) + return FALSE; + + lssproto_MC_send(fd,fl, + retr.x, retr.y, + retr.x + retr.width, retr.y + retr.height, + tilesum, + objsum, + eventsum, + stringdata ); +} +#else + stringdata = MAP_getdataFromRECT(fl,&seekr,&retr); + if( stringdata == NULL ) + return FALSE; + + lssproto_M_send(fd,fl, + retr.x, retr.y, + retr.x + retr.width, retr.y + retr.height, + stringdata ); +#endif + return TRUE; +} + + +/*---------------------------------------- + * Ѩ󷸡ë £ + * ¦ + * charaindex int ƽҷ¼̼͵ + * ߯Ի + * TRUE(1) + * FALSE(0) + ----------------------------------------*/ +BOOL MAP_sendArroundChar(int charaindex) +{ + int fd; + fd = getfdFromCharaIndex( charaindex ); + if( fd == -1 )return FALSE; + + return MAP_sendArroundCharNeedFD(fd, charaindex); +} + +#ifdef _CAX_LNS_NLGSUOXU +static int YCXX[] = {39,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,43,43,43,43,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,90,90,90,90,90,90,91,91,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,93,93,93,93,93,93,93,94,94,94,94,94,94,94,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,99,99,99,99,99,99,100,100,100,100,100,100,100,100,100,100,101,101,101,101,101,101,102,102,102,102,102,103,103,103,103,103,104,104,104,104,104,105,105,105,105,105,105,105,105,105,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,107,107,107,107 +}; + +static int YCXY[] = {39,39,40,64,65,66,76,77,78,40,41,63,66,67,73,74,75,79,82,83,40,61,62,68,70,71,72,80,81,83,39,60,69,83,40,60,83,41,47,59,63,64,65,66,67,68,69,70,71,72,78,82,40,47,48,60,63,73,76,77,78,81,39,40,44,45,46,49,60,63,74,76,78,82,40,45,46,47,48,50,60,63,75,78,83,40,48,51,55,59,60,62,78,84,40,49,50,52,55,56,57,58,61,79,85,40,50,52,54,60,72,73,75,80,81,86,40,48,49,50,51,52,53,60,72,76,77,82,87,40,47,48,49,50,51,52,59,72,78,83,88,89,90,40,52,58,72,78,84,91,92,93,40,52,57,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,79,85,94,95,96,40,53,57,60,73,77,80,86,97,98,99,108,109,110,40,54,57,59,72,77,78,81,87,91,92,100,107,108,109,110,111,40,54,57,59,71,77,79,82,83,88,89,90,93,98,99,101,102,103,104,105,106,107,111,112,113,39,54,57,58,59,60,61,62,63,64,65,66,70,76,77,80,84,94,95,96,97,100,101,106,112,114,38,53,56,57,60,67,71,75,77,79,85,86,93,94,99,100,101,102,106,112,114,37,53,55,56,57,61,68,72,73,74,75,76,77,78,87,88,91,92,95,96,97,98,101,103,106,112,115,120,34,35,36,53,54,62,69,73,77,89,90,102,103,106,113,116,119,121,34,52,53,54,63,68,72,77,89,90,102,103,106,113,117,118,120,34,39,48,49,50,51,52,53,63,68,69,70,71,77,90,91,102,104,105,106,113,118,119,34,39,40,41,46,47,48,49,50,51,63,67,68,77,90,92,93,94,95,96,102,104,105,106,107,112,113,118,119,34,39,42,45,46,51,63,66,72,73,74,77,91,92,93,96,99,100,101,102,103,104,107,112,114,118,34,39,43,44,45,51,64,70,71,75,77,93,95,98,102,107,108,109,110,111,112,115,118,35,39,45,51,52,53,65,69,75,77,93,94,97,103,112,115,119,121,36,39,45,53,54,66,67,68,75,77,92,93,96,97,98,99,100,101,104,112,115,119,121,36,37,38,39,40,45,54,67,75,77,91,93,95,96,100,105,108,109,110,111,112,113,114,115,116,117,118,120,121,40,45,55,75,78,90,93,94,96,99,106,108,114,115,119,120,121,41,45,56,57,58,75,79,90,93,96,98,107,114,115,119,44,55,56,57,59,76,80,85,86,87,89,92,93,96,98,111,112,113,114,115,118,41,42,43,54,57,60,61,77,81,84,87,89,91,93,96,97,111,115,117,118,119,120,121,41,42,43,54,58,59,60,61,62,63,64,78,81,83,87,88,90,93,96,111,116,117,120,41,44,52,53,54,64,65,79,80,83,86,87,89,93,95,96,112,117,45,52,64,66,79,80,83,84,85,86,87,88,89,90,91,92,93,94,96,113,114,117,45,49,50,51,64,66,69,70,71,72,75,76,78,79,80,81,84,86,88,93,96,113,118,45,49,64,66,68,72,73,74,77,78,81,82,83,84,86,88,89,90,91,92,96,111,112,119,45,48,64,66,68,79,81,83,85,86,87,88,91,93,96,105,106,107,108,109,110,111,119,45,46,47,64,65,66,67,79,80,81,82,87,90,94,96,102,103,104,109,119,64,65,78,81,82,87,90,94,96,98,99,100,101,102,105,109,118,64,65,78,79,80,81,82,87,90,94,95,97,100,106,108,109,110,111,112,113,114,115,117,63,64,65,81,87,90,93,95,96,99,106,108,115,116,62,63,64,65,66,81,87,89,90,91,92,95,97,98,106,107,108,116,62,65,66,81,86,87,89,91,96,97,116,61,66,67,81,85,87,89,92,97,98,116,62,64,67,68,81,84,87,88,93,97,98,99,116,62,63,65,68,69,81,83,86,88,94,97,98,99,63,66,70,81,82,86,87,93,97,98,99,63,64,67,80,81,85,93,97,98,99,64,65,68,69,80,81,84,85,93,97,98,99,64,65,69,80,81,82,83,84,94,95,96,97,98,99,69,80,81,82,84,97,98,70,80,81,82,84,96,98,70,71,72,73,74,75,76,80,81,82,84,96,98,73,74,75,76,77,80,82,84,95,97,98,73,80,82,84,94,96,73,80,82,83,95,98,71,72,80,82,83,91,92,94,96,97,70,81,82,90,93,96,69,81,83,89,95,69,83,84,88,94,69,85,86,87,94,70,80,81,82,83,93,94,95,96,71,72,73,74,75,76,77,78,79,80,84,89,90,91,92,94,85,86,87,88 +}; + +static int JJXX[] = {54,55,55,56,56,56,56,57,57,57,58,58,58,58,58,58,58,58,59,59,59,60,60,60,60,60,60,60,61,61,61,61,61,61,62,62,62,62,62,63,63,63,63,63,63,64,64,64,64,64,65,65,65,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,74,74,74,74,74,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,77,77,77,77,77,77,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,93,93,94,94,94,94,94,94,94,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,99,99,99,100,100,100,100,100,100,100,100,100,100,100,100,100,101,101,101,101,101,101,101,101,101,101,102,102,102,102,102,102,102,102,102,102,102,102,103,103,103,103,103,103,103,103,103,103,104,104,104,104,104,104,104,104,104,104,104,104,104,104,105,105,105,105,105,105,105,105,105,105,105,106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,108,108,108,108,109,109,109,109,109,110,110,111,111,111,111,111,111,111,112,112,113,113,113,114,114,115 +}; + +static int JJXY[] = {107,106,107,98,99,100,106,99,101,105,100,101,102,103,104,115,116,117,103,114,118,102,104,112,113,114,119,123,101,104,112,120,122,124,99,100,103,112,121,96,97,98,103,112,118,96,103,112,117,119,95,103,111,116,117,118,119,120,95,104,110,115,124,95,104,108,109,110,111,112,113,114,123,95,105,106,107,108,109,110,122,90,91,92,94,121,89,93,113,114,115,116,117,118,119,120,88,92,94,112,89,90,92,94,102,103,104,105,106,107,111,91,92,94,101,107,111,94,100,101,107,111,56,57,58,94,99,102,103,107,110,56,59,94,103,107,110,56,60,94,103,107,110,56,60,94,103,107,110,57,60,95,96,97,98,99,100,101,102,103,107,110,58,61,93,94,95,96,107,111,58,61,92,96,97,98,108,111,59,61,78,79,92,99,109,111,60,62,77,80,92,100,109,111,61,62,75,76,81,82,93,100,110,62,63,74,83,94,100,110,63,64,73,84,95,99,111,63,65,71,72,85,86,96,99,112,63,66,67,68,70,87,88,89,90,91,92,95,98,113,62,69,89,90,92,93,94,95,96,97,114,62,86,87,88,115,62,87,93,94,95,96,97,116,62,66,88,93,94,95,96,116,62,65,67,68,88,93,94,95,116,62,65,69,88,89,92,115,62,65,70,90,91,115,62,65,70,90,91,92,104,105,106,107,108,114,63,64,65,66,70,87,88,89,93,103,108,113,66,67,70,87,88,89,94,95,101,102,106,107,108,113,67,68,70,85,87,88,89,90,96,100,106,113,68,70,84,86,91,97,98,99,100,101,102,106,114,70,83,87,88,92,98,103,104,106,114,70,74,75,84,89,90,91,93,97,105,106,114,70,73,76,84,92,94,96,105,107,114,70,73,77,85,93,94,95,104,108,109,110,111,112,114,69,73,78,79,84,86,96,97,104,113,114,69,73,80,82,83,85,86,98,104,68,73,80,81,86,99,103,68,73,100,103,68,72,101,102,103,68,71,64,65,66,67,68,69,70,66,67,66,67,68,66,67,66 +}; + +static int KLXX[] = {34,35,36,36,36,36,36,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40,40,40,40,40,40,41,41,41,41,41,42,43,44,45,46,47,48,49,49,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,90,90,90,90,90,90,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,95,95,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,100,100,100,100,100,101,101,101,101,101,101,102,102,102,102,102,103,103,103,103,103,104,104,105,105,106,106,106 +}; + +static int KLXY[] = {62,62,62,71,72,73,74,61,62,69,70,75,77,60,61,63,64,65,66,68,75,76,77,78,59,60,63,64,65,66,67,68,69,70,71,72,73,74,78,59,62,63,64,65,66,60,61,62,63,64,61,61,61,61,61,61,61,60,61,59,60,61,58,59,61,66,67,68,92,93,105,109,110,111,112,47,48,57,62,65,66,69,70,71,72,93,94,95,101,102,103,104,105,106,107,109,112,113,48,49,50,51,52,53,54,55,56,57,59,60,61,62,63,64,65,66,67,68,69,70,71,72,93,95,96,102,103,104,107,109,110,114,37,48,49,58,63,65,70,93,96,97,103,105,106,107,108,109,110,111,112,114,37,38,47,48,58,59,62,64,65,70,71,93,96,106,110,112,114,37,62,63,70,71,93,96,107,110,113,114,37,38,70,71,93,94,95,106,107,108,109,110,111,112,114,38,70,71,92,93,106,107,109,112,114,37,38,39,71,93,94,105,106,107,109,113,33,34,35,36,37,39,40,41,69,70,72,93,94,105,106,110,111,112,35,37,40,41,42,43,54,55,68,73,74,93,94,105,106,34,37,38,42,43,44,45,46,54,55,68,74,75,93,94,105,35,37,46,55,68,76,93,94,105,36,37,38,47,48,49,50,51,52,53,54,55,56,68,77,78,79,92,93,94,105,37,48,54,57,68,79,92,94,105,37,38,48,57,58,68,79,90,91,92,93,94,95,104,105,38,39,48,58,59,68,69,73,79,88,89,91,92,94,96,104,105,39,48,58,59,60,61,62,63,64,65,66,67,69,70,72,74,79,88,91,92,93,94,95,97,103,104,105,106,39,40,41,42,48,58,59,60,61,62,63,64,65,66,67,68,69,70,71,74,78,79,89,91,92,94,95,98,100,101,102,106,48,58,59,60,71,72,73,74,75,76,77,78,87,88,89,90,92,94,96,99,106,48,58,59,71,72,73,74,75,77,78,79,80,81,82,83,84,85,86,87,92,94,96,107,48,58,59,72,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,108,109,110,111,47,58,85,86,87,88,92,95,96,110,48,58,84,85,89,90,91,97,109,48,53,58,85,86,97,108,49,53,58,85,86,87,88,96,97,98,107,50,53,58,84,87,95,96,99,100,107,50,52,53,58,84,86,95,96,101,107,50,52,53,57,58,84,86,95,96,97,98,102,103,104,105,106,107,108,109,110,50,52,53,54,55,56,57,59,84,85,86,96,97,100,101,102,50,53,54,56,57,58,59,60,61,84,85,97,98,99,102,49,56,61,62,63,84,85,97,98,101,49,56,61,64,65,84,85,97,98,99,101,48,62,65,85,97,98,100,48,62,65,85,97,100,44,45,46,47,63,65,96,98,100,45,63,65,95,96,98,99,100,46,63,65,93,94,95,96,97,99,100,47,64,65,93,94,95,99,101,48,63,65,95,99,101,49,63,65,96,99,100,50,51,62,65,69,70,71,72,96,97,98,99,52,57,58,59,60,61,65,69,73,74,75,82,83,84,96,97,98,53,54,55,56,64,65,68,75,76,77,78,79,80,81,85,96,97,62,63,67,70,71,72,86,96,97,62,65,66,70,73,80,81,82,83,87,96,63,64,67,68,69,70,74,75,76,77,78,79,84,85,88,63,69,70,74,75,76,77,79,80,81,82,86,88,62,63,69,70,71,72,74,87,88,62,69,70,86,88,61,62,69,70,86,87,61,62,69,85,87,61,69,84,85,86,61,69,69,70,70,71,72 +}; + +static int SCXX[] = {27,27,27,27,27,28,28,28,29,29,29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,31,31,32,32,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,47,47,47,47,47,48,48,48,48,48,48,48,49,49,49,49,49,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,67,67,67,67,67,67,67,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,90,90,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,94,94,94,94,94,94,94,94,94,94,94,95,95,95,95,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,99,99,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,101,101,101,101,101,101,101,101,101,101,101,101,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,103,103,103,103,103,103,103,103,103,104,104,104,104,104,104,104,104,104,105,105,105,105,105,105,105,105,105,105,105,106,106,106,106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,110,110,110,110,110,110,110,110,111,111,111,111,111,111,111,111,112,112,112,112,112,112,112,112,112,113,113,113,113,113,113,113,113,113,114,114,114,114,114,114,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,115,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,117,117,117,117,117,117,118,118,118,118,118,118,118,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,120,120,120,120,120,120,120,120,120,120,120,120,120,120 +}; + +static int SCXY[] = {67,68,69,70,71,65,66,72,64,73,78,79,80,81,82,83,84,85,53,54,55,56,57,58,59,60,61,62,63,74,75,76,77,85,52,86,51,87,51,60,61,73,74,75,88,51,59,61,74,75,76,77,78,79,80,81,89,51,58,62,75,82,90,47,48,49,50,51,57,62,75,83,86,87,90,49,56,62,76,83,85,86,90,49,55,62,76,83,85,90,49,54,61,76,82,85,90,49,54,61,76,81,85,86,90,48,49,54,61,73,74,75,76,77,78,79,80,81,85,87,90,48,54,62,73,76,85,88,90,48,54,62,72,76,85,89,90,48,54,55,56,63,66,67,68,69,70,71,76,77,85,90,91,48,57,64,65,66,78,86,90,91,48,58,59,79,87,90,91,48,60,80,88,91,48,61,62,63,64,81,89,48,65,82,90,101,48,66,83,91,100,102,110,48,66,84,92,93,99,103,108,109,111,48,66,84,85,94,98,103,107,112,48,66,83,90,95,96,97,103,106,113,47,66,82,89,103,105,113,119,120,121,47,66,82,88,104,114,118,122,47,66,82,87,90,91,92,93,94,95,96,97,98,99,100,115,116,117,123,124,47,66,82,86,91,92,101,102,103,104,105,106,107,108,124,46,65,83,84,85,93,101,102,109,124,45,64,82,83,84,94,100,103,110,111,112,113,114,115,116,117,118,119,120,124,44,63,81,82,85,94,99,104,112,113,114,115,116,117,118,124,43,62,83,86,87,88,89,90,91,92,93,94,95,96,97,98,104,105,106,107,108,109,112,124,42,55,56,57,58,59,60,61,84,85,94,104,110,111,124,41,54,76,77,78,79,80,81,86,94,124,40,52,53,75,82,87,94,125,39,46,47,48,49,50,51,75,83,88,94,126,39,46,75,84,89,94,127,39,45,75,84,89,94,128,39,45,74,84,89,94,128,39,45,49,50,51,52,53,54,55,56,74,84,90,94,127,38,44,50,57,73,85,86,90,94,126,37,44,51,58,72,87,90,94,95,125,36,43,51,59,72,88,91,96,125,35,43,52,60,72,89,92,97,125,35,43,53,61,62,63,72,89,93,94,98,125,35,38,43,52,53,63,64,72,74,75,76,77,78,89,94,99,125,35,38,43,51,65,66,71,73,79,89,95,96,100,125,35,38,39,43,50,67,71,72,80,89,97,98,101,102,103,104,125,35,38,39,43,49,68,70,72,80,90,99,105,125,35,38,39,43,49,68,69,72,81,91,100,106,125,35,38,40,43,49,68,69,72,81,92,101,106,124,35,38,41,42,49,68,69,72,81,93,98,99,100,101,102,106,124,34,38,39,49,68,72,73,81,93,96,97,106,123,32,33,39,49,68,73,81,93,94,95,106,120,121,122,31,39,48,49,67,73,81,92,93,107,120,31,38,47,59,60,61,62,63,64,65,66,74,81,90,91,92,97,98,99,107,120,31,32,37,38,39,40,41,42,43,44,45,46,50,51,52,53,54,55,56,57,59,66,75,76,77,78,79,80,81,82,88,89,90,91,96,100,108,120,32,49,50,58,59,65,79,83,84,95,101,102,103,104,105,106,107,109,120,33,43,44,45,46,47,48,62,63,64,78,85,86,87,88,89,90,91,92,93,94,108,110,119,34,35,43,61,62,77,109,111,112,113,118,35,43,60,76,110,113,118,34,42,59,76,111,113,118,34,41,55,56,58,76,111,112,118,35,40,43,44,45,46,47,48,54,57,76,83,84,85,111,118,35,39,41,42,49,50,54,76,82,86,117,34,38,39,40,51,54,76,80,81,87,116,34,52,54,76,77,78,79,87,116,33,53,54,76,87,116,33,53,54,76,87,116,33,53,54,75,76,87,116,117,127,128,129,33,53,54,55,74,77,88,117,118,119,120,121,122,123,126,129,32,54,55,64,65,73,77,89,90,91,124,125,129,32,53,54,65,72,77,92,93,94,95,96,97,98,99,100,101,102,124,125,126,127,128,31,53,54,66,71,77,78,103,124,31,53,54,66,67,70,78,104,123,30,37,51,52,53,65,68,69,78,105,123,29,36,38,49,50,52,65,71,72,78,105,123,28,34,35,38,44,45,46,47,48,49,50,51,52,63,64,65,71,72,78,105,111,112,113,114,115,116,117,118,119,120,121,122,123,28,31,32,33,39,44,49,52,61,62,63,71,72,78,105,111,29,30,31,39,44,49,61,72,73,74,75,76,77,78,104,105,111,29,40,44,49,61,73,103,111,29,40,44,49,61,74,103,111,28,29,40,44,50,61,75,102,110,29,41,42,43,50,61,75,102,109,28,49,62,75,102,108,28,49,62,75,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,107,29,43,44,45,46,47,48,62,64,65,66,67,68,69,70,71,72,73,74,75,86,107,29,42,62,64,86,107,29,30,41,62,64,87,107,31,32,33,34,35,40,62,64,65,66,67,68,69,70,87,107,32,33,34,35,36,37,38,39,40,58,62,70,88,107 +}; + +static int FCXX[] = {28,29,29,29,30,30,31,31,31,31,31,32,32,32,32,33,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,36,36,36,36,37,37,37,37,37,38,38,38,38,38,38,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,52,52,52,52,52,52,52,53,53,54,54,54,55,55,55,55,55,56,56 +}; + +static int FCXY[] = {33,33,34,37,35,36,35,51,52,53,54,35,36,50,54,34,36,37,38,39,40,50,54,33,34,40,41,42,43,50,53,54,33,34,43,44,48,49,50,51,52,53,33,34,51,52,33,34,52,53,54,34,35,52,53,55,56,34,35,51,52,53,54,56,27,28,29,32,33,36,51,54,56,58,59,29,30,31,37,51,52,54,56,59,29,32,33,34,35,36,38,47,48,49,50,51,52,53,54,56,59,60,61,62,29,32,36,38,44,45,46,47,49,50,51,53,56,57,58,59,60,61,23,24,25,28,29,31,36,38,43,45,46,47,48,49,50,51,53,54,55,56,59,61,22,26,27,28,29,30,32,36,39,40,41,42,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,20,21,22,23,26,27,31,32,33,34,35,36,39,40,41,42,43,44,47,48,49,51,55,56,57,60,23,27,32,35,36,37,38,42,47,49,50,51,55,56,57,60,23,26,31,32,33,34,35,40,41,48,49,50,51,59,60,23,25,29,30,31,36,37,38,39,59,23,25,26,27,28,29,30,31,32,33,34,35,36,37,23,24,25,29,33,34,35,23,26,28,29,30,31,32,23,26,22,25,26,22,23,24,25,26,25,26 +}; + +static int QGGXX[] = {42,42,42,42,42,42,42,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,63,63,63,64,64,65,65,65,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,69,69 +}; + +static int QGGXY[] = {52,53,54,55,56,58,59,52,55,57,58,59,51,52,53,54,55,56,57,59,61,62,50,51,58,59,60,62,49,50,58,59,62,48,49,59,61,64,65,66,67,68,71,72,73,74,75,83,49,50,59,61,64,69,70,76,78,79,80,81,82,43,44,45,46,47,49,51,59,62,63,68,69,70,71,72,73,74,75,76,77,80,43,48,51,59,66,67,68,70,71,72,73,74,75,76,77,78,79,43,50,52,58,59,60,61,63,64,65,69,79,43,49,50,52,53,54,55,56,57,58,61,62,68,79,80,42,51,52,55,56,58,67,68,79,80,81,42,51,52,53,54,56,57,58,67,79,81,42,50,52,54,55,57,58,59,67,79,80,81,43,44,49,50,51,53,56,59,67,79,45,48,51,52,53,54,55,58,66,79,42,43,44,47,48,51,52,58,66,68,74,75,76,77,78,42,43,44,45,46,48,50,51,58,66,68,69,72,73,42,44,45,46,47,48,49,50,58,66,67,70,72,42,45,46,49,50,58,66,70,72,43,44,47,48,50,58,71,48,51,58,52,58,52,57,58,52,55,56,57,58,59,60,50,51,52,53,54,55,59,60,61,62,50,54,55,56,57,58,61,54,57 +}; + +static int DNXX[] = {22,23,23,23,24,24,25,25,26,26,26,26,27,27,27,27,27,28,28,28,28,29,29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30,31,31,31,31,31,32,32,32,32,32,33,33,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,44,44,44,44,44,45,45,45,45,45,45,46,46,46,47,47 +}; + +static int DNXY[] = {33,32,33,34,31,35,31,36,31,32,36,37,31,33,34,35,37,31,33,34,37,30,33,34,35,36,39,26,27,28,29,30,34,35,36,37,38,39,40,31,37,40,41,42,32,37,39,40,42,28,31,36,37,38,39,40,41,43,28,29,30,35,36,40,42,44,31,34,35,36,40,42,44,47,48,30,32,34,35,36,40,41,42,43,44,45,46,48,29,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,29,33,34,35,36,37,39,40,41,42,44,45,46,48,29,30,31,32,33,34,37,38,39,41,43,44,45,46,47,48,49,51,52,31,32,34,37,38,39,40,43,44,45,46,49,50,51,32,33,34,37,38,39,40,41,42,43,44,45,46,48,49,50,51,32,33,37,38,39,41,44,48,49,50,51,37,38,39,41,51,36,38,39,40,41,36,37,38,39,40,41,37,38,40,38,39 +}; + +static int KAXX[] = {32,33,34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,91,91,91,91,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,94,94,94,94,94,94,94,94,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,100,100,100,100,101,101,101 +}; + +static int KAXY[] = {65,65,60,61,62,63,64,66,37,38,39,40,41,42,43,44,45,59,67,36,46,58,68,69,35,47,58,70,35,48,58,60,61,62,63,64,65,66,71,35,48,58,60,67,72,99,100,101,35,48,58,60,68,73,98,101,35,48,58,60,61,69,74,97,102,34,49,58,60,61,62,67,70,74,96,97,102,34,50,51,57,60,61,63,66,68,71,75,89,90,91,92,93,94,95,96,97,102,33,48,52,53,54,55,56,60,61,64,65,69,72,76,90,96,98,99,100,101,32,38,39,40,41,42,43,46,47,49,59,61,64,65,70,73,76,82,83,91,96,33,34,37,44,45,50,53,54,55,56,57,58,61,64,71,74,77,78,79,80,81,84,88,89,90,91,96,35,36,50,52,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,85,87,91,92,97,104,105,106,107,108,38,39,40,41,50,52,61,64,73,76,79,86,93,98,103,108,37,39,42,50,51,61,65,73,77,78,94,99,101,102,107,37,39,40,41,42,43,44,45,46,47,50,52,61,66,73,77,78,81,94,100,102,106,116,37,40,43,48,50,52,55,56,57,61,65,73,76,79,81,95,101,103,105,114,115,116,37,40,43,49,50,52,53,55,58,61,64,74,75,80,81,95,100,104,112,113,115,38,40,44,49,51,52,55,58,61,63,74,75,76,81,96,100,111,115,38,40,44,48,49,51,55,59,61,62,73,77,81,96,100,104,105,106,107,108,109,110,115,116,37,40,44,48,49,51,52,53,54,55,59,61,62,73,78,81,96,100,103,117,36,40,41,44,48,49,59,60,63,69,72,77,81,96,100,102,116,37,40,45,47,50,58,60,62,68,69,73,76,81,96,99,101,110,116,38,39,40,41,42,43,44,45,46,51,52,53,54,55,56,57,59,62,67,70,74,75,80,81,95,98,100,110,115,40,45,58,62,66,69,74,75,79,90,91,92,93,94,98,100,110,111,114,36,40,41,42,43,44,45,46,47,57,62,65,68,74,76,77,78,90,98,100,110,111,114,36,37,44,47,48,49,50,51,52,53,54,55,56,61,64,67,74,76,78,90,99,101,111,113,36,38,42,43,46,47,53,54,55,56,57,58,59,60,61,63,66,73,76,79,90,99,101,102,111,112,113,36,39,40,41,46,47,52,62,67,69,70,71,72,77,80,81,82,90,100,101,102,112,113,37,41,45,47,51,60,61,68,77,82,83,84,85,86,87,88,89,90,101,102,112,38,45,48,50,59,68,69,70,71,72,73,74,75,76,77,78,88,89,90,91,92,93,94,95,96,97,102,103,113,39,40,44,48,50,58,63,67,70,78,79,80,88,97,102,104,105,106,107,108,109,110,114,37,40,41,43,44,47,50,56,57,58,62,64,65,66,70,79,80,81,88,97,98,102,110,114,37,38,39,41,42,43,44,47,50,51,52,53,54,55,56,61,64,65,70,80,81,82,88,99,102,110,114,37,38,39,40,44,46,47,49,50,57,58,59,60,63,66,70,81,82,83,84,85,88,90,91,100,102,110,114,40,41,42,43,44,45,47,48,49,55,56,62,67,70,81,83,85,86,87,90,91,99,102,110,114,35,41,43,45,46,49,53,54,63,67,70,80,84,85,87,90,91,97,98,99,102,107,110,114,35,37,38,39,40,41,42,46,49,54,63,67,71,79,85,86,87,89,91,94,95,96,103,106,108,109,111,114,35,36,37,39,40,41,46,49,55,63,67,72,79,84,85,86,87,88,91,93,94,103,104,105,109,112,115,46,50,56,63,67,73,75,79,83,87,91,95,96,97,98,99,100,101,109,113,116,46,51,52,57,64,68,74,75,76,79,82,88,89,90,91,101,109,112,115,117,47,53,58,65,69,74,75,77,78,79,81,84,85,86,87,88,89,90,91,96,97,98,101,106,107,108,109,110,111,112,113,114,118,119,120,47,54,59,60,65,70,74,75,80,83,90,91,95,99,101,105,109,111,113,120,47,53,54,55,56,57,61,65,71,74,75,79,82,90,95,100,101,105,109,110,112,115,116,120,47,52,54,58,62,65,71,74,75,76,77,78,81,90,94,101,105,108,110,111,112,113,114,117,121,47,51,53,59,63,65,71,73,77,80,90,92,93,96,97,98,101,105,107,110,111,117,121,46,50,51,52,60,64,65,70,72,73,77,80,90,91,92,93,96,99,105,106,109,110,111,112,113,114,115,116,117,121,46,54,55,56,57,61,65,69,71,73,77,80,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,108,120,46,51,52,53,58,62,68,70,72,76,80,86,90,95,96,99,100,101,105,107,108,118,119,120,46,48,49,50,59,63,67,69,71,75,81,85,90,96,98,99,101,104,106,109,117,46,47,60,63,64,65,66,68,71,74,76,77,78,79,80,81,84,89,97,99,100,102,103,104,105,109,116,60,63,67,70,72,73,74,75,76,77,81,82,83,87,88,96,99,101,102,109,116,60,64,65,66,69,73,86,96,101,108,116,61,62,63,68,74,75,86,97,100,107,116,61,62,67,75,86,98,99,100,107,116,62,67,76,86,87,89,90,91,92,93,94,95,96,97,98,107,116,63,67,76,86,87,88,107,111,112,113,114,115,63,64,67,76,85,86,87,88,107,110,64,67,76,84,87,107,109,64,65,66,75,83,88,107,109,63,66,72,73,74,80,81,82,83,84,85,86,87,88,108,109,62,65,67,68,69,70,71,79,82,108,109,62,63,64,70,72,77,78,80,81,61,62,63,70,71,73,77,79,61,62,72,73,74,75,76,77,78,61,62,73,77,74,75,76 +}; + +static int TMXX[] = {33,33,34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,73,73,73,73,73,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84 +}; + +static int TMXY[] = {78,85,58,77,79,84,85,86,56,57,58,74,75,76,80,81,83,87,88,89,90,57,58,73,74,82,86,87,88,90,91,57,59,60,61,62,63,73,85,89,91,57,59,64,65,66,67,68,69,70,71,72,77,78,79,80,81,82,83,84,90,91,57,61,74,75,76,84,85,91,55,56,57,60,61,74,84,86,92,51,52,54,55,59,61,74,84,87,88,48,55,58,61,73,84,88,47,48,55,57,61,72,84,88,47,48,56,57,61,71,84,88,47,48,56,57,61,71,84,88,47,48,57,58,60,61,71,84,88,42,43,44,47,57,59,60,61,62,63,64,65,66,67,71,79,80,81,82,83,84,85,86,87,89,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,61,67,71,79,80,81,83,84,90,39,61,67,71,79,81,82,85,90,36,37,38,47,48,49,50,51,60,67,70,78,79,81,86,87,90,37,46,47,48,49,51,52,59,63,64,65,66,67,70,78,79,81,87,91,37,41,45,49,50,51,52,57,58,62,67,68,69,70,71,72,73,74,75,76,78,79,80,81,88,91,37,40,41,42,44,49,52,53,54,57,61,67,70,76,79,80,81,82,89,91,35,36,38,39,40,41,42,43,44,45,48,49,52,53,54,55,57,60,62,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,82,90,92,35,39,40,41,43,44,45,46,47,48,49,50,51,54,55,57,60,63,65,67,71,74,77,78,80,81,82,91,92,35,38,39,40,42,48,49,50,51,54,55,57,58,59,64,67,71,73,76,77,81,91,92,33,34,37,38,39,40,41,48,51,52,53,54,55,56,57,58,63,64,65,67,71,73,75,80,91,92,33,36,37,38,39,40,49,52,55,56,57,58,67,68,69,70,71,72,73,74,78,79,80,92,33,34,35,36,37,38,40,49,50,55,56,57,70,71,72,73,76,77,82,83,84,85,86,87,92,33,37,38,39,40,41,49,50,52,55,56,57,69,70,72,73,74,75,80,81,87,33,37,38,39,40,41,48,50,51,52,53,54,55,56,57,58,69,72,73,74,75,78,79,80,87,33,34,38,39,42,48,49,50,51,52,53,54,55,57,68,69,76,77,87,34,35,37,38,39,40,41,42,44,45,46,47,48,49,50,54,55,56,57,68,69,77,78,84,87,35,38,39,40,41,42,43,44,45,48,53,57,58,68,77,79,80,84,85,88,34,40,41,42,44,45,46,51,52,57,58,68,69,77,80,83,85,89,90,91,31,32,33,40,42,43,44,50,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,69,77,79,83,85,86,88,30,31,39,40,41,42,43,48,49,52,59,62,67,77,78,82,86,88,30,33,42,43,44,45,46,47,48,49,50,51,59,63,67,76,77,81,86,87,88,30,31,32,60,64,68,75,76,77,80,81,85,86,61,65,69,70,71,72,73,74,75,76,77,79,80,81,82,83,84,86,62,66,73,76,77,78,84,85,86,63,67,73,78,82,86,64,68,71,72,78,65,69,70,71,78,66,70,71,72,73,74,75,76,77,78,79,80,66,68,69,70,71,72,73,74,75,76,77,78,79,80,67,68,70,71,75,79,68,69,70,71,72,73,74,75,80,68,71,74,76,78,80,81,68,72,75,77,79,82,83,84,85,68,69,70,71,72,73,76,78,79,80,82,83,86,68,72,81,82,83,84,86,73,74,75,76,77,78,79,80,81,86,73,74,82,83,84,85,86 +}; + +static int KTXX[] = {62,62,62,62,62,62,62,63,63,63,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,90,90,90,90,90,90,91,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,94,94,94,94,94,94,94,94,94,94,94,94,94,94,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,99,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,101,101,101,101,101,102,102,102,102,102,102,102,103,103,103,103,103,103,103,103,104,104,104,104,104,104,104,104,104,104,105,105,105,105,105,105,105,105,105,105,105,105,105,105,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,108,108,108,108,109,109,109,109,109,109,110,110,110,110,110,110,110,110 +}; + +static int KTXY[] = {90,91,92,93,94,95,96,90,96,105,90,96,97,98,99,100,102,104,105,88,89,90,91,92,100,102,103,105,106,109,110,83,84,85,86,87,88,90,91,99,102,104,105,106,107,108,109,82,87,90,99,102,105,108,110,111,112,81,87,90,98,99,100,101,103,105,106,107,109,112,74,75,76,77,78,79,80,84,85,86,87,91,97,100,102,104,105,110,112,74,75,83,85,88,89,92,96,100,102,104,105,110,111,112,113,114,115,75,77,78,82,85,90,91,92,93,94,95,96,100,101,103,104,105,106,107,108,109,110,111,113,114,115,75,77,79,80,81,82,83,84,91,94,96,97,98,99,100,101,102,103,108,109,110,113,114,115,75,77,80,91,94,97,99,100,101,102,103,104,105,106,107,110,111,112,113,75,78,80,91,94,96,100,101,110,112,113,116,73,74,78,79,92,95,99,100,106,109,110,113,114,115,116,72,76,77,78,91,94,96,98,100,107,108,110,112,113,114,116,71,75,76,77,80,81,82,83,84,85,86,87,88,89,90,93,95,97,99,106,107,110,114,116,71,74,75,78,79,92,94,96,97,98,105,106,111,112,115,117,71,73,74,75,79,80,81,82,83,84,92,95,96,98,104,105,111,112,113,115,117,71,74,85,86,87,88,89,90,91,93,95,96,97,98,99,100,111,113,115,117,72,74,91,92,94,95,97,98,99,101,111,113,115,117,72,74,84,85,86,87,88,90,94,95,96,97,98,99,100,101,102,111,113,114,116,117,72,74,83,89,94,101,102,103,104,105,106,107,108,109,111,113,114,115,116,71,72,73,74,80,81,83,88,90,94,95,96,97,99,100,101,102,104,105,110,111,112,113,114,115,70,71,74,79,82,83,84,85,86,87,89,90,91,92,93,94,102,103,104,105,108,109,110,111,115,69,70,71,72,73,74,75,76,78,82,83,85,88,89,90,94,102,104,105,106,107,108,109,111,115,67,68,75,76,77,78,79,80,81,86,94,102,104,107,109,110,111,112,113,114,116,67,77,78,85,87,88,89,90,91,95,101,102,104,107,109,114,115,116,67,77,78,85,92,95,100,102,103,104,105,106,109,67,76,77,78,85,93,95,100,103,108,109,67,77,85,93,95,100,102,107,108,67,68,69,70,71,72,73,74,77,85,94,95,100,101,102,103,104,105,106,107,75,86,94,95,100,102,106,75,79,80,81,82,83,87,94,96,99,100,101,104,105,74,75,76,77,78,79,84,88,94,96,98,99,100,103,104,106,85,89,94,96,97,99,102,103,107,85,89,94,95,98,99,100,101,102,103,104,108,86,88,94,95,96,97,98,101,102,103,105,106,109,86,88,93,97,101,102,106,107,108,109,86,87,88,89,90,91,92,93,94,95,96,97,98,99,101,102,109,86,87,93,101,110,85,88,92,93,94,101,110,85,86,87,88,89,90,91,100,85,86,88,89,91,92,93,98,99,100,85,86,87,88,89,90,91,92,93,94,95,96,97,98,83,84,85,89,94,95,96,98,82,83,84,85,96,97,98,80,81,82,83,76,77,78,79,81,83,75,76,77,78,79,80,81,83 +}; + + +static int WLXX[] = {44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,70,70,70,70,70,70,71,71,71,71,71,71,72,72,72 +}; + +static int WLXY[] = {63,64,65,66,40,41,42,43,44,46,47,48,52,53,54,55,59,60,61,62,67,68,39,40,44,45,49,50,51,55,56,57,58,68,38,39,44,45,46,47,48,49,50,51,57,58,59,64,65,66,68,37,38,41,42,43,45,51,55,56,60,61,64,66,67,68,37,39,40,41,42,43,44,45,52,55,61,67,68,37,43,53,55,61,67,68,69,70,72,73,74,75,76,37,44,51,52,53,54,61,67,71,77,37,44,51,52,53,55,61,67,77,36,44,46,50,51,55,56,57,58,59,60,61,66,67,68,69,70,71,72,73,74,75,77,35,44,45,47,48,49,50,51,56,57,61,62,63,66,67,76,77,35,44,45,47,51,54,55,57,61,64,65,76,35,44,45,46,47,48,49,50,51,52,53,58,60,61,62,63,64,65,76,77,35,43,44,47,50,51,53,54,55,56,58,59,60,61,63,65,76,77,36,43,44,45,46,48,49,51,52,53,55,56,57,61,62,64,66,71,72,73,74,75,76,77,36,37,42,43,44,47,49,51,53,54,57,58,61,62,65,67,70,72,73,77,37,38,39,40,41,42,43,49,50,52,53,54,55,57,62,65,68,69,71,74,75,76,77,37,38,39,40,41,43,49,53,54,55,57,62,65,66,67,69,71,39,42,43,49,50,51,52,53,54,55,57,62,64,65,69,71,39,40,41,48,51,53,55,56,57,62,65,66,69,71,40,47,48,50,51,52,53,54,56,57,58,59,60,61,62,66,67,68,71,47,49,50,51,52,54,56,57,68,69,70,45,46,47,48,49,50,51,53,55,57,43,44,45,46,48,49,52,53,54,57,58,42,43,44,45,46,47,48,49,50,51,53,54,55,56,42,45,46,49,50,43,44,45,47,48,49,43,44,46,47,48,49,43,45,49 +}; + +static int HETXX[] = {16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,21,21,21,21,21,22,22,22,22,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,32,32,32,32,32,32,32,32,32,32,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,72,72,72,72,72,73,73,73,73,73,73,73,74,74,74,74,75,75,75,75,76,76,77,77,77,77,77,77,78,78,79,79,80,80,80,81,81,81,82,82,82,82,83,83,83,83,83,83,83,84,84,84,84,84,84,85,85,85 +}; + +static int HETXY[] = {18,19,20,25,26,27,28,29,36,37,38,39,40,41,17,21,22,23,24,30,31,32,33,34,35,42,43,47,48,16,44,45,46,48,16,28,33,34,35,36,37,38,39,40,41,48,17,27,29,30,31,32,42,43,48,17,18,26,43,48,18,26,43,48,18,26,30,31,32,33,44,48,59,18,26,30,34,44,47,59,60,65,66,67,18,19,26,30,35,44,46,47,57,58,59,61,62,63,64,68,18,20,21,26,30,36,37,44,48,49,50,51,52,53,54,55,56,63,69,70,17,22,26,29,31,32,38,39,40,41,42,43,44,54,55,56,57,58,63,64,71,72,73,26,29,32,33,34,35,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,65,66,73,26,28,32,36,37,38,39,40,41,46,54,63,67,68,69,73,26,28,32,42,43,44,47,54,64,65,69,73,18,19,20,21,22,23,24,25,26,28,29,30,31,44,48,49,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,73,19,28,44,50,52,54,66,67,70,73,20,28,29,44,49,52,55,56,57,58,59,67,70,71,73,21,28,30,31,32,33,34,45,48,52,60,66,70,71,73,22,28,35,45,47,52,56,61,66,69,71,73,22,28,36,44,45,47,52,56,57,61,65,68,71,73,23,28,35,36,37,38,39,40,41,42,43,47,51,56,58,61,64,68,71,73,23,28,34,36,37,47,50,56,59,60,61,63,68,71,73,24,25,29,34,38,46,49,56,61,62,69,71,73,81,26,30,31,32,35,39,40,41,42,43,44,45,49,53,54,55,56,60,66,70,71,74,80,81,27,32,35,43,44,48,53,55,57,58,59,65,67,71,72,75,76,77,78,79,81,27,32,35,43,45,48,53,54,58,59,60,61,62,63,64,67,71,72,81,27,31,35,43,46,47,51,52,53,54,58,67,71,72,81,27,30,35,47,51,54,57,67,72,81,28,31,32,34,43,47,48,49,51,54,57,62,67,72,73,74,75,80,28,33,34,43,44,47,50,51,54,56,61,62,67,72,75,79,29,36,37,38,39,40,41,42,43,44,48,51,55,56,60,63,67,72,75,79,30,31,32,33,34,36,40,44,47,50,51,55,56,59,63,68,69,70,72,75,80,30,31,34,36,39,44,45,46,49,51,52,53,54,57,58,64,69,72,75,81,30,31,34,36,39,43,44,47,48,57,58,64,68,71,75,81,29,30,31,32,33,34,36,38,42,44,46,47,48,56,59,60,61,62,63,64,67,70,71,72,73,75,81,27,28,31,32,35,39,40,41,43,45,47,48,49,50,51,55,64,65,67,69,70,74,75,80,27,32,34,36,38,39,43,44,46,47,50,52,54,62,63,66,67,68,70,76,79,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,51,52,53,54,55,56,57,58,59,60,61,65,67,68,70,79,29,30,31,32,35,36,41,43,45,53,64,67,68,70,79,30,31,36,40,43,44,53,64,67,68,70,79,30,31,36,37,38,39,40,41,42,43,53,54,64,67,68,70,79,29,30,31,36,39,44,53,54,64,67,68,70,78,28,30,32,36,38,39,45,46,53,54,65,67,68,70,77,27,29,30,31,32,33,34,35,36,37,38,40,47,48,49,50,51,52,53,54,66,67,68,70,76,27,29,30,31,36,39,41,42,46,54,55,56,57,58,59,60,61,62,63,64,65,66,68,69,75,27,28,30,31,32,33,35,38,40,43,45,46,49,50,51,54,55,65,68,74,27,28,29,32,33,34,35,36,37,41,42,43,44,47,48,50,53,56,64,67,68,71,72,73,27,28,30,31,35,44,46,47,49,53,57,58,60,61,62,63,64,65,66,68,71,24,25,26,27,29,32,35,43,45,48,49,52,54,55,56,57,58,59,62,68,70,23,24,25,26,29,33,34,35,44,48,49,51,53,60,61,67,70,25,26,27,29,35,36,42,43,48,49,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,25,28,36,42,48,50,51,53,56,57,58,59,60,62,63,64,65,66,67,25,26,27,28,36,37,38,41,49,52,53,54,55,56,60,61,66,67,37,39,40,41,48,49,52,53,37,40,48,49,50,51,53,37,40,48,49,53,37,39,48,49,50,51,52,37,40,48,49,37,41,42,43,37,43,36,38,39,40,41,42,36,38,35,39,35,40,41,33,34,41,32,34,35,41,31,34,36,37,38,39,41,30,32,33,39,40,41,30,31,32 +}; + +static int DDXX[] = {30,31,31,32,32,33,33,33,33,33,33,34,34,34,34,34,34,34,35,35,35,35,35,35,36,36,36,36,37,37,37,37,37,37,37,38,38,38,38,38,39,39,39,39,39,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,60,60,60,60,60,60,61,61,61,61,61,62,62,62,63,63,63,64,64,64,64,64,64,64,64,65,65,65,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,67,67,68,68,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,78,78,78,78,78,79,79,80,80,80,81,81,81,81,81,81,81,82,82,82,83,83,84,84,84,84,84,84,84,85,85,85,85,85,85,85,86,86,86,86,87,87, +}; + +static int DDXY[] = {46,45,46,44,45,44,46,49,50,51,52,44,45,47,48,50,51,53,45,46,47,49,52,53,45,48,52,53,45,46,47,48,49,51,52,44,45,50,51,52,43,44,45,50,52,45,50,51,52,45,49,50,53,54,55,56,57,58,59,62,63,64,65,69,70,71,72,45,48,57,58,59,60,61,62,66,67,68,72,73,74,75,45,47,58,59,63,66,67,76,77,45,46,59,63,64,76,45,51,52,53,54,58,60,63,65,75,76,45,50,55,58,60,64,65,76,44,46,49,55,58,63,64,65,66,76,44,47,49,56,57,63,65,67,76,44,47,48,49,50,51,56,57,62,65,67,76,45,48,50,51,52,53,54,55,56,57,58,63,65,67,68,69,70,74,75,46,47,48,49,50,58,59,60,61,62,63,64,65,68,69,74,41,42,43,46,48,49,51,56,59,60,61,62,65,66,67,70,71,72,73,75,76,77,41,43,45,46,47,50,51,52,55,57,58,67,68,72,73,74,76,77,40,41,43,44,46,47,50,51,53,54,68,69,73,76,41,42,43,48,50,52,58,59,70,71,73,75,42,43,44,49,50,52,57,59,71,72,73,75,44,45,46,47,48,49,50,51,53,56,59,70,73,74,75,45,46,50,52,53,55,58,59,69,73,75,47,48,49,50,53,54,58,69,50,53,54,56,57,69,50,51,52,55,69,51,52,69,51,52,69,51,52,66,67,68,69,70,71,52,64,65,68,69,70,71,72,73,74,75,76,52,61,62,63,66,67,68,75,52,61,50,51,52,53,54,55,56,57,58,61,50,51,53,54,55,56,57,59,61,49,50,52,53,54,55,56,57,58,60,61,41,47,48,49,52,54,57,59,60,41,42,45,46,47,48,50,51,53,54,55,56,57,58,59,60,42,43,44,49,51,52,54,55,57,59,60,42,43,49,51,52,55,58,60,42,44,49,50,51,52,55,57,58,60,42,44,49,50,52,55,56,58,60,43,44,49,50,51,55,58,59,43,44,55,58,61,58,61,58,59,61,55,56,57,58,59,60,61,54,55,58,53,59,52,53,56,57,58,60,61,51,52,54,55,58,59,60,52,53,58,59,57,58, +}; + +static int SMDXX[] = {17,17,17,17,17,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,23,23,23,23,23,23,23,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30,31,31,31,31,31,31,31,31,31,31,32,32,32,32,32,32,32,33,33,33,33,33,33,33,33,34,34,34,34,34,34,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37,37,37,37,37,38,38,38,38,38,38,39,39,39,39,39,39,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,50,50,50,50,50,50,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,60,60,60,60,60,61,61,61,61,62,62,62,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,64,64,64,64,64,64,64,64,64,64,64,65,65,65,65,65,65,66,66,66,66,66,66,67,67,67,67,67,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,89,89,89,89,90,90,90,90,90,90,90,90,90,90,91,91,91,91,91,91,91,91,91,92,92,92,92,92,92,92,92,92,93,93,93,93,93,93,93,93,94,94,94,94,94,94,94,94,94,95,95,95,95,95,95,95,95,95,95,95,95,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,97,97,97,97,97,97,97,97,97,97,97,97,97,98,98,98,98,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,99,99,99,100,100,100,100,100,100,100,100,100,100,100,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,103,103,103,103,103,103,103,103,103,104,104,104,104,104,104,104,104,105,105,105,105,105,105,105,105,106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107,107,107,107,107,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,110,110,110,110,110,110,110,110,110,110,110,110,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,114,114,114,114,114,114,114,114,114,115,115,115,115,115,115,115,115,115,115,115,115,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,116,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,118,118,118,118,118,118,118,118,118,118,118,118,118,119,119,119,119,119,119,119,119,119,119,119,119,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,122,122,122,122,122,122,122,122,122,122,122,122,123,123,123,123,123,123,123,123,123,124,124,124,124,124,124,124,124,124,124,124,125,125,125,125,125,125,125,125,125,125,126,126,126,126,126,126,126,126,126,126,127,127,127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,129,129,129,129,129,129,129,129,129,129,130,130,130,130,130,130,130,130,130,131,131,131,131,131,131,131,132,132,132,132,133,133,133,133,133,133,133,133,133,133,134,134,135,135,135,135,135,135,135,135,135,135,135,135 +}; + +static int SMDXY[] = {81,82,83,84,85,78,79,80,86,100,101,76,77,87,88,89,90,91,99,102,74,75,78,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,103,72,73,77,79,80,83,93,103,70,71,76,81,82,94,103,69,75,95,99,100,101,104,69,75,95,100,102,105,106,68,76,95,100,103,107,108,109,67,75,76,95,101,104,109,67,74,95,96,97,98,99,102,105,109,66,74,99,103,105,110,66,69,70,71,72,73,74,99,104,105,111,112,113,114,65,66,67,68,99,104,106,115,64,65,100,104,107,108,109,110,111,116,63,64,100,104,111,117,118,62,64,101,104,111,119,120,121,61,64,101,104,111,120,60,64,100,104,111,119,54,55,56,57,60,64,100,105,111,114,115,119,54,58,59,63,99,106,111,112,113,115,119,53,62,99,107,115,119,52,61,100,108,115,119,51,60,101,102,109,115,120,50,59,103,110,115,121,122,123,49,58,104,105,110,115,124,48,57,105,110,115,125,47,56,106,110,114,115,116,117,118,125,43,44,45,46,56,107,110,119,124,41,42,50,51,52,53,56,107,111,120,123,40,48,49,53,54,55,56,107,111,119,122,38,39,41,42,43,44,45,46,47,56,107,112,118,121,36,37,40,107,112,116,117,120,35,39,107,112,115,119,34,39,107,112,114,119,31,32,33,34,35,36,37,38,39,108,112,114,119,30,31,108,111,114,118,119,29,31,107,111,114,117,21,22,23,24,28,31,106,111,114,116,20,24,26,27,28,29,30,31,32,106,111,113,115,21,23,25,26,105,111,113,115,22,23,24,25,105,110,112,115,21,22,105,109,110,111,115,21,106,108,110,115,21,107,111,114,18,19,20,21,22,107,111,114,16,17,18,19,21,23,106,107,110,114,19,20,21,22,102,103,104,105,107,110,114,20,21,102,107,110,114,21,102,103,107,111,114,21,104,107,111,114,21,40,41,42,105,107,110,113,21,38,39,42,106,107,110,113,18,19,20,38,43,105,107,110,113,19,37,42,105,107,110,114,18,20,33,34,35,36,37,38,39,40,41,105,108,109,115,116,19,21,31,32,36,37,105,109,110,117,118,20,22,23,24,25,26,27,28,29,30,32,36,37,38,105,109,111,118,20,25,29,33,35,38,39,105,106,109,112,118,21,24,26,29,32,35,39,107,109,113,118,22,24,27,29,32,35,36,40,108,109,114,119,23,24,28,29,31,35,36,39,41,108,109,115,116,117,118,119,120,121,122,123,124,29,31,32,33,34,35,36,39,42,108,109,112,120,124,38,42,43,44,45,46,47,48,49,50,51,52,53,54,55,72,73,76,82,83,84,85,86,87,107,108,109,111,113,114,121,123,124,125,37,41,44,48,49,50,51,55,72,74,75,76,82,84,85,86,106,109,110,115,120,121,122,124,126,36,40,45,46,47,51,52,53,54,55,72,74,75,76,82,83,105,106,109,110,113,116,117,118,120,121,123,126,35,36,37,38,39,72,73,82,104,108,109,112,114,119,120,122,123,126,71,72,76,77,78,79,80,81,82,101,102,103,107,108,111,115,116,117,118,119,120,121,123,126,71,74,75,76,82,103,106,107,111,120,121,122,123,124,125,126,127,128,129,69,70,73,75,77,78,82,104,111,120,122,123,125,129,130,67,68,72,74,77,78,82,104,109,110,120,122,123,124,126,129,68,69,71,73,74,76,78,82,103,107,108,121,123,125,127,128,70,71,72,75,78,81,102,106,122,126,127,71,74,77,78,80,101,105,123,125,126,71,73,76,78,80,101,105,123,124,71,72,75,78,80,101,105,122,124,71,74,77,80,100,105,122,124,70,71,74,77,80,100,105,122,123,48,49,50,51,69,71,74,76,80,100,104,122,48,50,52,69,71,72,73,74,75,79,101,102,103,104,122,48,50,52,68,70,71,72,74,76,77,78,122,123,48,50,52,67,69,70,72,73,74,75,122,124,48,49,50,53,66,67,68,69,72,74,122,124,49,50,51,54,55,65,68,72,74,122,124,50,52,55,56,57,58,59,60,61,62,63,64,69,72,73,122,124,50,51,53,54,55,56,57,58,63,64,65,69,72,73,117,118,119,120,121,124,51,52,53,54,66,69,72,116,123,51,52,53,66,69,72,116,122,51,52,53,67,69,72,116,121,51,52,53,67,70,72,89,116,120,50,51,52,53,68,71,72,73,89,116,119,44,45,49,50,51,52,53,54,67,70,72,74,88,89,116,118,45,46,47,48,49,50,52,53,54,55,56,67,68,69,73,75,87,89,116,118,46,47,48,49,50,56,74,76,86,88,115,119,47,48,49,50,51,52,53,54,55,56,75,77,85,88,110,111,112,113,114,118,119,120,50,52,53,54,55,56,76,78,79,80,81,82,83,84,88,110,117,121,122,49,50,51,52,76,79,80,87,109,116,122,123,124,125,126,76,79,80,84,85,86,108,110,116,76,78,81,84,92,93,102,107,108,109,111,117,75,78,82,83,84,85,86,87,90,91,94,100,101,103,104,105,106,108,112,113,117,75,77,78,82,83,84,87,91,95,99,108,109,114,115,116,75,76,77,81,83,84,87,92,96,97,98,108,109,81,82,83,84,87,92,101,102,103,107,108,110,83,85,87,90,91,92,95,96,97,100,104,105,106,108,111,83,84,85,86,87,88,89,93,94,95,96,97,98,99,108,112,84,85,87,92,95,99,100,101,102,103,108,113,84,85,87,91,92,95,100,108,114,84,85,87,93,94,95,99,108,110,111,114,85,88,95,96,100,105,106,109,111,114,85,89,90,95,97,100,104,107,111,113,85,91,92,95,97,101,103,108,109,111,113,85,86,87,88,89,90,91,92,93,94,95,98,99,102,110,113,85,87,94,100,101,102,103,104,105,106,112,85,88,89,90,91,92,95,107,112,85,93,94,96,108,109,111,95,97,98,110,95,99,100,101,102,103,104,105,106,107,96,107,97,98,99,100,101,102,103,104,105,106,107,108 +}; + +int QuBiao (int MapId) +{ + int Xy = -1; + int biao = -1; + + if (MapId == 2000) {// + Xy = rand()%1019; + biao = YCXX[Xy]*1000; + biao += YCXY[Xy]; + }else if (MapId == 3000) {//ӼӴ + Xy = rand()%456; + biao = JJXX[Xy]*1000; + biao += JJXY[Xy]; + }else if (MapId == 1000) {// + Xy = rand()%790; + biao = KLXX[Xy]*1000; + biao += KLXY[Xy]; + }else if (MapId == 4000) {// + Xy = rand()%1109; + biao = SCXX[Xy]*1000; + biao += SCXY[Xy]; + }else if (MapId == 5000) {// + Xy = rand()%280; + biao = FCXX[Xy]*1000; + biao += FCXY[Xy]; + }else if (MapId == 3400) {//濩 + Xy = rand()%272; + biao = QGGXX[Xy]*1000; + biao += QGGXY[Xy]; + }else if (MapId == 5100) {// + Xy = rand()%201; + biao = DNXX[Xy]*1000; + biao += DNXY[Xy]; + }else if (MapId == 1100) {//ɰ´ + Xy = rand()%1263; + biao = KAXX[Xy]*1000; + biao += KAXY[Xy]; + }else if (MapId == 3100) {//ķ + Xy = rand()%783; + biao = TMXX[Xy]*1000; + biao += TMXY[Xy]; + }else if (MapId == 1400) {//̹ + Xy = rand()%697; + biao = KTXX[Xy]*1000; + biao += KTXY[Xy]; + }else if (MapId == 3300) {//³ + Xy = rand()%401; + biao = WLXX[Xy]*1000; + biao += WLXY[Xy]; + }else if (MapId == 1300) {//ش + Xy = rand()%1016; + biao = HETXX[Xy]*1000; + biao += HETXY[Xy]; + }else if (MapId == 3200) {// + Xy = rand()%484; + biao = DDXX[Xy]*1000; + biao += DDXY[Xy]; + }else if (MapId == 400) {//ɳķ + Xy = rand()%1330; + biao = SMDXX[Xy]*1000; + biao += SMDXY[Xy]; + } + + return biao; +} +#endif diff --git a/map/map_util.c b/map/map_util.c new file mode 100644 index 0000000..ead0a3f --- /dev/null +++ b/map/map_util.c @@ -0,0 +1,35 @@ +#include "version.h" +#include "common.h" +#include "char.h" +#include "readmap.h" + + +#define MAP_CHARFLOOR(x) CHAR_getInt(x,CHAR_FLOOR) +#define MAP_CHARX(x) CHAR_getInt(x,CHAR_X) +#define MAP_CHARY(x) CHAR_getInt(x,CHAR_Y) + +BOOL MAP_getMapDataFromCharIndex( int index , int* map ) +{ + int mapdata[2]; + int ret; + + ret = MAP_getTileAndObjData(MAP_CHARFLOOR(index), + MAP_CHARX(index), + MAP_CHARY(index), + &mapdata[0],&mapdata[1] ); + map[0] = mapdata[0]; + map[1] = mapdata[1]; + return ret; +} + +BOOL MAP_getMapDataFromFXY( int f , int x , int y, int* map ) +{ + int mapdata[2]; + int ret; + + ret = MAP_getTileAndObjData(f,x,y,&mapdata[0],&mapdata[1] ); + map[0] = mapdata[0]; + map[1] = mapdata[1]; + return ret; +} + diff --git a/map/map_warppoint.c b/map/map_warppoint.c new file mode 100644 index 0000000..0a3281f --- /dev/null +++ b/map/map_warppoint.c @@ -0,0 +1,387 @@ +#include "version.h" + +#include +#include "common.h" +#include "char.h" +#include "char_base.h" +#include "object.h" +#include "buf.h" +#include "util.h" +#include "configfile.h" +#include "readmap.h" +#include "map_warppoint.h" + +#ifdef _MAP_WARPPOINT +#define MAP_MAXWARPPOINT 6000 + +typedef struct _tagMAPwarpPoints{ + int use; + int ofloor; + int ox; + int oy; + + int floor; + int x; + int y; + int type; +}_MAPwarpPoints; + +_MAPwarpPoints *MapWarppoint; +static int MapWarpPoints=0; +char PointType[3][256]={ "NONE", "FREE", "ERROR"}; + +char Filename[256]; +int resetmappointtime = 0; +int MAPPOINT_InitMapWarpPoint() +{ + MapWarppoint = ( _MAPwarpPoints *)calloc( 1, sizeof( struct _tagMAPwarpPoints)*MAP_MAXWARPPOINT); + if( MapWarppoint == NULL ) return 0; + + sprintf(Filename, "%s/mapwarp.txt", getMapdir()); + MAPPOINT_resetMapWarpPoint( 0); + return MAP_MAXWARPPOINT; +} +/* +void MAPPOINT_checkMapWarpPoint( int floor, int x, int y) +{ + OBJECT object; + + for( object = MAP_getTopObj(fl,x,y) ; object ; + object = NEXT_OBJECT(object) ){ + int o = GET_OBJINDEX(object); + if( OBJECT_getType(o) == OBJTYPE_WARPPOINT){ + if( !MAPPOINT_CHECKINDEX( OBJECT_getIndex( o)) ) continue; + if( OBJECT_getchartype( o) != event ) continue; + MAPPOINT_MapWarpHandle( charaindex, OBJECT_getIndex( o), fl, x, y ); + found = TRUE; + break; + } + +} +*/ +void MAPPOINT_resetMapWarpPoint( int flg) +{ + int i; + if( MapWarppoint == NULL ) return; + for( i=0; i= MAP_MAXWARPPOINT ) + return FALSE; + + return MapWarppoint[ ps].use; +} + +int MAPPOINT_getMPointEVType( int ps) +{ + if( !MAPPOINT_CHECKINDEX( ps) ) + return -1; + return MapWarppoint[ ps].type; +} + +int MAPPOINT_setMapWarpFrom( int ps, char *buf) +{ + char buf1[256]; + + if( MAPPOINT_CHECKINDEX( ps) ){ + print(" ô͵ %s !!\n", buf); + return -1; + } + + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( buf, ",", 1, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].ofloor = atoi( buf1); + if( getStringFromIndexWithDelim( buf, ",", 2, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].ox = atoi( buf1); + if( getStringFromIndexWithDelim( buf, ",", 3, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].oy = atoi( buf1); + return 1; +} + +int MAPPOINT_setMapWarpGoal( int ps, char *buf) +{ + char buf1[256]; + if( MAPPOINT_CHECKINDEX( ps) ){ + print(" ô͵ :%s!!\n", buf); + return -1; + } + + memset( buf1, 0, sizeof( buf1)); + if( getStringFromIndexWithDelim( buf, ",", 1, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].floor = atoi( buf1); + if( getStringFromIndexWithDelim( buf, ",", 2, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].x = atoi( buf1); + if( getStringFromIndexWithDelim( buf, ",", 3, buf1, sizeof(buf1)) ==FALSE ) return -1;//ԭ + MapWarppoint[ps].y = atoi( buf1); + return 1; +} + +int MAPPOINT_getMapWarpGoal( int ps, int ofl, int ox, int oy, int *fl, int *x, int *y) +{ + if( !MAPPOINT_CHECKINDEX( ps) ){ + print("ȡ͵PS:%d !!\n", ps); + return -1; + } + + if( MapWarppoint[ps].ofloor != ofl || + MapWarppoint[ps].ox != ox || MapWarppoint[ps].oy != oy ){ + print( "͵: ɵ⴫͵ %d %d %d !!\n" , ofl,ox,oy ); + int newmappointtime = time(NULL); + if(newmappointtime-resetmappointtime>=60){ + MAPPOINT_resetMapWarpPoint( 1); + MAPPOINT_loadMapWarpPoint(); + resetmappointtime = newmappointtime; + } + return -1; + } + //ɼж + if( MAP_IsValidCoordinate( MapWarppoint[ps].floor, MapWarppoint[ps].x, MapWarppoint[ps].y)== FALSE ){ + print( "͵: %d %d %d !!\n" , + MapWarppoint[ps].floor,MapWarppoint[ps].x, MapWarppoint[ps].y ); + return -1; + } + *fl = MapWarppoint[ps].floor; + *x = MapWarppoint[ps].x; + *y = MapWarppoint[ps].y; + return 1; +} + +int MAPPOINT_loadMapWarpPoint( ) +{ + int i=0, ps=0, objtype; + FILE *fp=NULL; + char buf[256], buf1[256]; + + if( Filename == NULL ) return -1; + fp = fopen( Filename, "r"); + if( fp == NULL ){ + return 0; + } + while( fgets( buf, sizeof( buf)-1, fp) != NULL ){ + if( strstr( buf, "#") != 0 ) continue; + if( getStringFromIndexWithDelim( buf, ":", 1, buf1, sizeof(buf1)) ==FALSE ) + continue; + for( i=0; i= arraysizeof( PointType) ){ + print(" 1.map ͵ %s \n", buf); + continue; + } + MapWarppoint[ps].type = i; + if( getStringFromIndexWithDelim( buf, ":", 2, buf1, sizeof(buf1)) ==FALSE ) continue; + objtype = CHAR_EVENT_WARP; + if( !strcmp( buf1, "NULL")){ + }else if( !strcmp( buf1, "M")){ + objtype = CHAR_EVENT_WARP_MORNING; + }else if( !strcmp( buf1, "N")){ + objtype = CHAR_EVENT_WARP_NIGHT; + }else if( !strcmp( buf1, "A")){ + objtype = CHAR_EVENT_WARP_NOON; + } + memset( buf1, 0, sizeof(buf1)); + if( getStringFromIndexWithDelim( buf, ":", 3, buf1, sizeof(buf1)) ==FALSE )continue; + + if( MAPPOINT_setMapWarpFrom( ps, buf1) == -1){ + print(" 2-1.map ͵ %s [%s] \n", buf, buf1); + continue; + } + if( MAPPOINT_creatMapWarpObj( ps, buf1, objtype) == -1 ){ + print(" 2.map ͵ %s [%s] \n", buf, buf1); + continue; + } + memset( buf1, 0, sizeof(buf1)); + if( getStringFromIndexWithDelim( buf, ":", 4, buf1, sizeof(buf1)) ==FALSE ){ + print(" 3.map ͵ %s [%s] \n", buf, buf1); + continue; + } + if( MAPPOINT_setMapWarpGoal( ps, buf1) == -1 ){ + print(" 4.map ͵ %s \n", buf); + continue; + } + memset( buf1, 0, sizeof(buf1)); + if( getStringFromIndexWithDelim( buf, ":", 5, buf1, sizeof(buf1)) ==FALSE ){ + print(" 5.map ͵ %s [%s] \n", buf, buf1); + continue; + } + MapWarppoint[ps].use = 1; + MapWarpPoints++; + ps++; + if( ps >= MAP_MAXWARPPOINT ){ + break; + } + } + //andy_log + print("ʼ %d ͼ͵...", MapWarpPoints); + fclose( fp); + print("\n"); + return 1; +} + +void MAPPOINT_MapWarpHandle( int charaindex, int ps, int ofl, int ox, int oy ) +{ + int floor, x, y; + if( MAPPOINT_getMapWarpGoal( ps, ofl, ox, oy, &floor, &x, &y) == -1 ){ + //andy_log + print( "ȡ͵( %d, %d,%d,%d)!!\n", ps, ofl, ox, oy); + return; + } + if( floor == 777 ) return; + CHAR_warpToSpecificPoint( charaindex, floor, x, y); + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index) ) { + CHAR_warpToSpecificPoint( index, floor, x, y); + } + } + } +} +#endif + + +#ifdef _CAX_LNS_MAPSUOXU +int DelMapPoint( int ps)//жصͼ͵ +{ + if (MapWarppoint[ps].use != 1) return FALSE; + MapWarppoint[ps].type = 0;//õͼĴ͵ + endObjectOne(get_mappointindex(MapWarppoint[ps].ofloor,MapWarppoint[ps].ox,MapWarppoint[ps].oy));//obj + MapWarppoint[ps].ofloor = -1;//õͼĴ͵ + MapWarppoint[ps].ox = -1;//õͼĴ͵ + MapWarppoint[ps].oy = -1;//õͼĴ͵ + MapWarppoint[ps].floor = -1;//õͼĴ͵ + MapWarppoint[ps].x = -1;//õͼĴ͵ + MapWarppoint[ps].y = -1;//õͼĴ͵ + MapWarppoint[ps].use = 0; + MapWarppoint[ps].type = 0; + return TRUE;//עô͵ʱȼǷԭд͵ +} + +int SetMapPoint( char* buf)//صͼ͵ +{ // "͵:NULL:2000,50,50:2006,20,20:" + if( MapWarpPoints >= MAP_MAXWARPPOINT ){ + print(" ͵Ѵޣ\n"); + return -1; + } + char buf1[256]; + char buf2[256]; + int objtype,i; + if( getStringFromIndexWithDelim( buf, ":", 1, buf1, sizeof(buf1)) ==FALSE )//ҳ͵ + { + return -2; + } + for( i=0; i= arraysizeof( PointType) ){//͵ʹ + return -3 ; + } + MapWarppoint[MapWarpPoints].type = i;//õͼĴ͵ + if( getStringFromIndexWithDelim( buf, ":", 2, buf1, sizeof(buf1)) ==FALSE ) //ҳ͵Чʱ + { + return -4 ; + } + objtype = CHAR_EVENT_WARP;//öΪ͵ + if( !strcmp( buf1, "NULL")){ + }else if( !strcmp( buf1, "M")){ + objtype = CHAR_EVENT_WARP_MORNING;//öΪ糿͵ + }else if( !strcmp( buf1, "N")){ + objtype = CHAR_EVENT_WARP_NIGHT;//öΪϴ͵ + }else if( !strcmp( buf1, "A")){ + objtype = CHAR_EVENT_WARP_NOON;//öΪ紫͵ + } + memset( buf1, 0, sizeof(buf1)); + if( getStringFromIndexWithDelim( buf, ":", 3, buf1, sizeof(buf1)) ==FALSE )//ҳԭ + { + return -5 ; + } + int fl = -1,x = -1,y = -1; + if( getStringFromIndexWithDelim( buf1, ",", 1, buf2, sizeof(buf1)) !=FALSE )//ҳԭ + { + fl = atoi(buf2); + } + if( getStringFromIndexWithDelim( buf1, ",", 2, buf2, sizeof(buf1)) !=FALSE )//ҳԭ + { + x = atoi(buf2); + } + if( getStringFromIndexWithDelim( buf1, ",", 3, buf2, sizeof(buf1)) !=FALSE )//ҳԭ + { + y = atoi(buf2); + } + if (fl == -1 || x == -1 || y == -1) return -5; + if (get_mappointindex( fl,x, y) != -1) return -5;//ù͵㣡 + for (i=0;i= MapWarpPoints) MapWarpPoints++;//ǰ͵ѾԤһ͵㡣 + return i; +} +#endif diff --git a/map/readmap.c b/map/readmap.c new file mode 100644 index 0000000..3ad1eb1 --- /dev/null +++ b/map/readmap.c @@ -0,0 +1,1621 @@ +#include "version.h" +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "common.h" +#include "object.h" +#include "readmap.h" +#include "buf.h" +#include "util.h" +#include "char.h" +#include "lssproto_serv.h" +#include "configfile.h" + +#define MAP_MAGIC "LS2MAP" + +static void MAP_makeDefaultImageData( MAP_ImageData* one ) +{ + one->data[MAP_WALKABLE] = TRUE; + one->data[MAP_HAVEHEIGHT] = FALSE; + one->data[MAP_DEFENCE] = 0; + one->data[MAP_INTODAMAGE] = 0; + one->data[MAP_OUTOFDAMAGE] = 0; + + one->data[MAP_SETED_BATTLEMAP] = 0; + one->data[MAP_BATTLEMAP] = 0; + one->data[MAP_BATTLEMAP2] = 0; + one->data[MAP_BATTLEMAP3] = 0; + one->data[MAP_INTODARKNESS] = 0; + one->data[MAP_INTOCONFUSION] = 0; + + one->data[MAP_OUTOFPOISON] = 0; + one->data[MAP_OUTOFPARALYSIS] = 0; + one->data[MAP_OUTOFSILENCE] = 0; + one->data[MAP_OUTOFSTONE] = 0; + one->data[MAP_OUTOFDARKNESS] = 0; + one->data[MAP_OUTOFCONFUSION] = 0; + +} + +static int MAP_flgSet( char* string ) +{ + int tmp; + tmp = atoi(string); + if( tmp == 0 ) + return 0; + return 1; +} +typedef enum +{ + MAP_INTENTRY=0, + MAP_CHARENTRY=1, + MAP_INTFUNC=2, + MAP_CHARFUNC=3, +}MAP_DATATYPECATEGORY; +static struct MAP_itemconfentry +{ + int type; + int index; + void* func; +}MAP_confentries[MAP_DATAINT_NUM+MAP_DATACHAR_NUM]={ + {MAP_INTENTRY, MAP_WALKABLE, MAP_flgSet}, + {MAP_INTENTRY, MAP_HAVEHEIGHT, MAP_flgSet}, + {MAP_INTENTRY, MAP_DEFENCE, NULL}, + {MAP_INTENTRY, MAP_INTODAMAGE, NULL}, + {MAP_INTENTRY, MAP_OUTOFDAMAGE, NULL}, + + {MAP_INTENTRY, MAP_SETED_BATTLEMAP, NULL}, + {MAP_INTENTRY, MAP_BATTLEMAP, NULL}, + {MAP_INTENTRY, MAP_BATTLEMAP2, NULL}, + {MAP_INTENTRY, MAP_BATTLEMAP3, NULL}, + {MAP_INTENTRY, MAP_INTODARKNESS, NULL}, + {MAP_INTENTRY, MAP_INTOCONFUSION, NULL}, + + {MAP_INTENTRY, MAP_OUTOFPOISON, NULL}, + {MAP_INTENTRY, MAP_OUTOFPARALYSIS, NULL}, + {MAP_INTENTRY, MAP_OUTOFSILENCE, NULL}, + {MAP_INTENTRY, MAP_OUTOFSTONE, NULL}, + {MAP_INTENTRY, MAP_OUTOFDARKNESS, NULL}, + {MAP_INTENTRY, MAP_OUTOFCONFUSION, NULL}, + +}; + +static MAP_ImageData* MAP_imagedata; +static unsigned int MAP_imagedatanum; +static int MAP_imgfilt[65535]; +#ifdef _CAX_LNS_MAPSUOXU +static int fbmap[10000]; +#endif + +BOOL MAP_readMapConfFile( char* filename ) +{ + FILE* file; + char line[512]; + int maximagenumber=0; + int i; + int linenum=0; + int imgdataindex=0; + + file = fopen( filename , "r" ); + if( file == NULL ){ + fprint( "޷ļ %s\n", filename ); + return FALSE; + } + while( fgets( line , sizeof( line ) , file ) ){ + char imgnum[16]; + BOOL ret; + int imgnumber; + deleteSequentChar( line, " \t" ); + pohcd( line, " \t" ); + dchop(line, " \t"); + + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + ret = getStringFromIndexWithDelim( line , " " , 1 , imgnum , sizeof( imgnum ) ); + if( ret == FALSE )continue; + imgnumber = atoi(imgnum); + maximagenumber = max( maximagenumber , imgnumber ); + } + + MAP_imagedatanum = maximagenumber + 1; + MAP_imagedata=allocateMemory(sizeof(MAP_ImageData)*MAP_imagedatanum); + if( MAP_imagedata == NULL ){ + fprint("޷ͼݴС=%d\n",MAP_imagedatanum); + return FALSE; + } + + for( i = 0; i data[MAP_confentries[i].index] + = atoi( token ); + break; + case MAP_CHARENTRY: + strcpysafe( one->string[MAP_confentries[i].index].string, + sizeof( one->string[MAP_confentries[i].index]. + string), + token); + break; + case MAP_INTFUNC: + { + int (*intfunction)(char* ); + intfunction = MAP_confentries[i].func; + one->data[MAP_confentries[i].index] + = intfunction(token); + break; + } + case MAP_CHARFUNC: + { + char* (*charfunction)(char* ); + charfunction = MAP_confentries[i].func; + + strcpysafe( one->string[MAP_confentries[i].index].string, + sizeof(one->string[MAP_confentries[i].index]. + string), + charfunction(token)); + break; + } + default: + break; + } + } + } + + fclose( file ); + return TRUE; +} + +#if 1 +BOOL MAP_readBattleMapConfFile( char* filename ) +{ + FILE* file; + char line[512]; + + int i, j; + int linenum=0; + int BattleMapNo[3], iRet, iWork, iPre[3],iFirst, iLast; + + file = fopen( filename , "r" ); + if( file == NULL ){ + fprint( "޷ %s\n", filename ); + return FALSE; + } + + BattleMapNo[0] = 0; + BattleMapNo[1] = 0; + BattleMapNo[2] = 0; + while( fgets( line , sizeof( line ) , file ) ){ + char *p; + linenum++; + + pohcd( line, " \t" ); + dchop(line, " \t"); + + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + + if( line[0] == '$' ){ + iRet = sscanf( line+1, "%d %d %d", &iPre[0], &iPre[1], &iPre[2] ); + BattleMapNo[0] = BattleMapNo[1] = BattleMapNo[2] = iPre[0]; + if( iRet < 1 ){ + print( "!!!!! ޷ȡսͼ(%s)( line %d )\n", filename, linenum ); + } + for( i = 0; i < iRet; i ++ ){ + BattleMapNo[i] = iPre[i]; + if( BattleMapNo[i] < 0 ){ + print( "!!!!! սͼΪֵ (%s)( line %d )\n", filename, linenum ); + } + } + + continue; + + } + if( sscanf( line, "%d", &iWork ) != 1 ){ + continue; + } + if( iWork < 0 ){ + print( "!!!!! ǮΪֵ (%s)( line %d )\n", filename, linenum ); + continue; + } + iFirst = iWork; + p = strstr( line, "to" ); + if( p != NULL ){ + if( sscanf( p+2, "%d", &iWork ) != 1 ){ + iLast = iFirst; + }else{ + iLast = iWork; + } + if( iWork < 0 ){ + print( "!!!!! ǮΪֵ (%s)( line %d )\n", filename, linenum ); + continue; + } + }else{ + iLast = iFirst; + } + + for( i = iFirst; i <= iLast; i ++ ){ + if( MAP_getImageInt( i, MAP_SETED_BATTLEMAP ) > 0 ){ + print( "!!!!! ͬǮظ趨(%s)( line %d )(%d)(%d & %d)\n", + filename, linenum, i, + MAP_getImageInt( i, MAP_BATTLEMAP ), + BattleMapNo[0] ); + } + + // įо + if( IsValidImagenumber( i ) == FALSE ){ + continue; + } + MAP_setImageInt( i, MAP_BATTLEMAP, BattleMapNo[0] ); + MAP_setImageInt( i, MAP_BATTLEMAP2, BattleMapNo[1] ); + MAP_setImageInt( i, MAP_BATTLEMAP3, BattleMapNo[2] ); + MAP_setImageInt( i, MAP_SETED_BATTLEMAP, 1 ); + } + + } + fclose( file ); + + for( j = 0; j < arraysizeof( MAP_imgfilt ); j ++ ){ + if( MAP_imgfilt[j] == -1 )continue; + if( MAP_getImageInt( j, MAP_SETED_BATTLEMAP ) == 0 ){ + print( "!!!!! Ǯ(%d)δ趨 (%s)\n", j, filename ); + } + } + return TRUE; +} +#endif + +BOOL IsValidImagenumber( int imagenumber ) +{ + if( imagenumber < 0 || imagenumber >= arraysizeof( MAP_imgfilt ) ) + return FALSE; + + if( MAP_imgfilt[imagenumber] == -1 ) + return FALSE; + return TRUE; +} + +int MAP_getImageInt( int imagenumber, int element ) +{ + if( imagenumber < 0 || imagenumber >= arraysizeof( MAP_imgfilt )) + return FALSE; + + if( MAP_imgfilt[imagenumber] == -1 )return FALSE; + return MAP_imagedata[MAP_imgfilt[imagenumber]].data[element]; +} + +BOOL MAP_setImageInt( int imagenumber, int element, int value ) +{ + if( imagenumber < 0 || imagenumber >= arraysizeof( MAP_imgfilt )) + return FALSE; + + if( MAP_imgfilt[imagenumber] == -1 )return FALSE; + MAP_imagedata[MAP_imgfilt[imagenumber]].data[element] = value; + + return TRUE; +} + +static MAP_Map* MAP_map; +static unsigned int MAP_mapnum; +static unsigned int MAP_mapnum_index; + + +static int* MAP_idjumptbl; +static int MAP_idtblsize; + +BOOL MAP_initMapArray( int num ) +{ + MAP_mapnum = num ; + + MAP_map = allocateMemory( sizeof( MAP_Map ) * MAP_mapnum ); + if( MAP_map == NULL )return FALSE; + + MAP_mapnum_index = 0; + + return TRUE; +} + +void MAP_endMapArray( void ) +{ + int i; + for( i = 0 ; i < MAP_mapnum ; i ++ ){ + if( MAP_map[i].tile != NULL ) + freeMemory( MAP_map[i].tile ); + + if( MAP_map[i].obj != NULL) + freeMemory( MAP_map[i].obj ); + + } + MAP_mapnum = 0; + MAP_mapnum_index = 0; + freeMemory( MAP_map ); + MAP_map = NULL; +} + +static BOOL MAP_IsMapFile( char* filename ) +{ + FILE* f; + char buf[16]; + int ret; + + f = fopen(filename, "r"); + if( f == NULL ){ + errorprint; + return FALSE; + } + + ret = fread( buf , sizeof( char ) , 6 , f); + if( ret != 6 ) + goto FCLOSERETURNFALSE; + buf[ret] = '\0'; + + if( strcmp( buf , MAP_MAGIC ) != 0 ) + goto FCLOSERETURNFALSE; + else + goto FCLOSERETURNTRUE; + +FCLOSERETURNFALSE: + fclose(f); + return FALSE; +FCLOSERETURNTRUE: + fclose(f); + return TRUE; +} + +static BOOL MAP_readMapOne( char* filename ) +{ + FILE* f; /* ̻ */ + char buf[16]; /* Ѩ͹ϼ */ + short data[1024]; /* */ + int ret; /* ߯ԻԻ */ + int i; /* */ + int mapindex; + + int id=0,xsiz=0,ysiz=0; /* Ѩ󷸡ɡ */ + + short *tile=NULL; + short *obj=NULL; + MAP_Objlink** olink=NULL; + char showstring[32]; /* Ѩ󷸡ɡ */ + struct stat filestat; /* ñ */ + BOOL invaliddata=FALSE; + if( MAP_mapnum_index >= MAP_mapnum ){ + fprint( "û㹻ռװصͼ.\n" ); + return FALSE; + } + mapindex=MAP_mapnum_index; + f = fopen(filename, "r"); + if( f == NULL ){ + errorprint; + return FALSE; + } + if( fstat( fileno(f) , &filestat ) != 0 ){ + errorprint; + goto FCLOSERETURNFALSE; + } + + ret = fread( buf , sizeof( char ) , 6 , f); + if( ret != 6 ){ + errorprint; + goto FCLOSERETURNFALSE; + } + buf[ret] = '\0'; + + if( strcmp( buf , MAP_MAGIC ) != 0 ) + goto FCLOSERETURNFALSE; + ret = fread( data , sizeof( short ) , 1 , f); + if( ret != 1 ){ + errorprint; + goto FCLOSERETURNFALSE; + } + id = ntohs( data[0] ); + + ret = fread( showstring , sizeof(char), arraysizeof(showstring), f); + if( ret != arraysizeof(showstring) ){ + errorprint; + goto FCLOSERETURNFALSE; + } + showstring[arraysizeof(showstring)-1] = '\0'; + ret = fread( data, sizeof( short ) , 1 , f); + if( ret != 1 ){ + errorprint; + goto FCLOSERETURNFALSE; + } + xsiz = ntohs( data[0] ); + ret = fread( data, sizeof( short ) , 1 , f); + if( ret != 1 ){ + errorprint; + goto FCLOSERETURNFALSE; + } + ysiz = ntohs( data[0] ); + tile = allocateMemory( sizeof( short ) * xsiz * ysiz ); + if( tile == NULL ){ + fprint( "޷ڴͼ:%s xsiz:%d ysiz:%d\n", filename, xsiz, ysiz); + goto FREEOBJHP; + } + + obj = allocateMemory( sizeof( short ) * xsiz * ysiz ); + if( obj == NULL ){ + fprint( "޷ڴ\n"); + goto FREETILE; + } + + olink = allocateMemory( sizeof(MAP_Objlink*) * xsiz * ysiz ); + if( olink == NULL ){ + fprint( "޷ڴ\n"); + goto FREEOBJ; + } + + ret = fread( tile , sizeof( short )*xsiz*ysiz,1,f ); + if( ret != 1 ){ + errorprint; + goto FREELINK; + } +// for( i = 0 ; i < xsiz * ysiz ; i ++ ) +// tile[i] = ntohs( tile[i] ); + for( i = 0 ; i < xsiz * ysiz ; i ++ ){ + tile[i] = ntohs( tile[i] ); + if( !IsValidImagenumber( tile[i] ) ){ + fprint("1ͼͼƬ:%d x:%d y:%d :%d\n", + id, i % xsiz, (int)(i / xsiz) , tile[i]); + invaliddata = TRUE; + } + } + ret = fread( obj , sizeof( short )*xsiz*ysiz,1,f ); + if( ret != 1 ){ + errorprint; + goto FREELINK; + } +// for( i = 0 ; i < xsiz * ysiz ; i ++ ) +// obj[i] = ntohs( obj[i] ); + for( i = 0 ; i < xsiz * ysiz ; i ++ ){ + obj[i] = ntohs( obj[i] ); + if( !IsValidImagenumber( obj[i] ) ){ + fprint( + "2ͼͼƬ:%d x:%d y:%d :%d\n", + id, i % xsiz, (int)(i / xsiz) , obj[i]); + invaliddata = TRUE; + } + } + if( invaliddata )goto FREELINK; +/* if( ftell(f) != filestat.st_size) + fprintf(stderr,"ļСȷ(%s). ĿļС:%" +#ifdef linux + "l" +#elif __FreeBSD__ + "ll" +#endif + "d ʵʴС:%ld\n", + filename, filestat.st_size,ftell(f)); +*/ + + for( i=0 ; i< xsiz*ysiz ; i ++ ) + olink[i] = NULL; + + MAP_map[mapindex].id = id; + MAP_map[mapindex].xsiz = xsiz; + MAP_map[mapindex].ysiz = ysiz; + strcpysafe( MAP_map[mapindex].string , + sizeof(MAP_map[mapindex].string), + showstring ); + MAP_map[mapindex].tile = tile; + MAP_map[mapindex].obj = obj; + MAP_map[mapindex].olink = olink; +#ifdef _MAP_NOEXIT + { + FILE *fp; + char mpexit[128]; + int floorID=0,exfloor=0,ex_X=0,ex_Y=0; + int map_type=0; + MAP_map[mapindex].startpoint = 0; + fp = fopen( "./data/map/map_noexit.txt","r"); + if( fp != NULL ){ + while( fgets(mpexit, 128, fp) != NULL ) { + sscanf( mpexit,"%d %d %d %d %d", &floorID, &exfloor, &ex_X, &ex_Y, &map_type); + if( strstr( mpexit, "#" ) != NULL) + continue; + if( floorID == id) { + MAP_map[mapindex].startpoint = (exfloor<<16)+(ex_X << 8)+(ex_Y<<0); + MAP_map[mapindex].MapType = map_type; + } + } + // Nuke 1204: Bug fix + fclose(fp); + }else { + print("\n **** Ҳ map_noexit.txt ļ!!!"); + } + } +#endif + goto FCLOSERETURNTRUE; + +FCLOSERETURNTRUE: + MAP_mapnum_index++; + fclose(f); + return TRUE; + +FREELINK: + freeMemory( olink ); +FREEOBJ: + freeMemory( obj ); +FREETILE: + freeMemory( tile ); +FREEOBJHP: +FCLOSERETURNFALSE: + fclose(f); + return FALSE; +} +#ifdef _MAP_NOEXIT +unsigned int MAP_getExFloor_XY( int floor, int *map_type) +{ + int i; + int exfloor; + for( i=0; i 0 ) { + exfloor = (MAP_map[i].startpoint>>16)&0xffffff; + if( exfloor >= 0 ) { + *map_type = MAP_map[i].MapType; + return MAP_map[i].startpoint ; + } + } + } + } + return 0; +} +BOOL CHECKFLOORID( id) +{ + int i; + + if( id < 0 ) + return FALSE; + + for( i=0; i MAP_getfloorX(mapid) || + y < 0 || y > MAP_getfloorY(mapid)) + return FALSE; + + return TRUE; +} + +#define MAP_GETMAXSIZE 45 +static char MAP_dataString[STRINGBUFSIZ*3]; +static int MAP_workdatabuffer[MAP_GETMAXSIZE*MAP_GETMAXSIZE]; +#define MAP_DATADELIMITER "," + +char* MAP_getdataFromRECT( int floor, RECT* seekr, RECT* realr ) +{ + int floorindex; + int stringlength=0; + char tmpbuffer[128]; + int i,j; + int floorx; + int databufferindex=0; + RECT scr; + char escapebuffer[128]; + + floorindex = MAP_getfloorIndex( floor ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return NULL; + } + if( seekr->width < 0 || seekr->height < 0 || + MAP_GETMAXSIZE < seekr->width || MAP_GETMAXSIZE < seekr->height ){ + print( "%s:%d:err\n", __FILE__, __LINE__); + return NULL; + } + snprintf( tmpbuffer,sizeof(tmpbuffer), + "%s|" , + makeEscapeString( MAP_map[floorindex].string, + escapebuffer,sizeof(escapebuffer))); + + strcpysafe( MAP_dataString, sizeof( MAP_dataString ), tmpbuffer ); + stringlength = strlen( tmpbuffer ); + + floorx = MAP_map[floorindex].xsiz; + scr.x = 0; + scr.y = 0; + scr.width = floorx; + scr.height= MAP_map[floorindex].ysiz; + + if( clipRect( seekr,&scr,realr ) == FALSE ){ + realr->x=realr->y=realr->width=realr->height=0; + return MAP_dataString; + } + for( i = realr->y ; i < realr->y + realr->height ; i ++ ){ + for( j = realr->x ; j < realr->x + realr->width ; j ++ ){ + MAP_workdatabuffer[databufferindex++] + = MAP_map[floorindex].tile[i*floorx+j]; + } + } + for( i = 0 ; i < databufferindex ; i ++ ){ + char buf[64]; + snprintf( tmpbuffer,sizeof(tmpbuffer),"%s" MAP_DATADELIMITER , + cnv10to62( MAP_workdatabuffer[i], buf, sizeof( buf)) ); + strcpysafe( &MAP_dataString[stringlength] , + sizeof( MAP_dataString ) - stringlength, + tmpbuffer ); + stringlength += strlen( tmpbuffer ); + } + if( stringlength < sizeof( MAP_dataString ) ) + MAP_dataString[stringlength-1] = NONCHAR_DELIMITER[0]; + databufferindex=0; + for( i = realr->y ; i < realr->y + realr->height ; i ++ ){ + for( j = realr->x ; j < realr->x + realr->width ; j ++ ){ + MAP_workdatabuffer[databufferindex++] + = MAP_map[floorindex].obj[i*floorx+j]; + } + } + for( i = 0 ; i < databufferindex ; i ++ ){ + char buf[64]; + if( MAP_workdatabuffer[i] == 0 ) buf[0] = '\0'; + else cnv10to62( MAP_workdatabuffer[i], buf, sizeof( buf)); + snprintf( tmpbuffer,sizeof(tmpbuffer),"%s" MAP_DATADELIMITER , + buf ); + strcpysafe( &MAP_dataString[stringlength] , + sizeof( MAP_dataString ) - stringlength, + tmpbuffer ); + stringlength += strlen( tmpbuffer ); + } + + if( stringlength < sizeof( MAP_dataString ) ) + MAP_dataString[stringlength-1] = NONCHAR_DELIMITER[0]; + + databufferindex=0; + for( i = realr->y ; i < realr->y + realr->height ; i ++ ){ + for( j = realr->x ; j < realr->x + realr->width ; j ++ ){ + OBJECT object; + BOOL found = FALSE; + for( object = MAP_getTopObj(floor,j,i) ; object ; + object = NEXT_OBJECT(object) ){ + int o = GET_OBJINDEX(object); + if( OBJECT_getType(o) == OBJTYPE_CHARA ){ + int etype; + int charaindex=OBJECT_getIndex(o); + if( !CHAR_CHECKINDEX(charaindex) )continue; + etype = CHAR_getWorkInt( charaindex, CHAR_WORKEVENTTYPE); + if( etype != CHAR_EVENT_NONE ) { + MAP_workdatabuffer[databufferindex++] = etype; + found = TRUE; + break; + } + } +#ifdef _MAP_WARPPOINT + else if( OBJECT_getType(o) == OBJTYPE_WARPPOINT ){ + int etype = OBJECT_getchartype( o); + if( etype != CHAR_EVENT_NONE ) { + MAP_workdatabuffer[databufferindex++] = (unsigned short)etype; + found = TRUE; + break; + } + } +#endif + } + if( !found ) { + MAP_workdatabuffer[databufferindex++] + = CHAR_EVENT_NONE; + } + } + } + for( i = 0 ; i < databufferindex ; i ++ ){ + char buf[64]; + if( MAP_workdatabuffer[i] == 0 ) buf[0] = '\0'; + else cnv10to62( MAP_workdatabuffer[i], buf, sizeof( buf)); + + snprintf( tmpbuffer,sizeof(tmpbuffer),"%s" MAP_DATADELIMITER, buf); + strcpysafe( &MAP_dataString[stringlength] , + sizeof( MAP_dataString ) - stringlength, tmpbuffer ); + stringlength += strlen( tmpbuffer ); + } + dchop( MAP_dataString, MAP_DATADELIMITER ); + return MAP_dataString; +} + +char *MAP_getChecksumFromRECT( int floor, RECT* seekr, RECT* realr, + int *tilesum, int *objsum, int *eventsum ) +{ + int floorindex; + int i,j; + int floorx; + int databufferindex=0; + RECT scr; + char escapebuffer[128]; + unsigned short eventbuf[MAP_CHAR_DEFAULTSEESIZ * MAP_CHAR_DEFAULTSEESIZ]; + unsigned short tilebuf[ MAP_CHAR_DEFAULTSEESIZ * MAP_CHAR_DEFAULTSEESIZ]; + unsigned short objbuf[ MAP_CHAR_DEFAULTSEESIZ * MAP_CHAR_DEFAULTSEESIZ]; + + floorindex = MAP_getfloorIndex( floor ); + if( floorindex == -1 ) return NULL; + if( seekr->width < 0 || seekr->height < 0 || + MAP_GETMAXSIZE < seekr->width || MAP_GETMAXSIZE < seekr->height ) + return NULL; + + strcpysafe( MAP_dataString, sizeof( MAP_dataString ), + makeEscapeString( MAP_map[floorindex].string, + escapebuffer,sizeof(escapebuffer))); + + floorx = MAP_map[floorindex].xsiz; + scr.x = 0; + scr.y = 0; + scr.width = floorx; + scr.height= MAP_map[floorindex].ysiz; + + if( clipRect( seekr,&scr,realr ) == FALSE ){ + realr->x=realr->y=realr->width=realr->height=0; + return MAP_dataString; + } + + *tilesum = 0; + *objsum =0; + *eventsum = 0; + memset( tilebuf, 0, sizeof( tilebuf)); + memset( objbuf, 0, sizeof( objbuf)); + memset( eventbuf, 0, sizeof( eventbuf)); + for( i = realr->y ; i < realr->y + realr->height ; i ++ ){ + for( j = realr->x ; j < realr->x + realr->width ; j ++ ){ + OBJECT object; + //BOOL found = FALSE; + for( object = MAP_getTopObj(floor,j,i) ; object ; + object = NEXT_OBJECT(object) ){ + int o = GET_OBJINDEX(object); + if( OBJECT_getType(o) == OBJTYPE_CHARA ){ + int etype; + int charaindex=OBJECT_getIndex(o); + if( !CHAR_CHECKINDEX(charaindex) )continue; + etype = CHAR_getWorkInt( charaindex, CHAR_WORKEVENTTYPE); + if( etype != CHAR_EVENT_NONE ) { + eventbuf[databufferindex] = (unsigned short)etype; + break; + } + } +#ifdef _MAP_WARPPOINT + else if( OBJECT_getType(o) == OBJTYPE_WARPPOINT ){ + int etype = OBJECT_getchartype( o); + if( etype != CHAR_EVENT_NONE ) { + eventbuf[databufferindex] = (unsigned short)etype; + break; + } + } +#endif + } + tilebuf[databufferindex] = (unsigned short)MAP_map[floorindex].tile[i*floorx+j]; + objbuf[databufferindex] = (unsigned short)MAP_map[floorindex].obj[i*floorx+j]; + databufferindex++; + } + } + *tilesum = CheckCRC( (unsigned char*)tilebuf, sizeof( tilebuf)); + *objsum = CheckCRC( (unsigned char*)objbuf, sizeof( objbuf)); + *eventsum = CheckCRC( (unsigned char*)eventbuf, sizeof( eventbuf)); + + return MAP_dataString; +} + +BOOL MAP_getTileAndObjData( int ff ,int fx, int fy, int* tile, int* obj) +{ + int floorindex,xsiz; + floorindex = MAP_getfloorIndex( ff ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + xsiz = MAP_map[floorindex].xsiz; + + if( fx < 0 || fx >= xsiz ) { + return FALSE; + } + if( fy < 0 || fy >= MAP_map[floorindex].ysiz ) { + return FALSE; + } + + if( tile ) + *tile = MAP_map[floorindex].tile[fy*xsiz+fx]; + if( obj ) + *obj = MAP_map[floorindex].obj[fy*xsiz+fx]; + + return TRUE; +} + +BOOL MAP_setTileAndObjData( int ff ,int fx, int fy, int tile, int obj) +{ + int floorindex,xsiz; + floorindex = MAP_getfloorIndex( ff ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + xsiz = MAP_map[floorindex].xsiz; + if( fx < 0 || fx >= xsiz ) { + return FALSE; + } + if( fy < 0 || fy >= MAP_map[floorindex].ysiz ) { + return FALSE; + } + if( tile != -1 ) + MAP_map[floorindex].tile[fy*xsiz+fx] = tile; + if( obj != -1) + MAP_map[floorindex].obj[fy*xsiz+fx] = obj; + return TRUE; +} + +BOOL MAP_initReadMap( char* maptilefile , char* mapdir ) +{ + print("\n"); + if( !MAP_readMapConfFile(maptilefile) ) + return FALSE; + if( !MAP_readBattleMapConfFile( getBattleMapfile( ) ) ) + return FALSE; + if( !MAP_readMapDir(mapdir) ) + return FALSE; + return TRUE; +} + +static int MAP_coKindAndInt[MAP_KINDNUM]= +{ + MAP_WALKABLE, +}; + +BOOL MAP_makeVariousMap(char* atile, char* aobj, int floor, int startx, + int starty, int xsiz, int ysiz, MAP_kind kind ) +{ + int i,j; + int findex; + int fxsiz; + int startpoint; + + if( atile == NULL || aobj == NULL || kind < 0 || kind >= MAP_KINDNUM ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + findex = MAP_getfloorIndex( floor ); + if( findex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + fxsiz = MAP_map[findex].xsiz; + startpoint = startx + starty * fxsiz ; + + for( i = 0 ; i < ysiz ; i ++ ){ + for( j = 0 ; j < xsiz ; j ++ ){ + atile[i*xsiz+j] = MAP_getImageInt( MAP_map[findex].tile[ + startpoint + i*xsiz + j],MAP_coKindAndInt[kind] ) + ? 1 : 0; + + aobj[i*xsiz+j] = MAP_getImageInt( MAP_map[findex].obj[ + startpoint + i*xsiz + j],MAP_coKindAndInt[kind] ) + ? 1 : 0; + } + } + return TRUE; +} + +BOOL MAP_makeWalkableMap( char* data, int floor, int startx, int starty, + int xsiz, int ysiz ) +{ + int i,j; + char* obj; + obj = allocateMemory(xsiz*ysiz*sizeof(char)); + if( obj == NULL )return FALSE; + + if( MAP_makeVariousMap( data, obj, floor, startx, starty, xsiz, ysiz, + MAP_KINDWALKABLE ) == FALSE ){ + freeMemory( obj ); + return FALSE; + } + + for( i = 0 ; i < ysiz ; i ++ ) + for( j = 0 ; j < xsiz ; j ++ ) + data[j+i*ysiz] = data[j+i*ysiz] & obj[j+i*ysiz]; + +#ifdef DEBUG + for( i = 0 ; i < ysiz ; i ++ ){ + for( j = 0 ; j < xsiz ; j ++ ) + if( data[j+i*ysiz] ){ + print(" "); + }else + print("O"); + print("\n"); + } +#endif /*DEBUG*/ + + return TRUE; +} + +BOOL MAP_IsThereSpecificFloorid( int floorid ) +{ + if( MAP_getfloorIndex(floorid)== -1)return FALSE; + else return TRUE; +} + +BOOL MAP_IsValidCoordinate( int floor, int x, int y ) +{ + if( MAP_IsThereSpecificFloorid(floor)==FALSE )return FALSE; + if( x < 0 || MAP_getfloorX(floor)<=x )return FALSE; + if( y < 0 || MAP_getfloorY(floor)<=y )return FALSE; + return TRUE; +} + +int MAP_attackSpecificPoint( int floor, int x, int y, int damage , + int charaindex ) +{ +#if 0 + int mapindex; + int xsiz; + int objimagenumber; + + mapindex = MAP_getfloorIndex(floor); + if( mapindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return 5; + } + xsiz = MAP_map[mapindex].xsiz; + if( 0 > x || x >= xsiz || 0 >y || y >= MAP_map[mapindex].ysiz ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return 5; + } + if( damage <= 0 )return 5; + + objimagenumber = MAP_map[mapindex].obj[x+y*xsiz]; + + if( MAP_getImageInt( objimagenumber,MAP_DEFENCE ) > 0 ){ + MAP_map[mapindex].objhp[x+y*xsiz] -= damage; + if( MAP_map[mapindex].objhp[x+y*xsiz] < 0 ){ + MAP_map[mapindex].obj[x+y*xsiz] = 0; +#if 1 + { + char *stringdata; + RECT seekr , retr; + seekr.x = x; + seekr.y = y; + seekr.width = 1; + seekr.height = 1; + stringdata = MAP_getdataFromRECT(floor,&seekr,&retr); + if( stringdata ){ + print("RINGO: RETR: %d %d %d %d\n", + retr.x,retr.y,retr.width,retr.height); + if( CHAR_getInt( charaindex , CHAR_WHICHTYPE ) + == CHAR_TYPEPLAYER ){ + int fd = getfdFromCharaIndex( charaindex ); + lssproto_M_send(fd,floor, retr.x, retr.y, + retr.x + retr.width, retr.y + retr.height, + stringdata ); + } + } else { + print("RINGO: bad stringdata. %d %d %d %d\n", + seekr.x,seekr.y,seekr.width,seekr.height); + + } + + } +#endif + return 1; + } + return 2; + } + + if( MAP_getImageInt(MAP_map[mapindex].obj[y*xsiz+x],MAP_HAVEHEIGHT ) + == 0 ) + return 4; +#endif + return 3; +} +BOOL MAP_appendTailObj( int floor, int x, int y, int objindex ) +{ + int mapindex; + int xsiz; + int dataindex; + MAP_Objlink* c; + MAP_Objlink* top; + + mapindex = MAP_getfloorIndex( floor ); + if( mapindex == -1 ) { + //print( "%s:%d:err(fl=%d,x=%d,y=%d)\n", __FILE__, __LINE__, floor, x, y ); + return FALSE; + } + xsiz = MAP_map[mapindex].xsiz; + if( 0 > x || x >= xsiz || 0 >y || y >= MAP_map[mapindex].ysiz ) { + //print( "%s:%d:err(fl=%d,x=%d,y=%d)\n", __FILE__, __LINE__, floor, x, y); + return FALSE; + } + dataindex = y*xsiz+x; + top = MAP_map[mapindex].olink[dataindex]; + if( top == NULL ){ + top = allocateMemory( sizeof(MAP_Objlink) ); + if( top == NULL ) { + //print( "%s:%d:err(fl=%d,x=%d,y=%d)\n", __FILE__, __LINE__, floor, x, y); + return FALSE; + } + top->next = NULL; + top->objindex = objindex; + MAP_map[mapindex].olink[dataindex] = top; + return TRUE; + } + for( c=top ; c->next ; c = c->next ); + c->next = allocateMemory(sizeof(MAP_Objlink)); + if( c->next == NULL )return FALSE; + c->next->next = NULL; + c->next->objindex = objindex; + return TRUE; +} + +BOOL MAP_removeObj( int floor, int x, int y, int objindex ) +{ + int mapindex; + int xsiz; + int dataindex; + MAP_Objlink* c; + MAP_Objlink* last=NULL; + + mapindex = MAP_getfloorIndex( floor ); + if( mapindex == -1 ) { + print( "%s:%d:\n", __FILE__, __LINE__); + return FALSE; + } + xsiz = MAP_map[mapindex].xsiz; + if( 0 > x || x >= xsiz || 0 >y || y >= MAP_map[mapindex].ysiz ) { + print( "%s:%d: ͼ[%d] x:[%d] y:[%d]\n", __FILE__, __LINE__, floor, x, y); + return FALSE; + } + dataindex = y*xsiz+x; + c = MAP_map[mapindex].olink[dataindex]; + while( c ){ + if( c->objindex == objindex ){ + if( last ) + last->next = c->next; + else + MAP_map[mapindex].olink[dataindex] = c->next; + freeMemory( c ); + return TRUE; + } + last = c; + c = c->next; + } + print( "%s:%d:\n", __FILE__, __LINE__); + return FALSE; +} + +BOOL _MAP_objmove( char *file, int line, int objindex, int ofloor, int ox, int oy, int nfloor, + int nx, int ny ) +{ +#if 1 + + int oldmapindex; + int oldxsiz; + + int dataindex; + MAP_Objlink* c; + MAP_Objlink* last=NULL; + MAP_Objlink* pointer=NULL; + + oldmapindex = MAP_getfloorIndex( ofloor ); + if( oldmapindex == -1 ) { + print( "%s:%d: ͼ[%d] x:[%d] y:[%d]\n", __FILE__, __LINE__, + ofloor, ox, oy); + return FALSE; + } + oldxsiz = MAP_map[oldmapindex].xsiz; + if( 0 > ox || ox >= oldxsiz + || 0 >oy || oy >= MAP_map[oldmapindex].ysiz ) + { + print( "%s:%d: ͼ[%d] x:[%d] y:[%d]\n", __FILE__, __LINE__, + ofloor, ox, oy); + return FALSE; + } + dataindex = oy*oldxsiz+ox; + c = MAP_map[oldmapindex].olink[dataindex]; + while( c ){ + if( c->objindex == objindex ){ + if( last ) + last->next = c->next; + else + MAP_map[oldmapindex].olink[dataindex] = c->next; + + pointer = c; + pointer->next = NULL; + break; + } + last = c; + c = c->next; + } + if( !pointer ) { + print( "\n%s:%d:( %d,%d,%d )->(%d,%d,%d)\n", __FILE__, __LINE__, + ofloor, ox, oy, nfloor, nx, ny ); + return FALSE; + } + { + int newmapindex; + int newxsiz; + MAP_Objlink* top; + + if( ofloor == nfloor ){ + newmapindex = oldmapindex; + newxsiz = oldxsiz; + }else{ + newmapindex = MAP_getfloorIndex( nfloor ); + if( newmapindex == -1 ) { + print( "%s:%d: ͼ[%d] x:[%d] y:[%d]\n", __FILE__, __LINE__, + nfloor, nx, ny); + return FALSE; + } + newxsiz = MAP_map[newmapindex].xsiz; + } + if( 0 > nx || nx >= newxsiz + || 0 >ny || ny >= MAP_map[newmapindex].ysiz ) + { + print( "%s:%d: ͼ[%d] x:[%d] y:[%d]\n", __FILE__, __LINE__, + nfloor, nx, ny); + return FALSE; + } + + dataindex = ny*newxsiz+nx; + top = MAP_map[newmapindex].olink[dataindex]; + if( top == NULL ){ + top = MAP_map[newmapindex].olink[dataindex] = pointer; + top->next = NULL; + return TRUE; + } + + for( c=top ; c->next ; c = c->next ); + c->next = pointer; + c->next->next = NULL; + return TRUE; + } +#else + if( MAP_removeObj( ofloor,ox,oy,objindex) + && MAP_appendTailObj( nfloor, nx ,ny, objindex ) ) + return TRUE; +#endif + print( "%s:%d:\n", __FILE__, __LINE__); + return FALSE; +} + +MAP_Objlink* _MAP_getTopObj( char *file, int line,int floor, int x, int y ) +{ + int mapindex; + int xsiz; + + mapindex = MAP_getfloorIndex( floor ); + if( mapindex == -1 ) { + //print( "callfrom[%s:%d] %s:%d:err floor(%d,%d,%d)\n", file, line, __FILE__, __LINE__, + // floor, x, y ); + return NULL; + } + + xsiz = MAP_map[mapindex].xsiz; + +#if 1 + if( x >= xsiz) return NULL; + if( y >= MAP_map[mapindex].ysiz ) return NULL; + if( x < 0 ) return NULL; + if( y < 0 ) return NULL; + return MAP_map[mapindex].olink[y*xsiz+x]; +#else + if( 0 <= x && x < xsiz && 0 <= y && y < MAP_map[mapindex].ysiz ) + return MAP_map[mapindex].olink[y*xsiz+x]; + else + return NULL; +#endif +} + +BOOL MAP_addNewObj( int floor, int x, int y, int objindex ) +{ + OBJECT map; + BOOL ret; + + for( map=MAP_getTopObj(floor,x,y) ; map ; map = NEXT_OBJECT(map)) { + if( GET_OBJINDEX(map) == objindex ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return 0; + } + } + ret = MAP_appendTailObj( floor, x, y, objindex ); + if( ret )return 1; + else return -1; +} + +char *MAP_getFloorName( int floor) +{ + int floorindex; + floorindex = MAP_getfloorIndex( floor ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return NULL; + } + return MAP_map[floorindex].string; +} + +#ifdef _MAKE_MAP +int MAP_getFloorXY( int floor, int *x, int *y) +{ + int floorindex; + floorindex = MAP_getfloorIndex( floor ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + *x=MAP_map[floorindex].xsiz; + *y=MAP_map[floorindex].ysiz; + return TRUE; +} +#endif + +BOOL MAP_setObjData( int ff ,int fx, int fy, int obj, int objhp ) +{ + int floorindex,xsiz; + + floorindex = MAP_getfloorIndex( ff ); + if( floorindex == -1 ) { + print( "%s:%d:err\n", __FILE__, __LINE__); + return FALSE; + } + xsiz = MAP_map[floorindex].xsiz; + if( fx < 0 || fx >= xsiz ) { + return FALSE; + } + if( fy < 0 || fy >= MAP_map[floorindex].ysiz ) { + return FALSE; + } + MAP_map[floorindex].obj[fy*xsiz+fx] = obj; + return TRUE; +} + +void MAP_sendAroundMapdata( int fl, int fromx, int fromy) +{ + char* mapdata; + RECT seek,ret; + int i,j; + seek.x = fromx; + seek.y = fromy; + seek.width = seek.height = 1; + mapdata = MAP_getdataFromRECT(fl,&seek,&ret); + if( mapdata != NULL ) { + int x = fromx; + int y = fromy; + + for( i =x-MAP_CHAR_DEFAULTSEESIZ/2 ; i <= x+MAP_CHAR_DEFAULTSEESIZ/2 ; i++ ){ + for( j = y-MAP_CHAR_DEFAULTSEESIZ/2 ; j <= y+MAP_CHAR_DEFAULTSEESIZ/2 ; + j ++ ){ + OBJECT object; + for( object = MAP_getTopObj(fl,i,j) ; + object ; + object = NEXT_OBJECT(object ) ){ + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_NOUSE ) continue; + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ) { + int index = OBJECT_getIndex( objindex); + if( CHAR_getInt( index, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) { + int fd = getfdFromCharaIndex( index ); + if( fd != -1 ) { + lssproto_M_send( fd, fl, ret.x,ret.y, + ret.x+ret.width, ret.y+ret.height, + mapdata ); + } + } + } + } + } + } + }else { + print( "ͼݴ %s:%d \n" , __FILE__, __LINE__); + } +} + +#ifdef _STATUS_WATERWORD //ˮ״̬ +int MAP_getMapFloorType( int floor) +{ + int i=0; + int WaterWord[]={8101,8015,8029,8028,8027,817,8007,8100,151,160,161,-1}; + while( WaterWord[i] != -1 ){ + if( floor == WaterWord[i] ){ + return 1; + } + i++; + } + return 0; +} +#endif + + +int MAP_getMapNum() +{ + return MAP_mapnum; +} + +int MAP_getfloorId(int index) +{ + if( MAP_mapnum<=(index) || (index)<0 ) + return -1; + return MAP_map[index].id; +} + + +#ifdef _CAX_LNS_MAPSUOXU +BOOL MAP_SetExWarp(int mapid , int fl, int x, int y, int type) +{ + int tomapindex = MAP_getfloorIndex(mapid); + if (tomapindex == -1) + { + print( "ҲĿͼȷϵͼIDǷȷ\n"); + return FALSE; + } + + MAP_map[tomapindex].startpoint = (fl<<16)+(x << 8)+(y<<0); + MAP_map[tomapindex].MapType = type;//ͼͣ Ŀǰ ޸ĵȨ + return TRUE; +} + +int MAP_makenew( int mapid ,char* map_name) +{ + int mymapid = -1; + int tomapindex = -1,makemapindex = -1,i,j; + if ((tomapindex = MAP_getfloorIndex(mapid)) == -1) + { + print( "ҲĿͼȷϵͼIDǷȷ\n"); + return -1; + } + int mapstartid = getCopymapstartingID();//øͼʼID + for (j=mapstartid;j= MAP_mapnum ){//û㹻Ŀռװµĵͼ10µĿռװµͼ +// print( "û㹻ڴ棬·ڴ档\n"); + MAP_Map* MAP_map2;// + MAP_map2 = allocateMemory( sizeof( MAP_Map ) * MAP_mapnum); + if( MAP_map2 == 0 ){ + print( "ͼʧܣ\n"); + return -1; + } + memcpy( MAP_map2 , MAP_map ,sizeof(MAP_Map) * MAP_mapnum);//֮ǰ + freeMemory( MAP_map );//ͷŵ + MAP_map = 0; + MAP_mapnum += 100; + MAP_map = allocateMemory( sizeof( MAP_Map ) * MAP_mapnum);//¸ͼڴ + if( MAP_map == 0 ){ + print( "·ͼڴʧܣ\n"); + return -1; + } +// print( "·ͼڴɹ\n"); + memcpy( MAP_map , MAP_map2 ,sizeof(MAP_Map) * (MAP_mapnum-100));//֮ǰ + freeMemory( MAP_map2 ); + MAP_map2 = 0; + } + short *tile=0; + short *obj=0; + MAP_Objlink** olink; + int xy = MAP_map[tomapindex].xsiz * MAP_map[tomapindex].ysiz; + tile = allocateMemory( sizeof( short ) * MAP_map[tomapindex].xsiz * MAP_map[tomapindex].ysiz );//ͼڴ + if( tile == NULL ){ + print( "޷ڴͼͼ\n"); + return -1; + } + + obj = allocateMemory( sizeof( short ) * MAP_map[tomapindex].xsiz * MAP_map[tomapindex].ysiz );//ͼڴ + if( obj == NULL ){ + print( "޷ڴͼ\n"); + freeMemory( tile ); + return -1; + } + + olink = allocateMemory( sizeof(MAP_Objlink*) * MAP_map[tomapindex].xsiz * MAP_map[tomapindex].ysiz );//ͼڴ + if( olink == 0 ){ + print( "޷ڴͼ\n"); + freeMemory( obj ); + return -1; + } + memcpy( &tile , &MAP_map[tomapindex].tile ,sizeof(MAP_map[tomapindex].tile)); + memcpy( &obj , &MAP_map[tomapindex].obj ,sizeof(MAP_map[tomapindex].obj)); + for( i=0 ; i< xy ; i ++ ){ + olink[i] = 0; + } + MAP_map[makemapindex].id = mymapid; + MAP_map[makemapindex].xsiz = MAP_map[tomapindex].xsiz; + MAP_map[makemapindex].ysiz = MAP_map[tomapindex].ysiz; + if (strcmp(map_name,"")!=0 ){ + strcpysafe( MAP_map[makemapindex].string , + sizeof(MAP_map[makemapindex].string), + map_name ); + }else { + strcpysafe( MAP_map[makemapindex].string , + sizeof(MAP_map[makemapindex].string), + MAP_map[tomapindex].string ); + } + + MAP_map[makemapindex].tile = tile; + MAP_map[makemapindex].obj = obj; + MAP_map[makemapindex].olink = olink; + MAP_map[makemapindex].startpoint = (2006<<16)+(20 << 8)+(15<<0);//ĬΪͻ峤 + MAP_map[makemapindex].MapType = 0; + + MAP_idjumptbl[mymapid] = makemapindex; + if ( makemapindex >= MAP_mapnum_index) MAP_mapnum_index = makemapindex+1; +fbmap[mymapid-mapstartid] = mapid; +return mymapid; +} + +BOOL MAP_DelMap(int mapid ) +{ + int tomapindex = -1; + if ((tomapindex = MAP_getfloorIndex(mapid)) == -1) + { + print( "ҲĿͼȷϵͼIDǷȷ\n"); + return FALSE; + } + int mapstartid = getCopymapstartingID();//øͼʼID + if (mapid > mapstartid+9999 || mapid < mapstartid) { + print( "ֻͷŸͼ(%d-%d)\n",mapstartid,mapstartid+9999); + return FALSE; + } + MAP_map[tomapindex].id = 0; + if (MAP_map[tomapindex].tile != 0) freeMemory( MAP_map[tomapindex].tile );//ͷŵ + if (MAP_map[tomapindex].obj != 0) freeMemory( MAP_map[tomapindex].obj );//ͷŵ + freeMemory( MAP_map[tomapindex].olink );//ͷŵ + MAP_map[tomapindex].startpoint = -1;//ͷ˳ͼ͵ + MAP_map[tomapindex].MapType = 0;//ͼͣ Ŀǰ + MAP_idjumptbl[mapid] = -1;//ͼ + return TRUE; +} +#endif diff --git a/mclient.c b/mclient.c new file mode 100644 index 0000000..500fd7f --- /dev/null +++ b/mclient.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "autil.h" +#include "util.h" +#include "net.h" +#include "char.h" +#include "char_base.h" +#include "mclient.h" +#include "log.h" +#include "handletime.h" +#include "chatmagic.h" + +#ifdef _GSERVER_RUNTIME //GSERVERִжʱMSERVER +void gserver_runtime() +{ + int checksum=0; + char buffer[1024]; + time_t starttime1; + + if(mfd == -1) return; + if( gserver_runtime_starttime0_flag ){ + gserver_runtime_starttime0_flag = FALSE; + gserver_runtime_starttime0 = time(NULL); + } + print("\nChange->ʱmserver\n"); + strcpy(buffer, ""); + strcpy(PersonalKey, MSPERSIONALKEY); + starttime1 = time(NULL); + checksum += util_mkint(-1,buffer, (int)difftime(starttime1,gserver_runtime_starttime0));//͵ĵλΪ + util_mkint(-1,buffer, checksum); + util_SendMesg(mfd, MPROTO_RECALL_GSERVER_RUNTIME, buffer); +} +#endif diff --git a/msignal.c b/msignal.c new file mode 100644 index 0000000..3431045 --- /dev/null +++ b/msignal.c @@ -0,0 +1,155 @@ +#include "version.h" +#include +#include +#include + +#include + +#include "buf.h" +#include "net.h" +#include "char.h" +#include "item.h" +#include "object.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "log.h" +#include "petmail.h" +#ifdef _ALLBLUES_LUA +#include "mylua/mylua.h" +#endif +/*------------------------------------------------------------ + * ئ + ------------------------------------------------------------*/ +static void endlsprotocol( void ) +{ + lssproto_CleanupServer(); + saacproto_CleanupClient(); +} + +/*------------------------------------------------------------ + * ͻئľئئзëĸ + * ئ + ------------------------------------------------------------*/ +static void allDataDump( void ) +{ + closeAllLogFile(); +#ifdef _PET_ITEM + storeObjects( getStoredir() ); + storePetmail(); +#endif +#ifdef _ALLBLUES_LUA + closemyluaload(); +#endif + storeCharaData(); +} + +/*------------------------------------------------------------ + * ئ + ------------------------------------------------------------*/ +void shutdownProgram( void ) +{ + printf("رSAAC:%d\n",acfd); + printf("رհ󶨶˿:%d\n",bindedfd); + close( acfd ); + close( bindedfd ); + memEnd(); +} +#ifdef _GMSV_DEBUG +char *DebugMainFunction = NULL; +extern time_t initTime; +#endif +extern int player_online; +extern int player_maxonline; +char saacretfunc[255]=""; +char *saacsendfunc = NULL; +int cliretfunc=0; +int clisendfunc=0; +char playcdkey[16] = ""; +char *errraw = NULL; +void sigshutdown( int number ) +{ + if( number == 0 ){ + print( "\nGMSVر\n" ); + }else{ + print( "\n=========Ƿԭ=========\n"); + print( "׼Ϣ: %d\n" , number ); +#ifdef _GMSV_DEBUG + print( " : %s\n", DebugMainFunction ); +#endif + print( ": %d\n", player_online); + print( ": %d\n", player_maxonline); + print( "SAAC: %s\n", saacretfunc); + print( "SAAC: %s\n", saacsendfunc); + print( "cli : %d\n", cliretfunc); + print( "cli : %d\n", clisendfunc); + print( "˺: %s\n", playcdkey); + print( ": %s\n", errraw); +#ifdef _GMSV_DEBUG + { + time_t new_t; + int dd,hh,mm,ss; + char buf[128]; + time(&new_t); + if(initTime==0){ + print( "ʱ: δʼ\n" ); + }else{ + new_t-=initTime; + + dd=(int) new_t / 86400; new_t=new_t % 86400; + hh=(int) new_t / 3600; new_t=new_t % 3600; + mm=(int) new_t / 60; new_t=new_t % 60; + ss=(int) new_t; + + if (dd>0) { + snprintf( buf, sizeof( buf ) , " %d %d Сʱ %d %d 롣",dd,hh,mm,ss); + } else if (hh>0) { + snprintf( buf, sizeof( buf ) , " %d Сʱ %d %d 롣",hh,mm,ss); + } else { + snprintf( buf, sizeof( buf ) , " %d %d 롣",mm,ss); + } + print( "ʱ: %s\n", buf ); + } + } +#endif + print( "=========Ƿԭ=========\n"); + } + remove( "gmsvlog.err2"); + rename( "gmsvlog.err1", "gmsvlog.err2" ); + rename( "gmsvlog.err", "gmsvlog.err1" ); + rename( "gmsvlog", "gmsvlog.err" ); + + allDataDump(); + + signal( SIGINT , SIG_IGN ); + signal( SIGQUIT, SIG_IGN ); + signal( SIGKILL, SIG_IGN ); + signal( SIGSEGV, SIG_IGN ); + signal( SIGPIPE, SIG_IGN ); + signal( SIGTERM, SIG_IGN ); + + shutdownProgram(); + exit(number); +} + + + +void signalset( void ) +{ + // CoolFish: Test Signal 2001/10/26 + print("\nʼȡź..\n"); + + print("SIGINT:%d\n", SIGINT); + print("SIGQUIT:%d\n", SIGQUIT); + print("SIGKILL:%d\n", SIGKILL); + print("SIGSEGV:%d\n", SIGSEGV); + print("SIGPIPE:%d\n", SIGPIPE); + print("SIGTERM:%d\n", SIGTERM); + + signal( SIGINT , sigshutdown ); + signal( SIGQUIT, sigshutdown ); + signal( SIGKILL, sigshutdown ); + signal( SIGSEGV, sigshutdown ); + signal( SIGPIPE, SIG_IGN ); + signal( SIGTERM, sigshutdown ); +} diff --git a/mylua/ablua.c b/mylua/ablua.c new file mode 100644 index 0000000..93ea89a --- /dev/null +++ b/mylua/ablua.c @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include +#include +#include "autil.h" +#include "util.h" +#include "mylua/mylua.h" +#include "mylua/base.h" +#include "version.h" + +#ifdef _ALLBLUES_LUA + +extern MY_Lua MYLua; + +void LoadAllbluesLUA(char *path) +{ + struct dirent* ent = NULL; + char filename[256]; + DIR *pDir; + pDir=opendir(path); + + while(NULL != (ent=readdir(pDir))) + { + if(ent->d_name[0] == '.')continue; + if (ent->d_type==8){ + if( strcmptail( ent->d_name, ".allblues" ) == 0 +#ifndef _NOT_NOCRYPTO_LUA + || strcmptail( ent->d_name, ".lua" ) == 0 +#endif + ){ + char filename[256]; + memset(filename, 0, 256); + sprintf(filename, "%s/%s", path, ent->d_name); + + myluaload(filename); + } + }else{ + sprintf(filename, "%s/%s", path, ent->d_name); + LoadAllbluesLUA(filename); + } + } +} + +void ReLoadAllbluesLUA(char *filename) +{ + remyluaload(filename); +} + +void NewLoadAllbluesLUA(char *filename) +{ + char token[256]; + if(strlen(filename)>0){ + sprintf(token, "data/ablua/%s", filename); + myluaload(token); + }else{ + LoadAllbluesLUA("data/ablua"); + } +} + +const int getCharBaseValue(lua_State *L, int narg, CharBase *charbase, int num) +{ + if(!lua_isnumber(L, narg)){ + size_t l; + const char *data = luaL_checklstring(L, narg, &l); + + if( data == NULL || data[0] == '\0' ){ + return -1; + } + char field[64]; + int line = 1; + int i; + int value = 0; + while(getStringFromIndexWithDelim( data, "|", line, field, sizeof( field)) == TRUE) + { + for( i=0 ; i < num; i++ ){ + if( strcmp( charbase[i].field, field ) == 0 ){ + value |= charbase[i].element; + break; + } + } + + if(i == num){ + return -1; + } + line++; + } + + return value; + }else{ + return luaL_checkint(L, narg); + } +} + +#endif + diff --git a/mylua/battlebase.c b/mylua/battlebase.c new file mode 100644 index 0000000..abfb103 --- /dev/null +++ b/mylua/battlebase.c @@ -0,0 +1,261 @@ +#include +#include "version.h" +#include "char_base.h" +#include "enemy.h" +#include "object.h" +#include "char.h" +#include "lssproto_serv.h" +#include "battle.h" +#include "battle_command.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "mylua/mylua.h" +#include "mylua/base.h" +#ifdef _ALLBLUES_LUA + +static int CreateVsEnemy (lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int npcindex = luaL_checkint(L, 2); + int enemytable[11]; + int i; + for( i = 0; i < 11; i ++ ) { + enemytable[i] = -1; + } + luaL_checktype(L, 3, LUA_TTABLE); + int n = luaL_getn(L, 3); + int id = 0; + for(i = 0; i < n; i++){ + int enemyid = getArrayInt(L, i); + int curEnemy = ENEMY_getEnemyArrayFromId( enemyid ); + + if( ENEMY_CHECKINDEX( curEnemy) ) { + enemytable[id++] = curEnemy; + }else{ + enemytable[i] = -1; + } + } + int ret = BATTLE_CreateVsEnemyNew(charaindex, npcindex, enemytable); + if( ret == 0 ) { + if(npcindex>-1){ + CHAR_setWorkInt( npcindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_INIT ); + CHAR_sendBattleEffect( npcindex, ON); + } + lua_pushinteger(L, CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX)); + return 1; + }else{ + return 0; + } +} + +static int getCharOne(lua_State *L) +{ + const int battle = luaL_checkint(L, 1); + const int num = luaL_checkint(L, 2); + const int side = luaL_checkint(L, 3); + + lua_pushinteger(L, BattleArray[battle].Side[side].Entry[num].charaindex); + + return 1; +} + + +#ifdef _ALLBLUES_LUA_1_4 +static CharBase BattleBaseEvent[] = { + {{"¼"}, BATTLE_FINISH} + ,{{"¼"}, BATTLE_ESCAPE} +}; + +static int CreateRandVsPlayer (lua_State *L) +{ + const int floorid = luaL_checkint(L, 1); + int charaindex1 = -1, charaindex2 = -1; + int num = 0; + int i = 0; + int playernum = CHAR_getPlayerMaxNum(); + for (i = 0; i < playernum; i++){ + if (CHAR_getCharUse(i) == FALSE) continue; + if ( !CHAR_CHECKINDEX( i ) )continue; + if ( CHAR_getInt( i, CHAR_FLOOR ) == floorid ) { + if (CHAR_getWorkInt(i, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE){ + if(charaindex1 == -1){ + charaindex1 = i; + }else{ + charaindex2 = i; + } + if(CHAR_CHECKINDEX( charaindex1 ) && CHAR_CHECKINDEX( charaindex2 ) ){ + BATTLE_CreateVsPlayer(charaindex1, charaindex2); + num ++; + } + } + } + } + + lua_pushinteger(L, num); + + return 1; +} + +static int CreateVsPlayer(lua_State *L) +{ + const int charaindex1 = luaL_checkint(L, 1); + const int charaindex2 = luaL_checkint(L, 2); + + if(CHAR_CHECKINDEX( charaindex1 ) && CHAR_CHECKINDEX( charaindex2 ) ){ + if( CHAR_getWorkInt( charaindex1, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE + && CHAR_getWorkInt( charaindex2, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ){ + if(BATTLE_CreateVsPlayer(charaindex1, charaindex2) == 0){ + lua_pushinteger(L, CHAR_getWorkInt( charaindex1, CHAR_WORKBATTLEINDEX)); + return 1; + } + } + } + lua_pushinteger(L, -1); + return 1; +} + +static int setLUAFunctionPointer(lua_State *L) +{ + size_t l; + const int battleindex = luaL_checkint(L, 1); + const int functype = getCharBaseValue(L, 2, BattleBaseEvent, arraysizeof(BattleBaseEvent)); + char *luafunctable=luaL_checklstring(L, 3, &l); + + BATTLE_setLUAFunction(battleindex, functype, L, luafunctable); + + return 1; +} + +static int WatchEntry(lua_State *L) +{ + const int meindex = luaL_checkint(L, 1); + const int toindex = luaL_checkint(L, 2); + + BATTLE_WatchEntry(meindex, toindex); + + return 1; +} + +static int NewEntry(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int battleindex = luaL_checkint(L, 2); + const int side = luaL_checkint(L, 3); + int fd = getfdFromCharaIndex(charaindex); + int iRet = BATTLE_NewEntry(charaindex, battleindex, side); + if( iRet == 0 ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_RESCUE ); + iRet = BATTLE_PetDefaultEntry( + charaindex, + battleindex, + side + ); + } + if( iRet == 0 ){ + int flg; + if( CHAR_getInt( charaindex, CHAR_DEFAULTPET ) >= 0 ){ + int pindex = CHAR_getCharPet( charaindex, CHAR_getInt( charaindex, CHAR_DEFAULTPET ) ); + CHAR_setWorkInt( pindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_RESCUE ); + } + if( fd != -1 ){ + lssproto_EN_send( fd, BattleArray[battleindex].type, BattleArray[battleindex].field_no ); + } + flg = (BattleArray[battleindex].Side[side].flg & BSIDE_FLG_HELP_OK)? TRUE:FALSE; + lssproto_HL_send( fd, flg); + char szBuffer[256]; + sprintf( szBuffer, "BP|%X|%X|%X", + BATTLE_Index2No( battleindex, charaindex ), BP_FLG_JOIN, CHAR_getInt(charaindex, CHAR_MP ) ); + BATTLE_CommandSend( charaindex, szBuffer ); + lua_pushinteger(L, 1); + }else{ + if( fd != -1 ){ + lssproto_EN_send( fd, FALSE, BattleArray[battleindex].field_no ); + } + lua_pushinteger(L, 0); + } + + return 1; +} +#endif + +#ifdef _ALLBLUES_LUA_1_9 +static int CreateForWatcher(lua_State *L) +{ + const int meindex = luaL_checkint(L, 1); + const int baatleindex = luaL_checkint(L, 2); + + BATTLE_CreateForWatcher(meindex, baatleindex); + + return 1; +} + +static int checkindex(lua_State *L) +{ + const int baatleindex = luaL_checkint(L, 1); + + lua_pushinteger(L, BATTLE_CHECKINDEX(baatleindex)); + + return 1; +} + +static int getType(lua_State *L) +{ + const int baatleindex = luaL_checkint(L, 1); + + lua_pushinteger(L, BATTLE_getType(baatleindex)); + + return 1; +} + +#ifdef _BATTLE_TIMESPEED +static int getCreateTime(lua_State *L) +{ + const int baatleindex = luaL_checkint(L, 1); + + lua_pushinteger(L, BATTLE_getCreateTime(baatleindex)); + + return 1; +} +#endif + +static int getBattleFloor(lua_State *L) +{ + const int baatleindex = luaL_checkint(L, 1); + + lua_pushinteger(L, BATTLE_getBattleFloor(baatleindex)); + + return 1; +} +#endif + +static const luaL_Reg battlelib[] = { + {"CreateVsEnemy", CreateVsEnemy}, + {"getCharOne", getCharOne}, +#ifdef _ALLBLUES_LUA_1_4 + {"CreateRandVsPlayer", CreateRandVsPlayer}, + {"CreateVsPlayer", CreateVsPlayer}, + {"setLUAFunctionPointer", setLUAFunctionPointer}, + {"WatchEntry", WatchEntry}, + {"NewEntry", NewEntry}, +#endif +#ifdef _ALLBLUES_LUA_1_9 + {"CreateForWatcher", CreateForWatcher}, + {"checkindex", checkindex}, + {"getType", getType}, +#ifdef _BATTLE_TIMESPEED + {"getCreateTime", getCreateTime}, +#endif + {"getBattleFloor", getBattleFloor}, +#endif + {NULL, NULL} +}; + + +LUALIB_API int luaopen_Battle (lua_State *L) { + luaL_register(L, "battle", battlelib); + return 1; +} + +#endif + diff --git a/mylua/charbase.c b/mylua/charbase.c new file mode 100644 index 0000000..12d8093 --- /dev/null +++ b/mylua/charbase.c @@ -0,0 +1,1999 @@ +#include +#include "char.h" +#include "battle.h" +#include "object.h" +#include "char_base.h" +#include "enemy.h" +#include "mylua/base.h" +#include "npcutil.h" +#include "readmap.h" +#include "log.h" +#include "pet.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "version.h" +#include "handletime.h" +#include "item_event.h" +#include "lssproto_serv.h" +#ifdef _ALLBLUES_LUA +#include "mylua/mylua.h" +extern MY_Lua MYLua; +static CharBase CharBaseWorkInt[] = { + {{""}, CHAR_WORKOBJINDEX} +#ifdef _FONT_SIZE + ,{{"ֺ"}, CHAR_WORKFONTSIZE} +#endif + ,{{"ս"}, CHAR_WORKBATTLEMODE} + ,{{""}, CHAR_WORKPARTYMODE} + ,{{"ս"}, CHAR_WORKBATTLEINDEX} + ,{{"NPCʱ1"}, CHAR_NPCWORKINT1} + ,{{"NPCʱ2"}, CHAR_NPCWORKINT2} + ,{{"NPCʱ3"}, CHAR_NPCWORKINT3} + ,{{"NPCʱ4"}, CHAR_NPCWORKINT4} + ,{{"NPCʱ5"}, CHAR_NPCWORKINT5} + ,{{"NPCʱ6"}, CHAR_NPCWORKINT6} + ,{{"NPCʱ7"}, CHAR_NPCWORKINT7} + ,{{"NPCʱ8"}, CHAR_NPCWORKINT8} + ,{{"NPCʱ9"}, CHAR_NPCWORKINT9} + ,{{"NPCʱ10"}, CHAR_NPCWORKINT10} + ,{{"NPCʱ11"}, CHAR_NPCWORKINT11} + ,{{"NPCʱ12"}, CHAR_NPCWORKINT12} + ,{{"NPCʱ13"}, CHAR_NPCWORKINT13} + ,{{"ģʽ"}, CHAR_WORKPETFOLLOWMODE} + ,{{"Ա1"}, CHAR_WORKPARTYINDEX1} + ,{{"Ա2"}, CHAR_WORKPARTYINDEX2} + ,{{"Ա3"}, CHAR_WORKPARTYINDEX3} + ,{{"Ա4"}, CHAR_WORKPARTYINDEX4} + ,{{"Ա5"}, CHAR_WORKPARTYINDEX5} + ,{{"HP"}, CHAR_WORKMAXHP} + ,{{"MP"}, CHAR_WORKMAXMP} + ,{{""}, CHAR_WORKATTACKPOWER} + ,{{""}, CHAR_WORKDEFENCEPOWER} + ,{{""}, CHAR_WORKQUICK} + ,{{""}, CHAR_WORKFIXVITAL} + ,{{""}, CHAR_WORKFIXSTR} + ,{{""}, CHAR_WORKFIXTOUGH} + ,{{"ٶ"}, CHAR_WORKFIXDEX} + ,{{"ͼ"}, CHAR_WORKFMFLOOR} + ,{{""}, CHAR_WORKATTACKPOWER} + ,{{""}, CHAR_WORKDEFENCEPOWER} + ,{{""}, CHAR_WORKQUICK} + ,{{""}, CHAR_WORKDBATTLEESCAPE} +#ifdef _OFFLINE_SYSTEM + ,{{""}, CHAR_WORK_OFFLINE} +#endif + ,{{"þ"}, CHAR_WORKGETEXP} +#ifdef _AUTO_PK + ,{{"ԶPK"}, CHAR_WORK_AUTOPK} + ,{{"ԶPK"}, CHAR_WORK_AUTOPK_DEAD} +#endif +#ifdef _SPECIAL_COUNTER + ,{{""}, CHAR_WORK_COUNTER} +#endif +#ifdef _SPECIAL_TIMER + ,{{"ʱ"}, CHAR_WORK_TIMER} +#endif +#ifdef _STREET_VENDOR + ,{{"̯"}, CHAR_WORKSTREETVENDOR} +#endif +#ifdef _RECORD_IP + ,{{"IP"}, CHAR_WORK_RECORD_IP} +#endif +#ifdef _ONLINE_TIME + ,{{"½ʱ"}, CHAR_WORK_LOGIN_TIME} +#endif + // ,{{"ӳ"}, CHAR_WORKITEM_ADDEXP} + // ,{{"ʱЧ"}, CHAR_WORKITEM_ADDEXPTIME} +}; + +static CharBase CharBaseWorkChar[] = { + {{"NPCʱ1"}, CHAR_NPCWORKCHAR1} + ,{{"NPCʱ2"}, CHAR_NPCWORKCHAR2} + ,{{"NPCʱ3"}, CHAR_NPCWORKCHAR3} + ,{{"NPCʱ4"}, CHAR_NPCWORKCHAR4} + ,{{"NPCʱ5"}, CHAR_NPCWORKCHAR5} + ,{{"NPCʱ6"}, CHAR_NPCWORKCHAR6} +#ifdef _STREET_VENDOR + ,{{"̯"}, CHAR_STREETVENDOR_NAME} +#endif +}; + +static CharBase CharBaseValue[] = { + {{""}, 0} + ,{{""}, 1} + ,{{""}, 2} + ,{{""}, 3} + ,{{""}, 4} + ,{{""}, 5} + ,{{""}, 6} + ,{{""}, 7} + ,{{""}, CHAR_TYPENONE} + ,{{""}, CHAR_TYPEPLAYER} + ,{{""}, CHAR_TYPEENEMY} + ,{{""}, CHAR_TYPEPET} +#ifdef _ALLBLUES_LUA + ,{{"LUA"}, CHAR_TYPELUANPC} +#endif +#ifdef _PLAYER_NPC + ,{{""}, CHAR_TYPEPLAYERNPC} + ,{{""}, CHAR_TYPEPLAYERPETNPC} +#endif +}; + +static CharBase CharBaseWorkValue[] = { + {{""}, CHAR_PARTY_NONE} + ,{{"ӳ"}, CHAR_PARTY_LEADER} + ,{{"Ա"}, CHAR_PARTY_CLIENT} + ,{{"ս"}, BATTLE_CHARMODE_NONE} + ,{{"սʼ"}, BATTLE_CHARMODE_INIT} + ,{{"ȴս"}, BATTLE_CHARMODE_C_WAIT} + ,{{"ȷս"}, BATTLE_CHARMODE_C_OK} + ,{{"ս"}, BATTLE_CHARMODE_RESCUE} + ,{{"ս"}, BATTLE_CHARMODE_FINAL} + ,{{"սʼ"}, BATTLE_CHARMODE_WATCHINIT} + ,{{"ûм"}, FMMEMBER_NONE} + ,{{""}, FMMEMBER_APPLY} + ,{{"峤"}, FMMEMBER_LEADER} + ,{{"Ա"}, FMMEMBER_MEMBER} + ,{{""}, FMMEMBER_ELDER} +}; + +static CharBase CharBaseInt[] = { + {{"ͼ"}, CHAR_BASEIMAGENUMBER} + ,{{"ԭͼ"}, CHAR_BASEBASEIMAGENUMBER} + ,{{"ͼ"}, CHAR_FLOOR} + ,{{"X"}, CHAR_X} + ,{{"Y"}, CHAR_Y} + ,{{""}, CHAR_DIR} + ,{{"ȼ"}, CHAR_LV} + ,{{"ʯ"}, CHAR_GOLD} + ,{{"HP"}, CHAR_HP} + ,{{"MP"}, CHAR_MP} + ,{{"MP"}, CHAR_MAXMP} + ,{{""}, CHAR_VITAL} + ,{{""}, CHAR_STR} + ,{{""}, CHAR_TOUGH} + ,{{"ٶ"}, CHAR_DEX} + ,{{""}, CHAR_EARTHAT} + ,{{"ˮ"}, CHAR_WATERAT} + ,{{""}, CHAR_FIREAT} + ,{{""}, CHAR_WINDAT} + ,{{"ս"}, CHAR_DEFAULTPET} + ,{{""}, CHAR_CHARM} + ,{{""}, CHAR_LUCK} + ,{{""}, CHAR_DEADCOUNT} + ,{{"·"}, CHAR_WALKCOUNT} + ,{{"˵"}, CHAR_TALKCOUNT} + ,{{"𻵴"}, CHAR_DAMAGECOUNT} + ,{{""}, CHAR_GETPETCOUNT} + ,{{"ɱ"}, CHAR_KILLPETCOUNT} + ,{{""}, CHAR_DEADPETCOUNT} + ,{{"ʼ"}, CHAR_SENDMAILCOUNT} + ,{{"ϳɴ"}, CHAR_MERGEITEMCOUNT} + ,{{"PK"}, CHAR_DUELBATTLECOUNT} + ,{{"PKӮ"}, CHAR_DUELWINCOUNT} + ,{{"PK"}, CHAR_DUELLOSECOUNT} + ,{{"PKʤ"}, CHAR_DUELSTWINCOUNT} + ,{{"PKʤ"}, CHAR_DUELMAXSTWINCOUNT} + ,{{""}, CHAR_WHICHTYPE} + ,{{"ѭ¼ʱ"}, CHAR_LOOPINTERVAL} +#ifdef _NEWOPEN_MAXEXP + ,{{"ܾ"}, CHAR_OLDEXP} +#endif + ,{{"ǰ"}, CHAR_EXP} + ,{{"ܵ"}, CHAR_SKILLUPPOINT} + ,{{""}, CHAR_LEVELUPPOINT} + ,{{"DP"}, CHAR_DUELPOINT} + ,{{""}, CHAR_EXP} + ,{{""}, CHAR_LASTTALKELDER} + ,{{"ת"}, CHAR_TRANSMIGRATION} + ,{{""}, CHAR_SILENT} + ,{{""}, CHAR_FMINDEX} + ,{{"λ"}, CHAR_FMLEADERFLAG} + ,{{""}, CHAR_BANKGOLD} + ,{{""}, CHAR_RIDEPET} + ,{{""}, CHAR_CRITIAL} + ,{{""}, CHAR_COUNTER} +#ifdef _GAMBLE_BANK +// ,{{"ij"}, CHAR_RIDEPET} +#endif +#ifdef _DROPSTAKENEW + ,{{"ij"}, CHAR_GAMBLENUM} +#endif +#ifdef _PERSONAL_FAME // Arminius 8.30: + ,{{""}, CHAR_FAME} +#endif +#ifdef _ATTACK_MAGIC + ,{{"ħ"}, CHAR_EARTH_EXP} + ,{{"ˮħ"}, CHAR_WATER_EXP} + ,{{"ħ"}, CHAR_FIRE_EXP} + ,{{"ħ"}, CHAR_WIND_EXP} + ,{{"ħ"}, CHAR_EARTH_RESIST} + ,{{"ˮħ"}, CHAR_WATER_RESIST} + ,{{"ħ"}, CHAR_FIRE_RESIST} + ,{{"ħ"}, CHAR_WIND_RESIST} + ,{{"ħȾ"}, CHAR_EARTH_ATTMAGIC_EXP} + ,{{"ˮħȾ"}, CHAR_WATER_ATTMAGIC_EXP} + ,{{"ħȾ"}, CHAR_FIRE_ATTMAGIC_EXP} + ,{{"ħȾ"}, CHAR_WIND_ATTMAGIC_EXP} + ,{{"ħԾֵ"}, CHAR_EARTH_DEFMAGIC_EXP} + ,{{"ˮħԾֵ"}, CHAR_WATER_DEFMAGIC_EXP} + ,{{"ħԾֵ"}, CHAR_FIRE_DEFMAGIC_EXP} + ,{{"ħԾֵ"}, CHAR_WIND_DEFMAGIC_EXP} +#endif +#ifdef _CHAR_PROFESSION // WON ADD ְҵ + ,{{"ְҵ"}, PROFESSION_CLASS} + ,{{"ְҵȼ"}, PROFESSION_LEVEL} + ,{{"ܵ"}, PROFESSION_SKILL_POINT} + ,{{"Ӷѵ"}, ATTACHPILE} + ,{{""}, PROFESSION_FIRE_P} + ,{{""}, PROFESSION_ICE_P} + ,{{""}, PROFESSION_THUNDER_P} + ,{{""}, PROFESSION_FIRE_R} + ,{{""}, PROFESSION_ICE_R} + ,{{"׿"}, PROFESSION_THUNDER_R} +#endif +#ifdef _NEW_MANOR_LAW + ,{{""}, CHAR_MOMENTUM} +#endif +//#ifdef _VIP_SERVER +// ,{{""}, CHAR_AMPOINT} +//#endif +#ifdef _VIP_RIDE + ,{{"Ա"}, CHAR_VIPRIDE} + ,{{"ԱЧ"}, CHAR_VIPTIME} +#endif +#ifdef _ITEM_PET_LOCKED + ,{{"ȫ"}, CHAR_LOCKED} +#endif +#ifdef _ONLINE_SHOP + ,{{""}, CHAR_BJ} +#endif +#ifdef _CAX_ESC_REPORT + ,{{"ǩ"}, CHAR_REPORT} +#endif + ,{{"ģʽAI"}, CHAR_MODAI} + ,{{"ɱAI"}, CHAR_VARIABLEAI} + ,{{"輼λ"}, CHAR_SLOT} + ,{{"ID"}, CHAR_PETID} + ,{{"ID"}, CHAR_PETENEMYID} + ,{{"ػ"}, CHAR_PETFAMILY} + ,{{"ֵ"}, CHAR_ALLOCPOINT} + ,{{"ɳ"}, CHAR_PETRANK} + ,{{"Ƶȼ"}, CHAR_LIMITLEVEL} + +/*char.setInt( petindex, "ںϱ", PetCode) + char.setInt( petindex, "ת", 2) + char.setInt( petindex, "ں", 3) + char.setInt( petindex, "ںϱ", -1) + char.setInt( petindex, "װ", -1) + char.setInt( petindex, "ιʳ", 30 ) + char.setInt( petindex, "ںϳ", 1) + char.setInt( petindex, "ιʳʱ", other.time()) + char.setInt( petindex, "ں", 0) + char.setInt( petindex, "ں", 0) + char.setInt( petindex, "ں", 0) + char.setInt( petindex, "ںٶ", 0)*/ +// ,{{"ں"}, CHAR_FUSIONCODE}//CHAR_FUSIONBEIT + ,{{"ںϱ"}, CHAR_FUSIONINDEX}//ںϱ-- + ,{{"ںϱ"}, CHAR_FUSIONCODE}//- + ,{{"ιʳ"}, CHAR_FUSIONRAISE} //- + ,{{"ںϳ"}, CHAR_FUSIONBEIT}// - + ,{{"ιʳʱ"}, CHAR_FUSIONTIMELIMIT}// + ,{{"ں"}, CHAR_EVOLUTIONBASEVTL}// + ,{{"ں"}, CHAR_EVOLUTIONBASESTR}// + ,{{"ں"}, CHAR_EVOLUTIONBASETGH}// + ,{{"ںٶ"}, CHAR_EVOLUTIONBASEDEX}// + + +#ifdef _PET_BEATITUDE + ,{{"ֵ"}, CHAR_BEATITUDE} +#endif +#ifdef _CAMEO_MONEY + ,{{""}, CHAR_CAMEO} +#endif +#ifdef _MISSION_TRAIN + ,{{""}, CHAR_MISSIONTRAIN_NUM} + ,{{"ʱ"}, CHAR_MISSIONTRAIN_TIME} +#endif +#ifdef _PET_EVOLVE + ,{{""}, CHAR_EVOLVE} +#endif +#ifdef _ONLINE_TIME + ,{{"ʱ"}, CHAR_ONLINE_TIME} +#endif + ,{{"ʱ"}, CHAR_OFFTIME} +#ifdef _FLOOR_DIFI_FIELD + ,{{"¥ʱ"}, CHAR_FLOORDIFI_TIME} +#endif +//#ifdef _ACTIVE_GAME +// ,{{""}, CHAR_ACTIVE} +//#endif + ,{{"ӳ"}, CHAR_ADDEXPPOWER} //ӳ + ,{{"ʱЧ"}, CHAR_ADDEXPTIME} //ʱЧ /60 + ,{{""}, CHAR_VIGOR} + ,{{""}, CHAR_EVNUM} + ,{{"1"}, CHAR_LUASAVE_WORKINT_1} //lua洢 + ,{{"2"}, CHAR_LUASAVE_WORKINT_2} //lua洢 + ,{{"3"}, CHAR_LUASAVE_WORKINT_3} //lua洢 + ,{{"洢1"}, CHAR_LUASAVE_INT_1} //洢浵1-3 + ,{{"洢2"}, CHAR_LUASAVE_INT_2} //洢浵1-3 + ,{{"洢3"}, CHAR_LUASAVE_INT_3} //洢浵1-3 +#ifdef _CAX_Mercenary + ,{{"Ӷ"}, CHAR_MERCENARY} //Ӷ +#endif +#ifdef _SUPER + ,{{"Ʒ"}, CHAR_SUPER} +#endif +#ifdef _ALLDOMAN + ,{{"Ӣ۳ƺ"}, CHAR_HEROFLOOR} +#endif + +#ifdef _PLAYER_TITLE + ,{{"ƺŵȼ"}, CHAR_TITLE_LV} + ,{{"ƺʱ"}, CHAR_TITLE_TIME} +#endif +#ifdef _MISSION_TIME + ,{{"ʱ"}, CHAR_MISSION_TIME} +#endif +#ifdef _REGISTRATION_TIME + ,{{"ǩʱ"}, CHAR_REGISTRATION_TIME} + ,{{"ǩ"}, CHAR_REGISTRATION_COUNT} + ,{{"ǩʱ"}, CHAR_REGISTRATION_ONLINE_TIME} +#endif + ,{{"֤"}, CHAR_LOWRIDEPETS} + ,{{"֤1"}, CHAR_LOWRIDEPETS1} + ,{{"֤2"}, CHAR_HIGHRIDEPETS2} +}; + +static CharBase CharBaseChar[] = { + {{""}, CHAR_NAME} + ,{{"dz"}, CHAR_OWNTITLE} + ,{{""}, CHAR_USERPETNAME} + ,{{"˺"}, CHAR_CDKEY} + ,{{""}, CHAR_FMNAME} +#ifdef _TEACHER_SYSTEM + ,{{"ʦʺ"}, CHAR_TEACHER_ID} + ,{{"ʦ"}, CHAR_TEACHER_NAME} +#endif +#ifdef _ITEM_SETLOVER + ,{{"˺"}, CHAR_LOVERID} + ,{{""}, CHAR_LOVERNAME} +#endif +#ifdef _NEW_NAME + ,{{"ƺ"}, CHAR_NEWNAME} +#endif +#ifdef _LOTTERY_SYSTEM + ,{{"Ʊ"}, CHAR_LOTTERY_VALUE} +#endif + ,{{"˺"}, CHAR_OWNERCDKEY} + ,{{""}, CHAR_OWNERCHARANAME} +}; + + +static CharBase CharBaseEvent[] = { + {{"ʼ¼"}, CHAR_INITFUNC} + //,{{"¼"}, CHAR_WALKPREFUNC} + //,{{"ߺ¼"}, CHAR_WALKPOSTFUNC} + //,{{"δ֪¼"}, CHAR_PREOVERFUNC} + //,{{"δ֪¼"}, CHAR_POSTOVERFUNC} + //,{{"ۿ¼"}, CHAR_WATCHFUNC} + ,{{"ѭ¼"}, CHAR_LOOPFUNC} + //,{{"¼"}, CHAR_DYINGFUNC} + ,{{"Ի¼"}, CHAR_TALKEDFUNC} + //,{{"¼"}, CHAR_PREATTACKEDFUNC} + //,{{"¼"}, CHAR_POSTATTACKEDFUNC} + //,{{"뿪¼"}, CHAR_OFFFUNC} + //,{{"¼"}, CHAR_LOOKEDFUNC} + //,{{"¼"}, CHAR_ITEMPUTFUNC} + //,{{"Ի¼"}, CHAR_SPECIALTALKEDFUNC} + ,{{"¼"}, CHAR_WINDOWTALKEDFUNC} +#ifdef _USER_CHARLOOPS + //,{{"ѭ¼1"}, CHAR_LOOPFUNCTEMP1} + //,{{"ѭ¼2"}, CHAR_LOOPFUNCTEMP2} + //,{{"δ֪¼"}, CHAR_BATTLEPROPERTY} +#endif + ,{{"ص¼"}, CHAR_OVERLAPEDFUNC} + ,{{"ս¼"}, CHAR_BATTLEOVERDFUNC} +#ifdef _ALLBLUES_LUA_1_4 + ,{{"dz¼"}, CHAR_LOGINOUTFUNC} +#endif +#ifdef _ALLBLUES_LUA_1_9 + ,{{"ս¼"}, CHAR_BATTLESETFUNC} +#endif +}; + +static CharBase CharBaseColor[] = { + {{"ɫ"}, CHAR_COLORWHITE} + ,{{"ɫ"}, CHAR_COLORCYAN} + ,{{"ɫ"}, CHAR_COLORPURPLE} + ,{{"ɫ"}, CHAR_COLORBLUE} + ,{{"ɫ"}, CHAR_COLORYELLOW} + ,{{"ɫ"}, CHAR_COLORGREEN} + ,{{"ɫ"}, CHAR_COLORRED} + ,{{"Ұɫ"}, CHAR_COLORGRAY} + ,{{"ɫ"}, CHAR_COLORBLUE2} + ,{{"ɫ"}, CHAR_COLORGREEN2} +}; + +static CharBase CharBaseUpdata[] = { + {{"HP"}, CHAR_P_STRING_HP} + ,{{"MAXHP"}, CHAR_P_STRING_MAXHP} + ,{{"MP"}, CHAR_P_STRING_MP} + ,{{"MAXMP"}, CHAR_P_STRING_MAXMP} + ,{{""}, CHAR_P_STRING_VITAL} + ,{{""}, CHAR_P_STRING_STR} + ,{{""}, CHAR_P_STRING_TOUGH} + ,{{"ٶ"}, CHAR_P_STRING_DEX} + ,{{""}, CHAR_P_STRING_EXP} + ,{{"һ"}, CHAR_P_STRING_NEXTEXP} + ,{{"ȼ"}, CHAR_P_STRING_LV} + ,{{""}, CHAR_P_STRING_ATK} + ,{{""}, CHAR_P_STRING_DEF} + ,{{""}, CHAR_P_STRING_QUICK} + ,{{""}, CHAR_P_STRING_CHARM} + ,{{""}, CHAR_P_STRING_LUCK} + ,{{""}, CHAR_P_STRING_EARTH} + ,{{"ˮ"}, CHAR_P_STRING_WATER} + ,{{""}, CHAR_P_STRING_FIRE} + ,{{""}, CHAR_P_STRING_WIND} + ,{{"ʯ"}, CHAR_P_STRING_GOLD} + ,{{""}, CHAR_P_STRING_TITLE} + ,{{"DP"}, CHAR_P_STRING_DUELPOINT} + ,{{"ת"}, CHAR_P_STRING_TRANSMIGRATION} + ,{{""}, CHAR_P_STRING_NAME} + ,{{"dz"}, CHAR_P_STRING_OWNTITLE} + ,{{""}, CHAR_P_STRING_RIDEPET} + ,{{"ѧ"}, CHAR_P_STRING_LEARNRIDE} + ,{{"ͼ"}, CHAR_P_STRING_BASEBASEIMAGENUMBER} + ,{{""}, CHAR_P_STRING_SKYWALKER} + ,{{"ģʽ"}, CHAR_P_STRING_DEBUGMODE} +}; + +static CharBase CharBaseFlg[] = { + {{"ɼ"}, CHAR_ISVISIBLE} + ,{{"͸"}, CHAR_ISTRANSPARENT} + ,{{""}, CHAR_ISFLYING} + ,{{""}, CHAR_ISDIE} + ,{{""}, CHAR_ISPARTY} + ,{{""}, CHAR_ISDUEL} + ,{{"Ƭ"}, CHAR_ISTRADECARD} + ,{{""}, CHAR_ISTRADE} +#ifdef _CHANNEL_MODIFY + ,{{"Ƶ"}, CHAR_ISTELL} + ,{{"Ƶ"}, CHAR_ISFM} + ,{{"ְҵƵ"}, CHAR_ISOCC} + ,{{"Ի"}, CHAR_ISSAVE} + ,{{""}, CHAR_ISCHAT} +#ifdef _CHATROOMPROTOCOL +#ifdef _THE_WORLD_SEND + ,{{"Ƶ"}, CHAR_ISWORLD} +#endif +#ifdef _ONLINE_TALK_IP + ,{{"ٱƵ"}, CHAR_ISTALKIP} +#endif +#endif +#endif +}; + +static CharBase CharBaseAction[] = { + {{"վ"}, CHAR_ACTSTAND} + ,{{"߶"}, CHAR_ACTWALK} + ,{{""}, CHAR_ACTATTACK} + ,{{"Ͷ"}, CHAR_ACTTHROW} + ,{{""}, CHAR_ACTDAMAGE} + ,{{""}, CHAR_ACTDEAD} + ,{{"ħ"}, CHAR_ACTMAGIC} + ,{{""}, CHAR_ACTITEM} + ,{{"Ч"}, CHAR_ACTEFFECT} + ,{{""}, CHAR_ACTDOWN} + ,{{""}, CHAR_ACTSIT} + ,{{""}, CHAR_ACTHAND} + ,{{""}, CHAR_ACTPLEASURE} + ,{{"ŭ"}, CHAR_ACTANGRY} + ,{{""}, CHAR_ACTSAD} + ,{{""}, CHAR_ACTGUARD} + ,{{"·"}, CHAR_ACTACTIONWALK} + ,{{"ͷ"}, CHAR_ACTNOD} + ,{{"վ"}, CHAR_ACTACTIONSTAND} + ,{{"ս"}, CHAR_ACTBATTLE} + ,{{""}, CHAR_ACTLEADER} + ,{{"ս"}, CHAR_ACTBATTLEWATCH} + ,{{"δ֪"}, CHAR_ACTPOPUPNAME} + ,{{"ת"}, CHAR_ACTTURN} + ,{{""}, CHAR_ACTWARP} + ,{{""}, CHAR_ACTTRADE} +#ifdef _ANGEL_SUMMON + ,{{"ʹ"}, CHAR_ACTANGEL} +#endif + +#ifdef _MIND_ICON + ,{{"˼"}, CHAR_MIND} +#endif +#ifdef _STREET_VENDOR + ,{{"̯̲"}, CHAR_STREETVENDOR_OPEN} + ,{{"ر̯̲"}, CHAR_STREETVENDOR_CLOSE} +#endif +}; + + +static int getCharNum (lua_State *L) +{ + lua_pushinteger(L, CHAR_getCharNum()); + + return 1; +} + +static int getPlayerMaxNum (lua_State *L) +{ + lua_pushinteger(L, CHAR_getPlayerMaxNum()); + + return 1; +} + +static int getPetMaxNum (lua_State *L) +{ + lua_pushinteger(L, CHAR_getPetMaxNum()); + + return 1; +} + +static int getOthersMaxNum (lua_State *L) +{ + lua_pushinteger(L, CHAR_getOthersMaxNum()); + + return 1; +} + + +static int check (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, CHAR_CHECKINDEX(index)); + + return 1; +} + +static int setFlg (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseFlg, arraysizeof(CharBaseFlg)); + const int data = luaL_checkint(L, 3); + if(CHAR_setFlg(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getFlg (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseFlg, arraysizeof(CharBaseFlg)); + + lua_pushinteger(L, CHAR_getFlg(index, element)); + return 1; +} + +static int setWorkChar (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseWorkChar, arraysizeof(CharBaseWorkChar)); + char *data = luaL_checklstring(L, 3, &l); + if(CHAR_setWorkChar(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getWorkChar (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseWorkChar, arraysizeof(CharBaseWorkChar)); + lua_pushstring(L, CHAR_getWorkChar(index, element)); + return 1; +} + + +static int setWorkInt (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseWorkInt, arraysizeof(CharBaseWorkInt)); + const int data = getCharBaseValue(L, 3, CharBaseWorkValue, arraysizeof(CharBaseWorkValue)); + //print("index = %d element =%d data =%d \n ",index,element,data); + if(CHAR_setWorkInt(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getWorkInt (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseWorkInt, arraysizeof(CharBaseWorkInt)); + lua_pushinteger(L, CHAR_getWorkInt(index, element)); + return 1; +} + +static int setChar (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseChar, arraysizeof(CharBaseChar)); + char *data = luaL_checklstring(L, 3, &l); + if(CHAR_setChar(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getChar (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseChar, arraysizeof(CharBaseChar)); + lua_pushstring(L, CHAR_getChar(index, element)); + return 1; +} + +static int setInt (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseInt, arraysizeof(CharBaseInt)); + const int data = getCharBaseValue(L, 3, CharBaseValue, arraysizeof(CharBaseValue)); + if(CHAR_setInt(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getInt (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseInt, arraysizeof(CharBaseInt)); + lua_pushinteger(L, CHAR_getInt(index, element)); + return 1; +} + +static int setFunctionPointer(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int functype = getCharBaseValue(L, 2, CharBaseEvent, arraysizeof(CharBaseEvent)); + char *luafunctable=luaL_checklstring(L, 3, &l); + char *luafunctablepath=luaL_checklstring(L, 4, &l); + if(strlen(luafunctablepath) > 0){ + MY_Lua *mylua = &MYLua; + while(mylua->next != NULL){ + if(strcmp(mylua->luapath, luafunctablepath) == 0){ + return CHAR_setLUAFunction( index, functype, mylua->lua, luafunctable ); + } + mylua = mylua->next; + } + }else{ + return CHAR_setLUAFunction( index, functype, L, luafunctable ); + } + return 1; +} + +static int delFunctionPointer(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int functype = getCharBaseValue(L, 2, CharBaseEvent, arraysizeof(CharBaseEvent)); + + return CHAR_delLUAFunction( index, functype ); +} + +static int TalkToCli(lua_State *L) +{ + size_t l; + const int talkedcharaindex = luaL_checkint(L, 1); + const int talkcharaindex = luaL_checkint(L, 2); + char *message=luaL_checklstring(L, 3, &l); + const int color = getCharBaseValue(L, 4, CharBaseColor, arraysizeof(CharBaseColor)); + CHAR_talkToCli(talkedcharaindex, talkcharaindex, message, color); + return 1; +} + +static int TalkToRound(lua_State *L) +{ + size_t l; + const int talkedcharaindex = luaL_checkint(L, 1); + char *message=luaL_checklstring(L, 2, &l); + const int color = getCharBaseValue(L, 3, CharBaseColor, arraysizeof(CharBaseColor)); + + int fl = CHAR_getInt( talkedcharaindex, CHAR_FLOOR) ; + int x = CHAR_getInt( talkedcharaindex, CHAR_X) ; + int y = CHAR_getInt( talkedcharaindex, CHAR_Y) ; + + int i,j; + + int range = 8; + + for( i=x-range ; i<=x+range ; i++ ){ + for( j=y-range ; j<=y+range ; j++ ){ + OBJECT object; + for( object = MAP_getTopObj( fl,i,j ) ; object ; object = NEXT_OBJECT(object) ){ + int objindex = GET_OBJINDEX(object); + int toindex = OBJECT_getIndex( objindex); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA && toindex != talkedcharaindex ){ + if( CHAR_getInt(toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ + typedef void (*TALKF)(int,int,char*,int,int); + TALKF talkedfunc=NULL; + talkedfunc = (TALKF)CHAR_getFunctionPointer( toindex, CHAR_TALKEDFUNC); + if( talkedfunc ) { + talkedfunc(toindex, talkedcharaindex, message, color, -1); + } + } + } + } + } + } + + return 1; +} + +static int WalkPoint(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) return 0; + + const int x = luaL_checkint(L, 2); + const int y = luaL_checkint(L, 3); + + POINT start, end; + + start.x = CHAR_getInt( index, CHAR_X); + start.y = CHAR_getInt( index, CHAR_Y); + + end.x = x; + end.y = y; + + int pos = NPC_Util_getDirFromTwoPoint( &start, &end); + if( pos != - 1 ) { + CHAR_walk( index, pos, 0); + } + return 1; +} + +static int Walk(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) return 0; + + const int dir = luaL_checkint(L, 2); + const int step = luaL_checkint(L, 3); + + POINT start, end; + + start.x = CHAR_getInt( index, CHAR_X); + start.y = CHAR_getInt( index, CHAR_Y); + + end.x = start.x; + end.y = start.y; + switch(dir){ + case 0: + { + end.x = start.x - step; + break; + } + case 1: + { + end.x = start.x + step; + end.y = start.y - step; + break; + } + case 2: + { + end.x = start.x + step; + break; + } + case 3: + { + end.x = start.x + step; + end.y = start.y + step; + + break; + } + case 4: + { + end.y = start.y + step; + break; + } + case 5: + { + end.x = start.x - step; + end.y = start.y + step; + break; + } + case 6: + { + end.y = start.y - step; + break; + } + case 7: + { + end.x = start.x - step; + end.y = start.y - step; + break; + } + } + + int pos = NPC_Util_getDirFromTwoPoint( &start, &end); + if( dir != - 1 ) { + CHAR_walk( index, pos, 0); + } + return 1; +} + +static int BoundRandWalk(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + if( CHAR_getWorkInt( index, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) return 0; + + const int minX = min(luaL_checkint(L, 2), luaL_checkint(L, 4)); + const int minY = min(luaL_checkint(L, 3), luaL_checkint(L, 5)); + const int maxX = max(luaL_checkint(L, 2), luaL_checkint(L, 4)); + const int maxY = max(luaL_checkint(L, 3), luaL_checkint(L, 5)); + + POINT start, end; + int stepX = (rand() % 10) - 5; + int stepY = (rand() % 10) - 5; + + start.x = CHAR_getInt( index, CHAR_X); + start.y = CHAR_getInt( index, CHAR_Y); + + end.x = start.x + stepX; + if(end.x>maxX)end.x=maxX; + else if(end.xmaxY)end.y=maxY; + else if(end.y -1 ){ + CHAR_setCharPet( index, havepetelement, petindex); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, index); + } + + lua_pushinteger(L, havepetelement); + + return 1; +} + +static int getCharPet(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int havepetid = luaL_checkint(L, 2); + + lua_pushinteger(L, CHAR_getCharPet( index, havepetid)); + + return 1; +} + +static int DelItem(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int itemindex = luaL_checkint(L, 2); + + CHAR_DelItem( charaindex, itemindex); + + return 1; +} + +static int getFd(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + lua_pushinteger(L, getfdFromCharaIndex(charaindex)); + return 1; +} + +static int Updata(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int indextable = getCharBaseValue(L, 2, CharBaseUpdata, arraysizeof(CharBaseUpdata)); + + CHAR_send_P_StatusString( charaindex , indextable); + return 1; +} + +static int Additem(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int itemid = luaL_checkint(L, 2); + int itemindex = -1; + int emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex ); + + if( emptyitemindexinchara >= 0 ){ + itemindex = ITEM_makeItemAndRegist( itemid ); + + if( itemindex > -1 ){ + CHAR_setItemIndex( charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX, -1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + atoi( message), +#endif + "AddItem(LUA)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + } + lua_pushinteger(L, itemindex); + return 1; +} + +static int Finditem(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int itemid = luaL_checkint(L, 2); + int i; + int itemindex=-1; + int id; + for( i=CHAR_STARTITEMARRAY;i> (4 - flg) * 8) & 0xFF); + + return 1; +} + +static int getLiftTo8(lua_State *L) +{ + const int value = luaL_checkint(L, 1); + const int flg = luaL_checkint(L, 2); + + lua_pushinteger(L, (value << (4 - flg) * 8)); + + return 1; +} + +static int complianceParameter(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + + CHAR_complianceParameter(index); + + return 1; +} + + +static int sendStatusString(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data=luaL_checklstring(L, 2, &l); + + CHAR_sendStatusString( index, data ); + + return 1; +} + +static int sendBattleEffect(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int val = luaL_checkint(L, 2); + + CHAR_sendBattleEffect( index, val ); + + return 1; +} + +static int sendWatchEvent(lua_State *L) +{ + const int objindex = luaL_checkint(L, 1); + const int action = getCharBaseValue(L, 2, CharBaseAction, arraysizeof(CharBaseAction)); + const int flg = luaL_checkint(L, 3); + + luaL_checktype(L, 4, LUA_TTABLE); + int n = luaL_getn(L, 4); + int *opt = (int *) malloc(n * sizeof(int)); + int i; + + for(i = 0; i < n; i++){ + opt[i] = getArrayInt(L, i); + } + + CHAR_sendWatchEvent( objindex, action, opt, n, flg); + + return 1; +} + +static int dropPetAbsolute(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int fl = luaL_checkint(L, 2); + const int fx = luaL_checkint(L, 3); + const int fy = luaL_checkint(L, 4); + const int dir = luaL_checkint(L, 5); + const int val = luaL_checkint(L, 6); + int dirx[9],diry[9]; + int floor, x, y, i; + + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX(dir + i+1); + diry[i+2] = CHAR_getDY(dir + i+1); + } + dirx[0] = CHAR_getDX(dir); + diry[0] = CHAR_getDY(dir); + dirx[1] = 0; + diry[1] = 0; + floor = fl; + for( i = 0 ; i < 9 ; i ++ ){ + int x=fx+dirx[i]; + int y=fy+diry[i]; + if( PET_isPutPoint( floor, x, y ) == TRUE ) { + break; + } + } + if( i == 9 ) i = 1; + x = fx+dirx[i]; + y = fy+diry[i]; + + int objindex = PET_dropPetAbsolute( index, floor, x, y, val ); + + if( objindex == -1 ){ + return 1; + } + + CHAR_setWorkInt( index, CHAR_WORKOBJINDEX, objindex ); + CHAR_setInt( index, CHAR_FLOOR, floor); + CHAR_setInt( index, CHAR_X, x); + CHAR_setInt( index, CHAR_Y, y); + CHAR_setInt( index, CHAR_PUTPETTIME, NowTime.tv_sec); + + CHAR_sendCToArroundCharacter( objindex); + + return 1; +} + +static int AllWarpToSpecificPoint(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int floor = luaL_checkint(L, 2); + const int x = luaL_checkint(L, 3); + const int y = luaL_checkint(L, 4); + + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + int i; + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + int subindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1+i ); + if( CHAR_CHECKINDEX( subindex ) == FALSE ) continue; + CHAR_warpToSpecificPoint( subindex, floor, x, y ); + ITEM_WarpDelErrorItem( subindex ); + } + }else if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ){ + CHAR_talkToCli(charaindex, -1, "Ա޷ʹá", CHAR_COLORYELLOW); + return FALSE; + }else if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_NONE ){ + ITEM_WarpDelErrorItem( charaindex ); + CHAR_warpToSpecificPoint( charaindex, floor, x, y ); + } + + + return 1; +} + +static int Findpet(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int petid = luaL_checkint(L, 2); + const int lv = luaL_checkint(L, 3); + int i; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + int petindex = CHAR_getCharPet( charaindex, i ); + if(!CHAR_CHECKINDEX( petindex))continue; + if( CHAR_getInt(petindex, CHAR_PETID) == petid ){ + if(lv > 0){ + if( CHAR_getInt(petindex, CHAR_LV) != lv){ + continue; + } + } + lua_pushinteger(L, petindex); + return 1; + } + } + + lua_pushinteger(L, -1); + return 1; +} + +static int FindPetFormMatemo(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int metamo = luaL_checkint(L, 2); + const int lv = luaL_checkint(L, 3); + int i; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + int petindex = CHAR_getCharPet( charaindex, i ); + if(!CHAR_CHECKINDEX( petindex))continue; + if( CHAR_getInt(petindex, CHAR_BASEBASEIMAGENUMBER) == metamo ){ + if(lv > 0){ + if( CHAR_getInt(petindex, CHAR_LV) != lv){ + continue; + } + } + lua_pushinteger(L, petindex); + return 1; + } + } + + lua_pushinteger(L, -1); + return 1; +} + +static int FindPetFormEnemyTempID(lua_State *L) +{ + size_t l; + const int charaindex = luaL_checkint(L, 1); + char *data=luaL_checklstring(L, 2, &l); + char token[64]; + int enemytempid = -1, lv = 0; + int i; + + if(getStringFromIndexWithDelim(data, "-", 1, token, sizeof(token)) == TRUE){ + lv = atoi(token); + }else{ + lua_pushinteger(L, -1); + } + + if(getStringFromIndexWithDelim(data, "-", 2, token, sizeof(token)) == TRUE){ + enemytempid = atoi(token); + }else{ + lua_pushinteger(L, -1); + } + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + int petindex = CHAR_getCharPet( charaindex, i ); + if(!CHAR_CHECKINDEX( petindex))continue; + + if( CHAR_getInt( petindex, CHAR_PETID) == enemytempid ){ + if(lv > 0){ + if( CHAR_getInt(petindex, CHAR_LV) != lv){ + continue; + } + } + lua_pushinteger(L, petindex); + return 1; + } + } + + lua_pushinteger(L, -1); + return 1; +} + +static int DelPet(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int petindex = luaL_checkint(L, 2); + int i; + char category[12]; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( petindex == CHAR_getCharPet( charaindex, i ) ){ + if( CHAR_getInt( charaindex, CHAR_RIDEPET) == i ) { + CHAR_setInt( charaindex, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET ); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + } + + CHAR_endCharOneArray( petindex ); + CHAR_setCharPet( charaindex, i, -1); + snprintf( category, sizeof( category), "K%d",i); + CHAR_sendStatusString( charaindex, category ); + break; + } + } + return 1; +} + +#endif + +#ifdef _ALLBLUES_LUA_1_7 +static int findEmptyItemBox(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + lua_pushinteger(L, CHAR_findEmptyItemBox(charaindex)); + return 1; +} + +static int findEmptyPetBox(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + int num = 0; + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + int petindex = CHAR_getCharPet( charaindex, i ); + if(!CHAR_CHECKINDEX(petindex)){ + num ++ ; + } + } + lua_pushinteger(L, num); + return 1; +} + +static int dropPetFollow(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int havepetindex = luaL_checkint(L, 2); + char szPet[128]; + int dirx[9],diry[9]; + int i; + int objindex=-1; + int floor,x,y; + int petindex; + + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) return FALSE; + petindex = CHAR_getCharPet(charaindex,havepetindex); + if( petindex == -1 ) return FALSE; + if( !CHAR_CHECKINDEX( charaindex ) )return FALSE; + if( CHAR_CHECKINDEX( petindex) == FALSE ) return FALSE; + + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ + CHAR_talkToCli(charaindex, -1, "ػ޷", CHAR_COLORYELLOW); + return FALSE; + } + if (CHAR_getInt(charaindex, CHAR_RIDEPET) == havepetindex){ + CHAR_talkToCli(charaindex, -1, "еij޷棡", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ; i < 7 ; i ++ ){ + dirx[i+2] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + diry[i+2] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR) + i+1); + } + dirx[0] = CHAR_getDX(CHAR_getInt(charaindex,CHAR_DIR)); + diry[0] = CHAR_getDY(CHAR_getInt(charaindex,CHAR_DIR)); + dirx[1] = 0; + diry[1] = 0; + + floor = CHAR_getInt( charaindex,CHAR_FLOOR ); + for( i = 0 ; i < 9 ; i ++ ){ + int x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + int y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + if( PET_isPutPoint( floor, x, y ) == TRUE ) { + break; + } + } + if( i == 9 ) i = 1; + + x=CHAR_getInt(charaindex,CHAR_X)+dirx[i]; + y=CHAR_getInt(charaindex,CHAR_Y)+diry[i]; + + objindex = PET_dropPetAbsolute( petindex,floor,x,y, FALSE ); + if( objindex == -1 ) return FALSE; + + CHAR_setWorkInt( petindex,CHAR_WORKOBJINDEX,objindex ); + CHAR_setCharPet( charaindex, havepetindex, -1); + CHAR_setInt( petindex, CHAR_FLOOR, floor); + CHAR_setInt( petindex, CHAR_X, x); + CHAR_setInt( petindex, CHAR_Y, y); + CHAR_setInt( petindex, CHAR_PUTPETTIME, NowTime.tv_sec); + if( havepetindex == CHAR_getInt( charaindex, CHAR_DEFAULTPET)) { + int fd; + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + fd = getfdFromCharaIndex( charaindex); + lssproto_KS_send( fd, havepetindex, 0); + + } + CHAR_sendCToArroundCharacter( objindex); + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){ +#ifdef _PET_ITEM + CHAR_sendPetItemData( charaindex, havepetindex); +#endif + snprintf( szPet, sizeof( szPet ), "K%d", havepetindex ); + CHAR_sendStatusString( charaindex, szPet ); + } + + CHAR_setWorkInt( charaindex, CHAR_WORKPETFOLLOW, petindex); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWMODE, CHAR_PETFOLLOW_NOW); + CHAR_setWorkInt( petindex, CHAR_WORKPETFOLLOWCOUNT, 0); + CHAR_setInt( petindex, CHAR_PUTPETTIME, (int)(NowTime.tv_sec)); + CHAR_setInt( petindex, CHAR_WORKPLAYERINDEX, charaindex); + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "Follow(lua)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + return 1; +} + +static int getItemIndex(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int haveitemindex = luaL_checkint(L, 2); + + lua_pushinteger(L, CHAR_getItemIndex( charaindex, haveitemindex )); + return 1; + +} + +static int charSaveFromConnect(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + if( CHAR_getCharUse(charaindex) != FALSE ){ + CHAR_charSaveFromConnect( charaindex, FALSE ); + } + return 1; +} + +#ifdef _RECORD_IP +static int userip(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + unsigned long ip; + int a,b,c,d; + char strIP[32]; + + ip = CHAR_getWorkInt(charaindex, CHAR_WORK_RECORD_IP); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + + sprintf(strIP, "%d.%d.%d.%d", a, b, c, d); + + lua_pushstring(L, strIP); + return 1; +} +#endif + +static int DischargeParty(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int flg = luaL_checkint(L, 2); + CHAR_DischargeParty(charaindex, flg); + return 1; +} + + +static int Skillupsend(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + CHAR_Skillupsend(charaindex); + return 1; +} +#endif + +#ifdef _ALLBLUES_LUA_1_9 +static int logou(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + CHAR_logout(charaindex, TRUE); + return 1; +} +#endif +//void CHAR_WXSYSCMD_setStayEncount(int charaindex, char* message ) +#ifdef _ALLBLUES_LUA_2_0 +static int Encounter(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(charaindex) == FALSE) return 0; + int fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); +#ifdef _USER_CHARLOOPS + { + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( charaindex); + } +#endif +} + +static int GetOldLevelExp(lua_State *L) +{ + size_t l; + const int level = luaL_checkint(L, 1); + CHAR_GetOldLevelExp(level); + return 1; +} +#endif +#ifdef _AutoBattle_LUA +static int gcgc(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + Enemy_setStayLoop(charaindex); + return 1; +} +#endif + +#ifdef _FIX_PLAYER_NPC_PET +static int DelNpcPetByIndex(lua_State *L) +{ + const int petindex = luaL_checkint(L, 1); + CHAR_endCharOneArray( petindex ); + return 1; +} + +#endif + +static const luaL_Reg charlib[] = { + {"getCharNum", getCharNum}, + {"getPlayerMaxNum", getPlayerMaxNum}, + {"getPetMaxNum", getPetMaxNum}, + {"getOthersMaxNum", getOthersMaxNum}, + {"check", check}, + {"setWorkChar", setWorkChar}, + {"getWorkChar", getWorkChar}, + {"setWorkInt", setWorkInt}, + {"getWorkInt", getWorkInt}, + {"setChar", setChar}, + {"getChar", getChar}, + {"setInt", setInt}, + {"getInt", getInt}, + {"setFlg", setFlg}, + {"getFlg", getFlg}, + {"setFunctionPointer", setFunctionPointer}, + {"delFunctionPointer", delFunctionPointer}, + {"TalkToCli", TalkToCli}, + {"TalkToRound", TalkToRound}, + {"talkToFloor", talkToFloor}, + {"talkToParty", talkToParty}, + {"talkToServer", talkToServer}, + {"BoundRandWalk", BoundRandWalk}, + {"ToAroundChar", ToAroundChar}, +#ifdef _ALLBLUES_LUA_1_1 + {"Walk", Walk}, + {"WalkPoint", WalkPoint}, + {"WarpToSpecificPoint", WarpToSpecificPoint}, + {"MapAllWarp", MapAllWarp}, + {"RandRandWalk", RandRandWalk}, +#endif +#ifdef _ALLBLUES_LUA_1_3 + {"createPet", createPet}, + {"setCharPet", setCharPet}, + {"getCharPet", getCharPet}, + {"DelItem", DelItem}, + {"getFd", getFd}, + {"Updata", Updata}, + {"Additem", Additem}, + {"AddPet", AddPet}, + {"Finditem", Finditem}, +#ifdef _PLAYER_NPC + {"setPlayerNpc", setPlayerNpc}, +#endif + {"Coordinate", Coordinate}, + {"setPetSkill", setPetSkill}, + {"getPetSkill", getPetSkill}, + {"PetLevelUp", PetLevelUp}, + {"JoinParty", JoinParty}, +#endif +#ifdef _ALLBLUES_LUA_1_4 + {"getLiftTo8", getLiftTo8}, + {"getRightTo8", getRightTo8}, + {"complianceParameter", complianceParameter}, + {"sendStatusString", sendStatusString}, + {"sendBattleEffect", sendBattleEffect}, + {"dropPetAbsolute", dropPetAbsolute}, + {"AddPetCf", AddPetCf}, + {"sendWatchEvent", sendWatchEvent}, + {"AllWarpToSpecificPoint",AllWarpToSpecificPoint}, + {"Findpet", Findpet}, + {"DelPet", DelPet}, + {"FindPetFormEnemyTempID",FindPetFormEnemyTempID}, + {"FindPetFormMatemo", FindPetFormMatemo}, +#endif +#ifdef _PETSKILL_SHOP_LUA + {"FreePetSkill", FreePetSkill}, +#endif +#ifdef _ALLBLUES_LUA_1_7 + {"findEmptyPetBox", findEmptyPetBox}, + {"findEmptyItemBox", findEmptyItemBox}, + {"dropPetFollow", dropPetFollow}, + {"getItemIndex", getItemIndex}, + {"charSaveFromConnect", charSaveFromConnect}, + {"DischargeParty", DischargeParty}, + {"Skillupsend", Skillupsend}, +#ifdef _RECORD_IP + {"userip", userip}, +#endif +#endif +#ifdef _ALLBLUES_LUA_1_9 + {"logou", logou}, +#endif +#ifdef _ALLBLUES_LUA_2_0 + {"Encounter", Encounter}, + {"GetOldLevelExp", GetOldLevelExp}, +#endif +#ifdef _AutoBattle_LUA + {"gcgc", gcgc}, +#endif +#ifdef _FIX_PLAYER_NPC_PET + {"DelNpcPetByIndex", DelNpcPetByIndex}, +#endif + {NULL, NULL} +}; + +LUALIB_API int luaopen_Char (lua_State *L) { + luaL_register(L, "char", charlib); + return 1; +} + +#endif diff --git a/mylua/configbase.c b/mylua/configbase.c new file mode 100644 index 0000000..b0cd8bc --- /dev/null +++ b/mylua/configbase.c @@ -0,0 +1,82 @@ +#include +#include +#include +#include "char.h" +#include "char_base.h" +#include "mylua/base.h" +#include "mylua/mylua.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "configfile.h" + +#ifdef _ALLBLUES_LUA + +#ifdef _ALLBLUES_LUA_1_1 +static int set(lua_State *L) +{ + size_t l; + char *data=luaL_checklstring(L, 1, &l); + luareadconfigfile(data); + return 1; +} + +static int checkIp(lua_State *L) +{ + int ip = luaL_checkint(L, 1); + + lua_pushinteger(L, checkServerIp(ip)); + return 1; +} + +static int config_getBattleexp(lua_State *_NLL) +{ + LRetInt(_NLL, getBattleexp()); +} + +#ifdef _ALLBLUES_LUA_2_0 +static int ABLUA_getGameservername(lua_State *L) +{ + char* name = getGameservername(); + lua_pushstring(L, name); + return 1; +} + +static int ABLUAgetFdnum(lua_State *L) +{ + int playnum = getFdnum(); + lua_pushinteger(L, playnum); + return 1; +} +#endif + +#ifdef _FM_EXP_ADD +static int getfmexp(lua_State *L) +{ + lua_pushinteger(L, getFmAddExp()); + return 1; +} +#endif + +static const luaL_Reg configlib[] = { + {"set", set}, + {"checkIp", checkIp}, + {"getBattleexp", config_getBattleexp}, +#ifdef _FM_EXP_ADD + {"getFmExp", getfmexp}, +#endif +#ifdef _ALLBLUES_LUA_2_0 + {"getGameservername", ABLUA_getGameservername}, + {"getFdnum", ABLUAgetFdnum}, +#endif + {NULL, NULL} +}; + +LUALIB_API int luaopen_Config (lua_State *L) { + luaL_register(L, "config", configlib); + return 1; +} +#endif + +#endif + diff --git a/mylua/enemytempbase.c b/mylua/enemytempbase.c new file mode 100644 index 0000000..4a29d95 --- /dev/null +++ b/mylua/enemytempbase.c @@ -0,0 +1,156 @@ +#include +#include +#include "char.h" +#include "readmap.h" +#include "map_deal.h" +#include "char_base.h" +#include "enemy.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" + +#ifdef _ALLBLUES_LUA +#ifdef _ALLBLUES_LUA_1_4 + +static CharBase EnemytempBaseInt[] = { + {{""}, E_T_TEMPNO} + ,{{"ʼֵ"}, E_T_INITNUM} + ,{{"ɳ"}, E_T_LVUPPOINT} + ,{{""}, E_T_BASEVITAL} + ,{{""}, E_T_BASESTR} + ,{{""}, E_T_BASETGH} + ,{{"ٶ"}, E_T_BASEDEX} + ,{{""}, E_T_MODAI} + ,{{""}, E_T_GET} + ,{{""}, E_T_EARTHAT} + ,{{"ˮ"}, E_T_WATERAT} + ,{{""}, E_T_FIREAT} + ,{{""}, E_T_WINDAT} + ,{{""}, E_T_POISON} + ,{{"鿹"}, E_T_PARALYSIS} + ,{{"˯"}, E_T_SLEEP} + ,{{"ʯ"}, E_T_STONE} + ,{{"ƿ"}, E_T_DRUNK} + ,{{"쿹"}, E_T_CONFUSION} + ,{{"1"}, E_T_PETSKILL1} + ,{{"2"}, E_T_PETSKILL2} + ,{{"3"}, E_T_PETSKILL3} + ,{{"4"}, E_T_PETSKILL4} + ,{{"5"}, E_T_PETSKILL5} + ,{{"6"}, E_T_PETSKILL6} + ,{{"7"}, E_T_PETSKILL7} + ,{{""}, E_T_RARE} + ,{{""}, E_T_CRITICAL} + ,{{""}, E_T_COUNTER} + ,{{""}, E_T_SLOT} + ,{{""}, E_T_IMGNUMBER} + ,{{"ȼ"}, E_T_LIMITLEVEL} +}; + +static CharBase EnemytempBaseChar[] = { + {{""}, E_T_NAME} +}; + +static int getInt (lua_State *L) +{ + const int array = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, EnemytempBaseInt, arraysizeof(EnemytempBaseInt)); + lua_pushinteger(L, ENEMYTEMP_getInt(array, element)); + return 1; +} + +static int getChar (lua_State *L) +{ + const int array = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, EnemytempBaseChar, arraysizeof(EnemytempBaseChar)); + lua_pushstring(L, ENEMYTEMP_getChar(array, element)); + return 1; +} + +static int getEnemyTempArray(lua_State *L) +{ + const int enemyid = luaL_checkint(L, 1); + lua_pushinteger(L, ENEMYTEMP_getEnemyTempArray(enemyid)); + return 1; +} + + +static int getEnemyTempArrayFromTempNo(lua_State *L) +{ + const int array = luaL_checkint(L, 1); + lua_pushinteger(L, ENEMYTEMP_getEnemyTempArrayFromTempNo(array)); + return 1; +} + +static int getEnemyTempArrayFromInitnum(lua_State *L) +{ + const int array = luaL_checkint(L, 1); + lua_pushinteger(L, ENEMYTEMP_getEnemyTempArrayFromInitnum(array)); + return 1; +} + +static int getEnemyTempNameFromEnemyID(lua_State *L) +{ + const int enemyid = luaL_checkint(L, 1); + int i; + for( i = 0; i < ENEMY_getEnemyNum(); i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == ENEMY_getEnemyNum() ){ + lua_pushstring(L, ""); + return 1; + } + int tarray = ENEMYTEMP_getEnemyTempArray( i ); + + if( !ENEMYTEMP_CHECKINDEX( tarray)) { + lua_pushstring(L, ""); + }else{ + lua_pushstring(L, ENEMYTEMP_getChar(tarray, E_T_NAME)); + } + return 1; +} + + +static int getEnemyTempIDFromEnemyID(lua_State *L) +{ + const int enemyid = luaL_checkint(L, 1); + int i; + for( i = 0; i < ENEMY_getEnemyNum(); i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == ENEMY_getEnemyNum() ){ + lua_pushinteger(L, -1); + return 1; + } + lua_pushinteger(L, ENEMY_getInt( i, ENEMY_TEMPNO)); + return 1; +} + + + + +static const luaL_Reg enemytemplib[] = { + {"getInt", getInt}, + {"getChar", getChar}, + {"getEnemyTempArray", getEnemyTempArray}, + {"getEnemyTempArrayFromTempNo", getEnemyTempArrayFromTempNo}, + {"getEnemyTempArrayFromInitnum", getEnemyTempArrayFromInitnum}, + {"getEnemyTempNameFromEnemyID", getEnemyTempNameFromEnemyID}, + {"getEnemyTempIDFromEnemyID", getEnemyTempIDFromEnemyID}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Enemytemp (lua_State *L) { + luaL_register(L, "enemytemp", enemytemplib); + return 1; +} +#endif + +#endif + diff --git a/mylua/family.c b/mylua/family.c new file mode 100644 index 0000000..f6b2175 --- /dev/null +++ b/mylua/family.c @@ -0,0 +1,39 @@ +#include +#include "char.h" +#include "char_base.h" +#include "family.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "saacproto_cli.h" + +#ifdef _ALLBLUES_LUA + +extern char familyListBuf[MAXFAMILYLIST]; + +static int ShowFamilyList(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char subbuf[256]; + if( getStringFromIndexWithDelim( familyListBuf, "|", index, subbuf, sizeof(subbuf) ) == TRUE){ + lua_pushstring(L, subbuf); + }else{ + lua_pushstring(L, ""); + } + return 1; +} + +static const luaL_Reg Familylib[] = { + {"ShowFamilyList", ShowFamilyList}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Family (lua_State *L) { + luaL_register(L, "family", Familylib); + return 1; +} + +#endif + diff --git a/mylua/function.c b/mylua/function.c new file mode 100644 index 0000000..bab7692 --- /dev/null +++ b/mylua/function.c @@ -0,0 +1,1177 @@ +#include +#include "common.h" +#include "char_base.h" +#include "item.h" +#include "configfile.h" +#include "battle.h" +#include "mylua/base.h" +#include "version.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "mylua/mylua.h" +#include "mylua/function.h" +#include "char.h" + + +#ifdef _ALLBLUES_LUA +extern MY_Lua MYLua; + +//lua_State *M_Script_Lua = NULL; //ʵ + +lua_State *FindLua(char *filename) +{ + MY_Lua *mylua = &MYLua; + char newfilename[256]; + while(mylua->next != NULL){ + if(strcmptail( mylua->luapath, ".allblues" ) == 0 ){ + sprintf(newfilename, "%s.allblues", filename); + }else{ + sprintf(newfilename, "%s", filename); + } + + if(strcmp(newfilename, mylua->luapath) == 0){ + return mylua->lua; + } + mylua = mylua->next; + } + + return NULL; +} + +#ifdef _ALLBLUES_LUA_1_9 +BOOL EquipEffectFunction( int charaindex, int id ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/equipeffectfunction.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "EquipEffectFunction"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + + //η + lua_pushnumber(lua,charaindex); + lua_pushnumber(lua,id); + + if (lua_pcall(lua, 2, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} + +BOOL WalkFunction( int charaindex ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "WalkFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + + lua_pushnumber(mylua->lua,charaindex); + + if (lua_pcall(mylua->lua, 1, 1, 0) != 0) + error(mylua->lua, "error running function `f': %s", lua_tostring(mylua->lua, -1)); + + if (!lua_isnumber(mylua->lua, -1)) + error(mylua->lua, "function `f' must return a number"); + + int ret = lua_tonumber(mylua->lua, -1); + lua_pop(mylua->lua, 1); + if(ret == TRUE){ + return TRUE; + } + + mylua = mylua->next; + } + + return FALSE; +} +#ifdef _ITEM_OVER_LAP +BOOL ItemOverlapFunction( int charindex, int fromitemindex, int toitemindex ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "ItemOverlapFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + //η + lua_pushnumber(mylua->lua,charindex); + lua_pushnumber(mylua->lua,fromitemindex); + lua_pushnumber(mylua->lua,toitemindex); + + lua_pcall(mylua->lua, 3, 1, 0); + + lua_isnumber(mylua->lua, -1); + + int ret = lua_tonumber(mylua->lua, -1); + lua_pop(mylua->lua, 1); + if(ret == 1){ + mylua = mylua->next; + continue; + } + return ret; + } + + return TRUE; +} + +BOOL ItemOverlapedFunction( int charindex, int fromitemindex, int fromid, int toitemindex, int toid) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "ItemOverlapedFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + //η + lua_pushnumber(mylua->lua,charindex); + lua_pushnumber(mylua->lua,fromitemindex); + lua_pushnumber(mylua->lua,fromid); + lua_pushnumber(mylua->lua,toitemindex); + lua_pushnumber(mylua->lua,toid); + + docall(mylua->lua, 5, 1); + mylua = mylua->next; + } + + return TRUE; +} +#endif + +BOOL BattleFinishFunction( int charaindex, int battletime, int battleturn, int battletype ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/battlefinishfunction.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "BattleFinishFunction"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + + //η + lua_pushnumber(lua,charaindex); + lua_pushnumber(lua,battletime); + lua_pushnumber(lua,battleturn); + lua_pushnumber(lua,battletype); + + docall(lua, 4, 1); + + return TRUE; +} + +BOOL SetBattleEnmeyFunction(int meindex, int enemyindex, int id ) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_BATTLESETFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, meindex); + lua_pushnumber(lua, enemyindex); + lua_pushnumber(lua, id); + docall(lua, 3, 1); + + return TRUE; +} + +#endif + +#ifdef _ALLBLUES_LUA_1_8 +BOOL CaptureOkFunction( int attackindex, int defindex ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "CaptureOkFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + //η + lua_pushnumber(mylua->lua,attackindex); + lua_pushnumber(mylua->lua,defindex); + + docall(mylua->lua, 2, 1); + mylua = mylua->next; + } + + return TRUE; +} + +BOOL CaptureCheckFunction( int attackindex, int defindex ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/capturefunction.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "CaptureCheckFunction"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + + //η + lua_pushnumber(lua,attackindex); + lua_pushnumber(lua,defindex); + + if (lua_pcall(lua, 2, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} +#endif + +#ifdef _ALLBLUES_LUA_1_7 +BOOL CharVsEnemyFunction( int charaindex ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "CharVsEnemyFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + + lua_pushnumber(mylua->lua,charaindex); + + if (lua_pcall(mylua->lua, 1, 1, 0) != 0) + error(mylua->lua, "error running function `f': %s", lua_tostring(mylua->lua, -1)); + + if (!lua_isnumber(mylua->lua, -1)) + error(mylua->lua, "function `f' must return a number"); + + int ret = lua_tonumber(mylua->lua, -1); + lua_pop(mylua->lua, 1); + if(ret == TRUE){ + return TRUE; + } + + mylua = mylua->next; + } + + return FALSE; +} +#endif + +#ifdef _ALLBLUES_LUA_1_6 +BOOL CharTalkFunction( int charaindex, char *message, int color ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/chartalkfunction.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "CharTalkFunction"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + + //η + lua_pushnumber(lua,charaindex); + lua_pushstring(lua,message); + lua_pushnumber(lua,color); + + if (lua_pcall(lua, 3, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} + +BOOL FamilyRideFunction( int meindex, int petindex, int petid ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/familyridefunction.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FamilyRideFunction"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + + //η + lua_pushnumber(lua,meindex); + lua_pushnumber(lua,petindex); + lua_pushnumber(lua,petid); + + if (lua_pcall(lua, 3, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} +#endif + +#ifdef _ALLBLUES_LUA_1_5 +BOOL NetLoopFunction( void ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "NetLoopFunction"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + docall(mylua->lua, 0, 1); + mylua = mylua->next; + } + + return TRUE; +} + +BOOL FreeCharCreate( int charaindex ) +{ + static lua_State *lua; + + + if (lua == NULL){ + lua = FindLua("data/ablua/freecharcreate.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FreeCharCreate"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + //η + lua_pushnumber(lua,charaindex); + + docall(lua, 1, 1); + + return TRUE; +} + +BOOL FreeCharLogin( int charaindex ) +{ + static lua_State *lua; + + + if (lua == NULL){ + lua = FindLua("data/ablua/freecharlogin.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FreeCharLogin"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + //η + lua_pushnumber(lua,charaindex); + + docall(lua, 1, 1); + + return TRUE; +} + + +BOOL FreeVsPlayer( int charaindex, int toindex ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/freevsplayer.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FreeVsPlayer"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + //η + lua_pushnumber(lua,charaindex); + lua_pushnumber(lua,toindex); + + if (lua_pcall(lua, 2, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} + +BOOL FreePartyJoin( int charaindex, int toindex ) +{ + MY_Lua *mylua = &MYLua; + while(mylua->lua != NULL){ + lua_getglobal(mylua->lua, "FreePartyJoin"); + + if (!lua_isfunction(mylua->lua, -1)) { + lua_pop(mylua->lua, 1); + mylua = mylua->next; + continue; + } + //η + lua_pushnumber(mylua->lua,charaindex); + lua_pushnumber(mylua->lua,toindex); + + if (lua_pcall(mylua->lua, 2, 1, 0) != 0) + error(mylua->lua, "error running function `f': %s", lua_tostring(mylua->lua, -1)); + + + if (!lua_isnumber(mylua->lua, -1)) + error(mylua->lua, "function `f' must return a number"); + + int ret = lua_tonumber(mylua->lua, -1); + lua_pop(mylua->lua, 1); + if(ret == FALSE){ + return FALSE; + } + + mylua = mylua->next; + } + + return TRUE; +} +#endif + +#ifdef _ALLBLUES_LUA_1_4 + +BOOL RunCharLogOutEvent( int charaindex) +{ + lua_State *lua = CHAR_getLUAFunction(charaindex, CHAR_LOGINOUTFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + + docall(lua, 1, 1); + + return TRUE; +} + +BOOL BattleFinish( int battleindex, int charaindex) +{ + lua_State *lua = BATTLE_getLUAFunction(battleindex, BATTLE_FINISH); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + + docall(lua, 1, 1); + + return TRUE; +} + +BOOL BattleEscape( int battleindex, int charaindex) +{ + lua_State *lua = BATTLE_getLUAFunction(battleindex, BATTLE_ESCAPE); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + + docall(lua, 1, 1); + + return TRUE; +} +#endif +/* +#ifdef _OFFLINE_SYSTEM +BOOL OffLineCommand( int battleindex, int charaindex, int side) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/offlinecommand.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "OffLineCommand"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + //η + lua_pushnumber(lua,battleindex); + lua_pushnumber(lua,charaindex); + lua_pushnumber(lua,side); + + docall(lua, 3, 1); + + return TRUE; +} +#endif +*/ +#ifdef _PETSKILL_SHOP_LUA +BOOL FreePetSkillShop( int talkerindex, int petindex, int oldSkillID, int newSkillID) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/freepetskillshop.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "FreePetSkillShop"); + + if (!lua_isfunction(lua, -1)) { + return TRUE; + } + //η + lua_pushnumber(lua,talkerindex); + lua_pushnumber(lua,petindex); + lua_pushnumber(lua,oldSkillID); + lua_pushnumber(lua,newSkillID); + + if (lua_pcall(lua, 4, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = lua_tonumber(lua, -1); + lua_pop(lua, 1); + return ret; +} +#endif + +#ifdef _ALLBLUES_LUA_1_2 +BOOL RunUseChatMagic( int charaindex, char *data, lua_State *lua) +{ + if(lua == NULL)return FALSE; + + //η + lua_pushnumber(lua, charaindex); + lua_pushstring(lua, data); + + docall(lua, 2, 1); + + return TRUE; +} + + +BOOL RunItemUseEvent( int itemindex, int charaindex, int toindex, int haveitemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_USEFUNC); + if ( lua == NULL) { + return FALSE; + } + + //ηĸ + lua_pushnumber(lua, itemindex); + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, toindex); + lua_pushnumber(lua, haveitemindex); + + docall(lua, 4, 1); + + return TRUE; +} + +BOOL RunItemDieReLifeEvent( int charaindex, int itemindex, int haveitemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_DIERELIFEFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + lua_pushnumber(lua, haveitemindex); + + docall(lua, 3, 1); + + return TRUE; +} + +BOOL RunItemDetachEvent( int charaindex, int itemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_DETACHFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunItemAttachEvent( int charaindex, int itemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_ATTACHFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunItemPickupEvent( int charaindex, int itemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_PICKUPFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunItemPostOverEvent( int itemindex, int charaindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_POSTOVERFUNC); + if ( lua == NULL) { + return FALSE; + } + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunItemPreOverEvent( int itemindex, int charaindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_PREOVERFUNC); + if ( lua == NULL) { + return FALSE; + } + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunItemDropEvent( int charaindex, int itemindex ) +{ + lua_State *lua = ITEM_getLUAFunction(itemindex, ITEM_DROPFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, charaindex); + lua_pushnumber(lua, itemindex); + + docall(lua, 2, 1); + + return TRUE; +} + +#endif + + +BOOL RunCharTalkedEvent(int meindex, int toindex, char *messageeraseescape, int color, int channel) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_TALKEDFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua,meindex); + lua_pushnumber(lua,toindex); + lua_pushstring(lua,messageeraseescape); + lua_pushnumber(lua,color); + lua_pushnumber(lua,channel); + + docall(lua, 5, 1); + + return TRUE; +} + + +BOOL RunCharLoopEvent(int meindex) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_LOOPFUNC); + if ( lua == NULL) { + return FALSE; + } + + //ηһ + lua_pushnumber(lua,meindex); + docall(lua, 1, 1); + + return TRUE; +} + +BOOL RunCharOverlapEvent( int meindex, int toindex) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_OVERLAPEDFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, meindex); + lua_pushnumber(lua, toindex); + docall(lua, 2, 1); + + return TRUE; +} + +BOOL RunCharBattleOverEvent( int meindex, int battleindex, int iswin) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_BATTLEOVERDFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, meindex); + lua_pushnumber(lua, battleindex); + lua_pushnumber(lua, iswin); + docall(lua, 3, 1); + + return TRUE; +} + +BOOL RunCharWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + lua_State *lua = CHAR_getLUAFunction(meindex, CHAR_WINDOWTALKEDFUNC); + if ( lua == NULL) { + return FALSE; + } + + //η + lua_pushnumber(lua, meindex); + lua_pushnumber(lua, talkerindex); + lua_pushnumber(lua, seqno); + lua_pushnumber(lua, select); + lua_pushstring(lua, data); + + docall(lua, 5, 1); + + return TRUE; +} + +BOOL fameButton( int index) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/fameButton.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "fameButton"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + //η1 + lua_pushnumber(lua,index); + + if (lua_pcall(lua, 1, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + BOOL ret = (BOOL)lua_toboolean(lua, -1); + lua_pop(lua, 1); + return ret; + +} + +#ifdef _ALLBLUES_LUA_2_0 + +BOOL FreeModeExp(int charaindex, int exp ) +{ + //printf("exp1 = %d \n",exp); + static lua_State *lua; + if (lua == NULL){ + lua = FindLua("data/ablua/freemodeexp.lua"); + if (lua == NULL)return FALSE; + } + lua_getglobal(lua, "FreeModeExp"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + int TM_Ret = 0; + + lua_pushnumber(lua,charaindex); + lua_pushinteger(lua, (lua_Integer)exp); + + TM_Ret = lua_pcall(lua, 2, 0, 0); + if(TM_Ret != 0) + { + print("FreeCharExpSave Lua Err :%d(%s)\n", TM_Ret, lua_tostring(lua, -1)); + lua_pop(lua, 1); + + exp = &TM_Ret; + return exp; + + } +} + +/* +BOOL FreeModeExp(int charaindex,int* addexp, int getexp, int modexp ) +{ + static lua_State *lua; + if (lua == NULL){ + lua = FindLua("data/ablua/freemodeexp.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FreeModeExp"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + lua_pushnumber(lua,charaindex); + lua_pushnumber(lua,getexp); + lua_pushnumber(lua,modexp); + + if (lua_pcall(lua, 3, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + if (!lua_isnumber(lua, -1)) + error(lua, "function `f' must return a number"); + + int ret = -1; + ret = lua_tonumber(lua, -1); + + lua_pop(lua, 1); + if(ret == -1 || ret == 0 ) return FALSE; + else{ + addexp = &ret; + return TRUE; + } +} +*/ +/*BOOL FreeLoginCheck(int fd) +{ + static lua_State *lua; + if (lua == NULL){ + lua = FindLua("data/ablua/freelogincheck.lua"); + if (lua == NULL)return FALSE; + } + + lua_getglobal(lua, "FreeLoginCheck"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return FALSE; + } + lua_pushnumber(lua,fd); + + if (lua_pcall(lua, 1, 1, 0) != 0) + error(lua, "error running function `f': %s", lua_tostring(lua, -1)); + + BOOL ret = (BOOL)lua_toboolean(lua, -1); + lua_pop(lua, 1); + return ret; +} +*/ + +#ifdef _CAX_ESC_REPORT +void report1( int charaindex ){ + int fd,itemindex,emptyitemindexinchara,count,countReport = 0,i; + char token[256]; + if( (fd = getfdFromCharaIndex( charaindex)) == -1 ) return; + if(CHAR_getInt(charaindex,CHAR_TRANSMIGRATION) < getReportTa() || + (CHAR_getInt(charaindex,CHAR_TRANSMIGRATION) >= getReportTa() && CHAR_getInt(charaindex,CHAR_LV) < getReportLv())){ + sprintf( token, "\n\n\n ÿǩֻ%dת%dϵҿš", getReportTa(),getReportLv()); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,token); + return; + } + //жǷǩ + int day; + time_t t; + struct tm *local; + t=time(NULL); + local=localtime(&t); + day = (local->tm_year+1900) * 10000 + (local->tm_mon+1) * 100 + local->tm_mday; + if(CHAR_getInt(charaindex,CHAR_REPORT) == day){//Ѿǩ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n Ѿǩˣ"); + return; + } + + //========ͨǩ========= + if(CHAR_getInt( charaindex , CHAR_VIPRIDE)== 0){ + //ұո + count = CHAR_findSurplusItemBox( charaindex ); + //Ʒ + for (i = 0; i < 10; i++) { + if(getReportItem(i) !=-1){ + countReport++; + } + } + if(count < countReport){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n ռλ㡣"); + return; + } + for (i = 0; i < 10; i++) { + if(getReportItem(i) !=-1){ + #ifdef _ITEM_UP + itemindex = ITEM_makeItemAndRegist( getReportItem(i) , charaindex);//ȡһ + #else + itemindex = ITEM_makeItemAndRegist( getReportItem(i) );//ȡһ + #endif + if( itemindex != -1 ){ + emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex );//ȡռ + if( emptyitemindexinchara < 0 ){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n ռλ㡣"); + return; + } + CHAR_setItemIndex(charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + sprintf( token, "%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_setInt(charaindex,CHAR_REPORT,day); + } + } + } + }else{ + //========VIPǩ========= + //ұո + count = CHAR_findSurplusItemBox( charaindex ); + //Ʒ + for (i = 0; i < 10; i++) { + if(getVipReportItem(i) !=-1){ + countReport++; + } + } + if(count < countReport){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n ռλ㡣"); + return; + } + for (i = 0; i < 10; i++) { + if(getVipReportItem(i) !=-1){ + #ifdef _ITEM_UP + itemindex = ITEM_makeItemAndRegist( getVipReportItem(i) , charaindex );//ȡһ + #else + itemindex = ITEM_makeItemAndRegist( getVipReportItem(i) );//ȡһ + #endif + if( itemindex != -1 ){ + emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex );//ȡռ + if( emptyitemindexinchara < 0 ){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n ռλ㡣"); + return; + } + CHAR_setItemIndex(charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + sprintf( token, "õ%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + CHAR_setInt(charaindex,CHAR_REPORT,day); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\n\n ǩɹӭǩ"); + } + } + } + } + CHAR_charSaveFromConnect(fd,FALSE); + } +#endif + +#ifdef _CAX_ESC_SAVE_DATA +void SaveData(int charaindex){ + int fd; + if( (fd = getfdFromCharaIndex( charaindex)) == -1 ) return; + //int ownerindex = CHAR_getWorkInt(petindex, CHAR_WORKPLAYERINDEX); + CHAR_charSaveFromConnect(charaindex,FALSE); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,-1,-1,"\n\nԶ浵ɹ"); +} +#endif + +BOOL FreeSamenu(int* function,int id, int charaindex ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/freesamenu.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "ESC_Recv"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + int TM_Ret = 0; +#ifdef _CAX_ESC_REPORT + if ( id == 6){ + report1(charaindex); + //CHAR_talkToCli(charaindex,-1,"Ƿڲִ",CHAR_COLORRED); + return; + } +#endif +#ifdef _CAX_ESC_SAVE_DATA + if ( id == 7){ + SaveData(charaindex); + //CHAR_talkToCli(charaindex,-1,"Ƿڲִ",CHAR_COLORRED); + return; + } +#endif + //η + //lua_pushstring(lua,message); + lua_getglobal(lua, (const char*)function); + lua_pushinteger(lua, (lua_Integer)id); + lua_pushnumber(lua,charaindex); + TM_Ret = lua_pcall(lua, 2, 0, 0); + if(TM_Ret != 0) + { + print("NPC_Lua_ESC_Recv Lua Err :%d(%s)\n", TM_Ret, lua_tostring(lua, -1)); + lua_pop(lua, 1); + return; + } +} +/* +BOOL TeacherButton(int* function,int charaindex ) +{ + static lua_State *lua; + + if (lua == NULL){ + lua = FindLua("data/ablua/TeacherButton.lua"); + if (lua == NULL)return TRUE; + } + + lua_getglobal(lua, "TeacherButton"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + int TM_Ret = 0; + //η + //lua_pushstring(lua,message); + lua_getglobal(lua, (const char*)function); + lua_pushinteger(lua, (lua_Integer)charaindex); + TM_Ret = lua_pcall(lua, 1, 0, 0); + if(TM_Ret != 0) + { + print("TeacherButton Lua Err :%d(%s)\n", TM_Ret, lua_tostring(lua, -1)); + lua_pop(lua, 1); + return; + } +} + +*/ + +BOOL FreeCharExpSave(int charaindex, int exp ) +{ + //printf("exp1 = %d \n",exp); + static lua_State *lua; + if (lua == NULL){ + lua = FindLua("data/ablua/freecharexpsave.lua"); + if (lua == NULL)return FALSE; + } + lua_getglobal(lua, "FreeCharExpSave"); + + if (!lua_isfunction(lua, -1)) { + lua_pop(lua, 1); + return TRUE; + } + int TM_Ret = 0; + + lua_pushnumber(lua,charaindex); + lua_pushinteger(lua, (lua_Integer)exp); + + TM_Ret = lua_pcall(lua, 2, 0, 0); + if(TM_Ret != 0) + { + print("FreeCharExpSave Lua Err :%d(%s)\n", TM_Ret, lua_tostring(lua, -1)); + lua_pop(lua, 1); + return; + } +} + +#endif + +#endif + + diff --git a/mylua/init.c b/mylua/init.c new file mode 100644 index 0000000..79133d9 --- /dev/null +++ b/mylua/init.c @@ -0,0 +1,59 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" +#include "mylua/base.h" + +static const luaL_Reg lualibs[] = { + {"char", luaopen_Char}, + {"npc", luaopen_NPC}, + {"lssproto", luaopen_Lssproto}, + {"battle", luaopen_Battle}, + {"obj", luaopen_Object}, +#ifdef _ALLBLUES_LUA_1_1 + {"map", luaopen_Map}, + {"other", luaopen_Other}, + {"config", luaopen_Config}, +#endif +#ifdef _ALLBLUES_LUA_1_2 + {"item", luaopen_Item}, + {"magic", luaopen_Magic}, +#endif +#ifdef _OFFLINE_SYSTEM + {"offline", luaopen_Offline}, +#endif +#ifdef _ALLBLUES_LUA_1_4 + {"enemytemp", luaopen_Enemytemp}, +#ifdef _SASQL + {"sasql", luaopen_Sasql}, +#endif +#endif + {"net", luaopen_Net}, + {"saacproto", luaopen_Saacproto}, +#ifdef _ALLBLUES_LUA_1_8 + {"family", luaopen_Family}, + {"petskill", luaopen_PetSkill}, +#endif + {NULL, NULL} +}; + + +LUALIB_API void luaAB_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/mylua/itembase.c b/mylua/itembase.c new file mode 100644 index 0000000..11d4e53 --- /dev/null +++ b/mylua/itembase.c @@ -0,0 +1,360 @@ +#include +#include "common.h" +#include "char_base.h" +#include "mylua/base.h" +#include "char.h" +#include "item.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" + +#ifdef _ALLBLUES_LUA_1_2 +#include "mylua/mylua.h" +extern MY_Lua MYLua; +static CharBase ItemBaseInt[] = { + {{""}, ITEM_ID} + ,{{"ͼ"}, ITEM_BASEIMAGENUMBER} + ,{{"ֵ"}, ITEM_COST} + ,{{""}, ITEM_TYPE} + ,{{"ʹ"}, ITEM_ABLEUSEFIELD} + ,{{"Ŀ"}, ITEM_TARGET} + ,{{"ȼ"}, ITEM_LEVEL} + ,{{""}, ITEM_DAMAGEBREAK} + ,{{"ѵ"}, ITEM_USEPILENUMS} + ,{{"ص"}, ITEM_CANBEPILE} + ,{{"蹥"}, ITEM_NEEDSTR} + ,{{""}, ITEM_NEEDDEX} + ,{{"ת"}, ITEM_NEEDTRANS} + ,{{"ְҵ"}, ITEM_NEEDPROFESSION} +#ifdef _TAKE_ITEMDAMAGE + ,{{"С"}, ITEM_DAMAGECRUSHE} + ,{{""}, ITEM_MAXDAMAGECRUSHE} +#endif + ,{{""}, ITEM_OTHERDAMAGE} + ,{{""}, ITEM_OTHERDEFC} + ,{{"װ"}, ITEM_SUITCODE} + ,{{"С"}, ITEM_ATTACKNUM_MIN} + ,{{"󹥻"}, ITEM_ATTACKNUM_MAX} + ,{{""}, ITEM_MODIFYATTACK} + ,{{""}, ITEM_MODIFYDEFENCE} + ,{{""}, ITEM_MODIFYQUICK} + ,{{"HP"}, ITEM_MODIFYHP} + ,{{"MP"}, ITEM_MODIFYMP} + ,{{""}, ITEM_MODIFYLUCK} + ,{{""}, ITEM_MODIFYCHARM} + ,{{"ر"}, ITEM_MODIFYAVOID} + ,{{""}, ITEM_MODIFYATTRIB} + ,{{"Ա"}, ITEM_MODIFYATTRIBVALUE} + ,{{""}, ITEM_MAGICID} + ,{{"о"}, ITEM_MAGICPROB} + ,{{"MP"}, ITEM_MAGICUSEMP} + ,{{""}, ITEM_MODIFYARRANGE} + ,{{""}, ITEM_MODIFYSEQUENCE} + ,{{""}, ITEM_ATTACHPILE} + ,{{""}, ITEM_HITRIGHT} + ,{{""}, ITEM_NEGLECTGUARD} + ,{{""}, ITEM_POISON} + ,{{""}, ITEM_PARALYSIS} + ,{{"˯"}, ITEM_SLEEP} + ,{{"ʯ"}, ITEM_STONE} + ,{{""}, ITEM_DRUNK} + ,{{""}, ITEM_CONFUSION} + ,{{""}, ITEM_CRITICAL} + ,{{""}, ITEM_USEACTION} + ,{{"dzʧ"}, ITEM_DROPATLOGOUT} + ,{{"ʧ"}, ITEM_VANISHATDROP} + ,{{""}, ITEM_ISOVERED} + ,{{"ʼ"}, ITEM_CANPETMAIL} + ,{{"ϳɴ"}, ITEM_CANMERGEFROM} + ,{{"ϳ"}, ITEM_CANMERGETO} + ,{{"0"}, ITEM_INGVALUE0} + ,{{"1"}, ITEM_INGVALUE1} + ,{{"2"}, ITEM_INGVALUE2} + ,{{"3"}, ITEM_INGVALUE3} + ,{{"4"}, ITEM_INGVALUE4} + ,{{"ɫ"}, ITEM_COLOER} + ,{{"Ʒȼ"}, ITEM_LEAKLEVEL} + +}; + +static CharBase ItemBaseChar[] = { + {{""}, ITEM_NAME} + ,{{"ʾ"}, ITEM_SECRETNAME} + ,{{"˵"}, ITEM_EFFECTSTRING} + ,{{"ֶ"}, ITEM_ARGUMENT} + ,{{"ɷ0"}, ITEM_INGNAME0} + ,{{"ɷ1"}, ITEM_INGNAME1} + ,{{"ɷ2"}, ITEM_INGNAME2} + ,{{"ɷ3"}, ITEM_INGNAME3} + ,{{"ɷ4"}, ITEM_INGNAME4} +#ifdef _ANGEL_SUMMON + ,{{""}, ITEM_ANGELMISSION} + ,{{"ʹ"}, ITEM_ANGELINFO} + ,{{"Ӣ"}, ITEM_HEROINFO} +#endif + +}; + +static CharBase ItemBaseValue[] = { + {{"צ"}, ITEM_FIST} + ,{{""}, ITEM_AXE} + ,{{""}, ITEM_CLUB} + ,{{"ǹ"}, ITEM_SPEAR} + ,{{""}, ITEM_BOW} + ,{{""}, ITEM_SHIELD} + ,{{""}, ITEM_HELM} + ,{{""}, ITEM_ARMOUR} + ,{{""}, ITEM_BRACELET} + ,{{""}, ITEM_MUSIC} + ,{{""}, ITEM_NECKLACE} + ,{{""}, ITEM_RING} + ,{{""}, ITEM_BELT} + ,{{""}, ITEM_EARRING} + ,{{"ǻ"}, ITEM_NOSERING} + ,{{""}, ITEM_AMULET} + ,{{""}, ITEM_OTHER} + ,{{""}, ITEM_BOOMERANG} + ,{{"Ͷ"}, ITEM_BOUNDTHROW} + ,{{"Ͷʯ"}, ITEM_BREAKTHROW} + ,{{""}, ITEM_DISH} +#ifdef _ITEM_INSLAY + ,{{""}, ITEM_METAL} + ,{{"ʯ"}, ITEM_JEWEL} +#endif +#ifdef _ITEM_CHECKWARES + ,{{""}, ITEM_WARES} +#endif +#ifdef _ITEM_EQUITSPACE + ,{{""}, ITEM_WBELT} + ,{{""}, ITEM_WSHIELD} + ,{{"Ь"}, ITEM_WSHOES} +#endif +#ifdef _EQUIT_NEWGLOVE + ,{{""}, ITEM_WGLOVE} +#endif +#ifdef _ALCHEMIST + ,{{""}, ITEM_ALCHEMIST} +#endif +#ifdef _PET_ITEM + ,{{"ͷ"}, ITEM_PET_HEAD} + ,{{""}, ITEM_PET_TOOTH} + ,{{"צ"}, ITEM_PET_CLAW} + ,{{""}, ITEM_PET_BREAST} + ,{{"豳"}, ITEM_PET_BACK} + ,{{""}, ITEM_PET_WING} + ,{{""}, ITEM_PET_FEET} +#endif +}; + +static CharBase ItemBaseWorkInt[] = { + {{""}, ITEM_WORKOBJINDEX} + ,{{""}, ITEM_WORKCHARAINDEX} +}; + +static CharBase ItemBaseEvent[] = { + {{"δ֪¼"}, ITEM_PREOVERFUNC} + ,{{"ʼ¼"}, ITEM_POSTOVERFUNC} + ,{{"ʹ¼"}, ITEM_USEFUNC} + ,{{"װ¼"}, ITEM_ATTACHFUNC} + ,{{"ж¼"}, ITEM_DETACHFUNC} + ,{{"¼"}, ITEM_DROPFUNC} + ,{{"¼"}, ITEM_PICKUPFUNC} + ,{{"¼"}, ITEM_DIERELIFEFUNC} +}; + +static int getInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseInt, arraysizeof(ItemBaseInt)); + + lua_pushinteger(L, ITEM_getInt(index, element)); + return 1; +} + +static int setInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseInt, arraysizeof(ItemBaseInt)); + const int data = luaL_checkint(L, 3); + + if(ITEM_setInt(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getChar(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseChar, arraysizeof(ItemBaseChar)); + + lua_pushstring(L, ITEM_getChar(index, element)); + return 1; +} + +static int setChar(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseChar, arraysizeof(ItemBaseChar)); + char *data = luaL_checklstring(L, 3, &l); + + if(ITEM_setChar(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getWorkInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseWorkInt, arraysizeof(ItemBaseWorkInt)); + + lua_pushinteger(L, ITEM_getWorkInt(index, element)); + return 1; +} + +static int setWorkInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, ItemBaseWorkInt, arraysizeof(ItemBaseWorkInt)); + const int data = luaL_checkint(L, 3); + + if(ITEM_setWorkInt(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getNameFromNumber(lua_State *L) +{ + const int id = luaL_checkint(L, 1); + + lua_pushstring(L, ITEM_getNameFromNumber(id)); + + return 1; +} + +static int getcostFromITEMtabl(lua_State *L) +{ + const int id = luaL_checkint(L, 1); + + lua_pushinteger(L, ITEM_getcostFromITEMtabl(id)); + + return 1; +} + +static int getlevelFromITEMtabl(lua_State *L) +{ + const int id = luaL_checkint(L, 1); + + lua_pushinteger(L, ITEM_getlevelFromITEMtabl(id)); + + return 1; +} + +static int getgraNoFromITEMtabl(lua_State *L) +{ + const int id = luaL_checkint(L, 1); + + lua_pushinteger(L, ITEM_getgraNoFromITEMtabl(id)); + + return 1; +} + +static int getItemInfoFromNumber(lua_State *L) +{ + const int id = luaL_checkint(L, 1); + + lua_pushstring(L, ITEM_getItemInfoFromNumber(id)); + + return 1; +} + +static int setFunctionPointer(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int functype = getCharBaseValue(L, 2, ItemBaseEvent, arraysizeof(ItemBaseEvent)); + char *luafuncname=luaL_checklstring(L, 3, &l); + + return ITEM_setLUAFunction( index, functype, luafuncname ); +} + +static int addLUAListFunction(lua_State *L) +{ + size_t l; + char *luafuncname=luaL_checklstring(L, 1, &l); + char *luafunctable=luaL_checklstring(L, 2, &l); + char *luafunctablepath=luaL_checklstring(L, 3, &l); + + if(strlen(luafunctablepath) > 0){ + MY_Lua *mylua = &MYLua; + while(mylua->next != NULL){ + if(strcmp(mylua->luapath, luafunctablepath) == 0){ + return ITEM_addLUAListFunction( mylua->lua, luafuncname, luafunctable); + } + mylua = mylua->next; + } + }else{ + return ITEM_addLUAListFunction( L, luafuncname, luafunctable ); + } + return 1; +} + +static int UpdataItemOne(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int itemindex = luaL_checkint(L, 2); + + int i; + for( i = 0; i < CHAR_MAXITEMHAVE ; i++ ){ + if(itemindex == CHAR_getItemIndex( charaindex , i )){ + CHAR_sendItemDataOne( charaindex, i); + break; + } + } + + return 1; +} + +static int UpdataHaveItemOne(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int haveitemindex = luaL_checkint(L, 2); + + CHAR_sendItemDataOne( charaindex, haveitemindex); + + return 1; +} + +static const luaL_Reg itemlib[] = { + {"getInt", getInt}, + {"setInt", setInt}, + {"getChar", getChar}, + {"setChar", setChar}, + {"getWorkInt", getWorkInt}, + {"setWorkInt", setWorkInt}, + {"setFunctionPointer", setFunctionPointer}, + {"addLUAListFunction", addLUAListFunction}, + {"getNameFromNumber", getNameFromNumber}, + {"getcostFromITEMtabl", getcostFromITEMtabl}, + {"getlevelFromITEMtabl", getlevelFromITEMtabl}, + {"getgraNoFromITEMtabl", getgraNoFromITEMtabl}, + {"getItemInfoFromNumber", getItemInfoFromNumber}, + {"UpdataItemOne", UpdataItemOne}, + {"UpdataHaveItemOne", UpdataHaveItemOne}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Item (lua_State *L) { + luaL_register(L, "item", itemlib); + return 1; +} + +#endif + diff --git a/mylua/lssprotobase.c b/mylua/lssprotobase.c new file mode 100644 index 0000000..38edf23 --- /dev/null +++ b/mylua/lssprotobase.c @@ -0,0 +1,196 @@ +#include +#include "char.h" +#include "char_base.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" +#ifdef _ALLBLUES_LUA_2_0 +#include "autil.h" +#endif +#ifdef _ALLBLUES_LUA + + +#define WINDOW_BUTTONTYPE_NONE (0) +#define WINDOW_BUTTONTYPE_OK (1 << 0) +#define WINDOW_BUTTONTYPE_CANCEL (1 << 1) +#define WINDOW_BUTTONTYPE_YES (1 << 2) +#define WINDOW_BUTTONTYPE_NO (1 << 3) +#define WINDOW_BUTTONTYPE_PREV (1 << 4) +#define WINDOW_BUTTONTYPE_NEXT (1 << 5) + +#define WINDOW_BUTTONTYPE_OKCANCEL (WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL) +#define WINDOW_BUTTONTYPE_YESNO (WINDOW_BUTTONTYPE_YES | WINDOW_BUTTONTYPE_NO) + + +static CharBase CharBaseWindow[] = { + {{"Ի"}, WINDOW_MESSAGETYPE_MESSAGE} + ,{{""}, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT} + ,{{"ѡ"}, WINDOW_MESSAGETYPE_SELECT} + ,{{""}, WINDOW_MESSAGETYPE_PETSELECT} + ,{{"߿"}, WINDOW_MESSAGETYPE_ITEMSHOPMENU} + ,{{"߿"}, WINDOW_MESSAGETYPE_ITEMSHOPMAIN} + ,{{"ѧܿ"}, WINDOW_MESSAGETYPE_PETSKILLSHOP} +#ifdef _NEW_MANOR_LAW + ,{{"ʮƼ"}, WINDOW_FMMESSAGETYPE_10_MEMONTUM} + ,{{"б"}, WINDOW_FMMESSAGETYPE_FM_MEMONTUM} +#endif + ,{{"Աб"}, WINDOW_FMMESSAGETYPE_DENGON} + ,{{"ׯ԰б"}, WINDOW_FMMESSAGETYPE_POINTLIST} + ,{{"ǰб"}, WINDOW_FMMESSAGETYPE_TOP30DP} + ,{{"п"}, WINDOW_MESSAGETYPE_BANK} + ,{{"Ի"}, WINDOW_MESSAGETYPE_WIDEMESSAGE} + ,{{""}, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT} + +}; + +static CharBase CharBaseButton[] = { + {{"ްť"}, WINDOW_BUTTONTYPE_NONE} + ,{{"ȷ"}, WINDOW_BUTTONTYPE_OK} + ,{{"ȡ"}, WINDOW_BUTTONTYPE_CANCEL} + ,{{"YES"}, WINDOW_BUTTONTYPE_YES} + ,{{"NO"}, WINDOW_BUTTONTYPE_NO} + ,{{"һҳ"}, WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL} + ,{{"һҳ"}, WINDOW_BUTTONTYPE_NEXT|WINDOW_BUTTONTYPE_CANCEL} +}; + +static CharBase CharBaseSeqNo[] = { + {{""}, -1} +#ifdef _NEW_STREET_VENDOR + ,{{"̯"}, CHAR_WINDOWTYPE_STREET_VENDOR_TYPE} +#endif +#ifdef _PETSKILL_CANNEDFOOD + ,{{"\ѡ"}, ITEM_WINDOWTYPE_SELECTPETSKILL_SELECT} +#endif +#ifdef _ITEM_OVER_LAP + ,{{"ص"}, CHAR_WINDOWTYPE_ITEMOVERLAP} +#endif +}; + + +static int windows_send(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(index) == FALSE) return 0; + int fd = getfdFromCharaIndex( index); + const int windowtype = getCharBaseValue(L, 2, CharBaseWindow, arraysizeof(CharBaseWindow)); + const int buttontype = getCharBaseValue(L, 3, CharBaseButton, arraysizeof(CharBaseButton)); + const int seqno = getCharBaseValue(L, 4, CharBaseSeqNo, arraysizeof(CharBaseSeqNo)); + const int objindex=luaL_checkint(L, 5); + char *data=luaL_checklstring(L, 6, &l); + + + lssproto_WN_send(fd, windowtype, buttontype, seqno, objindex, data); + return 1; +} + +static int show(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(index) == FALSE) return 0; + int fd = getfdFromCharaIndex( index); + char *data=luaL_checklstring(L, 2, &l); + + + lssproto_C_send(fd, data); + return 1; +} + +static int FM(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(index) == FALSE) return 0; + int fd = getfdFromCharaIndex( index); + char *data=luaL_checklstring(L, 2, &l); + + lssproto_FM_send(fd, data); + return 1; +} + +static int S2(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(index) == FALSE) return 0; + int fd = getfdFromCharaIndex( index); + char *data=luaL_checklstring(L, 2, &l); + + lssproto_S2_send(fd, data); + return 1; +} + +#ifdef _ALLBLUES_LUA_2_0 +/* +static int CharList(lua_State *L) +{ + int fd = luaL_checkint(L, 1); + size_t l; + char *data=luaL_checklstring(L, 2, &l); + char buffer[1024 * 64]; + int checksum=0; + + strcpy(buffer,""); + checksum += util_mkstring(fd,buffer, "failed"); + checksum += util_mkstring(fd,buffer, data); + util_mkint(fd,buffer, checksum); + printf("data = %s\n",data); + util_SendMesg(fd, LSSPROTO_CLIENTLOGIN_SEND, buffer); + return 1; +} +*/ +static int CharList(lua_State *L) +{ + size_t l; + const int fd = luaL_checkint(L, 1); + char *data=luaL_checklstring(L, 2, &l); + + lssproto_CharList_send(fd, FAILED, data); + return 1; +} + +#ifdef _CAX_DENGON_GG +static int dengon(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + if(CHAR_CHECKINDEX(index) == FALSE) return 0; + int fd = getfdFromCharaIndex( index); + char *data=luaL_checklstring(L, 2, &l); + const int color=luaL_checkint(L, 3); + const int num=luaL_checkint(L, 4); + + lssproto_DENGON_send(fd, data, color, num); + return 1; +} +#endif + +#endif + + + + +static const luaL_Reg lssprotolib[] = { + {"windows", windows_send}, + {"show", show}, + {"FM", FM}, + {"S2", S2}, +#ifdef _ALLBLUES_LUA_2_0 + {"CharList", CharList}, +#ifdef _CAX_DENGON_GG + {"dengon", dengon}, +#endif +#endif + {NULL, NULL} +}; + +LUALIB_API int luaopen_Lssproto (lua_State *L) { + luaL_register(L, "lssproto", lssprotolib); + return 1; +} + +#endif + diff --git a/mylua/lua/Makefile b/mylua/lua/Makefile new file mode 100644 index 0000000..f7d884e --- /dev/null +++ b/mylua/lua/Makefile @@ -0,0 +1,182 @@ +# makefile for building Lua +# see ../INSTALL for installation instructions +# see ../Makefile and luaconf.h for further customization + +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + +# Your platform. See PLATS for possible values. +PLAT= none + +CC= gcc +CFLAGS=-w -O3 -g -rdynamic $(INCFLAGS) +AR= ar rcu +RANLIB= ranlib +RM= rm -f +LIBS= -lm $(MYLIBS) + +MYCFLAGS= +MYLDFLAGS= +MYLIBS= + +# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= + +PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +LUA_A= liblua.a +CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ + lstrlib.o loadlib.o linit.o + +LUA_T= lua +LUA_O= lua.o + +LUAC_T= luac +LUAC_O= luac.o print.o + +ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) +ALL_A= $(LUA_A) + +default: $(PLAT) + +all: $(ALL_T) + +o: $(ALL_O) + +a: $(ALL_A) + +$(LUA_A): $(CORE_O) $(LIB_O) + $(AR) $@ $? + $(RANLIB) $@ + +$(LUA_T): $(LUA_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + +$(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + +clean: + $(RM) $(ALL_T) $(ALL_O) + +depend: + @$(CC) $(CFLAGS) -MM l*.c print.c + +echo: + @echo "PLAT = $(PLAT)" + @echo "CC = $(CC)" + @echo "CFLAGS = $(CFLAGS)" + @echo "AR = $(AR)" + @echo "RANLIB = $(RANLIB)" + @echo "RM = $(RM)" + @echo "MYCFLAGS = $(MYCFLAGS)" + @echo "MYLDFLAGS = $(MYLDFLAGS)" + @echo "MYLIBS = $(MYLIBS)" + +# convenience targets for popular platforms + +none: + @echo "Please choose a platform:" + @echo " $(PLATS)" + +aix: + $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" + +ansi: + $(MAKE) all MYCFLAGS=-DLUA_ANSI + +bsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" + +freebsd: + $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" + +generic: + $(MAKE) all MYCFLAGS= + +linux: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" + +macosx: + $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" +# use this on Mac OS X 10.3- +# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX + +mingw: + $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ + "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe + $(MAKE) "LUAC_T=luac.exe" luac.exe + +posix: + $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX + +solaris: + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" + +# list targets that do not create files (but not all makes understand .PHONY) +.PHONY: all $(PLATS) default o a clean depend echo none + +# DO NOT DELETE + +lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ + lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ + lundump.h lvm.h +lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h +lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h +lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ + ltable.h +ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h +ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ + llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h lvm.h +ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ + ltable.h lundump.h lvm.h +ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h lundump.h +lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ + lstate.h ltm.h lzio.h +lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h +linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h +liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h +llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ + lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h +lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h +lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h +loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h +lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ + ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h +lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h +loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h +lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ + lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ + lfunc.h lstring.h lgc.h ltable.h +lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h +lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ + ltm.h lzio.h lstring.h lgc.h +lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h +ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h +ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h +ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ + lmem.h lstring.h lgc.h ltable.h +lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h +luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ + lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ + lundump.h +lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ + llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h +lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ + lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h +lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ + lzio.h +print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ + ltm.h lzio.h lmem.h lopcodes.h lundump.h + +# (end of Makefile) diff --git a/mylua/lua/lapi.c b/mylua/lua/lapi.c new file mode 100644 index 0000000..84113dd --- /dev/null +++ b/mylua/lua/lapi.c @@ -0,0 +1,1100 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + + +LUA_API void Lua_ReturnArray(lua_State *L,int Array[],int num) +{ + lua_newtable( L ); + int i; + for (i=0;i +#include +#include +#include +#include +#include + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; ifunc, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/mylua/lua/lauxlib.h b/mylua/lua/lauxlib.h new file mode 100644 index 0000000..3425823 --- /dev/null +++ b/mylua/lua/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/mylua/lua/lbaselib.c b/mylua/lua/lbaselib.c new file mode 100644 index 0000000..2a4c079 --- /dev/null +++ b/mylua/lua/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include +#include +#include +#include + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/mylua/lua/lcode.c b/mylua/lua/lcode.c new file mode 100644 index 0000000..cff626b --- /dev/null +++ b/mylua/lua/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/mylua/lua/lcode.h b/mylua/lua/lcode.h new file mode 100644 index 0000000..b941c60 --- /dev/null +++ b/mylua/lua/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/mylua/lua/ldblib.c b/mylua/lua/ldblib.c new file mode 100644 index 0000000..67de122 --- /dev/null +++ b/mylua/lua/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/mylua/lua/ldebug.c b/mylua/lua/ldebug.c new file mode 100644 index 0000000..50ad3d3 --- /dev/null +++ b/mylua/lua/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; il.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/mylua/lua/ldebug.h b/mylua/lua/ldebug.h new file mode 100644 index 0000000..ba28a97 --- /dev/null +++ b/mylua/lua/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/mylua/lua/ldo.c b/mylua/lua/ldo.c new file mode 100644 index 0000000..8de05f7 --- /dev/null +++ b/mylua/lua/ldo.c @@ -0,0 +1,518 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; itop - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; itop++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/mylua/lua/ldo.h b/mylua/lua/ldo.h new file mode 100644 index 0000000..98fddac --- /dev/null +++ b/mylua/lua/ldo.h @@ -0,0 +1,57 @@ +/* +** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + +#ifndef ldo_h +#define ldo_h + + +#include "lobject.h" +#include "lstate.h" +#include "lzio.h" + + +#define luaD_checkstack(L,n) \ + if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ + luaD_growstack(L, n); \ + else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); + + +#define incr_top(L) {luaD_checkstack(L,1); L->top++;} + +#define savestack(L,p) ((char *)(p) - (char *)L->stack) +#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) + +#define saveci(L,p) ((char *)(p) - (char *)L->base_ci) +#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) + + +/* results from luaD_precall */ +#define PCRLUA 0 /* initiated a call to a Lua function */ +#define PCRC 1 /* did a call to a C function */ +#define PCRYIELD 2 /* C funtion yielded */ + + +/* type of protected functions, to be ran by `runprotected' */ +typedef void (*Pfunc) (lua_State *L, void *ud); + +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); + +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); + +LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); + +#endif + diff --git a/mylua/lua/ldump.c b/mylua/lua/ldump.c new file mode 100644 index 0000000..c9d3d48 --- /dev/null +++ b/mylua/lua/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; ik[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; ip[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; ilocvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; iupvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/mylua/lua/lfunc.c b/mylua/lua/lfunc.c new file mode 100644 index 0000000..813e88f --- /dev/null +++ b/mylua/lua/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/mylua/lua/lfunc.h b/mylua/lua/lfunc.h new file mode 100644 index 0000000..a68cf51 --- /dev/null +++ b/mylua/lua/lfunc.h @@ -0,0 +1,34 @@ +/* +** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + +#ifndef lfunc_h +#define lfunc_h + + +#include "lobject.h" + + +#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ + cast(int, sizeof(TValue)*((n)-1))) + +#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ + cast(int, sizeof(TValue *)*((n)-1))) + + +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); + + +#endif diff --git a/mylua/lua/lgc.c b/mylua/lua/lgc.c new file mode 100644 index 0000000..d9e0b78 --- /dev/null +++ b/mylua/lua/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; isizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; isizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; isizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; isizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; ic.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; il.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; imt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/mylua/lua/lgc.h b/mylua/lua/lgc.h new file mode 100644 index 0000000..5a8dc60 --- /dev/null +++ b/mylua/lua/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/mylua/lua/linit.c b/mylua/lua/linit.c new file mode 100644 index 0000000..c1f90df --- /dev/null +++ b/mylua/lua/linit.c @@ -0,0 +1,38 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/mylua/lua/liolib.c b/mylua/lua/liolib.c new file mode 100644 index 0000000..e79ed1c --- /dev/null +++ b/mylua/lua/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/mylua/lua/llex.c b/mylua/lua/llex.c new file mode 100644 index 0000000..6dc3193 --- /dev/null +++ b/mylua/lua/llex.c @@ -0,0 +1,461 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "", "", "", "", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + struct lconv *cv = localeconv(); + char old = ls->decpoint; + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/mylua/lua/llex.h b/mylua/lua/llex.h new file mode 100644 index 0000000..a9201ce --- /dev/null +++ b/mylua/lua/llex.h @@ -0,0 +1,81 @@ +/* +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + +#ifndef llex_h +#define llex_h + +#include "lobject.h" +#include "lzio.h" + + +#define FIRST_RESERVED 257 + +/* maximum length of a reserved word */ +#define TOKEN_LEN (sizeof("function")/sizeof(char)) + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER RESERVED" +*/ +enum RESERVED { + /* terminal symbols denoted by reserved words */ + TK_AND = FIRST_RESERVED, TK_BREAK, + TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, + /* other terminal symbols */ + TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, + TK_NAME, TK_STRING, TK_EOS +}; + +/* number of reserved words */ +#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) + + +/* array with token `names' */ +LUAI_DATA const char *const luaX_tokens []; + + +typedef union { + lua_Number r; + TString *ts; +} SemInfo; /* semantics information */ + + +typedef struct Token { + int token; + SemInfo seminfo; +} Token; + + +typedef struct LexState { + int current; /* current character (charint) */ + int linenumber; /* input line counter */ + int lastline; /* line of last token `consumed' */ + Token t; /* current token */ + Token lookahead; /* look ahead token */ + struct FuncState *fs; /* `FuncState' is private to the parser */ + struct lua_State *L; + ZIO *z; /* input stream */ + Mbuffer *buff; /* buffer for tokens */ + TString *source; /* current source name */ + char decpoint; /* locale decimal point */ +} LexState; + + +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); +LUAI_FUNC void luaX_next (LexState *ls); +LUAI_FUNC void luaX_lookahead (LexState *ls); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); + + +#endif diff --git a/mylua/lua/llimits.h b/mylua/lua/llimits.h new file mode 100644 index 0000000..ca8dcb7 --- /dev/null +++ b/mylua/lua/llimits.h @@ -0,0 +1,128 @@ +/* +** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ +** Limits, basic types, and some other `installation-dependent' definitions +** See Copyright Notice in lua.h +*/ + +#ifndef llimits_h +#define llimits_h + + +#include +#include + + +#include "lua.h" + + +typedef LUAI_UINT32 lu_int32; + +typedef LUAI_UMEM lu_mem; + +typedef LUAI_MEM l_mem; + + + +/* chars used as small naturals (so that `char' is reserved for characters) */ +typedef unsigned char lu_byte; + + +#define MAX_SIZET ((size_t)(~(size_t)0)-2) + +#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) + + +#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ + +/* +** conversion of pointer to integer +** this is for hashing only; there is no problem if the integer +** cannot hold the whole pointer value +*/ +#define IntPoint(p) ((unsigned int)(lu_mem)(p)) + + + +/* type to ensure maximum alignment */ +typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; + + +/* result of a `usual argument conversion' over lua_Number */ +typedef LUAI_UACNUMBER l_uacNumber; + + +/* internal assertions for in-house debugging */ +#ifdef lua_assert + +#define check_exp(c,e) (lua_assert(c), (e)) +#define api_check(l,e) lua_assert(e) + +#else + +#define lua_assert(c) ((void)0) +#define check_exp(c,e) (e) +#define api_check luai_apicheck + +#endif + + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) /* to avoid warnings */ +#endif + + +#ifndef cast +#define cast(t, exp) ((t)(exp)) +#endif + +#define cast_byte(i) cast(lu_byte, (i)) +#define cast_num(i) cast(lua_Number, (i)) +#define cast_int(i) cast(int, (i)) + + + +/* +** type for virtual-machine instructions +** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) +*/ +typedef lu_int32 Instruction; + + + +/* maximum stack for a Lua function */ +#define MAXSTACK 250 + + + +/* minimum size for the string table (must be power of 2) */ +#ifndef MINSTRTABSIZE +#define MINSTRTABSIZE 32 +#endif + + +/* minimum size for string buffer */ +#ifndef LUA_MINBUFFER +#define LUA_MINBUFFER 32 +#endif + + +#ifndef lua_lock +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) +#endif + +#ifndef luai_threadyield +#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#endif + + +/* +** macro to control inclusion of some hard tests on stack reallocation +*/ +#ifndef HARDSTACKTESTS +#define condhardstacktests(x) ((void)0) +#else +#define condhardstacktests(x) x +#endif + +#endif diff --git a/mylua/lua/lmathlib.c b/mylua/lua/lmathlib.c new file mode 100644 index 0000000..441fbf7 --- /dev/null +++ b/mylua/lua/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include +#include + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/mylua/lua/lmem.c b/mylua/lua/lmem.c new file mode 100644 index 0000000..ae7d8c9 --- /dev/null +++ b/mylua/lua/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/mylua/lua/lmem.h b/mylua/lua/lmem.h new file mode 100644 index 0000000..7c2dcb3 --- /dev/null +++ b/mylua/lua/lmem.h @@ -0,0 +1,49 @@ +/* +** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + +#ifndef lmem_h +#define lmem_h + + +#include + +#include "llimits.h" +#include "lua.h" + +#define MEMERRMSG "not enough memory" + + +#define luaM_reallocv(L,b,on,n,e) \ + ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ + luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ + luaM_toobig(L)) + +#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) +#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) +#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) + +#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) +#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) +#define luaM_newvector(L,n,t) \ + cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) + +#define luaM_growvector(L,v,nelems,size,t,limit,e) \ + if ((nelems)+1 > (size)) \ + ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) + +#define luaM_reallocvector(L, v,oldn,n,t) \ + ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) + + +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + +#endif + diff --git a/mylua/lua/loadlib.c b/mylua/lua/loadlib.c new file mode 100644 index 0000000..cbcaf9d --- /dev/null +++ b/mylua/lua/loadlib.c @@ -0,0 +1,667 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include +#include +#include + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/mylua/lua/lobject.c b/mylua/lua/lobject.c new file mode 100644 index 0000000..4ff5073 --- /dev/null +++ b/mylua/lua/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include +#include + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/mylua/lua/lobject.h b/mylua/lua/lobject.h new file mode 100644 index 0000000..f1e447e --- /dev/null +++ b/mylua/lua/lobject.h @@ -0,0 +1,381 @@ +/* +** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $ +** Type definitions for Lua objects +** See Copyright Notice in lua.h +*/ + + +#ifndef lobject_h +#define lobject_h + + +#include + + +#include "llimits.h" +#include "lua.h" + + +/* tags for values visible from Lua */ +#define LAST_TAG LUA_TTHREAD + +#define NUM_TAGS (LAST_TAG+1) + + +/* +** Extra tags for non-values +*/ +#define LUA_TPROTO (LAST_TAG+1) +#define LUA_TUPVAL (LAST_TAG+2) +#define LUA_TDEADKEY (LAST_TAG+3) + + +/* +** Union of all collectable objects +*/ +typedef union GCObject GCObject; + + +/* +** Common Header for all collectable objects (in macro form, to be +** included in other objects) +*/ +#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked + + +/* +** Common header in struct form +*/ +typedef struct GCheader { + CommonHeader; +} GCheader; + + + + +/* +** Union of all Lua values +*/ +typedef union { + GCObject *gc; + void *p; + lua_Number n; + int b; +} Value; + + +/* +** Tagged Values +*/ + +#define TValuefields Value value; int tt + +typedef struct lua_TValue { + TValuefields; +} TValue; + + +/* Macros to test type */ +#define ttisnil(o) (ttype(o) == LUA_TNIL) +#define ttisnumber(o) (ttype(o) == LUA_TNUMBER) +#define ttisstring(o) (ttype(o) == LUA_TSTRING) +#define ttistable(o) (ttype(o) == LUA_TTABLE) +#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION) +#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN) +#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA) +#define ttisthread(o) (ttype(o) == LUA_TTHREAD) +#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA) + +/* Macros to access values */ +#define ttype(o) ((o)->tt) +#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc) +#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p) +#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n) +#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts) +#define tsvalue(o) (&rawtsvalue(o)->tsv) +#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u) +#define uvalue(o) (&rawuvalue(o)->uv) +#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl) +#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h) +#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b) +#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th) + +#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) + +/* +** for internal debug only +*/ +#define checkconsistency(obj) \ + lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt)) + +#define checkliveness(g,obj) \ + lua_assert(!iscollectable(obj) || \ + ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc))) + + +/* Macros to set values */ +#define setnilvalue(obj) ((obj)->tt=LUA_TNIL) + +#define setnvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; } + +#define setpvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } + +#define setbvalue(obj,x) \ + { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; } + +#define setsvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \ + checkliveness(G(L),i_o); } + +#define setuvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \ + checkliveness(G(L),i_o); } + +#define setthvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \ + checkliveness(G(L),i_o); } + +#define setclvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \ + checkliveness(G(L),i_o); } + +#define sethvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \ + checkliveness(G(L),i_o); } + +#define setptvalue(L,obj,x) \ + { TValue *i_o=(obj); \ + i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \ + checkliveness(G(L),i_o); } + + + + +#define setobj(L,obj1,obj2) \ + { const TValue *o2=(obj2); TValue *o1=(obj1); \ + o1->value = o2->value; o1->tt=o2->tt; \ + checkliveness(G(L),o1); } + + +/* +** different types of sets, according to destination +*/ + +/* from stack to (same) stack */ +#define setobjs2s setobj +/* to stack (not from same stack) */ +#define setobj2s setobj +#define setsvalue2s setsvalue +#define sethvalue2s sethvalue +#define setptvalue2s setptvalue +/* from table to same table */ +#define setobjt2t setobj +/* to table */ +#define setobj2t setobj +/* to new object */ +#define setobj2n setobj +#define setsvalue2n setsvalue + +#define setttype(obj, tt) (ttype(obj) = (tt)) + + +#define iscollectable(o) (ttype(o) >= LUA_TSTRING) + + + +typedef TValue *StkId; /* index to stack elements */ + + +/* +** String headers for string table +*/ +typedef union TString { + L_Umaxalign dummy; /* ensures maximum alignment for strings */ + struct { + CommonHeader; + lu_byte reserved; + unsigned int hash; + size_t len; + } tsv; +} TString; + + +#define getstr(ts) cast(const char *, (ts) + 1) +#define svalue(o) getstr(rawtsvalue(o)) + + + +typedef union Udata { + L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ + struct { + CommonHeader; + struct Table *metatable; + struct Table *env; + size_t len; + } uv; +} Udata; + + + + +/* +** Function Prototypes +*/ +typedef struct Proto { + CommonHeader; + TValue *k; /* constants used by the function */ + Instruction *code; + struct Proto **p; /* functions defined inside the function */ + int *lineinfo; /* map from opcodes to source lines */ + struct LocVar *locvars; /* information about local variables */ + TString **upvalues; /* upvalue names */ + TString *source; + int sizeupvalues; + int sizek; /* size of `k' */ + int sizecode; + int sizelineinfo; + int sizep; /* size of `p' */ + int sizelocvars; + int linedefined; + int lastlinedefined; + GCObject *gclist; + lu_byte nups; /* number of upvalues */ + lu_byte numparams; + lu_byte is_vararg; + lu_byte maxstacksize; +} Proto; + + +/* masks for new-style vararg */ +#define VARARG_HASARG 1 +#define VARARG_ISVARARG 2 +#define VARARG_NEEDSARG 4 + + +typedef struct LocVar { + TString *varname; + int startpc; /* first point where variable is active */ + int endpc; /* first point where variable is dead */ +} LocVar; + + + +/* +** Upvalues +*/ + +typedef struct UpVal { + CommonHeader; + TValue *v; /* points to stack or to its own value */ + union { + TValue value; /* the value (when closed) */ + struct { /* double linked list (when open) */ + struct UpVal *prev; + struct UpVal *next; + } l; + } u; +} UpVal; + + +/* +** Closures +*/ + +#define ClosureHeader \ + CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \ + struct Table *env + +typedef struct CClosure { + ClosureHeader; + lua_CFunction f; + TValue upvalue[1]; +} CClosure; + + +typedef struct LClosure { + ClosureHeader; + struct Proto *p; + UpVal *upvals[1]; +} LClosure; + + +typedef union Closure { + CClosure c; + LClosure l; +} Closure; + + +#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC) +#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC) + + +/* +** Tables +*/ + +typedef union TKey { + struct { + TValuefields; + struct Node *next; /* for chaining */ + } nk; + TValue tvk; +} TKey; + + +typedef struct Node { + TValue i_val; + TKey i_key; +} Node; + + +typedef struct Table { + CommonHeader; + lu_byte flags; /* 1<

lsizenode)) + + +#define luaO_nilobject (&luaO_nilobject_) + +LUAI_DATA const TValue luaO_nilobject_; + +#define ceillog2(x) (luaO_log2((x)-1) + 1) + +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); + + +#endif + diff --git a/mylua/lua/lopcodes.c b/mylua/lua/lopcodes.c new file mode 100644 index 0000000..4cc7452 --- /dev/null +++ b/mylua/lua/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/mylua/lua/lopcodes.h b/mylua/lua/lopcodes.h new file mode 100644 index 0000000..41224d6 --- /dev/null +++ b/mylua/lua/lopcodes.h @@ -0,0 +1,268 @@ +/* +** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $ +** Opcodes for Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lopcodes_h +#define lopcodes_h + +#include "llimits.h" + + +/*=========================================================================== + We assume that instructions are unsigned numbers. + All instructions have an opcode in the first 6 bits. + Instructions can have the following fields: + `A' : 8 bits + `B' : 9 bits + `C' : 9 bits + `Bx' : 18 bits (`B' and `C' together) + `sBx' : signed Bx + + A signed argument is represented in excess K; that is, the number + value is the unsigned value minus K. K is exactly the maximum value + for that argument (so that -max is represented by 0, and +max is + represented by 2*max), which is half the maximum for the corresponding + unsigned argument. +===========================================================================*/ + + +enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */ + + +/* +** size and position of opcode arguments. +*/ +#define SIZE_C 9 +#define SIZE_B 9 +#define SIZE_Bx (SIZE_C + SIZE_B) +#define SIZE_A 8 + +#define SIZE_OP 6 + +#define POS_OP 0 +#define POS_A (POS_OP + SIZE_OP) +#define POS_C (POS_A + SIZE_A) +#define POS_B (POS_C + SIZE_C) +#define POS_Bx POS_C + + +/* +** limits for opcode arguments. +** we use (signed) int to manipulate most arguments, +** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) +*/ +#if SIZE_Bx < LUAI_BITSINT-1 +#define MAXARG_Bx ((1<>1) /* `sBx' is signed */ +#else +#define MAXARG_Bx MAX_INT +#define MAXARG_sBx MAX_INT +#endif + + +#define MAXARG_A ((1<>POS_OP) & MASK1(SIZE_OP,0))) +#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ + ((cast(Instruction, o)<>POS_A) & MASK1(SIZE_A,0))) +#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ + ((cast(Instruction, u)<>POS_B) & MASK1(SIZE_B,0))) +#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ + ((cast(Instruction, b)<>POS_C) & MASK1(SIZE_C,0))) +#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ + ((cast(Instruction, b)<>POS_Bx) & MASK1(SIZE_Bx,0))) +#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ + ((cast(Instruction, b)< C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ + +OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ +OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ + +OP_FORLOOP,/* A sBx R(A)+=R(A+2); + if R(A) =) R(A)*/ +OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ + +OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ +} OpCode; + + +#define NUM_OPCODES (cast(int, OP_VARARG) + 1) + + + +/*=========================================================================== + Notes: + (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, + and can be 0: OP_CALL then sets `top' to last_result+1, so + next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. + + (*) In OP_VARARG, if (B == 0) then use actual number of varargs and + set top (like in OP_CALL with C == 0). + + (*) In OP_RETURN, if (B == 0) then return up to `top' + + (*) In OP_SETLIST, if (B == 0) then B = `top'; + if (C == 0) then next `instruction' is real C + + (*) For comparisons, A specifies what condition the test should accept + (true or false). + + (*) All `skips' (pc++) assume that next instruction is a jump +===========================================================================*/ + + +/* +** masks for instruction properties. The format is: +** bits 0-1: op mode +** bits 2-3: C arg mode +** bits 4-5: B arg mode +** bit 6: instruction set register A +** bit 7: operator is a test +*/ + +enum OpArgMask { + OpArgN, /* argument is not used */ + OpArgU, /* argument is used */ + OpArgR, /* argument is a register or a jump offset */ + OpArgK /* argument is a constant or register/constant */ +}; + +LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES]; + +#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) +#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) +#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) +#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) +#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) + + +LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ + + +/* number of list items to accumulate before a SETLIST instruction */ +#define LFIELDS_PER_FLUSH 50 + + +#endif diff --git a/mylua/lua/loslib.c b/mylua/lua/loslib.c new file mode 100644 index 0000000..da06a57 --- /dev/null +++ b/mylua/lua/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/mylua/lua/lparser.c b/mylua/lua/lparser.c new file mode 100644 index 0000000..1e2a9a8 --- /dev/null +++ b/mylua/lua/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; inups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; if->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/mylua/lua/lparser.h b/mylua/lua/lparser.h new file mode 100644 index 0000000..18836af --- /dev/null +++ b/mylua/lua/lparser.h @@ -0,0 +1,82 @@ +/* +** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + +#ifndef lparser_h +#define lparser_h + +#include "llimits.h" +#include "lobject.h" +#include "lzio.h" + + +/* +** Expression descriptor +*/ + +typedef enum { + VVOID, /* no value */ + VNIL, + VTRUE, + VFALSE, + VK, /* info = index of constant in `k' */ + VKNUM, /* nval = numerical value */ + VLOCAL, /* info = local register */ + VUPVAL, /* info = index of upvalue in `upvalues' */ + VGLOBAL, /* info = index of table; aux = index of global name in `k' */ + VINDEXED, /* info = table register; aux = index register (or `k') */ + VJMP, /* info = instruction pc */ + VRELOCABLE, /* info = instruction pc */ + VNONRELOC, /* info = result register */ + VCALL, /* info = instruction pc */ + VVARARG /* info = instruction pc */ +} expkind; + +typedef struct expdesc { + expkind k; + union { + struct { int info, aux; } s; + lua_Number nval; + } u; + int t; /* patch list of `exit when true' */ + int f; /* patch list of `exit when false' */ +} expdesc; + + +typedef struct upvaldesc { + lu_byte k; + lu_byte info; +} upvaldesc; + + +struct BlockCnt; /* defined in lparser.c */ + + +/* state needed to generate code for a given function */ +typedef struct FuncState { + Proto *f; /* current function header */ + Table *h; /* table to find (and reuse) elements in `k' */ + struct FuncState *prev; /* enclosing function */ + struct LexState *ls; /* lexical state */ + struct lua_State *L; /* copy of the Lua state */ + struct BlockCnt *bl; /* chain of current blocks */ + int pc; /* next position to code (equivalent to `ncode') */ + int lasttarget; /* `pc' of last `jump target' */ + int jpc; /* list of pending jumps to `pc' */ + int freereg; /* first free register */ + int nk; /* number of elements in `k' */ + int np; /* number of elements in `p' */ + short nlocvars; /* number of elements in `locvars' */ + lu_byte nactvar; /* number of active local variables */ + upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ + unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ +} FuncState; + + +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); + + +#endif diff --git a/mylua/lua/lstate.c b/mylua/lua/lstate.c new file mode 100644 index 0000000..4313b83 --- /dev/null +++ b/mylua/lua/lstate.c @@ -0,0 +1,214 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; imt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/mylua/lua/lstate.h b/mylua/lua/lstate.h new file mode 100644 index 0000000..3bc575b --- /dev/null +++ b/mylua/lua/lstate.h @@ -0,0 +1,169 @@ +/* +** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + +#ifndef lstate_h +#define lstate_h + +#include "lua.h" + +#include "lobject.h" +#include "ltm.h" +#include "lzio.h" + + + +struct lua_longjmp; /* defined in ldo.c */ + + +/* table of globals */ +#define gt(L) (&L->l_gt) + +/* registry */ +#define registry(L) (&G(L)->l_registry) + + +/* extra stack space to handle TM calls and some other extras */ +#define EXTRA_STACK 5 + + +#define BASIC_CI_SIZE 8 + +#define BASIC_STACK_SIZE (2*LUA_MINSTACK) + + + +typedef struct stringtable { + GCObject **hash; + lu_int32 nuse; /* number of elements */ + int size; +} stringtable; + + +/* +** informations about a call +*/ +typedef struct CallInfo { + StkId base; /* base for this function */ + StkId func; /* function index in the stack */ + StkId top; /* top for this function */ + const Instruction *savedpc; + int nresults; /* expected number of results from this function */ + int tailcalls; /* number of tail calls lost under this entry */ +} CallInfo; + + + +#define curr_func(L) (clvalue(L->ci->func)) +#define ci_func(ci) (clvalue((ci)->func)) +#define f_isLua(ci) (!ci_func(ci)->c.isC) +#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) + + +/* +** `global state', shared by all threads of this state +*/ +typedef struct global_State { + stringtable strt; /* hash table for strings */ + lua_Alloc frealloc; /* function to reallocate memory */ + void *ud; /* auxiliary data to `frealloc' */ + lu_byte currentwhite; + lu_byte gcstate; /* state of garbage collector */ + int sweepstrgc; /* position of sweep in `strt' */ + GCObject *rootgc; /* list of all collectable objects */ + GCObject **sweepgc; /* position of sweep in `rootgc' */ + GCObject *gray; /* list of gray objects */ + GCObject *grayagain; /* list of objects to be traversed atomically */ + GCObject *weak; /* list of weak tables (to be cleared) */ + GCObject *tmudata; /* last element of list of userdata to be GC */ + Mbuffer buff; /* temporary buffer for string concatentation */ + lu_mem GCthreshold; + lu_mem totalbytes; /* number of bytes currently allocated */ + lu_mem estimate; /* an estimate of number of bytes actually in use */ + lu_mem gcdept; /* how much GC is `behind schedule' */ + int gcpause; /* size of pause between successive GCs */ + int gcstepmul; /* GC `granularity' */ + lua_CFunction panic; /* to be called in unprotected errors */ + TValue l_registry; + struct lua_State *mainthread; + UpVal uvhead; /* head of double-linked list of all open upvalues */ + struct Table *mt[NUM_TAGS]; /* metatables for basic types */ + TString *tmname[TM_N]; /* array with tag-method names */ +} global_State; + + +/* +** `per thread' state +*/ +struct lua_State { + CommonHeader; + lu_byte status; + StkId top; /* first free slot in the stack */ + StkId base; /* base of current function */ + global_State *l_G; + CallInfo *ci; /* call info for current function */ + const Instruction *savedpc; /* `savedpc' of current function */ + StkId stack_last; /* last free slot in the stack */ + StkId stack; /* stack base */ + CallInfo *end_ci; /* points after end of ci array*/ + CallInfo *base_ci; /* array of CallInfo's */ + int stacksize; + int size_ci; /* size of array `base_ci' */ + unsigned short nCcalls; /* number of nested C calls */ + unsigned short baseCcalls; /* nested C calls when resuming coroutine */ + lu_byte hookmask; + lu_byte allowhook; + int basehookcount; + int hookcount; + lua_Hook hook; + TValue l_gt; /* table of globals */ + TValue env; /* temporary place for environments */ + GCObject *openupval; /* list of open upvalues in this stack */ + GCObject *gclist; + struct lua_longjmp *errorJmp; /* current error recover point */ + ptrdiff_t errfunc; /* current error handling function (stack index) */ +}; + + +#define G(L) (L->l_G) + + +/* +** Union of all collectable objects +*/ +union GCObject { + GCheader gch; + union TString ts; + union Udata u; + union Closure cl; + struct Table h; + struct Proto p; + struct UpVal uv; + struct lua_State th; /* thread */ +}; + + +/* macros to convert a GCObject into a specific value */ +#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) +#define gco2ts(o) (&rawgco2ts(o)->tsv) +#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) +#define gco2u(o) (&rawgco2u(o)->uv) +#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) +#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) +#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) +#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define ngcotouv(o) \ + check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) +#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) + +/* macro to convert any Lua object into a GCObject */ +#define obj2gco(v) (cast(GCObject *, (v))) + + +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); + +#endif + diff --git a/mylua/lua/lstring.c b/mylua/lua/lstring.c new file mode 100644 index 0000000..4911315 --- /dev/null +++ b/mylua/lua/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; isize; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/mylua/lua/lstring.h b/mylua/lua/lstring.h new file mode 100644 index 0000000..73a2ff8 --- /dev/null +++ b/mylua/lua/lstring.h @@ -0,0 +1,31 @@ +/* +** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keep all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + +#ifndef lstring_h +#define lstring_h + + +#include "lgc.h" +#include "lobject.h" +#include "lstate.h" + + +#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) + +#define sizeudata(u) (sizeof(union Udata)+(u)->len) + +#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) +#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ + (sizeof(s)/sizeof(char))-1)) + +#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) + +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); + + +#endif diff --git a/mylua/lua/lstrlib.c b/mylua/lua/lstrlib.c new file mode 100644 index 0000000..1b4763d --- /dev/null +++ b/mylua/lua/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (ssrc_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = ssrc_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/mylua/lua/ltable.c b/mylua/lua/ltable.c new file mode 100644 index 0000000..ec84f4f --- /dev/null +++ b/mylua/lua/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; ilsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/mylua/lua/ltable.h b/mylua/lua/ltable.h new file mode 100644 index 0000000..f5b9d5e --- /dev/null +++ b/mylua/lua/ltable.h @@ -0,0 +1,40 @@ +/* +** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + +#ifndef ltable_h +#define ltable_h + +#include "lobject.h" + + +#define gnode(t,i) (&(t)->node[i]) +#define gkey(n) (&(n)->i_key.nk) +#define gval(n) (&(n)->i_val) +#define gnext(n) ((n)->i_key.nk.next) + +#define key2tval(n) (&(n)->i_key.tvk) + + +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); + + +#if defined(LUA_DEBUG) +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC int luaH_isdummy (Node *n); +#endif + + +#endif diff --git a/mylua/lua/ltablib.c b/mylua/lua/ltablib.c new file mode 100644 index 0000000..b6d9cb4 --- /dev/null +++ b/mylua/lua/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/mylua/lua/ltm.h b/mylua/lua/ltm.h new file mode 100644 index 0000000..64343b7 --- /dev/null +++ b/mylua/lua/ltm.h @@ -0,0 +1,54 @@ +/* +** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ +** Tag methods +** See Copyright Notice in lua.h +*/ + +#ifndef ltm_h +#define ltm_h + + +#include "lobject.h" + + +/* +* WARNING: if you change the order of this enumeration, +* grep "ORDER TM" +*/ +typedef enum { + TM_INDEX, + TM_NEWINDEX, + TM_GC, + TM_MODE, + TM_EQ, /* last tag method with `fast' access */ + TM_ADD, + TM_SUB, + TM_MUL, + TM_DIV, + TM_MOD, + TM_POW, + TM_UNM, + TM_LEN, + TM_LT, + TM_LE, + TM_CONCAT, + TM_CALL, + TM_N /* number of elements in the enum */ +} TMS; + + + +#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ + ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) + +#define fasttm(l,et,e) gfasttm(G(l), et, e) + +LUAI_DATA const char *const luaT_typenames[]; + + +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); + +#endif diff --git a/mylua/lua/lua b/mylua/lua/lua new file mode 100644 index 0000000000000000000000000000000000000000..15e51892c9dbcb038e6846106ce65384cab62340 GIT binary patch literal 713285 zcmce<3w%`7wLd;dCdq)KXOK}-o7!lxB}FUIsEk0(Ymz_+OfqD`D+yGH5fLz%As{3q z&Wz@;IS^ZDt*utC_Ljc9_8~>TSy_KZVqsx*d2o!|Gn&pDIu(0lLi z|Ns03PR?0pKiAr8uf6u#Ywxq(JEJruCBC6A zx$QDr2Hr3%zXNe_9mX@SbX;~^X}H|T#NBCk@EQx47sHr0FZn}S8?MO1sWx6rZ*v*p z^4&F=jtH*uRGV!9E|$x1JlgI>{Cg3`Yd>IK3}+d<#-ot&D4SOfU|v>O)d#`F0MGbY z>91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9Xj)9glF%0A^yxUsO54DugQqS;=*P5sG z6ep*~*AndAUb2=a47__YIV?EXfD&sh*}imI4aMHXB(o&v3Ly(eyi15zKh@}zL6=;@ zYq1Rl=)gYDi6ec}zDv+=~J_n(BRT|1tM=A7BuP$e=GzJz|#g4C5yye zhV2 +#include +#include +#include + +#define luac_c +#define LUA_CORE + +#include "lua.h" +#include "lauxlib.h" + +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstring.h" +#include "lundump.h" + +#define PROGNAME "luac" /* default program name */ +#define OUTPUT PROGNAME ".out" /* default output file */ + +static int listing=0; /* list bytecodes? */ +static int dumping=1; /* dump bytecodes? */ +static int stripping=0; /* strip debug information? */ +static char Output[]={ OUTPUT }; /* default output file name */ +static const char* output=Output; /* actual output file name */ +static const char* progname=PROGNAME; /* actual program name */ + +static void fatal(const char* message) +{ + fprintf(stderr,"%s: %s\n",progname,message); + exit(EXIT_FAILURE); +} + +static void cannot(const char* what) +{ + fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); + exit(EXIT_FAILURE); +} + +static void usage(const char* message) +{ + if (*message=='-') + fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); + else + fprintf(stderr,"%s: %s\n",progname,message); + fprintf(stderr, + "usage: %s [options] [filenames].\n" + "Available options are:\n" + " - process stdin\n" + " -l list\n" + " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" + " -p parse only\n" + " -s strip debug information\n" + " -v show version information\n" + " -- stop handling options\n", + progname,Output); + exit(EXIT_FAILURE); +} + +#define IS(s) (strcmp(argv[i],s)==0) + +static int doargs(int argc, char* argv[]) +{ + int i; + int version=0; + if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; + for (i=1; itop+(i))->l.p) + +static const Proto* combine(lua_State* L, int n) +{ + if (n==1) + return toproto(L,-1); + else + { + int i,pc; + Proto* f=luaF_newproto(L); + setptvalue2s(L,L->top,f); incr_top(L); + f->source=luaS_newliteral(L,"=(" PROGNAME ")"); + f->maxstacksize=1; + pc=2*n+1; + f->code=luaM_newvector(L,pc,Instruction); + f->sizecode=pc; + f->p=luaM_newvector(L,n,Proto*); + f->sizep=n; + pc=0; + for (i=0; ip[i]=toproto(L,i-n-1); + f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i); + f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1); + } + f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0); + return f; + } +} + +static int writer(lua_State* L, const void* p, size_t size, void* u) +{ + UNUSED(L); + return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); +} + +struct Smain { + int argc; + char** argv; +}; + +static int pmain(lua_State* L) +{ + struct Smain* s = (struct Smain*)lua_touserdata(L, 1); + int argc=s->argc; + char** argv=s->argv; + const Proto* f; + int i; + if (!lua_checkstack(L,argc)) fatal("too many input files"); + for (i=0; i1); + if (dumping) + { + FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); + if (D==NULL) cannot("open"); + lua_lock(L); + luaU_dump(L,f,writer,D,stripping); + lua_unlock(L); + if (ferror(D)) cannot("write"); + if (fclose(D)) cannot("close"); + } + return 0; +} + +int main(int argc, char* argv[]) +{ + lua_State* L; + struct Smain s; + int i=doargs(argc,argv); + argc-=i; argv+=i; + if (argc<=0) usage("no input files given"); + L=lua_open(); + if (L==NULL) fatal("not enough memory for state"); + s.argc=argc; + s.argv=argv; + if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1)); + lua_close(L); + return EXIT_SUCCESS; +} diff --git a/mylua/lua/luaconf.h b/mylua/lua/luaconf.h new file mode 100644 index 0000000..e2cb261 --- /dev/null +++ b/mylua/lua/luaconf.h @@ -0,0 +1,763 @@ +/* +** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*/ + + +#ifndef lconfig_h +#define lconfig_h + +#include +#include + + +/* +** ================================================================== +** Search for "@@" to find all configurable definitions. +** =================================================================== +*/ + + +/* +@@ LUA_ANSI controls the use of non-ansi features. +** CHANGE it (define it) if you want Lua to avoid the use of any +** non-ansi feature or library. +*/ +#if defined(__STRICT_ANSI__) +#define LUA_ANSI +#endif + + +#if !defined(LUA_ANSI) && defined(_WIN32) +#define LUA_WIN +#endif + +#if defined(LUA_USE_LINUX) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +#define LUA_USE_READLINE /* needs some extra libraries */ +#endif + +#if defined(LUA_USE_MACOSX) +#define LUA_USE_POSIX +#define LUA_DL_DYLD /* does not need extra library */ +#endif + + + +/* +@@ LUA_USE_POSIX includes all functionallity listed as X/Open System +@* Interfaces Extension (XSI). +** CHANGE it (define it) if your system is XSI compatible. +*/ +#if defined(LUA_USE_POSIX) +#define LUA_USE_MKSTEMP +#define LUA_USE_ISATTY +#define LUA_USE_POPEN +#define LUA_USE_ULONGJMP +#endif + + +/* +@@ LUA_PATH and LUA_CPATH are the names of the environment variables that +@* Lua check to set its paths. +@@ LUA_INIT is the name of the environment variable that Lua +@* checks for initialization code. +** CHANGE them if you want different names. +*/ +#define LUA_PATH "LUA_PATH" +#define LUA_CPATH "LUA_CPATH" +#define LUA_INIT "LUA_INIT" + + +/* +@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +@* Lua libraries. +@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +@* C libraries. +** CHANGE them if your machine has a non-conventional directory +** hierarchy or if you want to install your libraries in +** non-conventional directories. +*/ +#if defined(_WIN32) +/* +** In Windows, any exclamation mark ('!') in the path is replaced by the +** path of the directory of the executable file of the current process. +*/ +#define LUA_LDIR "!\\lua\\" +#define LUA_CDIR "!\\" +#define LUA_PATH_DEFAULT \ + ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" +#define LUA_CPATH_DEFAULT \ + ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + +#else +#define LUA_ROOT "/usr/local/" +#define LUA_LDIR LUA_ROOT "share/lua/5.1/" +#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" +#define LUA_PATH_DEFAULT \ + "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" +#define LUA_CPATH_DEFAULT \ + "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so" +#endif + + +/* +@@ LUA_DIRSEP is the directory separator (for submodules). +** CHANGE it if your machine does not use "/" as the directory separator +** and is not Windows. (On Windows Lua automatically uses "\".) +*/ +#if defined(_WIN32) +#define LUA_DIRSEP "\\" +#else +#define LUA_DIRSEP "/" +#endif + + +/* +@@ LUA_PATHSEP is the character that separates templates in a path. +@@ LUA_PATH_MARK is the string that marks the substitution points in a +@* template. +@@ LUA_EXECDIR in a Windows path is replaced by the executable's +@* directory. +@@ LUA_IGMARK is a mark to ignore all before it when bulding the +@* luaopen_ function name. +** CHANGE them if for some reason your system cannot use those +** characters. (E.g., if one of those characters is a common character +** in file/directory names.) Probably you do not need to change them. +*/ +#define LUA_PATHSEP ";" +#define LUA_PATH_MARK "?" +#define LUA_EXECDIR "!" +#define LUA_IGMARK "-" + + +/* +@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +** machines, ptrdiff_t gives a good choice between int or long.) +*/ +#define LUA_INTEGER ptrdiff_t + + +/* +@@ LUA_API is a mark for all core API functions. +@@ LUALIB_API is a mark for all standard library functions. +** CHANGE them if you need to define those functions in some special way. +** For instance, if you want to create one Windows DLL with the core and +** the libraries, you may want to use the following definition (define +** LUA_BUILD_AS_DLL to get it). +*/ +#if defined(LUA_BUILD_AS_DLL) + +#if defined(LUA_CORE) || defined(LUA_LIB) +#define LUA_API __declspec(dllexport) +#else +#define LUA_API __declspec(dllimport) +#endif + +#else + +#define LUA_API extern + +#endif + +/* more often than not the libs go together with the core */ +#define LUALIB_API LUA_API + + +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +@@ LUAI_DATA is a mark for all extern (const) variables that are not to +@* be exported to outside modules. +** CHANGE them if you need to mark them in some special way. Elf/gcc +** (versions 3.2 and later) mark them as "hidden" to optimize access +** when Lua is compiled as a shared library. +*/ +#if defined(luaall_c) +#define LUAI_FUNC static +#define LUAI_DATA /* empty */ + +#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ + defined(__ELF__) +#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +#define LUAI_DATA LUAI_FUNC + +#else +#define LUAI_FUNC extern +#define LUAI_DATA extern +#endif + + + +/* +@@ LUA_QL describes how error messages quote program elements. +** CHANGE it if you want a different appearance. +*/ +#define LUA_QL(x) "'" x "'" +#define LUA_QS LUA_QL("%s") + + +/* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*/ +#define LUA_IDSIZE 60 + + +/* +** {================================================================== +** Stand-alone configuration +** =================================================================== +*/ + +#if defined(lua_c) || defined(luaall_c) + +/* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#if defined(LUA_USE_ISATTY) +#include +#define lua_stdin_is_tty() isatty(0) +#elif defined(LUA_WIN) +#include +#include +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +#else +#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ +#endif + + +/* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*/ +#define LUA_PROMPT "> " +#define LUA_PROMPT2 ">> " + + +/* +@@ LUA_PROGNAME is the default name for the stand-alone Lua program. +** CHANGE it if your stand-alone interpreter has a different name and +** your system is not able to detect that name automatically. +*/ +#define LUA_PROGNAME "lua" + + +/* +@@ LUA_MAXINPUT is the maximum length for an input line in the +@* stand-alone interpreter. +** CHANGE it if you need longer lines. +*/ +#define LUA_MAXINPUT 512 + + +/* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*/ +#if defined(LUA_USE_READLINE) +#include +#include +#include +#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) +#define lua_saveline(L,idx) \ + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \ + add_history(lua_tostring(L, idx)); /* add it to history */ +#define lua_freeline(L,b) ((void)L, free(b)) +#else +#define lua_readline(L,b,p) \ + ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ + fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ +#define lua_saveline(L,idx) { (void)L; (void)idx; } +#define lua_freeline(L,b) { (void)L; (void)b; } +#endif + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles +@* as a percentage. +** CHANGE it if you want the GC to run faster or slower (higher values +** mean larger pauses which mean slower collection.) You can also change +** this value dynamically. +*/ +#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */ + + +/* +@@ LUAI_GCMUL defines the default speed of garbage collection relative to +@* memory allocation as a percentage. +** CHANGE it if you want to change the granularity of the garbage +** collection. (Higher values mean coarser collections. 0 represents +** infinity, where each step performs a full collection.) You can also +** change this value dynamically. +*/ +#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ + + + +/* +@@ LUA_COMPAT_GETN controls compatibility with old getn behavior. +** CHANGE it (define it) if you want exact compatibility with the +** behavior of setn/getn in Lua 5.0. +*/ +#undef LUA_COMPAT_GETN + +/* +@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib. +** CHANGE it to undefined as soon as you do not need a global 'loadlib' +** function (the function is still available as 'package.loadlib'). +*/ +#undef LUA_COMPAT_LOADLIB + +/* +@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature. +** CHANGE it to undefined as soon as your programs use only '...' to +** access vararg parameters (instead of the old 'arg' table). +*/ +#define LUA_COMPAT_VARARG + +/* +@@ LUA_COMPAT_MOD controls compatibility with old math.mod function. +** CHANGE it to undefined as soon as your programs use 'math.fmod' or +** the new '%' operator instead of 'math.mod'. +*/ +#define LUA_COMPAT_MOD + +/* +@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting +@* facility. +** CHANGE it to 2 if you want the old behaviour, or undefine it to turn +** off the advisory error when nesting [[...]]. +*/ +#define LUA_COMPAT_LSTR 1 + +/* +@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. +** CHANGE it to undefined as soon as you rename 'string.gfind' to +** 'string.gmatch'. +*/ +#define LUA_COMPAT_GFIND + +/* +@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' +@* behavior. +** CHANGE it to undefined as soon as you replace to 'luaL_register' +** your uses of 'luaL_openlib' +*/ +#define LUA_COMPAT_OPENLIB + + + +/* +@@ luai_apicheck is the assert macro used by the Lua-C API. +** CHANGE luai_apicheck if you want Lua to perform some checks in the +** parameters it gets from API calls. This may slow down the interpreter +** a bit, but may be quite useful when debugging C code that interfaces +** with Lua. A useful redefinition is to use assert.h. +*/ +#if defined(LUA_USE_APICHECK) +#include +#define luai_apicheck(L,o) { (void)L; assert(o); } +#else +#define luai_apicheck(L,o) { (void)L; } +#endif + + +/* +@@ LUAI_BITSINT defines the number of bits in an int. +** CHANGE here if Lua cannot automatically detect the number of bits of +** your machine. Probably you do not need to change this. +*/ +/* avoid overflows in comparison */ +#if INT_MAX-20 < 32760 +#define LUAI_BITSINT 16 +#elif INT_MAX > 2147483640L +/* int has at least 32 bits */ +#define LUAI_BITSINT 32 +#else +#error "you must define LUA_BITSINT with number of bits in an integer" +#endif + + +/* +@@ LUAI_UINT32 is an unsigned integer with at least 32 bits. +@@ LUAI_INT32 is an signed integer with at least 32 bits. +@@ LUAI_UMEM is an unsigned integer big enough to count the total +@* memory used by Lua. +@@ LUAI_MEM is a signed integer big enough to count the total memory +@* used by Lua. +** CHANGE here if for some weird reason the default definitions are not +** good enough for your machine. (The definitions in the 'else' +** part always works, but may waste space on machines with 64-bit +** longs.) Probably you do not need to change this. +*/ +#if LUAI_BITSINT >= 32 +#define LUAI_UINT32 unsigned int +#define LUAI_INT32 int +#define LUAI_MAXINT32 INT_MAX +#define LUAI_UMEM size_t +#define LUAI_MEM ptrdiff_t +#else +/* 16-bit ints */ +#define LUAI_UINT32 unsigned long +#define LUAI_INT32 long +#define LUAI_MAXINT32 LONG_MAX +#define LUAI_UMEM unsigned long +#define LUAI_MEM long +#endif + + +/* +@@ LUAI_MAXCALLS limits the number of nested calls. +** CHANGE it if you need really deep recursive calls. This limit is +** arbitrary; its only purpose is to stop infinite recursion before +** exhausting memory. +*/ +#define LUAI_MAXCALLS 20000 + + +/* +@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function +@* can use. +** CHANGE it if you need lots of (Lua) stack space for your C +** functions. This limit is arbitrary; its only purpose is to stop C +** functions to consume unlimited stack space. (must be smaller than +** -LUA_REGISTRYINDEX) +*/ +#define LUAI_MAXCSTACK 8000 + + + +/* +** {================================================================== +** CHANGE (to smaller values) the following definitions if your system +** has a small C stack. (Or you may want to change them to larger +** values if your system has a large C stack and these limits are +** too rigid for you.) Some of these constants control the size of +** stack-allocated arrays used by the compiler or the interpreter, while +** others limit the maximum number of recursive calls that the compiler +** or the interpreter can perform. Values too large may cause a C stack +** overflow for some forms of deep constructs. +** =================================================================== +*/ + + +/* +@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and +@* syntactical nested non-terminals in a program. +*/ +#define LUAI_MAXCCALLS 200 + + +/* +@@ LUAI_MAXVARS is the maximum number of local variables per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXVARS 200 + + +/* +@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function +@* (must be smaller than 250). +*/ +#define LUAI_MAXUPVALUES 60 + + +/* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*/ +#define LUAL_BUFFERSIZE BUFSIZ + +/* }================================================================== */ + + + + +/* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*/ + +#define LUA_NUMBER_DOUBLE +#define LUA_NUMBER double + +/* +@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +@* over a number. +*/ +#define LUAI_UACNUMBER double + + +/* +@@ LUA_NUMBER_SCAN is the format for reading numbers. +@@ LUA_NUMBER_FMT is the format for writing numbers. +@@ lua_number2str converts a number to a string. +@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +@@ lua_str2number converts a string to a number. +*/ +#define LUA_NUMBER_SCAN "%lf" +#define LUA_NUMBER_FMT "%.14g" +#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +#define lua_str2number(s,p) strtod((s), (p)) + + +/* +@@ The luai_num* macros define the primitive operations over numbers. +*/ +#if defined(LUA_CORE) +#include +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b)) +#define luai_numpow(a,b) (pow(a,b)) +#define luai_numunm(a) (-(a)) +#define luai_numeq(a,b) ((a)==(b)) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) +#endif + + +/* +@@ lua_number2int is a macro to convert lua_Number to int. +@@ lua_number2integer is a macro to convert lua_Number to lua_Integer. +** CHANGE them if you know a faster way to convert a lua_Number to +** int (with any rounding method and without throwing errors) in your +** system. In Pentium machines, a naive typecast from double to int +** in C is extremely slow, so any alternative is worth trying. +*/ + +/* On a Pentium, resort to a trick */ +#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ + (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + +/* On a Microsoft compiler, use assembler */ +#if defined(_MSC_VER) + +#define lua_number2int(i,d) __asm fld d __asm fistp i +#define lua_number2integer(i,n) lua_number2int(i, n) + +/* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ +#else + +union luai_Cast { double l_d; long l_l; }; +#define lua_number2int(i,d) \ + { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; } +#define lua_number2integer(i,n) lua_number2int(i, n) + +#endif + + +/* this option always works, but may be slow */ +#else +#define lua_number2int(i,d) ((i)=(int)(d)) +#define lua_number2integer(i,d) ((i)=(lua_Integer)(d)) + +#endif + +/* }================================================================== */ + + +/* +@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment. +** CHANGE it if your system requires alignments larger than double. (For +** instance, if your system supports long doubles and they must be +** aligned in 16-byte boundaries, then you should add long double in the +** union.) Probably you do not need to change this. +*/ +#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; } + + +/* +@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling. +** CHANGE them if you prefer to use longjmp/setjmp even with C++ +** or if want/don't to use _longjmp/_setjmp instead of regular +** longjmp/setjmp. By default, Lua handles errors with exceptions when +** compiling as C++ code, with _longjmp/_setjmp when asked to use them, +** and with longjmp/setjmp otherwise. +*/ +#if defined(__cplusplus) +/* C++ exceptions */ +#define LUAI_THROW(L,c) throw(c) +#define LUAI_TRY(L,c,a) try { a } catch(...) \ + { if ((c)->status == 0) (c)->status = -1; } +#define luai_jmpbuf int /* dummy variable */ + +#elif defined(LUA_USE_ULONGJMP) +/* in Unix, try _longjmp/_setjmp (more efficient) */ +#define LUAI_THROW(L,c) _longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#else +/* default handling with long jumps */ +#define LUAI_THROW(L,c) longjmp((c)->b, 1) +#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } +#define luai_jmpbuf jmp_buf + +#endif + + +/* +@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern +@* can do during pattern-matching. +** CHANGE it if you need more captures. This limit is arbitrary. +*/ +#define LUA_MAXCAPTURES 32 + + +/* +@@ lua_tmpnam is the function that the OS library uses to create a +@* temporary name. +@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam. +** CHANGE them if you have an alternative to tmpnam (which is considered +** insecure) or if you want the original tmpnam anyway. By default, Lua +** uses tmpnam except when POSIX is available, where it uses mkstemp. +*/ +#if defined(loslib_c) || defined(luaall_c) + +#if defined(LUA_USE_MKSTEMP) +#include +#define LUA_TMPNAMBUFSIZE 32 +#define lua_tmpnam(b,e) { \ + strcpy(b, "/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } + +#else +#define LUA_TMPNAMBUFSIZE L_tmpnam +#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } +#endif + +#endif + + +/* +@@ lua_popen spawns a new process connected to the current one through +@* the file streams. +** CHANGE it if you have a way to implement it in your system. +*/ +#if defined(LUA_USE_POPEN) + +#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m)) +#define lua_pclose(L,file) ((void)L, (pclose(file) != -1)) + +#elif defined(LUA_WIN) + +#define lua_popen(L,c,m) ((void)L, _popen(c,m)) +#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1)) + +#else + +#define lua_popen(L,c,m) ((void)((void)c, m), \ + luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0) +#define lua_pclose(L,file) ((void)((void)L, file), 0) + +#endif + +/* +@@ LUA_DL_* define which dynamic-library system Lua should use. +** CHANGE here if Lua has problems choosing the appropriate +** dynamic-library system for your platform (either Windows' DLL, Mac's +** dyld, or Unix's dlopen). If your system is some kind of Unix, there +** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for +** it. To use dlopen you also need to adapt the src/Makefile (probably +** adding -ldl to the linker options), so Lua does not select it +** automatically. (When you change the makefile to add -ldl, you must +** also add -DLUA_USE_DLOPEN.) +** If you do not want any kind of dynamic library, undefine all these +** options. +** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD. +*/ +#if defined(LUA_USE_DLOPEN) +#define LUA_DL_DLOPEN +#endif + +#if defined(LUA_WIN) +#define LUA_DL_DLL +#endif + + +/* +@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State +@* (the data goes just *before* the lua_State pointer). +** CHANGE (define) this if you really need that. This value must be +** a multiple of the maximum alignment required for your machine. +*/ +#define LUAI_EXTRASPACE 0 + + +/* +@@ luai_userstate* allow user-specific actions on threads. +** CHANGE them if you defined LUAI_EXTRASPACE and need to do something +** extra when a thread is created/deleted/resumed/yielded. +*/ +#define luai_userstateopen(L) ((void)L) +#define luai_userstateclose(L) ((void)L) +#define luai_userstatethread(L,L1) ((void)L) +#define luai_userstatefree(L) ((void)L) +#define luai_userstateresume(L,n) ((void)L) +#define luai_userstateyield(L,n) ((void)L) + + +/* +@@ LUA_INTFRMLEN is the length modifier for integer conversions +@* in 'string.format'. +@@ LUA_INTFRM_T is the integer type correspoding to the previous length +@* modifier. +** CHANGE them if your system supports long long or does not support long. +*/ + +#if defined(LUA_USELONGLONG) + +#define LUA_INTFRMLEN "ll" +#define LUA_INTFRM_T long long + +#else + +#define LUA_INTFRMLEN "l" +#define LUA_INTFRM_T long + +#endif + + + +/* =================================================================== */ + +/* +** Local configuration. You can use this space to add your redefinitions +** without modifying the main part of the file. +*/ + + + +#endif + diff --git a/mylua/lua/lualib.h b/mylua/lua/lualib.h new file mode 100644 index 0000000..469417f --- /dev/null +++ b/mylua/lua/lualib.h @@ -0,0 +1,53 @@ +/* +** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua standard libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lualib_h +#define lualib_h + +#include "lua.h" + + +/* Key to file-handle type */ +#define LUA_FILEHANDLE "FILE*" + + +#define LUA_COLIBNAME "coroutine" +LUALIB_API int (luaopen_base) (lua_State *L); + +#define LUA_TABLIBNAME "table" +LUALIB_API int (luaopen_table) (lua_State *L); + +#define LUA_IOLIBNAME "io" +LUALIB_API int (luaopen_io) (lua_State *L); + +#define LUA_OSLIBNAME "os" +LUALIB_API int (luaopen_os) (lua_State *L); + +#define LUA_STRLIBNAME "string" +LUALIB_API int (luaopen_string) (lua_State *L); + +#define LUA_MATHLIBNAME "math" +LUALIB_API int (luaopen_math) (lua_State *L); + +#define LUA_DBLIBNAME "debug" +LUALIB_API int (luaopen_debug) (lua_State *L); + +#define LUA_LOADLIBNAME "package" +LUALIB_API int (luaopen_package) (lua_State *L); + + +/* open all previous libraries */ +LUALIB_API void (luaL_openlibs) (lua_State *L); + + + +#ifndef lua_assert +#define lua_assert(x) ((void)0) +#endif + + +#endif diff --git a/mylua/lua/lundump.c b/mylua/lua/lundump.c new file mode 100644 index 0000000..8010a45 --- /dev/null +++ b/mylua/lua/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; ik[i]); + for (i=0; ik[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; ip[i]=NULL; + for (i=0; ip[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; + for (i=0; ilocvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; + for (i=0; iupvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/mylua/lua/lundump.h b/mylua/lua/lundump.h new file mode 100644 index 0000000..c80189d --- /dev/null +++ b/mylua/lua/lundump.h @@ -0,0 +1,36 @@ +/* +** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#ifndef lundump_h +#define lundump_h + +#include "lobject.h" +#include "lzio.h" + +/* load one chunk; from lundump.c */ +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); + +/* make header; from lundump.c */ +LUAI_FUNC void luaU_header (char* h); + +/* dump one chunk; from ldump.c */ +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); + +#ifdef luac_c +/* print one chunk; from print.c */ +LUAI_FUNC void luaU_print (const Proto* f, int full); +#endif + +/* for header of binary files -- this is Lua 5.1 */ +#define LUAC_VERSION 0x51 + +/* for header of binary files -- this is the official format */ +#define LUAC_FORMAT 0 + +/* size of header of binary files */ +#define LUAC_HEADERSIZE 12 + +#endif diff --git a/mylua/lua/lvm.c b/mylua/lua/lvm.c new file mode 100644 index 0000000..ee3256a --- /dev/null +++ b/mylua/lua/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/mylua/lua/lvm.h b/mylua/lua/lvm.h new file mode 100644 index 0000000..bfe4f56 --- /dev/null +++ b/mylua/lua/lvm.h @@ -0,0 +1,36 @@ +/* +** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + +#ifndef lvm_h +#define lvm_h + + +#include "ldo.h" +#include "lobject.h" +#include "ltm.h" + + +#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) + +#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ + (((o) = luaV_tonumber(o,n)) != NULL)) + +#define equalobj(L,o1,o2) \ + (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) + + +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); + +#endif diff --git a/mylua/lua/lzio.c b/mylua/lua/lzio.c new file mode 100644 index 0000000..293edd5 --- /dev/null +++ b/mylua/lua/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/mylua/lua/lzio.h b/mylua/lua/lzio.h new file mode 100644 index 0000000..51d695d --- /dev/null +++ b/mylua/lua/lzio.h @@ -0,0 +1,67 @@ +/* +** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ +** Buffered streams +** See Copyright Notice in lua.h +*/ + + +#ifndef lzio_h +#define lzio_h + +#include "lua.h" + +#include "lmem.h" + + +#define EOZ (-1) /* end of stream */ + +typedef struct Zio ZIO; + +#define char2int(c) cast(int, cast(unsigned char, (c))) + +#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) + +typedef struct Mbuffer { + char *buffer; + size_t n; + size_t buffsize; +} Mbuffer; + +#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) + +#define luaZ_buffer(buff) ((buff)->buffer) +#define luaZ_sizebuffer(buff) ((buff)->buffsize) +#define luaZ_bufflen(buff) ((buff)->n) + +#define luaZ_resetbuffer(buff) ((buff)->n = 0) + + +#define luaZ_resizebuffer(L, buff, size) \ + (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ + (buff)->buffsize = size) + +#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) + + +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + + +/* --------- Private Part ------------------ */ + +struct Zio { + size_t n; /* bytes still unread */ + const char *p; /* current position in buffer */ + lua_Reader reader; + void* data; /* additional data */ + lua_State *L; /* Lua state (for reader) */ +}; + + +LUAI_FUNC int luaZ_fill (ZIO *z); + +#endif diff --git a/mylua/lua/print.c b/mylua/lua/print.c new file mode 100644 index 0000000..e240cfc --- /dev/null +++ b/mylua/lua/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; iupvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; ip[i],full); +} diff --git a/mylua/magicbase.c b/mylua/magicbase.c new file mode 100644 index 0000000..b01c18b --- /dev/null +++ b/mylua/magicbase.c @@ -0,0 +1,49 @@ +#include +#include "common.h" +#include "char_talk.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" +#ifdef _ALLBLUES_LUA_1_2 +#include "mylua/mylua.h" +extern MY_Lua MYLua; + +static int addLUAListFunction(lua_State *L) +{ + size_t l; + char *luafuncname = luaL_checklstring(L, 1, &l); + char *luafunctable = luaL_checklstring(L, 2, &l); + char *luafunctablepath = luaL_checklstring(L, 3, &l); + const int gmlevel = luaL_checkint(L, 4); + char *usestring = luaL_checklstring(L, 5, &l); + + + if(strlen(luafunctablepath) > 0){ + MY_Lua *mylua = &MYLua; + while(mylua->next != NULL){ + if(strcmp(mylua->luapath, luafunctablepath) == 0){ + return MAGIC_addLUAListFunction( mylua->lua, luafuncname, luafunctable, gmlevel, usestring ); + } + mylua = mylua->next; + } + }else{ + return MAGIC_addLUAListFunction( L, luafuncname, luafunctable, gmlevel, usestring ); + } + return 1; + +} + +static const luaL_Reg magiclib[] = { + {"addLUAListFunction", addLUAListFunction}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Magic (lua_State *L) { + luaL_register(L, "magic", magiclib); + return 1; +} + +#endif + diff --git a/mylua/makefile b/mylua/makefile new file mode 100644 index 0000000..6c7033d --- /dev/null +++ b/mylua/makefile @@ -0,0 +1,1067 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include -I../include/lua + +CFLAGS=-w -O3 -g -rdynamic $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64 +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmylua.a + +SRC=mylua.c ablua.c init.c charbase.c npcbase.c function.c lssprotobase.c battlebase.c objectbase.c mapbase.c otherbase.c configbase.c itembase.c magicbase.c offlinebase.c netbase.c enemytempbase.c sasqlbase.c saacproto.c family.c petskill.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +dos2unix: + dos2unix $(SRC) makefile + +chmod: + chmod 777 $(SRC) makefile + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + chmod 777 makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +mylua.o: mylua.c /usr/include/signal.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/bits/sigset.h /usr/include/bits/types.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/typesizes.h /usr/include/bits/signum.h \ + /usr/include/time.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/sigthread.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/dirent.h /usr/include/bits/dirent.h \ + /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h \ + /usr/include/linux/limits.h ../include/autil.h ../include/version.h \ + ../include/sasql.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix2_lim.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/common.h ../include/buf.h ../include/util.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lua.h \ + ../include/lualib.h ../include/version.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h +ablua.o: ablua.c /usr/include/pthread.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sched.h \ + /usr/include/bits/types.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/dirent.h /usr/include/bits/dirent.h \ + /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h \ + /usr/include/linux/limits.h /usr/include/string.h \ + /usr/include/sys/types.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/sys/sysmacros.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h ../include/autil.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix2_lim.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/common.h ../include/util.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lua.h ../include/lualib.h ../include/mylua/base.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h ../include/link.h ../include/lauxlib.h \ + ../include/lualib.h ../include/version.h +init.o: init.c ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/lualib.h ../include/lua.h \ + ../include/lauxlib.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h ../include/mylua/base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h /usr/include/string.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h +charbase.o: charbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/battle.h ../include/object.h ../include/char_base.h \ + ../include/enemy.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npcutil.h ../include/readmap.h ../include/log.h \ + ../include/pet.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/version.h ../include/handletime.h \ + ../include/item_event.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +npcbase.o: npcbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/battle.h ../include/net.h ../include/common.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/sys/time.h /usr/include/time.h /usr/include/bits/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/netinet/in.h \ + /usr/include/stdint.h /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/alloca.h /usr/include/arpa/inet.h /usr/include/netdb.h \ + /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h ../include/correct_bug.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lualib.h ../include/npccreate.h ../include/object.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/enemy.h \ + ../include/npc_eventaction.h ../include/lua.h ../include/version.h \ + ../include/lauxlib.h ../include/lualib.h ../include/npcutil.h \ + ../include/log.h +function.o: function.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/item.h ../include/configfile.h ../include/battle.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/version.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/mylua.h ../include/mylua/function.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h +lssprotobase.o: lssprotobase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/autil.h +battlebase.o: battlebase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/common.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/enemy.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/battle.h ../include/battle_command.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/base.h ../include/char_base.h +objectbase.o: objectbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/object.h ../include/version.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/base.h \ + ../include/char_base.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h +mapbase.o: mapbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h ../include/map_deal.h ../include/char_base.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h +otherbase.o: otherbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/sys/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h ../include/char.h ../include/common.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h ../include/correct_bug.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/util.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +configbase.o: configbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/mylua.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/configfile.h +itembase.o: itembase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/item.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +magicbase.o: magicbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_talk.h ../include/common.h ../include/util.h \ + /usr/include/sys/time.h /usr/include/time.h /usr/include/bits/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h ../include/net.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/mylua/base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h ../include/correct_bug.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +offlinebase.o: offlinebase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/common.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/enemy.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/battle.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h +netbase.o: netbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/lauxlib.h ../include/lua.h ../include/lualib.h \ + ../include/net.h ../include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/log.h +enemytempbase.o: enemytempbase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h ../include/map_deal.h ../include/char_base.h \ + ../include/enemy.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h +sasqlbase.o: sasqlbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/lauxlib.h ../include/lua.h ../include/lualib.h \ + ../include/net.h ../include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/log.h \ + ../include/sasql.h /usr/include/mysql/mysql.h \ + /usr/include/mysql/mysql_version.h /usr/include/mysql/mysql_com.h \ + /usr/include/mysql/mysql_time.h /usr/include/mysql/typelib.h \ + /usr/include/mysql/my_alloc.h /usr/include/mysql/my_list.h +saacproto.o: saacproto.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h +family.o: family.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/family.h ../include/mylua/base.h \ + ../include/char_base.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +petskill.o: petskill.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/pet_skill.h ../include/util.h \ + ../include/common.h ../include/mylua/base.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/item.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h diff --git a/mylua/makefile.bak b/mylua/makefile.bak new file mode 100644 index 0000000..6c7033d --- /dev/null +++ b/mylua/makefile.bak @@ -0,0 +1,1067 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include -I../include/lua + +CFLAGS=-w -O3 -g -rdynamic $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64 +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libmylua.a + +SRC=mylua.c ablua.c init.c charbase.c npcbase.c function.c lssprotobase.c battlebase.c objectbase.c mapbase.c otherbase.c configbase.c itembase.c magicbase.c offlinebase.c netbase.c enemytempbase.c sasqlbase.c saacproto.c family.c petskill.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +dos2unix: + dos2unix $(SRC) makefile + +chmod: + chmod 777 $(SRC) makefile + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + chmod 777 makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +mylua.o: mylua.c /usr/include/signal.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/bits/sigset.h /usr/include/bits/types.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/typesizes.h /usr/include/bits/signum.h \ + /usr/include/time.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/sigthread.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/dirent.h /usr/include/bits/dirent.h \ + /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h \ + /usr/include/linux/limits.h ../include/autil.h ../include/version.h \ + ../include/sasql.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix2_lim.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/common.h ../include/buf.h ../include/util.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lua.h \ + ../include/lualib.h ../include/version.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h +ablua.o: ablua.c /usr/include/pthread.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sched.h \ + /usr/include/bits/types.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/dirent.h /usr/include/bits/dirent.h \ + /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h \ + /usr/include/linux/limits.h /usr/include/string.h \ + /usr/include/sys/types.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/sys/sysmacros.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h ../include/autil.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix2_lim.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/common.h ../include/util.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lua.h ../include/lualib.h ../include/mylua/base.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h ../include/link.h ../include/lauxlib.h \ + ../include/lualib.h ../include/version.h +init.o: init.c ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/lualib.h ../include/lua.h \ + ../include/lauxlib.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h ../include/mylua/base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h /usr/include/string.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h +charbase.o: charbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/battle.h ../include/object.h ../include/char_base.h \ + ../include/enemy.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npcutil.h ../include/readmap.h ../include/log.h \ + ../include/pet.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/version.h ../include/handletime.h \ + ../include/item_event.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +npcbase.o: npcbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/battle.h ../include/net.h ../include/common.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/sys/time.h /usr/include/time.h /usr/include/bits/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/netinet/in.h \ + /usr/include/stdint.h /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/alloca.h /usr/include/arpa/inet.h /usr/include/netdb.h \ + /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h ../include/correct_bug.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lualib.h ../include/npccreate.h ../include/object.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/enemy.h \ + ../include/npc_eventaction.h ../include/lua.h ../include/version.h \ + ../include/lauxlib.h ../include/lualib.h ../include/npcutil.h \ + ../include/log.h +function.o: function.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/item.h ../include/configfile.h ../include/battle.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/version.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/mylua.h ../include/mylua/function.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h +lssprotobase.o: lssprotobase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/autil.h +battlebase.o: battlebase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/common.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/enemy.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/battle.h ../include/battle_command.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/base.h ../include/char_base.h +objectbase.o: objectbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/object.h ../include/version.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/base.h \ + ../include/char_base.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h +mapbase.o: mapbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h ../include/map_deal.h ../include/char_base.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h +otherbase.o: otherbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/sys/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h ../include/char.h ../include/common.h \ + /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \ + /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h ../include/correct_bug.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/util.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +configbase.o: configbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/math.h /usr/include/bits/huge_val.h \ + /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/mylua.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/configfile.h +itembase.o: itembase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/common.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/mylua/base.h ../include/char_base.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/item.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +magicbase.o: magicbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_talk.h ../include/common.h ../include/util.h \ + /usr/include/sys/time.h /usr/include/time.h /usr/include/bits/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h ../include/net.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/mylua/base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h ../include/correct_bug.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/lua.h ../include/luaconf.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h +offlinebase.o: offlinebase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/common.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/enemy.h ../include/object.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/battle.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/mylua/mylua.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h +netbase.o: netbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/lauxlib.h ../include/lua.h ../include/lualib.h \ + ../include/net.h ../include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/log.h +enemytempbase.o: enemytempbase.c /usr/include/string.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + ../include/char.h ../include/common.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/char_base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/readmap.h ../include/map_deal.h ../include/char_base.h \ + ../include/enemy.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h +sasqlbase.o: sasqlbase.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/lua.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + ../include/luaconf.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h /usr/include/bits/stdio_lim.h \ + /usr/include/bits/sys_errlist.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/include/bits/sockaddr.h /usr/include/asm/socket.h \ + /usr/include/asm/sockios.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/arpa/inet.h \ + /usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/strings.h /usr/include/sys/time.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h ../include/correct_bug.h \ + ../include/lauxlib.h ../include/lua.h ../include/lualib.h \ + ../include/net.h ../include/common.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/log.h \ + ../include/sasql.h /usr/include/mysql/mysql.h \ + /usr/include/mysql/mysql_version.h /usr/include/mysql/mysql_com.h \ + /usr/include/mysql/mysql_time.h /usr/include/mysql/typelib.h \ + /usr/include/mysql/my_alloc.h /usr/include/mysql/my_list.h +saacproto.o: saacproto.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/mylua/base.h ../include/char_base.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h +family.o: family.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h ../include/char.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/char_base.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/family.h ../include/mylua/base.h \ + ../include/char_base.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/lua.h ../include/lauxlib.h \ + ../include/lualib.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +petskill.o: petskill.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + ../include/common.h /usr/include/stdio.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/version.h ../include/sasql.h /usr/include/stdlib.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + ../include/correct_bug.h ../include/pet_skill.h ../include/util.h \ + ../include/common.h ../include/mylua/base.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/lua.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/item.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/mylua/mylua.h diff --git a/mylua/mapbase.c b/mylua/mapbase.c new file mode 100644 index 0000000..51a02ae --- /dev/null +++ b/mylua/mapbase.c @@ -0,0 +1,97 @@ +#include +#include +#include "char.h" +#include "readmap.h" +#include "map_deal.h" +#include "char_base.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" + +#ifdef _ALLBLUES_LUA +#ifdef _ALLBLUES_LUA_1_1 +static int RandMap(lua_State *L) +{ + lua_pushinteger(L, MAP_getfloorId(rand()% MAP_getMapNum())); + return 1; +} + +static int RandXAndY(lua_State *L) +{ + const int ff = luaL_checkint(L, 1); + int fx,fy; + int i; + for(i=0;i<50;i++){ + fx = rand() % MAP_getfloorX(ff); + fy = rand() % MAP_getfloorY(ff); + + if(MAP_walkAbleFromPoint( ff,fx,fy,0 )==TRUE){ + lua_pushinteger(L, (fx << 16)|fy ); + return 1; + } + } + lua_pushinteger(L, -1); + return 1; +} + +static int getX(lua_State *L) +{ + const int XandY = luaL_checkint(L, 1); + lua_pushinteger(L, (XandY >> 16)&0xFFFF ); + return 1; +} + +static int getY(lua_State *L) +{ + const int XandY = luaL_checkint(L, 1); + lua_pushinteger(L, XandY&0xFFFF ); + return 1; +} +static int getfloorX(lua_State *L) +{ + const int floorid = luaL_checkint(L, 1); + lua_pushinteger(L, MAP_getfloorX(floorid) ); + return 1; +} + +static int getfloorY(lua_State *L) +{ + const int floorid = luaL_checkint(L, 1); + lua_pushinteger(L, MAP_getfloorY(floorid) ); + return 1; +} + +static int getFloorName(lua_State *L) +{ + const int floorid = luaL_checkint(L, 1); + + char escapeshowstring[256]; + char *showstr = MAP_getfloorShowstring(floorid); + + getStringFromIndexWithDelim( showstr, "|", 1, escapeshowstring, sizeof( escapeshowstring)); + + lua_pushstring(L, escapeshowstring); + return 1; +} + +static const luaL_Reg maplib[] = { + {"RandMap", RandMap}, + {"RandXAndY", RandXAndY}, + {"getfloorX", getfloorX}, + {"getfloorY", getfloorY}, + {"getFloorName", getFloorName}, + {"getX", getX}, + {"getY", getY}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Map (lua_State *L) { + luaL_register(L, "map", maplib); + return 1; +} +#endif + +#endif + diff --git a/mylua/mylua.c b/mylua/mylua.c new file mode 100644 index 0000000..2dbc713 --- /dev/null +++ b/mylua/mylua.c @@ -0,0 +1,346 @@ +#include +#include +#include +#include +#include +#include "autil.h" +#include "buf.h" +#include "util.h" +#define lua_c +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "version.h" +#include "mylua/mylua.h" + + +#ifdef _ALLBLUES_LUA + +MY_Lua MYLua; + +static const char *progname = LUA_PROGNAME; + +int getArrayInt(lua_State *L, int idx) { + int result = 0; + lua_pushnumber(L, idx + 1); + lua_gettable(L, -2); + result = (int)lua_tonumber(L, -1); + lua_pop(L, 1); + return result; +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + +char crypto[]=DEFAULTTABLE; + +void DecryptLua(char* buff, int len, int id) +{ + + int i; + int cryptolen = strlen(crypto); + for(i=0;id_name[0] == '.')continue; + if (ent->d_type==8){ + + if( (strcmptail( ent->d_name, ".lua" ) == 0 && flg == 1) + || (strcmptail( ent->d_name, ".allblues") == 0 && flg == 0)){ + char filename[256]; + char token[256]; + sprintf(filename, "%s/%s", path, ent->d_name); + + char *luabuff = NULL; + int luamaxlen = 0; + + if ((f=fopen(filename,"r"))!=NULL) { + fseek(f,0,SEEK_END); + luamaxlen = ftell(f); + luabuff = (char*)malloc(luamaxlen + 1); + memset(luabuff, 0, luamaxlen); + fseek(f,0,SEEK_SET); + fread(luabuff, luamaxlen, 1, f); + fclose(f); + } + + if( flg == 1 ){ + CryptoLua(luabuff, luamaxlen, id); + sprintf(token, "%s.allblues", filename); + }else if( flg == 0 ){ + DecryptLua(luabuff, luamaxlen, id); + sprintf(token, "%s", filename); + + token[strlen(token)-9] = '\0'; + } + if ((f=fopen(token,"w+"))!=NULL) { + fwrite(luabuff,1,luamaxlen,f); + fclose(f); + } + free(luabuff); + } + }else{ + sprintf(filename, "%s/%s", path, ent->d_name); + CryptoAllbluesLUA(filename, flg, id); + } + } +} +#endif +void Cryptodofile(lua_State *L, char *filename) +{ + FILE *f; + + char *luabuff; + char *cfbuff = NULL; + char *buff; + int luamaxlen = 0; + int cfmaxlen = 0; + char head[]="\nfunction init()\n"; + char end[]="\nend\n"; + char filenamecf[256]; + char loadfilename[256]; + strcpy(loadfilename, filename); + + if ((f=fopen(loadfilename,"r"))!=NULL) { + fseek(f,0,SEEK_END); + luamaxlen = ftell(f); + luabuff = (char*)malloc(luamaxlen + 1); + memset(luabuff, 0, luamaxlen + 1); + fseek(f,0,SEEK_SET); + fread(luabuff, luamaxlen, 1, f); + fclose(f); + }else{ + return; + } +/* + CryptoLua(buff, maxlen, _ATTESTAION_ID); + char token[256]; + sprintf(token, "%s.allblues", filename); + if ((f=fopen(token,"w+"))!=NULL) { + fwrite(buff,1,maxlen,f); + fclose(f); + } +*/ + + + DecryptLua(luabuff, luamaxlen, 1); + loadfilename[strlen(loadfilename)-9] = '\0'; + + sprintf(filenamecf, "%s.cf", filename); + if ((f=fopen(filenamecf,"r"))!=NULL) { + fseek(f,0,SEEK_END); + cfmaxlen = ftell(f); + cfbuff = (char*)malloc(cfmaxlen + 1); + memset(cfbuff, 0, cfmaxlen + 1); + fseek(f,0,SEEK_SET); + fread(cfbuff, cfmaxlen, 1, f); + + fclose(f); + } + + int len = luamaxlen + cfmaxlen + strlen(head) + strlen(end) + 1; + buff = (char*)malloc(len); + memset(buff, 0, len); + len = 0; + memcpy( buff + len, head, strlen(head)); + len += strlen(head); + if(cfmaxlen > 0){ + memcpy( buff + len, cfbuff, cfmaxlen); + free(cfbuff); + } + len += cfmaxlen; + memcpy( buff + len, end, strlen(end)); + len += strlen(end); + memcpy( buff + len, luabuff, luamaxlen); + + luaL_dostring(L, buff); + + free(buff); + free(luabuff); +} + +int myluaload (char *filename) +{ + MY_Lua *mylua = &MYLua; + while(mylua->next!=NULL){ + if(strcmp(mylua->luapath, filename) == 0){ + return FALSE; + } + mylua = mylua->next; + } + mylua->luapath = allocateMemory( strlen(filename) ); + memset( mylua->luapath, 0 , strlen(filename) ); + strcpy(mylua->luapath, filename); + mylua->next = allocateMemory( sizeof(MY_Lua) ); + memset( mylua->next, 0 , sizeof(MY_Lua) ); + if(mylua->next == NULL)return EXIT_FAILURE; + + mylua->lua = lua_open(); /* create state */ + + if (mylua->lua == NULL) { + return FALSE; + } + + lua_gc(mylua->lua, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(mylua->lua); /* open libraries */ + luaAB_openlibs(mylua->lua); + lua_gc(mylua->lua, LUA_GCRESTART, 0); + + if(strcmptail( filename, ".allblues" ) == 0){ + Cryptodofile(mylua->lua, filename); + }else{ + dofile(mylua->lua, filename); + } + + lua_getglobal(mylua->lua, "init"); + if (lua_isfunction(mylua->lua, -1)) { + docall(mylua->lua, 0, 1); + } + + lua_getglobal(mylua->lua, "main"); + + if (lua_isfunction(mylua->lua, -1)) { + docall(mylua->lua, 0, 1); + } + + return TRUE; +} + +int remyluaload (char *filename) +{ + MY_Lua *mylua = &MYLua; + + while(mylua->next!=NULL){ + if(strlen(mylua->luapath) > 0){ + if(strlen(filename)>0){ + if(strstr(mylua->luapath, filename) == 0){ + mylua = mylua->next; + continue; + } + } + + lua_gc(mylua->lua, LUA_GCSTOP, 0); + luaL_openlibs(mylua->lua); + luaAB_openlibs(mylua->lua); + lua_gc(mylua->lua, LUA_GCRESTART, 0); + if(strcmptail( mylua->luapath, ".allblues" ) == 0){ + if ((fopen(mylua->luapath,"r"))==NULL) { + mylua = mylua->next; + continue; + } + Cryptodofile(mylua->lua, mylua->luapath); + }else{ + dofile(mylua->lua, mylua->luapath); + } + + lua_getglobal(mylua->lua, "data"); + + if (lua_isfunction(mylua->lua, -1)) { + docall(mylua->lua, 0, 1); + } + + } + mylua = mylua->next; + } + + return EXIT_SUCCESS; +} + + +int closemyluaload() +{ + MY_Lua *mylua = &MYLua; + while(mylua->next!=NULL){ + lua_pop(mylua->lua, 1); + lua_close(mylua->lua); + mylua = mylua->next; + } + + return EXIT_SUCCESS; +} + + +#endif + diff --git a/mylua/netbase.c b/mylua/netbase.c new file mode 100644 index 0000000..61ab702 --- /dev/null +++ b/mylua/netbase.c @@ -0,0 +1,87 @@ +#include +#include "lua.h" +#include "version.h" +#include "lauxlib.h" +#include "lualib.h" +#include "net.h" +#include "log.h" + +#ifdef _ALLBLUES_LUA + +static int endOne(lua_State *L) +{ + const int sockfd = luaL_checkint(L, 1); + + CONNECT_endOne_debug(sockfd); + + return 1; +} + +static int userip(lua_State *L) +{ + int charaindex = luaL_checkint(L, 1); + + int sockfd = getfdFromCharaIndex(charaindex); + + unsigned long ip; + int a,b,c,d; + char strIP[32]; + ip = CONNECT_get_userip(sockfd); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + + sprintf(strIP, "%d.%d.%d.%d", a, b, c, d); + + lua_pushstring(L, strIP); + return 1; +} + +#ifdef _ALLBLUES_LUA_2_0 +static int getIP(lua_State *L) +{ + int sockfd = luaL_checkint(L, 1); + + unsigned long ip; + int a,b,c,d; + char strIP[32]; + ip = CONNECT_get_userip(sockfd); + + a=(ip % 0x100); ip=ip / 0x100; + b=(ip % 0x100); ip=ip / 0x100; + c=(ip % 0x100); ip=ip / 0x100; + d=(ip % 0x100); + + sprintf(strIP, "%d.%d.%d.%d", a, b, c, d); + + lua_pushstring(L, strIP); + return 1; +} + +static int getUse(lua_State *L) +{ + int fd = luaL_checkint(L, 1); + lua_pushboolean(L,CONNECT_getUse(fd )); + return 1; +} +#endif + +static const luaL_Reg netlib[] = { + {"endOne", endOne}, + {"userip", userip}, +#ifdef _ALLBLUES_LUA_2_0 + {"getIP", getIP}, + {"getUse", getUse}, +#endif + {NULL, NULL} +}; + + +LUALIB_API int luaopen_Net (lua_State *L) { + luaL_register(L, "net", netlib); + return 1; +} + +#endif diff --git a/mylua/npcbase.c b/mylua/npcbase.c new file mode 100644 index 0000000..d6bf534 --- /dev/null +++ b/mylua/npcbase.c @@ -0,0 +1,607 @@ +#include +#include "battle.h" +#include "char_base.h" +#include "npccreate.h" +#include "object.h" +#include "char.h" +#include "enemy.h" +#include "char_base.h" +#include "npc_eventaction.h" +#include "lua.h" +#include "version.h" +#include "lauxlib.h" +#include "lualib.h" +#include "npcutil.h" +#include "log.h" +#ifdef _ALLBLUES_LUA + +static int CreateNpc (lua_State *L) { + Char one; + size_t l; + CHAR_getDefaultChar( &one, 0); + one.data[CHAR_WHICHTYPE] = CHAR_TYPELUANPC; + char *Name = luaL_checklstring(L, 1, &l); + const int Image = luaL_checkinteger(L, 2); + const int Floor = luaL_checkinteger(L, 3); + const int x = luaL_checkinteger(L, 4); + const int y = luaL_checkinteger(L, 5); + const int dir = luaL_checkinteger(L, 6); + + strcpysafe( one.string[CHAR_NAME].string , + sizeof(one.string[CHAR_NAME].string), + Name); + one.data[CHAR_BASEBASEIMAGENUMBER] = Image; + one.data[CHAR_BASEIMAGENUMBER] = Image; + one.data[CHAR_FLOOR]=Floor; + one.data[CHAR_X]=x; + one.data[CHAR_Y]=y; + one.data[CHAR_DIR] = dir; + + int npcindex = CHAR_initCharOneArray(&one); + + if( npcindex < 0 ) { + print( "NPCʧܡ\n"); + } + + Object object; + int objindex; + + + object.type = OBJTYPE_CHARA; + object.index = npcindex; + object.x =CHAR_getInt(npcindex, CHAR_X); + object.y = CHAR_getInt(npcindex, CHAR_Y); + object.floor = CHAR_getInt(npcindex, CHAR_FLOOR); + + objindex = initObjectOne( &object ); + + if( objindex == -1 ) { + CHAR_endCharOneArray( npcindex ); + }else { + CHAR_setWorkInt( npcindex,CHAR_WORKOBJINDEX, objindex ); + CHAR_LoginBesideSetWorkInt( npcindex, -1 ); + } + + lua_pushinteger(L, npcindex); + return 1; +} + +#ifdef _DEL_FAME +static int DelFame (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionDelFame(index, data); + return 1; +} +#endif +static int AddGold (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionAddGold2(index, data); + return 1; +} + + +static int DelGold (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionDelGold(index, data); + return 1; +} +#ifdef _MOMENTUM_NPC +static int DelMom (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionMomentum(index, data); + return 1; +} +#endif +#ifdef _DP_NPC +static int DelDP (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionDP(index, data); + return 1; +} +#endif +static int DelItem (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionDelItem(index, data); + return 1; +} + + +static int AddItem (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionAddItem(index, data); + return 1; +} + +static int AddPet (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionAddPet(index, data); + return 1; +} + +static int EvEnd (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionSetEend(index, data); + return 1; +} + +static int EvNow (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionSetNow(index, data); + return 1; +} + +static int Event_End (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionSetEend(index, data); + return 1; +} + +static int Event_Now (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionSetNow(index, data); + return 1; +} + +static int EvClr (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionClearEvent(index, data); + return 1; +} + +#ifdef _VIP_SHOP +static int VipItem (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionVipItem(index, data); + return 1; +} + +static int VipPet (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionVipPet(index, data); + return 1; +} +#endif + +#ifdef _NEW_VIP_SHOP +static int Vip_Item (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionVipItem(index, data); + return 1; +} + +static int Vip_Pet (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionVipPet(index, data); + return 1; +} +#endif + +#ifdef _NPC_ADDLEVELUP +static int SetLevel (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionLevelAndTransUp( 0, index, atoi(data), 0, 0, -1); + return 1; +} + +static int AddExps (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionLevelAndTransUp( 0, index, 0, 0, atoi(data), -1); + return 1; +} + +static int AddSkillPoint (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionLevelAndTransUp( 0, index, 0, atoi(data), 0, -1); + return 1; +} + +static int SetRideType (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + + NPC_ActionLevelAndTransUp( 0, index, 0, 0, 0, atoi(data)); + return 1; +} +#endif + +static int isFaceToFace (lua_State *L) +{ + const int meindex = luaL_checkint(L, 1); + const int talkerindex = luaL_checkint(L, 2); + + + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){ + if( NPC_Util_CharDistance( talkerindex ,meindex ) > 1) { + lua_pushinteger(L, 0); + return 1; + } + } + + lua_pushinteger(L, 1); + return 1; +} + +static int ActionPassCheck (lua_State *L) +{ + size_t l; + const int meindex = luaL_checkint(L, 1); + const int toindex = luaL_checkint(L, 2); + char *data = luaL_checklstring(L, 3, &l); + + if( NPC_ActionPassCheck( meindex, toindex, data) == FALSE ) { + lua_pushinteger(L, 0); + return 1; + } + + lua_pushinteger(L, 1); + return 1; +} + + +#ifdef _ALLBLUES_LUA_1_1 +static int SetPoint (lua_State *L) +{ + const int meindex = luaL_checkint(L, 1); + const int ff = luaL_checkint(L, 2); + const int fx = luaL_checkint(L, 3); + const int fy = luaL_checkint(L, 4); + + OBJECT_setFloor(CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), ff); + OBJECT_setX(CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), fx); + OBJECT_setY(CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), fy); + CHAR_setInt(meindex, CHAR_FLOOR, ff); + CHAR_setInt(meindex, CHAR_X, fx); + CHAR_setInt(meindex, CHAR_Y, fy); + CHAR_sendCDArroundChar( ff, fx, fy, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + return 1; +} + + +static int DelItemNum (lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + char *data = luaL_checklstring(L, 2, &l); + char tmp[16]; + int itemID = 0; + int itemNUM = 0; + + if( getStringFromIndexWithDelim( data, ",", 1, tmp, sizeof( tmp)) != FALSE ){ + itemID = atoi(tmp); + } + + if( getStringFromIndexWithDelim( data, ",", 2, tmp, sizeof( tmp)) != FALSE ){ + itemNUM = atoi(tmp); + } + + int i, itemindex; + char token[256]; + int num=0; + + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + if(num >= itemNUM)break; + itemindex = CHAR_getItemIndex( index , i ); + if( !ITEM_CHECKINDEX(itemindex) ) continue; + if( ITEM_getInt(itemindex, ITEM_ID) != itemID ) continue; + sprintf( token, "%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( index, -1, token, CHAR_COLORYELLOW); + + LogItem( + CHAR_getChar( index, CHAR_NAME ), + CHAR_getChar( index, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "ȡ", + CHAR_getInt( index,CHAR_FLOOR), + CHAR_getInt( index,CHAR_X ), + CHAR_getInt( index,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_setItemIndex( index, i, -1); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( index, i); + num++; + } + + lua_pushinteger(L, num); + return 1; +} + +static int DelNpc (lua_State *L) +{ + const int index = luaL_checkint(L, 1); + + if( !CHAR_CHECKINDEX( index ) ){ + print( "ANDY index=%d err\n", index); + return 1; + } + + CHAR_ObjectDelete(CHAR_getWorkInt( index,CHAR_WORKOBJINDEX)); + + CHAR_endCharOneArray( index ); + return 1; +} + +#endif + + + +#ifdef _PLAYER_NPC +static int CreateSpecialNpc (lua_State *L) +{ + Char one; + size_t l; + CHAR_getDefaultChar( &one, 0); + one.data[CHAR_WHICHTYPE] = CHAR_TYPELUANPC; + char *Name = luaL_checklstring(L, 1, &l); + const int Image = luaL_checkinteger(L, 2); + const int Floor = luaL_checkinteger(L, 3); + const int x = luaL_checkinteger(L, 4); + const int y = luaL_checkinteger(L, 5); + const int dir = luaL_checkinteger(L, 6); + const int enemyid = luaL_checkint(L, 7); + const int UpLevel = luaL_checkinteger(L, 8); + int i; + for( i = 0; i < ENEMY_getEnemyNum(); i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == ENEMY_getEnemyNum() ){ + lua_pushinteger(L, -1); + return 1; + } + + int npcindex = ENEMY_createEnemy( i, 0); + if( npcindex < 0 ) { + print( "NPCʧܡ\n"); + } + CHAR_setInt(npcindex, CHAR_WHICHTYPE, CHAR_TYPEPLAYERNPC); + CHAR_setChar(npcindex, CHAR_NAME, Name); + CHAR_setInt(npcindex, CHAR_BASEBASEIMAGENUMBER, Image); + CHAR_setInt(npcindex, CHAR_BASEIMAGENUMBER, Image); + CHAR_setInt(npcindex, CHAR_FLOOR, Floor); + CHAR_setInt(npcindex, CHAR_X, x); + CHAR_setInt(npcindex, CHAR_Y, y); + CHAR_setInt(npcindex, CHAR_DIR, dir); + + CHAR_setInt(npcindex, CHAR_MODAI, 10000); + CHAR_setInt(npcindex, CHAR_VARIABLEAI,10000); + + for( i = 0; i < UpLevel; i ++ ){ + CHAR_PetLevelUp( npcindex ); + CHAR_PetAddVariableAi( npcindex, AI_FIX_PETLEVELUP ); + } + CHAR_complianceParameter( npcindex ); + CHAR_setInt( npcindex, CHAR_HP, CHAR_getWorkInt( npcindex, CHAR_WORKMAXHP )); + Object object; + int objindex; + + object.type = OBJTYPE_CHARA; + object.index = npcindex; + object.x =CHAR_getInt(npcindex, CHAR_X); + object.y = CHAR_getInt(npcindex, CHAR_Y); + object.floor = CHAR_getInt(npcindex, CHAR_FLOOR); + + objindex = initObjectOne( &object ); + + if( objindex == -1 ) { + CHAR_endCharOneArray( npcindex ); + }else { + CHAR_setWorkInt( npcindex,CHAR_WORKOBJINDEX, objindex ); + CHAR_LoginBesideSetWorkInt( npcindex, -1 ); + } + + lua_pushinteger(L, npcindex); + return 1; +} +#endif + +#ifdef _ALLBLUES_LUA_1_4 +#ifdef _PLAYER_NPC +static int CreatePlayer (lua_State *L) { + Char one; + size_t l; + CHAR_getDefaultChar( &one, 0); + one.data[CHAR_WHICHTYPE] = CHAR_TYPEPLAYERNPC; + char *Name = luaL_checklstring(L, 1, &l); + const int Image = luaL_checkinteger(L, 2); + const int Floor = luaL_checkinteger(L, 3); + const int x = luaL_checkinteger(L, 4); + const int y = luaL_checkinteger(L, 5); + const int dir = luaL_checkinteger(L, 6); + + strcpysafe( one.string[CHAR_NAME].string , + sizeof(one.string[CHAR_NAME].string), + Name); + one.data[CHAR_BASEBASEIMAGENUMBER] = Image; + one.data[CHAR_BASEIMAGENUMBER] = Image; + one.data[CHAR_FLOOR]=Floor; + one.data[CHAR_X]=x; + one.data[CHAR_Y]=y; + one.data[CHAR_DIR] = dir; + + int npcindex = CHAR_initCharOneArray(&one); + + if( npcindex < 0 ) { + print( "NPCʧܡ\n"); + } + + Object object; + int objindex; + + + object.type = OBJTYPE_CHARA; + object.index = npcindex; + object.x =CHAR_getInt(npcindex, CHAR_X); + object.y = CHAR_getInt(npcindex, CHAR_Y); + object.floor = CHAR_getInt(npcindex, CHAR_FLOOR); + + objindex = initObjectOne( &object ); + + if( objindex == -1 ) { + CHAR_endCharOneArray( npcindex ); + lua_pushinteger(L, -1); + return 1; + } + + CHAR_setWorkInt( npcindex,CHAR_WORKOBJINDEX, objindex ); + CHAR_LoginBesideSetWorkInt( npcindex, -1 ); + + CHAR_setFlg( npcindex, CHAR_ISDUEL, 0); + CHAR_setFlg( npcindex, CHAR_ISTRADECARD, 0); + CHAR_setFlg( npcindex, CHAR_ISTRADE, 0); + CHAR_setFlg( npcindex, CHAR_ISPARTY, 0); + + lua_pushinteger(L, npcindex); + return 1; +} +#endif +#endif + + +static const luaL_Reg npclib[] = { + {"CreateNpc", CreateNpc}, +#ifdef _DEL_FAME + {"DelFame", DelFame}, +#endif + {"AddGold", AddGold}, + {"DelGold", DelGold}, +#ifdef _MOMENTUM_NPC + {"DelMom", DelMom}, +#endif +#ifdef _DP_NPC + {"DelDP", DelDP}, +#endif + {"DelItem", DelItem}, + {"AddItem", AddItem}, + {"AddPet", AddPet}, + {"EvEnd", EvEnd}, + {"EvNow", EvNow}, + {"Event_End", Event_End}, + {"Event_Now", Event_Now}, + {"EvClr", EvClr}, +#ifdef _VIP_SHOP + {"VipItem", VipItem}, + {"VipPet", VipPet}, +#endif +#ifdef _NEW_VIP_SHOP + {"Vip_Item", Vip_Item}, + {"Vip_Pet", Vip_Pet}, +#endif +#ifdef _NPC_ADDLEVELUP + {"SetLevel", SetLevel}, + {"AddExps", AddExps}, + {"AddSkillPoint", AddSkillPoint}, + {"SetRideType", SetRideType}, +#endif + {"isFaceToFace", isFaceToFace}, + {"Free", ActionPassCheck}, +#ifdef _ALLBLUES_LUA_1_1 + {"SetPoint", SetPoint}, + {"DelItemNum", DelItemNum}, + {"DelNpc", DelNpc}, +#endif +#ifdef _PLAYER_NPC + {"CreateSpecialNpc", CreateSpecialNpc}, +#ifdef _ALLBLUES_LUA_1_4 + {"CreatePlayer", CreatePlayer}, +#endif +#endif + {NULL, NULL} +}; + + +LUALIB_API int luaopen_NPC (lua_State *L) { + luaL_register(L, "npc", npclib); + return 1; +} + +#endif diff --git a/mylua/objectbase.c b/mylua/objectbase.c new file mode 100644 index 0000000..c96bc55 --- /dev/null +++ b/mylua/objectbase.c @@ -0,0 +1,140 @@ +#include +#include "char_base.h" +#include "object.h" +#include "version.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "mylua/base.h" + +#ifdef _ALLBLUES_LUA + +static CharBase CharBaseObj[] = { + {{"ɫ"}, OBJTYPE_CHARA} + ,{{""}, OBJTYPE_ITEM} + ,{{""}, OBJTYPE_GOLD} + ,{{""}, OBJTYPE_WARPPOINT} +}; + +static int check (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, CHECKOBJECT(index)); + return 1; +} + +static int getType (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getType(index)); + return 1; +} + +static int setType (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, CharBaseObj, arraysizeof(CharBaseObj)); + OBJECT_setType(index, element); + return 1; +} + +static int getFloor (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getFloor(index)); + return 1; +} + +static int setFloor (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int floor = luaL_checkint(L, 2); + OBJECT_setFloor(index, floor); + return 1; +} + +static int getX (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getX(index)); + return 1; +} + +static int setX (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int x = luaL_checkint(L, 2); + OBJECT_setX(index, x); + return 1; +} + +static int getY (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getY(index)); + return 1; +} + +static int setY (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int y = luaL_checkint(L, 2); + OBJECT_setY(index, y); + return 1; +} + +static int getIndex (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getIndex(index)); + return 1; +} + +static int getNum (lua_State *L) { + lua_pushinteger(L, OBJECT_getNum()); + return 1; +} +static int setIndex (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int charaindex = luaL_checkint(L, 2); + OBJECT_setIndex(index, charaindex); + return 1; +} + +static int getchartype (lua_State *L) { + const int index = luaL_checkint(L, 1); + lua_pushinteger(L, OBJECT_getchartype(index)); + return 1; +} + +static int setchartype (lua_State *L) { + const int index = luaL_checkint(L, 1); + const int flg = luaL_checkint(L, 2); + OBJECT_setchartype(index, flg); + return 1; +} + +static int DelObjectOne (lua_State *L) { + const int index = luaL_checkint(L, 1); + endObjectOne(index); + return 1; +} + + +static const luaL_Reg objectlib[] = { + {"check", check}, + {"getType", getType}, + {"setType", setType}, + {"getFloor", getFloor}, + {"setFloor", setFloor}, + {"getX", getX}, + {"setX", setX}, + {"getY", getY}, + {"setY", setY}, + {"getIndex", getIndex}, + {"setIndex", setIndex}, + {"getNum", getNum}, + {"getchartype", getchartype}, + {"setchartype", setchartype}, + {"DelObjectOne", DelObjectOne}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_Object (lua_State *L) { + luaL_register(L, "obj", objectlib); + return 1; +} + +#endif + diff --git a/mylua/offlinebase.c b/mylua/offlinebase.c new file mode 100644 index 0000000..fcced2d --- /dev/null +++ b/mylua/offlinebase.c @@ -0,0 +1,89 @@ +#include +#include "version.h" +#include "char_base.h" +#include "enemy.h" +#include "object.h" +#include "char.h" +#include "battle.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "mylua/mylua.h" + +#ifdef _OFFLINE_SYSTEM +static int Attack(lua_State *L) +{ + const int battleindex = luaL_checkint(L, 1); + const int charaindex = luaL_checkint(L, 2); + const int side = 1 - luaL_checkint(L, 3); + + + + BATTLE_ENTRY *pEntry = BattleArray[battleindex].Side[side].Entry; + int iNum[10] = {9,7,5,6,8,4,2,0,1,3}; + int i; + for( i = 0; i < 10; i ++ ){ + if( pEntry[iNum[i]].charaindex != -1 ){ + break; + } + } + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, iNum[i] + side * BATTLE_ENTRY_MAX); + int At_SoubiIndex = CHAR_getItemIndex( charaindex, CHAR_ARM ); + if( ITEM_CHECKINDEX( At_SoubiIndex ) == TRUE ) + { + if( ITEM_getInt( At_SoubiIndex, ITEM_TYPE ) == ITEM_BOOMERANG ){ + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_BOOMERANG ); +#ifdef _PETSKILL_BECOMEFOX + if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER)==101749 + || CHAR_getWorkInt( charaindex, CHAR_WORKFOXROUND ) != -1 ){ //DZС겻ʹû + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_NONE ); + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charaindex, CHAR_BECOMEPIG) > -1 ){// + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_ATTACK ); + } +#endif + } + } + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, 1 ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return 1; +} + +static int Recovery(lua_State *L) +{ + const int battleindex = luaL_checkint(L, 1); + const int charaindex = luaL_checkint(L, 2); + const int HP = luaL_checkint(L, 3); + + + int toNO = BATTLE_Index2No(battleindex, charaindex); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_S_OFFLINE_RECOVERY ); + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNO); + CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, HP ); + + CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK ); + + return 1; +} + + + +static const luaL_Reg offlinelib[] = { + {"Attack", Attack}, + {"Recovery", Recovery}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_Offline (lua_State *L) { + luaL_register(L, "offline", offlinelib); + return 1; +} + +#endif + diff --git a/mylua/otherbase.c b/mylua/otherbase.c new file mode 100644 index 0000000..9ec48fd --- /dev/null +++ b/mylua/otherbase.c @@ -0,0 +1,126 @@ +#include +#include +#include +#include "char.h" +#include "char_base.h" +#include "mylua/base.h" +#include "util.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" +#include "mylua/mylua.h" + +#ifdef _ALLBLUES_LUA +extern MY_Lua MYLua; + +static int nowtime(lua_State *L) +{ + lua_pushinteger(L, (int) time( NULL )); + return 1; +} + +static int strtoi(lua_State *L) +{ + size_t l; + char *data=luaL_checklstring(L, 1, &l); + lua_pushinteger(L, atoi(data)); + return 1; +} + +static int getString(lua_State *L) +{ + size_t l; + char *data = luaL_checklstring(L, 1, &l); + char *delim = luaL_checklstring(L, 2, &l); + const int index = luaL_checkint(L, 3); + + char token[256]; + if(getStringFromIndexWithDelim( data, delim, index, token, sizeof( token))){ + lua_pushstring(L, token); + }else{ + lua_pushstring(L, ""); + } + return 1; +} + +static int CallFunction(lua_State *L) +{ + size_t l; + char *funcname = luaL_checklstring(L, 1, &l); + char *filename = luaL_checklstring(L, 2, &l); + char newfilename[256]; + luaL_checktype(L, 3, LUA_TTABLE); + int n = luaL_getn(L, 3); + + lua_State *lua = NULL; + + MY_Lua *mylua = &MYLua; + while(mylua->next != NULL){ + if(strcmptail( mylua->luapath, ".allblues" ) == 0 + && strcmptail( filename, ".lua" ) == 0 ){ + sprintf(newfilename, "%s.allblues", filename); + }else{ + sprintf(newfilename, "%s", filename); + } + + if(strcmp(newfilename, mylua->luapath) == 0){ + lua = mylua->lua; + break; + } + mylua = mylua->next; + } + if (lua == NULL) { + return FALSE; + } + + lua_getglobal(lua, funcname); + + if (!lua_isfunction(lua, -1)) { + return FALSE; + } + + int i; + + for(i = 0; i < n; i++){ + lua_pushnumber(lua, getArrayInt(L, i)); + } + + + lua_pcall(lua, n, 1, 0); + + lua_isnumber(lua, -1); + + int ret = lua_tonumber(lua, -1); + lua_pushinteger(L, ret); + return TRUE; +} + + +static int c10to62(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + + char token[256]; + cnv10to62( index, token, sizeof(token)); + + lua_pushstring(L, token); + return 1; +} + +static const luaL_Reg otherlib[] = { + {"time", nowtime}, + {"atoi", strtoi}, + {"getString", getString}, + {"CallFunction", CallFunction}, + {"c10to62", c10to62}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Other (lua_State *L) { + luaL_register(L, "other", otherlib); + return 1; +} + +#endif + diff --git a/mylua/petskill.c b/mylua/petskill.c new file mode 100644 index 0000000..0299e49 --- /dev/null +++ b/mylua/petskill.c @@ -0,0 +1,115 @@ +#include +#include "common.h" +#include "version.h" +#include "pet_skill.h" +#include "mylua/base.h" +#include "char.h" +#include "item.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "lssproto_serv.h" + +#ifdef _ALLBLUES_LUA_1_8 +#include "mylua/mylua.h" +extern MY_Lua MYLua; +static CharBase PetSkillBaseInt[] = { + {{""}, PETSKILL_ID} + ,{{"ֶ"}, PETSKILL_FIELD} + ,{{"Ŀ"}, PETSKILL_TARGET} +#ifdef _PETSKILL2_TXT + ,{{""}, PETSKILL_USETYPE} +#endif + ,{{"ֵ"}, PETSKILL_COST} + ,{{"Ƿ"}, PETSKILL_ILLEGAL} +}; + +static CharBase PetSkillBaseChar[] = { + {{""}, PETSKILL_NAME} + ,{{"ע"}, PETSKILL_COMMENT} + ,{{""}, PETSKILL_FUNCNAME} + ,{{"ѡ"}, PETSKILL_OPTION} +#ifdef _CFREE_petskill + ,{{""}, PETSKILL_FREE} + ,{{""}, PETSKILL_KINDCODE} +#endif +}; + +static int getInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, PetSkillBaseInt, arraysizeof(PetSkillBaseInt)); + + lua_pushinteger(L, PETSKILL_getInt(index, element)); + return 1; +} + +static int setInt(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, PetSkillBaseInt, arraysizeof(PetSkillBaseInt)); + const int data = luaL_checkint(L, 3); + + if(PETSKILL_setInt(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int getChar(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, PetSkillBaseChar, arraysizeof(PetSkillBaseChar)); + + lua_pushstring(L, PETSKILL_getChar(index, element)); + return 1; +} + +static int setChar(lua_State *L) +{ + size_t l; + const int index = luaL_checkint(L, 1); + const int element = getCharBaseValue(L, 2, PetSkillBaseChar, arraysizeof(PetSkillBaseChar)); + char *data = luaL_checklstring(L, 3, &l); + + if(PETSKILL_setChar(index, element, data) == -1){ + return 0; + }else{ + return 1; + } +} + +static int check(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + + lua_pushinteger(L, PETSKILL_CHECKINDEX(index)); + return 1; +} + +static int getPetskillArray(lua_State *L) +{ + const int index = luaL_checkint(L, 1); + + lua_pushinteger(L, PETSKILL_getPetskillArray(index)); + return 1; +} + +static const luaL_Reg petskilllib[] = { + {"getInt", getInt}, + {"setInt", setInt}, + {"getChar", getChar}, + {"setChar", setChar}, + {"check", check}, + {"getPetskillArray", getPetskillArray}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_PetSkill (lua_State *L) { + luaL_register(L, "petskill", petskilllib); + return 1; +} + +#endif + diff --git a/mylua/saacproto.c b/mylua/saacproto.c new file mode 100644 index 0000000..986ff95 --- /dev/null +++ b/mylua/saacproto.c @@ -0,0 +1,51 @@ +#include +#include "char.h" +#include "char_base.h" +#include "mylua/base.h" +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +#include "saacproto_cli.h" + +#ifdef _ALLBLUES_LUA +static int ACFixFMPoint(lua_State *L) +{ + size_t l; + char *winfmname=luaL_checklstring(L, 1, &l); + const int winfmindex = luaL_checkint(L, 2); + const int winindex = luaL_checkint(L, 3); + char *losefmname=luaL_checklstring(L, 4, &l); + const int losefmindex = luaL_checkint(L, 5); + const int loseindex = luaL_checkint(L, 6); + const int village = luaL_checkint(L, 7); + + saacproto_ACFixFMPoint_send(acfd, winfmname, winfmindex, winindex, losefmname, losefmindex, loseindex, village); + + return 1; +} + +static int ACFMDetail(lua_State *L) +{ + size_t l; + char *fmname=luaL_checklstring(L, 1, &l); + const int fmindex = luaL_checkint(L, 2); + const int tempindex = luaL_checkint(L, 3); + const int fd = luaL_checkint(L, 4); + saacproto_ACFMDetail_send( acfd, fmname, fmindex, tempindex, CONNECT_getFdid(fd)); + return 1; +} + +static const luaL_Reg Saacprotolib[] = { + {"ACFixFMPoint", ACFixFMPoint}, + {"ACFMDetail", ACFMDetail}, + + {NULL, NULL} +}; + +LUALIB_API int luaopen_Saacproto (lua_State *L) { + luaL_register(L, "saacproto", Saacprotolib); + return 1; +} + +#endif + diff --git a/mylua/sasqlbase.c b/mylua/sasqlbase.c new file mode 100644 index 0000000..48c2c1c --- /dev/null +++ b/mylua/sasqlbase.c @@ -0,0 +1,167 @@ +#include +#include "lua.h" +#include "version.h" +#include "lauxlib.h" +#include "lualib.h" +#include "net.h" +#include "log.h" +#include "sasql.h" + +#ifdef _ALLBLUES_LUA +#ifdef _ALLBLUES_LUA_1_4 +#ifdef _SASQL +#include +extern MYSQL mysql; +MYSQL_RES *mysql_result; +MYSQL_ROW mysql_row; +MYSQL_FIELD *fields; +int numrow = 0; +int numfields = 0; +static int setVipPoint(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int point = luaL_checkint(L, 2); + + sasql_setVipPoint(charaindex, point); + return 1; +} + +static int setJfPoint(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int point = luaL_checkint(L, 2); + + sasql_setJfPoint(charaindex, point); + return 1; +} + +static int setxjPoint(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + const int point = luaL_checkint(L, 2); + + sasql_setxjPoint(charaindex, point); + return 1; +} + +static int getVipPoint(lua_State *L) +{ + const int charaindex = luaL_checkint(L, 1); + + lua_pushinteger(L, sasql_getVipPoint(charaindex)); + return 1; +} + +static int getJfPoint(lua_State *L) +{ +// printf("һη\n"); + const int charaindex = luaL_checkint(L, 1); + + lua_pushinteger(L, sasql_jifenPoint(charaindex)); + return 1; +} + +static int getxjPoint(lua_State *L) +{ +// printf("һη\n"); + const int charaindex = luaL_checkint(L, 1); + + lua_pushinteger(L, sasql_xjPoint(charaindex)); + return 1; +} + +static int setVipPointForCdkey(lua_State *L) +{ + size_t l; + char *id=luaL_checklstring(L, 1, &l); + const int point = luaL_checkint(L, 2); + + sasql_setVipPointForCdkey(id, point); + return 1; +} + +static int getVipPointForCdkey(lua_State *L) +{ + size_t l; + char *id=luaL_checklstring(L, 1, &l); + lua_pushinteger(L, sasql_getVipPointForCdkey(id)); + return 1; +} + +static int query(lua_State *L) +{ + size_t l; + char *data=luaL_checklstring(L, 1, &l); + + if(!sasql_mysql_query(data)){ + lua_pushinteger(L, 1); + }else{ + lua_pushinteger(L, 0); + } + return 1; +} + +static int free_result(lua_State *L) +{ + mysql_free_result(mysql_result); + return 1; +} + +static int store_result(lua_State *L) +{ + mysql_result=mysql_store_result(&mysql); + return 1; +} + +static int num_rows(lua_State *L) +{ + numrow=mysql_num_rows(mysql_result); + lua_pushinteger(L, numrow); + return 1; +} + +static int num_fields(lua_State *L) +{ + lua_pushinteger(L, numfields); + return 1; +} + +static int fetch_row(lua_State *L) +{ + mysql_row = mysql_fetch_row(mysql_result); + return 1; +} + +static int data(lua_State *L) +{ + int id = luaL_checkint(L, 1) - 1; + lua_pushstring(L, mysql_row[id]); + return 1; +} + +static const luaL_Reg sasqllib[] = { + {"setVipPoint", setVipPoint}, + {"getVipPoint", getVipPoint}, + {"setJfPoint", setJfPoint}, + {"getJfPoint", getJfPoint}, + {"setxjPoint", setxjPoint}, + {"getxjPoint", getxjPoint}, + {"query", query}, + {"free_result", free_result}, + {"store_result", store_result}, + {"num_rows", num_rows}, + {"fetch_row", fetch_row}, + {"num_fields", num_fields}, + {"data", data}, + {"setVipPointForCdkey", setVipPointForCdkey}, + {"getVipPointForCdkey", getVipPointForCdkey}, + {NULL, NULL} +}; + +LUALIB_API int luaopen_Sasql (lua_State *L) { + luaL_register(L, "sasql", sasqllib); + return 1; +} +#endif +#endif +#endif diff --git a/net.c b/net.c new file mode 100644 index 0000000..665f23b --- /dev/null +++ b/net.c @@ -0,0 +1,4532 @@ +#define __NET_C__ +#include "version.h" +//#define __FD_SETSIZE 2048 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//ttom+1 + +#include +#define _SOCKET_NONBLOCK +#ifdef _SOCKET_NONBLOCK +#include +#endif +#include "net.h" +#include "buf.h" +#include "link.h" +#include "common.h" +#include "msignal.h" +#include "configfile.h" +#include "util.h" +#include "saacproto_cli.h" +#include "lssproto_serv.h" +#include "char.h" +#include "handletime.h" +#include "log.h" +#include "object.h" +#include "title.h" +#include "item_event.h" +#include "enemy.h" +// Arminius 7.31 cursed stone +#include "battle.h" +#include "version.h" +#include "pet_event.h" +#include "char_talk.h" +#include "petmail.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +#ifdef _AUTO_PK +#include "npc_autopk.h" +#endif +#include "attestation.h" + + +#define MIN(x,y) ( ( (x) < (y) ) ? (x) : (y) ) + +#ifdef _NEW_SERVER_ +BOOL bNewServer = TRUE; +#else +BOOL bNewServer = FALSE; +#endif + +// Nuke +1 0901: For state monitor +int StateTable[ WHILESAVEWAIT + 1 ]; + +int ITEM_getRatio(); +int CHAR_players(); +#define CONO_CHECK_LOGIN 0x001 +#define CONO_CHECK_ITEM 0x010 +#define CONO_CHECK_PET 0x100 +int cono_check = 0x111; +extern int questionstarttime; +extern int questionman; +extern char answer[64]; +int AC_WBSIZE = ( 1024*64*16 ); +//ttom+1 for the performatce +static unsigned int MAX_item_use = 0; +int i_shutdown_time = 0; //ttom +BOOL b_first_shutdown = FALSE; //ttom + +int mfdfulll = 0; +int yzcnt = 0; +unsigned int atttime=0; +#ifdef _NO_ATTACK +static unsigned long useripnum = 100000; +static unsigned long* userip = 0; +static unsigned long* userip_count_data = 0; +static unsigned long useripcount = 0; +static unsigned long* useriptime = 0; +#endif +#ifdef _PK_LUCK_MAN +int pkluckhour = -1; +int pkluckmin = -1; +int pklucknum = 0; +#endif +extern int autopkstart; +static int autopkend=0; +static int autopkone = 0; +extern char *DebugMainFunction; +/*------------------------------------------------------------ +* ӡP +------------------------------------------------------------*/ +typedef struct tag_serverState +{ + BOOL acceptmore; /* 1գaccept ؤ + нƥclose */ + unsigned int fdid; /* fd ɧԻ */ + unsigned int closeallsocketnum; /* closeallsocket Ի + */ + int shutdown; /* ӡëshutdownƹ + * 0:ɧ ľ½:ƹ + * ƹئ޻ Ȼ£ + */ + int dsptime; /* shutdown ƹ񼰷 */ + int limittime; /* ľ */ +}ServerState; + +#ifdef _CAX_LNS_NLSUOXU +typedef struct tagFuncKk +{ + char *FileName; /*ű·*/ + char *FuncName; /*ִк*/ + unsigned int EspTime; + unsigned int MespTime; + int ID; + unsigned int GetTime; +}FuncKk; + +FuncKk TimerLua[50]; +void SetTimerLua(void)//ʼLUAʱ +{ + int i; + for( i = 0 ; i < arraysizeof( TimerLua ) ; i ++ ){ + TimerLua[i].FileName = NULL; + TimerLua[i].FuncName = NULL; + TimerLua[i].EspTime = -1; + TimerLua[i].MespTime=-1; + TimerLua[i].ID = -1; + TimerLua[i].GetTime = -1; + } +} + +int SetTimer_net(char *FileName,char *FuncName,unsigned int EspTime) +{ + int i; + for( i = 0 ; i < arraysizeof( TimerLua ) ; i ++ ){ + if (TimerLua[i].ID == -1) break; + } + TimerLua[i].FileName = FileName; + TimerLua[i].FuncName = FuncName; + TimerLua[i].EspTime = NowTime.tv_sec; + TimerLua[i].MespTime= NowTime.tv_usec; + TimerLua[i].ID = i+1; + TimerLua[i].GetTime = EspTime*1024; + return i+1; +} +#endif + +typedef struct tagCONNECT +{ + BOOL use; + + char *rb; + int rbuse; + char *wb; + int wbuse; + int check_rb_oneline_b; + int check_rb_time; + pthread_mutex_t mutex; + + struct sockaddr_in sin; /* Ƽʧ */ + ConnectType ctype; /* ˒ */ + + char cdkey[ CDKEYLEN ]; /* CDKEY */ + char passwd[ PASSWDLEN ]; /* ɵ */ + LoginType state; /* ػ̼ */ + int nstatecount; + char charname[ CHARNAMELEN ]; /* ̼wƽҷ’o */ + int charaindex; /* char?d߼̼͵z + * ̼ԉɬýľ©z-1ɻ + * ?dئݩz + */ + char CAbuf[ 2048 ]; /* CA() ë¿м */ + int CAbufsiz; /* CAbuf */ + + struct timeval lastCAsendtime; /*ԉCAë˪ */ + + char CDbuf[ 2048 ]; /* CD() ë¿м */ + int CDbufsiz; /* CDbuf */ + + struct timeval lastCDsendtime; /*ԉCDë˪ */ + + struct timeval lastCharSaveTime; /* ԉƽҷ·ëƤ */ + + struct timeval lastprocesstime; /* ԉëʆA*/ + + struct timeval lastreadtime; /* ԉreadީz練л*/ + + // Nuke start 08/27 : For acceleration avoidance + // WALK_TOLERANCE: Permit n W messages in a second (3: is the most restricted) +#define WALK_TOLERANCE 4 +#define WALK_SPOOL 5 +#define WALK_RESTORE 100 + unsigned int Walktime; + unsigned int lastWalktime; + unsigned int Walkcount; + int Walkspool; // For walk burst after release key F10 + int Walkrestore; + // B3_TOLERANCE: Time distance between recently 3 B message (8: is the latgest) + // BEO_TOLERANCE: Time distance between the lastmost B and EO (5: is the largest) +#define B3_TOLERANCE 5 +#define BEO_TOLERANCE 3 +#define BEO_SPOOL 10 +#define BEO_RESTORE 100 + unsigned int Btime; + unsigned int lastBtime; + unsigned int lastlastBtime; + unsigned int EOtime; + +#ifdef _BATTLE_TIMESPEED + // unsigned int DefBtime; + int BDTime; + int CBTime; +#endif + +#ifdef _TYPE_TOXICATION + int toxication; +#endif + +#ifdef _ITEM_ADDEXP //vincent N + int EDTime; +#endif + // unsigned int BEO; + int BEOspool; + int BEOrestore; + // Nuke 0219: Avoid cheating + int die; + // Nuke end + // Nuke 0310 + int credit; + int fcold; + // Nuke 0406: New Flow Control + int nu; + int nu_decrease; + int ke; + // Nuke 1213: Flow Control 2 + int packetin; + + // Nuke 0624: Avoid Null Connection + unsigned int cotime; + // Nuke 0626: For no enemy + int noenemy; + // Arminius 7.2: Ra's amulet + int eqnoenemy; +#ifdef _Item_MoonAct + int eqrandenemy; +#endif + +#ifdef _CHIKULA_STONE + int chistone; +#endif + // Arminius 7.31: cursed stone + int stayencount; + + int battlecharaindex[ CONNECT_WINDOWBUFSIZE ]; + int duelcharaindex[ CONNECT_WINDOWBUFSIZE ]; + int tradecardcharaindex[ CONNECT_WINDOWBUFSIZE ]; + int joinpartycharaindex[ CONNECT_WINDOWBUFSIZE ]; + + // CoolFish: Trade 2001/4/18 + int tradecharaindex[ CONNECT_WINDOWBUFSIZE ]; + int errornum; + int rightnum; + int fdid; + + int close_request; //the second have this + + int appendwb_overflow_flag; /* 1ƥappendWb?1 */ + //ttom+1 avoidance the watch the battle be kept out + BOOL in_watch_mode; + BOOL b_shut_up; //for avoid the user wash the screen + BOOL b_pass; //for avoid the unlimited area + + struct timeval Wtime; + + struct timeval WLtime; + BOOL b_first_warp; + int state_trans; + + // CoolFish: Trade 2001/4/18 + char TradeTmp[ 256 ]; + +#ifdef _ITEM_PILEFORTRADE + int tradelist; +#endif + // Shan Recvdata Time + + struct timeval lastrecvtime; // 'FM' Stream Control time + + struct timeval lastrecvtime_d; // DENGON Talk Control time + + // Arminius: 6.22 encounter + int CEP; // Current Encounter Probability + // Arminius 7.12 login announce + int announced; + + // shan battle delay time 2001/12/26 + + struct timeval battle_recvtime; +#ifdef _NO_WARP + // shan hjj add Begin + int seqno; + int selectbutton; + // shan End +#endif + unsigned int starttime; + unsigned int connecttime; + char pcid[64]; + char oldpcid[64]; + char defaultkey[32]; + BOOL confirm_key; // shan trade(DoubleCheck) +#ifdef _CAX_NEWMAC_LOGIN + char mac[13]; +#endif +} +CONNECT; + +CONNECT *Connect; /*ͥݤ*/ + + +/* ؿƬˤĤƤ狼褦ˤΥޥ */ +#define SINGLETHREAD +#define MUTLITHREAD +#define ANYTHREAD + +ServerState servstate; + +pthread_mutex_t MTIO_servstate_m; +#define SERVSTATE_LOCK() pthread_mutex_lock( &MTIO_servstate_m ); +#define SERVSTATE_UNLOCK() pthread_mutex_unlock( &MTIO_servstate_m ); +#define CONNECT_LOCK_ARG2(i,j) pthread_mutex_lock( &Connect[i].mutex ); +#define CONNECT_UNLOCK_ARG2(i,j) pthread_mutex_unlock( &Connect[i].mutex ); +#define CONNECT_LOCK(i) pthread_mutex_lock( &Connect[i].mutex ); +#define CONNECT_UNLOCK(i) pthread_mutex_unlock( &Connect[i].mutex ); +/* +#define SERVSTATE_LOCK() +#define SERVSTATE_UNLOCK() +#define CONNECT_LOCK_ARG2(i,j) +#define CONNECT_UNLOCK_ARG2(i,j) +#define CONNECT_LOCK(i) +#define CONNECT_UNLOCK(i) +*/ +char* encrypt_key(char* ip)//ܺ +{ + int b[]={3,7,8,2,9,5,4}; + int i=0; + while(*ip!=NULL) + { + *ip+=b[i%7]; + if(*ip> 122) + *ip=*ip%122+32; + i++,ip++; + } + return ip; +} + +char* decrypt_key(char* id)//ܺ +{ + int b[]={3,7,8,2,9,5,4}; + int i=0; + while(*id!=NULL) + { + *id-=b[i%7]; + if(*id <32) + *id=*id-32+122; + i++,id++; + } + return id; +} +/*------------------------------------------------------------ +* servstateë©z +* ¦ѩy߯Ի +* ئ +------------------------------------------------------------*/ +ANYTHREAD static void SERVSTATE_initserverState( void ) +{ + SERVSTATE_LOCK(); + servstate.acceptmore = TRUE; + servstate.fdid = 0; + servstate.closeallsocketnum = -1; + servstate.shutdown = 0; + servstate.limittime = 0; + servstate.dsptime = 0; + SERVSTATE_UNLOCK(); +} + +ANYTHREAD int SERVSTATE_SetAcceptMore( int nvalue ) +{ + BOOL buf; + SERVSTATE_LOCK(); + buf = servstate.acceptmore; + servstate.acceptmore = nvalue; + SERVSTATE_UNLOCK(); + return buf; +} +ANYTHREAD static int SERVSTATE_incrementFdid( void ) +{ + int ret; + SERVSTATE_LOCK(); + ret = servstate.fdid++; + SERVSTATE_UNLOCK(); + return ret; +} +ANYTHREAD static void SERVSTATE_setCloseallsocketnum( int a ) +{ + SERVSTATE_LOCK(); + servstate.closeallsocketnum = a; + SERVSTATE_UNLOCK(); +} +ANYTHREAD static void SERVSTATE_incrementCloseallsocketnum(void) +{ + SERVSTATE_LOCK(); + servstate.closeallsocketnum ++; + SERVSTATE_UNLOCK(); +} +ANYTHREAD void SERVSTATE_decrementCloseallsocketnum(void) +{ + SERVSTATE_LOCK(); + servstate.closeallsocketnum --; + SERVSTATE_UNLOCK(); +} +ANYTHREAD int SERVSTATE_getCloseallsocketnum( void ) +{ + int a; + SERVSTATE_LOCK(); + a = servstate.closeallsocketnum; + SERVSTATE_UNLOCK(); + return a; +} + +ANYTHREAD static int SERVSTATE_getAcceptmore(void) +{ + int a; + SERVSTATE_LOCK(); + a = servstate.acceptmore; + SERVSTATE_UNLOCK(); + return a; +} +ANYTHREAD int SERVSTATE_getShutdown(void) +{ + int a; + SERVSTATE_LOCK(); + a = servstate.shutdown; + SERVSTATE_UNLOCK(); + return a; +} +ANYTHREAD void SERVSTATE_setShutdown(int a) +{ + SERVSTATE_LOCK(); + servstate.shutdown = a; + SERVSTATE_UNLOCK(); +} +ANYTHREAD int SERVSTATE_getLimittime(void) +{ + int a; + SERVSTATE_LOCK(); + a = servstate.limittime; + SERVSTATE_UNLOCK(); + return a; +} +ANYTHREAD void SERVSTATE_setLimittime(int a) +{ + SERVSTATE_LOCK(); + servstate.limittime = a; + SERVSTATE_UNLOCK(); +} +ANYTHREAD int SERVSTATE_getDsptime(void) +{ + int a; + SERVSTATE_LOCK(); + a = servstate.dsptime; + SERVSTATE_UNLOCK(); + return a; +} +ANYTHREAD void SERVSTATE_setDsptime(int a) +{ + SERVSTATE_LOCK(); + servstate.dsptime = a; + SERVSTATE_UNLOCK(); +} + +static int appendWB( int fd, char *buf, int size ) +{ + if ( fd != acfd ) { + if ( Connect[ fd ].wbuse + size >= WBSIZE ) { + //print( "appendWB:err buffer over[%d]:%s \n", + //Connect[ fd ].wbuse + size, Connect[ fd ].cdkey ); + return -1; + } + }else { + if ( Connect[ fd ].wbuse + size > AC_WBSIZE ) { + FILE * fp = NULL; + //print( "appendWB:err buffer over[%d+%d]:(SAAC) \n", Connect[ fd ].wbuse, size ); + + if ( ( fp = fopen( "appendWBerr.log", "a+" ) ) == NULL ) return -1; + + fprintf( fp, "(SAAC) appendWB:err buffer over[%d+%d/%d]:\n", Connect[ fd ].wbuse, size, AC_WBSIZE ); + + fclose( fp ); + + return -1; + } + } + + + + memcpy( Connect[ fd ].wb + Connect[ fd ].wbuse , + buf, size ); + Connect[ fd ].wbuse += size; + return size; +} +static int appendRB( int fd, char *buf, int size ) +{ + if ( fd != acfd ) { + if ( Connect[ fd ].rbuse + size > RBSIZE ) { + //print( "appendRB:OTHER(%d) err buffer over \n", fd ); + + return -1; + } + }else { + if ( strlen( buf ) > size ) { + //print( "appendRB AC buffer len err : %d/%d=\n(%s)!!\n", strlen( buf ), size, buf ); + } + + if ( Connect[ fd ].rbuse + size > AC_RBSIZE ) { + //print( "appendRB AC err buffer over:\n(%s)\n len:%d - rbuse:%d \n", + //buf, strlen( buf ), Connect[ fd ].rbuse ); + return -1; + } + } + + memcpy( Connect[ fd ].rb + Connect[ fd ].rbuse , buf, size ); + Connect[ fd ].rbuse += size; + return size; +} + +static int shiftWB( int fd, int len ) +{ + if ( Connect[ fd ].wbuse < len ) { + //print( "shiftWB: err\n" ); + return -1; + } + + memmove( Connect[ fd ].wb, Connect[ fd ].wb + len, Connect[ fd ].wbuse - len ); + Connect[ fd ].wbuse -= len; + + if ( Connect[ fd ].wbuse < 0 ) { + //print( "shiftWB:wbuse err\n" ); + Connect[ fd ].wbuse = 0; + } + + return len; +} + +static int shiftRB( int fd, int len ) +{ + if ( Connect[ fd ].rbuse < len ) { + //print( "shiftRB: err\n" ); + return -1; + } + + memmove( Connect[ fd ].rb, Connect[ fd ].rb + len, Connect[ fd ].rbuse - len ); + Connect[ fd ].rbuse -= len; + + if ( Connect[ fd ].rbuse < 0 ) { + //print( "shiftRB:rbuse err\n" ); + Connect[ fd ].rbuse = 0; + } + + return len; +} + +SINGLETHREAD int lsrpcClientWriteFunc( int fd , char* buf , int size ) +{ + int r; + + if ( Connect[ fd ].use == FALSE ) { + return FALSE; + } + + if ( Connect[ fd ].appendwb_overflow_flag ) { + //print( "lsrpcClientWriteFunc: buffer overflow fd:%d\n" , fd ); + return -1; + } + + r = appendWB( fd, buf , size ); + + // Nuke *1 0907: Ignore acfd from WB error + + if ( ( r < 0 ) && ( fd != acfd ) ) { + Connect[ fd ].appendwb_overflow_flag = 1; + //print("11111"); + CONNECT_endOne_debug( fd ); + // Nuke + 1 0901: Why close + // print("closed in lsrpcClientWriteFunc"); + } + + return r; +} + +static int logRBuseErr = 0; +SINGLETHREAD BOOL GetOneLine_fix( int fd, char *buf, int max ) +{ + int i; + + if ( Connect[ fd ].rbuse == 0 ) return FALSE; + + if ( Connect[ fd ].check_rb_oneline_b == 0 && + Connect[ fd ].check_rb_oneline_b == Connect[ fd ].rbuse ) { + return FALSE; + } + + + for ( i = 0; i < Connect[ fd ].rbuse && i < ( max - 1 ); i ++ ) { + if ( Connect[ fd ].rb[ i ] == '\n' ) { + memcpy( buf, Connect[ fd ].rb, i + 1 ); + buf[ i + 1 ] = '\0'; + shiftRB( fd, i + 1 ); + + //-------- + /* + //andy_log + if( strstr( Connect[fd].rb , "ACCharLoad") != NULL && + Connect[fd].check_rb_oneline_b != 0 )//Connect[fd].rb + LogAcMess( fd, "GetOne", Connect[fd].rb ); + */ + //-------- + logRBuseErr = 0; + Connect[ fd ].check_rb_oneline_b = 0; + Connect[ fd ].check_rb_time = 0; + return TRUE; + } + } + + //print("rbuse lens: %d!!\n", Connect[fd].rbuse); + logRBuseErr++; + + //-------- + //andy_log + if ( fd == acfd && strstr( Connect[ fd ].rb , "ACCharLoad" ) != NULL && + logRBuseErr >= 50 ) { //Connect[fd].rb + char buf[ AC_RBSIZE ]; + memcpy( buf, Connect[ fd ].rb, Connect[ fd ].rbuse + 1 ); + buf[ Connect[ fd ].rbuse + 1 ] = 0; + LogAcMess( fd, "RBUFFER", buf ); + logRBuseErr = 0; + } + + //-------- + Connect[ fd ].check_rb_oneline_b = Connect[ fd ].rbuse; + + return FALSE; +} + + +char *getRandStr(int num){ + char str[num+1]; + int i; + struct timeval tv; + struct timezone tz; + gettimeofday (&tv , &tz); + srand(tv.tv_usec); + for(i = 0; i < num; i++) + { + int a = 0; + a = ( rand() %2) ? ( rand() %26 + 65) : ( rand()% 10 + 48); + str[i] = a; + } + str[num] = '\0'; + return str; +} + +ANYTHREAD BOOL initConnectOne( int sockfd, struct sockaddr_in* sin ,int len ) +{ + CONNECT_LOCK( sockfd ); + + Connect[ sockfd ].use = TRUE; + Connect[ sockfd ].ctype = NOTDETECTED; + Connect[ sockfd ].wbuse = Connect[ sockfd ].rbuse = 0; + Connect[ sockfd ].check_rb_oneline_b = 0; + Connect[ sockfd ].check_rb_time = 0; + + memset( Connect[ sockfd ].cdkey , 0 , sizeof( Connect[ sockfd ].cdkey ) ); + memset( Connect[ sockfd ].passwd, 0 , sizeof( Connect[ sockfd ].passwd ) ); + + Connect[ sockfd ].state = NOTLOGIN; + Connect[ sockfd ].nstatecount = 0; + memset( Connect[ sockfd ].charname, 0, sizeof( Connect[ sockfd ].charname ) ); + Connect[ sockfd ].charaindex = -1; + + Connect[ sockfd ].CAbufsiz = 0; + Connect[ sockfd ].CDbufsiz = 0; + Connect[ sockfd ].rbuse = 0; + Connect[ sockfd ].wbuse = 0; + Connect[ sockfd ].check_rb_oneline_b = 0; + Connect[ sockfd ].check_rb_time = 0; + + Connect[ sockfd ].close_request = 0; /* Ӭۢư׷º */ + // Nuke 08/27 For acceleration avoidance + Connect[ sockfd ].Walktime = 0; + Connect[ sockfd ].lastWalktime = 0; + Connect[ sockfd ].Walkcount = 0; + Connect[ sockfd ].Walkspool = WALK_SPOOL; + Connect[ sockfd ].Walkrestore = WALK_RESTORE; + Connect[ sockfd ].Btime = 0; + Connect[ sockfd ].lastBtime = 0; + Connect[ sockfd ].lastlastBtime = 0; + Connect[ sockfd ].EOtime = 0; + Connect[ sockfd ].nu_decrease = 0; +#ifdef _BATTLE_TIMESPEED + // Connect[sockfd].DefBtime = 0; + Connect[ sockfd ].BDTime = 0; + Connect[ sockfd ].CBTime = 0; +#endif +#ifdef _TYPE_TOXICATION + Connect[ sockfd ].toxication = 0; +#endif +#ifdef _ITEM_ADDEXP //vincent + Connect[ sockfd ].EDTime = 0; +#endif + // Connect[sockfd].BEO = 0; + Connect[ sockfd ].BEOspool = BEO_SPOOL; + Connect[ sockfd ].BEOrestore = BEO_RESTORE; + //ttom + Connect[ sockfd ].b_shut_up = FALSE; + Connect[ sockfd ].Wtime.tv_sec = 0; // + Connect[ sockfd ].Wtime.tv_usec = 0; // + Connect[ sockfd ].WLtime.tv_sec = 0; // + Connect[ sockfd ].WLtime.tv_usec = 0; // + Connect[ sockfd ].b_first_warp = FALSE; + Connect[ sockfd ].state_trans = 0; //avoid the trans + // Nuke + Connect[ sockfd ].die = 0; + Connect[ sockfd ].credit = 3; + Connect[ sockfd ].fcold = 0; + // Nuke 0406: New Flow Control + Connect[ sockfd ].nu = 30; + Connect[ sockfd ].ke = 10; + // Nuke 1213: Flow Control 2 + Connect[ sockfd ].packetin = 30; // if 10x10 seconds no packet, drop the line + + // Nuke 0624: Avoid Useless Connection + Connect[ sockfd ].cotime = 0; + // Nuke 0626: For no enemy + Connect[ sockfd ].noenemy = 0; + // Arminius 7.2: Ra's amulet + Connect[ sockfd ].eqnoenemy = 0; + +#ifdef _Item_MoonAct + Connect[ sockfd ].eqrandenemy = 0; +#endif +#ifdef _CHIKULA_STONE + Connect[ sockfd ].chistone = 0; +#endif + // Arminius 7.31: cursed stone + Connect[ sockfd ].stayencount = 0; + + // CoolFish: Init Trade 2001/4/18 + memset( &Connect[ sockfd ].TradeTmp, 0, sizeof( Connect[ sockfd ].TradeTmp ) ); +#ifdef _ITEM_PILEFORTRADE + Connect[ sockfd ].tradelist = -1; +#endif + // Arminius 6.22 Encounter + Connect[ sockfd ].CEP = 0; + + // Arminius 7.12 login announce + Connect[ sockfd ].announced = 0; + +#ifdef _NO_WARP + // shan hjj add Begin + Connect[sockfd].seqno=-1; + Connect[sockfd].selectbutton=1; + // shan End +#endif + // ¼ʼʱ + time_t curtime; + struct tm *p; + time(&curtime); + p=localtime(&curtime); + curtime = mktime(p); + Connect[ sockfd ].starttime = curtime; + + memset( Connect[ sockfd ].pcid, 0 , sizeof( Connect[ sockfd ].pcid ) ); + memset( Connect[ sockfd ].oldpcid, 0 , sizeof( Connect[ sockfd ].oldpcid ) ); + Connect[ sockfd ].confirm_key = FALSE; // shan trade(DoubleCheck) + + if ( sin != NULL ) memcpy( &Connect[ sockfd ].sin , sin , len ); + + memset( &Connect[ sockfd ].lastprocesstime, 0 , + sizeof( Connect[ sockfd ].lastprocesstime ) ); + + memcpy( &Connect[ sockfd ].lastCAsendtime, &NowTime , + sizeof( Connect[ sockfd ].lastCAsendtime ) ); + + memcpy( &Connect[ sockfd ].lastCDsendtime, &NowTime , + sizeof( Connect[ sockfd ].lastCDsendtime ) ); + + memcpy( &Connect[ sockfd ].lastCharSaveTime, &NowTime , + sizeof( Connect[ sockfd ].lastCharSaveTime ) ); + + // Shan Add + memcpy( &Connect[ sockfd ].lastrecvtime, &NowTime , + sizeof( Connect[ sockfd ].lastrecvtime ) ); + + memcpy( &Connect[ sockfd ].lastrecvtime_d, &NowTime , + sizeof( Connect[ sockfd ].lastrecvtime_d ) ); + + memcpy( &Connect[ sockfd ].battle_recvtime, &NowTime , + sizeof( Connect[ sockfd ].battle_recvtime ) ); + + memcpy( &Connect[ sockfd ].lastreadtime , &NowTime, + + sizeof( struct timeval ) ); + + Connect[ sockfd ].lastreadtime.tv_sec -= DEBUG_ADJUSTTIME; + + Connect[ sockfd ].errornum = 0; + + Connect[ sockfd ].rightnum = 0; + + Connect[ sockfd ].fdid = SERVSTATE_incrementFdid(); + + CONNECT_UNLOCK( sockfd ); + + Connect[ sockfd ].appendwb_overflow_flag = 0; + + Connect[sockfd].connecttime = time(NULL); + + memset( Connect[ sockfd ].defaultkey , 0 , sizeof( Connect[ sockfd ].defaultkey ) ); + strcpy(Connect[ sockfd ].defaultkey,getRandStr(10)); + + return TRUE; +} + +ANYTHREAD BOOL _CONNECT_endOne( char *file, int fromline, int sockfd , int line ) +{ + if(errno==113 || errno==104){ + return; + } + CONNECT_LOCK_ARG2(sockfd,line); + + if( Connect[sockfd].use == FALSE ){ + CONNECT_UNLOCK_ARG2(sockfd,line); + //andy_log + //print("ѹر[%d]!!\n", sockfd ); + return TRUE; + } + Connect[sockfd].use = FALSE; + if( Connect[sockfd].ctype == CLI ){ + CONNECT_UNLOCK_ARG2( sockfd,line ); + if(Connect[sockfd].charaindex >= 0){ +#ifdef _OFFLINE_SYSTEM + if(CHAR_getWorkInt( Connect[sockfd].charaindex, CHAR_WORK_OFFLINE ) != 0){ + CHAR_setWorkInt( Connect[sockfd].charaindex, CHAR_WORKFD, -1); + }else +#endif + { + if( !CHAR_logout( Connect[sockfd].charaindex,TRUE )) { + //print( "err %s:%d from %s:%d \n", __FILE__, __LINE__, file, fromline); + } + //print("\ndrop line from %s:%d,__FD_SETSIZE=%d\n",file,fromline,__FD_SETSIZE); + sasql_online(Connect[sockfd].cdkey,NULL,NULL,NULL,NULL,0); + print( "˳˺=%s \n", Connect[sockfd].cdkey ); + } + Connect[sockfd].charaindex=-1; + }else{ + if(strlen(Connect[sockfd].cdkey)>0) + sasql_online(Connect[sockfd].cdkey,NULL,NULL,NULL,NULL,0); + } + CONNECT_LOCK_ARG2( sockfd ,line); + } +#ifdef _NO_ATTACK + else{ + if(strlen(Connect[sockfd].cdkey)<1){ + // ʱ + time_t curtime; + struct tm *p; + time(&curtime); + p=localtime(&curtime); + curtime = mktime(p); + if( curtime - Connect[sockfd].starttime <= getAttTime() ){ + unsigned long tmpip=CONNECT_get_userip(sockfd); + unsigned long i = 0; + int ipa,ipb,ipc,ipd; + char ip[32]; + ipa=(tmpip % 0x100); tmpip=tmpip / 0x100; + ipb=(tmpip % 0x100); tmpip=tmpip / 0x100; + ipc=(tmpip % 0x100); tmpip=tmpip / 0x100; + ipd=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",ipa,ipb,ipc,ipd); + for(; i < useripcount; ++i ){ + if( userip[i] == tmpip ){ + if(userip_count_data[i]>=getAttCnt()){ + Connect[sockfd].wbuse = 0; + Connect[sockfd].rbuse = 0; + Connect[sockfd].CAbufsiz = 0; + Connect[sockfd].CDbufsiz = 0; + CONNECT_UNLOCK_ARG2(sockfd,line); + + print( "Ƿ=%d ǷIP=%s \n", sockfd, ip ); + close(sockfd); +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[256]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + } +#endif + userip_count_data[i] = 1; + useriptime[i] = curtime; + return TRUE; + } + if(curtime-useriptime[i]<=getAttSafeTime()){ + ++userip_count_data[i]; + break; + }else{ + useriptime[i]=curtime; + break; + } + } + } + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + if(i>= useripcount && useripcount= sizeof( Connect[ fd ].CAbuf ) ) { + CONNECT_UNLOCK( fd ); + return FALSE; + } + + memcpy( Connect[ fd ].CAbuf + Connect[ fd ].CAbufsiz , data , size ); + Connect[ fd ].CAbuf[ Connect[ fd ].CAbufsiz + size ] = ','; + Connect[ fd ].CAbufsiz += ( size + 1 ); + CONNECT_UNLOCK( fd ); + return TRUE; +} + +ANYTHREAD static int CONNECT_getCAbuf( int fd, char *out, int outmax, + int *outlen ) +{ + CONNECT_LOCK( fd ); + + if ( Connect[ fd ].use == TRUE ) { + int cplen = MIN( outmax, Connect[ fd ].CAbufsiz ); + memcpy( out, Connect[ fd ].CAbuf , cplen ); + *outlen = cplen; + CONNECT_UNLOCK( fd ); + return 0; + } else { + CONNECT_UNLOCK( fd ); + return -1; + } +} +ANYTHREAD static int CONNECT_getCDbuf( int fd, char *out, int outmax, + int *outlen ) +{ + if(fd<0) return 0; + CONNECT_LOCK( fd ); + + if ( Connect[ fd ].use == TRUE ) { + int cplen = MIN( outmax, Connect[ fd ].CDbufsiz ); + memcpy( out, Connect[ fd ].CDbuf, cplen ); + *outlen = cplen; + CONNECT_UNLOCK( fd ); + return 0; + } else { + CONNECT_UNLOCK( fd ); + return 0; + } +} + +ANYTHREAD static int CONNECT_setCAbufsiz( int fd, int len ) +{ + CONNECT_LOCK( fd ); + + if ( Connect[ fd ].use == TRUE ) { + Connect[ fd ].CAbufsiz = len; + CONNECT_UNLOCK( fd ); + return 0; + } else { + CONNECT_UNLOCK( fd ); + return -1; + } +} +ANYTHREAD static int CONNECT_setCDbufsiz( int fd, int len ) +{ + CONNECT_LOCK( fd ); + + if ( Connect[ fd ].use == TRUE ) { + Connect[ fd ].CDbufsiz = len; + CONNECT_UNLOCK( fd ); + return 0; + } else { + CONNECT_UNLOCK( fd ); + return -1; + } +} + +ANYTHREAD static void CONNECT_setLastCAsendtime( int fd, struct timeval *t) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].lastCAsendtime = *t; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD static void CONNECT_getLastCAsendtime( int fd, struct timeval *t ) +{ + CONNECT_LOCK( fd ); + *t = Connect[ fd ].lastCAsendtime; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD static void CONNECT_setLastCDsendtime( int fd, struct timeval *t ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].lastCDsendtime = *t; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD static void CONNECT_getLastCDsendtime( int fd, struct timeval *t ) +{ + CONNECT_LOCK( fd ); + *t = Connect[ fd ].lastCDsendtime; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getUse_debug( int fd, int i ) +{ + int a; + CONNECT_LOCK_ARG2( fd, i ); + a = Connect[ fd ].use; + CONNECT_UNLOCK_ARG2( fd, i ); + return a; + +} + +ANYTHREAD int CONNECT_getUse( int fd ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].use; + CONNECT_UNLOCK( fd ); + return a; +} +void CONNECT_setUse( int fd , int a) +//ANYTHREAD static void CONNECT_setUse( int fd , int a) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].use = a; + CONNECT_UNLOCK( fd ); +} + +void CONNECT_setStarttime( int fd , int a) +//ANYTHREAD static void CONNECT_setUse( int fd , int a) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].starttime = a; + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_checkStatecount( int a ) +{ + int i; + int count = 0; + + for ( i = 0; i < ConnectLen; i++ ) { + if ( Connect[ i ].use == FALSE || Connect[ i ].state != a ) continue; + + if ( Connect[ i ].nstatecount <= 0 ) { + Connect[ i ].nstatecount = ( int ) time( NULL ) + 60; + }else{ + if ( Connect[ i ].nstatecount < ( int ) time( NULL ) ) { + //print("33333"); + CONNECT_endOne_debug( i ); + count++; + } + } + } + + { + memset( StateTable, 0, sizeof( StateTable ) ); + + for ( i = 0; i < ConnectLen; i++ ) + if ( Connect[ i ].use == TRUE ) + StateTable[ Connect[ i ].state ] ++; + } +} + +ANYTHREAD int CONNECT_checkStateSomeOne( int a, int maxcount) +{ + char temp[ 80 ], buffer[ 1024 ]; + int i, ret = 1; + + if ( StateTable[ a ] >= maxcount ) ret = -1; + + buffer[ 0 ] = 0; + + for ( i = 0; i <= WHILESAVEWAIT; i++ ) { + sprintf( temp, "%4d", StateTable[ i ] ); + strcat( buffer, temp ); + } + + //print( "\nNOW{{%s}}", buffer ); + return ret; +} + +ANYTHREAD void CONNECT_setState( int fd , int a) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].state = a; + Connect[ fd ].nstatecount = 0; + + // Nuke start 0829: For debugging + { + char temp[80],buffer[128]; + int i; + memset( StateTable, 0, sizeof( StateTable ) ); + + for ( i = 0; i < ConnectLen; i++ ) + if ( Connect[ i ].use == TRUE ) + StateTable[ Connect[ i ].state ] ++; + + buffer[ 0 ] = 0; + + for ( i = 0; i <= WHILESAVEWAIT; i++ ) { + sprintf( temp, "%4d", StateTable[ i ] ); + strcat( buffer, temp ); + } + // print( "\nFILE:%s,LINE:%d", file,fromline ); + //print( "\n{{%s}}", buffer ); + } + // Nuke end + + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD int CONNECT_getState( int fd ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].state; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_incrementErrornum(int fd ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].errornum ++; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD void CONNECT_setCharaindex( int fd, int a ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].charaindex = a; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getCharaindex( int fd ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].charaindex; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_getCdkey( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].cdkey ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_setCdkey( int sockfd, char *cd ) +{ + CONNECT_LOCK( sockfd ); + snprintf( Connect[ sockfd ].cdkey, sizeof( Connect[ sockfd ].cdkey ), "%s", + cd ); + CONNECT_UNLOCK( sockfd ); +} + +ANYTHREAD void CONNECT_getPcid( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].pcid ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_setPcid( int sockfd, char *pcid ) +{ + CONNECT_LOCK( sockfd ); + snprintf( Connect[ sockfd ].pcid, sizeof( Connect[ sockfd ].pcid ), "%s", + pcid ); + CONNECT_UNLOCK( sockfd ); +} + +#ifdef _CAX_NEWMAC_LOGIN +ANYTHREAD void CONNECT_getMAC( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].mac ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_setMAC( int sockfd, char *mac ) +{ + CONNECT_LOCK( sockfd ); + snprintf( Connect[ sockfd ].mac, sizeof( Connect[ sockfd ].mac ), "%s", mac ); + CONNECT_UNLOCK( sockfd ); +} +#endif + +ANYTHREAD void CONNECT_getOldPcid( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].oldpcid ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_setOldPcid( int sockfd, char *pcid ) +{ + CONNECT_LOCK( sockfd ); + snprintf( Connect[ sockfd ].oldpcid, sizeof( Connect[ sockfd ].oldpcid ), "%s", + pcid ); + CONNECT_UNLOCK( sockfd ); +} + +ANYTHREAD void CONNECT_getDefaultKey( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].defaultkey ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_setDefaultKey( int sockfd, char *defaultkey ) +{ + CONNECT_LOCK( sockfd ); + snprintf( Connect[ sockfd ].defaultkey, sizeof( Connect[ sockfd ].defaultkey ), "%s", + defaultkey ); + CONNECT_UNLOCK( sockfd ); +} + +ANYTHREAD void CONNECT_getPasswd( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].passwd ); + CONNECT_UNLOCK( fd ); +} +ANYTHREAD void CONNECT_setPasswd( int fd, char *in ) +{ + CONNECT_LOCK( fd ); + strcpysafe( Connect[ fd ].passwd, sizeof( Connect[ fd ].passwd ), in ); + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getCtype( int fd ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].ctype; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_setCtype( int fd , int a ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].ctype = a; + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD void CONNECT_getCharname( int fd , char *out, int outlen ) +{ + CONNECT_LOCK( fd ); + strcpysafe( out, outlen, Connect[ fd ].charname ); + CONNECT_UNLOCK( fd ); +} +ANYTHREAD void CONNECT_setCharname( int fd, char *in ) +{ + CONNECT_LOCK( fd ); + strcpysafe( Connect[ fd ].charname, sizeof( Connect[ fd ].charname ), + in ); + CONNECT_UNLOCK( fd ); +} + +ANYTHREAD int CONNECT_getFdid( int fd ) +{ + if( fd < 0 || fd >= ConnectLen ){ + return -1; + } + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].fdid; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_setDuelcharaindex( int fd, int i , int a ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].duelcharaindex[ i ] = a; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getDuelcharaindex( int fd, int i ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].duelcharaindex[ i ]; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_setBattlecharaindex( int fd, int i , int a ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].battlecharaindex[ i ] = a; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getBattlecharaindex( int fd, int i ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].battlecharaindex[ i ]; + CONNECT_UNLOCK( fd ); + return a; +} +ANYTHREAD void CONNECT_setJoinpartycharaindex( int fd, int i , int a) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].joinpartycharaindex[ i ] = a; + CONNECT_UNLOCK( fd ); +} +ANYTHREAD int CONNECT_getJoinpartycharaindex( int fd, int i ) +{ + int a; + CONNECT_LOCK( fd ); + a = Connect[ fd ].joinpartycharaindex[ i ]; + CONNECT_UNLOCK( fd ); + return a; +} + +// CoolFish: Trade 2001/4/18 +ANYTHREAD void CONNECT_setTradecharaindex( int fd, int i , int a ) +{ + CONNECT_LOCK( fd ); + Connect[ fd ].tradecharaindex[ i ] = a; + CONNECT_UNLOCK( fd ); +} + +// Shan Begin +ANYTHREAD void CONNECT_setLastrecvtime( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + Connect[fd].lastrecvtime = *a; + CONNECT_UNLOCK(fd); +} +ANYTHREAD void CONNECT_getLastrecvtime( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + *a = Connect[fd].lastrecvtime; + CONNECT_UNLOCK(fd); +} + +ANYTHREAD void CONNECT_setLastrecvtime_D( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + Connect[fd].lastrecvtime_d = *a; + CONNECT_UNLOCK(fd); +} +ANYTHREAD void CONNECT_getLastrecvtime_D( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + *a = Connect[fd].lastrecvtime_d; + CONNECT_UNLOCK(fd); +} +// 2001/12/26 +ANYTHREAD void CONNECT_SetBattleRecvTime( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + Connect[fd].battle_recvtime = *a; + CONNECT_UNLOCK(fd); +} +ANYTHREAD void CONNECT_GetBattleRecvTime( int fd, struct timeval *a ) +{ + CONNECT_LOCK(fd); + *a = Connect[fd].battle_recvtime; + CONNECT_UNLOCK(fd); +} +// Shan End + + +#ifdef _ITEM_PILEFORTRADE +ANYTHREAD void CONNECT_setTradeList( int fd, int num) +{ + Connect[fd].tradelist = num; +} +ANYTHREAD int CONNECT_getTradeList(int fd) +{ + return Connect[fd].tradelist; +} +#endif + +ANYTHREAD void CONNECT_setTradeTmp(int fd, char* a) +{ + CONNECT_LOCK(fd); + strcpysafe( Connect[fd].TradeTmp, sizeof(Connect[fd].TradeTmp), a); + + CONNECT_UNLOCK(fd); +} +ANYTHREAD void CONNECT_getTradeTmp(int fd, char *trademsg, int trademsglen) +{ + CONNECT_LOCK(fd); + strcpysafe(trademsg, trademsglen, Connect[fd].TradeTmp); + CONNECT_UNLOCK(fd); +} + +ANYTHREAD void CONNECT_setTradecardcharaindex( int fd, int i , int a ) +{ + CONNECT_LOCK(fd); + Connect[fd].joinpartycharaindex[i] = a; + CONNECT_UNLOCK(fd); +} +ANYTHREAD int CONNECT_getTradecardcharaindex( int fd, int i ) +{ + int a; + CONNECT_LOCK(fd); + a = Connect[fd].joinpartycharaindex[i]; + CONNECT_UNLOCK(fd); + return a; +} + +ANYTHREAD void CONNECT_setCloseRequest( int fd, int count) +{ + // print("\nرΪ FILE:%s,LINE:%d ", file, line); + CONNECT_LOCK(fd); + Connect[fd].close_request = count; + // Nuke + // print("\nرΪ %d ",fd); + CONNECT_UNLOCK(fd); +} + + +/*------------------------------------------------------------ +* CAcheck ʤɤ˻Ȥؿºݤ롣 +* +* fd int եǥץ +* ֤ +* ʤ +------------------------------------------------------------*/ +ANYTHREAD void CAsend( int fd ) +{ + char buf[sizeof(Connect[0].CAbuf)]; + int bufuse=0; + + if( CONNECT_getCAbuf( fd, buf, sizeof(buf), &bufuse ) < 0 )return; + if( bufuse == 0 )return; + + //print("\nshan--->(CAsend)->%s fd->%d", buf, fd); + + /*ǸΥǥߥ ',' '\0' Ȥ*/ + buf[bufuse-1] = '\0'; + + lssproto_CA_send( fd , buf ); + + CONNECT_setCAbufsiz( fd, 0 ); +} + + +/*------------------------------------------------------------ +* CA롣 +* +* ֤ +* ʤ +------------------------------------------------------------*/ +ANYTHREAD void CAcheck( void ) +{ + int i; +#ifndef _WAN_FIX + unsigned int interval_us = getCAsendinterval_ms()*1000; +#endif + /* Connectз֧¾պϷئ */ + for( i = 0; i < ConnectLen; i ++) { +#ifndef _WAN_FIX + struct timeval t; +#endif + if( !CONNECT_getUse_debug(i,1008) )continue; +#ifndef _WAN_FIX + CONNECT_getLastCAsendtime( i, &t ); + if( time_diff_us( NowTime, t ) > interval_us ){ +#endif + CAsend( i); +#ifndef _WAN_FIX + CONNECT_setLastCAsendtime( i, &NowTime ); + } +#endif + } +} +ANYTHREAD void CAflush( int charaindex ) +{ + int i; + i = getfdFromCharaIndex( charaindex); + if( i == -1 )return; + CAsend(i); +} + + +/*------------------------------------------------------------ +* CDbuf ɲä롣 +* +* fd int եǥץ +* data char* ǡ +* size int ǡΥ +* ֤ +* TRUE(1) +* FALSE(0) +------------------------------------------------------------*/ +ANYTHREAD BOOL CONNECT_appendCDbuf( int fd , char* data, int size ) +{ + CONNECT_LOCK(fd); + + if( ( Connect[fd].CDbufsiz + size ) >= sizeof( Connect[fd].CDbuf )){ + CONNECT_UNLOCK(fd); + return FALSE; + } + memcpy( Connect[fd].CDbuf + Connect[fd].CDbufsiz , data, size ); + Connect[fd].CDbuf[Connect[fd].CDbufsiz+size] = ','; + Connect[fd].CDbufsiz += ( size + 1 ); + CONNECT_UNLOCK(fd); + return TRUE; +} + + +/*------------------------------------------------------------ +* CDcheck ʤɤ˻Ȥؿºݤ롣 +* +* fd int եǥץ +* ֤ +* ʤ +------------------------------------------------------------*/ +ANYTHREAD void CDsend( int fd ) +{ + char buf[sizeof(Connect[0].CAbuf )]; + int bufuse=0; + if( CONNECT_getCDbuf( fd, buf, sizeof(buf), &bufuse ) < 0 ) return; + if( bufuse == 0 ) return; + buf[bufuse-1] = '\0'; + lssproto_CD_send(fd, buf ); + CONNECT_setCDbufsiz(fd,0); +} + + +/*------------------------------------------------------------ +* CD롣 +* +* ֤ +* ʤ +------------------------------------------------------------*/ +ANYTHREAD void CDcheck( void ) +{ + int i; +#ifndef _WAN_FIX + unsigned int interval_us = getCDsendinterval_ms()*1000; +#endif + for(i=0; i interval_us ){ +#endif + CDsend( i); +#ifndef _WAN_FIX + CONNECT_setLastCDsendtime( i , &NowTime ); + } +#endif + } +} + +ANYTHREAD void CDflush( int charaindex ) +{ + int i; + i = getfdFromCharaIndex( charaindex); + if( i == -1 )return; + CDsend(i); +} + +void chardatasavecheck( void ) +{ + int i; + int interval = getCharSavesendinterval(); + static struct timeval chardatasavecheck_store; + if( NowTime.tv_sec > (chardatasavecheck_store.tv_sec +10)){ + chardatasavecheck_store = NowTime; + + +#ifdef _FIX_SAVE_CHAR + for(i=0;i interval){ + CHAR_charSaveFromConnect( i, FALSE ); + CHAR_setWorkInt( i, CHAR_WORK_SAVE_CHAR, tv_sec); + } + } + } +#else + for( i = 0; i < ConnectLen; i ++) { + CONNECT_LOCK(i); + if( Connect[i].use == TRUE + && Connect[i].state == LOGIN + && NowTime.tv_sec - Connect[i].lastCharSaveTime.tv_sec + > interval ){ + Connect[i].lastCharSaveTime = NowTime; + CONNECT_UNLOCK(i); + CHAR_charSaveFromConnect( CONNECT_getCharaindex( i ), FALSE ); + } else { + CONNECT_UNLOCK(i); + } + } +#endif + } else { + ; + } +} + +/*------------------------------------------------------------ +* fd valid ئּëƩ +* ¦ +* fd int fd +* ߯Ի +* valid TRUE(1) +* invalid FALSE(0) +------------------------------------------------------------*/ +ANYTHREAD INLINE int CONNECT_checkfd( int fd ) +{ + if( 0 > fd || fd >= ConnectLen ){ + return FALSE; + } + CONNECT_LOCK(fd); + if( Connect[fd].use == FALSE ){ + CONNECT_UNLOCK(fd); + return FALSE; + } else { + CONNECT_UNLOCK(fd); + return TRUE; + } +} + + +/*------------------------------------------------------------ +* cdkey fd 롣 +* +* cd char* cdkey +* ֤ +* եǥץ äơ -1 λϥ顼 +------------------------------------------------------------*/ +ANYTHREAD int getfdFromCdkey( char* cd ) +{ + int i; + for( i = 0 ;i < ConnectLen ; i ++ ){ + CONNECT_LOCK(i); + if( Connect[i].use == TRUE && + strcmp( Connect[i].cdkey , cd ) == 0 ){ + CONNECT_UNLOCK(i); + return i; + } + CONNECT_UNLOCK(i); + } + return -1; +} + + +/*------------------------------------------------------------ +* charaindex fd ë £ +* ½ ëף +* ¦ +* charaindex int ƽҷ¼̼͵ +* ߯Ի +* ̻ﷸū Ȼ -1 ݷ޷¡ +------------------------------------------------------------*/ +ANYTHREAD int getfdFromCharaIndex( int charaindex ) +{ +#if 1 + int ret; + if( !CHAR_CHECKINDEX( charaindex)) return -1; + if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return -1; + ret = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + if( ret < 0 || ret >= ConnectLen ) return -1; + return ret; +#else + int i; + for( i = 0 ;i < ConnectLen ; i ++ ){ + CONNECT_LOCK(i); + if( Connect[i].use == TRUE + && Connect[i].charaindex == charaindex ){ + CONNECT_UNLOCK(i); + return i; + } + CONNECT_UNLOCK(i); + } + return -1; +#endif +} +/*------------------------------------------------------------ +* charaindex cdkey ë £ +* ¦ +* charaindex int ƽҷ¼̼͵ +* ߯Ի +* 0ئ ئ +------------------------------------------------------------*/ +ANYTHREAD int getcdkeyFromCharaIndex( int charaindex , char *out, int outlen ) +{ + int i; + + for( i = 0 ;i < ConnectLen ; i ++ ){ + CONNECT_LOCK(i); + if( Connect[i].use == TRUE + && Connect[i].charaindex == charaindex ){ + snprintf( out, outlen, "%s" , Connect[i].cdkey ); + CONNECT_UNLOCK(i); + return 0; + } + CONNECT_UNLOCK(i); + } + return -1; +} + + +/*------------------------------------------------------------ +* Ʊfdid ۤõ +* +* fdid int fdid +* ֤ +* -1 ݷ޷¡ +------------------------------------------------------------*/ +ANYTHREAD int getfdFromFdid( int fdid ) +{ + int i; + + for( i=0; i= 0 ){ + int a = Connect[i].charaindex; + CONNECT_UNLOCK(i); + return a; + } + CONNECT_UNLOCK(i); + } + + return -1; +} +/*------------------------------------------------------------ +* index fdid Ȥ롣 +* +* charind int եǥץ +* fdid ä饭ind +------------------------------------------------------------*/ +ANYTHREAD int getFdidFromCharaIndex( int charind ) +{ + int i; + + for( i=0; i 10000 ) chikulatime = 0; + if( getReloadNpcTime() > 0){ + if ( chikulatime % getReloadNpcTime() == 0 ) { + NPC_reloadNPC(); + MAPPOINT_resetMapWarpPoint( 1); + MAPPOINT_loadMapWarpPoint(); + } + } + + if( chikulatime % 60 == 0 ){ //ÿ600ضԾ + MAPPOINT_resetMapWarpPoint( 1); + MAPPOINT_loadMapWarpPoint(); + } + + int playernum = CHAR_getPlayerMaxNum(); + int charaindex; + for ( charaindex = 0;charaindex < playernum; charaindex++ ) { + if( !CHAR_CHECKINDEX(charaindex) )continue; + if ( chikulatime % 6 == 0 ) { // ÿ60 + // shan 2001/12/27 Begin + +#ifdef _PETSKILL_BECOMEPIG + if ( CHAR_CHECKINDEX( charaindex ) ) + if ( CHAR_getInt( charaindex, CHAR_BECOMEPIG ) > -1 ) { //״̬ + + if ( ( CHAR_getInt( charaindex, CHAR_BECOMEPIG ) - 1 ) <= 0 ) { //ʱ + CHAR_setInt( charaindex, CHAR_BECOMEPIG, 0 ); + + if ( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ) { //ս״̬ + CHAR_setInt( charaindex, CHAR_BECOMEPIG, -1 ); //״̬ + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ) ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER ); + CHAR_talkToCli( charaindex, -1, "ʧЧˡ", CHAR_COLORWHITE ); + } + } + else { + CHAR_setInt( charaindex, CHAR_BECOMEPIG, max(0,CHAR_getInt( charaindex, CHAR_BECOMEPIG ) - 60) ); + } + } +#endif + } + + if ( chikulatime % 30 == 0 ) { // ÿ300 +#ifdef _ITEM_ADDEXP //vincent + if ( CHAR_getInt( charaindex, CHAR_ADDEXPPOWER ) > 0 && + CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + int exptime; + exptime = CHAR_getInt( charaindex, CHAR_ADDEXPTIME ) - 300; + + if ( exptime <= 0 ) { + CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, 0 ); + CHAR_setInt( charaindex, CHAR_ADDEXPTIME, 0 ); + CHAR_talkToCli( charaindex,-1,"ѧϰʧ!",CHAR_COLORYELLOW); + } + else { + CHAR_setInt( charaindex, CHAR_ADDEXPTIME, exptime ); + //print("\n ADDEXPTIME %d ", exptime); + + if ( ( exptime % ( 60 * 60 ) ) < 300 && exptime >= ( 60 * 60 ) ) { + char msg[ 1024 ]; + sprintf( msg, "ѧϰʣԼ %d Сʱ", (int)(exptime/(60*60)) ); + //sprintf( msg, "ѧϰʣԼ %d ֡", (int)(exptime/(60)) ); + CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORYELLOW ); + } + } + + } + + if ( CHAR_getInt( charaindex, CHAR_VIPRIDE ) > 0 && CHAR_getInt( charaindex, CHAR_VIPTIME ) > 0 ){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(CHAR_getInt( charaindex, CHAR_VIPTIME ) 0 && + CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) { + int nviptime; + nviptime = CHAR_getInt( charaindex, CHAR_NVIPTIME ) - 300; + + if ( nviptime <= 0 ) { + CHAR_setInt( charaindex, CHAR_NVIPEXP, 0 ); + CHAR_setInt( charaindex, CHAR_NVIPTIME, 0 ); + CHAR_talkToCli( charaindex,-1,"⾭ʱѵڡ",CHAR_COLORYELLOW); + } + else { + CHAR_setInt( charaindex, CHAR_NVIPTIME, nviptime ); + if ( ( nviptime % ( 60 * 60 ) ) < 300 && nviptime >= ( 60 * 60 ) ) { + char token[ 1024 ]; + sprintf( token, "⾭ʱʣ %d Сʱ", (int)(nviptime/(60*60)) ); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); + } + } + } +#endif +#ifdef _OFFLINE_SYSTEM + if( getOfflineCf()==1 && CHAR_getWorkInt(charaindex,CHAR_WORK_OFFLINE) !=0 && CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR)!=1 && CHAR_getWorkInt(charaindex,CHAR_WORKSTREETVENDOR)!=2){ + if(CHAR_getInt(charaindex,CHAR_OFFTIME)>0){ + int offtime = CHAR_getInt(charaindex,CHAR_OFFTIME) - 300; + if(offtime<=0){ + CHAR_setInt(charaindex,CHAR_OFFTIME,0); + CHAR_logout(charaindex,TRUE); + sasql_online(CHAR_getChar(charaindex,CHAR_CDKEY),NULL,NULL,NULL,NULL,0); + }else{ + CHAR_setInt(charaindex,CHAR_OFFTIME,offtime); + } + }else{ + CHAR_logout(charaindex,TRUE); + sasql_online(CHAR_getChar(charaindex,CHAR_CDKEY),NULL,NULL,NULL,NULL,0); + } + } +#endif +#ifdef _ITEM_METAMO + if ( CHAR_getWorkInt( charaindex, CHAR_WORKITEMMETAMO ) < NowTime.tv_sec + && CHAR_getWorkInt( charaindex, CHAR_WORKITEMMETAMO ) != 0 ) { + CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0 ); + CHAR_setWorkInt( charaindex, CHAR_WORKNPCMETAMO, 0 ); //npcԻıҲҪ + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ) ); + CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER ); + CHAR_talkToCli( charaindex, -1, "ʧЧˡ", CHAR_COLORWHITE ); + } + +#endif +#ifdef _ITEM_TIME_LIMIT + ITEM_TimeLimit( charaindex ); // (ɿ) shan time limit of item. code:shan + +#endif + + } //%30 + +#ifdef _PETSKILL_BECOMEPIG + if ( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ) { //ս״̬ + + if ( CHAR_getInt( charaindex, CHAR_BECOMEPIG ) > -1 ) { //״̬ + char temp[ 256 ]; + sprintf( temp, "ʱ:%d", CHAR_getInt( charaindex, CHAR_BECOMEPIG ) ); + CHAR_talkToCli( charaindex, -1, temp, CHAR_COLORWHITE ); + } + } + +#endif + //10 +#ifdef _MAP_TIME + if ( CHAR_getWorkInt( charaindex, CHAR_WORK_MAP_TIME ) > 0 + && CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ) { + CHAR_setWorkInt( charaindex, CHAR_WORK_MAP_TIME, CHAR_getWorkInt( charaindex, CHAR_WORK_MAP_TIME ) - 10 ); + + if ( CHAR_getWorkInt( charaindex, CHAR_WORK_MAP_TIME ) <= 0 ) { + // ʱ䵽, + CHAR_talkToCli( charaindex, -1, "Ϊܲ˸ȶѷڡ", CHAR_COLORRED ); + CHAR_warpToSpecificPoint( charaindex, 30008, 39, 38 ); + CHAR_setInt( charaindex, CHAR_HP, 1 ); + CHAR_AddCharm( charaindex, -3 ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP ); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_CHARM ); + } + else { + char szMsg[ 64 ]; + sprintf( szMsg, "ȵĻֻٴ %d 롣", CHAR_getWorkInt( charaindex, CHAR_WORK_MAP_TIME ) ); + CHAR_talkToCli( charaindex, -1, szMsg, CHAR_COLORRED ); + } + } +#endif + } + for ( i = 0;i < ConnectLen; i++ ) { + if ( ( Connect[ i ].use ) && ( i != acfd )) { + + + if ( chikulatime % 6 == 0 ) { // ÿ60 + // shan 2001/12/27 Begin + + if ( CHAR_getWorkInt( Connect[ i ].charaindex, CHAR_WORKBATTLEMODE ) + != BATTLE_CHARMODE_NONE ) { + + struct timeval recvtime; + CONNECT_GetBattleRecvTime( i, &recvtime ); + + if ( time_diff( NowTime, recvtime ) > 360 ) { + //print("55555"); + CONNECT_endOne_debug( i ); + } + } + + // End + } //%30 + +#ifdef _OFFLINE_SYSTEM + if( chikulatime % 60 == 0 ){//ÿ600 + if ( CHAR_getWorkInt( Connect[ i ].charaindex, CHAR_WORK_OFFLINE )==0){ + if( strlen(CHAR_getChar(Connect[ i ].charaindex,CHAR_OFFBUF))<1){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int mon=1+p->tm_mon; + int date=p->tm_mday; + char offbuf[64]; + sprintf(offbuf,"%d-%d-%d",mon,date,0); + if(timep-Connect[ i ].starttime >= 600 && CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)<86400){ + sprintf(offbuf,"%d-%d-%d",mon,date,1); + Connect[ i ].starttime = timep; + CHAR_setInt(Connect[ i ].charaindex,CHAR_OFFTIME,CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)+600); + } + CHAR_setChar(Connect[ i ].charaindex,CHAR_OFFBUF,offbuf); + }else{ + char offbuf[64]; + strcpy(offbuf,CHAR_getChar(Connect[ i ].charaindex,CHAR_OFFBUF)); + char offtmp[10]; + int mymon,mydate,mycnt; + getStringFromIndexWithDelim(offbuf,"-", 1,offtmp,sizeof(offtmp)); + mymon = atoi(offtmp); + getStringFromIndexWithDelim(offbuf,"-", 2,offtmp,sizeof(offtmp)); + mydate = atoi(offtmp); + getStringFromIndexWithDelim(offbuf,"-", 3,offtmp,sizeof(offtmp)); + mycnt = atoi(offtmp); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int mon=1+p->tm_mon; + int date=p->tm_mday; + if(mymon!=mon || mydate!=date){ + sprintf(offbuf,"%d-%d-%d",mon,date,0); + if(timep-Connect[ i ].starttime >= 600 && CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)<432000){ + sprintf(offbuf,"%d-%d-%d",mon,date,1); + Connect[ i ].starttime = timep; + CHAR_setInt(Connect[ i ].charaindex,CHAR_OFFTIME,CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)+600); + } + CHAR_setChar(Connect[ i ].charaindex,CHAR_OFFBUF,offbuf); + }else{ + if(mycnt<24 && timep-Connect[ i ].starttime >= 600 && CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)<432000){ + sprintf(offbuf,"%d-%d-%d",mon,date,mycnt+1); + Connect[ i ].starttime = timep; + CHAR_setInt(Connect[ i ].charaindex,CHAR_OFFTIME,CHAR_getInt(Connect[ i ].charaindex,CHAR_OFFTIME)+600); + CHAR_setChar(Connect[ i ].charaindex,CHAR_OFFBUF,offbuf); + } + } + } + } + } +#endif + +#ifndef _USER_CHARLOOPS + //here ԭ + if ( Connect[ i ].stayencount ) { + if ( Connect[ i ].BDTime < time( NULL ) ) { + if ( CHAR_getWorkInt( Connect[ i ].charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ) { + lssproto_EN_recv( i, CHAR_getInt( Connect[ i ].charaindex, CHAR_X ), + CHAR_getInt( Connect[ i ].charaindex, CHAR_Y ) ); + Connect[ i ].BDTime = time( NULL ); + } + } + } + +#endif +#ifdef _CHIKULA_STONE + if ( chikulatime % 3 == 0 && getChiStone( i ) > 0 ) { //ԶѪ + CHAR_AutoChikulaStone( Connect[ i ].charaindex, getChiStone( i ) ); + } + +#endif + + if ( chikulatime % 6 == 0 ) { //ˮ״̬ +#ifdef _STATUS_WATERWORD + CHAR_CheckWaterStatus( Connect[ i ].charaindex ); +#endif + // Nuke 0626: No enemy + + if ( Connect[ i ].noenemy > 0 ) { + Connect[ i ].noenemy--; + + if ( Connect[ i ].noenemy == 0 ) { + CHAR_talkToCli( CONNECT_getCharaindex( i ), -1, "ػʧˡ", CHAR_COLORWHITE ); + } + } + } + + //ÿ10 +#ifdef _TYPE_TOXICATION //ж + if ( Connect[ i ].toxication > 0 ) { + CHAR_ComToxicationHp( Connect[ i ].charaindex ); + } + +#endif + // Nuke 0624 Avoid Useless Connection + if ( Connect[ i ].state == NOTLOGIN ) { + Connect[ i ].cotime++; + if ( Connect[ i ].cotime > 30 ) { + //print( "LATE" ); + CONNECT_endOne_debug( i ); + } + }else{ + Connect[ i ].cotime = 0; + } + + if ( ( Connect[ i ].nu <= 22 ) ) { + int r; + + if ( Connect[ i ].nu <= 0 ) { + Connect[ i ].nu_decrease++; + + if ( Connect[ i ].nu_decrease >= 30 ) + Connect[ i ].nu_decrease = 30; + + if ( Connect[ i ].nu_decrease > 22 ) logSpeed( i ); + } + else { + Connect[ i ].nu_decrease -= 1; + + if ( Connect[ i ].nu_decrease < 0 ) + Connect[ i ].nu_decrease = 0; + } + + r = 22 - Connect[ i ].nu_decrease; + r = ( r >= 15 ) ? r : 15; + lssproto_NU_send( i, r ); + Connect[ i ].nu += r; + //print("\nr=%d,nu=%d\n",r,Connect[ i ].nu); + } + // Nuke 1213: Flow control 2 + Connect[ i ].packetin--; // Remove a counter + + if ( Connect[ i ].packetin <= 0 ) { // Time out, drop this line + //print( "Drop line: sd=%d\n", i ); + CONNECT_endOne_debug( i ); + } + + //10 + + } + } + } + +//#ifdef _PETSKILL_BECOMEPIG +// if ( checkT2 != NowTimes && ( checkT2 ) <= NowTimes ) { +// int i; +// checkT2 = time( NULL ); +// ++chikulatime2; //ÿ1 +// +// if ( chikulatime2 > 1000 ) chikulatime2 = 0; +// +// for ( i = 0;i < ConnectLen; i++ ) { +// if ( ( Connect[ i ].use ) && ( i != acfd )) { +// // +// +// if ( CHAR_CHECKINDEX( Connect[ i ].charaindex ) ) +// if ( CHAR_getInt( Connect[ i ].charaindex, CHAR_BECOMEPIG ) > -1 ) { //״̬ +// +// if ( ( CHAR_getInt( Connect[ i ].charaindex, CHAR_BECOMEPIG ) - 1 ) <= 0 ) { //ʱ +// CHAR_setInt( Connect[ i ].charaindex, CHAR_BECOMEPIG, 0 ); +// +// if ( CHAR_getWorkInt( Connect[ i ].charaindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_NONE ) { //ս״̬ +// CHAR_setInt( Connect[ i ].charaindex, CHAR_BECOMEPIG, -1 ); //״̬ +// CHAR_complianceParameter( Connect[ i ].charaindex ); +// CHAR_sendCToArroundCharacter( CHAR_getWorkInt( Connect[ i ].charaindex , CHAR_WORKOBJINDEX ) ); +// CHAR_send_P_StatusString( Connect[ i ].charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER ); +// CHAR_talkToCli( Connect[ i ].charaindex, -1, "ʧЧˡ", CHAR_COLORWHITE ); +// } +// } +// else { +// CHAR_setInt( Connect[ i ].charaindex, CHAR_BECOMEPIG, CHAR_getInt( Connect[ i ].charaindex, CHAR_BECOMEPIG ) - 1 ); +// } +// } +// } +// } +// } +//#endif + +} + +//int isThereInvalidIP(unsigned long ip, unsigned long* userip, unsigned long useripcount) +//{ +// unsigned long i = 0; +// for(; i < useripcount; ++i ) +// { +// if( userip[i] == ip && userip_count_data[i] >= getAttCnt()) +// return 1; +// } +// +// return 0; +//} + +// Nuke 0126: Resource protection +int isThereThisIP(unsigned long ip) +{ + unsigned long ipip = ip; + char ipstr[32]; + int astr,bstr,cstr,dstr; + astr=(ipip % 0x100); ipip=ipip / 0x100; + bstr=(ipip % 0x100); ipip=ipip / 0x100; + cstr=(ipip % 0x100); ipip=ipip / 0x100; + dstr=(ipip % 0x100); + sprintf(ipstr,"%d.%d.%d.%d",astr,bstr,cstr,dstr); + if(strcmp(ipstr,getNoAttIp(0))==0 || strcmp(ipstr,getNoAttIp(1))==0 || strcmp(ipstr,getNoAttIp(2))==0 || strcmp(ipstr,getNoAttIp(3))==0 || strcmp(ipstr,getNoAttIp(4))==0) + return 0; + int i,cmpnum = 0,j; + j = getSameIpLogin(); + if(j <= 0)return 0; + unsigned long ipa; + + for ( i = 0; i < ConnectLen ; i++ ) + { + if ( !Connect[ i ].use ) continue; + + //if ( Connect[ i ].state == NOTLOGIN || Connect[ i ].state == WHILEDOWNLOADCHARLIST ) { + memcpy( &ipa, &Connect[ i ].sin.sin_addr, 4 ); + if (ipa==ip && Connect[ i ].state == NOTLOGIN ) return 1; + //if(getLoginJqmType()==1) return 0; //IPЧ + if (ipa==ip) cmpnum++; + + if (cmpnum >= j){ + //print("Ƶ½IP:%d %d",cmpnum,j); + return 1; + } + } + + return 0; +} + +int isManRen(void) +{ + int i; + int maxnum = CHAR_getPlayerMaxNum()-10; + for(i=0;i= ipcnt){ + //print("Ƶ½IP:%d %d",cmpnum,j); + return 1; + } + } + + return 0; +} + +int player_online = 0; +int player_maxonline = 0; + +SINGLETHREAD BOOL netloop_faster( void ) +{ + //DebugMainFunction="netloop_faster1"; + int ret , loop_num; + struct timeval tmv; /*timeval*/ + static int fdremember = 0; + + static unsigned int total_item_use=0; + static int petcnt=0; + // static unsigned int nu_time=0; + struct timeval st, et; + unsigned int casend_interval_us , cdsend_interval_us; + int acceptmore = SERVSTATE_getAcceptmore(); + fd_set rfds, wfds , efds; + unsigned int looptime_us; + int allowerrornum = getAllowerrornum(); + int acwritesize = getAcwriteSize(); +#ifdef _AC_PIORITY + static int flag_ac=1; + static int fdremembercopy=0; + static int totalloop=0; + static int totalfd=0; + static int totalacfd=0; + static int counter=0; +#endif + /* + { + int errorcode; + int errorcodelen; + int qs; + + errorcodelen = sizeof(errorcode); + qs = getsockopt( acfd, SOL_SOCKET, SO_RCVBUF , &errorcode, &errorcodelen); + //andy_log + print("\n\n GETSOCKOPT SO_RCVBUF: [ %d, %d, %d] \n", qs, errorcode, errorcodelen); + } + */ + //DebugMainFunction="netloop_faster2"; + looptime_us = getOnelooptime_ms()*1000 ; + casend_interval_us = getCAsendinterval_ms()*1000; + cdsend_interval_us = getCDsendinterval_ms()*1000; + //DebugMainFunction="netloop_faster3"; + FD_ZERO( & rfds ); + FD_ZERO( & wfds ); + FD_ZERO( & efds ); + FD_SET( bindedfd , & rfds ); + FD_SET( bindedfd , & wfds ); + FD_SET( bindedfd , & efds ); + tmv.tv_sec = tmv.tv_usec = 0; + ret = select( bindedfd + 1 , &rfds,&wfds,&efds,&tmv ); + if( ret < 0 && ( errno != EINTR )){ + ; + } + //DebugMainFunction="netloop_faster4"; + if( ret > 0 && FD_ISSET(bindedfd , &rfds ) ){ + struct sockaddr_in sin; + int addrlen=sizeof( struct sockaddr_in ); + int sockfd; + // int flags=fcntl(bindedfd,F_GETFL,0);//ͨ F_GETFL ȡļ־flags + // fcntl(bindedfd,F_SETFL,flags|O_NONBLOCK|O_NDELAY);//˴ֻǰĴλΪO_NONBLOCK + sockfd = accept( bindedfd ,(struct sockaddr*) &sin , &addrlen ); + if( sockfd == -1 && errno == EINTR ){ + print( "accept err:%s\n", strerror(errno));; + } +#ifdef _SOCKET_NONBLOCK + else if (sockfd != -1 && fcntl (sockfd, F_SETFL, O_NONBLOCK) < 0) { + fprintf (stderr, "Set sockfd Nonblock error.\n"); + close (sockfd); + } +#endif + else if( sockfd != -1 ) + { + unsigned long sinip; + + memcpy( &sinip, &sin.sin_addr, 4); +// if( isThereInvalidIP( sinip, userip, useripcount ) ) +// { +// // ˣ° +// int ipa,ipb,ipc,ipd; +// char ip[32]; +// ipa=(sinip % 0x100); sinip=sinip / 0x100; +// ipb=(sinip % 0x100); sinip=sinip / 0x100; +// ipc=(sinip % 0x100); sinip=sinip / 0x100; +// ipd=(sinip % 0x100); +// sprintf(ip,"%d.%d.%d.%d",ipa,ipb,ipc,ipd); +// +// close(sockfd); +// +// char systemstr[256]; +// sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); +// system(systemstr); +// } +// else + { + + int cono=1, from_acsv = 0; + if (cono_check&CONO_CHECK_LOGIN){ + if( StateTable[WHILELOGIN]+StateTable[WHILELOGOUTSAVE] > QUEUE_LENGTH1 || + StateTable[WHILEDOWNLOADCHARLIST] > QUEUE_LENGTH2 ){ + print("err State[%d,%d,%d]!!\n", StateTable[WHILELOGIN], + StateTable[WHILELOGOUTSAVE], + StateTable[WHILEDOWNLOADCHARLIST] ); + + CONNECT_checkStatecount( WHILEDOWNLOADCHARLIST); + cono=0; + } + } + if (cono_check&CONO_CHECK_ITEM) + if ((total_item_use+3000) >= MAX_item_use){ + print("ʹƷ!!"); + cono=0; + } + if (cono_check&CONO_CHECK_PET) + if( (petcnt+1000) >= CHAR_getPetMaxNum() ){ + print("ʹó!!"); + cono=0; + } + + //print("CO"); + + { + float fs=0.0; + if( (fs = ((float)Connect[acfd].rbuse/AC_RBSIZE) ) > 0.6 ){ + print( "andy AC rbuse: %3.2f [%4d]\n", fs, Connect[acfd].rbuse ); + if( fs > 0.78 ) cono = 0; + } + } + + memcpy( &sinip, &sin.sin_addr, 4); + // Nuke *1 0126: Resource protection + + if((cono == 0) || (acceptmore <= 0) || isThereThisIP( sinip) ){ + // Nuke +2 Errormessage + char mess[64]="EŷæУԺԡ"; + if (!from_acsv) + write(sockfd,mess,strlen(mess)+1); + //print( "accept but drop[cono:%d,acceptmore:%d,isThereThisIP=%d]\n", cono, acceptmore,isThereThisIP( sinip)); + close(sockfd); +#ifdef _SAME_IP_ONLINE_NUM + }else if(SameIpOnlineNum(sinip) == 1){ + char mess[64]; + sprintf(mess, "EIP%dˣ½ԾάϷƽ⣡\n", getSameIpOnlineNum()); + write(sockfd,mess,strlen(mess)+1); + close(sockfd); +#endif + }else if( sockfd < ConnectLen && sockfd-player_online=getNoFullPlayer()){ + time_t curtime; + struct tm *p; + time(&curtime); + p=localtime(&curtime); + curtime = mktime(p); + if(curtime-atttime>getNoFullTime()){ + atttime = curtime; + int j,ipa,ipb,ipc,ipd; + char ip[32]; + char systemstr[256]; + unsigned long tmpip; + for(j=12;j=getNoFullEndPlayer()){ +// time_t curtime; +// struct tm *p; +// time(&curtime); +// p=localtime(&curtime); +// curtime = mktime(p); +// if(curtime-atttime>getNoFullEndTime()){ +// atttime = curtime; +// int j,ipa,ipb,ipc,ipd; +// char ip[32]; +// char systemstr[256]; +// unsigned long tmpip; +// for(j=12;j0){ +// int j,ipa,ipb,ipc,ipd; +// char ip[32]; +// char systemstr[256]; +// unsigned long tmpip; +// time_t curtime; +// struct tm *p; +// time(&curtime); +// p=localtime(&curtime); +// curtime = mktime(p); +// for(j=13;j0 && curtime-Connect[ sockfd ].starttime>=getNoFullPlayer()){ +// ipa=(tmpip % 0x100); tmpip=tmpip / 0x100; +// ipb=(tmpip % 0x100); tmpip=tmpip / 0x100; +// ipc=(tmpip % 0x100); tmpip=tmpip / 0x100; +// ipd=(tmpip % 0x100); +// sprintf(ip,"%d.%d.%d.%d",ipa,ipb,ipc,ipd); +// if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ +// sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); +// CONNECT_endOne_debug(j); +// system(systemstr); +// } +// } +// } +// } +//#endif + } + } + } + } + //DebugMainFunction="netloop_faster5"; + loop_num=0; + gettimeofday( &st, NULL ); + while(1) + { + //DebugMainFunction="netloop_faster6"; + char buf[ 65535 * 2 ]; + int j; + //ttom+1 for the debug + static int i_tto = 0; + static int i_timeNu = 0; + //DebugMainFunction="netloop_faster7"; + gettimeofday( &et, NULL ); + //DebugMainFunction="netloop_faster8"; + if( time_diff_us( et,st) >= looptime_us ) //ִÿ0.1ҪĵĹ + { +#define LOOP_NUM_ADD_CREDIT 5 +#define CREDIT_SPOOL 3 + + switch ( acceptmore ) { + case - 1: + print( "#" ); + break; + case 0: + print( "$" ); + + if ( !b_first_shutdown ) { + b_first_shutdown = TRUE; + i_shutdown_time = SERVSTATE_getLimittime(); + print("\n رշʱ=%d",i_shutdown_time); + } + break; + default: + { + static int i_counter=0; + // Syu ADD ʱȡAnnounce + static int j_counter=0; + // Syu ADD ÿСʱ¸Ӣսа + static int h_counter=0; + // ļʱ + static long total_count=0; + static int checktime_counter=0; + +#ifdef _AUTO_PK + static int h_autopk=0; +#endif + +#ifdef _LOOP_ANNOUNCE + static int loop_counter=0; +#endif +#ifdef _LUCK_MAN + static int lucktime_count=0; +#endif +#ifdef _QUESTION_ONLINE + static int questiontime_count=0; +#endif + + int i; + int item_max; + + if ( i_counter > 10 ) { //10 + player_online = 0; //looptime_us +#ifdef _AC_PIORITY + //print("\n", + // (totalfd*1.0)/(totalloop*1.0), + // totalfd,totalloop,totalacfd); + totalloop = 0; totalfd = 0; totalacfd = 0; +#endif + i_counter = 0; + item_max = ITEM_getITEM_itemnum(); + total_item_use = ITEM_getITEM_UseItemnum(); + for ( i = 0;i < ConnectLen; i++ ) { + if ( ( Connect[ i ].use ) && ( i != acfd )) { + if ( CHAR_CHECKINDEX( Connect[ i ].charaindex ) ) + player_online++; + } + } + if(player_online>player_maxonline){ + player_maxonline=player_online; + } + { + int max, min; + // int MaxItemNums; + char buff1[ 512 ]; +// char szBuff1[ 256 ]; +//#ifdef _ASSESS_SYSEFFICACY +// { +// float TVsec; +// ASSESS_getSysEfficacy( &TVsec); +// sprintf( szBuff1, "Sys:[%2.4f] \n", TVsec); +// } +//#endif + //MaxItemNums = ITEM_getITEM_itemnum(); + // MaxItemNums = getItemnum(); + memset( buff1, 0, sizeof( buff1)); + CHAR_getCharOnArrayPercentage( 1, &max, &min, &petcnt); + /* + sprintf( buff1,"\n=%d =%3.1f%% Ʒ=%3.1f%% ʼ:%d ս:%d\n%s", + player_online, (float)((float)(petcnt*100)/max), + (float)((float)(total_item_use*100)/MaxItemNums), + PETMAIL_getPetMailTotalnums(), Battle_getTotalBattleNum(), szBuff1 ); + */ + if((petcnt+500)>=getPetcharnum() || (total_item_use+2000)>=getItemnum()*0.98){ + lssproto_Shutdown_recv(0, "hogehoge", 1); + } + sprintf( buff1,"\n=%d =%d Ʒ=%d ʼ:%d ս:%d", + player_online, petcnt,total_item_use, + PETMAIL_getPetMailTotalnums(), + Battle_getTotalBattleNum() ); + //sprintf( buff1,"\nPlayer=%d PM:%d B:%d %s", + //player_online, + //PETMAIL_getPetMailTotalnums(), Battle_getTotalBattleNum(), szBuff1 ); + + buff1[ strlen( buff1)+1] = 0; + print("%s", buff1); +#ifdef _ASSESS_SYSEFFICACY_SUB + { +// float TVsec; +// ASSESS_getSysEfficacy_sub( &TVsec, 1); +// sprintf( szBuff1, "NT:[%2.4f] ", TVsec); +// strcpy( buff1, szBuff1); +// +// ASSESS_getSysEfficacy_sub( &TVsec, 2); +// sprintf( szBuff1, "NG:[%2.4f] ", TVsec); +// strcat( buff1, szBuff1); +// +// ASSESS_getSysEfficacy_sub( &TVsec, 3); +// sprintf( szBuff1, "BT:[%2.4f] ", TVsec); +// strcat( buff1, szBuff1); +// +// ASSESS_getSysEfficacy_sub( &TVsec, 4); +// sprintf( szBuff1, "CH:[%2.4f] \n", TVsec); +// strcat( buff1, szBuff1); + /* + ASSESS_getSysEfficacy_sub( &TVsec, 5); + sprintf( szBuff1, "PM:[%2.4f] \n", TVsec); + strcat( buff1, szBuff1); + + ASSESS_getSysEfficacy_sub( &TVsec, 6); + sprintf( szBuff1, "FM:[%2.4f] ", TVsec); + strcat( buff1, szBuff1); + + ASSESS_getSysEfficacy_sub( &TVsec, 7); + sprintf( szBuff1, "SV:[%2.4f] ", TVsec); + strcat( buff1, szBuff1); + + ASSESS_getSysEfficacy_sub( &TVsec, 9); + sprintf( szBuff1, "AG:[%2.4f] ", TVsec); + strcat( buff1, szBuff1); + + ASSESS_getSysEfficacy_sub( &TVsec, 10); + sprintf( szBuff1, "CE:[%2.4f] \n", TVsec); + strcat( buff1, szBuff1); + */ + //buff1[ strlen( buff1)+1] = 0; + //print("%s.", buff1); + } +#endif + } +#ifdef _TIME_TICKET + check_TimeTicket(); +#endif + + } + +#ifdef _LOOP_ANNOUNCE + if ( loop_counter > 60*getLoopAnnounceTime() && getLoopAnnounceMax()>0) + { + int i; + int playernum = CHAR_getPlayerMaxNum(); + static int index; + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + char buff[36]; + snprintf( buff, sizeof( buff),"%s档",getGameserverID()); + CHAR_talkToCli( i, -1, buff, CHAR_COLORYELLOW); + CHAR_talkToCli( i, -1, getLoopAnnounce(index % getLoopAnnounceMax()), CHAR_COLORYELLOW); + } + } + index++; + loop_counter=0; + } +#endif + +#ifdef _LUCK_MAN + if( lucktime_count > 60*getLuckTime() && getLuckItem()>0 &&getLuckTime()>0 && CHAR_getPlayerMaxNum()>0) + { + int i; + int playernum; + int luckcharaindex,luckret,luckitemindex; + char* luckname=NULL; + char luckbuf[256]; + goto LUCKBEGIN; +LUCKBEGIN: + playernum = CHAR_getPlayerMaxNum(); + luckcharaindex = rand()%playernum; + + luckitemindex = ITEM_makeItemAndRegist( getLuckItem()); + luckret = CHAR_addItemSpecificItemIndex(luckcharaindex,luckitemindex); + if( luckret < 0 || luckret >= CHAR_MAXITEMHAVE ) + { + ITEM_endExistItemsOne( luckitemindex); + goto LUCKBEGIN; + } + else + { + luckname=CHAR_getChar(luckcharaindex,CHAR_NAME); + CHAR_talkToCli( luckcharaindex, -1, "ϲΪǣ", CHAR_COLORYELLOW); + sprintf( luckbuf, "ϲҡ%sΪǣýƷ%s",luckname,ITEM_getChar(luckitemindex,ITEM_NAME)); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, luckbuf, CHAR_COLORRED); + } + } + lucktime_count=0; + } + } +#endif + +#ifdef _QUESTION_ONLINE + if(getQustionTime()>0 && questiontime_count>getQustionTime()*60 && CHAR_getPlayerMaxNum()>0) + { + char *res; + res = sasql_query_question(); + if(strcmp(res,"err")!=0) + { + saacproto_ACQuestion_recv(res); + } + questiontime_count=0; + } +#endif + +#ifdef _AUTO_PK + if(AutoPk_PKTimeGet()>-1){ + if ( h_autopk > 60 ) + { + h_autopk=0; + AutoPk_PKSystemInfo(); + } + }else{ + if(autopkone == 0){ + AutoPk_GetAwardStr(); + autopkone = 1; + } + if(autopkstart==1){ + if(h_autopk > 10){ + h_autopk = 0; + if(autopkend==1){ +/* time_t timep; + time(&timep); + int j; + for( j = 0; j < BATTLE_battlenum; j ++ ){ + if( BattleArray[j].use == FALSE ){ + continue; + }else{ + if(BattleArray[j].floor!=20000){ + continue; + }else{ + if(timep-BattleArray[j].battletime>=getAutoPkBattleTime()){ + int pkfd1 = getfdFromCharaIndex(BattleArray[j].leaderindex); + int pkfd2 = getfdFromCharaIndex(BattleArray[j].rivalindex); + lssproto_CharLogout_recv(pkfd1,0); + lssproto_CharLogout_recv(pkfd2,0); + } + } + } + } + int playernum = CHAR_getPlayerMaxNum(); + int i; + for(i=0;i-1 && getAutoPkTime()<24){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int hour=p->tm_hour; + int min=p->tm_min; + if(getAutoPkTime() == hour+1 && min >=30){ + AutoPk_PKTimeSet(30); + AutoPk_GetAwardStr(); + } + } + } + } +#endif + + // Syu ADD ʱȡAnnounce + if ( j_counter > 60*60 ) + {//6000 Լ 600=10 + j_counter=0; + print("\nʱȡ"); + LoadAnnounce(); + } + + if ( checktime_counter > 60*60) + { + checktime_counter=0; + // if (strcmp(getlocaltime(), TimeLimitLocal)>0){ + // exit(0); + // } + } + /* + #ifdef _ALLDOMAN // Syu ADD аNPC + // Syu ADD ÿСʱ¸Ӣսа + if ( h_counter > 60*60 ){//36000 Լ 3600=60 + h_counter=0; + print("\nSyu log LoadHerolist"); + saacproto_UpdataStele_send ( acfd , "FirstLoad", "LoadHerolist" , "" , 0 , 0 , 0 , 999 ) ; + } + #endif + */ + + if ( i_timeNu != time( NULL ) ) // ÿִһ + { + i_timeNu = time( NULL ); + +#ifdef _DEL_DROP_GOLD + //if( total_count % 60 == 0 ) { //ÿִ + // GOLD_DeleteTimeCheckLoop(); + //} +#endif + //if( total_count % 60*10 == 0 ) { //ÿ10ִ + //} +#ifdef _ALLBLUES_LUA_1_5 + if( total_count % 60 == 0 ) { //ÿִ + NetLoopFunction(); + } +#endif +#ifdef _PK_LUCK_MAN + if ( total_count % 60 == 0 && getPkLuckTimeMin()>-1 && getPkLuckTimeMax()>-1 ){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + int hour=p->tm_hour; + int min=p->tm_min; + if(hour>=getPkLuckTimeMin()&&hour<=getPkLuckTimeMax()&&pkluckhour!=hour){ + if(pkluckmin==-1){ + pkluckmin = RAND(1,59); + pklucknum = 0; + } + if(min==pkluckmin){ + pkluckhour = hour; + pkluckmin=-1; + int pkluckplayerindex[100]; + int j; + for ( j = 0;j < ConnectLen; j++ ) { + if ( ( Connect[ j ].use ) && ( j != acfd )) { + if ( CHAR_CHECKINDEX( Connect[ j ].charaindex ) ){ + if( CHAR_getWorkInt( Connect[ j ].charaindex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE && getPkLuckFloor(CHAR_getInt(Connect[ j ].charaindex,CHAR_FLOOR))>0 && CHAR_getInt(Connect[ j ].charaindex,CHAR_LV)>=getPkLuckLevel()){ + if(BattleArray[CHAR_getWorkInt( Connect[ j ].charaindex,CHAR_WORKBATTLEINDEX)].type == BATTLE_TYPE_P_vs_P && BattleArray[CHAR_getWorkInt( Connect[ j ].charaindex,CHAR_WORKBATTLEINDEX)].turn10){ + int k,l; + int pkluckmanindex[100]; + pkluckmanindex[0] = -1; + int m = getPkLuckNum(); + if(pklucknum100) continue; + char tmpbuf[256]; + int mapnum = getPkLuckFloor(CHAR_getInt(pkluckplayerindex[n-1],CHAR_FLOOR)); + char *mapname = getPkLuckMapName(mapnum-1); + sprintf(tmpbuf,"[У˿Ѷ]ϲ[%s][%s]PKб",CHAR_getChar(pkluckplayerindex[n-1],CHAR_NAME),mapname); + int lucktemp[4]; + char luckbuf[4][32] = {"","","Ա",""}; + lucktemp[0] = getPkLuckFame(); + lucktemp[1] = getPkLuckVigor(); + lucktemp[2] = getPkLuckVipPoint(); + lucktemp[3] = getPkLuckAmPoint(); + int lucktype; + randmax = 1; + while(randmax<=10){ + lucktype = RAND(1,4); + if(lucktemp[lucktype-1]>0) + break; + randmax++; + } + if(randmax>10) continue; + if(lucktype==1){ + CHAR_setInt(pkluckplayerindex[n-1],CHAR_FAME,CHAR_getInt(pkluckplayerindex[n-1],CHAR_FAME)+lucktemp[0]*100); + } + else if(lucktype==2){ + CHAR_setInt(pkluckplayerindex[n-1],CHAR_VIGOR,CHAR_getInt(pkluckplayerindex[n-1],CHAR_VIGOR)+lucktemp[1]); + } + else if(lucktype==3){ + sasql_vippoint(CHAR_getChar(pkluckplayerindex[n-1],CHAR_CDKEY),lucktemp[2],1); + } + else if(lucktype==4){ + sasql_ampoint(CHAR_getChar(pkluckplayerindex[n-1],CHAR_CDKEY),lucktemp[3],1); + } + sprintf(tmpbuf,"%s,%s %d!",tmpbuf,luckbuf[lucktype-1],lucktemp[lucktype-1]); + pkluckplayerindex[n-1] = -1; + int i; + int playernum = CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, tmpbuf, CHAR_COLORRED); + } + } + } + } + } + } + } +#endif + +#ifdef _17CSA_YANZHENG + if( total_count % (60*60) == 0 ) { //ÿ60ִ + if(yzcnt>0){ + if(yzcnt>=3){ + exit(1); + }else{ + if(attestation()<1){ + yzcnt++; + }else{ + yzcnt=0; + } + } + } + } + + if( total_count % (60*60*24) == 0 ) { //ÿ24Сʱִ + if(attestation()<1){ + if(yzcnt<3){ + yzcnt++; + }else{ + exit(1); + } + } + } +#endif + +#ifdef _AUTO_PK + if(AutoPk_PKTimeGet()>-1 || autopkstart==1) + h_autopk++; +#endif + i_counter++; + // Syu ADD ʱȡAnnounce + j_counter++; + // Syu ADD ÿСʱ¸Ӣսа + h_counter++; + + total_count++; + checktime_counter++; +#ifdef _LOOP_ANNOUNCE + loop_counter++; +#endif +#ifdef _LUCK_MAN + if(getLuckItem()>0 &&getLuckTime()>0 && CHAR_getPlayerMaxNum()>0){ + lucktime_count++; + } +#endif +#ifdef _QUESTION_ONLINE + if(getQustionTime()>0 && CHAR_getPlayerMaxNum()>0){ + questiontime_count++; + if(questionstarttime>0) + { + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if( timep-questionstarttime>30 || questionman>=3){ + questionstarttime=0; + questionman=0; + char answerbuf[256]; + sprintf(answerbuf,"ʴ𡿱(%s)ûдԵҼסŶ",answer); + int i_count,playmaxnum; + playmaxnum=CHAR_getPlayerMaxNum(); + for( i_count = 0 ; i_count < playmaxnum ; i_count++) { + if( CHAR_getCharUse(i_count) != FALSE ) { + if(CHAR_getWorkInt(i_count,CHAR_WORKQUESTIONFLG)!=1){ + CHAR_talkToCli( i_count, -1, answerbuf, CHAR_COLORRED); + } + } + } + } + } + } +#endif + } + } + + if ( ( i_tto % 60 ) == 0 ) { + i_tto = 0; + print( "." ); + } + i_tto++; + + //andy add 2003/0212------------------------------------------ + CONNECT_SysEvent_Loop( ); + + //------------------------------------------------------------ + } // switch() + +#ifdef _AC_PIORITY + if ( flag_ac == 2 ) fdremember = fdremembercopy; + + flag_ac = 1; + + totalloop++; + +#endif + break; // Break while + } // if(>0.1sec) + + loop_num++; + //DebugMainFunction="netloop_faster9"; +#ifdef _AC_PIORITY + switch ( flag_ac ) { + case 1: + fdremembercopy = fdremember; + fdremember = acfd; + flag_ac = 2; + break; + case 2: + counter++; + + if ( counter >= 3 ) { + counter = 0; + fdremember = fdremembercopy + 1; + flag_ac = 0; + } + + break; + default: + fdremember++; + break; + } + +#else + fdremember++; + +#endif + //DebugMainFunction="netloop_faster10"; + if ( fdremember == ConnectLen ) fdremember = 0; + + if ( Connect[ fdremember ].use == FALSE ) continue; + + if ( Connect[ fdremember ].state == WHILECLOSEALLSOCKETSSAVE ) continue; + + if ( getKongType()==1 && Connect[ fdremember ].state == NOTLOGIN && Connect[ fdremember ].ctype!=CLI ){ + if ( fdremember != acfd ){ + if(Connect[fdremember].connecttime + 20 < time(NULL)){ + unsigned long tmpip; + int a,b,c,d; + char ip[32]; + char ip2[32]; + tmpip=CONNECT_get_userip(fdremember); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ +#ifdef _CAX_OFF_IPTABLES + char token[256]; + sprintf(token, "iptables -I INPUT -s %s -j DROP",ip); + //printf("%s\n", token); + logKong(ip); + system(token); +#endif + char mess[64]="Eip"; + write(fdremember,mess,strlen(mess)+1); + CONNECT_endOne_debug(fdremember ); + continue; + } + } + } + } + //DebugMainFunction="netloop_faster11"; +#ifdef _AC_PIORITY + totalfd++; + + if ( fdremember == acfd ) totalacfd++; + +#endif + //DebugMainFunction="netloop_faster12"; + /* read select */ + FD_ZERO( & rfds ); + FD_ZERO( & wfds ); + FD_ZERO( & efds ); + + FD_SET( fdremember , & rfds ); + FD_SET( fdremember , & wfds ); + FD_SET( fdremember , & efds ); + tmv.tv_sec = tmv.tv_usec = 0; + ret = select( fdremember + 1 , &rfds,&wfds,&efds,&tmv ); + + if ( ret > 0 && FD_ISSET( fdremember, &rfds ) ) { + errno = 0; + memset( buf, 0, sizeof( buf ) ); + // int flags=fcntl(fdremember,F_GETFL,0);//ͨ F_GETFL ȡļ־flags + // fcntl(fdremember,F_SETFL,flags|O_NONBLOCK|O_NDELAY);//˴ֻǰĴλΪO_NONBLOCK + ret = read( fdremember, buf, sizeof( buf ) ); + + if ( ret > 0 && sizeof( buf ) <= ret ) { + //print( "ȡ(%s)峤:%d - %d !!\n", ( fdremember == acfd ) ? "SAAC" : "", ret, sizeof( buf ) ); + } + + if( (ret == -1 && errno != EINTR) || ret == 0 ){ + if( fdremember == acfd ){ + print( "ȡ:%d %s\n",ret,strerror(errno)); + print( "gmsvacsvʧȥ! 쳣ֹ...\n" ); + sigshutdown( -1 ); + exit(1); + }else { + if( ret == -1 ){ + if(errno==113 || errno==104){ + continue; + }else{ + //print( "ȡ: %d %s \n", errno, strerror( errno)); + } + } + //print( "\nRCL " ); + CONNECT_endOne_debug(fdremember ); + + continue; + } + }else{ + if( appendRB( fdremember, buf, ret ) == -2 && getErrUserDownFlg() == 1){ + //print("77777"); + CONNECT_endOne_debug(fdremember ); + continue; + }else{ + Connect[fdremember].lastreadtime = NowTime; + Connect[fdremember].lastreadtime.tv_sec -= DEBUG_ADJUSTTIME; + Connect[fdremember].packetin = 30; + } + } + }else if( ret < 0 && errno != EINTR){ + if( fdremember != acfd ){ + //if(CHAR_getWorkInt(Connect[fdremember].charaindex,CHAR_WORKNOONLINE)!=1){ + //print( "\nȡӴ:%d %s\n", errno, strerror( errno )); + CONNECT_endOne_debug(fdremember ); + continue; + //} + } + } + + //DebugMainFunction="netloop_faster13"; + + for ( j = 0; j < 3; j ++ ) { + char rbmess[ 65535 * 2 ]; + memset( rbmess, 0, sizeof( rbmess ) ); + + if ( GetOneLine_fix( fdremember, rbmess, sizeof( rbmess ) ) == FALSE ) continue; + + if ( !( ( rbmess[ 0 ] == '\r' && rbmess[ 1 ] == '\n' ) || rbmess[ 0 ] == '\n' ) ) { + if ( fdremember == acfd ) { +#ifdef _DEBUG + //printf("ȡSAAC:%s\n",rbmess); +#endif + //DebugMainFunction="netloop_faster14"; + if ( saacproto_ClientDispatchMessage( fdremember, rbmess ) < 0 ) { + //print("\nSAAC:DispatchMsg_Error!!!\n"); + } + }else { +#ifdef _DEBUG + //printf("ȡͻ:%s\n",rbmess); +#endif + //DebugMainFunction="netloop_faster15"; + if ( lssproto_ServerDispatchMessage( fdremember, rbmess ) < 0 ) { + //print("\nLSSP:DispatchMsg_Error!!! \n"); +// unsigned long tmpip; +// int a,b,c,d; +// char ip[32]; +// tmpip=CONNECT_get_userip(fdremember); +// a=(tmpip % 0x100); tmpip=tmpip / 0x100; +// b=(tmpip % 0x100); tmpip=tmpip / 0x100; +// c=(tmpip % 0x100); tmpip=tmpip / 0x100; +// d=(tmpip % 0x100); +// sprintf(ip,"%d.%d.%d.%d",a,b,c,d); +// time_t curtime; +// struct tm *p; +// time(&curtime); +// p=localtime(&curtime); +// curtime = mktime(p); +// int j=0; +// for(; j < useripcount; ++j ){ +// if( userip[j] == tmpip ){ +// if(userip_count_data[j]>=getAttDmeCnt()){ +// +// print( "Ƿ=%d ǷIP=%s \n", fdremember, ip ); +// +// char systemerrstr[256]; +// sprintf(systemerrstr,"iptables -I INPUT -s %s -j DROP",ip); +// system(systemerrstr); +// userip_count_data[j] = 1; +// useriptime[j] = curtime; +// CONNECT_endOne_debug( fdremember ); +// break; +// } +// if(curtime-useriptime[j]<=getAttDmeTime()){ +// ++userip_count_data[j]; +// break; +// }else{ +// useriptime[j]=curtime; +// break; +// } +// } +// } +// if(strcmp(ip,"59.53.88.217")!=0 && strcmp(ip,"58.17.30.87")!=0){ +// if(j>= useripcount && useripcount allowerrornum ) + break; + }else{ + //DebugMainFunction="netloop_faster17"; + if(CONNECT_getState(fdremember)==NOTLOGIN){ + Connect[ fdremember ].rightnum++; + } + if(Connect[ fdremember ].rightnum>getRightNum()){ //ֹȷ + unsigned long tmpip; + int a,b,c,d; + char ip[32]; + tmpip=CONNECT_get_userip(fdremember); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + //if(CONNECT_getState(fdremember)==NOTLOGIN && sasql_check_lockip(ip,getFengType())<1){ + if(CONNECT_getState(fdremember)==NOTLOGIN){ + if(getRightMode()==0){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),4)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logRightBao(ip,strlen(rbmess)); + } +#endif + CONNECT_endOne_debug(fdremember); + break; + //} + } + }else{ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),4)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logRightBao(ip,strlen(rbmess)); + } +#endif + CONNECT_endOne_debug(fdremember); + break; + //} + } + } + }else{ + if(CONNECT_getState(fdremember)==NOTLOGIN){ + CONNECT_endOne_debug(fdremember); + break; + } + } + } + //DebugMainFunction="netloop_faster18"; + } + } + } + } + //DebugMainFunction="netloop_faster19"; + if ( Connect[ fdremember ].errornum > getFengerrornum() ) { + unsigned long tmpip; + int a,b,c,d; + char ip[32]; + tmpip=CONNECT_get_userip(fdremember); + a=(tmpip % 0x100); tmpip=tmpip / 0x100; + b=(tmpip % 0x100); tmpip=tmpip / 0x100; + c=(tmpip % 0x100); tmpip=tmpip / 0x100; + d=(tmpip % 0x100); + sprintf(ip,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ip,getNoAttIp(0))!=0 && strcmp(ip,getNoAttIp(1))!=0 && strcmp(ip,getNoAttIp(2))!=0 && strcmp(ip,getNoAttIp(3))!=0 && strcmp(ip,getNoAttIp(4))!=0){ + //if(CONNECT_getState(fdremember)==NOTLOGIN && sasql_check_lockip(ip,getFengType())<1){ + if(CONNECT_getState(fdremember)==NOTLOGIN){ + if(getErrorMode()==0){ + if(sasql_query_online_ip(ip)==0){ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),3)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongBao(ip); + } +#endif + CONNECT_endOne_debug(fdremember); + continue; + //} + } + }else{ + //if(sasql_add_lockip(ip,getFengType(),getServernumber(),3)==1){ +#ifdef _CAX_OFF_IPTABLES + if(strcmp(ip,"0.0.0.0")!=0){ + char systemstr[128]; + sprintf(systemstr,"iptables -I INPUT -s %s -j DROP",ip); + system(systemstr); + logWrongBao(ip); + } +#endif + CONNECT_endOne_debug(fdremember); + continue; + //} + } + } + }else{ + if(CONNECT_getState(fdremember)==NOTLOGIN){ + CONNECT_endOne_debug( fdremember ); + continue; + } + } + } + //DebugMainFunction="netloop_faster20"; + if ( Connect[ fdremember ].errornum > allowerrornum ) { + //print( "û:%s̫ˣǿƹر\n",inet_ntoa(Connect[fdremember].sin.sin_addr )); + logHackKick(fdremember); + CONNECT_endOne_debug( fdremember ); + continue; + } + //DebugMainFunction="netloop_faster21"; + if ( Connect[ fdremember ].CAbufsiz > 0 + && time_diff_us( et, Connect[ fdremember ].lastCAsendtime ) > casend_interval_us ) { + CAsend( fdremember ); + Connect[ fdremember ].lastCAsendtime = et; + } + //DebugMainFunction="netloop_faster22"; + if ( Connect[ fdremember ].CDbufsiz > 0 + && time_diff_us( et, Connect[ fdremember ].lastCDsendtime ) > cdsend_interval_us ) { + CDsend( fdremember ); + Connect[ fdremember ].lastCDsendtime = et; + } + //DebugMainFunction="netloop_faster23"; + if ( Connect[ fdremember ].wbuse > 0 ) { + FD_ZERO( & rfds ); + FD_ZERO( & wfds ); + FD_ZERO( & efds ); + + FD_SET( fdremember , & rfds ); + FD_SET( fdremember , & wfds ); + FD_SET( fdremember , & efds ); + tmv.tv_sec = tmv.tv_usec = 0; + ret = select( fdremember + 1 , &rfds,&wfds,&efds,&tmv ); + + if ( ret > 0 && FD_ISSET( fdremember , &wfds )) { + //Nuke start 0907: Protect gmsv + // int flags=fcntl(fdremember,F_GETFL,0);//ͨ F_GETFL ȡļ־flags + // fcntl(fdremember,F_SETFL,flags|O_NONBLOCK|O_NDELAY);//˴ֻǰĴλΪO_NONBLOCK + if ( fdremember == acfd ) { + ret = write( fdremember , Connect[ fdremember ].wb , + ( Connect[fdremember].wbuse < acwritesize) ? Connect[fdremember].wbuse : acwritesize ); +#ifdef _DEBUG + //printf("SAAC:%s\n",Connect[ fdremember ].wb); + memset( Connect[ fdremember ].wb, 0, WBSIZE ); +#endif + }else { + ret = write( fdremember , Connect[fdremember].wb , + (Connect[fdremember].wbuse < 1024*16) ? + Connect[fdremember].wbuse : 1024*16 ); + } + + // Nuke end + + if ( ret == -1 && errno != EINTR ) { + //print( "д뷵: %d %s \n", errno, strerror( errno)); + CONNECT_endOne_debug( fdremember ); + continue; + } else if( ret > 0 ){ + shiftWB( fdremember, ret ); + } + }else if( ret < 0 && errno != EINTR ){ + //if(CHAR_getWorkInt(Connect[fdremember].charaindex,CHAR_WORKNOONLINE)!=1){ + //print( "\nдӴ:%d %s\n",errno, strerror( errno )); + CONNECT_endOne_debug(fdremember ); + //} + } + } + //DebugMainFunction="netloop_faster24"; + /* ॢȤν */ + if ( fdremember == acfd ) + continue; + //DebugMainFunction="netloop_faster25"; + //ttom start : because of the second have this + if ( Connect[ fdremember ].close_request ) { + //print( "ǿȹر:%s \n",inet_ntoa(Connect[fdremember].sin.sin_addr )); + CONNECT_endOne_debug( fdremember ); + continue; + } + //DebugMainFunction="netloop_faster27"; + //ttom end + } + + return TRUE; +} + +ANYTHREAD void outputNetProcLog( int fd, int mode) +{ + int i; + int c_use = 0, c_notdetect = 0 ; + int c_ac = 0, c_cli = 0 , c_adm = 0, c_max = 0; + int login = 0; + char buffer[ 4096 ]; + char buffer2[ 4096 ]; + + strcpysafe( buffer, sizeof( buffer ), "Server Status\n" ); + c_max = ConnectLen; + + + for ( i = 0;i < c_max;i++ ) { + CONNECT_LOCK( i ); + + if ( Connect[ i ].use ) { + c_use ++; + + switch ( Connect[ i ].ctype ) { + case NOTDETECTED: c_notdetect++; break; + case AC: c_ac ++; break; + case CLI: c_cli ++; break; + case ADM: c_adm ++; break; + } + + if ( Connect[ i ].charaindex >= 0 ) { + login ++; + } + } + + CONNECT_UNLOCK( i ); + } + + snprintf( buffer2 , sizeof( buffer2 ) , + "connect_use=%d\n" + "connect_notdetect=%d\n" + "connect_ac=%d\n" + "connect_cli=%d\n" + "connect_adm=%d\n" + "connect_max=%d\n" + "login=%d\n", + c_use , c_notdetect, c_ac, c_cli, c_adm, c_max, login ); + strcatsafe( buffer , sizeof( buffer ), buffer2 ); + { + int char_max = CHAR_getCharNum(); + int char_use = 0 ; + int pet_use = 0; + + for ( i = 0;i < char_max;i++ ) { + if ( CHAR_getCharUse( i ) ) { + char_use++; + + if ( CHAR_getInt( i, CHAR_WHICHTYPE ) == CHAR_TYPEPET ) { + pet_use ++; + } + } + } + + snprintf( buffer2, sizeof( buffer2 ) , + "char_use=%d\n" + "char_max=%d\n" + "pet_use=%d\n", + char_use , char_max, pet_use ); + strcatsafe( buffer , sizeof( buffer ), buffer2 ); + } + + { + + int i; + int item_max = ITEM_getITEM_itemnum(); + int item_use = 0; + + for ( i = 0;i < item_max;i++ ) { + if ( ITEM_getITEM_use( i ) ) { + item_use ++; + } + } + + snprintf( buffer2, sizeof( buffer2 ), + "item_use=%d\n" + "item_max=%d\n", + item_use , item_max ); + strcatsafe( buffer , sizeof( buffer ), buffer2 ); + } + + { + int i , obj_use = 0; + int obj_max = OBJECT_getNum(); + + for ( i = 0;i < obj_max;i++ ) { + if ( OBJECT_getType( i ) != OBJTYPE_NOUSE ) { + obj_use ++; + } + } + + snprintf( buffer2, sizeof( buffer2 ) , + "object_use=%d\n" + "object_max=%d\n", + obj_use , obj_max ); + strcatsafe( buffer , sizeof( buffer ) , buffer2 ); + } + + if ( mode == 0 ) { + printl( LOG_PROC , buffer ); + }else if( mode == 1 ) { + lssproto_ProcGet_send( fd, buffer ); + } +} + +/*------------------------------------------------------------ +* cdkey fd 롣 +* +* cd char* cdkey +* ֤ +* եǥץ äơ -1 λϥ顼 +------------------------------------------------------------*/ +ANYTHREAD int getfdFromCdkeyWithLogin( char* cd ) +{ + int i; + + for ( i = 0 ;i < ConnectLen ; i ++ ) { + CONNECT_LOCK( i ); + + if ( Connect[ i ].use == TRUE + && Connect[ i ].state != NOTLOGIN // Nuke 0514: Avoid duplicated login + && strcmp( Connect[ i ].cdkey , cd ) == 0 ) { + CONNECT_UNLOCK( i ); + return i; + } + + CONNECT_UNLOCK( i ); + } + + return -1; +} + + +/*********************************************************************** +MTIO +***********************************************************************/ +// Nuke start 08/27: For acceleration avoidance +//ttom+1 +#define m_cktime 500 +//static float m_cktime=0; + +int checkWalkTime(int fd) +{ + int me, interval; + //ttom + float f_Wtime, f_WLtime, f_interval; + // Nuke + return 0; + + //ARM&Tom correct + //me=CONNECT_getCharaindex(fd); + me = fd; + Connect[ me ].Walktime = time( 0 ); + + gettimeofday( &Connect[ me ].Wtime, ( struct timezone* ) NULL ); // + interval = abs( Connect[ me ].Walktime - Connect[ me ].lastWalktime ); + //ttom + f_Wtime = Connect[ me ].Wtime.tv_sec * 1000 + Connect[ me ].Wtime.tv_usec / 1000; + f_WLtime = Connect[ me ].WLtime.tv_sec * 1000 + Connect[ me ].WLtime.tv_usec / 1000; + f_interval = abs( f_Wtime - f_WLtime ); + //ttom + Connect[ me ].Walkrestore--; + + if ( Connect[ me ].Walkrestore <= 0 ) { + //print("Walkspool restored "); + Connect[ me ].Walkspool = WALK_SPOOL; + Connect[ me ].Walkrestore = WALK_RESTORE; + } + + if ( f_interval > m_cktime ) { + Connect[ me ].WLtime = Connect[ me ].Wtime; + Connect[ me ].Walkcount = 0; + } else { + Connect[ me ].Walkcount++; + + if ( Connect[ me ].Walkcount > 1 ) { + Connect[ me ].Walkspool--; + + if ( Connect[ me ].Walkspool > 0 ) { + Connect[ me ].Walkcount = 0; + print( "Walkspool consumed as %d", Connect[ me ].Walkspool ); + return 0; + } + + /*Connect[me].Walkspool=WALK_SPOOL; + Connect[me].Walkrestore=WALK_RESTORE; + print("Walk dropped \n"); + Connect[me].credit=-10; + return 0;*/ + return -1; + } + } + return 0; +} +int setBtime(int fd) +{ + int me, interval; + //ARM & Tom + //me=CONNECT_getCharaindex(fd); + me = fd; + Connect[ me ].BEOrestore--; + + if ( Connect[ me ].BEOrestore <= 0 ) { + Connect[ me ].BEOrestore = BEO_RESTORE; + Connect[ me ].BEOspool = BEO_SPOOL; + //print("BEOspool restored "); + } + + Connect[ me ].lastlastBtime = Connect[ me ].lastBtime; + Connect[ me ].lastBtime = Connect[ me ].Btime; + Connect[ me ].Btime = time( 0 ); + interval = abs( Connect[ me ].Btime - Connect[ me ].lastlastBtime ); + //print("B3interval:%d ",interval); + + if ( interval < B3_TOLERANCE ) { + Connect[ me ].BEOspool--; + //print("B3spool consumed as:%d ",Connect[me].BEOspool); + + if ( Connect[ me ].BEOspool <= 0 ) return -1; + else return 0; + } else return 0; +} +int checkBEOTime(int fd) +{ + int me, interval; + //ARM & Tom + //me=CONNECT_getCharaindex(fd); + me = fd; + Connect[ me ].EOtime = time( 0 ); + interval = abs( Connect[ me ].EOtime - Connect[ me ].Btime ); + //print("BEOinterval:%d ",interval); + + if ( interval < BEO_TOLERANCE ) { + Connect[ me ].BEOspool--; + //print("BEOspool consumed as:%d ",Connect[me].BEOspool); + // Nuke 0626: Do not kick out + if (Connect[me].BEOspool <= 0) { Connect[me].nu_decrease++; return -1; } + else return 0; + } else return 0; +} +int ITEM_getRatio() +{ + int i, r; + int item_max = ITEM_getITEM_itemnum(); + int item_use = 0; + + for ( i = 0;i < item_max;i++ ) { + if ( ITEM_getITEM_use( i ) ) { + item_use ++; + } + } + + r = ( item_use * 100 ) / item_max; + print( "ItemRatio=%d%% ", r ); + return r; +} +int CHAR_players() +{ + int i; + int chars = 0; + int players = 0, pets = 0, others = 0; + int whichtype = -1; + int objnum = OBJECT_getNum(); + /* ڷobj */ + + for ( i = 0 ; i < objnum ; i++ ) { + switch ( OBJECT_getType( i ) ) { + case OBJTYPE_CHARA: + chars++; + whichtype = CHAR_getInt( OBJECT_getIndex( i ), CHAR_WHICHTYPE ); + + if ( whichtype == CHAR_TYPEPLAYER ) players++; + else if ( whichtype == CHAR_TYPEPET ) pets++; + else others ++; + + break; + + default: + break; + } + } + + return players; +} +void sigusr1(int i) +{ + signal( SIGUSR1, sigusr1 ); + cono_check = ( cono_check + 1 ) % 4; + print( "Cono Check is login:%d item:%d", cono_check & 1, cono_check & 2 ); +} +// Arminius 6.26 +void sigusr2(int i) +{ + signal( SIGUSR2, sigusr2 ); + print( "\nReceived Shutdown signal...\n\n" ); + lssproto_Shutdown_recv( 0, "hogehoge", 5 ); // 5ά +} + +// Nuke end +//ttom start +void CONNECT_set_watchmode(int fd, BOOL B_Watch) +{ + //int me; + //me = CONNECT_getCharaindex( fd ); + Connect[ fd ].in_watch_mode = B_Watch; +} +BOOL CONNECT_get_watchmode(int fd) +{ + //int me; + BOOL B_ret; + //me = CONNECT_getCharaindex( fd ); + B_ret = Connect[ fd ].in_watch_mode; + return B_ret; +} +BOOL CONNECT_get_shutup(int fd) +{ + //int me; + BOOL B_ret; + //me = CONNECT_getCharaindex( fd ); + B_ret = Connect[ fd ].b_shut_up; + return B_ret; +} +void CONNECT_set_shutup(int fd,BOOL b_shut) +{ + //int me; + //me = CONNECT_getCharaindex( fd ); + Connect[ fd ].b_shut_up = b_shut; +} +unsigned long CONNECT_get_userip(int fd) +{ + unsigned long ip; + memcpy( &ip, &Connect[ fd ].sin.sin_addr, sizeof( long ) ); + return ip; +} +void CONNECT_set_pass(int fd,BOOL b_ps) +{ + int me; + me = CONNECT_getCharaindex( fd ); + Connect[ me ].b_pass = b_ps; +} +BOOL CONNECT_get_pass(int fd) +{ + //int me; + BOOL B_ret; + //me = CONNECT_getCharaindex( fd ); + B_ret = Connect[ fd ].b_pass; + return B_ret; +} +void CONNECT_set_first_warp(int fd,BOOL b_ps) +{ + //int me; + //me = CONNECT_getCharaindex( fd ); + Connect[ fd ].b_first_warp = b_ps; +} +BOOL CONNECT_get_first_warp(int fd) +{ + //int me; + BOOL B_ret; + //me = CONNECT_getCharaindex( fd ); + B_ret = Connect[ fd ].b_first_warp; + return B_ret; +} +void CONNECT_set_state_trans(int fd,int a) +{ + //int me; + //me = CONNECT_getCharaindex( fd ); + Connect[ fd ].state_trans = a; +} +int CONNECT_get_state_trans(int fd) +{ + int i_ret; + //me = CONNECT_getCharaindex( fd ); + i_ret = Connect[ fd ].state_trans; + return i_ret; +} +//ttom end + +// Arminius 6.22 encounter +int CONNECT_get_CEP(int fd) +{ + return Connect[ fd ].CEP; +} + +void CONNECT_set_CEP(int fd, int cep) +{ + Connect[ fd ].CEP = cep; +} +// Arminius end + +// Arminius 7.12 login announce +int CONNECT_get_announced(int fd) +{ + return Connect[ fd ].announced; +} + +void CONNECT_set_announced(int fd, int a) +{ + Connect[ fd ].announced = a; +} + +// shan trade(DoubleCheck) begin +int CONNECT_get_confirm(int fd) +{ + return Connect[ fd ].confirm_key; +} +void CONNECT_set_confirm(int fd, BOOL b) +{ + Connect[ fd ].confirm_key = b; +} +// end +int isDie(int fd) +{ + return ( Connect[ fd ].die ); +} + +void setDie(int fd) +{ + Connect[ fd ].die = 1; +} + +int checkNu(fd) +{ + Connect[ fd ].nu--; + //print("NU=%d\n",Connect[fd].nu); + + if ( Connect[ fd ].nu < 0 ) return -1; + + return 0; +} + +int checkKe(fd) +{ + Connect[ fd ].ke--; + //print("KE=%d\n",Connect[fd].ke); + + if ( Connect[ fd ].ke < 0 ) return -1; + + return 0; +} + +// Nuke start 0626: For no enemy function +void setNoenemy(fd) +{ + Connect[ fd ].noenemy = 6; +} +void clearNoenemy(fd) +{ + Connect[ fd ].noenemy = 0; +} +int getNoenemy(fd) +{ + return Connect[ fd ].noenemy; +} +// Nuke end + +// Arminius 7/2: Ra's amulet +void setEqNoenemy(int fd, int level) +{ + Connect[ fd ].eqnoenemy = level; +} + +void clearEqNoenemy(int fd) +{ + Connect[ fd ].eqnoenemy = 0; +} + +int getEqNoenemy(int fd) +{ + return Connect[ fd ].eqnoenemy; +} + +#ifdef _Item_MoonAct +void setEqRandenemy(int fd, int level) +{ + Connect[ fd ].eqrandenemy = level; +} + +void clearEqRandenemy(int fd) +{ + Connect[ fd ].eqrandenemy = 0; +} + +int getEqRandenemy(int fd) +{ + return Connect[ fd ].eqrandenemy; +} + +#endif + +#ifdef _CHIKULA_STONE +void setChiStone(int fd, int nums) +{ + Connect[ fd ].chistone = nums; +} +int getChiStone(int fd) +{ + return Connect[ fd ].chistone; +} +#endif + +// Arminius 7.31 cursed stone +void setStayEncount(int fd) +{ + Connect[ fd ].stayencount = 1; +} + +void clearStayEncount(int fd) +{ + Connect[ fd ].stayencount = 0; +} + +int getStayEncount(int fd) +{ + return Connect[ fd ].stayencount; +} + +void CONNECT_setBDTime( int fd, int nums) +{ + Connect[ fd ].BDTime = nums; +} + +int CONNECT_getBDTime( int fd) +{ + return Connect[ fd ].BDTime; +} + +#ifdef _TYPE_TOXICATION +void setToxication( int fd, int flg) +{ + Connect[ fd ].toxication = flg; +} +int getToxication( int fd) +{ + return Connect[ fd ].toxication; +} +#endif + +#ifdef _NO_WARP +// shan hjj add Begin +int CONNECT_get_seqno(int fd) +{ + return Connect[fd].seqno; +} +void CONNECT_set_seqno(int fd, int a) +{ + if( (Connect[fd].seqno==CHAR_WINDOWTYPE_QUIZ_MAIN)&&(a==0) ) + a = CHAR_WINDOWTYPE_QUIZ_MAIN; + Connect[fd].seqno = a; +} +int CONNECT_get_selectbutton(int fd) +{ + return Connect[fd].selectbutton; +} +void CONNECT_set_selectbutton(int fd, int a) +{ + Connect[fd].selectbutton = a; +} +// shan End +#endif + +#ifdef _BATTLE_TIMESPEED +void RescueEntryBTime( int charaindex, int fd, unsigned int lowTime, unsigned int battletime) +{ + int NowTime = ( int ) time( NULL ); + + Connect[ fd ].CBTime = NowTime; + //Connect[fd].CBTime+battletime +} + +BOOL CheckDefBTime( int charaindex, int fd, unsigned int lowTime, unsigned int battletime, unsigned int addTime)//lowTimeӳʱ +{ +#ifdef CXC_BOXC_WUGUA + if( fd < 0 || fd >= ConnectLen ){ + return TRUE; + } +#endif + int delayTime = 0; + unsigned int NowTime = ( unsigned int ) time( NULL ); + + //print(" NowTime=%d lowTime=%d battleTime=%d CBTime=%d", NowTime, lowTime, battletime, Connect[fd].CBTime); + + lowTime += battletime; + + if ( ( Connect[ fd ].CBTime + battletime ) > lowTime ) lowTime = Connect[ fd ].CBTime + battletime; +#ifndef CXC_BOXC_WUGUA + + if ( NowTime < lowTime ) { //lowTimeӦõսʱ + int r = 0; + delayTime = lowTime - NowTime; + delayTime = ( delayTime <= 0 ) ? 1 : delayTime; + r = ( -4 ) * ( delayTime + 2 ); + //print("\nbr=%d\n",r); +// if(getSaType()==8018) +// r = 0; + lssproto_NU_send( fd, r ); + Connect[ fd ].nu += r; + } + +#endif +#ifdef CXC_BOXC_WUGUA + lssproto_NU_send( fd, 0 ); +#endif + //Connect[fd].BDTime = (NowTime+20)+delayTime; +#ifdef _FIX_CHARLOOPS + if(getCharloops()>0) + Connect[fd].BDTime = NowTime + rand() % getCharloops() ; // 񱦵ȴʱ + else + Connect[fd].BDTime = NowTime; +#else + Connect[ fd ].BDTime = ( NowTime + rand() % 5 ) + delayTime + addTime; // 񱦵ȴʱ +#endif + //print(" BDTime=%d ", Connect[fd].BDTime); + return TRUE; +} +#endif + +BOOL MSBUF_CHECKbuflen( int size, float defp) +{ + return TRUE; +} + +void SetTcpBuf( int sockfd ) +{ + + unsigned long param=1; + int nRecvBuf = getrecvbuffer()*1024; + int nSendBuf = getsendbuffer()*1024; + // int nRecvlowatBuf = getrecvlowatbuffer(); + // int nNetTimeout=0;//0 + // BOOL bDontLinger = FALSE; + // BOOL bReuseaddr=TRUE; + + struct linger rLinger; + rLinger.l_onoff = 1; // linegr + rLinger.l_linger = 0; // ӳʱΪ 0 , ע TCPIPرգпֻܳ + + //ýջ + if(setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,(char*)&nRecvBuf, sizeof(int)) < 0) + print( "\nSO_RCVBUFʧ!!!!\n" ); + + //÷ͻ + if(setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char*)&nSendBuf, sizeof(int)) < 0) + print( "\nSO_SNDBUFʧ!!!!\n" ); + /* + if(setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, (char*)&nNetTimeout, sizeof(int)) < 0) + print( "\nSO_SNDTIMEOʧ!!!!\n" ); + + if(setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (char*)&nNetTimeout, sizeof(int)) < 0) + print( "\nSO_RCVTIMEOʧ!!!!\n" ); + + if(setsockopt(sockfd,SOL_SOCKET,SO_DONTLINGER,(const char*)&bDontLinger,sizeof(BOOL)) < 0) + print( "\nSO_DONTLINGERʧ!!!!\n" ); + + if(setsockopt(sockfd,SOL_SOCKET ,SO_REUSEADDR,(const char*)&bReuseaddr,sizeof(BOOL)) < 0) + print( "\nSO_REUSEADDRʧ!!!!\n" ); + */ + if(setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char *)&rLinger, sizeof(rLinger)) < 0) + print( "\nSO_LINGERʧ!!!!\n" ); + /* //ýջ + if (setsockopt( sockfd, SOL_SOCKET, SO_RCVLOWAT, (char*)&nRecvlowatBuf, sizeof(int) < 0) + print( "\nýSO_RCVLOWATʧ!!!!\n" ); + */ + + // if(ioctl(sockfd, FIONBIO, ¶m)) + // print( "\nýFIONBIOʧ!!!!\n" ); + + // int flags=fcntl(sockfd,F_GETFL,0);//ͨ F_GETFL ȡļ־flags + // fcntl(sockfd,F_SETFL,flags|O_NONBLOCK|O_NDELAY);//˴ֻǰĴλΪO_NONBLOCK +} + + +#ifdef _SAME_IP_ONLINE_NUM +int SameIpOnlineNum( unsigned long ip ){ +#ifdef _CHECK_SEVER_IP + if(checkServerIp(ip) == TRUE){ + return 0; + } +#endif + int MAX_USER = getFdnum(); + int i, num=0; + if(getSameIpOnlineNum()>0){ + for(i=4;i= getSameIpOnlineNum()){ + return 1; + } + } + } + } + } + + return 0; +} +#endif + +#ifdef _CAX_LNS_NLSUOXU +BOOL DelTimer_net(int ID) +{ + if (ID-1 < 0 || ID-1 > arraysizeof( TimerLua )) return FALSE; + TimerLua[ID-1].FileName = NULL; + TimerLua[ID-1].FuncName = NULL; + TimerLua[ID-1].EspTime = -1; + TimerLua[ID].MespTime=-1; + TimerLua[ID-1].ID = -1; + TimerLua[ID-1].GetTime = -1; + return TRUE; +} +#endif + + +#ifdef _CAX_LNS_CHARSUOXU +char* CONNECT_get_userip2(int fd) +{ + return inet_ntoa(Connect[fd].sin.sin_addr ); +} +int CONNECT_get_userport(int fd) +{ + return Connect[ fd ].sin.sin_port; +} +#endif \ No newline at end of file diff --git a/npc/11npc_action.c b/npc/11npc_action.c new file mode 100644 index 0000000..26c85e5 --- /dev/null +++ b/npc/11npc_action.c @@ -0,0 +1,137 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_action.h" + +/* + * ʧ ɱNPC + * ǩԻ߯Ի·ֻ + * ʣ׷ Ȼ¼ʧ巴 ɱئУ + * + * ¦ѡ + * msgcol: ⼰ƣ۷ɻ + * normal: ɧȻ֧ ئʧ帲ƻ߯ + * attack: ʧ帲߯ + * damage: ĸëʧ帲߯ + * down: ľʧ帲߯ + * sit: ʧ帲ƻ߯ + * hand: ëʧ帲ƻ߯ + * pleasure: ʧ帲ƻ߯ + * angry: ʧ帲ƻ߯ + * sad: Ƹʧ帲ƻ߯ + * guard: ʧ帲ƻ߯ + */ + + +#define NPC_ACTION_MSGCOLOR_DEFAULT CHAR_COLORYELLOW + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; + +/********************************* +* +*********************************/ +BOOL NPC_ActionInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int tmp; + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "msgcol"); + if( tmp == -1 ) tmp = NPC_ACTION_MSGCOLOR_DEFAULT; + CHAR_setWorkInt( meindex, CHAR_WORK_MSGCOLOR, tmp); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEACTION ); + + + return TRUE; +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_ActionTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* */ + if( !NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 1 )) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, + "normal", + buf, sizeof( buf)) + != NULL ) + { + CHAR_talkToCli( talkerindex, meindex ,buf , + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR )); + } + +} +/********************************* +* watch +*********************************/ +void NPC_ActionWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ) +{ + int meindex; + int index; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + int i; + struct { + CHAR_ACTION act; + char *string; + }searchtbl[] = { + { CHAR_ACTATTACK, "attack"}, + { CHAR_ACTDAMAGE, "damage"}, + { CHAR_ACTDOWN, "down"}, + { CHAR_ACTSIT, "sit"}, + { CHAR_ACTHAND, "hand"}, + { CHAR_ACTPLEASURE, "pleasure"}, + { CHAR_ACTANGRY, "angry"}, + { CHAR_ACTSAD, "sad"}, + { CHAR_ACTGUARD, "guard"}, + { CHAR_ACTNOD, "nod"}, + { CHAR_ACTTHROW, "throw"}, + }; + + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; + index = OBJECT_getIndex( objindex); + /* 弰 ɱ */ + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + + meindex = OBJECT_getIndex( meobjindex); + + /* Ȼƥئ ɱئ */ + if( NPC_Util_isFaceToFace( meindex, index, 1 ) != TRUE ) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + for( i = 0; i < arraysizeof( searchtbl); i ++ ) { + if( searchtbl[i].act == act) { + if( NPC_Util_GetStrFromStrWithDelim( argstr, + searchtbl[i].string, + buf, sizeof( buf)) + != NULL ) + { + CHAR_talkToCli( index, meindex ,buf , + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR )); + break; + } + } + } +} diff --git a/npc/makefile b/npc/makefile new file mode 100644 index 0000000..369a1ad --- /dev/null +++ b/npc/makefile @@ -0,0 +1,3765 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libnpc.a + +SRC=readnpc.c npcgen.c npctemplate.c npccreate.c npcutil.c \ +npc_warp.c npc_townpeople.c \ +npc_msg.c npc_healer.c npc_oldman.c \ +npc_storyteller.c npc_dengon.c npc_doorman.c \ +npc_npcenemy.c npc_itemchange.c npc_itemup.c\ +npc_action.c npc_windowman.c npc_savepoint.c \ +npc_windowhealer.c npc_itemshop.c npc_sysinfo.c \ +npc_duelranking.c npc_petskillshop.c npc_petshop.c \ +npc_signboard.c npc_warpman.c npc_exchangeman.c \ +npc_timeman.c npc_bodylan.c npc_mic.c \ +npc_luckyman.c npc_bus.c npc_charm.c npc_quiz.c \ +npc_poolitemshop.c npc_checkman.c npc_janken.c \ +npc_transmigration.c npc_makepair.c \ +npc_familyman.c npc_fmdengon.c npc_fmwarpman.c \ +npc_fmhealer.c npc_bankman.c npc_fmpkman.c\ +npc_airplane.c npc_scheduleman.c npc_fmpkcallman.c\ +npc_manorsman.c npc_riderman.c npc_fmletter.c npc_petmaker.c \ +npc_gamblemaster.c npc_gambleroulette.c npc_petfusion.c\ +npc_stoneserviceman.c npc_newnpcman.c npc_gamblebank.c \ +npc_petracemaster.c npc_petracepet.c npc_bigsmallmaster.c \ +npc_bigsmallpet.c npc_auctioneer.c npc_freepetskillshop.c \ +npc_eventaction.c npc_vipshop.c npc_autopk.c npc_fmlookwar.c npc_fmlookwar1.c\ +npc_mtradenpcman.c npc_blackmarket.c npc_transerman.c npc_pauctionman.c npc_alldoman.c\ +npc_sellsthman.c npc_newvipshop.c npc_vigorshop.c npc_stushop.c npc_rmbshop.c npc_itemvippointshop.c\ +npc_welfare.c npc_verywelfare.c npc_welfare2.c npc_petskilldelshop.c npc_fmrank.c\ + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +readnpc.o: readnpc.c /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/common.h ../include/npctemplate.h ../include/npccreate.h \ + ../include/battle.h ../include/configfile.h +npcgen.o: npcgen.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npccreate.h ../include/util.h ../include/common.h \ + ../include/npctemplate.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/char_data.h ../include/buf.h \ + ../include/object.h ../include/readmap.h ../include/item.h \ + ../include/handletime.h ../include/map_deal.h +npctemplate.o: npctemplate.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npctemplate.h ../include/util.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/buf.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/char_data.h ../include/util.h \ + ../include/handletime.h ../include/item.h ../include/anim_tbl.h \ + ../include/configfile.h +npccreate.o: npccreate.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npccreate.h ../include/util.h ../include/common.h \ + ../include/npctemplate.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/util.h ../include/buf.h ../include/readmap.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/handletime.h ../include/configfile.h +npcutil.o: npcutil.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/configfile.h ../include/object.h \ + ../include/item.h ../include/map_deal.h ../include/npcutil.h \ + ../include/npc_door.h ../include/readmap.h ../include/npccreate.h \ + ../include/enemy.h ../include/family.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +npc_warp.o: npc_warp.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/map_deal.h \ + ../include/readmap.h ../include/npccreate.h ../include/npcutil.h \ + ../include/handletime.h ../include/npc_eventaction.h +npc_townpeople.o: npc_townpeople.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/handletime.h ../include/anim_tbl.h ../include/npc_door.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npcutil.h +npc_msg.o: npc_msg.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/npcutil.h +npc_healer.o: npc_healer.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h +npc_oldman.o: npc_oldman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h +npc_storyteller.o: npc_storyteller.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h +npc_dengon.o: npc_dengon.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h +npc_doorman.o: npc_doorman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/item.h ../include/util.h \ + ../include/handletime.h ../include/npc_doorman.h ../include/npc_door.h \ + ../include/npcutil.h ../include/configfile.h +npc_npcenemy.o: npc_npcenemy.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_npcenemy.h ../include/battle.h ../include/enemy.h \ + ../include/readmap.h ../include/encount.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/configfile.h \ + ../include/anim_tbl.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_itemchange.o: npc_itemchange.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/battle.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h \ + ../include/npc_itemchange.h +npc_itemup.o: npc_itemup.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/battle.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h \ + ../include/npc_itemup.h +npc_action.o: npc_action.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_action.h +npc_windowman.o: npc_windowman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npc_windowman.h +npc_savepoint.o: npc_savepoint.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h +npc_windowhealer.o: npc_windowhealer.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_windowhealer.h +npc_itemshop.o: npc_itemshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_sysinfo.o: npc_sysinfo.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_event.h ../include/object.h ../include/handletime.h \ + ../include/magic.h ../include/npcutil.h ../include/char_data.h \ + ../include/chatmagic.h ../include/net.h ../include/configfile.h \ + ../include/npcgen.h +npc_duelranking.o: npc_duelranking.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/net.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_duelranking.h ../include/handletime.h +npc_petskillshop.o: npc_petskillshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/mylua/function.h +npc_petshop.o: npc_petshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/log.h +npc_signboard.o: npc_signboard.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/readmap.h ../include/family.h +npc_warpman.o: npc_warpman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_warpman.h ../include/map_deal.h ../include/readmap.h \ + ../include/battle.h ../include/npc_exchangeman.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h +npc_exchangeman.o: npc_exchangeman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/net.h ../include/char_base.h \ + ../include/npcutil.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npc_exchangeman.h \ + ../include/npc_eventaction.h ../include/log.h ../include/battle.h \ + ../include/handletime.h ../include/enemy.h ../include/npc_warp.h +npc_timeman.o: npc_timeman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h ../include/handletime.h +npc_bodylan.o: npc_bodylan.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_windowhealer.h +npc_mic.o: npc_mic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/npcutil.h \ + ../include/npc_mic.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/battle.h +npc_luckyman.o: npc_luckyman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_luckyman.h +npc_bus.o: npc_bus.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_bus.h ../include/handletime.h +npc_charm.o: npc_charm.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_charm.h +npc_quiz.o: npc_quiz.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npc_quiz.h ../include/npcutil.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/buf.h ../include/function.h ../include/readmap.h \ + ../include/object.h ../include/log.h +npc_poolitemshop.o: npc_poolitemshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npcutil.h ../include/npc_poolitemshop.h ../include/log.h \ + ../include/handletime.h +npc_checkman.o: npc_checkman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h +npc_janken.o: npc_janken.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npc_janken.h ../include/npcutil.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/buf.h ../include/function.h ../include/readmap.h \ + ../include/object.h ../include/log.h +npc_transmigration.o: npc_transmigration.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/npc_transmigration.h \ + ../include/configfile.h ../include/npc_pettransman.h +npc_makepair.o: npc_makepair.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_transerman.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_makepair.h ../include/npc_eventaction.h +npc_familyman.o: npc_familyman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_familyman.h \ + ../include/family.h +npc_fmdengon.o: npc_fmdengon.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h \ + ../include/handletime.h ../include/npc_fmdengon.h ../include/family.h \ + ../include/npc_scheduleman.h +npc_fmwarpman.o: npc_fmwarpman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_fmwarpman.h ../include/npc_scheduleman.h \ + ../include/readmap.h ../include/log.h ../include/battle.h \ + ../include/handletime.h ../include/family.h ../include/configfile.h +npc_fmhealer.o: npc_fmhealer.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h +npc_bankman.o: npc_bankman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_bankman.h \ + ../include/family.h +npc_fmpkman.o: npc_fmpkman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_fmpkman.h ../include/npc_scheduleman.h \ + ../include/npc_fmwarpman.h ../include/family.h ../include/readmap.h \ + ../include/battle.h ../include/log.h +npc_airplane.o: npc_airplane.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_airplane.h ../include/handletime.h +npc_scheduleman.o: npc_scheduleman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h \ + ../include/npc_scheduleman.h ../include/family.h +npc_fmpkcallman.o: npc_fmpkcallman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_fmpkcallman.h ../include/family.h ../include/readmap.h \ + ../include/battle.h ../include/log.h ../include/npc_scheduleman.h \ + ../include/handletime.h +npc_manorsman.o: npc_manorsman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h \ + ../include/npc_scheduleman.h ../include/family.h \ + ../include/npc_manorsman.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/net.h ../include/configfile.h \ + ../include/log.h +npc_riderman.o: npc_riderman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_riderman.h \ + ../include/family.h ../include/log.h +npc_fmletter.o: npc_fmletter.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_fmletter.h \ + ../include/family.h ../include/log.h +npc_petmaker.o: npc_petmaker.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h \ + ../include/enemy.h ../include/chatmagic.h ../include/log.h +npc_gamblemaster.o: npc_gamblemaster.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/readmap.h ../include/log.h \ + ../include/npc_eventaction.h ../include/npc_gamblemaster.h +npc_gambleroulette.o: npc_gambleroulette.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h \ + ../include/npc_gambleroulette.h +npc_petfusion.o: npc_petfusion.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/char_data.h \ + ../include/npcutil.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_petfusion.h \ + ../include/pet.h ../include/chatmagic.h +npc_stoneserviceman.o: npc_stoneserviceman.c +npc_newnpcman.o: npc_newnpcman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_newnpcman.h \ + ../include/pet.h +npc_gamblebank.o: npc_gamblebank.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/handletime.h ../include/configfile.h \ + ../include/npc_gamblebank.h +npc_petracemaster.o: npc_petracemaster.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/npc_petracemaster.h +npc_petracepet.o: npc_petracepet.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/npc_petracepet.h +npc_bigsmallmaster.o: npc_bigsmallmaster.c +npc_bigsmallpet.o: npc_bigsmallpet.c +npc_auctioneer.o: npc_auctioneer.c +npc_freepetskillshop.o: npc_freepetskillshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/configfile.h ../include/util.h ../include/npc_eventaction.h \ + ../include/npc_freepetskillshop.h ../include/mylua/function.h +npc_eventaction.o: npc_eventaction.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/map_deal.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/family.h \ + ../include/profession_skill.h ../include/chatmagic.h +npc_vipshop.o: npc_vipshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_vipshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_autopk.o: npc_autopk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_autopk.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_healer.h \ + ../include/configfile.h +npc_fmlookwar.o: npc_fmlookwar.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmlookwar.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_fmlookwar1.o: npc_fmlookwar1.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmlookwar1.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_mtradenpcman.o: npc_mtradenpcman.c +npc_blackmarket.o: npc_blackmarket.c +npc_transerman.o: npc_transerman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_transerman.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_pauctionman.o: npc_pauctionman.c +npc_alldoman.o: npc_alldoman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h \ + ../include/enemy.h ../include/chatmagic.h ../include/log.h \ + ../include/npc_itemchange.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_eventaction.h \ + ../include/npc_charm.h ../include/npc_alldoman.h +npc_sellsthman.o: npc_sellsthman.c +npc_newvipshop.o: npc_newvipshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_newvipshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_vigorshop.o: npc_vigorshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_stushop.o: npc_stushop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_stushop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_rmbshop.o: npc_rmbshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_rmbshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_itemvippointshop.o: npc_itemvippointshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_welfare.o: npc_welfare.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/profession_skill.h ../include/chatmagic.h \ + ../include/npc_welfare.h ../include/npc_exchangeman.h +npc_verywelfare.o: npc_verywelfare.c +npc_welfare2.o: npc_welfare2.c +npc_petskilldelshop.o: npc_petskilldelshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/mylua/function.h +npc_fmrank.o: npc_fmrank.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmrank.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_healer.h \ + ../include/configfile.h ../include/sasql.h diff --git a/npc/makefile.bak b/npc/makefile.bak new file mode 100644 index 0000000..369a1ad --- /dev/null +++ b/npc/makefile.bak @@ -0,0 +1,3765 @@ +export CC=gcc +export RM=rm -f +export AR=ar cr +export MV=mv +export RANLIB=ranlib +export SED=sed + + +export SHELL=/bin/sh + +INCFLAGS=-I. -I../include + +CFLAGS=-O3 -w $(INCFLAGS) +#Pentium 4 (Intel) +#CFLAGS=-march=pentium4 -O3 -pipe -fomit-frame-pointer $(INCFLAGS) +#Athlon XP (AMD) +#CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" $(INCFLAGS) +#Athlon64£º +#CFLAGS="-O2 -march=athlon64 -ftracer -fprefetch-loop-arrays -pipe" $(INCFLAGS) + +PROG=libnpc.a + +SRC=readnpc.c npcgen.c npctemplate.c npccreate.c npcutil.c \ +npc_warp.c npc_townpeople.c \ +npc_msg.c npc_healer.c npc_oldman.c \ +npc_storyteller.c npc_dengon.c npc_doorman.c \ +npc_npcenemy.c npc_itemchange.c npc_itemup.c\ +npc_action.c npc_windowman.c npc_savepoint.c \ +npc_windowhealer.c npc_itemshop.c npc_sysinfo.c \ +npc_duelranking.c npc_petskillshop.c npc_petshop.c \ +npc_signboard.c npc_warpman.c npc_exchangeman.c \ +npc_timeman.c npc_bodylan.c npc_mic.c \ +npc_luckyman.c npc_bus.c npc_charm.c npc_quiz.c \ +npc_poolitemshop.c npc_checkman.c npc_janken.c \ +npc_transmigration.c npc_makepair.c \ +npc_familyman.c npc_fmdengon.c npc_fmwarpman.c \ +npc_fmhealer.c npc_bankman.c npc_fmpkman.c\ +npc_airplane.c npc_scheduleman.c npc_fmpkcallman.c\ +npc_manorsman.c npc_riderman.c npc_fmletter.c npc_petmaker.c \ +npc_gamblemaster.c npc_gambleroulette.c npc_petfusion.c\ +npc_stoneserviceman.c npc_newnpcman.c npc_gamblebank.c \ +npc_petracemaster.c npc_petracepet.c npc_bigsmallmaster.c \ +npc_bigsmallpet.c npc_auctioneer.c npc_freepetskillshop.c \ +npc_eventaction.c npc_vipshop.c npc_autopk.c npc_fmlookwar.c npc_fmlookwar1.c\ +npc_mtradenpcman.c npc_blackmarket.c npc_transerman.c npc_pauctionman.c npc_alldoman.c\ +npc_sellsthman.c npc_newvipshop.c npc_vigorshop.c npc_stushop.c npc_rmbshop.c npc_itemvippointshop.c\ +npc_welfare.c npc_verywelfare.c npc_welfare2.c npc_petskilldelshop.c npc_fmrank.c\ + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) + +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(CC) $(INCFLAGS) -M $(SRC) >> makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) makefile makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' makefile.bak>makefile + $(RM) makefile.bak + +# DO NOT DELETE THIS LINE +readnpc.o: readnpc.c /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/string.h ../include/version.h ../include/sasql.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + ../include/correct_bug.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/common.h ../include/npctemplate.h ../include/npccreate.h \ + ../include/battle.h ../include/configfile.h +npcgen.o: npcgen.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npccreate.h ../include/util.h ../include/common.h \ + ../include/npctemplate.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/char_data.h ../include/buf.h \ + ../include/object.h ../include/readmap.h ../include/item.h \ + ../include/handletime.h ../include/map_deal.h +npctemplate.o: npctemplate.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npctemplate.h ../include/util.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/buf.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/char_data.h ../include/util.h \ + ../include/handletime.h ../include/item.h ../include/anim_tbl.h \ + ../include/configfile.h +npccreate.o: npccreate.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/npccreate.h ../include/util.h ../include/common.h \ + ../include/npctemplate.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/util.h ../include/buf.h ../include/readmap.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_data.h ../include/handletime.h ../include/configfile.h +npcutil.o: npcutil.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/configfile.h ../include/object.h \ + ../include/item.h ../include/map_deal.h ../include/npcutil.h \ + ../include/npc_door.h ../include/readmap.h ../include/npccreate.h \ + ../include/enemy.h ../include/family.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h +npc_warp.o: npc_warp.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/map_deal.h \ + ../include/readmap.h ../include/npccreate.h ../include/npcutil.h \ + ../include/handletime.h ../include/npc_eventaction.h +npc_townpeople.o: npc_townpeople.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/handletime.h ../include/anim_tbl.h ../include/npc_door.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npcutil.h +npc_msg.o: npc_msg.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_base.h ../include/npcutil.h +npc_healer.o: npc_healer.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h +npc_oldman.o: npc_oldman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h +npc_storyteller.o: npc_storyteller.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h +npc_dengon.o: npc_dengon.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h +npc_doorman.o: npc_doorman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/item.h ../include/util.h \ + ../include/handletime.h ../include/npc_doorman.h ../include/npc_door.h \ + ../include/npcutil.h ../include/configfile.h +npc_npcenemy.o: npc_npcenemy.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_npcenemy.h ../include/battle.h ../include/enemy.h \ + ../include/readmap.h ../include/encount.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/configfile.h \ + ../include/anim_tbl.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_itemchange.o: npc_itemchange.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/battle.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h \ + ../include/npc_itemchange.h +npc_itemup.o: npc_itemup.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/readmap.h ../include/battle.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h \ + ../include/npc_itemup.h +npc_action.o: npc_action.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_action.h +npc_windowman.o: npc_windowman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npc_windowman.h +npc_savepoint.o: npc_savepoint.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h +npc_windowhealer.o: npc_windowhealer.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_windowhealer.h +npc_itemshop.o: npc_itemshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_sysinfo.o: npc_sysinfo.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/char_event.h ../include/object.h ../include/handletime.h \ + ../include/magic.h ../include/npcutil.h ../include/char_data.h \ + ../include/chatmagic.h ../include/net.h ../include/configfile.h \ + ../include/npcgen.h +npc_duelranking.o: npc_duelranking.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/net.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_duelranking.h ../include/handletime.h +npc_petskillshop.o: npc_petskillshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/mylua/function.h +npc_petshop.o: npc_petshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/log.h +npc_signboard.o: npc_signboard.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/readmap.h ../include/family.h +npc_warpman.o: npc_warpman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_warpman.h ../include/map_deal.h ../include/readmap.h \ + ../include/battle.h ../include/npc_exchangeman.h ../include/log.h \ + ../include/enemy.h ../include/handletime.h ../include/npc_eventaction.h +npc_exchangeman.o: npc_exchangeman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/net.h ../include/char_base.h \ + ../include/npcutil.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npc_exchangeman.h \ + ../include/npc_eventaction.h ../include/log.h ../include/battle.h \ + ../include/handletime.h ../include/enemy.h ../include/npc_warp.h +npc_timeman.o: npc_timeman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/object.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/npc_oldman.h ../include/title.h \ + ../include/char_data.h ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/log.h ../include/handletime.h +npc_bodylan.o: npc_bodylan.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_windowhealer.h +npc_mic.o: npc_mic.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/npcutil.h \ + ../include/npc_mic.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/battle.h +npc_luckyman.o: npc_luckyman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_luckyman.h +npc_bus.o: npc_bus.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_bus.h ../include/handletime.h +npc_charm.o: npc_charm.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_charm.h +npc_quiz.o: npc_quiz.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npc_quiz.h ../include/npcutil.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/buf.h ../include/function.h ../include/readmap.h \ + ../include/object.h ../include/log.h +npc_poolitemshop.o: npc_poolitemshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npcutil.h ../include/npc_poolitemshop.h ../include/log.h \ + ../include/handletime.h +npc_checkman.o: npc_checkman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h +npc_janken.o: npc_janken.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/common.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/npc_janken.h ../include/npcutil.h ../include/char.h \ + ../include/char_base.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/buf.h ../include/function.h ../include/readmap.h \ + ../include/object.h ../include/log.h +npc_transmigration.o: npc_transmigration.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/npc_transmigration.h \ + ../include/configfile.h ../include/npc_pettransman.h +npc_makepair.o: npc_makepair.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_transerman.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_makepair.h ../include/npc_eventaction.h +npc_familyman.o: npc_familyman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_familyman.h \ + ../include/family.h +npc_fmdengon.o: npc_fmdengon.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npcutil.h \ + ../include/handletime.h ../include/npc_fmdengon.h ../include/family.h \ + ../include/npc_scheduleman.h +npc_fmwarpman.o: npc_fmwarpman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/npc_fmwarpman.h ../include/npc_scheduleman.h \ + ../include/readmap.h ../include/log.h ../include/battle.h \ + ../include/handletime.h ../include/family.h ../include/configfile.h +npc_fmhealer.o: npc_fmhealer.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h +npc_bankman.o: npc_bankman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_bankman.h \ + ../include/family.h +npc_fmpkman.o: npc_fmpkman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_fmpkman.h ../include/npc_scheduleman.h \ + ../include/npc_fmwarpman.h ../include/family.h ../include/readmap.h \ + ../include/battle.h ../include/log.h +npc_airplane.o: npc_airplane.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_airplane.h ../include/handletime.h +npc_scheduleman.o: npc_scheduleman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h \ + ../include/npc_scheduleman.h ../include/family.h +npc_fmpkcallman.o: npc_fmpkcallman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/npc_fmpkcallman.h ../include/family.h ../include/readmap.h \ + ../include/battle.h ../include/log.h ../include/npc_scheduleman.h \ + ../include/handletime.h +npc_manorsman.o: npc_manorsman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/npcutil.h ../include/handletime.h \ + ../include/npc_scheduleman.h ../include/family.h \ + ../include/npc_manorsman.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/net.h ../include/configfile.h \ + ../include/log.h +npc_riderman.o: npc_riderman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_riderman.h \ + ../include/family.h ../include/log.h +npc_fmletter.o: npc_fmletter.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/configfile.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_fmletter.h \ + ../include/family.h ../include/log.h +npc_petmaker.o: npc_petmaker.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h \ + ../include/enemy.h ../include/chatmagic.h ../include/log.h +npc_gamblemaster.o: npc_gamblemaster.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/readmap.h ../include/log.h \ + ../include/npc_eventaction.h ../include/npc_gamblemaster.h +npc_gambleroulette.o: npc_gambleroulette.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/readmap.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/handletime.h \ + ../include/npc_gambleroulette.h +npc_petfusion.o: npc_petfusion.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/char_data.h \ + ../include/npcutil.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_petfusion.h \ + ../include/pet.h ../include/chatmagic.h +npc_stoneserviceman.o: npc_stoneserviceman.c +npc_newnpcman.o: npc_newnpcman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_newnpcman.h \ + ../include/pet.h +npc_gamblebank.o: npc_gamblebank.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h ../include/char.h ../include/common.h \ + ../include/char_base.h ../include/version.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/enemy.h ../include/log.h ../include/battle.h \ + ../include/readmap.h ../include/handletime.h ../include/configfile.h \ + ../include/npc_gamblebank.h +npc_petracemaster.o: npc_petracemaster.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/npc_petracemaster.h +npc_petracepet.o: npc_petracepet.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/handletime.h ../include/npc_petracepet.h +npc_bigsmallmaster.o: npc_bigsmallmaster.c +npc_bigsmallpet.o: npc_bigsmallpet.c +npc_auctioneer.o: npc_auctioneer.c +npc_freepetskillshop.o: npc_freepetskillshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/configfile.h ../include/util.h ../include/npc_eventaction.h \ + ../include/npc_freepetskillshop.h ../include/mylua/function.h +npc_eventaction.o: npc_eventaction.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/saacproto_cli.h ../include/saacproto_util.h \ + ../include/map_deal.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/family.h \ + ../include/profession_skill.h ../include/chatmagic.h +npc_vipshop.o: npc_vipshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_vipshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_autopk.o: npc_autopk.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_autopk.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_healer.h \ + ../include/configfile.h +npc_fmlookwar.o: npc_fmlookwar.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmlookwar.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_fmlookwar1.o: npc_fmlookwar1.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmlookwar1.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_mtradenpcman.o: npc_mtradenpcman.c +npc_blackmarket.o: npc_blackmarket.c +npc_transerman.o: npc_transerman.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_transerman.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_pauctionman.o: npc_pauctionman.c +npc_alldoman.o: npc_alldoman.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h /usr/include/ctype.h \ + ../include/object.h ../include/common.h ../include/char_base.h \ + ../include/version.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/util.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h \ + ../include/enemy.h ../include/chatmagic.h ../include/log.h \ + ../include/npc_itemchange.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/npc_eventaction.h \ + ../include/npc_charm.h ../include/npc_alldoman.h +npc_sellsthman.o: npc_sellsthman.c +npc_newvipshop.o: npc_newvipshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_newvipshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_vigorshop.o: npc_vigorshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_stushop.o: npc_stushop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_stushop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_rmbshop.o: npc_rmbshop.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_rmbshop.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h +npc_itemvippointshop.o: npc_itemvippointshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/npc_eventaction.h \ + ../include/readmap.h ../include/log.h ../include/family.h +npc_welfare.o: npc_welfare.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/profession_skill.h ../include/chatmagic.h \ + ../include/npc_welfare.h ../include/npc_exchangeman.h +npc_verywelfare.o: npc_verywelfare.c +npc_welfare2.o: npc_welfare2.c +npc_petskilldelshop.o: npc_petskilldelshop.c ../include/version.h \ + ../include/sasql.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/lssproto_serv.h ../include/lssproto_util.h \ + ../include/pet_skill.h ../include/readmap.h ../include/battle.h \ + ../include/mylua/function.h +npc_fmrank.o: npc_fmrank.c ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/char.h \ + ../include/common.h ../include/char_base.h ../include/version.h \ + ../include/skill.h ../include/util.h ../include/title.h \ + ../include/addressbook.h ../include/net.h /usr/include/signal.h \ + /usr/include/bits/signum.h /usr/include/bits/siginfo.h \ + /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \ + /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h \ + /usr/include/bits/sigthread.h /usr/include/pthread.h \ + /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/luaconf.h ../include/lauxlib.h ../include/lualib.h \ + ../include/char_data.h ../include/item.h ../include/char.h \ + ../include/object.h ../include/char_base.h ../include/npcutil.h \ + ../include/npc_fmrank.h ../include/lssproto_serv.h \ + ../include/lssproto_util.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/readmap.h ../include/battle.h \ + ../include/log.h ../include/enemy.h ../include/handletime.h \ + ../include/npc_eventaction.h ../include/npc_healer.h \ + ../include/configfile.h ../include/sasql.h diff --git a/npc/npc_action.c b/npc/npc_action.c new file mode 100644 index 0000000..26c85e5 --- /dev/null +++ b/npc/npc_action.c @@ -0,0 +1,137 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_action.h" + +/* + * ʧ ɱNPC + * ǩԻ߯Ի·ֻ + * ʣ׷ Ȼ¼ʧ巴 ɱئУ + * + * ¦ѡ + * msgcol: ⼰ƣ۷ɻ + * normal: ɧȻ֧ ئʧ帲ƻ߯ + * attack: ʧ帲߯ + * damage: ĸëʧ帲߯ + * down: ľʧ帲߯ + * sit: ʧ帲ƻ߯ + * hand: ëʧ帲ƻ߯ + * pleasure: ʧ帲ƻ߯ + * angry: ʧ帲ƻ߯ + * sad: Ƹʧ帲ƻ߯ + * guard: ʧ帲ƻ߯ + */ + + +#define NPC_ACTION_MSGCOLOR_DEFAULT CHAR_COLORYELLOW + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; + +/********************************* +* +*********************************/ +BOOL NPC_ActionInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int tmp; + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "msgcol"); + if( tmp == -1 ) tmp = NPC_ACTION_MSGCOLOR_DEFAULT; + CHAR_setWorkInt( meindex, CHAR_WORK_MSGCOLOR, tmp); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEACTION ); + + + return TRUE; +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_ActionTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* */ + if( !NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 1 )) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, + "normal", + buf, sizeof( buf)) + != NULL ) + { + CHAR_talkToCli( talkerindex, meindex ,buf , + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR )); + } + +} +/********************************* +* watch +*********************************/ +void NPC_ActionWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ) +{ + int meindex; + int index; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + int i; + struct { + CHAR_ACTION act; + char *string; + }searchtbl[] = { + { CHAR_ACTATTACK, "attack"}, + { CHAR_ACTDAMAGE, "damage"}, + { CHAR_ACTDOWN, "down"}, + { CHAR_ACTSIT, "sit"}, + { CHAR_ACTHAND, "hand"}, + { CHAR_ACTPLEASURE, "pleasure"}, + { CHAR_ACTANGRY, "angry"}, + { CHAR_ACTSAD, "sad"}, + { CHAR_ACTGUARD, "guard"}, + { CHAR_ACTNOD, "nod"}, + { CHAR_ACTTHROW, "throw"}, + }; + + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; + index = OBJECT_getIndex( objindex); + /* 弰 ɱ */ + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + + meindex = OBJECT_getIndex( meobjindex); + + /* Ȼƥئ ɱئ */ + if( NPC_Util_isFaceToFace( meindex, index, 1 ) != TRUE ) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + for( i = 0; i < arraysizeof( searchtbl); i ++ ) { + if( searchtbl[i].act == act) { + if( NPC_Util_GetStrFromStrWithDelim( argstr, + searchtbl[i].string, + buf, sizeof( buf)) + != NULL ) + { + CHAR_talkToCli( index, meindex ,buf , + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR )); + break; + } + } + } +} diff --git a/npc/npc_airplane.c b/npc/npc_airplane.c new file mode 100644 index 0000000..79a4462 --- /dev/null +++ b/npc/npc_airplane.c @@ -0,0 +1,760 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_airplane.h" +#include "handletime.h" + +/* + * (Made from Bus) + */ + +enum { + NPC_WORK_ROUTETOX = CHAR_NPCWORKINT1, /* ߣ */ + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, /* ߣ */ + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, /* */ + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, /* 微Ի ߡ ࡰԻ */ + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, + NPC_WORK_ONEWAYFLG = CHAR_NPCWORKINT11, + NPC_WORK_RUNWAVE = CHAR_NPCWORKINT13, +}; + +/* ⼰enum */ +enum { + NPC_AIR_MSG_GETTINGON, + NPC_AIR_MSG_NOTPARTY, + NPC_AIR_MSG_OVERPARTY, + NPC_AIR_MSG_DENIEDITEM, + NPC_AIR_MSG_ALLOWITEM, + NPC_AIR_MSG_LEVEL, + NPC_AIR_MSG_GOLD, + NPC_AIR_MSG_EVENT, + NPC_AIR_MSG_START, + NPC_AIR_MSG_END, +}; +typedef struct { + char option[32]; + char defaultmsg[128]; +}NPC_AIR_MSG; +NPC_AIR_MSG airmsg[] = { + { "msg_gettingon", "PAON޷;ࡣ"}, + { "msg_notparty", "PAPAON޷ŶӼࡣ"}, + { "msg_overparty", "PAON"}, + { "msg_denieditem", "PAPAONҿɲҪߣ"}, + { "msg_allowitem", "~(ҪǸ߰!)"}, + { "msg_level", "PAPAONĵȼࡣ"}, + { "msg_stone", "PAPAONǮࡣ"}, + { "msg_event", "PAON޷ࡣ"}, + { "msg_start", "~()"}, + { "msg_end", "~()"} +}; + +static int NPC_AirSetPoint( int meindex, char *argstr); +static void NPC_AirSetDestPoint( int meindex, char *argstr); +static BOOL NPC_AirCheckDeniedItem( int meindex, int charaindex, char *argstr); +static BOOL NPC_AirCheckLevel( int meindex, int charaindex, char *argstr); +static int NPC_AirCheckStone( int meindex, int charaindex, char *argstr); +static void NPC_AirSendMsg( int meindex, int talkerindex, int tablenum); +static int NPC_AirGetRoutePointNum( int meindex, char *argstr ); +static void NPC_Air_walk( int meindex); + +#define NPC_AIR_LOOPTIME 20 +#define NPC_AIR_WAITTIME_DEFAULT 180 +#define NPC_AIR_WAITINGMODE_WAITTIME 5000 + +/********************************* +* +*********************************/ +BOOL NPC_AirInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + int i; + char buf[256],buf1[256]; + int routenum; + int waittime; + int seflg; + int onewayflg; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + /* ئľئ¦Ѽ */ + routenum = NPC_Util_GetNumFromStrWithDelim( argstr, "routenum"); + if( routenum == -1 ) { + print( "npcair:nothing routenum \n"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, routenum); + + for( i = 1; i <= routenum; i ++ ) { + char routetostring[64]; + snprintf( routetostring, sizeof( routetostring), "routeto%d", i); + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcair:nothing route to \n"); + return FALSE; + } + } + //ANDY_ADD NPC_WORK_RUNWAVE + if( NPC_Util_GetStrFromStrWithDelim( argstr, "WAVE",buf1, sizeof(buf1)) == NULL ) { + CHAR_setWorkInt( meindex, NPC_WORK_RUNWAVE, 77); + }else { + CHAR_setWorkInt( meindex, NPC_WORK_RUNWAVE, atoi( buf1) ); + } + + waittime = NPC_Util_GetNumFromStrWithDelim( argstr, "waittime"); + if( waittime == -1 ) waittime = NPC_AIR_WAITTIME_DEFAULT; + CHAR_setWorkInt( meindex, NPC_WORK_WAITTIME, waittime); + + seflg = NPC_Util_GetNumFromStrWithDelim( argstr, "seflg"); + if( seflg == -1 ) seflg = TRUE; + CHAR_setWorkInt( meindex, NPC_WORK_SEFLG, seflg); + + onewayflg = NPC_Util_GetNumFromStrWithDelim( argstr, "oneway"); + if( onewayflg == -1 ) onewayflg = FALSE; // default + CHAR_setWorkInt( meindex, NPC_WORK_ONEWAYFLG, onewayflg); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEBUS ); + + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, 2); + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, 0); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, 0); + + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, + NPC_AIR_WAITINGMODE_WAITTIME); + + /* ػë */ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + + for( i = 0; i < CHAR_PARTYMAX; i ++) { + CHAR_setWorkInt( meindex, CHAR_WORKPARTYINDEX1 + i, -1); + } + + /* */ +{ + int rev; + int r = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEMAX); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, RAND( 1, r)); + //print( "route:%d\n",CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + /* Ƿ */ + rev = NPC_Util_GetNumFromStrWithDelim( argstr, "reverse"); + if( rev == 1 ) { + int num = NPC_AirGetRoutePointNum( meindex, argstr); + if( num <= 0 ) { + print( "npcairplane:֣\n"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, num-1); + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, 1); + } + /* ë */ + NPC_AirSetPoint( meindex, argstr); + /* ë */ + NPC_AirSetDestPoint( meindex, argstr); +} + + return TRUE; +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_AirTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + int i; + int partyflg = FALSE; + int npc_wave = CHAR_getWorkInt( meindex, NPC_WORK_RUNWAVE); + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* мɡ ū Ʃ */ + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX(index)){ + if( index == talkerindex) { + partyflg = TRUE; + } + } + } + if( !partyflg ) { + //NPC_AirCheckJoinParty( meindex, talkerindex, TRUE); + } + else { + if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) == 0 ) { + int i; + // #define NPC_AIR_DEBUGROUTINTG "routingtable:" + if( strstr( szMes, "" ) || + strstr( szMes, "" ) || + strstr( szMes, "Go" ) || + strstr( szMes, "go" )) + { + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_AIR_LOOPTIME); + + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + //andy_reEdit NPC_WORK_RUNWAVE + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + npc_wave, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_AirSendMsg( meindex, partyindex, NPC_AIR_MSG_START); + } + } + } + } + } +} +/************************************** + * + **************************************/ +void NPC_AirLoop( int meindex) +{ + int i; + int npc_wave = CHAR_getWorkInt( meindex, NPC_WORK_RUNWAVE); + switch( CHAR_getWorkInt( meindex, NPC_WORK_MODE )) { + case 0: + /* ƹݣë */ + /* ޻׼ƥ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + + CHAR_getWorkInt( meindex, NPC_WORK_WAITTIME) + < NowTime.tv_sec) + { + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + //ANDY_reEdit + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + npc_wave, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_AirSendMsg( meindex, partyindex, NPC_AIR_MSG_START); + } + } + + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_AIR_LOOPTIME); + } + return; + case 1: + /* */ + NPC_Air_walk( meindex); + case 2: + /* Ȼƹ */ + /* ޻׼ƥ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + + (CHAR_getWorkInt( meindex, NPC_WORK_WAITTIME) /3) + < NowTime.tv_sec) + { + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_AIR_LOOPTIME); + + } + return; + case 3: + /* ƻ֣ͷʧ мб + * Ƴƥëľ֧ + */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + 3 < NowTime.tv_sec){ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_AIR_WAITINGMODE_WAITTIME); + { + int r = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEMAX); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, RAND( 1, r)); + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, + CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP)^1); + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP) == 1) { + int num = NPC_AirGetRoutePointNum( meindex, argstr); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, num-1); + }else { + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT) +1); + } + NPC_AirSetPoint( meindex, argstr); + NPC_AirSetDestPoint( meindex, argstr); + CHAR_DischargeParty( meindex, 0); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + if ((CHAR_getWorkInt(meindex, NPC_WORK_ONEWAYFLG) == 1) && + (CHAR_getWorkInt(meindex, NPC_WORK_ROUNDTRIP) == 1) ){ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_AIR_LOOPTIME); + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 1); + } else + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + } + return; + default: + break; + } +} +/************************************** + * ʣ + **************************************/ +static void NPC_Air_walk( int meindex) +{ + POINT start, end; + int dir; + int ret; + int i; + int npc_wave = CHAR_getWorkInt( meindex, NPC_WORK_RUNWAVE ); + + /* */ + /* ݼ */ + start.x = CHAR_getInt( meindex, CHAR_X); + start.y = CHAR_getInt( meindex, CHAR_Y); + end.x = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOX); + end.y = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOY); + + /* ׼ƥݼ̼ */ + if( start.x == end.x && start.y == end.y ) { + int add = 1; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP ) == 1 ) { + add *= -1; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT) +add); + if( NPC_AirSetPoint( meindex, argstr) == FALSE ) { + /* */ + /* ƹ */ + CHAR_setWorkInt( meindex, NPC_WORK_MODE,3); + + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + //ANDY_reEdit + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + npc_wave, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_AirSendMsg( meindex, partyindex, NPC_AIR_MSG_END); +#ifdef CAX_RIDE_GENXIN + CHAR_DischargePartyNoMsg( partyindex);//ɢŶ + CHAR_setInt( partyindex, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( partyindex, CHAR_P_STRING_RIDEPET); +#endif + } + } + /* ػë */ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return; + } + else { + return; + } + } + /*-------------------------------------------------------*/ + /* ھ */ + + /* ëƻ */ + dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + + /* ɡ ūƥ */ + end.x = CHAR_getInt( meindex, CHAR_X); + end.y = CHAR_getInt( meindex, CHAR_Y); + + if( dir >= 0 && dir <= 7 ) { + /* */ + ret = CHAR_walk( meindex, dir, 0); + + if( ret == CHAR_WALKSUCCESSED ) { + /* лئëھ */ + int i; + int mefl=CHAR_getInt( meindex, CHAR_FLOOR); + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( meindex, i + CHAR_WORKPARTYINDEX1); + int fl = CHAR_getInt( toindex, CHAR_FLOOR); + int xx = CHAR_getInt( toindex, CHAR_X); + int yy = CHAR_getInt( toindex, CHAR_Y); + if( CHAR_CHECKINDEX(toindex) && + (mefl==fl) && (abs(xx-end.x)+abs(yy-end.y)<10) ) { + int parent_dir; + /* Ҽ ʼ󡼰 ëƻ */ + /* */ + start.x = xx; + start.y = yy; + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + /* ·ūë ¿б + * ݼҷ󡼰Ҽ ëܰ + */ + end = start; + if( parent_dir != -1 ) { + CHAR_walk( toindex, parent_dir, 0); + } + } + } + } + } +} +/************************************** + * ݼë + **************************************/ +static int NPC_AirSetPoint( int meindex, char *argstr) +{ + char buf[4096]; + char buf2[256]; + char buf3[256]; + int floor,warpx,warpy; + int ret; + char routetostring[64]; + + snprintf( routetostring, sizeof( routetostring), "routeto%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcair:nothing route \n"); + return FALSE; + } + + ret = getStringFromIndexWithDelim( buf, ";", + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT), + buf2, sizeof(buf2)); + if( ret == FALSE ) return FALSE; + + // Arminius: add floor + + ret = getStringFromIndexWithDelim( buf2, ",", 1, + buf3, sizeof(buf3)); + if( ret == FALSE) return FALSE; + floor = atoi(buf3); + + ret = getStringFromIndexWithDelim( buf2, ",", 2, + buf3, sizeof(buf3)); + if( ret == FALSE) return FALSE; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, atoi( buf3)); + warpx = atoi(buf3); + + ret = getStringFromIndexWithDelim( buf2, ",", 3, + buf3, sizeof(buf3)); + if( ret == FALSE) return FALSE; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, atoi( buf3)); + warpy = atoi(buf3); + + if (floor!=CHAR_getInt(meindex, CHAR_FLOOR)) { + int i; + CHAR_warpToSpecificPoint(meindex, floor, warpx, warpy); + + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( meindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(toindex) ) { + CHAR_warpToSpecificPoint(toindex, floor, warpx, warpy); + } + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, warpx); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, warpy); + } + + return TRUE; +} +/************************************** + * route įգ 󡻥ؤչľë + * į屾£ + **************************************/ +static void NPC_AirSetDestPoint( int meindex, char *argstr) +{ + char buf[256]; + char routename[256]; + + snprintf( routename, sizeof( routename), "routename%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routename, buf, sizeof( buf)) + != NULL ) + { + CHAR_setChar( meindex, CHAR_OWNTITLE, buf); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + } +} +/************************************** + * ϶ýľʧ ةë Ȼ¾ + * Ȼշֻ + **************************************/ +static BOOL NPC_AirCheckDeniedItem( int meindex, int charaindex, char *argstr) +{ + char buf[1024]; + BOOL found = TRUE; + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "denieditem", buf, sizeof( buf)) + != NULL ) + { + int i; + int ret; + for( i = 1; ; i ++) { + int itemid; + char buf2[64]; + int j; + ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2)); + if( ret == FALSE ) break; + itemid = atoi( buf2); + for( j = 0; j < CHAR_MAXITEMHAVE; j ++) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid) { + found = FALSE; + break; + } + } + } + } + } + return found; +} +/************************************** + * ϶ýľʧ ةë Ȼ¾ + * Ȼئֻ + **************************************/ +BOOL NPC_AirCheckAllowItem( int meindex, int charaindex, BOOL pickupmode) +{ + char buf[1024]; + BOOL found = TRUE; + BOOL pickup = FALSE; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pickupitem", buf, sizeof( buf)) + != NULL ) + { + pickup = TRUE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "allowitem", buf, sizeof( buf)) + != NULL ) + { + int i; + int ret; + for( i = 1; ; i ++) { + int itemid; + char buf2[64]; + int j; + BOOL getflg; + ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2)); + if( ret == FALSE ) break; + itemid = atoi( buf2); + getflg = FALSE; + for( j = 0; j < CHAR_MAXITEMHAVE; j ++) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid) { + /* Ȼ¾գݹʧ ةë */ + if( pickupmode && pickup && !getflg) { + CHAR_DelItem( charaindex, j); + getflg = TRUE; + } + break; + } + } + } + if( j == CHAR_MAXITEMHAVE) { + found = FALSE; + break; + } + } + } + return found; +} + +/************************************** + * ϶ýľìﶯ + **************************************/ +static BOOL NPC_AirCheckLevel( int meindex, int charaindex, char *argstr) +{ + int level; + + /* ئľئ¦Ѽ */ + level = NPC_Util_GetNumFromStrWithDelim( argstr, "needlevel"); + if( level == -1 ) { + return TRUE; + } + if( CHAR_getInt( charaindex, CHAR_LV) >= level ) return TRUE; + + return FALSE; +} + +/************************************** + * ë + * -1 0 ݾ ۢStone + **************************************/ +static int NPC_AirCheckStone( int meindex, int charaindex, char *argstr) +{ + int gold; + + /* ئľئ¦Ѽ */ + gold = NPC_Util_GetNumFromStrWithDelim( argstr, "needstone"); + if( gold == -1 ) { + return 0; + } + if( CHAR_getInt( charaindex, CHAR_GOLD) >= gold ) return gold; + + return -1; +} +/************************************** + * ë˪ + * ¦Ѽ⻥ئľɷɻë˪ + **************************************/ +static void NPC_AirSendMsg( int meindex, int talkerindex, int tablenum) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buf[256]; + char msg[256]; + if( tablenum < 0 || tablenum >= arraysizeof( airmsg)) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, airmsg[tablenum].option, buf, sizeof( buf)) + != NULL ) + { + strcpy( msg, buf); + } + else { + snprintf( msg, sizeof(msg),airmsg[tablenum].defaultmsg); + } + CHAR_talkToCli( talkerindex, meindex, msg, CHAR_COLORYELLOW); +} +/************************************** + * ƤP̼ë + **************************************/ +static int NPC_AirGetRoutePointNum( int meindex, char *argstr ) +{ + int i; + char buf[4096]; + char buf2[256]; + int ret; + char routetostring[64]; + + snprintf( routetostring, sizeof( routetostring), "routeto%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcair:nothing route \n"); + return -1; + } + for( i = 1; ; i ++ ) { + ret = getStringFromIndexWithDelim( buf, ";", i, buf2, sizeof(buf2)); + if( ret == FALSE) break; + } + return( i -1); +} +BOOL NPC_AirCheckJoinParty( int meindex, int charaindex, BOOL msgflg) +{ + //int fd; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + int ret; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + /* */ + if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; + /* ַ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GETTINGON); + return FALSE; + } + /* շֻ */ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_NOTPARTY); + return FALSE; + } + /* ɡ ūë */ + if( CHAR_getEmptyPartyArray( meindex) == -1 ) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_OVERPARTY); + return FALSE; + } + /* ʧ ةë(ʧ ة) */ + if( !NPC_AirCheckDeniedItem( meindex, charaindex, argstr)) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_DENIEDITEM); + return FALSE; + } +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ) { + CHAR_talkToCli( charaindex, -1, "޷Яϻ", CHAR_COLORYELLOW); + return FALSE; + } +#endif + + /* ʧ ةë( ۢʧ ة) */ + if( !NPC_AirCheckAllowItem( meindex, charaindex, FALSE)) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_ALLOWITEM); + return FALSE; + } + /* ìPë */ + if( !NPC_AirCheckLevel( meindex, charaindex, argstr)) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_LEVEL); + return FALSE; + } + /* ì */ +// if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 || +// CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 || +// CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 ) +// { +// if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_EVENT); +// return FALSE; +// } + /* żë ë¼ƥ ͱ³ */ + ret = NPC_AirCheckStone( meindex, charaindex, argstr); + if( ret == -1 ) { + if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GOLD); + return FALSE; + } + if( ret != 0 ) { + char msgbuf[128]; + /* ë */ + CHAR_setInt( charaindex, CHAR_GOLD, + CHAR_getInt( charaindex, CHAR_GOLD) - ret); + /* ˪ */ + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + snprintf( msgbuf, sizeof( msgbuf), "֧%d Stone", ret); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + } + /* ɡ ū */ + //CHAR_JoinParty_Main( charaindex, meindex); + + //fd = getfdFromCharaIndex( charaindex ); + + //lssproto_PR_send( fd, 1, 1); + + return TRUE; +} diff --git a/npc/npc_alldoman.c b/npc/npc_alldoman.c new file mode 100644 index 0000000..b024bf2 --- /dev/null +++ b/npc/npc_alldoman.c @@ -0,0 +1,392 @@ +#include "version.h" +#include +#include +#include +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" +#include "enemy.h" +#include "chatmagic.h" +#include "log.h" +#include "npc_itemchange.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_eventaction.h" +#include "npc_charm.h" + +#ifdef _ALLDOMAN +#include "npc_alldoman.h" + +#define MAX_HERO_COLUMN 7 +#define MAX_HERO_LIST 100 +char Herolist[MAX_HERO_LIST][MAX_HERO_COLUMN][72]; + +int sort[MAX_HERO_LIST][2]; +int countnum = -1 ; +int showpage = 1 ; +int totalpage = 1; + +static void NPC_Alldoman_selectWindow( int meindex, int talker, int seqno,char *data); + +void NPC_AlldomanWindowTalked(int meindex, int talkerindex, int seqno, int select,char *data) +{ + char buf2[256]; + char buf[256]; + int i; + int playernum = CHAR_getPlayerMaxNum(); + //andy_log + print( "seqno:%d\n", seqno); + switch(seqno) + { + case NPC_ALLDOMAN_MAIN_WND: + if ( select == WINDOW_BUTTONTYPE_NEXT ) { + showpage ++ ; + NPC_Alldoman_selectWindow(meindex , talkerindex , 4 ,""); + } + if ( select == WINDOW_BUTTONTYPE_OK ) { + //CHAR_talkToCli(talkerindex,meindex,"ˣ",CHAR_COLORRED); + showpage = 1 ; + NPC_Alldoman_selectWindow(meindex , talkerindex, 5 ,""); + } + break; + case NPC_ALLDOMAN_SELECT_WND: + if(atoi(data)==2) { + //CHAR_talkToCli(talkerindex,meindex,"",CHAR_COLORRED); + if ( CHAR_getInt( talkerindex , CHAR_FLOOR ) != 8200 ) { + CHAR_talkToCli(talkerindex,-1,"ֻܸӢۿд",CHAR_COLORRED); + break; + } + if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) > 132 || + CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) <= 0 ) { + CHAR_setWorkInt( talkerindex , CHAR_WORKHEROFLOOR , 0 ) ; + CHAR_talkToCli(talkerindex,-1,"ֻܸӢۿд",CHAR_COLORRED); + break; + } + sprintf( buf2 , "ó˴%3d֤ͼԼʯ" , CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) ); + CHAR_talkToCli(talkerindex,-1,buf2,CHAR_COLORRED); + if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) == 132 ) { + sprintf( buf2 , "%s" , "˹½Ӣ" ) ; + //ﶥȫϵ㲥 + sprintf( buf , "%sӢսɷ֮齫Ϣ֪ͨȫ磬µӢ۵!!" , CHAR_getChar( talkerindex, CHAR_NAME ) ); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, buf, CHAR_COLORBLUE2); + } + } + } + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 130 ) + sprintf( buf2 , "%s" , "˹½սʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 125 ) + sprintf( buf2 , "%s" , "˹½ʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 120 ) + sprintf( buf2 , "%s" , "˹Ӣ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 115 ) + sprintf( buf2 , "%s" , "˹ʹսʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 110 ) + sprintf( buf2 , "%s" , "ķսʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 100 ) + sprintf( buf2 , "%s" , "˿սʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 80 ) + sprintf( buf2 , "%s" , "̹սʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 60 ) + sprintf( buf2 , "%s" , "ضսʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 40 ) + sprintf( buf2 , "%s" , "ħʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 20 ) + sprintf( buf2 , "%s" , "ʥʿ" ) ; + else if ( CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) >= 1 ) + sprintf( buf2 , "%s" , "ʿ" ) ; + else + sprintf( buf2 , " " ); + saacproto_UpdataStele_send ( + acfd , + CHAR_getChar( talkerindex , CHAR_CDKEY ), + CHAR_getChar( talkerindex , CHAR_NAME ) , + buf2 , + CHAR_getInt( talkerindex , CHAR_LV ) , + CHAR_getInt( talkerindex , CHAR_TRANSMIGRATION) , + 10 , + CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR ) + ) ; + //WorkFloor + CHAR_setWorkInt( talkerindex , CHAR_WORKHEROFLOOR , 0 ) ; + } + if(atoi(data)==4) { + //CHAR_talkToCli(talkerindex,meindex,"",CHAR_COLORRED); + showpage = 1 ; + NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,""); + } + if(atoi(data)==6) { + //CHAR_talkToCli(talkerindex,meindex,"",CHAR_COLORRED); + } + break; + case NPC_ALLDOMAN_LIST_WND: + if( select == WINDOW_BUTTONTYPE_OK ){ + print("\nSyu log FloorWorkint => %d" , CHAR_getWorkInt( talkerindex , CHAR_WORKHEROFLOOR )); + } + if( select == WINDOW_BUTTONTYPE_PREV && showpage > 1 ) { + showpage -- ; + NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,"" ); + } + if( select == WINDOW_BUTTONTYPE_NEXT && showpage < totalpage ) { + showpage ++ ; + NPC_Alldoman_selectWindow(meindex , talkerindex, 6 ,""); + } + break; + } +} + +static void NPC_Alldoman_selectWindow( int meindex, int talker, int num, char *data) +{ + int buttontype = 0,windowtype = 0,windowno = 0 , i ; + int fd = getfdFromCharaIndex( talker); + char token[1024]; + char token2[100 * 100]; + + + //andy_log + print( "NPC_Alldoman_selectWindow( num:%d)\n", num); + switch(num) + { + case 4: + if ( showpage == 1 ) { + buttontype = WINDOW_BUTTONTYPE_NEXT; + sprintf( token, "ʥʱ³ִУ֮һ⣬˹ijϴɹʶʿǰȺĻȺʿںڸȺսϣʵ⣬ʿأʿѡڻضͨ·"); + } + else if ( showpage == 2 ) { + buttontype = WINDOW_BUTTONTYPE_NEXT; + sprintf( token, "ĵĵֿ峤ټͨ³ĺͨڴӿǰڷ˵Ϊʥʱ죬Ϊʥʱʿʯ˵ضΪӢսЧҵоﵽǿǿ"); + } + else if ( showpage == 3) { + buttontype = WINDOW_BUTTONTYPE_OK; + sprintf( token, "ΪĿģ˹½ϢӢ´Ӣսģشگȫ˹Ӣۣ\n\n ӢսίԱ"); + } + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = NPC_ALLDOMAN_MAIN_WND; + lssproto_WN_send(fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token ); + break; + case 5: + buttontype = WINDOW_BUTTONTYPE_NONE; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = NPC_ALLDOMAN_SELECT_WND; + sprintf(token, + "0\n\n дʯ" + "\n\n " + "\n\n ȡ" + ); + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),token); + break; + case 6: + if ( totalpage != 1 && showpage == 1 ) + buttontype = WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_NEXT; + else if ( totalpage == 1 ) + buttontype = WINDOW_BUTTONTYPE_OK ; + else if ( totalpage != 1 && showpage == totalpage ) + buttontype = WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_PREV; + else if ( totalpage != 1 && showpage != 1 && showpage != totalpage ) + buttontype = WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT; + windowtype = WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT; + windowno = NPC_ALLDOMAN_LIST_WND; + sprintf ( token2 , " ͷ ¥ ȼ ת\n"); + for ( i=0+(showpage-1 )*15; i 1) return; + if( NPC_Util_isFaceToFace( talker, meindex , 1 ) == FALSE ) return; + showpage = 1 ; + NPC_Alldoman_selectWindow(meindex, talker , 4 ,""); +} +void NPC_AlldomanWriteStele ( char *token ) +{ + + int linenum = 0 , i , flag , temp , temp1 , j ; + int lens=0; + char *addr; + if( token == NULL || (lens = strlen( token)) <= 0 ) return; + while( linenum < 100 ){ + for ( i = 0 ; i < MAX_HERO_COLUMN ; i ++ ) { + if( getStringFromIndexWithDelim( token, "|", i + 1 , Herolist[ linenum ][ i ] , sizeof( Herolist[ linenum ][ i ] ) ) == FALSE ){ +#ifdef _ALLDOMAN_DEBUG + countnum = 0 ; + for ( i = 0 ; i < MAX_HERO_LIST ; i ++ ) { + sort[i][0] = atoi ( Herolist[i][6] ) ; + sort[i][1] = i ; + if ( sort[i][0] != 0 && sort[i][0] != -1 ) + countnum ++ ; + } + + for ( i = 0 ; i < MAX_HERO_LIST - 1 ; i ++ ) { + flag = 0 ; + for ( j = 0 ; j < MAX_HERO_LIST - 1 ; j ++ ) { + if ( sort[j][0] > sort[j+1][0] ){ + flag = 1 ; + temp = sort[j][0]; + temp1 = sort[j][1]; + sort[j][0] = sort[j + 1][0]; + sort[j][1] = sort[j + 1][1]; + sort[j+1][0] = temp; + sort[j+1][1] = temp1; + } + } + if ( flag != 1 ) + break; + } + totalpage = countnum / 15 ; + if ( ( countnum % 15 ) != 0 ) + totalpage ++; +#endif + return; + } + } + linenum ++; + + if ( (addr = strstr ( token , "\n" )) == NULL ) break; + strcpy ( token , addr + 1 ) ; + if( token == NULL || (lens = strlen( token)) <= 0 ) { +#ifdef _ALLDOMAN_DEBUG + countnum = 0 ; + for ( i = 0 ; i < MAX_HERO_LIST ; i ++ ) { + sort[i][0] = atoi ( Herolist[i][6] ) ; + sort[i][1] = i ; + if ( sort[i][0] != 0 && sort[i][0] != -1 ) + countnum ++ ; + } + for ( i = 0 ; i < MAX_HERO_LIST - 1 ; i ++ ) { + flag = 0 ; + for ( j = 0 ; j < MAX_HERO_LIST - 1 ; j ++ ) { + if ( sort[j][0] > sort[j+1][0] ){ + flag = 1 ; + temp = sort[j][0]; + temp1 = sort[j][1]; + sort[j][0] = sort[j + 1][0]; + sort[j][1] = sort[j + 1][1]; + sort[j+1][0] = temp; + sort[j+1][1] = temp1; + } + } + if ( flag != 1 ) + break; + } + totalpage = countnum / 15 ; + if ( ( countnum % 15 ) != 0 ) + totalpage ++; +#endif + return; + } + } + + countnum = 0 ; + for ( i = 0 ; i < MAX_HERO_LIST ; i ++ ) { + sort[i][0] = atoi ( Herolist[i][6] ) ; + sort[i][1] = i ; + if ( sort[i][0] != 0 && sort[i][0] != -1 ) + countnum ++ ; + } + + for ( i = 0 ; i < MAX_HERO_LIST - 1 ; i ++ ) { + flag = 0 ; + for ( j = 0 ; j < MAX_HERO_LIST - 1 ; j ++ ) { + if ( sort[j][0] > sort[j+1][0] ){ + flag = 1 ; + temp = sort[j][0]; + temp1 = sort[j][1]; + sort[j][0] = sort[j + 1][0]; + sort[j][1] = sort[j + 1][1]; + sort[j+1][0] = temp; + sort[j+1][1] = temp1; + } + } + if ( flag != 1 ) + break; + } + + + totalpage = countnum / 15 ; + if ( ( countnum % 15 ) != 0 ) + totalpage ++; +//#endif +} + +void NPC_Alldoman_S_WriteStele( char *ocdkey , char *oname , char *ncdkey , + char *nname , char *title , int level , int trns , int floor ) +{ + int i , j , temp , temp1 , flag ; + for ( i = 0 ; i < MAX_HERO_COLUMN ; i ++ ) { + if ( ( strcmp( Herolist[i][0] , ocdkey ) == 0 ) && ( strcmp( Herolist[i][1] , oname ) == 0 ) ) { + sprintf( Herolist[i][0] , "%s" , ncdkey ) ; + sprintf( Herolist[i][1] , "%s" , nname ) ; + sprintf( Herolist[i][2] , "%s" , title ) ; + sprintf( Herolist[i][3] , "%d" , level ) ; + sprintf( Herolist[i][4] , "%d" , trns ) ; + sprintf( Herolist[i][6] , "%d" , floor ) ; + break; + } + } + countnum = 0 ; + for ( i = 0 ; i < MAX_HERO_LIST ; i ++ ) { + sort[i][0] = atoi ( Herolist[i][6] ) ; + sort[i][1] = i ; + if ( sort[i][0] != 0 && sort[i][0] != -1 ) + countnum ++ ; + } + for ( i = 0 ; i < MAX_HERO_LIST - 1 ; i ++ ) { + flag = 0 ; + for ( j = 0 ; j < MAX_HERO_LIST - 1 ; j ++ ) { + if ( sort[j][0] > sort[j+1][0] ){ + flag = 1 ; + temp = sort[j][0]; + temp1 = sort[j][1]; + sort[j][0] = sort[j + 1][0]; + sort[j][1] = sort[j + 1][1]; + sort[j+1][0] = temp; + sort[j+1][1] = temp1; + } + } + if ( flag != 1 ) + break; + } + totalpage = countnum / 15 ; + if ( ( countnum % 15 ) != 0 ) + totalpage ++ ; +} + +#endif + diff --git a/npc/npc_auctioneer.c b/npc/npc_auctioneer.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_autopk.c b/npc/npc_autopk.c new file mode 100644 index 0000000..a6e7d4b --- /dev/null +++ b/npc/npc_autopk.c @@ -0,0 +1,992 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_autopk.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_healer.h" +#include "configfile.h" + +#ifdef _GMRELOAD + extern struct GMINFO gminfo[GMMAXNUM]; +#endif +#ifdef _JOB_AUTOPK + extern int jobautopk; +#endif +#ifdef _AUTO_PK + +#define AWARDNO (1 << 0) +#define AWARDPET (1 << 1) +#define AWARDITEM (1 << 2) +#define AWARDALL (AWARDPET|AWARDITEM) + +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_JOINPK, + WINDOW_PKLIST, + WINDOW_PKINFO, + WINDOW_HISTORY, + WINDOW_HISTORY_NEXT, + WINDOW_HISTORY_PREV, + WINDOW_END, +}; + +typedef struct tagautopk +{ + int winnum; + char cdkey[CDKEYLEN]; + char name[CHARNAMELEN]; +}Autopk; + +typedef struct tagaward +{ + int awardpetid; + int awarditemid; + char awardpet[32]; + char awarditem[32]; + int draw; +}Award; + +static int baward = FALSE; + +Award award[5]; + +Autopk ship[5]; + +int autopklist; +static int autopktime=-1; +static int awardpetid=-1; +static int awarditemid=-1; +static char awardpet[32]; +static char awarditem[32]; +int autopkstart=0; +int autopkcnt=0; +int autopktype = 0; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_TIMEFLAG = CHAR_NPCWORKINT9, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +enum { + NPC_AUTOPK_START, + NPC_AUTOPK_SELECT, + NPC_AUTOPK_JOINPK, + NPC_AUTOPK_PKLIST, + NPC_AUTOPK_PKAWARD, + NPC_AUTOPK_HISTORY, + NPC_AUTOPK_OK, + NPC_AUTOPK_END, +}; +#define STANDBYTIME 50 + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select); +BOOL AutoPk_GetHistoryStr( char *token, int page ); +void AutoPk_PKNum( char *token ); +BOOL AutoPk_AddItem( int charindex, int index ); +BOOL AutoPk_AddPet( int charindex, int index ); + +BOOL NPC_AutoPkInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + +// CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_AutoPkTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_AutoPkWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + char jiangbuf[256]; + memset(jiangbuf, 0, sizeof(jiangbuf)); + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_AUTOPK_START: + break; + case NPC_AUTOPK_SELECT: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_AUTOPK_JOINPK: + if(autopktime>2 +#ifdef _JOB_AUTOPK + && CHAR_getInt( talkerindex, PROFESSION_CLASS ) == jobautopk +#endif + ){ + char buf1[128]; + char buf2[255]; + int i; + if(CHAR_getInt(talkerindex,CHAR_LV)0){ + AutoPk_PKSystemTalk(jiangbuf,jiangbuf); + } +// if(!strcmp(ship[3].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[3].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[3].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDPET; +// if((award[3].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDITEM; +// }else if(!strcmp(ship[4].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[4].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[4].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDPET; +// if((award[4].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDITEM; +// } + break; + case NPC_AUTOPK_HISTORY: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_PREV, atoi( data)); + return; + } + break; + case NPC_AUTOPK_OK: + break; + case NPC_AUTOPK_END: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } +} + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token, "3\n񶷣УԱ\n\n" + "ʲôҪΪء\n" + "Ҫμӱ\n" + "鿴ѡ֡\n" + "ȡƷ\n" + "ʷ¼\n" + "ۿ"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_SELECT; + break; + case WINDOW_SELECT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(select==1){ + if(autopktime>2){ + sprintf(token, " 񶷣УԱ\n\n" + "ǰʼʱ仹ʣ%dӣһ׼",autopktime); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_AUTOPK_JOINPK; + }else if(autopktime>0){ + sprintf(token, "񶷣УԱ\n\n" + "PK%dӺʼ!\n޷أ\n\nPS޷볡أ볡硣",autopktime); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + }else{ + sprintf(token, " 񶷣УԱ\n\n" + "ĿǰδٰУ˱\n עУ˱Ϣ\n עٷ̳\n ʯ ʱ \n\n PS޷볡"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else if(select==2){ + sprintf(token, "񶷣У\n"); + strcat(token, "תȼҡ\n"); + AutoPk_PKNum(token); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKLIST; + }else if(select==3){ + AutoPk_GetAwardStr(); + char buff[64]; + sprintf(token, "񶷣УƷȡ\nʤڱȡ\n\n");; +// if(strlen(award[0].awardpet)>0) +// sprintf(buff, "ھ%s\n", award[0].awardpet); +// else +// sprintf(buff, "ھ\n"); +// strcat(token, buff); + if(strlen(award[0].awarditem)>0) + sprintf(buff, " %s\n", award[0].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[1].awardpet)>0) +// sprintf(buff, "Ǿ%s\n", award[1].awardpet); +// else +// sprintf(buff, "Ǿ\n"); +// strcat(token, buff); + if(strlen(award[1].awarditem)>0) + sprintf(buff, " %s\n", award[1].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[2].awardpet)>0) +// sprintf(buff, "%s\n", award[2].awardpet); +// else +// sprintf(buff, "\n"); +// strcat(token, buff); + if(strlen(award[2].awarditem)>0) + sprintf(buff, " %s\n", award[2].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); + strcat(token,"\nΰɱ㣬ɱҪѸŶ"); +// if(strlen(award[3].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[3].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[3].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[3].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); +// if(strlen(award[4].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[4].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[4].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[4].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); + if(baward && (!strcmp(ship[0].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[0].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[0].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[1].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[1].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[1].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[2].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[2].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[2].draw&AWARDITEM)!=AWARDITEM) && autopktype == 0) + buttontype = WINDOW_BUTTONTYPE_YESNO; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKAWARD; + }else if(select==4){ + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + }else if(select==5){ + CHAR_talkToCli( toindex, -1, "[ʾ]ʼ뵽ҽԺ<Զ̹սԱ>鿴Ŷ", CHAR_COLORRED ); + return; + } + break; + case WINDOW_HISTORY_NEXT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_HISTORY_PREV: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<1)CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) || CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_END: + return; + break; + } + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_AutoPkLoop( void ) +{ +} + +BOOL AutoPk_GetHistoryStr( char *token, int page ) +{ + FILE* fp; + fp = fopen("./data/autopk/autopkhistory.txt", "r"); + if (fp == NULL) + { + print("鿴ʷļ򿪴\n"); + return FALSE; + } + typedef struct taghistory + { + char winnum[5]; + char name[CHARNAMELEN]; + }History; + History history[5]; + + char hstime[5],line[255],buf[255]; + int i; + for(i=0;i0){ + char buf1[64]; + char buf2[128]; + char qfgonggao[256]; +#ifdef _YUANGUSA + sprintf(qfgonggao,"[Ѷ]PK[%d]ӺУμ·%s",autopktime,getGameservername()); + system_all_talk(qfgonggao); + sprintf(buf1, "μӽPKʱ仹ʣ%dӣǰ볡",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "PKʱ仹ʣ%dӣǰ볡",autopktime); +#else + sprintf(buf1, "ֹμPKʱ仹ʣ%dӣ",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "ʽPKʱ仹ʣ%dӣ",autopktime); +#endif + AutoPk_PKSystemTalk(buf1, buf2); + }else if(autopktime==0){ + int i,charaindex,num=0; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=getAutoPkMinNum())break; + } + } + if(num>=getAutoPkMinNum()){ + AutoPk_PKSystemTalk("ʽʼ","ʽʼ"); + AutoPk_PKSystemStart(); + autopkstart=1; + autopkcnt = 0; + autopktime--; + autopktype = 1; + }else{ + i = 0; + for(i=0;i0){ + awardpetid=petid; + strcpy(awardpet,pet); + }else{ + awardpetid=-1; + } + if(itemid>0){ + awarditemid=itemid; + strcpy(awarditem,item); + }else{ + awarditemid=-1; + } +} + +#ifdef _NONUM_AUTOPK +void AutoPk_ChampionShipSet( char *cdkey, char *name,int winnum, int win ) +{ + strcpy(ship[win].cdkey, cdkey); + strcpy(ship[win].name, name); + ship[win].winnum=winnum; +} +#else +void AutoPk_ChampionShipSet( char *cdkey, char *name, int winnum, int win ) +{ + if(win==0){ + char token[64]; + if(winnum>ship[0].winnum){ + sprintf( token, "[ս]%sĿǰһɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[0].cdkey,cdkey) && strstr(ship[0].name,name)){ + ship[0].winnum=winnum; + }else if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + } + }else if(winnum>ship[1].winnum){ + sprintf( token, "[ս]%sĿǰڶɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=winnum; + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=winnum; + strcpy(ship[1].cdkey, cdkey); + strcpy(ship[1].name, name); + } + }else if(winnum>ship[2].winnum){ + sprintf( token, "[ս]%sĿǰɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + ship[2].winnum=winnum; + strcpy(ship[2].cdkey, cdkey); + strcpy(ship[2].name, name); + } + }else if(win==1){ + ship[3].winnum=winnum; + strcpy(ship[3].cdkey, cdkey); + strcpy(ship[3].name, name); + }else if(win==2){ + ship[4].winnum=winnum; + strcpy(ship[4].cdkey, cdkey); + strcpy(ship[4].name, name); + } +} +#endif + + +void AutoPk_GetChampionShip( void ) +{ + char token[64]; + if(strlen(ship[0].cdkey)>0){ + sprintf( token, "[]񶷴ھߡ%s", ship[0].name); + AutoPk_PKSystemTalk(token,token); + AutoPk_PKTimeSetOnly(-1); + autopkstart=0; + } + if(strlen(ship[1].cdkey)>0){ + sprintf( token, "[]񶷴Ǿߡ%s", ship[1].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[2].cdkey)>0){ + sprintf( token, "[]񶷴ߡ%s", ship[2].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[3].cdkey)>0 && strlen(ship[4].cdkey)>0){ + //sprintf( token, "ϲ%s%sñPKĺ͵", ship[3].name,ship[4].name); + //AutoPk_PKSystemTalk(token,token); + } + autopktype = 0; + AutoPk_SetHistoryStr(); + + + + baward = TRUE; +} + +BOOL AutoPk_AddItem( int charindex, int index ) +{ + char msgbuf[64]; + int ret; + int spaceNum=5,i,itemindex=-1; + itemindex = CHAR_findEmptyItemBox( charindex ); + if( itemindex < 0 ) { + CHAR_talkToCli( charindex, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( award[index].awarditemid ); + if(itemindex == -1) + return FALSE; + ret = CHAR_addItemSpecificItemIndex( charindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex ); + print ("\n ret error!!"); + return FALSE; + } + sprintf( msgbuf,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charindex, ret); + return TRUE; +} + +BOOL AutoPk_AddPet( int charindex, int index) +{ + int ret; + char msgbuf[64]; + int enemynum; + int i,j; + int petindex, petindex2; + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == award[index].awardpetid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( charindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charindex, i ) == ret ) + break; + } + + petindex2 = CHAR_getCharPet(charindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_setInt(petindex2,CHAR_VARIABLEAI,10000); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + } + return TRUE; +} + +void NPC_AUTOPKHealerTalked( int meindex ) +{ + if( CHAR_getInt( meindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + if( (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 2) ) + { + + NPC_HealerAllHeal( meindex); + CHAR_talkToCli( meindex, -1,"ϲʤȴֱȫظ",CHAR_COLORYELLOW); + }else{ + int i = 0; + int otherindex; + + for( i=0 ; i < CHAR_PARTYMAX ; i++) + { + otherindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1 + i); + if(otherindex != -1){ + + NPC_HealerAllHeal( otherindex); + CHAR_talkToCli( otherindex, -1,"ϲʤȫظ",CHAR_COLORYELLOW); + } + } + } +} + +BOOL AutoPk_GetAwardStr( void ) +{ + FILE* fp; + int i=0; + int j=0; + int enemynum = ENEMY_getEnemyNum(); + fp = fopen("./data/autopk/autopkaward.txt", "r"); + if (fp == NULL) + { + print("鿴Ʒļ򿪴\n"); + return FALSE; + } + for(i=0;i<5;i++){ + char line[64],buf[32]; + if (fgets(line, sizeof(line), fp) == NULL)break; + chop(line); + getStringFromIndexWithDelim(line,"|", 1, buf, sizeof(buf)); + award[i].awardpetid=atoi(buf); + if(award[i].awardpetid!=-1){ + for( j=0; j 0 && award[i].awarditemid <= getItemnum() ){ + strcpy(award[i].awarditem,ITEM_getNameFromNumber(award[i].awarditemid)); + } + else{ + strcpy(award[i].awarditem, "\0"); + award[i].draw=AWARDNO; + } + } + fclose(fp); + return TRUE; +} + +void AutoPk_SetAwardStr( char *token ) +{ + FILE* fp; + int i=0; + fp = fopen("./data/autopk/autopkaward.txt", "w"); + fwrite(token, strlen(token), 1, fp); + fclose(fp); +} + +void AutoPk_PKSystemStart( void ) +{ + int i,charaindex,num=0; + int pkindex[1000],pktype[1000]; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=2){ + if(num%2==0){ + int j = num-1; + i=0; + for(i=0;i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_autopk.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_healer.h" +#include "configfile.h" + +#ifdef _GMRELOAD + extern struct GMINFO gminfo[GMMAXNUM]; +#endif +#ifdef _JOB_AUTOPK + extern int jobautopk; +#endif +#ifdef _AUTO_PK + +#define AWARDNO (1 << 0) +#define AWARDPET (1 << 1) +#define AWARDITEM (1 << 2) +#define AWARDALL (AWARDPET|AWARDITEM) + +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_JOINPK, + WINDOW_PKLIST, + WINDOW_PKINFO, + WINDOW_HISTORY, + WINDOW_HISTORY_NEXT, + WINDOW_HISTORY_PREV, + WINDOW_END, +}; + +typedef struct tagautopk +{ + int winnum; + char cdkey[CDKEYLEN]; + char name[CHARNAMELEN]; +}Autopk; + +typedef struct tagaward +{ + int awardpetid; + int awarditemid; + char awardpet[32]; + char awarditem[32]; + int draw; +}Award; + +static int baward = FALSE; + +Award award[5]; + +Autopk ship[5]; + +int autopklist; +static int autopktime=-1; +static int awardpetid=-1; +static int awarditemid=-1; +static char awardpet[32]; +static char awarditem[32]; +int autopkstart=0; +int autopkcnt=0; +int autopktype = 0; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_TIMEFLAG = CHAR_NPCWORKINT9, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +enum { + NPC_AUTOPK_START, + NPC_AUTOPK_SELECT, + NPC_AUTOPK_JOINPK, + NPC_AUTOPK_PKLIST, + NPC_AUTOPK_PKAWARD, + NPC_AUTOPK_HISTORY, + NPC_AUTOPK_OK, + NPC_AUTOPK_END, +}; +#define STANDBYTIME 50 + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select); +BOOL AutoPk_GetHistoryStr( char *token, int page ); +void AutoPk_PKNum( char *token ); +BOOL AutoPk_AddItem( int charindex, int index ); +BOOL AutoPk_AddPet( int charindex, int index ); + +BOOL NPC_AutoPkInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + +// CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + award[0].draw=0; + award[1].draw=0; + award[2].draw=0; + award[3].draw=0; + award[4].draw=0; + + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_AutoPkTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_AutoPkWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + char jiangbuf[256]; + memset(jiangbuf, 0, sizeof(jiangbuf)); + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_AUTOPK_START: + break; + case NPC_AUTOPK_SELECT: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_AUTOPK_JOINPK: + if(autopktime>2 +#ifdef _JOB_AUTOPK + && CHAR_getInt( talkerindex, PROFESSION_CLASS ) == jobautopk +#endif + ){ + char buf1[128]; + char buf2[255]; + int i; + if(CHAR_getInt(talkerindex,CHAR_LV)0){ + AutoPk_PKSystemTalk(jiangbuf,jiangbuf); + } +// if(!strcmp(ship[3].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[3].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[3].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDPET; +// if((award[3].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDITEM; +// }else if(!strcmp(ship[4].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[4].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[4].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDPET; +// if((award[4].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDITEM; +// } + break; + case NPC_AUTOPK_HISTORY: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_PREV, atoi( data)); + return; + } + break; + case NPC_AUTOPK_OK: + break; + case NPC_AUTOPK_END: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } +} + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token, "3\n񶷣УԱ\n\n" + "ʲôҪΪء\n" + "Ҫμӱ\n" + "鿴ѡ֡\n" + "ȡƷ\n" + "ʷ¼\n" + "ۿ"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_SELECT; + break; + case WINDOW_SELECT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(select==1){ + if(autopktime>2){ + sprintf(token, " 񶷣УԱ\n\n" + "ǰʼʱ仹ʣ%dӣһ׼",autopktime); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_AUTOPK_JOINPK; + }else if(autopktime>0){ + sprintf(token, "񶷣УԱ\n\n" + "PK%dӺʼ!\n޷أ\n\nPS޷볡أ볡硣",autopktime); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + }else{ + sprintf(token, " 񶷣УԱ\n\n" + "ĿǰδٰУ˱\n עУ˱Ϣ\n עٷ̳\n www.waei.cc \n\n PS޷볡"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else if(select==2){ + sprintf(token, "񶷣У\n"); + strcat(token, "תȼҡ\n"); + AutoPk_PKNum(token); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKLIST; + }else if(select==3){ + AutoPk_GetAwardStr(); + char buff[64]; + sprintf(token, "񶷣УƷȡ\nʤڱȡ\n\n");; +// if(strlen(award[0].awardpet)>0) +// sprintf(buff, "ھ%s\n", award[0].awardpet); +// else +// sprintf(buff, "ھ\n"); +// strcat(token, buff); + if(strlen(award[0].awarditem)>0) + sprintf(buff, " %s\n", award[0].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[1].awardpet)>0) +// sprintf(buff, "Ǿ%s\n", award[1].awardpet); +// else +// sprintf(buff, "Ǿ\n"); +// strcat(token, buff); + if(strlen(award[1].awarditem)>0) + sprintf(buff, " %s\n", award[1].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[2].awardpet)>0) +// sprintf(buff, "%s\n", award[2].awardpet); +// else +// sprintf(buff, "\n"); +// strcat(token, buff); + if(strlen(award[2].awarditem)>0) + sprintf(buff, " %s\n", award[2].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); + strcat(token,"\nΰɱ㣬ɱҪѸŶ"); +// if(strlen(award[3].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[3].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[3].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[3].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); +// if(strlen(award[4].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[4].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[4].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[4].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); + if(baward && (!strcmp(ship[0].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[0].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[0].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[1].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[1].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[1].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[2].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[2].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[2].draw&AWARDITEM)!=AWARDITEM) && autopktype == 0) + buttontype = WINDOW_BUTTONTYPE_YESNO; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKAWARD; + }else if(select==4){ + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + }else if(select==5){ + CHAR_talkToCli( toindex, -1, "[ʾ]ʼ뵽ҽԺ<Զ̹սԱ>鿴Ŷ", CHAR_COLORRED ); + return; + } + break; + case WINDOW_HISTORY_NEXT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_HISTORY_PREV: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<1)CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) || CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_END: + return; + break; + } + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_AutoPkLoop( void ) +{ +} + +BOOL AutoPk_GetHistoryStr( char *token, int page ) +{ + FILE* fp; + fp = fopen("./data/autopk/autopkhistory.txt", "r"); + if (fp == NULL) + { + print("鿴ʷļ򿪴\n"); + return FALSE; + } + typedef struct taghistory + { + char winnum[5]; + char name[CHARNAMELEN]; + }History; + History history[5]; + + char hstime[5],line[255],buf[255]; + int i; + for(i=0;i0){ + char buf1[64]; + char buf2[128]; + char qfgonggao[256]; +#ifdef _YUANGUSA + sprintf(qfgonggao,"[Ѷ]PK[%d]ӺУμ·%s",autopktime,getGameservername()); + system_all_talk(qfgonggao); + sprintf(buf1, "μӽPKʱ仹ʣ%dӣǰ볡",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "PKʱ仹ʣ%dӣǰ볡",autopktime); +#else + sprintf(buf1, "ֹμPKʱ仹ʣ%dӣ",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "ʽPKʱ仹ʣ%dӣ",autopktime); +#endif + AutoPk_PKSystemTalk(buf1, buf2); + }else if(autopktime==0){ + int i,charaindex,num=0; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=getAutoPkMinNum())break; + } + } + if(num>=getAutoPkMinNum()){ + AutoPk_PKSystemTalk("ʽʼ","ʽʼ"); + AutoPk_PKSystemStart(); + autopkstart=1; + autopkcnt = 0; + autopktime--; + autopktype = 1; + }else{ + i = 0; + for(i=0;i0){ + awardpetid=petid; + strcpy(awardpet,pet); + }else{ + awardpetid=-1; + } + if(itemid>0){ + awarditemid=itemid; + strcpy(awarditem,item); + }else{ + awarditemid=-1; + } +} + +#ifdef _NONUM_AUTOPK +void AutoPk_ChampionShipSet( char *cdkey, char *name,int winnum, int win ) +{ + strcpy(ship[win].cdkey, cdkey); + strcpy(ship[win].name, name); + ship[win].winnum=winnum; +} +#else +void AutoPk_ChampionShipSet( char *cdkey, char *name, int winnum, int win ) +{ + if(win==0){ + char token[64]; + if(winnum>ship[0].winnum){ + sprintf( token, "[ս]%sĿǰһɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[0].cdkey,cdkey) && strstr(ship[0].name,name)){ + ship[0].winnum=winnum; + }else if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + } + }else if(winnum>ship[1].winnum){ + sprintf( token, "[ս]%sĿǰڶɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=winnum; + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=winnum; + strcpy(ship[1].cdkey, cdkey); + strcpy(ship[1].name, name); + } + }else if(winnum>ship[2].winnum){ + sprintf( token, "[ս]%sĿǰɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + ship[2].winnum=winnum; + strcpy(ship[2].cdkey, cdkey); + strcpy(ship[2].name, name); + } + }else if(win==1){ + ship[3].winnum=winnum; + strcpy(ship[3].cdkey, cdkey); + strcpy(ship[3].name, name); + }else if(win==2){ + ship[4].winnum=winnum; + strcpy(ship[4].cdkey, cdkey); + strcpy(ship[4].name, name); + } +} +#endif + + +void AutoPk_GetChampionShip( void ) +{ + char token[64]; + if(strlen(ship[0].cdkey)>0){ + sprintf( token, "[]񶷴ھߡ%s", ship[0].name); + AutoPk_PKSystemTalk(token,token); + AutoPk_PKTimeSetOnly(-1); + autopkstart=0; + } + if(strlen(ship[1].cdkey)>0){ + sprintf( token, "[]񶷴Ǿߡ%s", ship[1].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[2].cdkey)>0){ + sprintf( token, "[]񶷴ߡ%s", ship[2].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[3].cdkey)>0 && strlen(ship[4].cdkey)>0){ + //sprintf( token, "ϲ%s%sñPKĺ͵", ship[3].name,ship[4].name); + //AutoPk_PKSystemTalk(token,token); + } + autopktype = 0; + AutoPk_SetHistoryStr(); + + + + baward = TRUE; +} + +BOOL AutoPk_AddItem( int charindex, int index ) +{ + char msgbuf[64]; + int ret; + int spaceNum=5,i,itemindex=-1; + itemindex = CHAR_findEmptyItemBox( charindex ); + if( itemindex < 0 ) { + CHAR_talkToCli( charindex, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( award[index].awarditemid ); + if(itemindex == -1) + return FALSE; + ret = CHAR_addItemSpecificItemIndex( charindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex ); + print ("\n ret error!!"); + return FALSE; + } + sprintf( msgbuf,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charindex, ret); + return TRUE; +} + +BOOL AutoPk_AddPet( int charindex, int index) +{ + int ret; + char msgbuf[64]; + int enemynum; + int i,j; + int petindex, petindex2; + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == award[index].awardpetid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( charindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charindex, i ) == ret ) + break; + } + + petindex2 = CHAR_getCharPet(charindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_setInt(petindex2,CHAR_VARIABLEAI,10000); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + } + return TRUE; +} + +void NPC_AUTOPKHealerTalked( int meindex ) +{ + if( CHAR_getInt( meindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + if( (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 2) ) + { + + NPC_HealerAllHeal( meindex); + CHAR_talkToCli( meindex, -1,"ϲʤȴֱȫظ",CHAR_COLORYELLOW); + }else{ + int i = 0; + int otherindex; + + for( i=0 ; i < CHAR_PARTYMAX ; i++) + { + otherindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1 + i); + if(otherindex != -1){ + + NPC_HealerAllHeal( otherindex); + CHAR_talkToCli( otherindex, -1,"ϲʤȫظ",CHAR_COLORYELLOW); + } + } + } +} + +BOOL AutoPk_GetAwardStr( void ) +{ + FILE* fp; + int i=0; + int j=0; + int enemynum = ENEMY_getEnemyNum(); + fp = fopen("./data/autopk/autopkaward.txt", "r"); + if (fp == NULL) + { + print("鿴Ʒļ򿪴\n"); + return FALSE; + } + for(i=0;i<5;i++){ + char line[64],buf[32]; + if (fgets(line, sizeof(line), fp) == NULL)break; + chop(line); + getStringFromIndexWithDelim(line,"|", 1, buf, sizeof(buf)); + award[i].awardpetid=atoi(buf); + if(award[i].awardpetid!=-1){ + for( j=0; j 0 && award[i].awarditemid <= getItemnum() ){ + strcpy(award[i].awarditem,ITEM_getNameFromNumber(award[i].awarditemid)); + } + else{ + strcpy(award[i].awarditem, "\0"); + award[i].draw=AWARDNO; + } + } + fclose(fp); + return TRUE; +} + +void AutoPk_SetAwardStr( char *token ) +{ + FILE* fp; + int i=0; + fp = fopen("./data/autopk/autopkaward.txt", "w"); + fwrite(token, strlen(token), 1, fp); + fclose(fp); +} + +void AutoPk_PKSystemStart( void ) +{ + int i,charaindex,num=0; + int pkindex[1000],pktype[1000]; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=2){ + if(num%2==0){ + int j = num-1; + i=0; + for(i=0;i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_autopk.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_healer.h" +#include "configfile.h" + +#ifdef _GMRELOAD + extern struct GMINFO gminfo[GMMAXNUM]; +#endif +#ifdef _JOB_AUTOPK + extern int jobautopk; +#endif +#ifdef _AUTO_PK + +#define AWARDNO (1 << 0) +#define AWARDPET (1 << 1) +#define AWARDITEM (1 << 2) +#define AWARDALL (AWARDPET|AWARDITEM) + +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_JOINPK, + WINDOW_PKLIST, + WINDOW_PKINFO, + WINDOW_HISTORY, + WINDOW_HISTORY_NEXT, + WINDOW_HISTORY_PREV, + WINDOW_END, +}; + +typedef struct tagautopk +{ + int winnum; + char cdkey[CDKEYLEN]; + char name[CHARNAMELEN]; +}Autopk; + +typedef struct tagaward +{ + int awardpetid; + int awarditemid; + char awardpet[32]; + char awarditem[32]; + int draw; +}Award; + +static int baward = FALSE; + +Award award[10]; + +Autopk ship[10]; + +int autopklist; +static int autopktime=-1; +static int awardpetid=-1; +static int awarditemid=-1; +static char awardpet[32]; +static char awarditem[32]; +int autopkstart=0; +int autopkcnt=0; +int autopktype = 0; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_TIMEFLAG = CHAR_NPCWORKINT9, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +enum { + NPC_AUTOPK_START, + NPC_AUTOPK_SELECT, + NPC_AUTOPK_JOINPK, + NPC_AUTOPK_PKLIST, + NPC_AUTOPK_PKAWARD, + NPC_AUTOPK_HISTORY, + NPC_AUTOPK_OK, + NPC_AUTOPK_END, +}; +#define STANDBYTIME 50 + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select); +BOOL AutoPk_GetHistoryStr( char *token, int page ); +void AutoPk_PKNum( char *token ); +BOOL AutoPk_AddItem( int charindex, int index ); +BOOL AutoPk_AddPet( int charindex, int index ); + +BOOL NPC_AutoPkInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + +// CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + award[0].draw=0; + award[1].draw=0; + award[2].draw=0; + award[3].draw=0; + award[4].draw=0; + award[5].draw=0; + award[6].draw=0; + award[7].draw=0; + award[8].draw=0; + award[9].draw=0; + + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_AutoPkTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_AutoPkWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + char jiangbuf[256]; + memset(jiangbuf, 0, sizeof(jiangbuf)); + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_AUTOPK_START: + break; + case NPC_AUTOPK_SELECT: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_AUTOPK_JOINPK: + if(autopktime>2 +#ifdef _JOB_AUTOPK + && CHAR_getInt( talkerindex, PROFESSION_CLASS ) == jobautopk +#endif + ){ + char buf1[128]; + char buf2[255]; + int i; + if(CHAR_getInt(talkerindex,CHAR_LV)0){ + AutoPk_PKSystemTalk(jiangbuf,jiangbuf); + } +// if(!strcmp(ship[3].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[3].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[3].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDPET; +// if((award[3].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 3 )) +// award[3].draw=award[3].draw|AWARDITEM; +// }else if(!strcmp(ship[4].cdkey, CHAR_getChar( talkerindex, CHAR_CDKEY)) +// && !strcmp(ship[4].name, CHAR_getChar( talkerindex, CHAR_NAME))){ +// if((award[4].draw&AWARDPET)!=AWARDPET) +// if(AutoPk_AddPet( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDPET; +// if((award[4].draw&AWARDITEM)!=AWARDITEM) +// if(AutoPk_AddItem( talkerindex, 4 )) +// award[4].draw=award[4].draw|AWARDITEM; +// } + break; + case NPC_AUTOPK_HISTORY: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_HISTORY_PREV, atoi( data)); + return; + } + break; + case NPC_AUTOPK_OK: + break; + case NPC_AUTOPK_END: + NPC_AutoPk_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } +} + +static void NPC_AutoPk_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token, "3\n񶷣УԱ\n\n" + "ʲôҪΪء\n" + "Ҫμӱ\n" + "鿴ѡ֡\n" + "ȡƷ\n" + "ʷ¼\n" + "ۿ"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_SELECT; + break; + case WINDOW_SELECT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(select==1){ + if(autopktime>2){ + sprintf(token, " 񶷣УԱ\n\n" + "ǰʼʱ仹ʣ%dӣһ׼",autopktime); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_AUTOPK_JOINPK; + }else if(autopktime>0){ + sprintf(token, "񶷣УԱ\n\n" + "PK%dӺʼ!\n޷أ\n\nPS޷볡أ볡硣",autopktime); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + }else{ + sprintf(token, " 񶷣УԱ\n\n" + "ĿǰδٰУ˱\n עУ˱Ϣ\n עٷ̳\n www.waei.cc \n\n PS޷볡"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else if(select==2){ + sprintf(token, "񶷣У\n"); + strcat(token, "תȼҡ\n"); + AutoPk_PKNum(token); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKLIST; + }else if(select==3){ + AutoPk_GetAwardStr(); + char buff[64]; + sprintf(token, "񶷣УƷȡ\nʤڱȡ\n\n");; +// if(strlen(award[0].awardpet)>0) +// sprintf(buff, "ھ%s\n", award[0].awardpet); +// else +// sprintf(buff, "ھ\n"); +// strcat(token, buff); + if(strlen(award[0].awarditem)>0) + sprintf(buff, " %s\n", award[0].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[1].awardpet)>0) +// sprintf(buff, "Ǿ%s\n", award[1].awardpet); +// else +// sprintf(buff, "Ǿ\n"); +// strcat(token, buff); + if(strlen(award[1].awarditem)>0) + sprintf(buff, " %s\n", award[1].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); +// if(strlen(award[2].awardpet)>0) +// sprintf(buff, "%s\n", award[2].awardpet); +// else +// sprintf(buff, "\n"); +// strcat(token, buff); + if(strlen(award[2].awarditem)>0) + sprintf(buff, " %s\n", award[2].awarditem); + else + sprintf(buff, " \n"); + strcat(token, buff); + strcat(token,"\nΰɱ㣬ɱҪѸŶ"); +// if(strlen(award[3].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[3].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[3].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[3].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); +// if(strlen(award[4].awardpet)>0) +// sprintf(buff, "ʤ%s\n", award[4].awardpet); +// else +// sprintf(buff, "ʤ\n"); +// strcat(token, buff); +// if(strlen(award[4].awarditem)>0) +// sprintf(buff, "ʤƷ%s\n", award[4].awarditem); +// else +// sprintf(buff, "ʤƷ\n"); +// strcat(token, buff); + if(baward && (!strcmp(ship[0].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[0].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[0].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[1].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[1].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[1].draw&AWARDITEM)!=AWARDITEM) + || (!strcmp(ship[2].cdkey, CHAR_getChar( toindex, CHAR_CDKEY)) + && !strcmp(ship[2].name, CHAR_getChar( toindex, CHAR_NAME)) + && (award[2].draw&AWARDITEM)!=AWARDITEM) && autopktype == 0) + buttontype = WINDOW_BUTTONTYPE_YESNO; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_AUTOPK_PKAWARD; + }else if(select==4){ + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + }else if(select==5){ + CHAR_talkToCli( toindex, -1, "[ʾ]ʼ뵽ҽԺ<Զ̹սԱ>鿴Ŷ", CHAR_COLORRED ); + return; + } + break; + case WINDOW_HISTORY_NEXT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE))) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_HISTORY_PREV: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<1)CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE,1); + if(AutoPk_GetHistoryStr(token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) || CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_AUTOPK_HISTORY; + break; + case WINDOW_END: + return; + break; + } + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_AutoPkLoop( void ) +{ +} + +BOOL AutoPk_GetHistoryStr( char *token, int page ) +{ + FILE* fp; + fp = fopen("./data/autopk/autopkhistory.txt", "r"); + if (fp == NULL) + { + print("鿴ʷļ򿪴\n"); + return FALSE; + } + typedef struct taghistory + { + char winnum[5]; + char name[CHARNAMELEN]; + }History; + History history[5]; + + char hstime[5],line[255],buf[255]; + int i; + for(i=0;i0){ + char buf1[64]; + char buf2[128]; + char qfgonggao[256]; +#ifdef _YUANGUSA + sprintf(qfgonggao,"[Ѷ]PK[%d]ӺУμ·%s",autopktime,getGameservername()); + system_all_talk(qfgonggao); + sprintf(buf1, "μӽPKʱ仹ʣ%dӣǰ볡",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"μӽPKʱ仹ʣ%dӣǰ볡αƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "PKʱ仹ʣ%dӣǰ볡",autopktime); +#else + sprintf(buf1, "ֹμPKʱ仹ʣ%dӣ",autopktime); + if(awardpetid!=-1 && awarditemid==-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%s",autopktime-2,awardpetid,awardpet); + else if(awardpetid==-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,Ʒ:%s",autopktime-2,awarditemid,awarditem); + else if(awardpetid!=-1 && awarditemid!=-1) + sprintf(buf2,"ֹμPKʱ仹ʣ%dӣαƷΪ::%d,:%sͱ:%d,Ʒ:%s",autopktime-2,awardpetid,awardpet,awarditemid,awarditem); + else + sprintf(buf2, "ʽPKʱ仹ʣ%dӣ",autopktime); +#endif + AutoPk_PKSystemTalk(buf1, buf2); + }else if(autopktime==0){ + int i,charaindex,num=0; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=getAutoPkMinNum())break; + } + } + if(num>=getAutoPkMinNum()){ + AutoPk_PKSystemTalk("ʽʼ","ʽʼ"); + AutoPk_PKSystemStart(); + autopkstart=1; + autopkcnt = 0; + autopktime--; + autopktype = 1; + }else{ + i = 0; + for(i=0;i0){ + awardpetid=petid; + strcpy(awardpet,pet); + }else{ + awardpetid=-1; + } + if(itemid>0){ + awarditemid=itemid; + strcpy(awarditem,item); + }else{ + awarditemid=-1; + } +} + +#ifdef _NONUM_AUTOPK +void AutoPk_ChampionShipSet( char *cdkey, char *name,int winnum, int win ) +{ + strcpy(ship[win].cdkey, cdkey); + strcpy(ship[win].name, name); + ship[win].winnum=winnum; +} +#else +void AutoPk_ChampionShipSet( char *cdkey, char *name, int winnum, int win ) +{ + if(win==0){ + char token[64]; + if(winnum>ship[0].winnum){ + sprintf( token, "[ս]%sĿǰһɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[0].cdkey,cdkey) && strstr(ship[0].name,name)){ + ship[0].winnum=winnum; + }else if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=ship[0].winnum; + strcpy(ship[1].cdkey, ship[0].cdkey); + strcpy(ship[1].name, ship[0].name); + ship[0].winnum=winnum; + strcpy(ship[0].cdkey, cdkey); + strcpy(ship[0].name, name); + } + }else if(winnum>ship[1].winnum){ + sprintf( token, "[ս]%sĿǰڶɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + if(strstr(ship[1].cdkey,cdkey) && strstr(ship[1].name,name)){ + ship[1].winnum=winnum; + }else{ + ship[2].winnum=ship[1].winnum; + strcpy(ship[2].cdkey, ship[1].cdkey); + strcpy(ship[2].name, ship[1].name); + ship[1].winnum=winnum; + strcpy(ship[1].cdkey, cdkey); + strcpy(ship[1].name, name); + } + }else if(winnum>ship[2].winnum){ + sprintf( token, "[ս]%sĿǰɱ%d", name, winnum); + AutoPk_PKSystemTalk(token,token); + ship[2].winnum=winnum; + strcpy(ship[2].cdkey, cdkey); + strcpy(ship[2].name, name); + } + }else if(win==1){ + ship[3].winnum=winnum; + strcpy(ship[3].cdkey, cdkey); + strcpy(ship[3].name, name); + }else if(win==2){ + ship[4].winnum=winnum; + strcpy(ship[4].cdkey, cdkey); + strcpy(ship[4].name, name); + } +} +#endif + + +void AutoPk_GetChampionShip( void ) +{ + char token[64]; + if(strlen(ship[0].cdkey)>0){ + sprintf( token, "[]񶷴ھߡ%s", ship[0].name); + AutoPk_PKSystemTalk(token,token); + AutoPk_PKTimeSetOnly(-1); + autopkstart=0; + } + if(strlen(ship[1].cdkey)>0){ + sprintf( token, "[]񶷴Ǿߡ%s", ship[1].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[2].cdkey)>0){ + sprintf( token, "[]񶷴ߡ%s", ship[2].name); + AutoPk_PKSystemTalk(token,token); + } + if(strlen(ship[3].cdkey)>0 && strlen(ship[4].cdkey)>0){ + //sprintf( token, "ϲ%s%sñPKĺ͵", ship[3].name,ship[4].name); + //AutoPk_PKSystemTalk(token,token); + } + autopktype = 0; + AutoPk_SetHistoryStr(); + + + + baward = TRUE; +} + +BOOL AutoPk_AddItem( int charindex, int index ) +{ + char msgbuf[64]; + int ret; + int spaceNum=5,i,itemindex=-1; + itemindex = CHAR_findEmptyItemBox( charindex ); + if( itemindex < 0 ) { + CHAR_talkToCli( charindex, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( award[index].awarditemid ); + if(itemindex == -1) + return FALSE; + ret = CHAR_addItemSpecificItemIndex( charindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex ); + print ("\n ret error!!"); + return FALSE; + } + sprintf( msgbuf,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( charindex, ret); + return TRUE; +} + +BOOL AutoPk_AddPet( int charindex, int index) +{ + int ret; + char msgbuf[64]; + int enemynum; + int i,j; + int petindex, petindex2; + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( charindex, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == award[index].awardpetid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( charindex, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( charindex, i ) == ret ) + break; + } + + petindex2 = CHAR_getCharPet(charindex, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( charindex, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_setInt(petindex2,CHAR_VARIABLEAI,10000); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(charindex, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( charindex, msgbuf ); + } + return TRUE; +} + +void NPC_AUTOPKHealerTalked( int meindex ) +{ + if( CHAR_getInt( meindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + if( (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt( meindex, CHAR_WORKPARTYMODE) == 2) ) + { + + NPC_HealerAllHeal( meindex); + CHAR_talkToCli( meindex, -1,"ϲʤȴֱȫظ",CHAR_COLORYELLOW); + }else{ + int i = 0; + int otherindex; + + for( i=0 ; i < CHAR_PARTYMAX ; i++) + { + otherindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1 + i); + if(otherindex != -1){ + + NPC_HealerAllHeal( otherindex); + CHAR_talkToCli( otherindex, -1,"ϲʤȫظ",CHAR_COLORYELLOW); + } + } + } +} + +BOOL AutoPk_GetAwardStr( void ) +{ + FILE* fp; + int i=0; + int j=0; + int enemynum = ENEMY_getEnemyNum(); + fp = fopen("./data/autopk/autopkaward.txt", "r"); + if (fp == NULL) + { + print("鿴Ʒļ򿪴\n"); + return FALSE; + } + for(i=0;i<5;i++){ + char line[64],buf[32]; + if (fgets(line, sizeof(line), fp) == NULL)break; + chop(line); + getStringFromIndexWithDelim(line,"|", 1, buf, sizeof(buf)); + award[i].awardpetid=atoi(buf); + if(award[i].awardpetid!=-1){ + for( j=0; j 0 && award[i].awarditemid <= getItemnum() ){ + strcpy(award[i].awarditem,ITEM_getNameFromNumber(award[i].awarditemid)); + } + else{ + strcpy(award[i].awarditem, "\0"); + award[i].draw=AWARDNO; + } + } + fclose(fp); + return TRUE; +} + +void AutoPk_SetAwardStr( char *token ) +{ + FILE* fp; + int i=0; + fp = fopen("./data/autopk/autopkaward.txt", "w"); + fwrite(token, strlen(token), 1, fp); + fclose(fp); +} + +void AutoPk_PKSystemStart( void ) +{ + int i,charaindex,num=0; + int pkindex[1000],pktype[1000]; + int playernum=CHAR_getPlayerMaxNum(); + for(i=0;i=2){ + if(num%2==0){ + int j = num-1; + i=0; + for(i=0;i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_bankman.h" +#include "family.h" + +extern int familyNumTotal; +extern char familyListBuf[MAXFAMILYLIST]; + +char sendbuf[1024]; +char buf[1024]; +char subbuf[128]; +int i, j; + + +struct { + int windowno; + int windowtype; + int buttontype; + int takeitem; + int giveitem; + char message[4096]; +}w; + +struct { + BOOL use; + int checkhaveitem; + int checkhaveitemgotowin; + int checkdonthaveitem; + int checkdonthaveitemgotowin; + int warp; + int battle; + int gotowin; +}buttonproc[13]; /* ok,cancel, yes,no,prev,next ݼ */ + + + + + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; +static void NPC_Bankman_selectWindow( int meindex, int toindex, int num); +static BOOL NPC_Bankman_readData( int meindex, int windowno, BOOL chkflg); +static int NPC_Bankman_restoreButtontype( char *data ); + +BOOL NPC_BankmanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf))== NULL ){ + print( "familyman:ûָ趨ĵ \n"); + return FALSE; + } + /* ݱɬ÷ëƻ֧ */ + if( !NPC_Bankman_readData( meindex, -1, TRUE) ) { + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); + + return TRUE; +} + +void NPC_BankmanTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + NPC_Bankman_selectWindow( meindex, talkerindex, 1 ); + +} + +void NPC_BankmanLooked( int meindex , int lookedindex) +{ + + print(" Look:me:%d,looked:%d ",meindex,lookedindex); + NPC_Bankman_selectWindow( meindex, lookedindex,1 ); + +} + +static void NPC_Bankman_selectWindow( int meindex, int toindex, int num) +{ + + int fd; + char buf[256]; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* */ + if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; + + if( !NPC_Bankman_readData( meindex, num, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + + fd = getfdFromCharaIndex( toindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } +} + +void NPC_BankmanWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) + +{ + + int button = -1; + char buf[2048], buff[256]; + + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + /* ū įë */ + if( !NPC_Bankman_readData( meindex, seqno - 100, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + /* ʾëƩ */ + if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { + //if( w.windowtype == WINDOW_MESSAGETYPE_MESSAGE ) { + // shan end + button = atoi( data)+5; + if( button > 12 ) { + print( "familyman:invalid button[%d]\n", button); + return; + } + } + else if( select & WINDOW_BUTTONTYPE_OK) button = 0; + else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; + else if( select & WINDOW_BUTTONTYPE_YES) button = 2; + else if( select & WINDOW_BUTTONTYPE_NO) button = 3; + else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; + else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; + else { + print( "familyman:invalid button[%d]\n", select); + return; + } + // shan begin + //if( buttonproc[button].use == TRUE ) { + //if( select > 0) { + if( button > 0 ) { + // shan end + int fd; + int newwin = -1; + + fd = getfdFromCharaIndex( talkerindex); + + /* ʾ巽Ȼ ëԻ */ + if( newwin == -1 ) { + newwin = buttonproc[button].gotowin; + } + + // Robin + // + // shan begin + if( select == WINDOW_BUTTONTYPE_YES) { + newwin = 5; + } + // shan end + if( newwin == 5 ) { + if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) < 1 && + CHAR_getInt( talkerindex, CHAR_BANKGOLD) < 1 ) + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nʸ񲻷ϣ" + "\nȼ壡", buff, sizeof(buff))); + else { + sprintf(buf, "B|G|%d", CHAR_getInt( talkerindex, CHAR_BANKGOLD) ); + lssproto_FM_send( fd, buf ); + } + return; + } + // ʻ + if( newwin == 6 ) + { + if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) > 0 ) + saacproto_ACGetFMData_send( acfd, CHAR_getChar( talkerindex, CHAR_FMNAME), + CHAR_getInt( talkerindex, CHAR_FMINDEX ), + CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI ), + 1, + CONNECT_getFdid(fd) + ); + else + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nʸ񲻷ϣ" + "\nȼ壡", buff, sizeof(buff))); + return; + } + // ˳ + if( newwin == 7 ) + { + if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) == -1 ) { + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nʸ񲻷ϣ" + "\nȼ壡", buff, sizeof(buff))); + return; + } + + print(" WN2FM "); + FAMILY_Leave( fd, talkerindex, "E|1"); + + return; + } + + if( !NPC_Bankman_readData( meindex, newwin, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } + + + + } +} + +static BOOL NPC_Bankman_readData( int meindex, int windowno, BOOL chkflg) +{ + + int i; + int linenum = 0; + int endflg = FALSE; + int buttonendflg; + int winno = -1; + int buttonconfmode; + int b_mode; + int selectnum ; + int messagepos; + BOOL errflg = FALSE; + BOOL readflg = TRUE; + FILE *fp; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char filename[64]; + char opfile[128]; + char line[1024]; + char firstToken[1024]; + char secondToken[1024]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + NPC_Util_GetStrFromStrWithDelim( argstr, "conff", filename, sizeof( filename)); + sprintf( opfile, "%s/", getNpcdir( ) ); + strcat( opfile, filename); + fp = fopen( opfile, "r"); + if( fp == NULL ) { + print( "familyman:file open error [%s]\n", opfile); + return FALSE; + } + + while( readflg == TRUE ) { + endflg = FALSE; + buttonendflg = TRUE; + buttonconfmode = FALSE; + selectnum = 0; + messagepos = 0; + winno = -1; + b_mode = -1; + errflg = FALSE; + + /* */ + w.windowno = -1; + w.windowtype = -1; + w.buttontype = -1; + w.takeitem = -1; + w.giveitem = -1; + w.message[0] = '\0'; + + for( i = 0; i < arraysizeof( buttonproc); i ++ ) { + buttonproc[i].use = FALSE; + buttonproc[i].checkhaveitem = -1; + buttonproc[i].checkhaveitemgotowin = -1; + buttonproc[i].checkdonthaveitem = -1; + buttonproc[i].checkdonthaveitemgotowin = -1; + buttonproc[i].warp = -1; + buttonproc[i].battle = -1; + buttonproc[i].gotowin = -1; + } + + while( 1) { + char buf[256]; + int ret; + if( !fgets( line, sizeof( line), fp)){ + readflg = FALSE; + break; + } + + linenum ++; + + /* 춪 */ + if( line[0] == '#' || line[0] == '\n') continue; + /* ݱ */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) strcpy( line, buf); + + /* delim "=" ƥ (1)ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, + sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + /* delim "=" ƥ2 ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 2, secondToken, + sizeof( secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + + if( strcasecmp( firstToken, "winno") == 0 ) { + if( winno != -1 ) { + print( "familyman:winnoȴ¶winno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + readflg = FALSE; + break; + } + /* ūNoë */ + winno = atoi( secondToken); + continue; + } + /* ūNo Ȼئݼ淴 */ + if( winno == -1 ) { + print( "familyman:winno δ壬ȴ趨\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = FALSE; + break; + } + /* ūNo ݷë + * ľ½ */ + if( (chkflg == FALSE && winno == windowno )|| + chkflg == TRUE) + { + if( buttonconfmode == TRUE ) { + if( strcasecmp( firstToken, "gotowin") == 0 ) { + buttonproc[b_mode].gotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkhaveitem") == 0 ) { + buttonproc[b_mode].checkhaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "haveitemgotowin") == 0 ) { + buttonproc[b_mode].checkhaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkdonthaveitem") == 0 ) { + buttonproc[b_mode].checkdonthaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "donthaveitemgotowin") == 0 ) { + buttonproc[b_mode].checkdonthaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "endbutton") == 0 ) { + if( buttonproc[b_mode].gotowin == - 1 ) { + if( buttonproc[b_mode].checkhaveitem == -1 && + buttonproc[b_mode].checkdonthaveitem == -1) + { + errflg = TRUE; + } + else { + /* оȵƥɬýľľ */ + if( !((buttonproc[b_mode].checkhaveitem != -1 && + buttonproc[b_mode].checkhaveitemgotowin != -1) + || (buttonproc[b_mode].checkdonthaveitem != -1 && + buttonproc[b_mode].checkdonthaveitemgotowin != -1))) + { + errflg = TRUE; + } + } + } + + if( errflg == TRUE) { + print( "familyman: Ҳgotowin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = TRUE; + break; + } + buttonproc[b_mode].use = TRUE; + buttonconfmode = FALSE; + buttonendflg = TRUE; + } + } + else { + + w.windowno = winno; + /* ūɬ */ + if( strcasecmp( firstToken, "wintype") == 0 ) { + w.windowtype = atoi( secondToken); + } + /* ʾɬ */ + else if( strcasecmp( firstToken, "buttontype") == 0 ) { + w.buttontype = NPC_Bankman_restoreButtontype( secondToken); + } + /* getitemɬ */ + else if( strcasecmp( firstToken, "takeitem") == 0 ) { + w.takeitem = atoi( secondToken); + } + /* giveitemɬ */ + else if( strcasecmp( firstToken, "giveitem") == 0 ) { + w.giveitem = atoi( secondToken); + } + /* messageɬ */ + else if( strcasecmp( firstToken, "message") == 0 ) { + if( messagepos == 0 ) { + strcpy( w.message, secondToken); + messagepos = strlen( w.message); + } + else { + w.message[messagepos]='\n'; + messagepos++; + strcpy( &w.message[messagepos], secondToken); + messagepos+=strlen(secondToken); + } + } + /* ʾëݼɬ */ + else if( strcasecmp( firstToken, "okpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 0; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "cancelpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 1; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "yespressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 2; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nopressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 3; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "prevpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 4; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nextpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 5; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "selected") == 0 ) { + buttonconfmode = TRUE; + b_mode = 6 + selectnum; + buttonendflg = FALSE; + selectnum ++; + } + /* ɬñδԻ */ + else if( strcasecmp( firstToken, "endwin") == 0 ) { + endflg = TRUE; + if( chkflg == FALSE) { + readflg = FALSE; + } + break; + } + else { + print( "familyman:趨DzܵIJ\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + } + } + } + else { + if( strcasecmp( firstToken, "endwin") == 0 ) { + winno = -1; + } + } + } + if( buttonendflg == FALSE) { + print( "familyman: Ҳendbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( winno != -1 ) { + if( w.windowtype == -1 ) { + print( "familyman: Ҳwintype\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( w.buttontype == -1 ) { + print( "familyman: Ҳbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( strlen( w.message) == 0 ) { + print( "familyman: Ҳmessage\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + } + } + fclose( fp); + + if( chkflg == FALSE && w.windowno == -1 ) { + print( "familyman: Ҳָwindowno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( winno != -1 && endflg == FALSE) { + print( "familyman: Ҳendwin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( errflg == TRUE) return FALSE; + + return TRUE; +} +/* + * buttontype=ƥ϶ ٯ ëѰ £ + * + */ +static int NPC_Bankman_restoreButtontype( char *data ) +{ + int ret = 0; + int rc; + int i; + char buff[1024]; + + for( i = 1; ; i ++ ) { + rc = getStringFromIndexWithDelim( data, "|", i, buff, + sizeof( buff ) ); + if( rc == FALSE) break; + if( strcasecmp( buff, "ok") == 0 ) { + ret |= WINDOW_BUTTONTYPE_OK; + } + else if( strcasecmp( buff, "cancel") == 0 ) { + ret |= WINDOW_BUTTONTYPE_CANCEL; + } + else if( strcasecmp( buff, "yes") == 0 ) { + ret |= WINDOW_BUTTONTYPE_YES; + } + else if( strcasecmp( buff, "no") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NO; + } + else if( strcasecmp( buff, "prev") == 0 ) { + ret |= WINDOW_BUTTONTYPE_PREV; + } + else if( strcasecmp( buff, "next") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NEXT; + } + } + if( ret == 0 ) { + ret = atoi( data); + } + return ret; +} diff --git a/npc/npc_bigsmallmaster.c b/npc/npc_bigsmallmaster.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_bigsmallpet.c b/npc/npc_bigsmallpet.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_blackmarket.c b/npc/npc_blackmarket.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_bodylan.c b/npc/npc_bodylan.c new file mode 100644 index 0000000..db1fb72 --- /dev/null +++ b/npc/npc_bodylan.c @@ -0,0 +1,487 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_windowhealer.h" + + + + +/* + *ʾū¼ءë ɱNPC + * ƾľգ + * NPCINDEXë£ + * + *ȣNPCԻƥʧؤգʧëڳ + *NPCINDEXë ƻ¾ + * ئݷʧˡ + *жʧëƻëʧ£ + *ʧ ˡ ئ϶ü߷ + * + */ + +enum { + BODYLAN_E_COMMANDNUM = CHAR_NPCWORKINT1, // ѨӮ +}; + + +// ̼ƹ +enum{ + BODYLAN_WIN_FIRST, + BODYLAN_WIN_LAST_GOOD, + BODYLAN_WIN_LAST_NG, + BODYLAN_WIN_GOOD_NO, + BODYLAN_WIN_ALREADY, + BODYLAN_WIN_NOT_PREEVENT, + BODYLAN_WIN_END +}; + +static void NPC_BodyLan_Profit( int meindex, int playerindex ); + +static void NPC_BodyLan_Window( + int meindex, + int talkerindex, + int mode +); + + +/********************************* +* +*********************************/ +BOOL NPC_BodyLanInit( int meindex ) +{ + + char szP[256], szArg[4096]; + char buf[256]; + int i, needSeq; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEEVENT ); + + if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){ + print( "npc_bodylan.c:û(%s)\n", + CHAR_getChar(meindex,CHAR_NPCARGUMENT) ); + return FALSE; + } + + + // ˡë + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Act", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:δ趨(%s)\n", szArg ); + return FALSE; + } + + for( i = 0 ; ; i ++ ){ + // ۢئ + if( getStringFromIndexWithDelim( szP, ",", i, buf, sizeof( buf)) != FALSE ){ + needSeq = atoi(buf); + // Ѩ̹ϵ ճƥ + if( needSeq < 0 ){ + if( i <= 0 ){ + print( "npc_bodylan:δ趨(%s)\n", szArg ); + } + // ë + CHAR_setWorkInt( meindex, BODYLAN_E_COMMANDNUM, i ); + break; + }else{ + // ƻ + } + }else{ + if( i <= 0 ){ + print( "npc_bodylan:δ趨(%s)\n", szArg ); + } + // ë + CHAR_setWorkInt( meindex, BODYLAN_E_COMMANDNUM, i ); + break; + } + } + + + + return TRUE; + +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_BodyLanTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + char szP[256], szArg[4096]; + int EventNo = -1,Pre_Event = -1; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2 ) + { + return; + } + + // ¦ ٯ + if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){ + print( "npc_bodylan.c:û(%s)\n", + CHAR_getChar(meindex,CHAR_NPCARGUMENT) ); + return ; + }else{ + // ì į + if( NPC_Util_GetStrFromStrWithDelim( szArg, "EventNo", szP, sizeof( szP ) ) != NULL ){ + EventNo = atoi(szP); + } + // ۢì į + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Pre_Event", szP, sizeof( szP ) ) != NULL ){ + Pre_Event = atoi(szP); + } + } + + // ۢì įؤľ + if( Pre_Event >= 0 ){ + // ì帲ƻƻ¾ + if( NPC_EventCheckFlg( talkerindex, Pre_Event ) == FALSE ){ + // ۢìëʧƻئճ𼰱 + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_NOT_PREEVENT ); + return; + } + } + // ì įؤľ + if( EventNo >= 0 ){ + // ì帲ƻƻ¾ + if( NPC_EventCheckFlg( talkerindex, EventNo ) == TRUE ){ + // Ȼճ𼰱 + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_ALREADY ); + return; + } + } + + // ԳȻ׾ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKTRADER ) == meindex ){ + + // ձѨ ƻ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT ) + >= CHAR_getWorkInt( meindex, BODYLAN_E_COMMANDNUM ) + ){ + // + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_LAST_GOOD ); + return; + }else{ + // + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_LAST_NG ); + return; + } + }else{ + // ٻئƥ + // м̼͵ë + CHAR_setWorkInt( talkerindex, CHAR_WORKTRADER, meindex ); + // ˡ پձ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1 ); + + // ˱羮微ئؤ + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_FIRST ); + return; + } +} + + +/*======================================= + * watch + *======================================*/ +void NPC_BodyLanWatch( + int objmeindex, + int objmoveindex, + CHAR_ACTION act, + int x, + int y, + int dir, + int* opt, + int optlen +) +{ + char szP[256], szArg[4096]; + char buf[256]; + int actindex; + int meindex; + int seqNo, needSeq; + + // ƽҷ½ + if( OBJECT_getType(objmoveindex) != OBJTYPE_CHARA ) return; + actindex = OBJECT_getIndex(objmoveindex); + // ½ + if( CHAR_getInt( actindex, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + // м̼͵ + meindex = OBJECT_getIndex(objmeindex); + + // мINDEXë ƻ¾ئľ + if( CHAR_getWorkInt( actindex, CHAR_WORKTRADER ) != meindex ){ + return; + } + + // ƥʧëƻ¾ + seqNo = CHAR_getWorkInt( actindex, CHAR_WORKSHOPRELEVANT ); + // ئ پ + if( seqNo < 1 )seqNo = 1; + + // ¦ ٯ + if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){ + print( "npc_bodylan.c:û(%s)\n", + CHAR_getChar(meindex,CHAR_NPCARGUMENT) ); + return ; + } + + + // ˡë + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Act", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:δ趨(%s)\n", szArg ); + return; + } + + // ۢئ + if(getStringFromIndexWithDelim( szP, ",", seqNo, buf, sizeof( buf)) != FALSE ){ + needSeq = atoi(buf); + }else{ + // ئ⾮ئ پ + CHAR_setWorkInt( actindex, CHAR_WORKSHOPRELEVANT, 1 ); + +// print( "ͷˡص\n", seqNo, needSeq ); + // Ͼ微 + return; + } + + // ۢئʧ + if( needSeq == act ){ + // ף۳ľ +// print( "ɹ\(%d%d)\n", seqNo, needSeq ); + seqNo ++; + if( seqNo >= CHAR_getWorkInt( meindex, BODYLAN_E_COMMANDNUM ) ){ +// print( "ڴ˽\n" ); + } + // ë + CHAR_setWorkInt( actindex, CHAR_WORKSHOPRELEVANT, seqNo ); + }else{ + // پ֧Ի + CHAR_setWorkInt( actindex, CHAR_WORKSHOPRELEVANT, 1 ); +// print( "(%d%d)\n", seqNo, needSeq ); + } + +} + + + +//********* ݼ ********* +static void NPC_BodyLan_Profit( int meindex, int playerindex ) +{ + char szArg[4096], szP[256]; + int fl, x, y, pmode, i, subindex, parent; + + // ¦ ٯ + if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){ + print( "npc_bodylan.c:û(%s)\n", + CHAR_getChar(meindex,CHAR_NPCARGUMENT) ); + return ; + } + + //********************************************* + // + // ۷ɬ + // + //********************************************* + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Warp", szP, sizeof( szP ) ) != NULL ){ + // 工 + if( sscanf( szP, "%d,%d,%d", &fl, &x, &y ) == 3 ){ + }else{ + print( "npc_bodylan: ޷ȡռ(%s)\n", szP ); + return; + } + // ɡ ū׬ƥҼַ + pmode = CHAR_getWorkInt( playerindex, CHAR_WORKPARTYMODE ); + switch( pmode ){ + case 1: // л + parent = playerindex; + break; + case 2: // лҼë + parent = CHAR_getWorkInt( playerindex, CHAR_WORKPARTYINDEX1 ); + break; + default: + // ɡ ūԪئף۷з귥 + CHAR_warpToSpecificPoint( playerindex, fl, x, y ); + return; + } + // 幻 + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + subindex = CHAR_getWorkInt( parent, CHAR_WORKPARTYINDEX1+i ); + if( CHAR_CHECKINDEX( subindex ) == FALSE )continue; + // ɡ ū幻 + CHAR_warpToSpecificPoint( subindex, fl, x, y ); + } + } + + + +} + +#if 1 +static void NPC_BodyLan_Window( + int meindex, + int talkerindex, + int mode +) +{ + char token[1024]; + char escapedname[2048]; + char szArg[4096]; + char szP[256]; + int fd; + int buttontype = 0, windowtype = 0, windowno = 0; + + if( CHAR_CHECKINDEX( talkerindex ) == FALSE )return; + fd = getfdFromCharaIndex( talkerindex ); + + // ¦ ٯ + if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){ + print( "npc_bodylan.c:û(%s)\n", + CHAR_getChar(meindex,CHAR_NPCARGUMENT) ); + return ; + } + + szP[0] = 0; + + switch( mode ){ + case BODYLAN_WIN_FIRST: + // ٱ ľ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "First", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:һʼû(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_YES|WINDOW_BUTTONTYPE_NO; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + + case BODYLAN_WIN_LAST_GOOD: + // ƥݩ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Good", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:ʱ˵û(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_YESNO;// YES|NO + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + + case BODYLAN_WIN_LAST_NG: + // ƥݩ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Ng", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:ʱ˵û(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_OK;// OK + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + + case BODYLAN_WIN_GOOD_NO: + // ݩݱ ëƽҼ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Good_No", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:ʱȡƷû(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_OK;// OK + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + + case BODYLAN_WIN_ALREADY: + // ƥìë ƻ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Good_No", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:¼ʱû(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_OK; // OK + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + + case BODYLAN_WIN_NOT_PREEVENT: + // ۢئìëئƻئ + if( NPC_Util_GetStrFromStrWithDelim( szArg, "Pre_Not", szP, sizeof( szP ) ) == NULL ){ + print( "npc_bodylan:?ǰ¼û(%s)\n", szArg ); + return; + } + sprintf( token,"%s", szP ); + buttontype=WINDOW_BUTTONTYPE_OK; // OK + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=mode; + break; + default: + return; + } + + makeEscapeString( token, escapedname, sizeof(escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + escapedname); + + +} + + + +/*----------------------------------------- +ͷʧ߯Ȼݱ̫ľ£ +-------------------------------------------*/ +void NPC_BodyLanWindowTalked( + int meindex, + int talkerindex, + int seqno, + int select, + char *data +) +{ + + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; + + switch( seqno){ + case BODYLAN_WIN_LAST_GOOD: // ݩݱOKɽľ + if(select==WINDOW_BUTTONTYPE_YES ){ + NPC_BodyLan_Profit( meindex, talkerindex ); + // м̼͵ë٨ľ + CHAR_setWorkInt( talkerindex, CHAR_WORKTRADER, -1 ); + // ˡ پձ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1 ); + }else + if( select == WINDOW_BUTTONTYPE_NO ){ + // ݩݱƽҼľ + NPC_BodyLan_Window( meindex, talkerindex, BODYLAN_WIN_GOOD_NO ); + // м̼͵ë٨ľ + CHAR_setWorkInt( talkerindex, CHAR_WORKTRADER, -1 ); + // ˡ پձ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1 ); + } + break; + default: + break; + } + +} + + + +#endif + diff --git a/npc/npc_bus.c b/npc/npc_bus.c new file mode 100644 index 0000000..553002c --- /dev/null +++ b/npc/npc_bus.c @@ -0,0 +1,731 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_bus.h" +#include "handletime.h" + +/* + * ﵩئëNPC + */ + +enum { + NPC_WORK_ROUTETOX = CHAR_NPCWORKINT1, /* ߣ */ + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, /* ߣ */ + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, /* */ + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, /* 微Ի ߡ ࡰԻ */ + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +}; + +/* ⼰enum */ +enum { + NPC_BUS_MSG_GETTINGON, + NPC_BUS_MSG_NOTPARTY, + NPC_BUS_MSG_OVERPARTY, + NPC_BUS_MSG_DENIEDITEM, + NPC_BUS_MSG_ALLOWITEM, + NPC_BUS_MSG_LEVEL, + NPC_BUS_MSG_GOLD, + NPC_BUS_MSG_EVENT, + NPC_BUS_MSG_START, + NPC_BUS_MSG_END, +}; +typedef struct { + char option[32]; + char defaultmsg[128]; +}NPC_BUS_MSG; +NPC_BUS_MSG busmsg[] = { + { "msg_gettingon", "PAON޷;ࡣ"}, + { "msg_notparty", "PAPAON޷ŶӼࡣ"}, + { "msg_overparty", "PAON"}, + { "msg_denieditem", "PAPAONҿɲҪߣ"}, + { "msg_allowitem", "~(ҪǸ߰!)"}, + { "msglevel", "PAPAONĵȼࡣ"}, + { "msg_stone", "PAPAONǮࡣ"}, + { "msg_event", "PAON޷ࡣ"}, + { "msg_start", "~()"}, + { "msg_end", "~()"} + +}; + +static int NPC_BusSetPoint( int meindex, char *argstr); +static void NPC_BusSetDestPoint( int meindex, char *argstr); +static BOOL NPC_BusCheckDeniedItem( int meindex, int charaindex, char *argstr); +static BOOL NPC_BusCheckLevel( int meindex, int charaindex, char *argstr); +static int NPC_BusCheckStone( int meindex, int charaindex, char *argstr); +static void NPC_BusSendMsg( int meindex, int talkerindex, int tablenum); +static int NPC_BusGetRoutePointNum( int meindex, char *argstr ); +static void NPC_Bus_walk( int meindex); + +#define NPC_BUS_LOOPTIME 200 + +/* ޷ɻ */ +#define NPC_BUS_WAITTIME_DEFAULT 180 + +#define NPC_BUS_WAITINGMODE_WAITTIME 5000 + +/********************************* +* +*********************************/ +BOOL NPC_BusInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + int i; + char buf[256]; + int routenum; + int waittime; + int seflg; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + /* ئľئ¦Ѽ */ + routenum = NPC_Util_GetNumFromStrWithDelim( argstr, "routenum");//ʻ· + + if( routenum == -1 ) { + print( "npcbus:nothing routenum \n"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, routenum); + + for( i = 1; i <= routenum; i ++ ) { + char routetostring[64]; + snprintf( routetostring, sizeof( routetostring), "routeto%d", i); + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcbus:nothing route to \n"); + return FALSE; + } + + } + waittime = NPC_Util_GetNumFromStrWithDelim( argstr, "waittime"); + + if( waittime == -1 ) waittime = NPC_BUS_WAITTIME_DEFAULT; + CHAR_setWorkInt( meindex, NPC_WORK_WAITTIME, waittime); + + seflg = NPC_Util_GetNumFromStrWithDelim( argstr, "seflg"); + + if( seflg == -1 ) seflg = TRUE; + CHAR_setWorkInt( meindex, NPC_WORK_SEFLG, seflg); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEBUS ); + + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, 2); + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, 0); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, 0); + + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, + NPC_BUS_WAITINGMODE_WAITTIME); + + /* ػë */ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + + for( i = 0; i < CHAR_PARTYMAX; i ++) { + CHAR_setWorkInt( meindex, CHAR_WORKPARTYINDEX1 + i, -1); + } + + /* */ +{ + int rev; + int r = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEMAX); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, RAND( 1, r)); + //print( "route:%d\n",CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + /* Ƿ */ + rev = NPC_Util_GetNumFromStrWithDelim( argstr, "reverse"); + + if( rev == 1 ) { + int num = NPC_BusGetRoutePointNum( meindex, argstr); + + if( num <= 0 ) { + print( "npcbus:֣\n"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, num-1); + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, 1); + } + /* ë */ + NPC_BusSetPoint( meindex, argstr); + /* ë */ + NPC_BusSetDestPoint( meindex, argstr); +} + + return TRUE; +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_BusTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + int i; + int partyflg = FALSE; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* мɡ ū Ʃ */ + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX(index)){ + if( index == talkerindex) { + partyflg = TRUE; + } + } + } + if( !partyflg ) { + //NPC_BusCheckJoinParty( meindex, talkerindex, TRUE); + } + else { + if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) == 0 ) { + int i; + // #define NPC_BUS_DEBUGROUTINTG "routingtable:" + if( strstr( szMes, "" ) || + strstr( szMes, "" ) || + strstr( szMes, "Go" ) || + strstr( szMes, "go" )) + { + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_BUS_LOOPTIME); + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + 60, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_BusSendMsg( meindex, partyindex, NPC_BUS_MSG_START); + } + } + } + } + } +} +/************************************** + * + **************************************/ +void NPC_BusLoop( int meindex) +{ + int i; + switch( CHAR_getWorkInt( meindex, NPC_WORK_MODE )) { + case 0: + /* ƹݣë */ + /* ޻׼ƥ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + + CHAR_getWorkInt( meindex, NPC_WORK_WAITTIME) + < NowTime.tv_sec) + { + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + 60, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_BusSendMsg( meindex, partyindex, NPC_BUS_MSG_START); + } + } + + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_BUS_LOOPTIME); + } + return; + case 1: + /* */ + NPC_Bus_walk( meindex); + case 2: + /* Ȼƹ */ + /* ޻׼ƥ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + + (CHAR_getWorkInt( meindex, NPC_WORK_WAITTIME) /3) + < NowTime.tv_sec) + { + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + /* Ѽëʻպ */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NPC_BUS_LOOPTIME); + + } + return; + case 3: + /* ƻ֣ͷʧ мб + * Ƴƥëľ֧ + */ + if( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + 3 + < NowTime.tv_sec) + { + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + /* Ѽë */ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, + NPC_BUS_WAITINGMODE_WAITTIME); + + /* */ + { + int r = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEMAX); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, RAND( 1, r)); + //print( "route:%d\n",CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + } + /* Ի׷º */ + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, + CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP)^1); + + /* ݺ̼Ʃ */ + /* Ի */ + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP) == 1) { + /* κ̼ë */ + int num = NPC_BusGetRoutePointNum( meindex, argstr); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, num-1); + } + else { + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT) +1); + } + /* ݼ̼ ë */ + NPC_BusSetPoint( meindex, argstr); + /* ë */ + NPC_BusSetDestPoint( meindex, argstr); + /* ɡ ū ë */ + CHAR_DischargeParty( meindex, 0); + /* ػë */ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + /* ƹʧ */ + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + } + return; + default: + break; + } +} +/************************************** + * ʣ + **************************************/ +static void NPC_Bus_walk( int meindex) +{ + POINT start, end; + int dir; + int ret; + int i; + + /* */ + /* ݼ */ + start.x = CHAR_getInt( meindex, CHAR_X); + start.y = CHAR_getInt( meindex, CHAR_Y); + end.x = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOX); + end.y = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOY); + + /* ׼ƥݼ̼ */ + if( start.x == end.x && start.y == end.y ) { + int add = 1; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP ) == 1 ) { + add *= -1; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT) +add); + if( NPC_BusSetPoint( meindex, argstr) == FALSE ) { + /* */ + /* ƹ */ + CHAR_setWorkInt( meindex, NPC_WORK_MODE,3); + + /* SE Ѩƹ̫ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG )) { + CHAR_sendSEoArroundCharacter( + CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y), + 60, + TRUE); + } + /* ݼ*/ + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int partyindex = CHAR_getWorkInt( meindex, CHAR_WORKPARTYINDEX1+i); + if( CHAR_CHECKINDEX( partyindex)) { + NPC_BusSendMsg( meindex, partyindex, NPC_BUS_MSG_END); + } + } + /* ػë */ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return; + } + else { + return; + } + } + /*-------------------------------------------------------*/ + /* ھ */ + + /* ëƻ */ + dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + + /* ɡ ūƥ */ + end.x = CHAR_getInt( meindex, CHAR_X); + end.y = CHAR_getInt( meindex, CHAR_Y); + + /* Ⱦݼм */ + for( i = 0; i < 100; i ++ ) { + if( dir < 0 ) { + dir = RAND( 0,7); + } + dir = NPC_Util_SuberiWalk( meindex, dir); + if( dir >= 0 && dir <= 7) break; + } + + if( dir >= 0 && dir <= 7 ) { + /* */ + ret = CHAR_walk( meindex, dir, 0); + + if( ret == CHAR_WALKSUCCESSED ) { + /* лئëھ */ + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + int toindex = CHAR_getWorkInt( meindex, i + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(toindex) ) { + int parent_dir; + /* Ҽ ʼ󡼰 ëƻ */ + /* */ + start.x = CHAR_getInt( toindex, CHAR_X); + start.y = CHAR_getInt( toindex, CHAR_Y); + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + /* ·ūë ¿б + * ݼҷ󡼰Ҽ ëܰ + */ + end = start; + if( parent_dir != -1 ) { + CHAR_walk( toindex, parent_dir, 0); + } + } + } + } + } +} +/************************************** + * ݼë + **************************************/ +static int NPC_BusSetPoint( int meindex, char *argstr) +{ + char buf[4096]; + char buf2[256]; + char buf3[256]; + int ret; + char routetostring[64]; + + snprintf( routetostring, sizeof( routetostring), "routeto%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcbus:nothing route \n"); + return FALSE; + } + ret = getStringFromIndexWithDelim( buf, ";", + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT), + buf2, sizeof(buf2)); + + if( ret == FALSE ) return FALSE; + + ret = getStringFromIndexWithDelim( buf2, ",", 1, + buf3, sizeof(buf3)); + if( ret == FALSE) return FALSE; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, atoi( buf3)); + + ret = getStringFromIndexWithDelim( buf2, ",", 2, + buf3, sizeof(buf3)); + if( ret == FALSE) return FALSE; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, atoi( buf3)); + return TRUE; +} +/************************************** + * route įգ 󡻥ؤչľë + * į屾£ + **************************************/ +static void NPC_BusSetDestPoint( int meindex, char *argstr) +{ + char buf[256]; + char routename[256]; + + snprintf( routename, sizeof( routename), "routename%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routename, buf, sizeof( buf)) + != NULL ) + { + CHAR_setChar( meindex, CHAR_OWNTITLE, buf); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + } +} +/************************************** + * ϶ýľʧ ةë Ȼ¾ + * Ȼշֻ + **************************************/ +static BOOL NPC_BusCheckDeniedItem( int meindex, int charaindex, char *argstr) +{ + char buf[1024]; + BOOL found = TRUE; + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "denieditem", buf, sizeof( buf)) + != NULL ) + { + int i; + int ret; + for( i = 1; ; i ++) { + int itemid; + char buf2[64]; + int j; + ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2)); + if( ret == FALSE ) break; + itemid = atoi( buf2); + for( j = 0; j < CHAR_MAXITEMHAVE; j ++) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid) { + found = FALSE; + break; + } + } + } + } + } + return found; +} +/************************************** + * ϶ýľʧ ةë Ȼ¾ + * Ȼئֻ + **************************************/ +BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode) +{ + char buf[1024]; + BOOL found = TRUE; + BOOL pickup = FALSE; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pickupitem", buf, sizeof( buf))!= NULL ){ + pickup = TRUE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "allowitem", buf, sizeof( buf))!= NULL ){ + int i; + int ret; + for( i = 1; ; i ++) { + int itemid; + char buf2[64]; + int j; + BOOL getflg; + ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2)); + if( ret == FALSE ) break; + itemid = atoi( buf2); + getflg = FALSE; + for( j = 0; j < CHAR_MAXITEMHAVE; j ++) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid) { + if( pickupmode && pickup && !getflg) { + CHAR_DelItem( charaindex, j); + getflg = TRUE; + } + break; + } + } + } + if( j == CHAR_MAXITEMHAVE) { + found = FALSE; + break; + } + } + } + return found; +} + +/************************************** + * ϶ýľìﶯ + **************************************/ +static BOOL NPC_BusCheckLevel( int meindex, int charaindex, char *argstr) +{ + int level; + + /* ئľئ¦Ѽ */ + level = NPC_Util_GetNumFromStrWithDelim( argstr, "needlevel"); + if( level == -1 ) { + return TRUE; + } + if( CHAR_getInt( charaindex, CHAR_LV) >= level ) return TRUE; + + return FALSE; +} +/************************************** + * ë + * -1 0 ݾ ۢStone + **************************************/ +static int NPC_BusCheckStone( int meindex, int charaindex, char *argstr) +{ + int gold; + + /* ئľئ¦Ѽ */ + gold = NPC_Util_GetNumFromStrWithDelim( argstr, "needstone"); + if( gold == -1 ) { + return 0; + } + if( CHAR_getInt( charaindex, CHAR_GOLD) >= gold ) return gold; + + return -1; +} +/************************************** + * ë˪ + * ¦Ѽ⻥ئľɷɻë˪ + **************************************/ +static void NPC_BusSendMsg( int meindex, int talkerindex, int tablenum) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buf[256]; + char msg[256]; + if( tablenum < 0 || tablenum >= arraysizeof( busmsg)) return; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, busmsg[tablenum].option, buf, sizeof( buf)) + != NULL ) + { + strcpy( msg, buf); + } + else { + snprintf( msg, sizeof(msg),busmsg[tablenum].defaultmsg); + } + CHAR_talkToCli( talkerindex, meindex, msg, CHAR_COLORYELLOW); +} +/************************************** + * ƤP̼ë + **************************************/ +static int NPC_BusGetRoutePointNum( int meindex, char *argstr ) +{ + int i; + char buf[4096]; + char buf2[256]; + int ret; + char routetostring[64]; + + snprintf( routetostring, sizeof( routetostring), "routeto%d", + CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf)) + == NULL ) + { + print( "npcbus:nothing route \n"); + return -1; + } + for( i = 1; ; i ++ ) { + ret = getStringFromIndexWithDelim( buf, ";", i, buf2, sizeof(buf2)); + if( ret == FALSE) break; + } + return( i -1); +} +BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg) +{ + //int fd; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + int ret; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + /* */ + if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; + /* ַ */ + if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GETTINGON); + return FALSE; + } + /* շֻ */ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_NOTPARTY); + return FALSE; + } + /* ɡ ūë */ + if( CHAR_getEmptyPartyArray( meindex) == -1 ) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_OVERPARTY); + return FALSE; + } + /* ʧ ةë(ʧ ة) */ + if( !NPC_BusCheckDeniedItem( meindex, charaindex, argstr)) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_DENIEDITEM); + return FALSE; + } +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE ) { + CHAR_talkToCli( charaindex, -1, "޷Яϳ", CHAR_COLORYELLOW); + return FALSE; + } +#endif + /* ʧ ةë( ۢʧ ة) */ + if( !NPC_BusCheckAllowItem( meindex, charaindex, FALSE)) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_ALLOWITEM); + return FALSE; + } + /* ìPë */ + if( !NPC_BusCheckLevel( meindex, charaindex, argstr)) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_LEVEL); + return FALSE; + } + /* ì */ +// if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 || +// CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 || +// CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 ) +// { +// if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_EVENT); +// return FALSE; +// } + /* żë ë¼ƥ ͱ³ */ + ret = NPC_BusCheckStone( meindex, charaindex, argstr); + if( ret == -1 ) { + if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GOLD); + return FALSE; + } + if( ret != 0 ) { + char msgbuf[128]; + /* ë */ + CHAR_setInt( charaindex, CHAR_GOLD, + CHAR_getInt( charaindex, CHAR_GOLD) - ret); + /* ˪ */ + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); + snprintf( msgbuf, sizeof( msgbuf), "֧%d Stone", ret); + CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW); + } + /* ɡ ū */ + //CHAR_JoinParty_Main( charaindex, meindex); + + //fd = getfdFromCharaIndex( charaindex ); + + //lssproto_PR_send( fd, 1, 1); + + + return TRUE; +} diff --git a/npc/npc_charm.c b/npc/npc_charm.c new file mode 100644 index 0000000..0c4e401 --- /dev/null +++ b/npc/npc_charm.c @@ -0,0 +1,285 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_charm.h" + +// ҽë ʻңֿ + +//ì ػ / + +//ڷƥʣ +/* +#define RATE 4 // +#define CHARMHEAL 5 // +#define WARU 3 // ë° + +*/ + +#define RATE 10 // +#define CHARMHEAL 5 // +#define WARU 3 // ë° + + +static void NPC_Charm_selectWindow( int meindex, int toindex, int num); +int NPC_CharmCost(int meindex,int talker); +void NPC_CharmUp(int meindex,int talker); + + +/********************************* +* +*********************************/ +BOOL NPC_CharmInit( int meindex ) +{ + /*--ƽҷ¼ëɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPECHARM ); + return TRUE; + +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_CharmTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + /* */ + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + NPC_Charm_selectWindow( meindex, talkerindex, 0); +} + + +/* + * + */ +static void NPC_Charm_selectWindow( int meindex, int toindex, int num) +{ + + char token[1024]; + char escapedname[1024]; + int fd = getfdFromCharaIndex( toindex); + int buttontype = 0; + int windowtype = 0; + int windowno = 0; + int cost = 0; + int chartype; + + /*--̼⻥мƥƱɬ--*/ + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + switch( num) { + case 0: + /*-- --*/ + sprintf(token,"4\n ʦ " + "\n\n ӭ٣Ҫʲأ" + "\n " + "\n\n " + "\n\n ʲҲ " + ); + + buttontype = WINDOW_BUTTONTYPE_NONE; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_CHARM_START; + break; + + case 1: + cost = NPC_CharmCost( meindex, toindex); + if(cost == -1){ + sprintf(token," ʦ " + "\n\n" + "\n\nԶࡡ" + ); + buttontype = WINDOW_BUTTONTYPE_OK; + }else{ + sprintf(token," ʦ " + "\n,ǧػݼʵʩ??" + "\n\n ҪĻ" + "\nҪ%6dstoneࡣ" + "\n\nʹҲ",cost + ); + buttontype = WINDOW_BUTTONTYPE_YESNO; + + } + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHARM_END; + + break; + + case 2: + cost = NPC_CharmCost( meindex, toindex); + chartype = CHAR_getInt( toindex, CHAR_IMAGETYPE); + + if(cost > CHAR_getInt( toindex, CHAR_GOLD)) { + sprintf(token," ʦ " + "\n\n ѽ!Ǯࡣ" + "\n ȥǮ´ɣ" + ); + + }else{ + NPC_CharmUp( meindex, toindex); + + /*--ƽҷ¼巽Ȼë --*/ + switch( chartype) { + case CHAR_IMAGETYPE_GIRL: + sprintf(token," ʦ " + "\n\n ,ޣ" + "\n\nɰأ" + ); + + break; + case CHAR_IMAGETYPE_BOY: + sprintf(token," ʦ " + "\n\n ,ޣ" + "\n\nDzDZȸղҪ˧أ" + ); + break; + + case CHAR_IMAGETYPE_CHILDBOY: + case CHAR_IMAGETYPE_CHILDGIRL: + sprintf(token," ʦ " + "\n\n ,ޣ" + "\n\n ıúÿɰࡣ" + ); + break; + + case CHAR_IMAGETYPE_MAN: + sprintf(token," ʦ " + "\n\n ,ޣ" + "\n\n øأ" + ); + break; + + case CHAR_IMAGETYPE_WOMAN: + sprintf(token," ʦ " + "\n\n ,ޣ" + "\n\n DZأ" + ); + break; + + } + } + + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHARM_END; + break; + } + + makeEscapeString( token, escapedname, sizeof( escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + escapedname); + +} + + +/*----------------------------------------- +ͷʧ߯Ȼݱ̫ľ£ +-------------------------------------------*/ +void NPC_CharmWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; + + switch( seqno){ + case CHAR_WINDOWTYPE_CHARM_START: + if(atoi( data) == 2) { + NPC_Charm_selectWindow( meindex, talkerindex, 1 ); + } + break; + + case CHAR_WINDOWTYPE_CHARM_END: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_Charm_selectWindow( meindex, talkerindex, 2 ); + } + break; + } + +} + + + +/*-- --*/ +void NPC_CharmUp(int meindex,int talker) +{ + int cost; + int i; + int petindex; + char petsend[64]; + + /*--ëӼƽﵤ--*/ + cost = NPC_CharmCost( meindex, talker); + CHAR_setInt( talker, CHAR_GOLD, + CHAR_getInt( talker, CHAR_GOLD) - cost); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + + /*-- ߨ߶ئ¦ߨ߱--*/ + if(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL >= 100) { + CHAR_setInt( talker, CHAR_CHARM, 100); + }else{ + /*-- ë--*/ + CHAR_setInt(talker, CHAR_CHARM, + (CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL)); + } + + /*-- ޥ--*/ + CHAR_complianceParameter( talker ); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM); + + + /*--ʸɷ¶ëޥ--*/ + for( i = 0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + /* ƽҷ¼ */ + if( !CHAR_CHECKINDEX( talker ) ) continue; + + /*--ɷ¶Ʃ--*/ + CHAR_complianceParameter( petindex ); + sprintf( petsend, "K%d", i ); + CHAR_sendStatusString( talker , petsend ); + } +} + + +/*--żң--*/ +int NPC_CharmCost(int meindex,int talker) +{ + int cost; + int level; + int charm; + int trans; + + level = CHAR_getInt( talker, CHAR_LV); + charm = CHAR_getInt( talker, CHAR_CHARM); + trans = CHAR_getInt( talker, CHAR_TRANSMIGRATION); + + if(charm >= 100) return -1; + + if(charm <= 1) charm = WARU; + + /*-- ңֿ --*/ + cost = level * RATE * (charm / WARU) * (trans+1); + + return cost; + +} diff --git a/npc/npc_checkman.c b/npc/npc_checkman.c new file mode 100644 index 0000000..1fe3864 --- /dev/null +++ b/npc/npc_checkman.c @@ -0,0 +1,472 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" + + +//ػƥ°׷º뼰 +#define MAXEVENTFLG 96 + +/* + * ì׷ºë + * + */ + +static void NPC_CheckMan_selectWindow( int meindex, int toindex, int num); +int NPC_NowFlgCheck(int meindex,int talker,int now[MAXEVENTFLG]); +int NPC_EndFlgCheck(int meindex,int talker ,int nowflg[MAXEVENTFLG]); +BOOL NPC_FlgCheckMain( int meindex,int talker,int nowindex,int now[MAXEVENTFLG],char *work2); + +/********************************* +* +*********************************/ +BOOL NPC_CheckManInit( int meindex ) +{ + /*--ƽҷ¼ëɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPECHECKMAN); + + return TRUE; +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_CheckManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + /* */ + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + // ټ̼ + NPC_CheckMan_selectWindow( meindex, talkerindex, 0); + +} + + +/* + * + */ +static void NPC_CheckMan_selectWindow( int meindex, int talker, int num) +{ + + char token[1024]; + char work[256]; + char work2[512]; + + char escapedname[1024]; + int fd = getfdFromCharaIndex( talker); + int buttontype = 0; + int windowtype = 0; + int windowno = 0; + int now[MAXEVENTFLG]; + int nowindex; + int i; + int page; + + work[0] = 0; + work2[0] = 0; + token[0] = 0; + + now[0] =0; + + /*--̼⻥мƥƱɬ--*/ + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + switch( num) { + + case 0: + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,0); + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,0); + + /*-- --*/ + sprintf(token,"3\n Ѩ " + "\nػ׷ºë" + "\n" + "\n գNOW׷ºͣ " + "\n գEND׷ºͣ " + "\n\n գNOW׷º " + "\n գEND׷º " + ); + + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_CHECKMAN_START; + break; + + //NOW׷º뼰ǩ + case 1: + + //NOW׷º뼰 + nowindex = NPC_NowFlgCheck( meindex, talker, now); + + //ʸ + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ; + + if(page == 0 || page == 1){ + i = 0; + }else{ + i = 83; + } + + //ʸ + for(; i < nowindex ; i++) + { + sprintf(work,"%d,",now[ i]); + strcat(work2,work); + } + + sprintf(token,"Ѩ " + "\nػ Ȼ NOWì" + "\n%s" + ,work2); + + if(page != 2 && nowindex > 83) + { + //ƹ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,1); + //ʸ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,2); + + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; + + }else{ + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + } + + break; + + + //END׷º뼰ǩ + case 2: + // ׷º뼰 + nowindex = NPC_EndFlgCheck( meindex, talker, now); + + //ʸ + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ; + + if(page == 0 || page == 1){ + i = 0; + }else{ + i = 83; + } + work2[0]=0; + + //ʸ + for(; i < nowindex ; i++) + { + sprintf(work,"%d,",now[ i]); + strcat(work2,work); + } + sprintf(token,"Ѩ " + "\nػ Ȼ ENDì" + "\n%s" + ,work2); + + if(page != 2 && nowindex > 83) + { + //ƹ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,2); + //ʸ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,2); + + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; + + }else{ + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + } + + break; + + + // NOW׷º뼰 + case 4: + { + + //NOW׷º + nowindex = NPC_NowFlgCheck( meindex, talker, now); + + if(NPC_FlgCheckMain( meindex, talker, nowindex,now,work2) + == FALSE) + { + return; + } + + + sprintf(token,"Ѩ " + "\nػ Ȼ NOWì" + "\n%s" + ,work2); + + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ; + nowindex = (nowindex / ((6*page)+1)); + + if(page != 16 && nowindex != 0) + { + //ƹ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,4); + //ʸ + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC); + page++; + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,page); + + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; + }else{ + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + } + + } + break; + + // END׷º뼰 + case 5: + { + //END׷º뼰 + nowindex = NPC_EndFlgCheck( meindex, talker, now); + + + if(NPC_FlgCheckMain( meindex, talker, nowindex, now, work2) + == FALSE) + { + return; + } + + sprintf(token,"Ѩ " + "\nػ Ȼ ENDì" + "\n%s" + ,work2); + + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ; + + nowindex = (nowindex / ((6*page)+1)); + + if(page != 16 && nowindex != 0) + { + //ƹ + CHAR_setWorkInt(talker, CHAR_WORKSHOPRELEVANT, 5); + //ʸ + page = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC); + page++; + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, page); + + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_CHECKMAN_MAIN; + }else{ + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + } + + } + } + + makeEscapeString( token, escapedname, sizeof( escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + escapedname); + +} + + +/*----------------------------------------- +ͷʧ߯Ȼݱ̫ľ£ +-------------------------------------------*/ +void NPC_CheckManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int datano; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; + + datano = atoi(data); + + if(select == WINDOW_BUTTONTYPE_OK) + { + NPC_CheckMan_selectWindow( meindex, talkerindex, 0 ); + }else if(select == WINDOW_BUTTONTYPE_CANCEL) { + return; + } + + + + + switch(CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT)){ + case 1: + if(CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTSEC) == 2){ + NPC_CheckMan_selectWindow( meindex, talkerindex, 1 ); + } + break; + + case 2: + if(CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTSEC) == 2){ + NPC_CheckMan_selectWindow( meindex, talkerindex, 2 ); + } + break; + + case 4: + if(CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTSEC) >= 2){ + NPC_CheckMan_selectWindow( meindex, talkerindex, 4 ); + } + + case 5: + if(CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTSEC) >= 2){ + NPC_CheckMan_selectWindow( meindex, talkerindex, 5 ); + } + + break; + } + + switch( datano ){ + case 1: + NPC_CheckMan_selectWindow( meindex, talkerindex, 1 ); + break; + + case 2: + NPC_CheckMan_selectWindow( meindex, talkerindex, 2 ); + break; + + case 4: + NPC_CheckMan_selectWindow( meindex, talkerindex, 4 ); + break; + + case 5: + NPC_CheckMan_selectWindow( meindex, talkerindex, 5 ); + break; + } + +} + +/* + *ì ׷ºë + */ +int NPC_NowFlgCheck(int meindex,int talker ,int nowflg[MAXEVENTFLG]) +{ + int i = 0; + int j = 0; + + for(i= 0; i < MAXEVENTFLG ; i++){ + if(NPC_NowEventCheckFlg( talker, i) == TRUE) + { + nowflg[j] = i; + j++; + } + } + + return j; +} + +/* + *ì ׷ºë + */ +int NPC_EndFlgCheck(int meindex,int talker ,int nowflg[MAXEVENTFLG]) +{ + int i = 0; + int j = 0; + + for(i= 0; i < MAXEVENTFLG ; i++){ + + if(NPC_EventCheckFlg( talker, i) == TRUE) + { + nowflg[j] = i; + j++; + } + } + + return j; +} + +/* + * + * + */ +BOOL NPC_FlgCheckMain( int meindex,int talker,int nowindex,int now[MAXEVENTFLG],char *work2) +{ + int page; + int max; + int i; + int shou; + int j=1; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char work[512]; + char buf[40]; + char buf2[42]; + + //ʸ + page = CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) ; + + if(page == 0) { + page =1; + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,1) ; + } + + if(page == 1){ + i = 0; + if( nowindex >6 ){ + max =7; + }else{ + max =nowindex; + } + }else{ + max = (page * 6) +1; + i = max - 7; + shou = nowindex / max; + + if(shou == 0){ + max = nowindex; + }else{ + i = max - 7; + } + } + + //ìƻ̤ľ°̻ë ij + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("NPC_CheckMan:GetArgStrErr"); + return FALSE; + } + + work[0] = 0; + work2[0] = 0; + + //ʸ + for(; i < max ; i++) + { + sprintf(work,"#%d:",now[ i]); + j = 1; + while( getStringFromIndexWithDelim(argstr, "|", j, buf,sizeof( buf)) + !=FALSE ) + { + j++; + if(strstr(buf,work) != NULL){ + sprintf(buf2,"%s\n",buf); + strcat(work2,buf2); + break; + } + } + } + + return TRUE; +} diff --git a/npc/npc_dengon.c b/npc/npc_dengon.c new file mode 100644 index 0000000..82d083f --- /dev/null +++ b/npc/npc_dengon.c @@ -0,0 +1,248 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "handletime.h" + +static BOOL NPC_DengonReadString( int meindex, int id, char *str ); +static void NPC_DengonWriteString( int meindex, int talkerindex, int id, char *str ); + +#define DENGONFILEDIR "./Dengon/" +#define DENGONFILELINENUM 1000 +#define DENGONFILESTRINGSIZE 256 +#define DENGONFILECOUNTERSIZE 11 +#define DENGONFILEENTRYSIZE (DENGONFILECOUNTERSIZE+DENGONFILESTRINGSIZE+1) +#define MESSAGEINONEWINDOW 7 + +char NPC_sendbuf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW]; + +BOOL NPC_DengonInit( int meindex ) +{ + char filename[256], tmp[256]; + FILE *f; + int i,j; + int id, maxid; + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEDENGON ); + + snprintf( filename,sizeof(filename), "%s%d_%d_%d", + DENGONFILEDIR, CHAR_getInt( meindex, CHAR_FLOOR ), + CHAR_getInt( meindex, CHAR_X ), + CHAR_getInt( meindex, CHAR_Y ) ); + + if( ! (f=fopen( filename, "r" )) ){ + f = fopen( filename, "w" ); + if( f ){ + }else{ + print( "ERROR:Can't create Dengonfile %s!\n",filename ); + return FALSE; + } + for( j = 0; j < DENGONFILELINENUM; j++ ){ + fwrite( "0000000000:", sizeof(char), + DENGONFILECOUNTERSIZE, f); + for( i=0;i maxid ) { + maxid = id; + } + } + + CHAR_setWorkInt( meindex, CHAR_WORKDENGONMAXID, maxid ); + + fclose(f); + return TRUE; +} + + +void NPC_DengonWindowTalked( int index, int talker, + int seqno, int select, char *data) +{ + char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2]; + + int id; + +#define DENGONDISTANCE 3 + + if(NPC_Util_CharDistance(index,talker) > DENGONDISTANCE ) return; + if( seqno == CHAR_WINDOWTYPE_DENGON) { + int buttontype = 0; + int maxid; + switch( select ){ + case WINDOW_BUTTONTYPE_NEXT: + case WINDOW_BUTTONTYPE_PREV: + id = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) + + MESSAGEINONEWINDOW + * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + + maxid = CHAR_getWorkInt( index, CHAR_WORKDENGONMAXID ); + + if( id > maxid) id = maxid; + else if( id < 2 ) id = 1; + + buttontype = WINDOW_BUTTONTYPE_OKCANCEL; + if( id == maxid ) buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( id == 1 ) buttontype |= WINDOW_BUTTONTYPE_NEXT; + else { + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT, id); + if( NPC_DengonReadString( index, id, NPC_sendbuf ) ){ + int fd; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 )return; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT, + buttontype, + CHAR_WINDOWTYPE_DENGON, + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + } + break; + case WINDOW_BUTTONTYPE_OK: + if( strlen( data) == 0 ) break; + id = CHAR_getWorkInt(index, CHAR_WORKDENGONMAXID ); + id++; + NPC_DengonWriteString( index, talker, id, data ); + CHAR_setWorkInt(index, CHAR_WORKDENGONMAXID, id ); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT, id); + if( NPC_DengonReadString( index, id, NPC_sendbuf ) ){ + int fd; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 )return; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_DENGON, + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + } + break; + default: + break; + } + } +} + + + + +void NPC_DengonLooked( int meindex, int lookedindex ) +{ + int maxid; + char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2]; + if( NPC_Util_CharDistance( lookedindex, meindex ) > 1) return; + maxid = CHAR_getWorkInt( meindex, CHAR_WORKDENGONMAXID ); + if( NPC_DengonReadString( meindex, maxid, NPC_sendbuf ) ){ + int fd; + fd = getfdFromCharaIndex( lookedindex ); + if( fd == -1 )return; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OKCANCEL| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_DENGON, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + + CHAR_setWorkInt( lookedindex, CHAR_WORKSHOPRELEVANT, maxid); + + } + +} + +static BOOL NPC_DengonReadString( int meindex, int id, char *str ) +{ + char filename[256]; + char readbuf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW]; + + FILE *f; + int maxid, i, sendid, len; + char *writeptr, *readptr; + + + maxid = CHAR_getWorkInt( meindex, CHAR_WORKDENGONMAXID ); + if( id > maxid ) id = maxid; + sendid = id - MESSAGEINONEWINDOW + 1; + + if( sendid < maxid - DENGONFILELINENUM + 1 ){ + sendid = maxid - DENGONFILELINENUM + 1; + } + + if( sendid < 1 ) sendid = 1; + + snprintf( filename,sizeof(filename), "%s%d_%d_%d", + DENGONFILEDIR, CHAR_getInt( meindex, CHAR_FLOOR ), + CHAR_getInt( meindex, CHAR_X ), + CHAR_getInt( meindex, CHAR_Y ) ); + + writeptr = str; + strcpy( writeptr, " ԰\n"); + len = strlen(writeptr); + writeptr += len; + + f = fopen( filename, "r" ); + if( !f ) return FALSE; +{ + char buf[DENGONFILEENTRYSIZE]; + int wptr = 0; + readbuf[0] = '\0'; + for( i = 0; i < MESSAGEINONEWINDOW; i ++ ) { + fseek( f, ((sendid+i)%DENGONFILELINENUM)*DENGONFILEENTRYSIZE, SEEK_SET ); + fread( buf, sizeof(char), + DENGONFILEENTRYSIZE , f ); + memcpy( &readbuf[wptr], buf,sizeof( buf)); + wptr += DENGONFILEENTRYSIZE; + } +} + fclose(f); + readptr = readbuf + DENGONFILECOUNTERSIZE; + for( i=0;i +#include + + +static int NPC_Door_isOpen( int meindex ); + +/* + * ʧë ׻NPC ۢئѼ + * Door + * + * NPCARGUMENT + * + * og|cg|idname|swcount|closetime_sec|soonflg0/1|passflg0/1/2 + * + * passflg 1ʴƥؤ ئ£2 + * 姸վئУ 0ɵƥئУ + * + * ë϶£ ƥ޷ɻƥ1ޣ + * ɬë̤巴 įۢئëֹ ۢƥؤ£ + * + * мԻCë˪ѻؤ¾գ1info, į + * ë ƻչëͷʧ ľ + * ػ ޥئ£ + */ + +#define NPC_DOOR_OPENMSG "ʧ!" +#define NPC_DOOR_CLOSEMSG "ʧëƻ!" +#define NPC_DOOR_CANTOPENMSG "ؤئмƥʧëʳ绥\ +ƥئ!" + +#define ROPEGRAPHIC 9259 /* Ǿ ؤɧľئз */ + +enum{ + NPC_DOOR_FLG_SOONCLOSE = 1, + NPC_DOOR_FLG_WATCHCLOSE = 2 +}; + + +/* + * ʧɬë±巴ƥ + * maxhp , maxmp , level , str , tough ë0緽У + * + */ +BOOL NPC_DoorInit( int meindex ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char settingdir[1024]; + char buf[256]; + + NPC_Util_GetArgStr( meindex, arg, sizeof( arg)); + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE,CHAR_EVENT_NPC); + + getStringFromIndexWithDelim(arg, "|" , 1 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOOROPENG , atoi( buf )); + getStringFromIndexWithDelim(arg, "|" , 2 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORCLOSEG , atoi( buf )); + getStringFromIndexWithDelim(arg, "|" , 3 , buf,sizeof(buf) ); + CHAR_setWorkChar( meindex , CHAR_WORKDOORNAME , buf ); + strcpysafe( settingdir,sizeof( settingdir) , buf ); + getStringFromIndexWithDelim(arg, "|" , 4 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORSWITCHCOUNT , atoi( buf )); + getStringFromIndexWithDelim(arg, "|" , 5 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORCLOSETIME , atoi( buf )); + + CHAR_setInt( meindex , CHAR_MERCHANTLEVEL , atoi( buf )); + getStringFromIndexWithDelim(arg, "|" , 6 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORSOONFLG , atoi( buf )); + + getStringFromIndexWithDelim(arg, "|" , 7 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORPASSFLG , atoi( buf )); + CHAR_setWorkInt( meindex , CHAR_WORKDOORORIGINALGRAPHIC, + CHAR_getInt( meindex,CHAR_BASEIMAGENUMBER )); + CHAR_setInt( meindex, CHAR_LV, 0 ); + if( getStringFromIndexWithDelim( arg , "|" , 8 , buf ,sizeof( buf ))){ + if( strncmp( buf , "title" ,5 ) == 0 ){ + print( "This is a title door:'%s'\n" , buf ); + CHAR_setWorkInt( meindex , CHAR_WORKDOORPASSFLG ,0 ); + CHAR_setWorkChar( meindex , CHAR_WORKDOORTITLE , buf ); + CHAR_setInt( meindex, CHAR_LV, 1 ); + } else if( isdigit( buf[0] )){ + if( getStringFromIndexWithDelim(arg, "|" , 8 , buf,sizeof(buf) )) + CHAR_setWorkChar( meindex, CHAR_WORKDOORGOLDLIMIT, buf); + if( getStringFromIndexWithDelim(arg, "|" , 10 , buf,sizeof(buf) )) + CHAR_setWorkChar( meindex, CHAR_WORKDOORWEEK, buf); + if( getStringFromIndexWithDelim(arg, "|" , 11 , buf,sizeof(buf) )) + CHAR_setWorkChar( meindex, CHAR_WORKDOORHOUR, buf); + if( getStringFromIndexWithDelim(arg, "|" , 12 , buf,sizeof(buf) )) + CHAR_setWorkChar( meindex, CHAR_WORKDOORMINUTE, buf); + } + } + + CHAR_setInt( meindex , CHAR_HP , 0 ); + CHAR_setInt( meindex , CHAR_MP , 0 ); + CHAR_setInt( meindex , CHAR_MAXMP , 0 ); + CHAR_setInt( meindex , CHAR_STR , 0 ); + CHAR_setInt( meindex , CHAR_TOUGH, 0 ); + { + int g = CHAR_getWorkInt( meindex , CHAR_WORKDOOROPENG ); + if( g >= 11900 && g <= 11915 ){ + CHAR_setWorkInt( meindex , CHAR_WORKDOORKEYITEMID , 15 ); + } else if( g >= 11916 && g <= 11931 ){ + + CHAR_setWorkInt( meindex , CHAR_WORKDOORKEYITEMID , 16 ); + } else { + CHAR_setWorkInt( meindex , CHAR_WORKDOORKEYITEMID , -1 ); + } + if(CHAR_getWorkInt( meindex , CHAR_WORKDOORPASSFLG )==2){ + CHAR_setWorkInt( meindex , CHAR_WORKDOORKEYITEMID , -2 ); + } + if( CHAR_getInt( meindex , CHAR_BASEIMAGENUMBER ) == + ROPEGRAPHIC ){ + CHAR_setWorkInt( meindex , CHAR_WORKDOORKEYITEMID,-2 ); + } + } + + { + int closeg = CHAR_getWorkInt( meindex , CHAR_WORKDOORCLOSEG ); + int dir = -1; + switch( closeg ){ + case 11900: dir = 6; break; /* ʧ Ի */ + case 11902: dir = 0; break; /* Ի */ + case 11904: dir = 2; break; /* Ŀ */ + case 11906: dir = 4; break; /* Ŀ */ + + case 11908: dir = 6; break; /* Ӯʧ Ի */ + case 11910: dir = 0; break; /* Ի */ + case 11912: dir = 2; break; /* Ŀ */ + case 11914: dir = 4; break; /* Ŀ */ + + case 11916: dir = 6; break; /* ˼ʧ Ի */ + case 11918: dir = 0; break; /* Ի */ + case 11920: dir = 2; break; /* Ŀ */ + case 11922: dir = 4; break; /* Ŀ */ + + case 11924: dir = 6; break; /* Ӯ˼ʧ Ի */ + case 11926: dir = 0; break; /* Ի */ + case 11928: dir = 2; break; /* Ŀ */ + case 11930: dir = 4; break; /* Ŀ */ + + case 11958: dir = 2; break; /* Ӯ ʧ Ŀ */ + case 11960: dir = 4; break; /* Ŀ */ + case 11962: dir = 6; break; /* Ի */ + case 11964: dir = 0; break; /* Ի */ + + case 11966: dir = 2; break; /* ʧ Ŀ */ + case 11968: dir = 4; break; /* Ŀ */ + case 11970: dir = 6; break; /* Ի */ + case 11972: dir = 0; break; /* Ի */ + + case 11978: dir = 2; break; /* Ӯżʧ Ŀ */ + case 11980: dir = 4; break; /* Ŀ */ + case 11982: dir = 6; break; /* Ի */ + case 11984: dir = 0; break; /* Ի */ + + case 11986: dir = 2; break; /* żʧ Ŀ */ + case 11988: dir = 4; break; /* Ŀ */ + case 11990: dir = 6; break; /* Ի */ + case 11992: dir = 0; break; /* Ի */ + + default: break; + } + if( dir >= 0 )CHAR_setInt(meindex,CHAR_DIR,dir); + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEDOOR ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + CHAR_setInt( meindex , CHAR_WORKDOORSWITCHCURRENT , 0 ); + CHAR_setWorkInt( meindex, CHAR_WORKDOOREXPIRETIME, 0xffffffff); + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORPASSFLG ) == 1){ + NPC_ROOMINFO roominfo; + if( NPC_RoomAdminNew_ReadFile( CHAR_getWorkChar( meindex, CHAR_WORKDOORNAME), &roominfo) == TRUE ){ + NPC_DoorSetPasswd( meindex, roominfo.passwd); + CHAR_setWorkInt( meindex, CHAR_WORKDOOREXPIRETIME, roominfo.expire); + }else { + NPC_DoorSetPasswd( meindex, "8hda8iauia90494jasd9asodfasdf89" ); + if( getStringFromIndexWithDelim(arg, "|" , 13 , buf,sizeof(buf) )) + if( strlen( buf) != 0 ) + NPC_DoorSetPasswd( meindex, buf ); + } + } + + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER , CHAR_getWorkInt(meindex, CHAR_WORKDOORCLOSEG)); + NPC_DoorRefreshOverFlg( meindex ); + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_NPC); + return TRUE; +} +void NPC_DoorAddSwitchCounter( int meindex , int i , int doindex ) +{ + if( i != 0 && CHAR_getWorkInt( meindex, CHAR_WORKDOORSWITCHCOUNT) + != 0 ){ + CHAR_setWorkInt( meindex, CHAR_WORKDOORSWITCHCURRENT , + CHAR_getWorkInt(meindex, + CHAR_WORKDOORSWITCHCURRENT) + + i ); + if( CHAR_getWorkInt( meindex, CHAR_WORKDOORSWITCHCURRENT ) == + CHAR_getWorkInt( meindex, CHAR_WORKDOORSWITCHCOUNT) ){ + NPC_DoorOpen( meindex , doindex ); + } else { + NPC_DoorClose( meindex , doindex ); + } + } +} + +void NPC_DoorSetSwitchCounter( int meindex, int i , int doindex ) +{ + if( !CHAR_CHECKINDEX(meindex))return; + CHAR_setWorkInt( meindex , CHAR_WORKDOORSWITCHCURRENT , i ); + NPC_DoorAddSwitchCounter( meindex, 0 , doindex ); +} + +static int NPC_DoorSamePos( int meindex ){ + int iWork; + OBJECT object; + int floor = CHAR_getInt( meindex, CHAR_FLOOR ); + int x = CHAR_getInt( meindex, CHAR_X ); + int y = CHAR_getInt( meindex, CHAR_Y ); + + for( object=MAP_getTopObj( floor, x,y ); object ; object = NEXT_OBJECT(object) ){ + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) != OBJTYPE_CHARA )continue; + iWork = OBJECT_getIndex(objindex); + if( CHAR_getInt(iWork,CHAR_HP) < 0 )continue; + if( CHAR_getInt( iWork,CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + return iWork; + } + } + return -1; +} + +void NPC_DoorWatch( int myobjindex, int moveobjindex, CHAR_ACTION act, + int x, int y, int dir, int* opt, int optlen ) +{ + unsigned long closetime; + int meindex, moveindex; + + if( OBJECT_getType( moveobjindex) != OBJTYPE_CHARA ) { + return; + } + meindex = OBJECT_getIndex(myobjindex); + moveindex = OBJECT_getIndex(moveobjindex); + if( NPC_Door_isOpen( meindex ) == 0 )return; + if( CHAR_getInt( moveindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORSOONFLG )){ + if( CHAR_getInt( meindex , CHAR_TALKCOUNT ) > 0 ){ + if( NPC_DoorSamePos( meindex ) == -1 ){ + NPC_DoorClose(meindex , -1 ); + CHAR_setInt( meindex , CHAR_TALKCOUNT, 0 ); + } + } + }else + if( CHAR_getInt( meindex, CHAR_MERCHANTLEVEL ) >= 0 ){ + closetime = (unsigned long )CHAR_getWorkInt( meindex , CHAR_WORKDOORCLOSETIME ); + if( (unsigned long) NowTime.tv_sec > (unsigned long) closetime ){ + NPC_DoorClose(meindex , -1 ); + } + } +} + + +#if 1 +void NPC_DoorOff( int meindex , int movedindex ) +{ + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORSOONFLG )){ + NPC_DoorClose(meindex , -1 ); + } else { + } +} +#endif + +void NPC_DoorPostOver( int meindex , int movedindex ) +{ + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORSOONFLG )){ + CHAR_setInt( meindex , CHAR_TALKCOUNT, 1 ); + CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); /* ɧľئ */ + } +} + +void NPC_DoorLooked( int meindex , int lookedindex ) +{ + int needkey; + + if( CHAR_getInt( meindex , CHAR_LV )){ + char token[32]; + char *p = CHAR_getWorkChar( meindex , CHAR_WORKDOORTITLE ); + int i,j,ok=FALSE; + for(i = 0 ; ; i++ ){ + int r; + r = getStringFromIndexWithDelim( p,":",2+i,token ,sizeof(token)); + if(r){ + int titleind = atoi( token ); + for(j=0;j=1 ){ + if( NPC_Door_isOpen( meindex ) ){ + NPC_DoorFlip( meindex , lookedindex ); + return; + } +#define NPC_DOOR_EXPIRE_MSG "%s ķЧ %d/%d %d:%d" + else { + if( CHAR_getWorkInt( meindex, CHAR_WORKDOOREXPIRETIME) + != 0xffffffff ){ + struct tm tmwk; + time_t expire = CHAR_getWorkInt( meindex, CHAR_WORKDOOREXPIRETIME); + char msgbuf[128]; + + NPC_ROOMINFO roominfo; + /* ɵ ë */ + NPC_RoomAdminNew_ReadFile( + CHAR_getWorkChar( meindex, CHAR_WORKDOORNAME), + &roominfo); + memcpy( &tmwk, localtime( &expire), sizeof( tmwk)); + snprintf( msgbuf, sizeof( msgbuf), NPC_DOOR_EXPIRE_MSG, + roominfo.charaname, + tmwk.tm_mon+1, tmwk.tm_mday, + tmwk.tm_hour, tmwk.tm_min); + CHAR_talkToCli( lookedindex, meindex, msgbuf, CHAR_COLORWHITE); + } + } + #undef NPC_DOOR_EXPIRE_MSG + return; + } + needkey = CHAR_getWorkInt( meindex , CHAR_WORKDOORKEYITEMID ); + if( needkey >= 0 ){ + if( NPC_Util_countHaveItem( lookedindex , needkey ) > 0 ){ + NPC_DoorFlip( meindex , lookedindex); + } else { + CHAR_talkToCli( lookedindex , -1 , NPC_DOOR_CANTOPENMSG , CHAR_COLORWHITE ); + } + } else if( needkey == -1 ){ + NPC_DoorFlip(meindex , lookedindex ); + } else { + CHAR_talkToCli( lookedindex , -1 , "ƺҲ򲻿" , CHAR_COLORWHITE); + } +} +void NPC_DoorTalked( int meindex , int talkerindex , char *msg , int color ) +{ + char *m = CHAR_getWorkChar( meindex , CHAR_WORKDOORPASSWD ); + if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return; + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORPASSFLG ) != 1 ){ + return; + } + if( CHAR_getWorkInt( meindex , CHAR_WORKDOORPASSFLG ) >= 1 && + ((unsigned long)NowTime.tv_sec) > (unsigned long) + CHAR_getWorkInt( meindex , CHAR_WORKDOOREXPIRETIME )){ + print( "RINGO: passdoor expired ( talked )\n" ); + return; + } + if( m[0] == '\0' )return; + cutDotsTail( msg ); + if( strcmp( m , msg ) == 0 ){ + NPC_DoorFlip( meindex , talkerindex ); + }else { + CHAR_talkToCli( talkerindex , -1 , "벻ȷ", CHAR_COLORWHITE ); + } +} + +int NPC_DoorSearchByName( char *name ) +{ + int i; + int charnum = CHAR_getCharNum(); + + for(i= CHAR_getPlayerMaxNum() + CHAR_getPetMaxNum(); + i= 0 ) CHAR_talkToCli( doindex , -1 , NPC_DOOR_CLOSEMSG, CHAR_COLORWHITE ); + CHAR_setInt( meindex , CHAR_TALKCOUNT, 0 ); +} +void NPC_DoorOpen(int meindex , int doindex ) +{ + CHAR_setWorkInt( meindex , CHAR_WORKDOORCLOSETIME, + NowTime.tv_sec + + CHAR_getInt( meindex , CHAR_MERCHANTLEVEL)); + CHAR_setInt( meindex , CHAR_BASEIMAGENUMBER , + CHAR_getWorkInt( meindex,CHAR_WORKDOOROPENG )); + NPC_DoorRefreshOverFlg( meindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, + CHAR_WORKOBJINDEX )); + if( doindex >= 0 ) + CHAR_talkToCli( doindex , -1, NPC_DOOR_OPENMSG ,CHAR_COLORWHITE); +} + +static int NPC_Door_isOpen( int meindex ) +{ + int now_g = CHAR_getInt( meindex , CHAR_BASEIMAGENUMBER ); + int open_g = CHAR_getWorkInt( meindex ,CHAR_WORKDOOROPENG ); + if( now_g == open_g ) return 1; else return 0; +} + +BOOL NPC_DoorRefreshOverFlg( int meind ) +{ + if( !CHAR_CHECKINDEX(meind))return FALSE; + if( NPC_Door_isOpen( meind ) ==1 ){ + CHAR_setFlg( meind , CHAR_ISOVERED , 1 ); + } else { + CHAR_setFlg( meind , CHAR_ISOVERED , 0 ); + } + return TRUE; +} + +BOOL NPC_DoorSetRopeFlag(int fl,int x,int y, int flag ) +{ + int ind = NPC_DoorSearchByPosition( fl,x,y ); + if( ind < 0 ) return FALSE; + if( flag ){ + CHAR_setInt( ind , CHAR_BASEIMAGENUMBER , ROPEGRAPHIC ); + } else { + CHAR_setInt(ind , CHAR_BASEIMAGENUMBER , 0 ); + } + NPC_DoorRefreshOverFlg( ind ); + CHAR_sendCToArroundCharacter( + CHAR_getWorkInt( ind , CHAR_WORKOBJINDEX )); + + return TRUE; +} + diff --git a/npc/npc_doorman.c b/npc/npc_doorman.c new file mode 100644 index 0000000..06ec825 --- /dev/null +++ b/npc/npc_doorman.c @@ -0,0 +1,215 @@ +#include "version.h" +#include +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "item.h" +#include "util.h" +#include "handletime.h" +#include "npc_doorman.h" +#include "npc_door.h" +#include "npcutil.h" +#include "configfile.h" +/* + * + * Իʧؤ幫ʧëվ巽ȻNPC. + * ʧئԻcreate·ƥʧë۽³绥ƥ£ + * ئƾľƽҷëƻԻ8Ѩʧ + * ͻ帲ƻ£ۿ׹ʧ ݱ巰ʳئ£ + * + * ̵̼Talkƥ + * + * ʧë׻ + * + * 1 ë£۰ƥշ gold|100 + * 2 ʧ ةë1۰ ۰ƥշ item|45 + * 3 ʧ ةë Ȼ¾Ʃ£ Ȼշʣitemhave|44 + * 4 ʧ ةë ȻئоƩ£ Ȼئշʣ + * itemnothave|333 + * 5 įëȻ¾Ʃ£ Ȼշʣ titlehave|string + * 6 įëȻئоƩ£ Ȼئշʣ + * titlenothave|string + * + * ئߤ 緰ʣż + *100׷ʻƥʾƥУе100 + * ľ£ئԻУȻľ£ƥ100 + * ׷ףۣɴľ£ + * + * ʧ ة谼ϡë׷ʻƥʾʣ + * 36Ͼئƾ껯ǷȻշʣ + * + * + * + * ܷ + * + *1 ʧë絤 + *2 NPCëʧئԻ ʣ¦ë gold|100 + *3 NPC帲ƻ100ȻƥУɵ + *4 ʧлŻӼ + * + */ + +static void NPC_DoormanOpenDoor( char *nm ); + +BOOL NPC_DoormanInit( int meindex ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char dname[1024]; + + /* ìɬ */ + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE,CHAR_EVENT_NPC); + + CHAR_setInt( meindex , CHAR_HP , 0 ); + CHAR_setInt( meindex , CHAR_MP , 0 ); + CHAR_setInt( meindex , CHAR_MAXMP , 0 ); + CHAR_setInt( meindex , CHAR_STR , 0 ); + CHAR_setInt( meindex , CHAR_TOUGH, 0 ); + CHAR_setInt( meindex , CHAR_LV , 0 ); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPETOWNPEOPLE ); + CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); /* ľئз */ + + NPC_Util_GetArgStr( meindex, arg, sizeof( arg)); + + if(!getStringFromIndexWithDelim( arg, "|", 3, dname, sizeof(dname ))){ + print("RINGO: 趨ʱҪŵࡣ:%s:\n", + arg ); + return FALSE; + } + print( "RINGO: Doorman create: arg: %s dname: %s\n",arg,dname); + CHAR_setWorkChar( meindex , CHAR_WORKDOORMANDOORNAME , dname ); + + return TRUE; +} + +void NPC_DoormanTalked( int meindex , int talkerindex , char *msg , + int color ) +{ + char mode[128]; + char opt[256]; + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + /* ʧѨ1 ئշϼ */ + if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return; + + NPC_Util_GetArgStr( meindex, arg, sizeof( arg)); + + if( !getStringFromIndexWithDelim( arg, "|", 1, mode, sizeof( mode ))) + return; + + if( !getStringFromIndexWithDelim( arg, "|", 2, opt, sizeof( opt ) )) + return; + + if( strcmp( mode , "gold" ) == 0 ){ + int g = atoi( opt ); + int yn = NPC_Util_YN( msg ); + /*char *nm = CHAR_getChar( meindex , CHAR_NAME );*/ + char msg[256]; + + if( g > 0 && yn < 0 ){ + snprintf( msg ,sizeof( msg ) , + "Ҫ%dĽ", g ); + CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); + } else if( g > 0 && yn == 0 ){ + snprintf( msg , sizeof( msg ), + " %dĽDZҪġ", g ); + } else if( g > 0 && yn == 1 ){ + int now_g = CHAR_getInt( talkerindex, CHAR_GOLD ); + if( now_g < g ){ + snprintf( msg , sizeof( msg ) , + " %dĽDZҪġ", g ); + CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); + } else { + snprintf( msg , sizeof( msg ), + "%d յˡھš", g ); + CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE ); + + /* ë */ + now_g -= g; + CHAR_setInt( talkerindex , CHAR_GOLD , now_g ); + /* ؤе ë˪ */ + CHAR_send_P_StatusString(talkerindex, CHAR_P_STRING_GOLD); + + /* ʧ */ + NPC_DoormanOpenDoor( + CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME)); + } + } + } else if( strcmp( mode , "item" ) == 0 ){ + CHAR_talkToCli( talkerindex, meindex , + "δ֧Ԯģʽ", + CHAR_COLORWHITE); + } else if( strcmp( mode , "itemhave" ) == 0 ){ + CHAR_talkToCli( talkerindex, meindex , + "δ֧Ԯģʽ", + CHAR_COLORWHITE); + } else if( strcmp( mode , "itemnothave" ) == 0 ){ + CHAR_talkToCli( talkerindex, meindex , + "δ֧Ԯģʽ", + CHAR_COLORWHITE); + } else if( strcmp( mode , "titlehave" ) == 0 ){ + CHAR_talkToCli( talkerindex, meindex , + "δ֧Ԯģʽ", + CHAR_COLORWHITE); + + } else if( strcmp( mode , "roomlimit" ) == 0 ){ + + /* м׻ؤ */ + char szOk[256], szNg[256], szBuf[32]; + int checkfloor; + int maxnum, i, iNum; + + if( !getStringFromIndexWithDelim( arg, "|", 2, szBuf, sizeof( szBuf ) )) + return; + + /* Ʃ°׷ʧ */ + if( sscanf( szBuf, "%d:%d", &checkfloor, &maxnum ) != 2 ){ + return; + } + + for( iNum = 0,i = 0; i < getFdnum(); i ++ ){ + /* ½巴 */ + if( CHAR_getCharUse( i ) == FALSE )continue; + if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue; + /* ϶ü׷ʧ½ */ + if( CHAR_getInt( i, CHAR_FLOOR ) != checkfloor )continue; + iNum++; + } + if( !getStringFromIndexWithDelim( arg, "|", 5, szNg, sizeof( szNg ))){ + strcpy( szNg, "" ); /* ɡئƼ */ + } + if( !getStringFromIndexWithDelim( arg, "|", 4, szOk, sizeof( szOk ))){ + strcpy( szOk, "Űɡ" ); /* ɡؤԻ */ + } + + if( iNum >= maxnum ){ + /* ë */ + CHAR_talkToCli( talkerindex, meindex ,szNg, CHAR_COLORWHITE); + }else{ + /* ئ */ + CHAR_talkToCli( talkerindex, meindex ,szOk, CHAR_COLORWHITE); + NPC_DoormanOpenDoor( + CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME)); + } + + } else if( strcmp( mode , "titlenothave" ) == 0 ){ + CHAR_talkToCli( talkerindex, meindex , + "δ֧Ԯģʽ", + CHAR_COLORWHITE); + } +} + +/* + * ƥƻ׼ëͻʣ + * + */ +static void NPC_DoormanOpenDoor( char *nm) +{ + int doori = NPC_DoorSearchByName( nm ); + print( "RINGO: Doorman's Door: index: %d\n", doori ); + + NPC_DoorOpen( doori , -1 ); + +} + diff --git a/npc/npc_duelranking.c b/npc/npc_duelranking.c new file mode 100644 index 0000000..a69cfbd --- /dev/null +++ b/npc/npc_duelranking.c @@ -0,0 +1,227 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "net.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_duelranking.h" +#include "handletime.h" + +static void NPC_Duelranking_selectWindow( int meindex, int toindex, int num, int select ); +#define NPC_DUELRANKING_WINDOWLINENUM 10 + + +enum{ + WINDOWTYPE_PKLIST_START=10, + WINDOWTYPE_PKLIST_SELECT, + WINDOWTYPE_PKLIST_SELECT1, + WINDOWTYPE_PKLIST_SELECT2, + + WINDOWTYPE_FAMILYCONTENDSTART, + WINDOWTYPE_FAMILYCONTENDSELECT, + WINDOWTYPE_FAMILYCONTENDLIST, + WINDOWTYPE_FAMILYCONTENDJOIN, + + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_BATTLELOOP = CHAR_NPCWORKINT2, +}; + +BOOL NPC_DuelrankingInit( int meindex ) +{ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEDUELRANKING ); + return TRUE; +} + +void NPC_DuelrankingLooked( int meindex , int lookedindex) +{ + NPC_Duelranking_selectWindow( meindex, lookedindex, 1, -1); +} + +static void NPC_Duelranking_selectWindow( int meindex, int toindex, int num, int select) +{ + + int fd; + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_CharDistance( toindex, meindex ) > 1) return; + if( (fd = getfdFromCharaIndex( toindex)) == -1 ) return; + + switch( num){ + case 1: + { + char message[1024]; + char buf[2048]; + strcpy( message, + "1\n" + " Ҫһ \n\n\n" + " ǿǣ \n\n" + " Լ \n\n" + " \n\n" ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_DUELRANKING_START, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } + break; + } +} + +void NPC_DuelrankingWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int fdid = getFdidFromCharaIndex( talkerindex); + if( fdid == -1 ) return; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + switch( seqno){ + case CHAR_WINDOWTYPE_DUELRANKING_START: + if( atoi( data) == 3 ) { + saacproto_DBGetEntryByCount_send( acfd, + DB_DUELPOINT, 0, + NPC_DUELRANKING_WINDOWLINENUM, fdid, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + } + if( atoi( data) == 5 ) { + char dbkey[256]; + CHAR_makeDBKey( talkerindex, dbkey, sizeof( dbkey)); + saacproto_DBGetEntryRank_send( acfd, DB_DUELPOINT, dbkey, fdid, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + } + break; + case CHAR_WINDOWTYPE_DUELRANKING_TOPRANKING: + if( select == WINDOW_BUTTONTYPE_PREV || select == WINDOW_BUTTONTYPE_NEXT) { + int count = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + if( select == WINDOW_BUTTONTYPE_NEXT ) { + count += NPC_DUELRANKING_WINDOWLINENUM; + }else { + count -= NPC_DUELRANKING_WINDOWLINENUM; + } + + if( count < 0) count = 0; + saacproto_DBGetEntryByCount_send( acfd, + DB_DUELPOINT, + count, + NPC_DUELRANKING_WINDOWLINENUM, fdid, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + }else if( select == WINDOW_BUTTONTYPE_OK ) { + if( strlen( data) != 0 ) { + int count; + count = atoi( data); + if( count < 1 ) count = 1; + saacproto_DBGetEntryByCount_send( acfd, + DB_DUELPOINT, + count-1, + NPC_DUELRANKING_WINDOWLINENUM, fdid, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + } + } + break; + } +} + +void NPC_Duelranking_PrintRanking( char *data, int count_start, int fdid, int msgid2) +{ + char message[1024]; + char buf[2048]; + int i; + int cnt = 0; + int button = 0; + int fd = getfdFromFdid( fdid); + if( fd == -1 ) return; + message[0] = '\0'; + snprintf( message, sizeof( message), + " ǿ\n\n" + " Rank DuelPoint Lv Name\n\n" ); + for( i = 1; ; i ++ ) { + char rankdata[256]; + char cdandname[64]; + char charaname[32]; + char rank[16]; + char score[64]; + char msgbuf[512]; + char cdkey[32]; + char lv[16]; + char hosi[6]; + + if( !getStringFromIndexWithDelim( data, "|", i, rankdata, sizeof( rankdata))) { + break; + } + if( !getStringFromIndexWithDelim( rankdata, ",", 2, rank, sizeof( rank)) ){ + continue; + } + if( !getStringFromIndexWithDelim( rankdata, ",", 3, cdandname, sizeof( cdandname)) ){ continue; + } + makeStringFromEscaped( cdandname); + if( !getStringFromIndexWithDelim( cdandname, "_", 1, cdkey, sizeof( cdkey)) ){ + continue; + } + if( !getStringFromIndexWithDelim( cdandname, "_", 2, charaname, sizeof( charaname)) ){ + continue; + } + if( !getStringFromIndexWithDelim( rankdata, ",", 4, score, sizeof( score)) ){ + continue; + } + if( !getStringFromIndexWithDelim( rankdata, ",", 5, lv, sizeof( lv)) ){ + lv[0] = '\0'; + } + { + char *mycdkey = CHAR_getChar( CONNECT_getCharaindex(fd), CHAR_CDKEY); + char *myname = CHAR_getChar( CONNECT_getCharaindex(fd), CHAR_NAME); + char engnum[4][3] = { "st","nd","rd","th"}; + int dsprank = atoi(rank); + if( dsprank > 3) dsprank = 3; + if( mycdkey != NULL && myname != NULL && strcmp( cdkey, mycdkey) == 0 && + strcmp( charaname, myname) == 0 ) { + strcpy( hosi, ""); + }else { + strcpy( hosi, ""); + } + snprintf( msgbuf, sizeof( msgbuf), "%s %5d%s %10s %3s %s\n", + hosi, + atoi(rank)+1, engnum[dsprank], + score, lv, + charaname ); + } + strcatsafe( message, sizeof( message), msgbuf); + cnt ++; + } + if( cnt == 0 ) { + strcpy( message, "\n ûˡ"); + button = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_OK; + }else if( cnt < NPC_DUELRANKING_WINDOWLINENUM ) { + if( count_start >= NPC_DUELRANKING_WINDOWLINENUM) { + button = WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_PREV; + }else { + button = WINDOW_BUTTONTYPE_OK; + } + }else if( count_start == 0 ) { + button = WINDOW_BUTTONTYPE_NEXT|WINDOW_BUTTONTYPE_OK; + }else { + button = WINDOW_BUTTONTYPE_NEXT|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_OK; + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_WIDEMESSAGEANDLINEINPUT, + button, + CHAR_WINDOWTYPE_DUELRANKING_TOPRANKING, + msgid2, + makeEscapeString( message, buf, sizeof(buf))); + + if( cnt == 0 ) { + CHAR_setWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKSHOPRELEVANT, -1); + }else { + CHAR_setWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKSHOPRELEVANT, count_start); + } +} + +void NPC_Duelranking_CallMyRanking( int count, int msgid, int msgid2) +{ + count -= 5; + if( count < 0 ) count = 0; + saacproto_DBGetEntryByCount_send( acfd, DB_DUELPOINT, + count, NPC_DUELRANKING_WINDOWLINENUM, + msgid, msgid2 ); +} + diff --git a/npc/npc_eventaction.c b/npc/npc_eventaction.c new file mode 100644 index 0000000..fffb3e1 --- /dev/null +++ b/npc/npc_eventaction.c @@ -0,0 +1,4543 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "map_deal.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "family.h" + +#ifdef _ANGEL_SUMMON +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; +#endif +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +#include "profession_skill.h" +#include "chatmagic.h" +#endif + +enum{ + NPC_EVENTMODE_NONE, + NPC_EVENTMODE_OPEN, + NPC_EVENTMODE_EVENT, +}; + +typedef struct { + char arg[32]; + int born; + int dead; +}NPC_TimeMan; + +#define YOAKE 700 +#define NICHIBOTU 300 +#define SHOUGO 125 +#define YONAKA 500 + +static NPC_TimeMan TimeTble[] = { + {"ALLNIGHT", NICHIBOTU+1, YOAKE}, + {"ALLNOON", YOAKE+1, NICHIBOTU}, + {"AM", YONAKA+1, SHOUGO}, + {"PM", SHOUGO+1, YONAKA}, + {"FORE", YOAKE+1, SHOUGO}, + {"AFTER", SHOUGO+1, NICHIBOTU}, + {"EVNING", NICHIBOTU+1, YONAKA}, + {"MORNING", YONAKA+1, YOAKE}, + {"FREE", 0, 1024}, +}; + +extern void BATTLE_changeRideImage( int index ); + + +#define MAXNPCPOINT 10 + +int year,mon,date,day,hour,min,sec; +BOOL ActionNpc_WarpPoint(int meindex,int talker,char *npcarg) +{ + char data[1024], buf1[256], buf2[256]; + int i=1, j=0; + BOOL EvFlg=FALSE; + + struct { + int FLOOR; + int X; + int Y; + }Points[MAXNPCPOINT]; + + for( i=0;i= MAXNPCPOINT ) + break; + } + where = RAND( 0, j-1); + if( MAP_IsValidCoordinate( Points[where].FLOOR, Points[where].X, Points[where].Y ) == TRUE ){ + CHAR_warpToSpecificPoint( meindex, Points[where].FLOOR, Points[where].X, Points[where].Y); + EvFlg = TRUE; + }else { + for( i=0; i<10; i++) { + print("%d.[%d,%d,%d]\n", i, Points[i].FLOOR, Points[i].X, Points[i].Y); + } + } + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "WARPPOINT", data, sizeof( data)) != NULL ) { + int where=0; + i=1; + j=0; + while( getStringFromIndexWithDelim( data, ";", i, buf1, sizeof( buf1)) != FALSE ) { + i++; + getStringFromIndexWithDelim( buf1, ",", 1, buf2, sizeof( buf2)); + Points[j].FLOOR = atoi( buf2); + getStringFromIndexWithDelim( buf1, ",", 2, buf2, sizeof( buf2)); + Points[j].X = atoi( buf2); + getStringFromIndexWithDelim( buf1, ",", 3, buf2, sizeof( buf2)); + Points[j].Y = atoi( buf2); + j++; + if( j >= MAXNPCPOINT ) + break; + } + where = RAND( 0, j-1); + if( MAP_IsValidCoordinate( Points[where].FLOOR, Points[where].X, Points[where].Y ) == TRUE ){ + CHAR_warpToSpecificPoint( talker, Points[where].FLOOR, Points[where].X, Points[where].Y); + EvFlg = TRUE; + }else { + for( i=0; i<10; i++) { + print("%d.[%d,%d,%d]\n", i, Points[i].FLOOR, Points[i].X, Points[i].Y); + } + } + + } + + return EvFlg; +} + +BOOL ActionNpc_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums) +{ + char buf1[1024], buf2[256]; + if( nums < 1 ) return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buf1, sizeof( buf1) ) != NULL){ + if( strstr( buf1, "TRUE") != 0 ) { + if( Action_PartyCheck( meindex, toindex) == FALSE) { + CHAR_talkToCli( toindex, meindex, "һһ", CHAR_COLORYELLOW); + return FALSE; + } + } + } + if( getStringFromIndexWithDelim( npcarg,"}", nums, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "FREE", buf2, sizeof( buf2) ) == NULL) +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipItem", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "VipPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Item", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Pet", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Abi_Pet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _TEACHER_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuItem", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "StuPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _RMB_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPoint", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPet", buf2, sizeof( buf2) ) == NULL) +#endif + return FALSE; + + + if( NPC_ActionPassCheck( meindex, toindex, buf2) == FALSE ) { +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Item", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Pet", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Abi_Pet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _TEACHER_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _RMB_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPoint", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPet", buf2, sizeof( buf2) ) == NULL) +#endif + { + CHAR_talkToCli( toindex, meindex, "㣡", CHAR_COLORYELLOW); + return FALSE; + } + } + return Action_RunDoEventAction( meindex, toindex, buf1); +} + +BOOL ActionNpc_CheckFree( int meindex, int toindex, char *npcarg) +{ + char buf1[2048], buf2[256]; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buf1, sizeof( buf1) ) != NULL){ + if( strstr( buf1, "TRUE") != 0 ) { + if( Action_PartyCheck( meindex, toindex) == FALSE) { + CHAR_talkToCli( toindex, meindex, "һһ", CHAR_COLORYELLOW); + return FALSE; + } + } + } + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf2, sizeof( buf2) ) == NULL) +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Item", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Pet", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Abi_Pet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _TEACHER_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _RMB_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPoint", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPet", buf2, sizeof( buf2) ) == NULL) +#endif + return FALSE; + + if( NPC_ActionPassCheck( meindex, toindex, buf2) == FALSE ) { +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "VipPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _VIP_SHOP + if( NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Item", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Pet", buf2, sizeof( buf2) ) == NULL) + if(NPC_Util_GetStrFromStrWithDelim( buf1, "Vip_Abi_Pet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _TEACHER_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "StuPet", buf2, sizeof( buf2) ) == NULL) +#endif +#ifdef _RMB_SYSTEM + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPoint", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbItem", buf2, sizeof( buf2) ) == NULL) + if( NPC_Util_GetStrFromStrWithDelim( buf1, "RmbPet", buf2, sizeof( buf2) ) == NULL) +#endif + { + CHAR_talkToCli( toindex, meindex, "㣡", CHAR_COLORYELLOW); + return FALSE; + } + } + return Action_RunDoEventAction( meindex, toindex, buf1); +} + +#ifdef _CHANNEL_MODIFY +extern int *piOccChannelMember; +#endif + +BOOL Action_RunDoEventAction( int meindex, int toindex, char *buf1) +{ + char buf2[2048]; + +#if 1 // Robin NPCִжǰһμFREE + if( NPC_Util_GetStrFromStrWithDelim( buf1, "FREE", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionPassCheck( meindex, toindex, buf2 ) == FALSE && buf2[0] == '\n' ) { + print("\n ķ!?NPCFREE!!:%s:%d,%d,%d ", + CHAR_getChar(toindex, CHAR_CDKEY), + CHAR_getInt(toindex, CHAR_FLOOR), + CHAR_getInt(toindex, CHAR_X), + CHAR_getInt(toindex, CHAR_Y) ); + CHAR_warpToSpecificPoint(toindex,117,225,13); + return FALSE; + } + } +#endif + + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddGold", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddGold2( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelGold", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDelGold( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddFame", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddFame( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelFame", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDelFame( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddVipPoint", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddVipPoint( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelVipPoint", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDelVipPoint( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddPoint", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddPoint( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelPoint", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDelPoint( toindex, buf2) == FALSE ) + return FALSE; + } +#ifdef _VIGOR_SYS + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddVigor", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddVigor( toindex, buf2) == FALSE ) + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelVigor", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDelVigor( toindex, buf2) == FALSE ) + return FALSE; + } +#endif + +#ifdef _MOMENTUM_NPC + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelMom", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionMomentum( toindex, buf2) == FALSE ) + return FALSE; + } +#endif +#ifdef _DP_NPC + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelDP", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionDP( toindex, buf2) == FALSE ) + return FALSE; + } +#endif + if( NPC_Util_GetStrFromStrWithDelim( buf1, "DelItem", buf2, sizeof( buf2)) != NULL ) { + //print("\n DelItem:%s:%d ", __FILE__, __LINE__); + if( NPC_ActionDelItem( toindex, buf2) == FALSE ) { + //print("\n ķ??NPC_ActionDelItem:%s:%s ", CHAR_getChar(toindex, CHAR_CDKEY), buf2); + //CHAR_warpToSpecificPoint(toindex,117,225,13); + return FALSE; + } + } + + //npcĵ + if( NPC_Util_GetStrFromStrWithDelim( buf1, "AddItem", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionAddItem( toindex, buf2) == FALSE ) + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( buf1, "GetUpItem", buf2, sizeof( buf2)) != NULL ) { + if( NPC_ActionUpItem( toindex, buf2) == FALSE ) + return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( buf1, "HeChengMsg", buf2, sizeof( buf2)) != NULL ) { + int k; + int playernum = CHAR_getPlayerMaxNum(); + char hcmsg[256]; + sprintf(hcmsg,"ϳɴˡϲҡ%sɹϳ%s",CHAR_getChar(toindex,CHAR_NAME),buf2); + for(k=0;k PROFESSION_CLASS_NONE && p_class < PROFESSION_CLASS_NUM ) // 1:սʿ 2:ʦ 3: + { + int i, value = 0; + int skill_id = -1; + + // ԭ + if( PROFESSION_RESTORE_POINT( toindex ) != 1 ) return FALSE; + + // 趨ְҵ + CHAR_setInt( toindex, PROFESSION_CLASS, p_class ); +#ifdef _CHANNEL_MODIFY + if(CHAR_getInt(toindex,PROFESSION_CLASS) > 0){ + int i,pclass = CHAR_getInt(toindex,PROFESSION_CLASS) - 1; + for(i=0;i 0){ + int i,pclass = CHAR_getInt(toindex,PROFESSION_CLASS) - 1; + for(i=0;i") != NULL ){ + strcat( Head, ">"); + flg = 1; + }else if( strstr( buf2, "<") != NULL ){ + strcat( Head, "<"); + flg = 2; + }else if( strstr( buf2, "!") != NULL ) { + strcat( Head, "!"); + flg = 5; + } + }else if(strstr( buf2, "<") != NULL){ + strcpy( Head, "<"); + flg = 4; + }else if(strstr( buf2, ">") != NULL){ + strcpy( Head, ">"); + flg = 3; + } + Head[ strlen( Head)+1] = 0; + if( NPC_Util_GetStrFromStrWithDelim( buf2, Head, buf3, sizeof( buf3) ) != NULL) { + if( flg == 0 ) + if( atoi(buf3) != partys ) return FALSE; + else if( flg == 1 ) + if( atoi(buf3) < partys ) return FALSE; + else if( flg == 2 ) + if( atoi(buf3) > partys ) return FALSE; + else if( flg == 3 ) + if( atoi(buf3) <= partys ) return FALSE; + else if( flg == 4 ) + if( atoi(buf3) >= partys ) return FALSE; + else if( flg == 5 ) + if( atoi(buf3) == partys ) return FALSE; + } + }*/ +#endif + + ActionNpc_WarpPoint( meindex, toindex, buf1); + return TRUE; +} +BOOL Action_PartyCheck( int meindex, int talker) +{ + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + return FALSE; + } + return TRUE; +} + +BOOL NPC_ActionAddGold( int talker, int Golds) +{ + CHAR_AddGold( talker, Golds); + return TRUE; +} + +BOOL NPC_ActionDelGold( int talker,char *buf) +{ + int Golds=0; + int PGold=0; + if( buf == NULL ) return FALSE; + Golds = atoi( buf); + PGold = CHAR_getInt( talker, CHAR_GOLD); + if( PGold < Golds ) { + CHAR_talkToCli( talker, -1, "ϵǮร", CHAR_COLORYELLOW); + return FALSE; + }else { + char buf1[256]; + sprintf( buf1, "%dʯ", Golds); + CHAR_talkToCli( talker, -1, buf1, CHAR_COLORYELLOW); + } + CHAR_setInt( talker, CHAR_GOLD, PGold-Golds); + CHAR_send_P_StatusString( talker , CHAR_P_STRING_GOLD); + return TRUE; +} + +BOOL NPC_ActionAddFame( int talker,char *buf) +{ + int Fames=0; + int MFame=0; + if( buf == NULL ) return FALSE; + Fames = atoi( buf); + MFame = CHAR_getInt( talker, CHAR_FAME)+Fames*100; + if( MFame > 1000000 ) { + CHAR_talkToCli( talker, -1, "ร", CHAR_COLORYELLOW); + return FALSE; + }else { + char buf1[256]; + sprintf( buf1, "%d", Fames); + CHAR_talkToCli( talker, -1, buf1, CHAR_COLORYELLOW); + } + CHAR_setInt( talker, CHAR_FAME, MFame); + return TRUE; +} + +BOOL NPC_ActionDelFame( int talker,char *buf) +{ + int Fames=0; + int MFame=0; + if( buf == NULL ) return FALSE; + Fames = atoi( buf); + MFame = CHAR_getInt( talker, CHAR_FAME)/100; + if( MFame < Fames ) { + CHAR_talkToCli( talker, -1, "ร", CHAR_COLORYELLOW); + return FALSE; + }else { + char buf1[256]; + sprintf( buf1, "%d", Fames); + CHAR_talkToCli( talker, -1, buf1, CHAR_COLORYELLOW); + } + CHAR_setInt( talker, CHAR_FAME, CHAR_getInt( talker, CHAR_FAME)-Fames*100); + return TRUE; +} +BOOL NPC_ActionAddVipPoint( int talker,char *buf) +{ + int Vippoints=0; + int MVippoint=0; + if( buf == NULL ) return FALSE; + Vippoints = atoi( buf); + MVippoint = sasql_vippoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + char buf1[256]; + sprintf( buf1, "%dԱ", Vippoints); + CHAR_talkToCli( talker, -1, buf1, CHAR_COLORYELLOW); + sasql_vippoint( CHAR_getChar(talker,CHAR_CDKEY), Vippoints,1); + return TRUE; +} +BOOL NPC_ActionDelVipPoint( int talker,char *buf) +{ + int Vippoints=0; + int MVippoint=0; + if( buf == NULL ) return FALSE; + Vippoints = atoi( buf); + MVippoint = sasql_vippoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if(MVippoint MaxGold ) total_gold = MaxGold; + + CHAR_setInt( talker, CHAR_GOLD, total_gold ); + CHAR_send_P_StatusString( talker , CHAR_P_STRING_GOLD); + return TRUE; +} + +BOOL NPC_ActionDelPet( int talker, char *buf) +{ + int petsel; + int petindex=0, k=1; + int fd = getfdFromCharaIndex( talker ); + char msgbuf[64], szPet[128],buff2[256],buff3[256]; + char buf2[256],buff1[256]; + int defpet; + int petno,kNum,find=0,petLv=0,flg=-1; + + while( getStringFromIndexWithDelim(buf , "," , k, buff1, sizeof( buff1)) !=FALSE ) { + k++; + if( strstr( buff1,"-") != NULL ) { + getStringFromIndexWithDelim(buff1,"-",2,buff3,sizeof(buff3)); + getStringFromIndexWithDelim(buff1,"-",1,buf2,sizeof(buf2)); + + if( strstr( buf2,"!") != NULL ) { + flg = 0; + getStringFromIndexWithDelim(buf2,"!=",2,buff2,sizeof(buff2)); + }else if( strstr( buf,"<") != NULL ) { + flg = 1; + getStringFromIndexWithDelim(buf2,"<",2,buff2,sizeof(buff2)); + }else if( strstr( buf,">") != NULL ) { + flg = 2; + getStringFromIndexWithDelim(buf2,">",2,buff2,sizeof(buff2)); + }else if( strstr( buf,"=") != NULL) { + flg = 3; + getStringFromIndexWithDelim(buf2,"=",2,buff2,sizeof(buff2)); + }else + return FALSE; + petLv = atoi( buff2); + } + continue; + + if(strstr(buff3,"*")!=NULL){ + getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); + petno = atoi(buf2); + getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); + kNum = atoi(buf2); + }else { + petno = atoi( buff3); + kNum = 30; + } + //andy_log + print("petno:%d kNum:%d \n ", petno, kNum); + + find =0; + + for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++) { + petindex = CHAR_getCharPet( talker, petsel); + if( !CHAR_CHECKINDEX(petindex)) continue; + if(CHAR_getInt( petindex, CHAR_PETID) != petno )continue; + + switch( flg) { + case 0: + if( CHAR_getInt( petindex, CHAR_LV ) != petLv ) { + }else { + continue; + } + break; + case 1: + if( CHAR_getInt( petindex, CHAR_LV ) < petLv ) { + }else { + continue; + } + break; + case 2: + if( CHAR_getInt( petindex, CHAR_LV ) > petLv ) { + }else { + continue; + } + break; + case 3: + if( CHAR_getInt( petindex, CHAR_LV ) != petLv )continue; + break; + } + + petindex = CHAR_getCharPet( talker, petsel); + if( !CHAR_CHECKINDEX(petindex) ) + continue; + if( CHAR_getWorkInt( CONNECT_getCharaindex( fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) + continue; + defpet = CHAR_getInt( talker, CHAR_DEFAULTPET); + + if(defpet == petsel) { + CHAR_setInt( talker, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + + snprintf( msgbuf,sizeof( msgbuf), "%s", CHAR_getChar( petindex, CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + LogPet( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "TenseiDel", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + CHAR_setCharPet( talker, petsel, -1); + CHAR_endCharOneArray( petindex ); + snprintf( szPet, sizeof( szPet ), "K%d", petsel); + CHAR_sendStatusString( talker, szPet ); + + find++; + if( find >= kNum ) + break; //Ŀɾ + } + } + + return TRUE; +} + +#ifdef _NPC_NewDelPet +BOOL NPC_ActionNewDelPet( int toindex, char *msg) +{ + int i,petindex=0,petlev,petnum,petcount,mypetlevel,petid; + char buf[32],buf2[32]; + int flg=0,count=0; + + //ȽϷʽ + if ( strstr( msg, "=" ) ) + flg = 0; + else if( strstr( msg, "<" ) ) + flg = 1; + else + flg = 2; + + //ȼ + if ( getStringFromIndexWithDelim( msg, "-", 1, buf, sizeof( buf )) ){ + char cmp[12]; + if( flg == 0 ) + strcpy(cmp,"="); + else if( flg == 1 ) + strcpy(cmp,"<"); + else + strcpy(cmp,">"); + if ( getStringFromIndexWithDelim( buf, cmp, 2, buf2, sizeof( buf2 )) ){ + petlev = atoi(buf2); + } + else + return FALSE; + } + else + return FALSE; + + // + if ( getStringFromIndexWithDelim( msg, "-", 2, buf, sizeof( buf )) ){ + if ( getStringFromIndexWithDelim( buf, "*", 1, buf2, sizeof( buf2 )) ){ + petnum = atoi( buf2 ); + } + else + return FALSE; + } + else + return FALSE; + + // + if ( getStringFromIndexWithDelim( msg, "-", 2, buf, sizeof( buf )) ){ + if ( getStringFromIndexWithDelim( buf, "*", 2, buf2, sizeof( buf2 )) ){ + petcount = atoi( buf2 ); + } + else + return FALSE; + } + else + return FALSE; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + BOOL cmp=FALSE; + petindex = CHAR_getCharPet( toindex, i); + petid = CHAR_getInt( petindex, CHAR_PETID); + mypetlevel = CHAR_getInt( petindex, CHAR_LV); + + if( flg == 0 ) + if( mypetlevel == petlev ) cmp = TRUE; + if( flg == 1 ) + if( mypetlevel < petlev ) cmp = TRUE; + if( flg == 2 ) + if( mypetlevel > petlev ) cmp = TRUE; + + if( petnum == petid && cmp ){//ɾ + char szPet[128]; + int defpet; + char msgbuf[64]; + int fd = getfdFromCharaIndex( toindex ); + + if( !CHAR_CHECKINDEX(petindex) ) return FALSE; + + if( CHAR_getInt( toindex, CHAR_RIDEPET) == i ) { + + //CHAR_talkToCli( talker, -1, "еij޷", CHAR_COLORYELLOW ); + //return FALSE; + + CHAR_setInt( toindex, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( toindex, CHAR_P_STRING_RIDEPET ); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + } + + //ƽҷ» ئգʸëڱ + if( CHAR_getWorkInt( CONNECT_getCharaindex( fd ), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + return FALSE; + //ʸᆴ + defpet = CHAR_getInt( toindex, CHAR_DEFAULTPET); + if(defpet == i){ + CHAR_setInt( toindex, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + + snprintf( msgbuf,sizeof( msgbuf), "%s", + CHAR_getChar( petindex, CHAR_NAME)); + CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE); + + // ʸë ׷ + LogPet( CHAR_getChar( toindex, CHAR_NAME ), // ƽҷ + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "EvnetDell(ɾ)", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + + // + CHAR_setCharPet( toindex, i, -1); + + CHAR_endCharOneArray( petindex ); + + snprintf( szPet, sizeof( szPet ), "K%d", i); + // ޥʸ ˪Ի + CHAR_sendStatusString( toindex, szPet ); + + ++count; + if( count >= petcount ) + break; + } + } + + return TRUE; +} +#endif + +BOOL NPC_ActionAddPet( int talker, char *buf) +{ + int ret; + char msgbuf[64], buff3[64]; + int enemynum; + int i,j,k=1; + int petindex, petindex2, petid; + + k=1; + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + //Ƿпλ + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ){ + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } +#ifdef _PET_MM + if(strstr(buff3,"MM1") || strstr(buff3,"MM3")) + petid = 1479; + else if(strstr(buff3,"MM2") || strstr(buff3,"MM4")) + petid = 2547; + else + petid = atoi( buff3); +#else + petid = atoi( buff3); +#endif + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID ) == petid ) + //if( ENEMY_getInt( i, ENEMY_TEMPNO ) == petid ) + break; + } + + if( i == enemynum ) + continue; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + i = 0; + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ +#ifdef _PET_MM + if(strstr(buff3,"MM1") || strstr(buff3,"MM2")){ + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + }else if(strstr(buff3,"MM3") || strstr(buff3,"MM4")){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } +#endif + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + continue; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + + LogPet( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex2, CHAR_NAME), + CHAR_getInt( petindex2, CHAR_LV), + "TenseiGet", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex2, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + } + return TRUE; +} + +BOOL NPC_ActionTiaoZhanMsg( int toindex, char *msg) +{ + int k; + int playernum = CHAR_getPlayerMaxNum(); + char tzmsg[256]; + sprintf(tzmsg,"սȷ桹ϲҡ%s%s",CHAR_getChar(toindex,CHAR_NAME),msg); + for(k=0;k= (num-finditem) ){ + pilenum -= (num-finditem); + onenum += (num-finditem); + }else { + onenum = pilenum; + pilenum=0; + } + finditem += onenum; + + ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum); + sprintf( token, "%d%s", onenum, ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); + if( pilenum <= 0 ){ + LogItem( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "ȡ", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + + + CHAR_setItemIndex( toindex, i, -1); + ITEM_endExistItemsOne( itemindex); + } + CHAR_sendItemDataOne( toindex, i); + } + + if( finditem != num && num != -1 ) return FALSE; + return TRUE; +} + +BOOL NPC_ActionDelItem( int talker, char *buf) +{ + char buff3[128], buf2[32]; + int k=1, itemid, neednum; + if( !CHAR_CHECKINDEX( talker) ) return FALSE; + while( getStringFromIndexWithDelim(buf , "," , k++, buff3, sizeof(buff3)) !=FALSE ) { + neednum = 1; + if( getStringFromIndexWithDelim( buff3, "*", 1, buf2, sizeof(buf2)) == FALSE ) continue; + itemid = atoi( buf2); + if( getStringFromIndexWithDelim( buff3, "*", 2, buf2, sizeof(buf2)) == TRUE ){ + neednum = atoi( buf2); + if( NPC_ActionDoPileDelItem( talker, itemid, neednum) == FALSE ) return FALSE; + }else{ + NPC_ActionDoPileClearItem( talker, itemid); + } + } + return TRUE; +} +#else +BOOL NPC_ActionDelItem( int talker, char *buf) +{ + int i = 1, j = 1,k = 1; + char buff3[128]; + char buf2[32]; + int itemindex; + char token[256]; + + if( !CHAR_CHECKINDEX( talker) ) return FALSE; + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ) { + k++; + if(strstr(buff3,"*")!=NULL){ + int itemno, kosuu=0, id, cnt=0; + struct _tagItemArray { + int index; + int itemindex; + }; + struct _tagItemArray ItemArray[20]; + for( i=0; i<20 ; i++){ + ItemArray[i].itemindex = -1; + ItemArray[i].index = -1; + } + //ȡִ + getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); + itemno = atoi(buf2); + getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); + kosuu = atoi(buf2); + //ȡ item index + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + ItemArray[cnt].itemindex = itemindex; + ItemArray[cnt].index = i; + cnt++; + } + } + if(cnt == kosuu) + break; + } + if(cnt != kosuu){ + CHAR_talkToCli( talker, -1,"", CHAR_COLORYELLOW); + return FALSE; + } + //ȡƷ + for( i=0; i<20; i++) { + itemindex = ItemArray[i].itemindex; + if( !ITEM_CHECKINDEX(itemindex) ) break; + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + CHAR_setItemIndex( talker, ItemArray[i].index ,-1); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( talker, ItemArray[i].index); + LogItem( + CHAR_getChar( talker, CHAR_NAME ), CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "WarpManDelItem", + CHAR_getInt( talker, CHAR_FLOOR), CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + }else{ + for( j = CHAR_STARTITEMARRAY ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + if( ITEM_CHECKINDEX(itemindex) ){ + if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ + LogItem( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "WarpManDelItem", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + sprintf( token, "%s", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + CHAR_DelItem( talker, j); + } + } + } + } + } + return TRUE; +} +#endif + +#ifdef _VIP_SHOP +BOOL NPC_ActionVipItem( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int itemID,itemindex=-1; + int pVipPoint, VipPoints; + char buff[256], token[256]; + int ret; + + if(getStringFromIndexWithDelim(buf , "," , 1, buff, sizeof(buff)) !=FALSE) + itemID = atoi(buf); + + itemindex = CHAR_findEmptyItemBox( talker ); + if( itemindex < 0 ) { + CHAR_talkToCli( talker, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + if(getStringFromIndexWithDelim(buf , "," , 2, buff, sizeof(buff)) !=FALSE) + VipPoints=atoi(buff); + if(VipPoints<0)VipPoints=0; + + pVipPoint = sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if( pVipPoint < VipPoints ) { + CHAR_talkToCli( talker, -1, "ĻֲŶ", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( itemID ); + if( itemindex != -1 ){ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + + sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), -VipPoints,1); + sprintf( token, "۳%d", VipPoints); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + + CHAR_sendItemDataOne( talker, ret); + } + + return TRUE; +} + +BOOL NPC_ActionVipPet( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int ret; + char msgbuf[64], buf1[8], buf2[10]; + int enemynum; + int i,j; + int petindex, petindex2, petid; + int pVipPoint, VipPoints; + + if(getStringFromIndexWithDelim(buf , "," , 1, buf1, sizeof(buf1)) !=FALSE) +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM3")) + petid = 1479; + else if(strstr(buf1,"MM2") || strstr(buf1,"MM4")) + petid = 2547; + else + petid = atoi( buf1 ); +#else + petid = atoi( buf1 ); +#endif + + if(getStringFromIndexWithDelim(buf , "," , 2, buf2, sizeof(buf2)) !=FALSE) + VipPoints=atoi(buf2); + if(VipPoints<0)VipPoints=0; + + pVipPoint = sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if( pVipPoint < VipPoints ) { + CHAR_talkToCli( talker, -1, "ĻֲŶ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( talker, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM2")){ + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + }else if(strstr(buf1,"MM3") || strstr(buf1,"MM4")){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } +#endif + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), -VipPoints,1); + snprintf( msgbuf,sizeof( msgbuf), "۳%d", VipPoints); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + return TRUE; +} +#endif + +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipItem( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int itemID,itemindex=-1; + int pVipPoint, VipPoints, zhe; + char buff[256], token[256]; + int ret; + int fd = getfdFromCharaIndex( talker); + char* id = CHAR_getChar(talker, CHAR_CDKEY); + if(getStringFromIndexWithDelim(buf , "," , 1, buff, sizeof(buff)) !=FALSE) + itemID = atoi(buf); + + itemindex = CHAR_findEmptyItemBox( talker ); + if( itemindex < 0 ) { + CHAR_talkToCli( talker, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + if(getStringFromIndexWithDelim(buf , "," , 2, buff, sizeof(buff)) !=FALSE) + VipPoints=atoi(buff); + if(VipPoints<0)VipPoints=0; + + pVipPoint = sasql_vippoint(id,0,0); + if( pVipPoint < VipPoints ) { + CHAR_talkToCli( talker, -1, "ϵĵŶ", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( itemID ); + if( itemindex != -1 ){ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + + sasql_vippoint(id,-VipPoints,1); + + sprintf( token, "۳Ա%d", VipPoints); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + CHAR_sendItemDataOne( talker, ret); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } + + return TRUE; +} + +BOOL NPC_ActionNewVipPet( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int ret; + char msgbuf[64], buf1[8], buf2[10]; + int enemynum; + int i,j; + int petindex, petindex2, petid; + int pVipPoint, VipPoints, zhe; + int fd = getfdFromCharaIndex( talker); + char* id = CHAR_getChar(talker, CHAR_CDKEY); + if(getStringFromIndexWithDelim(buf , "," , 1, buf1, sizeof(buf1)) !=FALSE) +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM3")) + petid = 1479; + else if(strstr(buf1,"MM2") || strstr(buf1,"MM4")) + petid = 2547; + else + petid = atoi( buf1 ); +#else + petid = atoi( buf1 ); +#endif + + if(getStringFromIndexWithDelim(buf , "," , 2, buf2, sizeof(buf2)) !=FALSE) + VipPoints=atoi(buf2); + if(VipPoints<0)VipPoints=0; + + pVipPoint = sasql_vippoint(id,0,0); + if( pVipPoint < VipPoints ) { + CHAR_talkToCli( talker, -1, "ϵĵŶ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( talker, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM2")){ + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + }else if(strstr(buf1,"MM3") || strstr(buf1,"MM4")){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } +#endif + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + sasql_vippoint(id,-VipPoints,1); + snprintf( msgbuf,sizeof( msgbuf), "۳Ա%d", VipPoints); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return TRUE; +} +#endif + +BOOL NPC_ActionNewVipAbiPet( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int ret; + char msgbuf[64], buf1[10], buf2[10]; + int enemynum; + int vital,str,tough,dex,petlevel,pettrans; + int i,j; + int petindex, petindex2, petid; + int pVipPoint, VipPoints; + int fd = getfdFromCharaIndex( talker); + char* id = CHAR_getChar(talker, CHAR_CDKEY); + + easyGetTokenFromString( buf , 1 , buf1, sizeof(buf1)); + petid=atoi(buf1); + easyGetTokenFromString( buf , 2 , buf1, sizeof(buf1)); + vital=atoi(buf1); + easyGetTokenFromString( buf , 3 , buf1, sizeof(buf1)); + str=atoi(buf1); + easyGetTokenFromString( buf , 4 , buf1, sizeof(buf1)); + tough=atoi(buf1); + easyGetTokenFromString( buf , 5 , buf1, sizeof(buf1)); + dex=atoi(buf1); + easyGetTokenFromString( buf , 6 , buf1, sizeof(buf1)); + petlevel=atoi(buf1); + easyGetTokenFromString( buf , 7 , buf1, sizeof(buf1)); + pettrans=atoi(buf1); + + if( petlevel != -1 ){ +#ifdef _TRANS_LEVEL_CF + if( petlevel > getMaxLevel() ) petlevel = getMaxLevel(); +#else + if( petlevel > 140 ) level = 140; +#endif + if( petlevel <= 0 ) petlevel = 1; +} + else{ + petlevel = 1; +} + if(pettrans>2){ + pettrans=2; + } + if(pettrans<0){ + pettrans=0; + } + + if(getStringFromIndexWithDelim(buf , "," , 2, buf2, sizeof(buf2)) !=FALSE) + VipPoints=atoi(buf2); + if(VipPoints<0)VipPoints=0; + + pVipPoint = sasql_vippoint(id,0,0); + if( pVipPoint < VipPoints ) { + CHAR_talkToCli( talker, -1, "ϵĵŶ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( talker, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setInt( ret, CHAR_VITAL, vital); + CHAR_setInt( ret, CHAR_STR, str*80); + CHAR_setInt( ret, CHAR_TOUGH, tough*80); + CHAR_setInt( ret, CHAR_DEX, dex*100); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + CHAR_setInt( ret, CHAR_LV, petlevel); + CHAR_setInt( ret, CHAR_TRANSMIGRATION, pettrans); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + sasql_vippoint(id,-VipPoints,1); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + snprintf( msgbuf,sizeof( msgbuf), "۳Ա%d", VipPoints); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return TRUE; +} + +#ifdef _STU_SYS +BOOL NPC_ActionStuItem( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int itemID,itemindex=-1; + int pStuPoint, StuPoints; + char buff[256], token[256]; + int ret; + + if(getStringFromIndexWithDelim(buf , "," , 1, buff, sizeof(buff)) !=FALSE) + itemID = atoi(buf); + + itemindex = CHAR_findEmptyItemBox( talker ); + if( itemindex < 0 ) { + CHAR_talkToCli( talker, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + if(getStringFromIndexWithDelim(buf , "," , 2, buff, sizeof(buff)) !=FALSE) + StuPoints=atoi(buff); + if(StuPoints<0)StuPoints=0; + + pStuPoint = CHAR_getInt( talker, CHAR_STUNUM); + if( pStuPoint < StuPoints ) { + CHAR_talkToCli( talker, -1, "ͽŶ", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( itemID ); + if( itemindex != -1 ){ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + + CHAR_setInt( talker, CHAR_STUNUM, pStuPoint-StuPoints); + sprintf( token, "۳ͽ%d", StuPoints); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + + CHAR_sendItemDataOne( talker, ret); + } + + return TRUE; +} + +BOOL NPC_ActionStuPet( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int ret; + char msgbuf[64], buf1[8], buf2[10]; + int enemynum; + int i,j; + int petindex, petindex2, petid; + int pStuPoint, StuPoints; + + if(getStringFromIndexWithDelim(buf , "," , 1, buf1, sizeof(buf1)) !=FALSE) +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM3")) + petid = 1479; + else if(strstr(buf1,"MM2") || strstr(buf1,"MM4")) + petid = 2547; + else + petid = atoi( buf1 ); +#else + petid = atoi( buf1 ); +#endif + + if(getStringFromIndexWithDelim(buf , "," , 2, buf2, sizeof(buf2)) !=FALSE) + StuPoints=atoi(buf2); + if(StuPoints<0)StuPoints=0; + + pStuPoint = CHAR_getInt( talker, CHAR_STUNUM); + if( pStuPoint < StuPoints ) { + CHAR_talkToCli( talker, -1, "ͽŶ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( talker, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM2")){ + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + }else if(strstr(buf1,"MM3") || strstr(buf1,"MM4")){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } +#endif + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + CHAR_setInt( talker, CHAR_STUNUM, pStuPoint-StuPoints); + snprintf( msgbuf,sizeof( msgbuf), "۳ͽ%d", StuPoints); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + return TRUE; +} +#endif + +#ifdef _RMB_SYSTEM +BOOL NPC_ActionRmbPoint( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int pRmbPoint, RmbPoints; + char buff[256], token[256]; + int point_num=0; + + if(getStringFromIndexWithDelim(buf , "," , 1, buff, sizeof(buff)) !=FALSE) + point_num = atoi(buf); + + if(point_num<0) return FALSE; + + if(getStringFromIndexWithDelim(buf , "," , 2, buff, sizeof(buff)) !=FALSE) + RmbPoints=atoi(buff); + if(RmbPoints<0)RmbPoints=0; + + pRmbPoint = sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if( pRmbPoint < RmbPoints ) { + CHAR_talkToCli( talker, -1, "ֽ𲻹Ŷ", CHAR_COLORYELLOW); + return FALSE; + } + + sasql_vippoint( CHAR_getChar(talker,CHAR_CDKEY), point_num,1); + + sprintf( token,"%dԱ",point_num); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + + sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), -RmbPoints,1); + sprintf( token, "۳ֽ%d", RmbPoints); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + + return TRUE; +} + +BOOL NPC_ActionRmbItem( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int itemID,itemindex=-1; + int pRmbPoint, RmbPoints; + char buff[256], token[256]; + int ret; + + if(getStringFromIndexWithDelim(buf , "," , 1, buff, sizeof(buff)) !=FALSE) + itemID = atoi(buf); + + itemindex = CHAR_findEmptyItemBox( talker ); + if( itemindex < 0 ) { + CHAR_talkToCli( talker, -1, "Ʒռ䲻㣡", CHAR_COLORYELLOW); + return FALSE; + } + + if(getStringFromIndexWithDelim(buf , "," , 2, buff, sizeof(buff)) !=FALSE) + RmbPoints=atoi(buff); + if(RmbPoints<0)RmbPoints=0; + + pRmbPoint = sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if( pRmbPoint < RmbPoints ) { + CHAR_talkToCli( talker, -1, "ֽ𲻹Ŷ", CHAR_COLORYELLOW); + return FALSE; + } + + itemindex = ITEM_makeItemAndRegist( itemID ); + if( itemindex != -1 ){ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + + sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), -RmbPoints,1); + sprintf( token, "۳ֽ%d", RmbPoints); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW); + + CHAR_sendItemDataOne( talker, ret); + } + + return TRUE; +} + +BOOL NPC_ActionRmbPet( int talker, char *buf) +{ + if (CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return FALSE; + } + int ret; + char msgbuf[64], buf1[8], buf2[10]; + int enemynum; + int i,j; + int petindex, petindex2, petid; + int pRmbPoint, RmbPoints; + + if(getStringFromIndexWithDelim(buf , "," , 1, buf1, sizeof(buf1)) !=FALSE) +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM3")) + petid = 1479; + else if(strstr(buf1,"MM2") || strstr(buf1,"MM4")) + petid = 2547; + else + petid = atoi( buf1 ); +#else + petid = atoi( buf1 ); +#endif + + if(getStringFromIndexWithDelim(buf , "," , 2, buf2, sizeof(buf2)) !=FALSE) + RmbPoints=atoi(buf2); + if(RmbPoints<0)RmbPoints=0; + + pRmbPoint = sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if( pRmbPoint < RmbPoints ) { + CHAR_talkToCli( talker, -1, "ֽ𲻹Ŷ", CHAR_COLORYELLOW); + return FALSE; + } + + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) + break; + } + + if( i == CHAR_MAXPETHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), ""); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) + return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + if( CHAR_getCharPet( talker, i ) == ret ) + break; + } + if( i == CHAR_MAXPETHAVE ) + CHAR_talkToCli( talker, -1, "ȡʧܣ", CHAR_COLORYELLOW); + + if( CHAR_CHECKINDEX( ret ) == TRUE ){ +#ifdef _PET_MM + if(strstr(buf1,"MM1") || strstr(buf1,"MM2")){ + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + }else if(strstr(buf1,"MM3") || strstr(buf1,"MM4")){ + while(CHAR_getInt( ret, CHAR_LV)<79){ // + int LevelUpPoint; + LevelUpPoint = ( 50<< 24) + ( 50<< 16) + ( 50<< 8) + ( 50<< 0); + CHAR_setInt( ret, CHAR_ALLOCPOINT, LevelUpPoint); + CHAR_PetLevelUp( ret ); + CHAR_PetAddVariableAi( ret, AI_FIX_PETLEVELUP ); + CHAR_setInt( ret, CHAR_LV, CHAR_getInt( ret, CHAR_LV) +1 ); + } + } +#endif + CHAR_setInt( ret, CHAR_HP, CHAR_getWorkInt( ret, CHAR_WORKMAXHP )); + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + CHAR_setInt(ret,CHAR_VARIABLEAI,10000); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) + return FALSE; + snprintf( msgbuf,sizeof( msgbuf), "õ%s", CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + sasql_rmbpoint( CHAR_getChar(talker,CHAR_CDKEY), -RmbPoints,1); + snprintf( msgbuf,sizeof( msgbuf), "۳ֽ%d", RmbPoints); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + return TRUE; +} +#endif + +#ifdef _TRANS_7_NPC +BOOL NPC_ActionTrans7( int talker, char *buf) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<80){ + sprintf( token, "תȼС80תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif + NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + CHAR_setInt(talker, CHAR_LV ,1); + CHAR_setMaxExp( talker, 0); + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_TRANSMIGRATION)*10); + CHAR_Skillupsend( talker ); + CHAR_setInt( talker,CHAR_RIDEPET, -1 ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); +} + +#ifdef _TRANS7_POINT +BOOL NPC_ActionTransNewSeven( int talker, char *buf) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<160){ + sprintf( token, "תȼС160תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif +// NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+getTrans7Point()); + + CHAR_Skillupsend( talker ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); +} +#endif +BOOL NPC_ActionTransNew7( int talker, char *buf) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<160){ + sprintf( token, "תȼС160תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif +// NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + if(CHAR_getInt(talker,CHAR_SUPER)==1) + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+80); + else + { + if(CHAR_getInt(talker,CHAR_VIPRIDE)>0) + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+75); + else + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+70); + } + CHAR_Skillupsend( talker ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); +} +#endif + +BOOL NPC_ActionAddItem( int talker, char *buf) +{ + int itemID,k=0,itemindex=-1; + int spaceNum=5,i; + char buff3[256], msgbuf[64], token[256]; + int ret; + + k=1; + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + for( i = spaceNum ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( itemindex == -1 ) { + spaceNum = i+1; + break; + } + } + if( i == CHAR_MAXITEMHAVE ) { + snprintf( msgbuf,sizeof( msgbuf), "Ʒռ䲻㣡"); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORYELLOW); + return FALSE; + } + } + k=1; + while( getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + itemID = atoi( buff3); + if( itemID ) + itemindex = ITEM_makeItemAndRegist( itemID); + if(itemindex == -1) + continue; + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + print ("\n ret error!!"); + return FALSE; + } + + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( talker, ret); + } + + return TRUE; +} + +BOOL NPC_ActionSetEend( int talkerindex, char * buf) +{ + int eveno; + int talkNo=1, iflg=0; + char buf1[256]; + + while( getStringFromIndexWithDelim( buf,",",talkNo,buf1,sizeof( buf1)) != FALSE) { + talkNo++; + eveno = atoi( buf); + NPC_EventSetFlg( talkerindex, eveno); + if( ++iflg > 20 ) break; + } + return TRUE; +} + +BOOL NPC_ActionClearEvent( int toindex, char * buf) +{ + int eveno; + int talkNo=1, iflg=0; + char buf1[256]; + + while( getStringFromIndexWithDelim( buf,",",talkNo,buf1,sizeof( buf1)) != FALSE) { + talkNo++; + eveno = atoi( buf); + NPC_EndEventSetFlgCls( toindex, eveno); + if( ++iflg > 20 ) break; + } + return TRUE; +} + +BOOL NPC_ActionSetNow( int toindex, char * buf) +{ + int eveno; + int talkNo=1, iflg=0; + char buf1[256]; + + while( getStringFromIndexWithDelim( buf,",",talkNo,buf1,sizeof( buf1)) != FALSE) { + talkNo++; + eveno = atoi( buf); + NPC_NowEventSetFlg( toindex, eveno); + if( ++iflg > 20 ) break; + } + return TRUE; +} + + +BOOL NPC_ActionPassCheck( int meindex, int talker, char *buf) +{ + + char buff2[256]; + char buff3[128]; + int i=1,j=1; + int loop=0; + while( getStringFromIndexWithDelim(buf,",",i,buff2,sizeof(buff2)) !=FALSE ) { + i++; + if(strstr(buff2,"&")!=NULL){ + j=1; + loop=0; + while( getStringFromIndexWithDelim(buff2,"&",j,buff3,sizeof(buff3)) !=FALSE ) { + j++; + if(NPC_ActionBigSmallCheck( meindex, talker, buff3)==FALSE) { + loop=1; + break; + } + } + if(loop==0) { + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + } + }else{ + if( NPC_ActionBigSmallCheck( meindex, talker, buff2) == TRUE){ + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + + } + } + } + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, FALSE ); + return FALSE; + +} + +BOOL NPC_ActionBigSmallCheck(int meindex,int talker,char* buf) +{ + + char buff2[128], buff3[128]; + int kosuu,temp=-1,flg=0; + +#ifdef _NEW_WARPMAN + char buff1[128]; + if(strstr( buf, "-") != NULL) { + getStringFromIndexWithDelim( buf, "-", 2, buff3, sizeof(buff3)); + temp = atoi( buff3); + getStringFromIndexWithDelim( buf, "-", 1, buff1, sizeof(buff1)); + strcpy( buf, buff1); + } +#endif + + if( strstr( buf, "<") != NULL ){ + getStringFromIndexWithDelim( buf, "<", 2, buff3, sizeof(buff2)); + kosuu = atoi( buff3); + getStringFromIndexWithDelim( buf, "<", 1, buff2, sizeof(buff2)); + + if( NPC_ActionFreeIfCheck( meindex, talker, buff2, buff3, kosuu, 1, temp)==TRUE){ + return TRUE; + } + }else if(strstr( buf, ">") != NULL){ + getStringFromIndexWithDelim( buf, ">", 2, buff3, sizeof(buff2)); + kosuu = atoi(buff3); + getStringFromIndexWithDelim( buf, ">" ,1, buff2, sizeof(buff2)); + + if( NPC_ActionFreeIfCheck( meindex, talker, buff2, buff3, kosuu, 2, temp) == TRUE ){ + return TRUE; + } + + }else if( strstr( buf, "!" ) != NULL){ + getStringFromIndexWithDelim( buf, "!=", 2, buff3, sizeof(buff2)); + kosuu = atoi( buff3); + getStringFromIndexWithDelim( buf, "!=", 1, buff2, sizeof(buff2)); + if( NPC_ActionFreeIfCheck( meindex, talker, buff2, buff3, kosuu, 0, temp) == TRUE ){ + return FALSE; + }else{ + return TRUE; + } + }else if( strstr( buf, "=") != NULL){ + getStringFromIndexWithDelim( buf, "=", 2, buff3, sizeof(buff2)); + kosuu = atoi( buff3); + getStringFromIndexWithDelim( buf, "=", 1, buff2, sizeof(buff2)); + flg = 0; + if( strstr( buf, "*") != NULL){ + if( NPC_ActionWarpManReduce( meindex, talker, buf)==TRUE){ + return TRUE; + } + } +#ifdef _NPC_ActionFreeCmp + else if( strstr( buf, "^") != NULL){ + if( NPC_ActionWarpManReduce2( meindex, talker, buf)==TRUE){ + return TRUE; + } + } +#endif + else if( NPC_ActionFreeIfCheck( meindex, talker, buff2, buff3, kosuu, flg, temp) == TRUE ) { + return TRUE; + } + } + return FALSE; +} + +#ifdef _NPC_ActionFreeCmp +//ʵܺԭNPC_ActionWarpManReduce,Ϊ˲Ӱǰ趨,Բȥ޸ԭ +BOOL NPC_ActionWarpManReduce2(int meindex,int talker,char *buf) +{ + char buf2[512]; + char buf3[256]; + int i, itemindex, itemno, kosuu; + int id=0; + int nums = 0; + + getStringFromIndexWithDelim(buf,"=",2,buf2,sizeof(buf2)); + getStringFromIndexWithDelim(buf2,"^",1,buf3,sizeof(buf3)); + itemno = atoi(buf3); + getStringFromIndexWithDelim(buf2,"^",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + for( i=CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if( itemno == id ){ + nums += ITEM_getInt( itemindex, ITEM_USEPILENUMS);// + } + } + } + + if( nums == kosuu ) return TRUE; + + return FALSE; +} +#endif + +#ifdef _NEW_MANOR_LAW +extern struct FM_POINTLIST fmpointlist; +#endif + +BOOL NPC_ActionFreeIfCheck(int meindex,int talker, char* buf, char *opt, int kosuu,int flg, int temp) +{ +#ifdef _VIP_SHOP + if(strcmp(buf,"VIPPOINT")==0){ + if(NPC_ActionVipPointCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif +#ifdef _VIP_RIDE + if(strcmp(buf,"VIP")==0){ + if(NPC_ActionVipCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + + if(strcmp(buf,"LV")==0){ + if(NPC_ActionLevelCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + +#ifdef _ALL_ITEM + if(strcmp(buf,"ALLNUM1")==0){ + if(NPC_ActionAllNum1Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ALLNUM2")==0){ + if(NPC_ActionAllNum2Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ALLNUM3")==0){ + if(NPC_ActionAllNum3Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ALLNUM4")==0){ + if(NPC_ActionAllNum4Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ALLNUM5")==0){ + if(NPC_ActionAllNum5Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + + if(strcmp(buf,"FAME")==0){ + if(NPC_ActionFameCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"VIPPOINT")==0){ + if(NPC_ActionVippointCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"AMPOINT")==0){ + if(NPC_ActionAmpointCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#ifdef _VIGOR_SYS + if(strcmp(buf,"VIGOR")==0){ + if(NPC_ActionVigorCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif +#ifndef _CAX_NPCTIME_OFF + if(strcmp(buf,"YEAR")==0){ + if(NPC_ActionYearCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"MON")==0){ + if(NPC_ActionMonCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"DATE")==0){ + if(NPC_ActionDateCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"DAY")==0){ + if(NPC_ActionDayCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"HOUR")==0){ + if(NPC_ActionHourCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"MIN")==0){ + if(NPC_ActionMinCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"SEC")==0){ + if(NPC_ActionSecCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + if(strcmp(buf,"GOLD")==0){ + if(NPC_ActionGoldCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if( strcmp(buf,"TRANS") == 0 ) { + if( NPC_ActionCheckTrans( meindex, talker, kosuu, flg) == TRUE ) + return TRUE; + } + + if(strcmp(buf,"SKUP") == 0){ + if( NPC_ActionCheckSkup( meindex, talker, kosuu, flg) == TRUE ) + return TRUE; + } + + if(strcmp(buf,"SAFE") == 0){ + if( NPC_ActionCheckSafe( meindex, talker, kosuu, flg) == TRUE ) + return TRUE; + } + + if( !strcmp( buf, "GTIME") ){ + if( NPC_CheckTimeDefine( opt) == TRUE ) + return TRUE; + } + + if(strcmp( buf, "TIME") == 0) { + if(NPC_TiemCheck( meindex, talker, kosuu, flg) == TRUE) + return TRUE; + } + + if( strcmp( buf, "PET") == 0 ) { + if( temp > 0 ) { + if( ActionCheckMyPet( meindex, talker, kosuu, flg, temp) == TRUE ) + return TRUE; + }else + return FALSE; + } + if(strcmp(buf,"ITEM")==0){ + if(NPC_ActionItemCheck(meindex,talker,kosuu, flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"EQUIT")==0){ + if(NPC_ActioneEquitCheck(meindex,talker,kosuu, flg)==TRUE) + return TRUE; + } + + if( !strcmp(buf,"ENDEV") || !strcmp(buf,"EVEND") ){ + if(NPC_EventCheckFlg( talker, kosuu)==TRUE) + return TRUE; + } + if( !strcmp(buf,"NOWEV") || !strcmp(buf,"EVNOW") ){ + if(NPC_NowEventCheckFlg( talker, kosuu)==TRUE) + return TRUE; + } + + if(strcmp(buf,"PARTY")==0){ + if(NPC_ActionPartyCheck( talker, kosuu, flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"reITEM")==0){ + if( NPC_ActionReItemCheck( talker, kosuu, flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"rePET")==0){ + if( NPC_ActionRePetCheck( talker, kosuu, flg)==TRUE) + return TRUE; + } + +#ifdef _NPCCHANGE_PLAYERIMG + if(strcmp( buf, "BBI")==0) { + if( NPC_CheckPlayerBBI( meindex, talker, kosuu, flg)== TRUE) { + return TRUE; + } + } +#endif + if( strcmp( buf, "FM") == 0 ){ + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) > 0 && + CHAR_getInt( talker, CHAR_FMLEADERFLAG ) != FMMEMBER_APPLY) + if( CHAR_getWorkInt( talker, CHAR_WORKFMFLOOR) == kosuu ){ + return TRUE; + } + } + if(strcmp(buf,"DR")==0){ + if(NPC_ActionDuelRankCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } + if(strcmp(buf,"DP")==0){ + if(NPC_ActionDuelPointCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if( strcmp( buf, "CLASS") == 0 ){ + if(NPC_ActionClassCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if( strcmp( buf, "Skill") == 0 ){ + if( NPC_ActionSkillCheck( meindex, talker, kosuu, flg)==TRUE) + return TRUE; + } + if( strcmp( buf, "SkNum") == 0 ){ + if( NPC_ActionSkillNumCheck( meindex, talker, kosuu, flg)==TRUE) + return TRUE; + } + if( strcmp( buf, "SKCP") == 0 ){ + if( NPC_ActionSkillPointAndSkillCheck( meindex, talker, kosuu, flg)==TRUE) + return TRUE; + } +#endif + + +#ifdef _TREASURE_BOX + if( strcmp( buf, "BOX") == 0 ){ + if( NPC_ActionTreasureTypeCheck( meindex, kosuu, + //NPC_TIME_EVENTMODE = CHAR_NPCWORKINT6,// 1 + CHAR_getWorkInt( meindex, CHAR_NPCWORKINT6) ,flg)==TRUE) + return TRUE; + } +#endif + +#ifdef _NPC_ADDWARPMAN1 + if( strcmp( buf, "PARTYCOUNT") == 0){ + if(NPC_ActionPartyCountCheck( talker, kosuu, flg)==TRUE) + return TRUE; + } + if( strcmp( buf, "MANCOUNT" ) == 0 ){ + if(NPC_ActionManCountCheck( talker, kosuu, flg ) == TRUE ) + return TRUE; + } + if( strcmp( buf, "WOMANCOUNT" ) == 0 ){ + if(NPC_ActionWomanCountCheck( talker, kosuu, flg ) == TRUE ) + return TRUE; + } +#endif + +#ifdef _ANGEL_SUMMON + if(strcmp(buf,"ANGEL_NOW")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_DOING, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_NOW")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_DOING, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_OVER")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_OVER")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_OUT")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_TIMEOVER, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_OUT")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_TIMEOVER, 0)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ANGEL_I_NOW")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_DOING, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_NOW")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_DOING, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_I_OVER")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_OVER")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_I_OUT")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_TIMEOVER, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_OUT")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_TIMEOVER, TRUE)==TRUE) + return TRUE; + } + if(strcmp( buf, "HEROCNT") == 0) { + //if(NPC_EventLevelCheck( meindex, talker, kosuu, flg) == TRUE) { + if(NPC_HeroCompleteCountCheck( meindex, talker, kosuu, flg) == TRUE) + return TRUE; + } + +#endif + +#ifdef _CAX_NPCTIME_IF +if(strcmp( buf, "HOUR") == 0) { + if(NPC_TiemCheckWithHour( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "DAY") == 0) { + if(NPC_TiemCheckWithDay ( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } +#endif + +#ifdef _NEW_MANOR_LAW + if(strcmp(buf,"MANOR") == 0){ + // -1ʾҪǷΪׯ԰Աwarp + if(kosuu > -1){ + int iFmIndex = -1,iHadFmindex = -1; + char token[256]; + + iFmIndex = CHAR_getInt(talker,CHAR_FMINDEX); + getStringFromIndexWithDelim(fmpointlist.pointlistarray[kosuu],"|",5,token,sizeof(token)); + iHadFmindex = atoi(token); + if(iFmIndex > -1){ + // ׯ԰ӵмijԱ + if(iFmIndex == iHadFmindex){ + // мʽԱ + if(CHAR_getInt(talker,CHAR_FMLEADERFLAG) != FMMEMBER_NONE && + CHAR_getInt(talker,CHAR_FMLEADERFLAG) != FMMEMBER_APPLY) return TRUE; + } + } + } + } +#endif + + return FALSE; +} + +BOOL NPC_ActioneEquitCheck(int meindex,int talker,int itemNo, int flg) +{ + int i; + int itemindex=-1; + int id; + for( i=0;i point1) + return TRUE; + } + + return FALSE; +} + +BOOL ActionCheckMyPet( int meindex, int talker, int petLv, int flg, int petid) +{ + int petsel,petindex=-1; + int lv=-1; + for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++) { + petindex = CHAR_getCharPet( talker, petsel); + if( petindex == -1 ) + continue; + if(CHAR_getInt( petindex, CHAR_PETID) != petid ) + continue; + break; + } + if( petsel == CHAR_MAXPETHAVE ) { + return FALSE; + }else { //ҵ + lv = CHAR_getInt( petindex, CHAR_LV); + if( NPC_ActionBigSmallLastCheck( petLv, lv, flg) == TRUE) { + return TRUE; + }else { + return FALSE; + } + } + return FALSE; +} + + +BOOL NPC_ActionCheckTrans(int meindex,int talker,int trans,int flg) +{ + int myTrans; + myTrans=CHAR_getInt(talker, CHAR_TRANSMIGRATION); + if( NPC_ActionBigSmallLastCheck( trans, myTrans, flg ) == TRUE ) { + return TRUE; + } + return FALSE; +} + + +#ifdef _VIP_SHOP +BOOL NPC_ActionVipPointCheck(int meindex,int talker,int point,int flg) +{ + int mypoint; + mypoint=sasql_vippoint(CHAR_getUseID(talker),0,0); + if(NPC_ActionBigSmallLastCheck( point, mypoint, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif +#ifdef _VIP_RIDE +BOOL NPC_ActionVipCheck(int meindex,int talker,int vip,int flg) +{ + if(NPC_ActionBigSmallLastCheck( CHAR_getInt(talker,CHAR_VIPRIDE), vip, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif +#ifdef _VIP_SHOP +BOOL NPC_ActionNewVipPointCheck(int meindex,int talker,int point,int flg) +{ + int mypoint; + mypoint=sasql_vippoint(CHAR_getUseID(talker),0,0); + if(NPC_ActionBigSmallLastCheck( point, mypoint, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif +BOOL NPC_ActionLevelCheck(int meindex,int talker,int level,int flg) +{ + int mylevel; + mylevel=CHAR_getInt(talker,CHAR_LV); + if(NPC_ActionBigSmallLastCheck( level, mylevel, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +#ifdef _ALL_ITEM +BOOL NPC_ActionAllNum1Check(int meindex,int talker,int npcallnum1,int flg) +{ + int allnum1 = sasql_allnum(1,0,0); + if(NPC_ActionBigSmallLastCheck( npcallnum1, allnum1, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionAllNum2Check(int meindex,int talker,int npcallnum2,int flg) +{ + int allnum2 = sasql_allnum(2,0,0); + if(NPC_ActionBigSmallLastCheck( npcallnum2, allnum2, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionAllNum3Check(int meindex,int talker,int npcallnum3,int flg) +{ + int allnum3 = sasql_allnum(3,0,0); + if(NPC_ActionBigSmallLastCheck( npcallnum3, allnum3, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionAllNum4Check(int meindex,int talker,int npcallnum4,int flg) +{ + int allnum4 = sasql_allnum(4,0,0); + if(NPC_ActionBigSmallLastCheck( npcallnum4, allnum4, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionAllNum5Check(int meindex,int talker,int npcallnum5,int flg) +{ + int allnum5 = sasql_allnum(5,0,0); + if(NPC_ActionBigSmallLastCheck( npcallnum5, allnum5, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif + +BOOL NPC_ActionFameCheck(int meindex,int talker,int fame,int flg) +{ + int myfame; + myfame=CHAR_getInt(talker,CHAR_FAME)/100; + if(NPC_ActionBigSmallLastCheck( fame, myfame, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionVippointCheck(int meindex,int talker,int point,int flg) +{ + int mypoint; + mypoint=sasql_vippoint(CHAR_getChar(talker,CHAR_CDKEY),0,0); + if(NPC_ActionBigSmallLastCheck( point, mypoint, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionAmpointCheck(int meindex,int talker,int ampoint,int flg) +{ + int myampoint; + myampoint=sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + if(NPC_ActionBigSmallLastCheck( ampoint, myampoint, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#ifdef _VIGOR_SYS +BOOL NPC_ActionVigorCheck(int meindex,int talker,int vigor,int flg) +{ + int myvigor; + myvigor=CHAR_getInt(talker,CHAR_VIGOR); + if(NPC_ActionBigSmallLastCheck( vigor, myvigor, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif + +#ifndef _CAX_NPCTIME_OFF +BOOL NPC_ActionYearCheck(int meindex,int talker,int npcyear,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcyear, year, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionMonCheck(int meindex,int talker,int npcmon,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcmon, mon, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionDateCheck(int meindex,int talker,int npcdate,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcdate, date, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionDayCheck(int meindex,int talker,int npcday,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcday, day, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionHourCheck(int meindex,int talker,int npchour,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npchour, hour, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +BOOL NPC_ActionMinCheck(int meindex,int talker,int npcmin,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcmin, min, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + + +BOOL NPC_ActionSecCheck(int meindex,int talker,int npcsec,int flg) +{ + NPC_ActionTime(); + if(NPC_ActionBigSmallLastCheck( npcsec, sec, flg) == TRUE){ + return TRUE; + } + return FALSE; +} +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ +BOOL NPC_ActionClassCheck(int meindex,int talker,int p_class,int flg) +{ + int myclass; + myclass= CHAR_getInt( talker, PROFESSION_CLASS ); + + if(NPC_ActionBigSmallLastCheck( p_class, myclass, flg) == TRUE){ + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionSkillPointAndSkillCheck( int meindex,int talker,int sknum,int flg) +{ + int myskillpoint, myskillnum=0, myskilllevel; + int mysknum=0, j; + myskillpoint= CHAR_getInt( talker, PROFESSION_SKILL_POINT ); + myskilllevel= CHAR_getInt( talker, PROFESSION_LEVEL ); + + for( j=0; jskill, 0, 0 ); + pSkil->use = 0; + } + }else if( !strcmp( buf2, "CLASS") ){ + if( getStringFromIndexWithDelim( buf1 , "=" , 2, buf2, sizeof( buf2)) ==FALSE ) continue; + if( strstr( buf2, "ALL") != NULL ){ + CHAR_setInt( toindex , PROFESSION_CLASS, 0); +#ifdef _CHANNEL_MODIFY + if(CHAR_getInt(toindex,PROFESSION_CLASS) > 0){ + int i,pclass = CHAR_getInt(toindex,PROFESSION_CLASS) - 1; + for(i=0;i= kosuu ) return TRUE; +#endif + + return FALSE; + +} + +#ifdef _NPCCHANGE_PLAYERIMG //andy +BOOL NPC_ActionChangePlayerBBI( int meindex, int charindex, char *Img) +{ + int cBBI; + char buf1[256]; + memset( buf1, 0, sizeof( buf1)); + if( !CHAR_CHECKINDEX( charindex) ) + return FALSE; + if( !CHAR_CHECKINDEX( meindex) ) + return FALSE; +#ifdef _FIXBUG_ATTACKBOW + { + int armtype; + int itemindex = CHAR_getItemIndex( charindex, CHAR_ARM); + if( ITEM_CHECKINDEX(itemindex) ){ + armtype = ITEM_getInt( itemindex, ITEM_TYPE ); + if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW || + armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG) { + CHAR_talkToCli( charindex, -1, "ʹԶ޷", CHAR_COLORYELLOW ); + return FALSE; + } + } + + } +#endif +#ifdef _PETSKILL_BECOMEPIG + if( CHAR_getInt( charindex, CHAR_BECOMEPIG) > -1 ){// + CHAR_talkToCli( charindex, -1, "޷вܱ", CHAR_COLORYELLOW ); + return FALSE; + } +#endif + if( CHAR_getInt( charindex, CHAR_RIDEPET) != -1 ) {//費ͼ + CHAR_setInt( charindex, CHAR_RIDEPET, -1 ); + BATTLE_changeRideImage( charindex ); + CHAR_talkToCli( charindex, -1, "ȡ״̬", CHAR_COLORYELLOW); + + //change -----> ޸bug(,ѡ״̬ȻΪ"", + CHAR_complianceParameter( charindex ); + CHAR_send_P_StatusString( charindex, CHAR_P_STRING_RIDEPET); + + //return FALSE; + } +#ifdef _ITEM_METAMO + CHAR_setWorkInt( charindex, CHAR_WORKITEMMETAMO, 0); +#endif + + if( Img == NULL || !strcmp( Img, "\0")) + return FALSE; +//======================= + CHAR_setWorkInt( charindex, CHAR_WORKNPCMETAMO, meindex); + if( strstr( Img, "NPCBBI") != NULL ) { + cBBI = CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER); + sprintf( buf1, "㻯%sӡ", CHAR_getChar( meindex, CHAR_NAME)); + }else if( strstr( Img, "MYBBI") != NULL ) { + cBBI = CHAR_getInt( charindex, CHAR_BASEBASEIMAGENUMBER); + CHAR_setWorkInt( charindex, CHAR_WORKNPCMETAMO, 0); + sprintf( buf1, "ԭӡ"); + }else if( strstr( Img, ",") != NULL ) { + int imgindex=1, maxImg=0; + while( getStringFromIndexWithDelim( Img, ",", imgindex, buf1, sizeof( buf1)) != FALSE ) { + imgindex++; + maxImg++; + } + if( (imgindex = (rand()%maxImg)) > maxImg) imgindex = 1; + if( imgindex < 1 ) imgindex = 1; + + if( getStringFromIndexWithDelim( Img, ",", imgindex, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + cBBI = atoi( buf1); + sprintf( buf1, "Ӹıˡ"); + }else { + cBBI = atoi( Img); + sprintf( buf1, "Ӹıˡ"); + } +//======================= + if( cBBI < 0 ) { + return FALSE; + } + CHAR_talkToCli( charindex, -1, buf1, CHAR_COLORYELLOW); + //CHAR_BASEBASEIMAGENUMBER CHAR_BASEIMAGENUMBER + CHAR_setInt( charindex, CHAR_BASEIMAGENUMBER, cBBI); + CHAR_complianceParameter( charindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( charindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + //CHAR_K_STRING_BASEIMAGENUMBER + //CHAR_P_STRING_BASEBASEIMAGENUMBER + return TRUE; +} +#endif + +#ifdef _NPCCHANGE_PLAYERIMG +BOOL NPC_CheckPlayerBBI( int meindex, int charindex, int BBI, int flg) +{ + int MyBBI; + if( !CHAR_CHECKINDEX( charindex)) + return FALSE; + if( BBI < 0 ) + return FALSE; + MyBBI = CHAR_getInt( charindex, CHAR_BASEIMAGENUMBER); + return NPC_ActionBigSmallLastCheck( BBI, MyBBI,flg); +} +#endif + +BOOL showString( int meindex, char *showstr,int flg) +{ //㲥 + char buf1[256]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int toindex = -1; + int floor; + int i; + if( NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL ) { + print("\n not found argstr "); + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, showstr,buf1, sizeof(buf1)) == NULL ) { + strcpy( buf1, showstr); + } + toindex = -1; + floor = CHAR_getInt( meindex , CHAR_FLOOR); + while( toindex < 1000) { + toindex ++; + if( !CHAR_CHECKINDEX( toindex) ) + continue; + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + continue; + if( CHAR_getInt( toindex , CHAR_FLOOR) != floor ) + continue; + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); + if( flg == 1 ) { + CHAR_setWorkInt( toindex, CHAR_WORKSTAKEFLAG, FALSE ); + for( i=0; i<5; i++) { + CHAR_setWorkInt( toindex, i+CHAR_WORKSTAKETYPE1, 0); + } + } + } + return TRUE; +} + +BOOL NPC_getTimeXYPoint( int meindex, int Mode) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[256], buf1[256], buf2[256]; + int fl=-1, x, y; + int GraNo = -1; + int points = 1; //Ϊ1 + if( Mode <= 0 ) { + points = 2; + } + memset( npcarg, 0, sizeof( npcarg)); + if( !CHAR_CHECKINDEX( meindex) ) return FALSE; + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL ){ + print("WarpMan:GetArgStrErr"); + return FALSE; + } + memset( buf, 0, sizeof( buf)); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "TimeXYPoint", buf, sizeof( buf)) != NULL ){ + if( getStringFromIndexWithDelim(buf , "&" , points, buf1, sizeof( buf1)) != FALSE ){ + memset( buf2, 0, sizeof( buf2)); + if( getStringFromIndexWithDelim(buf1 , "," , 1, buf2, sizeof( buf2)) == FALSE ){ + return FALSE; + } + fl = atoi( buf2); + if( getStringFromIndexWithDelim(buf1 , "," , 2, buf2, sizeof( buf2)) == FALSE ){ + return FALSE; + } + x = atoi( buf2); + if( getStringFromIndexWithDelim(buf1 , "," , 3, buf2, sizeof( buf2)) == FALSE ){ + return FALSE; + } + y = atoi( buf2); + if( MAP_IsValidCoordinate( fl, x, y ) == FALSE ){ + char filename[256]; + NPC_Util_CheckAssignArgFile( meindex, filename); + return FALSE; + } + if( CHAR_getInt( meindex, CHAR_FLOOR) != fl || + CHAR_getInt( meindex, CHAR_X) != x || + CHAR_getInt( meindex, CHAR_Y) != y ){ + CHAR_warpToSpecificPoint( meindex, fl , x , y); + } + } + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "GraNo", buf, sizeof( buf)) != NULL ){ + if( getStringFromIndexWithDelim(buf , "&" , points, buf1, sizeof( buf1)) != FALSE ){ + GraNo = atoi( buf1); + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, GraNo); + } + } + return TRUE; +} + +BOOL NPC_getTimeData( int meindex, char *npcarg, int *born, int *dead, int loopspeed) +{ + int i; + char buf[256]; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "NEWTIME", buf, sizeof( buf)) != NULL ){ + for(i=0 ; i<9 ; i++){ + if( strstr( buf, TimeTble[i].arg ) != NULL){ + *born = TimeTble[i].born; + *dead = TimeTble[i].dead; + return TRUE; + } + } + } + return FALSE; +} + +BOOL NPC_CheckTimeDefine( char *timetype) +{ + LSTIME nowlstime; + int born=-1, dead=-1, finds=0, i; + + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + + for(i=0 ; i<9 ; i++){ + if( strstr( timetype, TimeTble[i].arg ) != NULL){ + born = TimeTble[i].born; + dead = TimeTble[i].dead; + finds = 1; + break; + } + } + if( finds == 0 ) return FALSE; + + if( born < dead ){ + if( (born < nowlstime.hour) && (dead > nowlstime.hour) ){ + return TRUE; + } + }else{ + if( (born < nowlstime.hour && 1024 > nowlstime.hour) || + ( 0 < nowlstime.hour && dead > nowlstime.hour)){ + return TRUE; + } + } + + return FALSE; +} + +void NPC_TimeDefineDo( int meindex, int born, int dead, int typeMode) +{ + LSTIME nowlstime; + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + if(born < dead){ + if( (born < nowlstime.hour) && (dead > nowlstime.hour) ){ + CHAR_setWorkInt(meindex,typeMode,0); + }else{ + CHAR_setWorkInt(meindex,typeMode,1); + } + }else{ + if( (born < nowlstime.hour && 1024 > nowlstime.hour) || ( 0 < nowlstime.hour && dead > nowlstime.hour)){ + CHAR_setWorkInt(meindex,typeMode,0); + }else{ + CHAR_setWorkInt(meindex,typeMode,1); + } + } + if( NPC_getTimeXYPoint( meindex, CHAR_getWorkInt( meindex, typeMode)) == FALSE ) + return; +} + + +void GetRand_WarpPoint( char *buf, int *fl, int *x, int *y ) +{ + char buff1[256],buff2[256]; + int i=0,point=1; + struct { + int m_fl; + int m_x; + int m_y; + } RandPoint[]={ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + }; + while( getStringFromIndexWithDelim( buf,";",point,buff1,sizeof( buff1)) != FALSE) { + point++; + getStringFromIndexWithDelim(buff1,",",1,buff2,sizeof(buff2)); + RandPoint[i].m_fl = atoi(buff2); + getStringFromIndexWithDelim(buff1,",",2,buff2,sizeof(buff2)); + RandPoint[i].m_x = atoi(buff2); + getStringFromIndexWithDelim(buff1,",",3,buff2,sizeof(buff2)); + RandPoint[i].m_y = atoi(buff2); + i++; + if( i >= arraysizeof( RandPoint) ) + break; + } + + point = RAND( 0, i); + if( RandPoint[point].m_fl <= 0 || point > arraysizeof( RandPoint) -1) { + point = 0; + } + *fl = RandPoint[point].m_fl; + *x = RandPoint[point].m_x; + *y = RandPoint[point].m_y; + + return; +} + +#ifdef _EMENY_CHANCEMAN +int NPC_EmenyChanceCheck( int meindex, int charaindex, char *arg) +{ + char buf1[256]; + int sex=2, fl=-1,x=-1,y=-1; + memset( buf1, 0, sizeof( buf1)); + + if( NPC_Util_GetStrFromStrWithDelim( arg, "CHECKSEX", buf1, sizeof( buf1)) == NULL ) { + return charaindex; + } + if( strstr( buf1, "male") != 0 ){ + sex = 1; + } + if( NPC_Util_GetStrFromStrWithDelim( arg, "NOBATTLEWARP", buf1, sizeof( buf1)) != NULL ) { + char data[256]; + if( getStringFromIndexWithDelim( buf1,",", 1, data, sizeof(data)) == FALSE ) return charaindex; + fl = atoi( data); + if( getStringFromIndexWithDelim( buf1,",", 2, data, sizeof(data)) == FALSE ) return charaindex; + x = atoi( data); + if( getStringFromIndexWithDelim( buf1,",", 3, data, sizeof(data)) == FALSE ) return charaindex; + y = atoi( data); + } + return NPC_DischargePartyForSex( meindex, charaindex, fl, x, y, sex); +} + +int NPC_DischargePartyForSex( int meindex, int charaindex, int fl, int x, int y, int fsex) +{ + int Party[CHAR_PARTYMAX] = {-1,-1,-1,-1,-1}; + int masterindex =-1, i, j, playerNo; + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_LEADER ){ + playerNo = CHAR_getInt( charaindex, CHAR_BASEBASEIMAGENUMBER); + if( CHAR_getSexInt( playerNo ) == fsex ) { + if( MAP_IsValidCoordinate( fl, x, y) != FALSE ){ + CHAR_warpToSpecificPoint( charaindex, fl, x, y); + return -1; + } + }else { + return charaindex; + } + } + CHAR_talkToCli( charaindex, -1, "Ŷ飡", CHAR_COLORYELLOW); + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1+i); + if( !CHAR_CHECKINDEX( index)) continue; + Party[i] = index;//¼ + } + CHAR_DischargePartyNoMsg( charaindex);//ɢŶ + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = Party[i]; + playerNo = CHAR_getInt( index, CHAR_BASEBASEIMAGENUMBER); + if( CHAR_getSexInt( playerNo ) == fsex ) { + if( MAP_IsValidCoordinate( fl, x, y) != FALSE ){ + CHAR_warpToSpecificPoint( index, fl, x, y); + } + Party[i] = -1; + } + } + j = CHAR_WORKPARTYINDEX1; + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int index = Party[i]; + if( !CHAR_CHECKINDEX( index ))continue; + if( !CHAR_CHECKINDEX( masterindex )){ + masterindex = index; + CHAR_setWorkInt( masterindex, CHAR_WORKPARTYMODE, CHAR_PARTY_LEADER); + CHAR_setWorkInt( masterindex, j++, masterindex); + }else { + CHAR_setWorkInt( masterindex, j++, index); + CHAR_setWorkInt( index, CHAR_WORKPARTYMODE, CHAR_PARTY_CLIENT); + CHAR_setWorkInt( index, CHAR_WORKPARTYINDEX1, masterindex); + } + } + return masterindex; +} +#endif + +BOOL NPC_ActionDuelRankCheck(int meindex,int talker,int rank,int flg) +{ + int myrank; + myrank=CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC); + if( NPC_ActionBigSmallLastCheck( rank, myrank, flg)==TRUE){ + return TRUE; + } + + return FALSE; +} + +BOOL NPC_ActionDuelPointCheck(int meindex,int talker,int rank,int flg) +{ + int myduel; + myduel = CHAR_getInt( talker, CHAR_DUELPOINT); + if( NPC_ActionBigSmallLastCheck( rank, myduel, flg)==TRUE){ + return TRUE; + } + + return FALSE; +} + +BOOL NPC_ActionTreasureTypeCheck(int meindex,int level, int type, int flg) +{ + int mylevel; + +// if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTMODE) == NPC_EVENTMODE_EVENT ){ + mylevel = (type == NPC_EVENTMODE_EVENT)?1:0; + if( NPC_ActionBigSmallLastCheck( level, mylevel, flg)==TRUE) + return TRUE; + return FALSE; +} + +BOOL NPC_ActionTreasureRandItemGet(int meidex,int talker,int rand_j,char *buf) +{ + char buff2[64]; + int randitem; + int ret; + int itemindex; + char token[128]; + + if(rand_j == 0) { + print("Event:춣Ľ룬ִ"); + return FALSE; + } + + //randitem = rand()%rand_j; + //srand((int)time(0)); + randitem = RAND(1,rand_j); + if(randitem == 0) randitem = rand_j; + + getStringFromIndexWithDelim(buf , "," , randitem, buff2, sizeof(buff2)) ; + + itemindex = ITEM_makeItemAndRegist( atoi( buff2)); + + if(itemindex == -1) return FALSE; + + /*ʧ ةܰ( ʧ ة ľ */ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_exchangeman.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventAddItem(õĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + return TRUE; + +} + +#ifdef _NPC_ADDLEVELUP // (ɿ) ANDY ⲿԻҵȼ +extern tagRidePetTable ridePetTable[296]; +void NPC_ActionLevelAndTransUp( int meindex, int charindex, int level, int skillpoint, int exp, int ridepet) +{ + char szBuffer[256]=""; + if( !CHAR_CHECKINDEX( charindex) ) + return; +//int CHAR_LevelUpCheck( int charaindex , int toindex) + if( exp > 0 ){ + int LevelUp=0; + int myexp = CHAR_getInt( charindex, CHAR_EXP); + myexp += exp; + if( myexp > 300000000 ) myexp = 300000000; + CHAR_setInt( charindex, CHAR_EXP, myexp); + snprintf( szBuffer, sizeof(szBuffer), + "(%s) õ EXP %d", CHAR_getUseName( charindex ), exp); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + LevelUp = CHAR_LevelUpCheck( charindex , -1); + if( LevelUp > 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) %d", + CHAR_getUseName( charindex ), + CHAR_getInt( charindex, CHAR_LV ) + ); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + CHAR_setInt( charindex, CHAR_SKILLUPPOINT, + CHAR_getInt( charindex, CHAR_SKILLUPPOINT) + LevelUp*3 ); + CHAR_complianceParameter( charindex ); + } + } + + if( level > 0 ){ + CHAR_setInt( charindex, CHAR_LV, level); + snprintf( szBuffer, sizeof(szBuffer), + "(%s) ȼ趨Ϊ %d", + CHAR_getUseName( charindex ), CHAR_getInt( charindex, CHAR_LV ) + ); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + } + + if( skillpoint > 0 ){ + int MySp = CHAR_getInt( charindex, CHAR_SKILLUPPOINT); + MySp += skillpoint; + CHAR_setInt( charindex, CHAR_SKILLUPPOINT, MySp); + } + if( ridepet >= 0 ){ + int basepet[2][4]={ {2066,2067,2068,2069}, + {2072,2073,2074,2075}}; + int petTemp[]={-1,-1,-1,-1,-1}; + char msgbuf[256]; + int petNum=0; + int i,j=0; + int k=0, petindex,enemyarray; + petTemp[j++] = basepet[0][rand()%4]; + petTemp[j++] = basepet[1][rand()%4]; + + for( i=0; i< arraysizeof(ridePetTable) ; i++ ){ + if( CHAR_getInt( charindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].charNo ){ + petTemp[j]= ridePetTable[i].petId; + j++; + if( j >= arraysizeof( petTemp) ) + break; + } + } + j=0; + for( petNum=0; petNum= CHAR_MAXITEMHAVE ) + return FALSE; + } + return TRUE; +} + +BOOL NPC_ActionMissionHeroCheck(int meindex,int talker,int mission,int flg,int checkitem) +{ + int mindex; + char nameinfo[64]; + int i, itemindex, itemid; + + mindex = checkIfAngel( talker); + if( mindex <= -1 ) return FALSE; + if( missiontable[mindex].mission != mission) return FALSE; + getMissionNameInfo( talker, nameinfo); + if( strcmp( nameinfo, missiontable[mindex].heroinfo )) return FALSE; + if( missiontable[mindex].flag != flg ) return FALSE; + + if( checkitem ) { // + for( i=CHAR_STARTITEMARRAY;i= CHAR_MAXITEMHAVE ) + return FALSE; + } + + return TRUE; +} + + +BOOL NPC_HeroCompleteCountCheck(int meindex,int talker,int count,int flg) +{ + + int herocnt; + herocnt = CHAR_getInt(talker,CHAR_HEROCNT); + + if(NPC_EventBigSmallLastCheck( count, herocnt, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + + + +#endif + + +BOOL NPC_ActionCheckSkup(int meindex,int talker,int skup,int flg) +{ + int mySkup; + mySkup=CHAR_getInt(talker, CHAR_SKILLUPPOINT); + if( NPC_ActionBigSmallLastCheck( skup, mySkup, flg ) == TRUE ) { + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionCheckSafe(int meindex,int talker,int safe,int flg) +{ + int mySafe; + mySafe=CHAR_getWorkInt(talker, CHAR_WORKSAFEMODE); + if( NPC_ActionBigSmallLastCheck( safe, mySafe, flg ) == TRUE ) { + return TRUE; + } + return FALSE; +} + +BOOL NPC_ActionWarpNpc(int meindex,char *buf) +{ + char token[32]; + char token2[32]; + char buf2[32]; + int floor,x,y,x1,x2,y1,y2; + int ret; + int cnt; + int dcnt = 1; + + /*--ػ󼰴 --*/ + cnt = CHAR_getWorkInt(meindex,CHAR_NPCWORKINT4); + while(getStringFromIndexWithDelim(buf,",", dcnt,buf2,sizeof(buf2) ) + !=FALSE ){ + dcnt++; + } + //cnt = RAND(1,dcnt); + if(dcnt <= cnt) cnt=1; + + + while(getStringFromIndexWithDelim(buf,",", cnt,buf2,sizeof(buf2)) !=FALSE ) + { + cnt++; + ret=getStringFromIndexWithDelim(buf2,".", 1,token,sizeof(token)); + if( ret == FALSE ) { + continue; + } + floor = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 2,token,sizeof(token)); + if( ret == FALSE ){ + continue; + } + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + x = atoi( token ); + }else{ + x1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + x2=x1; + }else{ + x2=atoi(token2); + } + x = RAND(x1,x2); + } + //x = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 3,token,sizeof(token)); + if( ret == FALSE ) { + continue; + } + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + y = atoi( token ); + }else{ + y1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + y2=y1; + }else{ + y2=atoi(token2); + } + y = RAND(y1,y2); + } + //y = atoi( token ); + //print("\nfloor=%d,x=%d,y=%d\n",floor,x,y); + CHAR_setWorkInt(meindex,CHAR_NPCWORKINT4, cnt); + CHAR_warpToSpecificPoint(meindex, floor, x, y); + return TRUE; + } + + return FALSE; + +} + +int NPC_ActionTime(void) +{ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + year=1900+p->tm_year; + mon=1+p->tm_mon; + date=p->tm_mday; + day=p->tm_wday; + hour=p->tm_hour; + min=p->tm_min; + sec=p->tm_sec; +} diff --git a/npc/npc_exchangeman.c b/npc/npc_exchangeman.c new file mode 100644 index 0000000..156092f --- /dev/null +++ b/npc/npc_exchangeman.c @@ -0,0 +1,6052 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "net.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_exchangeman.h" +#include "npc_eventaction.h" +#include "log.h" +#include "battle.h" +#include "handletime.h" +#include "enemy.h" +#include "npc_warp.h" + +int year,mon,date,day,hour,min,sec; +#ifdef _ALL_ITEM +extern int allnum1,allnum2,allnum3,allnum4,allnum5; +extern char hanzibuf[5000][8]; +#endif +#ifdef _ANGEL_SUMMON +extern struct MissionInfo missionlist[MAXMISSION]; +extern struct MissionTable missiontable[MAXMISSIONTABLE]; +#endif +#ifdef _TRANS_7_NPC +BOOL NPC_EventTRANS(int meindex, int talker, char *buff2,int mode); +#endif +static void NPC_ExChangeMan_selectWindow( int meindex, int talker,int num); +BOOL NPC_TypeCheck(int meindex,int talker,char *szMes); +int NPC_ExChangeManEventCheck( int meindex, int talker, char *buff1); +BOOL NPC_EventItemCheck(int meindex,int talker,int itemNo,int flg); +BOOL NPC_EventLevelCheck(int meindex,int talker,int level,int flg); +BOOL NPC_EventVipCheck(int meindex,int talker,int vip,int flg); +BOOL NPC_EventSuperCheck(int meindex,int talker,int vip,int flg); +BOOL NPC_EventVipPointCheck(int meindex,int talker,int vippoint,int flg); +BOOL NPC_EventNpcTimeCheck(int meindex,int talker,int npctime,int flg); +#ifdef _EV_NUM +BOOL NPC_EventEvNumCheck(int meindex,int talker,int evnum,int flg); +#endif +// Arminius 8.14 move to .h (for pet talk) +//BOOL NPC_EventBigSmallCheck(int meindex,int talker,char* buf); +BOOL NPC_EventFreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg); +BOOL NPC_EventBigSmallLastCheck(int point1,int mypoint,int flg); +BOOL NPC_ENDEventNoCheck(int meindex,int talker,int shiftbit,int flg); +BOOL NPC_NOWEventNoCheck(int meindex,int talker,int shiftbit,int flg); +BOOL NPC_TiemCheck(int meindex,int talker,int time,int flg); + +#ifdef _CAX_NPCTIME_IF +/*CCIS_WXscript add 09/02/21 Сʱ*/ +BOOL NPC_TiemCheckWithHour(int meindex,int talker,int time,int flg); +/*CCIS_WXscript add 09/02/21 ڼ*/ +BOOL NPC_TiemCheckWithDay(int meindex,int talker,int time,int flg); +#endif + +BOOL NPC_EventAddPet(int meindex, int talker, char *buff2,int mode); +BOOL NPC_RandItemGet(int meindex, int talker,int rand_j,char *buf); + +BOOL NPC_PetLvCheckType2(int petindex,int meindex,int talker,char *buf,int mode); +BOOL NPC_PetLvCheck(int meindex,int talker,char *buf,int mode); +#ifdef _NPC_PETSKILLUP +BOOL NPC_PetSkillCheck(int meindex,int talker,char *buf,int mode); +#endif +void NPC_RequestMain(int meindex,int talker,char *buf); +void NPC_AcceptMain(int meindex,int talker ,char*buf); +void NPC_MsgDisp(int meindex,int talker,int num); +BOOL NPC_EventAdd(int meindex,int talker,int mode); +BOOL NPC_AcceptDel(int meindex,int talker,int mode); +BOOL NPC_SavePointCheck(int meindex,int talker,int shiftbit,int flg); + +BOOL NPC_EventReduce(int meindex,int talker,char *buf); +BOOL NPC_EventDelItem(int meindex,int talker,char *buf,int breakflg); +BOOL NPC_EventDelItemEVDEL(int meindex,int talker,char *buf,char *nbuf,int breakflg); +BOOL NPC_EventAddItem(int meindex,int talker,char *buf); +int NPC_EventFile(int meindex,int talker,char *buf); +BOOL NPC_EventDelPet(int meindex,int talker, int petsel); +void NPC_PetSkillMakeStr(int meindex,int toindex,int select); +void NPC_CleanMain(int meindex,int talker,char *buf); +void NPC_EventPetSkill( int meindex, int talker, char *data); +BOOL NPC_ItemFullCheck(int meindex,int talker,char *buf,int mode,int evcnt); +void NPC_CharmStatus(int meindex,int talker); +BOOL NPC_ImageCheck(int meindex,int talker,int kosuu,int flg); +int NPC_EventGetCost(int meindex,int talker,char *arg); + +BOOL NPC_EventWarpNpc(int meindex,char *buf); + +enum { + CHAR_WORK_EVENTWARP = CHAR_NPCWORKINT4, + +}; + +/********************************* +* +*********************************/ +BOOL NPC_ExChangeManInit( int meindex ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024*2]; + int i = 1; + char buf4[256]; + + CHAR_setWorkInt(meindex,CHAR_WORK_EVENTWARP,1); + + /*--NPCë--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEEVENT ); + + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) { + print("NPC_ExChange.c TypeCheck: GetArgStrErr\n"); + print("NPCName=%s\n", CHAR_getChar( meindex ,CHAR_NAME)); + return FALSE; + } + + i = 1; + /*--ìNPCʧ ةë--*/ + /*-- ƻ¾ʸƥ˪ľ¾--*/ + while(getStringFromIndexWithDelim( argstr ,"EventEnd" ,i ,buf ,sizeof(buf)) + != FALSE) + { + i++; + /*--ƥ̤ľ¼߼ë-*/ + if(strstr( buf,"GetItem") != NULL) { + if(strstr( buf,"ItemFullMsg") == NULL) { + NPC_Util_GetStrFromStrWithDelim(buf,"EventNo",buf4,sizeof(buf4)); + print("\n### EventNo=%d %s:ItemFullMsg ###", + atoi( buf4), + CHAR_getChar( meindex, CHAR_NAME)); + } + } + + if(strstr( buf,"GetPet") != NULL) { + if(strstr( buf,"PetFullMsg") == NULL) { + NPC_Util_GetStrFromStrWithDelim(buf,"EventNo",buf4,sizeof(buf4)); + print("\n### ventNo=%d %s:PetFullMsg ###", + atoi(buf4), + CHAR_getChar(meindex,CHAR_NAME)); + } + } + + if(strstr( buf,"GetEgg") != NULL) { + if(strstr( buf,"PetFullMsg") == NULL) { + NPC_Util_GetStrFromStrWithDelim(buf,"EventNo",buf4,sizeof(buf4)); + print("\n### ventNo=%d %s:PetFullMsg ###", + atoi(buf4), + CHAR_getChar(meindex,CHAR_NAME)); + } + } + + if(strstr( buf,"GetStone") != NULL){ + if(strstr( buf,"StoneFullMsg") == NULL){ + NPC_Util_GetStrFromStrWithDelim(buf,"EventNo",buf4,sizeof(buf4)); + print("\n### EventNo=%d %s:StonFullMsg ###", + atoi( buf4), + CHAR_getChar( meindex, CHAR_NAME)); + } + } + + if(strstr( buf,"DelStone") != NULL) { + if(strstr( buf,"StoneLessMsg") == NULL) { + NPC_Util_GetStrFromStrWithDelim(buf,"EventNo",buf4,sizeof(buf4)); + print("\n### EventNo=%d %s:StoneLessMsg ###", + atoi(buf4), + CHAR_getChar(meindex,CHAR_NAME)); + } + } + } + + i = 1; + + return TRUE; + +} + +/*-- --*/ +BOOL NPC_EventWarpNpc(int meindex,char *buf) +{ + char token[32]; + char token2[32]; + char buf2[32]; + int floor,x,y,x1,x2,y1,y2; + int ret; + int cnt; + int dcnt = 1; + + /*--ػ󼰴 --*/ + cnt = CHAR_getWorkInt(meindex,CHAR_WORK_EVENTWARP); + while(getStringFromIndexWithDelim(buf,",", dcnt,buf2,sizeof(buf2) ) + !=FALSE ){ + dcnt++; + } + //cnt = RAND(1,dcnt); + if(dcnt <= cnt) cnt=1; + + while(getStringFromIndexWithDelim(buf,",", cnt,buf2,sizeof(buf2)) !=FALSE ) + { + cnt++; + ret=getStringFromIndexWithDelim(buf2,".", 1,token,sizeof(token)); + if( ret == FALSE ) { + continue; + } + floor = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 2,token,sizeof(token)); + if( ret == FALSE ){ + continue; + } + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + x = atoi( token ); + }else{ + x1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + x2=x1; + }else{ + x2=atoi(token2); + } + x = RAND(x1,x2); + } + //x = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 3,token,sizeof(token)); + if( ret == FALSE ) { + continue; + } + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + y = atoi( token ); + }else{ + y1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + y2=y1; + }else{ + y2=atoi(token2); + } + y = RAND(y1,y2); + } + //y = atoi( token ); + //print("\nfloor=%d,x=%d,y=%d\n",floor,x,y); + CHAR_setWorkInt(meindex,CHAR_WORK_EVENTWARP, cnt); + CHAR_warpToSpecificPoint(meindex, floor, x, y); + return TRUE; + } + + return FALSE; + +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_ExChangeManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2) == FALSE) { + /* */ + if(NPC_Util_isFaceToChara(talkerindex,meindex,1 ) == FALSE) return; + } + + /*-- ë--*/ + CHAR_setWorkInt( talkerindex ,CHAR_WORKSHOPRELEVANT, 0); + CHAR_setWorkInt( talkerindex ,CHAR_WORKSHOPRELEVANTSEC, 0); + CHAR_setWorkInt( talkerindex ,CHAR_WORKSHOPRELEVANTTRD, 0); + +#ifdef _NPC_RAND_MSG + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("NPC_ExChange.c TypeCheck: GetArgStrErr\n"); + print("NPCName=%s\n", CHAR_getChar(meindex,CHAR_NAME)); + return; + } + if(strstr(argstr,"STARTRAND")!=NULL){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(talkerindex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + return; + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtime = atoi(tempbuff); +#ifdef _MM_NO_JIAOBEN + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(talkerindex, -1, errbuf, CHAR_COLORRED); + return; + } +#endif + } + } +// if(timep-CHAR_getWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME)>=getEditBaseTime()) +// CHAR_setWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME,timep); +// else{ +// char errbuf[256]; +// sprintf(errbuf,"%dſԼ˲",getEditBaseTime()-(timep-CHAR_getWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME))); +// CHAR_talkToCli(talkerindex, -1, errbuf, CHAR_COLORRED); +// return; +// } + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","",""}; + char chengbuf[][5]={"","*","x","X","","",""}; + char numbuf[][5]={"","","","","","","","","",""}; + char arg[255]; + int i,j,k,l,m; + char buf[256]; + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; +// if(randtype == 0){ +// randtype = RAND(1,10); +// if(randtype<=5){ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=1; +// else randtype=2; +// }else{ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=3; +// else randtype=4; +// } +// } + randtype = 4; + if(randtype==1){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else{ + typebuf=jianbuf[l-1]; + k = i-j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + sprintf(buf,"%d|%d|%s",k,meindex,szMes); + CHAR_setWorkChar(talkerindex,CHAR_WORKRANDMSG,buf); + int fd = getfdFromCharaIndex( talkerindex ); + sprintf(buf,"ʽĽ(%s%s%s=?)",ibuf,typebuf,jbuf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_NPC_RAND1_MSG, + -1, + buf); + }else if(randtype==2){ + if(m==1){ + typebuf=jiabuf[l-1]; + k = i+j; + }else if(m==2){ + typebuf=jianbuf[l-1]; + k = i-j; + }else{ + typebuf=chengbuf[l-1]; + k = i*j; + } + char ibuf[10],jbuf[10]; + if(i<10){ + sprintf(ibuf,"%s",numbuf[i]); + }else{ + int ia,ib; + ia = i/10; + ib = i - ia*10; + sprintf(ibuf,"%s",numbuf[ia]); + strcat(ibuf,numbuf[ib]); + } + if(j<10){ + sprintf(jbuf,"%s",numbuf[j]); + }else{ + int ja,jb; + ja = j/10; + jb = j - ja*10; + sprintf(jbuf,"%s",numbuf[ja]); + strcat(jbuf,numbuf[jb]); + } + int n; + int randnum1; + char tempret[5][32]; + randnum1 = RAND(1,5); + int randnumbuf[4]; + int tmpi=0; + while(tmpi<100){ + randnumbuf[0] = RAND(1,100); + randnumbuf[1] = RAND(1,100); + randnumbuf[2] = RAND(1,100); + randnumbuf[3] = RAND(1,100); + if(randnumbuf[0]!=randnumbuf[1]!=randnumbuf[2]!=randnumbuf[3]!=k){ + break; + } + tmpi++; + } + tmpi=0; + for(n=1;n<=5;n++){ + if(n==randnum1){ + sprintf(tempret[n-1],"%d",k); + }else if(tmpi<4){ + sprintf(tempret[n-1],"%d",randnumbuf[tmpi]); + tmpi++; + } + } + sprintf(buf,"%d|%d|%s",randnum1,meindex,szMes); + CHAR_setWorkChar(talkerindex, CHAR_WORKRANDMSG, buf); + int fd = getfdFromCharaIndex( talkerindex ); + sprintf(buf,"3\nѡʽĽ(%s%s%s=?)\n \n \nѡһ%s\nѡ%s\nѡ%s\nѡģ%s\nѡ壺%s\n",ibuf,typebuf,jbuf,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_NPC_RAND2_MSG, + -1, + buf); + }else if(randtype==3){ + sprintf(arg,"%s",sasql_rand_buf()); + if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randquestion,tempbuf); + if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) + return; + strcpy(randrightanswer,tempbuf); + sprintf(buf,"%s|%d|%s",randrightanswer,meindex,szMes); + CHAR_setWorkChar(talkerindex,CHAR_WORKRANDMSG,buf); + int fd = getfdFromCharaIndex( talkerindex ); + sprintf(buf,"%s:",randquestion); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_NPC_RAND3_MSG, + -1, + buf); + }else{ +// sprintf(arg,"%s",sasql_rand_buf()); +// if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; +// if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randquestion,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randrightanswer,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 3, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer1,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 4, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer2,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 5, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer3,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 6, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer4,tempbuf); + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬӢģ",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + //char *tempbuff2 = "ABCDE"; + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + if(selecttype<=30){ + sprintf(buf,"%d|%d|%s",rightnum,meindex,szMes); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(buf,"%d|%d|%s",randnum1,meindex,szMes); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(talkerindex, CHAR_WORKRANDMSG, buf); + int fd = getfdFromCharaIndex( talkerindex ); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_NPC_RAND4_MSG, + -1, + buf); + CHAR_setWorkInt(talkerindex,CHAR_WORKLUANPCINT,0); + } + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(talkerindex,CHAR_RANDTYPE,tempbuff); + return; + } +#endif + + /*-- --*/ + NPC_TypeCheck( meindex, talkerindex, szMes); + +} + +/*------------------------------------------------------------ + *ɬð̻ë ģؤ ë + *-------------------------------------------------------------*/ +BOOL NPC_TypeCheck(int meindex,int talker,char *szMes) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024*2]; + char buf2[512]; + int i = 1; + int EvNo; + int evch; + int q=1; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("NPC_ExChange.c TypeCheck: GetArgStrErr\n"); + print("NPCName=%s\n", CHAR_getChar(meindex,CHAR_NAME)); + return FALSE; + } + + /*-- ɬð̻ë --*/ + while(getStringFromIndexWithDelim( argstr,"EventEnd",i,buf,sizeof( buf)) + != FALSE){ + i++; + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT, 0); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + + /*-- ìϼë --*/ + if(NPC_Util_GetStrFromStrWithDelim(buf,"EventNo", + buf2, sizeof( buf2) ) == NULL) continue; + + if(strstr( buf2, "-") != 0) { + EvNo = -1; + }else{ + if(strstr(buf2,",") != NULL){ + char buf3[512]; + while(getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)) + != FALSE) { + q++; + } + q--; + q = rand()%q + 1; + getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)); + EvNo = atoi( buf3); + }else{ + EvNo = atoi( buf2); + } + } + + /*-- ׷ºë浤ƥì ƻݳ --*/ + if(NPC_EventCheckFlg( talker, EvNo) == TRUE) continue; + + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"KeyWord", buf2,sizeof( buf2) ) + != NULL){ + if(strcmp( szMes, buf2) != 0) continue; + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT, i); + } + + /*--ʸ 󡼰ͻ Ȼ¾ë--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"Pet_Name", buf2,sizeof( buf2)) != NULL){ + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 1); + } + evch = NPC_ExChangeManEventCheck( meindex, talker, buf); + if(evch != -1) { + if(NPC_Util_GetStrFromStrWithDelim( buf,"TYPE", buf2, sizeof( buf2)) != NULL){ + + if( strstr( buf2, "REQUEST") != NULL) { + NPC_RequestMain( meindex, talker, buf); + return TRUE; + }else if( strstr( buf2, "ACCEPT") != NULL) { + /*- ë --*/ + NPC_AcceptMain( meindex, talker, buf); + return TRUE; + + }else if(strstr( buf2, "MESSAGE") != NULL) { + char token[14*100]; + char token2[14*100]; + if(NPC_Util_GetStrFromStrWithDelim( buf,"NomalMsg", token,sizeof( token) ) + != NULL ) { + if(NPC_AcceptDel( meindex, talker, 0) == FALSE) return FALSE; + if(EvNo != -1) + NPC_NowEventSetFlg( talker, EvNo); + CHAR_talkToCli( talker, meindex, token, CHAR_COLORWHITE); + if(NPC_Util_GetStrFromStrWithDelim( buf,"NpcWarp", token2,sizeof( token2) ) + != NULL){ + NPC_EventWarpNpc(meindex,token2); + } + if(NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", buf2, sizeof( buf2) ) + !=NULL){ + char buf3[16]; + int k = 1; + if(EvNo != -1) NPC_NowEventSetFlgCls( talker, EvNo); + while(getStringFromIndexWithDelim(buf2 , "," ,k, buf3, sizeof(buf3)) + !=FALSE ){ + k++; + NPC_EventSetFlg( talker, atoi( buf3)); + } + } + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2)) != NULL) { + char buf3[16]; + int k = 1; + k= 1 ; + while(getStringFromIndexWithDelim(buf2 , "," , k, + buf3, sizeof(buf3)) + != FALSE ){ + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + k++; + } + } +#ifdef _ANGEL_SUMMON + // ٻ + if( NPC_Util_GetStrFromStrWithDelim( buf, "MISSIONOVER", + buf2, sizeof( buf2)) != NULL) + { + int mindex; + int mission; + char nameinfo[64]; + + mission = atoi( buf2); + mindex = checkIfAngel(talker); + + if( mission == missiontable[mindex].mission ) + { + char msg[1024]; + + print(" ====ٻ==== "); + + CHAR_setInt( talker, CHAR_HEROCNT, + CHAR_getInt( talker, CHAR_HEROCNT)+1 ); + getMissionNameInfo( talker, nameinfo); + saacproto_ACMissionTable_send( acfd, MISSION_HERO_COMPLETE, 4, nameinfo, ""); + sprintf( msg, " i:%d m:%d %s ", mindex, mission, nameinfo); + print( msg); + LogAngel( msg ); + } + + } + + // ٻ + if( NPC_Util_GetStrFromStrWithDelim( buf, "MISSIONCLEAN", + buf2, sizeof( buf2)) != NULL) + { + int mindex; + int mission; + char nameinfo[64]; + + mission = atoi( buf2); + mindex = checkIfAngel( talker); + + if( mission == missiontable[mindex].mission ) + { + char msg[1024]; + + getMissionNameInfo( talker, nameinfo); + saacproto_ACMissionTable_send( acfd, mindex, 3, nameinfo, ""); + + sprintf( msg, " i:%d m:%d %s ", mindex, mission, nameinfo); + print( msg); + LogAngel( msg ); + } + + } +#endif + + }else if(NPC_Util_GetStrFromStrWithDelim(buf, "NomalWindowMsg", + token, sizeof( token) ) + !=NULL) { + /*--̼ƥë߯--*/ + int fd = getfdFromCharaIndex( talker); +#ifdef _NEWEVENT + if(NPC_Util_GetStrFromStrWithDelim(buf, "NomalWindowMsg1", + buf2, sizeof(buf2)) != NULL){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + }else { +#endif + char token2[14*100]; + if(NPC_AcceptDel( meindex, talker,0) == FALSE) return FALSE; + if( EvNo != -1) NPC_NowEventSetFlg( talker, EvNo); + + if(NPC_Util_GetStrFromStrWithDelim( buf,"NpcWarp", + token2,sizeof( token2) ) != NULL){ + NPC_EventWarpNpc(meindex,token2); + } + if(NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", + buf2, sizeof( buf2) ) !=NULL){ + char buf3[16]; + int k = 1; + if(EvNo != -1) NPC_NowEventSetFlgCls( talker, EvNo); + while(getStringFromIndexWithDelim(buf2 , "," ,k, + buf3, sizeof(buf3)) !=FALSE ){ + k++; + NPC_EventSetFlg( talker, atoi( buf3)); + } + } + //ì׷ºë + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2)) != NULL) { + char buf3[16]; + int k = 1; + + k= 1 ; + while(getStringFromIndexWithDelim(buf2 , "," , k, + buf3, sizeof(buf3)) != FALSE ){ + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + k++; + } + } +#ifdef _ANGEL_SUMMON + // ٻ + if( NPC_Util_GetStrFromStrWithDelim( buf, "MISSIONOVER", + buf2, sizeof( buf2)) != NULL) + { + int mindex; + int mission; + char nameinfo[64]; + + mission = atoi( buf2); + mindex = checkIfAngel( talker); + + if( mission == missiontable[mindex].mission ) + { + char msg[1024]; + + print(" ====ٻ==== "); + + CHAR_setInt( talker, CHAR_HEROCNT, + CHAR_getInt( talker, CHAR_HEROCNT)+1 ); + getMissionNameInfo( talker, nameinfo); + saacproto_ACMissionTable_send( acfd, MISSION_HERO_COMPLETE, 4, nameinfo, ""); + sprintf( msg, " i:%d m:%d %s ", mindex, mission, nameinfo); + print( msg); + LogAngel( msg ); + } + + } + + // ٻ + if( NPC_Util_GetStrFromStrWithDelim( buf, "MISSIONCLEAN", + buf2, sizeof( buf2)) != NULL) + { + int mindex; + int mission; + char nameinfo[64]; + + mission = atoi( buf2); + mindex = checkIfAngel( talker); + + if( mission == missiontable[mindex].mission ) + { + print(" ====ٻ==== "); + + getMissionNameInfo( talker, nameinfo); + saacproto_ACMissionTable_send( acfd, mindex, 3, nameinfo, ""); + } + + } +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YES, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +#ifdef _NEWEVENT + } +#endif + } + + return TRUE; + + }else if(strstr( buf2, "CLEAN") != NULL) { + NPC_CleanMain( meindex, talker, buf); + return TRUE; + } + } + } + } + + strcpy( buf, "\0"); + if( NPC_Util_GetStrFromStrWithDelim( argstr, "NomalMainMsg", buf, sizeof( buf)) == NULL ) { + print("\n err:NOT FIND NomalMainMsg"); + return FALSE; + } + i = 1; + while(getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof( buf2))!= FALSE){ + i++; + } + i--; + i = rand()%i + 1; + getStringFromIndexWithDelim( buf,",", i, buf2, sizeof( buf2)); + CHAR_talkToCli( talker, meindex, buf2, CHAR_COLORWHITE); + return TRUE; +} + + +/*----------------------------------- + * ë + ------------------------------------*/ +static void NPC_ExChangeMan_selectWindow( int meindex, int talker,int num) +{ + + switch( num) { + /*--;޵--*/ + case 0: + /*-ì ئƥìë¾ë --*/ + NPC_MsgDisp( meindex, talker, 0); + break; + + case 1: + /*--ޥì浤--*/ + NPC_MsgDisp( meindex, talker, 5); + break; + + /*--ʧͱ--*/ + case 2: + /*--Ի--*/ + NPC_MsgDisp( meindex, talker, 6); + break; + + case 3: + /*--Ի--*/ + NPC_MsgDisp( meindex, talker, 11); + break; + } + +} + +/*------------------------------------- + *ìë ̼ + --------------------------------------*/ +void NPC_RequestMain(int meindex,int talker,char *buf) +{ + int shiftbit; + char buf2[128]; + int q=1; + /*--ìϼë--*/ + NPC_Util_GetStrFromStrWithDelim( buf,"EventNo", buf2,sizeof( buf2) ); + if(strstr(buf2,",") != NULL){ + char buf3[128]; + while(getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)) + != FALSE) { + q++; + } + q--; + q = rand()%q + 1; + getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)); + shiftbit = atoi( buf3); + }else{ + shiftbit = atoi( buf2); + } + + if(NPC_NowEventCheckFlg( talker, shiftbit) == TRUE) { + NPC_ExChangeMan_selectWindow( meindex, talker, 0); + }else{ + NPC_ExChangeMan_selectWindow( meindex, talker, 1); + } +} + +/*--------------------------------------- + * ì ̼ + ----------------------------------------*/ +void NPC_AcceptMain(int meindex,int talker ,char *buf) +{ + + NPC_ExChangeMan_selectWindow( meindex, talker, 2); +} + +/*---------------------------------------- + * ׷ºëʧ¿м̼ + ----------------------------------------*/ +void NPC_CleanMain(int meindex,int talker,char *buf) +{ + NPC_ExChangeMan_selectWindow( meindex, talker, 3); +} + +/*----------------------------------------- +ͷʧ߯Ȼݱ̫ľ£ +-------------------------------------------*/ +void NPC_ExChangeManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + /*-- Իئ巴 --*/ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + + + switch( seqno) { + + /*--׷ºëݼ̼--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_CLEANMSG: + if( select == WINDOW_BUTTONTYPE_YES) { + NPC_MsgDisp( meindex, talkerindex, 12); + }else if(select == WINDOW_BUTTONTYPE_NO) { + } + break; + +#ifdef _NEWEVENT + case CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG: + if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD) + 1); + NPC_MsgDisp( meindex, talkerindex, 99); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD) - 1); + NPC_MsgDisp( meindex, talkerindex, 99); + } + break; +#else + case CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG: + break; +#endif + /*--;޵ؤԻ絤--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK: + if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)+1); + NPC_MsgDisp( meindex, talkerindex, 22); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)-1); + NPC_MsgDisp( meindex, talkerindex, 22); + } + break; + + /*--ʧͱؤԻ絤--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_ACCTHANK: + if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)+1); + NPC_MsgDisp( meindex, talkerindex, 82); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)-1); + NPC_MsgDisp( meindex, talkerindex, 82); + } + break; + + /*--ػìë¾--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_NOWEVENT: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_MsgDisp( meindex, talkerindex, 7); + }else if(select == WINDOW_BUTTONTYPE_NO){ + NPC_MsgDisp( meindex, talkerindex, 1); + } + break; + + /*--;޵̼̼--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG: + if(select == WINDOW_BUTTONTYPE_YES) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD,0); + NPC_MsgDisp( meindex, talkerindex, 2); + }else if(select == WINDOW_BUTTONTYPE_NO) { + + }else if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)+1); + NPC_MsgDisp( meindex, talkerindex, 55); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)-1); + NPC_MsgDisp( meindex, talkerindex, 55); + } + break; + + /*--Ի̼̼--*/ + case CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG: + if(select == WINDOW_BUTTONTYPE_YES) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD,0); +#ifdef _NEWEVENT + NPC_MsgDisp( meindex, talkerindex, 81); +#else + NPC_MsgDisp( meindex, talkerindex, 8); +#endif + }else if(select == WINDOW_BUTTONTYPE_NO) { + }else if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)+1); + NPC_MsgDisp( meindex, talkerindex, 66); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)-1); + NPC_MsgDisp( meindex, talkerindex, 66); + } + break; + +#ifdef _NEWEVENT + case CHAR_WINDOWTYPE_WINDOWEVENT_ACCTHANKNEW: + if(select == WINDOW_BUTTONTYPE_OK){ + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD,0); + NPC_MsgDisp( meindex, talkerindex, 8); + }else if(select == WINDOW_BUTTONTYPE_NEXT) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)+1); + NPC_MsgDisp( meindex, talkerindex, 81); + }else if(select == WINDOW_BUTTONTYPE_PREV) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD, + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)-1); + NPC_MsgDisp( meindex, talkerindex, 81); + } + break; +#endif + /*--ʸ ëܸ̼--*/ + case CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP: + if(CHAR_getWorkInt( talkerindex ,CHAR_WORKSHOPRELEVANTTRD) ==0) { + NPC_EventPetSkill( meindex, talkerindex, data); + NPC_MsgDisp( meindex, talkerindex, 25); + }else{ + NPC_EventPetSkill( meindex, talkerindex, data); + NPC_MsgDisp( meindex, talkerindex, 88); + } + break; + } +} + + +/*------------------------- + * ëƻ¾ + --------------------------*/ +int NPC_ExChangeManEventCheck( int meindex, int talker, char *buff1) +{ + char buff2[512]; + char buff3[128]; + char buf[512]; + int i = 1,j = 1; + int loop = 0; + + NPC_Util_GetStrFromStrWithDelim( buff1, "EVENT", buf, sizeof( buf)); + + /*-- EVENtë έ --*/ + while( getStringFromIndexWithDelim(buf, ",", i, buff2,sizeof( buff2)) + !=FALSE ) + { + i++; + /*-- "&"ؤ¼ƥ --*/ + if(strstr( buff2, "&")!=NULL){ + j = 1; + loop = 0; + while(getStringFromIndexWithDelim(buff2, "&", j, buff3, sizeof( buff3)) + != FALSE ) + { + j++; + if(NPC_EventBigSmallCheck( meindex, talker, buff3) == FALSE) + { + loop = 1; + break; + } + } + + if(loop == 0){ + i--; + return i; + } + /*--繴--*/ + }else{ + if(NPC_EventBigSmallCheck( meindex, talker, buff2) == TRUE) { + i--; + return i; + } + } + + } + + return -1; + +} + +/*--------------------------------- + * į + --------------------------------*/ +BOOL NPC_EventBigSmallCheck(int meindex,int talker, char* buf) +{ + + char buff2[128]; + int kosuu; + + /*--ʸͻȻPETë --*/ + if(strstr( buf, "PET") != NULL) { + if(strstr( buf, "EV") != NULL) { + if(NPC_PetLvCheck( meindex, talker, buf, 1) != FALSE) return TRUE; + }else{ + if(NPC_PetLvCheck( meindex, talker, buf, 0) != FALSE) return TRUE; + } + return FALSE; + } +#ifdef _NPC_PETSKILLUP + if(strstr( buf, "PSKILL") != NULL) { + if(strstr( buf, "EV") != NULL) { + if(NPC_PetSkillCheck( meindex, talker, buf, 1) != FALSE) return TRUE; + }else{ + if(NPC_PetSkillCheck( meindex, talker, buf, 0) != FALSE) return TRUE; + } + return FALSE; + } +#endif + /*--Ʊ ɧį --*/ + if(strstr( buf, "<") != NULL) { + getStringFromIndexWithDelim( buf, "<", 2, buff2, sizeof( buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "<", 1, buff2, sizeof( buff2)); + + if(NPC_EventFreeIfCheck( meindex, talker, buff2, kosuu, 1) == TRUE) { + return TRUE; + } + + }else if(strstr( buf, ">") != NULL) { + getStringFromIndexWithDelim( buf, ">", 2, buff2, sizeof(buff2)); + kosuu = atoi(buff2); + getStringFromIndexWithDelim( buf, ">" ,1, buff2, sizeof(buff2)); + + if(NPC_EventFreeIfCheck( meindex, talker, buff2, kosuu, 2)==TRUE) { + return TRUE; + } + + }else if(strstr( buf, "!=" ) != NULL) { + getStringFromIndexWithDelim( buf, "!=", 2, buff2, sizeof( buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "!=", 1, buff2, sizeof( buff2)); + if(NPC_EventFreeIfCheck( meindex, talker, buff2, kosuu, 3) == TRUE) { + return TRUE; + } + + }else if(strstr( buf, "=") != NULL) { + getStringFromIndexWithDelim( buf, "=", 2, buff2, sizeof( buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "=", 1, buff2, sizeof( buff2)); + + if(strstr( buf, "*") != NULL) { + if(NPC_EventReduce( meindex, talker, buf) == TRUE){ + return TRUE; + } + }else if(NPC_EventFreeIfCheck( meindex, talker, buff2, kosuu, 0) + == TRUE) + { + return TRUE; + } + } + + return FALSE; + +} + + +/*----------------------------------- + * ë ƻ¾ + *-----------------------------------*/ +BOOL NPC_EventFreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg) +{ + + /*--ì--*/ + if(strcmp( buf, "LV") == 0) { + if(NPC_EventLevelCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "AMPOINT") == 0) { + if(NPC_EventAmPointCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "FAME") == 0) { + if(NPC_EventFameCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } +#ifndef _CAX_NPCTIME_OFF + if(strcmp( buf, "YEAR") == 0) { + if(NPC_EventYearCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "MON") == 0) { + if(NPC_EventMonCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "DATE") == 0) { + if(NPC_EventDateCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "DAY") == 0) { + if(NPC_EventDayCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "HOUR") == 0) { + if(NPC_EventHourCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "MIN") == 0) { + if(NPC_EventMinCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "SEC") == 0) { + if(NPC_EventSecCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } +#endif + + if(strcmp(buf,"VIP")==0){ + if(NPC_EventVipCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"SUPER")==0){ + if(NPC_EventSuperCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"VIPPOINT")==0){ + if(NPC_EventVipPointCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + if(strcmp(buf,"NPCTIME")==0){ + if(NPC_EventNpcTimeCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + +#ifdef _EV_NUM + if(strcmp(buf,"EVNUM")==0){ + if(NPC_EventEvNumCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"EVTHINGS")==0){ + int evitem; + evitem = CHAR_getInt(talker,CHAR_EVITEM); + if(evitem>0){ + if(NPC_EventItemCheck(meindex,talker,evitem,flg)==TRUE) + return TRUE; + }else{ + return TRUE; + } + } + if(strcmp(buf,"EVCODE")==0){ + if(NPC_EventEvCodeCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + +#ifdef _ALL_ITEM + if(strcmp(buf,"ALLNUM1")==0){ + if(NPC_EventAllNum1Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"ALLNUM2")==0){ + if(NPC_EventAllNum2Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"ALLNUM3")==0){ + if(NPC_EventAllNum3Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"ALLNUM4")==0){ + if(NPC_EventAllNum4Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + if(strcmp(buf,"ALLNUM5")==0){ + if(NPC_EventAllNum5Check(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + + if(strcmp(buf,"EQUIT")==0){ + if(NPC_EventEquitCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } + + /*--ʧ ة--*/ + if(strcmp( buf, "ITEM") == 0) { + if(NPC_EventItemCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + /*-- ì--*/ + if(strcmp( buf, "ENDEV") == 0) { + if(NPC_ENDEventNoCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "NOWEV") == 0) { + if(NPC_NOWEventNoCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "SP" ) == 0) { + if(NPC_SavePointCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + + if(strcmp( buf, "TIME") == 0) { + if(NPC_TiemCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } +#ifdef _CAX_NPCTIME_IF +/*CCIS_WXscript add 09/02/21 ENENT CHECK */ + if(strcmp( buf, "HOUR") == 0) { + if(NPC_TiemCheckWithHour( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + if(strcmp( buf, "DAY") == 0) { + if(NPC_TiemCheckWithDay ( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } +/*CCIS_WXscript add 09/02/21 ENENT CHECK */ +#endif + +#ifdef _PROFESSION_SKILL // WON ADD ְҵ + if(strcmp(buf,"CLASS")==0){ + if(NPC_ActionClassCheck(meindex,talker,kosuu,flg)==TRUE) + return TRUE; + } +#endif + + if(strcmp( buf, "IMAGE") == 0) { + if(NPC_ImageCheck( meindex, talker, kosuu, flg) == TRUE) { + return TRUE; + } + } + +#ifdef _ANGEL_SUMMON + if(strcmp(buf,"ANGEL_NOW")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_DOING, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_NOW")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_DOING, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_OVER")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_OVER")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_OUT")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_TIMEOVER, 0)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_OUT")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_TIMEOVER, 0)==TRUE) + return TRUE; + } + + if(strcmp(buf,"ANGEL_I_NOW")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_DOING, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_NOW")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_DOING, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_I_OVER")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_OVER")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_HERO_COMPLETE, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"ANGEL_I_OUT")==0){ + if( NPC_ActionMissionAngelCheck(meindex,talker,kosuu, MISSION_TIMEOVER, TRUE)==TRUE) + return TRUE; + } + if(strcmp(buf,"HERO_I_OUT")==0){ + if( NPC_ActionMissionHeroCheck(meindex,talker,kosuu, MISSION_TIMEOVER, TRUE)==TRUE) + return TRUE; + } + if(strcmp( buf, "HEROCNT") == 0) { + //if(NPC_EventLevelCheck( meindex, talker, kosuu, flg) == TRUE) { + if(NPC_HeroCompleteCountCheck( meindex, talker, kosuu, flg) == TRUE) + return TRUE; + } + +#endif + + if(strcmp(buf, "SKUP")==0){ + int myskup; + myskup = CHAR_getInt(talker,CHAR_SKILLUPPOINT); + if(NPC_EventBigSmallLastCheck( kosuu, myskup, flg) == TRUE) + return TRUE; + } +#ifdef _NPC_EXCHANGEMANTRANS + //жת + { + //print("\nжת"); + if(strcmp(buf,"TRANS")==0){ + int mytrans; + mytrans = CHAR_getInt(talker,CHAR_TRANSMIGRATION); + if(NPC_EventBigSmallLastCheck( kosuu, mytrans, flg) == TRUE) + return TRUE; + } + } +#endif +#ifdef _PROSK99 + if(strstr( buf, "PROSK" ) != NULL) {//PROSK99>16 ְȼ춵99%Ҫ16 + char *p=NULL; + int i,level=0,count=0; + CHAR_HaveSkill *pSkil; + if( strstr( buf, "PROSK" ) ){ + p = buf; + level = atoi(p+5); + }else + level = 100; + for( i = 0; i < CHAR_SKILLMAXHAVE; i ++ ){ + if( CHAR_getCharHaveSkill( talker, i ) ){ + pSkil = CHAR_getCharHaveSkill( talker, i ); + if( SKILL_getInt( &pSkil->skill, SKILL_LEVEL) >= level ) + ++count; + } + } + if(NPC_EventBigSmallLastCheck( kosuu, count, flg) == TRUE) + return TRUE; + } +#endif + +#ifdef _ADD_reITEM + if(strstr( buf, "reITEM" ) != NULL) { + int i,count=0,itemindex=-1; + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ) + ++count; + } + if(NPC_EventBigSmallLastCheck( kosuu, count, flg) == TRUE) + return TRUE; + } +#endif + + return FALSE; + +} + +/*-------------------------------- + * ʸìë + ---------------------------------*/ +BOOL NPC_PetLvCheck(int meindex,int talker,char *buf,int mode) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[16]; + char buf3[8]; + int petno; + int baseno; + int petlevel = 0; + int flg=0; + int mypetlevel = 0; + int i = 0; + int petindex; + char name[512]; + int cnt = 0; + int loop; + int pettran=-1; //жϳת + + + /*--϶ýľʸϼ ID)ë --*/ + getStringFromIndexWithDelim( buf, "-", 2, buff2, sizeof( buff2)); + if(strstr(buff2,"*") != NULL) { + getStringFromIndexWithDelim( buff2, "*", 1, buf3, sizeof( buf3)); + petno = atoi( buf3); + getStringFromIndexWithDelim( buff2, "*", 2, buf3, sizeof( buf3)); + loop = atoi( buf3); + + }else{ + petno = atoi( buff2); + loop = 1; + + } + + if(getStringFromIndexWithDelim( buf, "-", 3, buff2, sizeof( buff2))) //жϳת + { + pettran = atoi( buff2); + } + + /*--ʸ л¾--*/ + for(i=0; i < CHAR_MAXPETHAVE ; i++) { + if(loop == cnt) return TRUE; + + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + if(pettran != -1) //жϳת + { + if(pettran!=CHAR_getInt( petindex, CHAR_TRANSMIGRATION)) + continue; + } + + /*--ʸIDë ƻ--*/ + baseno = CHAR_getInt( petindex, CHAR_PETID); + + /* ʸIDػƹëƩ */ + if( (baseno == petno) && (CHAR_getInt( petindex, CHAR_ENDEVENT) + == mode)) + { + /*--ìë--*/ + mypetlevel = CHAR_getInt( petindex, CHAR_LV); + getStringFromIndexWithDelim( buf, "-", 1, buff2, sizeof( buff2)); + + if(strstr( buf, "<") != NULL) { + flg = 1; + getStringFromIndexWithDelim( buff2, "<", 2, buf3, sizeof(buf3)); + }else if(strstr( buf, ">") != NULL) { + getStringFromIndexWithDelim( buff2, ">", 2, buf3, sizeof(buf3)); + flg = 2; + }else if(strstr( buf, "=") != NULL) { + getStringFromIndexWithDelim( buff2, "=", 2, buf3, sizeof(buf3)); + flg = 0; + } + + petlevel = atoi( buf3); + + if(NPC_EventBigSmallLastCheck( petlevel, mypetlevel, flg) == TRUE) { + /*--ʸ 󡻥ɬýľ 󡼰 --*/ + if(CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC)==1) { + char *usename; + + /*--ɬð̻P --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("PetLevel:GetArgStrErr"); + return FALSE; + } + + usename = CHAR_getUseName( petindex); + NPC_Util_GetStrFromStrWithDelim( argstr, "Pet_Name", + name,sizeof( name)); + + if(strcmp( name, usename) == 0) + { + cnt++; + continue; + } + }else { + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + cnt++; + continue; + } + } + } + } + + if(loop == cnt) return TRUE; + if(i == CHAR_MAXPETHAVE) return FALSE; + + return FALSE; +} + + +/*-------------------------------- + * ʸìë + ---------------------------------*/ +int NPC_PetLvCheckType2(int petindex,int meindex,int talker,char *buf,int mode) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[16]; + char buf3[8]; + int petno; + int baseno; + int petlevel = 0; + int flg = 0; + int mypetlevel = 0; + char name[512]; + + /*--϶ýľʸϼ ID)ë --*/ + getStringFromIndexWithDelim( buf, "-", 2, buff2, sizeof( buff2)); + if(strstr(buff2,"*") != NULL) { + getStringFromIndexWithDelim( buff2, "*", 1, buf3, sizeof( buf3)); + petno = atoi( buf3); + }else{ + petno = atoi( buff2); + } + + + /*--ʸIDë ƻ--*/ + baseno = CHAR_getInt( petindex, CHAR_PETID); + + /*--ʸIDػƹëƩ--*/ + if( (baseno == petno) && (CHAR_getInt( petindex, CHAR_ENDEVENT) + == mode)) + { + /*--ìë--*/ + mypetlevel=CHAR_getInt( petindex, CHAR_LV); + getStringFromIndexWithDelim( buf, "-", 1,buff2,sizeof(buff2)); + + if(strstr( buf, "<") != NULL) { + flg = 1; + getStringFromIndexWithDelim( buff2, "<", 2, + buf3, sizeof(buf3)); + }else if(strstr( buf, ">") != NULL) { + getStringFromIndexWithDelim( buff2, ">", 2, buf3, sizeof(buf3)); + flg = 2; + }else if(strstr( buf, "=") != NULL) { + getStringFromIndexWithDelim( buff2, "=", 2, buf3, sizeof(buf3)); + flg = 0; + } + + petlevel = atoi(buf3); + + if(NPC_EventBigSmallLastCheck( petlevel, mypetlevel, flg) + == TRUE) + { + /*--ʸ 󡻥ɬýľ 󡼰 --*/ + if(CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC) == 1) { + char *usename; + + /*--ɬð̻P --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("PetLevel:GetArgStrErr"); + return FALSE; + } + + usename = CHAR_getUseName( petindex); + NPC_Util_GetStrFromStrWithDelim(argstr,"Pet_Name", + name, sizeof( name)); + + if(strcmp( name, usename) == 0) + { + return TRUE; + } + }else { + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + return TRUE; + } + } + } + + return FALSE; + +} + +#ifdef _NPC_PETSKILLUP +BOOL NPC_PetSkillCheck(int meindex,int talker,char *buf,int mode) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[64]; + char buf3[32]; + char buf4[32]; + int petskill; + int npcskill; + int skillno; + int petlevel = 0; + int flg=0; + int mypetlevel = 0; + int i = 0; + int petindex; + char name[512]; + int cnt = 0; + int loop; + + + /*--϶ýľʸϼ ID)ë --*/ + if(strstr( buf, "<") != NULL) { + flg = 1; + getStringFromIndexWithDelim( buf, "<", 2, + buff2, sizeof(buff2)); + }else if(strstr( buf, ">") != NULL) { + getStringFromIndexWithDelim( buf, ">", 2, buff2, sizeof(buff2)); + flg = 2; + }else if(strstr( buf, "=") != NULL) { + getStringFromIndexWithDelim( buf, "=", 2, buff2, sizeof(buff2)); + flg = 0; + } + getStringFromIndexWithDelim( buff2, "-", 1, buf3, sizeof( buf3)); + petlevel = atoi(buf3); + getStringFromIndexWithDelim( buff2, "-", 2, buf3, sizeof( buf3)); + skillno = atoi( buf3)-1; + getStringFromIndexWithDelim( buff2, "-", 3, buf3, sizeof( buf3)); + getStringFromIndexWithDelim( buf3, "*", 1, buf4, sizeof( buf4)); + npcskill = atoi( buf4); + getStringFromIndexWithDelim( buf3, "*", 2, buf4, sizeof( buf4)); + loop = atoi( buf4); + + /*--ʸ л¾--*/ + for(i=0; i < CHAR_MAXPETHAVE ; i++) { + //if(loop == cnt) return TRUE; + + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + CHAR_setWorkInt(petindex,CHAR_WORKPETSKILLUP,0); + if(loop==cnt)continue; + /*--ʸIDë ƻ--*/ + + /* ʸIDػƹëƩ */ + if(CHAR_getInt( petindex, CHAR_ENDEVENT)== mode) + { + /*--ìë--*/ + mypetlevel = CHAR_getInt( petindex, CHAR_LV); + + if(NPC_EventBigSmallLastCheck( petlevel, mypetlevel, flg) == TRUE) { + if( !CHAR_CHECKPETSKILLINDEX( skillno)){ + continue; + } + if(CHAR_getPetSkill( petindex, skillno)!=npcskill){ + continue; + } + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + CHAR_setWorkInt(petindex,CHAR_WORKPETSKILLUP,1); + cnt++; + continue; + } + } + } + + if(loop <= cnt) return TRUE; + if(i == CHAR_MAXPETHAVE) return FALSE; + + return FALSE; +} +#endif + +/*------------------------ + * + --------------------------*/ +BOOL NPC_SavePointCheck(int meindex,int talker,int shiftbit,int flg) +{ + int point; + + point = CHAR_getInt( talker, CHAR_SAVEPOINT); + + if( (point & ( 1<< shiftbit)) == ( 1<< shiftbit)) { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; +} + +/*------------------------ + *̶⼰ + --------------------------*/ +BOOL NPC_ImageCheck(int meindex,int talker,int kosuu,int flg) +{ + int image; + + image = CHAR_getInt( talker, CHAR_IMAGETYPE); + + if(NPC_EventBigSmallLastCheck( image, kosuu, flg) == TRUE) { + return TRUE; + } + return FALSE; + +} + + +/*----------------------------------------- + * ޼ë浤(ؤ) + ------------------------------------------*/ +BOOL NPC_TiemCheck(int meindex,int talker,int time,int flg) +{ + LSTIME nowlstime; + int now; + + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + now = getLSTime( &nowlstime); + + if(NPC_EventBigSmallLastCheck( time, now, flg) == TRUE) { + return TRUE; + } + return FALSE; + +} + +#ifdef _CAX_NPCTIME_IF +/*----------------------------------------- + * Time Check ENENT:NPC CCIS_WXscript add + ------------------------------------------*/ +BOOL NPC_TiemCheckWithHour(int meindex,int talker,int ttime,int flg) +{ + time_t cc_seconds; + struct tm * cc_timeinfo; + int cc_sec , now; + + cc_seconds = time (NULL); + cc_timeinfo = localtime ( &cc_seconds ); + + now = cc_timeinfo->tm_hour; + + if(NPC_EventBigSmallLastCheck( ttime, now, flg) == TRUE) { + return TRUE; + } + return FALSE; + +} + +/*----------------------------------------- + * Time Check ENENT:NPC CCIS_WXscript add + ------------------------------------------*/ +BOOL NPC_TiemCheckWithDay (int meindex,int talker,int ttime,int flg) +{ + time_t cc_seconds; + struct tm * cc_timeinfo; + int cc_sec , now; + + cc_seconds = time (NULL); + cc_timeinfo = localtime ( &cc_seconds ); + + now = cc_timeinfo->tm_wday; + + if(NPC_EventBigSmallLastCheck( ttime, now, flg) == TRUE) { + return TRUE; + } + return FALSE; + +} +#endif + +/*------------------------------ + *--Itemë + -------------------------------*/ +BOOL NPC_EventItemCheck(int meindex,int talker,int itemNo,int flg) +{ + int i; + int itemindex = -1; + int id; + + //Change fix 鴩ϵĵ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex) ) { + id=ITEM_getInt( itemindex ,ITEM_ID ); + + if(NPC_EventBigSmallLastCheck( itemNo, id, flg) == TRUE) { + if(flg == 0) return TRUE; + continue; + }else{ + if(flg == 0) continue; + return FALSE; + } + } + } + + if(flg == 3) return TRUE; + + return FALSE; + +} + + +/*------------------------------ + * levelë + -------------------------------*/ +BOOL NPC_EventLevelCheck(int meindex,int talker,int level,int flg) +{ + + int mylevel; + mylevel = CHAR_getInt(talker,CHAR_LV); + + if(NPC_EventBigSmallLastCheck( level, mylevel, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventAmPointCheck(int meindex,int talker,int ampoint,int flg) +{ + + int myampoint; + myampoint = sasql_ampoint( CHAR_getChar(talker,CHAR_CDKEY), 0,0); + + if(NPC_EventBigSmallLastCheck( ampoint, myampoint, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventFameCheck(int meindex,int talker,int fame,int flg) +{ + + int myfame; + myfame = CHAR_getInt(talker,CHAR_FAME)/100; + + if(NPC_EventBigSmallLastCheck( fame, myfame, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +#ifndef _CAX_NPCTIME_OFF +BOOL NPC_EventYearCheck(int meindex,int talker,int npcyear,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcyear, year, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventMonCheck(int meindex,int talker,int npcmon,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcmon, mon, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventDateCheck(int meindex,int talker,int npcdate,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcdate, date, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventDayCheck(int meindex,int talker,int npcday,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcday, day, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventHourCheck(int meindex,int talker,int npchour,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npchour, hour, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventMinCheck(int meindex,int talker,int npcmin,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcmin, min, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventSecCheck(int meindex,int talker,int npcsec,int flg) +{ + NPC_EventTime(); + if(NPC_EventBigSmallLastCheck( npcsec, sec, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +#endif + +BOOL NPC_EventVipCheck(int meindex,int talker,int vip,int flg) +{ + + int myVIP; + myVIP = CHAR_getInt(talker,CHAR_VIPRIDE); + + if(NPC_EventBigSmallLastCheck( vip, myVIP, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventSuperCheck(int meindex,int talker,int super,int flg) +{ + + int mySUPER; + mySUPER = CHAR_getInt(talker,CHAR_SUPER); + + if(NPC_EventBigSmallLastCheck( super, mySUPER, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventVipPointCheck(int meindex,int talker,int vippoint,int flg) +{ + + int myVIPPOINT; + myVIPPOINT = sasql_vippoint(CHAR_getUseID(talker),0,0); + + if(NPC_EventBigSmallLastCheck( vippoint, myVIPPOINT, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventNpcTimeCheck(int meindex,int talker,int npctime,int flg) +{ + + int myNPCTIME; + myNPCTIME = CHAR_getInt(talker,CHAR_NPCTIME); + + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); /*ȡõʱ*/ + timep=mktime(p); + if(npctime==0){ + if(myNPCTIME>=timep) return TRUE; + return FALSE; + }else{ + if(myNPCTIME<=timep) return TRUE; + return FALSE; + } + + return FALSE; + +} + +#ifdef _EV_NUM +BOOL NPC_EventEvNumCheck(int meindex,int talker,int evnum,int flg) +{ + + int myEVNUM; + myEVNUM = CHAR_getInt(talker,CHAR_EVNUM); + + if(NPC_EventBigSmallLastCheck( evnum, myEVNUM, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} + +BOOL NPC_EventEvCodeCheck(int meindex,int talker,int npcno,int flg) +{ + char *evcode=NULL; + evcode = CHAR_getChar(talker,CHAR_EVCODE); + char errmsg[256]; + if(strlen(evcode)<=0) return FALSE; + char tmpbuf[256]; + memset( tmpbuf, 0, sizeof( tmpbuf ) ); + int mynpcno,evflg,itemid,itemnum,petpicid,petminlv,petmaxlv; + char *petname; + if(getStringFromIndexWithDelim(evcode,"|", 1, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + mynpcno = atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 2, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + evflg = atoi(tmpbuf); + if(evflg<1 || evflg>3) return FALSE; + if(evflg==2){ + if(getStringFromIndexWithDelim(evcode,"|", 3, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + itemid = atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 4, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + itemnum = atoi(tmpbuf); + }else if(evflg==3){ + if(getStringFromIndexWithDelim(evcode,"|", 3, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petpicid = atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 4, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petname= tmpbuf; + if(getStringFromIndexWithDelim(evcode,"|", 5, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petminlv = atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 6, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petmaxlv = atoi(tmpbuf); + } + if(npcno!=mynpcno){ + char *npcmsg; + npcmsg=sasql_ev_npcmsg(mynpcno); + if(strcmp(npcmsg,"err")==0) return FALSE; + if(evflg==1){ + sprintf(errmsg,"\n뵽<%s>\n",npcmsg); + lssproto_WN_send( getfdFromCharaIndex(talker), WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + errmsg); + return FALSE; + }else if(evflg==2){ + sprintf(errmsg,"\n%d<%s><%s>\n",itemnum,ITEM_getNameFromNumber( itemid),npcmsg); + lssproto_WN_send( getfdFromCharaIndex(talker), WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + errmsg); + return FALSE; + }else if(evflg==3){ + sprintf(errmsg,"\nŵȼΪ%d-%d֮ij<%s><%s>\n",petminlv,petmaxlv,petname,npcmsg); + lssproto_WN_send( getfdFromCharaIndex(talker), WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + errmsg); + return FALSE; + } + }else{ + if(evflg==1){ + return TRUE; + }else if(evflg==2){ + sprintf(errmsg,"ITEM=%d*%d",itemid,itemnum); + if(NPC_EventReduce(meindex,talker,errmsg)==TRUE){ + return TRUE; + }else{ + sprintf(errmsg,"\n%d<%s>⽻\n",itemnum,ITEM_getNameFromNumber( itemid)); + lssproto_WN_send( getfdFromCharaIndex(talker), WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + errmsg); + return FALSE; + } + }else if(evflg==3){ + int peti,petindex=-1,mypetpicid,mypetlv; + for(peti=0;peti=petminlv && mypetlv<=petmaxlv){ + return TRUE; + } + continue; + } + if(peti>=CHAR_MAXPETHAVE){ + sprintf(errmsg,"\nŵȼΪ%d-%d֮ij<%s>Ҵ\n",petminlv,petmaxlv,petname); + lssproto_WN_send( getfdFromCharaIndex(talker), WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + errmsg); + return FALSE; + } + } + } + return FALSE; +} +#endif + +#ifdef _ALL_ITEM +BOOL NPC_EventAllNum1Check(int meindex,int talker,int npcallnum1,int flg) +{ + + int myALLNUM1; + myALLNUM1 = sasql_allnum(1,0,0); + + if(NPC_EventBigSmallLastCheck( npcallnum1, myALLNUM1, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventAllNum2Check(int meindex,int talker,int npcallnum2,int flg) +{ + + int myALLNUM2; + myALLNUM2 == sasql_allnum(2,0,0); + + if(NPC_EventBigSmallLastCheck( npcallnum2, myALLNUM2, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventAllNum3Check(int meindex,int talker,int npcallnum3,int flg) +{ + + int myALLNUM3; + myALLNUM3 = sasql_allnum(3,0,0); + + if(NPC_EventBigSmallLastCheck( npcallnum3, myALLNUM3, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventAllNum4Check(int meindex,int talker,int npcallnum4,int flg) +{ + + int myALLNUM4; + myALLNUM4 = sasql_allnum(4,0,0); + + if(NPC_EventBigSmallLastCheck( npcallnum4, myALLNUM4, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +BOOL NPC_EventAllNum5Check(int meindex,int talker,int npcallnum5,int flg) +{ + + int myALLNUM5; + myALLNUM5 = sasql_allnum(5,0,0); + + if(NPC_EventBigSmallLastCheck( npcallnum5, myALLNUM5, flg) == TRUE) + { + if(flg == 3) return FALSE; + return TRUE; + } + + if(flg == 3) return TRUE; + return FALSE; + +} +#endif + +BOOL NPC_EventEquitCheck(int meindex,int talker,int itemNo, int flg) +{ + int i; + int itemindex=-1; + int id; + for( i=0;i point1) { + return TRUE; + } + }else if(flg == 3) { + if(point1 != mypoint) { + return TRUE; + } + } + return FALSE; +} + + +/*--------------------------------- + *ë + *----------------------------------*/ +#ifdef _CHANNEL_MODIFY +extern int *piOccChannelMember; +#endif +void NPC_MsgDisp(int meindex,int talker,int num) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; +#ifdef _NEWEVENT + char buf[4096]; + char token2[4096]; + char buf2[4096]; + char token[4096]; + char tmp[4096]; +#else + char buf[1024*2]; + char token2[100*14]; + char buf2[512]; + char token[512]; + char tmp[32]; +#endif + int i = 1; + int q=1; + int work = 0; + int EvNo = 0; + int fd = getfdFromCharaIndex( talker); + int buttontype = WINDOW_BUTTONTYPE_OK; + int windowtype = CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG; + int evch; + + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("MsgDisp:GetArgStrErr"); + print("NPCName=%s\n", CHAR_getChar( meindex, CHAR_NAME)); + return ; + } + if(num == 22 || num == 82 || num == 55 || num == 66) { + int pwork; + + pwork = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + pwork = (pwork / 100) -1 ; + + getStringFromIndexWithDelim( argstr, "EventEnd", pwork, buf,sizeof( buf)); + + }else{ + /*ɬð̻ë*/ + while(getStringFromIndexWithDelim( argstr, "EventEnd", i, buf, sizeof(buf)) + != FALSE) + { + i++; + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + + /*--ìϼë--*/ + NPC_Util_GetStrFromStrWithDelim( buf, "EventNo", buf2, sizeof( buf2)); + if(strstr( buf2, "-1") != 0) { + EvNo = -1; + }else{ + if(strstr(buf2,",") != NULL){ + char buf3[128]; + while(getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)) + != FALSE) { + q++; + } + q--; + q = rand()%q + 1; + getStringFromIndexWithDelim( buf2, ",", q, buf3, sizeof( buf3)); + EvNo = atoi( buf3); + }else{ + EvNo = atoi( buf2); + } + } + //EvNo = atoi( buf2); + + /*--׷ºë浤ƥì ƻݳ--*/ + if(NPC_EventCheckFlg( talker, EvNo) == TRUE) continue; + + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"Pet_Name", buf2,sizeof( buf2)) + != NULL ) + { + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 1); + } + + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"KeyWord", buf2,sizeof( buf2) ) + != NULL) + { + if(CHAR_getWorkInt( talker ,CHAR_WORKSHOPRELEVANT) != i) continue; + } + + evch = NPC_ExChangeManEventCheck( meindex, talker, buf); + + if(evch != -1) { + + /*--ì--*/ + // if(NPC_ExChangeManEventCheck( meindex, talker, buf) == TRUE) { + break; + } + } + } + + //print(" NPC_MsgDisp:%d ", num); + + switch( num) { + case 0: + /*ػìë¾ë ʶ--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "StopMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token,sizeof( buf2), buf2); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = CHAR_WINDOWTYPE_WINDOWEVENT_NOWEVENT; + } + break; + + case 1: + /*--֧¾ë ׽мNOë--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "NoStopMsg", + buf2, sizeof( buf2)) + != NULL) + { + strcpysafe( token, sizeof(buf2), buf2); + + } + break; + + case 7: + /*--ػìë弰--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "EndStopMsg", + buf2, sizeof( buf2)) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + + /*--ì ë Ȼջ--*/ + NPC_EventAdd( meindex, talker, 1); + + /*--׷ºë--*/ + NPC_NowEventSetFlgCls( talker, EvNo); + + /*--Ӭ׼ƥ ë--*/ + if(CHAR_getInt( talker, CHAR_CHARM) > 0) { + CHAR_setInt( talker, CHAR_CHARM, CHAR_getInt(talker,CHAR_CHARM) -1); + CHAR_complianceParameter( talker ); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM); + NPC_CharmStatus( meindex, talker); + } + } + break; + + case 2: + /*--ؤԻ絤--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "ThanksMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token,sizeof( buf2), buf2); + /*--ì ׷ºë--*/ + if(NPC_EventAdd(meindex, talker, 0) != FALSE) { + NPC_NowEventSetFlg( talker, EvNo); + } + else { + return; + } + + + if(NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", + buf2, sizeof( buf2) ) + !=NULL) + { + char buf3[16]; + int k = 1; + if(EvNo != -1) NPC_NowEventSetFlgCls( talker, EvNo); + + while(getStringFromIndexWithDelim(buf2 , "," ,k, + buf3, sizeof(buf3)) + !=FALSE ) + { + k++; + NPC_EventSetFlg( talker, atoi( buf3)); + } + } + + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2)) + != NULL) { + char buf3[16]; + int k = 1; + + k= 1 ; + while(getStringFromIndexWithDelim(buf2 , "," , k, + buf3, sizeof(buf3)) + != FALSE ) + { + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + k++; + } + } + + + + } + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, 1); + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work + ( i * 100); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, work); + + if(NPC_Util_GetStrFromStrWithDelim( buf,"NpcWarp", + token2,sizeof( token2) ) + != NULL){ + NPC_EventWarpNpc(meindex,token2); + } + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "ThanksMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + + break; + + case 22: + + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work % 100; + + if(work == 1){ + if( NPC_Util_GetStrFromStrWithDelim( buf, "ThanksMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token,sizeof( buf2), buf2); + } + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "ThanksMsg2") != NULL) { + + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + + }else{ + + sprintf( tmp, "ThanksMsg%d", work); + if( NPC_Util_GetStrFromStrWithDelim( buf, tmp, + buf2, sizeof( buf2) ) + != NULL) { + strcpysafe( token,sizeof( buf2), buf2); + } + + work++; + sprintf( tmp, "ThanksMsg%d", work); + + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, tmp) != NULL) { + + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + }else{ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWEVENT_REQTHANK, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + } + break; + + case 25: + /*--ؤԻ絤--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "ThanksMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token,sizeof( buf2), buf2); + /*--ì ׷ºë--*/ + if(NPC_EventAdd(meindex, talker, 2) != FALSE) { + NPC_NowEventSetFlg( talker, EvNo); + } + } + break; + + + case 3: + /*-- ɧ--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "NomalMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe(token, sizeof( buf2), buf2); + } + break; + + case 4: + /*--ʧ ةмݼ--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "ItemFullMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe(token, sizeof( buf2), buf2); + } + break; + + case 5: + /*-- ë¶˼̼--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "RequestMsg", + buf2, sizeof( buf2) ) + != NULL) + { + + if(strstr(buf2,"%8d") != NULL) { + char buf3[64]; + int cost; + + NPC_Util_GetStrFromStrWithDelim( buf, "DelStone", + buf3, sizeof( buf3) ); + cost = NPC_EventGetCost( meindex, talker, buf3); + + sprintf(token,buf2,cost); + + }else{ + strcpysafe( token,sizeof( buf2), buf2); + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG; + } + + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, 1); + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work + ( i * 100); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, work); + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "RequestMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + break; + + case 55: + + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work % 100; + + if(work == 1){ + if( NPC_Util_GetStrFromStrWithDelim( buf, "RequestMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + } + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "RequestMsg2") != NULL){ + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + }else{ + + sprintf( tmp, "RequestMsg%d", work); + if( NPC_Util_GetStrFromStrWithDelim( buf, tmp, + buf2, sizeof( buf2) ) + != NULL){ + strcpysafe( token,sizeof( buf2), buf2); + + } + work++; + sprintf( tmp, "RequestMsg%d", work); + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, tmp) != NULL) { + + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + }else{ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWEVENT_REQMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + } + break; + + + case 6: + //print(" 6_Ӧ? "); + /*--Ի˼̼--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "AcceptMsg", + buf2, sizeof( buf2) ) + != NULL) + { + if(strstr(buf2,"%8d") != NULL) { + char buf3[64]; + int cost; + + NPC_Util_GetStrFromStrWithDelim( buf, "DelStone", + buf3, sizeof( buf3) ); + cost = NPC_EventGetCost( meindex, talker, buf3); + + sprintf( token, buf2, cost); + }else{ + strcpysafe( token, sizeof( buf2), buf2); + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG; + } + + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, 1); + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work + ( i * 100); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, work); + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "AcceptMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + break; + + + case 66: + //print(" 66_Ӧ? "); + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work % 100; + + if(work == 1){ + if( NPC_Util_GetStrFromStrWithDelim( buf, "AcceptMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token,sizeof( buf2), buf2); + } + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "AcceptMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + }else{ + + sprintf( tmp, "AcceptMsg%d", work); + if( NPC_Util_GetStrFromStrWithDelim( buf, tmp, + buf2, sizeof( buf2) ) + != NULL){ + strcpysafe( token,sizeof( buf2), buf2); + } + work++; + sprintf( tmp, "AcceptMsg%d", work); + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, tmp) != NULL) { + + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + }else{ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWEVENT_ACCMAINMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + } + break; + + case 8: + //print(" 8_Ӧ? "); + + if( NPC_Util_GetStrFromStrWithDelim( buf, "ThanksMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + /*--ì ׷ºë--*/ + if(NPC_AcceptDel( meindex, talker,0) == FALSE){ + return ; + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", + buf2, sizeof( buf2) ) + !=NULL) + { + char buf3[16]; + int k = 1; + if(EvNo != -1) NPC_NowEventSetFlgCls( talker, EvNo); + + while(getStringFromIndexWithDelim(buf2 , "," ,k, + buf3, sizeof(buf3)) + !=FALSE ) + { + k++; + NPC_EventSetFlg( talker, atoi( buf3)); + } + } + + if( NPC_Util_GetStrFromStrWithDelim( buf, "Charm", + buf2, sizeof( buf2)) + !=NULL) + { + /*--ƥ գ ë---*/ + if( CHAR_getInt( talker, CHAR_CHARM) < 100 && EvNo > 0 ){ + if(CHAR_getInt( talker, CHAR_CHARM) + atoi(buf2) > 100){ + CHAR_setInt( talker, CHAR_CHARM,100); + + }else{ + CHAR_setInt( talker, CHAR_CHARM, + CHAR_getInt(talker,CHAR_CHARM) + atoi(buf2)); + + } + + CHAR_complianceParameter( talker ); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM); + NPC_CharmStatus( meindex, talker); + } + } + + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2)) + != NULL) { + char buf3[16]; + int k = 1; + + k= 1 ; + while(getStringFromIndexWithDelim(buf2 , "," , k, + buf3, sizeof(buf3)) + != FALSE ) + { + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + k++; + } + } + + + // Robin add ְҵ + if( NPC_Util_GetStrFromStrWithDelim( buf, "PROFESSION", + buf2, sizeof( buf2)) != NULL) + { + int p_class = atoi( buf2); + //Change fix 2004/07/05 + for( i=0; i 0 ){ + p_class = 1; + CHAR_talkToCli( talker, -1, "Ȱְҵװͨͨж£", CHAR_COLORWHITE); + break; + } + } + } + if( p_class == 0) + { + print(" ====ְҵ==== "); + + // ԭ + //if( PROFESSION_RESTORE_POINT( talker ) != 1 ) return FALSE; + + // 趨ְҵ + CHAR_setInt( talker, PROFESSION_CLASS, p_class ); +#ifdef _CHANNEL_MODIFY + if(CHAR_getInt(talker,PROFESSION_CLASS) > 0){ + int i,pclass = CHAR_getInt(talker,PROFESSION_CLASS) - 1; + for(i=0;i 0 ){ + if(CHAR_getInt( talker, CHAR_CHARM) + atoi(buf2) > 100){ + CHAR_setInt( talker, CHAR_CHARM,100); + }else{ + CHAR_setInt( talker, CHAR_CHARM, + CHAR_getInt(talker,CHAR_CHARM) + atoi( buf2)); + } + CHAR_complianceParameter( talker ); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM); + NPC_CharmStatus( meindex, talker); + } + } + } + + break; + + + case 9: + + if( NPC_Util_GetStrFromStrWithDelim( buf, "NomalWindowMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + if(EvNo != -1) NPC_NowEventSetFlg( talker, EvNo); + } +#ifdef _NEWEVENT + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, 1); + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work + ( i * 100); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, work); + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "NomalWindowMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } +#endif + break; + +#ifdef _NEWEVENT + case 99: + work = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD); + work = work % 100; + + if(work == 1) + { + if( NPC_Util_GetStrFromStrWithDelim( buf, "NomalWindowMsg1", + buf2, sizeof( buf2) ) != NULL) + strcpysafe( token,sizeof( buf2), buf2); + + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, "NomalWindowMsg2") != NULL) { + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + }else{ + + sprintf( tmp, "NomalWindowMsg%d", work); + if( NPC_Util_GetStrFromStrWithDelim( buf, tmp, + buf2, sizeof( buf2) ) + != NULL){ + strcpysafe( token,sizeof( buf2), buf2); + } + work++; + sprintf( tmp, "NomalWindowMsg%d", work); + /*--ʸ⻥ؤʾ̼ë--*/ + if(strstr( buf, tmp) != NULL) { + + /*ƥ˪*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + }else{ + int fd = getfdFromCharaIndex( talker); + char token2[14*100]; + /*--ƥʧ ةئܰë浤--*/ + if(NPC_AcceptDel( meindex, talker,0) == FALSE) return; + + /*׷ºëƻľɣ--*/ + if( EvNo != -1) NPC_NowEventSetFlg( talker, EvNo); + + if(NPC_Util_GetStrFromStrWithDelim( buf,"NpcWarp", + token2,sizeof( token2) )!= NULL){ + NPC_EventWarpNpc(meindex,token2); + } + + //׷ºë + if(NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", + buf2, sizeof( buf2) )!=NULL) + { + char buf3[16]; + int k = 1; + + if(EvNo != -1) NPC_NowEventSetFlgCls( talker, EvNo); + + while(getStringFromIndexWithDelim(buf2 , "," ,k, + buf3, sizeof(buf3)) !=FALSE ) + { + k++; + NPC_EventSetFlg( talker, atoi( buf3)); + } + } + //ì׷ºë + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2)) != NULL) { + char buf3[16]; + int k = 1; + + k= 1 ; + while(getStringFromIndexWithDelim(buf2 , "," , k, + buf3, sizeof(buf3)) + != FALSE ) + { + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + k++; + } + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YES, + CHAR_WINDOWTYPE_WINDOWEVENT_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return; + } + } + break; +#endif + case 10: + + /*--ʸмݼ--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "PetFullMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + print(" PetFullMsg:%s ", token); + } + else + { + print(" PetFullMsg_Error:%d ", __LINE__); + } + break; + + case 11: + /*--׷ºë弰--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanMainMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = CHAR_WINDOWTYPE_WINDOWEVENT_CLEANMSG; + } + break; + case 12: + /*--׷ºë --*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlgMsg", + buf2, sizeof( buf2) ) + != NULL) + { + char buf3[64]; + int loop=1; + + strcpysafe( token, sizeof( buf2), buf2); + NPC_Util_GetStrFromStrWithDelim( buf, "CleanFlg", + buf2, sizeof( buf2) ); + while(getStringFromIndexWithDelim(buf2 , "," , loop, buf3, sizeof(buf3)) + != FALSE ) + { + NPC_EndEventSetFlgCls( talker, atoi(buf3)); + loop++; + } + } + break; + + case 13: + /*--Żм--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "StoneFullMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + } + break; + + case 14: + /*--ŻԻئж--*/ + if( NPC_Util_GetStrFromStrWithDelim( buf, "StoneLessMsg", + buf2, sizeof( buf2) ) + != NULL) + { + strcpysafe( token, sizeof( buf2), buf2); + } + break; + } + + /*ƥ˪*/ +#ifdef _NEWEVENT + if(num != 8) +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + buttontype, + windowtype, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +/*-------------------------------------- + *ìüʧ ةëܰ + ---------------------------------------*/ +BOOL NPC_EventAdd(int meindex,int talker,int mode) +{ + + char buf[64]; + char buff2[1024]; + int j = 1,i = 0; + int kosuucnt = 0; + int itemindex; + char buff[1024*2]; + int rand_j = 0; + int rand_flg = 0; + int rand_cnt = 0; + int evcnt; + int b_flg = 0; + + /*--ɬð̻ ̤лؤë ƻּë --*/ + evcnt = NPC_EventFile( meindex, talker, buff); + + if(evcnt == -1) return FALSE; + +// if(NPC_EventFile( meindex, talker, buff) == FALSE) return FALSE; + + /*--ʧ ةë--*/ + if(NPC_ItemFullCheck( meindex, talker, buff, mode, evcnt) == FALSE){ + NPC_MsgDisp( meindex, talker, 4); + return FALSE; + } + + /*--ͱ --*/ + if(NPC_Util_GetStrFromStrWithDelim( buff, "DelStone", buff2, sizeof( buff2) ) + !=NULL) + { + int stone; + + stone = NPC_EventGetCost( meindex, talker, buff2); + + if( (CHAR_getInt( talker, CHAR_GOLD) - stone) < 0 ){ + NPC_MsgDisp( meindex, talker, 14); + return FALSE; + } + } + + + /*--ʸ ëܰ--*/ + if((NPC_Util_GetStrFromStrWithDelim( buff, "pet_skill", buff2, sizeof( buff2) ) + !=NULL) && mode == 0 ){ + if(mode == 0) { + NPC_PetSkillMakeStr( meindex, talker, 1); + return TRUE; + } + } + + + if(mode == 2) mode = 0; + + /*--ʸëܰ---*/ + if(NPC_Util_GetStrFromStrWithDelim( buff, "GetPet", buff2, sizeof( buff2) ) + !=NULL) + { + if(mode == 0){ + if(NPC_EventAddPet( meindex, talker, buff2,0) == FALSE) { + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + }else if(mode == 1){ + + } + } + + // Robin add NPCȡﵰ + if(NPC_Util_GetStrFromStrWithDelim( buff, "GetEgg", buff2, sizeof( buff2) ) + !=NULL) + { + if(mode == 0){ + if(NPC_EventAddEgg( meindex, talker, buff2,0) == FALSE) { + print(" AddEgg_Error:%d ", __LINE__); + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + }else if(mode == 1){ + + } + } + + if(NPC_Util_GetStrFromStrWithDelim( buff, "DelItem", buff2, sizeof( buff2) ) !=NULL){ + if(strstr(buff2,"EVDEL") != NULL){ + char work[256]; + char nbuf[256]; + + NPC_Util_GetStrFromStrWithDelim(buf, "EVENT", buff2, sizeof( buff2)); + getStringFromIndexWithDelim( buff2, ",", evcnt, work, sizeof( work)); + + if(strstr(buff,"Break")!=NULL){ + b_flg=1; + }else{ + b_flg=0; + } + + if(NPC_Util_GetStrFromStrWithDelim( buff, "NotDel", nbuf, sizeof( nbuf)) != NULL) { + NPC_EventDelItemEVDEL( meindex, talker, work, nbuf,b_flg); + }else{ + NPC_EventDelItemEVDEL( meindex, talker, work, "-1",b_flg); + } + + }else{ + if(strstr(buff,"Break")!=NULL){ + b_flg=1; + }else{ + b_flg=0; + } + + NPC_EventDelItem( meindex, talker, buff2, b_flg); + } + } + + /*--ë---*/ + if(NPC_Util_GetStrFromStrWithDelim( buff, "DelStone", buff2, sizeof( buff2) ) + !=NULL) + { + int stone; + char token[128]; + + stone = NPC_EventGetCost( meindex, talker, buff2); + + CHAR_setInt(talker,CHAR_GOLD,CHAR_getInt( talker, CHAR_GOLD) - stone); + + /*--ɷ¶˪Ի--*/ + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + sprintf(token, "%dstone", stone); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + + + /*--¼ĸةʧ ة---*/ + if(NPC_Util_GetStrFromStrWithDelim( buff, "GetRandItem", buf, sizeof( buf) ) != NULL ){ + j=1; + while( getStringFromIndexWithDelim( buf , "," , j, buff2, sizeof( buff2)) != FALSE ){ + j++; + rand_j++; + } + rand_cnt = 1; + } + + + /*-- ɧʧ ة--*/ + if(NPC_Util_GetStrFromStrWithDelim( buff, "GetItem", buf, sizeof( buf)) != NULL ){ + if(mode == 0) { + j = 1; + /*--ۼʧ ةë ʾ--*/ + while(getStringFromIndexWithDelim( buf, "," , j, buff2, sizeof(buff2)) !=FALSE ){ + j++; + } + + j--; + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ){ + kosuucnt++; + } + } + j= j + rand_cnt; + if( kosuucnt < j ){ + NPC_MsgDisp( meindex, talker, 4); + return FALSE; + + }else{ + if(NPC_Util_GetStrFromStrWithDelim( buff, "GetRandItem", buff2, sizeof( buff2)) !=NULL) { + rand_flg = 1; + NPC_RandItemGet( meindex, talker, rand_j, buff2); + } + if(NPC_EventAddItem( meindex, talker, buf) == FALSE) return FALSE; + } + }else if(mode == 1){ + if(strstr(buff,"Break")!=NULL){ + b_flg=1; + }else{ + b_flg=0; + } + NPC_EventDelItem( meindex, talker, buf,b_flg); + } + } + + if( (NPC_Util_GetStrFromStrWithDelim( buff, "GetRandItem", buf, sizeof( buf) ) + !=NULL) && (rand_flg == 0) && mode == 0 ) + { + /*-- ¾-*/ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ){ + kosuucnt++; + } + } + /*--廥ؤ¾--*/ + if( kosuucnt == 0 ){ + NPC_MsgDisp( meindex, talker, 4); + return FALSE; + } + + + NPC_RandItemGet( meindex, talker, rand_j,buf); + } + +#ifdef _EXCHANGEMAN_REQUEST_DELPET + if( NPC_Util_GetStrFromStrWithDelim( buff, "DelPet", buff2, sizeof( buff2) ) != NULL && mode == 0 ) { + char buf4[32]; + char buf5[256]; + int i=1; + char work[256]; + int j=1; + + if(strstr(buff2,"EVDEL") != NULL){ + NPC_Util_GetStrFromStrWithDelim( buf, "EVENT", buf5, sizeof( buf5)); + getStringFromIndexWithDelim( buf5, ",",evcnt , buff2, sizeof( buff2)); + while(getStringFromIndexWithDelim( buff2, "&", j, work, sizeof( work))!=FALSE){ + j++; + if(strstr( work, "PET") != NULL) { + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheck( meindex, talker, work, 1) == FALSE) return FALSE; + }else{ + if(NPC_PetLvCheck( meindex, talker, work, 0) == FALSE) return FALSE; + } + } + } + j = 1; + while(getStringFromIndexWithDelim( buff2, "&", j, work, sizeof( work)) != FALSE){ + j++; + if(strstr( work, "PET") == NULL ) continue; + + if(strstr(work,"*") != NULL){ + int cnt=0; + int petcnt=0; + int petindex; + + getStringFromIndexWithDelim( work, "*", 2, buf4, sizeof( buf4)); + cnt = atoi(buf4); + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 1) + == FALSE) { + continue; + } + }else{ + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 0) == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker,i) == FALSE) return FALSE; + + petcnt++; + /*--϶мʸë׾--*/ + if(cnt == petcnt) break; + + } + }else{ + /*--ʸëë϶ƻئмƥʸë廯--*/ + + int petindex; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + petindex = CHAR_getCharPet( talker, i); + + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if(strstr( buff2, "EV") != NULL){ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 1) == FALSE){ + continue; + } + }else{ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 0) == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker, i) == FALSE) return FALSE; + } + } + } + + }else{ + /*--ֵ1պʸë Ȼ¾ë浤--*/ + while(getStringFromIndexWithDelim( buff2, ",", j, work, sizeof( work)) + !=FALSE) + { + j++; + /*--ʸͻȻPETë --*/ + if(strstr( work, "PET") != NULL) { + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheck( meindex, talker, work, 1) == FALSE) return FALSE; + }else{ + if(NPC_PetLvCheck( meindex, talker, work, 0) == FALSE) return FALSE; + } + } + } + j = 1; + + while(getStringFromIndexWithDelim( buff2, ",", j, work, sizeof( work)) != FALSE) + { + j++; + if(strstr(work,"*") != NULL) + { + int cnt=0; + int petcnt=0; + int petindex; + + getStringFromIndexWithDelim( work, "*", 2, buf4, sizeof( buf4)); + cnt = atoi(buf4); + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 1) == FALSE) { + continue; + } + }else{ + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 0) == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker,i) == FALSE) return FALSE; + + petcnt++; + /*--϶мʸë׾--*/ + if(cnt == petcnt) break; + } + }else{ + /*--ʸëë϶ƻئмƥʸë廯--*/ + + int petindex; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + petindex = CHAR_getCharPet( talker, i); + + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if(strstr( buff2, "EV") != NULL){ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 1) == FALSE){ + continue; + } + }else{ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 0) == FALSE) { + continue; + } + } + if(NPC_EventDelPet( meindex, talker, i) == FALSE) return FALSE; + } + } + } + } + } +#endif + return TRUE; + +} + + +/*-------------------------------------- + *¼ĸةƥʧ ةë + ------------------------------------ */ +BOOL NPC_RandItemGet(int meidex,int talker,int rand_j,char *buf) +{ + char buff2[64]; + int randitem; + int ret; + int itemindex; + char token[128]; + + if(rand_j == 0) { + print("Event:춣Ľ룬ִ"); + return FALSE; + } + + //randitem = rand()%rand_j; + //srand((int)time(0)); + randitem = RAND(1,rand_j); + if(randitem == 0) randitem = rand_j; + + getStringFromIndexWithDelim(buf , "," , randitem, buff2, sizeof(buff2)) ; + + itemindex = ITEM_makeItemAndRegist( atoi( buff2)); + + if(itemindex == -1) return FALSE; + + /*ʧ ةܰ( ʧ ة ľ */ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_exchangeman.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventAddItem(õĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + return TRUE; + +} + + +/*---------------------------------------------------- + * ì + ----------------------------------------------------*/ +BOOL NPC_AcceptDel(int meindex,int talker,int mode ) +{ + + char buf[1024*2]; + char buff2[1024]; + int rand_j = 0; + int j = 0; + int evcnt; + int b_flg = 0; + evcnt = NPC_EventFile( meindex, talker, buf); + if(evcnt == -1) return FALSE; + + /*--ɬð̻ 微ľë ƻּë --*/ +// if(NPC_EventFile(meindex,talker,buf)==FALSE) return FALSE; + + /*--ʧ ةë--*/ + if(NPC_ItemFullCheck( meindex, talker, buf, mode, evcnt) == FALSE){ + NPC_MsgDisp( meindex, talker, 4); + return FALSE; + } + + /*--ͱ --*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelStone", buff2, sizeof( buff2) ) + !=NULL) + { + int stone; + stone = NPC_EventGetCost( meindex, talker, buff2); + + if( (CHAR_getInt( talker, CHAR_GOLD) - stone) < 0 ) { + NPC_MsgDisp( meindex, talker, 14); + return FALSE; + } + } + + + /*--ͱ --*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetStone", buff2, sizeof( buff2) )!=NULL){ + int stone; + stone = atoi(buff2); + + if( (CHAR_getInt( talker, CHAR_GOLD) + stone) >= CHAR_getMaxHaveGold( talker) ) { + NPC_MsgDisp( meindex, talker, 13); + return FALSE; + } + } + + + /*--ʸ ëܰ--*/ + if((NPC_Util_GetStrFromStrWithDelim( buf, "pet_skill", buff2, sizeof( buff2) ) + !=NULL) && mode == 0 ){ + if(mode == 0){ + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD, 1); + NPC_PetSkillMakeStr( meindex, talker, 1); + return TRUE; + } + } + + /*--ʸë---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelPet", buff2, sizeof( buff2) ) != NULL) { + char buf4[32]; + char buf5[256]; + int i=1; + char work[256]; + int j=1; + + if(strstr(buff2,"EVDEL") != NULL){ + NPC_Util_GetStrFromStrWithDelim( buf, "EVENT", buf5, sizeof( buf5)); + getStringFromIndexWithDelim( buf5, ",",evcnt , buff2, sizeof( buff2)); + + + /*--ֵ1պʸë Ȼ¾ë浤--*/ + while(getStringFromIndexWithDelim( buff2, "&", j, work, sizeof( work)) + !=FALSE) + { + j++; + + /*--ʸͻȻPETë --*/ + if(strstr( work, "PET") != NULL) { + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheck( meindex, talker, work, 1) == FALSE) return FALSE; + }else{ + if(NPC_PetLvCheck( meindex, talker, work, 0) == FALSE) return FALSE; + } + } + } + j = 1; + + + while(getStringFromIndexWithDelim( buff2, "&", j, work, sizeof( work)) + != FALSE) + { + j++; + if(strstr( work, "PET") == NULL ) continue; + + if(strstr(work,"*") != NULL) + { + int cnt=0; + int petcnt=0; + int petindex; + + getStringFromIndexWithDelim( work, "*", 2, buf4, sizeof( buf4)); + cnt = atoi(buf4); + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 1) + == FALSE) { + continue; + } + }else{ + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 0) + == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker,i) == FALSE) return FALSE; + + petcnt++; + /*--϶мʸë׾--*/ + if(cnt == petcnt) break; + + } + }else{ + /*--ʸëë϶ƻئмƥʸë廯--*/ + + int petindex; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + petindex = CHAR_getCharPet( talker, i); + + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if(strstr( buff2, "EV") != NULL){ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 1) + == FALSE){ + continue; + } + }else{ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 0) + == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker, i) == FALSE) return FALSE; + } + } + } + + }else{ + + /*--ֵ1պʸë Ȼ¾ë浤--*/ + while(getStringFromIndexWithDelim( buff2, ",", j, work, sizeof( work)) + !=FALSE) + { + j++; + /*--ʸͻȻPETë --*/ + if(strstr( work, "PET") != NULL) { + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheck( meindex, talker, work, 1) == FALSE) return FALSE; + }else{ + if(NPC_PetLvCheck( meindex, talker, work, 0) == FALSE) return FALSE; + } + } + } + j = 1; + + + while(getStringFromIndexWithDelim( buff2, ",", j, work, sizeof( work)) + != FALSE) + { + j++; + if(strstr(work,"*") != NULL) + { + int cnt=0; + int petcnt=0; + int petindex; + + getStringFromIndexWithDelim( work, "*", 2, buf4, sizeof( buf4)); + cnt = atoi(buf4); + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + if(strstr( work, "EV") != NULL) { + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 1) + == FALSE) { + continue; + } + }else{ + if(NPC_PetLvCheckType2(petindex, meindex, talker, work, 0) + == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker,i) == FALSE) return FALSE; + + petcnt++; + /*--϶мʸë׾--*/ + if(cnt == petcnt) break; + + } + }else{ + /*--ʸëë϶ƻئмƥʸë廯--*/ + + int petindex; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + petindex = CHAR_getCharPet( talker, i); + + if( !CHAR_CHECKINDEX( petindex) ) continue; + + if(strstr( buff2, "EV") != NULL){ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 1) + == FALSE){ + continue; + } + }else{ + if(NPC_PetLvCheckType2( petindex, meindex, talker, work, 0) + == FALSE) { + continue; + } + } + + if(NPC_EventDelPet( meindex, talker, i) == FALSE) return FALSE; + } + } + } + } + } + + + + /*--ëؤ---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetStone", buff2, sizeof( buff2) ) + !=NULL) + { + int stone; + char token[128]; + + stone = atoi(buff2); + CHAR_setInt(talker,CHAR_GOLD,CHAR_getInt( talker, CHAR_GOLD) + stone); + /*--ɷ¶˪Ի--*/ + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + + sprintf( token,"õ%dstone", stone); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + + + /*--ʸëܰ---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetPet", buff2, sizeof( buff2) ) + !=NULL) + { + if(NPC_EventAddPet( meindex, talker, buff2,1) == FALSE) { + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + } + +#ifdef _TRANS_7_NPC + if(NPC_Util_GetStrFromStrWithDelim( buf, "TRANS7", buff2, sizeof( buff2) ) + !=NULL) + { + if(NPC_EventTRANS( meindex, talker, buff2,1) == FALSE) { + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "TRANSNEW7", buff2, sizeof( buff2) ) + !=NULL) + { + if(NPC_EventNewTRANS( meindex, talker, buff2,1) == FALSE) { + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + } +#ifdef _TRANS7_POINT + if(NPC_Util_GetStrFromStrWithDelim( buf, "TRANSNEWSEVEN", buff2, sizeof( buff2) ) + !=NULL) + { + if(NPC_EventNewTRANSSEVEN( meindex, talker, buff2,1) == FALSE) { + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + } +#endif +#endif + + // Robin add NPCȡﵰ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetEgg", buff2, sizeof( buff2) ) + !=NULL) + { + if(NPC_EventAddEgg( meindex, talker, buff2,1) == FALSE) { + print(" AddEgg_Error:%d ", __LINE__); + NPC_MsgDisp( meindex, talker, 10); + return FALSE; + } + } + + /*--ʧ ةë--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelItem", buff2, sizeof( buff2) ) != NULL){ + if(strstr(buff2,"EVDEL") != NULL){ + char work[256]; + char nbuf[256]; + + NPC_Util_GetStrFromStrWithDelim(buf, "EVENT", buff2, sizeof( buff2)); + getStringFromIndexWithDelim( buff2, ",", evcnt, work, sizeof( work)); + + if(strstr(buf,"Break")!=NULL){ + b_flg=1; + }else{ + b_flg=0; + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "NotDel", nbuf, sizeof( nbuf)) != NULL ){ + NPC_EventDelItemEVDEL( meindex, talker, work, nbuf,b_flg); + }else{ + NPC_EventDelItemEVDEL( meindex, talker, work, "-1",b_flg); + } + }else{ + if(strstr(buf,"Break")!=NULL){ + b_flg=1; + }else{ + b_flg=0; + } + NPC_EventDelItem( meindex, talker, buff2,b_flg); + } + } + + + /*--ë---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelStone", buff2, sizeof( buff2) ) + !=NULL) + { + int stone; + char token[128]; + + stone = NPC_EventGetCost( meindex, talker, buff2); + + CHAR_setInt(talker,CHAR_GOLD,CHAR_getInt( talker, CHAR_GOLD) - stone); + /*--ɷ¶˪Ի--*/ + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + sprintf( token, "%dstone", stone); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "AddFame", buff2, sizeof( buff2) ) + !=NULL) + { + int npcfame; + char token[128]; + + npcfame = atoi(buff2)*100; + if(CHAR_getInt(talker,CHAR_FAME)+npcfame>1000000) + { + CHAR_talkToCli( talker, -1, "!", CHAR_COLORRED); + } + else + { + CHAR_setInt(talker,CHAR_FAME,CHAR_getInt( talker, CHAR_FAME) + npcfame); + /*--ɷ¶˪Ի--*/ + sprintf( token, "%d", npcfame/100); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + } +#ifdef _EV_NUM + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelEvItem", buff2, sizeof( buff2) ) != NULL){ + char token[16]; + if(CHAR_getInt(talker,CHAR_EVITEM)>0){ + sprintf(token,"%d*1",CHAR_getInt(talker,CHAR_EVITEM)); + NPC_EventDelItem( meindex, talker, token,0); + } + } +#endif + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelFame", buff2, sizeof( buff2) ) + !=NULL) + { + int npcfame; + char token[128]; + + npcfame = atoi(buff2)*100; + + if(CHAR_getInt(talker,CHAR_FAME)3) return FALSE; + if(evflg==1){ + NPC_EventSetEvCode(meindex,talker); + }else if(evflg==2){ + int itemid,itemnum; + if(getStringFromIndexWithDelim(evcode,"|", 3, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + itemid=atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 4, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + itemnum=atoi(tmpbuf); + sprintf(tmpbuf,"%d*%d",itemid,itemnum); + NPC_EventDelItem(meindex,talker,tmpbuf,0); + NPC_EventSetEvCode(meindex,talker); + }else if(evflg==3){ + int petpicid,petminlv,petmaxlv,peti,petindex; + if(getStringFromIndexWithDelim(evcode,"|", 3, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petpicid=atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 5, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petminlv=atoi(tmpbuf); + if(getStringFromIndexWithDelim(evcode,"|", 6, tmpbuf, sizeof(tmpbuf)) == FALSE) + return FALSE; + petmaxlv=atoi(tmpbuf); + for(peti=0;peti=petminlv && CHAR_getInt(petindex,CHAR_LV)<=petmaxlv){ + if(NPC_EventDelPet( meindex, talker,peti) == FALSE) continue; + NPC_EventSetEvCode(meindex,talker); + }else{ + continue; + } + } + if(peti>=CHAR_MAXPETHAVE) return FALSE; + } + } + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "AddEvNum", buff2, sizeof( buff2) ) + !=NULL) + { + int evnum; + char token[128]; + evnum = atoi(buff2); + CHAR_setInt(talker,CHAR_EVNUM,CHAR_getInt( talker, CHAR_EVNUM) + evnum); + sprintf( token, "ܻ%dܻΪ%d", evnum,CHAR_getInt(talker,CHAR_EVNUM)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelEvNum", buff2, sizeof( buff2) ) + !=NULL) + { + int evnum; + char token[128]; + evnum = atoi(buff2); + CHAR_setInt(talker,CHAR_EVNUM,CHAR_getInt( talker, CHAR_EVNUM) - evnum); + sprintf( token, "ܻ%dܻΪ%d", evnum,CHAR_getInt(talker,CHAR_EVNUM)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetEvNum", buff2, sizeof( buff2) ) + !=NULL) + { + int evnum; + evnum = atoi(buff2); + CHAR_setInt(talker,CHAR_EVNUM,evnum); + CHAR_setInt(talker,CHAR_EVITEM,0); + CHAR_talkToCli( talker, -1, "ܻѾգ", CHAR_COLORWHITE); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetEvThings", buff2, sizeof( buff2) ) + !=NULL) + { + struct timeval evt; + int evflg = atoi(buff2); + if(evflg==0){ + CHAR_setInt(talker,CHAR_EVITEM,0); + }else{ + int evi,evj; + gettimeofday(&evt,NULL); + evi = RAND(0,1); + if(evi==0){ + CHAR_setInt(talker,CHAR_EVITEM,0); + }else{ + evi = RAND(32700,32714); + CHAR_setInt(talker,CHAR_EVITEM,evi); + } + } + } +#endif + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetVip", buff2, sizeof( buff2) ) + !=NULL) + { + int npcvip = atoi(buff2); + CHAR_setInt(talker,CHAR_VIPRIDE,npcvip); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetSuper", buff2, sizeof( buff2) ) + !=NULL) + { + int npcsuper = atoi(buff2); + CHAR_setInt(talker,CHAR_SUPER,npcsuper); + } + +#ifdef _ALL_ITEM + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetAllNum1", buff2, sizeof( buff2) ) + !=NULL) + { + sasql_allnum(1,atoi(buff2),1); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetAllNum2", buff2, sizeof( buff2) ) + !=NULL) + { + sasql_allnum(2,atoi(buff2),1); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetAllNum3", buff2, sizeof( buff2) ) + !=NULL) + { + sasql_allnum(3,atoi(buff2),1); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetAllNum4", buff2, sizeof( buff2) ) + !=NULL) + { + sasql_allnum(4,atoi(buff2),1); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "SetAllNum5", buff2, sizeof( buff2) ) + !=NULL) + { + sasql_allnum(5,atoi(buff2),1); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "AllNumMsg", buff2, sizeof( buff2) ) + !=NULL) + { + int allnumflag; + int fd = getfdFromCharaIndex( talker); + allnumflag = atoi(buff2); + char token[128]; + if(allnumflag == 1) + sprintf(token,"ĿǰѼĿΪ%d",sasql_allnum(allnumflag,0,0)); + else if(allnumflag == 2) + sprintf(token,"ĿǰѼĿΪ%d",sasql_allnum(allnumflag,0,0)); + else if(allnumflag == 3) + sprintf(token,"ĿǰѼĿΪ%d",sasql_allnum(allnumflag,0,0)); + else if(allnumflag == 4) + sprintf(token,"ĿǰѼĿΪ%d",sasql_allnum(allnumflag,0,0)); + else if(allnumflag == 5) + sprintf(token,"ĿǰѼĿΪ%d",sasql_allnum(allnumflag,0,0)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + token); + } +#endif + + /*--¼ĸةʧ ةëܰ---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetRandItem", buff2, sizeof( buff2) ) + !=NULL) + { + char buf3[32]; + j = 1; + while(getStringFromIndexWithDelim(buff2 , "," , j, buf3, sizeof( buf3)) + != FALSE ) + { + j++; + rand_j++; + } + NPC_RandItemGet( meindex, talker, rand_j, buff2); + } + + + /*--ʧ ةëܰ---*/ + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetItem", buff2, sizeof( buff2) ) + !=NULL) + { + NPC_EventAddItem( meindex, talker, buff2); + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "HeChengMsg", buff2, sizeof( buff2) ) + !=NULL) + { + int k; + int playernum = CHAR_getPlayerMaxNum(); + char hcmsg[256]; + sprintf(hcmsg,"ϳɴˡϲҡ%sɹϳ%s",CHAR_getChar(talker,CHAR_NAME),buff2); + for(k=0;ktimep) + { + CHAR_talkToCli( talker, -1, "洢ʱδ", CHAR_COLORRED ); + } + else + { + //int fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_setWorkInt(talker,CHAR_WORKSAVETIME,timep); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } + } + + /*--ɷ¶˪--*/ + CHAR_complianceParameter( talker ); + CHAR_send_P_StatusString( talker , + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_CHARM|CHAR_P_STRING_QUICK| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND|CHAR_P_STRING_EARTH + ); + + return TRUE; + +} + + +/*-------------------------- + * ìʸë + ---------------------------*/ +BOOL NPC_EventDelPet(int meindex,int talker, int petsel) +{ + + int petindex; + char szPet[128]; + int defpet; + char msgbuf[64]; + + int fd = getfdFromCharaIndex( talker ); + + petindex = CHAR_getCharPet( talker, petsel); + + if( !CHAR_CHECKINDEX(petindex) ) return FALSE; + + if( CHAR_getInt( talker, CHAR_RIDEPET) == petsel ) { + + //CHAR_talkToCli( talker, -1, "еij޷", CHAR_COLORYELLOW ); + //return FALSE; + + CHAR_setInt( talker, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_RIDEPET ); + CHAR_complianceParameter( talker ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( talker , CHAR_WORKOBJINDEX )); + print(" DelRidePet "); + } + print(" EventDelPet "); + + /*--ƽҷ» ئգʸëڱ --*/ + if( CHAR_getWorkInt( CONNECT_getCharaindex( fd), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return FALSE; + /*--ʸᆴ--*/ + defpet = CHAR_getInt( talker, CHAR_DEFAULTPET); + if(defpet == petsel){ + CHAR_setInt( talker, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + + snprintf( msgbuf,sizeof( msgbuf), "%s", + CHAR_getChar( petindex, CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORWHITE); + + // ʸë ׷ + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "EvnetDell(ɾ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + + /* */ + CHAR_setCharPet( talker, petsel, -1); + + CHAR_endCharOneArray( petindex ); + + snprintf( szPet, sizeof( szPet ), "K%d", petsel); + // ޥʸ ˪Ի + CHAR_sendStatusString( talker, szPet ); + + return TRUE; + +} + + +/*---------------------------- + * ʸëܰ + ------------------------------*/ +BOOL NPC_EventAddPet(int meindex, int talker, char *buff2,int mode) +{ + int ret; + char msgbuf[64]; + int enemynum; + int enemyid; + int i; + int petindex; + + /*--ʸ л¾--*/ + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) break; + } + + if(i == CHAR_MAXPETHAVE) return FALSE; + + + /* ¦ѼIDindexë */ + if(strstr(buff2,",") != NULL){ + char buf2[16]; + while(getStringFromIndexWithDelim( buff2, ",", i, buf2, sizeof( buf2)) + != FALSE) { + i++; + } + i--; + i = rand()%i + 1; + getStringFromIndexWithDelim( buff2, ",", i, buf2, sizeof( buf2)); + enemyid = atoi( buf2); + }else{ + enemyid = atoi( buff2); + } + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + + if( i == enemynum ) return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( talker, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE ) i = 0; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + } + + petindex = CHAR_getCharPet(talker,i); + + if( !CHAR_CHECKINDEX( petindex) )return FALSE; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( talker, msgbuf ); + + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf,sizeof( msgbuf), "õ%s", + CHAR_getChar(petindex,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORWHITE); + + // ʸë ľ׷ + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "EventGet(õ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + + + if(mode == 0) { + /*--ìüʸ--*/ + CHAR_setInt( petindex, CHAR_ENDEVENT, 1); + } + + return TRUE; + +} + +#ifdef _TRANS_7_NPC +BOOL NPC_EventNewTRANS(int meindex, int talker, char *buff2,int mode) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<160){ + sprintf( token, "תȼС160תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif +// NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + if(CHAR_getInt(talker,CHAR_SUPER)==1) + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+80); + else + { + if(CHAR_getInt(talker,CHAR_VIPRIDE)>0) + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+75); + else + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+70); + } + CHAR_Skillupsend( talker ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); + + CHAR_talkToCli( talker, -1, buff2, CHAR_COLORYELLOW ); +} +#ifdef _TRANS7_POINT +BOOL NPC_EventNewTRANSSEVEN(int meindex, int talker, char *buff2,int mode) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<160){ + sprintf( token, "תȼС160תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif +// NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_SKILLUPPOINT)+getTrans7Point()); + CHAR_Skillupsend( talker ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); + + CHAR_talkToCli( talker, -1, buff2, CHAR_COLORYELLOW ); +} +#endif +BOOL NPC_EventTRANS(int meindex, int talker, char *buff2,int mode) +{ + char token[128]; + int work[10]; + int Trans=CHAR_getInt(talker,CHAR_TRANSMIGRATION)+1; + if(Trans>7 || CHAR_getInt(talker,CHAR_LV)<80){ + sprintf( token, "תȼС80תʧ!", CHAR_getChar( talker, CHAR_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORYELLOW ); + return; + } +#ifdef _ADD_POOL_ITEM // WON ADD ӿɼķŵĵ + int tran_pool_item[5] = { 4, 4, 4, 4, 4 }; // ӵĵ߼ķ + int tran_pool_pet[5] = { 2, 2, 2, 2, 2}; // ӵijķ + int j,item_sum=0, pet_sum=0; + + for(j=0; j<5 ;j++){ + item_sum += tran_pool_item[j] ; + pet_sum += tran_pool_pet[j]; + } + + item_sum += 10; // ļĵ + pet_sum += 5; // ļij + +#endif + NPC_TransmigrationStatus(talker, talker, work); + NPC_TransmigrationFlg_CLS(talker, talker); + CHAR_setInt(talker ,CHAR_TRANSMIGRATION, Trans); + CHAR_setInt(talker, CHAR_LV ,1); + CHAR_setMaxExp( talker, 0); + CHAR_setInt( talker,CHAR_SKILLUPPOINT,CHAR_getInt( talker, CHAR_TRANSMIGRATION)*10); + CHAR_Skillupsend( talker ); + CHAR_setInt( talker,CHAR_RIDEPET, -1 ); + CHAR_setInt( talker , CHAR_BASEIMAGENUMBER , CHAR_getInt( talker , CHAR_BASEBASEIMAGENUMBER) ); + CHAR_sendStatusString( talker , "P"); + + CHAR_talkToCli( talker, -1, buff2, CHAR_COLORYELLOW ); +} +#endif + + +// Robin add NPCﵰ +BOOL NPC_EventAddEgg(int meindex, int talker, char *buff2,int mode) +{ + int ret; + char msgbuf[64]; + int enemynum; + int enemyid; + int petid; + int raise; + int i; + int petindex; + char buf2[32]; + char buf3[32]; + + print("\n !!:%s ", buff2); + + /*--ʸ л¾--*/ + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) break; + } + + if(i == CHAR_MAXPETHAVE) { + print(" AddEgg_Error:%d ", __LINE__); + return FALSE; + } + + + /* ¦ѼIDindexë */ + if(strstr(buff2,",") != NULL){ // ǷΪ + while(getStringFromIndexWithDelim( buff2, ",", i, buf2, sizeof( buf2)) + != FALSE) { + i++; + } + i--; + i = rand()%i + 1; + getStringFromIndexWithDelim( buff2, ",", i, buf2, sizeof( buf2)); + + }else{ + strcpy( buf2, buff2); + } + + getStringFromIndexWithDelim( buf2, ";", 1, buf3, sizeof( buf3)); + enemyid = atoi( buf3); // ﵰID + getStringFromIndexWithDelim( buf2, ";", 2, buf3, sizeof( buf3)); + petid = atoi( buf3); // ijID + getStringFromIndexWithDelim( buf2, ";", 3, buf3, sizeof( buf3)); + raise = atoi( buf3); // + + + // enemyidתenemybaseid + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + if( i == enemynum ) { + print(" AddEgg_Error:%d ", __LINE__); + return FALSE; + } + petid = ENEMY_getInt( i, ENEMY_TEMPNO); + + + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == enemyid) { + break; + } + } + if( i == enemynum ) { + print(" AddEgg_Error:%d ", __LINE__); + return FALSE; + } + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( talker, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE ) i = 0; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + } + + petindex = CHAR_getCharPet(talker,i); + + if( !CHAR_CHECKINDEX( petindex) ) { + print(" AddEgg_Error:%d ", __LINE__); + return FALSE; + } + + // Ϊﵰ + CHAR_setInt( petindex, CHAR_FUSIONBEIT, 1); + CHAR_setInt( petindex, CHAR_FUSIONCODE, -1); + CHAR_setInt( petindex, CHAR_FUSIONRAISE, raise); + CHAR_setInt( petindex, CHAR_FUSIONINDEX, petid); + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time( NULL)); + + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( talker, msgbuf ); + + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf,sizeof( msgbuf), "õ%s", + CHAR_getChar(petindex,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORWHITE); + + // ʸë ľ׷ + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "EventGetEgg(õ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + + + if(mode == 0) { + /*--ìüʸ--*/ + CHAR_setInt( petindex, CHAR_ENDEVENT, 1); + } + return TRUE; + +} + + +/*--------------------------- + * ì ë + -----------------------------**/ +BOOL NPC_EventDelItem(int meindex,int talker,char *buf,int breakflg) +{ + + int i = 1, j = 1, k = 1 ; + char buff3[128]; + char buf2[32]; + int itemindex; + char token[256]; + + while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) + !=FALSE ) + { + k++; + if(strstr(buff3,"*") != NULL) { + int itemno; + int kosuu; + int id; + int cnt=0; + + getStringFromIndexWithDelim( buff3, "*", 1, buf2, sizeof( buf2)); + itemno = atoi( buf2); + getStringFromIndexWithDelim( buff3, "*", 2, buf2, sizeof( buf2)); + kosuu = atoi( buf2); + + if( breakflg != 1 ) + NPC_ActionDoPileDelItem( talker, itemno, kosuu);//жѵĴ + else{ + for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex) ) { + id = ITEM_getInt( itemindex , ITEM_ID ); + if(itemno == id) { + cnt++; + LogItem( + CHAR_getChar( talker, CHAR_NAME ), // ƽҷ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), // ʧ ة į +#endif + "EventDelItem(ջصĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + + if(breakflg == 1){ + sprintf(token,"%s ",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + }else{ + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + //--ʧ ةëڽ-- + CHAR_setItemIndex( talker, i ,-1); + ITEM_endExistItemsOne(itemindex); + CHAR_sendItemDataOne( talker, i); + + if(cnt == kosuu){ + break; + } + } + } + } + } + } + else{ + /*--Ϸ įʧ ةë---*/ + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + + if( ITEM_CHECKINDEX( itemindex)){ + if( atoi( buff3) == ITEM_getInt( itemindex, ITEM_ID)) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventDelItem(ջصĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + if(breakflg == 1){ + sprintf(token,"%s ",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + }else{ + sprintf( token, "%s", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + /*--ʧ ةëڽ--*/ + CHAR_setItemIndex( talker, j ,-1); + ITEM_endExistItemsOne( itemindex); + /*--ɷ¶˪--*/ + CHAR_sendItemDataOne( talker, j); + } + } + } + } + } + + return TRUE; +} + +BOOL NPC_EventDelItemEVDEL(int meindex,int talker,char *buf,char *nbuf,int breakflg) +{ + + int k = 1, l = 1; + char buff3[128]; + char buf2[32]; + char buf4[32]; + + + + while(getStringFromIndexWithDelim(buf , "&" , k, buf4, sizeof(buf4)) !=FALSE ){ + int itemno; + k++; + if(strstr(buf4,"ITEM") == NULL) continue; + getStringFromIndexWithDelim(buf4 , "=" , 2, buff3, sizeof(buff3)); + + if(strstr(buff3,"*") != NULL) { + int kosuu; +#ifndef _ITEM_PILENUMS + char token[256]; + int i, itemindex, id, cnt; +#endif + getStringFromIndexWithDelim( buff3, "*", 1, buf2, sizeof( buf2)); + itemno = atoi( buf2); + getStringFromIndexWithDelim( buff3, "*", 2, buf2, sizeof( buf2)); + kosuu = atoi( buf2); + if(strstr(nbuf,"-1") == NULL){ + l = 1; + while(getStringFromIndexWithDelim(nbuf , "," , l, buf2, sizeof(buf2))){ + l++; + if(itemno == atoi( buf2)){ + l = -1; + break; + } + } + if(l == -1) continue; + } +#ifdef _ITEM_PILENUMS + NPC_ActionDoPileDelItem( talker, itemno, kosuu); +#else + cnt = 0; + for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex) ) { + id = ITEM_getInt( itemindex , ITEM_ID ); + if(itemno == id) { + cnt++; + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventDelItem(ջصĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + if(breakflg == 1){ + sprintf(token,"%s ",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + }else{ + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + CHAR_setItemIndex( talker, i ,-1); + ITEM_endExistItemsOne(itemindex); + CHAR_sendItemDataOne( talker, i); + if(cnt == kosuu){ + break; + } + } + } + } +#endif + }else{ +#ifndef _ITEM_PILENUMS + int j, itemindex; + char token[256]; +#endif + if(strstr(nbuf,"-1") == NULL){ + l = 1; + while(getStringFromIndexWithDelim(nbuf , "," , l, buf2, sizeof(buf2))){ + l++; + if(atoi(buff3) == atoi( buf2)){ + l = -1; + break; + } + } + if(l == -1) continue; + } + itemno = -1; +#ifdef _ITEM_PILENUMS + NPC_ActionDoPileDelItem( talker, itemno, itemno); +#else + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + if( ITEM_CHECKINDEX( itemindex)){ + if( atoi( buff3) == ITEM_getInt( itemindex, ITEM_ID)) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventDelItem(ջصĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + if(breakflg == 1){ + sprintf(token,"%s ",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + }else{ + sprintf( token, "%s", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + } + CHAR_setItemIndex( talker, j ,-1); + ITEM_endExistItemsOne( itemindex); + CHAR_sendItemDataOne( talker, j); + } + } + } +#endif + } + } + + return TRUE; +} + + +/*---------------------- + * ì ëܰ] + -----------------------*/ +BOOL NPC_EventAddItem(int meindex,int talker,char *buf) +{ + + char buff3[128]; + int i = 1; + int itemindex; + char buf3[32]; + int ret; + char token[256]; + + while(getStringFromIndexWithDelim(buf , "," , i, buff3, sizeof( buff3)) + != FALSE ) + { + i++; + if(strstr( buff3, "*") != NULL) { + + int itemno; + int kosuu; + int loop = 0; + + getStringFromIndexWithDelim( buff3, "*", 1, buf3,sizeof( buf3)); + itemno = atoi( buf3); + getStringFromIndexWithDelim( buff3, "*", 2, buf3,sizeof( buf3)); + kosuu = atoi( buf3); + + for(loop = 0 ; loop < kosuu ; loop++) { + itemindex = ITEM_makeItemAndRegist( itemno); + + if(itemindex == -1) return FALSE; + + /*ʧ ةܰ( ʧ ة ľ */ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print("npc_exchange:ACCEPTadditem error itemindex[%d]\n",itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventAddItem(õĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + sprintf( token, "õ%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + } + }else{ + itemindex = ITEM_makeItemAndRegist( atoi( buff3)); + + if(itemindex == -1) return FALSE; + + /*ʧ ةܰ( ʧ ة ľ */ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_exchange.c: ACCEPTadditem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventAddItem(õĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + sprintf(token,"õ%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + } + } + + return TRUE; +} + + +/*--------------------------------- + *ë ƻ¼ë + ------------- ---------------------*/ +int NPC_EventFile(int meindex,int talker,char *arg) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buf[1024*2]; + int i=1; + int EvNo=0; + int evch; + int q=1; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + + print("GetArgStrErr"); + return -1; + } + + /*ɬð̻ë*/ + while(getStringFromIndexWithDelim( argstr, "EventEnd", i, buf,sizeof( buf)) + != FALSE) + { + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 0); + i++; + /*--ìϼë--*/ + NPC_Util_GetStrFromStrWithDelim( buf, "EventNo", buff2,sizeof( buff2) ); + if(strstr(buff2,",") != NULL){ + char buf3[128]; + while(getStringFromIndexWithDelim( buff2, ",", q, buf3, sizeof( buf3)) + != FALSE) { + q++; + } + q--; + q = rand()%q + 1; + getStringFromIndexWithDelim( buff2, ",", q, buf3, sizeof( buf3)); + EvNo = atoi( buf3); + }else{ + EvNo = atoi( buff2); + } + + /*--׷ºë浤ƥì ƻݳ--*/ + if(NPC_EventCheckFlg( talker, EvNo) == TRUE) continue; + + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"Pet_Name", buff2,sizeof( buff2) ) + != NULL) + { + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, 1); + } + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"KeyWord", buff2,sizeof( buff2) ) + != NULL) + { + if(CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) != i ) continue; + } + + evch = NPC_ExChangeManEventCheck( meindex, talker, buf); + + if(evch != -1) { + /*--ì--*/ +// if(NPC_ExChangeManEventCheck( meindex, talker, buf) == TRUE) { + strcpysafe(arg, sizeof( buf) ,buf); + return evch; + } + } + + return -1; + +} + + +/*--------------------------------- + * ʧ ةͷë浤 + -----------------------------------*/ +BOOL NPC_EventReduce(int meindex,int talker,char *buf) +{ + + char buf2[512]; + char buf3[256]; + int id = 0; + int i; + int itemindex; + int itemno; + int kosuu; + int cnt = 0; + + getStringFromIndexWithDelim( buf, "=", 2, buf2, sizeof( buf2)); + getStringFromIndexWithDelim( buf2, "*", 1, buf3, sizeof( buf3)); + itemno = atoi( buf3); + getStringFromIndexWithDelim( buf2, "*", 2, buf3, sizeof( buf3)); + kosuu = atoi( buf3); + + for( i = 0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex) ){ + id = ITEM_getInt( itemindex ,ITEM_ID); + if(itemno == id){ + //change add ӶԶѵж + int pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + if( pilenum ) + cnt+=pilenum; + else + cnt++; + + if(cnt >= kosuu){ + return TRUE; + } + } + } + } + + return FALSE; + +} + +/*---------------------------------- + *ʸ嵩ƽë + ----------------------------------*/ +void NPC_EventPetSkill( int meindex, int talker, char *data) +{ + + int skill; + int pet; + int slot; + int cost; + int skillID = 0; + char buf[64]; + char argstr[1024]; + char msg[512]; + int petindex; + char msgbuf[128]; + int fd = getfdFromCharaIndex( talker ); + int evcnt; + + if( NPC_Util_CharDistance( talker, meindex ) > 2) { + return; + } + + evcnt = NPC_EventFile( meindex, talker, argstr); + + if(evcnt == -1) return; + + /*--ɬð̻ k ë ƻּë --*/ +// if(NPC_EventFile( meindex, talker, argstr) == FALSE) return ; + + /*ͷʧ߯Ȼ·--*/ + /* ëϷ־( į) ʸ( į) + ( į) */ + makeStringFromEscaped( data); + + /*--Ի--*/ + getStringFromIndexWithDelim( data, "|", 1, buf, sizeof( buf)); + skill = atoi( buf); + getStringFromIndexWithDelim( data, "|", 2, buf, sizeof( buf)); + pet = atoi( buf); + getStringFromIndexWithDelim( data, "|", 3, buf ,sizeof( buf)); + slot = atoi(buf); + getStringFromIndexWithDelim( data, "|", 4, buf, sizeof( buf)); + cost = atoi( buf); + + /*--ƽ ë--*/ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", + msg, sizeof( msg)) != NULL) + { + getStringFromIndexWithDelim( msg, ",", skill, buf ,sizeof( buf)); + skillID = atoi( buf); + } + slot--; + + + petindex = CHAR_getCharPet( talker, pet-1); + + if(petindex == -1){ + print("PetindexErr"); + return; + } + + /*--ƽҷ» ئգʸëڱ --*/ + if( CHAR_getWorkInt( CONNECT_getCharaindex( fd), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + + /*--ʸ ë--*/ + CHAR_setPetSkill( petindex, slot, skillID); + + /*--ëӼ--*/ + CHAR_setInt( talker, CHAR_GOLD, (CHAR_getInt( talker, CHAR_GOLD) - cost)); + + snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1); + + // ޥʸ ë˪Ի + CHAR_sendStatusString( talker, msgbuf ); + + CHAR_sendStatusString( talker, "P"); + +} + + +/*---------------------------------------- + * ʧ ةо +----------- ------------------------------*/ +BOOL NPC_ItemFullCheck(int meindex,int talker,char *buf,int mode,int evcnt) +{ + + char buff2[256]; + int i = 1,j = 1; + int maxitem = 0; + int kosuucnt = 0; + int itemindex; + char buf3[256]; + int rand_j = 0; + int rand_cnt = 0; + char nbuf[256]; + char buff6[16]; + int l = 1; + + if(NPC_Util_GetStrFromStrWithDelim( buf, "DelItem", buff2, sizeof( buff2) ) != NULL ){ + if(strstr(buff2,"EVDEL") != NULL){ + char buff4[64]; + char buff5[32]; + + i = 1; + NPC_Util_GetStrFromStrWithDelim( buf, "EVENT", buff2, sizeof( buff2)); + getStringFromIndexWithDelim(buff2, "," , evcnt, buf3, sizeof(buf3)); + + while(getStringFromIndexWithDelim(buf3, "&" , j, buff4, sizeof(buff4))){ + j++; + if(strstr(buff4,"ITEM") != NULL) { + if(strstr(buff4,"*") != NULL) { + int itemno; + + l = 1; + getStringFromIndexWithDelim(buff4, "=" , 2, buff5, sizeof(buff5)); + getStringFromIndexWithDelim(buff5, "*" , 1, buff6, sizeof(buff6)); + itemno = atoi(buff6); + + if(NPC_Util_GetStrFromStrWithDelim( buf, "NotDel", nbuf, sizeof( nbuf)) !=NULL){ + while(getStringFromIndexWithDelim(nbuf , "," , l,buff6, sizeof(buff6))) + { + l++; + if(itemno == atoi( buff6)) + { + l = -1; + break; + } + } + } + if(l == -1) continue; + getStringFromIndexWithDelim(buff5, "*" , 2, buff6, sizeof(buff6)); + maxitem -= atoi( buff6); + }else{ + getStringFromIndexWithDelim(buff4, "=" , 2, buff5, sizeof(buff5)); + l = 1; + + if(NPC_Util_GetStrFromStrWithDelim( buf, "NotDel", nbuf, sizeof( nbuf)) + !=NULL){ + while(getStringFromIndexWithDelim(nbuf , "," , l,buff6, sizeof(buff6))) { + l++; + if(atoi(buff5) == atoi( buff6)){ + l = -1; + break; + } + } + } + if(l == -1) continue; + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex)) { + if(atoi( buff5) == ITEM_getInt( itemindex, ITEM_ID)) { + maxitem--; + } + } + } + } + } + } + }else{ + char buff3[128]; + i = 1; + while(getStringFromIndexWithDelim(buff2, "," , i, buff3, sizeof(buff3)) !=FALSE ){ + i++; + if(strstr( buff3, "*") != NULL){ + getStringFromIndexWithDelim( buff3, "*", 2, buf3, sizeof( buf3)); + maxitem -= atoi( buf3); + }else{ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX( itemindex)) { + if(atoi( buff3) == ITEM_getInt( itemindex, ITEM_ID)) { + maxitem--; + } + } + } + } + } + + } + } + + if(NPC_Util_GetStrFromStrWithDelim( buf, "GetRandItem", buff2, sizeof( buff2) ) !=NULL && mode == 0){ + j = 1; + while(getStringFromIndexWithDelim(buff2 , "," , j, buf3, sizeof( buf3)) !=FALSE ){ + j++; + rand_j++; + } + rand_cnt = 1; + for( i = CHAR_STARTITEMARRAY ; i tm_year; + mon=1+p->tm_mon; + date=p->tm_mday; + day=p->tm_wday; + hour=p->tm_hour; + min=p->tm_min; + sec=p->tm_sec; +} + +#ifdef _EV_NUM +BOOL NPC_EventSetEvCode(int meindex,int talker) +{ + int evcodeflg,npcno,evtmp; + char tmpbuf[256]; + char *evbuf=NULL; + npcno=RAND(1,50); + evtmp = RAND(1,100); + if(evtmp<=60){ + evcodeflg=1; + }else if(evtmp>60 && evtmp<=80){ + evcodeflg=2; + }else{ + evcodeflg=3; + } + if(evcodeflg==1){ + sprintf(tmpbuf,"%d|%d",npcno,evcodeflg); + CHAR_setChar(talker,CHAR_EVCODE,tmpbuf); + }else if(evcodeflg==2){ + evbuf=sasql_ev_item(); + if(strcmp(evbuf,"err")==0){ + return FALSE; + }else{ + sprintf(tmpbuf,"%d|%d|%s",npcno,evcodeflg,evbuf); + CHAR_setChar(talker,CHAR_EVCODE,tmpbuf); + } + }else if(evcodeflg==3){ + evbuf=sasql_ev_pet(); + if(strcmp(evbuf,"err")==0){ + return FALSE; + }else{ + sprintf(tmpbuf,"%d|%d|%s",npcno,evcodeflg,evbuf); + CHAR_setChar(talker,CHAR_EVCODE,tmpbuf); + } + } + return TRUE; +} +#endif diff --git a/npc/npc_familyman.c b/npc/npc_familyman.c new file mode 100644 index 0000000..b00c4d4 --- /dev/null +++ b/npc/npc_familyman.c @@ -0,0 +1,687 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_familyman.h" +#include "family.h" + +extern int familyNumTotal; +extern char familyListBuf[MAXFAMILYLIST]; + +char sendbuf[1024]; +char buf[1024]; +char subbuf[128]; +int i, j; + +/* + * ɬýľūëNPC + * ƽʧìҡئľ¾֣ + * + */ + +struct { + int windowno; + int windowtype; + int buttontype; + int takeitem; + int giveitem; + char message[4096]; +}w; + +struct { + BOOL use; + int checkhaveitem; + int checkhaveitemgotowin; + int checkdonthaveitem; + int checkdonthaveitemgotowin; + int warp; + int battle; + int gotowin; +}buttonproc[13]; /* ok,cancel, yes,no,prev,next ݼ */ + + + + + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; +static void NPC_Familyman_selectWindow( int meindex, int toindex, int num); +static BOOL NPC_Familyman_readData( int meindex, int windowno, BOOL chkflg); +static int NPC_Familyman_restoreButtontype( char *data ); + +/********************************* +* +*********************************/ +BOOL NPC_FamilymanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + //int i; + //char secondToken[1024]; + + // Robin test + // print(" familyman_Init "); + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf)) + == NULL ) + { + print( "familyman:ûָ趨ĵ \n"); + return FALSE; + } + /* ݱɬ÷ëƻ֧ */ + if( !NPC_Familyman_readData( meindex, -1, TRUE) ) { + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); + + return TRUE; +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_FamilymanTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + NPC_Familyman_selectWindow( meindex, talkerindex, 1 ); + +} +/********************************* +* έľݼ +*********************************/ +void NPC_FamilymanLooked( int meindex , int lookedindex) +{ + + print(" Look:me:%d,looked:%d ",meindex,lookedindex); + NPC_Familyman_selectWindow( meindex, lookedindex,1 ); + +} + +static void NPC_Familyman_selectWindow( int meindex, int toindex, int num) +{ + + int fd; + char buf[256]; + + /* 帲ƻ ɱ */ + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + /* */ + if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; + + if( !NPC_Familyman_readData( meindex, num, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + + fd = getfdFromCharaIndex( toindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + + } +} + +void NPC_FamilymanWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) + +{ + + int button = -1; + char buf[256]; + + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + // CoolFish Add For Check Old Leader Del Family + if(seqno == CHAR_WINDOWTYPE_FAMILYMAN_OUT) + { + int fd = getfdFromCharaIndex( talkerindex); + if(select == WINDOW_BUTTONTYPE_YES) + FAMILY_Leave( fd, talkerindex, "E|1"); + return; + } + // CoolFish End + + /* ū įë */ + if( !NPC_Familyman_readData( meindex, seqno - 100, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + /* ʾëƩ */ + if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { + button = atoi( data)+5; + if( button > 12 ) { + print( "familyman:invalid button[%d]\n", button); + return; + } + } + else if( select & WINDOW_BUTTONTYPE_OK) button = 0; + else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; + else if( select & WINDOW_BUTTONTYPE_YES) button = 2; + else if( select & WINDOW_BUTTONTYPE_NO) button = 3; + else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; + else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; + else { + print( "familyman:invalid button[%d]\n", select); + return; + } + if( buttonproc[button].use == TRUE ) { + int fd; + int newwin = -1; + + fd = getfdFromCharaIndex( talkerindex); + + /* ʾ巽Ȼ ëԻ */ + if( newwin == -1 ) { + newwin = buttonproc[button].gotowin; + } + + // Robin + // + if( newwin == 5 ) { + if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) > 0 ) + { + //CHAR_talkToCli( talkerindex, -1, "ʸ񲻷Ѿ塣", CHAR_COLORWHITE ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\nܱǸรѾˣ", buf, sizeof(buf))); + return; + } + if( (CHAR_getInt( talkerindex, CHAR_TRANSMIGRATION ) == 0) + && (CHAR_getInt( talkerindex, CHAR_LV) < 30) ) + { + //CHAR_talkToCli( talkerindex, -1, "ܱǸȼ㡣", CHAR_COLORWHITE ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\nܱǸรĵȼ㣡", buf, sizeof(buf))); + return; + } + + if( !NPC_EventCheckFlg( talkerindex, 4 ) ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\nܱǸรɳУ", buf, sizeof(buf))); + return; + } +#ifdef _NEWFM_GOLD + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < getNewFmGold() ) + { + char newfmmsg[256]; + sprintf(newfmmsg,"\nܱǸรѲ㣡\nҪѣ%dʯ\n\nУӣ𱬣ʹãҪ⣬ϣҲҪü壬лл",getNewFmGold()); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + newfmmsg); + return; + } +#else + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < 10000 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\nܱǸรѲ㣡\nҪѣ10000ʯ\n", buf, sizeof(buf))); + return; + } +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_FAMILYADD, WINDOW_BUTTONTYPE_NONE, CHAR_WINDOWTYPE_FAMILYMAN_ADD, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), "Hello!!" ); + + return; + } + // б , + if( newwin == 6 ) + { + /* + strcpy( buf, ""); + j = 0; + for( i=1 ; i<=8 ; i++ ) { + if( i > familyNumTotal ) break; + if( getStringFromIndexWithDelim( familyListBuf, "|", i, subbuf, + sizeof(subbuf) ) == FALSE) break; + strcat( buf, "|" ); + strcat( buf, subbuf ); + j++; + } + + sprintf( sendbuf, "S|F|%d|%d|%d%s", familyNumTotal, 1, j, buf ); + //print(" FL:%s ", sendbuf ); + lssproto_FM_send( fd, sendbuf ); + */ + + //saacproto_ACShowFMList_send( acfd ); + + FAMILY_Detail( fd, talkerindex, "S|F|1|0" ); + return; + + } + // ˳ + if( newwin == 7 ) + { + if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) == -1 ) { + // CHAR_talkToCli( talkerindex, -1, "㻹δκμѽ", CHAR_COLORWHITE ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\nܱǸร㻹ûмκμѽ", buf, sizeof(buf))); + return; + } + + //if (CHAR_getInt(talkerindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) { + // CHAR_talkToCli( talkerindex, -1, "峤....", CHAR_COLORWHITE ); + // return; + //} + + print(" WN2FM "); + + // CoolFish Change for old leader del family check + if(CHAR_getInt(talkerindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) + { + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, CHAR_WINDOWTYPE_FAMILYMAN_OUT, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + makeEscapeString("\n峤...\n\nɢ˾޷پȻࡣ\n\nȷҪɢ",buf, sizeof(buf))); + return; + } + else + FAMILY_Leave( fd, talkerindex, "E|1"); + // CoolFish Change End + + return; + } + + if( !NPC_Familyman_readData( meindex, newwin, FALSE) ) { + print( "familyman:readdata error\n"); + return; + } + //fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } + + + + } +} +/* + * ɬð̻ë ƥ϶ýľwindownoë + * + * ¦ѡ + * meindex int NPCcharaindex + * windowno int ū į + * + */ +static BOOL NPC_Familyman_readData( int meindex, int windowno, BOOL chkflg) +{ + + int i; + int linenum = 0; + int endflg = FALSE; + int buttonendflg; + int winno = -1; + int buttonconfmode; + int b_mode; + int selectnum ; + int messagepos; + BOOL errflg = FALSE; + BOOL readflg = TRUE; + FILE *fp; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char filename[64]; + char opfile[128]; + char line[1024]; + char firstToken[1024]; + char secondToken[1024]; + + /* ūɬë Ի հ */ + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + /* ɬð̻ */ + NPC_Util_GetStrFromStrWithDelim( argstr, "conff", filename, sizeof( filename)); + + sprintf( opfile, "%s/", getNpcdir( ) ); + strcat( opfile, filename); + + fp = fopen( opfile, "r"); + if( fp == NULL ) { + print( "familyman:file open error [%s]\n", opfile); + return FALSE; + } + + while( readflg == TRUE ) { + endflg = FALSE; + buttonendflg = TRUE; + buttonconfmode = FALSE; + selectnum = 0; + messagepos = 0; + winno = -1; + b_mode = -1; + errflg = FALSE; + + /* */ + w.windowno = -1; + w.windowtype = -1; + w.buttontype = -1; + w.takeitem = -1; + w.giveitem = -1; + w.message[0] = '\0'; + + for( i = 0; i < arraysizeof( buttonproc); i ++ ) { + buttonproc[i].use = FALSE; + buttonproc[i].checkhaveitem = -1; + buttonproc[i].checkhaveitemgotowin = -1; + buttonproc[i].checkdonthaveitem = -1; + buttonproc[i].checkdonthaveitemgotowin = -1; + buttonproc[i].warp = -1; + buttonproc[i].battle = -1; + buttonproc[i].gotowin = -1; + } + + while( 1) { + char buf[256]; + int ret; + if( !fgets( line, sizeof( line), fp)){ + readflg = FALSE; + break; + } + + linenum ++; + + /* 춪 */ + if( line[0] == '#' || line[0] == '\n') continue; + /* ݱ */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) strcpy( line, buf); + + /* delim "=" ƥ (1)ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, + sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + /* delim "=" ƥ2 ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 2, secondToken, + sizeof( secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + + if( strcasecmp( firstToken, "winno") == 0 ) { + if( winno != -1 ) { + print( "familyman:winnoȴ¶winno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + readflg = FALSE; + break; + } + /* ūNoë */ + winno = atoi( secondToken); + continue; + } + /* ūNo Ȼئݼ淴 */ + if( winno == -1 ) { + print( "familyman:winno δ壬ȴ趨\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = FALSE; + break; + } + /* ūNo ݷë + * ľ½ */ + if( (chkflg == FALSE && winno == windowno )|| + chkflg == TRUE) + { + if( buttonconfmode == TRUE ) { + if( strcasecmp( firstToken, "gotowin") == 0 ) { + buttonproc[b_mode].gotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkhaveitem") == 0 ) { + buttonproc[b_mode].checkhaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "haveitemgotowin") == 0 ) { + buttonproc[b_mode].checkhaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkdonthaveitem") == 0 ) { + buttonproc[b_mode].checkdonthaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "donthaveitemgotowin") == 0 ) { + buttonproc[b_mode].checkdonthaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "endbutton") == 0 ) { + if( buttonproc[b_mode].gotowin == - 1 ) { + if( buttonproc[b_mode].checkhaveitem == -1 && + buttonproc[b_mode].checkdonthaveitem == -1) + { + errflg = TRUE; + } + else { + /* оȵƥɬýľľ */ + if( !((buttonproc[b_mode].checkhaveitem != -1 && + buttonproc[b_mode].checkhaveitemgotowin != -1) + || (buttonproc[b_mode].checkdonthaveitem != -1 && + buttonproc[b_mode].checkdonthaveitemgotowin != -1))) + { + errflg = TRUE; + } + } + } + + if( errflg == TRUE) { + print( "familyman: Ҳgotowin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = TRUE; + break; + } + buttonproc[b_mode].use = TRUE; + buttonconfmode = FALSE; + buttonendflg = TRUE; + } + } + else { + + w.windowno = winno; + /* ūɬ */ + if( strcasecmp( firstToken, "wintype") == 0 ) { + w.windowtype = atoi( secondToken); + } + /* ʾɬ */ + else if( strcasecmp( firstToken, "buttontype") == 0 ) { + w.buttontype = NPC_Familyman_restoreButtontype( secondToken); + } + /* getitemɬ */ + else if( strcasecmp( firstToken, "takeitem") == 0 ) { + w.takeitem = atoi( secondToken); + } + /* giveitemɬ */ + else if( strcasecmp( firstToken, "giveitem") == 0 ) { + w.giveitem = atoi( secondToken); + } + /* messageɬ */ + else if( strcasecmp( firstToken, "message") == 0 ) { + if( messagepos == 0 ) { + strcpy( w.message, secondToken); + messagepos = strlen( w.message); + } + else { + w.message[messagepos]='\n'; + messagepos++; + strcpy( &w.message[messagepos], secondToken); + messagepos+=strlen(secondToken); + } + } + /* ʾëݼɬ */ + else if( strcasecmp( firstToken, "okpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 0; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "cancelpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 1; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "yespressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 2; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nopressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 3; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "prevpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 4; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nextpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 5; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "selected") == 0 ) { + buttonconfmode = TRUE; + b_mode = 6 + selectnum; + buttonendflg = FALSE; + selectnum ++; + } + /* ɬñδԻ */ + else if( strcasecmp( firstToken, "endwin") == 0 ) { + endflg = TRUE; + if( chkflg == FALSE) { + readflg = FALSE; + } + break; + } + else { + print( "familyman:趨DzܵIJ\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + } + } + } + else { + if( strcasecmp( firstToken, "endwin") == 0 ) { + winno = -1; + } + } + } + if( buttonendflg == FALSE) { + print( "familyman: Ҳendbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( winno != -1 ) { + if( w.windowtype == -1 ) { + print( "familyman: Ҳwintype\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( w.buttontype == -1 ) { + print( "familyman: Ҳbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( strlen( w.message) == 0 ) { + print( "familyman: Ҳmessage\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + } + } + fclose( fp); + + if( chkflg == FALSE && w.windowno == -1 ) { + print( "familyman: Ҳָwindowno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( winno != -1 && endflg == FALSE) { + print( "familyman: Ҳendwin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( errflg == TRUE) return FALSE; + + return TRUE; +} +/* + * buttontype=ƥ϶ ٯ ëѰ £ + * + */ +static int NPC_Familyman_restoreButtontype( char *data ) +{ + int ret = 0; + int rc; + int i; + char buff[1024]; + + for( i = 1; ; i ++ ) { + rc = getStringFromIndexWithDelim( data, "|", i, buff, + sizeof( buff ) ); + if( rc == FALSE) break; + if( strcasecmp( buff, "ok") == 0 ) { + ret |= WINDOW_BUTTONTYPE_OK; + } + else if( strcasecmp( buff, "cancel") == 0 ) { + ret |= WINDOW_BUTTONTYPE_CANCEL; + } + else if( strcasecmp( buff, "yes") == 0 ) { + ret |= WINDOW_BUTTONTYPE_YES; + } + else if( strcasecmp( buff, "no") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NO; + } + else if( strcasecmp( buff, "prev") == 0 ) { + ret |= WINDOW_BUTTONTYPE_PREV; + } + else if( strcasecmp( buff, "next") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NEXT; + } + } + if( ret == 0 ) { + ret = atoi( data); + } + return ret; +} + + diff --git a/npc/npc_fmchallenge.c b/npc/npc_fmchallenge.c new file mode 100644 index 0000000..bfc7c2d --- /dev/null +++ b/npc/npc_fmchallenge.c @@ -0,0 +1,738 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "handletime.h" +#include "npc_fmchallenge.h" +#include "family.h" + +// ȫļ pk +enum { + NPC_WORK_ID = CHAR_NPCWORKINT1, // ǼԱ ID, 0 ʼ +}; + +enum { + CHAR_WORK_PAGE = CHAR_WORKSHOPRELEVANT, // ҳ + CHAR_WORK_DUELTIME = CHAR_WORKSHOPRELEVANTSEC, // ѡ pk ʱ +}; + +#define SCHEDULEFILEDIR "./Schedule/" + +void NPC_LoadPKSchedule(int meindex); // Load schedule from disk +void NPC_SavePKSchedule(int meindex); // save schedule to disk +// ų̱ data +void NPC_LIST_gendata(int meindex, int talkerindex, int page, char *buf, int size); +// ѡ data +void NPC_SELECT_gendata(int meindex, int page, char *buf, int size); +// ųϸ data +void NPC_DETAIL_gendata(int meindex, char *buf, int size, int dueltime); + +BOOL NPC_SchedulemanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int meid; + int interval; + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEFMSCHEDULEMAN ); + CHAR_setWorkInt ( meindex, NPC_WORK_PREVIOUSCHECKTIME, -1); + + // + NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)); + meid = NPC_Util_GetNumFromStrWithDelim(argstr, "id" ); + if ((meid<0) || (meid>=MAX_SCHEDULEMAN)) { + print("SCHEDULEMAN init error: invalid ID(%d)\n",meid); + meid=0; + } + CHAR_setWorkInt(meindex, NPC_WORK_ID, meid); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "loopinterval" ); + if ((interval<100) || (interval>10000)) interval=1000; + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "challengetimeout"); + if ((interval<60) || (interval>60*60)) interval=20*60; + CHAR_setWorkInt(meindex, NPC_WORK_CHALLENGETIMEOUT, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "settingtimeout"); + if ((interval<10) || (interval>60*60)) interval=60; + CHAR_setWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "fightinterval"); + if ((interval<5) || (interval>60)) interval = 50; + CHAR_setWorkInt(meindex, NPC_WORK_FIGHTINTERVAL, interval); + + NPC_LoadPKSchedule(meindex); + + return TRUE; +} + +void NPC_SchedulemanTalked(int meindex, int talkerindex, char *msg, int color) +{ +// CHAR_talkToCli(talkerindex, meindex, "ãǼУ˵ǼԱ", color); + char buf[4096]; + int fd; + + if (NPC_Util_CharDistance(meindex, talkerindex) > 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, 0); + NPC_LIST_gendata(meindex, talkerindex, 0, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); +} + +void NPC_SchedulemanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int page; + int buttontype; + char buf[4096],token[256]; + int fd,i,dt,a; + int fmpks_pos; + + if (NPC_Util_CharDistance(meindex,talkerindex) > 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + +// print("seqno=%d select=%d data=%s\n", seqno,select,data); + + switch (seqno) { + case CHAR_WINDOWTYPE_SCHEDULEMAN_START: + switch (select) { + case WINDOW_BUTTONTYPE_NEXT: + case WINDOW_BUTTONTYPE_PREV: + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE) + + MAXSCHEDULEINONEWINDOW + * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; + if (page<0) { + page=0; + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; + } + if (page>MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW) { + page=MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW; + buttontype=WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; + } + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, page); + // Send WN + NPC_LIST_gendata(meindex, talkerindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case WINDOW_BUTTONTYPE_OK: + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)) { + // ֻѳ峤ʹýһĹ (趨ġͬ) + + // decide: send family list or detail or accept + dt=atoi(data); + for (i=0; iMAXFAMILYINONEWINDOW) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULESELECTFAMILY, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + break; + case FMPKS_FLAG_CHALLENGE: + { // 峤Ͷͬ pk˹ + int tkfmindex=CHAR_getInt(talkerindex, CHAR_FMINDEX); + if (tkfmindex==fmpks[fmpks_pos+i].host_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SETTING; + fmpks[fmpks_pos+i].setting_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT); + // ͳϸб + CHAR_setWorkInt(talkerindex, CHAR_WORK_DUELTIME, dt); + NPC_DETAIL_gendata(meindex, buf, sizeof(buf), dt); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULEDETAIL, + WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_DETAIL, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } else if (tkfmindex==fmpks[fmpks_pos+i].guest_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SCHEDULED; + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_OK; + if (page<0) { + page=0; + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_OK; + } + if (page>MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW) { + page=MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW; + buttontype=WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_OK; + } + CHAR_talkToCli(talkerindex, meindex, + "ļѾս", CHAR_COLORWHITE); + // ͳ list + NPC_LIST_gendata(meindex, talkerindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + break; + case FMPKS_FLAG_SETTING: + { // 峤 + int tkfmindex=CHAR_getInt(talkerindex, CHAR_FMINDEX); + if (tkfmindex==fmpks[fmpks_pos+i].host_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SETTING; + fmpks[fmpks_pos+i].setting_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT); + // ͳϸб + CHAR_setWorkInt(talkerindex, CHAR_WORK_DUELTIME, dt); + NPC_DETAIL_gendata(meindex, buf, sizeof(buf), dt); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULEDETAIL, + WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_DETAIL, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + } + break; + } + } + NPC_SavePKSchedule(meindex); + } else { + + if (CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)!=FMMEMBER_LEADER) { + CHAR_talkToCli(talkerindex, meindex, + "ֻ峤ԤԼУม", CHAR_COLORWHITE); + } else if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)!=1) { + CHAR_talkToCli(talkerindex, meindex, + "ļ廹ûʽม", CHAR_COLORWHITE); + } + } + + break; + } + break; + case CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT: + switch (select) { + case WINDOW_BUTTONTYPE_PREV: + case WINDOW_BUTTONTYPE_NEXT: + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE) + + MAXFAMILYINONEWINDOW + * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV; + if (page<1) { + page=1; + buttontype=WINDOW_BUTTONTYPE_NEXT; + } + if (page>familyNumTotal-MAXFAMILYINONEWINDOW+1) { + page=familyNumTotal-MAXFAMILYINONEWINDOW+1; + buttontype=WINDOW_BUTTONTYPE_PREV; + } + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, page); + // Send WN + NPC_SELECT_gendata(meindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULESELECTFAMILY, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case WINDOW_BUTTONTYPE_OK: +#ifdef _FMVER21 + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && +#else + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) && +#endif + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)) { + dt=CHAR_getWorkInt(talkerindex, CHAR_WORK_DUELTIME); + for (i=0; i0) && (a<=40)) fmpks[fmpks_pos+i].prepare_time=a; + } + // + if (getStringFromIndexWithDelim(data,"|",5,token,sizeof(token))) { + a=atoi(token); +#ifdef _FMWAR_PLAYERNUM + if ((a>0) && (a<=getFmWarPlayerNum())) fmpks[fmpks_pos+i].max_player=a; +#else + if ((a>0) && (a<=50)) fmpks[fmpks_pos+i].max_player=a; +#endif + } + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_CHALLENGE; + fmpks[fmpks_pos+i].challenge_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_CHALLENGETIMEOUT); + CHAR_talkToCli(talkerindex, meindex, + "ս趨ɡ", CHAR_COLORWHITE); + } + break; + case WINDOW_BUTTONTYPE_CANCEL: + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_NONE; + CHAR_talkToCli(talkerindex, meindex, + "ս", CHAR_COLORWHITE); + break; + } + NPC_SavePKSchedule(meindex); + } + } + } + } + break; + } +} + +void NPC_SchedulemanLoop(int meindex) +{ +// int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + +/* + print("Scheduleman: fmpks_pos=%d dueltime=%d host=%s guest=%s\n", + fmpks_pos, fmpks[fmpks_pos].dueltime, fmpks[fmpks_pos].host_name, fmpks[fmpks_pos].guest_name); +*/ + + NPC_RemoveExpiredBattle(meindex); + NPC_ProcessTimeout(meindex); +} + +// Ƴڵս +void NPC_RemoveExpiredBattle(int meindex) +{ + struct tm tm1; + int keeptime; + int i,expired=-1; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + int prevckt = CHAR_getWorkInt(meindex, NPC_WORK_PREVIOUSCHECKTIME); + int fin = CHAR_getWorkInt(meindex, NPC_WORK_FIGHTINTERVAL); + int h,d; + + // Ŀǰʱ̵׼ȥƳڵų + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); +/* + if (tm1.tm_hour==0) + keeptime=0; + else + keeptime=(tm1.tm_hour-1)*100 + tm1.tm_min; +*/ + if (tm1.tm_min=0) { + // ƶųȡѾʧЧų + for (i=expired+1; i=60 ) h=h+100-60; + if (h>=2400) { + h = h-2400; + d = 10000; + } + fmpks[fmpks_pos+i].dueltime=d+h; + } + } +} + +// timeout +void NPC_ProcessTimeout(int meindex) +{ + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + + for (i=0; i=0) { + fmpks[fmpks_pos+i].challenge_timeout--; + if (fmpks[fmpks_pos+i].challenge_timeout<0) { + fmpks[fmpks_pos+i].host_index = -1; + strcpy(fmpks[fmpks_pos+i].host_name, "-1"); + fmpks[fmpks_pos+i].guest_index = -1; + strcpy(fmpks[fmpks_pos+i].guest_name, "-1"); + fmpks[fmpks_pos+i].prepare_time = -1; + fmpks[fmpks_pos+i].max_player = -1; + fmpks[fmpks_pos+i].flag=-1; + } + } + } + if (fmpks[fmpks_pos+i].flag==FMPKS_FLAG_SETTING) { + if (fmpks[fmpks_pos+i].setting_timeout>=0) { + fmpks[fmpks_pos+i].setting_timeout--; + if (fmpks[fmpks_pos+i].setting_timeout<0) { + fmpks[fmpks_pos+i].host_index = -1; + strcpy(fmpks[fmpks_pos+i].host_name, "-1"); + fmpks[fmpks_pos+i].guest_index = -1; + strcpy(fmpks[fmpks_pos+i].guest_name, "-1"); + fmpks[fmpks_pos+i].prepare_time = -1; + fmpks[fmpks_pos+i].max_player = -1; + fmpks[fmpks_pos+i].flag=-1; + } + } + } + } +} + +// , һֻܰһս +BOOL NPC_AlreadyScheduled(int meindex, int talkerindex) +{ + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + int tkfmindex = CHAR_getInt(talkerindex, CHAR_FMINDEX); + int flag=1; + + for (i=0; i=FMPKS_FLAG_SCHEDULED) { + if (fmpks[fmpks_pos+i].host_index==tkfmindex) return TRUE; + } else if (fmpks[fmpks_pos+i].flag!=FMPKS_FLAG_NONE) { + if (flag==1) flag=0; else return TRUE; + } + } + return FALSE; +} + +// ȡ schedule +void NPC_LoadPKSchedule(int meindex) +{ + char filename[256],tmp[4096],token[256]; + FILE *f; + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + + snprintf(filename,sizeof(filename), "%s%d_%d_%d", + SCHEDULEFILEDIR, CHAR_getInt(meindex, CHAR_FLOOR), + CHAR_getInt(meindex, CHAR_X), + CHAR_getInt(meindex, CHAR_Y) ); + + if( ! (f=fopen( filename, "r" )) ){ // create new schedule file + f = fopen( filename, "w" ); + if( !f ){ + print( "ERROR:Can't create Schedule file %s!\n",filename ); + return; + } + for (i=0; i=MAX_SCHEDULE)) return; + + // ¼Ŀǰʱ + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + sprintf(buf, "%d|", tm1.tm_hour*100 + tm1.tm_min); + + for (i=page; i +#include +#include "char.h" +#include "object.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npcutil.h" +#include "handletime.h" +#include "npc_fmdengon.h" +#include "family.h" +#include "npc_scheduleman.h" + +#define DENGONFILELINENUM 35 // ϱ +#define FMSDENGONFILELINENUM 140 // ԰ϱ +#define DENGONFILEENTRYSIZE 128 // ĴС +#ifdef _NEW_MANOR_LAW +#define MESSAGEINONEWINDOW 10 // ÿҳʾı +#else +#define MESSAGEINONEWINDOW 7 // ÿҳʾı +#endif +#define FMMAXNUM 1000 // ֵ +#define FM_MEMBERLIST 2 // Աб (ܱİ) +#define FM_MEMBERMEMO 3 // (ܱİ) +#define FM_FMMEMO 4 // ֮԰ (ܱİ) +#define FM_FMPOINT 5 // ݵ (ܱİ) +#define FM_FMDPTOP 6 // ǿ߱ (ܱİ) +#ifdef _FM_FMPOINTPK_LIST +#define FM_FMPOINTPK 7 // ׯ԰սʱ (ܱİ) +#endif +#define FM_WAITTIME (3*60) +#define FMSDENGON_SN 10000 // ֮԰ʶ + +extern struct FMMEMBER_LIST memberlist[FMMAXNUM]; // AC Աбϵ ARRAY +extern struct FMS_MEMO fmsmemo; // ֮԰ +extern struct FM_POINTLIST fmpointlist; // ݵ +extern struct FMS_DPTOP fmdptop; // ǿ߱ +extern int leaderdengonindex; // 777 幫 index +char NPC_sendbuf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW]; // һҳĴС +char enlistbuf[4096]; // Աļ BUF(ʾõ) + +unsigned long READTIME1 = 0, + READTIME2 = 0, + READTIME3 = 0, + READTIME4 = 0; + +#ifdef _FIX_FM_FMPOINT +void ApplyFamilyPoint( int meindex, int toindex, int select); +#endif + +// ijʼ(when gmsv start) +BOOL NPC_FmDengonInit( int meindex) +{ + int i; + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEDENGON); + + if( CHAR_getInt(meindex, CHAR_FLOOR) == 777 ){ + leaderdengonindex = meindex; + } + + if( READTIME1 == 0 || READTIME2 == 0 || READTIME3 == 0 || READTIME4 == 0 ){ + READTIME1 = NowTime.tv_sec+FM_WAITTIME, + READTIME2 = NowTime.tv_sec+FM_WAITTIME, + READTIME3 = NowTime.tv_sec+FM_WAITTIME, + READTIME4 = NowTime.tv_sec+FM_WAITTIME; + + // ȡüijԱб(memberlist struct)Լ԰ + for( i=0; i DENGONDISTANCE) return; +#endif + + // ԰ + if( seqno == CHAR_WINDOWTYPE_FM_DENGON) + { + int dengonindex; + int fmindex_wk; + char tmp_buffer[4096],tmp[4096]; + + getStringFromIndexWithDelim(data,"|",1,tmp_buffer,sizeof(tmp_buffer)); + dengonindex = atoi(tmp_buffer); + + fmindex_wk = CHAR_getWorkInt( talker, CHAR_WORKFMINDEXI); + + if( fmindex_wk < 0 || fmindex_wk >= FMMAXNUM) return; + + switch( select){ + case WINDOW_BUTTONTYPE_NEXT: + case WINDOW_BUTTONTYPE_PREV: + { + int fd,i; + fd = getfdFromCharaIndex( talker); + if( fd == -1) return; + + dengonindex += 7 * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + if( dengonindex > memberlist[fmindex_wk].memoindex && memberlist[fmindex_wk].memonum < DENGONFILELINENUM) + dengonindex = memberlist[fmindex_wk].memoindex; + else if( dengonindex < 6 && memberlist[fmindex_wk].memonum < DENGONFILELINENUM) + dengonindex = 6; + else if( dengonindex < 1 && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) + dengonindex = memberlist[fmindex_wk].memonum+dengonindex; + else if( dengonindex > memberlist[fmindex_wk].memonum && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) + dengonindex -= memberlist[fmindex_wk].memonum; + + buttontype = WINDOW_BUTTONTYPE_OKCANCEL; + if( dengonindex==memberlist[fmindex_wk].memoindex && memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( (dengonindex - 7)<=memberlist[fmindex_wk].memoindex && (dengonindex - 7)>=(memberlist[fmindex_wk].memoindex - 7) && + memberlist[fmindex_wk].memonum >= DENGONFILELINENUM) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else if( dengonindex==memberlist[fmindex_wk].memoindex) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( dengonindex == 6) buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + if(dengonindex >= 6){ + strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex - 5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if(dengonindex < 6){ + strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memonum+(dengonindex - 6)]); + strcat( NPC_sendbuf, "\n"); + for( i=memberlist[fmindex_wk].memonum+(dengonindex - 5); i DENGONFILELINENUM) + memberlist[fmindex_wk].memonum = DENGONFILELINENUM; + + memberlist[fmindex_wk].memoindex++; + if( memberlist[fmindex_wk].memoindex >= DENGONFILELINENUM) + memberlist[fmindex_wk].memoindex=0; + + dengonindex = memberlist[fmindex_wk].memoindex; + + if( dengonindex < 6 && memberlist[fmindex_wk].memonum= 6){ + strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex-5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if( dengonindex < 6){ + strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memonum+(dengonindex - 6)]); + strcat( NPC_sendbuf, "\n"); + for( i=memberlist[fmindex_wk].memonum+(dengonindex - 5); i fmsmemo.memoindex && fmsmemo.memonum < FMSDENGONFILELINENUM) + dengonindex = fmsmemo.memoindex; + else if( dengonindex < 6 && fmsmemo.memonum < FMSDENGONFILELINENUM) + dengonindex = 6; + else if( dengonindex < 1 && fmsmemo.memonum >= FMSDENGONFILELINENUM) + dengonindex = fmsmemo.memonum+dengonindex; + else if( dengonindex > fmsmemo.memonum && fmsmemo.memonum >= FMSDENGONFILELINENUM) + dengonindex -= fmsmemo.memonum; + + buttontype = WINDOW_BUTTONTYPE_OKCANCEL; + if( dengonindex==fmsmemo.memoindex && fmsmemo.memonum >= FMSDENGONFILELINENUM) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( (dengonindex-7)<=fmsmemo.memoindex && (dengonindex - 7)>=(fmsmemo.memoindex - 7) && + fmsmemo.memonum >= FMSDENGONFILELINENUM) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else if( dengonindex == fmsmemo.memoindex) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( dengonindex == 6 ) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + + if( dengonindex >= 6 ){ + if( (dengonindex - 6) >= 140 ) return; + strcpy( NPC_sendbuf, fmsmemo.memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex - 5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, fmsmemo.memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if(dengonindex < 6){ + if( (fmsmemo.memonum+(dengonindex - 6)) >= 140 || + (fmsmemo.memonum+(dengonindex - 6)) < 0 ) return; + + strcpy( NPC_sendbuf, fmsmemo.memo[fmsmemo.memonum+(dengonindex - 6)]); + + strcat( NPC_sendbuf, "\n"); + for( i=fmsmemo.memonum+(dengonindex - 5); i FMSDENGONFILELINENUM) + fmsmemo.memonum = FMSDENGONFILELINENUM; + + fmsmemo.memoindex++; + if( fmsmemo.memoindex >= FMSDENGONFILELINENUM) + fmsmemo.memoindex = 0; + + dengonindex = fmsmemo.memoindex; + if( dengonindex < 6 && fmsmemo.memonum= 6){ + strcpy( NPC_sendbuf, fmsmemo.memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex - 5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, fmsmemo.memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if(dengonindex < 6){ + strcpy( NPC_sendbuf, fmsmemo.memo[fmsmemo.memonum+(dengonindex - 6)]); + strcat( NPC_sendbuf, "\n"); + for( i=fmsmemo.memonum+(dengonindex - 5); i= FMMAXNUM) return; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + switch( select ){ + case WINDOW_BUTTONTYPE_OK: + { + strcpy( numberlistbuf, memberlist[fmindex_wk].numberlistarray[0]); + strcat( numberlistbuf, "\n"); + for( i=1; i<10; i++){ + strcat( numberlistbuf, memberlist[fmindex_wk].numberlistarray[i]); + strcat( numberlistbuf, "\n"); + } + // ӳʽ(ACҪļԱֵ) + sprintf(enlistbuf, "ǷļԱ|0|%d",memberlist[fmindex_wk].accept); + strcat( numberlistbuf, enlistbuf); + strcat( numberlistbuf, "\n"); + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_FM_MEMBERLIST, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( numberlistbuf, buf, sizeof(buf))); + } + break; + default: + break; + } + } + + // ǿ߱ѡӴ + else if( seqno == CHAR_WINDOWTYPE_FM_DPSELECT) + { + int fmindex_wk; + fmindex_wk = CHAR_getWorkInt( talker, CHAR_WORKFMINDEXI); + + if( CHAR_getInt(talker, CHAR_FMINDEX) > 0 ){ + if( fmindex_wk < 0 || fmindex_wk >= FMMAXNUM){ + print("FamilyNumber Data Error!!"); + return; + } + } + + buttonevent = atoi(data); + switch( buttonevent ){ + case 1: // ǰʮۺб + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.topmemo[i]); + strcat( listbuf, "\n"); + } + strcat( listbuf, "0\n"); +#ifdef _FMVER21 + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_TOP30DP, +#else + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, +#endif + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_NEXT, + CHAR_WINDOWTYPE_FM_DPTOP, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; + case 2: // ǰʮðб + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.adv_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.adv_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; + case 3: // ǰʮб + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.feed_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.feed_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; +#ifndef _NEW_MANOR_LAW + case 4: // ǰʮϳб + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.syn_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.syn_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; + case 5: // ǰʮб + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.food_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.food_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; +#endif +#ifdef _NEW_MANOR_LAW + case 4: // ǰʮУб +#else + case 6: // ǰʮУб +#endif + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.pk_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.pk_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; +#ifdef _NEW_MANOR_LAW + case 5: // ʮƼ + { + int fd,i; + char listbuf[4096]; + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( listbuf, fmdptop.momentum_topmemo[0]); + strcat( listbuf, "\n"); + for( i=1; i<10; i++){ + strcat( listbuf, fmdptop.momentum_topmemo[i]); + strcat( listbuf, "\n"); + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_10_MEMONTUM, + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; +#endif +#ifndef _NEW_MANOR_LAW + case 7: // Լа +#else + case 6: +#endif + { + int fd,i,h,k,fmid; + char listbuf[4096]; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + fmid = CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI); + if( fmid < 0 ){ + sprintf( NPC_sendbuf, " 桻\n Ǹ㲻ǼԱ޷鿴"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + -1, + -1, + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + return; + } + + for( h=0; h= 994 ) h = 990; + else h -= 4; + + strcpy( listbuf, fmdptop.topmemo[h]); + if( k == h ) strcat( listbuf, "|1"); + strcat( listbuf, "\n"); + for( i = h + 1; i < h + 10; i++){ + strcat( listbuf, fmdptop.topmemo[i]); + if(i == k) strcat( listbuf, "|1"); + strcat( listbuf, "\n"); + } +#ifdef _FMVER21 + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_TOP30DP, +#else + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_DP, +#endif + WINDOW_BUTTONTYPE_OK| + WINDOW_BUTTONTYPE_PREV, + CHAR_WINDOWTYPE_FM_DPME, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( listbuf, buf, sizeof(buf))); + } + break; +#ifdef _NEW_MANOR_LAW + case 7: // Լ + { + int fd,h,fmid; + char listbuf[4096]; + char szTempbuf[12]; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + fmid = CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI); + if( fmid < 0 ){ + sprintf( NPC_sendbuf, " 桻\n Ǹ㲻ǼԱ޷鿴"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + -1, + -1, + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + return; + } + + for( h=0; h 0 ){ + if( fmindex_wk < 0 || fmindex_wk >= FMMAXNUM){ + print("FamilyNumber Data Error!!"); + return; + } + } + + buttonevent = atoi(data); + + switch( buttonevent ){ + case FM_MEMBERLIST: + { + int fd; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + if( CHAR_getInt(talker, CHAR_FMINDEX) <= 0){ + sprintf( NPC_sendbuf, " 桻\n Ǹ㲻ǼԱʹù"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + -1, -1, makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + return; + } + /* + #ifdef _FMVER21 + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER || + CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER ){ + #else + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) == 1){ + #endif + saacproto_ACShowMemberList_send( acfd, fmindex_wk); + READTIME1 = NowTime.tv_sec+FM_WAITTIME; + }else + */ + if( NowTime.tv_sec > READTIME1 ){ + saacproto_ACShowMemberList_send( acfd, fmindex_wk); + READTIME1 = NowTime.tv_sec+FM_WAITTIME; + } + +#ifdef _FMVER21 + // if( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER || + // CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER || + // CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_VICELEADER ){ + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER || + CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER ){ +#else + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) == 1 ){ +#endif + sprintf( NPC_sendbuf, " ֪\nСĴԱϣһ޸޷ظԭ̬Сġ"); + }else{ + sprintf( NPC_sendbuf, " ֪\n ˱峤޸ģԱܲ鿴"); + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_FM_MESSAGE2, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + } + break; + case FM_FMPOINT: + { + int fd; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + +#ifdef _FMVER21 + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER ){ +#else + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) == 1 ){ +#endif + saacproto_ACFMPointList_send(acfd); + sprintf( NPC_sendbuf, " ֪\nСѡľݵ㣬һѡȡݵ޷ظԭ̬Сġ"); + READTIME4 = NowTime.tv_sec+FM_WAITTIME; + } + else{ + sprintf( NPC_sendbuf, " ֪\n˱峤룬Žܲ鿴"); + } + + if( NowTime.tv_sec > READTIME4 ){ + saacproto_ACFMPointList_send(acfd); + READTIME4 = NowTime.tv_sec+FM_WAITTIME; + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_FM_MESSAGE1, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + } + break; + case FM_FMDPTOP: + { + int fd; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + if( NowTime.tv_sec > READTIME3 ){ + saacproto_ACShowTopFMList_send( acfd, FM_TOP_INTEGRATE ); + saacproto_ACShowTopFMList_send( acfd, FM_TOP_ADV ); + saacproto_ACShowTopFMList_send( acfd, FM_TOP_FEED ); + saacproto_ACShowTopFMList_send( acfd, FM_TOP_SYNTHESIZE ); + saacproto_ACShowTopFMList_send( acfd, FM_TOP_DEALFOOD ); + saacproto_ACShowTopFMList_send( acfd, FM_TOP_PK ); +#ifdef _NEW_MANOR_LAW + saacproto_ACShowTopFMList_send(acfd, FM_TOP_MOMENTUM); +#endif + READTIME3 = NowTime.tv_sec+FM_WAITTIME; + } + memset(NPC_sendbuf,0,sizeof(NPC_sendbuf)); + strcpy( NPC_sendbuf, "\n ʮб\n"); + strcat( NPC_sendbuf, " ʮðռ\n"); + strcat( NPC_sendbuf, " ʮ\n"); +#ifndef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " ʮϳɼ\n"); + strcat( NPC_sendbuf, " ʮ\n"); +#endif + strcat( NPC_sendbuf, " ʮս\n"); +#ifdef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " ʮƼ\n"); +#endif + strcat( NPC_sendbuf, " Լб\n"); +#ifdef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " Լ\n"); +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_FM_DPSELECT, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + + } + break; + case FM_MEMBERMEMO: + { + int fd,i,dengonindex; + char tmp[4096]; + fd = getfdFromCharaIndex( talker ); + + if( fd == -1 ) return; + + if( CHAR_getInt(talker, CHAR_FMINDEX) <= 0){ + sprintf( NPC_sendbuf, " 桻\n Ǹ㲻ǼԱʹù"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, + -1, + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + return; + } + + if( NowTime.tv_sec > READTIME2 ){ + saacproto_ACFMReadMemo_send( acfd, fmindex_wk); + READTIME2 = NowTime.tv_sec+FM_WAITTIME; + } + + dengonindex = memberlist[fmindex_wk].memoindex; + if( memberlist[fmindex_wk].memoindex < 6 && memberlist[fmindex_wk].memonum < DENGONFILELINENUM ){ + dengonindex = 6; + } + + if( dengonindex >= 6 ){ + strcpy( NPC_sendbuf, memberlist[fmindex_wk].memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex - 5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, memberlist[fmindex_wk].memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if( dengonindex < 6 ){ + strcpy( NPC_sendbuf, + memberlist[fmindex_wk].memo[memberlist[fmindex_wk].memonum + (dengonindex - 6)]); + strcat( NPC_sendbuf, "\n"); + for( i=memberlist[fmindex_wk].memonum + (dengonindex - 5); i READTIME3 ){ + saacproto_ACFMReadMemo_send( acfd, FMSDENGON_SN); + READTIME3 = NowTime.tv_sec+FM_WAITTIME; + } + dengonindex = fmsmemo.memoindex; + if( fmsmemo.memoindex<6 || fmsmemo.memonum>FMSDENGONFILELINENUM ){ + dengonindex = 6; + } + if( dengonindex >= 6 ){ + strcpy( NPC_sendbuf, fmsmemo.memo[dengonindex - 6]); + strcat( NPC_sendbuf, "\n"); + for( i=(dengonindex - 5); i<=dengonindex; i++){ + strcat( NPC_sendbuf, fmsmemo.memo[i]); + strcat( NPC_sendbuf, "\n"); + } + sprintf(tmp, "%d\n", dengonindex); + strcat( NPC_sendbuf, tmp); + } + if( dengonindex < 6 ){ + if( (fmsmemo.memonum + (dengonindex - 6)) < 0 || (fmsmemo.memonum + (dengonindex - 6)) >= 140 ) + return; + strcpy( NPC_sendbuf, fmsmemo.memo[fmsmemo.memonum + (dengonindex - 6)]); + strcat( NPC_sendbuf, "\n"); + for( i=fmsmemo.memonum + (dengonindex - 5); i= FMMAXNUM) return; + + getStringFromIndexWithDelim(data,"|",1,tmp_buffer,sizeof(tmp_buffer)); + numberlistindex = atoi(tmp_buffer); + getStringFromIndexWithDelim(data,"|",2,tmp_buffer,sizeof(tmp_buffer)); + buttonevent = atoi(tmp_buffer); + getStringFromIndexWithDelim(data,"|",3,dutybuf,sizeof(dutybuf)); + +#ifdef _FMVER21 + // if( buttonevent>=1 && buttonevent<=11 && + // ( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER || + // CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER || + // CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_VICELEADER )) + if( buttonevent>=1 && buttonevent<=11 && + ( CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER || + CHAR_getInt( talker, CHAR_FMLEADERFLAG ) == FMMEMBER_ELDER )) +#else + if( buttonevent>=1 && buttonevent<=11 && CHAR_getInt( talker, CHAR_FMLEADERFLAG) == 1 ) +#endif + { + int fd,i; + int int_status; + char getstatus[4096]; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + strcpy( getstatus, memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1] + + (strlen( memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1]) - 1)); + + int_status = atoi(getstatus); + + // ļ롢˳ѡ + if( buttonevent!=11 ) +#ifdef _FMVER21 + strcpy( memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1] + + (strlen(memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1]) - 1), dutybuf); +#else + switch( int_status ){ + case 1: + case 3: + strcpy( memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1] + + (strlen(memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1]) - 1), "4"); + break; + case 2: + strcpy( memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1] + + (strlen(memberlist[fmindex_wk].numberlistarray[numberlistindex+buttonevent - 1]) - 1), "1"); + break; + default: + break; + } +#endif + // ļѡ + if( buttonevent == 11 ) + { + strcpy( getstatus, enlistbuf + (strlen(enlistbuf) - 1)); + int_status = atoi(getstatus); + + switch( int_status ){ + case 1: + memberlist[fmindex_wk].accept = 0; + sprintf(enlistbuf, "ǷļԱ|%d|%d",numberlistindex,memberlist[fmindex_wk].accept); + break; + case 0: + memberlist[fmindex_wk].accept = 1; + sprintf(enlistbuf, "ǷļԱ|%d|%d",numberlistindex,memberlist[fmindex_wk].accept); + break; + default: + break; + } + } + + strcpy( numberlistbuf, memberlist[fmindex_wk].numberlistarray[numberlistindex]); + strcat( numberlistbuf, "\n"); + for( i=(numberlistindex + 1); i memberlist[fmindex_wk].fmnum) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( numberlistindex == 0 ) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + + lssproto_WN_send( fd, WINDOW_FMMESSAGETYPE_SELECT, + buttontype, + CHAR_WINDOWTYPE_FM_MEMBERLIST, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( numberlistbuf, buf, sizeof(buf))); + } // end if + switch( select ){ + case WINDOW_BUTTONTYPE_NEXT: + case WINDOW_BUTTONTYPE_PREV: + { + int fd,i; + + fd = getfdFromCharaIndex( talker ); + if( fd == -1 ) return; + + numberlistindex += 10 * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + + if( numberlistindex >= memberlist[fmindex_wk].fmnum) + numberlistindex -= 10; + else if( numberlistindex < 1 ) + numberlistindex = 0; + + buttontype = WINDOW_BUTTONTYPE_OK; + if( (numberlistindex + 10) >= memberlist[fmindex_wk].fmnum) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( numberlistindex==0 ) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + + strcpy( numberlistbuf, memberlist[fmindex_wk].numberlistarray[numberlistindex]); + strcat( numberlistbuf, "\n"); + for( i=(numberlistindex+1); i= 30) + return; + //listindex = 20; + //listindex -= 10; + //else if( listindex < 1 ) + // listindex = 0; + if (listindex < 0) return; + + buttontype = WINDOW_BUTTONTYPE_OK; + if( (listindex + 10) >= 30) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( listindex==0 ) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + + strcpy( listbuf, fmdptop.topmemo[listindex]); + strcat( listbuf, "\n"); + for( i=(listindex+1); i 5) + pointlistindex -= 5; + else if( pointlistindex < 1 ) + pointlistindex = 0; + + buttontype = WINDOW_BUTTONTYPE_OK; + if( CHAR_getInt( talker, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER && + CHAR_getWorkInt(talker, CHAR_WORKFMSETUPFLAG)==1){ + if(select==WINDOW_BUTTONTYPE_NEXT) + CHAR_setWorkInt( talker, CHAR_WORKLISTPAGE,1); + else if(select==WINDOW_BUTTONTYPE_PREV) + CHAR_setWorkInt( talker, CHAR_WORKLISTPAGE,0); + int tkfmindex = CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI); + int i,check=TRUE; + char fmindex[4]; + for(i=0; i 5){ + getStringFromIndexWithDelim( fmpointlist.pointlistarray[5],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[5],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[5],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[5],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[6],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[6],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[6],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[6],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ˹ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[7],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[7],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[7],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[7],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[8],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[8],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[8],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[8],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ŷ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[9],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[9],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[9],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[9],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ˹ %3s %3s %s\n", pointbuf, x, y, name); + buttontype |= WINDOW_BUTTONTYPE_PREV; + }else if( pointlistindex==0 ){ + getStringFromIndexWithDelim( fmpointlist.pointlistarray[0],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[0],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[0],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[0],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ķ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[1],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[1],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[1],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[1],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ˹ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[2],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[2],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[2],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[2],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ӡ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[3],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[3],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[3],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[3],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s ³ %3s %3s %s\n", pointbuf, x, y, name); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[4],"|",3, x, sizeof( x)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[4],"|",4, y, sizeof( y)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[4],"|",5, fmindex, sizeof( fmindex)); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[4],"|",6, name, sizeof( name)); + if(atoi(fmindex)<=0)strcpy(name," δռ"); + sprintf(pointbuf,"%s %3s %3s %s\n", pointbuf, x, y, name); + buttontype |= WINDOW_BUTTONTYPE_NEXT; + }else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } +#else + int i; + pointlistindex += 10 * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + + if( pointlistindex > FMPOINTNUM) + pointlistindex -= 10; + else if( pointlistindex < 1 ) + pointlistindex = 0; + + buttontype = WINDOW_BUTTONTYPE_OK; + if( (pointlistindex + 10) > FMPOINTNUM) + buttontype |= WINDOW_BUTTONTYPE_PREV; + else if( pointlistindex==0 ) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + else{ + buttontype |= WINDOW_BUTTONTYPE_PREV; + buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + + strcpy( pointbuf, fmpointlist.pointlistarray[pointlistindex]); + strcat( pointbuf, "\n"); + for( i=(pointlistindex+1); i READTIME3 ){ + saacproto_ACShowTopFMList_send(acfd, FM_TOP_INTEGRATE); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_ADV); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_FEED); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_SYNTHESIZE); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_DEALFOOD); + saacproto_ACShowTopFMList_send(acfd, FM_TOP_PK); +#ifdef _NEW_MANOR_LAW + saacproto_ACShowTopFMList_send(acfd, FM_TOP_MOMENTUM); +#endif + READTIME3 = NowTime.tv_sec+FM_WAITTIME; + } + + strcpy( NPC_sendbuf, "\n ʮб\n"); + strcat( NPC_sendbuf, " ʮðռ\n"); + strcat( NPC_sendbuf, " ʮ\n"); +#ifndef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " ʮϳɼ\n"); + strcat( NPC_sendbuf, " ʮ\n"); +#endif + strcat( NPC_sendbuf, " ʮս\n"); +#ifdef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " ʮƼ\n"); +#endif + strcat( NPC_sendbuf, " Լб\n"); +#ifdef _NEW_MANOR_LAW + strcat( NPC_sendbuf, " Լ\n"); +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_FM_DPSELECT, +#ifndef _FM_MODIFY + CHAR_getWorkInt( index, CHAR_WORKOBJINDEX), +#else + -1, +#endif + makeEscapeString( NPC_sendbuf, buf, sizeof(buf))); + } + break; + case WINDOW_BUTTONTYPE_OK: + break; + default: + break; + } + + } +} + +// call FmDengon NPC event +#ifndef _FM_MODIFY +void NPC_FmDengonLooked( int meindex, int lookedindex ) +{ + char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2]; + char menubuf[4096]; + int fd; + + if (!CHAR_CHECKINDEX(lookedindex)) return; + + fd = getfdFromCharaIndex( lookedindex ); + if( fd == -1 ) return; + + // վڲǰһ + if( NPC_Util_CharDistance( lookedindex, meindex ) > 1) return; + // հ״ + strcpy( menubuf, " 岼\n\n"); + strcat( menubuf, " Աб\n"); + strcat( menubuf, " \n"); + strcat( menubuf, " ֮԰\n"); + strcat( menubuf, " ݵ\n"); + strcat( menubuf, " ֮ǿ߱"); + + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_FM_SELECT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( menubuf, buf, sizeof(buf))); +} +#else +void NPC_FmDengonLooked( int meindex, int lookedindex ) +{ + char buf[DENGONFILEENTRYSIZE*MESSAGEINONEWINDOW*2]; + char menubuf[4096]; + int fd; + + if (!CHAR_CHECKINDEX(lookedindex)) return; + + fd = getfdFromCharaIndex( lookedindex ); + if( fd == -1 ) return; + + // հ״ + strcpy( menubuf, " 岼\n\n"); + strcat( menubuf, " Աб\n"); + strcat( menubuf, " \n"); + strcat( menubuf, " ֮԰\n"); + strcat( menubuf, " ݵ\n"); + strcat( menubuf, " ֮ǿ߱"); +#ifdef _FM_FMPOINTPK_LIST + strcat( menubuf, "\n"); + strcat( menubuf, " ׯ԰սʱ"); +#endif + lssproto_WN_send(fd, + WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_FM_SELECT, + -1, + makeEscapeString( menubuf, buf, sizeof(buf))); +} +#endif + +#ifdef _FIX_FM_FMPOINT +void ApplyFamilyPoint( int meindex, int toindex, int select) +{ + int fd = getfdFromCharaIndex(toindex); + if (fd == -1) return; + char fmindex[4]; + char buf[64]; + int tkfmindex = CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI); + int i,check=0; + for (i=0; i<=MANORNUM-1; i++) { // 10ׯ԰ + getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, fmindex, sizeof(fmindex)); + if (tkfmindex==atoi(fmindex)-1){ + return; + } + } + if(memberlist[tkfmindex].fmjoinnum<30) + check=1; + else if(CHAR_getInt( toindex, CHAR_FAME)<300000) + check=2; + getStringFromIndexWithDelim( fmpointlist.pointlistarray[select-1],"|",5, fmindex, sizeof( fmindex)); + if(atoi(fmindex)<=0 && check==0){ + saacproto_ACFixFMPoint_send(acfd,CHAR_getChar(toindex, CHAR_FMNAME),tkfmindex+1,tkfmindex, + CHAR_getChar(toindex, CHAR_FMNAME),tkfmindex+1,tkfmindex,select); + sprintf(buf, "ϲ㣡\n ׯ԰Ѿˡ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + 0, CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), buf); + }else{ + if(check==0) + sprintf(buf, "ׯ԰ݵռˣ뵽ׯ԰߹ݹԱ߹ׯ԰ɣ"); + else if(check==1) + sprintf(buf, "ܱǸׯ԰ݵ˱30ˣ"); + else if(check==2) + sprintf(buf, "ܱǸׯ԰ݵ3000ϣ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + 0, CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), buf); + } +} +#endif + diff --git a/npc/npc_fmhealer.c b/npc/npc_fmhealer.c new file mode 100644 index 0000000..25baec1 --- /dev/null +++ b/npc/npc_fmhealer.c @@ -0,0 +1,144 @@ +#include "version.h" +/*---------- Shan (BEGIN) ----------*/ +/*--------- AD 2001/05/28 ---------*/ +// +// ҽ +// +/*---------- Shan(END) ----------*/ +#include +#include +#include + +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" + +#define RANGE 2 +void NPC_FmHealerSpeak( int index, int talker); +void NPC_FmHealerAllHeal( int talker ); +BOOL NPC_FmMoneyCheck(int meindex,int talker); +int NPC_FmCostCheck(int talker); +void NPC_FmCharCheckPoint(int meindex,int talker); +int NPC_FmWorkInput(int meindex,int talker); + +BOOL NPC_FmHealerInit( int meindex ) +{ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEHEALER ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + return TRUE; +} + +void NPC_FmHealerTalked( int meindex , int talker , char *msg ,int color ) +{ + char* npcarg; + char token[32]; + int msgNo; + + npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT); + + getStringFromIndexWithDelim( npcarg, "|", 1, token,sizeof( token)); + msgNo = atoi( token ); + + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + + if( NPC_Util_isFaceToFace( talker, meindex , 2 ) == FALSE ) + { + if( NPC_Util_isFaceToFace( talker, meindex , 1 ) == FALSE ) + return; + } + + //if( CHAR_getInt(meindex, CHAR_FLOOR) != CHAR_getWorkInt(talker, CHAR_WORKFMFLOOR)){ + //print("\n npc floor->%d player floor->%d",CHAR_getInt(meindex, CHAR_FLOOR), + // CHAR_getWorkInt(talker, CHAR_WORKFMFLOOR)); + // CHAR_talkToCli(talker, meindex, + // "Ǹ㲻DZԱ޷ظ",CHAR_COLORWHITE); + // return; + //} + + if( (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 2)){ + NPC_FmHealerAllHeal( talker); + if(msgNo == 1) { + CHAR_talkToCli( talker, meindex, + "ѾȫظСԼࡣ",CHAR_COLORWHITE); + }else if(msgNo == 2){ + CHAR_talkToCli( talker, meindex, + "DZԱҰظɣ",CHAR_COLORWHITE); + } + }else{ + int i = 0; + int otherindex; + for( i=0 ; i < CHAR_PARTYMAX ; i++){ + otherindex = CHAR_getWorkInt( talker, CHAR_WORKPARTYINDEX1 + i); + if(otherindex != -1){ + NPC_FmHealerAllHeal( otherindex); + if(msgNo == 1){ + CHAR_talkToCli( otherindex, meindex, + "ѾȫظСԼࡣ",CHAR_COLORWHITE); + }else if(msgNo == 2){ + CHAR_talkToCli( otherindex, meindex, + "DZԱҰظɣ",CHAR_COLORWHITE); + } + } + } + } +} + +void NPC_FmHealerAllHeal( int talker ) +{ + int i; + int petindex; + char petsend[3]; + char msgbuf[5]; + + CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); + CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); + + for(i = 0 ; i < CHAR_MAXPETHAVE; i ++){ + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + + if( !CHAR_CHECKINDEX( talker ) ) continue; + if( CHAR_CHECKINDEX( petindex) == FALSE ) continue; + CHAR_setFlg( petindex, CHAR_ISDIE, 0); + CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( petindex ); + sprintf( petsend, "K%d", i ); + CHAR_sendStatusString( talker , petsend ); + } + + if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ){ + int topartyarray = -1; + int oyaindex = CHAR_getWorkInt( talker, CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX( oyaindex )){ + int i; + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 + i); + if( CHAR_CHECKINDEX( workindex) ){ + if( workindex == talker ){ + topartyarray = i; + break; + } + } + } + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int otherindex = CHAR_getPartyIndex( talker, i); + if( CHAR_CHECKINDEX( otherindex) ){ + snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray); + if( otherindex != talker){ + CHAR_sendStatusString( otherindex, msgbuf); + } + } + } + } + } + CHAR_send_P_StatusString( talker, CHAR_P_STRING_HP); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_MP); +} + diff --git a/npc/npc_fmletter.c b/npc/npc_fmletter.c new file mode 100644 index 0000000..a76afa1 --- /dev/null +++ b/npc/npc_fmletter.c @@ -0,0 +1,679 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_fmletter.h" +#include "family.h" +#include "log.h" + +extern struct FM_POINTLIST fmpointlist; + +char sendbuf[1024]; +char buf[1024]; +char subbuf[128]; +int i, j; + +/* + * ɬýľūëNPC + * ƽʧìҡئľ¾֣ + * + */ + +struct { + int windowno; + int windowtype; + int buttontype; + int takeitem; + int giveitem; + char message[4096]; + int letter; +}w; + +struct { + BOOL use; + int checkhaveitem; + int checkhaveitemgotowin; + int checkdonthaveitem; + int checkdonthaveitemgotowin; + int warp; + int battle; + int gotowin; +}buttonproc[13]; /* ok,cancel, yes,no,prev,next ݼ */ + + + + + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; + +static void NPC_FmLetter_selectWindow( int meindex, int toindex, int num); +static BOOL NPC_FmLetter_readData( int meindex, int windowno, BOOL chkflg); +static int NPC_FmLetter_restoreButtontype( char *data ); + +/********************************* +* +*********************************/ +BOOL NPC_FmLetterInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + //int i; + //char secondToken[1024]; + + // Robin test + // print(" fmleter_Init "); + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf)) + == NULL ) + { + print( "fmletter:ûָ趨ĵ \n"); + return FALSE; + } + /* ݱɬ÷ëƻ֧ */ + if( !NPC_FmLetter_readData( meindex, -1, TRUE) ) { + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); + + return TRUE; +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_FmLetterTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + //print(" FmLetter_fmindex:%d ", CHAR_getInt( meindex, CHAR_FMINDEX) ); + + + int fmindex = 0, village, i; + char token[256]; + char buf[256]; + for( i=0 ; i 1) return; + + /* ū įë */ + if( !NPC_FmLetter_readData( meindex, seqno - 100, FALSE) ) { + print( "fmletter:readdata error\n"); + return; + } + /* ʾëƩ */ + if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { + button = atoi( data)+5; + if( button > 12 ) { + print( "fmletter:invalid button[%d]\n", button); + return; + } + } + else if( select & WINDOW_BUTTONTYPE_OK) button = 0; + else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; + else if( select & WINDOW_BUTTONTYPE_YES) button = 2; + else if( select & WINDOW_BUTTONTYPE_NO) button = 3; + else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; + else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; + else { + print( "fmletter:invalid button[%d]\n", select); + return; + } + if( buttonproc[button].use == TRUE ) { + int fd; + int newwin = -1; + + fd = getfdFromCharaIndex( talkerindex); + + /* ʾ巽Ȼ ëԻ */ + if( newwin == -1 ) { + newwin = buttonproc[button].gotowin; + } + + + // Robin + if( newwin == 5 ) { + int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); + int itemindex = ITEM_makeItemAndRegist( w.letter ); + + if( emptyitemindexinchara < 0 ) return; + + if( itemindex != -1 ){ + char msgbuf[128]; + CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); + /* Workëɬ */ + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); + CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); + LogItem( + CHAR_getChar( talkerindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talkerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +#endif + "AddLetter(뺯)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + snprintf( msgbuf, sizeof( msgbuf), "%sɹ", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); + } + } + + // Robin + if( newwin == 6 ) { + int emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); + int itemindex = ITEM_makeItemAndRegist( w.letter ); + + if( emptyitemindexinchara < 0 ) return; + + if( itemindex != -1 ){ + char msgbuf[128]; + CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); + /* Workëɬ */ + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, talkerindex); + CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); + LogItem( + CHAR_getChar( talkerindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talkerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), /* ʧ ة į */ +#endif + "AddLetter(뺯)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + snprintf( msgbuf, sizeof( msgbuf), "%sɹ", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talkerindex, -1,msgbuf, CHAR_COLORWHITE); + } + } + + + if( !NPC_FmLetter_readData( meindex, newwin, FALSE) ) { + print( "fmletter:readdata error\n"); + return; + } + + //fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } + + + + } +} +/* + * ɬð̻ë ƥ϶ýľwindownoë + * + * ¦ѡ + * meindex int NPCcharaindex + * windowno int ū į + * + */ +static BOOL NPC_FmLetter_readData( int meindex, int windowno, BOOL chkflg) +{ + + int i; + int linenum = 0; + int endflg = FALSE; + int buttonendflg; + int winno = -1; + int buttonconfmode; + int b_mode; + int selectnum ; + int messagepos; + BOOL errflg = FALSE; + BOOL readflg = TRUE; + FILE *fp; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char filename[64]; + char opfile[128]; + char line[1024]; + char firstToken[1024]; + char secondToken[1024]; + + /* ūɬë Ի հ */ + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + /* ɬð̻ */ + NPC_Util_GetStrFromStrWithDelim( argstr, "conff", filename, sizeof( filename)); + + sprintf( opfile, "%s/", getNpcdir( ) ); + strcat( opfile, filename); + + fp = fopen( opfile, "r"); + if( fp == NULL ) { + print( "fmletter:file open error [%s]\n", opfile); + return FALSE; + } + + while( readflg == TRUE ) { + endflg = FALSE; + buttonendflg = TRUE; + buttonconfmode = FALSE; + selectnum = 0; + messagepos = 0; + winno = -1; + b_mode = -1; + errflg = FALSE; + + /* */ + w.windowno = -1; + w.windowtype = -1; + w.buttontype = -1; + w.takeitem = -1; + w.giveitem = -1; + w.message[0] = '\0'; + + for( i = 0; i < arraysizeof( buttonproc); i ++ ) { + buttonproc[i].use = FALSE; + buttonproc[i].checkhaveitem = -1; + buttonproc[i].checkhaveitemgotowin = -1; + buttonproc[i].checkdonthaveitem = -1; + buttonproc[i].checkdonthaveitemgotowin = -1; + buttonproc[i].warp = -1; + buttonproc[i].battle = -1; + buttonproc[i].gotowin = -1; + } + + while( 1) { + char buf[256]; + int ret; + if( !fgets( line, sizeof( line), fp)){ + readflg = FALSE; + break; + } + + linenum ++; + + /* 춪 */ + if( line[0] == '#' || line[0] == '\n') continue; + /* ݱ */ + chomp( line ); + + /* ë */ + /* tab ë " " 徧 */ + replaceString( line, '\t' , ' ' ); + /* ʸë£*/ + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) strcpy( line, buf); + + /* delim "=" ƥ (1)ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, + sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + /* delim "=" ƥ2 ͼë */ + ret = getStringFromIndexWithDelim( line, "=", 2, secondToken, + sizeof( secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + + if( strcasecmp( firstToken, "winno") == 0 ) { + if( winno != -1 ) { + print( "fmletter:winnoȴ¶winno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + readflg = FALSE; + break; + } + /* ūNoë */ + winno = atoi( secondToken); + continue; + } + + /* ūNo Ȼئݼ淴 */ + if( winno == -1 ) { + print( "fmletter:winno δ壬ȴ趨\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = FALSE; + break; + } + /* ūNo ݷë + * ľ½ */ + if( (chkflg == FALSE && winno == windowno )|| + chkflg == TRUE) + { + if( buttonconfmode == TRUE ) { + if( strcasecmp( firstToken, "gotowin") == 0 ) { + buttonproc[b_mode].gotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkhaveitem") == 0 ) { + buttonproc[b_mode].checkhaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "haveitemgotowin") == 0 ) { + buttonproc[b_mode].checkhaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkdonthaveitem") == 0 ) { + buttonproc[b_mode].checkdonthaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "donthaveitemgotowin") == 0 ) { + buttonproc[b_mode].checkdonthaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "endbutton") == 0 ) { + if( buttonproc[b_mode].gotowin == - 1 ) { + if( buttonproc[b_mode].checkhaveitem == -1 && + buttonproc[b_mode].checkdonthaveitem == -1) + { + errflg = TRUE; + } + else { + /* оȵƥɬýľľ */ + if( !((buttonproc[b_mode].checkhaveitem != -1 && + buttonproc[b_mode].checkhaveitemgotowin != -1) + || (buttonproc[b_mode].checkdonthaveitem != -1 && + buttonproc[b_mode].checkdonthaveitemgotowin != -1))) + { + errflg = TRUE; + } + } + } + + if( errflg == TRUE) { + print( "fmletter: Ҳgotowin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = TRUE; + break; + } + buttonproc[b_mode].use = TRUE; + buttonconfmode = FALSE; + buttonendflg = TRUE; + } + } + else { + + w.windowno = winno; + + sprintf( buf, "letter%d", CHAR_getInt( meindex, CHAR_FMINDEX) ); + + /* ūɬ */ + if( strcasecmp( firstToken, "wintype") == 0 ) { + w.windowtype = atoi( secondToken); + } + /* ʾɬ */ + else if( strcasecmp( firstToken, "buttontype") == 0 ) { + w.buttontype = NPC_FmLetter_restoreButtontype( secondToken); + } + /* getitemɬ */ + else if( strcasecmp( firstToken, "takeitem") == 0 ) { + w.takeitem = atoi( secondToken); + } + /* giveitemɬ */ + else if( strcasecmp( firstToken, "giveitem") == 0 ) { + w.giveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, buf) == 0 ) { + w.letter = atoi( secondToken); + } + + /* messageɬ */ + else if( strcasecmp( firstToken, "message") == 0 ) { + if( messagepos == 0 ) { + strcpy( w.message, secondToken); + messagepos = strlen( w.message); + } + else { + w.message[messagepos]='\n'; + messagepos++; + strcpy( &w.message[messagepos], secondToken); + messagepos+=strlen(secondToken); + } + } + /* ʾëݼɬ */ + else if( strcasecmp( firstToken, "okpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 0; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "cancelpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 1; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "yespressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 2; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nopressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 3; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "prevpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 4; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nextpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 5; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "selected") == 0 ) { + buttonconfmode = TRUE; + b_mode = 6 + selectnum; + buttonendflg = FALSE; + selectnum ++; + } + /* ɬñδԻ */ + else if( strcasecmp( firstToken, "endwin") == 0 ) { + endflg = TRUE; + if( chkflg == FALSE) { + readflg = FALSE; + } + break; + } + else { + //print( "fmletter:趨DzܵIJ\n"); + //print( "filename:[%s] line[%d]\n", filename, linenum); + } + } + } + else { + if( strcasecmp( firstToken, "endwin") == 0 ) { + winno = -1; + } + } + } + if( buttonendflg == FALSE) { + print( "fmletter: Ҳendbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( winno != -1 ) { + if( w.windowtype == -1 ) { + print( "fmletter: Ҳwintype\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( w.buttontype == -1 ) { + print( "fmletter: Ҳbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( strlen( w.message) == 0 ) { + print( "fmletter: Ҳmessage\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + } + } + fclose( fp); + + if( chkflg == FALSE && w.windowno == -1 ) { + print( "fmletter: Ҳָwindowno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( winno != -1 && endflg == FALSE) { + print( "fmletter: Ҳendwin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( errflg == TRUE) return FALSE; + + return TRUE; +} +/* + * buttontype=ƥ϶ ٯ ëѰ £ + * + */ +static int NPC_FmLetter_restoreButtontype( char *data ) +{ + int ret = 0; + int rc; + int i; + char buff[1024]; + + for( i = 1; ; i ++ ) { + rc = getStringFromIndexWithDelim( data, "|", i, buff, + sizeof( buff ) ); + if( rc == FALSE) break; + if( strcasecmp( buff, "ok") == 0 ) { + ret |= WINDOW_BUTTONTYPE_OK; + } + else if( strcasecmp( buff, "cancel") == 0 ) { + ret |= WINDOW_BUTTONTYPE_CANCEL; + } + else if( strcasecmp( buff, "yes") == 0 ) { + ret |= WINDOW_BUTTONTYPE_YES; + } + else if( strcasecmp( buff, "no") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NO; + } + else if( strcasecmp( buff, "prev") == 0 ) { + ret |= WINDOW_BUTTONTYPE_PREV; + } + else if( strcasecmp( buff, "next") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NEXT; + } + } + if( ret == 0 ) { + ret = atoi( data); + } + return ret; +} + + + + diff --git a/npc/npc_fmlookwar.c b/npc/npc_fmlookwar.c new file mode 100644 index 0000000..f015496 --- /dev/null +++ b/npc/npc_fmlookwar.c @@ -0,0 +1,265 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_fmlookwar.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +#ifdef _FM_NPC_LOOK_WAR +//صشøнڽ"ʦ" +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_LOOKSELECT, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +extern int afmwarnum; +extern int bfmwarnum; +extern int cfmwarnum; +extern int dfmwarnum; +extern int efmwarnum; +extern int ffmwarnum; + +static void NPC_FmLookWarMan_selectWindow( int meindex, int toindex, int num,int select); +BOOL FmLookWarMan_Run( int meindex, int toindex, int select); + +BOOL NPC_FmLookWarManInit( int meindex ) +{ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} + +void NPC_FmLookWarManTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } +// Syu ADD Ŵʦж״̬ + if( CHAR_getWorkInt ( talkerindex , CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + { + CHAR_talkToCli( talkerindex, meindex, "ӣ",CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_FmLookWarMan_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_FmLookWarManWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_FMLOOKWARMAN_START: + break; + case NPC_FMLOOKWARMAN_SELECT: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + NPC_FmLookWarMan_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_FMLOOKWARMAN_LOOK: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + else if( select == WINDOW_BUTTONTYPE_NEXT ) + NPC_FmLookWarMan_selectWindow( meindex, talkerindex, WINDOW_SELECT, 99); + else if( select == WINDOW_BUTTONTYPE_PREV ) + NPC_FmLookWarMan_selectWindow( meindex, talkerindex, WINDOW_SELECT, 98); + else + NPC_FmLookWarMan_selectWindow( meindex, talkerindex, WINDOW_LOOKSELECT, atoi( data)); + break; + } + +} + +static void NPC_FmLookWarMan_selectWindow( int meindex, int toindex, int num,int select) +{ + char token[512]; + + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + int PREVTYPE; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token,"2\nԶ̹սԱṩ侳Ĺս\n" + "ѡҪۿս\n" + " ķׯ԰ս\n" + " ˿ׯ԰ս\n" + " ӼӴׯ԰ս\n" + " ³ׯ԰ս\n" + " 񶷳ֱ\n" + " ţдֱ\n"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_FMLOOKWARMAN_SELECT; + windowtype = WINDOW_MESSAGETYPE_SELECT; + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,0); + CHAR_setWorkInt(toindex,CHAR_WORKLISTSELECT,0); + break; + case WINDOW_SELECT: + PREVTYPE = 0; + if(select == 99 || select == 98){ + if(select == 98) PREVTYPE =1; + select = CHAR_getWorkInt(toindex,CHAR_WORKLISTSELECT); + } + if(select>=1 && select<=6){ + int fmwarnum = 0; + if(select == 1){ + fmwarnum = afmwarnum; + }else if(select == 2){ + fmwarnum = bfmwarnum; + }else if(select == 3){ + fmwarnum = cfmwarnum; + }else if(select == 4){ + fmwarnum = dfmwarnum; + }else if(select == 5){ + fmwarnum = efmwarnum; + }else if(select == 6){ + fmwarnum = ffmwarnum; + } + + if(fmwarnum<1){ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return; + } + if(PREVTYPE==1) + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1); + else + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)+1); + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTSELECT)==0) + CHAR_setWorkInt(toindex,CHAR_WORKLISTSELECT,select); + sprintf(token,SearchFmWar(toindex,select)); + if(strcmp(token,"err")==0){ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_SELECT); + if(fmwarnum>CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)*6){ + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1>0) + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + }else{ + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1>0) + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + windowno = NPC_FMLOOKWARMAN_LOOK; + windowtype = WINDOW_MESSAGETYPE_SELECT; + }else + return; + break; + case WINDOW_LOOKSELECT: + if(LookFmWarIndex(toindex,select)==-1){ + CHAR_talkToCli( toindex, meindex, "źսʧܡ",CHAR_COLORYELLOW); + return; + } + break; + default: + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_FmLookWarManLoop( int meindex) +{ + +} + +BOOL FmLookWarMan_Run( int meindex, int toindex, int select) +{ + if(select<1 || select>6) return FALSE; + switch(select){ + case 1: + if(SearchFmWarRandIndex(toindex,1042)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 2: + if(SearchFmWarRandIndex(toindex,2032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 3: + if(SearchFmWarRandIndex(toindex,3032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 4: + if(SearchFmWarRandIndex(toindex,4032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 5: + if(SearchFmWarRandIndex(toindex,20000)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 6: + if(SearchFmWarRandIndex(toindex,12345)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + default: + break; + } + return FALSE; +} +#endif + + diff --git a/npc/npc_fmlookwar1.c b/npc/npc_fmlookwar1.c new file mode 100644 index 0000000..5615093 --- /dev/null +++ b/npc/npc_fmlookwar1.c @@ -0,0 +1,265 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_fmlookwar1.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +#ifdef _FM_NPC_LOOK_WAR1 +//صشøнڽ"ʦ" +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_LOOKSELECT, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +extern int afmwarnum; +extern int bfmwarnum; +extern int cfmwarnum; +extern int dfmwarnum; +extern int efmwarnum; +extern int ffmwarnum; + +static void NPC_FmLookWarMan1_selectWindow( int meindex, int toindex, int num,int select); +BOOL FmLookWarMan1_Run( int meindex, int toindex, int select); + +BOOL NPC_FmLookWarMan1Init( int meindex ) +{ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} + +void NPC_FmLookWarMan1Talked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } +// Syu ADD Ŵʦж״̬ + if( CHAR_getWorkInt ( talkerindex , CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + { + CHAR_talkToCli( talkerindex, meindex, "ӣ",CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_FmLookWarMan1_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_FmLookWarMan1WindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_FMLOOKWARMAN1_START: + break; + case NPC_FMLOOKWARMAN1_SELECT: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + NPC_FmLookWarMan1_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_FMLOOKWARMAN1_LOOK: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + else if( select == WINDOW_BUTTONTYPE_NEXT ) + NPC_FmLookWarMan1_selectWindow( meindex, talkerindex, WINDOW_SELECT, 99); + else if( select == WINDOW_BUTTONTYPE_PREV ) + NPC_FmLookWarMan1_selectWindow( meindex, talkerindex, WINDOW_SELECT, 98); + else + NPC_FmLookWarMan1_selectWindow( meindex, talkerindex, WINDOW_LOOKSELECT, atoi( data)); + break; + } + +} + +static void NPC_FmLookWarMan1_selectWindow( int meindex, int toindex, int num,int select) +{ + char token[512]; + + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + int PREVTYPE; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token,"2\nԶ̹սԱṩ侳Ĺս\n" + "ѡҪۿս\n" + " ԰ׯ԰ս\n" + " ׯ԰ս\n" + " ˹ׯ԰ս\n" + " Ҷׯ԰ս\n" + " ŷׯ԰ս\n" + " ˹ׯս\n"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_FMLOOKWARMAN1_SELECT; + windowtype = WINDOW_MESSAGETYPE_SELECT; + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,0); + CHAR_setWorkInt(toindex,CHAR_WORKLISTSELECT,0); + break; + case WINDOW_SELECT: + PREVTYPE = 0; + if(select == 99 || select == 98){ + if(select == 98) PREVTYPE =1; + select = CHAR_getWorkInt(toindex,CHAR_WORKLISTSELECT); + } + if(select>=1 && select<=6){ + int fmwarnum = 0; + if(select == 1){ + fmwarnum = afmwarnum; + }else if(select == 2){ + fmwarnum = bfmwarnum; + }else if(select == 3){ + fmwarnum = cfmwarnum; + }else if(select == 4){ + fmwarnum = dfmwarnum; + }else if(select == 5){ + fmwarnum = efmwarnum; + }else if(select == 6){ + fmwarnum = ffmwarnum; + } + + if(fmwarnum<1){ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return; + } + if(PREVTYPE==1) + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1); + else + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)+1); + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTSELECT)==0) + CHAR_setWorkInt(toindex,CHAR_WORKLISTSELECT,select); + sprintf(token,SearchFmWar(toindex,select)); + if(strcmp(token,"err")==0){ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_SELECT); + if(fmwarnum>CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)*6){ + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1>0) + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + }else{ + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)-1>0) + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + windowno = NPC_FMLOOKWARMAN1_LOOK; + windowtype = WINDOW_MESSAGETYPE_SELECT; + }else + return; + break; + case WINDOW_LOOKSELECT: + if(LookFmWarIndex(toindex,select)==-1){ + CHAR_talkToCli( toindex, meindex, "źսʧܡ",CHAR_COLORYELLOW); + return; + } + break; + default: + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_FmLookWarMan1Loop( int meindex) +{ + +} + +BOOL FmLookWarMan1_Run( int meindex, int toindex, int select) +{ + if(select<1 || select>6) return FALSE; + switch(select){ + case 1: + if(SearchFmWarRandIndex(toindex,5042)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 2: + if(SearchFmWarRandIndex(toindex,6032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 3: + if(SearchFmWarRandIndex(toindex,7032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 4: + if(SearchFmWarRandIndex(toindex,8032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 5: + if(SearchFmWarRandIndex(toindex,9032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + case 6: + if(SearchFmWarRandIndex(toindex,10032)==0){ + return TRUE; + }else{ + CHAR_talkToCli( toindex, meindex, "źõͼĿǰսԹۿ",CHAR_COLORYELLOW); + return FALSE; + } + break; + default: + break; + } + return FALSE; +} +#endif + + diff --git a/npc/npc_fmpkcallman.c b/npc/npc_fmpkcallman.c new file mode 100644 index 0000000..9f98a6c --- /dev/null +++ b/npc/npc_fmpkcallman.c @@ -0,0 +1,392 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_fmpkcallman.h" +#include "family.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" + +// WON ADD 峤ٻ +#include "npc_scheduleman.h" +#include "handletime.h" + + +static void NPC_FMPKCallMan_selectWindow(int meindex, int toindex, int num, int select); +void NPC_CallFMMember(int meindex, int floor, int fmindex, char *fmname, int index); + +/********************************* +* +*********************************/ +BOOL NPC_FMPKCallManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + char buff2[256]; + int fl, x, y; + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof( npcarg)) == NULL){ + print("FMPKCallMan:GetArgStrErr"); + return FALSE; + } + + /*--ɬýľ¾----*/ + /*--ɬýľئľNPCëئг--*/ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf))==NULL){ + print("FMPKCallMan Err is %s",npcarg); + print("FMPKCallMan Err"); + return FALSE; + } + + /*--ɬýľлַƻئľǷNPCëئ--*/ + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl=atoi(buff2); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y=atoi(buff2); + + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "FMWarp NPC:Invalid warpman ERR" ); + return FALSE; + } + + /*--ɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWARPMAN ); + + return TRUE; +} + +/********************************* +* ƾľݼ +*********************************/ +void NPC_FMPKCallManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + /* */ + if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + /*--ͼ--*/ + CHAR_setWorkInt(talkerindex, CHAR_WORKSHOPRELEVANT, 0); + + /*-Ԫ --*/ + NPC_FMPKCallMan_selectWindow( meindex, talkerindex, 0, -1); +} + +static void NPC_FMPKCallMan_selectWindow( int meindex, int toindex, + int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024], buf[256], buf2[256]; + int fd = getfdFromCharaIndex(toindex); + + if( fd == -1 ) { + fprint( "getfd err\n"); + return; + } + + // print("meindex:%d toindex:%d num:%d select:%d", meindex, toindex, num, select); + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + /*--ɬð̻P ׷ʧѻ϶ýľ¾ľľɰ׷ʧѼԻ*/ + if(strstr(npcarg,"%4d")!=NULL){ + int work; + NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf)); + getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2)); + work = atoi( buf2); + } + + token[0] = '\0'; + + switch(num) { + + case 0: + if (NPC_Util_GetStrFromStrWithDelim(npcarg, "MainMsg", buf, + sizeof(buf)) == NULL) + return; + sprintf(token, "3\n У˳\n" + "%s" + "\n ٻԱ" + "\n ؼ¼㡷" + "\n ȡ", + buf); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_FMPKCALLMAN_START, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); + break; + case 1: +#ifdef _FMVER21 + if( CHAR_getInt( toindex, CHAR_FMLEADERFLAG) == FMMEMBER_LEADER) +#else + if( CHAR_getInt( toindex, CHAR_FMLEADERFLAG) == 1) +#endif + { + if (CHAR_getWorkInt(toindex, CHAR_WORKFMSETUPFLAG) != 1) + { + if (NPC_Util_GetStrFromStrWithDelim(npcarg, "NoSetupMsg", buf, + sizeof(buf)) == NULL) + return; + if (strstr(buf, "%s") != NULL) + sprintf(token, buf, CHAR_getChar(toindex, CHAR_FMNAME)); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, token); + } + else + { + if (NPC_Util_GetStrFromStrWithDelim(npcarg, "CallMsg", buf, + sizeof(buf)) == NULL) + return; + if (strstr(buf, "%s") != NULL) + sprintf(token, buf, CHAR_getChar(toindex, CHAR_FMNAME)); + +// WON ADD 峤ٻ + { + int fmindex, fmpk_pos=-1, j; + int now_time; + struct tm tm1; +// Terry add for ֵΪ 0 ļ,Զжϼ + char szFMName[32]; +// end + + memcpy(&tm1,localtime((time_t *)&NowTime.tv_sec),sizeof(tm1)); + + fmindex = CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI); +// Terry add for ֵΪ 0 ļ,Զжϼ + strncpy(szFMName,CHAR_getChar(toindex,CHAR_FMNAME),sizeof(szFMName)); +// end + + for( j=0; j <= MAX_SCHEDULEMAN*MAX_SCHEDULE; j++ ){ +// Terry fix for ֵΪ 0 ļ,Զжϼ +// if( (fmindex == fmpks[j].host_index ) || (fmindex == fmpks[j].guest_index ) ){ + if((fmindex == fmpks[j].host_index && strcmp(szFMName,fmpks[j].host_name) == 0) || + (fmindex == fmpks[j].guest_index && strcmp(szFMName,fmpks[j].guest_name) == 0)){ +//end + fmpk_pos=j; + break; + } + } + + if(fmpk_pos != -1){ + + if(fmpk_pos <= MANORNUM*MAX_SCHEDULE+1){ + now_time=NowTime.tv_sec+(60*60); + }else{ + if(tm1.tm_hour+1==24) now_time=10000; + else now_time=(tm1.tm_hour+1) * 100; + } + + if( (fmpks[fmpk_pos].flag != FMPKS_FLAG_SCHEDULED) && + (fmpks[fmpk_pos].flag != FMPKS_FLAG_MANOR_PREPARE) ) + { + sprintf(token,"ûмԼսԼսɡ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, token); + + }else if( now_time < fmpks[fmpk_pos].dueltime ){ + + sprintf(token,"ڶսǰһСʱٻԱ!"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, token); + + }else{ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_FMPKCALLMAN_CALL, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); + } + }else{ + sprintf(token,"ûмԼսԼսɡ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, token); + } + } + + } + } else { + if (NPC_Util_GetStrFromStrWithDelim(npcarg, "NoLeaderMsg", buf, + sizeof(buf)) == NULL) + return; + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, buf); + } + break; + case 2: + if (NPC_Util_GetStrFromStrWithDelim(npcarg, "LeavepkMsg", buf, + sizeof(buf)) == NULL) + return; + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_FMPKCALLMAN_LEAVE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf); + break; + } +} + +/*----------------------------------------- + * ͷʧ߯Ȼݱ̫ľ£ + * +-------------------------------------------*/ +void NPC_FMPKCallManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int datanum = -1, fl, x, y; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024], buff2[256]; + + int fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + if (NPC_Util_GetArgStr(meindex, npcarg, sizeof(npcarg)) == NULL) + { + print("GetArgStrErr"); + return; + } + NPC_Util_GetStrFromStrWithDelim(npcarg, "WARP", buf, sizeof(buf)); + getStringFromIndexWithDelim(buf, ",", 1, buff2, sizeof(buff2)); + fl = atoi(buff2); + getStringFromIndexWithDelim(buf, ",", 2, buff2, sizeof(buff2)); + x = atoi(buff2); + getStringFromIndexWithDelim(buf, ",", 3, buff2, sizeof(buff2)); + y = atoi(buff2); + + makeStringFromEscaped( data); + + print("meindex:%d seqno:%d select:%d data:%s\n", meindex, seqno, select, data); + + datanum = atoi( data); + switch( seqno){ + + /*--ԪԻ --*/ + case CHAR_WINDOWTYPE_FMPKCALLMAN_START: + if (datanum == 1) + NPC_FMPKCallMan_selectWindow(meindex, talkerindex, 1, -1); + else if (datanum == 2) + NPC_FMPKCallMan_selectWindow(meindex, talkerindex, 2, -1); + break; + case CHAR_WINDOWTYPE_FMPKCALLMAN_CALL: + if (select == WINDOW_BUTTONTYPE_YES) + { + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nٻСԺ\n磥", buf, sizeof(buf))); + NPC_CallFMMember(meindex, + CHAR_getInt(talkerindex, CHAR_FLOOR), + CHAR_getInt(talkerindex, CHAR_FMINDEX), + CHAR_getChar(talkerindex, CHAR_FMNAME), + CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI)); + } + break; + case CHAR_WINDOWTYPE_FMPKCALLMAN_COME: + if (select == WINDOW_BUTTONTYPE_YES) + { + print("CHAR_WINDOWTYPE_FMPKCALLMAN_COME\n"); + if (CHAR_getWorkInt(talkerindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + return; + if (CHAR_getWorkInt(talkerindex, CHAR_WORKPARTYMODE) + != CHAR_PARTY_NONE) + CHAR_DischargeParty(talkerindex, 0); + + CHAR_setWorkInt(talkerindex, CHAR_WORKWARPCHECK, FALSE); + CHAR_setWorkInt(talkerindex, CHAR_WORKFMPKFLAG, 1); + CHAR_warpToSpecificPoint(talkerindex, fl, x, y); + } + break; + case CHAR_WINDOWTYPE_FMPKCALLMAN_LEAVE: + if (select == WINDOW_BUTTONTYPE_YES) + { + int spfl = 0, spx = 0, spy = 0, i = 0, itemindex = 0; + if (CHAR_getWorkInt(talkerindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + return; + if (CHAR_getWorkInt(talkerindex, CHAR_WORKPARTYMODE) + != CHAR_PARTY_NONE) + { + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\n޷Ŷӷʽ뿪ࡣ\nȽɢŶӣ", buf, sizeof(buf))); + return; + } + for (i = 0; i < CHAR_MAXITEMHAVE; i++) + { + itemindex = CHAR_getItemIndex(talkerindex, i); + if (ITEM_CHECKINDEX(itemindex) == FALSE) continue; + + if (ITEM_getInt(itemindex, ITEM_DROPATLOGOUT) == TRUE) + { + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nйƷร\nΪ˱ڴ;вС𻵣\nȽƷж£\nллĺ", buf, sizeof(buf))); + return; + } + + } + CHAR_setWorkInt(talkerindex, CHAR_WORKWARPCHECK, FALSE); + CHAR_getElderPosition(CHAR_getInt(talkerindex, CHAR_LASTTALKELDER), + &spfl, &spx, &spy); + CHAR_warpToSpecificPoint(talkerindex, spfl, spx, spy); + } + break; + default: + break; + } +} + +extern struct FM_PKFLOOR fmpkflnum[FAMILY_FMPKFLOOR]; +void NPC_CallFMMember(int meindex, int floor, int fmindex, char *fmname, int index) +{ + int i, charindex; + char buf[256]; + extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; + print("CallFMMember_NPC_meindex:%d\n", meindex); + for( i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex = familyMemberIndex[index][i]; + if( charindex >= 0 ) { + if( CHAR_getCharUse(charindex) ) + { + print("charindex:%d name:%s\n", charindex, CHAR_getChar(charindex, CHAR_NAME)); + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor) continue; + if (CHAR_getWorkInt(charindex, CHAR_WORKBATTLEMODE) == BATTLE_CHARMODE_NONE) + { + int fd = getfdFromCharaIndex(charindex); + int charfloor = CHAR_getInt(charindex, CHAR_FLOOR); + int j = 0, checkflag = 0; + if (fd == -1) continue; +#ifdef _FMVER21 + if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) < 0 || + CHAR_getInt(charindex, CHAR_FMLEADERFLAG) == FMMEMBER_APPLY) continue; +#else + if (CHAR_getInt(charindex, CHAR_FMLEADERFLAG) <= 0 ) continue; +#endif + for (j = 0; j < FAMILY_FMPKFLOOR; j++) + { + if (charfloor == fmpkflnum[j].fl) + checkflag = 1; + } + if (checkflag != 1) + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, CHAR_WINDOWTYPE_FMPKCALLMAN_COME, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + makeEscapeString("\nѾڣУޡҪҪأ\n״̬УŶࡣ", buf, sizeof(buf))); + } + } + else + familyMemberIndex[index][i] = -1; + } + } +} diff --git a/npc/npc_fmpkman.c b/npc/npc_fmpkman.c new file mode 100644 index 0000000..4005acb --- /dev/null +++ b/npc/npc_fmpkman.c @@ -0,0 +1,301 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_fmpkman.h" +#include "npc_scheduleman.h" +#include "npc_fmwarpman.h" +#include "family.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" + +enum { + NPC_WORK_ID = CHAR_NPCWORKINT1, +}; + +static void NPC_FMPKMan_selectWindow(int meindex, int toindex, int num, int select); +// shan add +BOOL NPC_PARTY_CHAECK1(int meindex,int talker); +void NPC_ERR_DiSP1(int meindex,int talker,int errNO); + +/********************************* +* +*********************************/ +BOOL NPC_FMPKManInit( int meindex ) +{ + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + char buff2[256]; + int fl, x, y, meid; + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof( npcarg)) == NULL){ + print("FMPKMan:GetArgStrErr"); + return FALSE; + } + + /*--ɬýľ¾----*/ + /*--ɬýľئľNPCëئг--*/ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf))==NULL){ + print("FMPKMan Err is %s",npcarg); + print("FMPKMan Err"); + return FALSE; + } + + /*--ɬýľлַƻئľǷNPCëئ--*/ + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl=atoi(buff2); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y=atoi(buff2); + + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "FMWarp NPC:Invalid warpman ERR" ); + return FALSE; + } + + meid = NPC_Util_GetNumFromStrWithDelim(npcarg, "ID"); + if ((meid < 0) || (meid >= MAX_SCHEDULEMAN)) + { + print("FMPKMAN NPC: Init error Invalid ID:%d", meid); + return FALSE; + } + CHAR_setWorkInt(meindex, NPC_WORK_ID, meid); + + /*--ɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWARPMAN ); + + return TRUE; + +} + +/********************************* +* ƾľݼ +*********************************/ +void NPC_FMPKManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + + /*--ͼ--*/ + CHAR_setWorkInt(talkerindex, CHAR_WORKSHOPRELEVANT, 0); + + /*-Ԫ --*/ + NPC_FMPKMan_selectWindow( meindex, talkerindex, 0, -1); +} + +static void NPC_FMPKMan_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024], buf[256], buf2[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex(toindex); + int num1 = 0, num2 = 0; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + + if( fd == -1 ) { + print( "getfd err\n"); + return; + } + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + /*--ɬð̻P ׷ʧѻ϶ýľ¾ľľɰ׷ʧѼԻ*/ + if(strstr(npcarg,"%4d")!=NULL){ + int work; + NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf)); + getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2)); + work = atoi( buf2); + } + + token[0] = '\0'; + + switch(num){ + // ټū + case 0: + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "MainMsg", buf, + sizeof( buf)) == NULL) + return; + sprintf(token, "3\n У˳\n" + "%s" + "\n 쿴˫ " + "\n 뿪У˳ ", + buf); + buttontype = WINDOW_BUTTONTYPE_NONE; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_FMPKMAN_START; + break; + case 1: + if(NPC_Util_GetStrFromStrWithDelim(npcarg, "ViewMsg", buf, + sizeof(token)) == NULL) + return; + NPC_GetPKFMNum(CHAR_getInt(toindex, CHAR_FLOOR), + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + &num1, &num2); +/* + print("host:%s guest:%s hostindex:%d guestindex:%d\n", + fmpks[fmpks_pos].host_name, + fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index); +*/ + sprintf(token, "\n%s\n\n%s:%4d\n\n%s:%4d", buf, + fmpks[fmpks_pos].host_name, num1, + fmpks[fmpks_pos].guest_name, num2); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_FMPKMAN_VIEW; + break; + case 2: + if(NPC_Util_GetStrFromStrWithDelim(npcarg, "LeavepkMsg", token, + sizeof(token)) == NULL) + return; + + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_FMPKMAN_LEAVEPK; + break; + default: + break; + } + + /*--޵--*/ + //makeEscapeString( token, escapedname, sizeof(escapedname)); + + + /*--˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +/*----------------------------------------- + * ͷʧ߯Ȼݱ̫ľ£ + * +-------------------------------------------*/ +void NPC_FMPKManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int datanum = -1, fl, x, y; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024], buff2[256]; + + if (NPC_Util_GetArgStr(meindex, npcarg, sizeof(npcarg)) == NULL) + { + print("GetArgStrErr"); + return; + } + NPC_Util_GetStrFromStrWithDelim(npcarg, "WARP", buf, sizeof(buf)); + getStringFromIndexWithDelim(buf, ",", 1, buff2, sizeof(buff2)); + fl = atoi(buff2); + getStringFromIndexWithDelim(buf, ",", 2, buff2, sizeof(buff2)); + x = atoi(buff2); + getStringFromIndexWithDelim(buf, ",", 3, buff2, sizeof(buff2)); + y = atoi(buff2); + + makeStringFromEscaped( data); + +// print("meindex:%d seqno:%d select:%d data:%s\n", meindex, seqno, select, data); + + datanum = atoi( data); + switch( seqno){ + + /*--ԪԻ --*/ + case CHAR_WINDOWTYPE_FMPKMAN_START: + if (datanum == 1) + NPC_FMPKMan_selectWindow(meindex, talkerindex, 1, -1); + else if (datanum == 2) + NPC_FMPKMan_selectWindow(meindex, talkerindex, 2, -1); + break; + case CHAR_WINDOWTYPE_FMPKMAN_VIEW: + break; + case CHAR_WINDOWTYPE_FMPKMAN_LEAVEPK: + if (select == WINDOW_BUTTONTYPE_YES) + { + if (CHAR_getWorkInt(talkerindex, CHAR_WORKBATTLEMODE) + != BATTLE_CHARMODE_NONE) + return; + + // shan add + if(NPC_PARTY_CHAECK1( meindex, talkerindex)==FALSE){ + NPC_ERR_DiSP1( meindex, talkerindex, 1); + return; + } + + CHAR_setWorkInt(talkerindex, CHAR_WORKWARPCHECK, FALSE); + CHAR_warpToSpecificPoint(talkerindex, fl, x, y); + } + break; + default: + break; + } +} + +// shan add +BOOL NPC_PARTY_CHAECK1(int meindex,int talker) +{ + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + return FALSE; + } + return TRUE; +} + +// shan add errNO=1() +void NPC_ERR_DiSP1(int meindex,int talker,int errNO) +{ + char token[1024]; + int i=0; + int otherindex; + int fd = getfdFromCharaIndex( talker); + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + + if(errNO==1){ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PartyMsg",token, sizeof( token))==NULL){ + sprintf(token, "޷Ŷ볡\n\nŶӽɢ֮ٸ\n볡"); + } + + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE)==CHAR_PARTY_CLIENT){ + + }else{ + for( i=0 ; i < CHAR_PARTYMAX ;i++){ + otherindex=CHAR_getWorkInt(talker,CHAR_WORKPARTYINDEX1+i); + if(otherindex != -1){ + fd = getfdFromCharaIndex( otherindex); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + } + } + return ; + } + } +} + + + diff --git a/npc/npc_fmrank.c b/npc/npc_fmrank.c new file mode 100644 index 0000000..396dec1 --- /dev/null +++ b/npc/npc_fmrank.c @@ -0,0 +1,340 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_fmrank.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_healer.h" +#include "configfile.h" +#include "sasql.h" + +extern char fmrankname[20][50]; +extern int fmrankpoint[20]; +int fmrankcnt=0; +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_FMRANKTOP_NEXT, + WINDOW_FMRANKTOP_PREV, +}; + + +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_TIMEFLAG = CHAR_NPCWORKINT9, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +enum { + NPC_FMRANK_START, + NPC_FMRANK_SELECT, + NPC_FMRANK_ADDPOINT, + NPC_FMRANK_ADDFM, + NPC_FMRANK_TOP20, +}; +#define STANDBYTIME 50 + +static void NPC_FmRank_selectWindow( int meindex, int toindex, int num,int select); + +BOOL NPC_FmRankInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + +// CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_FmRankTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_FmRankWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + int myfmindex=-1; + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_FMRANK_START: + break; + case NPC_FMRANK_SELECT: + NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_FMRANK_ADDPOINT: + if(atoi(data)<1000 || atoi(data)>1000000){ + CHAR_talkToCli( talkerindex, -1,"׷ӵĵС1000ֻ100W֣",CHAR_COLORRED); + return; + } + if(sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),0,0)0){ + int myfmpoint = sasql_fmpoint_query(myfmindex); + if(myfmpoint>0){ + if(sasql_fmpoint_add(myfmindex,(myfmpoint+atoi(data)))==1){ + sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),-atoi(data),1); + CHAR_talkToCli( talkerindex, -1,"ѸԼļ徺۵ɹ",CHAR_COLORRED); + return; + } + } + } + break; + case NPC_FMRANK_ADDFM: + if(atoi(data)<5000 || atoi(data)>1000000){ + CHAR_talkToCli( talkerindex, -1,"״ξ۵С5000ֻ100W֣",CHAR_COLORRED); + return; + } + if(sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),0,0)0){ + int myfmpoint = sasql_fmpoint_query(myfmindex); + char* fmname = CHAR_getChar(talkerindex,CHAR_FMNAME); + if(myfmpoint<=0){ + if(sasql_fmindex_add(myfmindex,fmname,atoi(data))==1){ + sasql_ampoint(CHAR_getChar(talkerindex,CHAR_CDKEY),-atoi(data),1); + CHAR_talkToCli( talkerindex, -1,"ѸԼļ徺۵ɹ",CHAR_COLORRED); + return; + } + } + } + break; + case NPC_FMRANK_TOP20: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + if(fmrankcnt>7){ + NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_FMRANKTOP_NEXT, atoi( data)); + return; + } + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + if(fmrankcnt>7){ + NPC_FmRank_selectWindow( meindex, talkerindex, WINDOW_FMRANKTOP_PREV, atoi( data)); + return; + } + } + break; + } +} + +static void NPC_FmRank_selectWindow( int meindex, int toindex, int num,int select) +{ + int myfmindex=-1; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + char buff[128]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + sprintf(token, "3\n\n 徺Ա\n\n" + " ϵͳ\n" + " ׷Ӿ۵\n" + " 鿴Ρ\n" + " 鿴ǰʮ\n" + " ܽܡ\n"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_FMRANK_SELECT; + break; + case WINDOW_SELECT: + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(select==1 || select == 2){ + myfmindex = CHAR_getInt(toindex, CHAR_FMINDEX); + if(myfmindex>0){ + int myfmpoint = sasql_fmpoint_query(myfmindex); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + if(myfmpoint>0){ + sprintf(token, " 徺Ա\n\n" + "ļѾϵͳ\n" + "ڵľ۵ǣ%d㣡\n\n" + "\n" + "·д׷ӵ㡾ȷ",myfmpoint); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_FMRANK_ADDPOINT; + }else{ + sprintf(token, " 徺Ա\n\n" + "ļ廹δϵͳ\n\n" + "ϵͳ\n" + "·д۵㡾ȷ"); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_FMRANK_ADDFM; + } + }else{ + sprintf(token, " 徺Ա\n\n" + "ûм߳壬мٽд˲"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else if(select==3){ + myfmindex = CHAR_getInt(toindex, CHAR_FMINDEX); + if(myfmindex>0){ + int myfmpoint = sasql_fmpoint_query(myfmindex); + if(myfmpoint>0){ + int myfmno = sasql_fmno_query(myfmindex); + sprintf(token, " 徺Ա\n\n" + "ļѾϵͳ\n\n" + "ڵľ۵ǣ%d\n\n" + "%dλ",myfmpoint,myfmno); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + }else{ + sprintf(token, " 徺Ա\n\n" + "ļ廹δϵͳ\n"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else{ + sprintf(token, " 徺Ա\n\n" + "ûм߳壬мٽд˲"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + }else if(select==4){ + CHAR_setWorkInt(toindex,CHAR_WORKLISTPAGE,1); + sprintf(token, " ǰ20б\n"); + fmrankcnt = sasql_fm_query(); + if(fmrankcnt>0){ + int fmshowmax; + if(fmrankcnt>7) fmshowmax=7; + else fmshowmax = fmrankcnt; + int i; + for(i=0;i7) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_FMRANK_TOP20; + }else if(select==5){ + sprintf(token, "\n1þʽ \n" + "2ֻʾǰ20λ ۡ\n" + "3Ȼǰ š\n" + "4ٳΪһٵ \n" + "5ˢʱΪ15 ϵ\n" + "6ÿһ ͳ\n"); + buttontype = WINDOW_BUTTONTYPE_CANCEL; + } + break; + case WINDOW_FMRANKTOP_NEXT: + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)<1) return; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + sprintf(token, " ǰ20б\n"); + if(fmrankcnt>0){ + int fmshowmax; + if(fmrankcnt<=7) return; + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)==1){ + if(fmrankcnt>14){ + fmshowmax = 14; + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + } + else{ + fmshowmax = fmrankcnt; + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + } + }else if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)==2){ + if(fmrankcnt<=14) return; + fmshowmax = fmrankcnt; + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + }else{ + return; + } + int i; + for(i=7*CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE);i3) return; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + sprintf(token, " ǰ20б\n"); + if(fmrankcnt>0){ + int fmshowmax; + if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)==3){ + if(fmrankcnt<=14) return; + fmshowmax = 14; + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + }else if(CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE)==2){ + if(fmrankcnt<=7) return; + fmshowmax = 7; + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + } + int i; + for(i=fmshowmax-7;i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_fmwarpman.h" +#include "npc_scheduleman.h" +#include "readmap.h" +#include "log.h" +#include "battle.h" +#include "handletime.h" +#include "family.h" +#include "errno.h" +#include "configfile.h" + +#ifdef _FM_POINT_PK +extern struct FM_POINTLIST fmpointlist; // ݵ +#endif + +#define FMWARPMAN_INIT_LOOPTIME 600 // 0.1 +#define FMWARPMAN_FREE_LOOPTIME 9000 // 1.5 +#define FMWARPMAN_BUSY_LOOPTIME 3000 // 0.5 +#define FMWARPMAN_WAIT_LOOPTIME 18000 // 3 +#define FMWARPMAN_CLEANPLACE 59 +//#define FMWARPMAN_CLEANPLACE 9 +#define TRUE 1 +#define FALSE 0 +// CoolFish Rem 2002/2/25 +// #define MANOR 4 + +enum { + NPC_WORK_MODEFLAG = CHAR_NPCWORKINT1, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT2, + NPC_WORK_WARPFLOOR = CHAR_NPCWORKINT3, + NPC_WORK_FMNUMI = CHAR_NPCWORKINT4, + NPC_WORK_FMNUMII = CHAR_NPCWORKINT5, + NPC_WORK_ID = CHAR_NPCWORKINT6, + NPC_WORK_TIMEFLAG = CHAR_NPCWORKINT9, + NPC_WORK_TALKFLAG = CHAR_NPCWORKINT10, + NPC_WORK_CleanTime = CHAR_NPCWORKINT11, +}; + +enum { + NPC_STATEINIT, + NPC_STATEFREE, + NPC_STATEBUSY, + NPC_STATEWAIT, +}; + +enum { + NPC_WORK_WINFMNAME = CHAR_NPCWORKCHAR1, +}; + +void NPC_ERR_FMDiSP(int meindex, int talker, int errNO); +static void NPC_FMWarpMan_selectWindow(int meindex, int toindex, int num, int select); +void NPC_FMBATTLESET(int floor, int index1, int index2, int flag); +void NPC_WarpFamily(int floor, int index1, int index2, int fl, int x, int y); +void NPC_BattleOut(int fmindex, int fmindex1); +void NPC_CleanPK(int floor, int meindex); +int NPC_FMFloorUse(int floor); +void NPC_talkToFloor(int floor, int index1, int index2, char *data); +void CheckLeavePK(int npcindex, int floor, int index1, int index2); + +void CHECK_FMPknumInFloor( int meindex) +{ + int fmnum1 = 0, fmnum2 = 0; + int fmpks_pos; + + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + // Nuke 20040920: Bug fix ׯ԰ʱҪ + //print("<<%d %d>>",fmpks_pos,MAX_SCHEDULEMAN); + //if( fmpks_pos < 0 || fmpks_pos >= MAX_SCHEDULEMAN ) return; + if( fmpks_pos < 0 || fmpks_pos >= MAX_SCHEDULEMAN * MAX_SCHEDULE ) return; + NPC_GetPKFMNum(CHAR_getWorkInt(meindex, NPC_WORK_WARPFLOOR), + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + &fmnum1, &fmnum2 ); + + CHAR_setWorkInt( meindex, NPC_WORK_FMNUMI , fmnum1); + CHAR_setWorkInt( meindex, NPC_WORK_FMNUMII, fmnum2); +} + +extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; + +BOOL NPC_FMWarpManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buf[1024]; + int fl, x, y, meid; + // shan + int fl1, x1, y1; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("FMWarpMan:GetArgStrErr"); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP1", buf, sizeof( buf))==NULL){ + print("FMWarpman Err is %s",npcarg); + print("FMWarpman Err"); + return FALSE; + } + + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl=atoi(buff2); + CHAR_setWorkInt(meindex, NPC_WORK_WARPFLOOR, fl); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y=atoi(buff2); + + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "FMWarp NPC:Invalid warpman ERR" ); + return FALSE; + } + + // shan begin + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP2", buf, sizeof( buf))==NULL){ + print("FMWarpman Err is %s",npcarg); + print("FMWarpman Err"); + return FALSE; + } + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl1=atoi(buff2); + CHAR_setWorkInt(meindex, NPC_WORK_WARPFLOOR, fl); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x1=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y1=atoi(buff2); + if( MAP_IsValidCoordinate( fl1,x1,y1 )== FALSE ){ + print( "FMWarp NPC:Invalid warpman ERR" ); + return FALSE; + } + // shan end + + meid = NPC_Util_GetNumFromStrWithDelim(npcarg, "ID"); + if ((meid < 0) || (meid >= MAX_SCHEDULEMAN)) + { + print("FMWARP NPC: Init error invalid ID:%d\n", meid); + return FALSE; + } + + /*--ɬ--*/ + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_INIT_LOOPTIME); + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWARPMAN ); + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEINIT); + CHAR_setWorkInt(meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + CHAR_setWorkInt(meindex, NPC_WORK_TIMEFLAG, 0); + CHAR_setWorkInt(meindex, NPC_WORK_TALKFLAG, -1); + CHAR_setWorkInt(meindex, NPC_WORK_ID, meid); + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMI, 0); + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMII, 0); + + CHAR_setWorkInt( meindex, NPC_WORK_CleanTime, 6*10); + + return TRUE; +} + +void NPC_FMWarpManTalked(int meindex, int talkerindex, char *szMes, int color) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){ + if(NPC_Util_isFaceToChara(talkerindex,meindex,1 )==FALSE) return; + } + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + + if(CHAR_getWorkInt(talkerindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + NPC_ERR_FMDiSP( meindex, talkerindex, 1); + } + + CHAR_setWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD , 0 ); + NPC_FMWarpMan_selectWindow( meindex, talkerindex, 0, -1); +} + +void NPC_FMWarpManLoop(int meindex) +{ + struct tm tm1; + struct tm *tm2; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + int floor = CHAR_getWorkInt(meindex, NPC_WORK_WARPFLOOR); + // WON ADD snprintfᵼµbug + if( (tm2=localtime((time_t *)&NowTime.tv_sec) ) == NULL ){ + print("\n won ==> time err !! "); + return; + } + memcpy(&tm1, localtime((time_t *)&NowTime.tv_sec), sizeof(tm1)); + + if (tm1.tm_min == 0) + CHAR_setWorkInt(meindex, NPC_WORK_TIMEFLAG, tm1.tm_min); + if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEINIT) + { + if (tm1.tm_sec == 0) + { + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEFREE); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_FREE_LOOPTIME); + } + } + if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEFREE) + { + // ȡĿǰϵͳʱ䣬Ŀǰʱ >= ׼ʱ趨£գӣ״̬ + + if (tm1.tm_min > CHAR_getWorkInt(meindex, NPC_WORK_TALKFLAG) + && tm1.tm_min == 0) + { + // ֪ͨԱ + if (fmpks[fmpks_pos].flag == FMPKS_FLAG_SCHEDULED) + NPC_talkToFloor(CHAR_getInt(meindex, CHAR_FLOOR), + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, "׼ˣ"); + CHAR_setWorkInt(meindex, NPC_WORK_TALKFLAG, tm1.tm_min); + } + if ((fmpks[fmpks_pos].prepare_time > 0) && (fmpks[fmpks_pos].flag == FMPKS_FLAG_SCHEDULED)) + { + int clock = 0; + + NPC_FMBATTLESET(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, -1); + if (tm1.tm_hour - (fmpks[fmpks_pos].dueltime / 100) < 0) + clock = (fmpks[fmpks_pos].dueltime % 100) + fmpks[fmpks_pos].prepare_time - 60; + else + clock = fmpks[fmpks_pos].dueltime - (tm1.tm_hour * 100) + fmpks[fmpks_pos].prepare_time; + + if ((tm1.tm_min >= clock) && (fmpks[fmpks_pos].prepare_time > 0)) + { + + NPC_talkToFloor(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, "սޡ"); + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEBUSY); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_BUSY_LOOPTIME); + NPC_FMBATTLESET(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, 1); + +// print("\n won ==> set fmwaperman state busy !!"); + } + else if (tm1.tm_min > CHAR_getWorkInt(meindex, NPC_WORK_TIMEFLAG)) + { + char buf[256]; + int clock = 0; + CHAR_setWorkInt(meindex, NPC_WORK_TIMEFLAG, tm1.tm_min); + clock = ((fmpks[fmpks_pos].dueltime % 100) + fmpks[fmpks_pos].prepare_time) - tm1.tm_min; + if (clock >= 60) clock = clock - 60; + sprintf(buf, "սʱ仹ʣ£%4d", clock); + NPC_talkToFloor(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, buf); + } + } + }else if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEBUSY){ + // 鳡жʤ + int num1 = 0, num2 = 0; + int winflag = 0; + int floor = CHAR_getWorkInt(meindex, NPC_WORK_WARPFLOOR); + int meid = CHAR_getWorkInt(meindex, NPC_WORK_ID); + +// print("\n won ==> check_winner : npc_meid(%d)", meid ); + + NPC_GetPKFMNum(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, &num1, &num2); + NPC_FMBATTLESET(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, 1); + CheckLeavePK(meindex, floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index); + + if (meid > MANORNUM){ + if (tm1.tm_min == FMWARPMAN_CLEANPLACE){ + // жʤWARP볡趨ΣУ״̬ + NPC_BattleOut(fmpks[fmpks_pos].host_index, fmpks[fmpks_pos].guest_index); + NPC_FMBATTLESET(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, -1); + if (fmpks[fmpks_pos].win == 0){// ս + if (num1 > num2) + winflag = 1; + else if(num1 < num2) + winflag = 2; + else + winflag = 3; + }else if (fmpks[fmpks_pos].win == 1){ // ս + if ((CHAR_getWorkInt(meindex, NPC_WORK_FMNUMI) - num1) < (CHAR_getWorkInt(meindex, NPC_WORK_FMNUMII) - num2)) + winflag = 1; + else if ((CHAR_getWorkInt(meindex, NPC_WORK_FMNUMI) - num1) > (CHAR_getWorkInt(meindex, NPC_WORK_FMNUMII) - num2)) + winflag = 2; + else + winflag = 3; + } + } + } + if ((num1 == 0) && (num2 != 0)){ + winflag = 2; + }else if ((num2 == 0) && (num1 != 0)){ + winflag = 1; + }else if ((num1 == 0) && (num2 == 0)){ //ƽ趨طӮ + winflag = 1; + } + if (winflag > 0 && winflag < 3){ +#ifdef _MANOR_PKRULE + if(meid > MANORNUM){ +#endif + // ˼pk + if (winflag == 1){ + saacproto_ACFixFMPK_send(acfd, + fmpks[fmpks_pos].host_name, + fmpks[fmpks_pos].host_index + 1, + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].guest_index + 1, + fmpks[fmpks_pos].guest_index); + } else { + saacproto_ACFixFMPK_send(acfd, + fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].guest_index + 1, + fmpks[fmpks_pos].guest_index, + fmpks[fmpks_pos].host_name, + fmpks[fmpks_pos].host_index + 1, + fmpks[fmpks_pos].host_index); + } +#ifdef _MANOR_PKRULE + } +#endif + + { + if (meid > 0 && meid <= MANORNUM){// CoolFish 2002/2/25 Change MANOR -> MANORNUM +#ifdef _NEW_MANOR_LAW + int i,iFmIndex1,iFmIndex2,iCharindex; +#endif + fmpks[fmpks_pos + 1].flag = FMPKS_FLAG_MANOR_BATTLEEND; + if (winflag == 1){ + char token[256]; + sprintf( token, " (%d:%d) %d/%d/%d", + tm1.tm_hour, tm1.tm_min, + tm1.tm_year+1900, tm1.tm_mon+1, tm1.tm_mday); + saacproto_ACFixFMPoint_send(acfd, + fmpks[fmpks_pos].host_name, + fmpks[fmpks_pos].host_index + 1, + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].guest_index + 1, + fmpks[fmpks_pos].guest_index, meid); + //Syu ׯ԰սʤLog + Logfmpk( + fmpks[fmpks_pos].host_name, + fmpks[fmpks_pos].host_index, + num1, + fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].guest_index, + num2, token, "", "", 2); +#ifdef _NEW_MANOR_LAW + // ԭסׯ԰,Աɵõʯ + iFmIndex1 = fmpks[fmpks_pos].host_index; + for(i=0;i= 0 && CHAR_getCharUse(iCharindex)){ + // ýǮ = * 5000 + int iAddGold = ((float)CHAR_getInt(iCharindex,CHAR_MOMENTUM)/100.0f) * 5000.0f; + int iGold = CHAR_getInt(iCharindex,CHAR_BANKGOLD),iMaxGold; + // ȷ + if(iGold + iAddGold > CHAR_MAXBANKGOLDHAVE){ + CHAR_setInt(iCharindex,CHAR_BANKGOLD,CHAR_MAXBANKGOLDHAVE); + // зŲ,ŵ + iAddGold = iGold + iAddGold - CHAR_MAXBANKGOLDHAVE; + iGold = CHAR_getInt(iCharindex,CHAR_GOLD); + iMaxGold = CHAR_getMaxHaveGold(iCharindex); + if(iGold + iAddGold > iMaxGold) CHAR_setInt(iCharindex,CHAR_GOLD,iMaxGold); + else CHAR_setInt(iCharindex,CHAR_GOLD,iGold + iAddGold); + LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME), + CHAR_getChar(iCharindex,CHAR_CDKEY), + CHAR_getChar(iCharindex,CHAR_NAME), + CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,0); + } + else{ + CHAR_setInt(iCharindex,CHAR_BANKGOLD,iGold + iAddGold); + LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME), + CHAR_getChar(iCharindex,CHAR_CDKEY), + CHAR_getChar(iCharindex,CHAR_NAME), + CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,1); + } + CHAR_talkToCli(iCharindex,-1,"!ػסׯ԰Ľѻĸ",CHAR_COLORRED); + } + } +#endif + } + else if (winflag == 2){ + char token[256]; + sprintf( token, " (%d:%d) %d/%d/%d", + tm1.tm_hour, tm1.tm_min, + tm1.tm_year+1900, tm1.tm_mon+1, tm1.tm_mday); +#ifdef _FM_POINT_PK + int fmid; + char fmindex[4]; + for (fmid=0; fmid=0 && fmid= 0 && CHAR_getCharUse(iCharindex)){ + CHAR_setInt(iCharindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(iCharindex,-1,"ׯ԰ս˼ƹ",CHAR_COLORRED); + } + iCharindex = familyMemberIndex[iFmIndex2][i]; + if(iCharindex >= 0 && CHAR_getCharUse(iCharindex)){ + CHAR_setInt(iCharindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(iCharindex,-1,"ׯ԰ս˼ƹ",CHAR_COLORRED); + } + } +#endif + } + } + if (winflag == 1) + { + CHAR_setWorkChar(meindex, NPC_WORK_WINFMNAME, fmpks[fmpks_pos].host_name); + } + else if (winflag == 2) + { + CHAR_setWorkChar(meindex, NPC_WORK_WINFMNAME, fmpks[fmpks_pos].guest_name); + } + NPC_WarpFamily(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + CHAR_getInt(meindex, CHAR_FLOOR), + CHAR_getInt(meindex, CHAR_X), + CHAR_getInt(meindex, CHAR_Y)); + if (meid > MANORNUM){// CoolFish 2002/2/25 Change MANOR -> MANORNUM + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEWAIT); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_WAIT_LOOPTIME); + } + }else if( winflag == 3 ){ + if (meid > 0 && meid <= MANORNUM) // CoolFish 2002/2/25 Change MANOR -> MANORNUM + + fmpks[fmpks_pos + 1].flag = FMPKS_FLAG_MANOR_BATTLEEND; + NPC_talkToFloor(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, "˫ƽ֣ʤ"); + NPC_WarpFamily(floor, fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + CHAR_getInt(meindex, CHAR_FLOOR), + CHAR_getInt(meindex, CHAR_X), + CHAR_getInt(meindex, CHAR_Y)); + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEWAIT); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_WAIT_LOOPTIME); + } + }else if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEWAIT){ + + // andy_edit 2002/07/29 + if (tm1.tm_min == FMWARPMAN_CLEANPLACE) + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_FREE_LOOPTIME); + + NPC_CleanPK(floor, meindex); + + if (tm1.tm_min == 0){ + int iFmIndex1 = fmpks[fmpks_pos].host_index; + int iFmIndex2 = fmpks[fmpks_pos].guest_index; + int i,iCharindex; + for(i=0;i= 0 && CHAR_getCharUse(iCharindex)){ + CHAR_setInt(iCharindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(iCharindex,-1,"ׯ԰ս˼ƹ",CHAR_COLORRED); + } + iCharindex = familyMemberIndex[iFmIndex2][i]; + if(iCharindex >= 0 && CHAR_getCharUse(iCharindex)){ + CHAR_setInt(iCharindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(iCharindex,-1,"ׯ԰ս˼ƹ",CHAR_COLORRED); + } + } + CHAR_setWorkInt(meindex, NPC_WORK_MODEFLAG, NPC_STATEFREE); + // shan add + NPC_FMBATTLESET(floor, fmpks[fmpks_pos].host_index, fmpks[fmpks_pos].guest_index, -1); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, FMWARPMAN_FREE_LOOPTIME); + // fmwarpman ʼ + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMI, 0); + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMII, 0); + CHAR_setWorkInt(meindex, NPC_WORK_TIMEFLAG, 0); + CHAR_setWorkInt(meindex, NPC_WORK_TALKFLAG, -1); + CHAR_setWorkChar(meindex, NPC_WORK_WINFMNAME, ""); + } + } +} + +void NPC_FMWarpManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024], buff2[256], tmpbuf[256]; + int fl, x, y, fmpks_pos, fd; + + if( !CHAR_CHECKINDEX( talkerindex) )return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + if(select==WINDOW_BUTTONTYPE_OK){ + return; + } + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + // shan add + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + + if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index){ + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP1", buf, sizeof( buf)) == NULL ){ + print("FM WARPMAN Can't Read WARP1!\n"); + return; + } + }else if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index){ + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP2", buf, sizeof( buf)) == NULL ){ + print("FM WARPMAN Can't Read WARP2!\n"); + return; + } + }else{ + CHAR_talkToCli( talkerindex, meindex, "㲢Ƕս˫һԱ", CHAR_COLORYELLOW); + return; + } + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl=atoi(buff2); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y=atoi(buff2); + + + switch (seqno){ + case CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN: + if(select==WINDOW_BUTTONTYPE_YES){ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return; + if(CHAR_getWorkInt(talkerindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + CHAR_talkToCli( talkerindex, meindex, "ɢŶӣ", CHAR_COLORYELLOW); + return; + } + + if(CHAR_getWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD) <= 0){ + if( CHAR_getWorkInt( talkerindex, CHAR_WORKWARPCHECK ) == TRUE ) { + if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEFREE){ + if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index){ + int tmpnum1 = CHAR_getWorkInt(meindex, NPC_WORK_FMNUMI) + 1; + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMI, tmpnum1); + }else if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index){ + int tmpnum2 = CHAR_getWorkInt(meindex, NPC_WORK_FMNUMII) + 1; + CHAR_setWorkInt(meindex, NPC_WORK_FMNUMII, tmpnum2); + }else{ + CHAR_talkToCli( talkerindex, meindex, "㲢Ƕս˫һԱ", CHAR_COLORYELLOW); + } + CHAR_setWorkInt(talkerindex, CHAR_WORKFMPKFLAG, 1); + CHAR_setWorkInt(talkerindex, CHAR_WORKFMMANINDEX, meindex); + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); + CHAR_warpToSpecificPoint(talkerindex, fl, x,y); +/* { + FILE *fp; + struct tm tm1; + char szFileName[128]; + + memcpy(&tm1, localtime((time_t *)&NowTime.tv_sec), sizeof(tm1)); + memset(szFileName,0,sizeof(szFileName)); + sprintf(szFileName,"FMPkWarp.%d%d%d.log",tm1.tm_mon,tm1.tm_hour,tm1.tm_min); + fp = fopen(szFileName,"a+"); + if(fp != NULL){ + fprintf(fp,"FMName:%s\tName:%s\tWarpHost:%d\tWarpGuest:%d\tFloor:%d,%d,%d\tMaxPlayer:%d\n", + CHAR_getChar(talkerindex,CHAR_FMNAME),CHAR_getChar(talkerindex,CHAR_NAME), + CHAR_getWorkInt(meindex,NPC_WORK_FMNUMI), + CHAR_getWorkInt(meindex,NPC_WORK_FMNUMII), + fl,x,y, + fmpks[fmpks_pos].max_player); + fclose(fp); + } + else printf("%s(errno:%x)\n",sys_errlist[errno],errno); + } +*/ + } + else return; + { + struct tm tm1; + int clock = 0; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + memcpy(&tm1, localtime((time_t *)&NowTime.tv_sec), sizeof(tm1)); + clock = ((fmpks[fmpks_pos].dueltime % 100) + fmpks[fmpks_pos].prepare_time) - tm1.tm_min; + if (clock >= 60) clock = clock - 60; + sprintf(tmpbuf, "\nȺ˫׼ٿս" + "\nսʱ벻Ҫdz뿪" + "\nӮʤļҲһ£" + "\nȴе볡" + "\nллĺ" + "\nսʱ仹ʣ£%4d", + clock); + lssproto_WN_send(fd, + WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString(tmpbuf, buff2, sizeof(buff2))); + } + } + } + else{ + if(CHAR_getInt(talkerindex,CHAR_GOLD) < CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)){ + NPC_ERR_FMDiSP( meindex, talkerindex, 2); + return ; + } + CHAR_DelGold( talkerindex, CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD )); + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); + CHAR_warpToSpecificPoint(talkerindex, fl, x,y); + } + } + break; + } +} + +void NPC_ERR_FMDiSP(int meindex,int talker,int errNO) +{ + + char token[1024]; + int i=0; + int otherindex; + int fd = getfdFromCharaIndex( talker); + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + + if(errNO==1){ + /*--ɡ ūƥ ƾ--*/ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PartyMsg",token, sizeof( token))==NULL) { + /*--ɬýľئľɣƱë--*/ + sprintf(token, "\n\n޷ŶӣȽɢŶӣ"); + } + + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE)==CHAR_PARTY_CLIENT){ + + }else{ + + /*--ĸ ƾ--*/ + /*--ɡ ū幻嶪ë--*/ + for( i=0 ; i < CHAR_PARTYMAX ;i++) + { + otherindex=CHAR_getWorkInt(talker,CHAR_WORKPARTYINDEX1+i); + + if(otherindex != -1){ + fd = getfdFromCharaIndex( otherindex); + + /*-ƥ˪--*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + } + } + return ; + } + + }else if (errNO==2){ + /*--ŻԻئƥʣ--*/ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "MoneyMsg", token, sizeof( token))==NULL){ + /*--ŻԻئмɬýľئգƱë Ի--*/ + sprintf(token,"\n\nǮƺࡣǮٹ"); + } + } + + /*-ƥ˪--*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +static void NPC_FMWarpMan_selectWindow( int meindex, int toindex, int num,int select) +{ + struct tm tm1; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf[256]; + char buf2[1024]; + char buf3[256]; + int fl = 0, num1 = 0, num2 = 0; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID) * MAX_SCHEDULE; + int floor = CHAR_getWorkInt(meindex, NPC_WORK_WARPFLOOR); + int fd = getfdFromCharaIndex( toindex); + if( fd == -1 ) { + fprint( "getfd err\n"); + return; + } + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + /*--ɬð̻P ׷ʧѻ϶ýľ¾ľľɰ׷ʧѼԻ*/ + if(strstr(npcarg,"%4d")!=NULL){ + NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP1", buf, sizeof( buf)); + getStringFromIndexWithDelim(buf,",",1,buf3,sizeof(buf3)); + fl = NPC_FMFloorUse(atoi(buf3)); + } + CHAR_setWorkInt(toindex, CHAR_WORKWARPCHECK, TRUE); + CHAR_setWorkInt(toindex, NPC_WORK_WARPFLOOR, fl); + memcpy(&tm1, localtime((time_t *)&NowTime.tv_sec), sizeof(tm1)); + + if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEFREE) + { + if (((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].guest_name) == 0))) + { + if(CHAR_getInt(toindex,CHAR_FMINDEX)<0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\n㻹ûмأˣ", token, sizeof(token))); + return; + } + if ((fmpks[fmpks_pos].host_index != -1) + && (CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index)) + { + // WON ADD pkԼս + + if(fmpks[fmpks_pos].flag == -1) return; + + if (fmpks[fmpks_pos].flag != FMPKS_FLAG_SCHEDULED) + + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nⳡսԷûͬأ\n´ǵԼԷǼǰɡ", token, sizeof(token))); + return; + } + + if(CHAR_getInt(toindex,CHAR_FMINDEX)<0) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\n㻹ûмأˣ", token, sizeof(token))); + return; + } + +#ifdef _FMVER21 + if (CHAR_getInt(toindex, CHAR_FMLEADERFLAG) == FMMEMBER_APPLY) +#else + if (CHAR_getInt(toindex, CHAR_FMLEADERFLAG) == 0) +#endif + { + char tmpbuf[256]; + sprintf(tmpbuf, "\n㻹ûʽ%s壬Բܽ", fmpks[fmpks_pos].host_name); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString(tmpbuf, token, sizeof(token))); + return; + } + //andy_add 2003/06/17 + CHECK_FMPknumInFloor( meindex); + if (CHAR_getWorkInt(meindex, NPC_WORK_FMNUMI) > (fmpks[fmpks_pos].max_player - 1)){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, makeEscapeString("\nѾٽȥޡ\nѾ趨ˣ", token, sizeof(token))); + return; + } + } + else if ((fmpks[fmpks_pos].guest_index != -1) + && (CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index)) + { + // WON ADD pkԼս + + if(fmpks[fmpks_pos].flag == -1) return; + + if (fmpks[fmpks_pos].flag != FMPKS_FLAG_SCHEDULED) + + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("\nⳡսûͬأ\n´ǵȷϡ", token, sizeof(token))); + return; + } +#ifdef _FMVER21 + if (CHAR_getInt(toindex, CHAR_FMLEADERFLAG) == FMMEMBER_APPLY) +#else + if (CHAR_getInt(toindex, CHAR_FMLEADERFLAG) == 0) +#endif + { + char tmpbuf[256]; + sprintf(tmpbuf, "\n㻹ûʽ%s壬Բܽ", fmpks[fmpks_pos].guest_name); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString(tmpbuf, token, sizeof(token))); + return; + } + //andy_add 2003/06/17 + CHECK_FMPknumInFloor( meindex); + if( CHAR_getWorkInt( meindex, NPC_WORK_FMNUMII) > (fmpks[fmpks_pos].max_player - 1)){ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString("Ѿٽȥޡ\nѾ趨ˣ", token, sizeof(token))); + return; + } + } + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "FreeMsg", buf2, sizeof( buf2)) == NULL) return; + CONNECT_set_pass(fd, TRUE); + CONNECT_set_first_warp(fd, TRUE); + sprintf(token, buf2, fmpks[fmpks_pos].guest_name, fmpks[fmpks_pos].host_name, + tm1.tm_hour, tm1.tm_min); + CHAR_setWorkInt( toindex , CHAR_WORKFMMANINDEX, meindex ); + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -1 ); + } else if ((((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].guest_name) == 0))) + && (((fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_SCHEDULED) + || (fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_MANOR_PREPARE))) + ) + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NextMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2, fl, tm1.tm_hour, tm1.tm_min); + CONNECT_set_pass(fd, FALSE); + CONNECT_set_first_warp(fd, FALSE); + } + else if ((strcmp(fmpks[fmpks_pos].host_name, "") == 0) || (strcmp(fmpks[fmpks_pos].guest_name, "") == 0)) + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "TalkMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2); + CONNECT_set_pass(fd, FALSE); + CONNECT_set_first_warp(fd, FALSE); + } + else + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "AskMsg", buf2, sizeof( buf2)) == NULL) return; + CONNECT_set_pass(fd, FALSE); + CONNECT_set_first_warp(fd, FALSE); + sprintf(token, buf2, fmpks[fmpks_pos].guest_name, fmpks[fmpks_pos].host_name); + } + } + else if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEBUSY) // ս + { + if (((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].guest_name) == 0))) + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "BusyMsg", buf2, sizeof( buf2)) == NULL){ + print("\nGet BusyMsg Message Error"); + return; + } + NPC_GetPKFMNum(floor, + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + &num1, &num2); + sprintf(token, buf2, + fmpks[fmpks_pos].host_name, num1, + fmpks[fmpks_pos].guest_name, num2, + tm1.tm_hour, tm1.tm_min); + } else if ((((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].guest_name) == 0))) + && (((fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_SCHEDULED) + || (fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_MANOR_PREPARE))) + ) + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NextMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2, fl, tm1.tm_hour, tm1.tm_min); + } else { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "AskMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2, fmpks[fmpks_pos].guest_name, fmpks[fmpks_pos].host_name); + } + CONNECT_set_pass(fd, FALSE); + CONNECT_set_first_warp(fd, FALSE); + } + else if (CHAR_getWorkInt(meindex, NPC_WORK_MODEFLAG) == NPC_STATEWAIT) // ս + { + if (((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos].guest_name) == 0))) + { + char tmpbuf[256]; + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "EndMsg", buf2, sizeof( buf2)) == NULL){ + print("\nGet EndMsg Message Error"); + return; + } + NPC_GetPKFMNum(floor, + fmpks[fmpks_pos].host_index, + fmpks[fmpks_pos].guest_index, + &num1, &num2); + if (strcmp(CHAR_getWorkChar(meindex, NPC_WORK_WINFMNAME), "") == 0) + sprintf(tmpbuf, "˫ƽ֣"); + else sprintf(tmpbuf, "%sʤˣ", CHAR_getWorkChar(meindex, NPC_WORK_WINFMNAME)); + sprintf(token, buf2, fmpks[fmpks_pos].guest_name, + fmpks[fmpks_pos].host_name, tmpbuf); + } else if ((((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].host_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].host_name) == 0)) + || ((CHAR_getWorkInt(toindex, CHAR_WORKFMINDEXI) == fmpks[fmpks_pos + 1].guest_index) + && (strcmp(CHAR_getChar(toindex, CHAR_FMNAME), fmpks[fmpks_pos + 1].guest_name) == 0))) + && (((fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_SCHEDULED) + || (fmpks[fmpks_pos + 1].flag == FMPKS_FLAG_MANOR_PREPARE))) + ) + { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NextMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2, fl, tm1.tm_hour, tm1.tm_min); + } else { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "AskMsg", buf2, sizeof( buf2)) == NULL) return; + sprintf(token, buf2, fmpks[fmpks_pos].guest_name, fmpks[fmpks_pos].host_name); + } + CONNECT_set_pass(fd, FALSE); + CONNECT_set_first_warp(fd, FALSE); + } + /*-ƥ˪--*/ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +int NPC_FMFloorUse(int floor) +{ + int i; + int players = 0; + int playernum = CHAR_getPlayerMaxNum(); + + /* */ + for( i=0 ; i< playernum ; i++ ){ + if( CHAR_getCharUse(i) == FALSE )continue; + if(CHAR_getInt(i,CHAR_FLOOR)==floor){ + players++; + } + } + return players; +} + +void NPC_GetPKFMNum(int floor, int index1, int index2, int *num1, int *num2) +{ + int i = 0, charindex; + + *num1 = 0; *num2 = 0; + + /* */ + for (i = 0 ; i < FAMILY_MAXMEMBER; i++ ){ + charindex = familyMemberIndex[ index1][i]; + if( CHAR_getCharUse( charindex) ){ + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor) + *num1 = *num1 + 1; + }else + familyMemberIndex[ index1][i] = -1; + + charindex = familyMemberIndex[index2][i]; + if (CHAR_getCharUse(charindex)){ + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor) + *num2 = *num2 + 1; + }else + familyMemberIndex[ index2][i] = -1; + } + +} + +void NPC_FMBATTLESET(int floor, int index1, int index2, int flag) +{ + int i = 0, charindex; + + for (i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex = familyMemberIndex[index1][i]; + if (CHAR_getCharUse(charindex)) + { + if (CHAR_getInt(charindex ,CHAR_FLOOR) == floor) + { + CHAR_setWorkInt( charindex, CHAR_WORKBATTLEFLAG, flag); + if(flag==1) + CHAR_setFlg(charindex, CHAR_ISDUEL, 1); + } + } + else + familyMemberIndex[index1][i] = -1; + charindex = familyMemberIndex[index2][i]; + if (CHAR_getCharUse(charindex)) + { + if (CHAR_getInt(charindex ,CHAR_FLOOR) == floor) + { + CHAR_setWorkInt( charindex, CHAR_WORKBATTLEFLAG, flag); + if(flag==1) + CHAR_setFlg(charindex, CHAR_ISDUEL, 1); + } + } + else + familyMemberIndex[index2][i] = -1; + } +} + +void NPC_CleanPK(int floor, int meindex) +{ + int i; + int playernum = CHAR_getPlayerMaxNum(); + int fl = CHAR_getInt(meindex, CHAR_FLOOR); + int x = CHAR_getInt(meindex, CHAR_X); + int y = CHAR_getInt(meindex, CHAR_Y); + + for( i=0 ; i< playernum ; i++ ) + { + if( CHAR_getCharUse(i) == FALSE )continue; + if(CHAR_getInt(i,CHAR_FLOOR)==floor) + CHAR_warpToSpecificPoint(i, fl, x, y); + } +} + +void NPC_talkToFloor(int floor, int index1, int index2, char *data) +{ + int i = 0, charindex; + + for (i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex = familyMemberIndex[index1][i]; + if (CHAR_getCharUse(charindex)) + { +// print("charname:%s fmname:%s\n", +// CHAR_getChar(charindex, CHAR_NAME), +// CHAR_getChar(charindex, CHAR_FMNAME)); + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor) + CHAR_talkToCli(charindex, -1, data, CHAR_COLORYELLOW); + } + else + familyMemberIndex[index1][i] = -1; + charindex = familyMemberIndex[index2][i]; + if (CHAR_getCharUse(charindex)) + { +// print("charname:%s fmname:%s\n", +// CHAR_getChar(i, CHAR_NAME), +// CHAR_getChar(i, CHAR_FMNAME)); + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor) + CHAR_talkToCli(charindex, -1, data, CHAR_COLORRED); + } + else + familyMemberIndex[index2][i] = -1; + } +} + +void NPC_WarpFamily(int floor, int index1, int index2, int fl, int x, int y) +{ + int i, charindex1, charindex2; + + for (i = 0; i < FAMILY_MAXMEMBER; i++){ + charindex1 = familyMemberIndex[index1][i]; + charindex2 = familyMemberIndex[index2][i]; + if (CHAR_getCharUse(charindex1)) + { + if (CHAR_getInt(charindex1, CHAR_FLOOR) == floor) + { + CHAR_setWorkInt(charindex1, CHAR_WORKBATTLEFLAG, FALSE); + CHAR_warpToSpecificPoint(charindex1, fl, x, y); + } + } + else + familyMemberIndex[index1][i] = -1; + if (CHAR_getCharUse(charindex2)) + { + if (CHAR_getInt(charindex2, CHAR_FLOOR) == floor) + { + CHAR_setWorkInt(charindex2, CHAR_WORKBATTLEFLAG, FALSE); + CHAR_warpToSpecificPoint(charindex2, fl, x, y); + } + } + else + familyMemberIndex[index1][i] = -1; + } +} + +void NPC_BattleOut(int index1, int index2) +{ + int i, charindex1, charindex2; + + for (i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex1 = familyMemberIndex[index1][i]; + charindex2 = familyMemberIndex[index2][i]; + if(CHAR_getCharUse(charindex1)){ + if(CHAR_getWorkInt( charindex1, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + BATTLE_WatchStop(charindex1); + } + else + familyMemberIndex[index1][i] = -1; + + if(CHAR_getCharUse(charindex2)){ + if(CHAR_getWorkInt( charindex2, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + BATTLE_WatchStop(charindex2); + } + else + familyMemberIndex[index2][i] = -1; + } +} + +void CheckLeavePK(int npcindex, int floor, int index1, int index2) +{ + int i = 0, charindex, fl = 0, x = 0, y = 0; + fl = CHAR_getInt(npcindex, CHAR_FLOOR); + x = CHAR_getInt(npcindex, CHAR_X); + y = CHAR_getInt(npcindex, CHAR_Y); + + for (i = 0; i < FAMILY_MAXMEMBER; i++) + { + charindex = familyMemberIndex[index1][i]; + if (CHAR_getCharUse(charindex)){ + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor){ + if (CHAR_getWorkInt(charindex, CHAR_WORKFMPKFLAG) < 0){ + if (CHAR_getWorkInt(charindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + CHAR_DischargeParty( charindex, 0); + CHAR_setWorkInt(charindex, CHAR_WORKWARPCHECK, FALSE); + CHAR_setWorkInt(charindex, CHAR_WORKBATTLEFLAG, FALSE); + CHAR_warpToSpecificPoint(charindex, fl, x, y); + CHAR_talkToCli(charindex, -1, "ս볡", CHAR_COLORRED); + } + } + }else + familyMemberIndex[index1][i] = -1; + charindex = familyMemberIndex[index2][i]; + if (CHAR_getCharUse(charindex)){ + if (CHAR_getInt(charindex, CHAR_FLOOR) == floor){ + if (CHAR_getWorkInt(charindex, CHAR_WORKFMPKFLAG) < 0){ + if (CHAR_getWorkInt(charindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + CHAR_DischargeParty(charindex, 0); + CHAR_setWorkInt(charindex, CHAR_WORKWARPCHECK, FALSE); + CHAR_setWorkInt(charindex, CHAR_WORKBATTLEFLAG, FALSE); + CHAR_warpToSpecificPoint(charindex, fl, x, y); + CHAR_talkToCli(charindex, -1, "ս볡", CHAR_COLORRED); + } + } + }else + familyMemberIndex[index2][i] = -1; + } +} diff --git a/npc/npc_freepetskillshop.c b/npc/npc_freepetskillshop.c new file mode 100644 index 0000000..ac4494d --- /dev/null +++ b/npc/npc_freepetskillshop.c @@ -0,0 +1,573 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "readmap.h" +#include "battle.h" +#include "configfile.h" +#include "util.h" +#include "npc_eventaction.h" +#include "npc_freepetskillshop.h" +#ifdef _PETSKILL_SHOP_LUA +#include "mylua/function.h" +#endif +#ifdef _CFREE_petskill + +enum { + CHAR_WORK_SKILLSELECT = CHAR_NPCWORKINT1, +}; + +enum { + SELECTSKILL_START=10, + SELECTSKILL_TEACH=23, + SELECTSKILL_END=30, +}; + +enum { + START_WINDOW=0, + SKILL_WINDOW, + MEEND_WINDOW, +}; + +static void NPC_FreePetSkillShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL NPC_FreePetSkillMakeStr(int meindex,int toindex, int select); +//BOOL NPC_CHECKFREEPETSKILL( int toindex, int petindex, int skillID); +BOOL NPC_SkillShopItemCheck(int meindex,int talker,int itemNo, int cou); +BOOL NPC_SkillShopDelItems(int meindex,int talker, char *buf); +BOOL NPC_SkillShopPetCheck( int toindex, int petindex, int skillID ); +BOOL NPC_SkillShopWarp( int meindex, int talkindex); + +#define MAXNPCPOINT 10 + +BOOL NPC_FreePetSkillShopInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_FREESKILLSHOP ); + CHAR_setWorkInt( meindex, CHAR_WORK_SKILLSELECT, 0); + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr NO arg !!"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "pet_skill", msg, sizeof( msg)) != NULL){ + char buf[256], filename[256]; + int k=1, skillID, skillarray; + while( getStringFromIndexWithDelim( msg, ",", k, buf, sizeof( buf) ) ){ + k++; + skillID=atoi(buf); + skillarray = PETSKILL_getPetskillArray( skillID); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1){ + if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ){ + print("\n\ܲ淶:[%d-%s] ->ļ:%s\n", + skillID, + PETSKILL_getChar( skillarray, PETSKILL_NAME), + filename ); + } + } + } + }else{ + return FALSE; + } + + return TRUE; +} +void NPC_FreePetSkillShopTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1 ); + + NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, START_WINDOW,-1); +} + +static void NPC_FreePetSkillShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + int fd = getfdFromCharaIndex( toindex); + int buttontype = 0, windowtype = 0, windowno = 0; + char buf1[256]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + + switch(num) { + case START_WINDOW: + { + BOOL Evflg = TRUE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "start_msg", token, sizeof( token)) == NULL) { + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + if( CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) != 1 ) { + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + //ж + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1)) != NULL ) { + if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE ) { + Evflg = FALSE; + } + } + if( Evflg == FALSE) { + CHAR_talkToCli( toindex, -1, "óѧ⼼ܣร", CHAR_COLORYELLOW); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + return; + }else { + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowno = SELECTSKILL_START; + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 2); + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token ); + } + } + break; + case SKILL_WINDOW: + if( NPC_FreePetSkillMakeStr( meindex, toindex, select) == FALSE ) { + print("\n npc_freepetskillshop.c "); + } + break; + case MEEND_WINDOW: + break; + } +} + +void NPC_FreePetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int skill; + int pet; + int slot; + int cost; + int skillID=0; + int petskillindex; + char buf[64]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[512]; + int petindex; + char msgbuf[128]; + double rate= 1.0; + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) + return ; + + + switch( seqno) { + case SELECTSKILL_START: + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 2 ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1); + break; + case SELECTSKILL_TEACH: + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 3 ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + makeStringFromEscaped( data); + getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); + skill=atoi(buf); + getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf)); + pet=atoi(buf); + getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf)); + slot=atoi(buf); + getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf)); + cost=atoi(buf); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + skillID=atoi(buf); + } + slot--; + if( slot < 0 ) return; + + petindex = CHAR_getCharPet( talkerindex, pet-1); + if( !CHAR_CHECKINDEX(petindex) ){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate = atof( msg); + } + petskillindex = PETSKILL_getPetskillArray( skillID ); + if( !PETSKILL_CHECKINDEX( petskillindex)){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + + cost = PETSKILL_getInt( petskillindex, PETSKILL_COST ); + cost = cost * rate; + + //ж + if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } +#ifdef _PETSKILL_SHOP_LUA + if(FreePetSkillShop(talkerindex, petindex, CHAR_getPetSkill(petindex, slot), skillID) == FALSE ) { + return; + } +#endif + if( NPC_CHECKFREEPETSKILL( talkerindex, petindex, skillID ) == TRUE ){ + + if( Action_RunDoEventAction( meindex, talkerindex, argstr) == FALSE ){ + CHAR_talkToCli( talkerindex, -1, "Ʒ!!", CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + + CHAR_setPetSkill( petindex, slot, skillID); + CHAR_setInt( talkerindex, CHAR_GOLD, ( CHAR_getInt( talkerindex, CHAR_GOLD) - cost) ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1); + CHAR_sendStatusString( talkerindex, msgbuf ); + CHAR_sendStatusString( talkerindex, "P"); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + //WARP + if( NPC_SkillShopWarp( meindex, talkerindex) == TRUE ) + return; + }else { + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + CHAR_talkToCli( talkerindex, -1, "!!", CHAR_COLORYELLOW); + } + //ADD + NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1); + break; + case SELECTSKILL_END: + break; + } + + return; +} + +BOOL NPC_CHECKFREEPETSKILL( int toindex, int petindex, int skillID) +{ + int skillindex=-1; + char SCode[256]; + char Free[256]; + int i, petID; + skillindex = PETSKILL_getPetskillArray( skillID ); + memset( Free, 0, sizeof( Free)); + if( !PETSKILL_CHECKINDEX( skillindex) ) { + return FALSE; + } + + petID = CHAR_getInt( petindex, CHAR_PETID); + sprintf( SCode, "%s", PETSKILL_getChar( skillindex, PETSKILL_KINDCODE)); + sprintf( Free, "%s", PETSKILL_getChar( skillindex, PETSKILL_FREE)); + + //CHECK CODE + if( !strcmp( SCode, "\0")) { + return TRUE; + } + + for( i=0; i= cou ) + return TRUE; + } + return FALSE; + +} + +BOOL NPC_SkillShopDelItems(int meindex,int talker, char *buf) +{ + char buf1[256]; + char item[256], cout[256]; + int i=1; + BOOL Evflg=TRUE; + while( getStringFromIndexWithDelim( buf, ",", i,buf1, sizeof( buf1)) != FALSE ) { + i++; + if( strstr( buf1, "*") != NULL ) { + getStringFromIndexWithDelim( buf1, "*", 1, item, sizeof( item)); + getStringFromIndexWithDelim( buf1, "*", 2, cout, sizeof( cout)); + }else { + strcpy( item, buf1); + strcpy( cout, "1"); + } + if( NPC_SkillShopItemCheck( meindex, talker, atoi( item), atoi( cout)) == FALSE ) { + Evflg=FALSE; + break; + } + if( Evflg == FALSE ) + break; + } + if( Evflg == FALSE ) + return FALSE; + if( NPC_ActionDelItem( talker, buf) == TRUE ) { + return TRUE; + } + return FALSE; +} + +BOOL NPC_SkillShopPetCheck( int toindex, int petindex, int skillID ) +{ + char Free[256]; + int i; + char data[256], msg[256]; + int skillindex = PETSKILL_getPetskillArray( skillID ); + + memset( Free, 0, sizeof( Free)); + sprintf( Free, "%s", PETSKILL_getChar( skillindex, PETSKILL_FREE)); + + if( NPC_Util_GetStrFromStrWithDelim( Free, "FREE", data, sizeof( data)) != NULL ) { + BOOL EvFlg = TRUE; + i=1; + while( getStringFromIndexWithDelim( data, "|", i, msg, sizeof( msg)) != FALSE ) { + i++; + if( strstr( msg, "LV") != NULL ) { + char LvStr[256]; + int LV=0; + if( strstr( msg, ">" ) != NULL ) { + if( getStringFromIndexWithDelim( msg, ">", 2, LvStr, sizeof( LvStr)) != FALSE ) { + LV = atoi( LvStr); + if( CHAR_getInt( petindex, CHAR_LV) <= LV ) + EvFlg = FALSE; + } + }else if( strstr( msg, "<")) { + if( getStringFromIndexWithDelim( msg, "<", 2, LvStr, sizeof( LvStr)) != FALSE ) { + LV = atoi( LvStr); + if( CHAR_getInt( petindex, CHAR_LV) >= LV ) + EvFlg = FALSE; + } + } + }else if( strstr( msg, "SK") != NULL ) { + int j=0, PskId=-1, ID; + char strSK[256]; + int petskillindex; + + getStringFromIndexWithDelim( msg, "=", 2, strSK, sizeof( strSK) ); + ID = atoi( strSK); + for( j=0; j < CHAR_MAXPETSKILLHAVE; j++) { + PskId = CHAR_getPetSkill( petindex, j); + petskillindex = PETSKILL_getPetskillArray( PskId ); + if( !PETSKILL_CHECKINDEX( petskillindex)) + continue; + if( ID == PskId ) { + if( strstr( msg, "!=") !=NULL ) + EvFlg = FALSE; + break; + } + } + if( j == CHAR_MAXPETSKILLHAVE ) { + EvFlg = FALSE; + break; + } + } + if( EvFlg == FALSE ) + break; + } + if( EvFlg == FALSE ) { + return FALSE; + }else { + return TRUE; + } + } + return TRUE; +} + +BOOL NPC_SkillShopWarp( int meindex, int talkindex) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char data[1024], buf1[256], buf2[256]; + int i=1, j=1; + BOOL EvFlg=FALSE; + struct { + int FLOOR; + int X; + int Y; + }Points[MAXNPCPOINT]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + for( i=0;i= MAXNPCPOINT ) + break; + } + where = RAND( 0, i-1); + CHAR_warpToSpecificPoint( meindex, Points[where].FLOOR, Points[where].X, Points[where].Y); + EvFlg = TRUE; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", data, sizeof( data)) != NULL ) { + int P_Floor,P_X,P_Y; + getStringFromIndexWithDelim( data, ",", 1, buf2, sizeof( buf2)); + P_Floor = atoi( buf2); + getStringFromIndexWithDelim( data, ",", 2, buf2, sizeof( buf2)); + P_X = atoi( buf2); + getStringFromIndexWithDelim( data, ",", 3, buf2, sizeof( buf2)); + P_Y = atoi( buf2); + CHAR_warpToSpecificPoint( talkindex, P_Floor, P_X, P_Y); + EvFlg = TRUE; + } + + return EvFlg; +} + +#endif + + + + + diff --git a/npc/npc_gamblebank.c b/npc/npc_gamblebank.c new file mode 100644 index 0000000..c9659df --- /dev/null +++ b/npc/npc_gamblebank.c @@ -0,0 +1,519 @@ +#include "version.h" +#include +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "enemy.h" +#include "log.h" +#include "battle.h" +#include "readmap.h" +#include "handletime.h" +#include "configfile.h" +#ifdef _GAMBLE_BANK +#include "npc_gamblebank.h" + +static void NPC_GambleBank_selectWindow( int meindex, int toindex, int num, int flg); +int NPC_GambleBank_DoGold( int meindex, int toindex, int Gold, int flg); +BOOL NPC_GambleBank_AddItem( int meindex, int toindex, int itemId, int count); + +enum { + GAMBLE_START = 0, + GAMBLE_SELET, + GAMBLE_MAN_BANK, + GAMBLE_MAN_CHANG1, + GAMBLE_MAN_CHANG2, + GAMBLE_END, +}; + +enum { + NPC_WORK_INDEX = CHAR_NPCWORKINT1, + NPC_WORK_WORKTYPE = CHAR_NPCWORKINT2, // 0,-1 = NULL 2 = 3 = 4 = BOTH + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT3, + NPC_WORK_PAGE = CHAR_NPCWORKINT4, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +#define _GAMBLEBANK_U_NOLOCK //ͬʱԶ + +#define GAMBLEBANK_LOOPTIME 80 +#define GAMBLEBANK_STANDBY 5000 +#define GAMBLEBANK_DEF 3 // / 100 +#define GAMBLEBANK_GETMAX 1000000 +#define GAMBLEBANK_GETMIN 100 +#define LIST_PAGE 7 +BOOL NPC_GambleBankInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[256]; + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_GAMBLEBANK ); + +#ifdef _GAMBLEBANK_U_NOLOCK + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, GAMBLEBANK_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); +#endif + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL) { + print("GambleBank:GetArgStrErr"); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim( npcarg,"GAMBLE_TYPE", buf1,sizeof( buf1) ) == NULL) { + print("GAMBLE_TYPE err !"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_WORKTYPE, atoi( buf1) ); + + return TRUE; +} +//CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); +void NPC_GambleBankLoop( int meindex) +{ +#ifdef _GAMBLEBANK_U_NOLOCK + + int fulltime = GAMBLEBANK_LOOPTIME; + if( ( CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + fulltime) >= NowTime.tv_sec ) + return; + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); +#endif + return; +} + +void NPC_GambleBankTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + char buf1[256]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + int work_type; + + if( !CHAR_CHECKINDEX( talkerindex) || !CHAR_CHECKINDEX( meindex) ) + return; + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) { + return; + } + } + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL) { + print("GambleBank:GetArgStrErr"); + return; + } +#ifdef _FIX_GAMBLENUM + if( CHAR_getInt( talkerindex, CHAR_GAMBLENUM) < 0 ) { + CHAR_setInt( talkerindex, CHAR_GAMBLENUM, 0); + } +#endif + if(NPC_Util_GetStrFromStrWithDelim( npcarg,"GAMBLE_TYPE", buf1,sizeof( buf1) ) == NULL) { + print("GAMBLE_TYPE err !"); + return; + } + + CHAR_setWorkInt( meindex, NPC_WORK_WORKTYPE, atoi( buf1) ); + work_type = CHAR_getWorkInt( meindex, NPC_WORK_WORKTYPE); + + + if( work_type < 1 || work_type > 4 ) { // 0 or -1 + strcpy( buf1,"ʱֹͣ"); + CHAR_talkToCli( talkerindex, meindex, buf1, CHAR_COLORYELLOW); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } +#ifdef _GAMBLEBANK_U_NOLOCK + +#else + if( CHAR_getWorkInt( meindex , NPC_WORK_INDEX) >= 0 ) { + strcpy( buf1,"æţ"); + CHAR_talkToCli( talkerindex, meindex, buf1, CHAR_COLORYELLOW); + return; + }else { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, talkerindex); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + } +#endif + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1); + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_START, 1); +} + +static void NPC_GambleBank_selectWindow( int meindex, int toindex, int num, int flg) +{ + char token[256]; + char buf1[256],buf2[256]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + int i; + int page=-1; + //flg <= 0 1 flg = 2 Ǯ 3 = ˴ + // 4 = н 5 = 6 = + char Gamble_End[][56] = { + "error_msg", "end_msg", "money_msg", "full_msg1", + "full_msg2","getmax_msg","getmin_msg", + }; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GambleBank:GetArgStrErr"); + return; + } + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + switch( num) { + case GAMBLE_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg,"gamble_start", token, sizeof( token) ) == NULL) { + print("gamble_start msg err !"); + return; + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_GambleBank_START; + break; + + case GAMBLE_SELET: + i = 1; + strcpy( token, "\0"); + sprintf( buf2,"%s%d", "gamble_msg0", i); + while( NPC_Util_GetStrFromStrWithDelim( npcarg, buf2, buf1, sizeof( buf1) ) != NULL ) { + if( strstr( buf1, "NULL" ) == NULL ) { + strcat( token , buf1); + strcat( token, "\n"); + }else { + strcat( token, "\n"); + } + i++; + sprintf( buf2,"%s%d", "gamble_msg0", i); + } + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno = NPC_GambleBank_SELECT; + break; + + case GAMBLE_MAN_BANK: // + sprintf( token,"%d", CHAR_getInt( toindex, CHAR_PERSONAGOLD ) ); + windowtype = WINDOW_MESSAGETYPE_BANK; + windowno = NPC_GambleBank_BANK; + break; + + case GAMBLE_MAN_CHANG1: // + { + char snum[256]; + page = CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT); + strcpy( token, ""); + sprintf( token, "%d֣뻻һƷأ\n", CHAR_getInt( toindex, CHAR_GAMBLENUM)); + for( i=(page*LIST_PAGE);i<(page*LIST_PAGE+LIST_PAGE);i++) { + if( i>=arraysizeof( GB_ITEMS)) { + break; + } + if( !strcmp( GB_ITEMS[i].name,"NEXT") ) { + strcat( token, " һҳ"); + break; + } + if( !strcmp( GB_ITEMS[i].name,"END") ) { + strcat( token, " ȡ\n"); + break; + } + + sprintf( snum,"%s%d\t%s", + "֣", GB_ITEMS[i].Gnum, + GB_ITEMS[i].name); + snum[36] = 0; + strcat( token, snum); + strcat( token,"\n"); + strcpy( snum, "\0"); + } + + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_NONE; + windowno = NPC_GambleBank_CHANG1; + } + break; + case GAMBLE_END: + CHAR_send_P_StatusString( toindex, CHAR_P_STRING_GOLD); + if( flg < 0 || flg > 6) { + flg = 0; + } + if( NPC_Util_GetStrFromStrWithDelim( npcarg, Gamble_End[flg], token, sizeof( token) ) == NULL) { + print("Gamble_End[%d] noe found !", flg); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, -1); +#ifdef _GAMBLEBANK_U_NOLOCK +#else + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); +#endif + windowno = NPC_GambleBank_END; + buttontype = WINDOW_BUTTONTYPE_OK; + break; + } + + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +void NPC_GambleBankWindowTalked ( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int stone_gold = 0; + int flg=1; + int work_type=-1; + int type; + type = atoi( data); + + if( !CHAR_CHECKINDEX( talkerindex) || !CHAR_CHECKINDEX( meindex) ) + return; + + work_type = CHAR_getWorkInt( meindex, NPC_WORK_WORKTYPE ); + if( work_type < 1 || work_type > 4 ) { + return; + } + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } +#ifdef _GAMBLEBANK_U_NOLOCK +#else + { + char buf1[256]; + if( CHAR_getWorkInt( meindex , NPC_WORK_INDEX) != talkerindex ) { + strcpy( buf1,"æأ"); + CHAR_talkToCli( talkerindex, meindex, buf1, CHAR_COLORYELLOW); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + } +#endif + + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + switch( seqno) { + case NPC_GambleBank_START: + if( select == WINDOW_BUTTONTYPE_YES ) { + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_SELET, flg); + }else { + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_END, flg); + } + break; + case NPC_GambleBank_SELECT: + if( type == 1 ) { // + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 2); + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_MAN_BANK, flg); + }else if( type == 2 ) { // + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_MAN_CHANG1, flg); + }else { + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_END, flg); + } + break; + case NPC_GambleBank_BANK: //2 + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 2 ) // + return; + if( work_type != 2 && work_type != 4 ) { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } + if( select == 4 && atoi( data) != 0 ) { + stone_gold = atoi( data); + flg = NPC_GambleBank_DoGold( meindex, talkerindex, stone_gold, select); + //flg = 1 flg = 2 Ǯ flg <= 0 + if( flg == 1 ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } + } + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_END, flg); + break; + case NPC_GambleBank_CHANG1: // + { + int page,ItemID; + int count; + type -=1; + page = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT)*LIST_PAGE; + if( work_type != 3 && work_type != 4 ) { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } + + if( page < 0 ) //Ի + return; + if( (page+type) < 0 || (page+type) >= arraysizeof( GB_ITEMS) ) { + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_END, flg); + }else if( !strcmp( GB_ITEMS[page+type].name,"NEXT") ){ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, + CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) + 1); + NPC_GambleBank_selectWindow( meindex, talkerindex, GAMBLE_MAN_CHANG1, flg); + }else if( !strcmp( GB_ITEMS[page+type].name,"END") ){ + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + }else { + if( type < 7 && type >= 0 ) { + if( GB_ITEMS[page+type].name == NULL || + !strcmp( GB_ITEMS[page+type].name, "\0") ) { + }else { + ItemID = GB_ITEMS[page+type].ItemId; //ID + count = GB_ITEMS[page+type].Gnum; // + NPC_GambleBank_AddItem( meindex, talkerindex, ItemID, count); + } + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + } + } + break; + case NPC_GambleBank_END: + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + break; + } +} + + +int NPC_GambleBank_DoGold( int meindex, int toindex, int Gold, int flg) +{ + //flg = 1 flg = 2 Ǯ flg <= 0 3 = ˴ 4 = н 5 = ߽ + char buf1[256]; + int player_gold = CHAR_getInt( toindex, CHAR_GOLD ); + int stone_def = 0; // +// int def = GAMBLEBANK_DEF; + //Ĵȡ + if( flg != 4 ) + return 0; + if( Gold == 0 ) { + return 0; + } + + if( Gold < 0 ) { //ȡ + Gold *=-1; + //stone_def = (Gold * def) /100; + stone_def = 300; + if( Gold > GAMBLEBANK_GETMAX ) { + return 5; + }else if( Gold < GAMBLEBANK_GETMIN ) { + return 6; + } + if( ( player_gold + Gold ) > CHAR_getMaxHaveGold(toindex) ) { + return 3; //ȡὫ˽ + }else if( (Gold + stone_def)> CHAR_getInt( toindex, CHAR_PERSONAGOLD ) ) { //д + return 2; + } + + CHAR_setInt( toindex, CHAR_PERSONAGOLD, (CHAR_getInt( toindex, CHAR_PERSONAGOLD )-(Gold+stone_def))); + + CHAR_AddGold( toindex, Gold); + + sprintf( buf1,"ȡ%d ѣ%dʣࣺ%d ", Gold, stone_def, CHAR_getInt( toindex, CHAR_PERSONAGOLD )); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); + LogBankStone( CHAR_getChar( toindex, CHAR_NAME ), CHAR_getChar( toindex, CHAR_CDKEY ), + toindex, Gold, + "GB_Bank_Get(ȡ)", + CHAR_getInt( toindex, CHAR_FLOOR), + CHAR_getInt( toindex, CHAR_X ), CHAR_getInt( toindex, CHAR_Y ) , + CHAR_getInt( toindex, CHAR_GOLD ), + CHAR_getInt( toindex, CHAR_PERSONAGOLD ) + ); + return 1; + }else if( Gold > 0 ) { // + if( Gold > player_gold ) { + return 2; + }else if( (Gold + CHAR_getInt( toindex, CHAR_PERSONAGOLD ) ) > CHAR_MAXPERSONAGOLD ) { + return 4; + } + + CHAR_DelGold( toindex, Gold ); + + CHAR_setInt( toindex, CHAR_PERSONAGOLD, (CHAR_getInt( toindex, CHAR_PERSONAGOLD ) + Gold ) ); + sprintf( buf1,"%d ʣࣺ%d ", Gold, CHAR_getInt( toindex, CHAR_PERSONAGOLD )); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); + LogBankStone( CHAR_getChar( toindex, CHAR_NAME ), CHAR_getChar( toindex, CHAR_CDKEY ), + toindex, Gold, + "GB_Bank_save(д)", + CHAR_getInt( toindex, CHAR_FLOOR), + CHAR_getInt( toindex, CHAR_X ), CHAR_getInt( toindex, CHAR_Y ), + CHAR_getInt( toindex, CHAR_GOLD ), + CHAR_getInt( toindex, CHAR_PERSONAGOLD ) + ); + return 1; + } + return 0; +} + +BOOL NPC_GambleBank_AddItem( int meindex, int toindex, int itemId, int count) +{ + int i=-1,itemindex=-1; + int ret=-1; + char token[256]; + strcpy( token,"\0"); + if( count < 0 || itemId < 0 ) + return FALSE; + + if( CHAR_getInt( toindex, CHAR_GAMBLENUM) < count ) { + sprintf( token,"ֲֳ㣡"); + CHAR_talkToCli( toindex, -1,token,CHAR_COLORWHITE); + return FALSE; + } + for( i = 0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex=CHAR_getItemIndex( toindex , i ); + if( itemindex == -1 ) { + break; + } + } + if( i == CHAR_MAXITEMHAVE ) { + snprintf( token,sizeof( token), "Ʒռ䲻㣡"); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORWHITE); + return FALSE; + } + itemindex = ITEM_makeItemAndRegist( itemId); + if(itemindex == -1) + return FALSE; + ret = CHAR_addItemSpecificItemIndex( toindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + LogItem( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "G_BANK(ֳֶһ)", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + sprintf( token,"õ%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( toindex, -1,token,CHAR_COLORWHITE); + CHAR_sendItemDataOne( toindex, ret); + CHAR_setInt( toindex, CHAR_GAMBLENUM, CHAR_getInt( toindex, CHAR_GAMBLENUM) - count); + sprintf( token,"ֳʣࣺ %d", CHAR_getInt( toindex, CHAR_GAMBLENUM)); + CHAR_talkToCli( toindex, -1,token,CHAR_COLORWHITE); + return TRUE; +} + +#endif + + + + + diff --git a/npc/npc_gamblemaster.c b/npc/npc_gamblemaster.c new file mode 100644 index 0000000..5f6e49a --- /dev/null +++ b/npc/npc_gamblemaster.c @@ -0,0 +1,600 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "handletime.h" +#include "readmap.h" +#include "log.h" +#include "npc_eventaction.h" + +#ifdef _GAMBLE_ROULETTE + +#include "npc_gamblemaster.h" +void defPlayerGold( int meindex, int flg); +void NPC_GAMBLEMASTER_RESET( int meindex); +void Codef_Gold( int meindex, int toindex, int stone, int flg, char *token); +void NPC_GambleRoulette_selectWindow(int meindex,int toindex,int num,int select); + +enum +{ + ROULETTE_START=0, + ROULETTE_SELECT, + ROULETTE_LOOK, + ROULETTE_END, +}; + +enum +{ + roulette1 = 11, roulette2, roulette3, roulette4, roulette5, roulette6, roulette7, + roulette8, roulette9, roulette10, roulette11, roulette12, roulette13, roulette14, + roulette15, roulette16, roulette17, roulette18, roulette19, roulette20, + + roulette21 = 41, roulette22, roulette23, roulette24, roulette25, roulette26, + roulette27, roulette28, roulette29, roulette30, roulette31, roulette32, + roulette33, roulette34, roulette35, roulette36, roulette37, roulette38, + roulette39, roulette40, + roulette41 = 71, roulette42, roulette43, roulette44, roulette45, + + roulette51 = 101, roulette52=102, roulette53=103, + roulette61 = 111, roulette62=112, +}; + +typedef struct tagGambleMaster +{ + int m_fx; + int m_fy; + int m_type; // + int m_RG; //1 2 + int m_EO; //˫1 2 + int m_SI; + int m_IN; + char str_type[56]; + int m_nums; +}GambleEndType; +GambleEndType EndTypedef[60]={ +{22, 8 , roulette1 , roulette41, roulette43, roulette51, roulette61, "죱", 0}, +{7 , 8 , roulette1 , roulette41, roulette43, roulette51, roulette61, "죱", 0}, +{22, 10, roulette3 , roulette41, roulette43, roulette51, roulette61, "죳", 0}, +{7 , 6 , roulette3 , roulette41, roulette43, roulette51, roulette61, "죳", 0}, +{20, 11, roulette5 , roulette41, roulette43, roulette51, roulette61, "죵", 0}, +{9 , 5 , roulette5 , roulette41, roulette43, roulette51, roulette61, "죵", 0}, +{19, 5 , roulette6 , roulette41, roulette44, roulette53, roulette61, "죶", 0}, +{10, 11, roulette6 , roulette41, roulette44, roulette53, roulette61, "죶", 0}, +{17, 5 , roulette8 , roulette41, roulette44, roulette53, roulette61, "죸", 0}, +{12, 11, roulette8 , roulette41, roulette44, roulette53, roulette61, "죸", 0}, +{16, 5 , roulette9 , roulette41, roulette43, roulette53, roulette61, "죹", 0}, +{13, 11, roulette9 , roulette41, roulette43, roulette53, roulette61, "죹", 0}, +{15, 5 , roulette10, roulette41, roulette44, roulette53, roulette61, "죱", 0}, +{14, 11, roulette10, roulette41, roulette44, roulette53, roulette61, "죱", 0}, +{12, 5 , roulette13, roulette41, roulette43, roulette52, roulette62, "죱", 0}, +{17, 11, roulette13, roulette41, roulette43, roulette52, roulette62, "죱", 0}, +{22, 6 , roulette17, roulette41, roulette43, roulette53, roulette62, "죱", 0}, +{7 , 10, roulette17, roulette41, roulette43, roulette53, roulette62, "죱", 0}, +{22, 5 , roulette18, roulette41, roulette44, roulette52, roulette62, "죱", 0}, +{7 , 11, roulette18, roulette41, roulette44, roulette52, roulette62, "죱", 0}, + +{22, 9 , roulette22, roulette42, roulette44, roulette51, roulette61, "̣", 0}, +{7 , 7 , roulette22, roulette42, roulette44, roulette51, roulette61, "̣", 0}, +{21, 11, roulette24, roulette42, roulette44, roulette51, roulette61, "̣", 0}, +{8 , 5 , roulette24, roulette42, roulette44, roulette51, roulette61, "̣", 0}, +{18, 5 , roulette27, roulette42, roulette43, roulette53, roulette61, "̣", 0}, +{11, 11, roulette27, roulette42, roulette43, roulette53, roulette61, "̣", 0}, +{19, 11, roulette31, roulette42, roulette43, roulette51, roulette62, "̣", 0}, +{10, 5 , roulette31, roulette42, roulette43, roulette51, roulette62, "̣", 0}, +{18, 11, roulette32, roulette42, roulette44, roulette51, roulette62, "̣", 0}, +{11, 5 , roulette32, roulette42, roulette44, roulette51, roulette62, "̣", 0}, +{16, 11, roulette34, roulette42, roulette44, roulette52, roulette62, "̣", 0}, +{14, 5 , roulette34, roulette42, roulette44, roulette52, roulette62, "̣", 0}, +{15, 11, roulette35, roulette42, roulette43, roulette52, roulette62, "̣", 0}, +{13, 5 , roulette35, roulette42, roulette43, roulette52, roulette62, "̣", 0}, +{22, 7 , roulette36, roulette42, roulette44, roulette53, roulette62, "̣", 0}, +{7 , 9 , roulette36, roulette42, roulette44, roulette53, roulette62, "̣", 0}, +{21, 5 , roulette39, roulette42, roulette43, roulette52, roulette62, "̣", 0}, +{8 , 11, roulette39, roulette42, roulette43, roulette52, roulette62, "̣", 0}, +{20, 5 , roulette40, roulette42, roulette44, roulette52, roulette62, "̣", 0}, +{9 , 11, roulette40, roulette42, roulette44, roulette52, roulette62, "̣", 0}, +{22,11, roulette45, 0, 0, roulette52, 0, "룰"}, + +{ 7, 5, -1, -1, -1, -1, -1, "", 0}, +{ -1, -1, -1, -1, -1, -1, -1, "", 0}, +}; + +enum { + /* + NPC_WORK_ROUTETOX = CHAR_NPCWORKINT1, + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, +*/ + NPC_WORK_NPCAI = CHAR_NPCWORKINT3, + NPC_WORK_NPCACTION = CHAR_NPCWORKINT3, + NPC_WORK_MASTERSTONE = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_SYSTIME = CHAR_NPCWORKINT6, + NPC_WORK_GAMEFLG = CHAR_NPCWORKINT7, + NPC_WORK_GAMBLECODE = CHAR_NPCWORKINT8, + NPC_WORK_MASTERFLG = CHAR_NPCWORKINT9, + NPC_WORK_ENDPOINT = CHAR_NPCWORKINT10, +}; + +#define ROULETTE_ERRTIME 500 +#define ROULETTE_STANDBY1 40 +#define ROULETTE_LOOPTIME 3000 + +BOOL NPC_Gamble_MasterInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[256]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL ) { + print("\n not found argstr "); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "gamble_code",buf1, sizeof(buf1)) == NULL ) { + print("\n gamble_code error: not found !!"); + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_GAMBLECODE, atoi( buf1)); + //Ϸ׶ + CHAR_setWorkInt( meindex, NPC_WORK_GAMEFLG, 0); + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_GAMBLEMASTER ); + // NPC_WORK_MODE ״̬ 0: ȴ 1:GAME START 2:GAME END + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + CHAR_setWorkInt( meindex, NPC_WORK_MASTERFLG, 30); + CHAR_setWorkInt( meindex, NPC_WORK_MASTERSTONE, 0); + CHAR_setWorkInt( meindex, NPC_WORK_NPCAI, 0); + //趨LOOP TIMER + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, ROULETTE_LOOPTIME); + //¼ʱ + CHAR_setWorkInt( meindex, NPC_WORK_SYSTIME, NowTime.tv_sec); + return TRUE; +} + +void NPC_Gamble_MasterTalked( int meindex , int talkerindex , char *szMes , int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL ) { + print("\n not found argstr "); + return; + } + // 0 ѡ 11 - 19 21 - 29 + CHAR_setWorkInt(talkerindex , CHAR_WORKSHOPRELEVANT,0); + NPC_GambleRoulette_selectWindow( meindex, talkerindex, ROULETTE_START, -1 ); +} + +void NPC_GambleRoulette_selectWindow(int meindex,int toindex,int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[256],buf2[256]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + int pagenum=0, i; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof( npcarg)) == NULL ) { + print("\n not found npcarg "); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT,0); + return; + } + switch( num) { + case ROULETTE_START: + i = 1; + strcpy( token, "\0"); + sprintf( buf2,"%s%d", "gamble_msg0", i); + while( NPC_Util_GetStrFromStrWithDelim( npcarg, buf2, buf1, sizeof( buf1) ) != NULL ) { + if( strstr( buf1, "NULL" ) == NULL ) { + strcat( token , buf1); + strcat( token, "\n"); + }else { + strcat( token, "\n"); + } + i++; + sprintf( buf2,"%s%d", "gamble_msg0", i); + } + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno = WINDOWTYPE_GAMBLEROULETTE_START; + break; + break; + case ROULETTE_SELECT: + //ҳ select + pagenum = CHAR_getWorkInt( toindex , CHAR_WORKSHOPRELEVANT); + strcpy( token, "\0"); + if( select >= 0 ) { + sprintf( buf2,"%s%2d", "page_num", select); + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANT, select+1); + }else { + sprintf( buf2,"%s%2d", "page_num", pagenum ); + pagenum+=1; + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANT, pagenum); + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, buf2, token, sizeof( token) ) == NULL ) { + print("\n error: not found token:%s", token); + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANT,0); + return; + } + + sprintf( buf2,"%s%2d", "page_num", CHAR_getWorkInt( toindex , CHAR_WORKSHOPRELEVANT)); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, buf2, buf1, sizeof( buf1) ) == NULL ) { + windowno = WINDOWTYPE_GAMBLEROULETTE_END; + buttontype = WINDOW_BUTTONTYPE_OK; + }else { + windowno = WINDOWTYPE_GAMBLEROULETTE_SELECT; + buttontype = WINDOW_BUTTONTYPE_NEXT; + } + break; + case ROULETTE_LOOK: + { //ʾʱػ + int G_num = CHAR_getInt( toindex, CHAR_GAMBLENUM ); + + if( CHAR_getWorkInt( toindex, CHAR_WORKSTAKEFLAG) != FALSE) { + for( i=0; i<5; i++) { + if( CHAR_getWorkInt( toindex, i+CHAR_WORKSTAKETYPE1) > 0 ) + G_num++; + } + } + if( G_num < 0 ) G_num = 0; + sprintf( token,"ֳΪ%d", G_num ); + windowno = WINDOWTYPE_GAMBLEROULETTE_END; + buttontype = WINDOW_BUTTONTYPE_OK; + } + break; + case ROULETTE_END: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "page_endmsg", token, sizeof( token) ) == NULL ) { + print("\n error: not found end_msg"); + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANT,0); + return; + } + + windowno = WINDOWTYPE_GAMBLEROULETTE_END; + buttontype = WINDOW_BUTTONTYPE_OK; + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_Gamble_MasterWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int pagenum=0; + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + switch( seqno ) { + case WINDOWTYPE_GAMBLEROULETTE_START: + pagenum = atoi( data); + if( pagenum == 4 ) { + NPC_GambleRoulette_selectWindow( meindex, talkerindex, ROULETTE_END, -1 ); + }else { + if( pagenum == 3 ) { //ROULETTE_LOOK + NPC_GambleRoulette_selectWindow( meindex, talkerindex, ROULETTE_LOOK, -1 ); + }else { + pagenum = (pagenum*10)+1; + NPC_GambleRoulette_selectWindow( meindex, talkerindex, ROULETTE_SELECT, pagenum ); + } + } + break; + case WINDOWTYPE_GAMBLEROULETTE_SELECT: + NPC_GambleRoulette_selectWindow( meindex, talkerindex, ROULETTE_SELECT, -1 ); + break; + case WINDOWTYPE_GAMBLEROULETTE_END: + CHAR_setWorkInt(talkerindex , CHAR_WORKSHOPRELEVANT, 0); + break; + } + return; +} + +void NPC_Gamble_MasterLoop( int meindex) +{ + int objmeindex = -1; + int full_time; + //int Master_Stone = 0; + int timeNum = 0; + //int time_run=0; + //int act; + objmeindex = CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX); + switch( CHAR_getWorkInt( meindex, NPC_WORK_MODE )) { + case 0: // ȴ + full_time = ROULETTE_STANDBY1; + timeNum = CHAR_getWorkInt( meindex, NPC_WORK_MASTERFLG ); + if( ( CHAR_getWorkInt( meindex, NPC_WORK_SYSTIME) + full_time) < NowTime.tv_sec ) { + if( timeNum == 30 ) { //20 + //0 null 1 ׼ 2 3 ͣ + CHAR_setWorkInt( meindex, NPC_WORK_GAMEFLG, 1); + showString( meindex, "עʱʣ£롣", 0); + }else if( timeNum == 10 ) { + showString( meindex, "standby_msg", 0); //㲥 + SetCasinoMap( meindex, 0, 0); //趨ͼע + }else if( timeNum <= 6 ) { //ʼ + //0 null 1 ׼ 2 3 ͣ + CHAR_setWorkInt( meindex, NPC_WORK_GAMEFLG, 2); + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 1); + showString( meindex, "start_msg", 0); //㲥 + } + CHAR_setWorkInt( meindex, NPC_WORK_MASTERFLG, timeNum - 2 ); + } + break; + case 1: // GAME START + if( CHAR_getWorkInt( meindex, NPC_WORK_GAMEFLG) == 3 ) { + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 2); + } + break; + case 2: // GAME END + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 3); + defPlayerGold( meindex , TRUE); //Ӯ + CHAR_setWorkInt( meindex, NPC_WORK_ENDPOINT, 0); + NPC_MAPCLEANGOLD( meindex , CHAR_getInt( meindex, CHAR_FLOOR )); + + LogGamble( + CHAR_getChar( meindex, CHAR_NAME ), "master", + "ROULETTE", CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X ), + CHAR_getInt( meindex, CHAR_Y ) , + CHAR_getWorkInt( meindex, NPC_WORK_MASTERSTONE), 0, 0, 0, 2 + ); + break; + case 3: + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + CHAR_setWorkInt( meindex, NPC_WORK_GAMEFLG, 0); + showString( meindex, "end_msg", 0); //㲥 + SetCasinoMap( meindex, 0, 1); //趨ͼע + CHAR_setWorkInt( meindex, NPC_WORK_MASTERFLG, 30 ); + CHAR_setWorkInt( meindex, NPC_WORK_SYSTIME, NowTime.tv_sec); + break; + default: + NPC_GAMBLEMASTER_RESET( meindex); + break; + } +} + +void defPlayerGold( int meindex , int flg) +{ + int X,Y; + int endpoint; + int End_type = 0; + int toindex=0, i, master_floor; + int player_type; + int gamble_num; + //float def; + char token[256], buff[256]; + char buf1[56],buf2[56]; + BOOL GAMBLE_YES = FALSE; + endpoint = CHAR_getWorkInt( meindex, NPC_WORK_ENDPOINT); + + X = (endpoint >> 16 ); + Y = (endpoint & 0xffff); + + for( End_type = 0; End_type < arraysizeof(EndTypedef) ; End_type++ ) { + if( (X == EndTypedef[ End_type].m_fx) && (Y == EndTypedef[ End_type].m_fy )) { + break; + } + } + + if( End_type == arraysizeof(EndTypedef) ) { + print("\n\n **********GAMBLE MASTER ERROR !! **************"); + print("\n NOT FOUND : X=%d Y=%d EndTypedef[I] !!", X, Y); + return; + } +/*Log===================================== + { //¼ + FILE *fp; + int kp=0,pn=0;; + fp = fopen("./data/npc/roulette/lookgamble.txt","w+"); + if( fp != NULL ) { + if( EndTypedef[ End_type].m_nums < 10000 ) + EndTypedef[ End_type].m_nums = EndTypedef[ End_type].m_nums+1; + for( kp=0; kp 0 && EndTypedef[ kp].m_type > 0 ) { + fprintf( fp," %s н [%d] ", EndTypedef[ kp].str_type, EndTypedef[ kp].m_nums ); + if( (pn+1)%2 == 0 ) { + fprintf( fp," \n"); + } + pn ++; + } + } + fclose( fp); + } + } +//========================================*/ + + if( EndTypedef[ End_type].m_type <= 0 ) { + showString( meindex, "أͨɱ", 0); + }else { + sprintf( token ,"н %s ", EndTypedef[End_type].str_type ); + showString( meindex, token, 0 ); + } + if( EndTypedef[ End_type].m_EO == roulette43 ) { + sprintf( buf1,""); + }else { + sprintf( buf1,"˫"); + } + if( EndTypedef[ End_type].m_RG == roulette41 ) { + sprintf( buf2,""); + }else { + sprintf( buf2,""); + } + //ڳ + toindex = -1; + master_floor = CHAR_getInt( meindex , CHAR_FLOOR); + while( toindex < 10000 ) { + toindex++; + if( !CHAR_CHECKINDEX( toindex) ) + continue; + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + continue; + if( master_floor != CHAR_getInt( toindex, CHAR_FLOOR ) ) //Ƿڶij + continue; + if( CHAR_getWorkInt( toindex, CHAR_WORKSTAKEFLAG) == FALSE ) //Ƿע + continue; + //Ƿ + GAMBLE_YES = FALSE; + CHAR_setWorkInt( toindex, CHAR_WORKSTAKEFLAG, FALSE); + for( i=0; i<5; i++) { + player_type = CHAR_getWorkInt( toindex, i+CHAR_WORKSTAKETYPE1); + gamble_num = 0; + if( player_type > 0 ) { + if( player_type == EndTypedef[End_type].m_type ) { //˺ + if( EndTypedef[End_type].m_type == roulette45 ) { + gamble_num += 40; + }else { + gamble_num += 20; + } + GAMBLE_YES = TRUE; + //Ǯ + Codef_Gold( meindex, toindex, gamble_num, 0, EndTypedef[End_type].str_type ); + }else if( player_type == EndTypedef[End_type].m_RG ) { //˺ + gamble_num += 1; + GAMBLE_YES = TRUE; + Codef_Gold( meindex, toindex, gamble_num, 0, buf2 ); + }else if( player_type == EndTypedef[End_type].m_EO ) { //˵˫ + gamble_num += 1; + GAMBLE_YES = TRUE; + Codef_Gold( meindex, toindex, gamble_num, 0, buf1 ); + }else if( player_type == EndTypedef[End_type].m_SI ) { // + gamble_num += 2; + GAMBLE_YES = TRUE; + sprintf( token,"%s%d", "", EndTypedef[End_type].m_SI-100 ); + Codef_Gold( meindex, toindex, gamble_num, 0, token ); + }else if( player_type == EndTypedef[End_type].m_IN ) { //1-10 11-20 + gamble_num += 1; + GAMBLE_YES = TRUE; + if( (EndTypedef[End_type].m_IN - 100 ) == 11 ) { + snprintf( buff, sizeof( buff),""); + }else if( (EndTypedef[End_type].m_IN - 100 ) == 12 ) { + snprintf( buff, sizeof( buff),""); + } + sprintf( token,"%s%s", "Χ", buff ); + Codef_Gold( meindex, toindex, gamble_num, 0, token ); + }else { //û ۻ + if( (player_type>>16) == EndTypedef[End_type].m_type || + (player_type&0xffff) == EndTypedef[End_type].m_type + ) { //˫ + gamble_num += 10; + GAMBLE_YES = TRUE; + sprintf( token,"%s%s", "˫ţ", EndTypedef[End_type].str_type ); + Codef_Gold( meindex, toindex, gamble_num, 0, token ); + }else if( player_type > 0 ) { //72 73 74 75 û ۻ + strcpy( token, "\0"); + if( player_type >= roulette41 && player_type <= roulette44 ) { //̵˫ + sprintf( token,"%s", "Ѻע ̵˫ û"); + }else if( player_type == roulette45 ) { //00 + sprintf( token,"%s", "Ѻע 00 û"); + }else if( player_type >= roulette51 && player_type <= roulette53 ) { // + sprintf( token,"%s", "Ѻע û"); + }else if( player_type >= roulette61 && player_type <= roulette62 ) { //Χ + sprintf( token,"%s", "Ѻע Χ û"); + }else if( player_type > (1<<16) ) { //˫ + sprintf( token,"%s", "Ѻע ˫ û"); + }else { // + sprintf( token,"%s", "Ѻע û"); + } + gamble_num -= 1; + Codef_Gold( meindex, toindex, gamble_num, 1, token ); + } + } + } + // + CHAR_setWorkInt( toindex, i+CHAR_WORKSTAKETYPE1, 0); + } + if( CHAR_getInt( toindex, CHAR_GAMBLENUM) < 0 ) { + CHAR_setInt( toindex, CHAR_GAMBLENUM, 0 ); + }else if( CHAR_getInt( toindex, CHAR_GAMBLENUM) > 10000 ) { + CHAR_setInt( toindex, CHAR_GAMBLENUM, 10000 ); + } + sprintf( token, "ֳۼΪ%d֡", CHAR_getInt( toindex, CHAR_GAMBLENUM)); + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + + if( GAMBLE_YES == FALSE ) { + sprintf( token, "Ѻעûн"); + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + continue; + } + + } + return; +} + +void Codef_Gold( int meindex, int toindex, int stone,int flg, char *token) +{ + char buf1[256]; + int dnum=-1; + int Master_gnum=0; + Master_gnum = CHAR_getWorkInt( meindex, NPC_WORK_MASTERSTONE); + Master_gnum += stone; + if( !flg ) { + sprintf( buf1,"ϲˣ%sõ %d ", token, stone); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); +#ifdef _FIX_GAMBLENUM + stone += 1; //һʼע۵Ļ +#endif + CHAR_setInt( toindex, CHAR_GAMBLENUM, CHAR_getInt( toindex, CHAR_GAMBLENUM) + stone); + + }else { + dnum = stone; + if( stone < 0 ) { + dnum = (dnum*(-1)); + } + + sprintf( buf1,"%s %d ", token, dnum); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); +#ifdef _FIX_GAMBLENUM +#else + CHAR_setInt( toindex, CHAR_GAMBLENUM, CHAR_getInt( toindex, CHAR_GAMBLENUM) + stone); +#endif + } + + LogGamble( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + "ROULETTE", + CHAR_getInt( toindex, CHAR_FLOOR), + CHAR_getInt( toindex, CHAR_X ), + CHAR_getInt( toindex, CHAR_Y ), + CHAR_getInt( toindex, CHAR_GOLD), + stone, + 0, + CHAR_getInt( toindex, CHAR_GAMBLENUM ), + 1 + ); + + //¼ӯ + if( Master_gnum > 5000000 ) Master_gnum = 5000000; + if( Master_gnum < 0 ) Master_gnum = 0; + CHAR_setWorkInt( meindex, NPC_WORK_MASTERSTONE, Master_gnum); + return; +} +// +void NPC_GAMBLEMASTER_RESET( int meindex) +{ + // + print("\n "); + CHAR_setWorkInt( meindex, NPC_WORK_GAMEFLG, 0);//0 null 1 ׼ 2 + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + showString( meindex, "غϲ㣡ȣ¿ʼ", 1); + NPC_MAPCLEANGOLD( meindex , CHAR_getInt( meindex, CHAR_FLOOR )); + //defPlayerGold( meindex , FALSE); + CHAR_setWorkInt( meindex, NPC_WORK_SYSTIME, NowTime.tv_sec + ROULETTE_ERRTIME); +} + +#endif + + + diff --git a/npc/npc_gambleroulette.c b/npc/npc_gambleroulette.c new file mode 100644 index 0000000..67c732e --- /dev/null +++ b/npc/npc_gambleroulette.c @@ -0,0 +1,474 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "readmap.h" +#include "lssproto_serv.h" +#include "handletime.h" + +#ifdef _GAMBLE_ROULETTE +#include "npc_gambleroulette.h" + +#define _OTHER_ROUND //һܷ + +static void Gamble_Roulette_walk( int meindex); +static int Gamble_RouletteSetPoint( int meindex ); +static void Find_Master( int meindex); +int RunRand( int meindex, int flg ); +BOOL SetEndPoint( int meindex ); +void Gamble_Roulette_Reset( int meindex, int flg); +void ResetDataStart( int meindex); +BOOL ReadPointData( int meindex ); +enum { + NPC_WORK_ROUTETOX = CHAR_NPCWORKINT1, + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, //¼index +}; + +typedef struct tagRoulettePoint { + int x; + int y; + int flg; +}RoulettePoint; +RoulettePoint PointData[]={ + {-1,-1,-1},{-1,-1,-1},{-1,-1,-1},{-1,-1,-1}, +}; + +RoulettePoint TestPointData[4*8]; + +#define ROULETTE_STANDBY 1500 +#define ROULETTE_LOOPTIME 1000 + +#define ROULETTE_RUNTIME1 50 + +BOOL NPC_Gamble_RouletteInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_GAMBLEROULETTE ); + //CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, routenum); + //СҪ߼ͣ + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, 0); + CHAR_setWorkInt( meindex, NPC_WORK_SEFLG, -1); + // NPC_WORK_MODE С״̬ 0:ȴ 1:(˳) + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + //ڼͼ + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, 0); + //˳ 1 0 + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, 1); + //ڼ· + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTROUTE, 0); + //趨LOOP TIMER + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, ROULETTE_STANDBY); + //¼ʱ + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + if( ReadPointData( meindex) == FALSE ) + return FALSE; + return TRUE; +} + +void NPC_Gamble_RouletteTalked( int meindex , int talkerindex , char *szMes , int color ) +{ + return; +} + +void NPC_Gamble_RouletteWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + return; +} + +void NPC_Gamble_RouletteLoop( int meindex) +{ + int objmeindex = -1, index = 0, act = 0; + objmeindex = CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX); + switch( CHAR_getWorkInt( meindex, NPC_WORK_MODE )) { + case 0: //ֹͣʱȴ Ϊȴ + + //ץindex Ƿ񺰿ʼ + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG) < 0 ) { + CHAR_setWorkInt( meindex, NPC_WORK_MODE,5); + }else { + index = CHAR_getWorkInt( meindex, NPC_WORK_SEFLG); + //CHAR_NPCWORKINT7 0 null 1 ׼ 2 3 ͣ + if( CHAR_getWorkInt( index, CHAR_NPCWORKINT7 ) == 2 ) { + CHAR_sendCToArroundCharacter( objmeindex); + CHAR_setWorkInt( meindex, NPC_WORK_MODE,1); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, ROULETTE_RUNTIME1); + //С߼ + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, RunRand( meindex, 0 ) ); + ResetDataStart( meindex);// + if( CHAR_getInt( meindex, CHAR_X) == 14 && + CHAR_getInt( meindex, CHAR_Y) == 8 ) { + }else { + print("\n\n####################\n Сԭ!![%d,%d]", + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y) + ); + + } + }else if( CHAR_getWorkInt( index, CHAR_NPCWORKINT7 ) == 1 || + ( CHAR_getWorkInt( index, CHAR_NPCWORKINT9) < 30 && + CHAR_getWorkInt( index, CHAR_NPCWORKINT9) > 24 ) + ) { //׼ + if( CHAR_getInt( meindex, CHAR_X) == 14 && CHAR_getInt( meindex, CHAR_Y) == 8 ) { + }else { + CHAR_warpToSpecificPoint( meindex, CHAR_getInt( meindex, CHAR_FLOOR), + 14, 8); + CHAR_setInt( meindex, CHAR_X, 14); + CHAR_setInt( meindex, CHAR_Y, 8); + CHAR_sendCToArroundCharacter( objmeindex); + } + } + } + break; + case 1: + Gamble_Roulette_walk( meindex); + break; + case 2: + break; + case 3: + // + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + // + act = CHAR_ACTATTACK; + CHAR_sendWatchEvent( objmeindex, act, NULL,0, FALSE); + CHAR_setWorkInt( meindex, CHAR_WORKACTION, act); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, 0); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, ROULETTE_STANDBY); + + //ϸӾΧڵ + CHAR_sendCToArroundCharacter( objmeindex); + if( SetEndPoint( meindex ) == FALSE ) { + print("\n not Set EndPoint !!"); + } +#ifdef _OTHER_ROUND +#else + ReadPointData( meindex); //load round data +#endif + //ԭ + index = CHAR_getWorkInt( meindex, NPC_WORK_SEFLG); + CHAR_setWorkInt( index, CHAR_NPCWORKINT7, 3); + break; + case 5: //Ѱ + Find_Master( meindex); + if( CHAR_getWorkInt( meindex, NPC_WORK_SEFLG) < 0 ) { + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 0); + CHAR_setWorkInt( meindex, NPC_WORK_MODE,-1); + }else { + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + } + break; + default: + // + Gamble_Roulette_Reset( meindex, 0); + break; + } +} + +static void Gamble_Roulette_walk( int meindex) +{ + POINT start, end; + int dir; + int ret; + int i,run_num = 0; + int objmeindex = -1; + objmeindex = CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX); + + start.x = CHAR_getInt( meindex, CHAR_X); + start.y = CHAR_getInt( meindex, CHAR_Y); + end.x = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOX); + end.y = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOY); + // loop timerΪ 1. һ 2. ߵһ + + if( start.x == end.x && start.y == end.y ) { +#ifdef _OTHER_ROUND +#else + int add = 1; + //Ϊ NPC_WORK_ROUNDTRIP != 1 + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP ) != 1 ) { + add *= -1; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT) +add); +#endif + if( Gamble_RouletteSetPoint( meindex ) == FALSE ) { +#ifdef _OTHER_ROUND + CHAR_setWorkInt( meindex, NPC_WORK_MODE,3); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return; +#else + if( CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP ) != 1 ) { + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, arraysizeof( PointData) ); // + }else { + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, -1); //˳ + } + return; +#endif + }else { + return; + } + } +//-------------------------------------------------------------------- + run_num = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEMAX); + if( run_num > 0 ){ + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, (run_num - 1) ); + }else { +#ifdef _OTHER_ROUND + CHAR_setWorkInt( meindex, NPC_WORK_MODE,3); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return; +#else + int npc_ai=0; + int masterindex; + masterindex = CHAR_getWorkInt( meindex, NPC_WORK_SEFLG); + npc_ai = CHAR_getWorkInt( masterindex, CHAR_NPCWORKINT3); + if( npc_ai > 10 ) { + if( start.x == 7 && start.y == 5 ) { // 7,5 + CHAR_setWorkInt( masterindex, CHAR_NPCWORKINT3, 0); + }else { + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, 1); + return; + } + } + CHAR_setWorkInt( meindex, NPC_WORK_MODE,3); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return; +#endif + } +//-------------------------------------------------------------------- + dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + for( i = 0; i < 100; i ++ ) { + if( dir < 0 ) { + dir = RAND( 0,7); + } + dir = NPC_Util_SuberiWalk( meindex, dir); + if( dir >= 0 && dir <= 7) break; + } + if( dir >= 0 && dir <= 7 ) { + ret = CHAR_walk( meindex, dir, 0); + } +} + +static void Find_Master( int meindex) +{ + int floor, x=14, y=3; + OBJECT object; + floor = CHAR_getInt( meindex , CHAR_FLOOR); + for( object = MAP_getTopObj( floor, x, y) ; object ; object = NEXT_OBJECT(object ) ){ + int findex; + int objindex = GET_OBJINDEX(object); + if( !CHECKOBJECTUSE( objindex)) continue; + findex = OBJECT_getIndex( objindex); + if( !CHAR_CHECKINDEX( findex)) continue; + if( CHAR_getInt( findex , CHAR_WHICHTYPE ) != CHAR_GAMBLEMASTER ) continue; + if( CHAR_getWorkInt( findex, CHAR_NPCWORKINT8) != 10001 ) continue; + CHAR_setWorkInt( meindex, NPC_WORK_SEFLG, findex) ; + return; + } +} + +int RunRand( int meindex, int flg ) +{ +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + int run_num1=0; + int i; + + run_num1 = RAND( 90, 150); + for( i=0; i<6; i++ ) { + run_num1 += RAND( 0, 20); + } + return run_num1; +} + +BOOL SetEndPoint( int meindex ) +{ + int x,y; + int master; + int endpoint; + + master = CHAR_getWorkInt( meindex, NPC_WORK_SEFLG); + if( !CHAR_CHECKINDEX( master) ) + return FALSE; + + if( CHAR_getWorkInt( master, CHAR_NPCWORKINT7) != 2 ) { + print("\n error( master,CHAR_NPCWORKINT7) != 2 "); + return FALSE; + } + + x = CHAR_getInt( meindex, CHAR_X); + y = CHAR_getInt( meindex, CHAR_Y); + endpoint = (x<<16)+(y<<0); + CHAR_setWorkInt( master, CHAR_NPCWORKINT10, endpoint); + return TRUE; +} + +void Gamble_Roulette_Reset( int meindex, int flg) +{ + // + int index; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEMAX, 0); + CHAR_setWorkInt( meindex, NPC_WORK_MODE, 0); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, ROULETTE_STANDBY); + + index = CHAR_getWorkInt( meindex, NPC_WORK_SEFLG); + if( !CHAR_CHECKINDEX( index) ) { + print("\n Gamble_Roulette error: no master !!"); + return; + } + CHAR_setWorkInt( index, CHAR_NPCWORKINT7, 3); + CHAR_setWorkInt( index, CHAR_NPCWORKINT10, 0); +} + +void ResetDataStart( int meindex ) +{ +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) + int Start=1; + struct tagWalkStartPoint{ + int x; + int y; + int rip; + }WalkStart[]={ + {7,5,1}, {7,11,0}, {22,11,1}, {22,5,0}, + }; + Start = RAND( 0, 3); + + CHAR_setWorkInt( meindex, NPC_WORK_ROUNDTRIP, WalkStart[Start].rip ); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, Start); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, WalkStart[Start].x ); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, WalkStart[Start].y ); + + { + int i=0,k; + int RIP = CHAR_getWorkInt( meindex, NPC_WORK_ROUNDTRIP); + k = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT); + if( RIP ) { + while( i < (arraysizeof( TestPointData))) { + k++; + if( k > 3 ) k = 0; + TestPointData[i].x = PointData[k].x; + TestPointData[i].y = PointData[k].y; + i++; + } + }else { + while( i < (arraysizeof( TestPointData))) { + k--; + if( k < 0 ) k = 3; + TestPointData[i].x = PointData[k].x; + TestPointData[i].y = PointData[k].y; + i++; + } + } + } +#ifdef _OTHER_ROUND + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, 0); +#endif +} + +BOOL ReadPointData( int meindex ) +{ + + char buf1[256], buf2[32], buf3[16]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int k=1,i=0; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "roulette",buf1, sizeof(buf1)) == NULL ) { + print("\n roulette error: not found !!"); + return FALSE; + } + k=1; + while( getStringFromIndexWithDelim( buf1, ";", k, buf2, sizeof(buf2) ) != FALSE ) { + k++; + if( strstr( buf2,",") == NULL ) + continue; + + if( getStringFromIndexWithDelim( buf2, ",", 1, buf3, sizeof(buf3)) == FALSE) { + return FALSE; + } + PointData[i].x = atoi( buf3); + if( getStringFromIndexWithDelim( buf2, ",", 2, buf3, sizeof(buf3)) == FALSE) { + return FALSE; + } + PointData[i].y = atoi( buf3); + if( i > 9 ) { + break; + } + i++; + } +#ifdef _OTHER_ROUND +#else + Gamble_RouletteSetPoint( meindex); +#endif + return TRUE;//arraysizeof( PointData) +} + +static int Gamble_RouletteSetPoint( int meindex ) +{ +#ifdef _OTHER_ROUND + int i; + i = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, TestPointData[i].x ); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, TestPointData[i].y ); + i++; + CHAR_setWorkInt( meindex, NPC_WORK_ROUTEPOINT, i); + if( i >= arraysizeof( TestPointData) ) { + return FALSE; + } +#else + int i; + i = CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT); + if( i<0 || i>arraysizeof( PointData) -1) { + return FALSE; + } + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, PointData[i].x ); + CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, PointData[i].y ); +#endif + {//· + struct tagWalkStartPoint{ + int x; + int y; + }WalkStart[]={ + {22,5}, {7,5}, {7,11}, {22,11}, {22,5}, {7,5} + }; + int ch_x,ch_y; + int next_x,next_y; + int h; + ch_x = CHAR_getInt( meindex, CHAR_X); + ch_y = CHAR_getInt( meindex, CHAR_Y); + for( h=1; h<5; h++) { + if( ch_x == WalkStart[h].x && + ch_y == WalkStart[h].y) { + next_x = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOX); + next_y = CHAR_getWorkInt( meindex, NPC_WORK_ROUTETOY); + if( next_x == WalkStart[h+1].x && + next_y == WalkStart[h+1].y) { + + }else if( next_x == WalkStart[h-1].x && + next_y == WalkStart[h-1].y) { + }else { + print("\n ##############################"); + print("\n ERR : [%d,%d] -> [%d,%d]",ch_x,ch_y,next_x,next_y); + } + break; + } + } + } + return TRUE; +} + +#endif + + + diff --git a/npc/npc_healer.c b/npc/npc_healer.c new file mode 100644 index 0000000..07c441f --- /dev/null +++ b/npc/npc_healer.c @@ -0,0 +1,181 @@ +#include "version.h" +#include +#include +#include + +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" + + +#define RANGE 2 +void NPC_HealerSpeak( int index, int talker); +void NPC_HealerAllHeal( int talker ); +BOOL NPC_MoneyCheck(int meindex,int talker); +int NPC_CostCheck(int talker); +void NPC_CharCheckPoint(int meindex,int talker); +int NPC_WorkInput(int meindex,int talker); + + +/********************************** + +************************************/ +BOOL NPC_HealerInit( int meindex ) +{ + //ëס¡ɬ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEHEALER ); + // ƥئ ۢئо + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + //ľئ +// CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); + + return TRUE; + +} + + + + +/*------------------------------------------- + * + * ľHP,MPë巰 + * + --------------------------------------------*/ +void NPC_HealerTalked( int meindex , int talker , char *msg ,int color ) +{ + + char* npcarg; + char token[32]; + int msgNo; + + + npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT); + + getStringFromIndexWithDelim( npcarg, "|", 1, token,sizeof( token)); + msgNo = atoi( token ); + + /*---帲ƻ ɱ---*/ + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) return; + + /*--- 1׷ƥ¾---*/ + /* */ + if( NPC_Util_CharDistance( talker, meindex ) > 2) return; + + if( (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) == 2) ) + { + /*--ƽﵤ--*/ + NPC_HealerAllHeal( talker); + if(msgNo == 1) { + CHAR_talkToCli( talker, meindex, + "Ѿȫظ´εıмࡣ",CHAR_COLORWHITE); + + }else if(msgNo == 2) { + CHAR_talkToCli( talker, meindex, + "ܳʵҰظɣ",CHAR_COLORWHITE); + } + + }else{ + int i = 0; + int otherindex; + + for( i=0 ; i < CHAR_PARTYMAX ; i++) + { + otherindex = CHAR_getWorkInt( talker, CHAR_WORKPARTYINDEX1 + i); + if(otherindex != -1){ + + NPC_HealerAllHeal( otherindex); + if(msgNo == 1) { + CHAR_talkToCli( otherindex, meindex, + "Ѿȫظ´εıмࡣ",CHAR_COLORWHITE); + + }else if(msgNo == 2) { + CHAR_talkToCli( otherindex, meindex, + "ܳʵҰظɣ",CHAR_COLORWHITE); + } + } + } + } +} + + +/*----------------------*/ +/* */ +/*-----------------------*/ +void NPC_HealerAllHeal( int talker ) +{ + int i; + int petindex; + char petsend[3]; + char msgbuf[5]; + + CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) ); + CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) ); + + + + for(i = 0 ; i < CHAR_MAXPETHAVE; i ++) { + petindex = CHAR_getCharPet( talker, i); + + if( petindex == -1 ) continue; + + /* ƽҷ¼ */ + if( !CHAR_CHECKINDEX( talker ) ) continue; + + /* ʸindexë */ + if( CHAR_CHECKINDEX( petindex) == FALSE ) continue; + + /*----*/ + CHAR_setFlg( petindex, CHAR_ISDIE, 0); + CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) ); + CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) ); + + /*--ɷ¶Ʃ--*/ + CHAR_complianceParameter( petindex ); + sprintf( petsend, "K%d", i ); + CHAR_sendStatusString( talker , petsend ); + } + + /*---޻ľޱ˪--*/ + if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) + { + int topartyarray = -1; + int oyaindex = CHAR_getWorkInt( talker , CHAR_WORKPARTYINDEX1); + + if( CHAR_CHECKINDEX( oyaindex )) { + int i; + + /* ֧޼ ë */ + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 + i); + if( CHAR_CHECKINDEX( workindex) ) { + if( workindex == talker ) { + topartyarray = i; + break; + } + } + } + + for( i = 0; i < CHAR_PARTYMAX; i ++ ) { + int otherindex = CHAR_getPartyIndex( talker, i); + /* ɷ¶ë˪ */ + if( CHAR_CHECKINDEX( otherindex) ) { + snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray); + if( otherindex != talker) { + CHAR_sendStatusString( otherindex, msgbuf); + } + } + } + } + } + + /*--ɷ¶˪Ի--*/ + CHAR_send_P_StatusString( talker, CHAR_P_STRING_HP); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_MP); + +} + diff --git a/npc/npc_itemchange.c b/npc/npc_itemchange.c new file mode 100644 index 0000000..ad498e4 --- /dev/null +++ b/npc/npc_itemchange.c @@ -0,0 +1,259 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_itemchange.h" + +#ifdef _ITEM_NPCCHANGE +enum { + ITEMCHANGE_START=1, + ITEMCHANGE_SELECT, + ITEMCHANGE_MESSAGE, + ITEMCHANGE_END, + ITEMCHANGE_ERROR, + +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +static void NPC_ItemchangeMan_selectWindow( int meindex, int toindex, int num,int select); +BOOL ItemchangeMan_GetNeedStr( int meindex, int toindex, char *npcarg, char *token, int num ); +BOOL ItemchangeMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token); + +BOOL NPC_ItemchangeManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_ITEMCHANGENPC); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_ItemchangeManTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if( NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_ItemchangeMan_selectWindow( meindex, talkerindex, ITEMCHANGE_START, -1); + +} + +void NPC_ItemchangeManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int flg=-1; + if( select == WINDOW_BUTTONTYPE_NO || select == WINDOW_BUTTONTYPE_CANCEL) + return; + switch( seqno) { + case NPC_ITEMCHANGE_START: + break; + case NPC_ITEMCHANGE_SELECT: + NPC_ItemchangeMan_selectWindow( meindex, talkerindex, ITEMCHANGE_SELECT, flg); + break; + case NPC_ITEMCHANGE_MESSAGE: + flg = atoi( data); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, flg); + NPC_ItemchangeMan_selectWindow( meindex, talkerindex, ITEMCHANGE_MESSAGE, flg); + break; + case NPC_ITEMCHANGE_END: + flg = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + NPC_ItemchangeMan_selectWindow( meindex, talkerindex, ITEMCHANGE_END , flg); + break; + } + +} + +static void NPC_ItemchangeMan_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case ITEMCHANGE_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("TranserMan Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, ITEMCHANGE_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_ITEMCHANGE_SELECT; + break; + case ITEMCHANGE_SELECT: + if( ItemchangeMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE ) + return; + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, ITEMCHANGE_SELECT); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_ITEMCHANGE_MESSAGE; + break; + case ITEMCHANGE_MESSAGE: + if( ItemchangeMan_GetNeedStr( meindex, toindex, npcarg, token, select ) == FALSE ) + return; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_ITEMCHANGE_END; + break; + case ITEMCHANGE_END: + if( ActionNpc_CheckMenuFree( meindex, toindex, npcarg, select ) == FALSE ){ + memset( token, 0, sizeof( token)); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) { + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + } + } + return; + break; + case ITEMCHANGE_ERROR: + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_ItemchangeManLoop( int meindex) +{ + +} + +BOOL ItemchangeMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token) +{ + char buf1[1024], buf2[256], buf3[256]; + char NullName[256] = {"δ֪Ʒ"}; + BOOL FINDS=FALSE; + int talkNo=1; + int addID; + if( npcarg == NULL ) return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuHead", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get MenuHead ERROR!"); + return FALSE; + } + + sprintf( token, "%s\n", buf1); + + while( getStringFromIndexWithDelim( npcarg,"}", talkNo, buf1, sizeof( buf1)) != FALSE ) { + char *ItemName; + talkNo++; + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "CHANGEITEM", buf2, sizeof( buf2)) != NULL ){ + addID = atoi( buf2); + if( (ItemName = ITEM_getNameFromNumber( addID)) == "\0" ){ + sprintf( buf3, " %s\n", NullName); + }else{ + sprintf( buf3, " %s\n", ItemName); + } + // continue; + }else { + memset( buf3, 0, sizeof( buf3)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "CHANGEMSG", buf3, sizeof( buf3)) == NULL ) + continue; + strcat( buf3, "\n"); + } + FINDS = TRUE; + strcat( token, buf3); + } + + return FINDS; +} + +BOOL ItemchangeMan_GetNeedStr( int meindex, int toindex, char *npcarg, char *token, int num ) +{ + char buf1[1024], buf2[256], buf3[256]; + char NullName[256] = {"δ֪Ʒ"}; + int talkNo=1, addID, i=0; + BOOL FINDS = FALSE; + if( npcarg == NULL ) return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "NeedHead", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get NeedHead ERROR!\n%s", npcarg); + return FALSE; + } + sprintf( token, "%s\n", buf1); + if( getStringFromIndexWithDelim( npcarg,"}", num, buf1, sizeof( buf1)) == FALSE ) { + printf("Get NeedMess error !!\n"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "NeedItem", buf2, sizeof( buf2) ) != NULL){ + while( getStringFromIndexWithDelim( buf2, ",", talkNo, buf1, sizeof( buf1)) != FALSE ) { + char *ItemName=NULL; + talkNo++; + + addID = atoi( buf1); + FINDS = TRUE; + if( (ItemName = ITEM_getNameFromNumber( addID)) == "\0" ){ + sprintf( buf3, "%s ", NullName); + }else{ + sprintf( buf3, "%s ", ItemName); + } + strcat( token, buf3); + if( i%3 == 0 ) + strcat( token, "\n"); + i++; + } + }else { + if( NPC_Util_GetStrFromStrWithDelim( buf1, "NeedMsg", buf2, sizeof( buf2) ) == NULL) + return FALSE; + sprintf( token, "%s ", buf2); + FINDS = TRUE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf2, "DelGold", buf1, sizeof( buf1)) != NULL ) { + char goldmess[256]; + int gold = atoi( buf1); + if( gold > 0 ) { + sprintf( goldmess, "ʯ:%d \n", gold); + strcat( token, goldmess); + } + } + + return FINDS; +} +//void ItemchangeMan_CheckMenuFree( int meindex, int toindex, char *npcarg, int nums) +#endif + + diff --git a/npc/npc_itemshop.c b/npc/npc_itemshop.c new file mode 100644 index 0000000..bd8a864 --- /dev/null +++ b/npc/npc_itemshop.c @@ -0,0 +1,1162 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "npc_eventaction.h" +#include "readmap.h" +#include "log.h" +#include "family.h" + +#define MAXSHOPITEM 33 +static void NPC_ItemShop_selectWindow( int meindex, int talker, int num,int select); +void NPC_ItemShop_BuyMain(int meindex,int talker,int before ); +void NPC_GetItemList(char *argstr,char * argtoken2); + #ifdef _NEW_MANOR_LAW + void NPC_ItemStrStr(int itemID,double rate,char *name,char *token2,int iCostFame,int iChangeItemCost); + #else + void NPC_ItemStrStr(int itemID,double rate,char *name,char *token2); + #endif + +BOOL NPC_SetNewItem(int meindex,int talker,char *data); +BOOL NPC_SellNewItem(int meindex,int talker,char *data); + +void NPC_ItemShop_Menu(int meindex,int talker); + +int NPC_GetLimtItemList(int talker,char *argstr,char *token2,int sell); + +void NPC_ItemShop_SellMain(int meindex,int talker,int select); +int NPC_GetSellItemList(int itemindex,int flg,char *argstr,char *argtoken,int select,int sell); +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostFame,int iChangeItemCost); +#else +BOOL NPC_AddItemBuy(int meindex, int talker,int itemID,int kosuu,double rate); +#endif +int NPC_SellItemstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell); +void NPC_LimitItemShop(int meindex,int talker,int select); +void NPC_ExpressmanCheck(int meindex,int talker); + +enum{ + NPC_SHOP_WORK_NO = CHAR_NPCWORKINT1, + NPC_SHOP_WORK_EV = CHAR_NPCWORKINT2, + NPC_SHOP_WORK_EXPRESS = CHAR_NPCWORKINT3, +}; + + + +typedef struct { + char arg[32]; + int type; +}NPC_Shop; + + +static NPC_Shop TypeTable[] = { + { "FIST", 0 }, //ȭ + { "AXE", 1 }, // + { "CLUB", 2 }, // + { "SPEAR", 3}, //ì + { "BOW", 4}, // + { "SHIELD", 5}, // + { "HELM", 6 }, //ͷ + { "ARMOUR", 7 }, // + { "BRACELET", 8}, // + { "ANCLET", 9 }, // + { "NECKLACE", 10}, // + { "RING", 11}, //ָ + { "BELT", 12}, // + { "EARRING", 13}, // + { "NOSERING", 14}, //ǻ + { "AMULET", 15}, // + { "OTHER", 16}, + { "BOOMERANG", 17}, // + { "BOUNDTHROW", 18}, + { "BREAKTHROW", 19}, //Ͷ +#ifdef _ITEM_TYPETABLE + { "DISH", 20}, + { "METAL", 21}, + { "JEWEL", 22}, + { "WARES", 23}, + { "WBELT", 24}, + { "WSHIELD", 25}, + { "WSHOES", 26}, + { "WGLOVE", 27}, + { "ANGELTOKEN", 28}, + { "HEROTOKEN", 29}, +#endif + { "ACCESSORY", 30}, // + { "OFFENCE", 40}, // + { "DEFENCE", 50}, // + +}; + +BOOL NPC_ItemShopInit( int meindex ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEITEMSHOP ); + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + if(strstr(argstr,"LIMITSHOP") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 0); + } + if(strstr( argstr, "EVENT") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 0); + } + if(strstr( argstr, "EXPRESS") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 0); + } + + return TRUE; +} + +void NPC_ItemShopTalked( int meindex , int talker , char *szMes ,int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[1024]; + char buf2[256]; + char token[1024]; + int i = 1; + BOOL sellonlyflg = FALSE; + char sellmsg[1024]; + + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if(NPC_Util_isFaceToFace( meindex, talker, 2) == FALSE) {//̸ʱǷ + if( NPC_Util_CharDistance( talker, meindex ) > 1) return; //1 + } + + //ȡnpc趨ڵ,ΪNULL, + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("itemshopGetArgStrErr"); + return; + } + + //ȡNPCֻѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", token, sizeof( token)) != NULL){ + sellonlyflg = TRUE; //NPCҵĶ + strcpysafe(sellmsg, sizeof( sellmsg), token);//:sellmsgֵ->רĵꡣ + } + + //ȡָ. buffΪһִָ,:,,л,kau,buy,menu,лл,,ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "buy_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim(buff,",",i,buf2,sizeof(buf2)) != FALSE ){ + i++; //ָ8,iͻӵ8 + if( strstr( szMes, buf2) != NULL) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 0) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg ) { + NPC_ItemShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemShop_selectWindow( meindex, talker, 1, -1); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg) { + NPC_ItemShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemShop_selectWindow( meindex, talker, 1, -1); + return; + } + return; + } + } + } + } + i=1; + + //ȡָ. buffΪһִָ,:,,sell,uru ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sell_msg", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",", i,buf2,sizeof(buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + NPC_ItemShop_selectWindow( meindex, talker, 2, -1); + return; + } + } + } + i = 1; + + //ѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "other_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim( buff, ",", i, buf2, sizeof( buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + if(NPC_Util_GetStrFromStrWithDelim( argstr, "hint_msg", + token, sizeof( token)) != NULL) + { + CHAR_talkToCli( talker, meindex, token, CHAR_COLORWHITE); + return; + } + } + } + } + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if( sellonlyflg) { + NPC_ItemShop_selectWindow( meindex, talker, 3, -1); + return; + } + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1) { + NPC_ExpressmanCheck( meindex, talker); + }else{ + NPC_ItemShop_selectWindow( meindex, talker, 0, -1); + } + } + } + +} + +static void NPC_ItemShop_selectWindow( int meindex, int talker, int num,int select) +{ + switch( num) { + case 0: + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);//ͽǮ,100Ԫ ͳȥϸʽΪ P8Nz2|100| + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1 ) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) ==0 ) { + NPC_ExpressmanCheck( meindex, talker);//ë + } + }else if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + + }else{ + NPC_ItemShop_Menu( meindex, talker);//ѡ(,,뿪)СӴ + } + break; + + case 1://Ӵ + CHAR_sendStatusString( talker,"I");//еĵ߸Client + NPC_ItemShop_BuyMain( meindex, talker, select); + break; + + case 2://Ӵ + CHAR_sendStatusString( talker,"I"); + NPC_ItemShop_SellMain( meindex, talker, select); + break; + + case 3: + NPC_LimitItemShop( meindex, talker, select); + break; + + } +} + +void NPC_ItemShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 3) { + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + + makeStringFromEscaped( data); + + switch( seqno){ + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG: + if(atoi( data) == 1 ) NPC_ItemShop_selectWindow(meindex, talkerindex, 1, -1); + if(atoi( data) == 2) NPC_ItemShop_selectWindow(meindex, talkerindex, 2, -1); + if(atoi( data) == 3) return;/*--ئ--*/ + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG: + if(NPC_SetNewItem(meindex , talkerindex, data) == TRUE) { + NPC_ItemShop_selectWindow( meindex, talkerindex, 1, 0); + }else{ + NPC_ItemShop_selectWindow( meindex, talkerindex ,0, -1); + } + + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG: + if(NPC_SellNewItem(meindex , talkerindex, data) == TRUE) { + NPC_ItemShop_selectWindow( meindex, talkerindex, 2, 0); + + }else{ + NPC_ItemShop_selectWindow( meindex, talkerindex, 0, -1); + } + + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_ItemShop_selectWindow( meindex, talkerindex ,2, -1); + + }else if(select == WINDOW_BUTTONTYPE_NO) { + return; + }else if(select == WINDOW_BUTTONTYPE_OK) { + NPC_ItemShop_selectWindow( meindex, talkerindex, 2, -1); + } + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS: + if(atoi(data) == 2) { + NPC_ItemShop_selectWindow( meindex, talkerindex, 1, -1); + }else if(atoi( data) == 4) { + NPC_ItemShop_selectWindow( meindex, talkerindex, 2, -1); + } + } +} + +void NPC_ItemShop_BuyMain(int meindex,int talker,int before ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("itemshop_GetArgStr_Err"); + return; + } +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_FAME)/100); + lssproto_S2_send(fd,token); +#endif + if(before != -1) { + sprintf(token,"0|0"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + }else{ + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "buy_main", buff2, sizeof( buff2)); + + sprintf(token,"0|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "what_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "level_msg", buff2, sizeof( buff)); + + snprintf( token2, sizeof( token2), "%s|%s", buff, buff2); + + strncat( token, token2, sizeof( token)); + + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "itemfull_msg", buff2, sizeof( buff2)); + + sprintf( token2, "|%s|%s", buff, buff2); + strncat(token , token2,sizeof(token)); + strcpy(token2, "|"); + + NPC_GetItemList( argstr, token2); + strncat( token, token2, sizeof( token)); + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} +void NPC_GetItemList(char *argstr,char *argtoken) +{ + int i = 1; + int tmp; + char *name ="\0"; + char buff2[256]; +#ifdef _NEW_MANOR_LAW + char buff3[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff4[256]; + char buff5[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff6[256]; + int iCostFame = 0; + int iChangeItemCost = 0; +#endif + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int loopcnt = 0; + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buff2, sizeof( buff2)) + != NULL){ + rate = atof( buff2); + } +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostFame",buff3,sizeof(buff3)) == NULL) iCostFame = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",",i,buff2,sizeof(buff2)) !=FALSE ) { +#ifdef _NEW_MANOR_LAW + if(iCostFame > -1){ + if(getStringFromIndexWithDelim(buff3,",",i,buff4,sizeof(buff4)) != FALSE) iCostFame = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",i,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + i++; + if(strstr( buff2, "-") == NULL) { + name = ITEM_getNameFromNumber( atoi(buff2)); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemStrStr( atoi( buff2), rate, name, token2,iCostFame,iChangeItemCost); + #else + NPC_ItemStrStr( atoi( buff2), rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + }else{ + int start; + int end; + getStringFromIndexWithDelim( buff2, "-", 1, token2, sizeof(token2)); + start = atoi( token2); + getStringFromIndexWithDelim( buff2, "-", 2 ,token2, sizeof(token2)); + end = atoi( token2); + if(start > end){ + tmp = start; + start = end; + end = tmp; + } + end++; + for(; start < end ; start++ ) { + /*--ڒo???--*/ + + name = ITEM_getNameFromNumber( start ); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemStrStr( start, rate, name, token2,iCostFame,iChangeItemCost); + #else + NPC_ItemStrStr( start, rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + } + } + } + } +} + + #ifdef _NEW_MANOR_LAW + void NPC_ItemStrStr(int itemID,double rate,char *name,char *token2,int iCostFame,int iChangeItemCost) + #else + void NPC_ItemStrStr(int itemID,double rate,char *name,char *token2) + #endif +{ + + int gold; + int level; + int graNo; + char info[1024]; + char escape[256]; + + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + level = ITEM_getlevelFromITEMtabl( itemID); + graNo = ITEM_getgraNoFromITEMtabl( itemID); + strcpy(escape,ITEM_getItemInfoFromNumber( itemID)); + gold=(int)(gold * rate); + + makeEscapeString( escape, info, sizeof( info)); + makeEscapeString( name, escape, sizeof( escape)); +#ifdef _NEW_MANOR_LAW + sprintf(token2,"%s|0|%d|%d|%d|%s|%d|",escape,level,gold,graNo,info,iCostFame < 0 ? -1:iCostFame/100); +#else + sprintf( token2, "%s|0|%d|%d|%d|%s|", escape, level, gold, graNo, info); +#endif +} + +BOOL NPC_SetNewItem(int meindex,int talker,char *data) +{ + + char buf[1024]; + char buff2[128]; +#ifdef _NEW_MANOR_LAW + char buff3[1024]; + char buff4[128]; + char buff5[1024]; + char buff6[128]; + int iCostFame = 0; + int iChangeItemCost = 0; +#endif + int i = 1, j = 1; + int select; + int kosuu = 0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int gold = 0; + int kosuucnt = 0; + int itemindex; + + /*--߯Ȼ׷ëѱݩ--*/ + getStringFromIndexWithDelim( data, "|", 1, buf, sizeof( buf)); + select = atoi(buf); + if(select == 0) return FALSE; + getStringFromIndexWithDelim( data, "|", 2, buf, sizeof( buf)); + kosuu = atoi(buf); + if( kosuu <= 0 ) return FALSE; + + /*--Ѽ ¾-*/ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex = CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ) { + kosuucnt++; + } + } + + /*--߯Ȼ Ѽ ˼ ӡﴡ Իƾмƥ--*/ + /*--ӡ ë ľ--*/ + if( kosuucnt < kosuu) kosuu = kosuucnt; + + /*--δ޷¡--*/ + if(kosuucnt == 0 ) return FALSE; + + i = 1; + + /*--Ҽ̻ 跴̻ﻥئ巴 --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return FALSE; + } + + /*---ë ئľ1.0)-*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buf, sizeof( buf)) != NULL) { + rate= atof( buf); + } + +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostFame",buff3,sizeof(buff3)) == NULL) iCostFame = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + + /*--ʧ ةܰë浤Ƿ-*/ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buf, sizeof( buf)) != NULL ){ + while(getStringFromIndexWithDelim(buf , "," , j, buff2, sizeof(buff2)) != FALSE ){ +#ifdef _NEW_MANOR_LAW + if(iCostFame > -1){ + if(getStringFromIndexWithDelim(buff3,",",j,buff4,sizeof(buff4)) != FALSE) iCostFame = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",j,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + j++; + /*-- "-"ֳľ¾--*/ + if(strstr( buff2, "-") == NULL) { + if( ITEM_getcostFromITEMtabl(atoi(buff2)) !=-1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemBuy(meindex, talker,atoi(buff2),kosuu,rate,iCostFame,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemBuy(meindex, talker,atoi(buff2),kosuu,rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + }else{ + /*--ʧ ة 15-25 ƥ˪ľ--*/ + int start; + int end; + + /* "-"ƥľ炙Ѱ Ѱë --*/ + getStringFromIndexWithDelim( buff2, "-", 1, argstr, sizeof(argstr)); + start = atoi( argstr); + getStringFromIndexWithDelim( buff2, "-", 2 ,argstr, sizeof(argstr)); + end = atoi( argstr); + end++; + + /*-- įѱئȻգ ľ׸**/ + if(start > end){ + gold = start; + start = end; + end = gold; + } + + /*--"-"ƥľмʧ ةë ë --*/ + for(; start < end ; start++ ) { + if( ITEM_getcostFromITEMtabl( start) != -1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemBuy(meindex, talker, start, kosuu, rate,iCostFame,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemBuy(meindex, talker, start, kosuu, rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + } + } + } + } + + return FALSE; + +} + +/*--------------------------------------------- + *ʧ ةܰë浤 + *--------------------------------------------*/ +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostFame,int iChangeItemCost) +#else +BOOL NPC_AddItemBuy(int meindex, int talker,int itemID,int kosuu,double rate) +#endif +{ + + int itemindex; + int i; + int gold; + int ret; + int maxgold; +#ifdef _NEW_MANOR_LAW + int iTotalCostFame = -1; +#endif + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + gold = (int)(gold * rate); + + maxgold = gold * kosuu; + if(CHAR_getInt( talker, CHAR_GOLD) < maxgold ) return FALSE; +#ifdef _NEW_MANOR_LAW + if(iCostFame > 0){ + iTotalCostFame= iCostFame * kosuu; + if(CHAR_getInt(talker,CHAR_FAME) < iTotalCostFame) return FALSE; + } +#endif + +// if( addNpcFamilyTax( meindex, talker, maxgold*0.4 ) ) +// print(" FamilyTaxDone! "); +// else +// print(" FamilyTaxError!"); + addNpcFamilyTax( meindex, talker, maxgold*0.4 ); + for(i = 0 ; i < kosuu ; i++){ + itemindex = ITEM_makeItemAndRegist( itemID); + + if(itemindex == -1) return FALSE; + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_itemshop.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + CHAR_sendItemDataOne( talker, ret); + } + CHAR_DelGold( talker, maxgold); +#ifdef _NEW_MANOR_LAW + if(iTotalCostFame > 0){ + CHAR_setInt(talker,CHAR_FAME,CHAR_getInt(talker,CHAR_FAME) - iTotalCostFame); + if(CHAR_getInt(talker,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(talker,CHAR_FMNAME),""))){ + int fd = getfdFromCharaIndex(talker); + char buf[256]; + sprintf(buf,"%d",CHAR_getInt(talker,CHAR_FAME)); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(talker,CHAR_FMNAME), + CHAR_getInt(talker,CHAR_FMINDEX), + CHAR_getWorkInt(talker,CHAR_WORKFMINDEXI), + FM_FIX_FAME,buf,"", + CHAR_getWorkInt(talker,CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + LogFMFameShop(CHAR_getChar(talker,CHAR_FMNAME), + CHAR_getChar(talker,CHAR_CDKEY), + CHAR_getChar(talker,CHAR_NAME), + CHAR_getInt(talker,CHAR_FAME), + iTotalCostFame); + } + } +#endif + //CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; + +} + +//ѡ (,,ȥ) СӴ +void NPC_ItemShop_Menu(int meindex,int talker) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[256]; + int fd = getfdFromCharaIndex( talker); + + //argstrȡ趨ѶϢ: ->buy_rate:1.0|sell_rate:0.2|buy_msg:,,л,kau,buy............. (мķָǶʱ) + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + //tokenΪӴtitle : ķķߵ|ӭ + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); +#ifdef _NEW_MANOR_LAW + snprintf(token, sizeof(token),"%s|%s|%d",CHAR_getChar(meindex,CHAR_NAME),buff,CHAR_getInt(talker,CHAR_FAME)/100); +#else + snprintf(token, sizeof(token),"%s|%s",CHAR_getChar( meindex, CHAR_NAME), buff); +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMENU, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +void NPC_ItemShop_SellMain(int meindex,int talker,int before) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + //ȡnpc趨 + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_FAME)/100); + lssproto_S2_send(fd,token); +#endif + + if(before != -1) { + sprintf(token,"1|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN + +CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "sell_main", buff2, sizeof( buff)); + sprintf( token, "1|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "stone_msg", buff, sizeof( buff)); + + if(CHAR_getWorkInt(meindex,NPC_SHOP_WORK_EXPRESS) == 1 ) { + NPC_Util_GetStrFromStrWithDelim( argstr, "exrealy_msg", buff2, sizeof(buff2)); + }else{ + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff2, sizeof( buff2)); + } + sprintf( token2,"%s|%s|", buff, buff2); + NPC_GetLimtItemList( talker,argstr, token2, -1);//ϸҪĵ + strncat( token, token2, sizeof( token)); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN+ + CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } +} +int NPC_GetLimtItemList(int talker, char *argstr, char* token2,int sell) +{ + + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token3[NPC_UTIL_GETARGSTR_LINEMAX]; + int k = 0 , i = 1 , j = 0; + int imax; + int itemtype = 0; + int itemindex; + int okflg = 0; + char buf[256]; + int flg=0; + int cost; + + if(sell == -1 ){ + i = CHAR_STARTITEMARRAY; + imax = CHAR_MAXITEMHAVE; + flg = -1; + }else{ + i= sell; + imax= sell + 1; + flg = 1; + } + + for( ; i < imax ; i++ ){ + okflg=0; + itemindex = CHAR_getItemIndex( talker , i ); + + if( ITEM_CHECKINDEX( itemindex) ){ + if( NPC_Util_GetStrFromStrWithDelim( argstr,"LimitItemType", buff, sizeof( buff)) != NULL ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ +#ifdef _ITEM_TYPETABLE + int cmpmaxitem = sizeof(TypeTable)/sizeof(TypeTable[0]); +#endif + k++; +#ifdef _ITEM_TYPETABLE + for(j = 0 ; j < cmpmaxitem ; j++){ +#else + for(j = 0 ; j < ITEM_CATEGORYNUM+3 ; j++){ +#endif + if(strcmp( TypeTable[ j].arg , token) == 0 ) { + itemtype = TypeTable[ j].type; + if(ITEM_getInt(itemindex,ITEM_TYPE) == itemtype) { + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat( token2, token3, sizeof( token3)); + okflg = 1; + }else if(itemtype == 30){ + if( 8 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 15) ){ + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 40){ + if(( 0 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 4)) + || (17 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 19))) { + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 50){ + if( 5 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 7) ){ + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + break; + } + } + + if(okflg == 1) break; + } + } + if( (NPC_Util_GetStrFromStrWithDelim( argstr, "LimitItemNo", buff,sizeof( buff))!= NULL) && okflg == 0 ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ + k++; + if(strstr( token, "-")==NULL && strcmp(token,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(token)) { + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg=1; + } + }else if (strstr( token, "-") != NULL){ + int start, end; + int work; + + if( getStringFromIndexWithDelim( token, "-", 1, buf, sizeof(buf)) == FALSE ) + return -1; + start = atoi( buf); + if( getStringFromIndexWithDelim( token, "-", 2 ,buf, sizeof(buf)) == FALSE ) + return -1; + end = atoi( buf); + + if(start > end){ + work = start; + start = end; + end = work; + } + + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_GetSellItemList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + } + } + + if(okflg == 0) { + cost = NPC_GetSellItemList(itemindex, 1, argstr, token3, i, sell); + if(sell != -1) return -1; + strncat( token2, token3, sizeof( token3)); + } + + } + } + return -1; +} + + + +/*---------------------------------------------------------- + + ͷʧ˪P + + *----------------------------------------------------------*/ +int NPC_GetSellItemList(int itemindex,int flg, char *argstr,char *argtoken,int select,int sell) +{ + char buff[256]; + double rate = 0.2; + char buff2[256]; + char buff3[64]; + int k = 1; + int cost = -1; + + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_item",buff, sizeof( buff)) != NULL){ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_rate",buff2, sizeof( buff2)) != NULL ){ + rate = atof(buff2); + }else{ + rate = 1.2; + } + + while(getStringFromIndexWithDelim(buff , "," , k, buff2, sizeof(buff2)) !=FALSE ){ + k++; + if(strstr( buff2, "-") == NULL && strcmp(buff2,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(buff2)){ + cost = NPC_SellItemstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + }else if (strstr( buff2, "-") != NULL){ + int start; + int end; + int work; + getStringFromIndexWithDelim( buff2, "-", 1, buff3, sizeof(buff3)); + start = atoi( buff3); + getStringFromIndexWithDelim( buff2, "-", 2 ,buff3, sizeof(buff3)); + end = atoi( buff3); + + if(start > end){ + work = start; + start = end; + end = work; + } + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_SellItemstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + } + } + } + if( NPC_Util_GetStrFromStrWithDelim( argstr,"sell_rate",buff, sizeof( buff)) != NULL ){ + rate = atof(buff); + cost = NPC_SellItemstrsStr( itemindex, flg ,rate, argtoken,select,sell); + return cost; + } + + return cost; +} + +int NPC_SellItemstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell) +{ + int cost; + char escapedname[256]; + char name[256]; + char *eff; + + + cost = ITEM_getInt( itemindex, ITEM_COST); + cost = (int)(cost * rate); + + if(sell != -1) return cost; + + strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME)); + makeEscapeString( escapedname, name, sizeof( name)); + eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING); + makeEscapeString( eff, escapedname, sizeof(escapedname)); + + + + sprintf( argtoken, +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%s|%d|%d|", +#else + "%s|%d|%d|%d|%s|%d|", +#endif + name, flg, cost, + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + escapedname, select +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#endif + ); + + return -1; + +} + +BOOL NPC_SellNewItem(int meindex,int talker,char *data) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256], token2[256]; + int cost, k, select, itemindex; + int MyGold, MaxGold, sellnum=1; + + MaxGold = CHAR_getMaxHaveGold( talker); + MyGold = CHAR_getInt( talker, CHAR_GOLD); + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + getStringFromIndexWithDelim(data , "|" ,1, token, sizeof( token)); + select = atoi(token); +#ifdef _ITEM_PILENUMS + getStringFromIndexWithDelim(data , "|" ,2, token, sizeof( token)); + sellnum = atoi(token); +#endif + + if( select < CHAR_STARTITEMARRAY || select >= CHAR_MAXITEMHAVE ) return FALSE; + k = select; + itemindex = CHAR_getItemIndex( talker , k); + cost = NPC_GetLimtItemList( talker,argstr, token2,select); + if( cost == -1 || (cost*sellnum)+MyGold >= MaxGold || !ITEM_CHECKINDEX( itemindex) ){ + int fd = getfdFromCharaIndex( talker); + sprintf(token,"\n\nѽ!Բ" "\n\nԲ ! ɲѡһأ" ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return FALSE; + } +#ifdef _ITEM_PILENUMS + if( NPC_DelItem( talker, k, sellnum) == FALSE ) return FALSE; +#else + { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "Sell()", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + CHAR_DelItem( talker, k); +#endif + CHAR_AddGold( talker, cost*sellnum); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; +} + + + +void NPC_LimitItemShop(int meindex,int talker,int select) +{ + + int fd = getfdFromCharaIndex( talker); + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", buf, sizeof( buf))!=NULL){ + sprintf(token,"\n\n%s", buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + CHAR_talkToCli( talker, meindex, "רŵꡣ",CHAR_COLORWHITE); + } + return; +} + +void NPC_ExpressmanCheck(int meindex,int talker) +{ + int fd = getfdFromCharaIndex( talker); + char token[1024]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buf, sizeof( buf)); + sprintf(token,"4\n%s\n\n%s" + "\n\n " + "\n\n " + ,CHAR_getChar(meindex,CHAR_NAME),buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + return; + + +} + diff --git a/npc/npc_itemup.c b/npc/npc_itemup.c new file mode 100644 index 0000000..6096143 --- /dev/null +++ b/npc/npc_itemup.c @@ -0,0 +1,280 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_itemup.h" +#ifdef _NPC_ITEMUP +enum { + ITEMUP_START=1, + ITEMUP_SELECT1, + ITEMUP_SELECT2, + ITEMUP_MESSAGE, + ITEMUP_END, + ITEMUP_ERROR, + +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +static void NPC_ItemupMan_selectWindow( int meindex, int toindex, int num,int select); +BOOL ItemupMan_GetNeedStr( int meindex, int toindex, char *npcarg, char *token, int num ); +BOOL ItemupMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token); +BOOL ItemupMan_GetItemStr( int meindex, int toindex, char *npcarg, char *token,int num); + +BOOL NPC_ItemupManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_ITEMCHANGENPC); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_ItemupManTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if( NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if( NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_ItemupMan_selectWindow( meindex, talkerindex, ITEMUP_START, -1); + +} + +void NPC_ItemupManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + int flg=-1; + if( select == WINDOW_BUTTONTYPE_NO || select == WINDOW_BUTTONTYPE_CANCEL) + return; + switch( seqno) { + case NPC_ITEMUP_START: + break; + case NPC_ITEMUP_SELECT1: + NPC_ItemupMan_selectWindow( meindex, talkerindex, ITEMUP_SELECT1, flg); + break; + case NPC_ITEMUP_SELECT2: + flg = atoi( data); + NPC_ItemupMan_selectWindow( meindex, talkerindex, ITEMUP_SELECT2, flg); + break; + case NPC_ITEMUP_MESSAGE: + flg = atoi( data); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, flg); + NPC_ItemupMan_selectWindow( meindex, talkerindex, ITEMUP_MESSAGE, flg); + break; + case NPC_ITEMUP_END: + flg = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + NPC_ItemupMan_selectWindow( meindex, talkerindex, ITEMUP_END , flg); + break; + } + +} + +static void NPC_ItemupMan_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + char npcbuf[2048]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case ITEMUP_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("TranserMan Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, ITEMUP_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_ITEMUP_SELECT1; + break; + case ITEMUP_SELECT1: + if( ItemupMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE ) + return; + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, ITEMUP_SELECT1); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_ITEMUP_SELECT2; + break; + case ITEMUP_SELECT2: + if( ItemupMan_GetItemStr( meindex, toindex, npcarg, token, select) == FALSE ) + return; + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, ITEMUP_SELECT2); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_ITEMUP_MESSAGE; + break; + case ITEMUP_MESSAGE: + if( ItemupMan_GetNeedStr( meindex, toindex, npcarg, token, select ) == FALSE ) + return; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_ITEMUP_END; + break; + case ITEMUP_END: + if(getStringFromIndexWithDelim( npcarg,"]", CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE), npcbuf, sizeof( npcbuf)) == FALSE){ + return; + } + if( ActionNpc_CheckMenuFree( meindex, toindex, npcbuf, select ) == FALSE ){ + memset( token, 0, sizeof( token)); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) { + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + } + } + return; + break; + case ITEMUP_ERROR: + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_ItemupManLoop( int meindex) +{ + +} + +BOOL ItemupMan_GetItemStr( int meindex, int toindex, char *npcarg, char *token, int num) +{ + char buf1[1024], buf2[256], buf3[256],buf0[2048]; + char NullName[256] = {"δ֪Ʒ"}; + BOOL FINDS=FALSE; + int talkNo=1; + int addID; + if( npcarg == NULL ) return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "ItemHead", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get NeedHead ERROR!\n%s", npcarg); + return FALSE; + } + sprintf( token, "%s\n", buf1); + + if(getStringFromIndexWithDelim( npcarg,"]", num, buf0, sizeof( buf0)) == FALSE){ + return FALSE; + } + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, num); + while( getStringFromIndexWithDelim( buf0,"}", talkNo, buf1, sizeof( buf1)) != FALSE ) { + char *ItemName; + talkNo++; + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "CHANGEITEM", buf2, sizeof( buf2)) != NULL ){ + addID = atoi( buf2); + if( (ItemName = ITEM_getNameFromNumber( addID)) == "\0" ){ + sprintf( buf3, " %s\n", NullName); + }else{ + sprintf( buf3, " %s\n", ItemName); + } + // continue; + }else { + memset( buf3, 0, sizeof( buf3)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "CHANGEMSG", buf3, sizeof( buf3)) == NULL ) + continue; + strcat( buf3, "\n"); + } + FINDS = TRUE; + strcat( token, buf3); + } + + return FINDS; +} + +BOOL ItemupMan_GetNeedStr( int meindex, int toindex, char *npcarg, char *token, int num ) +{ + char buf1[1024], buf2[256], buf3[256],buf0[2048],buf4[256]; + char NullName[256] = {"δ֪Ʒ"}; + int talkNo=1, addID, i=0,itemnum=1; + BOOL FINDS = FALSE; + if( npcarg == NULL ) return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "NeedHead", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get NeedHead ERROR!\n%s", npcarg); + return FALSE; + } + sprintf( token, "%s\n", buf1); + if(getStringFromIndexWithDelim( npcarg,"]", CHAR_getWorkInt(toindex,CHAR_WORKLISTPAGE), buf0, sizeof( buf0)) == FALSE){ + return FALSE; + } + if( getStringFromIndexWithDelim( buf0,"}", num, buf1, sizeof( buf1)) == FALSE ) { + printf("Get NeedMess error !!\n"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "NeedMsg", buf2, sizeof( buf2) ) != NULL){ + strcat( token,buf2); + FINDS = TRUE; + } + + return FINDS; +} + +BOOL ItemupMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token) +{ + char buf1[1024],buf2[256];; + BOOL FINDS=FALSE; + int talkNo=1; + char *MenuName; + if( npcarg == NULL ) return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuHead", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get MenuHead ERROR!"); + return FALSE; + } + + sprintf( token, "%s\n", buf1); + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuName", buf1, sizeof( buf1) ) == NULL){ + print("ItemchangeMan Get MenuHead ERROR!"); + return FALSE; + } + + while( getStringFromIndexWithDelim( buf1,",", talkNo, buf2, sizeof( buf2)) != FALSE ) { + talkNo++; + MenuName = buf2; + FINDS=TRUE; + strcat( token, MenuName); + strcat( token, "\n"); + } + + return FINDS; +} +#endif diff --git a/npc/npc_itemvippointshop.c b/npc/npc_itemvippointshop.c new file mode 100644 index 0000000..8791fa6 --- /dev/null +++ b/npc/npc_itemvippointshop.c @@ -0,0 +1,1165 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "npc_eventaction.h" +#include "readmap.h" +#include "log.h" +#include "family.h" + +#define MAXSHOPITEM 33 +static void NPC_ItemVippointShop_selectWindow( int meindex, int talker, int num,int select); +void NPC_ItemVippointShop_BuyMain(int meindex,int talker,int before ); +void NPC_GetItemVippointList(char *argstr,char * argtoken2); + #ifdef _NEW_MANOR_LAW + void NPC_ItemVippointStrStr(int itemID,double rate,char *name,char *token2,int iCostVippoint,int iChangeItemCost); + #else + void NPC_ItemVippointStrStr(int itemID,double rate,char *name,char *token2); + #endif + +BOOL NPC_SetNewItemVippoint(int meindex,int talker,char *data); +BOOL NPC_SellNewItemVippoint(int meindex,int talker,char *data); + +void NPC_ItemVippointShop_Menu(int meindex,int talker); + +int NPC_GetLimtItemVippointList(int talker,char *argstr,char *token2,int sell); + +void NPC_ItemVippointShop_SellMain(int meindex,int talker,int select); +int NPC_GetSellItemVippointList(int itemindex,int flg,char *argstr,char *argtoken,int select,int sell); +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemVippointBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostVippoint,int iChangeItemCost); +#else +BOOL NPC_AddItemVippointBuy(int meindex, int talker,int itemID,int kosuu,double rate); +#endif +int NPC_SellItemVippointstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell); +void NPC_LimitItemVippointShop(int meindex,int talker,int select); +void NPC_VippointExpressmanCheck(int meindex,int talker); + +enum{ + NPC_SHOP_WORK_NO = CHAR_NPCWORKINT1, + NPC_SHOP_WORK_EV = CHAR_NPCWORKINT2, + NPC_SHOP_WORK_EXPRESS = CHAR_NPCWORKINT3, +}; + + + +typedef struct { + char arg[32]; + int type; +}NPC_Shop; + + +static NPC_Shop TypeTable[] = { + { "FIST", 0 }, //ȭ + { "AXE", 1 }, // + { "CLUB", 2 }, // + { "SPEAR", 3}, //ì + { "BOW", 4}, // + { "SHIELD", 5}, // + { "HELM", 6 }, //ͷ + { "ARMOUR", 7 }, // + { "BRACELET", 8}, // + { "ANCLET", 9 }, // + { "NECKLACE", 10}, // + { "RING", 11}, //ָ + { "BELT", 12}, // + { "EARRING", 13}, // + { "NOSERING", 14}, //ǻ + { "AMULET", 15}, // + { "OTHER", 16}, + { "BOOMERANG", 17}, // + { "BOUNDTHROW", 18}, + { "BREAKTHROW", 19}, //Ͷ +#ifdef _ITEM_TYPETABLE + { "DISH", 20}, + { "METAL", 21}, + { "JEWEL", 22}, + { "WARES", 23}, + { "WBELT", 24}, + { "WSHIELD", 25}, + { "WSHOES", 26}, + { "WGLOVE", 27}, + { "ANGELTOKEN", 28}, + { "HEROTOKEN", 29}, +#endif + { "ACCESSORY", 30}, // + { "OFFENCE", 40}, // + { "DEFENCE", 50}, // + +}; + +BOOL NPC_ItemVippointShopInit( int meindex ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEITEMSHOP ); + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + if(strstr(argstr,"LIMITSHOP") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 0); + } + if(strstr( argstr, "EVENT") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 0); + } + if(strstr( argstr, "EXPRESS") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 0); + } + + return TRUE; +} + +void NPC_ItemVippointShopTalked( int meindex , int talker , char *szMes ,int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[1024]; + char buf2[256]; + char token[1024]; + int i = 1; + BOOL sellonlyflg = FALSE; + char sellmsg[1024]; + + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if(NPC_Util_isFaceToFace( meindex, talker, 2) == FALSE) {//̸ʱǷ + if( NPC_Util_CharDistance( talker, meindex ) > 1) return; //1 + } + + //ȡnpc趨ڵ,ΪNULL, + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("itemshopGetArgStrErr"); + return; + } + + //ȡNPCֻѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", token, sizeof( token)) != NULL){ + sellonlyflg = TRUE; //NPCҵĶ + strcpysafe(sellmsg, sizeof( sellmsg), token);//:sellmsgֵ->רĵꡣ + } + + //ȡָ. buffΪһִָ,:,,л,kau,buy,menu,лл,,ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "buy_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim(buff,",",i,buf2,sizeof(buf2)) != FALSE ){ + i++; //ָ8,iͻӵ8 + if( strstr( szMes, buf2) != NULL) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 0) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg ) { + NPC_ItemVippointShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemVippointShop_selectWindow( meindex, talker, 1, -1); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg) { + NPC_ItemVippointShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemVippointShop_selectWindow( meindex, talker, 1, -1); + return; + } + return; + } + } + } + } + i=1; + + //ȡָ. buffΪһִָ,:,,sell,uru ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sell_msg", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",", i,buf2,sizeof(buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + NPC_ItemVippointShop_selectWindow( meindex, talker, 2, -1); + return; + } + } + } + i = 1; + + //ѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "other_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim( buff, ",", i, buf2, sizeof( buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + if(NPC_Util_GetStrFromStrWithDelim( argstr, "hint_msg", + token, sizeof( token)) != NULL) + { + CHAR_talkToCli( talker, meindex, token, CHAR_COLORWHITE); + return; + } + } + } + } + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if( sellonlyflg) { + NPC_ItemVippointShop_selectWindow( meindex, talker, 3, -1); + return; + } + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1) { + NPC_VippointExpressmanCheck( meindex, talker); + }else{ + NPC_ItemVippointShop_selectWindow( meindex, talker, 0, -1); + } + } + } + +} + +static void NPC_ItemVippointShop_selectWindow( int meindex, int talker, int num,int select) +{ + switch( num) { + case 0: + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);//ͽǮ,100Ԫ ͳȥϸʽΪ P8Nz2|100| + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1 ) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) ==0 ) { + NPC_VippointExpressmanCheck( meindex, talker);//ë + } + }else if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + + }else{ + NPC_ItemVippointShop_Menu( meindex, talker);//ѡ(,,뿪)СӴ + } + break; + + case 1://Ӵ + CHAR_sendStatusString( talker,"I");//еĵ߸Client + NPC_ItemVippointShop_BuyMain( meindex, talker, select); + break; + + case 2://Ӵ + //CHAR_sendStatusString( talker,"I"); + //NPC_ItemVippointShop_SellMain( meindex, talker, select); + CHAR_talkToCli( talker, meindex, "NPC޴˹ܣ",CHAR_COLORWHITE); + break; + + case 3: + NPC_LimitItemVippointShop( meindex, talker, select); + break; + + } +} + +void NPC_ItemVippointShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 3) { + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + + makeStringFromEscaped( data); + + switch( seqno){ + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG: + if(atoi( data) == 1 ) NPC_ItemVippointShop_selectWindow(meindex, talkerindex, 1, -1); + if(atoi( data) == 2) NPC_ItemVippointShop_selectWindow(meindex, talkerindex, 2, -1); + if(atoi( data) == 3) return;/*--ئ--*/ + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG: + if(NPC_SetNewItemVippoint(meindex , talkerindex, data) == TRUE) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 1, 0); + }else{ + NPC_ItemVippointShop_selectWindow( meindex, talkerindex ,0, -1); + } + + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG: + if(NPC_SellNewItemVippoint(meindex , talkerindex, data) == TRUE) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 2, 0); + + }else{ + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 0, -1); + } + + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex ,2, -1); + + }else if(select == WINDOW_BUTTONTYPE_NO) { + return; + }else if(select == WINDOW_BUTTONTYPE_OK) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 2, -1); + } + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS: + if(atoi(data) == 2) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 1, -1); + }else if(atoi( data) == 4) { + NPC_ItemVippointShop_selectWindow( meindex, talkerindex, 2, -1); + } + } +} + +void NPC_ItemVippointShop_BuyMain(int meindex,int talker,int before ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("itemshop_GetArgStr_Err"); + return; + } +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_FAME)/100); + lssproto_S2_send(fd,token); +#endif + if(before != -1) { + sprintf(token,"0|0"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + }else{ + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "buy_main", buff2, sizeof( buff2)); + sprintf(buff2,"%s\nԱ%d",buff2,sasql_vippoint(CHAR_getUseID(talker),0,0)); + sprintf(token,"0|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "what_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "level_msg", buff2, sizeof( buff)); + + snprintf( token2, sizeof( token2), "%s|%s", buff, buff2); + + strncat( token, token2, sizeof( token)); + + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "itemfull_msg", buff2, sizeof( buff2)); + + sprintf( token2, "|%s|%s", buff, buff2); + strncat(token , token2,sizeof(token)); + strcpy(token2, "|"); + + NPC_GetItemVippointList( argstr, token2); + strncat( token, token2, sizeof( token)); + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} +void NPC_GetItemVippointList(char *argstr,char *argtoken) +{ + int i = 1; + int tmp; + char *name ="\0"; + char buff2[256]; +#ifdef _NEW_MANOR_LAW + char buff3[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff4[256]; + char buff5[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff6[256]; + int iCostVippoint = 0; + int iChangeItemCost = 0; +#endif + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int loopcnt = 0; + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buff2, sizeof( buff2)) + != NULL){ + rate = atof( buff2); + } +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostVippoint",buff3,sizeof(buff3)) == NULL) iCostVippoint = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",",i,buff2,sizeof(buff2)) !=FALSE ) { +#ifdef _NEW_MANOR_LAW + if(iCostVippoint > -1){ + if(getStringFromIndexWithDelim(buff3,",",i,buff4,sizeof(buff4)) != FALSE) iCostVippoint = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",i,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + i++; + if(strstr( buff2, "-") == NULL) { + name = ITEM_getNameFromNumber( atoi(buff2)); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemVippointStrStr( atoi( buff2), rate, name, token2,iCostVippoint,iChangeItemCost); + #else + NPC_ItemVippointStrStr( atoi( buff2), rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + }else{ + int start; + int end; + getStringFromIndexWithDelim( buff2, "-", 1, token2, sizeof(token2)); + start = atoi( token2); + getStringFromIndexWithDelim( buff2, "-", 2 ,token2, sizeof(token2)); + end = atoi( token2); + if(start > end){ + tmp = start; + start = end; + end = tmp; + } + end++; + for(; start < end ; start++ ) { + /*--ڒo???--*/ + + name = ITEM_getNameFromNumber( start ); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemVippointStrStr( start, rate, name, token2,iCostVippoint,iChangeItemCost); + #else + NPC_ItemVippointStrStr( start, rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + } + } + } + } +} + + #ifdef _NEW_MANOR_LAW + void NPC_ItemVippointStrStr(int itemID,double rate,char *name,char *token2,int iCostVippoint,int iChangeItemCost) + #else + void NPC_ItemVippointStrStr(int itemID,double rate,char *name,char *token2) + #endif +{ + + int gold; + int level; + int graNo; + char info[1024]; + char escape[256]; + + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + level = ITEM_getlevelFromITEMtabl( itemID); + graNo = ITEM_getgraNoFromITEMtabl( itemID); + strcpy(escape,ITEM_getItemInfoFromNumber( itemID)); + gold=(int)(gold * rate); + + makeEscapeString( escape, info, sizeof( info)); + makeEscapeString( name, escape, sizeof( escape)); + char tempbuf[64]; + if(iCostVippoint==0) sprintf(tempbuf,"ȡ "); + else if(iCostVippoint<10) sprintf(tempbuf," %d ",iCostVippoint); + else if(iCostVippoint<100) sprintf(tempbuf," %d ",iCostVippoint); + else if(iCostVippoint<1000) sprintf(tempbuf," %d ",iCostVippoint); + else if(iCostVippoint<10000) sprintf(tempbuf," %d ",iCostVippoint); + else if(iCostVippoint<100000) sprintf(tempbuf," %d ",iCostVippoint); + else sprintf(tempbuf,"%d ",iCostVippoint); + char newescape[256]; + sprintf(newescape,"%s%s",tempbuf,escape); +#ifdef _NEW_MANOR_LAW + sprintf(token2,"%s|0|%d|%d|%d|%s|%d|",newescape,level,gold,graNo,info,-1); +#else + sprintf( token2, "%s|0|%d|%d|%d|%s|", newescape, level, gold, graNo, info); +#endif +} + +BOOL NPC_SetNewItemVippoint(int meindex,int talker,char *data) +{ + + char buf[1024]; + char buff2[128]; +#ifdef _NEW_MANOR_LAW + char buff3[1024]; + char buff4[128]; + char buff5[1024]; + char buff6[128]; + int iCostVippoint = 0; + int iChangeItemCost = 0; +#endif + int i = 1, j = 1; + int select; + int kosuu = 0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int gold = 0; + int kosuucnt = 0; + int itemindex; + + /*--߯Ȼ׷ëѱݩ--*/ + getStringFromIndexWithDelim( data, "|", 1, buf, sizeof( buf)); + select = atoi(buf); + if(select == 0) return FALSE; + getStringFromIndexWithDelim( data, "|", 2, buf, sizeof( buf)); + kosuu = atoi(buf); + if( kosuu <= 0 ) return FALSE; + + /*--Ѽ ¾-*/ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex = CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ) { + kosuucnt++; + } + } + + /*--߯Ȼ Ѽ ˼ ӡﴡ Իƾмƥ--*/ + /*--ӡ ë ľ--*/ + if( kosuucnt < kosuu) kosuu = kosuucnt; + + /*--δ޷¡--*/ + if(kosuucnt == 0 ) return FALSE; + + i = 1; + + /*--Ҽ̻ 跴̻ﻥئ巴 --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return FALSE; + } + + /*---ë ئľ1.0)-*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buf, sizeof( buf)) != NULL) { + rate= atof( buf); + } + +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostVippoint",buff3,sizeof(buff3)) == NULL) iCostVippoint = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + + /*--ʧ ةܰë浤Ƿ-*/ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buf, sizeof( buf)) != NULL ){ + while(getStringFromIndexWithDelim(buf , "," , j, buff2, sizeof(buff2)) != FALSE ){ +#ifdef _NEW_MANOR_LAW + if(iCostVippoint > -1){ + if(getStringFromIndexWithDelim(buff3,",",j,buff4,sizeof(buff4)) != FALSE) iCostVippoint = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",j,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + j++; + /*-- "-"ֳľ¾--*/ + if(strstr( buff2, "-") == NULL) { + if( ITEM_getcostFromITEMtabl(atoi(buff2)) !=-1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemVippointBuy(meindex, talker,atoi(buff2),kosuu,rate,iCostVippoint,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemVippointBuy(meindex, talker,atoi(buff2),kosuu,rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + }else{ + /*--ʧ ة 15-25 ƥ˪ľ--*/ + int start; + int end; + + /* "-"ƥľ炙Ѱ Ѱë --*/ + getStringFromIndexWithDelim( buff2, "-", 1, argstr, sizeof(argstr)); + start = atoi( argstr); + getStringFromIndexWithDelim( buff2, "-", 2 ,argstr, sizeof(argstr)); + end = atoi( argstr); + end++; + + /*-- įѱئȻգ ľ׸**/ + if(start > end){ + gold = start; + start = end; + end = gold; + } + + /*--"-"ƥľмʧ ةë ë --*/ + for(; start < end ; start++ ) { + if( ITEM_getcostFromITEMtabl( start) != -1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemVippointBuy(meindex, talker, start, kosuu, rate,iCostVippoint,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemVippointBuy(meindex, talker, start, kosuu, rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + } + } + } + } + + return FALSE; + +} + +/*--------------------------------------------- + *ʧ ةܰë浤 + *--------------------------------------------*/ +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemVippointBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostVippoint,int iChangeItemCost) +#else +BOOL NPC_AddItemVippointBuy(int meindex, int talker,int itemID,int kosuu,double rate) +#endif +{ + + int itemindex; + int i; + int gold; + int ret; + int maxgold; +#ifdef _NEW_MANOR_LAW + int iTotalCostVippoint = -1; +#endif + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + gold = (int)(gold * rate); + + maxgold = gold * kosuu; + if(CHAR_getInt( talker, CHAR_GOLD) < maxgold ) return FALSE; +#ifdef _NEW_MANOR_LAW + if(iCostVippoint > 0){ + iTotalCostVippoint= iCostVippoint * kosuu; + if(sasql_vippoint(CHAR_getUseID(talker),0,0) < iTotalCostVippoint){ + CHAR_talkToCli( talker, meindex, "ĻԱ㲻㡣",CHAR_COLORWHITE); + return FALSE; + } + } +#endif + +// if( addNpcFamilyTax( meindex, talker, maxgold*0.4 ) ) +// print(" FamilyTaxDone! "); +// else +// print(" FamilyTaxError!"); + addNpcFamilyTax( meindex, talker, maxgold*0.4 ); + for(i = 0 ; i < kosuu ; i++){ + itemindex = ITEM_makeItemAndRegist( itemID); + + if(itemindex == -1) return FALSE; + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_itemshop.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + CHAR_sendItemDataOne( talker, ret); + } + CHAR_DelGold( talker, maxgold); +#ifdef _NEW_MANOR_LAW + if(iTotalCostVippoint > 0){ + sasql_vippoint( CHAR_getUseID(talker), -iTotalCostVippoint,1); + char tmpbuf[128]; + sprintf( tmpbuf, "۳%dԱ", iTotalCostVippoint); + CHAR_talkToCli( talker, -1, tmpbuf, CHAR_COLORYELLOW); + } + //int fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +#endif + //CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; + +} + +//ѡ (,,ȥ) СӴ +void NPC_ItemVippointShop_Menu(int meindex,int talker) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[256]; + int fd = getfdFromCharaIndex( talker); + + //argstrȡ趨ѶϢ: ->buy_rate:1.0|sell_rate:0.2|buy_msg:,,л,kau,buy............. (мķָǶʱ) + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + //tokenΪӴtitle : ķķߵ|ӭ + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); +#ifdef _NEW_MANOR_LAW + snprintf(token, sizeof(token),"%s|%s|%d",CHAR_getChar(meindex,CHAR_NAME),buff,CHAR_getInt(talker,CHAR_FAME)/100); +#else + snprintf(token, sizeof(token),"%s|%s",CHAR_getChar( meindex, CHAR_NAME), buff); +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMENU, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +void NPC_ItemVippointShop_SellMain(int meindex,int talker,int before) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + //ȡnpc趨 + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_FAME)/100); + lssproto_S2_send(fd,token); +#endif + + if(before != -1) { + sprintf(token,"1|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN + +CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "sell_main", buff2, sizeof( buff)); + sprintf( token, "1|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "stone_msg", buff, sizeof( buff)); + + if(CHAR_getWorkInt(meindex,NPC_SHOP_WORK_EXPRESS) == 1 ) { + NPC_Util_GetStrFromStrWithDelim( argstr, "exrealy_msg", buff2, sizeof(buff2)); + }else{ + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff2, sizeof( buff2)); + } + sprintf( token2,"%s|%s|", buff, buff2); + NPC_GetLimtItemVippointList( talker,argstr, token2, -1);//ϸҪĵ + strncat( token, token2, sizeof( token)); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN+ + CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } +} +int NPC_GetLimtItemVippointList(int talker, char *argstr, char* token2,int sell) +{ + + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token3[NPC_UTIL_GETARGSTR_LINEMAX]; + int k = 0 , i = 1 , j = 0; + int imax; + int itemtype = 0; + int itemindex; + int okflg = 0; + char buf[256]; + int flg=0; + int cost; + + if(sell == -1 ){ + i = CHAR_STARTITEMARRAY; + imax = CHAR_MAXITEMHAVE; + flg = -1; + }else{ + i= sell; + imax= sell + 1; + flg = 1; + } + + for( ; i < imax ; i++ ){ + okflg=0; + itemindex = CHAR_getItemIndex( talker , i ); + + if( ITEM_CHECKINDEX( itemindex) ){ + if( NPC_Util_GetStrFromStrWithDelim( argstr,"LimitItemType", buff, sizeof( buff)) != NULL ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ +#ifdef _ITEM_TYPETABLE + int cmpmaxitem = sizeof(TypeTable)/sizeof(TypeTable[0]); +#endif + k++; +#ifdef _ITEM_TYPETABLE + for(j = 0 ; j < cmpmaxitem ; j++){ +#else + for(j = 0 ; j < ITEM_CATEGORYNUM+3 ; j++){ +#endif + if(strcmp( TypeTable[ j].arg , token) == 0 ) { + itemtype = TypeTable[ j].type; + if(ITEM_getInt(itemindex,ITEM_TYPE) == itemtype) { + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat( token2, token3, sizeof( token3)); + okflg = 1; + }else if(itemtype == 30){ + if( 8 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 15) ){ + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 40){ + if(( 0 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 4)) + || (17 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 19))) { + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 50){ + if( 5 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 7) ){ + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + break; + } + } + + if(okflg == 1) break; + } + } + if( (NPC_Util_GetStrFromStrWithDelim( argstr, "LimitItemNo", buff,sizeof( buff))!= NULL) && okflg == 0 ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ + k++; + if(strstr( token, "-")==NULL && strcmp(token,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(token)) { + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg=1; + } + }else if (strstr( token, "-") != NULL){ + int start, end; + int work; + + if( getStringFromIndexWithDelim( token, "-", 1, buf, sizeof(buf)) == FALSE ) + return -1; + start = atoi( buf); + if( getStringFromIndexWithDelim( token, "-", 2 ,buf, sizeof(buf)) == FALSE ) + return -1; + end = atoi( buf); + + if(start > end){ + work = start; + start = end; + end = work; + } + + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_GetSellItemVippointList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + } + } + + if(okflg == 0) { + cost = NPC_GetSellItemVippointList(itemindex, 1, argstr, token3, i, sell); + if(sell != -1) return -1; + strncat( token2, token3, sizeof( token3)); + } + + } + } + return -1; +} + + + +/*---------------------------------------------------------- + + ͷʧ˪P + + *----------------------------------------------------------*/ +int NPC_GetSellItemVippointList(int itemindex,int flg, char *argstr,char *argtoken,int select,int sell) +{ + char buff[256]; + double rate = 0.2; + char buff2[256]; + char buff3[64]; + int k = 1; + int cost = -1; + + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_item",buff, sizeof( buff)) != NULL){ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_rate",buff2, sizeof( buff2)) != NULL ){ + rate = atof(buff2); + }else{ + rate = 1.2; + } + + while(getStringFromIndexWithDelim(buff , "," , k, buff2, sizeof(buff2)) !=FALSE ){ + k++; + if(strstr( buff2, "-") == NULL && strcmp(buff2,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(buff2)){ + cost = NPC_SellItemVippointstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + }else if (strstr( buff2, "-") != NULL){ + int start; + int end; + int work; + getStringFromIndexWithDelim( buff2, "-", 1, buff3, sizeof(buff3)); + start = atoi( buff3); + getStringFromIndexWithDelim( buff2, "-", 2 ,buff3, sizeof(buff3)); + end = atoi( buff3); + + if(start > end){ + work = start; + start = end; + end = work; + } + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_SellItemVippointstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + } + } + } + if( NPC_Util_GetStrFromStrWithDelim( argstr,"sell_rate",buff, sizeof( buff)) != NULL ){ + rate = atof(buff); + cost = NPC_SellItemVippointstrsStr( itemindex, flg ,rate, argtoken,select,sell); + return cost; + } + + return cost; +} + +int NPC_SellItemVippointstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell) +{ + int cost; + char escapedname[256]; + char name[256]; + char *eff; + + + cost = ITEM_getInt( itemindex, ITEM_COST); + cost = (int)(cost * rate); + + if(sell != -1) return cost; + + strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME)); + makeEscapeString( escapedname, name, sizeof( name)); + eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING); + makeEscapeString( eff, escapedname, sizeof(escapedname)); + + + + sprintf( argtoken, +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%s|%d|%d|", +#else + "%s|%d|%d|%d|%s|%d|", +#endif + name, flg, cost, + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + escapedname, select +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#endif + ); + + return -1; + +} + +BOOL NPC_SellNewItemVippoint(int meindex,int talker,char *data) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256], token2[256]; + int cost, k, select, itemindex; + int MyGold, MaxGold, sellnum=1; + + MaxGold = CHAR_getMaxHaveGold( talker); + MyGold = CHAR_getInt( talker, CHAR_GOLD); + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + getStringFromIndexWithDelim(data , "|" ,1, token, sizeof( token)); + select = atoi(token); +#ifdef _ITEM_PILENUMS + getStringFromIndexWithDelim(data , "|" ,2, token, sizeof( token)); + sellnum = atoi(token); +#endif + + if( select < CHAR_STARTITEMARRAY || select >= CHAR_MAXITEMHAVE ) return FALSE; + k = select; + itemindex = CHAR_getItemIndex( talker , k); + cost = NPC_GetLimtItemVippointList( talker,argstr, token2,select); + if( cost == -1 || (cost*sellnum)+MyGold >= MaxGold || !ITEM_CHECKINDEX( itemindex) ){ + int fd = getfdFromCharaIndex( talker); + sprintf(token,"\n\nѽ!Բ" "\n\nԲ ! ɲѡһأ" ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return FALSE; + } +#ifdef _ITEM_PILENUMS + if( NPC_DelItem( talker, k, sellnum) == FALSE ) return FALSE; +#else + { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "Sell()", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + CHAR_DelItem( talker, k); +#endif + CHAR_AddGold( talker, cost*sellnum); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; +} + + + +void NPC_LimitItemVippointShop(int meindex,int talker,int select) +{ + + int fd = getfdFromCharaIndex( talker); + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", buf, sizeof( buf))!=NULL){ + sprintf(token,"\n\n%s", buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + CHAR_talkToCli( talker, meindex, "רŵꡣ",CHAR_COLORWHITE); + } + return; +} + +void NPC_VippointExpressmanCheck(int meindex,int talker) +{ + int fd = getfdFromCharaIndex( talker); + char token[1024]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buf, sizeof( buf)); + sprintf(token,"4\n%s\n\n%s" + "\n\n " + "\n\n " + ,CHAR_getChar(meindex,CHAR_NAME),buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + return; + + +} + diff --git a/npc/npc_janken.c b/npc/npc_janken.c new file mode 100644 index 0000000..73e8e19 --- /dev/null +++ b/npc/npc_janken.c @@ -0,0 +1,512 @@ +#include "version.h" +#include +#include "common.h" +#include "char_base.h" +#include "npc_janken.h" +#include "npcutil.h" +#include "char.h" +#include "lssproto_serv.h" +#include "buf.h" +#include "function.h" +#include "readmap.h" +#include "object.h" +#include "log.h" + +/* + *Ԫ + */ +static void NPC_Janken_selectWindow( int meindex, int talker, int num); +void NPC_JnakenJudge(int meindex,int talker,int sel); +BOOL NPC_JankenEntryItemCheck(int talker,char *buf); +BOOL NPC_JankenEntryItemDel(int talker,char *buf); +void NPC_WarpPointGet(int meindex,int talker,int *fl,int *x,int *y,int judge); + + +/********************************* +* +*********************************/ +BOOL NPC_JankenInit( int meindex ) +{ + + //ë + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEJANKEN ); + + return TRUE; + +} + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_JankenTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + NPC_Janken_selectWindow(meindex, talkerindex, 0); + + + + +} + + + +/****************************** + * ľľ + ******************************/ +static void NPC_Janken_selectWindow( int meindex, int talker, int num) +{ + + char token[1024]; + char buf[32]; + int fd = getfdFromCharaIndex( talker); + int buttontype=0; + int windowtype=0; + int windowno=0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + + /*--̼⻥мƥƱɬ--*/ + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_janken Init: GetArgStrErr"); + return ; + } + + + switch( num) + { + case 0: + + /*-- ⻥ ľɾ޷¡ --*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr, "MainMsg", token, sizeof( token)) == NULL) + { + print("Janken:MainMsg:%s", CHAR_getChar( meindex, CHAR_NAME)); + return ; + } + + /*-- --*/ + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_JANKEN_START; + break; + + + case 1: + + //ʧ ة + if(NPC_Util_GetStrFromStrWithDelim( argstr, "EntryItem", buf, sizeof( buf))!= NULL) { + + if(NPC_JankenEntryItemCheck(talker,buf) == FALSE) + { + NPC_Janken_selectWindow(meindex, talker, 3); + } + + //޼üʧ ةë + if(NPC_JankenEntryItemDel(talker,buf) == FALSE){ + print("ԪERR:ʧ ةƱ"); + } + } + + + /*-- --*/ + sprintf(token," ʯͷ\n" + "\n\n ʯͷ " + "\n\n " + "\n\n " + ); + + buttontype=WINDOW_BUTTONTYPE_NONE; + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno=CHAR_WINDOWTYPE_JANKEN_MAIN; + break; + + case 2: + /*--ؤг --*/ + //sprintf(token," ؤгƥ\n" + sprintf(token," ƽ\n" + "\n\n ʯͷ " + "\n\n " + "\n\n " + ); + + buttontype=WINDOW_BUTTONTYPE_NONE; + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno=CHAR_WINDOWTYPE_JANKEN_MAIN; + break; + + case 3: + /*-- ⻥ ľɾ޷¡ --*/ + NPC_Util_GetStrFromStrWithDelim( argstr, "NoItem", token, sizeof( token)); + + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_JANKEN_END; + + break; + + } + + +// makeEscapeString( token, escapedname, sizeof(escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + + +} + + + +/********************************* +* ū帲 +*********************************/ +void NPC_JankenWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + switch( seqno){ + case CHAR_WINDOWTYPE_JANKEN_START: + + if(select==WINDOW_BUTTONTYPE_YES){ + NPC_Janken_selectWindow(meindex, talkerindex, 1); + } + break; + + case CHAR_WINDOWTYPE_JANKEN_MAIN: + if (atoi(data) >= 3){ + NPC_JnakenJudge(meindex,talkerindex,atoi(data) ); + } + break; + } +} + + +/* + *Ҽ + */ +void NPC_JnakenJudge(int meindex,int talker,int sel) +{ + int player=-1; + int jankenman; + char j_char[3][8]={" ʯͷ "," "," "}; + char token[1024]; + int shouhai = 0; + int fd = getfdFromCharaIndex( talker); + int fl=0,x=0,y=0; + + + if(sel == 3) player = 0; // + if(sel == 5) player = 1; //ƽ + if(sel == 7) player = 2; //ɡ + + jankenman = rand()%3; + + switch(jankenman){ + case 0: + if(player == 2){ + shouhai = 1; + }else if(player == 1){ + shouhai = 2; + } + break; + + case 1: + if(player == 0){ + shouhai = 1; + }else if(player == 2){ + shouhai = 2; + } + break; + + case 2: + if(player == 1){ + shouhai = 1; + }else if(player == 0){ + shouhai = 2; + } + break; + } + + if(shouhai == 1){ + //Change add Ҳʤ˸ĵ + NPC_JankenItemGet( meindex, talker, "WinItem" ); + + NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 0); + + snprintf( token, sizeof( token ) , + " \n\n" + " %16s %-16s\n" + " [%s] VS [%s]\n\n\n" + " %-16s ʤ", + CHAR_getChar(meindex,CHAR_NAME),CHAR_getChar(talker,CHAR_NAME), + j_char[jankenman],j_char[player], + CHAR_getChar(talker,CHAR_NAME) + ); + +// CHAR_talkToCli( talker , -1 ,token , CHAR_COLORCYAN ); + + // + CHAR_warpToSpecificPoint(talker, fl, x, y); + + // 巴٣ʧë£ + CHAR_sendWatchEvent( CHAR_getWorkInt( talker, CHAR_WORKOBJINDEX), CHAR_ACTPLEASURE,NULL,0,TRUE); + CHAR_setWorkInt( talker, CHAR_WORKACTION, CHAR_ACTPLEASURE); + + }else if(shouhai == 2){ + + //Change add Ҳ˸ĵ + NPC_JankenItemGet( meindex, talker, "LoseItem" ); + + NPC_WarpPointGet(meindex, talker, &fl, &x, &y, 1); + snprintf( token, sizeof( token ) , + " \n\n" + " %16s %-16s\n" + " [%s] VS [%s]\n\n\n" + " %-16s ", + CHAR_getChar(meindex,CHAR_NAME),CHAR_getChar(talker,CHAR_NAME), + j_char[jankenman],j_char[player], + CHAR_getChar(talker,CHAR_NAME) + ); +// CHAR_talkToCli( talker , -1 ,token , CHAR_COLORCYAN ); + + // + CHAR_warpToSpecificPoint(talker, fl, x, y); + + // 巴 Уʧë + CHAR_sendWatchEvent( CHAR_getWorkInt( talker, CHAR_WORKOBJINDEX), CHAR_ACTSAD,NULL,0,TRUE); + CHAR_setWorkInt( talker, CHAR_WORKACTION, CHAR_ACTSAD); + + + }else{ + //ؤг + NPC_Janken_selectWindow( meindex, talker, 2); + return; + } + + //˪ + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_JANKEN_END, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + + +} + + +/* + *ëGET£ + */ +void NPC_WarpPointGet(int meindex,int talker,int *fl,int *x,int *y,int judge) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char *strbuf[2] = {"WinWarp","LoseWarp"}; + char buf[64]; + char buf2[32]; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_janken Init: GetArgStrErr"); + return ; + } + + + /*--ë --*/ + NPC_Util_GetStrFromStrWithDelim( argstr, strbuf[judge], buf, sizeof( buf)); + getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2)); + *fl=atoi(buf2); + getStringFromIndexWithDelim(buf,",",2,buf2,sizeof(buf2)); + *x=atoi(buf2); + getStringFromIndexWithDelim(buf,",",3,buf2,sizeof(buf2)); + *y=atoi(buf2); + + +} + +/* + *--ʧ ةͷë浤 + */ +BOOL NPC_JankenEntryItemCheck(int talker,char *buf) +{ + + char buf2[512]; + char buf3[256]; + int id=0; + BOOL flg = FALSE; + int i; + int itemindex; + int itemno; + int kosuu; + int cnt=0; + int k=1; + + while(getStringFromIndexWithDelim(buf , "," , k, buf2, sizeof(buf2)) + !=FALSE ) + { + flg = FALSE; + k++; + + if(strstr(buf2,"*") != NULL){ + cnt = 0; + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemno = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id = ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno == id){ + cnt++; + if(cnt == kosuu){ + flg = TRUE; + break; + } + } + } + } + if(flg == FALSE) + { + return FALSE; + } + }else{ + itemno = atoi(buf2); + + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id = ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno == id){ + flg = TRUE; + break; + } + } + } + + if(flg == FALSE) + { + return FALSE; + } + } + } + + return TRUE; + +} + +BOOL NPC_JankenEntryItemDel(int talker,char *buf) +{ + + int i = 1, j = 1,k = 1; + char buff3[128]; + char buf2[32]; + int itemindex; + + while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + if(strstr(buff3, "*") !=NULL){ + int itemno; + int kosuu; + int id; + int cnt=0; + getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); + itemno = atoi(buf2); + getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); + kosuu = atoi(buf2); + for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + cnt++; + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "QuizDelItem(->)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_DelItem( talker, i); + if(cnt == kosuu){ + break; + } + } + } + } + }else{ + /*--Ϸ įʧ ةë---*/ + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + + if( ITEM_CHECKINDEX(itemindex) ){ + if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "QuizDelItem(->)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_DelItem( talker, j); + } + } + } + } + } + + return TRUE; +} + +BOOL NPC_JankenItemGet(int meindex,int talker, char *wl) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_janken ItemGet: GetArgStrErr"); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, wl, buf, sizeof( buf) ) !=NULL){ + NPC_EventAddItem( meindex, talker, buf); + } +} + diff --git a/npc/npc_luckyman.c b/npc/npc_luckyman.c new file mode 100644 index 0000000..fd52f20 --- /dev/null +++ b/npc/npc_luckyman.c @@ -0,0 +1,239 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_luckyman.h" + + +static void NPC_LuckyMan_selectWindow( int meindex, int toindex, int num,char *msg); +void NPC_LuckyManAllHeal( int talker,int mode ); +BOOL NPC_LuckyManLevelCheck(int meindex,int talker); +void NPC_LuckyDisp(int meindex,int talker); +BOOL NPC_LuckyCostCheck(int meindex,int talker,int cost); +int NPC_GetMoney(int meindex,int talker,char *buf); + + + +/********************************* +* +*********************************/ +BOOL NPC_LuckyManInit( int meindex ) +{ + + /*--ƽҷ¼ëɬ--**/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPELUCKYMAN ); + + return TRUE; +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_LuckyManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[256]; + char token[512]; + int cost; + + + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2) == FALSE) { + /* */ + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) { + print("NPC_ExChange.c TypeCheck: GetArgStrErr\n"); + print("NPCName=%s\n", CHAR_getChar( meindex, CHAR_NAME)); + return; + } + + + NPC_Util_GetStrFromStrWithDelim( argstr,"Stone", buf, sizeof( buf)); + cost = NPC_GetMoney( meindex, talkerindex, buf); + + NPC_Util_GetStrFromStrWithDelim( argstr,"main_msg", buf, sizeof( buf)); + sprintf( token, buf, cost); + + NPC_LuckyMan_selectWindow( meindex, talkerindex, 2, token); + +} + + +static void NPC_LuckyMan_selectWindow( int meindex, int toindex, int num,char *msg) +{ + + int fd = getfdFromCharaIndex( toindex); + char token[1024]; + int buttontype = 0,windowtype = 0,windowno = 0; + + + switch( num){ + case 1: + sprintf(token ,"յơ" + "\n\n%s",msg + ); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; + break; + + case 2: + sprintf(token, "ռʦ" + "\n\n%s",msg + ); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; + break; + + case 3: + sprintf(token, "ռʦ" + "\n\n%s",msg + ); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_START; + break; + } + + + /*--˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + +} + + +/*----------------------------------------- +ͷʧ߯Ȼݱ̫ľ£ +-------------------------------------------*/ +void NPC_LuckyManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[256]; + int money; + int level; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("NPC_ExChange.c TypeCheck: GetArgStrErr\n"); + print("NPCName=%s\n", CHAR_getChar(meindex,CHAR_NAME)); + return; + } + + switch( seqno){ + case CHAR_WINDOWTYPE_WINDOWPETSHOP_START: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_Util_GetStrFromStrWithDelim( argstr, "Stone", buf,sizeof(buf)); + + if(strstr(buf,"LV") != NULL) { + char buff2[32]; + level = CHAR_getInt( talkerindex, CHAR_LV); + getStringFromIndexWithDelim( buf, "*", 2, buff2,sizeof( buff2)); + money = level * atoi( buff2); + + if(NPC_LuckyCostCheck(meindex,talkerindex,money) == FALSE) { + NPC_Util_GetStrFromStrWithDelim( argstr,"NoMoney", buf, sizeof( buf)); + NPC_LuckyMan_selectWindow( meindex, talkerindex, 3, buf); + return; + } + }else{ + money = atoi( buf); + if(NPC_LuckyCostCheck(meindex,talkerindex ,money) == FALSE) { + NPC_Util_GetStrFromStrWithDelim( argstr,"NoMoney", buf,sizeof( buf)); + NPC_LuckyMan_selectWindow( meindex, talkerindex, 3, buf); + return; + } + } + + CHAR_DelGold( talkerindex, money ); + + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + NPC_LuckyDisp( meindex, talkerindex); + + }else if(select == WINDOW_BUTTONTYPE_OK) { + + } + break; + } +} + + + +void NPC_LuckyDisp(int meindex,int talker) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[16]; + char token[1024]; + char buf2[512]; + int i = 1; + + /*--ɬð̻ë --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) { + print("NPC_Savepoint.c Init: GetArgStrErr"); + return; + } + + /*--ëέ--*/ + sprintf( buf, "luck%d", CHAR_getInt( talker, CHAR_LUCK)); + NPC_Util_GetStrFromStrWithDelim( argstr, buf, buf2, sizeof( buf2)); + + while(getStringFromIndexWithDelim( buf2, ",", i, token, sizeof( token)) + != FALSE) + { + i++; + } + i--; + i = rand()%i + 1; + + /*--¼ĸةƥë --*/ + getStringFromIndexWithDelim( buf2,",", i, token, sizeof( token)); + NPC_LuckyMan_selectWindow( meindex, talker, 1, token); +} + + +/*---ż-**/ +BOOL NPC_LuckyCostCheck(int meindex,int talker,int cost) +{ + /*--ػɬ---*/ + /*---ŻԻ¾---*/ + if(CHAR_getInt( talker, CHAR_GOLD) < cost) { + return FALSE; + } + return TRUE; + +} + + +int NPC_GetMoney(int meindex,int talker,char *buf) +{ + int level; + int money; + + if(strstr(buf,"LV") != NULL) { + char buff2[32]; + level = CHAR_getInt(talker,CHAR_LV); + getStringFromIndexWithDelim( buf, "*" ,2, buff2,sizeof( buff2)); + money = level * atoi( buff2); + }else{ + money = atoi( buf); + } + return money; + +} diff --git a/npc/npc_makepair.c b/npc/npc_makepair.c new file mode 100644 index 0000000..13be140 --- /dev/null +++ b/npc/npc_makepair.c @@ -0,0 +1,542 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_transerman.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_makepair.h" +#include "npc_eventaction.h" + +#ifdef _NPC_MAKEPAIR +#define MAXPAIRNUMS 30 +PairMenu PairList[2][MAXPAIRNUMS]; + +enum { + WINDOW_START=10, + WINDOW_USER, + WINDOW_SELECT, // + WINDOW_PAIR, //Ҷ + WINDOW_PAIROK, + WINDOW_PAIRNO, + WINDOW_WARP, //Ծ + WINDOW_END, // + WINDOW_TALKSTART=20, + WINDOW_TALKSELECT, + WINDOW_TALKPAIR, + WINDOW_RETURN, + WINDOW_TALKEND, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_WORK_PAIRTEAMS = CHAR_NPCWORKINT2, +/* + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +#define MAKEPAIR_STANDBY 100*60 +static void NPC_MakePair_selectWindow( int meindex, int toindex, int num,int select); +BOOL MakePairMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token); +void CheckPairUsers( int *male, int *female); +BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token); +BOOL NPC_PairRegister( int toindex); +void NPC_PairUserAndWarp( int meindex, int toindex, int forindex, char *arg); +int NPC_getPairCode( int toindex); +int NPC_getTitleMsg( int meindex, int toindex, char *arg, char *token, int title); +int NPC_getNextTitle( int meindex, int toindex, char *arg, int title, int select); + + +BOOL NPC_MakePairManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + int i; + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_MakePairMan: GetArgStrErr!!"); + return FALSE; + } + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_MAKEPAIR); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, MAKEPAIR_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + CHAR_setWorkInt( meindex, NPC_WORK_PAIRTEAMS, 0); + + for( i=0; i 0){ + CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1); + sprintf( token, "ȡǰһε롣"); + }else { + char buf1[256]; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf1, sizeof( buf1) ) != NULL) { + if( NPC_ActionPassCheck( meindex, toindex, buf1) == FALSE ){ + CHAR_talkToCli( toindex, meindex, "㣡", CHAR_COLORYELLOW); + return; + } + } + NPC_PairForage( meindex, toindex, npcarg, token); + } + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = WINDOW_TALKEND; + } + break; + case WINDOW_PAIROK: //ͬ + if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) > 0){ + int forindex = CHAR_getWorkInt( toindex, CHAR_MYPAIRINDEX); + NPC_PairUserAndWarp( meindex, toindex, forindex, npcarg); + } + return; + case WINDOW_PAIRNO://ͬ + { + int forindex = CHAR_getWorkInt( toindex, CHAR_MYPAIRINDEX); + if( CHAR_CHECKINDEX( forindex) ){ + if( CHAR_getWorkInt( forindex, CHAR_MYPAIRFLG) > 0 ){ + CHAR_talkToCli( forindex, meindex, "Էܾ롣", CHAR_COLORYELLOW); + CHAR_setWorkInt( forindex, CHAR_MYPAIRINDEX, -1); + CHAR_setWorkInt( forindex, CHAR_MYPAIRFLG, -1); + } + } + CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1); + CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, -1); + CHAR_talkToCli( toindex, meindex, "ܾԷ롣", CHAR_COLORYELLOW); + return; + } + break; + case WINDOW_WARP: + break; + case WINDOW_END: + break; + } + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_MakePairManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_MakePairMan: GetArgStrErr!!"); + return; + } + switch( seqno) { + case WINDOW_TALKSTART: + { + int choose=atoi( data); + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( choose){ + case 1:// + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_USER, 0); + break; + case 2:// + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIR, 0); + break; + case 3:// + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_SELECT, 0); + break; + } + } + + break; + case WINDOW_TALKSELECT: + { + int title = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + title = NPC_getNextTitle( meindex, talkerindex, npcarg, title, select); + if( title < 0 ) return ; + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, title); + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_SELECT, select); + } + break; + case WINDOW_TALKPAIR://ظ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO){ + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIRNO, 0); + }else { + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIROK, 0); + } + break; + case WINDOW_RETURN: + NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_START, 0); + break; + case WINDOW_TALKEND: + break; + } +} +void NPC_MakePairManLoop( int meindex) +{ + int i; + for( i=0; i 0 ){ + if( !CHAR_CHECKINDEX( PairList[0][i].pindex) ){ + PairList[0][i].pindex = -1; + PairList[0][i].use = -1; + } + } + if( PairList[1][i].use > 0 ){ + if( !CHAR_CHECKINDEX( PairList[1][i].pindex) ){ + PairList[1][i].pindex = -1; + PairList[1][i].use = -1; + } + } + } +} + +BOOL MakePairMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token) +{ + char buf1[1024], buf2[256], buf3[256]; + BOOL FINDS=FALSE; + int talkNo=1; + if( npcarg == NULL ) return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuHead", buf1, sizeof( buf1) ) == NULL){ + return FALSE; + } + sprintf( token, "%s\n", buf1); + + sprintf( buf1, "MEMU%d", talkNo); + while( NPC_Util_GetStrFromStrWithDelim( npcarg, buf1, buf2, sizeof( buf2)) != NULL ) { + talkNo++; + sprintf( buf1, "MEMU%d", talkNo); + FINDS = TRUE; + sprintf( buf3, " %s\n", buf2); + strcat( token, buf3); + } + return FINDS; +} + +void CheckPairUsers( int *male, int *female) +{ + int i; + *male = 0; + *female = 0; + for( i=0; i 0 ) *male+=1; + if( PairList[1][i].use > 0 ) *female+=1; + } +} + +BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token) +{ + char buf1[256]; + int i; + int codes = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE); + int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); + Psex = (Psex==1)?1:0; + + + for( i=0; i 0 ) continue; + name = CHAR_getChar( PairList[Psex][i].pindex, CHAR_NAME); + cdKey = CHAR_getChar( PairList[Psex][i].pindex, CHAR_CDKEY); + if( strcmp( PairList[Psex][i].name, name) || strcmp( PairList[Psex][i].cdKey, cdKey) ){ + PairList[Psex][i].use = -1; + PairList[Psex][i].forindex = -1; + continue; + } + sprintf( token, "ԶΪ %s\nͳ룬ȺԷӦ", name); + if( NPC_Util_GetStrFromStrWithDelim( arg, "InviteMsg", buf1, sizeof( buf1) ) == NULL){ + break; + } + PairList[Psex][i].forindex = toindex; + fd = getfdFromCharaIndex( PairList[Psex][i].pindex); + + CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, 1); + CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, PairList[Psex][i].pindex); + CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG, 2); + CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRINDEX, toindex); + + name = CHAR_getChar( toindex, CHAR_NAME); + sprintf( buf, "%s\n%s\n%s", CHAR_getChar( meindex, CHAR_NAME),name, buf1); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OKCANCEL, WINDOW_TALKPAIR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf); + break; + } + if( i>= MAXPAIRNUMS ) { + if( NPC_Util_GetStrFromStrWithDelim( arg, "NoPairMsg", buf1, sizeof( buf1) ) != NULL){ + sprintf( token, "%s",buf1); + }else { + sprintf( token, "ûҵ"); + } + if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) <= 0 ) { + NPC_PairRegister( toindex); + } + return FALSE; + } + return TRUE; +} + +BOOL NPC_PairRegister( int toindex) +{ + char *cdKey = CHAR_getChar( toindex, CHAR_CDKEY); + char *name = CHAR_getChar( toindex, CHAR_NAME); + int space=-1,i; + int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) ); + Psex = (Psex==1)?0:1; + for( i=0; i=MAXPAIRNUMS){ + if( space != -1 && CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE) > 0 ){ + PairList[Psex][space].use = 1; + PairList[Psex][space].forindex = -1; + sprintf( PairList[Psex][space].cdKey, "%s", cdKey); + sprintf( PairList[Psex][space].name, "%s", name); + PairList[Psex][space].pindex = toindex; + PairList[Psex][space].code = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE); + + CHAR_talkToCli( toindex, -1, "", CHAR_COLORYELLOW); + return TRUE; + } + } + return FALSE; +} + +void NPC_PairUserAndWarp( int meindex, int toindex, int forindex, char *arg) +{ + char buf1[256]; + int fl=-1, x=-1, y=-1; + + if( !CHAR_CHECKINDEX( toindex)) return; + CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1); + CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, -1); + if( !CHAR_CHECKINDEX( forindex)) return; + CHAR_setWorkInt( forindex, CHAR_MYPAIRINDEX, -1); + CHAR_setWorkInt( forindex, CHAR_MYPAIRFLG, -1); + + if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) return; + if( CHAR_getWorkInt( forindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) return; + + if( NPC_Util_GetStrFromStrWithDelim( arg, "PAIRTOPOINT", buf1, sizeof( buf1) ) != NULL){ + char buf2[256]; + if( getStringFromIndexWithDelim( buf1,",",1,buf2,sizeof( buf2)) != FALSE ) + fl = atoi( buf2); + if( getStringFromIndexWithDelim( buf1,",",2,buf2,sizeof( buf2)) != FALSE ) + x = atoi( buf2); + if( getStringFromIndexWithDelim( buf1,",",3,buf2,sizeof( buf2)) != FALSE ) + y = atoi( buf2); + } + CHAR_DischargePartyNoMsg( toindex);//ɢŶ + CHAR_DischargePartyNoMsg( forindex);//ɢŶ + if( MAP_IsValidCoordinate( fl, x, y) != FALSE ){ + CHAR_warpToSpecificPoint( toindex, fl, x, y); + CHAR_warpToSpecificPoint( forindex, fl, x, y); + } + + CHAR_JoinParty_Main( toindex, forindex); + //lssproto_PR_send( fd, 0, 1); + { + int i; + for( i=0; i 0 ){ + if( PairList[0][i].pindex == toindex || + PairList[0][i].pindex == forindex ){ + PairList[0][i].pindex = -1; + PairList[0][i].use = -1; + } + } + if( PairList[1][i].use > 0 ){ + if( PairList[1][i].pindex == toindex || + PairList[1][i].pindex == forindex ){ + PairList[1][i].pindex = -1; + PairList[1][i].use = -1; + } + } + } + } +} + +int NPC_getPairCode( int toindex) +{ + char *arg="\0"; + int code=-1, i; + if( !CHAR_CHECKINDEX( toindex)) return-1; + for( i=0; i<15; i++) { + char buf1[256]; + int itemindex = CHAR_getItemIndex( toindex, i); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );// Ա|Ա|FLG + if( arg == "\0" )continue; + if( NPC_Util_GetStrFromStrWithDelim( arg, "PAIRCODE", buf1, sizeof( buf1) ) == NULL) continue; + code = atoi( buf1); + break; + } + return code; +} + +int NPC_getNextTitle( int meindex, int toindex, char *arg, int title, int select) +{ + char buf[NPC_UTIL_GETARGSTR_BUFSIZE], buf1[1024], buf2[256]; + int toID=0; + memset( buf, 0, sizeof( buf)); + if( getStringFromIndexWithDelim( arg, "PSYCHOMETRICS", 2, buf, sizeof( buf)) == FALSE ) + return -1; + if( getStringFromIndexWithDelim( buf , "}", title, buf1, sizeof( buf1)) == FALSE ) + return -1; + if( select == WINDOW_BUTTONTYPE_YES ) { + if( NPC_Util_GetStrFromStrWithDelim( buf1, "YESFOR", buf2, sizeof( buf2 )) == NULL) + return -1; + }else { + if( NPC_Util_GetStrFromStrWithDelim( buf1, "NOFOR", buf2, sizeof( buf2) ) == NULL) + return -1; + } + toID = atoi( buf2); + return toID; +} + +int NPC_getTitleMsg( int meindex, int toindex, char *arg, char *token, int title) +{ + char buf[NPC_UTIL_GETARGSTR_BUFSIZE], buf1[1024], buf2[256]; + memset( buf, 0, sizeof( buf)); + + if( getStringFromIndexWithDelim( arg, "PSYCHOMETRICS", 2, buf, sizeof( buf)) == FALSE ) + return -1; + //ȡһ + if( getStringFromIndexWithDelim( buf , "}", title, buf1, sizeof( buf1)) == FALSE ) + return FALSE; + if( NPC_Util_GetStrFromStrWithDelim( buf1, "TITLEMSG", buf2, sizeof( buf2 )) == NULL){ + if( NPC_Util_GetStrFromStrWithDelim( buf1, "FREE", buf2, sizeof( buf2 )) == NULL){ + return -1; + } + if( NPC_ActionPassCheck( meindex, toindex, buf2) == FALSE ) { + CHAR_talkToCli( toindex, meindex, "", CHAR_COLORYELLOW); + return -1; + } + if( Action_RunDoEventAction( meindex, toindex, buf1) == FALSE ){ + CHAR_talkToCli( toindex, meindex, "", CHAR_COLORYELLOW); + return -1; + } + if( NPC_Util_GetStrFromStrWithDelim( buf1, "ENDMSG", buf2, sizeof( buf2 )) == NULL){ + return -1; + } + sprintf( token, "%s", buf2); + return 2; + } + + sprintf( token, "%s", buf2); + return 1; +} +#endif diff --git a/npc/npc_manorsman.c b/npc/npc_manorsman.c new file mode 100644 index 0000000..e7d0dea --- /dev/null +++ b/npc/npc_manorsman.c @@ -0,0 +1,1333 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "handletime.h" +#include "npc_scheduleman.h" +#include "family.h" +#include "npc_manorsman.h" +#include "saacproto_cli.h" +#include "net.h" +#include "configfile.h" +#include "log.h" + +/* + * ׯ԰ PK ǼԱ + * + */ +int manorflag[10] = {0,0,0,0,0,0,0,0,0,0}; +char manorname[10][32] = {"\O","\O","\O","\O","\O","\O","\O","\O","\O","\O"}; +#define MAX_MANORSMAN 22 +static int FMPK_ManorsmanList[MAX_MANORSMAN]={ +-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1, +-1,-1 }; + +enum { + NPC_WORK_ID = CHAR_NPCWORKINT1, // ǼԱ ID, 0 ʼ + NPC_WORK_MANORID = CHAR_NPCWORKINT2, // ׯ԰ + NPC_WORK_CHALLENGEWAIT = CHAR_NPCWORKINT3, // սȴʱ + NPC_WORK_PEACEWAIT = CHAR_NPCWORKINT4, // սʱ + NPC_WORK_PREVLOOPTIME = CHAR_NPCWORKINT5, // ǰһδ Loop ʱ +#ifdef _NEW_MANOR_LAW + NPC_WORK_BETTLETIME = CHAR_NPCWORKINT6 // ¼ʱ +#endif +}; + +#define SCHEDULEFILEDIR "./Schedule/" + +#ifdef _FIX_FAMILY_PK_LIMIT // WON ADD սׯ԰ǰʮΪǰʮ +#define PK_LIMIT 20 +#endif + + +extern struct FM_POINTLIST fmpointlist; +extern void NPC_talkToFloor(int floor, int index1, int index2, char *data); +#ifdef _MANOR_PKRULE +extern struct FMS_DPTOP fmdptop; +#endif + +void NPC_ManorLoadPKSchedule(int meindex); // Load schedule from disk +#ifdef _NEW_MANOR_LAW +void SortManorSchedule(); +int SortManorScheduleMomentum(const void *indexa, const void *indexb); +extern int familyMemberIndex[FAMILY_MAXNUM][FAMILY_MAXMEMBER]; +int g_iSortManor; +#endif + +int NPC_getManorsmanListIndex( int ID) +{ + + if( ID < 0 || ID >= MAX_MANORSMAN ){ + return FMPK_ManorsmanList[ ID]; + } + return -1; +} +BOOL NPC_ManorSmanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int meid; + int a; + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEMANORSCHEDULEMAN ); + + // + NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)); + meid = NPC_Util_GetNumFromStrWithDelim(argstr, "id" ); + if ((meid<0) || (meid>=MAX_SCHEDULEMAN)) { + print("MANORSMAN init error: invalid ID(%d)\n",meid); + meid=0; + } + CHAR_setWorkInt(meindex, NPC_WORK_ID, meid); + + a = NPC_Util_GetNumFromStrWithDelim(argstr, "loop" ); + if ((a<100) || (a>10000)) a=1000; + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, a); + + a = NPC_Util_GetNumFromStrWithDelim(argstr, "manorid" ); + if ((a<1) || (a>/*4*/MANORNUM)) {// CoolFish 2002/2/25 + print("MANORSMAN init error: invalid manor id(%d).", a); + a=1; + } + CHAR_setWorkInt(meindex, NPC_WORK_MANORID, a); + + a = NPC_Util_GetNumFromStrWithDelim(argstr, "challengewait"); + if ((a<1) || (a>259200)) { + print("MANORSMAN init error: invalid challengewait(%d).",a); + a=259200; + } + CHAR_setWorkInt(meindex, NPC_WORK_CHALLENGEWAIT, a); + + a = NPC_Util_GetNumFromStrWithDelim(argstr, "peacewait"); + if ((a<0) || (a>432000)) { + print("MANORSMAN init error: invalid peacewait(%d).",a); + a=604800; + } + CHAR_setWorkInt(meindex, NPC_WORK_PEACEWAIT, a); + + NPC_ManorLoadPKSchedule(meindex); + + CHAR_setWorkInt(meindex, NPC_WORK_PREVLOOPTIME, NowTime.tv_sec); +#ifdef _NEW_MANOR_LAW + CHAR_setWorkInt(meindex,NPC_WORK_BETTLETIME,0); +#endif + + if( CHAR_getWorkInt( meindex, NPC_WORK_ID) >= 0 && + CHAR_getWorkInt( meindex, NPC_WORK_ID) 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + + switch (fmpks[fmpks_pos+1].flag) { + case FMPKS_FLAG_NONE: + // ûԼսʱս + saacproto_ACFMPointList_send(acfd); +#ifdef _MANOR_PKRULE + sprintf(buf, "ׯ԰Ȩսսʸ\n\n" + "һûӵׯ԰ļ\n" + #ifdef _FIX_FAMILY_PK_LIMIT // WON ADD սׯ԰ǰʮΪǰʮ + "бΪǰʮ\n" + #else + "бΪǰʮ\n" + #endif + "߹ʱ䣺賿\n\n" + "Դҽȷʸ"); +#else + sprintf(buf, "ׯ԰Ȩսսʸ\n\n" + "һûӵׯ԰ļ\n" + "ׯ԰\n\n" + "Դҽȷʸ"); +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_CHECKMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case FMPKS_FLAG_MANOR_PREPARE: + // ĿǰѾս׼ + { + int timeleft=fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec; + int dd,hh,mm; + char buf2[4096]; + dd = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 86400; + hh = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 3600 - dd*24; + mm = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 60 - dd*24*60 - hh*60; + memset(buf2,0,sizeof(buf2)); + if (dd>0) sprintf(buf, " %d ", dd); else strcpy(buf, ""); + strcat(buf2, buf); + if (hh>0) sprintf(buf, " %d Сʱ", hh); else strcpy(buf, ""); + strcat(buf2, buf); + if (mm>0) sprintf(buf, " %d ", mm); else strcpy(buf, ""); + strcat(buf2, buf); + if (strlen(buf2)==0) + sprintf(buf, "ׯ԰Ȩս\n%s ֣ %s\n\n" + "ʼ׼볡", + fmpks[fmpks_pos+1].guest_name, + fmpks[fmpks_pos+1].host_name); + else + sprintf(buf, "ׯ԰Ȩս\n%s ֣ %s\n\n" + "Ԥ%sῪʼ", + fmpks[fmpks_pos+1].guest_name, + fmpks[fmpks_pos+1].host_name, + buf2); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + break; + case FMPKS_FLAG_MANOR_PEACE: + // սѾĺƽʱ + { + int timeleft=fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec; + int dd,hh,mm; + char buf2[4096]; + dd = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 86400; + hh = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 3600 - dd*24; + mm = /*fmpks[fmpks_pos+1].dueltime*/ timeleft / 60 - dd*24*60 - hh*60; + strcpy(buf2,""); + if (dd>0) sprintf(buf, " %d ", dd); else strcpy(buf, ""); + strcat(buf2, buf); + if (hh>0) sprintf(buf, " %d Сʱ", hh); else strcpy(buf, ""); + strcat(buf2, buf); + if (mm>0) sprintf(buf, " %d ", mm); else strcpy(buf, ""); + strcat(buf2, buf); + + if (strlen(buf2)==0) + strcpy(buf, "Եȣ׼һ߹ݵı"); + else + sprintf(buf, "սʱڣҪ߹ݵĻ\n%s롣",buf2); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), buf); + } + break; + case FMPKS_FLAG_MANOR_BATTLEBEGIN: + // Ŀǰڽ߹ + sprintf(buf, "ׯ԰Ȩս\n%s ֣ %s\n\n" + "ޡ\nû˸Ͽɡ", + fmpks[fmpks_pos+1].guest_name, + fmpks[fmpks_pos+1].host_name); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case FMPKS_FLAG_MANOR_OTHERPLANET: + // ڱս + sprintf(buf, "ׯ԰Ȩս\n%s ֣ %s\n\n" + "ص %s ", + fmpks[fmpks_pos+1].guest_name, + fmpks[fmpks_pos+1].host_name, + fmpks[fmpks_pos+2].host_name); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + } +} +#else +void NPC_ManorSmanTalked(int meindex, int talkerindex, char *msg, int color) +{ + char buf[4096]; + int fd; + int fmpks_pos = CHAR_getWorkInt(meindex,NPC_WORK_ID)*MAX_SCHEDULE; + int manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID); + + if(CHAR_CHECKINDEX(meindex) == FALSE){ + printf("\nNPC_ManorSmanTalked error!(meindex:%d)",meindex); + return; + } + if(NPC_Util_CharDistance(meindex,talkerindex) > 2) return; + if(!NPC_Util_isFaceToFace(meindex,talkerindex,2)) return; + fd = getfdFromCharaIndex(talkerindex); + if(fd == -1) return; + + if(fmpks[fmpks_pos+1].flag == FMPKS_FLAG_CHALLENGE) fmpks[fmpks_pos+1].flag = FMPKS_FLAG_NONE; + + switch(fmpks[fmpks_pos+1].flag){ + // ս 1800~2200 + case FMPKS_FLAG_NONE: + case FMPKS_FLAG_WAIT: + saacproto_ACFMPointList_send(acfd); + sprintf(buf,"ׯ԰Ȩսսʸ\n\n" + "һûׯ԰ļ\n" + "Ƹׯ԰Ƶ\n" + "Լսʱֹʱһ߻սʸ\n" + "ġͬȱ߻ʸ\n" + " OK ҽȷʸ񣬰 NO ۿս"); + lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_YESNO,CHAR_WINDOWTYPE_CHECKMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf); + if(fmpointlist.fm_momentum[manorid-1] <= -1){ + int hadfmindex,index; + char token[256]; + + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",5,token,sizeof(token)); + hadfmindex = atoi(token); + if(hadfmindex != -1){ + for(index=0;index= FAMILY_MAXNUM){ + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",6,token,sizeof(token)); + printf("\nNPC_ManorSmanTalked():save fm_momentum error(%d:%s)",hadfmindex,token); + break; + } + // ¼ʱׯ + else fmpointlist.fm_momentum[manorid-1] = fmdptop.fmMomentum[index]; + } + } + SortManorSchedule(); + break; + // ս׼ 2200~ȡսʸļ嵱ʱսʱ( 1800~2200 ֮) + case FMPKS_FLAG_MANOR_PREPARE: + // ĿǰѾս׼ + { + int timeleft = fmpks[fmpks_pos+1].dueltime - NowTime.tv_sec; + int mm,hh,dd; + char buf2[4096]; + + dd = timeleft / 86400; + hh = timeleft / 3600 - dd * 24; + mm = timeleft / 60 - dd * 24 * 60 - hh * 60; + memset(buf2,0,sizeof(buf2)); + if(dd > 0) sprintf(buf," %d ",dd); else strcpy(buf,""); + strcat(buf2,buf); + if(hh > 0) sprintf(buf," %d Сʱ",hh); else strcpy(buf,""); + strcat(buf2,buf); + if(mm > 0) sprintf(buf," %d ",mm); else strcpy(buf,""); + strcat(buf2,buf); + if(strlen(buf2) == 0) + sprintf(buf,"ׯ԰Ȩս\n%s ֣ %s\n\nʼ׼볡", + fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name); + else + sprintf(buf,"ׯ԰Ȩս\n%s ֣ %s\n\nԤ%sῪʼ", + fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name,buf2); + lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf); + } + break; + // սڼ׼, + case FMPKS_FLAG_MANOR_PEACE: + case FMPKS_FLAG_MANOR_PEACE_SAVE: + { + int timeleft = fmpks[fmpks_pos+1].dueltime-NowTime.tv_sec; + int dd,hh,mm; + char buf2[4096]; + dd = timeleft / 86400; + hh = timeleft / 3600 - dd*24; + mm = timeleft / 60 - dd*24*60 - hh*60; + memset(buf2,0,sizeof(buf2)); + if(dd > 0) sprintf(buf," %d ",dd); else strcpy(buf,""); + strcat(buf2,buf); + if(hh > 0) sprintf(buf," %d Сʱ",hh); else strcpy(buf,""); + strcat(buf2,buf); + if(mm > 0) sprintf(buf," %d ",mm); else strcpy(buf,""); + strcat(buf2,buf); + + if(strlen(buf2) == 0) strcpy(buf, "Եȣ׼һ߹ݵı"); + else sprintf(buf, "ڷսʱڣҪսĻ\n%s롣",buf2); + lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf); + } + break; + // ս + case FMPKS_FLAG_MANOR_BATTLEBEGIN: + sprintf(buf,"ׯ԰Ȩս\n%s ֣ %s\n\nޡ\nû˸Ͽɡ", + fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name); + lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),buf); + break; + case FMPKS_FLAG_MANOR_OTHERPLANET: + // ڱս + sprintf(buf,"ׯ԰Ȩս\n%s ֣ %s\n\nص %s ", + fmpks[fmpks_pos+1].guest_name,fmpks[fmpks_pos+1].host_name,fmpks[fmpks_pos+2].host_name); + lssproto_WN_send(fd,WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf); + break; + } +} +#endif + +void NPC_ManorSmanWindowTalked(int meindex, int talkerindex, int seqno, int select, char *data) +{ + int fd, fmpks_pos, manorid, tkfmindex, tkfmdp; + char buf[4096],token[256]; + int hadfmindex; +#ifndef _ACFMPK_LIST + char hadfmname[256]; +#endif + int hadfmpopular; + + if (NPC_Util_CharDistance(meindex,talkerindex) > 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + manorid = CHAR_getWorkInt(meindex, NPC_WORK_MANORID); + tkfmindex = CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI); + tkfmdp = CHAR_getWorkInt(talkerindex, CHAR_WORKFMDP); + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 5, token, sizeof(token)); + hadfmindex = atoi(token); + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 7, token, sizeof(token)); + hadfmpopular = atoi(token); + + switch (seqno){ + case CHAR_WINDOWTYPE_CHECKMAN_START: + if (select==WINDOW_BUTTONTYPE_YES){ +#ifdef _FMVER21 + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && +#else + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) && +#endif + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)){ + if (hadfmindex != -1) { + if (hadfmindex-1 != tkfmindex){ + int check=0,i; +#ifdef _FM_POINT_PK + if(strcmp(getFmPointPK(),"")){ + // Arminius 2.25 fix: fmpks е 1~"MANORNUM" һҪ manorsman + for (i=0; i<=/*3*/MANORNUM-1; i++) { // 9ׯ԰ + getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token)); + if (tkfmindex==atoi(token)-1) check=1; + } + } +#else + // Arminius 2.25 fix: fmpks е 1~"MANORNUM" һҪ manorsman + for (i=0; i= FAMILY_MAXNUM){ + printf("\nNPC_ManorSmanWindowTalked():find tkfmIndex error (%d)",tkfmindex); + } + else +#ifdef _CAX_FM_QISHINUM + // սƲׯƵ5,ս + if(fmdptop.fmMomentum[index] < fmpointlist.fm_momentum[manorid-1]*0.5) won1 = 0;//0.5 +#else + //ս޸Ϊ 5 + if(fmdptop.fmMomentum[index] < 500 ) won1 = 0; +#endif + //----------------------------------------- + #else + //----------------------------------------- + int i; + char won2[256]; + won1 = 0; + #ifdef _FIX_FAMILY_PK_LIMIT // WON ADD սׯ԰ǰʮΪǰʮ + for(i=0; i< PK_LIMIT; i++){ + #else + for(i=0; i<10; i++){ + #endif + if( getStringFromIndexWithDelim( fmdptop.topmemo[i], "|", 3, won2, sizeof(won2)) == FALSE ) { + print("err Get fmdptop.topmemo[%d] if FALSE !!\n", i); + break; + } + if( strcmp(CHAR_getChar(talkerindex, CHAR_FMNAME) ,won2) == 0 ){ + won1= 1; + break; + } + //----------------------------------------- + } + #endif + + if(won1 == 1){ + // WON END + #ifdef _NEW_MANOR_LAW + sprintf(buf,"ȷׯ԰սʸһ׼ʱ\n" + "ʱѯԵ֪ʣµʱ\n" + "ս´սڽһս\n" + "׼ڣڼڲս\n\n" + "ȷҪսׯ԰"); + #else + sprintf(buf,"ׯ԰սһ׼\n" + "ʱѯԵ֪ʣµʱ\n" + "ս᲻ʤжս\n" + "սڼ䲻ս\n\n" + "ȷҪսׯ԰"); + #endif +#else + if(tkfmdp >= hadfmpopular){ + sprintf(buf,"ׯ԰սһ׼\n" + "ʱѯԵ֪ʣµʱ\n" + "ս᲻ʤս\n" + "սڼ䲻ս\n\n" + "ȷҪսׯ԰"); +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_CHECKMAN_MAIN, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + else{ +#ifdef _NEW_MANOR_LAW + #ifdef _CAX_FM_QISHINUM + sprintf(buf, "ļδׯ԰Ƶɣټ͡"); + #else + sprintf(buf, "ļδ 5 ټ͡"); + #endif +#else + #ifdef _MANOR_PKRULE + #ifdef _FIX_FAMILY_PK_LIMIT // WON ADD սׯ԰ǰʮΪǰʮ + sprintf(buf, "ļδǰʮ壬ټ͡"); + #else + sprintf(buf, "ļδǰʮ壬ټ͡"); + #endif + #else + sprintf(buf, "ļвս\n" + "ӵׯ԰ļ壬ټ͡"); + #endif +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + else if(check == 2){ + sprintf(buf, "ļսׯ԰\n" + "ѻɣ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + else{ + sprintf(buf, "һֻӵһׯ԰\n" + "ׯ԰֮Ҫд\n" + "뵽У˳"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + else{ + sprintf(buf, "ׯ԰Ѿļม"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + else{ + sprintf(buf, "ڲûׯ԰壡\n" + "ֱȥǨͿӴ"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + else{ + sprintf(buf, "ֻ峤սม"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } +#ifdef _NEW_MANOR_LAW + else if(select == WINDOW_BUTTONTYPE_NO){ + int i,index,manorindex; + char szMsg[3072]; + + sprintf(buf," ׯ԰ս\n ʱ \n"); + manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1; + // ͳս + for(i=0;i<10;i++){ + index = ManorSchedule[manorindex].iSort[i]; + if(ManorSchedule[manorindex].iFmIndex[index] != -1){ + sprintf(szMsg,"%2d %s\n",i+1,ManorSchedule[manorindex].szMemo[index]); + strcat(buf,szMsg); + } + } + lssproto_WN_send(fd,WINDOW_FMMESSAGETYPE_MANOR_SCHEDULE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX),buf); + } +#endif + break; + case CHAR_WINDOWTYPE_CHECKMAN_MAIN: + if (select==WINDOW_BUTTONTYPE_YES) { +#ifdef _FMVER21 + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && +#else + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) && +#endif + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1) && + (hadfmindex != -1) && + (hadfmindex - 1 != tkfmindex) +#ifndef _MANOR_PKRULE + && (tkfmdp >= hadfmpopular) +#endif + ){ +#ifndef _ACFMPK_LIST + struct tm tm1; +#endif + +#ifndef _NEW_MANOR_LAW + #ifdef _MANOR_PKRULE + time_t timep; + struct tm *p; + time(&timep); + p = gmtime(&timep); + if( p->tm_hour+8 > 24) + p->tm_hour = p->tm_hour-16; + else + p->tm_hour = p->tm_hour+8; +#ifdef _YUANGUSA + if(p->tm_hour<18 && p->tm_hour>20){ + sprintf(buf, "6:008:00Լսɣ"); +#else + if(p->tm_hour<18 && p->tm_hour>1){ + sprintf(buf, "6:00賿1:00Լսɣ"); +#endif + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + } + #endif + // WON ADD pkԼս + if( fmpks[fmpks_pos+1].flag != FMPKS_FLAG_NONE ){ + sprintf(buf, "ׯ԰ѾԼսม"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + return; + } +#endif + if(manorflag[manorid-1]==1){ + sprintf(buf, "ׯ԰[%s]ѾԼսม",manorname[manorid-1]); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + return; + } +#ifdef _ACFMPK_LIST + #ifndef _NEW_MANOR_LAW + NPC_ManorSavePKSchedule(meindex, talkerindex, 0); + sprintf( buf, "ׯ԰ս½ȷУᡣ"); + CHAR_talkToCli( talkerindex, meindex, buf, CHAR_COLORYELLOW); + #else + NPC_ManorAddToSchedule(meindex,talkerindex); + #endif +#else + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1], "|", 6, token, sizeof(token)); + strcpy(hadfmname, token); + + fmpks[fmpks_pos+1].dueltime = CHAR_getWorkInt(meindex, NPC_WORK_CHALLENGEWAIT) + NowTime.tv_sec + - tm1.tm_min*60 + 1800; // Arminius 11.1 ijһ xx:30 + fmpks[fmpks_pos+1].host_index = hadfmindex-1; + strcpy(fmpks[fmpks_pos+1].host_name, hadfmname); + fmpks[fmpks_pos+1].guest_index = tkfmindex; + strcpy(fmpks[fmpks_pos+1].guest_name, CHAR_getChar(talkerindex, CHAR_FMNAME)); + fmpks[fmpks_pos+1].prepare_time = 15; +#ifdef _FMWAR_PLAYERNUM + fmpks[fmpks_pos+1].max_player = getFmWarPlayerNum(); +#else + fmpks[fmpks_pos+1].max_player = 50; +#endif + fmpks[fmpks_pos+1].win = -1; + fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_OTHERPLANET; + strcpy(fmpks[fmpks_pos+2].host_name, getGameserverID()); + + #ifndef _NEW_MANOR_LAW + NPC_ManorSavePKSchedule(meindex, talkerindex, 0); + sprintf(buf, "ׯ԰սѾ趨ɣú׼"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + #else + NPC_ManorAddToSchedule(meindex,talkerindex); + #endif + fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_PREPARE; +#endif + + } + } + break; + } +} + +void NPC_CleanPkList( int ti) +{ +// Terry fix ҪΪ-1Ϊ0 +/* fmpks[ ti+1 ].host_index = 0; + fmpks[ ti+1].guest_index=0; + fmpks[ ti].host_index=0; + fmpks[ ti].guest_index=0;*/ + fmpks[ ti+1 ].host_index = -1; + fmpks[ ti+1].guest_index=-1; + fmpks[ ti].host_index=-1; + fmpks[ ti].guest_index=-1; + + strcpy(fmpks[ ti+1].host_name,""); + strcpy(fmpks[ ti+1].guest_name,""); + strcpy(fmpks[ ti].host_name,""); + strcpy(fmpks[ ti].guest_name,""); + strcpy(fmpks[ ti+2].host_name,""); +} + +void NPC_ManorSmanLoop(int meindex) +{ + struct tm tm1; + int fmpks_pos; +#ifdef _NEW_MANOR_LAW + int iOffsetTime; +#endif + + if(CHAR_CHECKINDEX(meindex) == FALSE){ + printf("\nNPC_ManorSmanLoop error!(meindex:%d)",meindex); + return; + } + + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + switch (fmpks[fmpks_pos+1].flag) { + case FMPKS_FLAG_NONE: +#ifdef _NEW_MANOR_LAW + { + int hadfmindex,index,manorid; + char token[256]; + //ʱԿʼս + manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID); + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",5,token,sizeof(token)); + hadfmindex = atoi(token); + if(hadfmindex != -1){ + for(index=0;index= FAMILY_MAXNUM){ + getStringFromIndexWithDelim(fmpointlist.pointlistarray[manorid-1],"|",6,token,sizeof(token)); + //printf("\nNPC_ManorSmanLoop():save fm_momentum error(%d:%s)",hadfmindex,token); + break; + } + // ¼ʱׯ + else fmpointlist.fm_momentum[manorid-1] = fmdptop.fmMomentum[index]; + // һ״̬ + fmpks[fmpks_pos+1].flag = FMPKS_FLAG_WAIT; + // սڹ4Сʱ(1800~2200) + fmpks[fmpks_pos+1].dueltime = NowTime.tv_sec + 3600 * 4; + NPC_ManorSavePKSchedule(meindex, -1, FMPKS_FLAG_WAIT,fmpks[fmpks_pos+1].dueltime,tm1); + } + SortManorSchedule(); + } +#endif + break; +#ifdef _NEW_MANOR_LAW + // ս,Ѽ¼,ȴսų + case FMPKS_FLAG_WAIT: + { + int manorid,i,iPlayerNum = CHAR_getPlayerMaxNum(); + char szMsg[256]; + + manorid = CHAR_getWorkInt(meindex,NPC_WORK_MANORID); + if(manorflag[manorid-1] == 1){ + break; + } + // û,ƸıҪȥACҪʱ + //fmpointlist.fm_inwar[manorid-1] = TRUE; + fmpointlist.fm_inwar[manorid-1] = FALSE; //DzACҪʱ + if(fmpks[fmpks_pos+1].dueltime <= NowTime.tv_sec){ + // սߵĻսȨ + int manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1; + int iNo1FmIndexSort = ManorSchedule[manorindex].iSort[0]; + if(ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort]>=0){ + for (i=1; i<=/*4*/MANORNUM; i++) { // ǷѾսׯ԰ + if ((fmpks[i*MAX_SCHEDULE+1].guest_index==ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort]) && + (strcmp(fmpks[i*MAX_SCHEDULE+1].guest_name, + ManorSchedule[manorindex].szFmName[iNo1FmIndexSort])==0) + ) { + ManorSchedule[manorindex].iSort[0] = ManorSchedule[manorindex].iSort[1]; + //ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort] = ManorSchedule[manorindex].iFmIndex[iNo2FmIndexSort]; + iNo1FmIndexSort = ManorSchedule[manorindex].iSort[0]; + } + } + } + int index = ManorSchedule[manorindex].iFmIndex[iNo1FmIndexSort],iFmIndex1,iCharindex; + //Logfmpk_war(iNo1FmIndexSort,manorindex,index); + char token[256],fmname[256]; + // ûս + if(index < 0){ + // ֱӽ뵽ս + fmpks[fmpks_pos+1].flag = FMPKS_FLAG_MANOR_BATTLEEND; + CHAR_setWorkInt(meindex,NPC_WORK_BETTLETIME,tm1.tm_mday); + // ֪ͨ + for(i=0;i= 0 && CHAR_getCharUse(iCharindex)){ + // ýǮ = * 5000 + int iAddGold = ((float)CHAR_getInt(iCharindex,CHAR_MOMENTUM)/100.0f) * 5000.0f; + int iGold = CHAR_getInt(iCharindex,CHAR_BANKGOLD),iMaxGold; + // ȷ + if(iGold + iAddGold > CHAR_MAXBANKGOLDHAVE){ + CHAR_setInt(iCharindex,CHAR_BANKGOLD,CHAR_MAXBANKGOLDHAVE); + // зŲ,ŵ + iAddGold = iGold + iAddGold - CHAR_MAXBANKGOLDHAVE; + iGold = CHAR_getInt(iCharindex,CHAR_GOLD); + iMaxGold = CHAR_getMaxHaveGold(iCharindex); + if(iGold + iAddGold > iMaxGold) CHAR_setInt(iCharindex,CHAR_GOLD,iMaxGold); + else CHAR_setInt(iCharindex,CHAR_GOLD,iGold + iAddGold); + LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME), + CHAR_getChar(iCharindex,CHAR_CDKEY), + CHAR_getChar(iCharindex,CHAR_NAME), + CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,0); + } + else{ + CHAR_setInt(iCharindex,CHAR_BANKGOLD,iGold + iAddGold); + LogFMPKGetMomey(CHAR_getChar(iCharindex,CHAR_FMNAME), + CHAR_getChar(iCharindex,CHAR_CDKEY), + CHAR_getChar(iCharindex,CHAR_NAME), + CHAR_getInt(iCharindex,CHAR_MOMENTUM),iAddGold,1); + } + CHAR_talkToCli(iCharindex,-1,"!ػסׯ԰Ľѻĸ",CHAR_COLORRED); + // ĸ˼ƶҪ + CHAR_setInt(iCharindex,CHAR_MOMENTUM,0); + CHAR_talkToCli(iCharindex,-1,"ׯ԰ս˼ƹ",CHAR_COLORRED); + } + } + } + } + else{ + // սʱѹ,ѡսׯԼһʱ׼ + NPC_ManorSavePKSchedule(meindex,index,0,-1,ManorSchedule[manorindex].tm1[iNo1FmIndexSort]); + // ,ƸıҲȥACҪʱ + fmpointlist.fm_inwar[manorid-1] = FALSE; + // ֪ͨ + sprintf(szMsg,"%s սׯ԰ʸ",ManorSchedule[manorindex].szFmName[iNo1FmIndexSort]); + + for(i=0;itm_hour; +// if (dueltimetmp==dueltime && tm2.tm_hour<22) +// { +// dueltime = dueltime + 3600; +// } + if(p2.tm_hour<23 && p2.tm_hour>19 && p1.tm_mon == p2.tm_mon && p1.tm_mday == p2.tm_mday && p1.tm_hour == p2.tm_hour) + { + if(p2.tm_hour==20){ + int tmpnum = RAND(1,100); + if(tmpnum<=33) + dueltime = dueltime + 1800; + else if(tmpnum<=66) + dueltime = dueltime + 3600; + else + dueltime = dueltime + 5400; + }else if(p2.tm_hour==21){ + int tmpnum = RAND(1,100); + if(tmpnum<=25) + dueltime = dueltime + 1800; + else if(tmpnum<=50) + dueltime = dueltime + 3600; + else if(tmpnum<=75) + dueltime = dueltime + 5400; + else + dueltime = dueltime - 1800; + }else if(p2.tm_hour==22){ + int tmpnum = RAND(1,100); + if(tmpnum<=50) + dueltime = dueltime - 1800; + else + dueltime = dueltime + 1800; + } + } + if(p2.tm_hour>17 && p2.tm_hour<20 ){ + dueltime = dueltime + 3600*(20-p2.tm_hour); + } + } + getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 5, token, sizeof(token)); + hadfmindex = atoi( token); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 7, token, sizeof(token)); + hadfmpopular = atoi( token); + getStringFromIndexWithDelim( fmpointlist.pointlistarray[manorid-1], "|", 6, token, sizeof(token)); + strcpy( hadfmname, token); + makeEscapeString( hadfmname, n1, sizeof(n1)); +#ifndef _NEW_MANOR_LAW + makeEscapeString( CHAR_getChar(toindex, CHAR_FMNAME), n2, sizeof(n2)); +#else + // ҳս߼ + index = ManorSchedule[manorid-1].iSort[0]; + makeEscapeString(ManorSchedule[manorid-1].szFmName[index],n2,sizeof(n2)); +#endif + makeEscapeString( getGameserverID(), n3, sizeof(n3)); + + sprintf(msg, "%d|%d|%s|%d|%s|%d|%d|%d|%s", + dueltime, hadfmindex-1, n1, tkfmindex, n2, 15, 50, FMPKS_FLAG_MANOR_OTHERPLANET, n3); + PkFlg = 1; + { + char buf1[256]; + sprintf( buf1,"%d", CHAR_getWorkInt( meindex, NPC_WORK_ID) ); + Logfmpk( + n1, hadfmindex-1, 0, + n2, tkfmindex, 0, + "", buf1, n3, 1); + } + } +#ifndef _NEW_MANOR_LAW + saacproto_ACSendFmPk_send( acfd, toindex, PkFlg, CHAR_getWorkInt( meindex, NPC_WORK_ID), msg); +#else + // toindex òΪ -1 + saacproto_ACSendFmPk_send( acfd, -1, PkFlg, CHAR_getWorkInt( meindex, NPC_WORK_ID), msg); +#endif +} + +#endif + +#ifdef _NEW_MANOR_LAW +// սų +void NPC_ManorAddToSchedule(int meindex,int charaindex) +{ + int i,j,iEmpty = -1,iFmIndex,manorindex = CHAR_getWorkInt(meindex,NPC_WORK_MANORID) - 1; + struct tm tm1; + + iFmIndex = CHAR_getWorkInt(charaindex,CHAR_WORKFMINDEXI); + // Ƿų,еׯ԰Լս + for(j=0;j= FAMILY_MAXNUM){ + lssproto_WN_send(getfdFromCharaIndex(charaindex),WINDOW_MESSAGETYPE_MESSAGE,WINDOW_BUTTONTYPE_OK,CHAR_WINDOWTYPE_CHECKMAN_END, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX),"ǸҲļ"); + return; + } + // Ƚ + if(ManorSchedule[manorindex].iFmMomentum[index] < fmdptop.fmMomentum[i]){ + int fmpks_pos,iPlayerNum = CHAR_getPlayerMaxNum(); + char szMsg[256]; + + // ֪ͨ + fmpks_pos = CHAR_getWorkInt(meindex,NPC_WORK_ID) * MAX_SCHEDULE; + sprintf(szMsg,"%s 屻 %s 強սų",ManorSchedule[manorindex].szFmName[index],CHAR_getChar(charaindex,CHAR_FMNAME)); + for(i=0;i momentumB) ? -1:1; +} +#endif diff --git a/npc/npc_manorsman.res b/npc/npc_manorsman.res new file mode 100644 index 0000000000000000000000000000000000000000..31d67f372e774b3f8d8ffef3946aa2b20114593d GIT binary patch literal 860 zcmcgrI|{-;5S`T&R+7R4Y-#BcQfw)B3GZM#o$0(%ij+%o4GT#nqzQ~~vjld62vP8n zH=n$j&9a*zBC?=JBtnJzYSP!JF{5_Kv&~erM_|DMG?c*t=y?w&!b8l_!6Kxps^EhV zHW8de2OIYlUjBwsgRd6_zDbHc$%j__$J~3RiyzvwesMl{QT_8A8&&#W^7(n`<1E=} z6sM20RB!%LgLt2gO4cUZ%MB3tl0u9(h2`1=i6n~zfvrpC|< DCt-RU literal 0 HcmV?d00001 diff --git a/npc/npc_mic.c b/npc/npc_mic.c new file mode 100644 index 0000000..c8567c9 --- /dev/null +++ b/npc/npc_mic.c @@ -0,0 +1,163 @@ +#include "version.h" +#include +#include + +#include "common.h" +#include "char_base.h" +#include "char.h" +#include "npcutil.h" +#include "npc_mic.h" +#include "saacproto_cli.h" +#include "lssproto_serv.h" +#include "battle.h" + +enum { + CHAR_WORK_FLOOR = CHAR_NPCWORKINT1, + CHAR_WORK_LX = CHAR_NPCWORKINT2, + CHAR_WORK_LY = CHAR_NPCWORKINT3, + CHAR_WORK_RX = CHAR_NPCWORKINT4, + CHAR_WORK_RY = CHAR_NPCWORKINT5, + CHAR_WORK_MODE = CHAR_NPCWORKINT6, + CHAR_WORK_TYPE = CHAR_NPCWORKINT7, + CHAR_WORK_WIND = CHAR_NPCWORKINT8, + CHAR_WORK_FMFL = CHAR_NPCWORKINT9, +}; + + +BOOL NPC_MicInit( int meindex ) +{ + int i; + int arg_param[8]; + char argstr[256]; + char buf[64]; + + + NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)); + + + if( strstr(argstr, "FREE")!=NULL){ + CHAR_setWorkInt(meindex,CHAR_WORK_TYPE,1); + } + if( strstr(argstr, "WIND")!=NULL){ + CHAR_setWorkInt(meindex,CHAR_WORK_WIND,1); + } + + + if( strstr( argstr , "|" ) != NULL){ + for( i = 1; i < 9; i ++ ) { + if( getStringFromIndexWithDelim(argstr, "|" , i , buf,sizeof(buf) ) + == FALSE ) + { + printf( "NPC_MIC:ʡԲ\n"); + arg_param[i-1] = 0; + continue; + } + arg_param[i-1] = atoi(buf); + } + CHAR_setWorkInt( meindex, CHAR_WORK_FLOOR, arg_param[0]); + CHAR_setWorkInt( meindex, CHAR_WORK_LX, min( arg_param[1],arg_param[3])); + CHAR_setWorkInt( meindex, CHAR_WORK_LY, min( arg_param[2],arg_param[4])); + CHAR_setWorkInt( meindex, CHAR_WORK_RX, max( arg_param[1],arg_param[3])); + CHAR_setWorkInt( meindex, CHAR_WORK_RY, max( arg_param[2],arg_param[4])); + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEMIC); + + CHAR_setWorkInt( meindex, CHAR_WORK_FMFL, arg_param[7]); + return TRUE; + + }else{ + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEMIC); + CHAR_setWorkInt( meindex, CHAR_WORK_MODE, 1); + return TRUE; + } + + return FALSE; +} + +void NPC_MicTalked( int meindex , int talkerindex , char *msg ,int color ) +{ + + int i; + int playernum; + int x,y; + char message[4096]; + char buf[2048]; + + if( CHAR_getInt(talkerindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + if(CHAR_getWorkInt(meindex,CHAR_WORK_TYPE) == 0){ + if(NPC_Util_isFaceToChara(talkerindex,meindex,1 ) ==FALSE) return; + } + + snprintf( buf, sizeof( buf), "%s\n%s", + CHAR_getChar( talkerindex, CHAR_NAME), + msg); + + // Robin 0621 峤㲥 + print(" MIC_FL:%d ", CHAR_getWorkInt( meindex, CHAR_WORK_FMFL )); + if( CHAR_getWorkInt( meindex, CHAR_WORK_FMFL ) != 0 ) + { +#ifdef _FMVER21 + if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER) +#else + if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == 1) +#endif + // && ( CHAR_getWorkInt( talkerindex, CHAR_WORKFMFLOOR) == CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR ) ) ) + { + print(" FMLeaderTalk_send:%s,%d,%d,%s ", + CHAR_getChar( talkerindex, CHAR_FMNAME), CHAR_getInt( talkerindex, CHAR_FMINDEX), + CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI), buf); + + sprintf(message, "[峤㲥]%s", buf); + saacproto_ACFMAnnounce_send( acfd, + CHAR_getChar( talkerindex, CHAR_FMNAME), + CHAR_getInt( talkerindex, CHAR_FMINDEX), + CHAR_getWorkInt( talkerindex, CHAR_WORKFMINDEXI), + message, + color + ); + return; + } + + } + + makeEscapeString( buf, message, sizeof(buf)); + + playernum = CHAR_getPlayerMaxNum(); + + for( i = 0; i < playernum; i ++ ) { + BOOL flg = FALSE; + if( CHAR_getCharUse(i) == FALSE ) continue; + if( CHAR_getInt( i, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ) continue; + if( CHAR_getInt( i, CHAR_FLOOR) != CHAR_getWorkInt( meindex, CHAR_WORK_FLOOR) ){ + continue; + } + if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE) == 0 ) { + x = CHAR_getInt( i, CHAR_X); + y = CHAR_getInt( i, CHAR_Y); + if( x >= CHAR_getWorkInt( meindex, CHAR_WORK_LX) && + x <= CHAR_getWorkInt( meindex, CHAR_WORK_RX) && + y >= CHAR_getWorkInt( meindex, CHAR_WORK_LY) && + y <= CHAR_getWorkInt( meindex, CHAR_WORK_RY)){ + flg = TRUE; + } + }else { + flg = TRUE; + } + if( flg) { + CHAR_talkToCli( i, talkerindex, msg, CHAR_COLORYELLOW); + if( CHAR_getWorkInt( meindex, CHAR_WORK_WIND) == 1 ) { + if( CHAR_getWorkInt( i, CHAR_WORKBATTLEMODE) + == BATTLE_CHARMODE_NONE) + { + int fd = getfdFromCharaIndex( i); + if( fd != -1 ) { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_MICMESSAGE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + message); + } + } + } + } + } +} diff --git a/npc/npc_msg.c b/npc/npc_msg.c new file mode 100644 index 0000000..4e02d4f --- /dev/null +++ b/npc/npc_msg.c @@ -0,0 +1,46 @@ +#include "version.h" +#define _NPC_MSG_C_ + +#include "char.h" +#include "char_base.h" +#include "npcutil.h" + + +/* + ئ 쫷ƥַʣ + Իؤ ƥέ·£ + + init , looked ı ɱ + + */ +BOOL NPC_MsgInit( int meindex ) +{ + //CHAR_setInt( meindex , CHAR_HP , 0 ); + + //CHAR_setInt( meindex , CHAR_MP , 0 ); + //CHAR_setInt( meindex , CHAR_MAXMP , 0 ); + + //CHAR_setInt( meindex , CHAR_STR , 0 ); + //CHAR_setInt( meindex , CHAR_TOUGH, 0 ); + + //CHAR_setInt( meindex , CHAR_LV , 0 ); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPETOWNPEOPLE ); + //CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); + //CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); /* ľئз */ + + return TRUE; +} + + +/* + * έľף۷ئʷ + */ +void NPC_MsgLooked( int meindex , int lookedindex ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + NPC_Util_GetArgStr( meindex, arg, sizeof( arg)); + CHAR_talkToCli( lookedindex , -1 , arg , CHAR_COLORWHITE ); + +} diff --git a/npc/npc_mtradenpcman.c b/npc/npc_mtradenpcman.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_newnpcman.c b/npc/npc_newnpcman.c new file mode 100644 index 0000000..a1cfa4d --- /dev/null +++ b/npc/npc_newnpcman.c @@ -0,0 +1,1191 @@ +#include "version.h" +#include +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "enemy.h" +#include "log.h" +#include "battle.h" +#include "readmap.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_newnpcman.h" +#include "pet.h" +#define NEWNPCMAN_STANDBY 5000 +#define NEWNPCMAN_WAITTIME 150 +enum { + WINDOW_START=1, + WINDOW_SELECT1, + WINDOW_SELECT2, + WINDOW_SELECT3, + WINDOW_SELECTLOSTPET, + WINDOW_DEFIND, + WINDOW_WARP, + WINDOW_END, + + NPC_PROGRAMEGINEER_START=1, + NPC_PROGRAMEGINEER_SELECT1, + NPC_PROGRAMEGINEER_SELECT2, + NPC_PROGRAMEGINEER_SELECT3, + NPC_PROGRAMEGINEER_SELECTLOSTPET, + NPC_PROGRAMEGINEER_DEFIND, + NPC_PROGRAMEGINEER_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; +/* +char UserBBIs[12][256]={ + "С", "", "к", "", "Ƥ", "", + "С", "Ƥ", "ñ", "̷", "Ů", "" }; +char PetBBIs[4][256]={//³˹ ³ ³ ³ + "³˹-컢", "³-̻", "³-", "³-ƻ" }; + +int PlayerBBI[6*2][4]={ + { 100000, 100005, 100010, 100015 }, //С + { 100025, 100030, 100035, 100020 }, // + { 100055, 100050, 100045, 100040 }, //к + { 100060, 100065, 100070, 100075 }, // + { 100095, 100085, 100090, 100080 }, //Ƥ + { 100100, 100115, 100110, 100115 }, // + + { 100135, 100120, 100125, 100130 }, //С + { 100145, 100140, 100150, 100155 }, //Ƥ + { 100165, 100170, 100160, 100175 }, //ñ + { 100190, 100195, 100185, 100180 }, //̷ + { 100200, 100210, 100215, 100205 }, //Ů + { 100230, 100225, 100220, 100235 } // + }; +*/ + +static int checkPc[48][3]; + +static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg); + +void NPC_reCheckMyPetUnusual( int meindex, int toindex);//쳣 + +BOOL CHECK_ReplacePET( int toindex); // +void NPC_reCheckItemPilenum( int meindex, int toindex);//ԭǹѵ +BOOL CHECK_ITEMEQUIT( int toindex);// +BOOL CHECK_PETBBI( int toindex);//ͼ + +#ifdef _PET_LOSTPET +BOOL NPC_reFindMyLostPet( int meindex, int toindex, char *buf); +BOOL NPC_getLostPetString( int meindex, int toindex); +BOOL NPC_backupLostPetString( int toindex); +static char petstring[7][2048]={"","","","","","",""}; +#endif + +BOOL NPC_NewNpcManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + { + int i; + for( i=0; i<48; i++){ + if( i == 0 ){ + checkPc[i][0]=30000; + checkPc[i][1]=30024; + checkPc[i][2]=100000; + }else{ + checkPc[i][0] = checkPc[i-1][0] + 25; + checkPc[i][1] = checkPc[i-1][1] + 25; + checkPc[i][2] = checkPc[i-1][2] + 5; + } +// print("ANDY checkPc:%d[%d,%d,%d]\n", i, checkPc[i][0], checkPc[i][1], checkPc[i][2]); + } + } + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_NEWNPCMAN); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} + +void NPC_NewNpcManLoop( int meindex) +{ + +} + +void NPC_NewNpcManTalked( int meindex , int talkerindex , char *msg , int color ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + if( CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER) != 101578 ){ + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECT1, 0); + return; + } + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + return; + } + + memset( token, 0, sizeof( token)); + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + return; + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_PROGRAMEGINEER_DEFIND; + break; + case WINDOW_SELECT1: + sprintf(token," ѡ" + "\n 쳣" + "\n ͼš" + "\n " +#ifdef _PET_LOSTPET + "\n ʧ" +#endif +// "\n ԭǹѵ" + + ); + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_PROGRAMEGINEER_SELECT2; + break; + case WINDOW_SELECT2: + switch( flg){ + case 1://쳣 + NPC_reCheckMyPetUnusual( meindex, toindex); + CHAR_talkToCli( toindex, -1, "ϳ!", CHAR_COLORYELLOW); + return; + break; + case 2://ͼ + CHECK_PETBBI( toindex); + return; + break; + case 3:// + if( CHECK_ITEMEQUIT( toindex) == TRUE ){ + CHAR_talkToCli( toindex, -1, "!", CHAR_COLORYELLOW); + } + return; + break; + + case 4: +#ifdef _PET_LOSTPET + if( NPC_reFindMyLostPet( meindex, toindex, token) == FALSE ){ + CHAR_talkToCli( toindex, -1, "ϣ", CHAR_COLORYELLOW); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_PROGRAMEGINEER_SELECTLOSTPET; +#endif + break; + case 5: //ԭǹѵ +// NPC_reCheckItemPilenum( meindex, toindex); + return; + break; + } + break; +/* + case WINDOW_SELECT3: + { + int petnum, petindex; + petnum = atoi( data)-1; + if( petnum >= CHAR_MAXPETHAVE || petnum < 0 ) return; + petindex = CHAR_getCharPet( talker, petsel); + if( !CHAR_CHECKINDEX(petindex) ) return; + break; + } +*/ + case WINDOW_SELECTLOSTPET: +#ifdef _PET_LOSTPET + { + int ret, i, ti, ltime, cost; + Char ch; + char msgbuf[256]; + char petstring1[2048]; + + int havepetelement = CHAR_getCharPetElement( toindex); + ti = flg; + if( havepetelement < 0 ){ + CHAR_talkToCli( toindex, -1, "λ", CHAR_COLORYELLOW); + return; + } + if( NPC_getLostPetString( meindex, toindex) == FALSE ) { + CHAR_talkToCli( toindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + return; + } + + if( getStringFromIndexWithDelim( petstring[ti-1], "#", 2, petstring1, sizeof( petstring1)) == FALSE ){ + CHAR_talkToCli( toindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + return; + }else{ + char buf1[256]; + if( getStringFromIndexWithDelim( petstring[ti-1], "|", 6, buf1, sizeof( buf1)) == FALSE ) return; + ltime = atoi(buf1); + ltime = time( NULL) - ltime; + ltime = ltime/(60*60*24); + if( getStringFromIndexWithDelim( petstring[ti-1], "|", 4, buf1, sizeof( buf1)) == FALSE ) return; + cost = atoi( buf1); + + cost = cost + (ltime*10000); + + if( CHAR_getInt( toindex, CHAR_GOLD) < cost ) { + sprintf( buf1, "Ѽķ%d죬%dʯҲſء", ltime, cost); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); + return; + } + } + + + ret = CHAR_makePetFromStringToArg( petstring1, &ch, -2); + strcpy( petstring[ti-1], ""); + if( ret ) { + char buf1[256]; + int petindex = PET_initCharOneArray( &ch ); + if( !CHAR_CHECKINDEX( petindex) ){ + CHAR_talkToCli( toindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + return; + } + print("ANDY petindex:%d[%s]\n", petindex, CHAR_getChar( petindex, CHAR_NAME) ); + + CHAR_complianceParameter( petindex ); + CHAR_setInt( petindex, CHAR_HP, CHAR_getWorkInt( petindex, CHAR_WORKMAXHP)); + CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, toindex); + CHAR_setCharPet( toindex, havepetelement, petindex); + CHAR_setChar( petindex, CHAR_OWNERCDKEY, + CHAR_getChar( toindex, CHAR_CDKEY)); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, + CHAR_getChar( toindex, CHAR_NAME)); + + if( NPC_backupLostPetString( toindex) == FALSE ){ + print("ANDY err backup petstring !!\n"); + return; + } + + sprintf( buf1, "LostPGet:%d", cost); + LogPet( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + buf1, + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + sprintf( buf1, "ȡ%s", CHAR_getUseName( petindex)); + CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW); + for( i = 0; i < CHAR_MAXPETHAVE; i++){ + int petindex = CHAR_getCharPet( toindex, i); + if( !CHAR_CHECKINDEX( petindex) ) + continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( toindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( toindex, msgbuf ); + } + CHAR_DelGold( toindex, cost); + }else{ + CHAR_talkToCli( toindex, -1, "ȡʧܣ", CHAR_COLORYELLOW); + return; + } + return; + } +#endif + return; + break; + case WINDOW_DEFIND: + { + int i; + int face = CHAR_getInt( toindex, CHAR_FACEIMAGENUMBER); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECK_MSG", token, sizeof( token) ) == NULL) { + return; + } + for( i=0; i<48; i++){ + if( face >= checkPc[i][0] && face < checkPc[i][1] ) + break; + } + if( i >= 48 )return; + CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, meindex); + CHAR_setInt( toindex, CHAR_BASEIMAGENUMBER, checkPc[i][2]); + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_PROGRAMEGINEER_END; + } + break; + case WINDOW_END: + { + CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, -1); + CHAR_setInt( toindex, CHAR_BASEBASEIMAGENUMBER, + CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) ); + + CHAR_complianceParameter( toindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX )); + CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER); + return; + } + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_NewNpcManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO){ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + CHAR_setWorkInt( talkerindex, CHAR_WORKNPCMETAMO, -1); + return; + } + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_PROGRAMEGINEER_SELECT1: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECT1, atoi( data)); + break; + case NPC_PROGRAMEGINEER_SELECT2: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECT2, atoi( data)); + break; + case NPC_PROGRAMEGINEER_SELECT3: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECT3, atoi( data)); + break; + case NPC_PROGRAMEGINEER_SELECTLOSTPET: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECTLOSTPET, atoi( data)); + break; + case NPC_PROGRAMEGINEER_DEFIND: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_DEFIND, atoi( data)); + break; + case NPC_PROGRAMEGINEER_END: + NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } +} + +BOOL CHECK_ITEMEQUIT( int toindex) +{ + int i, itemindex; + char token[256]; + + for (i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++) { + itemindex = CHAR_getItemIndex( toindex, i); + if( ITEM_getInt( itemindex, ITEM_ID) == 19646 ){ + CHAR_DelItem( toindex, i); + itemindex = -1; + itemindex = ITEM_makeItemAndRegist( 1292); + if( !ITEM_CHECKINDEX( itemindex) ){ + }else{ + int ret = CHAR_addItemSpecificItemIndex( toindex, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + ITEM_endExistItemsOne( itemindex); + continue; + } + sprintf( token,"õ%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW ); + CHAR_sendItemDataOne( toindex, ret); + continue; + } + } + if( ITEM_getInt( itemindex, ITEM_ID) == 1292 && + ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){ + + ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); + ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); + sprintf(token,"%s𻵶", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_sendItemDataOne( toindex, i); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); + } + } + + // ķŵ + for (i = 0; i < CHAR_MAXPOOLITEMHAVE; i++) { + if( ITEM_getInt( itemindex, ITEM_ID) == 1292 && + ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){ + + ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0); + ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0); + sprintf(token,"ķŵ%s𻵶", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); + } + } + + return TRUE; +} + + +BOOL CHECK_PETBBI( int toindex) +{ + int i, petindex, PetID; + BOOL Finds = FALSE; + char token[256]; + for( i=0; i < CHAR_MAXPETHAVE; i++) { + int parry, array, PetBBI; + petindex = CHAR_getCharPet( toindex, i); + if( !CHAR_CHECKINDEX( petindex) ) continue; + PetID = CHAR_getInt( petindex, CHAR_PETID); + array = ENEMY_getEnemyArrayFromTempNo( PetID); + if( !ENEMY_CHECKINDEX( array)) continue; + parry = ENEMYTEMP_getEnemyTempArray( array); + PetBBI = ENEMYTEMP_getInt( parry, E_T_IMGNUMBER); + + if( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) != PetBBI || + CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) != PetBBI ){ + CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, PetBBI); + CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, PetBBI); + sprintf( token, "%sͼ", CHAR_getUseName( petindex)); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW); + Finds = TRUE; + } + CHAR_setInt( petindex, CHAR_EARTHAT, ENEMYTEMP_getInt( parry, E_T_EARTHAT) ); + CHAR_setInt( petindex, CHAR_WATERAT, ENEMYTEMP_getInt( parry, E_T_WATERAT) ); + CHAR_setInt( petindex, CHAR_FIREAT, ENEMYTEMP_getInt( parry, E_T_FIREAT) ); + CHAR_setInt( petindex, CHAR_WINDAT, ENEMYTEMP_getInt( parry, E_T_WINDAT) ); + char tempname[128]; + if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL) + sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME)); + else + sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME)); + CHAR_setChar( petindex, CHAR_NAME, tempname); + CHAR_setChar( petindex, CHAR_USERPETNAME , ""); + } + for( i=0; i %s (%s:%s)(file:%s %d) !! \n", + petID, PetNAME, CHAR_getUseName( toindex), + CHAR_getChar( toindex, CHAR_CDKEY), __FILE__, __LINE__ ); + } + } + + for( i=0; i 0 )continue; + + if( i == CHAR_getInt( toindex, CHAR_DEFAULTPET) ) { + int fd = getfdFromCharaIndex( toindex); + CHAR_setInt( toindex, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + + snprintf( szPet,sizeof( szPet), "%s", CHAR_getUseName( petindex) ); + CHAR_talkToCli( toindex, -1, szPet, CHAR_COLORYELLOW); + LogPet( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "TenseiDel", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + + Finds = TRUE; + CHAR_setCharPet( toindex, i, -1); + CHAR_endCharOneArray( petindex ); + + array = ENEMY_getEnemyArrayFromTempNo( 1133); + if( !ENEMY_CHECKINDEX( array)) continue; + ret = ENEMY_createPetFromEnemyIndex( toindex, array); + if( !CHAR_CHECKINDEX( ret ) ) continue; + + snprintf( szPet, sizeof( szPet), "õ%s", CHAR_getUseName( ret) ); + CHAR_talkToCli( toindex, -1, szPet, CHAR_COLORWHITE); + + LogPet( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), + CHAR_getChar( ret, CHAR_NAME), + CHAR_getInt( ret, CHAR_LV), + "TenseiGet", + CHAR_getInt( toindex,CHAR_FLOOR), + CHAR_getInt( toindex,CHAR_X ), + CHAR_getInt( toindex,CHAR_Y ), + CHAR_getChar( ret, CHAR_UNIQUECODE) + ); + + } + + for( i=0; i 1 ){ + int itemID, pilenum=1, newindex; + itemID = ITEM_getInt( itemindex, ITEM_ID); + if( !ITEM_CHECKITEMTABLE( itemID) ) continue; + pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS); + while( pilenum > 1 ){ + int ti = CHAR_findEmptyItemBox( toindex); + if( ti == -1 ){ + CHAR_sendItemDataOne( toindex, i); + CHAR_talkToCli( toindex, -1, "λ", CHAR_COLORYELLOW); + return; + } + newindex = ITEM_makeItemAndRegist( itemID); + if( !ITEM_CHECKINDEX( newindex) ) break; + CHAR_setItemIndex( toindex , ti, newindex); + CHAR_sendItemDataOne( toindex, ti); + pilenum--; + ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum); + } + if( ITEM_getInt( itemindex, ITEM_CANBEPILE) != ITEMTBL_getInt( itemID, ITEM_CANBEPILE) ) + ITEM_setInt( itemindex, ITEM_CANBEPILE, ITEMTBL_getInt( itemID, ITEM_CANBEPILE) ); + CHAR_sendItemDataOne( toindex, i); + } + } + CHAR_talkToCli( toindex, -1, "ǹϡ", CHAR_COLORYELLOW); +} + +#ifdef _PET_LOSTPET +BOOL NPC_reFindMyLostPet( int meindex, int toindex, char *buf) +{ + //0 1 2 + FILE *fp = NULL; + char *CdKey=NULL; + int lv=0, cost, ltime, count=0, i, type; + char filename[256], line[2048], buf1[256]; + char petname[256], typebuf[256]; + char buf2[10][256]={"\n","\n","\n","\n","\n", + "\n","\n","\n","\n","\n" }; + CdKey = CHAR_getChar( toindex, CHAR_CDKEY ); + if( CdKey == NULL ) return FALSE; + sprintf( filename, "lostpet/%s.txt", CdKey); + strcpy( buf, "==ʧ¼==\n"); + if( (fp=fopen( filename, "r")) == NULL ) return FALSE; + + while( fgets( line , sizeof( line ) , fp ) && count < 7){ + if( line == NULL ) continue; + if( getStringFromIndexWithDelim( line, "|", 1, buf1, sizeof( buf1)) == FALSE ) continue; + if( strcmp( CHAR_getChar( toindex, CHAR_CDKEY ), buf1 )) continue; + if( getStringFromIndexWithDelim( line, "|", 6, buf1, sizeof( buf1)) == FALSE ) continue; + ltime = atoi(buf1); + ltime = time( NULL) - ltime; + ltime = ltime/(60*60*24); + if( ltime > 14 ) continue;//14 + + if( getStringFromIndexWithDelim( line, "|", 2, petname, sizeof( petname)) == FALSE ) continue; + if( getStringFromIndexWithDelim( line, "|", 3, buf1, sizeof( buf1)) == FALSE ) continue; + lv = atoi( buf1); + if( getStringFromIndexWithDelim( line, "|", 4, buf1, sizeof( buf1)) == FALSE ) continue; + cost = atoi( buf1); + + if( getStringFromIndexWithDelim( line, "#", 3, buf1, sizeof( buf1)) == FALSE ) continue; + type = atoi( buf1); + if( type == 1 ){ + strcpy( typebuf, ""); + }else if( type == 2 ){ + strcpy( typebuf, ""); + }else{ + strcpy( typebuf, ""); + } + + sprintf( buf2[count++], "%s LV:%dʯ:%d(%d%s)\n", petname, lv, cost, ltime, typebuf); + } + fclose( fp); + for( i=0; i<7; i++){ + strcat( buf, buf2[i]); + } + if( count == 0 ) return FALSE; + return TRUE; +} + +BOOL NPC_getLostPetString( int meindex, int toindex) +{ + FILE *fp = NULL; + char *CdKey=NULL; + int count=0, i, ltime; + char filename[256], line[2048], buf1[256]; + + for( i=0; i<7; i++) + strcpy( petstring[i], ""); + + CdKey = CHAR_getChar( toindex, CHAR_CDKEY ); + if( CdKey == NULL ) return FALSE; + sprintf( filename, "lostpet/%s.txt", CdKey); + if( (fp=fopen( filename, "r")) == NULL ) return FALSE; + + while( fgets( line , sizeof( line ) , fp ) && count < 7){ + if(strlen( line) <= 0 ) continue; +// if( getStringFromIndexWithDelim( line, "#", 2, buf1, sizeof( buf1)) == FALSE ) return FALSE; +// Terry fix ȡʱûжʱ 2004/09/22 + if(getStringFromIndexWithDelim(line,"|",6,buf1,sizeof(buf1)) == FALSE) continue; + ltime = atoi(buf1); + ltime = time( NULL) - ltime; + ltime = ltime/(60*60*24); + if(ltime > 14) continue;//14 +// Terry end + strcpy( petstring[count++], line); + } + + fclose( fp); + return TRUE; +} + +BOOL NPC_backupLostPetString( int toindex) +{ + FILE *fp = NULL; + char *CdKey=NULL; + int i, count=0; + char filename[256]; + + CdKey = CHAR_getChar( toindex, CHAR_CDKEY ); + if( CdKey == NULL ) return FALSE; + sprintf( filename, "lostpet/%s.txt", CdKey); + if( (fp=fopen( filename, "w")) == NULL ) return FALSE; + + for( i=0; i<7; i++){ + if( strlen( petstring[i]) <= 0 ) continue; + fprintf( fp, "%s", petstring[i]); + count++; + } + fclose( fp); + + if( count == 0 ) + remove( filename); + + return TRUE; +} + +/* + + +#ifdef _NEW_WARPMAN +#include "npc_newnpcman.h" +#define NEWNPCMAN_STANDBY 5000 +#define NEWNPCMAN_WAITTIME 150 + +enum{ +NPC_NEWNPCMAN_START=21, +NPC_NEWNPCMAN_MAN, +NPC_NEWNPCMAN_END, +}; + +enum { + NEWNPC_START = 1, + NEWNPC_MAN, + NEWNPC_END, +}; + +enum { + NPC_WORK_INDEX = CHAR_NPCWORKINT1, + NPC_WORK_WORKTYPE = CHAR_NPCWORKINT2, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT3, +}; + +BOOL CHECK_YEARPET( int toindex); +static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg); +int NPC_NewNpcManDelPet(int meindex,int talker, int petsel); +BOOL NPC_NewNpcManAddPet(int meindex, int talker, int petid); + +//ɻֳ +static int Re_Pet[4]; +// shan +char uStr[128]=""; + +BOOL NPC_NewNpcManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[256],buf2[256]; + int k=1; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL) { + print("GambleBank:GetArgStrErr"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "REPET", buf1, sizeof( buf1)) == NULL ) { + return FALSE; + } + + while( getStringFromIndexWithDelim(buf1, ",", k, buf2, sizeof(buf2)) != FALSE ) { + Re_Pet[k-1] = atoi( buf2); + if( Re_Pet[k-1] < 0 ) + return FALSE; + k++; + if( (k-1) >= arraysizeof( Re_Pet) ) + break; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_NEWNPCMAN ); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return TRUE; +} + +void NPC_NewNpcManLoop( int meindex) +{ + //test + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[256],buf2[256]; + int k=1; + + int fulltime = NEWNPCMAN_WAITTIME; + if( (CHAR_getWorkInt( meindex, NPC_WORK_CURRENTTIME) + fulltime) > NowTime.tv_sec ) + return; + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + + //test + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL) { + print("GambleBank:GetArgStrErr"); + return; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "REPET", buf1, sizeof( buf1)) == NULL ) { + return; + } + + while( getStringFromIndexWithDelim(buf1, ",", k, buf2, sizeof(buf2)) != FALSE ) { + Re_Pet[k-1] = atoi( buf2); + if( Re_Pet[k-1] < 0 ) + return; + k++; + if( (k-1) >= arraysizeof( Re_Pet) ) + break; + } + //test end +} + +void NPC_NewNpcManTalked( int meindex , int talkerindex , char *msg , int color ) +{ + char buf1[256]; + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + if( CHAR_getWorkInt( meindex , NPC_WORK_INDEX) >= 0 ) { + sprintf( buf1,"%s","æأ"); + print("\n NPC_WORK_INDEX = %d ", CHAR_getWorkInt( meindex , NPC_WORK_INDEX)); + CHAR_talkToCli( talkerindex, meindex, buf1, CHAR_COLORYELLOW); + return; + }else { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, talkerindex); + print("\n start : NPC_WORK_INDEX = talkerindex"); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + NPC_NewNpcMan_selectWindow( meindex, talkerindex, NEWNPC_START, 0); + } +} + +static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + char token_str[][56]={"ERROR_MSG","START_MSG","END_MSG","ERROR_ALL"}; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + int petno = 718, petid =1479; + int type_str = 0; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL) { + print("GambleBank:GetArgStrErr"); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return ; + } + + if( CHAR_getWorkInt( meindex , NPC_WORK_INDEX) != toindex ) { + sprintf( token,"%s","æأ"); + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + return; + } + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + print("\n switch( num=%d)", num); + switch( num) { + case NEWNPC_START: + type_str = 1; + buttontype = WINDOW_BUTTONTYPE_OKCANCEL; + windowno = NPC_NEWNPCMAN_START; + break; + + case NEWNPC_MAN: + { + if( CHECK_YEARPET( toindex) == TRUE ) { + type_str = 1; + windowtype = WINDOW_MESSAGETYPE_PETSELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_NEWNPCMAN_MAN; + }else { + type_str = 3; + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = NPC_NEWNPCMAN_END; + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + } + } + break; + + case NEWNPC_END: + type_str = 0; + if( flg <= CHAR_MAXPETHAVE && flg >= 0 ) { + petno = flg; + + if( ( petid = NPC_NewNpcManDelPet( meindex, toindex, petno)) >= 0 ) { + if( NPC_NewNpcManAddPet( meindex, toindex, petid) == TRUE ) { + type_str = 2; + } + } + } + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = NPC_NEWNPCMAN_END; + + break; + } + + if(NPC_Util_GetStrFromStrWithDelim( npcarg, token_str[ type_str], token,sizeof( token) ) == NULL) { + print("token_str[%d] err !", type_str); + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_NewNpcManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } + + print("\n seqno=%d, select=%d", seqno, select); + switch( seqno) { + case NPC_NEWNPCMAN_START: + if( select != WINDOW_BUTTONTYPE_YES && select != WINDOW_BUTTONTYPE_OK ) { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + return; + } + if(select==WINDOW_BUTTONTYPE_CANCEL) { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + }else { + NPC_NewNpcMan_selectWindow( meindex, talkerindex, NEWNPC_MAN, -1); + } + break; + + case NPC_NEWNPCMAN_MAN: + { + int petnum; + petnum = atoi( data)-1; + + print("\n petnum=%d", petnum); + if(select==WINDOW_BUTTONTYPE_CANCEL) { + CHAR_setWorkInt( meindex , NPC_WORK_INDEX, -1); + }else { + NPC_NewNpcMan_selectWindow( meindex, talkerindex, NEWNPC_END, petnum); + } + } + break; + + case NPC_NEWNPCMAN_END: + break; + } +} + +int NPC_NewNpcManDelPet(int meindex,int talker, int petsel) +{ + int defpet; + int fd = getfdFromCharaIndex( talker ); + char msgbuf[64], szPet[128]; + int k=0; + int petindex=-1; + + petindex = CHAR_getCharPet( talker, petsel); + if( !CHAR_CHECKINDEX(petindex) ) + return -1; + + for( k=0;k +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_newvipshop.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//صشøнڽ"ʦ" +#ifdef _VIP_SHOP +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_PREV, + WINDOW_NEXT, + WINDOW_WARP, + WINDOW_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +#define STANDBYTIME 50 + +static void NPC_NewVipShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL NewVipShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token, int index ); +int NewVipShop_ShowMenulist( char *npcarg ); + +int page; + +BOOL NPC_NewVipshopInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_NewVipshopTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_NewVipshopWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_TRANSERMAN_SELECT: + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_TRANSERMAN_WARP: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_PREV, atoi( data)); + return; + } + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_WARP, atoi( data)); + break; + case NPC_TRANSERMAN_END: + NPC_NewVipShop_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } + +} + +static void NPC_NewVipShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf1[256]; + char buf2[256]; + char buf3[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + static int select1; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("NewVipShop_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("NewVipShop Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_SELECT; + break; + case WINDOW_SELECT: + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 0); + page=NewVipShop_ShowMenulist(npcarg); + if( NewVipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "NewVipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(page>1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_NEXT: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<=page) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if( NewVipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "NewVipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1==page) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_PREV: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)>0) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if( NewVipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "NewVipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==0) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_WARP: + select1=CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)*7+select; + CHAR_setWorkInt( toindex, CHAR_WORKLISTSELECT , select1); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "END_MSG", buf1, sizeof( buf1) ) == NULL) { + print("NewVipShop Get START_MSG ERROR !"); + return; + } + if(getStringFromIndexWithDelim( npcarg,"}",select1, buf2, sizeof( buf2)) != FALSE) + NPC_Util_GetStrFromStrWithDelim( buf2, "MenuStr", buf3, sizeof( buf3)); + sprintf( token, "\n%s\n\n %s\n",buf1, buf3); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_END; + break; + case WINDOW_END: + ActionNpc_CheckMenuFree( meindex, toindex, npcarg, CHAR_getWorkInt( toindex, CHAR_WORKLISTSELECT )); + return; + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_NewVipshopLoop( int meindex) +{ + +} + +BOOL NewVipShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token,int index ) +{ + char buf1[1024], buf2[32], buf3[36]; + BOOL FINDS=FALSE; + int talkNo=index*7+1; + if( npcarg == NULL ) return FALSE; + + sprintf( token, "㵱ǰĻԱ:%d %d/%dҳ\n",sasql_vippoint(CHAR_getUseID(toindex),0,0), index+1, page); + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + memset( buf2, 0, sizeof( buf2)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL ) + continue; + FINDS = TRUE; + + sprintf( buf3, " %s", buf2); + if(strlen(buf3)<10) + strcat( buf3, "\n"); + else + strcat( buf3, "\n"); + strcat( token, buf3); + if(talkNo>(index*7+7))return FINDS; + } + return FINDS; +} + +int NewVipShop_ShowMenulist( char *npcarg ) +{ + char buf1[1024]; + int talkNo=1; + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + } + return (talkNo-3)/7+1; +} + +#endif diff --git a/npc/npc_npcenemy.c b/npc/npc_npcenemy.c new file mode 100644 index 0000000..28369fe --- /dev/null +++ b/npc/npc_npcenemy.c @@ -0,0 +1,1563 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_npcenemy.h" +#include "battle.h" +#include "enemy.h" +#include "readmap.h" +#include "encount.h" +#include "lssproto_serv.h" +#include "configfile.h" +#include "anim_tbl.h" +#include "handletime.h" +#include "npc_eventaction.h" +extern char hanzibuf[5000][8]; +enum { + CHAR_WORK_ENCOUNTTYPE = CHAR_NPCWORKINT1, /* ޼ */ + CHAR_WORK_DIEACT = CHAR_NPCWORKINT2, /* Ϸ¾ */ + CHAR_WORK_WARP_FLOOR = CHAR_NPCWORKINT3, /* °׷ʧ*/ + CHAR_WORK_WARP_X = CHAR_NPCWORKINT4, /* X */ + CHAR_WORK_WARP_Y = CHAR_NPCWORKINT5, /* Y */ + CHAR_WORK_ONEBATTLE = CHAR_NPCWORKINT6, /* ƾ ئ */ + NPC_TIME_MODE = CHAR_NPCWORKINT7, + CHAR_WORK_BASEIMGBAK = CHAR_NPCWORKINT8, /* 缰 į */ + CHAR_WORK_DIETIME = CHAR_NPCWORKINT9, /* Ϸ */ + CHAR_WORK_REVIVALTIME = CHAR_NPCWORKINT10, /* Ϸ߯ */ + CHAR_WORK_BATTLETYPE = CHAR_NPCWORKINT11, +#ifdef _WARNPC_CTRL + CHAR_WORK_BATTLEINGTIME = CHAR_NPCWORKINT12, +#endif +}; + +#define NPC_ENEMY_REVIVALTIMA_DEFAULT 120 + +static int gymbody[] = { + SPR_001em,SPR_011em,SPR_021em,SPR_031em,SPR_041em,SPR_051em, + SPR_061em,SPR_071em,SPR_081em,SPR_091em,SPR_101em,SPR_111em, + + SPR_002em,SPR_012em,SPR_022em,SPR_032em,SPR_042em,SPR_052em, + SPR_062em,SPR_072em,SPR_082em,SPR_092em,SPR_102em,SPR_112em, + + SPR_003em,SPR_013em,SPR_023em,SPR_033em,SPR_043em,SPR_053em, + SPR_063em,SPR_073em,SPR_083em,SPR_093em,SPR_103em,SPR_113em, + + SPR_004em,SPR_014em,SPR_024em,SPR_034em,SPR_044em,SPR_054em, + SPR_064em,SPR_074em,SPR_084em,SPR_094em,SPR_104em,SPR_114em, +}; + +#ifdef _NEW_WARPMAN +static BOOL NPC_NPCEnemy_CheckFree( int meindex, int toindex, BOOL *Party); +BOOL NPC_WarpAllMsg(int meindex,int toindex ); +BOOL NPCEnemy_CheckFree( int meindex, int talker, char *buf); +BOOL NPCEnemy_BSCheck(int meindex,int talker,char* buf); +BOOL NPCEnemy_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp); +BOOL NPCEnemy_WarpManReduce(int meindex,int talker,char *buf); +BOOL NPCEnemy_BigSmallLastCheck(int point1,int mypoint,int flg); +BOOL NPCEnemy_CheckTrans(int meindex,int talker,int trans,int flg); +BOOL NPCEnemy_LevelCheck(int meindex,int talker,int level,int flg); +BOOL NPCEnemy_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid); +BOOL NPCEnemy_ItemCheck(int meindex,int talker,int itemNo,int flg); +#endif +#ifdef _NPC_REPLACEMENT +void Check_EnemyWarpMe( int meindex, char *args ); +#endif +static int NPC_NPCEnemy_StealItem( char *argstr, int meindex, int charaindex); + +BOOL NPC_NPCEnemyInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + int tmp, gym; +#ifdef _NPCENEMY_1 + char token1[128]; +#endif + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL ) { + print("Can't GetArgStr !!"); + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sktype", buf, sizeof( buf)) != NULL ){ + CHAR_setWorkInt( meindex, CHAR_WORK_BATTLETYPE, atoi( buf)); + }else{ + CHAR_setWorkInt( meindex, CHAR_WORK_BATTLETYPE, 0); + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "enemyno", buf, sizeof( buf)) == NULL ){ + char filename[256]; + NPC_Util_CheckAssignArgFile( meindex, filename); + print( "NPCEnemy: nothing parameter [enemyno]:\n%s\n", filename); + return FALSE; + }else { + int i; + for( i = 0; i < NPC_ENEMY_ENEMYNUMBER; i ++ ) { + int curEnemy; + char data[128]; + int ret; + ret = getStringFromIndexWithDelim( buf,",", i + 1, data, sizeof(data)); + if( ret == FALSE) + break; + curEnemy = ENEMY_getEnemyArrayFromId( atoi( data)); + if( !ENEMY_CHECKINDEX( curEnemy) ) { + char filename[256]; + NPC_Util_CheckAssignArgFile( meindex, filename); + print( "NPCEnemy: invalid param [enemyno:%d data:%s curEnemy:%d]\nfile:%s\n",i+1, data, curEnemy, filename ); + return FALSE; + } + } + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "steal", buf, sizeof( buf)) != NULL ) { + if( NPC_Util_GetStrFromStrWithDelim( argstr, "item", buf, sizeof( buf)) == NULL ) { + print( "NPCEnemy:ָstealûָitem\n"); + return FALSE; + } + } + + gym = NPC_Util_GetNumFromStrWithDelim( argstr, "gym"); + + if( gym > 0 ){ + CHAR_setInt( meindex, CHAR_BASEBASEIMAGENUMBER, + gymbody[RAND( 0, arraysizeof( gymbody ) - 1)] ); + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, + CHAR_getInt( meindex, CHAR_BASEBASEIMAGENUMBER ) ); + CHAR_setInt( meindex, CHAR_LV, gym ); + } + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "dieact"); + if( tmp != 1 ) + tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_DIEACT, tmp); + if( strstr( argstr, "NEWNPCENEMY") != 0 ) { + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_FLOOR, 0 ); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_Y, 0 ); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_X, 0 ); + }else { + if( CHAR_getWorkInt( meindex, CHAR_WORK_DIEACT) == 1 ) { + char buff1[256]; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "warpfl", buff1, sizeof( buff1) ) == NULL) { + print( "NPCENEMY: nothing warp_floor %s\n", buff1); + return FALSE; + } + tmp = atoi( buff1); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_FLOOR, tmp); + if( NPC_Util_GetStrFromStrWithDelim( argstr, "warpx", buff1, sizeof( buff1) ) == NULL) { + print( "NPCENEMY: nothing warp_x\n"); + return FALSE; + } + tmp = atoi( buff1); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_X, tmp); + if( NPC_Util_GetStrFromStrWithDelim( argstr, "warpy", buff1, sizeof( buff1) ) == NULL) { + print( "NPCENEMY: nothing warp_y\n"); + return FALSE; + } + tmp = atoi( buff1); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_Y, tmp); + if( MAP_IsValidCoordinate( CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) ) == FALSE ){ + char filename[256]; + NPC_Util_CheckAssignArgFile( meindex, filename); + print( "NPCENEMY: %s: .\n %s.\nInvalid fl=%d,x=%d,y=%d\n", filename, argstr, + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) ); + return FALSE; + } + } + } + //andy_end + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "entype"); + if( tmp != 1 && tmp != 2) + tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE, tmp); + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "onebattle"); + if( tmp != 1 ) + tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_ONEBATTLE, tmp); + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "time"); + if( tmp == -1 ) + tmp = NPC_ENEMY_REVIVALTIMA_DEFAULT; + CHAR_setWorkInt( meindex, CHAR_WORK_REVIVALTIME, tmp); + + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPENPCENEMY ); + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_ENEMY); + CHAR_setWorkInt( meindex, CHAR_WORK_BASEIMGBAK, + CHAR_getInt( meindex, CHAR_BASEIMAGENUMBER)); + return TRUE; +} + +void NPC_NPCEnemyTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[256]; + + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof( npcarg)) == NULL ) { + print("Can't GetArgStr !!"); + return; + } + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "NEWTIME", buf, sizeof( buf)) != NULL ){ + if( CHAR_getWorkInt( meindex, NPC_TIME_MODE) <= 0 ) { + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "Time_Msg", buf, sizeof( buf) ) != NULL) { + CHAR_talkToCli( talkerindex, meindex, buf, CHAR_COLORYELLOW); + } + return; + } + } + if( !NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 1 )) + return; + if( CHAR_getWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE) >= 1 ) { + if(strstr(npcarg,"STARTRAND")!=NULL){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(talkerindex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + return; + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + return; + randtime = atoi(tempbuff); +#ifdef _MM_NO_JIAOBEN + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(talkerindex, -1, errbuf, CHAR_COLORRED); + return; + } +#endif + } + } +// if(timep-CHAR_getWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME)>=getEditBaseTime()) +// CHAR_setWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME,timep); +// else{ +// char errbuf[256]; +// sprintf(errbuf,"%dſԼ˲",getEditBaseTime()-(timep-CHAR_getWorkInt(talkerindex,CHAR_WORKRANDEDITBASETIME))); +// CHAR_talkToCli(talkerindex, -1, errbuf, CHAR_COLORRED); +// return; +// } + char jiabuf[][5]={"","","","","","ʮ",""}; + char jianbuf[][5]={"","һ","-","","-","",""}; + char chengbuf[][5]={"","*","x","X","","",""}; + char numbuf[][5]={"","","","","","","","","",""}; + char arg[255]; + int i,j,k,l,m; + char buf[256]; + i = RAND(30,70); + j = RAND(1,29); + l = RAND(1,7); + m = RAND(1,3); + char *typebuf; +// if(randtype == 0){ +// randtype = RAND(1,10); +// if(randtype<=5){ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=1; +// else randtype=2; +// }else{ +// randtype = RAND(1,10); +// if(randtype<=3) randtype=3; +// else randtype=4; +// } +// } + randtype = 4; + { +// sprintf(arg,"%s",sasql_rand_buf()); +// if(strcmp(arg,"err")==0) return; + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; +// if(getStringFromIndexWithDelim(arg,"|", 1, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randquestion,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 2, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randrightanswer,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 3, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer1,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 4, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer2,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 5, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer3,tempbuf); +// if(getStringFromIndexWithDelim(arg,"|", 6, tempbuf, sizeof(tempbuf)) == FALSE) +// return; +// strcpy(randwronganswer4,tempbuf); + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬӢģ",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + //char *tempbuff2 = "ABCDE"; + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + if(selecttype<=30){ + sprintf(buf,"%d|%d",rightnum,meindex); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(buf,"%d|%d",randnum1,meindex); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(talkerindex, CHAR_WORKRANDMSG, buf); + int fd = getfdFromCharaIndex( talkerindex ); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_NPCENEMY_RAND_MSG, + -1, + buf); + CHAR_setWorkInt(talkerindex,CHAR_WORKLUANPCINT,0); + } + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(talkerindex,CHAR_RANDTYPE,tempbuff); + return; + } + NPC_NPCEnemy_Encount( meindex, talkerindex, 1); + } +} + +int NPC_NPCEnemy_Encount( int meindex, int charaindex, int mode) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[512]; + BOOL flg = TRUE; + int battlemax = getBattlenum(); + int i; + if( CHAR_getInt( meindex, CHAR_BASEIMAGENUMBER) == 0 ) { + return FALSE; + } + if( mode == 0 ) { + if( CHAR_getWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE) == 1 ) { + flg = FALSE; + } + }else if( mode == 1 ) { + if( CHAR_getWorkInt( meindex, CHAR_WORK_ENCOUNTTYPE) == 0 ) { + flg = FALSE; + } + } + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( !flg) { + if( NPC_Util_GetStrFromStrWithDelim( argstr, "deniedmsg", buf, sizeof( buf)) != NULL ) { + CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW ); + } + return FALSE; + } + flg = FALSE; + while( 1 ) { + char buf[1024]; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "item", buf, sizeof( buf)) != NULL ) { + char data[128]; + BOOL found = FALSE; + + for( i = 0; i < CHAR_MAXITEMHAVE; i ++ ) { + int j; + int itemid; + int ret = getStringFromIndexWithDelim( buf,",", i + 1,data, sizeof(data)); + if( ret == FALSE) + break; + found = FALSE; + itemid = atoi( data); + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) == itemid ) { + found = TRUE; + break; + } + } + } + if( !found ) + break; + } + if( !found ) + break; + } +#ifdef _ADD_NOITEM_BATTLE + if(NPC_Util_GetStrFromStrWithDelim(argstr,"noitem",buf,sizeof(buf)) != NULL){ + char data[128]; + BOOL found = FALSE; + + for(i=0;i= sizeof( buf) ) { + print( "buffer over\n"); + return FALSE; + } + } + else { + strcpysafe( &buf[len], sizeof( buf)-len, "\n" ); + len++; + if( len >= sizeof( buf) ) { + print( "buffer over\n"); + return FALSE; + } + } + } + + if( fd != -1 ) { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_NPCENEMY_START, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( buf, escapebuf,sizeof(escapebuf))); + } + /* */ + return FALSE; + }else { + /* */ + flg = NPC_NPCEnemy_BattleIn( meindex, charaindex); + } + } + } + if( !flg) { + if( NPC_Util_GetStrFromStrWithDelim( argstr, "deniedmsg", buf, sizeof( buf))!= NULL ) + { + CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW ); + } + } + return flg; +} + +int NPC_NPCEnemy_Dying( int battleindex, int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + int i,toindex=-1; + int tmp=-1; + + if( !CHAR_CHECKINDEX( meindex)) { + return FALSE; + } + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + +#ifdef _NEW_WARPMAN + if( strstr( argstr, "NEWNPCENEMY") ) { + }else { +#endif + /* Ӭ ̫ */ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "endmsg", buf, sizeof( buf)) != NULL ) { + for( i = 0; i < 5; i ++ ) { + /* 帨ƻ幻嶪 */ + int toindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( toindex) ) { + CHAR_talkToCli( toindex, meindex ,buf , CHAR_COLORYELLOW ); + } + } + + } +#ifdef _NEW_WARPMAN + } +#endif + if( NPC_Util_GetStrFromStrWithDelim( argstr, "steal", buf, sizeof( buf)) != NULL ) { + print("\n steal TRUE !!"); + if( atoi( buf) == 1 ) { + int charaindex = BattleArray[battleindex].Side[0].Entry[0].charaindex; + NPC_NPCEnemy_StealItem( argstr, meindex, charaindex); + } + + } +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + if( NPC_Util_GetStrFromStrWithDelim( argstr, "herobattlefield", buf, sizeof( buf)) != NULL ) { + int charaindex = BattleArray[battleindex].Side[0].Entry[0].charaindex; + CHAR_setWorkInt ( charaindex , CHAR_WORKHEROFLOOR , atoi ( buf ) ) ; + // Syu ADD + if ( atoi ( buf ) > CHAR_getInt ( charaindex , CHAR_HEROFLOOR ) ) + CHAR_setInt ( charaindex , CHAR_HEROFLOOR , atoi( buf ) ) ; + } + +#endif + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "dieact"); + if( tmp != 1 ) + tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_DIEACT, tmp); + + if( CHAR_getWorkInt( meindex, CHAR_WORK_DIEACT) == 0 ) { + Char *ch; + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, 0); + print("bbi---->bi10"); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_ALTERRATIVE); + MAP_sendAroundMapdata( CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y)); + ch = CHAR_getCharPointer( meindex); + if( ch != NULL ) { + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), + "NPCEnemyLoop"); + CHAR_constructFunctable( meindex); + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 5000); + CHAR_setWorkInt( meindex, CHAR_WORK_DIETIME, NowTime.tv_sec); +#ifdef _NPCENEMY_1 + char token1[512]; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "winmsg", token1, sizeof( token1)) != NULL ) { + int i; + int playernum = CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, token1, CHAR_COLORRED); + } + } + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "GetRandItem", buf, sizeof( buf))!= NULL ){ + int j=1, rand_cnt=1; + char buf2[256]; + while( getStringFromIndexWithDelim( buf , "," , j, buf2, sizeof( buf2)) != FALSE ){ + j++; + rand_cnt++; + } + for( i = 0; i < 5; i ++ ) { + int toindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( toindex) ) { + NPC_ActionTreasureRandItemGet( meindex, toindex, rand_cnt, buf); + } + } + } +#endif + }else { + print( "NPCENEMY:err\n"); + } + }else { + for( i = 0; i < 5; i ++ ) { + toindex = BattleArray[battleindex].Side[0].Entry[i].charaindex; + if( CHAR_CHECKINDEX( toindex) ) { +#ifdef _NEW_WARPMAN + if( strstr( argstr, "NEWNPCENEMY") ) { + BOOL Party=TRUE; + if( NPC_NPCEnemy_CheckFree( meindex, toindex , &Party) == FALSE ) { + continue; + } + if( Party == TRUE ) { + }else { + if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { + if( NPC_WarpAllMsg( meindex, toindex ) == TRUE ) { + return TRUE; + } + } + continue; + } + } + CHAR_DischargeParty( toindex, 0); // + CHAR_warpToSpecificPoint( toindex, + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) + ); + +#else + CHAR_warpToSpecificPoint( toindex, + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_FLOOR), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_X), + CHAR_getWorkInt( meindex, CHAR_WORK_WARP_Y) + ); +#endif +#ifdef _NPC_REPLACEMENT + Check_EnemyWarpMe( meindex, argstr); +#endif + } + } + } + return TRUE; +} + +void NPC_NPCEnemyLoop( int meindex ) +{ + + if( NowTime.tv_sec > CHAR_getWorkInt( meindex, CHAR_WORK_DIETIME) + + CHAR_getWorkInt( meindex, CHAR_WORK_REVIVALTIME)){ + Char *ch; + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, CHAR_getWorkInt( meindex, CHAR_WORK_BASEIMGBAK)); + print("bbi---->bi11"); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + CHAR_setWorkInt( meindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_ENEMY); +#ifdef _NPCENEMY_1 + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + char token1[1024]; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "npcwarp", token1, sizeof( token1)) != NULL ) { + char token[32]; + char token2[32]; + char buf2[32]; + int floor,x,y,x1,x2,y1,y2; + int ret; + int cnt; + int dcnt = 1; + + /*--ػ󼰴 --*/ + //cnt = CHAR_getWorkInt(meindex,CHAR_NPCWORKINT4); + while(getStringFromIndexWithDelim(token1,",", dcnt,buf2,sizeof(buf2) ) + !=FALSE ){ + dcnt++; + } + cnt = RAND(1,dcnt); + //printf("\ndcnt=%d,cnt=%d\n",dcnt,cnt); + + if(getStringFromIndexWithDelim(token1,",", cnt,buf2,sizeof(buf2)) !=FALSE ) + { + cnt++; + ret=getStringFromIndexWithDelim(buf2,".", 1,token,sizeof(token)); + if( ret == FALSE ) { + floor = CHAR_getInt(meindex,CHAR_FLOOR); + } + floor = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 2,token,sizeof(token)); + if( ret == FALSE ){ + x = CHAR_getInt(meindex,CHAR_X); + }else{ + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + x = atoi( token ); + }else{ + x1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + x2=x1; + }else{ + x2=atoi(token2); + } + x = RAND(x1,x2); + } + } + //x = atoi( token ); + + ret=getStringFromIndexWithDelim(buf2,".", 3,token,sizeof(token)); + if( ret == FALSE ) { + y = CHAR_getInt(meindex,CHAR_Y); + }else{ + ret=getStringFromIndexWithDelim(token,"-", 1,token2,sizeof(token2)); + if( ret == FALSE ){ + y = atoi( token ); + }else{ + y1=atoi(token2); + ret=getStringFromIndexWithDelim(token,"-", 2,token2,sizeof(token2)); + if( ret == FALSE ){ + y2=y1; + }else{ + y2=atoi(token2); + } + y = RAND(y1,y2); + } + } + //y = atoi( token ); + + //CHAR_setInt(meindex,CHAR_NPCWORKINT4, cnt); + //CHAR_warpToSpecificPoint(meindex, floor, x, y); + //CHAR_setInt(meindex,CHAR_FLOOR,floor); + //CHAR_setInt(meindex,CHAR_X,x); + //CHAR_setInt(meindex,CHAR_Y,y); + CHAR_warpToSpecificPoint(meindex,floor,x,y); + } + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "allmsg", token1, sizeof( token1)) != NULL ) { + int i; + int playernum = CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, token1, CHAR_COLORRED); + } + } + } +#endif + MAP_sendAroundMapdata( CHAR_getInt( meindex, CHAR_FLOOR), + CHAR_getInt( meindex, CHAR_X), + CHAR_getInt( meindex, CHAR_Y)); + ch = CHAR_getCharPointer( meindex); + if( ch != NULL ) { + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNC]), ""); + CHAR_constructFunctable( meindex); +// CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 0); + } + } +} + + +BOOL NPC_NPCEnemy_BattleIn( int meindex, int charaindex) +{ + int gym; + int ret; + char buf[256]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + memset( argstr, 0, sizeof( argstr)); + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + gym = NPC_Util_GetNumFromStrWithDelim( argstr, "gym"); + +#ifdef _EMENY_CHANCEMAN + { + int masterindex=-1; + masterindex = NPC_EmenyChanceCheck( meindex, charaindex, argstr); + if( CHAR_CHECKINDEX( masterindex)){ + charaindex = masterindex; + }else { + return TRUE; + } + } +#endif +#ifdef _WARNPC_CTRL + int sameip = NPC_Util_GetNumFromStrWithDelim( argstr, "sameip"); + if(sameip == -1) + sameip = 0; + CHAR_setWorkInt( charaindex, CHAR_WORKNPCBATTLESAMEIP, sameip); + if(CHAR_getWorkInt(charaindex,CHAR_WORKNPCBATTLESAMEIP)>0){ + int partyi; + unsigned ip=CONNECT_get_userip(getfdFromCharaIndex(charaindex)); + unsigned teseip = ip; + unsigned toip; + int a, b, c, d,ipcnt=1; + char ipstr[32]; + a=(teseip % 0x100); teseip=teseip / 0x100; + b=(teseip % 0x100); teseip=teseip / 0x100; + c=(teseip % 0x100); teseip=teseip / 0x100; + d=(teseip % 0x100); + sprintf(ipstr,"%d.%d.%d.%d",a,b,c,d); + if(strcmp(ipstr,getNoAttIp(0))==0 || strcmp(ipstr,getNoAttIp(1))==0 || strcmp(ipstr,getNoAttIp(2))==0 || strcmp(ipstr,getNoAttIp(3))==0 || strcmp(ipstr,getNoAttIp(4))==0){ + } + else{ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_NONE ) { + }else{ + for( partyi = 0; partyi < CHAR_PARTYMAX; partyi ++ ) { + int index = CHAR_getWorkInt( charaindex, partyi + CHAR_WORKPARTYINDEX1); + if( CHAR_CHECKINDEX(index)) { + toip = CONNECT_get_userip(getfdFromCharaIndex(index)); + if(ip==toip){ + ipcnt++; + if(ipcnt>sameip){ + CHAR_talkToCli( charaindex, -1, "ͬIPѴޣ޷ս", CHAR_COLORYELLOW); + return FALSE; + } + } + } + } + } + } + } +#endif + if( gym > 0 ){ + ret = BATTLE_CreateVsEnemy( charaindex, 2, meindex); + }else{ + ret = BATTLE_CreateVsEnemy( charaindex, 1, meindex); + } + if( ret == 0 ) { +#ifdef _WARNPC_CTRL + int tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "noquckwar"); + if( tmp == -1 ) + tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_BATTLEINGTIME, tmp); + if(CHAR_getWorkInt(meindex,CHAR_WORK_BATTLEINGTIME)>0){ + CHAR_setWorkInt(charaindex,CHAR_WORKNPCENEMYBATTLETIME,1); + CHAR_setWorkInt(charaindex,CHAR_WORKNPCENEMYTIME,CHAR_getWorkInt(meindex,CHAR_WORK_BATTLEINGTIME)); + if(CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + int i; + for( i = 1; i < CHAR_PARTYMAX; i ++ ) { + if( CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1) > -1 ) { + CHAR_setWorkInt(CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1),CHAR_WORKNPCENEMYBATTLETIME,1); + CHAR_setWorkInt(CHAR_getWorkInt( charaindex, i + CHAR_WORKPARTYINDEX1),CHAR_WORKNPCENEMYTIME,CHAR_getWorkInt(meindex,CHAR_WORK_BATTLEINGTIME)); + } + } + } + } +#endif + BattleArray[CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX)].WinFunc = NPC_NPCEnemy_Dying; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "startmsg", buf, sizeof( buf)) != NULL ){ + CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW ); + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "steal", buf, sizeof( buf))!= NULL ){ + if( atoi( buf) == 0 ) { + NPC_NPCEnemy_StealItem( argstr, meindex, charaindex); + } + } +#ifdef _NPCENEMY_1 + if( NPC_Util_GetStrFromStrWithDelim( argstr, "help", buf, sizeof( buf)) != NULL ){ + CHAR_setWorkInt(charaindex,CHAR_WORKBATTLEHELP,1); + BattleArray[CHAR_getWorkInt( charaindex, + CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( charaindex, + CHAR_WORKBATTLESIDE)].flg |= BSIDE_FLG_HELP_OK; + int i; + for( i = 0; i < 5; i ++ ) { + int toindex = BattleArray[CHAR_getWorkInt( + charaindex, CHAR_WORKBATTLEINDEX)].Side[ + CHAR_getWorkInt( charaindex, + CHAR_WORKBATTLESIDE)].Entry[i].charaindex; + if( CHAR_CHECKINDEX( toindex)) { + int tofd = getfdFromCharaIndex( toindex ); + if( tofd != -1 ) { + CHAR_setWorkInt(toindex,CHAR_WORKBATTLEHELP,1); + lssproto_HL_send( tofd, TRUE); + } + /* ˪ */ + CHAR_sendBattleEffect( toindex, ON); + } + } + char floorname[32]; + int floorx,floory; + getStringFromIndexWithDelim( MAP_getfloorShowstring(CHAR_getInt(meindex,CHAR_FLOOR)),"|", 1,floorname, sizeof(floorname)); + floorx = CHAR_getInt(meindex,CHAR_X); + floory = CHAR_getInt(meindex,CHAR_Y); + int playernum = CHAR_getPlayerMaxNum(); + char token1[256]; + sprintf(token1,"ʿǣ%s%d,%dҵʹߣԮ",floorname,floorx,floory); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, -1, token1, CHAR_COLORRED); + } + } + } +#endif + } + return ( ret == 0 ) ?TRUE:FALSE ; +} + +void NPC_NPCEnemyWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + if( seqno == CHAR_WINDOWTYPE_NPCENEMY_START) { + if( select == WINDOW_BUTTONTYPE_YES) { + NPC_NPCEnemy_BattleIn( meindex, talkerindex); + } + } +} + +static int NPC_NPCEnemy_StealItem( char *argstr, int meindex, int charaindex) +{ + char itembuf[1024]; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "item", itembuf, sizeof( itembuf))!= NULL ) + { + char data[128]; + int delitemgroup[CHAR_MAXITEMHAVE]; + int found = 0; + int i; + for( i = 0; i < CHAR_MAXITEMHAVE; i ++ ) { + int j; + int itemid; + int ret = getStringFromIndexWithDelim( itembuf,",", i + 1,data, sizeof(data)); + if( ret == FALSE) { + break; + } + itemid = atoi( data); + for( j = 0; j < CHAR_MAXITEMHAVE; j ++ ) { + int itemindex = CHAR_getItemIndex( charaindex, j); + if( ITEM_CHECKINDEX( itemindex)){ + if( ITEM_getInt( itemindex, ITEM_ID) == itemid ){ + CHAR_setItemIndex( charaindex, j, -1); + ITEM_endExistItemsOne( itemindex); + delitemgroup[found] = j; + found ++; + break; + } + } + } + if( !found ) break; + } + CHAR_sendItemData( charaindex, delitemgroup, found); + } + else { + print( "NPCENEMY:\n"); + return FALSE; + } + return TRUE; +} + +#ifdef _NEW_WARPMAN +static BOOL NPC_NPCEnemy_CheckFree( int meindex, int toindex, BOOL *Party) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf1[1024],buf2[256],buf3[256],buf4[256]; + char token[256]; + char temp1[16]; + int talkNo = 1; + int point=1; + + int i=0,type=0; + + struct tagWarpPoint { + int floor; + int x; + int y; + }AllWarPoint[]={ + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, + }; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL) { + print("GetArgStrErr"); + return FALSE; + } + if( (strstr( npcarg,"NEWNPCENEMY") == NULL) && (strstr( npcarg,"OVER") == NULL) ) { + return FALSE; + }else { + } + + while( getStringFromIndexWithDelim( npcarg,"OVER",talkNo,buf1,sizeof( buf1)) != FALSE ) { + + talkNo++; + sprintf(temp1,"NEWEVENT"); + if( strstr( buf1, temp1) != NULL) { + if( NPC_Util_GetStrFromStrWithDelim( buf1, "FREE", buf2, sizeof( buf2) ) == FALSE ) { + continue; + } + if( NPC_ActionPassCheck( meindex, toindex, buf2) == FALSE ) { + continue; + } + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "endmsg", token, sizeof( token)) != NULL ) { + CHAR_talkToCli( toindex, meindex ,token , CHAR_COLORYELLOW ); + } +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + if( NPC_Util_GetStrFromStrWithDelim( buf1, "herobattlefield", token, sizeof( token)) != NULL ) { + CHAR_setWorkInt ( toindex , CHAR_WORKHEROFLOOR , atoi ( token ) ) ; + if ( atoi ( token ) > CHAR_getInt ( toindex , CHAR_HEROFLOOR ) ) + CHAR_setInt ( toindex , CHAR_HEROFLOOR , atoi( token ) ) ; + + } +#endif + + if( NPC_Util_GetStrFromStrWithDelim( buf1, "WARP", buf2, sizeof( buf2) ) == FALSE ){ + continue; + }else {//RAND arraysizeof AllWarPoint + while( getStringFromIndexWithDelim( buf2, ";", point, buf3,sizeof( buf3)) != FALSE ) { + point++; + getStringFromIndexWithDelim( buf3, ",", 1, buf4, sizeof( buf4)); + AllWarPoint[i].floor = atoi( buf4); + getStringFromIndexWithDelim( buf3, ",", 2, buf4, sizeof( buf4)); + AllWarPoint[i].x = atoi( buf4); + getStringFromIndexWithDelim( buf3, ",", 3, buf4, sizeof( buf4)); + AllWarPoint[i].y = atoi( buf4); + i++; + if( i >= arraysizeof( AllWarPoint) ) + break; + } + type = RAND( 0, i-1); + if( AllWarPoint[type].floor <= 0 || type > arraysizeof( AllWarPoint)-1) { + type = 0; + } + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_FLOOR, AllWarPoint[type].floor ); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_X, AllWarPoint[type].x ); + CHAR_setWorkInt( meindex, CHAR_WORK_WARP_Y, AllWarPoint[type].y ); + + } + if( NPC_Util_GetStrFromStrWithDelim( buf1, "CHECKPARTY", buf4, sizeof( buf4)) != NULL ) { + if( strstr( buf4, "FALSE") != NULL ) { + *Party = FALSE; + } + } + if( *Party == TRUE ) { + Action_RunDoEventAction( meindex, toindex, buf1); + } + return TRUE; + } + } + return FALSE; +} + + +BOOL NPCEnemy_CheckFree( int meindex, int talker, char *buf) +{ + char buff2[256]; + char buff3[128]; + int i=1,j=1; + int loop=0; + while( getStringFromIndexWithDelim(buf,",",i,buff2,sizeof(buff2)) !=FALSE ) { + i++; + if(strstr(buff2,"&")!=NULL){ + j=1; + loop=0; + while( getStringFromIndexWithDelim(buff2,"&",j,buff3,sizeof(buff3)) !=FALSE ) { + j++; + if(NPCEnemy_BSCheck(meindex,talker,buff3)==FALSE) { + loop=1; + break; + } + } + if(loop==0) { + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + } + }else{ + if( NPCEnemy_BSCheck( meindex, talker, buff2) == TRUE ){ + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, TRUE ); + return TRUE; + } + } + } + CHAR_setWorkInt( talker, CHAR_WORKWARPCHECK, FALSE ); + return FALSE; +} + +BOOL NPCEnemy_BSCheck(int meindex,int talker,char* buf) +{ + char buff2[128]; + int kosuu,temp=-1,flg=0; + char buff1[128],buff3[128]; + if(strstr( buf, "-") != NULL) { + //buff3ΪץID + getStringFromIndexWithDelim( buf, "-", 2, buff3, sizeof(buff3)); + temp = atoi( buff3); + getStringFromIndexWithDelim( buf, "-", 1, buff1, sizeof(buff1)); + strcpy( buf, buff1); + } + + if(strstr( buf, "<") != NULL){ + getStringFromIndexWithDelim( buf, "<", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "<", 1, buff2, sizeof(buff2)); + + if(NPCEnemy_FreeIfCheck( meindex, talker, buff2, kosuu, 1, temp)==TRUE){ + return TRUE; + } + }else if(strstr( buf, ">") != NULL){ + getStringFromIndexWithDelim( buf, ">", 2, buff2, sizeof(buff2)); + kosuu = atoi(buff2); + getStringFromIndexWithDelim( buf, ">" ,1, buff2, sizeof(buff2)); + + if(NPCEnemy_FreeIfCheck( meindex, talker, buff2, kosuu, 2, temp)==TRUE){ + return TRUE; + } + + }else if(strstr( buf, "!" ) != NULL){ + getStringFromIndexWithDelim( buf, "!=", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "!=", 1, buff2, sizeof(buff2)); + if(NPCEnemy_FreeIfCheck( meindex, talker, buff2, kosuu, 0, temp) == TRUE){ + return FALSE; + }else{ + return TRUE; + } + + }else if(strstr( buf, "=") != NULL){ + + getStringFromIndexWithDelim( buf, "=", 2, buff2, sizeof(buff2)); + kosuu = atoi( buff2); + getStringFromIndexWithDelim( buf, "=", 1, buff2, sizeof(buff2)); + + if( strstr( buf, "PET")) { + flg = 3; + } + if(strstr( buf, "*") != NULL){ + if( NPCEnemy_WarpManReduce( meindex, talker, buf)==TRUE){ + return TRUE; + } + }else if(NPCEnemy_FreeIfCheck( meindex, talker, buff2, kosuu, flg, temp)==TRUE){ + return TRUE; + } + } + return FALSE; +} + +BOOL NPCEnemy_FreeIfCheck(int meindex,int talker,char* buf,int kosuu,int flg, int temp) +{ + if(strcmp(buf,"LV")==0){ + if(NPCEnemy_LevelCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } + + if( strcmp(buf,"TRANS") == 0 ) { + if( NPCEnemy_CheckTrans( meindex, talker, kosuu, flg) == TRUE ) + return TRUE; + } + if( strcmp( buf, "PET") == 0 ) { + if( temp > 0 ) { + if( NPCEnemy_CheckMyPet( meindex, talker, kosuu, flg, temp) == TRUE ) + return TRUE; + }else + return FALSE; + } + + if(strcmp(buf,"ITEM")==0){ + if(NPCEnemy_ItemCheck(meindex,talker,kosuu,flg)==TRUE){ + return TRUE; + } + } + if(strcmp(buf,"ENDEV")==0){ + if(NPC_EventCheckFlg( talker, kosuu)==TRUE){ + return TRUE; + } + } + if(strcmp(buf,"NOWEV")==0){ + if(NPC_NowEventCheckFlg( talker, kosuu)==TRUE){ + return TRUE; + } + } + return FALSE; + +} + +BOOL NPCEnemy_WarpManReduce(int meindex,int talker,char *buf) +{ + char buf2[512]; + char buf3[256]; + int id=0; + int i; + int itemindex; + int itemno; + int kosuu; + int cnt=0; + + getStringFromIndexWithDelim(buf,"=",2,buf2,sizeof(buf2)); + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemno = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex=CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + cnt++; + if(cnt==kosuu){ + return TRUE; + } + } + } + } + + return FALSE; + +} + +BOOL NPCEnemy_BigSmallLastCheck(int point1,int mypoint,int flg) +{ + if(flg==0){ + if(point1==mypoint) { + return TRUE; + } + + }else if(flg==1){ + if(mypoint < point1) { + return TRUE; + } + + }else if(flg==2){ + if(mypoint > point1) { + return TRUE; + } + } + + return FALSE; + +} + +BOOL NPCEnemy_LevelCheck(int meindex,int talker,int level,int flg) +{ + int mylevel; + mylevel=CHAR_getInt(talker,CHAR_LV); + if(NPCEnemy_BigSmallLastCheck(level,mylevel,flg)==TRUE) { + return TRUE; + } + return FALSE; +} + +BOOL NPCEnemy_CheckTrans(int meindex,int talker,int trans,int flg) +{ + int myTrans; + myTrans=CHAR_getInt(talker, CHAR_TRANSMIGRATION); + if( NPCEnemy_BigSmallLastCheck( trans, myTrans, flg ) == TRUE ) { + return TRUE; + } + return FALSE; +} + +BOOL NPCEnemy_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid) +{ + int petsel,petindex=-1; + for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++) { + petindex = CHAR_getCharPet( talker, petsel); + if( petindex == -1 ) + continue; + if(CHAR_getInt( petindex, CHAR_PETID) != petid ) + continue; + break; + } + if( petsel == CHAR_MAXPETHAVE ) { + return FALSE; + }else { //ҵ + switch( flg) { + case 0: + if( CHAR_getInt( petindex, CHAR_LV) != petLv ) + return TRUE; + break; + case 1: + if( CHAR_getInt( petindex, CHAR_LV) < petLv ) + return TRUE; + break; + case 2: + if( CHAR_getInt( petindex, CHAR_LV) > petLv ) + return TRUE; + break; + case 3: + if( CHAR_getInt( petindex, CHAR_LV) == petLv ) + return TRUE; + break; + } + return FALSE; + } + return FALSE; +} + +BOOL NPCEnemy_ItemCheck(int meindex,int talker,int itemNo,int flg) +{ + int i; + int itemindex=-1; + int id; + + for( i=0;i 0 && addcnt > 0 ) { + snprintf( message, sizeof( message ) , + "ɥʧ%d%s ƺŵʸ" + "ǵõ%d%s ijƺʸ" + , delcnt, + delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2, + addcnt, + addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2 + ); + CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); + } + else if( delcnt > 0 ) { + snprintf( message, sizeof( message ) , + "ɥʧõ%d%sƺŵʸ", delcnt, + delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); + CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); + } + else if( addcnt > 0 ) { + snprintf( message, sizeof( message ) , + "%d%sijƺŰɣ", addcnt, // CoolFish: d%s -> %d%s 2001/4/18 + addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); + CHAR_talkToCli( talkerindex , meindex , message , CHAR_COLORWHITE ); + } + if( delcnt > 0 ) { + snprintf( message, sizeof( message), + "ʧȥ%d%s ƺţ", delcnt, + delcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); + CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); + } + if( addcnt > 0 ) { + snprintf( message, sizeof( message), + "%d%s ƺţ", addcnt, + addcnt < 10 ? NPC_OLDMAN_TITLE_UNIT1:NPC_OLDMAN_TITLE_UNIT2); + CHAR_talkToCli( talkerindex, -1, message, CHAR_COLORYELLOW); + } + } +} + if( title_change ) CHAR_sendStatusString( talkerindex , "T" ); + +} diff --git a/npc/npc_pauctionman.c b/npc/npc_pauctionman.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_petfusion.c b/npc/npc_petfusion.c new file mode 100644 index 0000000..d8aa80e --- /dev/null +++ b/npc/npc_petfusion.c @@ -0,0 +1,253 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "char_data.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" +#include "npc_petfusion.h" +#include "pet.h" +#include "chatmagic.h" + + +#ifdef _NPC_FUSION + +enum { + WINDOW_START=10, + WINDOW_SELECT, + WINDOW_FUSION, + WINDOW_WARP, //Ծ + WINDOW_END, // + + WINDOW_TALKSTART=20, + WINDOW_TALKSELECT, + WINDOW_RETURN, + WINDOW_TALKEND, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +static void NPC_PetFusion_selectWindow( int meindex, int toindex, int num,int select); +BOOL NPC_DoPetFusion( int meindex, int toindex, char *data, int sizes); + + +BOOL NPC_PetFusionManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_PetFusionManInit: GetArgStrErr!!"); + return FALSE; + } + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_PETFUSIONMAN); + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, MAKEPAIR_STANDBY); + //CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + //CHAR_setWorkInt( meindex, NPC_WORK_PAIRTEAMS, 0); + return TRUE; +} +void NPC_PetFusionManTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( talkerindex, 0) == FALSE ){ + CHAR_talkToCli( talkerindex, meindex, "޷Яˣ", CHAR_COLORYELLOW); + return; + } +#endif + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + NPC_PetFusion_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +static void NPC_PetFusion_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + if( Action_PartyCheck( meindex, toindex) == FALSE) { + CHAR_talkToCli( toindex, meindex, "һһ", CHAR_COLORYELLOW); + return; + } + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_MakePairMan: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num){ + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "StartMsg", token, sizeof( token) ) == NULL){ + return; + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = WINDOW_TALKSTART; + break; + case WINDOW_SELECT: + if( ActionNpc_CheckFree( meindex, toindex, npcarg) == FALSE ) { + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = WINDOW_TALKEND; + }else { + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "SelectMsg", token, sizeof( token) ) == NULL){ + return; + } + windowtype = WINDOWS_MESSAGETYPE_PETFUSION; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = WINDOW_TALKSELECT; + } + break; + case WINDOW_FUSION: + //ںϴ + break; + case WINDOW_WARP: + break; + case WINDOW_END: + break; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, windowno); + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} +void NPC_PetFusionManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if( select == WINDOW_BUTTONTYPE_NO || select == WINDOW_BUTTONTYPE_CANCEL ){ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + return; + } + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != seqno ) + return; + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_MakePairMan: GetArgStrErr!!"); + return; + } + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != seqno ) + return; + + switch( seqno) { + case WINDOW_TALKSTART: + NPC_PetFusion_selectWindow( meindex, talkerindex, WINDOW_SELECT, 0); + break; + case WINDOW_TALKSELECT: + { + if( NPC_DoPetFusion( meindex, talkerindex, data, sizeof( data)) == FALSE ) + return; + return; + NPC_PetFusion_selectWindow( meindex, talkerindex, WINDOW_FUSION, 0); + } + break; + case WINDOW_RETURN: + break; + case WINDOW_TALKEND: + break; + } +} + +void NPC_PetFusionManLoop( int meindex) +{ +} + +BOOL NPC_DoPetFusion( int meindex, int toindex, char *data, int sizes) +{ + char buf[256]; + int i, flg, MainIndex=-1, Subindex1=-1, Subindex2=-1; + int work[4], skill1[7], skill2[7]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + memset( buf, 0, sizeof( buf)); + sprintf( buf, "%s", data); + if( !CHAR_CHECKINDEX( meindex) ) return FALSE; + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("err NPC_MakePairMan: GetArgStrErr!!"); + return FALSE; + } + for( i=0; i +#include +#include + +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" +#include "enemy.h" +#include "chatmagic.h" +#include "log.h" + +#define EVFLG 118 // 58->׻ 118-> + +void pet_make( int charaindex, char* message ); + +BOOL NPC_PetMakerInit( int meindex ) +{ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEPETMAKER ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + return TRUE; +} + +void NPC_PetMakerTalked( int meindex , int talker , char *msg ,int color ) +{ + char* npcarg; + char token[32],tmpbuf[256]; + int msgNo/*,translv*/; + int point,ckpoint,array,shift; + int i,num=0; + + array = EVFLG / 32; + shift = EVFLG % 32; + point = CHAR_getInt( talker, CHAR_ENDEVENT + array); + ckpoint = point; + + npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT); + + getStringFromIndexWithDelim( npcarg, "|", 1, token,sizeof( token)); + msgNo = atoi( token ); + + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + + if( NPC_Util_isFaceToFace( talker, meindex , 2 ) == FALSE ) + { + if( NPC_Util_isFaceToFace( talker, meindex , 1 ) == FALSE ) + return; + } + + //translv = CHAR_getInt( talker, CHAR_TRANSMIGRATION); // ׻ + + for(i=0; i=CHAR_MAXPETHAVE ){ + sprintf(tmpbuf, "ǸûĿռɷó"); + CHAR_talkToCli( talker, meindex, + tmpbuf,CHAR_COLORWHITE); + return; + } + + pet_make( talker, "1845" ); + + point = point | (1 << shift); + CHAR_setInt( talker, CHAR_ENDEVENT + array, point); +} + +void pet_make( int charaindex, char* message ) +{ + int ret; + char msgbuf[64]; + int enemynum; + int enemyid; + int i; + + enemyid = atoi(message); + enemynum = ENEMY_getEnemyNum(); + + for( i=0; i +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "handletime.h" + +#ifdef _PETRACE +#include "npc_petracemaster.h" + +#define PETRACEPETNUM 3 +#define PETRACEMASTER_INITPET_LOOPTIME 3000 // 3 +#define PETRACEMASTER_WAITDROPI_LOOPTIME 30000 // 30 +#define PETRACEMASTER_WAITDROPII_LOOPTIME 10000 // 10 +#define PETRACEMASTER_WAITDROPIII_LOOPTIME 5000 // 5 +#define PETRACEMASTER_WAITDROPIV_LOOPTIME 1000 // 1 +#define PETRACEMASTER_PETRACING_LOOPTIME 3000 // 3 +#define PETRACEMASTER_SHOWWINPET_LOOPTIME 10000 // 10 +#define PETRACEDROPSTAKETIME 120 // 2 120 +#define PETRACESHOWWINPET 30 // 30 +#define PETRACESTDPAYRATE 6 +#define PETRACESTDGOLD 1 // ʱ 1000 + +static void NPC_PetRaceMaster_selectWindow(int meindex, int toindex, int num, int select); +void NPC_findRacePetIndex(int meindex, int floor); +void NPC_givePriceToPlayer(int meindex, int floor, int winpetindex); + +enum +{ + NPC_WORK_STATE = CHAR_NPCWORKINT1, + NPC_WORK_PET1 = CHAR_NPCWORKINT2, + NPC_WORK_PET2 = CHAR_NPCWORKINT3, + NPC_WORK_PET3 = CHAR_NPCWORKINT4, + NPC_WORK_PETGROUP = CHAR_NPCWORKINT5, + NPC_WORK_STATECHANGE = CHAR_NPCWORKINT6, + NPC_WORK_FINDPETFLAG = CHAR_NPCWORKINT7, + NPC_WORK_WINPET = CHAR_NPCWORKINT8, + NPC_WORK_PETGOAL = CHAR_NPCWORKINT9, +}; +enum +{ + NPC_State_Init, + NPC_State_WaitDropStake, + NPC_State_PetRacing, + NPC_State_ShowWinPet, +}; +enum +{ + NPC_State_Wait, + NPC_State_Run, + NPC_State_ShowWin, +}; +typedef struct tagPetRaceGraTable +{ + int pet1gra; + int pet2gra; + int pet3gra; + char pet1name[64]; + char pet2name[64]; + char pet3name[64]; + int pet1win; + int pet2win; + int pet3win; +#ifdef _DROPSTAKENEW +#else + float payrate1; + float payrate2; + float payrate3; +#endif + char state1[64]; + char state2[64]; + char state3[64]; +}PetRaceGraTable; +#ifdef _DROPSTAKENEW +PetRaceGraTable petracegra[27] = +{ + {100820, 100821, 100822, "", "", "", 0, 0, 0, "", "", ""}, + {100823, 100824, 100825, "³", "", "", 0, 0, 0, "", "", ""}, + {100842, 100843, 100844, "˹", "˹", "˹", 0, 0, 0, "", "", ""}, + {100852, 100853, 100855, "", "˹", "˴", 0, 0, 0, "", "", ""}, + {100859, 100856, 100857, "ɿ", "", "", 0, 0, 0, "", "", ""}, + {100864, 100865, 100866, "", "±", "ë", 0, 0, 0, "", "", ""}, + {100829, 100826, 100827, "ȱȼ", "Ӽ", "˹", 0, 0, 0, "", "", ""}, + {100830, 100832, 100833, "ڱ", "", "", 0, 0, 0, "", "", ""}, + {100883, 100884, 100885, "", "", "", 0, 0, 0, "", "", ""}, + {100898, 100900, 100901, "ɿɶ", "", "ϲ", 0, 0, 0, "", "", ""}, + {100834, 100836, 100837, "", "屴", "岨", 0, 0, 0, "", "", ""}, + {100838, 100840, 100841, "", "֮", "", 0, 0, 0, "", "", ""}, + {100879, 100881, 100880, "ϼ", "", "ɰ", 0, 0, 0, "", "", ""}, + {100888, 100887, 100889, "Ī˾", "ŷɪ", "˹", 0, 0, 0, "", "", ""}, + {100913, 100914, 100915, "ķ˹", "˹", "˹", 0, 0, 0, "", "", ""}, + {100845, 100846, 100847, "", "³³", "³˹", 0, 0, 0, "", "", ""}, + {100849, 100850, 100851, "ŵ˹", "˹", "ϻ˹", 0, 0, 0, "", "", ""}, + {100878, 100876, 100877, "岼˹", "Ү˹", "ײ˹", 0, 0, 0, "", "", ""}, + {100908, 100909, 100906, "׶", "˾", "", 0, 0, 0, "", "", ""}, + {100916, 100918, 100919, "³˹", "Ϳ˾", "׵˹", 0, 0, 0, "", "", ""}, + {100860, 100862, 100861, "˾", "÷", "ϣ", 0, 0, 0, "", "", ""}, + {100867, 100870, 100868, "ŷּ³", "", "ʷ³", 0, 0, 0, "", "", ""}, + {100871, 100873, 100874, "³", "³", "˹", 0, 0, 0, "", "", ""}, + {100894, 100895, 100896, "Ħ", "ĦĦ", "Ħ", 0, 0, 0, "", "", ""}, + {100902, 100903, 100905, "", "Ħ", "˹", 0, 0, 0, "", "", ""}, + {100912, 100911, 100910, "", "˹", "", 0, 0, 0, "", "", ""}, + {100891, 100892, 100893, "֨", "˹˹", "ɸ˹", 0, 0, 0, "", "", ""}, +}; +#else +PetRaceGraTable petracegra[27] = +{ + {100820, 100821, 100822, "", "", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100823, 100824, 100825, "³", "", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100842, 100843, 100844, "˹", "˹", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100852, 100853, 100855, "", "˹", "˴", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100859, 100856, 100857, "ɿ", "", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100864, 100865, 100866, "", "±", "ë", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100829, 100826, 100827, "ȱȼ", "Ӽ", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100830, 100832, 100833, "ڱ", "", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100883, 100884, 100885, "", "", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100898, 100900, 100901, "ɿɶ", "", "ϲ", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100834, 100836, 100837, "", "屴", "岨", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100838, 100840, 100841, "", "֮", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100879, 100881, 100880, "ϼ", "", "ɰ", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100888, 100887, 100889, "Ī˾", "ŷɪ", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100913, 100914, 100915, "ķ˹", "˹", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100845, 100846, 100847, "", "³³", "³˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100849, 100850, 100851, "ŵ˹", "˹", "ϻ˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100878, 100876, 100877, "岼˹", "Ү˹", "ײ˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100908, 100909, 100906, "׶", "˾", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100916, 100918, 100919, "³˹", "Ϳ˾", "׵˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100860, 100862, 100861, "˾", "÷", "ϣ", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100867, 100870, 100868, "ŷּ³", "", "ʷ³", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100871, 100873, 100874, "³", "³", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100894, 100895, 100896, "Ħ", "ĦĦ", "Ħ", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100902, 100903, 100905, "", "Ħ", "˹", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100912, 100911, 100910, "", "˹", "", 0, 0, 0, 2, 2, 2, "", "", ""}, + {100891, 100892, 100893, "֨", "˹˹", "ɸ˹", 0, 0, 0, 2, 2, 2, "", "", ""}, +}; +#endif +BOOL NPC_PetRaceMasterInit( int meindex ) +{ + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_INITPET_LOOPTIME); + CHAR_setInt(meindex, CHAR_WHICHTYPE, CHAR_PETRACEMASTER); + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_Init); + CHAR_setWorkInt(meindex, NPC_WORK_PETGROUP, 0); +#ifdef _DROPSTAKENEW +#else + petracegra[0].payrate1 = 0; + petracegra[0].payrate2 = 0; + petracegra[0].payrate3 = 0; +#endif + return TRUE; +} + +void NPC_PetRaceMasterTalked( int meindex , int talkerindex , char *szMes , int color ) +{ + // ˵Լ״ + if (CHAR_getInt(talkerindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) + return; + if (NPC_Util_isFaceToFace(talkerindex, meindex, 2) == FALSE) + if (NPC_Util_CharDistance(talkerindex, meindex) > 1) + return; + NPC_PetRaceMaster_selectWindow(meindex, talkerindex, 0, -1); +} + +static void NPC_PetRaceMaster_selectWindow(int meindex, int toindex, int num, int select) +{ + char token[1024]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex(toindex); + if (fd == -1) return; + token[0] = '\0'; + switch(num) + { + case 0: + sprintf(token, "4\n\n ᄎٳ\n" + "ãҪ֪ʲ鱨\n" + "\n 쿴Ϸ" + "\n ״" + "\n 뿪"); + buttontype = WINDOW_BUTTONTYPE_NONE; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_PETRACEMASTER_START; + break; + case 1: +#ifdef _DROPSTAKENEW + sprintf(token, + "\nٳ" + "\nμӾٵijֻܹճ" + "\n״ϲע뽫һõIJȯ" + "\nעĺǰٽʱ" + "\n˽Զ֡" + "\nע⣺뿪˷dzʱעIJ" + "\nֽ޷ȡࡣ"); +#else + sprintf(token, + "\nٳ򣺲μӾٵijﹲֻ" + "\nճ״ϲעÿ" + "\nԼʡ뽫ʯҶעĺǰ" + "\nٽʱ˻Զؽ" + "\nϻС" + "\nע⣺н𳬹һǧ򣡵뿪" + "\n˷dzʱעĽ޷ȡࡣ"); +#endif + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_PETRACEMASTER_RULE; + break; + case 2: + { + int petgroup = CHAR_getWorkInt(meindex, NPC_WORK_PETGROUP); + int petindex1 = CHAR_getWorkInt(meindex, NPC_WORK_PET1); + int petindex2 = CHAR_getWorkInt(meindex, NPC_WORK_PET2); + int petindex3 = CHAR_getWorkInt(meindex, NPC_WORK_PET3); + int pet1win = petracegra[petgroup].pet1win; + int pet2win = petracegra[petgroup].pet2win; + int pet3win = petracegra[petgroup].pet3win; + int total = pet1win + pet2win + pet3win; + float winrate1 = 0, winrate2 = 0, winrate3 = 0; +#ifdef _DROPSTAKENEW +#else + char cpayrate1[64], cpayrate2[64], cpayrate3[64]; + if (petracegra[petgroup].payrate1 == 0) + snprintf(cpayrate1, sizeof(cpayrate1), "???"); + else + snprintf(cpayrate1, sizeof(cpayrate1), "%6.2f", petracegra[petgroup].payrate1); + if (petracegra[petgroup].payrate2 == 0) + snprintf(cpayrate2, sizeof(cpayrate2), "???"); + else + snprintf(cpayrate2, sizeof(cpayrate2), "%6.2f", petracegra[petgroup].payrate2); + if (petracegra[petgroup].payrate3 == 0) + snprintf(cpayrate3, sizeof(cpayrate3), "???"); + else + snprintf(cpayrate3, sizeof(cpayrate3), "%6.2f", petracegra[petgroup].payrate3); +#endif + if (total == 0) + { + winrate1 = 0; winrate2 = 0; winrate3 = 0; + } + else + { + winrate1 = (float)pet1win / (float)total; + winrate2 = (float)pet2win / (float)total; + winrate3 = (float)pet3win / (float)total; + } +#ifdef _DROPSTAKENEW + sprintf(token, "״\n\n ʤ ܳ ״ ʤ\n" + "========================================" + "%-10s%-6d%-6d%-8s%-6.2f\n" + "%-10s%-6d%-6d%-8s%-6.2f\n" + "%-10s%-6d%-6d%-8s%-6.2f\n", + CHAR_getChar(petindex1, CHAR_NAME), pet1win, total - pet1win, + petracegra[petgroup].state1, winrate1, + CHAR_getChar(petindex2, CHAR_NAME), pet2win, total - pet2win, + petracegra[petgroup].state2, winrate2, + CHAR_getChar(petindex3, CHAR_NAME), pet3win, total - pet3win, + petracegra[petgroup].state3, winrate3); +#else + sprintf(token, "״\n\n ʤ ܳ ״ ʤ \n" + "========================================" + "%-10s%-6d%-6d%-6s%-6.2f%-4s\n" + "%-10s%-6d%-6d%-6s%-6.2f%-4s\n" + "%-10s%-6d%-6d%-6s%-6.2f%-4s\n", + CHAR_getChar(petindex1, CHAR_NAME), pet1win, total - pet1win, + petracegra[petgroup].state1, winrate1, cpayrate1, + CHAR_getChar(petindex2, CHAR_NAME), pet2win, total - pet2win, + petracegra[petgroup].state2, winrate2, cpayrate2, + CHAR_getChar(petindex3, CHAR_NAME), pet3win, total - pet3win, + petracegra[petgroup].state3, winrate3, cpayrate3); +#endif + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_PETRACEMASTER_PET; + } + break; + case 3: + default: + break; + } + lssproto_WN_send(fd, windowtype, buttontype, windowno, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), token); +} + +void NPC_PetRaceMasterWindowTalked(int meindex, int talkerindex, int seqno, int select, char *data) +{ + int datanum = 0; + makeStringFromEscaped(data); + datanum = atoi(data); + switch(seqno) + { + case CHAR_WINDOWTYPE_PETRACEMASTER_START: + if (datanum == 1) + NPC_PetRaceMaster_selectWindow(meindex, talkerindex, 1, -1); + else if (datanum == 2) + NPC_PetRaceMaster_selectWindow(meindex, talkerindex, 2, -1); + break; + case CHAR_WINDOWTYPE_PETRACEMASTER_RULE: + if (datanum == 3) + NPC_PetRaceMaster_selectWindow(meindex, talkerindex, 1, -1); + case CHAR_WINDOWTYPE_PETRACEMASTER_PET: + case CHAR_WINDOWTYPE_PETRACEMASTER_LEAVE: + default: + break; + } +} + +void NPC_PetRaceMasterLoop( int meindex) +{ + int floor = CHAR_getInt(meindex, CHAR_FLOOR); + time_t t1; + time(&t1); + switch(CHAR_getWorkInt(meindex, NPC_WORK_STATE)) + { + case NPC_State_Init: + // Ѱҳindex + NPC_findRacePetIndex(meindex, floor); + break; + case NPC_State_WaitDropStake: + { + char tmpbuf[256]; + int statechangetime = CHAR_getWorkInt(meindex, NPC_WORK_STATECHANGE); + if (t1 < statechangetime) + { + if (statechangetime - t1 <= 5) + { + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPIV_LOOPTIME); + snprintf(tmpbuf, sizeof(tmpbuf), "%2dҪˣӻԾע", + (int)(statechangetime - t1) % 60); + } + else if (statechangetime - t1 <= 10) + { + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPIII_LOOPTIME); + snprintf(tmpbuf, sizeof(tmpbuf), "%2dҪˣӻԾע", + (int)(statechangetime - t1) % 60); + } + else if (statechangetime - t1 <= 30) + { + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPII_LOOPTIME); + snprintf(tmpbuf, sizeof(tmpbuf), "%2dҪˣӻԾע", + (int)(statechangetime - t1) % 60); + } + else + snprintf(tmpbuf, sizeof(tmpbuf), "%2d%2dҪˣӻԾע", + (int)(statechangetime - t1) / 60, (int)(statechangetime - t1) % 60); + } + if (t1 >= statechangetime) + { +#ifdef _DROPSTAKENEW +#else + float payrate1 = 0, payrate2 = 0, payrate3 = 0; + int pet1gold = 0, pet2gold = 0, pet3gold = 0, totalgold = 0; + int petindex1 = CHAR_getWorkInt(meindex, NPC_WORK_PET1); + int petindex2 = CHAR_getWorkInt(meindex, NPC_WORK_PET2); + int petindex3 = CHAR_getWorkInt(meindex, NPC_WORK_PET3); + int randpet = CHAR_getWorkInt(meindex, NPC_WORK_PETGROUP); + float droprate1 = 0, droprate2 = 0, droprate3 = 0, totaldroprate, Npayrate = PETRACESTDPAYRATE; +#endif + int i = 0; + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_PetRacing); + // 趨治ע + SetCasinoMap(meindex, 0, FALSE); +#ifdef _DROPSTAKENEW + snprintf(tmpbuf, sizeof(tmpbuf), "ֹͣעܿʼޣ"); +#else + // ֪ʣȡóעʣ + GetCasinoMapGold(meindex, PET_RACE1, &pet1gold); + GetCasinoMapGold(meindex, PET_RACE2, &pet2gold); + GetCasinoMapGold(meindex, PET_RACE3, &pet3gold); + totalgold = pet1gold + pet2gold + pet3gold; + if (totalgold <= 0) + { + payrate1 = 2; payrate2 = 2; payrate3 = 2; + } + else + { + if (pet1gold <= PETRACESTDGOLD) + pet1gold = PETRACESTDGOLD; + if (pet2gold <= PETRACESTDGOLD) + pet2gold = PETRACESTDGOLD; + if (pet3gold <= PETRACESTDGOLD) + pet3gold = PETRACESTDGOLD; + totalgold = pet1gold + pet2gold + pet3gold; + droprate1 = totalgold / pet1gold; + droprate2 = totalgold / pet2gold; + droprate3 = totalgold / pet3gold; + totaldroprate = droprate1 + droprate2 + droprate3; + if (totaldroprate / droprate1 > PETRACESTDPAYRATE) + { + payrate1 = 1; Npayrate -= 1; + } + if (totaldroprate / droprate2 > PETRACESTDPAYRATE) + { + payrate2 = 1; Npayrate -= 1; + } + if (totaldroprate / droprate3 > PETRACESTDPAYRATE) + { + payrate3 = 1; Npayrate -= 1; + } + if (payrate1 != 1) + payrate1 = droprate1 / totaldroprate * Npayrate; + if (payrate2 != 1) + payrate2 = droprate2 / totaldroprate * Npayrate; + if (payrate3 != 1) + payrate3 = droprate3 / totaldroprate * Npayrate; + } + petracegra[randpet].payrate1 = payrate1; + petracegra[randpet].payrate3 = payrate2; + petracegra[randpet].payrate2 = payrate3; + SetCasinoPayRate(meindex, PET_RACE1, payrate1); + SetCasinoPayRate(meindex, PET_RACE2, payrate2); + SetCasinoPayRate(meindex, PET_RACE3, payrate3); + snprintf(tmpbuf, sizeof(tmpbuf), "ֹͣעܿʼޣ%sΪ%5.2f%sΪ%5.2f%sΪ%5.2f", + CHAR_getChar(petindex1, CHAR_NAME), payrate1, + CHAR_getChar(petindex2, CHAR_NAME), payrate2, + CHAR_getChar(petindex3, CHAR_NAME), payrate3); +#endif + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_PETRACING_LOOPTIME); + // 趨״̬ + for (i = 0; i < PETRACEPETNUM; i++) + { + CHAR_setWorkInt(CHAR_getWorkInt(meindex, NPC_WORK_PET1 + i), NPC_WORK_STATE, NPC_State_Run); + CHAR_setInt(CHAR_getWorkInt(meindex, NPC_WORK_PET1 + i), CHAR_LOOPINTERVAL, 1000); + } + } + CHAR_talkToFloor(floor, meindex, tmpbuf, CHAR_COLORWHITE); + } + break; + case NPC_State_PetRacing: + if (CHAR_getWorkInt(meindex, NPC_WORK_PETGOAL) == PETRACEPETNUM) + { + char tmpbuf[256]; + int winpetindex = CHAR_getWorkInt(meindex, NPC_WORK_WINPET); + int petgroup = CHAR_getWorkInt(meindex, NPC_WORK_PETGROUP); + snprintf(tmpbuf, sizeof(tmpbuf), "ʤijǣ%s\n", + CHAR_getChar(winpetindex, CHAR_NAME)); + CHAR_talkToFloor(floor, meindex, tmpbuf, CHAR_COLORYELLOW); + // 趨ӮԼ + if (CHAR_getWorkInt(meindex, NPC_WORK_PET1) == winpetindex) + petracegra[petgroup].pet1win = petracegra[petgroup].pet1win + 1; + else if (CHAR_getWorkInt(meindex, NPC_WORK_PET2) == winpetindex) + petracegra[petgroup].pet2win = petracegra[petgroup].pet2win + 1; + else if (CHAR_getWorkInt(meindex, NPC_WORK_PET3) == winpetindex) + petracegra[petgroup].pet3win = petracegra[petgroup].pet3win + 1; + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_ShowWinPet); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_SHOWWINPET_LOOPTIME); + CHAR_setWorkInt(meindex, NPC_WORK_STATECHANGE, t1 + PETRACESHOWWINPET); + // + NPC_givePriceToPlayer(meindex, floor, winpetindex); + } + break; + case NPC_State_ShowWinPet: + { + int statechangetime = CHAR_getWorkInt(meindex, NPC_WORK_STATECHANGE); + if (t1 >= statechangetime) + { + int randpet = RAND(0, arraysizeof(petracegra) - 1); + int petindex1 = CHAR_getWorkInt(meindex, NPC_WORK_PET1); + int petindex2 = CHAR_getWorkInt(meindex, NPC_WORK_PET2); + int petindex3 = CHAR_getWorkInt(meindex, NPC_WORK_PET3); + char tmpbuf[256]; + CHAR_setWorkInt(meindex, NPC_WORK_PETGROUP, randpet); + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_WaitDropStake); + CHAR_setWorkInt(meindex, NPC_WORK_WINPET, 0); + CHAR_setWorkInt(meindex, NPC_WORK_PETGOAL, 0); + CHAR_setWorkInt(meindex, NPC_WORK_STATECHANGE, t1 + PETRACEDROPSTAKETIME); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPI_LOOPTIME); + // 趨ע + SetCasinoMap(meindex, 0, TRUE); + // 趨 + CHAR_setWorkInt(petindex1, NPC_WORK_STATE, NPC_State_Wait); + CHAR_setInt(petindex1, CHAR_LOOPINTERVAL, 1000); + CHAR_setInt(petindex1, CHAR_BASEIMAGENUMBER, petracegra[randpet].pet1gra); + CHAR_setChar(petindex1, CHAR_NAME, petracegra[randpet].pet1name); + + CHAR_setWorkInt(petindex2, NPC_WORK_STATE, NPC_State_Wait); + CHAR_setInt(petindex2, CHAR_LOOPINTERVAL, 1000); + CHAR_setInt(petindex2, CHAR_BASEIMAGENUMBER, petracegra[randpet].pet2gra); + CHAR_setChar(petindex2, CHAR_NAME, petracegra[randpet].pet2name); + + CHAR_setWorkInt(petindex3, NPC_WORK_STATE, NPC_State_Wait); + CHAR_setInt(petindex3, CHAR_LOOPINTERVAL, 1000); + CHAR_setInt(petindex3, CHAR_BASEIMAGENUMBER, petracegra[randpet].pet3gra); + CHAR_setChar(petindex3, CHAR_NAME, petracegra[randpet].pet3name); + // 趨״ +#ifdef _DROPSTAKENEW +#else + petracegra[randpet].payrate1 = 0; + petracegra[randpet].payrate3 = 0; + petracegra[randpet].payrate2 = 0; +#endif + { + int state1 = RAND(0, 3); + int state2 = RAND(0, 3); + int state3 = RAND(0, 3); + if (state1 == 0) + sprintf(petracegra[randpet].state1, ""); + else if (state1 == 1) + sprintf(petracegra[randpet].state1, "ͨ"); + else if (state1 == 2) + sprintf(petracegra[randpet].state1, ""); + else if (state1 == 3) + sprintf(petracegra[randpet].state1, "δ֪"); + if (state2 == 0) + sprintf(petracegra[randpet].state2, ""); + else if (state2 == 1) + sprintf(petracegra[randpet].state2, "ͨ"); + else if (state2 == 2) + sprintf(petracegra[randpet].state2, ""); + else if (state2 == 3) + sprintf(petracegra[randpet].state2, "δ֪"); + if (state3 == 0) + sprintf(petracegra[randpet].state3, ""); + else if (state3 == 1) + sprintf(petracegra[randpet].state3, "ͨ"); + else if (state3 == 2) + sprintf(petracegra[randpet].state3, ""); + else if (state3 == 3) + sprintf(petracegra[randpet].state3, "δ֪"); + } + snprintf(tmpbuf, sizeof(tmpbuf), "ᄎ׼УӻԾע"); + CHAR_talkToFloor(floor, meindex, tmpbuf, CHAR_COLORYELLOW); + } + } + break; + default: + break; + } +} + +void NPC_findRacePetIndex(int meindex, int floor) +{ + int i = 0, j = 0; + time_t t1; + time(&t1); + + if (CHAR_getWorkInt(meindex, NPC_WORK_FINDPETFLAG) == 0) + { + for (i = 0; i < CHAR_getCharNum(); i++) + { + if (CHAR_getInt(i, CHAR_FLOOR) == floor) + { + if (CHAR_getInt(i, CHAR_WHICHTYPE) == CHAR_PETRACEPET) + { + for (j = 0; j < PETRACEPETNUM; j++) + { + if (CHAR_getWorkInt(meindex, NPC_WORK_PET1 + j) == 0) + { + CHAR_setWorkInt(meindex, NPC_WORK_PET1 + j, i); + CHAR_setWorkInt(i, CHAR_NPCWORKINT2, meindex); + break; + } + } + } + } + } + if (CHAR_getWorkInt(meindex, NPC_WORK_PET1) > 0 + && CHAR_getWorkInt(meindex, NPC_WORK_PET2) > 0 + && CHAR_getWorkInt(meindex, NPC_WORK_PET3) > 0) + { + CHAR_setWorkInt(meindex, NPC_WORK_FINDPETFLAG, 1); + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_WaitDropStake); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEMASTER_WAITDROPI_LOOPTIME); + CHAR_setWorkInt(meindex, NPC_WORK_STATECHANGE, t1 + PETRACEDROPSTAKETIME); + } + else CHAR_setWorkInt(meindex, NPC_WORK_FINDPETFLAG, 0); + } +} + +void NPC_givePriceToPlayer(int meindex, int floor, int winpetindex) +{ + int wincasinotype = 0; + if (CHAR_getWorkInt(meindex, NPC_WORK_PET1) == winpetindex) + wincasinotype = PET_RACE1; + else if (CHAR_getWorkInt(meindex, NPC_WORK_PET2) == winpetindex) + wincasinotype = PET_RACE2; + else if (CHAR_getWorkInt(meindex, NPC_WORK_PET3) == winpetindex) + wincasinotype = PET_RACE3; + if (wincasinotype == 0) return; + else + CasinoPay(meindex, wincasinotype); +} +#endif diff --git a/npc/npc_petracepet.c b/npc/npc_petracepet.c new file mode 100644 index 0000000..8eb5a42 --- /dev/null +++ b/npc/npc_petracepet.c @@ -0,0 +1,291 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "handletime.h" + +#ifdef _PETRACE +#include "npc_petracepet.h" + +#define PETRACEPET_WAIT_LOOPTIME 30000 // 30 +#define PETRACEPET_SHOWWIN_LOOPTIME 10000 // 10 + +static void NPC_PetRacePet_Walk(int meindex); +static int NPC_PetRacePetSetPoint(int meindex, char *argstr); + +enum +{ + NPC_WORK_STATE = CHAR_NPCWORKINT1, + NPC_WORK_MASTER = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUTETOX = CHAR_NPCWORKINT4, + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT5, + NPC_WORK_WAITFLAG = CHAR_NPCWORKINT6, + NPC_WORK_FLOOR = CHAR_NPCWORKINT7, + NPC_WORK_X = CHAR_NPCWORKINT8, + NPC_WORK_Y = CHAR_NPCWORKINT9, + NPC_WORK_DIR = CHAR_NPCWORKINT10, + NPC_WORK_STOPX = CHAR_NPCWORKINT11, + NPC_WORK_STOPY = CHAR_NPCWORKINT12, +}; +enum +{ + NPC_State_Wait, + NPC_State_Run, + NPC_State_ShowWin, +}; + +int raceflag=0; + +BOOL NPC_PetRacePetInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[256]; + int showstopx, showstopy; + int routenum = 0, i = 0; + + NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)); + for (i = 1; i <= routenum; i++) + { + char routetostring[64]; + snprintf(routetostring, sizeof(routetostring), "routeto"); + if (NPC_Util_GetStrFromStrWithDelim(argstr, routetostring, buf, sizeof(buf)) == NULL) + { + print("Init_npcracepet: Didn't set route\n"); + return FALSE; + } + } + showstopx = NPC_Util_GetNumFromStrWithDelim(argstr, "showstopx"); + showstopy = NPC_Util_GetNumFromStrWithDelim(argstr, "showstopy"); + if (showstopx < 0 || showstopx > 100 || showstopy < 0 || showstopy > 100) + return FALSE; + CHAR_setInt(meindex, CHAR_WHICHTYPE, CHAR_PETRACEPET); + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_Wait); + CHAR_setWorkInt(meindex, NPC_WORK_ROUTEPOINT, 2); + CHAR_setWorkInt(meindex, NPC_WORK_WAITFLAG, 1); + CHAR_setWorkInt(meindex, NPC_WORK_FLOOR, CHAR_getInt(meindex, CHAR_FLOOR)); + CHAR_setWorkInt(meindex, NPC_WORK_X, CHAR_getInt(meindex, CHAR_X)); + CHAR_setWorkInt(meindex, NPC_WORK_Y, CHAR_getInt(meindex, CHAR_Y)); + CHAR_setWorkInt(meindex, NPC_WORK_DIR, CHAR_getInt(meindex, CHAR_DIR)); + CHAR_setWorkInt(meindex, NPC_WORK_STOPX, showstopx); + CHAR_setWorkInt(meindex, NPC_WORK_STOPY, showstopy); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEPET_WAIT_LOOPTIME); + NPC_PetRacePetSetPoint(meindex, argstr); + + return TRUE; +} + +void NPC_PetRacePetTalked( int meindex , int talkerindex , char *szMes , int color ) +{ +} + +void NPC_PetRacePetLoop( int meindex) +{ + switch(CHAR_getWorkInt(meindex, NPC_WORK_STATE)) + { + case NPC_State_Wait: + { + if (CHAR_getWorkInt(meindex, NPC_WORK_WAITFLAG) == 0) + { + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)); + CHAR_setWorkInt(meindex, NPC_WORK_ROUTEPOINT, 2); + NPC_PetRacePetSetPoint(meindex, argstr); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEPET_WAIT_LOOPTIME); + CHAR_setInt(meindex, CHAR_DIR, CHAR_getWorkInt(meindex, NPC_WORK_DIR)); + CHAR_warpToSpecificPoint(meindex, + CHAR_getWorkInt(meindex, NPC_WORK_FLOOR), + CHAR_getWorkInt(meindex, NPC_WORK_X), + CHAR_getWorkInt(meindex, NPC_WORK_Y)); + CHAR_setWorkInt(meindex, NPC_WORK_WAITFLAG, 1); + } + } + break; + case NPC_State_Run: + { + int interval = 50; + int random = 0; + if (CHAR_getWorkInt(meindex, NPC_WORK_ROUTETOX) <= CHAR_getWorkInt(meindex, NPC_WORK_STOPX) + && CHAR_getWorkInt(meindex, NPC_WORK_ROUTETOY) >= CHAR_getWorkInt(meindex, NPC_WORK_STOPY)) + random = 3; + else + random = RAND(0, 8); + if (random == 0) // + { + int rands = RAND(0, 3); + interval = 1500; + CHAR_sendAction(meindex, 0, FALSE); + if (rands == TRUE) + { + char tmpbuf[256]; + int floor = CHAR_getInt(meindex, CHAR_FLOOR); + int master = CHAR_getWorkInt(meindex, NPC_WORK_MASTER); + int randomi = RAND(1, 9); + if (randomi == 1) + snprintf(tmpbuf, sizeof(tmpbuf), "Ŷ%sࡣ", + CHAR_getChar(meindex, CHAR_NAME)); + else if (randomi == 2) + snprintf(tmpbuf, sizeof(tmpbuf), "%sʹ˷һ", + CHAR_getChar(meindex, CHAR_NAME)); + else if (randomi == 3) + snprintf(tmpbuf, sizeof(tmpbuf), "...%sŭˣ", + CHAR_getChar(meindex, CHAR_NAME)); + if (randomi > 0 && randomi < 4) + CHAR_talkToFloor(floor, master, tmpbuf, CHAR_COLORWHITE); + } + } + else if (random == 1) // ε + { + int rands = RAND(0, 3); + interval = 2500; + CHAR_sendAction(meindex, 2, FALSE); + if (rands == TRUE) + { + char tmpbuf[256]; + int floor = CHAR_getInt(meindex, CHAR_FLOOR); + int master = CHAR_getWorkInt(meindex, NPC_WORK_MASTER); + int randomi = RAND(1, 9); + if (randomi == 1) + snprintf(tmpbuf, sizeof(tmpbuf), "%sε...", + CHAR_getChar(meindex, CHAR_NAME)); + else if (randomi == 2) + snprintf(tmpbuf, sizeof(tmpbuf), "%s", + CHAR_getChar(meindex, CHAR_NAME)); + else if (randomi == 3) + snprintf(tmpbuf, sizeof(tmpbuf), "...%sε¸ҵˣ", + CHAR_getChar(meindex, CHAR_NAME)); + if (randomi > 0 && randomi < 4) + CHAR_talkToFloor(floor, master, tmpbuf, CHAR_COLORWHITE); + } + } + else if (random == 2) // վ + { + interval = 500; + CHAR_sendAction(meindex, 3, FALSE); + } + else // һ + interval = RAND(20, 100); + NPC_PetRacePet_Walk(meindex); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, interval); + } + break; + case NPC_State_ShowWin: + { + int action = RAND(0, 11); + CHAR_sendAction(meindex, action, FALSE); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, PETRACEPET_SHOWWIN_LOOPTIME); + } + break; + default: + break; + } +} + +static void NPC_PetRacePet_Walk(int meindex) +{ + POINT start, end; + int dir, i; + + start.x = CHAR_getInt(meindex, CHAR_X); + start.y = CHAR_getInt(meindex, CHAR_Y); + end.x = CHAR_getWorkInt(meindex, NPC_WORK_ROUTETOX); + end.y = CHAR_getWorkInt(meindex, NPC_WORK_ROUTETOY); + if (start.x == end.x && start.y == end.y) + { + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + NPC_Util_GetArgStr(meindex, argstr, sizeof( argstr)); + CHAR_setWorkInt(meindex, NPC_WORK_ROUTEPOINT, + CHAR_getWorkInt(meindex, NPC_WORK_ROUTEPOINT) + 1); + + if (NPC_PetRacePetSetPoint(meindex, argstr) == FALSE) + { + // Ŀĵᣬʼ״̬ + char tmpbuf[256]; + int masterindex = CHAR_getWorkInt(meindex, NPC_WORK_MASTER); + int petgoal = CHAR_getWorkInt(masterindex, CHAR_NPCWORKINT9); + int floor = CHAR_getInt(masterindex, CHAR_FLOOR); + if (CHAR_getWorkInt(masterindex, CHAR_NPCWORKINT8) == 0) + { + CHAR_warpToSpecificPoint(meindex, 7005,42,44); + CHAR_setWorkInt(masterindex, CHAR_NPCWORKINT8, meindex); + CHAR_sendAction(meindex, 3, FALSE); + snprintf(tmpbuf, sizeof(tmpbuf), "ȵĿĵص...%s", + CHAR_getChar(meindex, CHAR_NAME)); + raceflag++; + } + else + { + if(raceflag == 1) + { + //ͻصָ + CHAR_warpToSpecificPoint(meindex, 7005,43,47); + snprintf(tmpbuf, sizeof(tmpbuf), "ŵĿĵص...%s", + CHAR_getChar(meindex, CHAR_NAME)); + raceflag++; + } + else + { + //һĴͣʼ + CHAR_warpToSpecificPoint(meindex, 7005,45,44); + snprintf(tmpbuf, sizeof(tmpbuf), "󵽴Ŀĵص...%s", + CHAR_getChar(meindex, CHAR_NAME)); + raceflag=0; + } + } + CHAR_setWorkInt(meindex, NPC_WORK_STATE, NPC_State_ShowWin); + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, 500); + CHAR_setWorkInt(meindex, NPC_WORK_WAITFLAG, 0); + CHAR_setWorkInt(masterindex, CHAR_NPCWORKINT9, petgoal + 1); + CHAR_talkToFloor(floor, masterindex, tmpbuf, CHAR_COLORWHITE); + return; + } + else + return; + } + dir = NPC_Util_getDirFromTwoPoint(&start, &end); + end.x = CHAR_getInt(meindex, CHAR_X); + end.y = CHAR_getInt(meindex, CHAR_Y); + for(i = 0; i < 100; i++) + { + if (dir < 0) + dir = RAND(0, 7); + dir = NPC_Util_SuberiWalk(meindex, dir); + if (dir >= 0 && dir <= 7) break; + } + if (dir >= 0 && dir <= 7) + { + int result = 0; + result = CHAR_walk(meindex, dir, 0); + } +} + +static int NPC_PetRacePetSetPoint(int meindex, char *argstr) +{ + // Ѱһ x , y + char buf[4096], buf2[256], buf3[256]; + int ret; + char routetostring[64]; + snprintf(routetostring, sizeof(routetostring), "routeto"); + if (NPC_Util_GetStrFromStrWithDelim(argstr, routetostring, buf, sizeof(buf)) == NULL) + { + print("SetPoint_npcracepet: Didn't set route %s\n", routetostring); + return FALSE; + } + ret = getStringFromIndexWithDelim(buf, ";", + CHAR_getWorkInt(meindex, NPC_WORK_ROUTEPOINT), buf2, sizeof(buf2)); + if (ret == FALSE) return FALSE; + ret = getStringFromIndexWithDelim(buf2, ",", 1, buf3, sizeof(buf3)); + if (ret == FALSE) return FALSE; + CHAR_setWorkInt(meindex, NPC_WORK_ROUTETOX, atoi(buf3)); + ret = getStringFromIndexWithDelim(buf2, ",", 2, buf3, sizeof(buf3)); + if (ret == FALSE) return FALSE; + CHAR_setWorkInt(meindex, NPC_WORK_ROUTETOY, atoi(buf3)); + return TRUE; +} + +#endif + + diff --git a/npc/npc_petshop.c b/npc/npc_petshop.c new file mode 100644 index 0000000..d768b44 --- /dev/null +++ b/npc/npc_petshop.c @@ -0,0 +1,1533 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +/* ⼰enum */ +enum { + NPC_PETSHOP_MSG_OVER, + NPC_PETSHOP_MSG_MAIN, + NPC_PETSHOP_MSG_REALY, + NPC_PETSHOP_MSG_THANKS, + NPC_PETSHOP_MSG_COST, + NPC_PETSHOP_MSG_POOLTHANKS, + NPC_PETSHOP_MSG_POOLFULL, + NPC_PETSHOP_MSG_GETFULL, +}; +typedef struct { + char option[32]; + char defaultmsg[128]; +}NPC_PETSHOP_MSG; + +NPC_PETSHOP_MSG shopmsg[] = { + { "over_msg", "Ǯ!û?"}, + { "main_msg", "ӭ"}, + { "realy_msg", "Ŀ?"}, + { "thanks_msg", "лл!"}, + { "cost_msg", "Ǯ!"}, + { "pooltanks_msg", "лл!"}, + { "poolfull_msg", "޷"}, + { "getfull_msg", "㲻кܶ"} + +}; + +#define PETCOST 10 + +void NPC_PetDate(int meindex,int toindex,int select,char *token); +void NPC_PetDate2(int meindex,int talker,int select,char *token); +void NPC_PetDate3(int meindex,int talker,int select,char *token); +void NPC_PetDel2( int meindex, int talker, int select, char *token); +void NPC_PetDel3( int meindex, int talker, int select, char *token); +void NPC_getDrawPet( int meindex, int toindex, char *token, int *buttontype, int select); + +void NPC_PetShop_selectWindow( int meindex, int toindex, int num,int select); +int NPC_GetCost(int meindex,int talker,int petindex); +void NPC_PetDel(int meindex, int toindex,int select,char* token); +void NPC_MaxGoldOver(int meindex,int toindex,int select,char *token); + +#ifdef _NPC_DEPOTPET +void NPC_PoolPetShop_DepotPet_Menu( int meindex, int talkerindex); +void NPC_DepotPet_List( int meindex, int toindex, char *token, int *buttontype, int select); +void NPC_DepotPet_Add( int meindex, int talker, int select, char *token); +void NPC_DepotPet_Get( int meindex, int talker, int select, char *token); +void NPC_DepotPet_AskGet(int meindex,int talker,int select,char *token); +//void NPC_DepotPet_Pet_printWindow( int meindex, int talkerindex); +//void NPC_DepotPet_Depot_printWindow( int meindex, int talkerindex); +//BOOL NPC_DepotPet_InsertPet( int meindex, int talkerindex, int num); +//BOOL NPC_DepotPet_getPet( int meindex, int talkerindex, int num); +#endif +void NPC_DepotPet_CheckRepeat_del( int charaindex, int petindex); + +// ľźңֿ +#define NPC_GETPOOLCOST( talker) ( 50 + CHAR_getInt( talker, CHAR_LV)*4) + +// ľŷɻ +#define NPC_PETSHOP_POOLCOST_DEFAULT 200 + +/*-- --*/ +enum { + CHAR_WORK_NOMALRATE = CHAR_NPCWORKINT1, + CHAR_WORK_SPECIALRATE = CHAR_NPCWORKINT2, + CHAR_WORK_POOLCOST = CHAR_NPCWORKINT3, + CHAR_WORK_POOLFLG = CHAR_NPCWORKINT4, +}; + + +/********************************* +* +*********************************/ +int pckmeindex = 0; +BOOL NPC_PetShopInit( int meindex ) +{ + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buf[256]; + double rate; + int intrate; +// int cost; + int tmp; + + /*--ɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESTONESHOP ); + + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof( npcarg)) == NULL){ + print("GetArgStrErr"); + return FALSE; + } + + /*--ë炙巤ʢ*/ + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "nomal_rate", buf, sizeof( buf)) != NULL){ + rate = atof( buf); + intrate = ( int)( rate *1000); + CHAR_setWorkInt( meindex , CHAR_WORK_NOMALRATE ,intrate ); + }else{ + CHAR_setWorkInt( meindex , CHAR_WORK_NOMALRATE ,1000 ); + } + + + /*--ʸһַʢ--*/ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "special_rate", buf, sizeof( buf))!=NULL) + { + rate = atof( buf); + intrate = ( int)( rate *1000); + CHAR_setWorkInt( meindex , CHAR_WORK_SPECIALRATE ,intrate ); + }else{ + CHAR_setWorkInt( meindex , CHAR_WORK_SPECIALRATE ,1200 ); + } + + // ľŷʢ + //cost = NPC_Util_GetNumFromStrWithDelim( npcarg, "pool_cost"); + //if( cost == -1 ) cost = NPC_PETSHOP_POOLCOST_DEFAULT; + //CHAR_setWorkInt( meindex, CHAR_WORK_POOLCOST, cost); + + + // ľ ¾ëʢ + tmp = NPC_Util_GetNumFromStrWithDelim( npcarg, "pool_flg"); + if( tmp != 1 ) tmp = 0; + CHAR_setWorkInt( meindex, CHAR_WORK_POOLFLG, tmp); + pckmeindex = meindex; + return TRUE; + +} + + + + +/********************************* +* ƾľݼ +*********************************/ +void NPC_PetShopTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /*-- ¾--*/ + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + /* */ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + /*--ͼ--*/ + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,0); + /*-Ԫ --*/ + NPC_PetShop_selectWindow( meindex, talkerindex,0,-1); +} + +/********************************* +* έľݼ +*********************************/ +void NPC_PetShopLooked( int meindex , int lookedindex) +{ + /* 帲ƻ ɱ */ + if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + /* */ + //if( NPC_Util_CharDistance( lookedindex, meindex ) > 2) return; + + /*--ͼ--*/ +// CHAR_setWorkInt(lookedindex,CHAR_WORKSHOPRELEVANT,0); + + +// NPC_PetShop_selectWindow( meindex, lookedindex,0,-1); + +} +void NPC_PetShop_selectWindow1( int meindex, int toindex, int num,int select) +{ + NPC_PetShop_selectWindow( meindex, toindex, num,select); + +} + +void NPC_PetShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char token[1024]; + int buttontype=0,windowtype=0,windowno=0; + char buf[256]; + int fd = getfdFromCharaIndex( toindex); + + //print("\n NPC_PetShop_selectWindow num:%d select:%d ", num, select); + if( fd == -1 ) { + fprint( "getfd err\n"); + return; + } + token[0] = '\0'; + switch(num){ + // ټū + case 0: + NPC_MaxGoldOver( meindex, toindex, NPC_PETSHOP_MSG_MAIN, buf); + +#ifdef _NPC_DEPOTPET + if( !CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG)) { + sprintf(token, "4\n̵" + "%s" + "\n" + "\n " + "\n" + "\n" + "\n 뿪 ", + buf); + }else { + sprintf(token, "4\n̵" + "%s" + "\n ķų " + "\n ȡ " + "\n " + "\n ֿ " + "\n 뿪 ", + buf); + } +#else + if( !CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG)) { + sprintf(token, "4\n̵" + "%s" + "\n" + "\n " + "\n" + "\n 뿪 ", + buf); + }else { + sprintf(token, "4\n̵" + "%s" + "\n ķų " + "\n ȡ " + "\n " + "\n 뿪 ", + buf); + } +#endif + buttontype=WINDOW_BUTTONTYPE_NONE; + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_START; + break; + case 1: + buttontype=WINDOW_BUTTONTYPE_CANCEL; + windowtype=WINDOW_MESSAGETYPE_PETSELECT; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT; + break; + case 2: + NPC_PetDate(meindex,toindex,select,token); + buttontype=WINDOW_BUTTONTYPE_YESNO; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN; + break; + case 3: + if( (CHAR_getInt(toindex,CHAR_GOLD)+CHAR_getWorkInt(toindex,CHAR_WORKSHOPRELEVANTSEC)) + > CHAR_getMaxHaveGold( toindex) ){ + + NPC_MaxGoldOver( meindex, toindex, NPC_PETSHOP_MSG_OVER, token); + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_GOLDOVER; + buttontype=WINDOW_BUTTONTYPE_YESNO; + }else{ + NPC_PetDel(meindex,toindex,select,token); + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + } + + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + break; + case 4: + NPC_PetDel(meindex,toindex,select,token); + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + break; + case 5: // ȡķųб + if( CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG ) != 1 ) + return; + buttontype=WINDOW_BUTTONTYPE_CANCEL; + windowtype=WINDOW_MESSAGETYPE_PETSELECT; + windowno=CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT2; + break; + case 6: + if( CHAR_getInt( toindex, CHAR_GOLD) + < NPC_GETPOOLCOST( toindex)) + { + NPC_MaxGoldOver(meindex, toindex, NPC_PETSHOP_MSG_COST, token); + buttontype = WINDOW_BUTTONTYPE_OK; + } + else { + NPC_PetDate2( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_YESNO; + } + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN2; + break; + + case 7: + if( CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG ) != 1 ) + return; + if( CHAR_getInt( toindex, CHAR_GOLD) < NPC_GETPOOLCOST( toindex)){ + NPC_MaxGoldOver(meindex, toindex, NPC_PETSHOP_MSG_COST, token); + }else { + NPC_PetDel2( meindex, toindex, select, token); + } + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + break; + // ľ + case 8: + NPC_MaxGoldOver( meindex, toindex, NPC_PETSHOP_MSG_POOLFULL, token); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + break; + // ¦Իʸ ū + case 9: // ȡķųб + if( CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG) != 1 ) + return; + NPC_getDrawPet( meindex, toindex, token, &buttontype, select); + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_DRAWSELECT; + break; + // ¦Ի + case 10: + NPC_PetDate3( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_ASKDRAW; + break; + // ߯ + case 11: + if( CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG ) != 1 ) + return; + NPC_PetDel3( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + break; + // ʸ + case 12: + NPC_MaxGoldOver( meindex, toindex, NPC_PETSHOP_MSG_GETFULL, token); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + break; +#ifdef _NPC_DEPOTPET + case 13: // ֿб + if( !CHAR_CheckDepotPet( toindex) ) + return; + buttontype=WINDOW_BUTTONTYPE_CANCEL; + windowtype=WINDOW_MESSAGETYPE_PETSELECT; + windowno=CHAR_WINDOWTYPE_DEPOTPETSHOP_ADD; + break; + case 14: // ȡֿб + if( !CHAR_CheckDepotPet( toindex) ) + return; + NPC_DepotPet_List( meindex, toindex, token, &buttontype, select); + //buttontype=WINDOW_BUTTONTYPE_CANCEL; + windowtype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_DEPOTPETSHOP_GET; + break; + + case 15: // ѯȷϴֿ + if( CHAR_getInt( toindex, CHAR_GOLD) + < NPC_GETPOOLCOST( toindex)) + { + NPC_MaxGoldOver(meindex, toindex, NPC_PETSHOP_MSG_COST, token); + buttontype = WINDOW_BUTTONTYPE_OK; + } + else { + NPC_PetDate2( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_YESNO; + } + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKADD; + break; + + case 16: // ѯȷȡֿ + NPC_DepotPet_AskGet( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKGET; + break; + + case 17: // ȷϴֿ + if( !CHAR_CheckDepotPet(toindex) ) + return; + if( CHAR_getInt( toindex, CHAR_GOLD) < NPC_GETPOOLCOST( toindex)){ + NPC_MaxGoldOver(meindex, toindex, NPC_PETSHOP_MSG_COST, token); + }else { + NPC_DepotPet_Add( meindex, toindex, select, token); + } + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + break; + + case 18: // ȷȡֿ + if( CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG ) != 1 ) + return; + if( NPC_DepotPet_CheckLevel( meindex, toindex, select, token) == TRUE) { + NPC_DepotPet_Get( meindex, toindex, select, token); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + } + else { + sprintf( token, "\n޷չֻ"); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_WINDOWPETSHOP_END; + } + break; +#endif + // CoolFish: Add 2001/7/4 + default: + break; + + } + + /*--޵--*/ + //makeEscapeString( token, escapedname, sizeof(escapedname)); + + /*--˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +void NPC_PetShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int datanum = -1; + //print("\n NPC_PetShopWindowTalked: data:%s seq:%d sel:%d ", data, seqno, select); + + makeStringFromEscaped( data); + + datanum = atoi( data); + switch( seqno){ + case CHAR_WINDOWTYPE_WINDOWPETSHOP_START: + { + int poolflg = CHAR_getWorkInt( meindex, CHAR_WORK_POOLFLG); + if( ( datanum == 3 && poolflg) || // + ( datanum == 2 && !poolflg ) ){ // ȡ + NPC_PetShop_selectWindow( meindex, talkerindex, 1, -1 ); + }else if( datanum == 1 && poolflg) { // ķų + if( CHAR_getCharPoolPetElement( talkerindex) != -1 ) { + NPC_PetShop_selectWindow( meindex, talkerindex, 5, -1 ); + } + else { + NPC_PetShop_selectWindow( meindex, talkerindex, 8, -1 ); + } + }else if( datanum == 2 && poolflg ) { // ȡ + if( CHAR_getCharPetElement( talkerindex) != -1 ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_PetShop_selectWindow( meindex, talkerindex, 9, 0); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); + } + } +#ifdef _NPC_DEPOTPET + else if( datanum == 4 ) { // ʹóֿ + print(" ʹóֿ "); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + if( !CHAR_CheckDepotPet( talkerindex) ){ + CHAR_GetDepotPet( meindex, talkerindex); + CHAR_talkToCli( talkerindex, -1, "ȡóᣡ", CHAR_COLORYELLOW); + }else{ + NPC_PoolPetShop_DepotPet_Menu( meindex, talkerindex); + } + } +#endif + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT: + if(select==WINDOW_BUTTONTYPE_CANCEL){ + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + + }else{ + NPC_PetShop_selectWindow( meindex, talkerindex, 2, datanum ); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_PETSELECT2: + if(select==WINDOW_BUTTONTYPE_CANCEL){ + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + }else{ + NPC_PetShop_selectWindow( meindex, talkerindex, 6, datanum ); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN: + if(select==WINDOW_BUTTONTYPE_YES){ + if(CHAR_getWorkInt( talkerindex, CHAR_WORKSAFEMODE)==0){ + CHAR_SafePassword(talkerindex); + return; + } + NPC_PetShop_selectWindow( meindex, talkerindex, 3,-1 ); + }else{ + NPC_PetShop_selectWindow( meindex, talkerindex,1,-1); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_MAIN2: + if(select==WINDOW_BUTTONTYPE_YES){ + NPC_PetShop_selectWindow( meindex, talkerindex, 7,-1 ); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex,5,-1); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_ASKDRAW: + if( select == WINDOW_BUTTONTYPE_YES){ + if( CHAR_getCharPetElement( talkerindex) != -1 ) { + NPC_PetShop_selectWindow( meindex, talkerindex, 11,-1 ); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); + } + }else { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_PetShop_selectWindow( meindex, talkerindex, 9, 0); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_GOLDOVER: + if( select == WINDOW_BUTTONTYPE_YES){ + NPC_PetShop_selectWindow( meindex, talkerindex, 4,-1 ); + }else{ + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + } + break; + case CHAR_WINDOWTYPE_WINDOWPETSHOP_DRAWSELECT: + if( select == WINDOW_BUTTONTYPE_PREV){ + NPC_PetShop_selectWindow( meindex, talkerindex, 9, -1); + }else if( select == WINDOW_BUTTONTYPE_NEXT) { + NPC_PetShop_selectWindow( meindex, talkerindex, 9, 1); + }else if( select != WINDOW_BUTTONTYPE_CANCEL) { + if( CHAR_getCharPetElement( talkerindex) != -1 ) { + NPC_PetShop_selectWindow( meindex, talkerindex, 10, datanum); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); + } + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + } + break; + +#ifdef _NPC_DEPOTPET + case CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE: + if( !CHAR_CheckDepotPet( talkerindex) ) return ; + switch( datanum ) { + case 1:// +#ifdef _BIG_POOL_TYPE + if(getPetPoolType()==1){ + CHAR_talkToCli( talkerindex, -1, "ֿѹرգʹø˲ֿ⡣", CHAR_COLORYELLOW); + return; + } +#endif + if( CHAR_findEmptyDepotPet( talkerindex) == -1 ){ + CHAR_talkToCli( talkerindex, -1, "ֿ", CHAR_COLORYELLOW); + return; + } + //NPC_DepotPet_Pet_printWindow( meindex, talkerindex); + NPC_PetShop_selectWindow( meindex, talkerindex, 13, -1 ); + break; + case 2://ȡ + if( CHAR_getCharPetElement( talkerindex) < 0 ) { + CHAR_talkToCli( talkerindex, -1, "ϳλ", CHAR_COLORYELLOW); + return; + } + NPC_PetShop_selectWindow( meindex, talkerindex, 14, 0); + break; + case 0: + NPC_PetShop_selectWindow( meindex, talkerindex, 0, -1); + break; + } + break; + + case CHAR_WINDOWTYPE_DEPOTPETSHOP_ADD: + if(select==WINDOW_BUTTONTYPE_CANCEL){ + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + }else{ + NPC_PetShop_selectWindow( meindex, talkerindex, 15, datanum ); + } + break; + + case CHAR_WINDOWTYPE_DEPOTPETSHOP_GET: + if( select == WINDOW_BUTTONTYPE_PREV){ + NPC_PetShop_selectWindow( meindex, talkerindex, 14, -1); + }else if( select == WINDOW_BUTTONTYPE_NEXT) { + NPC_PetShop_selectWindow( meindex, talkerindex, 14, 1); + }else if( select != WINDOW_BUTTONTYPE_CANCEL) { + if( CHAR_getCharPetElement( talkerindex) != -1 ) { + NPC_PetShop_selectWindow( meindex, talkerindex, 16, datanum); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); + } + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + } + + break; + case CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKADD: // ȷϴֿ + if(select==WINDOW_BUTTONTYPE_YES){ + NPC_PetShop_selectWindow( meindex, talkerindex, 17,-1 ); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex,13,-1); + } + break; + + case CHAR_WINDOWTYPE_DEPOTPETSHOP_ASKGET: // ȷȡֿ + if( select == WINDOW_BUTTONTYPE_YES){ + if( CHAR_getCharPetElement( talkerindex) != -1 ) { + NPC_PetShop_selectWindow( meindex, talkerindex, 18,-1 ); + }else { + NPC_PetShop_selectWindow( meindex, talkerindex, 12, -1 ); + } + }else { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_PetShop_selectWindow( meindex, talkerindex, 14, 0); + } + break; +#endif + + case CHAR_WINDOWTYPE_WINDOWPETSHOP_END: + if( select == WINDOW_BUTTONTYPE_OK){ + NPC_PetShop_selectWindow( meindex, talkerindex, 0,-1 ); + } + break; + + // CoolFish: Add 2001/7/4 + default: + break; + + } +} + +void NPC_PetDate(int meindex,int talker,int select,char *token) +{ + + int petindex; + int cost; + char *petname; + char buf[1024]; + + /*--ͼ--*/ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,select); + + petindex = CHAR_getCharPet( talker, select-1); + + + if( !CHAR_CHECKINDEX(petindex) ) return; + + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_REALY, buf); + + cost=NPC_GetCost(meindex,talker,petindex); + + petname = CHAR_getUseName( petindex); + + sprintf(token,"\n[%s]ûɣ""%s" + "\n\n ۸ %d STONE\n" + ,petname,buf,cost); + +} + +void NPC_PetDate2(int meindex,int talker,int select,char *token) +{ + + int petindex; + char *petname; + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,select); + + petindex = CHAR_getCharPet( talker, select-1); + if( !CHAR_CHECKINDEX(petindex) ) return; + petname = CHAR_getUseName( petindex); + sprintf(token,"\nķ[%s]" + "\n\n ķż۸ %d stone\n" + ,petname, NPC_GETPOOLCOST( talker) + ); +} + +void NPC_PetDate3(int meindex,int talker,int select,char *token) +{ + int poolindex; + int petindex; + char *petname; + poolindex = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) * 5 + select - 1; + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,poolindex ); + petindex = CHAR_getCharPoolPet( talker, poolindex); + if( !CHAR_CHECKINDEX(petindex) ) return; + petname = CHAR_getUseName( petindex); + sprintf(token,"\n[%s]", petname); +} + +int NPC_GetCost(int meindex,int talker,int petindex) +{ + int cost; + int levelcost; + int level; + int getlevel; + int graNo; + int rare; + int charm=50; + int petai; + int i=1; + double rate=1.0; + int intrate; + char buf[1024]; + char buff2[128]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + + getlevel=CHAR_getInt(petindex,CHAR_PETGETLV); + level=CHAR_getInt(petindex,CHAR_LV); + graNo=CHAR_getInt(petindex,CHAR_BASEBASEIMAGENUMBER); + rare=CHAR_getInt(petindex,CHAR_RARE); + + if(getlevel==0) getlevel=1 ; + + /*--ëƻ--*/ + levelcost=(level*level)*10; + getlevel=(getlevel*getlevel)*10; +// Syu ADD ޸תǮ为bug +#ifdef _PET_2TRANS + if( CHAR_getInt(petindex , CHAR_TRANSMIGRATION)>0) +#else + if( CHAR_getInt(petindex , CHAR_TRANSMIGRATION)==1) +#endif + getlevel=10; + + + if(rare==0){ rare=1; + }else if(rare==1){ rare=5; + }else if(rare==2){ rare=8;} + + cost = ((levelcost-getlevel)+(level*PETCOST))*rare; + intrate = CHAR_getWorkInt( meindex , CHAR_WORK_NOMALRATE); + rate=(double) intrate / 1000; + + + NPC_Util_GetStrFromStrWithDelim( npcarg, "special_pet", buf, sizeof( buf)); + + i=1; + /*--ʸһƥңľʸëԻ ʸ϶÷ į)--*/ + while( getStringFromIndexWithDelim(buf,",",i,buff2,sizeof(buff2)) !=FALSE ) + { + if(strstr( buff2, "-")==NULL){ + if(graNo == atoi(buff2)){ + intrate=CHAR_getWorkInt( meindex , CHAR_WORK_SPECIALRATE); + rate=(double) intrate / 1000; + break; + } + }else{ + /*--ʧ ة 15-25 ƥľ--*/ + int start; + int end; + int tmp; + int graflg=0; + char token2[128]; + + /*-"-"ƥľ炙Ѱ Ѱë --*/ + getStringFromIndexWithDelim( buff2, "-", 1, token2, sizeof(token2)); + start = atoi( token2); + getStringFromIndexWithDelim( buff2, "-", 2 ,token2, sizeof(token2)); + end = atoi( token2); + + /*-- įѱئȻգ ľ׸**/ + if(start > end){ + tmp=start; + start=end; + end=tmp; + } + + end++; + /*--"-"ƥľмʧ ة ë --*/ + if(start <= graNo && graNo < end){ + intrate=CHAR_getWorkInt( meindex , CHAR_WORK_SPECIALRATE); + rate=(double) intrate / 1000; + graflg=1; + break; + } + + if(graflg ==1) break; + } + i++; + } + + /*--ʸպë ---*/ + petai=CHAR_getWorkInt(petindex,CHAR_WORKFIXAI); + + /*-- ë--*/ + charm = CHAR_getWorkInt(talker,CHAR_WORKFIXCHARM); + + /*-- պ / */ + charm = charm + petai; + + if(charm < 20){ + charm = 20; + } + + charm = charm / 2; + + cost = (int)cost*rate; + + rate=(double)charm/100; + + /*-- --*/ + cost = cost * rate; + +// if(levelcost == getlevel){ +// cost = cost / 4; +// } + + /*--ëʢ--*/ + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,cost); + + return cost; +} + + +#if 1 + +void NPC_PetDel(int meindex, int talker,int select,char* token) +{ + int petindex; + int petsel; + char szPet[128]; + int cost; + int defpet; + int fd = getfdFromCharaIndex( talker ); + + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_THANKS, token); + petsel=(CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANT)-1); + petindex = CHAR_getCharPet( talker, petsel); + + if( !CHAR_CHECKINDEX(petindex) ) return; + + // CoolFish: Family 2001/6/14 + if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){ +/* char buf[1024]; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString("\n\nܱǸػ޷ร\nԼúչˣ", buf, sizeof(buf))); +*/ + sprintf(token,"\n\nܱǸػ޷ร\nԼúչˣ"); + return; + } + + // Robin 0725 + if (CHAR_getInt( talker, CHAR_RIDEPET ) == petsel ){ +/* char buf[1024]; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString("\n\nеij޷ร", buf, sizeof(buf))); +*/ + sprintf(token,"\n\nеij޷ร"); + return; + } + if(strlen(CHAR_getChar(petindex,CHAR_USERPETNAME))>0 && strstr(CHAR_getChar(petindex,CHAR_USERPETNAME),"*")!=NULL){ + sprintf(token,"\n\nԶк(*)޷ꡢס̯޸ĺ"); + //CHAR_talkToCli(charaindex, -1, "Զк(*)޷ꡢס̯޸ĺ", CHAR_COLORYELLOW); + return; + } + if( CHAR_getWorkInt( talker, CHAR_WORKSAFEMODE)==0) + { + CHAR_SafePassword(talker); + return; + } + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + defpet=CHAR_getInt(talker,CHAR_DEFAULTPET); + if(defpet==petsel){ + CHAR_setInt(talker,CHAR_DEFAULTPET,-1); + lssproto_KS_send( fd, -1, TRUE); + } + +#ifdef _PET_ITEM + CHAR_sendPetItemEmpty(talker,petsel); +#endif + + CHAR_setCharPet( talker, petsel, -1); + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "sell()", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + char tmpmsg[256]; + sprintf(tmpmsg,"ѳɹ%sLv %d",CHAR_getChar( petindex, CHAR_NAME),CHAR_getInt( petindex, CHAR_LV)); + CHAR_talkToCli(talker, -1, tmpmsg, CHAR_COLORYELLOW); + CHAR_endCharOneArray( petindex ); + + snprintf( szPet, sizeof( szPet ), "K%d", petsel); + CHAR_sendStatusString( talker, szPet ); + cost=NPC_GetCost(meindex,talker,petindex); + CHAR_AddGold( talker, cost); + +} +#endif +void NPC_PetDel2( int meindex, int talker, int select, char *token) +{ + int petindex; + int selectpet; + int emptyindex; + char szPet[128]; + int fd = getfdFromCharaIndex( talker ); + + if( fd == -1 ) { + fprint( "err\n"); + return; + } + // ʸ ʣʸ ľ + selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) -1; + petindex = CHAR_getCharPet( talker, selectpet); + + if( !CHAR_CHECKINDEX( petindex) ) return; + // Robin 0725 + if (CHAR_getInt( talker, CHAR_RIDEPET ) == selectpet ) + { +/* char buf[1024]; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + -1, -1, + makeEscapeString("\n\nеij޷ķร", buf, sizeof(buf))); +*/ + sprintf(token,"\n\nеij޷ķร"); + return; + } + + // ëʣƻƻ¼ƥݳƥлئмƾ + emptyindex = CHAR_getCharPoolPetElement( talker); + if( emptyindex == -1 ) { + fprint( "err\n"); + return; + } + + // ʸئգݹľ ëʣ + if( CHAR_getInt( talker, CHAR_DEFAULTPET) == selectpet) { + CHAR_setInt( talker, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + // ľ ʸ̼͵ë + CHAR_setCharPoolPet( talker, emptyindex, petindex); + // ʸ +#ifdef _PET_ITEM + CHAR_sendPetItemEmpty(talker,selectpet); +#endif + CHAR_setCharPet( talker, selectpet, -1); + + // + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); + // Ӽ + + CHAR_DelGold( talker, NPC_GETPOOLCOST( talker) ); + + // ŷ˪ + CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD); + + snprintf( szPet, sizeof( szPet ), "K%d", selectpet); + // ޥʸ ˪Ի + CHAR_sendStatusString( talker, szPet ); + // ʸë ׷ + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "pool(ķų)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + //fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} + +void NPC_PetDel3( int meindex, int talker, int select, char *token) +{ + int petindex; + int selectpet; + int emptyindex; + char szPet[128]; + int workindex[CHAR_MAXPOOLPETHAVE]; + int i; + int cnt; + + selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ; + petindex = CHAR_getCharPoolPet( talker, selectpet); + + if( !CHAR_CHECKINDEX( petindex) ) return; + emptyindex = CHAR_getCharPetElement( talker); + if( emptyindex == -1 ) { + fprint( "err\n"); + return; + } + + // ػ޸Ϊͨ + if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 + && CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 3 ) { + CHAR_setInt( petindex, CHAR_PETFAMILY, 0); + CHAR_talkToCli( talker, -1, "ػ޸Ϊͨ", CHAR_COLORYELLOW); + } + + CHAR_setCharPet( talker, emptyindex, petindex); + CHAR_setCharPoolPet( talker, selectpet, -1); + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); +#ifdef _PET_ITEM + CHAR_sendPetItemData( talker, emptyindex); +#endif + snprintf( szPet, sizeof( szPet ), "K%d", emptyindex); + CHAR_sendStatusString( talker, szPet ); + snprintf( szPet, sizeof( szPet), "W%d",emptyindex); + CHAR_sendStatusString( talker, szPet ); + for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { + workindex[i] = -1; + } + cnt = 0; + for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { + int petindex = CHAR_getCharPoolPet( talker, i); + if( CHAR_CHECKINDEX( petindex) ) { + workindex[cnt++] = petindex; + } + } + for( i = 0; i < CHAR_MAXPOOLPETHAVE; i ++ ) { + CHAR_setCharPoolPet( talker, i, workindex[i]); + } +// LogPet( +// CHAR_getChar( talker, CHAR_NAME ), +// CHAR_getChar( talker, CHAR_CDKEY ), +// CHAR_getChar( petindex, CHAR_NAME), +// CHAR_getInt( petindex, CHAR_LV), +// "draw(ȡ)", +// CHAR_getInt( talker,CHAR_FLOOR), +// CHAR_getInt( talker,CHAR_X ), +// CHAR_getInt( talker,CHAR_Y ), +// CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 +// ); +#ifdef _PET_EVOLUTION + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) == 1 && + CHAR_getInt( petindex, CHAR_FUSIONRAISE) > 0 ){//ǷΪںϳ + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time( NULL)); + } +#endif + //int fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} + +void NPC_getDrawPet( int meindex, int toindex, char *token, int *buttontype, int select) +{ + // ʸؤԻ + #define LINENUM 5 + char buf[1024]; + int i; + int startnum, endnum; + int petindex = -1; + // ػʸ + int page = CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT); + int limit; + //andy_reEdit 2003/09/18 + limit = (CHAR_getInt(toindex,CHAR_TRANSMIGRATION)*2)+5; + + endnum = (page + select+1)*LINENUM ; + startnum = endnum - LINENUM; + *buttontype = WINDOW_BUTTONTYPE_CANCEL; + // ʸƩ + if( endnum >= limit ) { + endnum = limit; + if( page +select!= 0 ) *buttontype |= WINDOW_BUTTONTYPE_PREV; + } + else if( endnum <= LINENUM ) { + endnum = LINENUM; + *buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + else { + *buttontype |= WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, page +select); + + strcpy( token, "2\nѡ\n\n"); + for( i = startnum; i < endnum; i ++ ) { + petindex = CHAR_getCharPoolPet( toindex, i); + if( CHAR_CHECKINDEX( petindex) ) { + snprintf( buf, sizeof( buf), "LV.%3d MaxHP %3d %s\n", + CHAR_getInt( petindex, CHAR_LV), + CHAR_getWorkInt( petindex, CHAR_WORKMAXHP), + CHAR_getUseName( petindex) + ); + } + else { + strcpy( buf, "\n"); + } + strcat( token, buf); + } + // ݼëƩͻ ݳʾë + if( i != limit ) { + petindex = CHAR_getCharPoolPet( toindex, i); + if( !CHAR_CHECKINDEX( petindex)) { + *buttontype &= ~WINDOW_BUTTONTYPE_NEXT; + } + } +} + +/* + *ŻְǷǷ + */ +void NPC_MaxGoldOver(int meindex,int toindex,int select,char *token) +{ + + char buf[1024]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)); + + if( select < 0 || select >= arraysizeof( shopmsg)) return; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, shopmsg[select].option, buf, sizeof( buf)) == NULL ) + { + strcpy( buf, shopmsg[select].defaultmsg); + } + + snprintf(token,sizeof(buf),"\n\n%s",buf); + +} + +#ifdef _NPC_DEPOTPET +void NPC_PoolPetShop_DepotPet_Menu( int meindex, int talkerindex) +{ + int fd; + + //print(" NPC_PoolPetShop_DepotPet_Menu "); + + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + char message[1024]; + char buf[2048]; + + strcpy( message, + "3\n\n" + " رע⣺𽫹س빫ֿ\n﹫ֿ⡻\n" + " ų \n" + " ȡس \n" + ); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_DEPOTPETSHOP_HANDLE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } +} + +void NPC_DepotPet_List( int meindex, int toindex, char *token, int *buttontype, int select) +{ + // ʸؤԻ + #define LINENUM 5 + char buf[1024]; + int i; + int startnum, endnum; + int petindex = -1; + // ػʸ + int page = CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT); + int limit; + + limit = CHAR_MAXDEPOTPETHAVE; + + endnum = (page + select+1)*LINENUM ; + startnum = endnum - LINENUM; + *buttontype = WINDOW_BUTTONTYPE_CANCEL; + // ʸƩ + if( endnum >= limit ) { + endnum = limit; + if( page +select!= 0 ) *buttontype |= WINDOW_BUTTONTYPE_PREV; + } + else if( endnum <= LINENUM ) { + endnum = LINENUM; + *buttontype |= WINDOW_BUTTONTYPE_NEXT; + } + else { + *buttontype |= WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_NEXT; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, page +select); + + strcpy( token, "2\nѡҪӲֿȡij\n\n"); + for( i = startnum; i < endnum; i ++ ) { + petindex = CHAR_getDepotPetIndex( toindex, i); + if( CHAR_CHECKINDEX( petindex) ) { + snprintf( buf, sizeof( buf), "LV.%3d MaxHP %3d %s\n", + CHAR_getInt( petindex, CHAR_LV), + CHAR_getWorkInt( petindex, CHAR_WORKMAXHP), + CHAR_getUseName( petindex) + ); + } + else { + strcpy( buf, "\n"); + } + strcat( token, buf); + } + // ݼëƩͻ ݳʾë + if( i != limit ) { + petindex = CHAR_getDepotPetIndex( toindex, i); + if( !CHAR_CHECKINDEX( petindex)) { + *buttontype &= ~WINDOW_BUTTONTYPE_NEXT; + } + } + //print("\n DepotPet_List:%s ", token); +} + + +void NPC_DepotPet_Add( int meindex, int talker, int select, char *token) +{ + + int petindex; + int selectpet; + int emptyindex; + char szPet[128]; + int fd = getfdFromCharaIndex( talker ); + + if( fd == -1 ) { + fprint( "err\n"); + return; + } + // ʸ ʣʸ ľ + selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) -1; + //print("\n selectpet:%d ", selectpet); + petindex = CHAR_getCharPet( talker, selectpet); + if( !CHAR_CHECKINDEX( petindex) ) return; + + // Robin 0725 + if (CHAR_getInt( talker, CHAR_RIDEPET ) == selectpet ) + { + sprintf(token,"\n\nеij޷ֿร"); + return; + } + + if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 ) + { + sprintf(token,"\n\nػ޷ֿร"); + return; + } + // ëʣƻƻ¼ƥݳƥлئмƾ + emptyindex = CHAR_getCharDepotPetElement( talker); + if( emptyindex == -1 ) { + fprint( "err\n"); + return; + } + + // ʸئգݹľ ëʣ + if( CHAR_getInt( talker, CHAR_DEFAULTPET) == selectpet) { + CHAR_setInt( talker, CHAR_DEFAULTPET, -1); + lssproto_KS_send( fd, -1, TRUE); + } + // ľ ʸ̼͵ë + CHAR_setDepotPetIndex( talker, emptyindex, petindex); + // ʸ + CHAR_setCharPet( talker, selectpet, -1); + + // + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); + // Ӽ + + CHAR_DelGold( talker, NPC_GETPOOLCOST( talker) ); + + // ŷ˪ + CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD); + + snprintf( szPet, sizeof( szPet ), "K%d", selectpet); + // ޥʸ ˪Ի + CHAR_sendStatusString( talker, szPet ); + // ʸë ׷ +#ifdef _CHECK_PEPEAT + if( getCheckRepeat()==1 || NPC_DepotPet_CheckRepeat( talker) == 0) // ظ +#else + if( NPC_DepotPet_CheckRepeat( talker) == 0) // ظ +#endif + { +// LogPet( +// CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ +// CHAR_getChar( talker, CHAR_CDKEY ), +// CHAR_getChar( petindex, CHAR_NAME), +// CHAR_getInt( petindex, CHAR_LV), +// "pool(ֿ)", +// CHAR_getInt( talker,CHAR_FLOOR), +// CHAR_getInt( talker,CHAR_X ), +// CHAR_getInt( talker,CHAR_Y ), +// CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 +// ); + } + else + { + CHAR_talkToCli( talker, -1, "ǷǷij!!", CHAR_COLORYELLOW); + } + //fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +} + + + +void NPC_DepotPet_Get( int meindex, int talker, int select, char *token) +{ + int petindex; + int selectpet; + int emptyindex; + char szPet[128]; + int workindex[CHAR_MAXDEPOTPETHAVE]; + int i; + int cnt; + + selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ; + petindex = CHAR_getDepotPetIndex( talker, selectpet); + if( !CHAR_CHECKINDEX( petindex) ) return; + emptyindex = CHAR_getCharPetElement( talker); + if( emptyindex == -1 ) { + fprint( "err\n"); + return; + } +/* + if(CHAR_getInt(petindex,CHAR_BEATITUDE)>0 && strstr(CHAR_getChar(petindex,CHAR_NAME),"+")==NULL){ + char btmpname[128]; + sprintf(btmpname,"%s+",CHAR_getChar(petindex,CHAR_NAME)); + CHAR_setChar(petindex,CHAR_NAME,btmpname); + } +*/ +#ifdef _JK_CF_DELPETITEM //ɾCFָ + int ID1,ID2,j; + char* delbuf; + char delpetbuf[10]; + delbuf = getDelPet(); + ID1=CHAR_getInt( petindex, CHAR_PETID); + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delpetbuf, sizeof(delpetbuf)) == FALSE) + break; + ID2 = atoi(delpetbuf); + if(ID2 == -1)break; + if( ID1 == ID2){ + CHAR_setDepotPetIndex( talker, selectpet, -1);//ܵĽɫ + LogPet( CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "petshop(CFõij)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + CHAR_talkToCli(talker,-1,"ϵͳֿij",CHAR_COLORWHITE); + goto petshopOut; + } + } +#endif + CHAR_setCharPet( talker, emptyindex, petindex); + CHAR_setChar( petindex, CHAR_OWNERCHARANAME, CHAR_getChar( talker, CHAR_NAME)); + CHAR_setDepotPetIndex( talker, selectpet, -1); + NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token); + snprintf( szPet, sizeof( szPet ), "K%d", emptyindex); + CHAR_sendStatusString( talker, szPet ); + snprintf( szPet, sizeof( szPet), "W%d",emptyindex); + CHAR_sendStatusString( talker, szPet ); + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + workindex[i] = -1; + } + cnt = 0; + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + int petindex = CHAR_getDepotPetIndex( talker, i); + if( CHAR_CHECKINDEX( petindex) ) { + workindex[cnt++] = petindex; + } + } + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + CHAR_setDepotPetIndex( talker, i, workindex[i]); + } + LogPet( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "draw(ȡֿ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + //int fd = getfdFromCharaIndex( talker); + CHAR_charSaveFromConnect(talker, FALSE); + CHAR_talkToCli(talker, -1, "ϵͳΪԶ浵", CHAR_COLORRED); +petshopOut: +#ifdef _PET_EVOLUTION + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT) == 1 && + CHAR_getInt( petindex, CHAR_FUSIONRAISE) > 0 ){//ǷΪںϳ + CHAR_setInt( petindex, CHAR_FUSIONTIMELIMIT, (int)time( NULL)); + } +#endif +} + +void NPC_DepotPet_AskGet(int meindex,int talker,int select,char *token) +{ + int depotindex; + int petindex; + char *petname; + depotindex = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) * 5 + select - 1; + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,depotindex ); + petindex = CHAR_getDepotPetIndex( talker, depotindex); + if( !CHAR_CHECKINDEX(petindex) ) return; + petname = CHAR_getUseName( petindex); + sprintf(token,"\n[%s]", petname); +} + +int NPC_DepotPet_CheckRepeat( int charaindex) +{ + int petindex1, petindex2; + int i, j, find, ret = FALSE; + int workindex[CHAR_MAXDEPOTPETHAVE], cnt =0; + + for( i =0; i <(CHAR_MAXDEPOTPETHAVE-1); i++) + { + petindex1 = CHAR_getDepotPetIndex( charaindex, i); + if( !CHAR_CHECKINDEX( petindex1)) continue; + find = 0; + for( j =(i+1); j 0) + { + CHAR_setDepotPetIndex( charaindex, i, -1); + NPC_DepotPet_CheckRepeat_del( charaindex, petindex1); + } + } + + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + workindex[i] = -1; + } + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + int pindex = CHAR_getDepotPetIndex( charaindex, i); + if( CHAR_CHECKINDEX( pindex) ) { + workindex[cnt++] = pindex; + } + } + for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) { + CHAR_setDepotPetIndex( charaindex, i, workindex[i]); + } + + return ret; +} + +void NPC_DepotPet_CheckRepeat_del( int charaindex, int petindex) +{ + LogPet( + CHAR_getChar( charaindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "del(ֿϴ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + CHAR_endCharOneArray( petindex ); +} + +// ȼǷ㹻 +int NPC_DepotPet_CheckLevel(int meindex,int talker,int select,char *token) +{ + int petindex; + int selectpet; + + if( !CHAR_CheckDepotPet( talker) ) + return FALSE; + + selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ; + petindex = CHAR_getDepotPetIndex( talker, selectpet); + if( !CHAR_CHECKINDEX(petindex) ) return FALSE; + + //print("\n trans:%d char_lv:%d pet_lv:%d ", + // CHAR_getInt( talker, CHAR_TRANSMIGRATION), + // CHAR_getInt( talker, CHAR_LV), + // CHAR_getInt( petindex, CHAR_LV) ); + + // ػ޸Ϊͨ + if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 + && CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 3 ) { + CHAR_setInt( petindex, CHAR_PETFAMILY, 0); + } + + if( CHAR_getWorkInt( talker, CHAR_PickAllPet) == TRUE ) { // װѱ޽ָĻ... + return TRUE; + } + + if( CHAR_getInt( talker, CHAR_TRANSMIGRATION) > 0 + || CHAR_getInt( talker, CHAR_LV)+5 >= CHAR_getInt( petindex, CHAR_LV) ) { + return TRUE; + } + + return FALSE; + +} + +#endif + diff --git a/npc/npc_petskilldelshop.c b/npc/npc_petskilldelshop.c new file mode 100644 index 0000000..3cdeb1b --- /dev/null +++ b/npc/npc_petskilldelshop.c @@ -0,0 +1,276 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "readmap.h" +#include "battle.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif + +#ifdef _PETSKILL_DEL_NPC +enum { + CHAR_WORK_STONESELECT = CHAR_NPCWORKINT1, +}; + +static void NPC_PetSkillDelShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL NPC_PetSkillDelMakeStr(int meindex,int toindex,int select); + +BOOL NPC_PetSkillDelShopInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESTONESHOP ); + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ + char buf[256], filename[256]; + int k=1, skillID, skillarray; + while( getStringFromIndexWithDelim( msg, ",", k, buf, sizeof( buf) ) ){ + k++; + skillID=atoi(buf); + skillarray = PETSKILL_getPetskillArray( skillID); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1){ + if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ){ + print("PetSkillShop illegal skill:[%d-%s] ->file:%s", + skillID, + PETSKILL_getChar( skillarray, PETSKILL_NAME), + filename ); + } + } + } + }else{ + return FALSE; + } + + return TRUE; +} + +void NPC_PetSkillDelShopTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + NPC_PetSkillDelShop_selectWindow( meindex, talkerindex,0,-1); +} + +void NPC_PetSkillDelShopLooked( int meindex , int lookedindex) +{ + if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_CharDistance( lookedindex, meindex ) > 2) return; +} + +static void NPC_PetSkillDelShop_selectWindow( int meindex, int toindex, int num,int select) +{ + switch(num){ + case 0: + NPC_PetSkillDelMakeStr(meindex,toindex,select); + break; + case 1: + break; + } +} + +void NPC_PetSkillDelShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int skill; + int pet; + int slot; + int cost; + int skillID=0; + int skillitem=-1; + int petskillindex; + char buf[64]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[512]; + int petindex; + char msgbuf[128]; + int fd = getfdFromCharaIndex( talkerindex ); + double rate= 1.0; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + makeStringFromEscaped( data); + getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); + skill=atoi(buf); + getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf)); + pet=atoi(buf); + getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf)); + slot=atoi(buf); + getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf)); + cost=atoi(buf); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + skillID=atoi(buf); + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_item", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + skillitem=atoi(buf); + } + + slot--; + if( !CHAR_CHECKPETSKILLINDEX( slot)){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + petindex = CHAR_getCharPet( talkerindex, pet-1); + if( !CHAR_CHECKINDEX(petindex) ){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + if(skillID < 0 || skillitem<0) return ; + + if(petindex == -1){ + print("petskillshop.c:170 PetindexError"); + return; + } + + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + + petskillindex = PETSKILL_getPetskillArray( skillID ); + if(petskillindex == -1){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "costvigor", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + cost=atoi(buf); + } + + if(CHAR_getInt(talkerindex,CHAR_VIGOR) < cost){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + CHAR_talkToCli( talkerindex, -1, "Ļ" , CHAR_COLORRED); + return; + } + if(CHAR_getPetSkill( petindex, slot)!=skillID) return; + int emptyitemindexinchara; + emptyitemindexinchara = CHAR_findEmptyItemBox( talkerindex ); + + if( emptyitemindexinchara < 0 ){ + + CHAR_talkToCli( talkerindex, -1, "Ʒλ㡣" , CHAR_COLORYELLOW); + + return; + } + int itemindex = ITEM_makeItemAndRegist( skillitem ); + if( itemindex != -1 ){ + CHAR_setItemIndex( talkerindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX,talkerindex); + CHAR_sendItemDataOne( talkerindex, emptyitemindexinchara); + }else return; + CHAR_setPetSkill( petindex, slot, -1); + + CHAR_setInt( talkerindex, CHAR_VIGOR, CHAR_getInt( talkerindex, CHAR_VIGOR ) - cost ); + sprintf(msgbuf,"۳%dõ<%s>",cost,ITEM_getNameFromNumber( skillitem)); + CHAR_talkToCli( talkerindex, -1, msgbuf, CHAR_COLORYELLOW); + + snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1); + CHAR_sendStatusString( talkerindex, msgbuf ); + CHAR_sendStatusString( talkerindex, "P"); + NPC_PetSkillDelShop_selectWindow( meindex, talkerindex,0,-1); +} + +BOOL NPC_PetSkillDelMakeStr(int meindex,int toindex,int select) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + char msg1[256]; + double rate=1.0; + int i=0; + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + int fd = getfdFromCharaIndex( toindex); + + if(select==0){ + sprintf(token,"0|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", msg, sizeof( msg)) == NULL){ + print("mainERR"); + return FALSE; + } + + sprintf(token,"1|%s|%s", + CHAR_getChar(meindex,CHAR_NAME),msg); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate=atof(msg); + } + + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg) ) != NULL){ + int skillarray; + int skillID; + int cost; + char token2[265]; + char buf[64]; + + i=1; + while( getStringFromIndexWithDelim(msg,",",i,buf,sizeof(buf)) !=FALSE ){ + i++; + skillID=atoi(buf); + skillarray = PETSKILL_getPetskillArray( skillID); + + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) + continue; + if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1) continue; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "costvigor", msg1, sizeof( msg1) ) != NULL){ + getStringFromIndexWithDelim(msg1,",",i-1,buf,sizeof(buf)); + cost = atoi(buf); + }else{ + cost = PETSKILL_getInt(skillarray,PETSKILL_COST); + cost = (int)cost*rate; + } +#ifdef _SA80 + sprintf(token2,"|%s|%d|%s|0", PETSKILL_getChar(skillarray, PETSKILL_NAME), + cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT)); +#else + sprintf(token2,"|%s|%d|%s", PETSKILL_getChar(skillarray, PETSKILL_NAME), + cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT)); +#endif + strcat(token,token2); + } + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return TRUE; +} +#endif diff --git a/npc/npc_petskillshop.c b/npc/npc_petskillshop.c new file mode 100644 index 0000000..51a5db7 --- /dev/null +++ b/npc/npc_petskillshop.c @@ -0,0 +1,249 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "readmap.h" +#include "battle.h" +#ifdef _ALLBLUES_LUA +#include "mylua/function.h" +#endif +enum { + CHAR_WORK_STONESELECT = CHAR_NPCWORKINT1, +}; + +static void NPC_PetSkillShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL NPC_PetSkillMakeStr(int meindex,int toindex,int select); + +BOOL NPC_PetSkillShopInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESTONESHOP ); + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ + char buf[256], filename[256]; + int k=1, skillID, skillarray; + while( getStringFromIndexWithDelim( msg, ",", k, buf, sizeof( buf) ) ){ + k++; + skillID=atoi(buf); + skillarray = PETSKILL_getPetskillArray( skillID); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue; + if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1){ + if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ){ + print("PetSkillShop illegal skill:[%d-%s] ->file:%s", + skillID, + PETSKILL_getChar( skillarray, PETSKILL_NAME), + filename ); + } + } + } + }else{ + return FALSE; + } + + return TRUE; +} + +void NPC_PetSkillShopTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + NPC_PetSkillShop_selectWindow( meindex, talkerindex,0,-1); +} + +void NPC_PetSkillShopLooked( int meindex , int lookedindex) +{ + if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_CharDistance( lookedindex, meindex ) > 2) return; +} + +static void NPC_PetSkillShop_selectWindow( int meindex, int toindex, int num,int select) +{ + switch(num){ + case 0: + NPC_PetSkillMakeStr(meindex,toindex,select); + break; + case 1: + break; + } +} + +void NPC_PetSkillShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int skill; + int pet; + int slot; + int cost; + int skillID=0; + int petskillindex; + char buf[64]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[512]; + int petindex; + char msgbuf[128]; + int fd = getfdFromCharaIndex( talkerindex ); + double rate= 1.0; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + makeStringFromEscaped( data); + getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); + skill=atoi(buf); + getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf)); + pet=atoi(buf); + getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf)); + slot=atoi(buf); + getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf)); + cost=atoi(buf); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + skillID=atoi(buf); + } + + slot--; + if( !CHAR_CHECKPETSKILLINDEX( slot)){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + petindex = CHAR_getCharPet( talkerindex, pet-1); + if( !CHAR_CHECKINDEX(petindex) ){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + if(skillID < 0) return ; + + if(petindex == -1){ + print("petskillshop.c:170 PetindexError"); + return; + } + + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), + CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate = atof( msg); + } + + petskillindex = PETSKILL_getPetskillArray( skillID ); + if(petskillindex == -1){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + + cost = PETSKILL_getInt( petskillindex, PETSKILL_COST ); + cost = cost * rate; + + if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } +#ifdef _PETSKILL_SHOP_LUA + if(FreePetSkillShop(talkerindex, petindex, CHAR_getPetSkill(petindex, slot), skillID) == FALSE ) { + return; + } +#endif + CHAR_setPetSkill( petindex, slot, skillID); + CHAR_complianceParameter(petindex); + CHAR_DelGold( talkerindex, cost ); + + snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1); + CHAR_sendStatusString( talkerindex, msgbuf ); + CHAR_sendStatusString( talkerindex, "P"); + NPC_PetSkillShop_selectWindow( meindex, talkerindex,0,-1); +} + +BOOL NPC_PetSkillMakeStr(int meindex,int toindex,int select) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + double rate=1.0; + int i=0; + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + int fd = getfdFromCharaIndex( toindex); + + if(select==0){ + sprintf(token,"0|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", msg, sizeof( msg)) == NULL){ + print("mainERR"); + return FALSE; + } + + sprintf(token,"1|%s|%s", + CHAR_getChar(meindex,CHAR_NAME),msg); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate=atof(msg); + } + + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg) ) != NULL){ + int skillarray; + int skillID; + int cost; + char token2[265]; + char buf[64]; + + i=1; + while( getStringFromIndexWithDelim(msg,",",i,buf,sizeof(buf)) !=FALSE ){ + i++; + skillID=atoi(buf); + skillarray = PETSKILL_getPetskillArray( skillID); + + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) + continue; + if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1) continue; + cost = PETSKILL_getInt(skillarray,PETSKILL_COST); + cost = (int)cost*rate; +#ifdef _SA80 + sprintf(token2,"|%s|%d|%s|0", PETSKILL_getChar(skillarray, PETSKILL_NAME), + cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT)); +#else + sprintf(token2,"|%s|%d|%s", PETSKILL_getChar(skillarray, PETSKILL_NAME), + cost, PETSKILL_getChar(skillarray, PETSKILL_COMMENT)); +#endif + strcat(token,token2); + } + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return TRUE; +} + diff --git a/npc/npc_pkpetshop.c b/npc/npc_pkpetshop.c new file mode 100644 index 0000000..c53b481 --- /dev/null +++ b/npc/npc_pkpetshop.c @@ -0,0 +1,61 @@ +0038:npc_poolitemshop.c:0702B:1:14=48041e4b:16=47d21313:#include "version.h" + +#include "char.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "npc_poolitemshop.h" +#include "log.h" +#include "handletime.h" + +#define NPC_POOLITEMSHOP_DEFAULT_COST 200 + +enum { + NPC_WORK_COST = CHAR_NPCWORKINT1, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, +}; + +enum { + NPC_POOLITEMSHOP_MSG_MAIN=0, + NPC_POOLITEMSHOP_MSG_POOL, + NPC_POOLITEMSHOP_MSG_DRAW, + NPC_POOLITEMSHOP_MSG_REALY, + NPC_POOLITEMSHOP_MSG_STONE, + NPC_POOLITEMSHOP_MSG_POOLFULL, + NPC_POOLITEMSHOP_MSG_ITEMFULL, + + CHAR_WINDOWTYPE_POOLITEMSHOP_START = 290, + CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_FULL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_END, + +#ifdef _NPC_DEPOTITEM + CHAR_WINDOWTYPE_DEPOTITEMSHOP_MENU = 310, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET, +#endif +}; + +typedef struct { + char option[32]; + char defaultmsg[128]; +}NPC_POOLITEMSHOP_MSG; + +NPC_POOLITEMSHOP_MSG poolshopmsg[] = { + { "main_msg", "ӭ"}, + { "pool_main", "Ҫķʲ"}, + { "draw_main", "Ҫʲ"}, + { "realy_msg", "ҪǸ"}, + { "stone_msg", "Ǯ!"}, + { "poolfull_msg", "޷"}, + { "itemfull_msg", "Ŀкܶ"} +}; + +static BOOL NPC_PoolItemShop_DrawItem( int meindex, int talkerindex, int num); +static BOOL NPC_PoolItemShop_PoolItem( int meindex, int talkerindex, int num); +static void NPC_PoolItemShop_MakeItemString_Draw( int meindex, int talkerindex, + char *retstring,int retstringlen); +static void NPC_PoolItemShop_MakeItemString_Pool( int meindex, int talkerindex, + char *retstr \ No newline at end of file diff --git a/npc/npc_poolitemshop.c b/npc/npc_poolitemshop.c new file mode 100644 index 0000000..df4150c --- /dev/null +++ b/npc/npc_poolitemshop.c @@ -0,0 +1,1106 @@ +#include "version.h" + +#include "char.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "npc_poolitemshop.h" +#include "log.h" +#include "handletime.h" + +#define NPC_POOLITEMSHOP_DEFAULT_COST 200 + +enum { + NPC_WORK_COST = CHAR_NPCWORKINT1, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, +}; + +enum { + NPC_POOLITEMSHOP_MSG_MAIN=0, + NPC_POOLITEMSHOP_MSG_POOL, + NPC_POOLITEMSHOP_MSG_DRAW, + NPC_POOLITEMSHOP_MSG_REALY, + NPC_POOLITEMSHOP_MSG_STONE, + NPC_POOLITEMSHOP_MSG_POOLFULL, + NPC_POOLITEMSHOP_MSG_ITEMFULL, + + CHAR_WINDOWTYPE_POOLITEMSHOP_START = 290, + CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_FULL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG, + CHAR_WINDOWTYPE_POOLITEMSHOP_END, + +#ifdef _NPC_DEPOTITEM + CHAR_WINDOWTYPE_DEPOTITEMSHOP_MENU = 310, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET, +#endif +}; + +typedef struct { + char option[32]; + char defaultmsg[128]; +}NPC_POOLITEMSHOP_MSG; + +NPC_POOLITEMSHOP_MSG poolshopmsg[] = { + { "main_msg", "ӭ"}, + { "pool_main", "Ҫķʲ"}, + { "draw_main", "Ҫʲ"}, + { "realy_msg", "ҪǸ"}, + { "stone_msg", "Ǯ!"}, + { "poolfull_msg", "޷"}, + { "itemfull_msg", "Ŀкܶ"} +}; + +static BOOL NPC_PoolItemShop_DrawItem( int meindex, int talkerindex, int num); +static BOOL NPC_PoolItemShop_PoolItem( int meindex, int talkerindex, int num); +static void NPC_PoolItemShop_MakeItemString_Draw( int meindex, int talkerindex, + char *retstring,int retstringlen); +static void NPC_PoolItemShop_MakeItemString_Pool( int meindex, int talkerindex, + char *retstring,int retstringlen); +static char *NPC_PoolItemShop_getMsg_noarg( int tablenum, + char *argstr, char *retstring, int retstringlen); +static void NPC_PoolItemShop_printWindow_Draw( int meindex, int talkerindex); +static void NPC_PoolItemShop_printWindow_Pool( int meindex, int talkerindex); +static void NPC_PoolItemShop_printWindow_Full( int meindex, int talkerindex); +void NPC_PoolItemShop_printWindow_Start( int meindex, int talkerindex); +static void NPC_PoolItemShop_printWindow_HaveItemFull( int meindex, int talkerindex); + +#ifdef _NPC_DEPOTITEM +void NPC_PoolItemShop_DepotItem_Menu( int meindex, int talkerindex); +void NPC_DepotItem_Item_printWindow( int meindex, int talkerindex); +void NPC_DepotItem_Depot_printWindow( int meindex, int talkerindex); +BOOL NPC_DepotItem_InsertItem( int meindex, int talkerindex, int num); +BOOL NPC_DepotItem_gettItem( int meindex, int talkerindex, int num); +#endif + +#define NPCPOOLITEMLOOP 1000*20 +int othertime=0; +int ickmeindex = 0; +BOOL NPC_PoolItemShopInit( int meindex) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + int cost; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + cost = NPC_Util_GetNumFromStrWithDelim( argstr, "cost"); + if( cost == -1 ) cost = NPC_POOLITEMSHOP_DEFAULT_COST; + CHAR_setWorkInt( meindex, NPC_WORK_COST, cost); +#ifdef _XC_CANGKU + ickmeindex = meindex; +#endif + return TRUE; +} + +void NPC_PoolItemShopLoop( int meindex) +{ +} + +void NPC_PoolItemShopTalked( int meindex , int talkerindex , + char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + if( !NPC_Util_isFaceToFace( meindex, talkerindex, 2)) { + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); +} + +void NPC_PoolItemShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ +#ifndef _XC_CANGKU + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) return; +#endif + //print("\n NPC_PoolItemShopWindowTalked: seq:%d sel:%d data:%s", seqno, select, data); + + switch( seqno ) { + case CHAR_WINDOWTYPE_POOLITEMSHOP_START: + switch( atoi( data)) { + case 1: + if( CHAR_getCharPoolItemIndexElement( talkerindex) != -1 ) { + NPC_PoolItemShop_printWindow_Pool( meindex, talkerindex); + }else { + NPC_PoolItemShop_printWindow_Full( meindex, talkerindex); + } + break; + case 2: + if( CHAR_findEmptyItemBox( talkerindex) != -1 ) { + NPC_PoolItemShop_printWindow_Draw( meindex, talkerindex); + }else { + NPC_PoolItemShop_printWindow_HaveItemFull( meindex, talkerindex); + } + break; +#ifdef _NPC_DEPOTITEM + case 3: + if( !CHAR_CheckDepotItem( talkerindex) ){ + CHAR_GetDepotItem( meindex, talkerindex); + CHAR_talkToCli( talkerindex, -1, "ȡõߣᣡ", CHAR_COLORYELLOW); + }else{ + NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + } + break; +#endif + + } + break; + case CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG: + if( atoi( data) == 0){ + NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); + }else { + NPC_PoolItemShop_PoolItem( meindex, talkerindex, atoi(data)-1); + } + break; + case CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG: + if( atoi( data) == 0){ + NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); + }else { + NPC_PoolItemShop_DrawItem( meindex, talkerindex, atoi(data)-1); + } + break; + case CHAR_WINDOWTYPE_POOLITEMSHOP_FULL_MSG: + NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); + break; + case CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG: + NPC_PoolItemShop_printWindow_Start( meindex, talkerindex); + break; + +#ifdef _NPC_DEPOTITEM + case CHAR_WINDOWTYPE_DEPOTITEMSHOP_MENU: + if( !CHAR_CheckDepotItem( talkerindex) ){ + CHAR_GetDepotItem( meindex, talkerindex); + return; + }else{ + NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + } + break; + case CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE: + if( !CHAR_CheckDepotItem( talkerindex) ) return ; + switch( atoi( data)) { + case 1:// +#ifdef _BIG_POOL_TYPE + if(getItemPoolType()==1){ + CHAR_talkToCli( talkerindex, -1, "ֿѹرգʹø˲ֿ⡣", CHAR_COLORYELLOW); + return; + } +#endif + if( CHAR_findEmptyDepotItem( talkerindex) == -1 ){ + CHAR_talkToCli( talkerindex, -1, "ֿ", CHAR_COLORYELLOW); + return; + } + NPC_DepotItem_Item_printWindow( meindex, talkerindex); + break; + case 2: + if( CHAR_findEmptyItemBox( talkerindex) == -1 ) { + CHAR_talkToCli( talkerindex, -1, "ϵλ", CHAR_COLORYELLOW); + return; + } + NPC_DepotItem_Depot_printWindow( meindex, talkerindex); + break; + } + break; + case CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD:// + if( !CHAR_CheckDepotItem( talkerindex) ) return ; + if( atoi( data) == 0){ + NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + }else { + if( NPC_DepotItem_InsertItem( meindex, talkerindex, atoi( data)-1) == FALSE ){ + //NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + CHAR_talkToCli( talkerindex, -1, "ŵʧܣԣ", CHAR_COLORYELLOW); + return; + } + } + break; + case CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET: + if( !CHAR_CheckDepotItem( talkerindex) ) return ; + if( atoi( data) == 0){ + NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + }else { + if( NPC_DepotItem_gettItem( meindex, talkerindex, atoi( data)-1) == FALSE ){ + NPC_PoolItemShop_DepotItem_Menu( meindex, talkerindex); + CHAR_talkToCli( talkerindex, -1, "ȡʧܣԣ", CHAR_COLORYELLOW); + } + } + break; +#endif + + default: + break; + } +} + +void NPC_PoolItemShop_printWindow_Start( int meindex, int talkerindex) +{ + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + char message[1024]; + char buf[2048]; + +#ifdef _NPC_DEPOTITEM + strcpy( message, + "3\n\n" + " ӭ\n\n" + " ķŵߣ\n" + " ȡصߣ\n" + " ʹòֿ⣾\n\n" + " 뿪 " + ); +#else + strcpy( message, + "3\n\n" + " ӭ\n\n" + " ķŵߣ\n" + " ȡصߣ\n\n\n" + " 뿪 " + ); +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_POOLITEMSHOP_START, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } +} + +#ifdef _NPC_DEPOTITEM +void NPC_PoolItemShop_DepotItem_Menu( int meindex, int talkerindex) +{ + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + char message[1024]; + char buf[2048]; + + strcpy( message, + "3\n\n" + " ʹõֿ߲\n\n" + " ŵߣ\n" + " ȡصߣ\n" + ); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_HANDLE, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } +} + +void NPC_DepotItem_MakeItemString( int meindex, int talkerindex, char *retstring,int retstringlen) +{ + int i; + int itemindex; + int pos = 0; + char buff[1024]; + + retstring[0] = '\0'; + for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) { + int poolflg = FALSE; + itemindex = CHAR_getItemIndex( talkerindex, i); + if( !ITEM_CHECKINDEX( itemindex) ) continue; + + if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) || ITEM_getInt( itemindex, ITEM_VANISHATDROP) || + !ITEM_getInt( itemindex, ITEM_CANPETMAIL) ) { + poolflg = TRUE; + } + int itemtime = ITEM_getInt(itemindex,ITEM_TIME); + char tempbuf[256]; + if(itemtime>0){ + time_t timep; + struct tm *p; + timep = itemtime; + p=localtime(&timep); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + char tmbuf[256]; + strcpy(tmbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + sprintf(tempbuf,"Ч:%d.%s.%s %s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,tmbuf); + }else{ + strcpy(tempbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + } + snprintf( buff, sizeof( buff), +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%s|%d|%d|", +#else + "%s|%d|%d|%d|%s|%d|", +#endif + ITEM_getChar( itemindex, ITEM_SECRETNAME), + poolflg,CHAR_getWorkInt( meindex, NPC_WORK_COST), + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + tempbuf, +#ifdef _ITEM_PILENUMS + ITEM_getInt( itemindex, ITEM_USEPILENUMS), +#endif + i + 1 ); + + if( pos +strlen( buff)>= retstringlen) { + fprint( "buffer over err\n"); + break; + } + strcpy( &retstring[pos], buff); + pos += strlen( buff); + } +} + +void NPC_DepotItem_Item_printWindow( int meindex, int talkerindex) +{ + char itemstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char sendstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buff2[1024]; + char buff3[1024]; + char buff4[1024]; + int fd; + + if( (fd = getfdFromCharaIndex( talkerindex)) == -1 ){ + fprint( "err\n"); + return; + } + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + snprintf( sendstring, sizeof( sendstring), "0|%d|%s|%s|%s|%s|", + CHAR_getfindEmptyDepotItem( talkerindex), + CHAR_getChar( meindex, CHAR_NAME), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOL, argstr, buff2, sizeof( buff2)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOLFULL, argstr, buff3, sizeof( buff3)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, argstr, buff4, sizeof( buff4)) + ); + + NPC_DepotItem_MakeItemString( meindex, talkerindex, itemstring, sizeof( itemstring)); + strcat( sendstring, itemstring); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_ADD, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), sendstring); + +} + +void NPC_DepotItem_MakeDepotString( int meindex, int talkerindex, char *retstring,int retstringlen) +{ + int i; + int itemindex; + int pos = 0; + char buff[1024]; + + retstring[0] = '\0'; + for( i = 0; i < /*60*/CHAR_MAXDEPOTITEMHAVE; i ++ ) { + int poolflg = FALSE; + itemindex = CHAR_getDepotItemIndex( talkerindex, i); + if( !ITEM_CHECKINDEX( itemindex)) continue; + int itemtime = ITEM_getInt(itemindex,ITEM_TIME); + char tempbuf[256]; + if(itemtime>0){ + time_t timep; + struct tm *p; + timep = itemtime; + p=localtime(&timep); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + char tmbuf[256]; + strcpy(tmbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + sprintf(tempbuf,"Ч:%d.%s.%s %s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,tmbuf); + }else{ + strcpy(tempbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + } + snprintf( buff, sizeof( buff), +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%d|%s|%d|", +#else + "%s|%d|%d|%d|%d|%s|", +#endif + ITEM_getChar( itemindex, ITEM_SECRETNAME), + poolflg, + ITEM_getInt( itemindex, ITEM_LEVEL), + ITEM_getInt( itemindex, ITEM_COST), + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + tempbuf +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#endif + ); + if( pos +strlen( buff)>= retstringlen) { + fprint( "buffer over err\n"); + break; + } + strcpy( &retstring[pos], buff); + pos += strlen( buff); + } + +} + +void NPC_DepotItem_Depot_printWindow( int meindex, int talkerindex) +{ + char itemstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char sendstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buff[1024]; + char buff2[1024]; + char buff3[1024]; + int fd; + + if( (fd = getfdFromCharaIndex( talkerindex)) == -1 )return; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + snprintf( sendstring, sizeof( sendstring), "1|%s|%s|%s|%s|", + CHAR_getChar( meindex, CHAR_NAME), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_DRAW, argstr, buff2, sizeof( buff2)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_ITEMFULL, argstr, buff, sizeof( buff)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, argstr, buff3, sizeof( buff3)) + ); + NPC_DepotItem_MakeDepotString( meindex, talkerindex, itemstring, sizeof( itemstring)); + strcat( sendstring, itemstring); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_DEPOTITEMSHOP_GET, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + sendstring); + + //print("\n NPC_DepotItem_Depot_printWindow:%s size:%d ", sendstring, strlen(sendstring)); +} + +void NPC_DepotItem_CheckRepeat_Del( int charaindex, int ti, int itemindex) +{ + char token[256]; + sprintf( token, "ֿ%sظ(ϵͳ)", + ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW); + LogItem( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "repeat(ֿظ)", + 0, 0, 0, + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) ); + + CHAR_setDepotItemIndex( charaindex, ti, -1); + ITEM_endExistItemsOne( itemindex); +} + +void NPC_DepotItem_CheckRepeat( int talkerindex) +{ + int i, j, cnt=0, itemindex, itemindex1; + + for( i=0; i<(CHAR_MAXDEPOTITEMHAVE-1); i++){ + itemindex = CHAR_getDepotItemIndex( talkerindex, i); + if( !ITEM_CHECKINDEX( itemindex)) continue; + cnt=0; + for( j=(i+1); j=23228 && ID1<=23307){ + if(strstr(ITEM_getChar(itemindex,ITEM_EFFECTSTRING),"")==NULL){ + ITEM_setChar(itemindex,ITEM_EFFECTSTRING,"[ԣ]뵽峤(13.5)Ҹʦ"); + } + } + if(((ID1>=3000 && ID1<=11719) || (ID1>=14001 && ID1<=18530)) && ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE)<1){ + int maxcrushe = ITEMTBL_getInt(ID1,ITEM_MAXDAMAGECRUSHE); + ITEM_setInt(itemindex,ITEM_MAXDAMAGECRUSHE,maxcrushe); + ITEM_setInt(itemindex,ITEM_DAMAGECRUSHE,maxcrushe); + } +#endif + for( j=1;j<=30;j++ ) { + if(getStringFromIndexWithDelim(delbuf,",", j, delitembuf, sizeof(delitembuf)) == FALSE) + break; + ID2 = atoi(delitembuf); + if(ID2 == -1)break; + if( ID1 == ID2){ + CHAR_setItemIndex( talkerindex, emptyindex, -1); + LogItem(CHAR_getChar( talkerindex, CHAR_NAME ), // + CHAR_getChar( talkerindex, CHAR_CDKEY ), //ʺ +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "poolitemshop(CFƷ)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_talkToCli( talkerindex, -1, "ϵͳֿĵ", CHAR_COLORWHITE ); + return TRUE; + } + } +#endif + + + CHAR_sendItemDataOne( talkerindex, emptyindex); + + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + + LogItem( + CHAR_getChar( talkerindex, CHAR_NAME ), + CHAR_getChar( talkerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "Depot(ȡ)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) ); + + { + int i, cnt=0; + int work[CHAR_MAXDEPOTITEMHAVE]; + for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) { + work[i] = -1; + } + for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) { + itemindex = CHAR_getDepotItemIndex( talkerindex, i); + if( !ITEM_CHECKINDEX( itemindex)) continue; + work[ cnt++] = itemindex; + } + for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) { + CHAR_setDepotItemIndex( talkerindex, i, work[i]); + } + } + + int itemtime = 0; + itemtime = ITEM_getInt(itemindex,ITEM_TIME); + if(itemtime>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(itemtime<=timep){ + char itemname[128]; + sprintf(itemname,"ĵ:%sʱЧѵϵͳջء",ITEM_getChar(itemindex,ITEM_NAME)); + CHAR_talkToCli( talkerindex, -1, itemname, CHAR_COLORYELLOW ); + CHAR_setItemIndex( talkerindex, emptyindex ,-1); + CHAR_sendItemDataOne( talkerindex, emptyindex); + ITEM_endExistItemsOne(itemindex); + } + } + + return TRUE; +} +#endif + +static void NPC_PoolItemShop_printWindow_Full( int meindex, int talkerindex) +{ + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + char message[1024]; + char buf[2048]; + + strcpy( message, + "\n\n ޷" + ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_POOLITEMSHOP_FULL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } + +} + +static void NPC_PoolItemShop_printWindow_HaveItemFull( int meindex, int talkerindex) +{ + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + char message[1024]; + char buf[2048]; + + strcpy( message, + "\n\n ߲Ѿ" + ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_POOLITEMSHOP_HAVEITEMFULL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( message, buf, sizeof(buf))); + } +} + +static void NPC_PoolItemShop_printWindow_Pool( int meindex, int talkerindex) +{ + char itemstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char sendstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buff2[1024]; + char buff3[1024]; + char buff4[1024]; + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd == -1 ) { + fprint( "err\n"); + return; + } + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + snprintf( sendstring, sizeof( sendstring), "0|%d|%s|%s|%s|%s|", + CHAR_getEmptyCharPoolItemIndexNum( talkerindex), + CHAR_getChar( meindex, CHAR_NAME), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOL, + argstr, buff2, sizeof( buff2)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_POOLFULL, + argstr, buff3, sizeof( buff3)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, + argstr, buff4, sizeof( buff4)) + ); + + NPC_PoolItemShop_MakeItemString_Pool( meindex, talkerindex, itemstring, sizeof( itemstring)); + strcat( sendstring, itemstring); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_POOLITEMSHOP_POOL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + sendstring); + +} + +static void NPC_PoolItemShop_printWindow_Draw( int meindex, int talkerindex) +{ + char itemstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char sendstring[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buff[1024]; + char buff2[1024]; + char buff3[1024]; + int fd; + + fd = getfdFromCharaIndex( talkerindex); + if( fd == -1 ) { + fprint( "err\n"); + return; + } + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + snprintf( sendstring, sizeof( sendstring), "1|%s|%s|%s|%s|", + CHAR_getChar( meindex, CHAR_NAME), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_DRAW, + argstr, buff2, sizeof( buff2)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_ITEMFULL, + argstr, buff, sizeof( buff)), + NPC_PoolItemShop_getMsg_noarg( NPC_POOLITEMSHOP_MSG_REALY, + argstr, buff3, sizeof( buff3)) + ); + NPC_PoolItemShop_MakeItemString_Draw( meindex, talkerindex, + itemstring, sizeof( itemstring)); + strcat( sendstring, itemstring); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_POOLITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_POOLITEMSHOP_DRAW_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + sendstring); + +} + +static char *NPC_PoolItemShop_getMsg_noarg( int tablenum, + char *argstr, char *retstring, int retstringlen) +{ + char buf[1024]; + if( tablenum < 0 || tablenum >= arraysizeof( poolshopmsg)) return "\0"; + + if( NPC_Util_GetStrFromStrWithDelim( argstr, poolshopmsg[tablenum].option, buf, sizeof( buf)) != NULL ) { + strcpysafe( retstring, retstringlen, buf); + }else { + strcpysafe( retstring, retstringlen, poolshopmsg[tablenum].defaultmsg); + } + return retstring; +} + +static void NPC_PoolItemShop_MakeItemString_Pool( int meindex, int talkerindex, + char *retstring,int retstringlen) +{ + int i; + int itemindex; + int pos = 0; + char buff[1024]; + + retstring[0] = '\0'; + for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) { + itemindex = CHAR_getItemIndex( talkerindex, i); + if( ITEM_CHECKINDEX( itemindex)) { + int poolflg = FALSE; + if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) || + ITEM_getInt( itemindex, ITEM_VANISHATDROP) || + !ITEM_getInt( itemindex, ITEM_CANPETMAIL)){ + poolflg = TRUE; + } + int itemtime = ITEM_getInt(itemindex,ITEM_TIME); + char tempbuf[256]; + if(itemtime>0){ + time_t timep; + struct tm *p; + timep = itemtime; + p=localtime(&timep); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + char tmbuf[256]; + strcpy(tmbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + sprintf(tempbuf,"Ч:%d.%s.%s %s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,tmbuf); + }else{ + strcpy(tempbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + } + snprintf( buff, sizeof( buff), +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%s|%d|%d|", +#else + "%s|%d|%d|%d|%s|%d|", +#endif + ITEM_getChar( itemindex, ITEM_SECRETNAME), + poolflg,CHAR_getWorkInt( meindex, NPC_WORK_COST), + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + tempbuf, +#ifdef _ITEM_PILENUMS + ITEM_getInt( itemindex, ITEM_USEPILENUMS), +#endif + i + 1 ); + if( pos +strlen( buff)>= retstringlen) { + fprint( "buffer over err\n"); + break; + } + strcpy( &retstring[pos], buff); + pos += strlen( buff); + } + } +} + +static void NPC_PoolItemShop_MakeItemString_Draw( int meindex, int talkerindex, + char *retstring,int retstringlen) +{ + int i; + int itemindex; + int pos = 0; + char buff[1024]; + + retstring[0] = '\0'; + for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) { + itemindex = CHAR_getPoolItemIndex( talkerindex, i); + if( ITEM_CHECKINDEX( itemindex)) { + int poolflg = FALSE; + int itemtime = ITEM_getInt(itemindex,ITEM_TIME); + char tempbuf[256]; + if(itemtime>0){ + time_t timep; + struct tm *p; + timep = itemtime; + p=localtime(&timep); + int year=1900+p->tm_year; + int mon=1+p->tm_mon; + int date=p->tm_mday; + int hour=p->tm_hour; + int min=p->tm_min; + int sec=p->tm_sec; + char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; + if(mon<10) sprintf(monbuf,"0%d",mon); + else sprintf(monbuf,"%d",mon); + if(date<10) sprintf(datebuf,"0%d",date); + else sprintf(datebuf,"%d",date); + if(hour<10) sprintf(hourbuf,"0%d",hour); + else sprintf(hourbuf,"%d",hour); + if(min<10) sprintf(minbuf,"0%d",min); + else sprintf(minbuf,"%d",min); + if(sec<10) sprintf(secbuf,"0%d",sec); + else sprintf(secbuf,"%d",sec); + char tmbuf[256]; + strcpy(tmbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + sprintf(tempbuf,"Ч:%d.%s.%s %s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,tmbuf); + }else{ + strcpy(tempbuf,ITEM_getChar( itemindex, ITEM_EFFECTSTRING)); + } + snprintf( buff, sizeof( buff), +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%d|%s|%d|", + +#else + "%s|%d|%d|%d|%d|%s|", +#endif + ITEM_getChar( itemindex, ITEM_SECRETNAME), + poolflg, + ITEM_getInt( itemindex, ITEM_LEVEL), + ITEM_getInt( itemindex, ITEM_COST), + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + tempbuf +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#endif + ); + if( pos +strlen( buff)>= retstringlen) { + fprint( "buffer over err\n"); + break; + } + strcpy( &retstring[pos], buff); + pos += strlen( buff); + } + } +} + +static BOOL NPC_PoolItemShop_PoolItem( int meindex, int talkerindex, int num) +{ + int emptyindex; + int itemindex; + int cost = CHAR_getWorkInt( meindex, NPC_WORK_COST); + + emptyindex = CHAR_getCharPoolItemIndexElement( talkerindex); + if( emptyindex == -1 ) { + return FALSE; + } + + itemindex = CHAR_getItemIndex( talkerindex, num); + if( getItemPoolBug() == 1 ) + { + if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) || // dzʧ + ITEM_getInt( itemindex, ITEM_VANISHATDROP) || // ʧ + !ITEM_getInt( itemindex, ITEM_CANPETMAIL) ) { // ɳʼ + return FALSE; + } + } + if( !ITEM_CHECKINDEX( itemindex)) { + fprint( "err"); + return FALSE; + } + CHAR_DelGold( talkerindex, cost ); + + CHAR_setPoolItemIndex( talkerindex, emptyindex, itemindex); + + CHAR_setItemIndex( talkerindex, num, -1); + CHAR_sendItemDataOne( talkerindex, num); + + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + LogItem( + CHAR_getChar( talkerindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talkerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "pool(ķŵ)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + //int fd = getfdFromCharaIndex( talkerindex); + CHAR_charSaveFromConnect(talkerindex, FALSE); + CHAR_talkToCli(talkerindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return TRUE; +} + +static BOOL NPC_PoolItemShop_DrawItem( int meindex, int talkerindex, int num) +{ + int emptyindex; + int itemindex; + int i; + int cnt; + int work[CHAR_MAXPOOLITEMHAVE]; + + emptyindex = CHAR_findEmptyItemBox( talkerindex); + if( emptyindex == -1 ) return FALSE; + + itemindex = CHAR_getPoolItemIndex( talkerindex, num); + if( !ITEM_CHECKINDEX( itemindex)) { + fprint( "err\n"); + return FALSE; + } + CHAR_setItemIndex( talkerindex, emptyindex, itemindex); + CHAR_setPoolItemIndex( talkerindex, num, -1); + CHAR_sendItemDataOne( talkerindex, emptyindex); + for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) { + work[i] = -1; + } + cnt = 0; + for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) { + itemindex = CHAR_getPoolItemIndex( talkerindex, i); + if( ITEM_CHECKINDEX( itemindex)) { + work[ cnt++] = itemindex; + } + } + for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) { + CHAR_setPoolItemIndex( talkerindex, i, work[i]); + } + LogItem( + CHAR_getChar( talkerindex, CHAR_NAME ), + CHAR_getChar( talkerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "draw(ȡ)", + CHAR_getInt( talkerindex,CHAR_FLOOR), + CHAR_getInt( talkerindex,CHAR_X ), + CHAR_getInt( talkerindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + int fd = getfdFromCharaIndex( talkerindex); + int itemtime = 0; + itemtime = ITEM_getInt(itemindex,ITEM_TIME); + if(itemtime>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + if(itemtime<=timep){ + char itemname[128]; + sprintf(itemname,"ĵ:%sʱЧѵϵͳջء",ITEM_getChar(itemindex,ITEM_NAME)); + CHAR_talkToCli( talkerindex, -1, itemname, CHAR_COLORYELLOW ); + CHAR_setItemIndex( talkerindex, emptyindex ,-1); + CHAR_sendItemDataOne( talkerindex, emptyindex); + ITEM_endExistItemsOne(itemindex); + } + } + CHAR_charSaveFromConnect(talkerindex, FALSE); + CHAR_talkToCli(talkerindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + return TRUE; +} diff --git a/npc/npc_quiz.c b/npc/npc_quiz.c new file mode 100644 index 0000000..459d44c --- /dev/null +++ b/npc/npc_quiz.c @@ -0,0 +1,1330 @@ +#include "version.h" +#include +#include "common.h" +#include "char_base.h" +#include "npc_quiz.h" +#include "npcutil.h" +#include "char.h" +#include "lssproto_serv.h" +#include "buf.h" +#include "function.h" +#include "readmap.h" +#include "object.h" +#include "log.h" + +#define MEPLAYER 8 +#define OLDNO 100 + +enum { + CHAR_WORK_PLAYER1 = CHAR_NPCWORKINT1, + CHAR_WORK_PLAYER2 = CHAR_NPCWORKINT2, + CHAR_WORK_PLAYER3 = CHAR_NPCWORKINT3, + CHAR_WORK_PLAYER4 = CHAR_NPCWORKINT4, + CHAR_WORK_PLAYER5 = CHAR_NPCWORKINT5, + CHAR_WORK_PLAYER6 = CHAR_NPCWORKINT6, + CHAR_WORK_PLAYER7 = CHAR_NPCWORKINT7, + CHAR_WORK_PLAYER8 = CHAR_NPCWORKINT8, + CHAR_WORK_QUIZNUM = CHAR_NPCWORKINT9, +}; + +NPC_QUIZ* Quiz; + +struct pl{ + int talkerindex; + int quizno; + int answer; + int ansno; + int oldno[OLDNO]; + int *ptr; +}; + + +static int quizcnt = 0; + + +static void NPC_Quiz_selectWindow( int meindex, int talker, int num); +int *NPC_GetQuestion(int meindex); +BOOL NPC_QuizItemFullCheck(int meindex, int talker); +BOOL NPC_PlayerCheck(int meindex,int talker); +int NPC_RealyCheack(int meindex,int talker); +int NPC_QuizRandAnswer(int p_no,int q_no, int mode, + char *work1,char *work2,char *work3); +int NPC_QuizBorderLine(int ans, char *buf); +int NPC_QuizWarpBorderLine(int ans, char *buf); + +BOOL NPC_QuizAddItem(int talker,char *buf); + +BOOL NPC_EntryItemDel(int talker,char *buf); +BOOL NPC_EntryItemCheck(int talker,char *buf); +BOOL NPC_EntryStoneDel(int talker,char *buf); +BOOL NPC_EntryStoneCheck(int talker,char *buf); +BOOL NPC_QUIZPARTY_CHAECK(int meindex,int talker); + +BOOL NPC_QuizInit( int meindex ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + int *tbl; + int i; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "StartMsg", buf, sizeof( buf)) == NULL){ + print("Quiz_StartMsgErr:%s", CHAR_getChar( meindex, CHAR_NAME)); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "Quiznum", buf, sizeof( buf)) == NULL){ + print("QuizNumErrErr:%s", CHAR_getChar( meindex, CHAR_NAME)); + return FALSE; + } + + CHAR_setWorkInt( meindex, CHAR_WORK_QUIZNUM, atoi( buf)); + + for(i =0 ; i < 8 ; i++){ + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + i, -1); + } + tbl = NPC_GetQuestion( meindex); + + if( CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) > ( tbl[0] - 1)){ + print( + "%s,ԲȦquiz(%d? ȳ(%d)", + CHAR_getChar( meindex, CHAR_NAME), + (tbl[0]-1), + CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) + ); + return FALSE; + } + + return TRUE; + +} + +void NPC_QuizTalked( int meindex , int talkerindex , char *szMes , + int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + if(NPC_QUIZPARTY_CHAECK(meindex,talkerindex)==FALSE){ + NPC_Quiz_selectWindow( meindex, talkerindex, 4); + + } + if(NPC_QuizItemFullCheck(meindex, talkerindex) == FALSE){ + NPC_Quiz_selectWindow( meindex, talkerindex, 3); + }else{ + NPC_Quiz_selectWindow( meindex, talkerindex, 0); + } +} + +static void NPC_Quiz_selectWindow( int meindex, int talker, int num) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf[256]; + char buf2[256]; + char buf3[256]; + + int i = 0,k; + int questionno = 0; + int fd = getfdFromCharaIndex( talker); + int buttontype = 0; + int messagetype = 0; + int windowno = 0; + int len = 4; + int p_no; + int p_old; + int loop=0; + int ans; + BOOL entryflg = TRUE; + switch( num) { + case 0: + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + if(NPC_Util_GetStrFromStrWithDelim( argstr,"StartMsg",token, sizeof( token)) == NULL){ + print("%sStartMsg", CHAR_getChar(meindex,CHAR_NAME)); + return; + } + buttontype = WINDOW_BUTTONTYPE_YESNO; + messagetype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_QUIZ_START; + break; + + case 1: + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryItem", buf2, sizeof( buf2)) != NULL){ + if(NPC_EntryItemCheck( talker, buf2) == FALSE){ + entryflg = FALSE; + } + } + if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryStone",buf3, sizeof( buf3)) != NULL){ + if(NPC_EntryStoneCheck( talker, buf3) == FALSE){ + entryflg = FALSE; + } + } + if(entryflg == FALSE){ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"NoEntryMsg",token, sizeof( token)) != NULL) { + buttontype = WINDOW_BUTTONTYPE_OK; + messagetype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_QUIZ_START; + + } + + }else if(NPC_PlayerCheck( meindex, talker) == FALSE) { + /*-----*/ + sprintf(token,"\n\n\n ,Եһ" + "\n պ幫ئƥئо" + ); + buttontype = WINDOW_BUTTONTYPE_OK; + messagetype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_QUIZ_START; + + }else{ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryItem",buf2, sizeof( buf2)) != NULL){ + if(NPC_EntryItemDel( talker, buf2) ==FALSE){ + print("ûʧ(%s)",CHAR_getChar(meindex,CHAR_NAME)); + return; + } + } + if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryStone",buf3, sizeof( buf3)) != NULL){ + if(NPC_EntryStoneDel( talker, buf3) ==FALSE){ + print("Ǯûʧ(%s)",CHAR_getChar(meindex,CHAR_NAME)); + return; + } + } + NPC_Quiz_selectWindow(meindex, talker, 2); + return; + } + break; + + case 3: + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + + /*-- --*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"ItemFullMsg", token, sizeof( token)) == NULL) + { + print("%sItemFullMsg", CHAR_getChar(meindex,CHAR_NAME)); + return; + } + + buttontype = WINDOW_BUTTONTYPE_OK; + messagetype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_QUIZ_START; + + break; + case 2: + /*--̼--*/ + { + int *tbl; + int point; + int *pl_ptr; + int warp_flg = -1; + int floor=0,x=0,y=0; + + struct pl PLAYER; + + + if(NPC_QUIZPARTY_CHAECK(meindex,talker)==FALSE){ + NPC_Quiz_selectWindow( meindex, talker, 4); + } + + + + p_no = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT); + point = CHAR_getWorkInt( meindex, CHAR_WORK_PLAYER1 + p_no); + pl_ptr = (int *)point; + + memcpy(&PLAYER, pl_ptr, sizeof(struct pl)); + + if(PLAYER.quizno + == CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM)) + { + double avg; + int okflg; + char buf2[512]; + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) + { + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "GetItem", buf, sizeof( buf) )!=NULL) + { + okflg = NPC_QuizBorderLine(PLAYER.answer,buf); + if(okflg == -1) + { + + }else{ + + getStringFromIndexWithDelim(buf , "," , okflg+1, buf3, sizeof(buf3)); + if(NPC_QuizAddItem( talker, buf3) == FALSE) return ; + + } + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "Border", buf, sizeof( buf) )!=NULL) + { + okflg = NPC_QuizBorderLine(PLAYER.answer,buf); + if(okflg == -1) + { + NPC_Util_GetStrFromStrWithDelim( argstr, "FailureMsg", + buf2,sizeof(buf2)); + + CHAR_talkToCli( talker, meindex, buf2, CHAR_COLORWHITE); + + }else{ + + getStringFromIndexWithDelim(buf , "," , okflg+1, buf2, sizeof(buf2)); + CHAR_talkToCli( talker, meindex, buf2, CHAR_COLORWHITE); + } + } + + + /*--ݩѱɱԪ---*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr, "Warp", buf, sizeof( buf) )!=NULL) + { + warp_flg = NPC_QuizWarpBorderLine(PLAYER.answer,buf); + if(warp_flg != -1) { + char warpbuf[32]; + + getStringFromIndexWithDelim(buf , "," , warp_flg+1, buf2, sizeof(buf2)); + getStringFromIndexWithDelim(buf2 , "." , 1, warpbuf, sizeof(warpbuf)); + floor = atoi(warpbuf); + getStringFromIndexWithDelim(buf2 , "." , 2, warpbuf, sizeof(warpbuf)); + x = atoi(warpbuf); + getStringFromIndexWithDelim(buf2 , "." , 3, warpbuf, sizeof(warpbuf)); + y = atoi(warpbuf); + } + } + + + + avg = (double)PLAYER.answer / + CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) * 100; + + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + + CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ,-1); + +// print("\n %s %d",CHAR_getChar(talker,CHAR_NAME),(int)PLAYER.ptr); + + free(PLAYER.ptr); + + if(warp_flg != -1){ + CHAR_warpToSpecificPoint(talker, floor, x, y); + } + return; + + } + + tbl = NPC_GetQuestion( meindex); + + + if( CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) > ( tbl[0] - 1)) + { + free(PLAYER.ptr); + return ; + } + + while(1){ + loop++; + i = rand()%( tbl[0]); + if(i == 0) continue; + questionno = tbl[i]; + + for( k = 0 ; k < OLDNO ; k++){ + if(PLAYER.oldno[k] == questionno) { + loop = 0; + break; + } + } + if(k == OLDNO) break; + + if(loop == 5000) { + print("ⲻiȫظj"); + break; + } + } + + p_no = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT); + p_old = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC); + + PLAYER.quizno++; + + PLAYER.oldno[p_old] = questionno; + p_old++; + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC, p_old); + + strncpy( buf, Quiz[questionno].question, + sizeof( Quiz[questionno].question)); + + if(strlen( buf) < 40) { + strcat( buf, "\n"); + }else if(strlen( buf) > 79) { + len = 5; + } + + /*--ǩѨ--*/ + if( Quiz[questionno].answertype == 4) { + + if(strlen( buf) < 40) { + strcat( buf,"\n\n"); + }else if( strlen( buf) < 80) { + strcat( buf,"\n\n"); + }else{ + strcat( buf,"\n"); + } + + sprintf( token," quiz %d " + "\n%s " + "\nд\n" + "?(д밴ϣ)", + PLAYER.quizno, + buf); + + buttontype = WINDOW_BUTTONTYPE_OK; + messagetype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + windowno = CHAR_WINDOWTYPE_QUIZ_MAIN; + + /*--ػëƹ巤ʢ--*/ + memcpy(pl_ptr,&PLAYER,sizeof(struct pl)); + + break; + + }else if( Quiz[questionno].answertype == 2) { + char work1[128]; + char work2[128]; + char work3[128]; + + ans = (rand() % 3) + 1; + + ans = NPC_QuizRandAnswer(p_no,questionno,3, work1,work2,work3); + PLAYER.ansno = ans; + + sprintf(token,"%d\n quiz %d " + "\n%s " + "\n\n %s" + "\n %s" + "\n %s", + len, + PLAYER.quizno, + buf, + work1, + work2, + work3 + ); + + }else if( Quiz[questionno].answertype == 1){ + char work1[128]; + char work2[128]; + char work3[128]; + + strcpy(work3,"-1"); + ans = NPC_QuizRandAnswer(p_no,questionno,2, work1,work2,work3); + PLAYER.ansno = ans; + + sprintf(token,"%d\n quiz %d " + "\n%s " + "\n\n %s" + "\n %s", + len, + PLAYER.quizno, + buf, + work1, + work2 + ); + } + buttontype = WINDOW_BUTTONTYPE_CANCEL; + messagetype = WINDOW_MESSAGETYPE_SELECT; + windowno = CHAR_WINDOWTYPE_QUIZ_MAIN; + + memcpy(pl_ptr,&PLAYER,sizeof(struct pl)); + + } + break; + + case 4: + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) + { + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr,"Party", token, sizeof( token)) != NULL) + { + buttontype = WINDOW_BUTTONTYPE_OK; + messagetype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_QUIZ_START; + } + + break; + + } + + /*-ƥ˪--*/ + lssproto_WN_send( fd, messagetype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +void NPC_QuizWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int i=0; + int old_no; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) { + return; + } + switch( seqno){ + case CHAR_WINDOWTYPE_QUIZ_START: + if( select == WINDOW_BUTTONTYPE_YES) { + NPC_Quiz_selectWindow(meindex, talkerindex, 1); + } + + if(select == WINDOW_BUTTONTYPE_OK){ + } + + break; + + case CHAR_WINDOWTYPE_QUIZ_MAIN: + { + int point; + int *pl_ptr; + int p_no; + struct pl PLAYER; + + p_no = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + point = CHAR_getWorkInt( meindex, CHAR_WORK_PLAYER1 + p_no); + pl_ptr = (int *)point; + if(point < 0){ + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + + CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) ,-1); + //free(PLAYER.ptr); + return; + } + //print("\nlen=%d,size=%d,point=%d\n",sizeof(pl_ptr),sizeof(struct pl),point); + memcpy(&PLAYER,pl_ptr,sizeof(struct pl)); + + p_no = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + old_no = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANTSEC)-1; + i= PLAYER.oldno[old_no]; + + if(select == WINDOW_BUTTONTYPE_OK){ + if( i >= quizcnt || i < 0 ) return; + if( Quiz == NULL || strlen( Quiz[i].select1) >= 128 ) return; + + if( strstr( data, Quiz[i].select1) != NULL) { + PLAYER.answer++; + } + memcpy(pl_ptr,&PLAYER,sizeof(struct pl)); + NPC_Quiz_selectWindow(meindex, talkerindex, 2); + }else if(select == WINDOW_BUTTONTYPE_CANCEL){ + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + + CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) ,-1); + free(PLAYER.ptr); + }else if( atoi( data) == 0){ + }else{ + if(atoi(data) == PLAYER.ansno){ + PLAYER.answer++; + } + memcpy(pl_ptr,&PLAYER,sizeof(struct pl)); + NPC_Quiz_selectWindow(meindex, talkerindex, 2); + } + } + break; + + } + + +} + +/* + *ʾĸ̼ + */ +int NPC_QuizBorderLine(int ans ,char *buf) +{ + char buf2[32]; + int j = 1; + int border; + + + while(getStringFromIndexWithDelim(buf , "," , j, buf2, sizeof( buf2)) + !=FALSE ) + { + border = atoi(buf2); + + if(ans >= border) { + return j; + } + + j += 2; + + } + return -1; +} +/* + *ʾĸ̼ + */ +int NPC_QuizWarpBorderLine(int ans ,char *buf) +{ + char buf2[32]; + int j = 1; + int border; + + + while(getStringFromIndexWithDelim(buf , "," , j, buf2, sizeof( buf2)) + != FALSE ) + { + border = atoi(buf2); + + if(ans >= border) { + return j; + } + + j += 2; + + } + return -1; +} + + +/* + */ +BOOL NPC_QuizAddItem(int talker,char *buf) +{ + int i=1; + int ret; + char buf2[16]; + int itemindex; + char token[512]; + + while(getStringFromIndexWithDelim(buf , "." , i, buf2, sizeof(buf2)) + != FALSE ) + { + i++; + } + i--; + if(i == 1){ + getStringFromIndexWithDelim(buf , "." , i, buf2, sizeof(buf2)); + }else{ + /*--¼ĸة--*/ + i = (rand() % i)+1; + getStringFromIndexWithDelim(buf , "." , i, buf2, sizeof(buf2)); + } + + itemindex = ITEM_makeItemAndRegist(atoi(buf2)); + + if(itemindex == -1) return FALSE; + + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( !CHAR_CHECKITEMINDEX( talker, ret) ){ + print( "npc_quiz.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + + CHAR_talkToCli( talker, -1, "", CHAR_COLORWHITE); + + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "QuizAddItem(->쵽ĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + + sprintf(token,"õ%s", ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + + CHAR_sendItemDataOne( talker, ret); + return TRUE; + +} + +int NPC_QuizRandAnswer(int p_no,int q_no, int mode, + char *work1,char *work2,char *work3) +{ + int ans; + int ra; + + ans = (rand() % mode) + 1; + if(ans == 1) { + if( Quiz[q_no].answerNo == 1) { + strcpy( work1, Quiz[q_no].select1); + if(mode == 2) { + strcpy( work2, Quiz[q_no].select2); + return ans; + } + ra = rand()%2; + + if(ra == 0) { + strcpy( work2, Quiz[q_no].select2); + strcpy( work3, Quiz[q_no].select3); + }else{ + strcpy( work2, Quiz[q_no].select3); + strcpy( work3, Quiz[q_no].select2); + } + }else if( Quiz[q_no].answerNo == 2) { + strcpy( work1, Quiz[q_no].select2); + if(mode == 2) { + strcpy( work2, Quiz[q_no].select1); + return ans; + } + + ra = rand()%2; + if(ra == 0) { + strcpy( work2, Quiz[q_no].select1); + strcpy( work3, Quiz[q_no].select3); + }else{ + strcpy( work2, Quiz[q_no].select3); + strcpy( work3, Quiz[q_no].select1); + } + }else{ + strcpy( work1, Quiz[q_no].select3); + ra = rand()%2; + if(ra == 0) { + strcpy( work2, Quiz[q_no].select1); + strcpy( work3, Quiz[q_no].select2); + }else{ + strcpy( work2, Quiz[q_no].select1); + strcpy( work3, Quiz[q_no].select2); + } + } + }else if(ans == 2) { + if(Quiz[q_no].answerNo == 1) { + strcpy( work2, Quiz[q_no].select1); + if(mode == 2) { + strcpy( work1, Quiz[q_no].select2); + return ans; + } + ra=rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select2); + strcpy( work3, Quiz[q_no].select3); + }else { + strcpy( work1, Quiz[q_no].select3); + strcpy( work3, Quiz[q_no].select2); + } + }else if( Quiz[q_no].answerNo == 2) { + strcpy( work2, Quiz[q_no].select2); + if(mode == 2){ + strcpy( work1, Quiz[q_no].select1); + return ans; + } + ra = rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select1); + strcpy( work3, Quiz[q_no].select3); + }else { + strcpy( work1, Quiz[q_no].select3); + strcpy( work3, Quiz[q_no].select1); + } + }else { + strcpy( work2, Quiz[q_no].select3); + ra = rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select1); + strcpy( work3, Quiz[q_no].select2); + }else { + strcpy( work1, Quiz[q_no].select2); + strcpy( work3, Quiz[q_no].select1); + } + } + }else if(ans == 3) { + if( Quiz[q_no].answerNo == 1) { + strcpy( work3, Quiz[q_no].select1); + ra = rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select2); + strcpy( work2, Quiz[q_no].select3); + }else { + strcpy( work1, Quiz[q_no].select3); + strcpy( work2, Quiz[q_no].select2); + } + }else if( Quiz[q_no].answerNo == 2) { + strcpy( work3, Quiz[q_no].select2); + ra = rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select1); + strcpy( work2, Quiz[q_no].select3); + }else { + strcpy( work1, Quiz[q_no].select3); + strcpy( work2, Quiz[q_no].select1); + } + }else{ + strcpy( work3, Quiz[q_no].select3); + ra = rand()%2; + if(ra == 0) { + strcpy( work1, Quiz[q_no].select1); + strcpy( work2, Quiz[q_no].select2); + }else { + strcpy( work1, Quiz[q_no].select2); + strcpy( work2, Quiz[q_no].select1); + } + } + } + return ans; + +} + + +BOOL NPC_PlayerCheck(int meindex,int talker) + { + int i; + int k=0; + int *ptr; + struct pl Player; + + + NPC_RealyCheack( meindex, talker); + + for(i = 0 ; i < MEPLAYER ; i++){ + if( (CHAR_getWorkInt( meindex, CHAR_WORK_PLAYER1 +i ) == -1)) + { + break; + } + } + + if(i == MEPLAYER) return FALSE; + + + /*-- ƹ --*/ + if((ptr =(int *) calloc( 1,sizeof(struct pl))) == NULL){ + print("޷ȷ%s",CHAR_getChar(meindex,CHAR_NAME)); + return FALSE; + } + + /*-- ̼ë??-*/ + Player.ptr = ptr; + Player.talkerindex = talker; //npc̼͵??? + Player.quizno = 0; //ػ + Player.answer = 0; //ݩ + Player.ansno = 0; // įë ë±׶˱) + + for(k=0 ; k < OLDNO; k++) { + Player.oldno[k] = -1; + } + + /*--ƹë--*/ + memcpy(ptr,&Player,sizeof(struct pl)); + + + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTSEC,0); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT,0); + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANTTRD,0); + + + CHAR_setWorkInt( talker, CHAR_WORKSHOPRELEVANT, i); + + k= (int)ptr; + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + i, k ); + return TRUE; + +} + +int NPC_RealyCheack(int meindex,int talker) +{ + int fl, x, y; + int i, j; + int px[10] = {0, 1, 0,-1, 1,-1, 1, 0,-1}; + int py[10] = {0,-1,-1,-1, 0, 0, 1, 1, 1}; + int objindex; + + OBJECT object; + int talkerindex; + BOOL okflg = FALSE; + struct pl PLAYER; + int *pl_ptr; + int point; + + fl = CHAR_getInt( meindex, CHAR_FLOOR); + + for(j = 0 ; j < MEPLAYER ; j++) { + point = CHAR_getWorkInt( meindex, CHAR_WORK_PLAYER1 + j); + okflg = FALSE; + if(point == -1) continue; + + pl_ptr = (int *)point; + + memcpy(&PLAYER, pl_ptr, sizeof(struct pl)); + talkerindex = PLAYER.talkerindex; + + for(i=0 ; i < 10 ; i++) { + x = px[i] + CHAR_getInt( meindex, CHAR_X); + y = py[i] + CHAR_getInt( meindex, CHAR_Y); + + for(object = MAP_getTopObj(fl,x,y) ; object; + object = NEXT_OBJECT( object)) + { + objindex = GET_OBJINDEX( object); + + if( OBJECT_getType( objindex) == OBJTYPE_CHARA ){ + if( OBJECT_getIndex( objindex) == talkerindex) { + if(talkerindex == talker) { + okflg = TRUE; +// print("\n %s %d",CHAR_getChar(talker,CHAR_NAME),(int)PLAYER.ptr); + free(PLAYER.ptr); + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + j,-1); + }else{ + okflg = TRUE; + } + break; + } + } + } + if(okflg == TRUE) break; + } + + if(okflg ==FALSE){ +// print("\n %s %d",CHAR_getChar(talker,CHAR_NAME),(int)PLAYER.ptr); + free(PLAYER.ptr); + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + j,-1); + } + + } + + return -1; +} + +BOOL QUIZ_initQuiz( char *filename) +{ + + FILE* f; + char line[512]; + char buf2[512], buf3[128]; + char buf[512]; + int i, linenum=0; + f = fopen(filename,"r"); + if( f == NULL ){ + print( "file open error\n"); + return FALSE; + } + while( fgets( line, sizeof( line ), f ) ){ + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + linenum ++; + quizcnt++; + } + + if( fseek( f, 0, SEEK_SET ) == -1 ){ + fprint( "Seek Error\n" ); + fclose(f); + return FALSE; + } + + Quiz = allocateMemory( sizeof(NPC_QUIZ) * (quizcnt+1) ); + if( Quiz == NULL ){ + fprint( "Can't allocate Memory %d\n", sizeof(Quiz) * (quizcnt+1)); + fclose( f ); + return FALSE; + } + linenum = 0; + memset( buf3, 0, sizeof(buf3)); + while( fgets( line, sizeof( line ), f ) ){ + if( line[0] == '#' )continue; + if( line[0] == '\n' )continue; + chomp( line ); + replaceString( line, '\t' , ' ' ); + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) { + strcpy( line, buf); + } + + if( getStringFromIndexWithDelim( line, ",", 1, buf2, sizeof(buf2)) == FALSE ) continue; + Quiz[linenum].no = atoi(buf2); + + if( getStringFromIndexWithDelim( line, ",", 2, buf2, sizeof(buf2)) == FALSE ) continue; + Quiz[linenum].type = atoi(buf2); + + if( getStringFromIndexWithDelim( line, ",", 3, buf2, sizeof(buf2)) == FALSE ) continue; + Quiz[linenum].level = atoi(buf2); + + if( getStringFromIndexWithDelim( line, ",", 4, buf2, sizeof(buf2)) == FALSE ) continue; + Quiz[linenum].answertype = atoi(buf2); + + if( getStringFromIndexWithDelim( line, ",", 5, buf2, sizeof(buf2)) == FALSE ) continue; + Quiz[linenum].answerNo = atoi(buf2); + + if( getStringFromIndexWithDelim( line, ",", 6, buf2, sizeof(buf2)) == FALSE ) continue; + memcpy( Quiz[linenum].question, buf2, sizeof( Quiz[linenum].question)); + + + if( getStringFromIndexWithDelim( line, ",", 7, buf3, sizeof(buf3)) == FALSE ) continue; + memcpy( Quiz[linenum].select1, buf3, sizeof( Quiz[linenum].select1)); + if( getStringFromIndexWithDelim( line, ",", 8, buf3, sizeof(buf3)) == FALSE ) continue; + memcpy( Quiz[linenum].select2, buf3, sizeof( Quiz[linenum].select2)); + if( getStringFromIndexWithDelim( line, ",", 9, buf3, sizeof(buf3)) == FALSE ) continue; + memcpy( Quiz[linenum].select3, buf3, sizeof( Quiz[linenum].select3)); + + if(Quiz[linenum].answertype == 1){ + if(Quiz[linenum].answerNo == 3){ + return FALSE; + } + } + + if(Quiz[linenum].answertype == 4){ + if(Quiz[linenum].answerNo != 1){ + return FALSE; + } + } + linenum ++; +// quizcnt++; + } + if( quizcnt < linenum ){ + print("ERR linenum:%d >= quizcnt:%d\n", linenum, quizcnt); + return FALSE; + } + + quizcnt = linenum; + fclose( f); + return TRUE; + +} + +int *NPC_GetQuestion(int meindex) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int i,j; + int type=0; + int answer=0; + int level=0; + int *tbl; + char buf[16]; + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if(NPC_Util_GetStrFromStrWithDelim(argstr,"Type",buf, sizeof( buf)) != NULL ){ + type = atoi(buf); + } + if( type <= 0){ + type = 0xffff; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "Answer", buf, sizeof( buf)) != NULL){ + answer = atoi(buf); + } + if(answer <= 0){ + answer = 0xffff; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "Level", buf, sizeof( buf)) != NULL ){ + level = atoi(buf); + } + if(level <= 0){ + level = 0xffff; + } + for(j=0,i=0; i < quizcnt ;i++){ + if( (type & (1 << (Quiz[i].type-1))) != (1 << (Quiz[i].type-1))){ + continue; + } + if((answer & (Quiz[i].answertype)) != Quiz[i].answertype){ + continue; + } + if((level & (Quiz[i].level)) != Quiz[i].level){ + continue; + } + j++; + } + + { + int tmp_tbl[j+1]; + tmp_tbl[0] = j+1; + for(j=1,i=0; i < quizcnt ;i++){ + if( (type & (1 << (Quiz[i].type-1))) != (1 << (Quiz[i].type-1))){ + continue; + } + + if((answer & (Quiz[i].answertype)) != Quiz[i].answertype){ + continue; + } + + if((level & (Quiz[i].level)) != Quiz[i].level){ + continue; + } + tmp_tbl[j] = i; + + j++; + } + + tbl = tmp_tbl; + return tbl; + } +} + +BOOL NPC_QuizItemFullCheck(int meindex,int talker) +{ + int i; + int itemindex; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf2[32]; + + + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex = CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ) { + return TRUE; + } + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) + { + print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME)); + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryItem", buf2, sizeof( buf2)) != NULL) + { + if(NPC_EntryItemCheck( talker, buf2) == FALSE){ + NPC_Quiz_selectWindow( meindex, talker, 3); + return FALSE; + + }else{ + return TRUE; + } + } + + + return FALSE; + +} + + +/* + *ż + */ +BOOL NPC_EntryStoneCheck(int talker,char *buf) +{ + int stone; + int cost; + + cost= atoi( buf); + stone = CHAR_getInt( talker, CHAR_GOLD); + + if(cost > stone){ + return FALSE; + } + + return TRUE; +} + +/* + *ż + */ +BOOL NPC_EntryStoneDel(int talker,char *buf) +{ + int stone; + int cost; + char token[256]; + + cost= atoi( buf); + stone = CHAR_getInt( talker, CHAR_GOLD); + + if((stone-cost) < 0){ + CHAR_setInt( talker, CHAR_GOLD, 0); + }else{ + CHAR_DelGold( talker, cost ); + } + + sprintf( token, "%d stone", cost); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; +} + + +/* + */ +BOOL NPC_EntryItemDel(int talker,char *buf) +{ + + int i = 1, j = 1,k = 1; + char buff3[128]; + char buf2[32]; + int itemindex; + + + while(getStringFromIndexWithDelim(buf , "," , k, buff3, sizeof(buff3)) !=FALSE ){ + k++; + if(strstr(buff3, "*") !=NULL){ + int itemno; + int kosuu; + int id; + int cnt=0; + getStringFromIndexWithDelim(buff3,"*",1,buf2,sizeof(buf2)); + itemno = atoi(buf2); + getStringFromIndexWithDelim(buff3,"*",2,buf2,sizeof(buf2)); + kosuu = atoi(buf2); + for( i =0 ; i < CHAR_MAXITEMHAVE ; i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id=ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno==id){ + cnt++; + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ’o */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ̷ة?į */ +#endif + "QuizDelItem(->ĵ)", + CHAR_getInt( talker, CHAR_FLOOR), + CHAR_getInt( talker, CHAR_X ), + CHAR_getInt( talker, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + + CHAR_DelItem( talker, i); + if(cnt == kosuu){ + break; + } + } + } + } + }else{ + for( j = 0 ; j < CHAR_MAXITEMHAVE ; j++){ + itemindex = CHAR_getItemIndex( talker ,j); + + if( ITEM_CHECKINDEX(itemindex) ){ + if( atoi( buff3) == ITEM_getInt(itemindex,ITEM_ID)){ + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ’o */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ̷ة?į */ +#endif + "QuizDelItem(->쵽ĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_DelItem( talker, j); + } + } + } + } + } + + return TRUE; +} + +/* + */ +BOOL NPC_EntryItemCheck(int talker,char *buf) +{ + + char buf2[512]; + char buf3[256]; + int id=0; + BOOL flg = FALSE; + int i; + int itemindex; + int itemno; + int kosuu; + int cnt=0; + int k=1; + + while(getStringFromIndexWithDelim(buf , "," , k, buf2, sizeof(buf2)) + !=FALSE ) + { + flg = FALSE; + k++; + + if(strstr(buf2,"*") != NULL){ + cnt = 0; + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemno = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id = ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno == id){ + cnt++; + if(cnt == kosuu){ + flg = TRUE; + break; + } + } + } + } + if(flg == FALSE) + { + return FALSE; + } + }else{ + itemno = atoi(buf2); + + for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){ + itemindex = CHAR_getItemIndex( talker , i ); + if( ITEM_CHECKINDEX(itemindex) ){ + id = ITEM_getInt(itemindex ,ITEM_ID ); + if(itemno == id){ + flg = TRUE; + break; + } + } + } + + if(flg == FALSE) + { + return FALSE; + } + } + } + + return TRUE; + +} + +/* + */ +BOOL NPC_QUIZPARTY_CHAECK(int meindex,int talker) +{ + + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + return FALSE; + } + + return TRUE; + +} + diff --git a/npc/npc_riderman.c b/npc/npc_riderman.c new file mode 100644 index 0000000..c314fd4 --- /dev/null +++ b/npc/npc_riderman.c @@ -0,0 +1,887 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_riderman.h" +#include "family.h" +#include "log.h" + +extern int familyNumTotal; +extern char familyListBuf[MAXFAMILYLIST]; +extern tagRidePetTable ridePetTable[296]; +extern struct FM_POINTLIST fmpointlist; + +char sendbuf[1024]; +char buf[1024]; +char subbuf[128]; +int i, j; + +/* + * ɬýľūëNPC + * + */ + +struct { + int windowno; + int windowtype; + int buttontype; + int takeitem; + int giveitem; + int takegold; + char message[4096]; + int letter[4]; +}w; + +struct { + BOOL use; + int checkhaveitem; + int checkhaveitemgotowin; + int checkdonthaveitem; + int checkdonthaveitemgotowin; + int warp; + int battle; + int gotowin; +}buttonproc[13]; /* ok,cancel, yes,no,prev,next ݼ */ + + + + + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; + +static void NPC_Riderman_selectWindow( int meindex, int toindex, int num); +static BOOL NPC_Riderman_readData( int meindex, int windowno, BOOL chkflg); +static int NPC_Riderman_restoreButtontype( char *data ); +// static BOOL getLetter(int meindex,int talker ); +// static BOOL checkLetter(int meindex,int talker ); + +/********************************* +*********************************/ +BOOL NPC_RidermanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + //int i; + //char secondToken[1024]; + + // Robin test + // print(" riderman_Init "); + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf))== NULL ) + { + print( "riderman:ûָ趨ĵ \n"); + return FALSE; + } + /* ݱɬ÷ëƻ֧ */ + if( !NPC_Riderman_readData( meindex, -1, TRUE) ) { + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); + + return TRUE; +} + + + + +/********************************* +*********************************/ +void NPC_RidermanTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + //print(" Rideman_fmindex:%d ", CHAR_getInt( meindex, CHAR_FMINDEX) ); + + NPC_Riderman_selectWindow( meindex, talkerindex, 1 ); + +} +/********************************* +*********************************/ +void NPC_RidermanLooked( int meindex , int lookedindex) +{ + + //print(" Look:me:%d,looked:%d ",meindex,lookedindex); + NPC_Riderman_selectWindow( meindex, lookedindex,1 ); + +} + +static void NPC_Riderman_selectWindow( int meindex, int toindex, int num) +{ + + int fd; + char buf[256]; + + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; + + if( !NPC_Riderman_readData( meindex, num, FALSE) ) { + print( "riderman:readdata error\n"); + return; + } + + fd = getfdFromCharaIndex( toindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } +} + +void NPC_RidermanWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) + +{ + + + int button = -1; + char buf[512]; + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + if( !NPC_Riderman_readData( meindex, seqno - 100, FALSE) ) { + print( "riderman:readdata error\n"); + return; + } + /* ʾëƩ */ + if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { + button = atoi( data)+5; + if( button > 12 ) { + print( "riderman:invalid button[%d]\n", button); + return; + } + } + else if( select & WINDOW_BUTTONTYPE_OK) button = 0; + else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; + else if( select & WINDOW_BUTTONTYPE_YES) button = 2; + else if( select & WINDOW_BUTTONTYPE_NO) button = 3; + else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; + else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; + else { + print( "riderman:invalid button[%d]\n", select); + return; + } + if( buttonproc[button].use == TRUE ) { + int fd; + int newwin = -1; + + fd = getfdFromCharaIndex( talkerindex); + + if( newwin == -1 ) { + newwin = buttonproc[button].gotowin; + } + + + //print(" takegold:%d ", w.takegold ); + + // Robin + // ѧϰ Lv 40 + if( newwin == 6 ) { + + int charImg; + // int i, petindex, bFind = 0; + + charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER); + if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) >= 40 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѾѧѽ\nҪѧˡ", + buf, sizeof(buf))); + return; + } + + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) + { + char buf2[512]; + + sprintf( buf2, "\nܱǸรѧѲ㣡\nѧϰ˳Ҫ%dʯҡ", w.takegold); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( buf2, buf, sizeof(buf))); + return; + } + CHAR_DelGold( talkerindex, w.takegold ); + + CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 40 ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); + + //sprintf( buf, "R|L|1" ); + //lssproto_FM_send( fd, buf ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( + "\n\nϲ㣡Ѿ˳ˡ\n Lv40 µij\nСร", + buf, sizeof(buf))); + + // + { + int fmindex, fmindexi, village, i; + char fmname[256], token[256], buf2[64]; + + sprintf( buf2, "%d", w.takegold/5 ); + for( i=0 ; i= 80 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѾѧмѽ\nҪѧˡ", + buf, sizeof(buf))); + return; + } + else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 40 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѧмࡡ", + buf, sizeof(buf))); + return; + } + + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) + { + char buf2[512]; + + sprintf( buf2, "\nܱǸรѧѲ㣡\nѧϰ˳мҪ%dʯ", w.takegold); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( buf2, buf, sizeof(buf))); + return; + } + CHAR_DelGold( talkerindex, w.takegold ); + + CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 80 ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); + + //sprintf( buf, "R|L|1" ); + //lssproto_FM_send( fd, buf ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nϲ㣡Ѿмˡ\n Lv80 µij\nСร", + buf, sizeof(buf))); + + // + { + int fmindex, fmindexi, village, i; + char fmname[256], token[256], buf2[64]; + + sprintf( buf2, "%d", w.takegold/5 ); + for( i=0 ; i= 120 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѾѧ߼ѽ\nҪѧˡ", + buf, sizeof(buf))); + return; + } + else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 80 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѧм߼ࡡ", + buf, sizeof(buf))); + return; + } + + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) + { + char buf2[512]; + + sprintf( buf2, "\nܱǸรѧѲ㣡\nѧϰ˳߼Ҫ%dʯ", w.takegold); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( buf2, buf, sizeof(buf))); + return; + } + CHAR_DelGold( talkerindex, w.takegold ); + + CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 120 ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); + + //sprintf( buf, "R|L|1" ); + //lssproto_FM_send( fd, buf ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nϲ㣡Ѿ˸߼ˡ\n Lv120 µij\nСร", + buf, sizeof(buf))); + + // + { + int fmindex, fmindexi, village, i; + char fmname[256], token[256], buf2[64]; + + sprintf( buf2, "%d", w.takegold/5 ); + for( i=0 ; i 199 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѾѧؼѽ\nҪѧˡ", + buf, sizeof(buf))); + return; + } + else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 120 ) + { + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nѧ߼ؼࡡ", + buf, sizeof(buf))); + return; + } + + if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold ) + { + char buf2[512]; + + sprintf( buf2, "\nܱǸรѧѲ㣡\nѧϰ˳ؼҪ%dʯ", w.takegold); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( buf2, buf, sizeof(buf))); + return; + } + CHAR_DelGold( talkerindex, w.takegold ); + + CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 200 ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD ); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE ); + + //sprintf( buf, "R|L|1" ); + //lssproto_FM_send( fd, buf ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, -1, -1, + makeEscapeString( "\n\nϲ㣡Ѿؼˡ\nеȼij\nСร", + buf, sizeof(buf))); + + // + { + int fmindex, fmindexi, village, i; + char fmname[256], token[256], buf2[64]; + + sprintf( buf2, "%d", w.takegold/5 ); + for( i=0 ; i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_rmbshop.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//صشøнڽ"ʦ" +#ifdef _RMB_SYSTEM +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_PREV, + WINDOW_NEXT, + WINDOW_WARP, + WINDOW_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +#define STANDBYTIME 50 + +static void NPC_RmbShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL RmbShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token, int index ); +int RmbShop_ShowMenulist( char *npcarg ); + +int page; + +BOOL NPC_RmbshopInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_RmbshopTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_RmbshopWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_TRANSERMAN_SELECT: + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_TRANSERMAN_WARP: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_PREV, atoi( data)); + return; + } + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_WARP, atoi( data)); + break; + case NPC_TRANSERMAN_END: + NPC_RmbShop_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } + +} + +static void NPC_RmbShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf1[256]; + char buf2[256]; + char buf3[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + static int select1; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("RmbShop_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("RmbShop Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_SELECT; + break; + case WINDOW_SELECT: + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 0); + page=RmbShop_ShowMenulist(npcarg); + if( RmbShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "RmbShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(page>1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_NEXT: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<=page) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if( RmbShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "RmbShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1==page) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_PREV: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)>0) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if( RmbShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "RmbShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==0) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_WARP: + select1=CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)*7+select; + CHAR_setWorkInt( toindex, CHAR_WORKLISTSELECT , select1); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "END_MSG", buf1, sizeof( buf1) ) == NULL) { + print("RmbShop Get START_MSG ERROR !"); + return; + } + if(getStringFromIndexWithDelim( npcarg,"}",select1, buf2, sizeof( buf2)) != FALSE) + NPC_Util_GetStrFromStrWithDelim( buf2, "MenuStr", buf3, sizeof( buf3)); + sprintf( token, "\n%s\n\n %s\n",buf1, buf3); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_END; + break; + case WINDOW_END: + ActionNpc_CheckMenuFree( meindex, toindex, npcarg, CHAR_getWorkInt( toindex, CHAR_WORKLISTSELECT )); + return; + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_RmbshopLoop( int meindex) +{ + +} + +BOOL RmbShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token,int index ) +{ + char buf1[1024], buf2[32], buf3[36]; + BOOL FINDS=FALSE; + int talkNo=index*7+1; + if( npcarg == NULL ) return FALSE; + + sprintf( token, "㵱ǰֽ:%d %d/%dҳ\n",sasql_rmbpoint(CHAR_getUseID(toindex),0,0), index+1, page); + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + memset( buf2, 0, sizeof( buf2)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL ) + continue; + FINDS = TRUE; + + sprintf( buf3, " %s", buf2); + if(strlen(buf3)<10) + strcat( buf3, "\n"); + else + strcat( buf3, "\n"); + strcat( token, buf3); + if(talkNo>(index*7+7))return FINDS; + } + return FINDS; +} + +int RmbShop_ShowMenulist( char *npcarg ) +{ + char buf1[1024]; + int talkNo=1; + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + } + return (talkNo-3)/7+1; +} + +#endif + + diff --git a/npc/npc_roomadminnew.c b/npc/npc_roomadminnew.c new file mode 100644 index 0000000..c6b7c20 --- /dev/null +++ b/npc/npc_roomadminnew.c @@ -0,0 +1,967 @@ +#include "version.h" + +#include +#include +#include +#include +#include + +#include "object.h" +#include "char.h" +#include "char_base.h" +#include "char_data.h" +#include "net.h" +#include "npcutil.h" +#include "handletime.h" +#include "readmap.h" +#include "npc_roomadminnew.h" +#include "npc_door.h" + + +/* + * + */ + + +enum{ + CHAR_WORKINT_RANGE = CHAR_NPCWORKINT1, + /* ݼ */ + CHAR_WORKINT_NEXTTIME = CHAR_NPCWORKINT2, + CHAR_WORKINT_PRINTCLOSETIME = CHAR_NPCWORKINT3, + CHAR_WORKINT_SEARCHROOMTIME = CHAR_NPCWORKINT4, + +}; +enum { + CHAR_WORKCHAR_MYNAME = CHAR_NPCWORKCHAR1, + CHAR_WORKCHAR_NEXTROOM = CHAR_NPCWORKCHAR2, + +}; + +enum { + CHAR_WORKCHAR_ADMNAME = CHAR_NPCWORKCHAR1, +}; + + +#define NPC_ROOMADMINNEW_DATADIR "roomadmin/" +/* ̻P */ +#define NPC_ROOMADMINNEW_EXTENSION ".room" +#define NPC_ROOMADMINNEW_RANKING_EXTENSION ".score" +#define NPC_ROOMADMINNEW_RANKING_EXTENSION_TMP ".score.tmp" +#define NPC_ROOMADMINNEW_SCOREFILE ".score" +#define NPC_ROOMADMINNEW_PRINTCLOSETIME_DEFAULT 5 + +#define NPC_ROOMADMINNEW_MSG_CLOSE_BEFORE \ +"%s %s %sĻֹ%dǰ" +#define NPC_ROOMADMINNEW_MSG_CLOSE \ +"ѽֹ" +#define NPC_ROOMADMINNEW_MSG_NONE \ +"ܿϧû˻÷ӵȨ" +#define NPC_ROOMADMINNEW_MSG_CONGRATULATION \ +"ϲ%s÷Ȩ%sĽǮȫˡ%sԱѯʷ䰵š" +#define NPC_ROOMADMINNEW_MSG_PRINTPASSWD_NONE \ +"δзûаš" +#define NPC_ROOMADMINNEW_MSG_DSPPASSWD1 \ +"ķ %s %s %s" +#define NPC_ROOMADMINNEW_MSG_DSPPASSWD2 \ +"İ %s ֻҪڶ˵ʱβϡ...˾Ϳࡣ" +#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION_NONE \ +"յĻ" +#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION1 \ +"ķ %s %s %s" +#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION2 \ +"ֹ %d:%d ֹΪֹ%2dСʱ%02d֡" +#define NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION3 \ +"͵ñ %s " + +#define NPC_ROOMADMINNEW_MSG_RANKING_INFO \ +"Ǹ߶ñа" +#define NPC_ROOMADMINNEW_MSG_RANKING \ +"Rank %2d:%4d/%02d/%02d %8d GOLD %s%s " + +/* NPC */ +#define NPC_ROOMADMINNEW_MSGCOLOR CHAR_COLORWHITE +#define NPC_RANKING_MSGCOLOR CHAR_COLORWHITE +#define NPC_ROOMADMINNEW_2WEEK 60*60*24*14 + +static void NPC_RoomAdminNew_DspNextAuction( int meindex, int talkerindex); +static void NPC_RoomAdminNew_DspRoomPasswd( int meindex, int adminindex, int talkerindex); +static BOOL NPC_RoomAdminNew_SetNextAuction( int meindex); +static BOOL NPC_RoomAdminNew_WriteDataFile( int meindex, int pindex, char *roomname, + char *passwd, BOOL flg); +static void NPC_RoomAdminNew_CreatePasswd( char *passwd, int passlen); +static void NPC_RoomAdminNew_SendMsgThisFloor( int index, char *buff); +static int NPC_RoomAdminNew_SearchPlayerHasMostMoney( int meindex); +static void NPC_RoomAdminNew_CloseProc( int meindex); +static int NPC_RoomAdminNew_WriteScoreFile( int meindex, int pindex); +static void NPC_RoomAdminNew_ReadScoreFile( int meindex, int talkerindex, + char *admname); + +/************************************************ + ************************************************/ +BOOL NPC_RoomAdminNewInit( int meindex ) +{ + int i; + char buf[256]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + for( i = 3; ; i ++ ) { + if( getStringFromIndexWithDelim(argstr, "|" , i , buf,sizeof(buf) )) { + if( NPC_DoorSearchByName( buf) < 0 ) { + print( "admin not created.֮ǰȵȴ\n"); + return FALSE; + } + } + else{ + break; + } + } + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + + /* type */ + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEROOMADMIN); + getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) ); + CHAR_setWorkInt( meindex , CHAR_WORKINT_RANGE , atoi( buf )); + if( !getStringFromIndexWithDelim(argstr, "|" , 2 , buf,sizeof(buf) )) { + print( "arg err.admin not created.\n"); + return( FALSE); + } + CHAR_setWorkChar( meindex , CHAR_WORKCHAR_MYNAME , buf); + + CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, 0); + + NPC_RoomAdminNew_SetNextAuction( meindex); + + return TRUE; +} +/************************************************ + ************************************************/ +void NPC_RoomAdminNewLoop( int meindex ) +{ + int hun; + if( CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) == 0 ) { + struct tm tm1,tm2; + time_t t; + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + t = CHAR_getWorkInt( meindex, CHAR_WORKINT_SEARCHROOMTIME); + memcpy( &tm2, localtime( &t), + sizeof( tm2)); + if( tm1.tm_year != tm2.tm_year || + tm1.tm_mday != tm2.tm_mday || + tm1.tm_mon != tm2.tm_mon ) + { + NPC_RoomAdminNew_SetNextAuction( meindex); + } + return; + } + + hun = ceil((double)(CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) - + NowTime.tv_sec) / 60.0); + if( hun < 0 ) hun = 0; + + if( hun < NPC_ROOMADMINNEW_PRINTCLOSETIME_DEFAULT ) { + if( hun != CHAR_getWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME)) { + char buff[256]; + if( hun != 0 ) { + char buf2[1024]; + char msgbuff[16]; + char argstr2[NPC_UTIL_GETARGSTR_BUFSIZE]; + int doorindex; + + doorindex = NPC_DoorSearchByName( CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM)); + NPC_Util_GetArgStr( doorindex, argstr2, sizeof( argstr2)); + getStringFromIndexWithDelim( argstr2, "|" , 9 , + buf2,sizeof(buf2) ); + if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) { + strcpy( msgbuff, ""); + } + else { + msgbuff[0] = '\0'; + } + snprintf( buff, sizeof(buff), + NPC_ROOMADMINNEW_MSG_CLOSE_BEFORE, + buf2, + CHAR_getChar( doorindex, CHAR_NAME), + msgbuff, + hun); + + CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, hun); + } + else { + /* 󻻧Իף */ + strcpy( buff, NPC_ROOMADMINNEW_MSG_CLOSE); + CHAR_setWorkInt( meindex, CHAR_WORKINT_PRINTCLOSETIME, 0); + } + /* 𼰰׷ʧ幻˪ */ + NPC_RoomAdminNew_SendMsgThisFloor( meindex, buff); + } + } + if( hun == 0 ) { + NPC_RoomAdminNew_CloseProc( meindex); + } +} + +/************************************************ + ************************************************/ +void NPC_RoomAdminNewTalked( int meindex , int talkerindex , char *msg , + int color ) +{ + + if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return; + + /*NPC_RoomAdminNew_DspRoomPasswd( meindex, talkerindex);*/ + + NPC_RoomAdminNew_DspNextAuction( meindex, talkerindex); +} +/*----------------------------------------------- + *----------------------------------------------*/ +static void NPC_RoomAdminNew_CloseProc( int meindex) +{ + int pindex; + char buff[256]; + char pname[32]; + int failed = TRUE; + + pindex = NPC_RoomAdminNew_SearchPlayerHasMostMoney( meindex); + /* 񲷮ʧ */ + if( pindex != -1) { + while( 1) { + char passwd[9]; + int doorindex; + doorindex = NPC_DoorSearchByName( + CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM)); + /* ɵëϷ */ + NPC_RoomAdminNew_CreatePasswd( passwd, sizeof( passwd)); + if( NPC_RoomAdminNew_WriteDataFile( meindex, pindex, + CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM), + passwd, 1) + == FALSE) + { + break; + } + /* ʧɵë */ + if( NPC_DoorSetPasswd( doorindex, passwd) == -1 ) { + break; + } + CHAR_setWorkInt( doorindex, CHAR_WORKDOOREXPIRETIME, + CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) + + NPC_ROOMADMINNEW_2WEEK); + NPC_RoomAdminNew_WriteScoreFile( meindex, pindex); + + CHAR_setInt( pindex, CHAR_GOLD, 0); + + CHAR_send_P_StatusString( pindex , CHAR_P_STRING_GOLD); + + strcpy( pname, CHAR_getChar( pindex, CHAR_NAME)); + snprintf( buff, sizeof(buff), + NPC_ROOMADMINNEW_MSG_CONGRATULATION, pname, pname, pname); + failed = FALSE; + break; + } + } + + if( failed) { + NPC_RoomAdminNew_WriteDataFile( meindex, -1, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM), NULL, 0); + /* 񲷮϶ */ + snprintf( buff, sizeof(buff), + NPC_ROOMADMINNEW_MSG_NONE); + } + /* 𼰰׷ʧ幻˪ */ + NPC_RoomAdminNew_SendMsgThisFloor( meindex, buff); + + NPC_RoomAdminNew_SetNextAuction( meindex); + +} +/*----------------------------------------------- + *----------------------------------------------*/ +static int NPC_RoomAdminNew_SearchPlayerHasMostMoney( int meindex) +{ + int i,j, range; + int fl,x,y, gold; + int doorindex; + int topindex; + + fl = CHAR_getInt( meindex, CHAR_FLOOR); + x = CHAR_getInt( meindex, CHAR_X); + y = CHAR_getInt( meindex, CHAR_Y); + range = CHAR_getWorkInt( meindex , CHAR_WORKINT_RANGE); + topindex = -1; + + doorindex = NPC_DoorSearchByName( CHAR_getWorkChar( meindex, + CHAR_WORKCHAR_NEXTROOM)); + gold = atoi( CHAR_getWorkChar( doorindex, CHAR_WORKDOORGOLDLIMIT)); + for( i = x-range ; i <= x+range ; i++ ){ + for( j = y-range ; j <= y+range ; j ++ ){ + OBJECT object; + for( object = MAP_getTopObj( fl, i,j); object; + object = NEXT_OBJECT(object) ) + { + int objindex = GET_OBJINDEX( object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + int index; + index = OBJECT_getIndex(objindex); + if( CHAR_getInt( index, + CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) + { + if( CHAR_getInt( index, CHAR_GOLD) >= gold ) { + if( topindex == -1 ) { + topindex = index; + } + else { + int nowgold,topgold; + nowgold = CHAR_getInt( index, CHAR_GOLD ); + topgold = CHAR_getInt( topindex, CHAR_GOLD); + if( nowgold > topgold ) { + topindex = index; + } + else if( nowgold == topgold ) { + /* ئìﻥ */ + int nowlv, toplv; + nowlv = CHAR_getInt( index, CHAR_LV ); + toplv = CHAR_getInt( topindex, CHAR_LV); + if( nowlv < toplv ) { + topindex = index; + } + /* ľƥݩئئշ¼ĸةԪ*/ + /* indexƼлнǷ */ + else if( nowlv == toplv ) { + if( RAND( 0,1)) { + topindex = index; + } + } + } + } + } + } + } + } + } + } + return( topindex); +} +/*----------------------------------------------- + * ϶ýľindex׷ʧ幻 + *----------------------------------------------*/ +static void NPC_RoomAdminNew_SendMsgThisFloor( int index, char *buff) +{ + int i, fl; + int playernum = CHAR_getPlayerMaxNum(); + + fl = CHAR_getInt( index, CHAR_FLOOR); + for( i = 0; i < playernum; i ++ ) { + if( CHAR_getInt( i, CHAR_FLOOR) == fl ) { + if( CHAR_getInt( i, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) { + CHAR_talkToCli( i, index, buff, NPC_ROOMADMINNEW_MSGCOLOR); + } + } + } +} +/*----------------------------------------------- + *----------------------------------------------*/ +static void NPC_RoomAdminNew_CreatePasswd( char *passwd, int passlen) +{ +#define NPC_ROOMADMINNEW_RAND() ( (rand() /256) % 32768 ) /* 256ƥ¼Ѽ ߤ׻ */ + int i; + char *candidates[]= { + "A","B","D", "E","F","G","H", "J","K","L","M", "N","P","Q","R", + "T","W","X","Y", "a","b","d","e", "f","g","m","n", "q","r","t", + "0","1","2", "3","4","5","6", "7","8","9" + }; + strcpy( passwd , ""); + for(i = 0;i < passlen -1 ; i++){ + strcat( passwd , candidates[ NPC_ROOMADMINNEW_RAND() % (sizeof( candidates)/sizeof(candidates[0])) ] ); + } +#undef NPC_ROOMADMINNEW_RAND +} +/*----------------------------------------------- + * + * + * cdkey|charaname|passwd|expiretime + * + * + *----------------------------------------------*/ +static BOOL NPC_RoomAdminNew_WriteDataFile( int meindex, int pindex, + char *roomname, + char *passwd, int flg) +{ + char *cdkey; + char charaname[32*2]; + char expiretime[64]; + char filename[128]; + char outbuf[1024]; + FILE *fp_src; + + strcpy( filename, NPC_ROOMADMINNEW_DATADIR); + /*strcat( filename, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));*/ + strcat( filename, roomname); + strcat( filename, NPC_ROOMADMINNEW_EXTENSION); + + if( flg) { + //getcdkeyFromCharaIndex( pindex, cdkey, sizeof(cdkey )); + cdkey = CHAR_getChar( pindex, CHAR_CDKEY); + makeEscapeString( CHAR_getChar( pindex, CHAR_NAME), + charaname, sizeof( charaname)); + /* ľ */ + snprintf( expiretime, sizeof( expiretime), "%d", + CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME) + + NPC_ROOMADMINNEW_2WEEK /* ԉ */ + ); + + /* ƥ */ + snprintf( outbuf, sizeof( outbuf), "%s|%s|%s|%s|", + cdkey, charaname, passwd, expiretime); + fp_src = fopen( filename, "w"); + if( !fp_src) { + print( "[%s:%d] File Open Error\n", __FILE__, __LINE__); + return FALSE; + } + fputs( outbuf, fp_src); + fclose( fp_src); + } + else { + unlink( filename); + } + + return TRUE; + +} +/*----------------------------------------------- + *----------------------------------------------*/ +BOOL NPC_RoomAdminNew_ReadFile( char *roomname, NPC_ROOMINFO *data) +{ + FILE *fp; + char line[1024]; + char buf2[128]; + char filename[128]; + + strcpy( filename, NPC_ROOMADMINNEW_DATADIR); + strcat( filename, roomname); + strcat( filename, NPC_ROOMADMINNEW_EXTENSION); + + fp = fopen( filename, "r"); + if( !fp) return FALSE; + fgets( line, sizeof( line), fp); + /* */ + getStringFromIndexWithDelim( line, "|" , 1 , buf2,sizeof(buf2) ); + strcpy( data->cdkey, buf2); + getStringFromIndexWithDelim( line, "|" , 2 , buf2,sizeof(buf2) ); + strcpy( data->charaname, makeStringFromEscaped( buf2)); + getStringFromIndexWithDelim( line, "|" , 3 , buf2,sizeof(buf2) ); + strcpy( data->passwd, buf2); + getStringFromIndexWithDelim( line, "|" , 4 , buf2,sizeof(buf2) ); + if( strcmp( buf2, "max") == 0 ) { + data->expire = 0xffffffff; + } + else { + data->expire = atoi( buf2); + } + fclose( fp); + return TRUE; +} +/*----------------------------------------------- + *----------------------------------------------*/ +static BOOL NPC_RoomAdminNew_SetNextAuction( int meindex) +{ + int i, j; + int hitindex = -1; + int charnum = CHAR_getCharNum(); + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + struct tm tmwk; + + memcpy( &tmwk, localtime( ( time_t *)&NowTime.tv_sec), sizeof( tmwk)); + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + */ + for( i = CHAR_getPlayerMaxNum()+ CHAR_getPetMaxNum(); + i < charnum; + i ++ ) + { + if( CHAR_getInt( i, CHAR_WHICHTYPE) != CHAR_TYPEDOOR) { + continue; + } + if( CHAR_getWorkInt( i, CHAR_WORKDOORPASSFLG) == 0 ) { + continue; + } + for( j = 3; ; j ++ ) { + int rc; + char *doorname; + char buf[256]; + int dataexist; + NPC_ROOMINFO data; + + rc = getStringFromIndexWithDelim( argstr, "|" , j, + buf,sizeof(buf) ); + if( rc != TRUE ) { + break; + } + doorname = CHAR_getWorkChar( i, CHAR_WORKDOORNAME); + if( strcmp( buf, doorname ) != 0 ) { + continue; + } + if( atoi( CHAR_getWorkChar( i, CHAR_WORKDOORWEEK)) != tmwk.tm_wday) { + break; + } + /* ɱ */ + memset( &data, 0, sizeof( data)); + if( NPC_RoomAdminNew_ReadFile( doorname, &data) ) { + struct tm tmdoor; + * ׻ľհ̻ë + */ + if( data.expire < NowTime.tv_sec) { + NPC_RoomAdminNew_WriteDataFile( meindex, -1,doorname, NULL, 0); + /* ʧľб*/ + NPC_DoorSetPasswd( i, "8hda8iauia90494jasd9asodfasdf89"); + CHAR_setWorkInt( i, CHAR_WORKDOOREXPIRETIME, 0xffffffff); + + break; + } + memcpy( &tmdoor, localtime( ( time_t *)&data.expire), sizeof( tmdoor)); + if( tmdoor.tm_mon != tmwk.tm_mon || + tmdoor.tm_mday != tmwk.tm_mday) + { + break; + } + dataexist = TRUE; + } + else { + dataexist = FALSE; + } + if( tmwk.tm_hour > atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))){ + break; + } + if( tmwk.tm_hour == atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))) { + if( tmwk.tm_min >= atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE))) { + break; + } + } + /* ƥԻؤڳʧݷ·ɡ + */ + if( hitindex == -1 ) { + hitindex = i; + } + else { + if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR)) + > atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))) + { + hitindex = i; + } + else if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR)) + == atoi( CHAR_getWorkChar( i, CHAR_WORKDOORHOUR))) + { + if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE)) + > atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE))) + { + hitindex = i; + } + else if( atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE)) + == atoi( CHAR_getWorkChar( i, CHAR_WORKDOORMINUTE))) + { + NPC_ROOMINFO datawk; + int hitindexdataexist; + hitindexdataexist = NPC_RoomAdminNew_ReadFile( + CHAR_getWorkChar( hitindex, CHAR_WORKDOORNAME), + &datawk); + if( hitindexdataexist < dataexist ) { + hitindex = i; + } + + } + } + } + } + } + if( hitindex > 0 ) { + /* ë */ + tmwk.tm_sec = 0; + tmwk.tm_min = atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORMINUTE)); + tmwk.tm_hour = atoi( CHAR_getWorkChar( hitindex, CHAR_WORKDOORHOUR)); + CHAR_setWorkInt( meindex, CHAR_WORKINT_NEXTTIME, mktime( &tmwk)); + CHAR_setWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM, + CHAR_getWorkChar( hitindex, CHAR_WORKDOORNAME)); + + } + else { + CHAR_setWorkInt( meindex, CHAR_WORKINT_NEXTTIME, 0); + CHAR_setWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM,"" ); + + } + /* ë */ + CHAR_setWorkInt( meindex, CHAR_WORKINT_SEARCHROOMTIME, NowTime.tv_sec); + return( TRUE); +} +/*----------------------------------------------- + *----------------------------------------------*/ +static void NPC_RoomAdminNew_DspRoomPasswd( int index, int adminindex, int talkerindex) +{ + int i, rc, flg = FALSE; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char argstr2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char *cdkey; + char buf[128]; + char buff[16]; + char buf2[1024]; + + NPC_ROOMINFO info; + + //getcdkeyFromCharaIndex( talkerindex, cdkey, sizeof(cdkey)); + cdkey = CHAR_getChar( talkerindex, CHAR_CDKEY); + + NPC_Util_GetArgStr( adminindex, argstr, sizeof( argstr)); + for( i = 3; ; i ++ ) { + if( getStringFromIndexWithDelim(argstr, "|" , i , buf,sizeof(buf) )) { + rc = NPC_RoomAdminNew_ReadFile( buf, &info); + if( rc == TRUE ) { + if( strcmp( info.cdkey, cdkey) == 0 && + strcmp( info.charaname, + CHAR_getChar( talkerindex, CHAR_NAME)) == 0 ) + { + int doorindex; + char msgbuf[256]; + doorindex = NPC_DoorSearchByName( buf); + NPC_Util_GetArgStr( doorindex, argstr2, sizeof( argstr2)); + getStringFromIndexWithDelim( argstr2, "|" , 9 , + buf2,sizeof(buf2) ); + if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) { + strcpy( buff, ""); + } + else { + buff[0] = '\0'; + } + + /* Ȿ */ + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPPASSWD1, + buf2, + CHAR_getChar( doorindex, CHAR_NAME), + buff + ); + /* ˪ */ + CHAR_talkToCli( talkerindex, index,msgbuf, + NPC_ROOMADMINNEW_MSGCOLOR); + + /* Ȿ */ + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPPASSWD2, + CHAR_getWorkChar(doorindex, CHAR_WORKDOORPASSWD) + ); + /* ˪ */ + CHAR_talkToCli( talkerindex, index,msgbuf, + NPC_ROOMADMINNEW_MSGCOLOR); + flg = TRUE; + } + } + } + else { + break; + } + } + if( !flg) { + CHAR_talkToCli( talkerindex, index, + NPC_ROOMADMINNEW_MSG_PRINTPASSWD_NONE, + NPC_ROOMADMINNEW_MSGCOLOR); + } +} +/*----------------------------------------------- + *----------------------------------------------*/ +static void NPC_RoomAdminNew_DspNextAuction( int meindex, int talkerindex) +{ + char msgbuf[2048]; + time_t closetime; + + closetime = CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME); + if( closetime == 0 ) { + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION_NONE + ); + CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR); + } + else { + int doorindex; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[16]; + struct tm tmwk; + int difftime; + doorindex = NPC_DoorSearchByName( + CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM)); + NPC_Util_GetArgStr( doorindex, argstr, sizeof( argstr)); + getStringFromIndexWithDelim(argstr, "|" , 9 , explain,sizeof(explain)); + if( strlen(CHAR_getChar( doorindex, CHAR_NAME) ) != 0 ) { + strcpy( buff, ""); + } + else { + buff[0] = '\0'; + } + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION1, + explain, + CHAR_getChar( doorindex, CHAR_NAME), + buff + ); + CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR); + /* 󻻧Ի */ + memcpy( &tmwk, localtime( &closetime), sizeof( tmwk)); + difftime = closetime - NowTime.tv_sec; + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION2, + tmwk.tm_hour, + tmwk.tm_min, + difftime / 3600, + (difftime % 3600) / 60 + ); + CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR); + + /* Ʊź */ + snprintf( msgbuf, sizeof( msgbuf), + NPC_ROOMADMINNEW_MSG_DSPNEXTAUCTION3, + CHAR_getWorkChar( doorindex, CHAR_WORKDOORGOLDLIMIT) + ); + CHAR_talkToCli( talkerindex, meindex,msgbuf, NPC_ROOMADMINNEW_MSGCOLOR); + } + +} +/*----------------------------------------------- + * + * + * gold|time|cdkey|charaname|owntitle + * + *----------------------------------------------*/ +static int NPC_RoomAdminNew_WriteScoreFile( int meindex, int pindex) +{ +#define NPC_RANKING_DEFAULT 10 + int ret = 0; + char *cdkey; + char charaname[32*2],owntitle[32*2]; + char filename_dest[128],filename[128]; + char outbuf[1024], line[1024]; + FILE *fp_src, *fp_dest; + + strcpy( filename, NPC_ROOMADMINNEW_DATADIR); + strcat( filename, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_MYNAME)); + strcpy( filename_dest, filename); + strcat( filename, NPC_ROOMADMINNEW_RANKING_EXTENSION); + strcat( filename_dest, NPC_ROOMADMINNEW_RANKING_EXTENSION_TMP); + + //getcdkeyFromCharaIndex( pindex , cdkey , sizeof(cdkey )); + cdkey = CHAR_getChar( pindex, CHAR_CDKEY); + + makeEscapeString( CHAR_getChar( pindex, CHAR_NAME), + charaname, sizeof( charaname)); + + makeEscapeString( CHAR_getChar( pindex, CHAR_OWNTITLE), + owntitle, sizeof( owntitle)); + + /* ƥ */ + snprintf( outbuf, sizeof( outbuf), "%d|%d|%s|%s|%s|\n", + CHAR_getInt( pindex, CHAR_GOLD), + CHAR_getWorkInt( meindex,CHAR_WORKINT_NEXTTIME), + cdkey, charaname, owntitle ); + + + fp_dest = fopen( filename_dest, "w"); + if( !fp_dest) return -1; + + fp_src = fopen( filename, "r"); + if( !fp_src ) { + fclose( fp_dest); + fp_src = fopen( filename, "w"); + if( !fp_src) return -1; + fputs( outbuf, fp_src); + fclose( fp_src); + return 1; + } + else { + int cnt = 1; + char buf[128]; + while( fgets( line, sizeof( line), fp_src)) { + getStringFromIndexWithDelim( line, "|" , 1 , buf,sizeof(buf) ); + if( ret == 0 ) { + if( atoi( buf) < CHAR_getInt( pindex, CHAR_GOLD) ) { + fputs( outbuf, fp_dest); + fputs( line, fp_dest); + ret = cnt; + cnt ++; + } + else { + /* ľ½̤ */ + fputs( line, fp_dest); + } + } + else { + /* ľ½̤ */ + fputs( line, fp_dest); + } + cnt ++; + if( cnt > NPC_RANKING_DEFAULT ) break; + } + /* ¼ƽ뻥۹ǷȻئ */ + if( ret == 0 && cnt <= NPC_RANKING_DEFAULT ) { + fputs( outbuf, fp_dest); + ret = cnt; + } + } + fclose( fp_src); + fclose( fp_dest); + fp_src = fopen( filename_dest, "r"); + if( !fp_src) return -1; + fp_dest = fopen( filename, "w"); + if( !fp_dest) { + fclose( fp_src); + return -1; + } + while( fgets( line, sizeof( line), fp_src)) { + fputs( line, fp_dest); + } + fclose( fp_dest); + fclose( fp_src); + return( ret); +#undef NPC_RANKING_DEFAULT +} +/*----------------------------------------------- + * + * + *----------------------------------------------*/ +static void NPC_RoomAdminNew_ReadScoreFile( int meindex, int talkerindex, + char *admname) +{ + int cnt; + char filename[128]; + char line[1024]; + FILE *fp; + + strcpy( filename, NPC_ROOMADMINNEW_DATADIR); + strcat( filename, admname); + strcat( filename, NPC_ROOMADMINNEW_RANKING_EXTENSION); + + fp = fopen( filename, "r"); + if( !fp) return; + cnt = 1; + while( fgets( line, sizeof( line), fp)) { + int gold,bidtime; + char charaname[32],owntitle[32]; + char tmp[64]; + char outbuf[1024], buf[256]; + struct tm tmwk; + + getStringFromIndexWithDelim( line, "|" , 1 , buf,sizeof(buf) ); + gold = atoi(buf); + getStringFromIndexWithDelim( line, "|" , 2 , buf,sizeof(buf) ); + bidtime = atoi(buf); + getStringFromIndexWithDelim( line, "|" , 4 , buf,sizeof(buf) ); + strcpy( charaname, makeStringFromEscaped( buf)); + getStringFromIndexWithDelim( line, "|" , 5 , buf,sizeof(buf) ); + strcpy( owntitle, makeStringFromEscaped( buf)); + if( strlen( owntitle) != 0 ) { + strcpy( tmp, "["); + strcat( tmp, owntitle); + strcat( tmp, "] "); + strcpy( owntitle, tmp); + } + else { + strcpy( owntitle, " "); + } + memcpy( &tmwk, localtime( (time_t *)&bidtime), sizeof( tmwk)); + + snprintf( outbuf, sizeof( outbuf), + NPC_ROOMADMINNEW_MSG_RANKING, + cnt, + tmwk.tm_year + 1900, + tmwk.tm_mon+1, + tmwk.tm_mday, + gold,charaname,owntitle + ); + CHAR_talkToCli( talkerindex, meindex,outbuf, + NPC_RANKING_MSGCOLOR); + cnt ++; + } + fclose( fp); + +} +/************************************************ + ************************************************/ +BOOL NPC_RankingInit( int meindex ) +{ + char buf[256]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + + /* type */ + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPERANKING); + if( !getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) )) { + print( "arg err.rankingNPC not created.\n"); + return( FALSE); + } + CHAR_setWorkChar( meindex , CHAR_WORKCHAR_ADMNAME , buf); + + return TRUE; +} +/************************************************ + ************************************************/ +void NPC_RankingTalked( int meindex , int talkerindex , char *msg , + int color ) +{ + if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return; + + CHAR_talkToCli( talkerindex, meindex, + NPC_ROOMADMINNEW_MSG_RANKING_INFO, + NPC_RANKING_MSGCOLOR); + + NPC_RoomAdminNew_ReadScoreFile( meindex, talkerindex, + CHAR_getWorkChar( meindex, CHAR_WORKCHAR_ADMNAME)); + +} +/************************************************ + ************************************************/ +BOOL NPC_PrintpassmanInit( int meindex ) +{ + char buf[256]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + + /* type */ + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEPRINTPASSMAN); + if( !getStringFromIndexWithDelim(argstr, "|" , 1 , buf,sizeof(buf) )) { + print( "arg err.passmanNPC not created.\n"); + return( FALSE); + } + CHAR_setWorkChar( meindex , CHAR_WORKCHAR_ADMNAME , buf); + + return TRUE; +} +/************************************************ + ************************************************/ +void NPC_PrintpassmanTalked( int meindex , int talkerindex , char *msg , + int color ) +{ + int i; + int charnum; + if(NPC_Util_CharDistance( talkerindex, meindex ) > 2)return; + + charnum = CHAR_getCharNum(); + for(i= CHAR_getPlayerMaxNum() +CHAR_getPetMaxNum(); + i +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "npc_oldman.h" +#include "title.h" +#include "char_data.h" +#include "readmap.h" +#include "lssproto_serv.h" +#include "log.h" + +#define RANGE 2 + + +void NPC_SetFlg(int talker,int shiftbit); +BOOL NPC_CheckFlg(int point,int shiftbit); +BOOL NPC_SavePointItemCheck(int meindex,int talker,int itemno,int kosuu); +void NPC_MessageDisp(int meindex,int talker,int MseNo); +BOOL NPC_UsedCheck(int meindex,int talker,int flg); +BOOL NPC_SavePointItemDelete(int meindex,int talker,int itemNo,int kosuu); + +extern time_t initTime; + + +int playeronlinenum=0; + + +BOOL NPC_SavePointInit( int meindex ) +{ + int oldmanid=0, bornfl=0, bornx=0 ,borny=0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[32]; + char buf2[512]; + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_Savepoint.c Init: GetArgStrErr"); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ID",buf2,sizeof( buf2) )==NULL){ + print("SavePoint:IDδ趨 "); + return FALSE; + } + + oldmanid=atoi(buf2); + NPC_Util_GetStrFromStrWithDelim(argstr,"Born",buf2,sizeof( buf2) ); + getStringFromIndexWithDelim( buf2,",",1,token,sizeof(token)); + bornfl = atoi( token ); + getStringFromIndexWithDelim( buf2,",",2,token,sizeof(token)); + bornx = atoi( token ); + getStringFromIndexWithDelim( buf2,",",3,token,sizeof(token)); + borny = atoi( token ); + + CHAR_setWorkInt( meindex , CHAR_WORKOLDMANID ,oldmanid ); + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESAVEPOINT ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 1 ); + + if( MAP_IsValidCoordinate( bornfl,bornx,borny )== TRUE + && CHAR_ElderSetPosition( oldmanid ,bornfl,bornx, borny ) == TRUE ){ + return TRUE; + }else{ + printf( "Invalid elder npcarg=%s\n", argstr ); + return FALSE; + } +} + +void NPC_SavePointTalked( int meindex , int talkerindex , char *msg , + int color ) +{ + int fd; + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[512]; + char buf2[1024]; + char timeMsg[1024]; + int oldmanid; + + if( ! NPC_Util_charIsInFrontOfChar(talkerindex,meindex,RANGE) + || CHAR_getFlg( talkerindex,CHAR_ISDIE )){ + if( (CHAR_getInt(talkerindex,CHAR_X) == CHAR_getInt(meindex,CHAR_X)) + && (CHAR_getInt(talkerindex,CHAR_Y) == CHAR_getInt(meindex,CHAR_Y)) + && (CHAR_getInt(talkerindex,CHAR_FLOOR) ==CHAR_getInt(meindex,CHAR_FLOOR)) ){ + }else{ + return; + } + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_Savepoint.c TypeCheck: GetArgStrErr\n"); + return ; + } + + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ID",buf2,sizeof( buf2) )==NULL) return ; + oldmanid=atoi(buf2); + + if(strstr(argstr,"NOITEM")!=NULL) { + NPC_SetFlg(talkerindex,oldmanid); + } + +#ifndef _FREE_SAVE + if(NPC_CheckFlg(CHAR_getInt(talkerindex,CHAR_SAVEPOINT),oldmanid)==FALSE){ + + if(NPC_UsedCheck(meindex,talkerindex,0)==TRUE){ + NPC_MessageDisp(meindex,talkerindex,2); + }else{ + NPC_MessageDisp(meindex,talkerindex,0); + } + }else +#endif + { + CHAR_setInt( talkerindex, CHAR_LASTTALKELDER ,CHAR_getWorkInt( meindex, CHAR_WORKOLDMANID ) ); + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { +#ifndef _NPC_NOSAVEPOINT + Char *chwk; + chwk = CHAR_getCharPointer( talkerindex); + // CoolFish: +1 2001/11/05 + if (!chwk) return; + + CHAR_charSaveFromConnectAndChar( fd, chwk ,FALSE ); + // Nuke 0907: For acsv test + { + CHAR_charSaveFromConnectAndChar( fd, chwk ,FALSE ); + } +#endif + } + + NPC_Util_GetStrFromStrWithDelim(argstr,"NomalMsg",token,sizeof( token) ); + sprintf(buf2,token,CHAR_getChar(talkerindex,CHAR_NAME)); + + // Robin 0619 display time + { + time_t new_t; + int dd,hh,mm,ss; + + time(&new_t); + new_t-=initTime; + + dd=(int) new_t / 86400; new_t=new_t % 86400; + hh=(int) new_t / 3600; new_t=new_t % 3600; + mm=(int) new_t / 60; new_t=new_t % 60; + ss=(int) new_t; +#ifdef _SAVE_GAME_ID + if (dd>0) { + snprintf( timeMsg, sizeof( timeMsg ) , + "%sѾ %d %d Сʱ %d %d 롣",getGameserverID(),dd,hh,mm,ss); + } else if (hh>0) { + snprintf( timeMsg, sizeof( timeMsg ) , + "%sѾ %d Сʱ %d %d 롣",getGameserverID(),hh,mm,ss); + } else { + snprintf( timeMsg, sizeof( timeMsg ) , + "%sѾ %d %d 롣",getGameserverID(),mm,ss); + } + strcat(buf2,timeMsg); +#else + if (dd>0) { + snprintf( timeMsg, sizeof( timeMsg ) , + "Ѿ %d %d Сʱ %d %d 롣",dd,hh,mm,ss); + } else if (hh>0) { + snprintf( timeMsg, sizeof( timeMsg ) , + "Ѿ %d Сʱ %d %d 롣",hh,mm,ss); + } else { + snprintf( timeMsg, sizeof( timeMsg ) , + "Ѿ %d %d 롣",mm,ss); + } + strcat(buf2,timeMsg); +#endif + } + { + char temp[1024]; + //char *answer;// CoolFish: Rem 2001/4/18 + extern unsigned int StateTable[]; + // Robin 03/20 ܵ͸ҹˮ!!!! + +#ifdef _PLAYER_NUM + if(getPlayerNum()>0){ + int playernum = abs(StateTable[LOGIN])+getPlayerNum()+playeronlinenum; + if(atof(getPlayerBase())>1.0) playernum = playernum * atof(getPlayerBase()) + 0.5; + sprintf(temp,"ĿǰΪ %d ˡ",playernum); + }else{ + int playernum = abs(StateTable[LOGIN])+playeronlinenum; + if(atof(getPlayerBase())>1.0) playernum = playernum * atof(getPlayerBase()) + 0.5; + sprintf(temp,"ĿǰΪ %d ˡ",playernum); + } +#else + sprintf(temp,"ĿǰΪ %d ˡ",abs(StateTable[LOGIN])); +#endif + + strcat(buf2,temp); + + } + { + char savetemp[1024]; + sprintf(savetemp,"ϵͳԶΪ浵"); + strcat(buf2,savetemp); + } + //fd = getfdFromCharaIndex( talkerindex); + CHAR_charSaveFromConnect(talkerindex, FALSE); + CHAR_talkToCli( talkerindex , meindex , buf2 , CHAR_COLORWHITE ); + + } + + + +} + + +/*----------------------------------------- + * +-------------------------------------------*/ +void NPC_SavePointWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + + if(seqno==CHAR_WINDOWTYPE_WINDOWSAVEPOINT_START){ + if(select==WINDOW_BUTTONTYPE_YES){ + if(NPC_UsedCheck(meindex,talkerindex,1)==TRUE){ + NPC_MessageDisp(meindex,talkerindex,1); + } + } + } + + +} + + +/* + */ +BOOL NPC_AndReduce(int meindex,int talker,char *buf,int flg) +{ + + char buf2[512]; + char buf3[256]; + int itemNo=0; + int kosuu; + int j=1; + + if(flg==0){ + + while(getStringFromIndexWithDelim(buf,"&",j,buf2,sizeof(buf2))!=FALSE) + { + j++; + if(strstr( buf2, "*") != NULL){ + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemNo = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + + /*--ƹ--*/ + if(NPC_SavePointItemCheck(meindex,talker,itemNo,kosuu)==FALSE){ + return FALSE; + } + + }else{ + itemNo = atoi(buf2); + + /*--ƹ--*/ + if(NPC_SavePointItemCheck(meindex,talker,itemNo,1)==FALSE){ + return FALSE; + } + + } + } + + }else{ + if(strstr( buf, "*") != NULL){ + getStringFromIndexWithDelim(buf,"*",1,buf3,sizeof(buf3)); + itemNo = atoi(buf3); + getStringFromIndexWithDelim(buf,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + /*--ƹ--*/ + if(NPC_SavePointItemCheck(meindex,talker,itemNo,kosuu)==FALSE){ + return FALSE; + } + + }else{ + itemNo = atoi(buf); + /*--ƹ--*/ + if(NPC_SavePointItemCheck(meindex,talker,itemNo,1)==FALSE){ + return FALSE; + } + } + + } + + + return TRUE; +} + + +BOOL NPC_AndReduceDelete(int meindex,int talker,char *buf,int flg) +{ + + char buf2[512]; + char buf3[256]; + int itemNo=0; + int kosuu; + int j=1; + + if(flg==0){ + + while(getStringFromIndexWithDelim(buf,"&",j,buf2,sizeof(buf2))!=FALSE) + { + j++; + if(strstr( buf2, "*") != NULL){ + getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3)); + itemNo = atoi(buf3); + getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + /*--ƹ--*/ + if(NPC_SavePointItemDelete(meindex,talker,itemNo,kosuu)==FALSE){ + return FALSE; + } + + }else{ + itemNo = atoi(buf2); + /*--ƹ--*/ + if(NPC_SavePointItemDelete(meindex,talker,itemNo,1)==FALSE){ + return FALSE; + } + + } + } + + }else{ + if(strstr( buf, "*") != NULL){ + getStringFromIndexWithDelim(buf,"*",1,buf3,sizeof(buf3)); + itemNo = atoi(buf3); + getStringFromIndexWithDelim(buf,"*",2,buf3,sizeof(buf3)); + kosuu = atoi(buf3); + + /*--ƹ--*/ + if(NPC_SavePointItemDelete(meindex,talker,itemNo,kosuu)==FALSE){ + return FALSE; + } + + }else{ + itemNo = atoi(buf); + + /*--ƹ--*/ + if(NPC_SavePointItemDelete(meindex,talker,itemNo,1)==FALSE){ + return FALSE; + } + } + + } + + + return TRUE; +} + + + +/* + * ëέ׾ + */ +BOOL NPC_UsedCheck(int meindex,int talker,int flg) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[128]; + char buf2[512]; + int i=1; + int checkflg=0; + + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_savePoint.c UseCheck: GetArgStrErr"); + return FALSE; + } + + if(NPC_Util_GetStrFromStrWithDelim(argstr,"GetItem",buf,sizeof( buf) )!=NULL) + { + i=1; + while( getStringFromIndexWithDelim(buf,",",i,buf2,sizeof(buf2)) !=FALSE ) + { + i++; + if(strstr( buf2, "&") != NULL){ + + if(NPC_AndReduce( meindex, talker, buf2,0)==TRUE) + { + checkflg=1; + break; + } + }else{ + if(NPC_AndReduce( meindex, talker, buf2,1)==TRUE) + { + checkflg=2; + break; + } + } + } + if(checkflg==0) return FALSE; + } else return TRUE; // Arminius 2.5 û GetItem һɴ + + if(flg==1){ + if(checkflg==1){ + if(NPC_AndReduceDelete(meindex,talker,buf2,0)==FALSE){ + return FALSE; + } + }else{ + if(NPC_AndReduceDelete(meindex,talker,buf2,1)==FALSE){ + return FALSE; + } + } + } + + return TRUE; + +} + + + +void NPC_MessageDisp(int meindex,int talker,int MesNo) +{ + + int fd = getfdFromCharaIndex( talker); + int buttontype=WINDOW_BUTTONTYPE_OK; + int windowtype=WINDOW_MESSAGETYPE_MESSAGE; + int windowno=CHAR_WINDOWTYPE_WINDOWSAVEPOINT_START; + + char token[1024]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[32]; + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("NPC_savePoint.c UseCheck: GetArgStrErr"); + return ; + } + + switch(MesNo){ + case 0:/*-- ۢئʧ ةëȻ¾-*/ + NPC_Util_GetStrFromStrWithDelim(argstr,"RequestMsg",token,sizeof( token) ); + + break; + + case 1:/*-- ۢئʧ ةëȻ¾-*/ + NPC_Util_GetStrFromStrWithDelim(argstr,"OkMsg",token,sizeof( token) ); + NPC_Util_GetStrFromStrWithDelim(argstr,"ID",buf,sizeof( buf) ); + NPC_SetFlg(talker,atoi(buf)); + /*--Ƥؤ--*/ + /* ئƾ׹ƱмIDëʢ */ + CHAR_setInt( talker, CHAR_LASTTALKELDER ,CHAR_getWorkInt( meindex, CHAR_WORKOLDMANID ) ); + + /* Ƥ */ + /* ƻ·ڻئмƥʧئ */ + fd = getfdFromCharaIndex( talker); + if( fd != -1 ) { +#ifndef _NPC_NOSAVEPOINT + Char *chwk; + chwk = CHAR_getCharPointer( talker); + // CoolFish: +1 2001/11/05 + if (!chwk) return; + CHAR_charSaveFromConnectAndChar( fd, chwk ,FALSE ); +#endif + } + + break; + + case 2:/*-- ۢئʧ ةëȻ¾-*/ + NPC_Util_GetStrFromStrWithDelim(argstr,"RealyMsg",token,sizeof( token) ); + buttontype=WINDOW_BUTTONTYPE_YESNO; + break; + + } + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + +} + +BOOL NPC_SavePointItemDelete(int meindex,int talker,int itemNo,int kosuu) +{ + int i; + int itemindex; + int id; + int cnt=0; + + for( i=CHAR_STARTITEMARRAY;i +#include "char.h" +#include "object.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "handletime.h" +#include "npc_scheduleman.h" +#include "family.h" + +/* + * PK ǼԱ + * + * npc ʾҵǼǼ pk ų + * pk ųһСʱһ pk ΪԭŶ pk , ɵǼԱ + * Ǽ趨Ҫ趨 FamilyPKSchedule + * + * ǼԱͬʱὫ schedule дŵ Game Server + * Ļȶһݶսų̱ͬʱų̡ + * ųֻŴڿʼ 24 Сʱ֮ڵ + * ų̱ĸʽΪ: + * + * time|host_index|host_name|guest_index|guest_name|prepare_time|max_player|flag|win + * + * : ǼԱ¥_ǼԱX_ǼԱY + * + */ + +// ȫļ pk +FamilyPKSchedule fmpks[MAX_SCHEDULE*MAX_SCHEDULEMAN]; + +extern int familyNumTotal; + +enum { + NPC_WORK_ID = CHAR_NPCWORKINT1, // ǼԱ ID, 0 ʼ + NPC_WORK_CHALLENGETIMEOUT = CHAR_NPCWORKINT2, // ͬս timeout + NPC_WORK_SETTINGTIMEOUT = CHAR_NPCWORKINT3, // 趨ս timeout + NPC_WORK_PREVIOUSCHECKTIME = CHAR_NPCWORKINT4, // һμʱ + NPC_WORK_FIGHTINTERVAL = CHAR_NPCWORKINT5, // PK εļ (λ: ) +}; + +enum { + CHAR_WORK_PAGE = CHAR_WORKSHOPRELEVANT, // ҳ + CHAR_WORK_DUELTIME = CHAR_WORKSHOPRELEVANTSEC, // ѡ pk ʱ +}; + +#define SCHEDULEFILEDIR "./Schedule/" + +void NPC_LoadPKSchedule(int meindex); // Load schedule from disk +void NPC_SavePKSchedule(int meindex); // save schedule to disk +void NPC_RemoveExpiredBattle(int meindex); // Ƴڵս +void NPC_ProcessTimeout(int meindex); // timeout +BOOL NPC_AlreadyScheduled(int meindex, int talkerindex); // , һֻܰһ +// ų̱ data +void NPC_LIST_gendata(int meindex, int talkerindex, int page, char *buf, int size); +// ѡ data +void NPC_SELECT_gendata(int meindex, int talkerindex, int page, char *buf, int size); +// ųϸ data +void NPC_DETAIL_gendata(int meindex, char *buf, int size, int dueltime); + +BOOL NPC_SchedulemanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + int meid; + int interval; + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEFMSCHEDULEMAN ); + CHAR_setWorkInt ( meindex, NPC_WORK_PREVIOUSCHECKTIME, -1); + + // + NPC_Util_GetArgStr(meindex, argstr, sizeof(argstr)); + meid = NPC_Util_GetNumFromStrWithDelim(argstr, "id" ); + if ((meid<0) || (meid>=MAX_SCHEDULEMAN)) { + print("SCHEDULEMAN init error: invalid ID(%d)\n",meid); + meid=0; + } + CHAR_setWorkInt(meindex, NPC_WORK_ID, meid); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "loopinterval" ); + if ((interval<100) || (interval>10000)) interval=1000; + CHAR_setInt(meindex, CHAR_LOOPINTERVAL, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "challengetimeout"); + if ((interval<60) || (interval>60*60)) interval=20*60; + CHAR_setWorkInt(meindex, NPC_WORK_CHALLENGETIMEOUT, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "settingtimeout"); + if ((interval<10) || (interval>60*60)) interval=60; + CHAR_setWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT, interval); + + interval = NPC_Util_GetNumFromStrWithDelim(argstr, "fightinterval"); + if ((interval<5) || (interval>60)) interval = 50; + CHAR_setWorkInt(meindex, NPC_WORK_FIGHTINTERVAL, interval); + + + NPC_LoadPKSchedule(meindex); + + return TRUE; +} + +void NPC_SchedulemanTalked(int meindex, int talkerindex, char *msg, int color) +{ + char buf[4096]; + int fd; + if (NPC_Util_CharDistance(meindex, talkerindex) > 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, 0); + NPC_LIST_gendata(meindex, talkerindex, 0, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); +} + +void NPC_SchedulemanWindowTalked(int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int page; + int buttontype; + char buf[4096],token[256]; + int fd,i,dt,a; + int fmpks_pos; + + if (NPC_Util_CharDistance(meindex,talkerindex) > 2) return; + if (!NPC_Util_isFaceToFace(meindex, talkerindex, 2)) return; + fd = getfdFromCharaIndex(talkerindex); + if (fd == -1) return; + fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + +// print("seqno=%d select=%d data=%s\n", seqno,select,data); + + switch (seqno) { + case CHAR_WINDOWTYPE_SCHEDULEMAN_START: + switch (select) { + case WINDOW_BUTTONTYPE_NEXT: + case WINDOW_BUTTONTYPE_PREV: + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE) + + MAXSCHEDULEINONEWINDOW + * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; + if (page<0) { + page=0; + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_CANCEL; + } + if (page>MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW) { + page=MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW; + buttontype=WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_CANCEL; + } + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, page); + // Send WN + NPC_LIST_gendata(meindex, talkerindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case WINDOW_BUTTONTYPE_OK: + +#ifdef _FMVER21 + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && +#else + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) && +#endif + + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)) { + // ֻѳ峤ʹýһĹ (趨ġͬ) + + // decide: send family list or detail or accept + dt=atoi(data); + for (i=0; iMAXFAMILYINONEWINDOW) + buttontype |= WINDOW_BUTTONTYPE_NEXT; + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULESELECTFAMILY, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + + } + break; + case FMPKS_FLAG_CHALLENGE: + { // 峤Ͷͬ pk˹ + int tkfmindex=CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI); + if (tkfmindex==fmpks[fmpks_pos+i].host_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SETTING; + fmpks[fmpks_pos+i].setting_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT); + // ͳϸб + CHAR_setWorkInt(talkerindex, CHAR_WORK_DUELTIME, dt); + NPC_DETAIL_gendata(meindex, buf, sizeof(buf), dt); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULEDETAIL, + WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_DETAIL, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } else if (tkfmindex==fmpks[fmpks_pos+i].guest_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SCHEDULED; + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_OK; + if (page<0) { + page=0; + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_OK; + } + if (page>MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW) { + page=MAX_SCHEDULE-MAXSCHEDULEINONEWINDOW; + buttontype=WINDOW_BUTTONTYPE_PREV | WINDOW_BUTTONTYPE_OK; + } + CHAR_talkToCli(talkerindex, meindex, + "ļѾս", CHAR_COLORWHITE); + // ͳ list + NPC_LIST_gendata(meindex, talkerindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULELIST, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_START, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + break; + case FMPKS_FLAG_SETTING: + { // 峤 + int tkfmindex=CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI); + if (tkfmindex==fmpks[fmpks_pos+i].host_index) { + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_SETTING; + fmpks[fmpks_pos+i].setting_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_SETTINGTIMEOUT); + // ͳϸб + CHAR_setWorkInt(talkerindex, CHAR_WORK_DUELTIME, dt); + NPC_DETAIL_gendata(meindex, buf, sizeof(buf), dt); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULEDETAIL, + WINDOW_BUTTONTYPE_OK | WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_SCHEDULEMAN_DETAIL, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + } + } + // WON ADD pkԼս + break; + } + + } + } + NPC_SavePKSchedule(meindex); + } else { +#ifdef _FMVER21 + if (CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)!=FMMEMBER_LEADER) { +#else + if (CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)!=1) { +#endif + CHAR_talkToCli(talkerindex, meindex, + "ֻ峤ԤԼУม", CHAR_COLORWHITE); + }else if (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)!=1) { + CHAR_talkToCli(talkerindex, meindex, + "ļ廹ûʽม", CHAR_COLORWHITE); + } + } + break; + } + break; + case CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT: + switch (select) { + case WINDOW_BUTTONTYPE_PREV: + case WINDOW_BUTTONTYPE_NEXT: + page=CHAR_getWorkInt(talkerindex, CHAR_WORK_PAGE) + + MAXFAMILYINONEWINDOW + * (( select == WINDOW_BUTTONTYPE_NEXT) ? 1 : -1); + buttontype=WINDOW_BUTTONTYPE_NEXT | WINDOW_BUTTONTYPE_PREV; + if (page<1) { + page=1; + buttontype=WINDOW_BUTTONTYPE_NEXT; + } + if (page>familyNumTotal-MAXFAMILYINONEWINDOW+1) { + page=familyNumTotal-MAXFAMILYINONEWINDOW+1; + buttontype=WINDOW_BUTTONTYPE_PREV; + } + CHAR_setWorkInt(talkerindex, CHAR_WORK_PAGE, page); + // Send WN + NPC_SELECT_gendata(meindex, talkerindex, page, buf, sizeof(buf)); + lssproto_WN_send(fd, WINDOW_MESSAGETYPE_PKSCHEDULESELECTFAMILY, + buttontype, + CHAR_WINDOWTYPE_SCHEDULEMAN_SELECT, + CHAR_getWorkInt(meindex, CHAR_WORKOBJINDEX), + buf); + break; + case WINDOW_BUTTONTYPE_OK: + +#ifdef _FMVER21 + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==FMMEMBER_LEADER) && +#else + if ((CHAR_getInt(talkerindex,CHAR_FMLEADERFLAG)==1) && +#endif + (CHAR_getWorkInt(talkerindex, CHAR_WORKFMSETUPFLAG)==1)) { + + dt=CHAR_getWorkInt(talkerindex, CHAR_WORK_DUELTIME); + for (i=0; i0) && (a<=40)) fmpks[fmpks_pos+i].prepare_time=a; + } + // + if (getStringFromIndexWithDelim(data,"|",5,token,sizeof(token))) { + a=atoi(token); +#ifdef _FMWAR_PLAYERNUM + if ((a>0) && (a<=getFmWarPlayerNum())) fmpks[fmpks_pos+i].max_player=a; +#else + if ((a>0) && (a<=50)) fmpks[fmpks_pos+i].max_player=a; +#endif + } + // ʤ + if (getStringFromIndexWithDelim(data,"|",6,token,sizeof(token))) { + a=atoi(token); + if ((a>=0) && (a<=1)) fmpks[fmpks_pos+i].win = a; + } + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_CHALLENGE; + fmpks[fmpks_pos+i].challenge_timeout= + CHAR_getWorkInt(meindex, NPC_WORK_CHALLENGETIMEOUT); + CHAR_talkToCli(talkerindex, meindex, + "ս趨ɡ", CHAR_COLORWHITE); + } + break; + case WINDOW_BUTTONTYPE_CANCEL: + fmpks[fmpks_pos+i].flag=FMPKS_FLAG_NONE; + fmpks[fmpks_pos+i].host_index=-1; + strcpy(fmpks[fmpks_pos+i].host_name,""); + fmpks[fmpks_pos+i].guest_index=-1; + strcpy(fmpks[fmpks_pos+i].guest_name,""); + CHAR_talkToCli(talkerindex, meindex, + "ս", CHAR_COLORWHITE); + break; + } + NPC_SavePKSchedule(meindex); + } + } + } + } + break; + } +} + +void NPC_SchedulemanLoop(int meindex) +{ +// int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + +/* + print("Scheduleman: fmpks_pos=%d dueltime=%d host=%s guest=%s\n", + fmpks_pos, fmpks[fmpks_pos].dueltime, fmpks[fmpks_pos].host_name, fmpks[fmpks_pos].guest_name); +*/ + + NPC_RemoveExpiredBattle(meindex); + NPC_ProcessTimeout(meindex); +} + +// Ƴڵս +void NPC_RemoveExpiredBattle(int meindex) +{ + struct tm tm1; + int keeptime; + int i,expired=-1; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + int prevckt = CHAR_getWorkInt(meindex, NPC_WORK_PREVIOUSCHECKTIME); + int fin = CHAR_getWorkInt(meindex, NPC_WORK_FIGHTINTERVAL); + int h,d; + + // Ŀǰʱ̵׼ȥƳڵų + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + + if (tm1.tm_min=60) keeptime = keeptime + 100 - 60; + } + if (fmpks[fmpks_pos].dueltime > keeptime) expired=23; + } + + if (expired>=0) { + // ƶųȡѾʧЧų + for (i=expired+1; i=60 ) h=h+100-60; + if (h>=2400) { + h = h-2400; + d = 10000; + } + fmpks[fmpks_pos+i].dueltime=d+h; + } + + // һų, Ŷ״Ϊų̡ + if (fmpks[fmpks_pos].flag < FMPKS_FLAG_SCHEDULED) { + fmpks[fmpks_pos].flag = FMPKS_FLAG_NONE; + fmpks[fmpks_pos+i].host_index=-1; + strcpy(fmpks[fmpks_pos+i].host_name,""); + fmpks[fmpks_pos+i].guest_index=-1; + strcpy(fmpks[fmpks_pos+i].guest_name,""); + } + + } +} + +// timeout +void NPC_ProcessTimeout(int meindex) +{ + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + + for (i=0; i=0) { + fmpks[fmpks_pos+i].challenge_timeout--; + if (fmpks[fmpks_pos+i].challenge_timeout<0) { + fmpks[fmpks_pos+i].host_index = -1; + strcpy(fmpks[fmpks_pos+i].host_name, "-1"); + fmpks[fmpks_pos+i].guest_index = -1; + strcpy(fmpks[fmpks_pos+i].guest_name, "-1"); + fmpks[fmpks_pos+i].prepare_time = -1; + fmpks[fmpks_pos+i].max_player = -1; + fmpks[fmpks_pos+i].flag=-1; + fmpks[fmpks_pos+i].win=-1; + } + } + } + if (fmpks[fmpks_pos+i].flag==FMPKS_FLAG_SETTING) { + if (fmpks[fmpks_pos+i].setting_timeout>=0) { + fmpks[fmpks_pos+i].setting_timeout--; + if (fmpks[fmpks_pos+i].setting_timeout<0) { + fmpks[fmpks_pos+i].host_index = -1; + strcpy(fmpks[fmpks_pos+i].host_name, "-1"); + fmpks[fmpks_pos+i].guest_index = -1; + strcpy(fmpks[fmpks_pos+i].guest_name, "-1"); + fmpks[fmpks_pos+i].prepare_time = -1; + fmpks[fmpks_pos+i].max_player = -1; + fmpks[fmpks_pos+i].flag=-1; + fmpks[fmpks_pos+i].win=-1; + } + } + } + } +} + +// , һֻܰһս +BOOL NPC_AlreadyScheduled(int meindex, int talkerindex) +{ + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + int tkfmindex = CHAR_getWorkInt(talkerindex, CHAR_WORKFMINDEXI); + int flag=1; + + for (i=0; i=FMPKS_FLAG_SCHEDULED) { + if (fmpks[fmpks_pos+i].host_index==tkfmindex) return TRUE; + } else if (fmpks[fmpks_pos+i].flag!=FMPKS_FLAG_NONE) { + if (flag==1) flag=0; else return TRUE; + } + } + return FALSE; +} + +// ȡ schedule +void NPC_LoadPKSchedule(int meindex) +{ + char filename[256],tmp[4096],token[256]; + FILE *f; + int i; + int fmpks_pos = CHAR_getWorkInt(meindex, NPC_WORK_ID)*MAX_SCHEDULE; + + snprintf(filename,sizeof(filename), "%s%d_%d_%d", + SCHEDULEFILEDIR, CHAR_getInt(meindex, CHAR_FLOOR), + CHAR_getInt(meindex, CHAR_X), + CHAR_getInt(meindex, CHAR_Y) ); + + if( ! (f=fopen( filename, "r" )) ){ // create new schedule file + f = fopen( filename, "w" ); + if( !f ){ + print( "ERROR:Can't create Schedule file %s!\n",filename ); + return; + } + for (i=0; i=MAX_SCHEDULE)) return; + + // ¼Ŀǰʱ + memcpy( &tm1, localtime( (time_t *)&NowTime.tv_sec), sizeof( tm1)); + sprintf(buf, "%d|", tm1.tm_hour*100 + tm1.tm_min); + + for (i=page; i +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "readmap.h" +// Arminius 8.4 manor +#include "family.h" + +static void NPC_SignBoard_Window( int meindex, int toindex, int num,int select); + + +/********************************* +*********************************/ +BOOL NPC_SignBoardInit( int meindex ) +{ + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + /*--ɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEMSG ); + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + return TRUE; + +} + + + + +/********************************* +*********************************/ +void NPC_SignBoardLooked( int meindex , int lookedindex) +{ + + if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if( NPC_Util_CharDistance( lookedindex, meindex ) > 1) return; + + + NPC_SignBoard_Window( meindex, lookedindex,0,-1); + +} + + +static void NPC_SignBoard_Window( int meindex, int toindex, int num,int select) +{ + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + int fd = getfdFromCharaIndex( toindex); + + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return; + } + + // Arminius: manor + { + char *p,*q; + extern struct FM_POINTLIST fmpointlist; + p=strstr(npcarg, "%manorid:"); + if (p!=NULL) { + char tmp[1024]; + int a; + + q=strstr(p+1,"%"); + if (q!=NULL) { + q[0]='\0'; + p[0]='\0'; + a=atoi(p+9); +#ifdef _FAMILY_MANORNUM_CHANGE // CoolFish ޸װ԰ + if ((a>=1) && (a<=MANORNUM)) { +#else + if ((a>=1) && (a<=4)) { +#endif + getStringFromIndexWithDelim(fmpointlist.pointlistarray[a-1], "|", 5, token, sizeof(token)); + if (atoi(token)>=0) { + getStringFromIndexWithDelim(fmpointlist.pointlistarray[a-1], "|", 6, token, sizeof(token)); + sprintf(tmp,"%s%s%s",npcarg,token,q+1); + strcpy(npcarg, tmp); + } else { + sprintf(tmp,"%sûκμ%s",npcarg,q+1); + strcpy(npcarg, tmp); + } + } + } + } + } + + sprintf(token, "塡\n%s",npcarg); + + /*--˪--*/ + lssproto_WN_send( fd,WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWPETSHOP_START, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + + + +/*----------------------------------------- + * +-------------------------------------------*/ +void NPC_SignBoardWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) { + return; + } +} + diff --git a/npc/npc_simpleshop.c b/npc/npc_simpleshop.c new file mode 100644 index 0000000..d258e4e --- /dev/null +++ b/npc/npc_simpleshop.c @@ -0,0 +1,726 @@ +#include "version.h" +#include + +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "item.h" +#include "util.h" +#include "handletime.h" +#include "anim_tbl.h" +#include "npc_door.h" +#include "lssproto_serv.h" +#include "npcutil.h" +#include "npccreate.h" +#include "log.h" + + +/* + * + * + * ì: init, talked, specialtalked + * + * + */ +static void NPC_SimpleShopOpenShopWindow( int meindex, int cliindex, + char *npcarg ); +static void NPC_SimpleShopGetEscapedItemString( int shopindex, + int cliindex, char *str ); +static BOOL NPC_SimpleShopProcessBuyMsg( char *msg, int shop, int cli ); +static BOOL NPC_SimpleShopProcessSellMsg( char *msg, int shop, int cli ); + +static BOOL NPC_LimitBuyInShopProcessSellMsg(char *msg,int shop,int cli); + + +static BOOL NPC_SimpleShopFillItem( int meindex, char *npcarg ); +static int NPC_SimpleShopGetItemNum( int meindex ); +static void NPC_SimpleShopNormalWindow( int meindex, + int playerindex, char *str ); +static int NPC_ShopWindowIndexToItemTableIndex( int charindex, + int shopwindowindex ); +static BOOL NPC_SimpleShopOpenShopOrNot( char *msg, char *openshopstr ); +//static void NPC_SimpleShopSetLeakLevel( int meindex ); + +#define NPC_SIMPLESHOPMAXBUYPRICE 9999 +#define SIMPLESHOPTALKBUFSIZE 256 + +#define SIMPLESHOP_FATALERRSTR "ʹԲ,״̫ѡ" + +#define SIMPLESHOP_MAXINFINITITEM 40 + +enum{ + OPENSHOPTOKEN=1, + MSGTOKEN, + MAINTOKEN, + BUYTOKEN, + OKBUYTOKEN, + SELLTOKEN, + OKSELLTOKEN, + POORTOKEN, + ITEMFULLTOKEN, + ANOTHERPLAYERTOKEN, + RAREITEMTOKEN, + THANKYOUTOKEN, + ITEMLISTTOKEN, + + BUYINITEMLISTTOKEN, + }; +void NPC_SimpleShopTalked( int meindex, int talker, char *msg, int color ) +{ +#define SHOPRANGE 3 + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE], token[NPC_UTIL_GETARGSTR_LINEMAX]; + if( CHAR_getInt( talker,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER ){ + return; + } + if( NPC_Util_charIsInFrontOfChar( talker, meindex, SHOPRANGE ) + && ! CHAR_getFlg( talker,CHAR_ISDIE ) ){ + NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)); + getStringFromIndexWithDelim( npcarg,"|", OPENSHOPTOKEN,token, sizeof(token)); + if( NPC_SimpleShopOpenShopOrNot( msg, token ) + && NPC_Util_isFaceToFace( meindex, talker, SHOPRANGE ) ){ + CHAR_setWorkInt( meindex, CHAR_WORKSHOPCLIENTINDEX, talker ); + NPC_SimpleShopOpenShopWindow( meindex, talker, npcarg ); + }else{ + int tokennum; + int i; + char tmp[NPC_UTIL_GETARGSTR_LINEMAX]; + getStringFromIndexWithDelim( npcarg,"|", MSGTOKEN,token, sizeof(token)); + tokennum = 1; + for( i=0;token[i]!='\0';i++ ){ + if( token[i] == ',' ) tokennum++; + } + getStringFromIndexWithDelim( token,",", rand()%tokennum+1,tmp, sizeof(tmp)); + CHAR_talkToCli( talker, meindex, tmp, CHAR_COLORWHITE ); + } + } +} + +void NPC_SimpleShopSpecialTalked( int meindex, int talker, char *msg, int color ) +{ + if( CHAR_getInt(talker,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER + && NPC_Util_isFaceToFace( meindex, talker, SHOPRANGE ) ){ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE], token[NPC_UTIL_GETARGSTR_LINEMAX]; + NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)); + switch( tolower(msg[0]) ){ + case 's': + { + int ret; + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX)!= talker ){ + getStringFromIndexWithDelim( npcarg,"|",ANOTHERPLAYERTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow( meindex, talker, token ); + return; + } + ret = getStringFromIndexWithDelim( msg, "|", 3, token, sizeof(token)); + if( ret == FALSE ){ + token[0] = 'e'; + token[1] = '\0'; + } + switch( tolower(token[0])){ + case 'b': + if( (ret=NPC_SimpleShopProcessBuyMsg(msg,meindex,talker)) + <0){ + switch( ret ){ + case -2: + getStringFromIndexWithDelim( npcarg,"|",POORTOKEN, + token,sizeof(token)); + NPC_SimpleShopNormalWindow( meindex,talker,token); + break; + case -3: + getStringFromIndexWithDelim( npcarg,"|", + ITEMFULLTOKEN, + token,sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + break; + case -1: + default: + NPC_SimpleShopNormalWindow(meindex, talker, + SIMPLESHOP_FATALERRSTR + ); + break; + } + }else{ + NPC_SimpleShopFillItem( meindex, npcarg ); + getStringFromIndexWithDelim(npcarg,"|",THANKYOUTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + } + break; + case 's': + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX) != talker ){ + getStringFromIndexWithDelim( npcarg,"|", + ANOTHERPLAYERTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow( meindex, talker, token ); + return; + } + if((ret=NPC_SimpleShopProcessSellMsg(msg,meindex,talker)) <0 ){ + switch(ret){ + case -2: + getStringFromIndexWithDelim( npcarg,"|", + RAREITEMTOKEN, + token, sizeof(token) ); + NPC_SimpleShopNormalWindow( meindex,talker,token); + break; + case -1: + default: + NPC_SimpleShopNormalWindow(meindex, talker, + SIMPLESHOP_FATALERRSTR ); + break; + } + }else{ + getStringFromIndexWithDelim(npcarg,"|",THANKYOUTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + } + break; + case 'e': + default: + CHAR_setWorkInt( meindex, CHAR_WORKSHOPCLIENTINDEX, -1 ); + break; + } + break; + } + case 'i': + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX) + == talker ){ + NPC_SimpleShopOpenShopWindow( meindex, talker, npcarg ); + } + break; + default: + break; + } + } +} + +void NPC_LimitBuyInShopSpecialTalked( int meindex, int talker, char *msg, int color ) +{ + if( CHAR_getInt(talker,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER + && NPC_Util_isFaceToFace( meindex, talker, SHOPRANGE ) ){ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE], token[NPC_UTIL_GETARGSTR_LINEMAX]; + NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)); + switch( tolower(msg[0]) ){ + case 's': + { + int ret; + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX) != talker ){ + getStringFromIndexWithDelim( npcarg,"|", + ANOTHERPLAYERTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow( meindex, talker, token ); + return; + } + ret = getStringFromIndexWithDelim( msg, "|", 3, token, sizeof( token)); + if( ret == FALSE ){ + token[0] = 'e'; + token[1] = '\0'; + } + switch( tolower(token[0])){ + case 'b': + if( ( ret = NPC_SimpleShopProcessBuyMsg( msg, meindex, talker)) < 0){ + switch( ret ){ + case -2: + getStringFromIndexWithDelim( npcarg,"|",POORTOKEN, + token,sizeof(token)); + NPC_SimpleShopNormalWindow( meindex,talker,token); + break; + case -3: + getStringFromIndexWithDelim( npcarg,"|", + ITEMFULLTOKEN, + token,sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + break; + case -1: + default: + NPC_SimpleShopNormalWindow(meindex, talker, + SIMPLESHOP_FATALERRSTR + ); + break; + } + }else{ + NPC_SimpleShopFillItem( meindex, npcarg ); + getStringFromIndexWithDelim(npcarg,"|",THANKYOUTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + + } + break; + case 's': + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX) != talker ){ + getStringFromIndexWithDelim( npcarg,"|", + ANOTHERPLAYERTOKEN, + token, sizeof(token)); + NPC_SimpleShopNormalWindow( meindex, talker, token ); + return; + } + if((ret=NPC_LimitBuyInShopProcessSellMsg( + msg,meindex,talker))<0){ + switch(ret){ + case -2: + getStringFromIndexWithDelim( npcarg,"|", + RAREITEMTOKEN, + token,sizeof(token)); + NPC_SimpleShopNormalWindow( meindex,talker,token); + break; + case -1: + default: + NPC_SimpleShopNormalWindow(meindex, talker, SIMPLESHOP_FATALERRSTR + ); + break; + } + }else{ + getStringFromIndexWithDelim(npcarg,"|",THANKYOUTOKEN, token, sizeof(token)); + NPC_SimpleShopNormalWindow(meindex,talker,token); + + } + break; + case 'e': + default: + CHAR_setWorkInt( meindex, CHAR_WORKSHOPCLIENTINDEX, -1 ); + break; + } + break; + } + case 'i': + if( CHAR_getWorkInt(meindex,CHAR_WORKSHOPCLIENTINDEX) + == talker ){ + NPC_SimpleShopOpenShopWindow( meindex, talker, npcarg ); + } + break; + default: + break; + } + } +} + + + + + +/* + * int meindex : Ҽindex + * int playerindex : ̼ëindex + * char *str : + */ +static void NPC_SimpleShopNormalWindow( int meindex, int playerindex, + char *str ) +{ + int fd; + int objindex; + char tmp[512], *name; + + objindex = CHAR_getWorkInt(meindex,CHAR_WORKOBJINDEX); + name = CHAR_getChar( meindex, CHAR_NAME ); + snprintf(tmp,sizeof(tmp),"W|%d|N|%s|123|%s", objindex, name, str ); + fd = getfdFromCharaIndex(playerindex); + if( fd == -1 ) return; + lssproto_TK_send(fd,-1,tmp,CHAR_COLORWHITE ); +} + +/* + * ¦ + * int charindex:ƽҷ¼̼͵ + * ߯Ի + */ +static int NPC_ShopWindowIndexToItemTableIndex( int charindex, + int shopwindowindex ) +{ + int i, counter; + + counter = 0; + for( i=CHAR_STARTITEMARRAY;i NPC_SIMPLESHOPMAXBUYPRICE ){ + return -2; + } + price *= NPC_Util_sellRate(playerindex); + + CHAR_AddGold( playerindex, price ); + + CHAR_sendStatusString( playerindex , "P"); + + id = ITEM_getInt(itemind,ITEM_ID); + { + LogItem( + CHAR_getChar( playerindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( playerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemind, +#else + ITEM_getInt( itemind, ITEM_ID ), /* ʧ ة į */ +#endif + "Sell", + CHAR_getInt( playerindex,CHAR_FLOOR), + CHAR_getInt( playerindex,CHAR_X ), + CHAR_getInt( playerindex,CHAR_Y ), + ITEM_getChar( itemind, ITEM_UNIQUECODE), + ITEM_getChar( itemind, ITEM_NAME), + ITEM_getInt( itemind, ITEM_ID) + ); + } + + if( ! NPC_Util_moveItemToChar( shopindex,itemind,TRUE ) ){ + return -1; + } + NPC_Util_RemoveItemByID(shopindex,id,FALSE); + return 1; +} + +static BOOL NPC_LimitBuyInShopProcessSellMsg(char *msg, + int shopindex, int playerindex ) +{ + int sellwindowindex, itemtableindex,itemind, id,i,buyokflag, setid; + int price, tmpgold; + char buf[BUFSIZ]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE], token[NPC_UTIL_GETARGSTR_LINEMAX]; + + if(!CHAR_CHECKINDEX(shopindex)||!CHAR_CHECKINDEX(playerindex)) + return -1; + if( !getStringFromIndexWithDelim( msg,"|",4,buf,sizeof(buf) )){ + return -1; + } + sellwindowindex = atoi(buf); + itemtableindex = sellwindowindex + CHAR_STARTITEMARRAY; + itemind = CHAR_getItemIndex(playerindex,itemtableindex ); + if( ! ITEM_CHECKINDEX(itemind) ) return -1; + id = ITEM_getInt(itemind,ITEM_ID); + NPC_Util_GetArgStr( shopindex, npcarg, sizeof(npcarg)); + getStringFromIndexWithDelim( npcarg, "|", BUYINITEMLISTTOKEN, token, sizeof( token) ); + buyokflag = FALSE; + for( i=1;getStringFromIndexWithDelim(token,",",i,buf,sizeof(buf)); i++){ + + char *tok1 = NULL; + char *tok2 = NULL; + int no1=0, no2=0; + tok1 = strtok( buf, "-" ); + tok2 = strtok( NULL, "-" ); + + setid = atoi(buf); + + if( tok1 == NULL || tok2 == NULL ){ + if( setid == 0 ) return -2; + if( setid == id ) buyokflag = TRUE; + } else { + no1 = atoi( tok1 ); + no2 = atoi( tok2 ); + if( no1 <= id && id <= no2 ){ + buyokflag = TRUE; + } + } + } + if( buyokflag == FALSE ) return -2; + price = ITEM_getInt( itemind, ITEM_COST ); + price *= NPC_Util_sellRate(playerindex); + + CHAR_AddGold( playerindex, price ); + + CHAR_sendStatusString( playerindex , "P"); + if( ! NPC_Util_moveItemToChar( shopindex,itemind,TRUE ) ){ + return -1; + } + + { + LogItem( + CHAR_getChar( playerindex, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( playerindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemind, +#else + ITEM_getInt( itemind, ITEM_ID ), /* ʧ ة į */ +#endif + "Sell", + CHAR_getInt( playerindex,CHAR_FLOOR), + CHAR_getInt( playerindex,CHAR_X ), + CHAR_getInt( playerindex,CHAR_Y ), + ITEM_getChar( itemind, ITEM_UNIQUECODE), + ITEM_getChar( itemind, ITEM_NAME), + ITEM_getInt( itemind, ITEM_ID) + ); + } + + NPC_Util_RemoveItemByID(shopindex,id,FALSE); + + return 1; + +} + +/* + */ +static int NPC_SimpleShopGetItemNum( int meindex ) +{ + int counter, i; + + counter = 0; + for( i=CHAR_STARTITEMARRAY;i=2 ){ /* ʿ */ + NPC_Util_RemoveItemByID(meindex,itemid,FALSE); + } + }else{ + break; + } + } + + /* ͹ľر */ + //NPC_SimpleShopSetLeakLevel( meindex ); + + return TRUE; +} + + +/* + */ +BOOL NPC_SimpleShopInit( int meindex ) +{ + unsigned int mlevel; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + + int createindex = CHAR_getInt( meindex, CHAR_NPCCREATEINDEX ); + +/* print("shopinit start\n" );*/ + if( NPC_CHECKCREATEINDEX(createindex) ){ + NPC_create[createindex].intdata[NPC_CREATETIME] = -1; + } + + CHAR_setInt( meindex , CHAR_HP , 0 ); + CHAR_setInt( meindex , CHAR_MP , 0 ); + CHAR_setInt( meindex , CHAR_MAXMP , 0 ); + CHAR_setInt( meindex , CHAR_STR , 0 ); + CHAR_setInt( meindex , CHAR_TOUGH, 0 ); + CHAR_setInt( meindex , CHAR_LV , 0 ); + mlevel = ((100<<16)|(100<<0)); /* 2 弰 + Ʊ2 弰 */ + CHAR_setInt( meindex, CHAR_MERCHANTLEVEL, mlevel ); + + CHAR_setWorkInt( meindex, CHAR_WORKSHOPCLIENTINDEX, -1 ); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESHOP ); + CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + + NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)); + + if( ! NPC_SimpleShopFillItem( meindex,npcarg ) ){ + print( "SHOP INIT ERROR: npcarg=%s\n", npcarg ); + return FALSE; + } + +/* print("shopinit end\n" );*/ + + + return TRUE; +} + +/* + * npcargȳ𻧼ͼ + * ϱз,Իʷֽ,ʷֽئ + * + * ¦ + * ߯Ի + * ئTRUE, ئئFALSE + */ +static BOOL NPC_SimpleShopOpenShopOrNot( char *msg, char *openshopstr ) +{ + int i; + char buf[256]; + + i=1; + while(getStringFromIndexWithDelim(openshopstr,",",i,buf,sizeof(buf))){ + if( strstr( msg, buf ) ) return TRUE; + i++; + } + return FALSE; +} diff --git a/npc/npc_stoneserviceman.c b/npc/npc_stoneserviceman.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_storyteller.c b/npc/npc_storyteller.c new file mode 100644 index 0000000..d845fc9 --- /dev/null +++ b/npc/npc_storyteller.c @@ -0,0 +1,17 @@ +#include "version.h" +#include "char.h" + +BOOL NPC_StoryTellerInit( int meindex ) +{ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESTORYTELLER ); + CHAR_setFlg( meindex , CHAR_ISATTACKED , 0 ); + CHAR_setFlg( meindex , CHAR_ISOVERED , 0 ); + + return TRUE; +} + + +void NPC_StoryTellerTalked( int meindex , int talker , char *msg , int col ) +{ + +} diff --git a/npc/npc_stushop.c b/npc/npc_stushop.c new file mode 100644 index 0000000..0df0205 --- /dev/null +++ b/npc/npc_stushop.c @@ -0,0 +1,257 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_stushop.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//صشøнڽ"ʦ" +#ifdef _STU_SYS +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_PREV, + WINDOW_NEXT, + WINDOW_WARP, + WINDOW_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +#define STANDBYTIME 50 + +static void NPC_StuShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL StuShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token, int index ); +int StuShop_ShowMenulist( char *npcarg ); + +int page; + +BOOL NPC_StushopInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_StushopTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_StushopWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_TRANSERMAN_SELECT: + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_TRANSERMAN_WARP: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_PREV, atoi( data)); + return; + } + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_WARP, atoi( data)); + break; + case NPC_TRANSERMAN_END: + NPC_StuShop_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } + +} + +static void NPC_StuShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf1[256]; + char buf2[256]; + char buf3[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + static int select1; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("StuShop_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("StuShop Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_SELECT; + break; + case WINDOW_SELECT: + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 0); + page=StuShop_ShowMenulist(npcarg); + if( StuShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "StuShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(page>1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_NEXT: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<=page) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if( StuShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "StuShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1==page) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_PREV: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)>0) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if( StuShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "StuShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==0) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_WARP: + select1=CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)*7+select; + CHAR_setWorkInt( toindex, CHAR_WORKLISTSELECT , select1); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "END_MSG", buf1, sizeof( buf1) ) == NULL) { + print("StuShop Get START_MSG ERROR !"); + return; + } + if(getStringFromIndexWithDelim( npcarg,"}",select1, buf2, sizeof( buf2)) != FALSE) + NPC_Util_GetStrFromStrWithDelim( buf2, "MenuStr", buf3, sizeof( buf3)); + sprintf( token, "\n%s\n\n %s\n",buf1, buf3); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_END; + break; + case WINDOW_END: + ActionNpc_CheckMenuFree( meindex, toindex, npcarg, CHAR_getWorkInt( toindex, CHAR_WORKLISTSELECT )); + return; + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_StushopLoop( int meindex) +{ + +} + +BOOL StuShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token,int index ) +{ + char buf1[1024], buf2[32], buf3[36]; + BOOL FINDS=FALSE; + int talkNo=index*7+1; + if( npcarg == NULL ) return FALSE; + + sprintf( token, "㵱ǰͽ:%d %d/%dҳ\n",CHAR_getInt( toindex , CHAR_STUNUM), index+1, page); + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + memset( buf2, 0, sizeof( buf2)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL ) + continue; + FINDS = TRUE; + + sprintf( buf3, " %s", buf2); + if(strlen(buf3)<10) + strcat( buf3, "\n"); + else + strcat( buf3, "\n"); + strcat( token, buf3); + if(talkNo>(index*7+7))return FINDS; + } + return FINDS; +} + +int StuShop_ShowMenulist( char *npcarg ) +{ + char buf1[1024]; + int talkNo=1; + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + } + return (talkNo-3)/7+1; +} + +#endif + + diff --git a/npc/npc_sysinfo.c b/npc/npc_sysinfo.c new file mode 100644 index 0000000..a328609 --- /dev/null +++ b/npc/npc_sysinfo.c @@ -0,0 +1,840 @@ +#include "version.h" +#include +#include "char.h" +#include "char_event.h" +#include "object.h" +#include "handletime.h" +#include "magic.h" +#include "npcutil.h" +#include "char_data.h" +#include "chatmagic.h" +#include "net.h" +#include "configfile.h" +#include "npcgen.h" + +/* +--------------------------------------------------------------------- +sysinfo By Kawata +--------------------------------------------------------------------- +*/ + +#define NPC_SYSINFO_MSGMAX 21 + +#define NPC_SYSINFO_PASSWD_DEFAULT "longzoro" + +#define NPC_SYSINFO_TIMELIMIT_DEFAULT 120 + +#define NPC_SYSINFO_SHUTDOWNLIMIT_DEFAULT 5 + +#define NPC_SYSINFO_SHUTDOWN_MSG "ٹ %d ᣬʼserverϵͳά" + +#define NPC_SYSINFO_SHUTDOWN_MSG_COMP "serverѹرա" +enum { + CHAR_WORK_MODE = CHAR_NPCWORKINT1, + CHAR_WORK_TIME = CHAR_NPCWORKINT2, + CHAR_WORK_TIMELIMIT = CHAR_NPCWORKINT3, + CHAR_WORK_SHUTDOWNTIME = CHAR_NPCWORKINT4, + CHAR_WORK_SHUTDOWNLIMIT = CHAR_NPCWORKINT5, + CHAR_WORK_SHUTDOWNDSPTIME = CHAR_NPCWORKINT6, + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT7, + CHAR_WORK_PLAYER = CHAR_NPCWORKINT8, +}; + +enum { + CHAR_WORKCHAR_PASSWD = CHAR_NPCWORKCHAR1, +}; +typedef struct { + char msg[16]; +}CMD_MSG; +CMD_MSG cmd_msg[] = { + { "startinfo"}, {"endinfo"}, {"help"}, + {"player"}, {"list"}, {"sendno"}, + {"sendmsg"}, {"shutdown"}, {"msgcol"}, + {"sysinfo"}, {"info"}, + { "allowaccept" } , { "denyaccept" } , + { "closeallsockets" }, + { "allnosee" }, + { "allnobody" }, + { "movenum" }, + { "bornnum" }, + { "enemystate" }, + { "setwalktime"},{ "setcatime" },{"setcdtime"}, + { "setoneloop"}, + { "titlerestart"}, + { "setsaacwrite"}, { "setsaacread"}, +}; +enum{ + NPC_SYSINFO_MSG_STARTINFO, + NPC_SYSINFO_MSG_ENDINFO, + NPC_SYSINFO_MSG_HELP, + NPC_SYSINFO_MSG_PLAYER, + NPC_SYSINFO_MSG_LIST, + NPC_SYSINFO_MSG_SENDNO, + NPC_SYSINFO_MSG_SENDMSG, + NPC_SYSINFO_MSG_SHUTDOWN, + NPC_SYSINFO_MSG_MSGCOL, + NPC_SYSINFO_MSG_SYSINFO, + NPC_SYSINFO_MSG_INFO, + NPC_SYSINFO_MSG_ALLOWACCEPT, + NPC_SYSINFO_MSG_DENYACCEPT, + NPC_SYSINFO_MSG_CLOSEALLSOCKETS, + + /* Ȭܰ */ + NPC_SYSINFO_ALL_NOSEE, + NPC_SYSINFO_ALL_NOBODY, + NPC_SYSINFO_MOVE_NUM, + NPC_SYSINFO_BORN_NUM, + NPC_SYSINFO_ENEMY_STATE, + NPC_SYSINFO_SETWALKTIME, + NPC_SYSINFO_SETCATIME, + NPC_SYSINFO_SETCDTIME, + NPC_SYSINFO_SETONELOOP, + NPC_SYSINFO_TITLERESTART, + NPC_SYSINFO_SETSAACWRITE, + NPC_SYSINFO_SETSAACREAD, + + NPC_SYSINFO_MSG_NUM, +}; + +typedef struct { + char arg[32]; + char defMsg[128]; +}NPC_Sysinfo_Msg; + +static NPC_Sysinfo_Msg msgtable[] = { + { "def_msg", "ӵкȫ˵" }, + { "shutdown_msg", "ڿʼҪserverϵͳά뾡logout"}, +}; +enum{ + NPC_SYSINFO_ARG_DEF_MSG, + NPC_SYSINFO_ARG_SHUTDOWN_MSG, +}; + + +static void NPC_Sysinfo_SendMsg( int meindex, int pindex, int tblnum); +static char *NPC_Sysinfo_GetMsg( int meindex, char *msgindexstr, + char *out,int outlen, int num ); +static void NPC_Sysinfo_SendMsgToAll( int meindex, char *msg); +static void NPC_Sysinfo_Msg_EndInfo( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_Help( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_Player( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_List( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_SendNo( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_SendMsg( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_Shutdown( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Msg_Msgcol( int meindex, int tindex, char *msg); + +/* Ȭܰ */ +static void NPC_Sysinfo_All_NoBody( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_All_NoSee( int meindex, int tindex, char *msg); + +static void NPC_Sysinfo_Move_Num( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Born_Num( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_Enemy_State( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetWalkTime( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetCATime( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetCDTime( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetOneloop( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_TitleRestart( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetSaacwrite( int meindex, int tindex, char *msg); +static void NPC_Sysinfo_SetSaacread( int meindex, int tindex, char *msg); + +static void NPC_Sysinfo_Msg_allowAccept(int meindex, int tindex, char*msg) +{ + SERVSTATE_SetAcceptMore( 1 ); + CHAR_talkToCli( tindex, meindex, "allowaccept OK.", CHAR_COLORYELLOW); +} +static void NPC_Sysinfo_Msg_denyAccept(int meindex, int tindex, char*msg) +{ + SERVSTATE_SetAcceptMore( 0 ); + CHAR_talkToCli( tindex, meindex, "denyaccept OK.", CHAR_COLORYELLOW); +} +static void NPC_Sysinfo_Msg_closeallsockets(int meindex, int tindex, + char*msg) +{ + CHAR_talkToCli( tindex, meindex, "closeallsockets OK.", CHAR_COLORYELLOW); + closeAllConnectionandSaveData(); +} +static void NPC_Sysinfo_Msg_Sysinfo(int meindex, int tindex, char*msg) +{ + CHAR_CHAT_DEBUG_sysinfo( tindex, msg); +} +static void NPC_Sysinfo_Msg_Info(int meindex, int tindex, char*msg) +{ + CHAR_CHAT_DEBUG_info( tindex, msg); +} + + +typedef void (*FUNC)(int,int,char *); +static FUNC functbl[] = { + NULL, + NPC_Sysinfo_Msg_EndInfo, + NPC_Sysinfo_Msg_Help, + NPC_Sysinfo_Msg_Player, + NPC_Sysinfo_Msg_List, + NPC_Sysinfo_Msg_SendNo, + NPC_Sysinfo_Msg_SendMsg, + NPC_Sysinfo_Msg_Shutdown, + NPC_Sysinfo_Msg_Msgcol, + NPC_Sysinfo_Msg_Sysinfo, + NPC_Sysinfo_Msg_Info, + NPC_Sysinfo_Msg_allowAccept, + NPC_Sysinfo_Msg_denyAccept, + NPC_Sysinfo_Msg_closeallsockets, + /* Ȭܰ */ + NPC_Sysinfo_All_NoSee, + NPC_Sysinfo_All_NoBody, + NPC_Sysinfo_Move_Num, + NPC_Sysinfo_Born_Num, + NPC_Sysinfo_Enemy_State, + NPC_Sysinfo_SetWalkTime, + NPC_Sysinfo_SetCATime, + NPC_Sysinfo_SetCDTime, + NPC_Sysinfo_SetOneloop, + NPC_Sysinfo_TitleRestart, + NPC_Sysinfo_SetSaacwrite, + NPC_Sysinfo_SetSaacread, + +}; + +/********************************* +*********************************/ +BOOL NPC_SysinfoInit( int meindex ) +{ + int tmp; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[128]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + + CHAR_setWorkInt( meindex, CHAR_WORK_MODE, 0); + + /* ɵ */ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "passwd", buff, sizeof( buff)) == NULL) + { + strcpy( buff, NPC_SYSINFO_PASSWD_DEFAULT); + } + CHAR_setWorkChar( meindex, CHAR_WORKCHAR_PASSWD, buff); + + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "time"); + if( tmp == -1 ) tmp = NPC_SYSINFO_TIMELIMIT_DEFAULT; + CHAR_setWorkInt( meindex, CHAR_WORK_TIMELIMIT, tmp); + + tmp = NPC_Util_GetNumFromStrWithDelim( argstr, "msg_col"); + if( tmp < CHAR_COLORRED || tmp > CHAR_COLORWHITE ) + tmp = CHAR_COLORYELLOW; + CHAR_setWorkInt( meindex, CHAR_WORK_MSGCOLOR, tmp); + + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER, -1); + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNTIME, 0); + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNDSPTIME, 0); + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TYPEOTHERNPC); + CHAR_setFlg( meindex, CHAR_ISATTACKED, 0); + + return TRUE; +} + +/********************************* +**********************************/ +void NPC_SysinfoLoop( int meindex ) +{ + int shuttime; + if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE) == 1) { + int oldtime; + /* ë׻ */ + oldtime = CHAR_getWorkInt( meindex, CHAR_WORK_TIME); + /* ƥɧƹ */ + if( NowTime.tv_sec - oldtime > + CHAR_getWorkInt( meindex, CHAR_WORK_TIMELIMIT)) + { + CHAR_setWorkInt( meindex, CHAR_WORK_MODE, 0); + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER, -1); + } + } + shuttime = CHAR_getWorkInt( meindex, CHAR_WORK_SHUTDOWNTIME); + /* shutdown */ + if( shuttime > 0 ) { + int diff,limit,hun; + + diff = NowTime.tv_sec - shuttime; + limit = CHAR_getWorkInt( meindex, CHAR_WORK_SHUTDOWNLIMIT); + hun = limit - (diff/60); + /* 嶪 */ + if( hun != CHAR_getWorkInt( meindex, CHAR_WORK_SHUTDOWNDSPTIME)){ + char buff[256]; + if( hun != 0 ) { + snprintf( buff, sizeof(buff), NPC_SYSINFO_SHUTDOWN_MSG, hun); + } + else { + strcpy( buff, NPC_SYSINFO_SHUTDOWN_MSG_COMP); + } + NPC_Sysinfo_SendMsgToAll( meindex, buff); + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNDSPTIME, hun); + } + if( hun == 0) { + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNDSPTIME,0); + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNLIMIT,0); + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNTIME,0); + } + } +} +/********************************* +**********************************/ +void NPC_SysinfoTalked( int meindex, int tindex, char *msg, int color) +{ + char *msgwk; + char *buff; + int len; + int msgno; + + len = strlen( msg)+1; + msgwk = calloc( 1, sizeof(char)*len); + buff = calloc( 1, sizeof(char)*len); + strcpy( msgwk, msg); + /* ʸë继 */ + deleteSequentChar( msgwk, " "); + if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE) == 0 ) { + msgno = 0; + if( strncmp( msgwk, cmd_msg[NPC_SYSINFO_MSG_STARTINFO].msg, + strlen( cmd_msg[NPC_SYSINFO_MSG_STARTINFO].msg)) == 0) + { + if( getStringFromIndexWithDelim( msgwk, " ", 2, buff, len) + == TRUE ) + { + if( strcmp( buff, CHAR_getWorkChar( meindex, CHAR_WORKCHAR_PASSWD)) + == 0 ) + { + CHAR_setWorkInt( meindex, CHAR_WORK_MODE, 1); + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER, tindex); + CHAR_setWorkInt( meindex, CHAR_WORK_TIME, NowTime.tv_sec); + CHAR_talkToCli( tindex, meindex, + "Ƶָģʽhelp˵", + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + CHAR_talkToCli( tindex, meindex, + "enemystate ˽˵IJж", + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + + } + } + } + if( CHAR_getWorkInt( meindex, CHAR_WORK_MODE ) == 0 ) { + NPC_Sysinfo_SendMsg( meindex, tindex, NPC_SYSINFO_ARG_DEF_MSG); + } + }else { + if( tindex == CHAR_getWorkInt( meindex, CHAR_WORK_PLAYER)) { + int i; + for( i = NPC_SYSINFO_MSG_ENDINFO; i < NPC_SYSINFO_MSG_NUM; i ++ ) { + if( strncmp( msgwk, cmd_msg[i].msg, strlen( cmd_msg[i].msg)) == 0) { + if( functbl[i] != NULL ) { + functbl[i]( meindex, tindex, msgwk); + } + break; + } + } + CHAR_setWorkInt( meindex, CHAR_WORK_TIME, NowTime.tv_sec); + } + else { + NPC_Sysinfo_SendMsg( meindex, tindex, NPC_SYSINFO_ARG_DEF_MSG); + } + } + free( msgwk); + free( buff); +} +/*------------------------------------------------------------------------ + * ɧƹ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_EndInfo( int meindex, int tindex, char *msg) +{ + CHAR_setWorkInt( meindex, CHAR_WORK_MODE, 0); + CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER, -1); + CHAR_talkToCli( tindex, meindex, + "Ƶһģʽ", + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + +} +/*------------------------------------------------------------------------ + * HELP + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_Help( int meindex, int tindex, char *msg) +{ + int i; + typedef struct { + char str[512]; + }SYSINFO_MSGWK; + SYSINFO_MSGWK msgwk[] = { + { "ָHELP"}, + { "help ѶϢ"}, + { "player ʾLOGIN"}, + { "list ѶϢһ"}, + { "send number number ֵָѶϢĺὫѶϢݴ͸ȫҡ"}, + { "sendmsg msgs msgsΪ봫͵ѶϢsend ֮һ񣬼ɽ֮Ÿȫҡ"}, + { "shutdown min min ֡"}, + { "msgcol col 趨͸ѶϢɫɫָred,green,yellow,blue,purple,cyan,white"}, + { "sysinfo ϵͳ״̬"}, + { "info ״̬"}, + { "endinfo ظͨ״̬"}, + { "denyaccept ޷CLIENT˵Ľ"}, + { "allowaccept CLIENT˵Ľ"}, + { "closeallsockets ǿCLIENTLOGOUTڲʵdenyaccept"}, + { "titlerestart ٴζȡƺ趨"}, + { "enemystate ˵NPC״"}, + { ""}, + }; + + for( i = 0; msgwk[i].str[0] != '\0'; i ++ ) { + CHAR_talkToCli( tindex, meindex, msgwk[i].str, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} +/*------------------------------------------------------------------------ + * ëƩ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_Player( int meindex, int tindex, char *msg) +{ + int i, cnt = 0; + int playernum=CHAR_getPlayerMaxNum(); + char buff[64]; + for( i=0 ; i=1 && num < NPC_SYSINFO_MSGMAX ) { + if( NPC_Sysinfo_GetMsg( meindex, "sendno", msgbuf, + sizeof( msgbuf), num) != NULL ) + { + NPC_Sysinfo_SendMsgToAll( meindex, msgbuf); + } + } + } +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_SendMsg( int meindex, int tindex, char *msg) +{ + char buff[512]; + + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + NPC_Sysinfo_SendMsgToAll( meindex, buff); + } +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_Msgcol( int meindex, int tindex, char *msg) +{ + char buff[64]; + typedef struct { + int color; + char str[10]; + }SYSINFO_COLSET; + SYSINFO_COLSET colset[] = { + { 249, "red"}, + { 250, "green"}, + { 251, "yellow"}, + { 252, "blue"}, + { 253, "purple"}, + { 254, "cyan"}, + { 255, "white"}, + }; + + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + int i; + for( i = 0; i < 7; i ++ ) { + if( strstr( buff, colset[i].str) != NULL ) { + CHAR_setWorkInt( meindex, CHAR_WORK_MSGCOLOR, colset[i].color); + CHAR_talkToCli( tindex, meindex, "ѸıѶϢɫ", + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + break; + } + } + } +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static char *NPC_Sysinfo_GetMsg( int meindex, char *msgindexstr, + char *out,int outlen, int num ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char *work; + char *buff; + char *cret = NULL; + int worklen; + + worklen = strlen( msgindexstr)+3; + work = (char *)calloc( 1, worklen * sizeof( char)); + buff = (char *)calloc( 1, outlen * sizeof( char)); + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + snprintf( work, worklen, "%s%d", msgindexstr, num); + if( NPC_Util_GetStrFromStrWithDelim( argstr, work,buff, outlen) != NULL ) + { + strcpy( out, buff); + cret = out; + } + + free( work); + free( buff); + return( cret); +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_Msg_Shutdown( int meindex, int tindex, char *msg) +{ + char buff[10]; + int hun; + + NPC_Sysinfo_SendMsg( meindex, tindex, NPC_SYSINFO_ARG_SHUTDOWN_MSG); + /* ޱ */ + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNTIME, NowTime.tv_sec); + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + hun = atoi( buff); + if( hun <= 0 ) { + hun = NPC_SYSINFO_SHUTDOWNLIMIT_DEFAULT; + } + } + else { + hun = NPC_SYSINFO_SHUTDOWNLIMIT_DEFAULT; + } + + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNLIMIT, hun); + + CHAR_setWorkInt( meindex, CHAR_WORK_SHUTDOWNDSPTIME,0); +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_SendMsg( int meindex, int pindex, int tblnum) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[128]; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + if( NPC_Util_GetStrFromStrWithDelim( argstr, msgtable[tblnum].arg,buff, sizeof( buff)) == NULL ) + { + strcpy( buff, msgtable[tblnum].defMsg); + } + if( buff[0] != '\0' ) { + CHAR_talkToCli( pindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} +/*------------------------------------------------------------------------ + *----------------------------------------------------------------------*/ +static void NPC_Sysinfo_SendMsgToAll( int meindex, char *msg) +{ + int i; + int playernum = CHAR_getPlayerMaxNum(); + + for( i = 0 ; i < playernum ; i++) { + if( CHAR_getCharUse(i) != FALSE ) { + CHAR_talkToCli( i, meindex, msg, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } + } +} + + + +/* ƽҷë NO_SEE ¾ */ +static void NPC_Sysinfo_All_NoSee( int meindex, int tindex, char *msg ){ + char buff[256]; + + buff[0] = buff[1] = 0; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + if( strncmp( buff, "on", strlen( buff ) ) == 0 ){ + all_nosee = 1; + snprintf( buff, sizeof( buff), "ѿall_nosee " ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else + if( strncmp( buff, "off", strlen( buff ) ) == 0 ){ + all_nosee = 0; + snprintf( buff, sizeof( buff), "ѹرall_nosee " ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } + }else + if( all_nosee == 0 ){ + snprintf( buff, sizeof( buff), "all_noseeرš" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "all_noseeš" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} + +/* ƽҷë NO_BODY ¾ */ +static void NPC_Sysinfo_All_NoBody( int meindex, int tindex, char *msg ){ + char buff[256]; + + buff[0] = buff[1] = 0; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + if( strncmp( buff, "on", strlen( buff ) ) == 0 ){ + all_nobody = 1; + snprintf( buff, sizeof( buff), "ѿall_nobody " ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else + if( strncmp( buff, "off", strlen( buff ) ) == 0 ){ + all_nobody = 0; + snprintf( buff, sizeof( buff), "ѹرall_nobody " ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } + }else + if( all_nobody == 0 ){ + snprintf( buff, sizeof( buff), "all_nobody رš" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "all_nobody š" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} + + +static void NPC_Sysinfo_Move_Num( int meindex, int tindex, char *msg ){ + char buff[256]; + int work; + buff[0] = buff[1] = 0; + + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + work = atoi( buff ); + if( work <= 0 ) { + work = 1000; /* */ + } + EnemyMoveNum = work; + snprintf( buff, sizeof( buff), "õͬʱ%d", + EnemyMoveNum ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "ڵͬʱڽ%d", + EnemyMoveNum ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} + + + +static void NPC_Sysinfo_Born_Num( int meindex, int tindex, char *msg ){ + char buff[256]; + int work; + buff[0] = buff[1] = 0; + + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) + { + work = atoi( buff ); + if( work <= 0 ) { + work = 2; /* */ + } + one_loop_born = work; + snprintf( buff, sizeof( buff), "ͬʱɳߵ%d", + one_loop_born ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "ڵͬʱɳߵ%d", + one_loop_born ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } +} + + + +static void NPC_Sysinfo_Enemy_State( int meindex, int tindex, char *msg ){ + char buff[256]; + + if( all_nobody == 0 ){ + snprintf( buff, sizeof( buff), "allnobody رš" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "allnobody š" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } + if( all_nosee == 0 ){ + snprintf( buff, sizeof( buff), "allnosee رš" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + }else{ + snprintf( buff, sizeof( buff), "allnosee š" ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + } + snprintf( buff, sizeof( buff), + "bornnum ڵͬʱɳߵ%d", + one_loop_born ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + + snprintf( buff, sizeof( buff), + "movenum ڵͬʱڽ%d", + EnemyMoveNum ); + CHAR_talkToCli( tindex, meindex, buff, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + + +} +static void NPC_Sysinfo_SetWalkTime( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setWalksendinterval( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"WalkInterval = %d ",getWalksendinterval()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); + +} +static void NPC_Sysinfo_SetCATime( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setCAsendinterval_ms( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"CAsendInterval = %d ", + getCAsendinterval_ms()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} +static void NPC_Sysinfo_SetCDTime( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setCDsendinterval_ms( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"CDsendInterval = %d ", + getCDsendinterval_ms()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} +static void NPC_Sysinfo_SetOneloop( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setOnelooptime_ms( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"Onelooptime = %d ", + getOnelooptime_ms()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} +static void NPC_Sysinfo_TitleRestart( int meindex, int tindex, char *msg) +{ + int rc; + char msgbuf[256]; + + rc = TITLE_reinitTitleName(); + if( rc) { + snprintf( msgbuf, sizeof(msgbuf),"ȡϡ" ); + } + else { + snprintf( msgbuf, sizeof(msgbuf),"ERROR" ); + } + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} + + +static void NPC_Sysinfo_SetSaacwrite( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setSaacwritenum( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"Saacwritenum = %d ",getSaacwritenum()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} +static void NPC_Sysinfo_SetSaacread( int meindex, int tindex, char *msg) +{ + int interval; + char msgbuf[256]; + char buff[256]; + if( getStringFromIndexWithDelim( msg, " ", 2, buff, sizeof( buff)) == TRUE ) { + interval = atoi( buff); + if( interval > 0 ) { + setSaacreadnum( (unsigned)interval); + } + } + snprintf( msgbuf, sizeof(msgbuf),"Saacreadnum = %d ",getSaacreadnum()); + CHAR_talkToCli( tindex, meindex, msgbuf, + CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR)); +} diff --git a/npc/npc_timeman.c b/npc/npc_timeman.c new file mode 100644 index 0000000..2051278 --- /dev/null +++ b/npc/npc_timeman.c @@ -0,0 +1,226 @@ +#include "version.h" +#include +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "npcutil.h" +#include "npc_oldman.h" +#include "title.h" +#include "char_data.h" +#include "readmap.h" +#include "lssproto_serv.h" +#include "log.h" +#include "handletime.h" + + + + + +enum { + E_INT_GRAPHIC = CHAR_NPCWORKINT1, /* 󡼰 */ + E_INT_GRAPHIC2 = CHAR_NPCWORKINT2, /* */ + E_INT_BORN = CHAR_NPCWORKINT3, /* źϷ */ + E_INT_DEAD = CHAR_NPCWORKINT4, /* */ + E_INT_MODE = CHAR_NPCWORKINT5, /* ػƹ */ + E_INT_NOWGRAPHIC = CHAR_NPCWORKINT6, /* ػ°ū͹ϼ */ + +}; + + +typedef struct { + char arg[32]; + int born; + int dead; +}NPC_TimeMan; + + +#define YOAKE 700 +#define NICHIBOTU 300 +#define SHOUGO 125 +#define YONAKA 500 + +static NPC_TimeMan TimeTble[] = { + + {"ALLNIGHT", NICHIBOTU+1, YOAKE}, /* 뻯ئ */ + {"ALLNOON", YOAKE+1, NICHIBOTU},/* 뻯 */ + {"AM", YONAKA+1, SHOUGO}, /* AM ݼ */ + {"PM", SHOUGO+1, YONAKA}, /* PM ݼ */ + {"FORE", YOAKE+1, SHOUGO}, /* ƥտڸƥ */ + {"AFTER", SHOUGO+1, NICHIBOTU},/* ڸ ͸ƥ */ + {"EVNING", NICHIBOTU+1, YONAKA}, /* ƥީ ƥ */ + {"MORNING", YONAKA+1, YOAKE}, /* ީ ƥ */ + {"FREE", 0, 1024}, +}; + + + + +BOOL NPC_TimeManInit( int meindex ) +{ + + int i=0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[32]; + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPETOWNPEOPLE ); + if( NPC_Util_GetStrFromStrWithDelim( argstr, "change_no", buf, sizeof( buf)) != NULL ){ + if(strstr(buf,"CLS")!=NULL){ + CHAR_setWorkInt( meindex,E_INT_GRAPHIC2, 9999 ); + }else{ + CHAR_setWorkInt( meindex,E_INT_GRAPHIC2, atoi(buf) ); + } + }else{ + CHAR_setWorkInt( meindex,E_INT_GRAPHIC2, 9999 ); + } + + CHAR_setWorkInt( meindex, E_INT_GRAPHIC, CHAR_getInt( meindex, CHAR_BASEIMAGENUMBER) ); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "time", buf, sizeof( buf)) != NULL ){ + for(i=0 ; i<9 ; i++){ + if(strstr(buf,TimeTble[i].arg) != NULL){ + CHAR_setWorkInt( meindex, E_INT_BORN, TimeTble[i].born); + CHAR_setWorkInt( meindex, E_INT_DEAD, TimeTble[i].dead); + return TRUE; + } + } + } + + return FALSE; + +} + + +void NPC_TimeManTalked( int meindex , int talkerindex , char *msg ,int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[512]; + char buf[512]; + int tokennum=0; + int i; + + + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){ + if( NPC_Util_CharDistance( talkerindex ,meindex ) > 1) return; + } + + if(CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)==9999){ + /*--ƹ--*/ + return; + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + + + if( CHAR_getInt(talkerindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER )return; + + if( NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 3 ) ==FALSE) return; + + + + + if(CHAR_getWorkInt(meindex,E_INT_MODE)==0){ + /*--ë߯ */ + NPC_Util_GetStrFromStrWithDelim(argstr,"main_msg",buf,sizeof( buf) ); + + }else{ + NPC_Util_GetStrFromStrWithDelim(argstr,"change_msg",buf,sizeof( buf) ); + } + + tokennum = 1; + /* Ѩƥľͼϳؤ¾ */ + for( i=0;buf[i]!='\0';i++ ){ + if( buf[i] == ',' ) tokennum++; + } + + getStringFromIndexWithDelim( buf,",", rand()%tokennum+1,token, sizeof(token)); + /*----*/ + CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORWHITE ); + + +} + +/** ԻϾڳľ*/ +void NPC_TimeManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ) +{ + int meindex=0; + int index; + LSTIME nowlstime; + int born; + int dead; + + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; + index = OBJECT_getIndex( objindex); + + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + + meindex = OBJECT_getIndex( meobjindex); + born = CHAR_getWorkInt( meindex , E_INT_BORN ); + dead = CHAR_getWorkInt( meindex , E_INT_DEAD ); + +// print("now_hour=%d",nowlstime.hour); + + /* ëέë裻 */ + if(born < dead){ + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + if( (born < nowlstime.hour) && (dead > nowlstime.hour) ){ + if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) + ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC)) return; + + CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, + CHAR_getWorkInt( meindex, E_INT_GRAPHIC)); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + CHAR_setWorkInt(meindex,E_INT_MODE,0); + CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, + CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); + }else{ + /*---*/ + if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) + ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)) return; + + CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, + CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + CHAR_setWorkInt(meindex,E_INT_MODE,1); + CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, + CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); + + } + }else{ + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + if( (born < nowlstime.hour && 1024 > nowlstime.hour) + || ( 0 < nowlstime.hour && dead > nowlstime.hour) + ){ + if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) + ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC)) return; + + CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, + CHAR_getWorkInt( meindex, E_INT_GRAPHIC)); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + CHAR_setWorkInt(meindex,E_INT_MODE,0); + CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, + CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); + }else{ + if(CHAR_getWorkInt(meindex,E_INT_NOWGRAPHIC) + ==CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)) return; + + CHAR_setInt(meindex,CHAR_BASEIMAGENUMBER, + CHAR_getWorkInt( meindex, E_INT_GRAPHIC2)); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + CHAR_setWorkInt(meindex,E_INT_MODE,1); + CHAR_setWorkInt(meindex,E_INT_NOWGRAPHIC, + CHAR_getInt(meindex,CHAR_BASEIMAGENUMBER)); + } + } + +} + diff --git a/npc/npc_townpeople.c b/npc/npc_townpeople.c new file mode 100644 index 0000000..ea27dcc --- /dev/null +++ b/npc/npc_townpeople.c @@ -0,0 +1,61 @@ +#include "version.h" +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "util.h" +#include "handletime.h" +#include "anim_tbl.h" +#include "npc_door.h" +#include "lssproto_serv.h" +#include "npcutil.h" + + +/* + * м̫ by nakamura + * + * + */ + +/* + */ +void NPC_TownPeopleTalked( int index, int talker, char *msg, int color ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE], token[NPC_UTIL_GETARGSTR_LINEMAX]; + int i, tokennum; + + + if( CHAR_getInt(talker,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER + && NPC_Util_charIsInFrontOfChar( talker, index, 3 ) ){ + + NPC_Util_GetArgStr( index, arg, sizeof( arg)); + + tokennum = 1; + /* Ѩƥľͼϳؤ¾ */ + for( i=0;arg[i]!='\0';i++ ){ + if( arg[i] == ',' ) tokennum++; + } + + getStringFromIndexWithDelim( arg,",", + rand()%tokennum+1,token, sizeof(token)); + + CHAR_talkToCli( talker, index, token, CHAR_COLORWHITE ); + } +} + +/* + */ +BOOL NPC_TownPeopleInit( int meindex ) +{ + + //CHAR_setInt( meindex , CHAR_HP , 0 ); + //CHAR_setInt( meindex , CHAR_MP , 0 ); + //CHAR_setInt( meindex , CHAR_MAXMP , 0 ); + //CHAR_setInt( meindex , CHAR_STR , 0 ); + //CHAR_setInt( meindex , CHAR_TOUGH, 0 ); + //CHAR_setInt( meindex , CHAR_LV , 0 ); + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPETOWNPEOPLE ); + //CHAR_setFlg( meindex , CHAR_ISOVERED , 1 ); + + return TRUE; +} diff --git a/npc/npc_transerman.c b/npc/npc_transerman.c new file mode 100644 index 0000000..4a7a3c9 --- /dev/null +++ b/npc/npc_transerman.c @@ -0,0 +1,201 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_transerman.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//صشøнڽ"ʦ" +#ifdef _TRANSER_MAN +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_WARP, + WINDOW_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +#define STANDBYTIME 50 + +static void NPC_TranserMan_selectWindow( int meindex, int toindex, int num,int select); +BOOL TranserMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token); + +BOOL NPC_TranserManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_TranserManTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } +#ifdef _ITEM_CHECKWARES + if( CHAR_CheckInItemForWares( talkerindex, 0) == FALSE ){ + CHAR_talkToCli( talkerindex, meindex, "ݴʦ涨ܷЯˣ", CHAR_COLORYELLOW); + return; + } +#endif +// Syu ADD Ŵʦж״̬ + if( CHAR_getWorkInt ( talkerindex , CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE) + { + CHAR_talkToCli( talkerindex, meindex, "ݴʦ涨ܰе˴ͣ",CHAR_COLORYELLOW); + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_TranserMan_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_TranserManWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_TRANSERMAN_SELECT: + NPC_TranserMan_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_TRANSERMAN_WARP: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + NPC_TranserMan_selectWindow( meindex, talkerindex, WINDOW_WARP, atoi( data)); + break; + case NPC_TRANSERMAN_END: + break; + } + +} + +static void NPC_TranserMan_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256]; + + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("TranserMan Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_SELECT; + break; + case WINDOW_SELECT: + if( TranserMan_GetMenuStr( meindex, toindex, npcarg, token) == FALSE ) { + print( "TranserMan GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_WARP: + if( ActionNpc_CheckMenuFree( meindex, toindex, npcarg, select) == FALSE ){ + memset( token, 0, sizeof( token)); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FAIL_MSG", token, sizeof( token) ) != NULL) { + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + } + } + return; + + case WINDOW_END: + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_TranserManLoop( int meindex) +{ + +} + +BOOL TranserMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token) +{ + char buf1[1024], buf2[256], buf3[256]; + BOOL FINDS=FALSE; + int talkNo=1; + if( npcarg == NULL ) return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuHead", buf1, sizeof( buf1) ) == NULL){ + print("TranserMan Get MenuHead ERROR!"); + return FALSE; + } + sprintf( token, "%s\n", buf1); + + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + memset( buf2, 0, sizeof( buf2)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL ) + continue; + FINDS = TRUE; + + sprintf( buf3, " %s\n", buf2); + strcat( token, buf3); + } + + return FINDS; +} + +#endif + + diff --git a/npc/npc_transmigration.c b/npc/npc_transmigration.c new file mode 100644 index 0000000..252522d --- /dev/null +++ b/npc/npc_transmigration.c @@ -0,0 +1,1811 @@ +#include "version.h" +#include +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "enemy.h" +#include "log.h" +#include "battle.h" +#include "readmap.h" +#include "npc_transmigration.h" + +#ifdef _FUSIONBEIT_TRANS +#include "configfile.h" +#endif + +#ifdef _PET_TRANS +#include "npc_pettransman.h" +#endif + +static void NPC_Transmigration_selectWindow( int meindex, int toindex, int num); +static int NPC_TransmigrationCheck(int meindex, int talker); +BOOL NPC_TransmigrationAddPet(int meindex, int talker, int petid); +//Ѽ +int NPC_StartpointCheck(int meindex,int talker); +BOOL NPC_TransmigrationMain(int meindex, int toindex, char *buf); +int NPC_TransmigrationFlg_CLS(int meindex, int toindex); +BOOL NPC_TransmigrationDelPet(int meindex, int talker); +BOOL NPC_TransmigrationStatus(int meindex, int toindex,int *work); +BOOL NPC_TransmigratiomWarp(int meindex, int toindex, char *buf); +void s_eventsetend( int charaindex, int shiftbit ); + +#ifdef _PET_TRANS +int Pet_Select; +#endif + +/********************************* +*********************************/ +BOOL NPC_TransmigrationInit( int meindex ) +{ + + /*--ƽҷ¼ëɬ--*/ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPETRANSMIGRATION ); + + return TRUE; + +} + +/********************************* +*********************************/ +void NPC_TransmigrationTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ +#ifdef _PET_TRANS + int i,petindex; + char buf[256]; +#endif + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + { + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) return; + } +// print("savepoot=%d",CHAR_getInt( talkerindex, CHAR_SAVEPOINT)); +// NPC_StartpointCheck( meindex, talkerindex); + + +//׷ж ת ת +#ifdef _PET_TRANS + for(i=0 ; i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talkerindex, i); + if( petindex == -1 ) + continue; + // ID ǷΪ׷ 1479 ID Ϊ718 + if( CHAR_getInt( petindex, CHAR_PETID) == 718 +#ifdef _PET_2TRANS + || CHAR_getInt( petindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( petindex, CHAR_PETID) == getMMPETID2() +#endif + ) { + if( CHAR_getInt( petindex, CHAR_LV) > 79 ) { + //continue; + }else if( CHAR_getInt( petindex, CHAR_LV) == 79 ) { + if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( talkerindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( talkerindex, CHAR_NAME) )) { + sprintf( buf,"ϵ׷ţİ"); + CHAR_talkToCli( talkerindex, -1, buf, CHAR_COLORWHITE); + return; + } + break; + } + } + } + + if(i != CHAR_MAXPETHAVE) { + CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); + NPC_PetTransMan_selectWindow( meindex, talkerindex,0,-1); + }else { +#endif + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT,1); + NPC_Transmigration_selectWindow( meindex, talkerindex, 0); +#ifdef _PET_TRANS + } +#endif + + //ԭת + //CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT,1); + //NPC_Transmigration_selectWindow( meindex, talkerindex, 0); + +} + + +static void NPC_Transmigration_selectWindow( int meindex, int toindex, int num) +{ + + char token[1024]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[2048]; + char buf2[512]; + char tmp[512]; + char s_tensei[64]; + int buttontype = 0; + int windowtype = 0; + int windowno = 0; + int tenseiNo = 1; + int fd = getfdFromCharaIndex( toindex); + int i = 1; + BOOL tenflg = FALSE; + char *elder[4] = {"samugiru","marinasu","jaja","karutarna"}; + int point; + int ten_no; + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("Tensei:GetArgStrErr"); + return; + } + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + tenseiNo = CHAR_getInt( toindex, CHAR_TRANSMIGRATION); + tenseiNo++; + if(CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) >= 2){ + tenseiNo--; + } + + sprintf(s_tensei,"TENSEI:%d",tenseiNo); + + while(getStringFromIndexWithDelim( npcarg,"END",i,buf,sizeof( buf)) != FALSE){ + i++; + if(strstr(buf,s_tensei) != NULL) { + tenflg = TRUE; + break; + } + } + //ttom +// print("\nTrans meindex=%d,toindex=%d,num=%d",meindex,toindex,num); + //ttom + CONNECT_set_state_trans(fd,6); + //ttom end + + switch( num){ + case 0: + //ttom + //CONNECT_set_state_trans(fd,0); + //ttom end + ten_no = NPC_TransmigrationCheck(meindex, toindex); + if( +#ifdef _TRANS_6 + ten_no < 6 +#else + ten_no < 5 +#endif//_TRANS_6 + && ten_no >= 0){ + //ʧ + if(NPC_Util_GetStrFromStrWithDelim( buf,"startmsg", token,sizeof( token) ) == NULL) + { + print("startmsgErr"); + return; + } + buttontype = WINDOW_BUTTONTYPE_NEXT; + //ttom + CONNECT_set_state_trans(fd,0); + //ttom end + }else if( +#ifdef _TRANS_6 + ten_no == 6 +#else + ten_no == 5 +#endif//_TRANS_6 + ){ + //Ϸë֧ + if(NPC_Util_GetStrFromStrWithDelim( npcarg,"maxmsg", token,sizeof( token) ) == NULL) + { + print("maxmsgErr"); + return; + } + buttontype = WINDOW_BUTTONTYPE_OK; + }else{ + //ʧƻئ + if(NPC_Util_GetStrFromStrWithDelim( buf,"nonemsg", token,sizeof( token) ) == NULL) + { + print("nonemsgErr"); + return; + } + buttontype = WINDOW_BUTTONTYPE_OK; + + } + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_START; + + break; + + case 1: + if(NPC_Util_GetStrFromStrWithDelim( buf,"mainmsg", token,sizeof( token) ) == NULL) + { + print("mainmsgErr"); + return; + } + buttontype = WINDOW_BUTTONTYPE_OKCANCEL; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_MAIN; + break; + + case 2: + // Robin 2001/03/05 Tensei Check + //if(!CHAR_getWorkInt(toindex,CHAR_TENSEICHECKED)) return; + + point = NPC_StartpointCheck( meindex, toindex); + if(point == -1) { + return; + } + + NPC_Util_GetStrFromStrWithDelim( npcarg,elder[point],buf2,sizeof( buf2)); + if(NPC_TransmigrationMain(meindex, toindex, buf2) == FALSE) + { + return; + } + + + sprintf( tmp, "yesmsg%d", + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT)); + + if(NPC_Util_GetStrFromStrWithDelim( buf,tmp, token,sizeof( token) ) == NULL) + { + print("yesmsgErr"); + return; + } + + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) +1 + ); + sprintf( tmp, "yesmsg%d", + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT)); + + if(strstr(buf, tmp) == NULL) { + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_END; + }else { + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_END; + } + break; + + case 3: + + /*--ƽë浤--*/ + if(NPC_Util_GetStrFromStrWithDelim( buf,"nomsg", token,sizeof( token) ) == NULL) + { + print("nomsgErr"); + return; + } + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_NONE; + + break; + + case 4: + sprintf( tmp, "yesmsg%d", + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT)); + if(NPC_Util_GetStrFromStrWithDelim( buf,tmp, token,sizeof( token) ) == NULL) + { + print("yesmsgErr"); + return; + } + + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) +1 + ); + sprintf( tmp, "yesmsg%d", + CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT)); + + if(strstr(buf, tmp) == NULL) + { + buttontype = WINDOW_BUTTONTYPE_OK; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_END; + }else{ + buttontype = WINDOW_BUTTONTYPE_NEXT; + windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_END; + } + + + break; + case 5: + + // Robin 2001/03/05 Tensei Check + //if(!CHAR_getWorkInt(toindex,CHAR_TENSEICHECKED)) return; + point = NPC_StartpointCheck( meindex, toindex); + if(point == -1) return; + NPC_Util_GetStrFromStrWithDelim( npcarg,elder[point],buf2,sizeof( buf2)); + NPC_TransmigratiomWarp(meindex, toindex, buf2); +// buttontype = WINDOW_BUTTONTYPE_OK; +// windowno = CHAR_WINDOWTYPE_TRANSMIGRATION_END; + return; + break; + + + } +// makeEscapeString( token, escapedname, sizeof(escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} +/*----------------------------------------- +-------------------------------------------*/ +void NPC_TransmigrationWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + + int datanum = -1; + + int fd = getfdFromCharaIndex( talkerindex); + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + //ttom + //CONNECT_set_state_trans(fd,6); + //ttom end + datanum = atoi( data); + switch( seqno) { + case CHAR_WINDOWTYPE_TRANSMIGRATION_START: + if( select == WINDOW_BUTTONTYPE_NEXT) { + //ttom + if(CONNECT_get_state_trans(fd)==0){ } else return; + //ttom end + NPC_Transmigration_selectWindow( meindex, talkerindex,1); + //ttom + CONNECT_set_state_trans(fd,1); + //ttom end + + } + break; + + case CHAR_WINDOWTYPE_TRANSMIGRATION_MAIN: + if( select == WINDOW_BUTTONTYPE_OK) { +#ifdef _FIX_SUPERPERSON_STRANS + if( CHAR_getInt(talkerindex,CHAR_TRANSMIGRATION) == 5 && CHAR_getInt(talkerindex,CHAR_SUPER) > 0){ + if(NPC_EventCheckFlg( talkerindex, 63) == FALSE + || NPC_EventCheckFlg( talkerindex, 136) == FALSE + || NPC_EventCheckFlg( talkerindex, 175) == FALSE + || NPC_EventCheckFlg( talkerindex, 176) == FALSE){ + print("\nǷ6ת"); + return; + } + } +#endif + //ttom + if(CONNECT_get_state_trans(fd)==1){ } else return; + //ttom end + NPC_Transmigration_selectWindow( meindex, talkerindex, 2); + //ttom + CONNECT_set_state_trans(fd,2); + //ttom end + }else if(select == WINDOW_BUTTONTYPE_CANCEL) { + NPC_Transmigration_selectWindow( meindex, talkerindex, 3); + } + break; + + case CHAR_WINDOWTYPE_TRANSMIGRATION_END: + if( select == WINDOW_BUTTONTYPE_NEXT) { + //ttom + if(CONNECT_get_state_trans(fd)==2){ } else return; + //ttom end + NPC_Transmigration_selectWindow( meindex, talkerindex, 4); + //ttom + CONNECT_set_state_trans(fd,4); + //ttom end + }else if( select == WINDOW_BUTTONTYPE_OK) { + //ttom + if(CONNECT_get_state_trans(fd)==4){ } else return; + //ttom end + NPC_Transmigration_selectWindow( meindex, talkerindex, 5); + } + break; + +//ANDY_ADD 10/19 +#ifdef _PET_TRANS + + case CHAR_WINDOWTYPE_PETTRANS_START: //ʼԻ + if( select == WINDOW_BUTTONTYPE_NEXT) { + NPC_PetTransMan_selectWindow( meindex, talkerindex, 1, 0); + } + break; + + case CHAR_WINDOWTYPE_PETTRANS_SELECT: //Ƿóת + if( select == WINDOW_BUTTONTYPE_YES) { + NPC_PetTransMan_selectWindow( meindex, talkerindex, 2, 0); + }else { + NPC_PetTransMan_selectWindow( meindex, talkerindex, 5, 0); + } + break; + + case CHAR_WINDOWTYPE_PETTRANS_SELPET: //ѡ + if(select==WINDOW_BUTTONTYPE_CANCEL) { + NPC_PetTransMan_selectWindow( meindex, talkerindex, 5,-1 ); + }else { + Pet_Select = datanum; + NPC_PetTransMan_selectWindow( meindex, talkerindex, 3, datanum ); + } + break; + + case CHAR_WINDOWTYPE_PETTRANS_MAIN1: //ȷ ȷ/ȡ + if(select==WINDOW_BUTTONTYPE_YES){ + NPC_PetTransMan_selectWindow( meindex, talkerindex, 4, Pet_Select); + }else { + NPC_PetTransMan_selectWindow( meindex, talkerindex, 5, -1); + } + break; + + case CHAR_WINDOWTYPE_PETTRANS_END: //ת + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + break; + +#endif + + } + + +} + +//************************************************************ +//************************************************************ +BOOL NPC_TransmigratiomWarp(int meindex, int toindex, char *buf) +{ + char buf2[512]; + char buf3[128]; + char buf4[64]; + int floor=0 , x = 0, y = 0; + int i = 1; + int ret; + + while(getStringFromIndexWithDelim( buf,",",i,buf2,sizeof( buf2)) + != FALSE) + { + i++; + if(strstr(buf2,"Warp") != NULL) + { + getStringFromIndexWithDelim( buf2 ,"=" ,2, buf3 ,sizeof(buf3)); + //׷ʧ + ret = getStringFromIndexWithDelim( buf3,".",1 ,buf4 ,sizeof( buf4)); + if(ret ==FALSE) return FALSE; + floor = atoi(buf4); + ret = getStringFromIndexWithDelim( buf3,".",2 ,buf4 ,sizeof( buf4)); + if(ret ==FALSE) return FALSE; + x = atoi(buf4); + ret = getStringFromIndexWithDelim( buf3,".",3 ,buf4 ,sizeof( buf4)); + if(ret ==FALSE) return FALSE; + y = atoi(buf4); + + } + } + + + //Ƽ + if( MAP_IsValidCoordinate( floor, x, y )== FALSE ){ + return FALSE; + } + + //ttom + /* + { + int tenseiNo; + tenseiNo=CHAR_getInt( toindex, CHAR_TRANSMIGRATION); + CHAR_setInt( toindex,CHAR_SKILLUPPOINT,tenseiNo*10); + print("\n the set the skillpoint %d",tenseiNo*10); + CHAR_sendStatusString( toindex , "P"); + } + */ + //ttom + + // + CHAR_warpToSpecificPoint(toindex, floor, x, y); + + return TRUE; + +} + +//************************************************************ +// +// ߡة׻ +// ࡰѨϵ +// ᡰҳ +// ⡰л +// Ԩࡰ޷¡ +//************************************************************ +int NPC_StartpointCheck(int meindex,int talker) +{ + int point; + int shift = 0; + point = CHAR_getInt( talker, CHAR_SAVEPOINT); + for(shift = 0; shift < 4 ;shift++){ + if( (point & ( 1<< shift)) == ( 1<< shift)) { + return shift; + } + } + return -1; +} + +//******************************************************** +// +// +// +//******************************************************** +static int NPC_TransmigrationCheck(int meindex, int talker) +{ + // Ϸ + //ìﻥ߶ + //㹴ìδȻ³ + int i,j,k=0; + int ch_no[4] = {39,40,42,46}; + int petindex; + int num; +// int petid[4] = {1, 2, 3, 4}; //ʸ ë϶ + int petid[4] = {693, 694, 695, 696}; //ʸ ë϶ +// int petidfinal[4] = {11, 12, 13, 14}; //ʸ ë϶ + int petidfinal[4] = {693, 694, 695, 696}; //ʸ ë϶ + + // Robin 2001/03/05 + //CHAR_setWorkInt(talker,CHAR_TENSEICHECKED,FALSE); +#ifdef _TRANS_6 + if(CHAR_getInt( talker, CHAR_TRANSMIGRATION) >= 6){ + return 6; + } +#else + if(CHAR_getInt( talker, CHAR_TRANSMIGRATION) >= 5){ + return 5; + } +#endif + + //ìﻥ߶ + if(CHAR_getInt( talker, CHAR_LV) < 80) return -1; + + //ì׷º +#ifdef _TRANS_6 + if(CHAR_getInt( talker, CHAR_TRANSMIGRATION) < 6){ +#else + if(CHAR_getInt( talker, CHAR_TRANSMIGRATION) < 5){ +#endif + for(i = 0; i < 4 ;i++) + if(NPC_EventCheckFlg( talker, ch_no[i] ) == FALSE) return -1; + } + + num = CHAR_getInt(talker, CHAR_TRANSMIGRATION); + + if(num < 4 ){ + //϶ʸëȻ¾ʸ + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + //ttom + //print("petid=%d ",CHAR_getInt( petindex, CHAR_PETID)); + if(CHAR_getInt( petindex, CHAR_PETID) != petid[num]) continue; + +// if(CHAR_getInt( petindex, CHAR_LV) < PETLEVEL) continue; + break; + } + if(i == CHAR_MAXPETHAVE) return -1; + }else +#ifdef _TRANS_6 + if( num == 4 ) +#endif + { + for(j = 0; j < 4 ;j++){ + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + // print("petid=%d ",CHAR_getInt( petindex, CHAR_PETID)); + if(CHAR_getInt( petindex, CHAR_PETID) != petidfinal[j]) continue; + k++; + break; + } + } + if(k < 4) return -1; + } +#ifdef _TRANS_6 + else{ + /*int lasttalkelder = 2;// + if( CHAR_getInt( talker, CHAR_LASTTALKELDER) == 1 )//˿ + lasttalkelder = 112;// + else if( CHAR_getInt( talker, CHAR_LASTTALKELDER) == 2 )//Ӽ + lasttalkelder = 102;//˿˶ + else if( CHAR_getInt( talker, CHAR_LASTTALKELDER) == 3 )//³ + lasttalkelder = 34;// + print("\npetid:%d",lasttalkelder);*/ + + //ҿûд2ת + for(i=0 ; i < CHAR_MAXPETHAVE ; i++){ + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) continue; + if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION) == 2 + && ( CHAR_getInt( petindex, CHAR_PETID) == 2 + || CHAR_getInt( petindex, CHAR_PETID) == 112 + || CHAR_getInt( petindex, CHAR_PETID) == 102 + || CHAR_getInt( petindex, CHAR_PETID) == 34 ) ) break; + //if(CHAR_getInt( petindex, CHAR_TRANSMIGRATION) != 2 || CHAR_getInt( petindex, CHAR_PETID) != lasttalkelder ) continue; + } + if(i == CHAR_MAXPETHAVE){ + CHAR_talkToCli( talker,-1,"ûд2תijŶ!",CHAR_COLORWHITE); + return -1; + } + + + if(NPC_EventCheckFlg( talker, 63) == FALSE){ print("\nerr63");return -1;} + if(NPC_EventCheckFlg( talker, 136) == FALSE){ print("\nerr136");return -1;} + if(NPC_EventCheckFlg( talker, 175) == FALSE){ print("\nerr175");return -1;} + if(NPC_EventCheckFlg( talker, 176) == FALSE){ print("\nerr176");return -1;} + //15ħ֮Ƭ + j=0; + for( i=0 ; i 6) + CHAR_setInt(toindex ,CHAR_TRANSMIGRATION,6); + if( CHAR_getInt(toindex,CHAR_TRANSMIGRATION) == 6 )//6ת͵ij + present = 2546; +#else + if(CHAR_getInt( toindex, CHAR_TRANSMIGRATION) > 5) + CHAR_setInt(toindex ,CHAR_TRANSMIGRATION,5); +#endif + NPC_TransmigrationStatus(meindex, toindex, work); + NPC_TransmigrationFlg_CLS(meindex, toindex); + CHAR_setInt(toindex, CHAR_LV ,1); + CHAR_setMaxExp( toindex, 0); + +#ifdef _TRANS_6 +//ɾħ֮Ƭ + for( i=0 ; i> 16 ) & 0xFFFF); + level = (float)(( equ >> 0 ) & 0xFFFF); + //tttom + //print("\n this test equ=%d,quest=%f,level=%f",equ,quest,level); + //Ϸ + num = CHAR_getInt(toindex, CHAR_TRANSMIGRATION); // ǰѼ1,0ת1ʱΪ1 + tmp = (float)para / 100; +#ifdef _TRANS_6 + if (num == 6) tmp = 620; // תʱɵ +#endif + ans =(float)tmp/12 + (float)(quest / 4) +( (float)(level- num * 85) /4); + return (int)ans; +} + +//******************************************************* +//******************************************************* +float Rounding(float work,int num) +{ + + float p; + + if(num <0 ) return work; + num--; + p = (float)pow(10,num); + + return ( (work * p + 0.5) /p); + + +} + +//******************************************************* +// +// +//******************************************************* +BOOL NPC_TransmigrationStatus(int meindex, int toindex,int work[10]) +{ + int vital, str, tgh, dex; + int quest , level ,equ; + int t_quest, t_level; + int total,ans; + float tmp,lvup; + + vital = CHAR_getInt(toindex,CHAR_VITAL); + str = CHAR_getInt(toindex,CHAR_STR); + tgh = CHAR_getInt(toindex,CHAR_TOUGH); + dex = CHAR_getInt(toindex,CHAR_DEX); + + + //;޵׷ºë + quest = NPC_TransmigrationQuestCheck( toindex); + //ì + level = CHAR_getInt(toindex,CHAR_LV); + + work[0] = level; + work[1] = quest; + + equ = CHAR_getInt(toindex, CHAR_TRANSEQUATION); + + t_quest = (float)(( equ >> 16 ) & 0xFFFF); + t_level = (float)(( equ >> 0 ) & 0xFFFF); + + if( level > 130 ) level = 130; + t_quest = t_quest + quest; + t_level = t_level + level; + + CHAR_setInt(toindex, CHAR_TRANSEQUATION, + ( t_quest << 16 )+( t_level << 0 ) + ); + + total = vital + str + tgh + dex; + ans = NPC_TransCalculation(toindex, total); + + work[2] = vital; + tmp = (float)vital/total * ans; + work[3] = Rounding(tmp,1) * 100; + + work[4] = str; + tmp = (float)str/total * ans; + work[5] = Rounding(tmp,1) * 100; + + work[6] = tgh; + tmp = (float)tgh/total * ans; + work[7] = Rounding(tmp,1) * 100; + + work[8] = dex; + tmp = (float)dex/total * ans; + work[9] = Rounding(tmp,1) * 100; + + //vital + if(work[3] < 0) work[3] = 0; + CHAR_setInt(toindex, CHAR_VITAL, work[3]); + //str + if(work[5] < 0) work[5] = 0; + CHAR_setInt(toindex, CHAR_STR, work[5]); + + //tghr + if(work[7] < 0) work[7] = 0; + CHAR_setInt(toindex, CHAR_TOUGH, work[7]); + + //dex + if(work[9] < 0) work[9] = 0; + CHAR_setInt(toindex, CHAR_DEX, work[9]); + + + + lvup = CHAR_getInt(toindex, CHAR_SKILLUPPOINT ); +/*#ifdef _TRANS_6 + if( CHAR_getInt(toindex, CHAR_TRANSMIGRATION) == 6) + lvup = 620; +#endif*/ + lvup = lvup / 12; + lvup = Rounding(lvup, 1); + if(lvup < 0) lvup = 0; + CHAR_setInt(toindex, CHAR_SKILLUPPOINT, (int)lvup); + + /* ƽʧƥճľë˪ */ + if( CHAR_getInt( toindex,CHAR_SKILLUPPOINT ) >=1 ) + CHAR_Skillupsend(toindex); + + + return TRUE; + + +} + + +/*---------------------------- + * ʸëܰ + ------------------------------*/ +BOOL NPC_TransmigrationAddPet(int meindex, int talker, int petid) +{ + int ret; + char msgbuf[64]; + int enemynum; + int i,j; + int petindex; + int petindex2; + for( i = 0 ;i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( talker, i); + if( petindex == -1 ) break; + } + if(i == CHAR_MAXPETHAVE) return FALSE; + enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) { + if( ENEMY_getInt( i, ENEMY_ID) == petid) { + break; + } + } + + if( i == enemynum ) return FALSE; + + ret = ENEMY_createPetFromEnemyIndex( talker, i); + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ){ + if( CHAR_getCharPet( talker, i ) == ret )break; + } + if( i == CHAR_MAXPETHAVE ) i = 0; + if( CHAR_CHECKINDEX( ret ) == TRUE ){ + CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV )); + } + + petindex2 = CHAR_getCharPet(talker, i); + if( !CHAR_CHECKINDEX( petindex2) ) return FALSE; + + snprintf( msgbuf,sizeof( msgbuf), "õ%s", + CHAR_getChar(petindex2,CHAR_NAME)); + CHAR_talkToCli( talker, -1, msgbuf, CHAR_COLORWHITE); + for(j = 0; j < CHAR_MAXPETHAVE; j++){ + petindex = CHAR_getCharPet(talker, j); + if( !CHAR_CHECKINDEX( petindex) ) continue; + CHAR_complianceParameter( petindex ); + snprintf( msgbuf, sizeof( msgbuf ), "K%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", j ); + CHAR_sendStatusString( talker, msgbuf ); + } + LogPet( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), + CHAR_getChar( petindex2, CHAR_NAME), + CHAR_getInt( petindex2, CHAR_LV), + "TenseiGet", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + CHAR_getChar( petindex2, CHAR_UNIQUECODE) // shan 2001/12/14 + ); + + return TRUE; + +} + +#ifdef _TEACHER_SYSTEM +extern int FMAdvTbl[]; +#endif + +int NPC_TransmigrationFlg_CLS(int meindex, int toindex) +{ +#ifdef _TEACHER_SYSTEM + int iGetFame = 0; +#endif +#ifdef _PET_TRANS +#ifdef _PROSK99 + int endevflg[]={69,70,71,72,109,118,122,131,127,158,159,181,-1};//181:ǽƷ +#else + int endevflg[]={69,70,71,72,109,118,122,131,127,158,159,-1}; +#endif + int nowevflg[]={69,70,71,72,-1}; +#endif +#ifdef _TRANS_6 + int flg[6] = {48,49,50,51,52,179}; +#else + int flg[5] = {48,49,50,51,52}; +#endif + int num= CHAR_getInt(toindex ,CHAR_TRANSMIGRATION); + int i; +#ifdef _PET_TRANS + i=0; + while(endevflg[i] != -1 ) { + if( NPC_EventCheckFlg( toindex, endevflg[i] ) == FALSE ) { + endevflg[i] = 0; + } + i++; + } + i=0; + while( nowevflg[i] != -1 ) { + if( NPC_NowEventCheckFlg( toindex, nowevflg[i] ) == FALSE ) { + nowevflg[i] = 0; + } + i++; + } +#endif + + CHAR_setInt(toindex,CHAR_ENDEVENT,0); + CHAR_setInt(toindex,CHAR_ENDEVENT2,0); + CHAR_setInt(toindex,CHAR_ENDEVENT3,0); +#ifdef _NEWEVENT + CHAR_setInt(toindex,CHAR_ENDEVENT4,0); + CHAR_setInt(toindex,CHAR_ENDEVENT5,0); + CHAR_setInt(toindex,CHAR_ENDEVENT6,0); +#endif + CHAR_setInt(toindex,CHAR_NOWEVENT,0); + CHAR_setInt(toindex,CHAR_NOWEVENT2,0); + CHAR_setInt(toindex,CHAR_NOWEVENT3,0); +#ifdef _NEWEVENT + CHAR_setInt(toindex,CHAR_NOWEVENT4,0); + CHAR_setInt(toindex,CHAR_NOWEVENT5,0); + CHAR_setInt(toindex,CHAR_NOWEVENT6,0); +#endif +#ifdef _ADD_NEWEVENT // WON + CHAR_setInt(toindex,CHAR_ENDEVENT7,0); + CHAR_setInt(toindex,CHAR_NOWEVENT7,0); + CHAR_setInt(toindex,CHAR_ENDEVENT8,0); + CHAR_setInt(toindex,CHAR_NOWEVENT8,0); +#endif +#ifdef _PET_TRANS + i=0; + while( endevflg[i] != -1 ) { + if( endevflg[i] > 0 ) { + // shan Begin + //NPC_EventSetFlg( toindex, endevflg[i]); + s_eventsetend(toindex, endevflg[i]); + // End + } + i++; + } + i=0; + while( nowevflg[i] != -1 ) { + if( nowevflg[i] > 0 ) { + NPC_NowEventSetFlg( toindex, nowevflg[i]); + } + i++; + } + +#endif + + for(i = 0 ;i < num ;i++) { + NPC_EventSetFlg(toindex, flg[i]); + // CoolFish: Family Adv 2001/8/4 + AddFMAdv(toindex, flg[i]); +#ifdef _TEACHER_SYSTEM + // ۼ + if(flg[i] < 179){ + if (getPetUpGetExp()!=2){ + iGetFame += FMAdvTbl[flg[i]]; + }else{ + iGetFame +=0; + } + } +#endif + } +#ifdef _TEACHER_SYSTEM + iGetFame /= 20; // ʦѧ 5% (1/20) + // õûд0 + if(iGetFame > 0){ + // ûеʦ + if(strlen(CHAR_getChar(toindex,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(toindex,CHAR_TEACHER_NAME)) > 0){ + int iPlayernum = CHAR_getPlayerMaxNum(); + char szMsg[128]; + + // 鵼ʦڲ + for(i=0;i= 0 ) + errtype = 3; + + if( errtype >= 0 ) { + if( NPC_Util_GetStrFromStrWithDelim( buf,errchar[ errtype], token,sizeof( token)) == NULL ) { + print("\n ERROR str errchar !!"); + return; + } + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_PETTRANS_END; + break; + } + if( NPC_Util_GetStrFromStrWithDelim( buf,"selectmsg", token,sizeof( token)) == NULL ) { + print("\n ERROR selectmsg !!"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 1); + windowno = CHAR_WINDOWTYPE_PETTRANS_SELECT; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype=WINDOW_BUTTONTYPE_YESNO; + break; + + case 2: //ѡ + if( NPC_Util_GetStrFromStrWithDelim( buf,"setpetmsg", token,sizeof( token)) == NULL ) { + print("\n ERROR setpetmsg !!"); + return; + } + buttontype = WINDOW_BUTTONTYPE_NONE; + windowtype = WINDOW_MESSAGETYPE_PETSELECT; + windowno = CHAR_WINDOWTYPE_PETTRANS_SELPET; + break; + + case 3: //ת ȷ/ȡ + if( NPC_Util_GetStrFromStrWithDelim( buf,"transmsg", buf1,sizeof( buf1)) == NULL ){ + print("\n ERROR transmsg !!"); + return; + } + strcpy( token,"\0"); + petindex = CHAR_getCharPet( toindex, select-1); + petname = CHAR_getUseName( petindex); + sprintf(token, "\n[%s]ûɣ \n\n %s",petname,buf1); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = CHAR_WINDOWTYPE_PETTRANS_MAIN1; + break; + + case 4: //ת CHAR_TRANSMIGRATION + //תж + petindex = CHAR_getCharPet( toindex, select-1); + if( !CHAR_CHECKINDEX( petindex) ) { + return; + } +#ifdef _FUSIONBEIT_TRANS + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT ) > getFusionbeitTrans()) { + sprintf(token, "\n\nںϹijѾܹףร"); +#else + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT ) == 1 ) { + sprintf(token, "\n\nںϹijﲻתร"); +#endif + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + }else +#ifdef _PET_2TRANS + if( CHAR_getInt( toindex, CHAR_RIDEPET ) == select-1 /*&& CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 0*/ ){//еijﲻת + sprintf(token, "\n\nеijﲻתร"); + }else +#endif + if( CHAR_getInt( petindex, CHAR_LV) < 80 ) { + sprintf(token, "\n\nתףijҪȼ80ร"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + }else if( CHAR_getInt( petindex, CHAR_PETID) == 718 +#ifdef _PET_2TRANS + || CHAR_getInt( petindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( petindex, CHAR_PETID) == getMMPETID2() +#endif + ){ + sprintf(token, "\n\nֻﲻתร"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); +#ifdef _PET_2TRANS +#ifdef _FUSIONBEIT_TRANS + }else if( CHAR_getInt( petindex, CHAR_FUSIONBEIT ) == 0 && + CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 2 ) { +#else + }else if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 1 ) { +#endif +#else + }else if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 0 ) { +#endif + sprintf(token, "\n\nֻѾܹףร"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + //Ƿظת + }else { // תϣ + petindex = CHAR_getCharPet( toindex, select-1); + if( NPC_PetTransManStatus( meindex, toindex, petindex) == FALSE ) + return; + if( NPC_Util_GetStrFromStrWithDelim( buf,"main1msg", token,sizeof( token)) == NULL ) + return; +#ifdef _FUSIONBEIT_TRANS + if( CHAR_getInt( petindex, CHAR_FUSIONBEIT ) >= 1 ) + CHAR_setInt( petindex, CHAR_FUSIONBEIT ,CHAR_getInt( petindex, CHAR_FUSIONBEIT )+1); +#endif + CHAR_charSaveFromConnect(toindex, FALSE); + CHAR_talkToCli(toindex, -1, "ϵͳΪԶ浵", CHAR_COLORRED); + } + + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_PETTRANS_END; // + break; + + case 5: //תȡ + if( NPC_Util_GetStrFromStrWithDelim( buf,"cancelmsg", token,sizeof( token)) == NULL ) + return; + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + buttontype = WINDOW_BUTTONTYPE_OK; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + windowno = CHAR_WINDOWTYPE_PETTRANS_END; // + break; + + default: + break; + } + lssproto_WN_send( fd, windowtype, buttontype, windowno, CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); + +} + +int NPC_PetTransManCheck( int meindex, int toindex, int select) +{ + //char errchar[][56]={"errormy","erroritem","errorpet","failmsg"}; + int i; + int petindex = 0; + char token[256]; + int PetEvent_no[3]={4,69,70}; + //int PetEvent_no[3]={4,4,4}; + + int petNum = 0; + //ת + if( CHAR_getInt( toindex, CHAR_LV ) < 80 ) { + return 0; + }else { + //FLAG ǷɳתҪ + for(i = 0; i < 3 ;i++) { + if( NPC_EventCheckFlg( toindex, PetEvent_no[i] ) == FALSE) { + return 0; + } + } + //(/) & Ʒ + for(i=0 ; i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( toindex, i); + if( petindex == -1 ) + continue; + // ID ǷΪ׷ 1479 ID Ϊ718 + if(CHAR_getInt( petindex, CHAR_PETID) == 718 +#ifdef _PET_2TRANS + || CHAR_getInt( petindex, CHAR_PETID) == 401 +#endif +#ifdef _PET_3TRANS + || CHAR_getInt( petindex, CHAR_PETID) == getMMPETID2() +#endif + ){ + petNum ++; + if( CHAR_getInt( petindex, CHAR_LV) > 79 ) { + return 0; + }else if( CHAR_getInt( petindex, CHAR_LV) == 79 ) { + if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( toindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( toindex, CHAR_NAME) )) { + sprintf( token,"ϵ׷ţİ"); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORWHITE); + return 0; + } + } + } + } + + if( petNum > 1 ) { + sprintf( token,"׷أ"); + CHAR_talkToCli( toindex, -1, token, CHAR_COLORWHITE); + print("\n error PetTrans : (PETID = 718) > 1 !!"); + return 0; + }else if( petNum != 1 ) { + print("\n ת !!"); + return 0; + } + } + return -1; +} + +BOOL NPC_PetTransManStatus( int meindex, int toindex, int petNo) +{ + int petindex; + int LevelUpPoint = 0,petrank = 0; + int i,j,k,itemindex,itemID,count; + int vital1,str1,tgh1,dex1; + int vital2,str2,tgh2,dex2; +#ifdef _PET_3TRANS + int vital3,str3,tgh3,dex3,total3,tpetidx3; +#endif + char token[128]; + int total1,total2,total,petLV,ans; + int petID,enemynum,ret; + int work[4]={0,0,0,0}; + struct PetTransDelItem { + int minItemID; + int maxItemID; + }DelItem[3] = { {19629,19632} , {19672,19687} , {19625,19628} }; +#define RAND(x,y) ((x-1)+1+ (int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)) ) +#ifdef _PET_2TRANS + int tran = CHAR_getInt ( petNo, CHAR_TRANSMIGRATION ); + int tpetidx1,tpetidx2; + if( tran == 0 ){ + tpetidx1 = 718; + tpetidx2 = 401; +#ifdef _PET_3TRANS + tpetidx3 = getMMPETID2(); + } + else + if( tran == 1 ){ + tpetidx1 = 401; + tpetidx2 = getMMPETID2(); + tpetidx3 = getMMPETID2(); + }else + if( tran == 2 ){ + tpetidx1 = getMMPETID2(); + tpetidx2 = getMMPETID2(); + tpetidx3 = getMMPETID2(); + }else{ + tpetidx1 = 401; + tpetidx2 = getMMPETID2(); + tpetidx3 = getMMPETID2(); + } +#else + } + else{ + tpetidx1 = 401; + tpetidx2 = 401; + } +#endif +#endif + + for(i=0 ; i < CHAR_MAXPETHAVE ; i++) { + petindex = CHAR_getCharPet( toindex, i); + if( petindex == -1 ) + continue; + if( +#ifdef _PET_2TRANS + CHAR_getInt( petindex, CHAR_PETID) == tpetidx1 + || CHAR_getInt( petindex, CHAR_PETID) == tpetidx2 +#ifdef _PET_3TRANS + || CHAR_getInt( petindex, CHAR_PETID) == tpetidx3 +#endif +#else + CHAR_getInt( petindex, CHAR_PETID) == 718 +#endif + ){ + if( CHAR_getInt( petindex, CHAR_LV) == 79 ){ + if( strcmp( CHAR_getChar( petindex, CHAR_OWNERCDKEY), CHAR_getChar( toindex, CHAR_CDKEY) ) || + strcmp( CHAR_getChar( petindex, CHAR_OWNERCHARANAME), CHAR_getChar( toindex, CHAR_NAME) )) { + continue; + } + break; + } + } + } + if(i == CHAR_MAXPETHAVE) { + print("\n ת !!"); + return FALSE; + } + + LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( petindex, CHAR_PETRANK ); + + vital1 = (float)(( LevelUpPoint >> 24 ) & 0xFF); + str1 = (float)(( LevelUpPoint >> 16 ) & 0xFF); + tgh1 = (float)(( LevelUpPoint >> 8 ) & 0xFF); + dex1 = (float)(( LevelUpPoint >> 0 ) & 0xFF); + if(vital1 < 1)vital1 = 1; + if(str1 < 1)str1 = 1; + if(tgh1 < 1)tgh1 = 1; + if(dex1 < 1)dex1 = 1; + total1 = ( vital1 + str1 + tgh1 + dex1 ); +#ifdef _PET_TRANS_ABILITY + if( total1 > getPetTransAbility1() ) total1 = getPetTransAbility1(); +#else + if( total1 > 150 ) total1 = 150; +#endif + if( total1 < 0 ) total1 = 0; + LevelUpPoint = CHAR_getInt( petNo, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( petNo, CHAR_PETRANK ); + petLV = CHAR_getInt( petNo, CHAR_LV); + vital2 = (float)(( LevelUpPoint >> 24 ) & 0xFF); + str2 = (float)(( LevelUpPoint >> 16 ) & 0xFF); + tgh2 = (float)(( LevelUpPoint >> 8 ) & 0xFF); + dex2 = (float)(( LevelUpPoint >> 0 ) & 0xFF); + if(vital2 < 1)vital2 = 1; + if(str2 < 1)str2 = 1; + if(tgh2 < 1)tgh2 = 1; + if(dex2 < 1)dex2 = 1; + total2 = ( vital2 + str2 + tgh2 + dex2 ); + +#ifdef _PET_3TRANS +#ifdef _PET_TRANS_ABILITY + if( total2 > getPetTransAbility2() ) total2 = getPetTransAbility2(); +#else + if( total2 > 200 ) total2 = 200; +#endif + if( total2 < 0 ) total2 = 0; + LevelUpPoint = CHAR_getInt( petNo, CHAR_ALLOCPOINT ); + petrank = CHAR_getInt( petNo, CHAR_PETRANK ); + petLV = CHAR_getInt( petNo, CHAR_LV); + vital3 = (float)(( LevelUpPoint >> 24 ) & 0xFF); + str3 = (float)(( LevelUpPoint >> 16 ) & 0xFF); + tgh3 = (float)(( LevelUpPoint >> 8 ) & 0xFF); + dex3 = (float)(( LevelUpPoint >> 0 ) & 0xFF); + total3 = ( vital3 + str3 + tgh3 + dex3 ); +#ifdef _PET_TRANS_ABILITY + if( total3 > getPetTransAbility3() ) total3 = getPetTransAbility3(); +#else + if( total3 > 250 ) total3 = 250; +#endif +#endif + +#ifdef _PET_2TRANS + ans = NPC_PetTransManGetAns( total1, total2, petLV, petrank, CHAR_getInt( petNo, CHAR_TRANSMIGRATION ) ); +#else + ans = NPC_PetTransManGetAns( total1, total2, petLV, petrank); +#endif + total = total1 + (total2*4); + + work[0] = ( ans * ( vital1 + (vital2*4) ) ) / total; + work[1] = ( ans * ( str1 + (str2*4) ) ) / total; + work[2] = ( ans * ( tgh1 + (tgh2*4) ) ) / total; + work[3] = ( ans * ( dex1 + (dex2*4) ) ) / total; +//ȡarray========================= + enemynum = ENEMY_getEnemyNum(); + for(i=0;i= DelItem[j].minItemID ) && ( itemID <= DelItem[j].maxItemID ) ) { + LogItem( + CHAR_getChar( toindex, CHAR_NAME ), + CHAR_getChar( toindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), +#endif + "WarpManDelItem", + CHAR_getInt( toindex, CHAR_FLOOR), + CHAR_getInt( toindex, CHAR_X ), + CHAR_getInt( toindex, CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + CHAR_DelItem( toindex, i); + } + + }//for(j) + } + } + + NPC_NowEventSetFlg( toindex, 71 ); + + return TRUE; +} + + + +// shan add +void s_eventsetend( int charaindex, int shiftbit ) +{ +#ifdef _ADD_NEWEVENT // WON + int event_num = 8; +#else + int event_num = 6; +#endif + int point; + int array; + int shift; + + array = shiftbit / 32; + shift = shiftbit % 32; + + if( array>=event_num ){ + //print("󣡣ѳΧ(0~%d)",32*event_num-1); + return; + } + point = CHAR_getInt( charaindex, CHAR_ENDEVENT+array); + point = point | (1< +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "npc_eventaction.h" +#include "readmap.h" +#include "log.h" +#include "family.h" +#ifdef _VIGOR_SYS +#define MAXSHOPITEM 33 +static void NPC_ItemVigorShop_selectWindow( int meindex, int talker, int num,int select); +void NPC_ItemVigorShop_BuyMain(int meindex,int talker,int before ); +void NPC_GetItemVigorList(char *argstr,char * argtoken2); + #ifdef _NEW_MANOR_LAW + void NPC_ItemVigorStrStr(int itemID,double rate,char *name,char *token2,int iCostVigor,int iChangeItemCost); + #else + void NPC_ItemVigorStrStr(int itemID,double rate,char *name,char *token2); + #endif + +BOOL NPC_SetNewItemVigor(int meindex,int talker,char *data); +BOOL NPC_SellNewItemVigor(int meindex,int talker,char *data); + +void NPC_ItemVigorShop_Menu(int meindex,int talker); + +int NPC_GetLimtItemVigorList(int talker,char *argstr,char *token2,int sell); + +void NPC_ItemVigorShop_SellMain(int meindex,int talker,int select); +int NPC_GetSellItemVigorList(int itemindex,int flg,char *argstr,char *argtoken,int select,int sell); +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemVigorBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostVigor,int iChangeItemCost); +#else +BOOL NPC_AddItemVigorBuy(int meindex, int talker,int itemID,int kosuu,double rate); +#endif +int NPC_SellItemVigorstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell); +void NPC_LimitItemVigorShop(int meindex,int talker,int select); +void NPC_VigorExpressmanCheck(int meindex,int talker); + +enum{ + NPC_SHOP_WORK_NO = CHAR_NPCWORKINT1, + NPC_SHOP_WORK_EV = CHAR_NPCWORKINT2, + NPC_SHOP_WORK_EXPRESS = CHAR_NPCWORKINT3, +}; + + + +typedef struct { + char arg[32]; + int type; +}NPC_Shop; + + +static NPC_Shop TypeTable[] = { + { "FIST", 0 }, //ȭ + { "AXE", 1 }, // + { "CLUB", 2 }, // + { "SPEAR", 3}, //ì + { "BOW", 4}, // + { "SHIELD", 5}, // + { "HELM", 6 }, //ͷ + { "ARMOUR", 7 }, // + { "BRACELET", 8}, // + { "ANCLET", 9 }, // + { "NECKLACE", 10}, // + { "RING", 11}, //ָ + { "BELT", 12}, // + { "EARRING", 13}, // + { "NOSERING", 14}, //ǻ + { "AMULET", 15}, // + { "OTHER", 16}, + { "BOOMERANG", 17}, // + { "BOUNDTHROW", 18}, + { "BREAKTHROW", 19}, //Ͷ +#ifdef _ITEM_TYPETABLE + { "DISH", 20}, + { "METAL", 21}, + { "JEWEL", 22}, + { "WARES", 23}, + { "WBELT", 24}, + { "WSHIELD", 25}, + { "WSHOES", 26}, + { "WGLOVE", 27}, + { "ANGELTOKEN", 28}, + { "HEROTOKEN", 29}, +#endif + { "ACCESSORY", 30}, // + { "OFFENCE", 40}, // + { "DEFENCE", 50}, // + +}; + +BOOL NPC_ItemVigorShopInit( int meindex ) +{ + + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEITEMSHOP ); + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + if(strstr(argstr,"LIMITSHOP") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_NO, 0); + } + if(strstr( argstr, "EVENT") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EV, 0); + } + if(strstr( argstr, "EXPRESS") != NULL) { + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 1); + }else{ + CHAR_setWorkInt( meindex, NPC_SHOP_WORK_EXPRESS, 0); + } + + return TRUE; +} + +void NPC_ItemVigorShopTalked( int meindex , int talker , char *szMes ,int color ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff[1024]; + char buf2[256]; + char token[1024]; + int i = 1; + BOOL sellonlyflg = FALSE; + char sellmsg[1024]; + + if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if(NPC_Util_isFaceToFace( meindex, talker, 2) == FALSE) {//̸ʱǷ + if( NPC_Util_CharDistance( talker, meindex ) > 1) return; //1 + } + + //ȡnpc趨ڵ,ΪNULL, + if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL){ + print("itemshopGetArgStrErr"); + return; + } + + //ȡNPCֻѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", token, sizeof( token)) != NULL){ + sellonlyflg = TRUE; //NPCҵĶ + strcpysafe(sellmsg, sizeof( sellmsg), token);//:sellmsgֵ->רĵꡣ + } + + //ȡָ. buffΪһִָ,:,,л,kau,buy,menu,лл,,ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "buy_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim(buff,",",i,buf2,sizeof(buf2)) != FALSE ){ + i++; //ָ8,iͻӵ8 + if( strstr( szMes, buf2) != NULL) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 0) { + if( CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg ) { + NPC_ItemVigorShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemVigorShop_selectWindow( meindex, talker, 1, -1); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if( sellonlyflg) { + NPC_ItemVigorShop_selectWindow( meindex, talker, 3, -1); + return; + } + }else{ + NPC_ItemVigorShop_selectWindow( meindex, talker, 1, -1); + return; + } + return; + } + } + } + } + i=1; + + //ȡָ. buffΪһִָ,:,,sell,uru ҴЩ־ʱ,Ϳ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "sell_msg", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",", i,buf2,sizeof(buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + NPC_ItemVigorShop_selectWindow( meindex, talker, 2, -1); + return; + } + } + } + i = 1; + + //ѶϢ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "other_msg", buff, sizeof( buff)) != NULL ){ + while(getStringFromIndexWithDelim( buff, ",", i, buf2, sizeof( buf2)) != FALSE ){ + i++; + if(strstr(szMes,buf2) != NULL) { + if(NPC_Util_GetStrFromStrWithDelim( argstr, "hint_msg", + token, sizeof( token)) != NULL) + { + CHAR_talkToCli( talker, meindex, token, CHAR_COLORWHITE); + return; + } + } + } + } + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if( sellonlyflg) { + NPC_ItemVigorShop_selectWindow( meindex, talker, 3, -1); + return; + } + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EV) == 1) { + if( sellonlyflg) { + CHAR_talkToCli( talker, meindex, sellmsg, CHAR_COLORWHITE); + return; + } + }else{ + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1) { + NPC_VigorExpressmanCheck( meindex, talker); + }else{ + NPC_ItemVigorShop_selectWindow( meindex, talker, 0, -1); + } + } + } + +} + +static void NPC_ItemVigorShop_selectWindow( int meindex, int talker, int num,int select) +{ + switch( num) { + case 0: + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);//ͽǮ,100Ԫ ͳȥϸʽΪ P8Nz2|100| + + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_EXPRESS) == 1 ) { + if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) ==0 ) { + NPC_VigorExpressmanCheck( meindex, talker);//ë + } + }else if(CHAR_getWorkInt( meindex, NPC_SHOP_WORK_NO) == 1) { + + }else{ + NPC_ItemVigorShop_Menu( meindex, talker);//ѡ(,,뿪)СӴ + } + break; + + case 1://Ӵ + CHAR_sendStatusString( talker,"I");//еĵ߸Client + NPC_ItemVigorShop_BuyMain( meindex, talker, select); + break; + + case 2://Ӵ + CHAR_sendStatusString( talker,"I"); + NPC_ItemVigorShop_SellMain( meindex, talker, select); + break; + + case 3: + NPC_LimitItemVigorShop( meindex, talker, select); + break; + + } +} + +void NPC_ItemVigorShopWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 3) { + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + + makeStringFromEscaped( data); + + switch( seqno){ + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG: + if(atoi( data) == 1 ) NPC_ItemVigorShop_selectWindow(meindex, talkerindex, 1, -1); + if(atoi( data) == 2) NPC_ItemVigorShop_selectWindow(meindex, talkerindex, 2, -1); + if(atoi( data) == 3) return;/*--ئ--*/ + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG: + if(NPC_SetNewItemVigor(meindex , talkerindex, data) == TRUE) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 1, 0); + }else{ + NPC_ItemVigorShop_selectWindow( meindex, talkerindex ,0, -1); + } + + break; + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG: + if(NPC_SellNewItemVigor(meindex , talkerindex, data) == TRUE) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 2, 0); + + }else{ + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 0, -1); + } + + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT: + if(select == WINDOW_BUTTONTYPE_YES) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex ,2, -1); + + }else if(select == WINDOW_BUTTONTYPE_NO) { + return; + }else if(select == WINDOW_BUTTONTYPE_OK) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 2, -1); + } + break; + + case CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS: + if(atoi(data) == 2) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 1, -1); + }else if(atoi( data) == 4) { + NPC_ItemVigorShop_selectWindow( meindex, talkerindex, 2, -1); + } + } +} + +void NPC_ItemVigorShop_BuyMain(int meindex,int talker,int before ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("itemshop_GetArgStr_Err"); + return; + } +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_VIGOR)); + lssproto_S2_send(fd,token); +#endif + if(before != -1) { + sprintf(token,"0|0"); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + }else{ + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "buy_main", buff2, sizeof( buff2)); + + sprintf(token,"0|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "what_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "level_msg", buff2, sizeof( buff)); + + snprintf( token2, sizeof( token2), "%s|%s", buff, buff2); + + strncat( token, token2, sizeof( token)); + + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "itemfull_msg", buff2, sizeof( buff2)); + + sprintf( token2, "|%s|%s", buff, buff2); + strncat(token , token2,sizeof(token)); + strcpy(token2, "|"); + + NPC_GetItemVigorList( argstr, token2); + strncat( token, token2, sizeof( token)); + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_BUY_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} +void NPC_GetItemVigorList(char *argstr,char *argtoken) +{ + int i = 1; + int tmp; + char *name ="\0"; + char buff2[256]; +#ifdef _NEW_MANOR_LAW + char buff3[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff4[256]; + char buff5[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff6[256]; + int iCostVigor = 0; + int iChangeItemCost = 0; +#endif + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int loopcnt = 0; + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buff2, sizeof( buff2)) + != NULL){ + rate = atof( buff2); + } +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostVigor",buff3,sizeof(buff3)) == NULL) iCostVigor = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buff, sizeof( buff)) != NULL ){ + while( getStringFromIndexWithDelim(buff,",",i,buff2,sizeof(buff2)) !=FALSE ) { +#ifdef _NEW_MANOR_LAW + if(iCostVigor > -1){ + if(getStringFromIndexWithDelim(buff3,",",i,buff4,sizeof(buff4)) != FALSE) iCostVigor = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",i,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + i++; + if(strstr( buff2, "-") == NULL) { + name = ITEM_getNameFromNumber( atoi(buff2)); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemVigorStrStr( atoi( buff2), rate, name, token2,iCostVigor,iChangeItemCost); + #else + NPC_ItemVigorStrStr( atoi( buff2), rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + }else{ + int start; + int end; + getStringFromIndexWithDelim( buff2, "-", 1, token2, sizeof(token2)); + start = atoi( token2); + getStringFromIndexWithDelim( buff2, "-", 2 ,token2, sizeof(token2)); + end = atoi( token2); + if(start > end){ + tmp = start; + start = end; + end = tmp; + } + end++; + for(; start < end ; start++ ) { + /*--ڒo???--*/ + + name = ITEM_getNameFromNumber( start ); + if(name == "\0") continue; + loopcnt++; + if(loopcnt == MAXSHOPITEM) break; + #ifdef _NEW_MANOR_LAW + NPC_ItemVigorStrStr( start, rate, name, token2,iCostVigor,iChangeItemCost); + #else + NPC_ItemVigorStrStr( start, rate, name, token2); + #endif + strncat( argtoken, token2, sizeof(token2)); + } + } + } + } +} + + #ifdef _NEW_MANOR_LAW + void NPC_ItemVigorStrStr(int itemID,double rate,char *name,char *token2,int iCostVigor,int iChangeItemCost) + #else + void NPC_ItemVigorStrStr(int itemID,double rate,char *name,char *token2) + #endif +{ + + int gold; + int level; + int graNo; + char info[1024]; + char escape[256]; + + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + level = ITEM_getlevelFromITEMtabl( itemID); + graNo = ITEM_getgraNoFromITEMtabl( itemID); + strcpy(escape,ITEM_getItemInfoFromNumber( itemID)); + gold=(int)(gold * rate); + + makeEscapeString( escape, info, sizeof( info)); + makeEscapeString( name, escape, sizeof( escape)); +#ifdef _NEW_MANOR_LAW + sprintf(token2,"%s|0|%d|%d|%d|%s|%d|",escape,level,gold,graNo,info,iCostVigor < 0 ? -1:iCostVigor); +#else + sprintf( token2, "%s|0|%d|%d|%d|%s|", escape, level, gold, graNo, info); +#endif +} + +BOOL NPC_SetNewItemVigor(int meindex,int talker,char *data) +{ + + char buf[1024]; + char buff2[128]; +#ifdef _NEW_MANOR_LAW + char buff3[1024]; + char buff4[128]; + char buff5[1024]; + char buff6[128]; + int iCostVigor = 0; + int iChangeItemCost = 0; +#endif + int i = 1, j = 1; + int select; + int kosuu = 0; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + double rate = 1.0; + int gold = 0; + int kosuucnt = 0; + int itemindex; + + /*--߯Ȼ׷ëѱݩ--*/ + getStringFromIndexWithDelim( data, "|", 1, buf, sizeof( buf)); + select = atoi(buf); + if(select == 0) return FALSE; + getStringFromIndexWithDelim( data, "|", 2, buf, sizeof( buf)); + kosuu = atoi(buf); + if( kosuu <= 0 ) return FALSE; + + /*--Ѽ ¾-*/ + for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) { + itemindex = CHAR_getItemIndex( talker , i ); + if( !ITEM_CHECKINDEX( itemindex) ) { + kosuucnt++; + } + } + + /*--߯Ȼ Ѽ ˼ ӡﴡ Իƾмƥ--*/ + /*--ӡ ë ľ--*/ + if( kosuucnt < kosuu) kosuu = kosuucnt; + + /*--δ޷¡--*/ + if(kosuucnt == 0 ) return FALSE; + + i = 1; + + /*--Ҽ̻ 跴̻ﻥئ巴 --*/ + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return FALSE; + } + + /*---ë ئľ1.0)-*/ + if(NPC_Util_GetStrFromStrWithDelim( argstr, "buy_rate", buf, sizeof( buf)) != NULL) { + rate= atof( buf); + } + +#ifdef _NEW_MANOR_LAW + memset(buff3,0,sizeof(buff3)); + memset(buff5,0,sizeof(buff5)); + if(NPC_Util_GetStrFromStrWithDelim(argstr,"CostVigor",buff3,sizeof(buff3)) == NULL) iCostVigor = -1; + if(NPC_Util_GetStrFromStrWithDelim(argstr,"ChangeItemCost",buff5,sizeof(buff5)) == NULL) iChangeItemCost = -1; +#endif + + /*--ʧ ةܰë浤Ƿ-*/ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "ItemList", buf, sizeof( buf)) != NULL ){ + while(getStringFromIndexWithDelim(buf , "," , j, buff2, sizeof(buff2)) != FALSE ){ +#ifdef _NEW_MANOR_LAW + if(iCostVigor > -1){ + if(getStringFromIndexWithDelim(buff3,",",j,buff4,sizeof(buff4)) != FALSE) iCostVigor = atoi(buff4); + } + if(iChangeItemCost > -1){ + if(getStringFromIndexWithDelim(buff5,",",j,buff6,sizeof(buff6)) != FALSE) iChangeItemCost = atoi(buff6); + } +#endif + j++; + /*-- "-"ֳľ¾--*/ + if(strstr( buff2, "-") == NULL) { + if( ITEM_getcostFromITEMtabl(atoi(buff2)) !=-1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemVigorBuy(meindex, talker,atoi(buff2),kosuu,rate,iCostVigor,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemVigorBuy(meindex, talker,atoi(buff2),kosuu,rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + }else{ + /*--ʧ ة 15-25 ƥ˪ľ--*/ + int start; + int end; + + /* "-"ƥľ炙Ѱ Ѱë --*/ + getStringFromIndexWithDelim( buff2, "-", 1, argstr, sizeof(argstr)); + start = atoi( argstr); + getStringFromIndexWithDelim( buff2, "-", 2 ,argstr, sizeof(argstr)); + end = atoi( argstr); + end++; + + /*-- įѱئȻգ ľ׸**/ + if(start > end){ + gold = start; + start = end; + end = gold; + } + + /*--"-"ƥľмʧ ةë ë --*/ + for(; start < end ; start++ ) { + if( ITEM_getcostFromITEMtabl( start) != -1) { + if ( i == select) { + /*---ʧ ة---*/ + /*----*/ +#ifdef _NEW_MANOR_LAW + if(NPC_AddItemVigorBuy(meindex, talker, start, kosuu, rate,iCostVigor,iChangeItemCost) != TRUE) +#else + if(NPC_AddItemVigorBuy(meindex, talker, start, kosuu, rate) != TRUE) +#endif + { + return FALSE; + } + return TRUE; + } + i++; + } + } + } + } + } + + return FALSE; + +} + +/*--------------------------------------------- + *ʧ ةܰë浤 + *--------------------------------------------*/ +#ifdef _NEW_MANOR_LAW +BOOL NPC_AddItemVigorBuy(int meindex, int talker,int itemID,int kosuu,double rate,int iCostVigor,int iChangeItemCost) +#else +BOOL NPC_AddItemVigorBuy(int meindex, int talker,int itemID,int kosuu,double rate) +#endif +{ + + int itemindex; + int i; + int gold; + int ret; + int maxgold; +#ifdef _NEW_MANOR_LAW + int iTotalCostVigor = -1; +#endif + #ifdef _NEW_MANOR_LAW + if(iChangeItemCost > -1) gold = iChangeItemCost; + else + #endif + gold = ITEM_getcostFromITEMtabl( itemID); + gold = (int)(gold * rate); + + maxgold = gold * kosuu; + if(CHAR_getInt( talker, CHAR_GOLD) < maxgold ) return FALSE; +#ifdef _NEW_MANOR_LAW + if(iCostVigor > 0){ + iTotalCostVigor= iCostVigor * kosuu; + if(CHAR_getInt(talker,CHAR_VIGOR) < iTotalCostVigor) return FALSE; + } +#endif + +// if( addNpcFamilyTax( meindex, talker, maxgold*0.4 ) ) +// print(" FamilyTaxDone! "); +// else +// print(" FamilyTaxError!"); + addNpcFamilyTax( meindex, talker, maxgold*0.4 ); + for(i = 0 ; i < kosuu ; i++){ + itemindex = ITEM_makeItemAndRegist( itemID); + + if(itemindex == -1) return FALSE; + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) { + print( "npc_itemshop.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + CHAR_sendItemDataOne( talker, ret); + } + CHAR_DelGold( talker, maxgold); +#ifdef _NEW_MANOR_LAW + if(iTotalCostVigor > 0){ + CHAR_setInt(talker,CHAR_VIGOR,CHAR_getInt(talker,CHAR_VIGOR) - iTotalCostVigor); + if(CHAR_getInt(talker,CHAR_FMINDEX) != -1 && (strcmp(CHAR_getChar(talker,CHAR_FMNAME),""))){ + int fd = getfdFromCharaIndex(talker); + char buf[256]; + sprintf(buf,"%d",CHAR_getInt(talker,CHAR_VIGOR)); +// saacproto_ACFixFMData_send(acfd, +// CHAR_getChar(talker,CHAR_FMNAME), +// CHAR_getInt(talker,CHAR_FMINDEX), +// CHAR_getWorkInt(talker,CHAR_WORKFMINDEXI), +// FM_FIX_FAME,buf,"", +// CHAR_getWorkInt(talker,CHAR_WORKFMCHARINDEX), +// CONNECT_getFdid(fd)); +// LogFMVigorShop(CHAR_getChar(talker,CHAR_FMNAME), +// CHAR_getChar(talker,CHAR_CDKEY), +// CHAR_getChar(talker,CHAR_NAME), +// CHAR_getInt(talker,CHAR_VIGOR), +// iTotalCostVigor); + } + } +#endif + //CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; + +} + +//ѡ (,,ȥ) СӴ +void NPC_ItemVigorShop_Menu(int meindex,int talker) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[256]; + int fd = getfdFromCharaIndex( talker); + + //argstrȡ趨ѶϢ: ->buy_rate:1.0|sell_rate:0.2|buy_msg:,,л,kau,buy............. (мķָǶʱ) + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + //tokenΪӴtitle : ķķߵ|ӭ + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); +#ifdef _NEW_MANOR_LAW + snprintf(token, sizeof(token),"%s|%s|%d",CHAR_getChar(meindex,CHAR_NAME),buff,CHAR_getInt(talker,CHAR_VIGOR)); +#else + snprintf(token, sizeof(token),"%s|%s",CHAR_getChar( meindex, CHAR_NAME), buff); +#endif + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMENU, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + +} + +void NPC_ItemVigorShop_SellMain(int meindex,int talker,int before) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[NPC_UTIL_GETARGSTR_BUFSIZE]; + int fd = getfdFromCharaIndex( talker); + + //ȡnpc趨 + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + +#ifdef _ADD_STATUS_2 + sprintf(token,"FAME|%d",CHAR_getInt(talker,CHAR_VIGOR)); + lssproto_S2_send(fd,token); +#endif + + if(before != -1) { + sprintf(token,"1|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN + +CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + + char token2[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buff2[256]; + char buff[256]; + + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buff, sizeof( buff)); + NPC_Util_GetStrFromStrWithDelim( argstr, "sell_main", buff2, sizeof( buff)); + sprintf( token, "1|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG, + CHAR_getChar( meindex, CHAR_NAME), buff, buff2); + + NPC_Util_GetStrFromStrWithDelim( argstr, "stone_msg", buff, sizeof( buff)); + + if(CHAR_getWorkInt(meindex,NPC_SHOP_WORK_EXPRESS) == 1 ) { + NPC_Util_GetStrFromStrWithDelim( argstr, "exrealy_msg", buff2, sizeof(buff2)); + }else{ + NPC_Util_GetStrFromStrWithDelim( argstr, "realy_msg", buff2, sizeof( buff2)); + } + sprintf( token2,"%s|%s|", buff, buff2); + NPC_GetLimtItemVigorList( talker,argstr, token2, -1);//ϸҪĵ + strncat( token, token2, sizeof( token)); + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_ITEMSHOPMAIN+ + CHAR_getWorkInt(meindex,NPC_SHOP_WORK_NO), + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_SELL_MSG, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } +} +int NPC_GetLimtItemVigorList(int talker, char *argstr, char* token2,int sell) +{ + + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char buff[NPC_UTIL_GETARGSTR_LINEMAX]; + char token3[NPC_UTIL_GETARGSTR_LINEMAX]; + int k = 0 , i = 1 , j = 0; + int imax; + int itemtype = 0; + int itemindex; + int okflg = 0; + char buf[256]; + int flg=0; + int cost; + + if(sell == -1 ){ + i = CHAR_STARTITEMARRAY; + imax = CHAR_MAXITEMHAVE; + flg = -1; + }else{ + i= sell; + imax= sell + 1; + flg = 1; + } + + for( ; i < imax ; i++ ){ + okflg=0; + itemindex = CHAR_getItemIndex( talker , i ); + + if( ITEM_CHECKINDEX( itemindex) ){ + if( NPC_Util_GetStrFromStrWithDelim( argstr,"LimitItemType", buff, sizeof( buff)) != NULL ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ +#ifdef _ITEM_TYPETABLE + int cmpmaxitem = sizeof(TypeTable)/sizeof(TypeTable[0]); +#endif + k++; +#ifdef _ITEM_TYPETABLE + for(j = 0 ; j < cmpmaxitem ; j++){ +#else + for(j = 0 ; j < ITEM_CATEGORYNUM+3 ; j++){ +#endif + if(strcmp( TypeTable[ j].arg , token) == 0 ) { + itemtype = TypeTable[ j].type; + if(ITEM_getInt(itemindex,ITEM_TYPE) == itemtype) { + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat( token2, token3, sizeof( token3)); + okflg = 1; + }else if(itemtype == 30){ + if( 8 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 15) ){ + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 40){ + if(( 0 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 4)) + || (17 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 19))) { + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + }else if(itemtype == 50){ + if( 5 <= ITEM_getInt(itemindex,ITEM_TYPE) + && (ITEM_getInt(itemindex,ITEM_TYPE) <= 7) ){ + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + break; + } + } + + if(okflg == 1) break; + } + } + if( (NPC_Util_GetStrFromStrWithDelim( argstr, "LimitItemNo", buff,sizeof( buff))!= NULL) && okflg == 0 ){ + k = 1; + while(getStringFromIndexWithDelim(buff , "," , k, token, sizeof(token)) != FALSE ){ + k++; + if(strstr( token, "-")==NULL && strcmp(token,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(token)) { + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg=1; + } + }else if (strstr( token, "-") != NULL){ + int start, end; + int work; + + if( getStringFromIndexWithDelim( token, "-", 1, buf, sizeof(buf)) == FALSE ) + return -1; + start = atoi( buf); + if( getStringFromIndexWithDelim( token, "-", 2 ,buf, sizeof(buf)) == FALSE ) + return -1; + end = atoi( buf); + + if(start > end){ + work = start; + start = end; + end = work; + } + + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_GetSellItemVigorList(itemindex,0,argstr,token3,i,sell); + if(cost != -1) return cost; + strncat(token2,token3,sizeof(token3)); + okflg = 1; + } + } + } + } + + if(okflg == 0) { + cost = NPC_GetSellItemVigorList(itemindex, 1, argstr, token3, i, sell); + if(sell != -1) return -1; + strncat( token2, token3, sizeof( token3)); + } + + } + } + return -1; +} + + + +/*---------------------------------------------------------- + + ͷʧ˪P + + *----------------------------------------------------------*/ +int NPC_GetSellItemVigorList(int itemindex,int flg, char *argstr,char *argtoken,int select,int sell) +{ + char buff[256]; + double rate = 0.2; + char buff2[256]; + char buff3[64]; + int k = 1; + int cost = -1; + + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_item",buff, sizeof( buff)) != NULL){ + if(NPC_Util_GetStrFromStrWithDelim( argstr,"special_rate",buff2, sizeof( buff2)) != NULL ){ + rate = atof(buff2); + }else{ + rate = 1.2; + } + + while(getStringFromIndexWithDelim(buff , "," , k, buff2, sizeof(buff2)) !=FALSE ){ + k++; + if(strstr( buff2, "-") == NULL && strcmp(buff2,"") != 0) { + if(ITEM_getInt(itemindex,ITEM_ID) == atoi(buff2)){ + cost = NPC_SellItemVigorstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + }else if (strstr( buff2, "-") != NULL){ + int start; + int end; + int work; + getStringFromIndexWithDelim( buff2, "-", 1, buff3, sizeof(buff3)); + start = atoi( buff3); + getStringFromIndexWithDelim( buff2, "-", 2 ,buff3, sizeof(buff3)); + end = atoi( buff3); + + if(start > end){ + work = start; + start = end; + end = work; + } + end++; + if( (start <= ITEM_getInt(itemindex,ITEM_ID)) && (ITEM_getInt(itemindex,ITEM_ID) < end) ){ + cost = NPC_SellItemVigorstrsStr( itemindex,0, rate, argtoken,select,sell); + return cost; + } + } + } + } + if( NPC_Util_GetStrFromStrWithDelim( argstr,"sell_rate",buff, sizeof( buff)) != NULL ){ + rate = atof(buff); + cost = NPC_SellItemVigorstrsStr( itemindex, flg ,rate, argtoken,select,sell); + return cost; + } + + return cost; +} + +int NPC_SellItemVigorstrsStr(int itemindex,int flg,double rate,char *argtoken,int select,int sell) +{ + int cost; + char escapedname[256]; + char name[256]; + char *eff; + + + cost = ITEM_getInt( itemindex, ITEM_COST); + cost = (int)(cost * rate); + + if(sell != -1) return cost; + + strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME)); + makeEscapeString( escapedname, name, sizeof( name)); + eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING); + makeEscapeString( eff, escapedname, sizeof(escapedname)); + + + + sprintf( argtoken, +#ifdef _ITEM_PILENUMS + "%s|%d|%d|%d|%s|%d|%d|", +#else + "%s|%d|%d|%d|%s|%d|", +#endif + name, flg, cost, + ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER), + escapedname, select +#ifdef _ITEM_PILENUMS + ,ITEM_getInt( itemindex, ITEM_USEPILENUMS) +#endif + ); + + return -1; + +} + +BOOL NPC_SellNewItemVigor(int meindex,int talker,char *data) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[256], token2[256]; + int cost, k, select, itemindex; + int MyGold, MaxGold, sellnum=1; + + MaxGold = CHAR_getMaxHaveGold( talker); + MyGold = CHAR_getInt( talker, CHAR_GOLD); + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("GetArgStrErr"); + return FALSE; + } + getStringFromIndexWithDelim(data , "|" ,1, token, sizeof( token)); + select = atoi(token); +#ifdef _ITEM_PILENUMS + getStringFromIndexWithDelim(data , "|" ,2, token, sizeof( token)); + sellnum = atoi(token); +#endif + + if( select < CHAR_STARTITEMARRAY || select >= CHAR_MAXITEMHAVE ) return FALSE; + k = select; + itemindex = CHAR_getItemIndex( talker , k); + cost = NPC_GetLimtItemVigorList( talker,argstr, token2,select); + if( cost == -1 || (cost*sellnum)+MyGold >= MaxGold || !ITEM_CHECKINDEX( itemindex) ){ + int fd = getfdFromCharaIndex( talker); + sprintf(token,"\n\nѽ!Բ" "\n\nԲ ! ɲѡһأ" ); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return FALSE; + } +#ifdef _ITEM_PILENUMS + if( NPC_DelItem( talker, k, sellnum) == FALSE ) return FALSE; +#else + { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "Sell()", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + + ); + } + CHAR_DelItem( talker, k); +#endif + CHAR_AddGold( talker, cost*sellnum); + CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD); + return TRUE; +} + + + +void NPC_LimitItemVigorShop(int meindex,int talker,int select) +{ + + int fd = getfdFromCharaIndex( talker); + char token[NPC_UTIL_GETARGSTR_LINEMAX]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + + if(NPC_Util_GetStrFromStrWithDelim( argstr, "sellonly_msg", buf, sizeof( buf))!=NULL){ + sprintf(token,"\n\n%s", buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_LIMIT, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + }else{ + CHAR_talkToCli( talker, meindex, "רŵꡣ",CHAR_COLORWHITE); + } + return; +} + +void NPC_VigorExpressmanCheck(int meindex,int talker) +{ + int fd = getfdFromCharaIndex( talker); + char token[1024]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + + if( NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr)) == NULL) { + print("shop_GetArgStr_Err"); + return; + } + NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", buf, sizeof( buf)); + sprintf(token,"4\n%s\n\n%s" + "\n\n " + "\n\n " + ,CHAR_getChar(meindex,CHAR_NAME),buf); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT, + WINDOW_BUTTONTYPE_CANCEL, + CHAR_WINDOWTYPE_WINDOWITEMSHOP_EXPRESS, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + return; + + +} +#endif diff --git a/npc/npc_vipshop.c b/npc/npc_vipshop.c new file mode 100644 index 0000000..a5f8697 --- /dev/null +++ b/npc/npc_vipshop.c @@ -0,0 +1,257 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "npc_vipshop.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "battle.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//صشøнڽ"ʦ" +#ifdef _VIP_SHOP +enum { + WINDOW_START=1, + WINDOW_SELECT, + WINDOW_PREV, + WINDOW_NEXT, + WINDOW_WARP, + WINDOW_END, +}; +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, +/* + NPC_WORK_ROUTETOY = CHAR_NPCWORKINT2, + NPC_WORK_ROUTEPOINT = CHAR_NPCWORKINT3, + NPC_WORK_ROUNDTRIP = CHAR_NPCWORKINT4, + NPC_WORK_MODE = CHAR_NPCWORKINT5, + NPC_WORK_CURRENTROUTE = CHAR_NPCWORKINT6, + NPC_WORK_ROUTEMAX = CHAR_NPCWORKINT7, + NPC_WORK_WAITTIME = CHAR_NPCWORKINT8, + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT9, + NPC_WORK_SEFLG = CHAR_NPCWORKINT10, +*/ +}; + +#define STANDBYTIME 50 + +static void NPC_VipShop_selectWindow( int meindex, int toindex, int num,int select); +BOOL VipShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token, int index ); +int VipShop_ShowMenulist( char *npcarg ); + +int page; + +BOOL NPC_VipshopInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("TRANSER_MAN: GetArgStrErr!!"); + return FALSE; + } + + CHAR_setInt( meindex, CHAR_WHICHTYPE, CHAR_TRANSERMANS); + + //CHAR_setInt( meindex, CHAR_LOOPINTERVAL, NEWNPCMAN_STANDBY); + CHAR_setWorkInt( meindex, NPC_WORK_CURRENTTIME, NowTime.tv_sec); + return TRUE; +} +//CHAR_setWorkInt(talkerindex,CHAR_WORKSHOPRELEVANT,1); +void NPC_VipshopTalked( int meindex, int talkerindex, char *msg, int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) + return; + if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE) + return; + } + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_START, 0); +} + +void NPC_VipshopWindowTalked( int meindex, int talkerindex, int seqno, + int select, char *data) +{ + if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO) + return; + switch( seqno) { + case NPC_TRANSERMAN_START: + break; + case NPC_TRANSERMAN_SELECT: + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_SELECT, atoi( data)); + break; + case NPC_TRANSERMAN_WARP: + if( select == WINDOW_BUTTONTYPE_CANCEL ) + return; + if( select == WINDOW_BUTTONTYPE_NEXT ) + { + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_NEXT, atoi( data)); + return; + } + if( select == WINDOW_BUTTONTYPE_PREV ) + { + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_PREV, atoi( data)); + return; + } + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_WARP, atoi( data)); + break; + case NPC_TRANSERMAN_END: + NPC_VipShop_selectWindow( meindex, talkerindex, WINDOW_END, atoi( data)); + break; + } + +} + +static void NPC_VipShop_selectWindow( int meindex, int toindex, int num,int select) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE]; + char token[1024]; + char buf1[256]; + char buf2[256]; + char buf3[256]; + int buttontype = 0, windowtype = 0, windowno = 0; + int fd = getfdFromCharaIndex( toindex); + static int select1; + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + + if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) { + if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE) + return; + } + + memset( npcarg, 0, sizeof( npcarg)); + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("VipShop_MAN: GetArgStrErr!!"); + return; + } + memset( token, 0, sizeof( token)); + + switch( num) { + case WINDOW_START: + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) { + print("VipShop Get START_MSG ERROR !"); + return; + } + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, WINDOW_START); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_SELECT; + break; + case WINDOW_SELECT: + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, 0); + page=VipShop_ShowMenulist(npcarg); + if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "VipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(page>1) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_NEXT: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)<=page) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1); + if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "VipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)+1==page) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV; + else + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_PREV: + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)>0) + CHAR_setWorkInt( toindex, CHAR_WORKLISTPAGE, CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)-1); + if( VipShop_GetMenuStr( meindex, toindex, npcarg, token,CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)) == FALSE ) { + print( "VipShop GetMenu ERROR !!"); + return; + } + windowtype = WINDOW_MESSAGETYPE_SELECT; + if(CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)==0) + buttontype = WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + else + buttontype = WINDOW_BUTTONTYPE_PREV|WINDOW_BUTTONTYPE_CANCEL|WINDOW_BUTTONTYPE_NEXT; + windowno = NPC_TRANSERMAN_WARP; + break; + case WINDOW_WARP: + select1=CHAR_getWorkInt( toindex, CHAR_WORKLISTPAGE)*7+select; + CHAR_setWorkInt( toindex, CHAR_WORKLISTSELECT , select1); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "END_MSG", buf1, sizeof( buf1) ) == NULL) { + print("VipShop Get START_MSG ERROR !"); + return; + } + if(getStringFromIndexWithDelim( npcarg,"}",select1, buf2, sizeof( buf2)) != FALSE) + NPC_Util_GetStrFromStrWithDelim( buf2, "MenuStr", buf3, sizeof( buf3)); + sprintf( token, "\n%s\n\n %s\n",buf1, buf3); + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NPC_TRANSERMAN_END; + break; + case WINDOW_END: + ActionNpc_CheckMenuFree( meindex, toindex, npcarg, CHAR_getWorkInt( toindex, CHAR_WORKLISTSELECT )); + return; + break; + } + + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token); +} + + +void NPC_VipshopLoop( int meindex) +{ + +} + +BOOL VipShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token,int index ) +{ + char buf1[1024], buf2[32], buf3[36]; + BOOL FINDS=FALSE; + int talkNo=index*7+1; + if( npcarg == NULL ) return FALSE; + + sprintf( token, "㵱ǰĻ:%d %d/%dҳ\n",sasql_ampoint(CHAR_getUseID(toindex),0,0), index+1, page); + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + memset( buf2, 0, sizeof( buf2)); + if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL ) + continue; + FINDS = TRUE; + + sprintf( buf3, " %s", buf2); + if(strlen(buf3)<10) + strcat( buf3, "\n"); + else + strcat( buf3, "\n"); + strcat( token, buf3); + if(talkNo>(index*7+7))return FINDS; + } + return FINDS; +} + +int VipShop_ShowMenulist( char *npcarg ) +{ + char buf1[1024]; + int talkNo=1; + while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE ) { + talkNo++; + } + return (talkNo-3)/7+1; +} + +#endif + + diff --git a/npc/npc_warp.c b/npc/npc_warp.c new file mode 100644 index 0000000..c5edd06 --- /dev/null +++ b/npc/npc_warp.c @@ -0,0 +1,380 @@ +#include "version.h" +#include +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "map_deal.h" +#include "readmap.h" +#include "npccreate.h" +#include "npcutil.h" +#include "handletime.h" +#include "npc_eventaction.h" + +//#define _RECORD_NPCMAN_ //¼ + +BOOL NPC_TimeWarpCheck(int meindex,char *buf,int mode); + +static void NPC_WarpsetNeverMake( int charaindex ) +{ + int cindex; + cindex = CHAR_getInt(charaindex,CHAR_NPCCREATEINDEX); + if( NPC_CHECKCREATEINDEX(cindex) ) + NPC_create[cindex].workdata[NPC_CREATEWORKNEVERMAKE] = 1; +} + +BOOL NPC_WarpInit( int charaindex ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + int ret; + int floor=-1,x=-1,y=-1; + char token[128]; + +#ifdef _RECORD_NPCMAN_ //¼ + char evtype[256]; + char evtime[256]; + char argfile[256]; + + if( NPC_Util_CheckAssignArgFile( charaindex, argfile) == NULL ) + sprintf( argfile, "NULL"); +#endif + + CHAR_setInt( charaindex, CHAR_WHICHTYPE , CHAR_TYPEWARP ); + if( NPC_Util_GetArgStr( charaindex, arg, sizeof( arg)) == NULL ) { + print("\n GetArgStr ERR!!"); + return FALSE; + } +#ifdef _NEW_WARPPOINT + if( strstr( arg, "FREEMORE") != NULL ) { +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtype, "FREE"); + sprintf( evtime, "NULL"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP); + }else { +#endif +#ifdef _MAP_WARPPOINT + return FALSE; +#endif +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtype, "NONE"); +#endif + ret=getStringFromIndexWithDelim(arg,"|", 1,token,sizeof(token)); + if( ret ) floor = atoi( token ); + ret=getStringFromIndexWithDelim(arg,"|", 2,token,sizeof(token)); + if( ret ) x = atoi( token ); + ret=getStringFromIndexWithDelim(arg,"|", 3,token,sizeof(token)); + if( ret ) y = atoi( token ); + if( MAP_IsValidCoordinate( floor,x,y )== FALSE ){ + NPC_WarpsetNeverMake( charaindex ); + //print( "Warp NPC:Invalid arg:%s\n", arg ); + print( "Warp Npc Err:%d:%d:%d->(%s)\n", + CHAR_getInt( charaindex, CHAR_FLOOR ), + CHAR_getInt( charaindex, CHAR_X ), + CHAR_getInt( charaindex, CHAR_Y ), + arg ); + return FALSE; + } + ret=getStringFromIndexWithDelim(arg,"|",4,token,sizeof(token)); + if(ret==TRUE){ + int day; + day=NPC_TimeWarpCheck(charaindex,token,0); + if(day==0){ +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtime, "N"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP_NIGHT); + }else if(day==1){ +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtime, "M"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP_MORNING); + }else if(day==2){ +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtime, "A"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP_NOON); + }else{ +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtime, "NULL"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP); + } + }else{ +#ifdef _RECORD_NPCMAN_ //¼ + sprintf( evtime, "NULL"); +#endif + CHAR_setWorkInt( charaindex, CHAR_WORKEVENTTYPE, CHAR_EVENT_WARP); + } +#ifdef _NEW_WARPPOINT + } +#endif + CHAR_setFlg( charaindex,CHAR_ISVISIBLE, 0 ); + CHAR_setFlg( charaindex,CHAR_ISOVERED,1 ); + CHAR_setFlg( charaindex,CHAR_ISATTACKED,0 ); + CHAR_setFlg( charaindex,CHAR_ISATTACK,0 ); + +#ifdef _RECORD_NPCMAN_ //¼ + { + FILE *fp=NULL; + char filename[256]; + sprintf( filename,"./data/npc/%s", "mapwarp.txt"); + if( (fp = fopen( filename, "a+")) != NULL ) { + fprintf( fp, "%s:%s:%d,%d,%d:%d,%d,%d:%s\n", + evtype, evtime, + CHAR_getInt( charaindex, CHAR_FLOOR), + CHAR_getInt( charaindex, CHAR_X), + CHAR_getInt( charaindex, CHAR_Y), + floor, x, y, argfile ); + fclose( fp); + }else { + } + } +#endif + return TRUE; +} + +void NPC_WarpWarpCharacter( int warpnpcindex, int charaindex ) +{ + char arg[NPC_UTIL_GETARGSTR_BUFSIZE]; + int i=0; +#ifdef _NEW_WARPPOINT + char buf1[256], buf2[256], buf3[256], freemsg[256]; + BOOL nBefind = FALSE; + struct wapepoints { + int m_floor; + int m_x; + int m_y; + }Wpoint[10]={ + {-1,0,0}, {-1,0,0}, {-1,0,0}, {-1,0,0}, {-1,0,0}, + {-1,0,0}, {-1,0,0}, {-1,0,0}, {-1,0,0}, {-1,0,0} + }; + int iRand=0; +#endif + if( CHAR_getInt( charaindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + + if( NPC_Util_GetArgStr( warpnpcindex, arg, sizeof( arg)) == NULL ){ + return; + } + + { + char token[16]; + int floor=0,x=0,y=0; + int ret; + +#ifdef _NEW_WARPPOINT + i=1; + if( strstr( arg, "FREEMORE") != NULL ) { + int k=1, pw=-1; + while( getStringFromIndexWithDelim( arg, "OVER", i, buf1, sizeof( buf1)) != FALSE ) { + i++; + if( NPC_Util_GetStrFromStrWithDelim( buf1, "FREE", buf2, sizeof( buf2)) == NULL ) + continue; + if( NPC_ActionPassCheck( warpnpcindex, charaindex, buf2) == FALSE ) { + continue; + }else { + iRand=0; + if( NPC_Util_GetStrFromStrWithDelim( buf1, "TO", buf2, sizeof( buf2)) != FALSE ) { + k=1; + while( getStringFromIndexWithDelim( buf2, "&", k, freemsg, sizeof( freemsg)) != FALSE ){ + k++; + if( getStringFromIndexWithDelim( freemsg, ",", 1, buf3, sizeof( buf3)) == FALSE ) + break; + Wpoint[iRand].m_floor = atoi( buf3); + if( getStringFromIndexWithDelim( freemsg, ",", 2, buf3, sizeof( buf3)) == FALSE ) + break; + Wpoint[iRand].m_x = atoi( buf3); + if( getStringFromIndexWithDelim( freemsg, ",", 3, buf3, sizeof( buf3)) == FALSE ) + break; + Wpoint[iRand].m_y = atoi( buf3); + iRand++; + nBefind = TRUE; + if( iRand >= arraysizeof( Wpoint)) + break; + } + break; + } + } + if( nBefind == TRUE ) + break; + } + + if( nBefind == FALSE || iRand <= 0){ //ûҵ + floor = CHAR_getInt( warpnpcindex, CHAR_FLOOR); + x = CHAR_getInt( warpnpcindex, CHAR_X); + y = CHAR_getInt( warpnpcindex, CHAR_Y); + }else { + pw = RAND( 0, (iRand-1)); + floor = Wpoint[pw].m_floor; + x = Wpoint[pw].m_x; + y = Wpoint[pw].m_y; + if( NPC_Util_GetStrFromStrWithDelim( arg, "CHECKPARTY", buf1, sizeof( buf1)) != NULL ) { + if( strstr( buf1, "TRUE") != NULL ){ + if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ) { + CHAR_DischargeParty( charaindex, 0); // + } + } + } + if( MAP_IsValidCoordinate( floor,x,y )== FALSE ){ + print( "*Warp NPC:Invalid %d %d %d" , floor,x,y ); + return; + } + k=0; + } + }else { +#endif + ret=getStringFromIndexWithDelim(arg,"|", 1,token,sizeof(token)); + if( ret == FALSE )return; + floor = atoi( token ); + + ret=getStringFromIndexWithDelim(arg,"|", 2,token,sizeof(token)); + if( ret == FALSE )return; + x = atoi( token ); + + ret=getStringFromIndexWithDelim(arg,"|", 3,token,sizeof(token)); + if( ret == FALSE )return; + y = atoi( token ); +#ifdef _NEW_WARPPOINT + } +#endif + { + int ff=floor; + + int of=CHAR_getInt(charaindex, CHAR_FLOOR); + int fd=CHAR_getWorkInt( charaindex, CHAR_WORKFD); + int eqen=getEqNoenemy(fd); + if (eqen<200) { + if (eqen>=120) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)||(ff==500)) { + if ((of!=100)&&(of!=200)&&(of!=300)&&(of!=400)&&(of!=500)) { + CHAR_talkToCli(charaindex, -1, + "̫ηһĹâ١", CHAR_COLORWHITE); + } + } else { + if ((of==100)||(of==200)||(of==300)||(of==400)||(of==500)) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + } + } + } else if (eqen>=80) { + if ((ff==100)||(ff==200)||(ff==300)||(ff==400)) { + if ((of!=100)&&(of!=200)&&(of!=300)&&(of!=400)) { + CHAR_talkToCli(charaindex, -1, + "̫ηһĹâ١", CHAR_COLORWHITE); + } + } else { + if ((of==100)||(of==200)||(of==300)||(of==400)) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + } + } + } else if (eqen>=40) { + if ((ff==100)||(ff==200)) { + if ((of!=100)&&(of!=200)) { + CHAR_talkToCli(charaindex, -1, + "̫ηһĹâ١", CHAR_COLORWHITE); + } + } else { + if ((of==100)||(of==200)) { + CHAR_talkToCli(charaindex, -1, "Ĺâʧˡ", CHAR_COLORWHITE); + } + } + } + } + } + +#ifdef _DROPSTAKENEW + { + i = 0; + for (i = 0; i < MAXSTAKENUM; i++){ + if (CHAR_getWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + i) > 0){ + char tmpbuf[256]; + snprintf(tmpbuf, sizeof(tmpbuf), "뿪˷䣬Խ޷ȡزȯ"); + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKETYPE1 + i, 0); + CHAR_talkToCli(charaindex, -1, tmpbuf, CHAR_COLORYELLOW); + } + } + CHAR_setWorkInt(charaindex, CHAR_WORKSTAKEFLAG, 0); +#ifdef _FIX_GAMBLENUM + if(CHAR_getInt(charaindex, CHAR_GAMBLENUM) < 0) + CHAR_setInt(charaindex, CHAR_GAMBLENUM, 0); +#endif + } +#endif + if( floor == -1) { + return; + }else { + if( MAP_IsValidCoordinate( floor,x,y )== FALSE ){ + print( "Warp NPC:Invalid %d %d %d" , floor,x,y ); + return; + } + + CHAR_warpToSpecificPoint(charaindex, floor, x, y); + } + } +} + +void NPC_WarpWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ) +{ + int meindex,moveindex; + if( OBJECT_getType( objindex ) != OBJTYPE_CHARA )return; + + meindex = OBJECT_getIndex(meobjindex); + moveindex = OBJECT_getIndex(objindex); + + if( CHAR_getInt( moveindex,CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + return; + } + if( act != CHAR_ACTWALK )return; + + if( opt[0] == x && opt[1] == y )return; + if( CHAR_getInt(meindex,CHAR_X) == x && CHAR_getInt(meindex,CHAR_Y) == y ) { + NPC_WarpWarpCharacter( meindex, moveindex ); + } +} + +void NPC_WarpPostOver( int meindex, int charaindex ) +{ + NPC_WarpWarpCharacter( meindex, charaindex ); +} + +int NPC_WarpSearchByPosition( int fl , int x, int y) +{ + OBJECT object; + for( object=MAP_getTopObj(fl,x,y) ; object ; + object=NEXT_OBJECT(object)){ + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType( objindex ) == OBJTYPE_CHARA + && CHAR_getInt( OBJECT_getIndex(objindex), CHAR_WHICHTYPE) + == CHAR_TYPEWARP ){ + return OBJECT_getIndex(objindex); + } + } + return -1; +} + + +int NPC_TimeWarpCheck(int meindex,char *buf,int mode) +{ + LSTIME nowlstime; + char *time[4]={"N","M","A"}; + int now; + int i=0; + RealTimeToLSTime( NowTime.tv_sec, &nowlstime); + now = getLSTime( &nowlstime); + if(mode==0){ + for( i=0 ; i < 3 ; i++){ + if(strstr( buf,time[i]) != NULL){ + return i; + } + } + return -1;; + } + if(mode==1){ + if(now==CHAR_getWorkInt( meindex, CHAR_WORKEVENTTYPE)){ + return now; + } + return -1; + } + return -1; +} diff --git a/npc/npc_warpman.c b/npc/npc_warpman.c new file mode 100644 index 0000000..c4f6005 --- /dev/null +++ b/npc/npc_warpman.c @@ -0,0 +1,1133 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "saacproto_cli.h" +#include "npc_warpman.h" +#include "map_deal.h" +#include "readmap.h" +#include "battle.h" +#include "npc_exchangeman.h" +#include "log.h" +#include "enemy.h" +#include "handletime.h" +#include "npc_eventaction.h" + +static void NPC_WarpMan_selectWindow( int meindex, int toindex, int num,int select); +//ANDY_END +BOOL NPC_GetDuelPointCheck(int meindex,int talker); +BOOL NPC_PARTY_CHAECK( int meindex, int talkerindex); +void NPC_ERR_DiSP(int meindex,int talker,int errNO); + +BOOL NPC_BigSmallLastCheck(int point1,int mypoint,int flg); + +//BOOL NPC_ItemCheck(int meindex,int talker,int itemNo,int flg); +int NPC_FloorUse(int talker,int floor); +BOOL NPC_WarpMsg(int meindex,int talker,char *buf); +BOOL NPC_NpcWarpMsg(int meindex,int talker,char *arg); +int NPC_FloorUseOtherFloor(int charaindex, char *buf); + + +#ifdef _NPC_ADDLEVELUP +void NPC_LevelAndTransUp( int meindex, int charindex, int level, int skillpoint, int exp, int ridepet); +#endif + +#define WARPMAN_STANDBY 3000 +#define WARPMAN_WAIT 150 +//ANDY_ADD +int CheckWarpMsg( int meindex, int talkerindex,char *npcarg ,char *TalkStr); + +#ifdef _TREASURE_BOX +BOOL NPC_TreasureEventRunMsg( int meindex); +#endif + +BOOL NPC_TreasureRandItemGet(int meidex,int talker,int rand_j,char *buf); + +enum { + NPC_WORK_CURRENTTIME = CHAR_NPCWORKINT1, + NPC_TIME_BORN = CHAR_NPCWORKINT2, + NPC_TIME_DEAD = CHAR_NPCWORKINT3, + NPC_TIME_MODE = CHAR_NPCWORKINT4, + + NPC_TIME_EVENTMODE = CHAR_NPCWORKINT6,// 1 + NPC_TIME_EVENTTIME = CHAR_NPCWORKINT7, + NPC_TIME_EVENONBBI = CHAR_NPCWORKINT8, + NPC_TIME_EVENOFFDBBI = CHAR_NPCWORKINT9, + NPC_TIME_EVENTNUM = CHAR_NPCWORKINT10, +}; + +enum{ + NPC_EVENTMODE_NONE, + NPC_EVENTMODE_OPEN, + NPC_EVENTMODE_EVENT, +}; + +#ifdef _NEW_WARPMAN +static void NPC_NewWarpMan_selectWindow( int meindex, int toindex, int num,int select,char *TalkStr); + +enum { + WARP_MAN=0, + NEW_WARPMAN, + NEW_WARPMAN_END + }; +#endif +#define TIMECHECKLOOP 20 +// Robin 0518 +//BOOL checkend = FALSE; + + +BOOL NPC_WarpManInit( int meindex ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buff2[256]; + char buf[1024]; + int fl,x,y; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("WarpMan:GetArgStrErr"); + return FALSE; + } + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWARPMAN ); +#ifdef _NEW_WARPMAN + if( strstr( npcarg,"NEWWARPMAN") ) { + //timeman + CHAR_setWorkInt( meindex, NPC_TIME_MODE, 1); + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NEWTIME", buff2, sizeof( buff2)) != NULL ){ + CHAR_setInt( meindex, CHAR_LOOPINTERVAL, 60*1000); + } +#ifdef _TREASURE_BOX + CHAR_setWorkInt( meindex, NPC_TIME_EVENTMODE, NPC_EVENTMODE_NONE); + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "TREASURE_BOX", buff2, sizeof( buff2)) != NULL ){ + if( strstr( buff2, "ON") != NULL ){ + CHAR_setWorkInt( meindex, NPC_TIME_EVENTMODE, NPC_EVENTMODE_EVENT); + CHAR_setWorkInt( meindex, NPC_TIME_EVENTTIME, NowTime.tv_sec); + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "TREASURE_ONBBI", buff2, sizeof( buff2)) != NULL ) + CHAR_setWorkInt( meindex, NPC_TIME_EVENONBBI, atoi( buff2)); + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "TREASURE_OFFDBBI", buff2, sizeof( buff2)) != NULL ) + CHAR_setWorkInt( meindex, NPC_TIME_EVENOFFDBBI, atoi( buff2)); + CHAR_setWorkInt( meindex, NPC_TIME_EVENTNUM, 0 ); + } + } + +#endif + return TRUE; + }else{ +#endif + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf))==NULL){ + char filename[256]; + if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ) + print("\n Warpman Err -> file:%s", filename); + return FALSE; + } + getStringFromIndexWithDelim(buf,",",1,buff2,sizeof(buff2)); + fl=atoi(buff2); + getStringFromIndexWithDelim(buf,",",2,buff2,sizeof(buff2)); + x=atoi(buff2); + getStringFromIndexWithDelim(buf,",",3,buff2,sizeof(buff2)); + y=atoi(buff2); + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + char filename[256]; + NPC_Util_CheckAssignArgFile( meindex, filename); + print( "\nWarp NPC: filename:%s\n 3.Invalid warpman ERR %d %d %d" , filename, fl , x , y ); + return FALSE; + } +#ifdef _NEW_WARPMAN + } +#endif + return TRUE; +} + +void NPC_WarpManTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char token[256]; + int RunType=-1; + + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace( meindex ,talkerindex ,2)==FALSE){ + if(NPC_Util_isFaceToChara(talkerindex,meindex,1 )==FALSE) return; + } + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + +#ifdef _NEW_WARPMAN + if( strstr( npcarg,"NEWWARPMAN") ) { +#ifdef _TREASURE_BOX + if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTMODE) == NPC_EVENTMODE_OPEN ) + return; +#endif + NPC_NewWarpMan_selectWindow( meindex ,talkerindex, 0, -1, szMes); + return; + }else { + if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) {// + NPC_ERR_DiSP( meindex, talkerindex, 1); + return; + } + + + RunType = CheckWarpMsg( meindex, talkerindex, npcarg , szMes); + if( RunType !=0 ) { + if( RunType == 1 ) { + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "nomal_msg", token, sizeof(token)) != NULL) { + CHAR_talkToCli( talkerindex, meindex,token,CHAR_COLORWHITE); + } + } + return; + } + } +#else + + + if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) {// + NPC_ERR_DiSP( meindex, talkerindex, 1); + return; + } + RunType = CheckWarpMsg( meindex, talkerindex, npcarg , szMes); + if( RunType !=0 ) { + if( RunType == 1 ) { + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "nomal_msg", token, sizeof(token)) != NULL) { + CHAR_talkToCli( talkerindex, meindex,token,CHAR_COLORWHITE); + } + } + return; + } +#endif + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + CHAR_setWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD , 0 ); + if(strstr(npcarg,"DR")!=NULL) { + CHAR_setWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTSEC , -1 ); + if(NPC_GetDuelPointCheck(meindex,talkerindex)==FALSE) return; + }else{ + NPC_WarpMan_selectWindow( meindex, talkerindex,0,-1); + } +} + +static void NPC_WarpMan_selectWindow( int meindex, int toindex, int num,int select) +{ + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char token[1024]; + char buf[256]; + char buf2[1024]; + char buf3[256]; + int fl=0 ; + int money=100 ; + int fd = getfdFromCharaIndex( toindex); + char tmp[64]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 0); + return ; + } + + if(NPC_PARTY_CHAECK( meindex, toindex) == FALSE) { + NPC_ERR_DiSP( meindex, toindex, 1); + return; + } + + + if( CHAR_getWorkInt( toindex, CHAR_WORKSHOPRELEVANT) != 0 ) { + return; + }else { + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 1); + } + + if(strstr(npcarg,"%4d")!=NULL){ + int flwork = 0; + int work; + NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf)); + getStringFromIndexWithDelim(buf,",",1,buf3,sizeof(buf3)); + work = atoi( buf3); + fl = NPC_FloorUse( toindex, atoi(buf3)); + + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "Floor", buf3, sizeof( buf3)) != NULL){ + flwork = NPC_FloorUseOtherFloor(work, buf3); + } + fl = fl +flwork; + } + + NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf, sizeof( buf)); + + if( (NPC_ActionPassCheck(meindex,toindex,buf)==TRUE) || (strstr(buf,"ALLFREE")!=NULL) ){ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "FreeMsg", buf2, sizeof( buf2))==NULL) return; + CONNECT_set_pass(fd,TRUE); + CONNECT_set_first_warp(fd,TRUE); + if(strstr(buf2,"%4d") != NULL){ + sprintf(token,buf2,fl); + }else{ + strcpy(token,buf2); + } + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -1 ); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, 2); + }else { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PayMsg", buf2, sizeof( buf2)) != NULL){ + CONNECT_set_pass(fd,FALSE); + CONNECT_set_first_warp(fd,FALSE); + if(strstr(buf2,"%8d") != NULL){ + NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp)); + if(strstr(tmp,"LV")!=NULL){ + int level; + char buff2[32]; + + level = CHAR_getInt(toindex,CHAR_LV); + getStringFromIndexWithDelim(tmp,"*",2,buff2,sizeof(buff2)); + money = level*atoi(buff2); + }else{ + money=atoi(tmp); + } + if(strstr(buf2,"%4d") != NULL){ + sprintf(token,buf2,fl,money); + }else{ + sprintf(token,buf2,money); + } + }else if(strstr(buf2,"%4d") != NULL){ + sprintf(token,buf2,fl); + NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp)); + if( strstr( tmp,"-" ) != NULL){ + money=10000001; + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return ; + } + }else{ + strcpy(token,buf2); + NPC_Util_GetStrFromStrWithDelim( npcarg, "MONEY", tmp, sizeof( tmp)); + if( strstr( tmp,"-" ) != NULL){ + money=10000001; + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + return ; + }else{ + money = atoi(tmp); + } + } + if(CHAR_getInt(toindex,CHAR_FLOOR)==117){ + money=CHAR_getInt(toindex,CHAR_GOLD); + if (money>=10) money*=0.9; + else if( money == 0 ) { + CHAR_warpToSpecificPoint(toindex,117,225,13); + return; + } + } + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , money ); + CONNECT_set_pass(fd,TRUE); + CONNECT_set_first_warp(fd,TRUE); + + }else if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NomalMsg", token,sizeof(token)) !=NULL){ + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -2 ); + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, -1); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + } + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_YESNO, + CHAR_WINDOWTYPE_WINDOWWARPMAN_MAIN, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +void NPC_WarpManWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char buf[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; +#ifdef _NEW_WARPMAN + BOOL checkp=TRUE; + char buf1[1024]; + int talkNo = 1; + BOOL tenflg=FALSE; +#else + int fl,x,y; +#endif + char buff2[256]; + int fd = getfdFromCharaIndex( talkerindex ); + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) + return; + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) < 1 ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + +#ifdef _NEW_WARPMAN + if( seqno == NEW_WARPMAN ) { + int eqnum=0; + eqnum = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT); + sprintf(buf1,"%s", "NOFREE"); + if( eqnum >= 0 ) { + sprintf(buf1,"TALKEVENT%d", eqnum); + } + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0); + while( getStringFromIndexWithDelim( npcarg,"OVER",talkNo,buf,sizeof( buf)) != FALSE){ + if( strstr(buf, buf1) != NULL) { + strcpy( npcarg , buf); + tenflg = TRUE; + break; + } + talkNo++; + } + if( tenflg == FALSE ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + }else { +#endif + if( select != WINDOW_BUTTONTYPE_YES ) { + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE){ + NPC_ERR_DiSP( meindex, talkerindex, 1); + return; + } +#ifdef _NEW_WARPMAN + } +#else + NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf)); + GetRand_WarpPoint( buf, &fl, &x, &y ); +#endif + +#ifdef _NEW_WARPMAN + switch( seqno) { + case WARP_MAN: + if( select != WINDOW_BUTTONTYPE_YES ) + return; + if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ){ + NPC_ERR_DiSP( meindex, talkerindex, 1); + return; + } +#else + if( select != WINDOW_BUTTONTYPE_YES) return; + if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE) + return; +#endif + +#ifdef _NEW_WARPMAN + break; + case NEW_WARPMAN: + if( select != WINDOW_BUTTONTYPE_YES ){ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CancelMsg", buff2, sizeof( buff2) ) != NULL) { + CHAR_talkToCli( talkerindex, meindex, buff2, CHAR_COLORYELLOW); + } + return; + } + checkp=TRUE; + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buff2, sizeof( buff2) ) != NULL) { + if( strstr( buff2, "FALSE") != NULL ) { + checkp = FALSE; + } + } + if( checkp==TRUE && NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ) { + NPC_ERR_DiSP( meindex, talkerindex, 1); + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + break; + case NEW_WARPMAN_END: + return; + break; + } +#endif + + if( Action_RunDoEventAction( meindex, talkerindex, npcarg) == FALSE ){ + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return; + } + + CHAR_complianceParameter( talkerindex ); + CHAR_send_P_StatusString( talkerindex , + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_CHARM|CHAR_P_STRING_QUICK| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND|CHAR_P_STRING_EARTH + ); + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){ + return ; + } + if(CHAR_getWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD) <= 0){ + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); +#ifdef _NEW_WARPMAN + NPC_WarpMsg( meindex, talkerindex, npcarg); +#else + if( fl == 0 && x == 0 && y == 0 ) { + }else { + CHAR_warpToSpecificPoint(talkerindex, fl, x,y); + } +#endif + }else { + if(CHAR_getInt(talkerindex,CHAR_GOLD) < + CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)){ + NPC_ERR_DiSP( meindex, talkerindex, 2); + return ; + } + CHAR_DelGold( talkerindex, CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD )); + + CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE ); +#ifdef _NEW_WARPMAN + NPC_WarpMsg( meindex, talkerindex, npcarg); +#else + if( fl == 0 && x == 0 && y == 0 ) { + }else { + CHAR_warpToSpecificPoint(talkerindex, fl, x,y); + } +#endif + + } +#ifdef _NEW_WARPMAN + NPC_NpcWarpMsg( meindex, talkerindex, npcarg); +#else + } +#endif +} + +BOOL NPC_BigSmallLastCheck(int point1,int mypoint,int flg) +{ + if(flg==0){ + if(point1==mypoint) { + return TRUE; + } + + }else if(flg==1){ + if(mypoint < point1) { + return TRUE; + } + + }else if(flg==2){ + if(mypoint > point1) { + return TRUE; + } + } + + return FALSE; + +} + +BOOL NPC_GetDuelPointCheck(int meindex,int talker) +{ + + int fdid = getFdidFromCharaIndex( talker); + char dbkey[256]; + + if( fdid == -1 ) return FALSE; + + CHAR_makeDBKey( talker, dbkey, sizeof( dbkey)); + saacproto_DBGetEntryRank_send( acfd, DB_DUELPOINT, dbkey, fdid, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX)); + + return TRUE; + +} + +void NPC_GetDuelRank(int rank,int fdid,int objindex) +{ + + int talker; + int meindex; + + + rank++; + talker = getCharindexFromFdid( fdid); + if( talker == -1 ) return; + + meindex= OBJECT_getIndex( objindex); + if( !CHAR_CHECKINDEX( meindex)) return; + + CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANTSEC,rank); + + NPC_WarpMan_selectWindow( meindex, talker,0,-1); + +} + +BOOL NPC_PARTY_CHAECK(int meindex,int talker) +{ + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE){ + return FALSE; + } + return TRUE; +} + +void NPC_ERR_DiSP(int meindex,int talker,int errNO) +{ + char token[1024]; + int i=0; + int otherindex; + int fd = getfdFromCharaIndex( talker); + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + if(errNO==1){ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "PartyMsg",token, sizeof( token))==NULL) { + sprintf(token,"\n\n޷Ŷӡ" + "\n\n ɢŶ "); + } + if(CHAR_getWorkInt(talker,CHAR_WORKPARTYMODE)==CHAR_PARTY_CLIENT){ + }else{ + + for( i=0 ; i < CHAR_PARTYMAX ;i++){ + otherindex=CHAR_getWorkInt(talker,CHAR_WORKPARTYINDEX1+i); + if(otherindex != -1){ + fd = getfdFromCharaIndex( otherindex); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + } + } + return ; + } + }else if (errNO==2){ + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "MoneyMsg", token, sizeof( token))==NULL){ + sprintf(token,"\n\nƺǮࡡ" + "\n\nǮᣬٹ"); + } + } + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_WINDOWWARPMAN_ERR, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); +} + +int NPC_FloorUse(int charaindex,int floor) +{ + int i; + int players=0; + int playernum = CHAR_getPlayerMaxNum(); + for( i=0 ; i< playernum ; i++ ){ + if( CHAR_getCharUse(i) == FALSE )continue; + if(CHAR_getInt(i,CHAR_FLOOR)==floor){ + players++; + } + } + return players; +} + +int NPC_FloorUseOtherFloor(int warp, char *buf) +{ + int i,j=1; + int players=0; + int playernum = CHAR_getPlayerMaxNum(); + char buf2[32]; + int floor; + + for( i=0 ; i< playernum ; i++ ){ + if( CHAR_getCharUse(i) == FALSE )continue; + j=1; + while(getStringFromIndexWithDelim(buf,",",j,buf2,sizeof(buf2))!= FALSE){ + j++; + floor = atoi(buf2); + if(CHAR_getInt(i,CHAR_FLOOR) == floor && warp != floor) { + players++; + } + } + } + return players; +} + +BOOL NPC_WarpMsg(int meindex,int talker,char *arg) +{ + char buf[256]; + int fl=0,x=0,y=0; + int parent=-1; + int pmode; + int subindex; + int i; + + if( NPC_Util_GetStrFromStrWithDelim( arg, "WARP", buf, sizeof( buf)) == NULL ) + return FALSE; + GetRand_WarpPoint( buf, &fl, &x, &y ); + if( fl == 0 && x == 0 && y == 0 ) { + return TRUE; + }else { + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "Warp NPC:1.Invalid warpman ERR" ); + return FALSE; + } + } +#ifdef _TIME_TICKET + if( check_TimeTicketMap( fl) ) { + int havei, itemi; + CHAR_setWorkInt( talker, CHAR_WORKTICKETTIME, 0); + CHAR_setWorkInt( talker, CHAR_WORKTICKETTIMESTART, 0); + for( havei = CHAR_STARTITEMARRAY ; havei < CHAR_MAXITEMHAVE ; havei++ ){ + itemi = CHAR_getItemIndex( talker, havei); + if( !ITEM_CHECKINDEX( itemi) ) continue; + if( strcmp( ITEM_getChar( itemi, ITEM_USEFUNC), "ITEM_timeticket") ) continue; + //if( ITEM_getInt( itemi ,ITEM_ID) != 20646 ) continue; + CHAR_talkToCli( talker, -1, "ԶʹƱ", CHAR_COLORYELLOW); + ITEM_timeticketEx( talker, talker, havei, 1); + break; + } + if( havei == CHAR_MAXITEMHAVE ) { + CHAR_talkToCli( talker, -1, "׼רƱſɽ롣", CHAR_COLORYELLOW); + return FALSE; + } + } +#endif + pmode = CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE ); + switch( pmode ){ + case 1: + parent = talker; + break; + case 2: + parent = CHAR_getWorkInt( talker, CHAR_WORKPARTYINDEX1 ); + break; + default: + CHAR_warpToSpecificPoint(talker, fl, x,y); + return TRUE; + } + if( parent < 0 ) + return TRUE; + for( i = 0; i < CHAR_PARTYMAX; i ++ ){ + subindex = CHAR_getWorkInt( parent, CHAR_WORKPARTYINDEX1+i ); + if( CHAR_CHECKINDEX( subindex ) == FALSE )continue; + if( fl==0 && x==0 && y==0 ) { + }else { + CHAR_warpToSpecificPoint( subindex, fl, x, y ); + } + } + return TRUE; +} + +#ifdef _NEW_WARPMAN +static void NPC_NewWarpMan_selectWindow( int meindex, int toindex, int num,int select,char *TalkStr) +{ + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + char token[1024]; + int buttontype = 0, windowtype = 0, windowno = 0; + char buf[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20],buf1[256]; + int fd = getfdFromCharaIndex( toindex); + BOOL tenflg =FALSE; + int talkNo=1,RunType=-1; + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("GetArgStrErr"); + return ; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "NEWTIME", buf1, sizeof( buf1)) != NULL ){ + if( CHAR_getWorkInt( meindex, NPC_TIME_MODE) <= 0 ) { + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "Time_Msg", token, sizeof( token) ) != NULL) { + CHAR_talkToCli( toindex, meindex, token, CHAR_COLORYELLOW); + } + return; + } + } + + windowtype = WINDOW_MESSAGETYPE_MESSAGE; + sprintf( buf1,"TALKEVENT"); + //ѰҶ FREE + while(getStringFromIndexWithDelim( npcarg,"OVER",talkNo,buf,sizeof( buf)) != FALSE) { + if(strstr(buf, buf1) != NULL) { + //Ի + RunType = CheckWarpMsg( meindex, toindex, buf , TalkStr); + if( RunType > 1 ) { + return; + }else if( RunType != 0 ) { + talkNo++; + continue; + } + if( NPC_Util_GetStrFromStrWithDelim( buf, "FREE", token, sizeof( token) ) == NULL) { + print("msgErr"); + return; + } + + //Ƿ񸽺 + if((NPC_ActionPassCheck(meindex,toindex,token)==TRUE) || (strstr( token, "ALLFREE")!=NULL) ) { + CHAR_setWorkInt( toindex, CHAR_WORKSHOPRELEVANT, talkNo-1); + + // ȡ FreeMsg ִ + if(NPC_Util_GetStrFromStrWithDelim( buf, "FreeMsg", token, sizeof( token))==NULL) + return; + CONNECT_set_pass(fd,TRUE); + CONNECT_set_first_warp(fd,TRUE); + buttontype = WINDOW_BUTTONTYPE_YESNO; + windowno = NEW_WARPMAN; + tenflg = TRUE; + CHAR_setWorkInt( toindex , CHAR_WORKSHOPRELEVANTTRD , -1 ); + break; + } + } + talkNo++; + } + + //κ + if( tenflg == FALSE ) { + if( getStringFromIndexWithDelim( npcarg,"OVER",1,buf,sizeof( buf)) == FALSE ) + return; + if( strstr( buf, "NOFREE") == NULL ) { + return; + }else { + strcpy( npcarg, buf); + } + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NomalMsg", token,sizeof(token)) != NULL) { + CHAR_talkToCli( toindex, meindex, token,CHAR_COLORWHITE); + return; + } + } + + //ѶϢ CLI + lssproto_WN_send( fd, windowtype, buttontype, windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token ); +} + +#endif +//ANDY_RE +int CheckWarpMsg( int meindex, int talkerindex,char *npcarg ,char *TalkStr) +{ + char buf[1024]; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "warp_msg", buf, sizeof( buf) ) == NULL) + return 0; + if( strcmp( buf, TalkStr) ) + return 1; + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buf, sizeof( buf) ) != NULL) { + if( strstr( buf, "FALSE") != NULL ) { + }else { + if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ) { + NPC_ERR_DiSP( meindex, talkerindex, 1); + return 2; + } + } + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "FREE", buf, sizeof( buf)) == NULL ) + return 2; + if( ( NPC_ActionPassCheck( meindex, talkerindex, buf ) == FALSE) ) { + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "NomalMsg", buf,sizeof(buf)) != NULL) { + CHAR_talkToCli( talkerindex, meindex,buf,CHAR_COLORWHITE); + } + return 2; + }else { + if( Action_RunDoEventAction( meindex, talkerindex, npcarg) == FALSE ){ + + CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1); + return 3; + } + CHAR_complianceParameter( talkerindex ); + CHAR_send_P_StatusString( talkerindex , + CHAR_P_STRING_ATK|CHAR_P_STRING_DEF| + CHAR_P_STRING_CHARM|CHAR_P_STRING_QUICK| + CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE| + CHAR_P_STRING_WIND|CHAR_P_STRING_EARTH ); + + if(NPC_Util_GetStrFromStrWithDelim( npcarg, "FreeMsg", buf, sizeof( buf)) != NULL ){ + CHAR_talkToCli( talkerindex, meindex, buf, CHAR_COLORWHITE); + } + + NPC_WarpMsg( meindex, talkerindex, npcarg); + NPC_NpcWarpMsg( meindex, talkerindex, npcarg); + return 4; + } + return 0; +} + +BOOL NPC_NpcWarpMsg(int meindex,int talker,char *arg) +{ + char buf[256]; + int fl=0,x=0,y=0; + + if( CHAR_CHECKINDEX( meindex ) == FALSE ) + return FALSE; + + if( NPC_Util_GetStrFromStrWithDelim( arg, "NPCPOINT", buf, sizeof( buf)) == NULL ) + return FALSE; + GetRand_WarpPoint( buf, &fl, &x, &y ); + + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "Warp NPC:2.Invalid warpman ERR" ); + return FALSE; + } + + CHAR_warpToSpecificPoint( meindex, fl, x, y ); + + return TRUE; +} + +void NPC_WarpManLoop( int meindex) +{ + int born, dead; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + if( !CHAR_CHECKINDEX( meindex) ) return; + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL ){ + print("WarpMan:GetArgStrErr"); + return; + } + if( !strstr( npcarg,"NEWWARPMAN") ) + return; + + if( NPC_getTimeData( meindex, npcarg, &born, &dead, 200) != FALSE ){ + NPC_TimeDefineDo( meindex, born, dead, NPC_TIME_MODE); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + } +} + +void NPC_WarpManWatch( int meobjindex, int objindex, CHAR_ACTION act, + int x,int y,int dir, int* opt,int optlen ) +{ + int born, dead; + int meindex, index; + + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return; + index = OBJECT_getIndex( objindex); + if( !CHAR_CHECKINDEX( index) ) return; + if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return; + meindex = OBJECT_getIndex( meobjindex); + if( !CHAR_CHECKINDEX( meindex) ) return; + + if( NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg)) == NULL ){ + print("WarpMan:GetArgStrErr"); + return; + } + if( !strstr( npcarg,"NEWWARPMAN") ) + return; +#ifdef _TREASURE_BOX + if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTMODE) == NPC_EVENTMODE_OPEN ){ + if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTTIME) < NowTime.tv_sec ){ + //ر + CHAR_setWorkInt( meindex, NPC_TIME_EVENTMODE, NPC_EVENTMODE_EVENT); + //ͼ + CHAR_setInt( meindex, CHAR_BASEBASEIMAGENUMBER, + CHAR_getWorkInt( meindex, NPC_TIME_EVENOFFDBBI)); + CHAR_setInt( meindex, CHAR_BASEIMAGENUMBER, + CHAR_getWorkInt( meindex, NPC_TIME_EVENOFFDBBI)); + NPC_TreasureEventRunMsg( meindex); //Ƿwarp + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + } + } +#endif + if( NPC_getTimeData( meindex, npcarg, &born, &dead, 200) != FALSE ){ + NPC_TimeDefineDo( meindex, born, dead, NPC_TIME_MODE); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX ) ); + } +} + +#ifdef _TREASURE_BOX +BOOL NPC_TreasureEventRunMsg( int meindex) +{ + char buf[256]; + char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20]; + + int fl,x,y; + + if( !CHAR_CHECKINDEX( meindex )) + return FALSE; + + + if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){ + print("WarpMan:GetArgStrErr"); + return FALSE; + } + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "TREASURE_NUM", buf, sizeof( buf)) == NULL ) + return FALSE; + + if( CHAR_getWorkInt( meindex, NPC_TIME_EVENTNUM) < atoi( buf) ) return FALSE; + CHAR_setWorkInt( meindex, NPC_TIME_EVENTNUM, 0); + + if( NPC_Util_GetStrFromStrWithDelim( npcarg, "TREASURE_POINT", buf, sizeof( buf)) == NULL ) + return FALSE; + GetRand_WarpPoint( buf, &fl, &x, &y ); + + if( MAP_IsValidCoordinate( fl,x,y )== FALSE ){ + print( "Warp NPC:2.Invalid warpman ERR" ); + return FALSE; + } + + CHAR_warpToSpecificPoint( meindex, fl, x, y ); + return TRUE; +} + +#endif + +BOOL NPC_TreasureRandItemGet(int meidex,int talker,int rand_j,char *buf) +{ + char buff2[64]; + int randitem; + int ret; + int itemindex; + char token[128]; + + if(rand_j == 0) { + print("Event:춣Ľ룬ִ"); + return FALSE; + } + + randitem = rand()%rand_j; + if(randitem == 0) randitem = rand_j; + + getStringFromIndexWithDelim(buf , "," , randitem, buff2, sizeof(buff2)) ; + + itemindex = ITEM_makeItemAndRegist( atoi( buff2)); + + if(itemindex == -1) return FALSE; + + /*ʧ ةܰ( ʧ ة ľ */ + ret = CHAR_addItemSpecificItemIndex( talker, itemindex); + if( !CHAR_CHECKITEMINDEX( talker, ret) ){ + print( "npc_exchangeman.c: additem error itemindex[%d]\n", itemindex); + ITEM_endExistItemsOne( itemindex); + return FALSE; + } + + if(itemindex != -1) { + LogItem( + CHAR_getChar( talker, CHAR_NAME ), /* ƽҷ */ + CHAR_getChar( talker, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID), /* ʧ ة į */ +#endif + "EventAddItem(õĵ)", + CHAR_getInt( talker,CHAR_FLOOR), + CHAR_getInt( talker,CHAR_X ), + CHAR_getInt( talker,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + } + + sprintf(token,"%s",ITEM_getChar( itemindex, ITEM_NAME)); + CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE); + + CHAR_sendItemDataOne( talker, ret); + return TRUE; + +} + +#ifdef _NPC_ADDLEVELUP // (ɿ) ANDY ⲿԻҵȼ +extern tagRidePetTable ridePetTable[296]; +void NPC_LevelAndTransUp( int meindex, int charindex, int level, int skillpoint, int exp, int ridepet) +{ + char szBuffer[256]=""; + if( !CHAR_CHECKINDEX( charindex) ) + return; +//int CHAR_LevelUpCheck( int charaindex , int toindex) + if( exp > 0 ){ + int LevelUp=0; + int myexp = CHAR_getInt( charindex, CHAR_EXP); + myexp += exp; + if( myexp > 300000000 ) myexp = 300000000; + CHAR_setInt( charindex, CHAR_EXP, myexp); + snprintf( szBuffer, sizeof(szBuffer), + "(%s) õ EXP %d", CHAR_getUseName( charindex ), exp); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + LevelUp = CHAR_LevelUpCheck( charindex , -1); + if( LevelUp > 0 ){ + snprintf( szBuffer, sizeof(szBuffer), + "(%s) %d", + CHAR_getUseName( charindex ), + CHAR_getInt( charindex, CHAR_LV ) + ); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + CHAR_setInt( charindex, CHAR_SKILLUPPOINT, + CHAR_getInt( charindex, CHAR_SKILLUPPOINT) + LevelUp*3 ); + CHAR_complianceParameter( charindex ); + } + } + + if( level > 0 ){ + CHAR_setInt( charindex, CHAR_LV, level); + snprintf( szBuffer, sizeof(szBuffer), + "(%s) ȼ趨Ϊ %d", + CHAR_getUseName( charindex ), CHAR_getInt( charindex, CHAR_LV ) + ); + CHAR_talkToCli( charindex, -1, szBuffer, CHAR_COLORYELLOW); + } + + if( skillpoint > 0 ){ + int MySp = CHAR_getInt( charindex, CHAR_SKILLUPPOINT); + MySp += skillpoint; + CHAR_setInt( charindex, CHAR_SKILLUPPOINT, MySp); + } + if( ridepet >= 0 ){ + int basepet[2][4]={ {2066,2067,2068,2069}, + {2072,2073,2074,2075}}; + int petTemp[]={-1,-1,-1,-1,-1}; + char msgbuf[256]; + int petNum=0; + int i,j=0; + int k=0, petindex,enemyarray; + petTemp[j++] = basepet[0][rand()%4]; + petTemp[j++] = basepet[1][rand()%4]; + + for( i=0; i< arraysizeof(ridePetTable) ; i++ ){ + if( CHAR_getInt( charindex, CHAR_BASEBASEIMAGENUMBER) == ridePetTable[i].charNo ){ + petTemp[j]= ridePetTable[i].petId; + j++; + if( j >= arraysizeof( petTemp) ) + break; + } + } + j=0; + for( petNum=0; petNum +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "pet_skill.h" +#include "readmap.h" +#include "battle.h" +#include "profession_skill.h" +#include "chatmagic.h" +#include "npc_welfare.h" +#include "npc_exchangeman.h" + +static void NPC_Welfare_selectWindow(int meindex, int toindex, int num, int select); + + +//ÿNPCijʼ +BOOL NPC_WelfareInit( int meindex ) +{ + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWELFARE); + //print(":%s\n",CHAR_getChar( meindex, CHAR_NAME)); + return TRUE; +} + +//ԻʱĴ +void NPC_WelfareTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){ + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + } + NPC_Welfare_selectWindow( meindex, talkerindex,0,-1); +} + +static void NPC_Welfare_selectWindow( int meindex, int toindex, int num,int select) +{ + switch(num){ + case 0: + //free + NPC_WelfareMakeStr(meindex, toindex, select); + break; + case 1: + break; + } +} + +void NPC_WelfareWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + int skill, i, j; + int cost; + int skillID=0; + char buf[64]; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[512]; + char message[64]; + int fd = getfdFromCharaIndex( talkerindex ); + double rate= 1.0; + int skillarray; + int p_class=0, need_class=0; + int profession_skill_point; + + memset( message, -1, sizeof(message) ); + + if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) { + return; + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + + makeStringFromEscaped( data); + getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf)); + skill=atoi(buf); + getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf)); + cost=atoi(buf); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "profession_skill", msg, sizeof( msg)) != NULL){ + getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf)); + skillID=atoi(buf); + } + + + if(skillID < 0) return ; + + if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ; + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate = atof( msg); + } + + skillarray = PROFESSION_SKILL_getskillArray( skillID ); + + if(skillarray == -1){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return ; + } + + // жְҵ + { + if( NPC_Util_GetStrFromStrWithDelim( argstr, "profession_class", msg, sizeof(msg) ) == NULL){ + return ; + }else{ + p_class = atoi(msg); + } + + // ְҵ + need_class = PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_PROFESSION_CLASS ); + + if( CHAR_getInt( talkerindex, PROFESSION_CLASS ) == 0 ){ + char token[256]; + memset(token, -1, sizeof(token) ); + sprintf( token, "δְ!" ); + CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + + } + + if( CHAR_getInt( talkerindex, PROFESSION_CLASS ) != need_class && need_class != 4 ){ + char token[256]; + memset(token, -1, sizeof(token) ); + sprintf( token, "˼㲻ѧ!" ); + CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + + + } + + // жʣ + { + profession_skill_point = CHAR_getInt( talkerindex, PROFESSION_SKILL_POINT ); + if( profession_skill_point <= 0 ){ + char token[256]; + memset(token, -1, sizeof(token) ); + sprintf( token, "Ŀǰûѧϰ!" ); + CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + } + + // жǷѧϰ + { + int temp[4] = {0}, count = 0, flag = -1 , need_percent = -1, need_count = 0; + + for( i=0; i<4; i++){ + int limit = -1; + flag = -1; + limit = PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_LIMIT1+i*2 ); + need_percent = PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_LIMIT1+i*2 + 1 ); + + if( limit!= 0 && need_percent == 0 ) need_count++; + + if( limit == 0 ){ + continue; + }else if( limit == -1 ){ + for( j=0; j 0 ) break; + } + if( j >= PROFESSION_MAX_LEVEL ){ + char token[256]; + sprintf( token, "ѧΣսܲѧϰ"); + CHAR_talkToCli( talkerindex, meindex, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + }else{ + flag = -1; + for( j=0; jskill, SKILL_LEVEL); + + // ж + if( skill_level >= need_percent ){ + flag = 1; break; + } + } + } + + // δ + if( flag == -1 && need_percent == 0 ){ + temp[count] = limit; + count ++; + }else if( flag == -1 ){ + char token[256]; + memset(token, -1, sizeof(token) ); + sprintf( token, "δѧ%s!", PROFESSION_SKILL_getChar( limit, PROFESSION_SKILL_NAME) ); + CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + }else if( flag == -2 ){ + char token[256]; + memset(token, -1, sizeof(token) ); + sprintf( token, "%sȲ%d!", PROFESSION_SKILL_getChar( limit, PROFESSION_SKILL_NAME), need_percent ); + CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + } + } + + if( count == need_count && need_count != 0 ){ + char msg[256] = {0}; + + sprintf( msg, "ѧ " ); + for( i = 0; i< count; i++ ){ + if( temp[i] != 0 ){ + char token[50] = {0}; + sprintf( token, "%s ", PROFESSION_SKILL_getChar( temp[i], PROFESSION_SKILL_NAME) ); + strcat( msg, token ); + } + } + sprintf( msg, "%s һּ", msg ); + CHAR_talkToCli( talkerindex, -1, msg, CHAR_COLORYELLOW); + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + + return; + } + + } + + // жϽǮ + { + cost = PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_COST ); + cost = cost * rate; + + if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost){ + CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD); + return; + } + } + +#ifdef _NPC_ProfessionTrans + //жת + { + if( NPC_Util_GetStrFromStrWithDelim( argstr, "trans", msg, sizeof(msg) ) != NULL){ + int trans = atoi(msg); + print("\nתҪ:%d,%d",CHAR_getInt( talkerindex, CHAR_TRANSMIGRATION),trans); + if( CHAR_getInt( talkerindex, CHAR_TRANSMIGRATION) < trans){ + if( NPC_Util_GetStrFromStrWithDelim( argstr, "trans_msg", msg, sizeof(msg) ) != NULL){ + CHAR_talkToCli( talkerindex, meindex, msg, CHAR_COLORYELLOW); + return; + } + else{ + CHAR_talkToCli( talkerindex, meindex, "תŶ", CHAR_COLORYELLOW); + return; + } + } + } + } +#endif + + // Ӽ + { + int skill_level = 0; + + // ͨȸ5010 + if( (skillID == 63) || (skillID == 64) || (skillID == 65) ){ + int Pskillid = -1; + skill_level = 50; + Pskillid = PROFESSION_SKILL_getskillArray( skillID ); + }else{ + skill_level = 10; + } + + if( PROFESSION_SKILL_ADDSK( talkerindex, skillID, skill_level ) == -1 ) return; + + CHAR_DelGold( talkerindex, cost ); + + CHAR_sendStatusString( talkerindex , "S"); + + NPC_Welfare_selectWindow( meindex, talkerindex,0,-1); + } + + // ѶϢ + { + char token[256]; + int next_profession_skill_point = profession_skill_point-1; + + CHAR_setInt( talkerindex, PROFESSION_SKILL_POINT, next_profession_skill_point ); + + memset(token, -1, sizeof(token) ); + sprintf( token, "ѧϰ %sʣѧϰ %d" + ,PROFESSION_SKILL_getChar( skillarray, PROFESSION_SKILL_NAME ) + ,next_profession_skill_point ); + CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW); + + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( talkerindex , CHAR_WORKOBJINDEX )); + } + +} + +void NPC_WelfareMakeStr(int meindex,int toindex,int select) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char msg[256]; + double rate=1.0; + int i=0; + char token[65530]; + int fd = getfdFromCharaIndex( toindex); + + if(select==0){ + sprintf(token,"0|0"); + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PETSKILLSHOP, + WINDOW_BUTTONTYPE_NONE, + CHAR_WINDOWTYPE_WINDOWPETSKILLSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + } + + if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){ + print("GetArgStrErr"); + return; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "main_msg", msg, sizeof( msg)) == NULL){ + print("mainERR"); + return ; + } + + sprintf(token,"1|%s|%s", CHAR_getChar(meindex,CHAR_NAME), msg); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){ + rate=atof(msg); + } + + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "profession_skill", msg, sizeof( msg) ) != NULL){ + int skillarray; + int skillID; + int cost; + char token2[265]; + char buf[64]; + + i=1; + while( getStringFromIndexWithDelim(msg,",",i,buf,sizeof(buf)) !=FALSE ){ + i++; + skillID=atoi(buf); + + skillarray = PROFESSION_SKILL_getskillArray( skillID ); + + if( PROFESSION_SKILL_CHECKINDEX( skillarray ) == FALSE ) continue; + + cost = PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_COST ); + + cost = (int)cost*rate; + + sprintf(token2,"|%s|%d|%s|%d", + PROFESSION_SKILL_getChar( skillarray, PROFESSION_SKILL_NAME ), // + cost, // + PROFESSION_SKILL_getChar( skillarray, PROFESSION_SKILL_TXT ), // ˵ + PROFESSION_SKILL_getInt( skillarray, PROFESSION_SKILL_ICON ) // ͼʾ + ); + strcat(token,token2); + } + } + + lssproto_WN_send( fd, WINDOW_MESSAGETYPE_PROFESSIONSHOP, + WINDOW_BUTTONTYPE_NONE, + WINDOW_MESSAGETYPE_PROFESSIONSHOP, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + token); + + return; +} + + +#endif +#endif + + diff --git a/npc/npc_welfare2.c b/npc/npc_welfare2.c new file mode 100644 index 0000000..e69de29 diff --git a/npc/npc_windowhealer.c b/npc/npc_windowhealer.c new file mode 100644 index 0000000..132739b --- /dev/null +++ b/npc/npc_windowhealer.c @@ -0,0 +1,698 @@ +#include "version.h" +#include +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "lssproto_serv.h" +#include "npc_windowhealer.h" + + + +#define RATE 1000 + + +/* + * ɬýľūëNPC + * + */ + +enum { + CHAR_WORK_LEVEL = CHAR_NPCWORKINT1, + CHAR_WORK_RANGE = CHAR_NPCWORKINT2, + CHAR_WORK_HP = CHAR_NPCWORKINT3, + CHAR_WORK_MP = CHAR_NPCWORKINT4, + +}; + + +static void NPC_WindowHealer_selectWindow( int meindex, int toindex, int num); +void NPC_WindowHealerAllHeal( int talker,int mode ); +BOOL NPC_WindowHealerLevelCheck(int meindex,int talker); +BOOL NPC_WindowMoneyCheck(int meindex,int talker,int mode); +int NPC_WindowCostCheck(int meindex,int talker); +BOOL NPC_PetHealerCheck(int talker); +int NPC_WindowCostCheckMp(int meindex,int talker); + + +/********************************* +*********************************/ +BOOL NPC_WindowHealerInit( int meindex ) +{ + + char *npcarg; + char buf2[256]; + int range=1; + int rate; + double drate; + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEHEALER ); + + npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT); + + /*--弰ëìëʢ--*/ + if(getStringFromIndexWithDelim(npcarg,"|",1,buf2,sizeof(buf2))!=FALSE){ + CHAR_setWorkInt(meindex,CHAR_WORK_LEVEL,atoi(buf2)); + + }else{ + return FALSE; + } + if(getStringFromIndexWithDelim(npcarg, "|", 2, buf2, sizeof( buf2)) != FALSE ){ + drate = atof(buf2); + if(drate==0) { + rate=500; + }else{ + rate=(int) (drate * RATE); + } + CHAR_setWorkInt(meindex,CHAR_WORK_HP,rate); + } + if(getStringFromIndexWithDelim(npcarg, "|", 3, buf2, sizeof( buf2)) != FALSE ){ + drate = atof(buf2); + if(drate==0){ + rate=2000; + }else{ + rate=(int)( drate * RATE); + } + CHAR_setWorkInt(meindex,CHAR_WORK_MP,rate); + } + if(getStringFromIndexWithDelim(npcarg, "|", 4, buf2, sizeof( buf2)) != FALSE ){ + range=atoi(buf2); + if(range == 0){ + range=1; + } + } + CHAR_setWorkInt(meindex,CHAR_WORK_RANGE,range); + return TRUE; + +} + +void NPC_WindowHealerTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + + if( NPC_Util_CharDistance( talkerindex, meindex ) + > CHAR_getWorkInt(meindex,CHAR_WORK_RANGE)){ + return; + } + if( (CHAR_getWorkInt(talkerindex,CHAR_WORKPARTYMODE) == 0) + || (CHAR_getWorkInt(talkerindex,CHAR_WORKPARTYMODE) == 2) ){ + NPC_WindowHealer_selectWindow( meindex, talkerindex,0); + }else{ + int i=0; + int otherindex; + + for( i=0 ; i < CHAR_PARTYMAX ;i++){ + otherindex=CHAR_getWorkInt(talkerindex,CHAR_WORKPARTYINDEX1+i); + if(otherindex != -1){ + NPC_WindowHealer_selectWindow( meindex, otherindex,0); + } + } + } +} +void NPC_WindowHealerLooked( int meindex , int lookedindex) +{ + if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( NPC_Util_CharDistance( lookedindex, meindex ) + > CHAR_getWorkInt(meindex,CHAR_WORK_RANGE)){ + return; + } + NPC_WindowHealer_selectWindow( meindex, lookedindex,0); +} + +static void NPC_WindowHealer_selectWindow( int meindex, int toindex, int num) +{ + + char token[1024]; + char escapedname[1024]; + int fd = getfdFromCharaIndex( toindex); + int buttontype=0; + int windowtype=0; + int windowno=0; + + /*--̼⻥мƥƱɬ--*/ + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + + switch( num){ + case 0: + sprintf(token," ѽ𣿡 \n\n " + " ;ظ \n" + " ظ \n" + " ;ظ \n\n" + " ظ() " + ); + + buttontype=WINDOW_BUTTONTYPE_CANCEL; + windowtype=WINDOW_MESSAGETYPE_SELECT; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_STARTMSG; + break; + + + case 1: + if( CHAR_getInt(toindex,CHAR_HP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)){ + if(NPC_PetHealerCheck(toindex)==FALSE){ + sprintf(token, + " ;ظ" + "\n\n\n\nƺûбҪظࡣ"); + }else{ + sprintf(token, + " ;ظ" + "\n\n ƺûбҪظࡣ" + "\n\nΪҲˣ" + "\n Ȱظɣ"); + + NPC_WindowHealerAllHeal(toindex,0 ); + } + + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; + break; + }else if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){ + sprintf(token," ;ظ" + "\n\n\nҪظ;ûɣ " + "\n\nڵĵȼѰظࡣ"); + + }else{ + int gold; + gold=NPC_WindowCostCheck(meindex,toindex); + sprintf(token," ;ظ" + "\n\n\nҪظ;ûɣ " + "\n\n%dSTONE " + ,gold); + } + + buttontype=WINDOW_BUTTONTYPE_YESNO; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG; + break; + + case 2: + if( CHAR_getInt(toindex,CHAR_MP) ==CHAR_getWorkInt( toindex, CHAR_WORKMAXMP)){ + if(NPC_PetHealerCheck(toindex)==FALSE){ + sprintf(token, " ظ" + "\n\n\n\nƺûбҪظࡣ"); + }else{ + sprintf(token, " ظ" + "\n\n ƺûбҪظࡣ" + "\n\nΪҲˣ" + "\n Ȱظɣ"); + NPC_WindowHealerAllHeal(toindex,0 ); + } + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; + break; + } + + if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){ + sprintf(token," ظ" + "\n\nҪظûɣ " + "\n\n ڵĵȼѰظࡣ"); + }else{ + int cost; + cost=NPC_WindowCostCheckMp(meindex,toindex); + sprintf(token," ظ" + "\n\n\nҪظûɣ " + "\n\n%dSTONE ", + cost); + } + buttontype=WINDOW_BUTTONTYPE_YESNO; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; + break; + + + case 3: + sprintf(token, "\n;ѻظ" + "\n Ҳѻظһ״̬" + "\n\n\n Ӿûˣ"); + + NPC_WindowHealerAllHeal( toindex ,1 ); + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; + break; + + + case 4: + sprintf(token, "\nѻظ" + "\n Ҳѻظһ״̬" + "\n\n\n Ӿûˣ "); + NPC_WindowHealerAllHeal( toindex ,2 ); + buttontype=WINDOW_BUTTONTYPE_OK; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKSPIRITMSG; + break; + + + case 6: + { + int cost=0; + + if(CHAR_getInt(toindex,CHAR_HP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) + { + cost+=NPC_WindowCostCheck(meindex,toindex); + } + + if( CHAR_getInt(toindex,CHAR_MP) < CHAR_getWorkInt( toindex, CHAR_WORKMAXMP)) + { + cost=cost+NPC_WindowCostCheckMp(meindex,toindex); + } + + if(cost==0) { + if(NPC_PetHealerCheck(toindex)==FALSE){ + sprintf(token, + " ;ظ" + "\n\n\n\nƺûбҪظࡣ"); + }else{ + sprintf(token," ;ظ" + "\n\n ƺûбҪظࡣ" + "\n\nΪҲˣ" + "\n Ȱظɣ"); + NPC_WindowHealerAllHeal(toindex,0 ); + } + + + + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG; + break; + + }else{ + sprintf(token," ;ظ" + "\n\n\n Ҫظ;ûɣ" + "\n\n%dSTONE ",cost); + } + } + + if(NPC_WindowHealerLevelCheck(meindex,toindex)==TRUE){ + sprintf(token," ;ظ" + "\n\n\n Ҫظ;ûɣ" + "\n\nڵĵȼѰظࡣ"); + } + + buttontype=WINDOW_BUTTONTYPE_YESNO; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_ALLMSG; + break; + + + case 7: + sprintf(token," ;ѻظ" + "\n Ҳѻظһ״̬" + "\n\n\nһͻظˣ"); + + NPC_WindowHealerAllHeal( toindex ,3 ); + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKALLMSG; + break; + + + case 8: + sprintf(token,"\n\n\n\n ϧƺĽǮࡣ"); + + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; + break; + + case 9: + sprintf(token,"ظ" + "\n\n\nѾû" + "\n\n̫ǿĻҲࡣ"); + NPC_WindowHealerAllHeal(toindex,0 ); + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; + break; + + case 10: + sprintf(token,"ظ" + "\n\n\n ƺûбҪظӡ" + "\n\n̫ǿĻҲࡣ"); + buttontype=WINDOW_BUTTONTYPE_OK; + windowtype=WINDOW_MESSAGETYPE_MESSAGE; + windowno=CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG; + break; + + + } + + + makeEscapeString( token, escapedname, sizeof(escapedname)); + /*-ƥ˪--*/ + lssproto_WN_send( fd, windowtype, + buttontype, + windowno, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + escapedname); + +} + + +/*----------------------------------------- +-------------------------------------------*/ +void NPC_WindowHealerWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) +{ + + if( NPC_Util_CharDistance( talkerindex, meindex ) > (CHAR_getWorkInt(meindex,CHAR_WORK_RANGE)+4)) return; + + switch( seqno){ + case CHAR_WINDOWTYPE_WINDOWHEALER_STARTMSG: + if(atoi(data)==2) /*-- 1--*/ + { + NPC_WindowHealer_selectWindow( meindex, talkerindex, 1 ); + + }else if(atoi(data)==3){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 2 ); + + }else if(atoi(data)==4){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 6 ); + + }else if(atoi(data)==6){ + if(NPC_PetHealerCheck( talkerindex)==TRUE){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 9 ); + }else{ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 10 ); + } + }else if(select==WINDOW_BUTTONTYPE_CANCEL){ + } + break; + + + case CHAR_WINDOWTYPE_WINDOWHEALER_HPMSG: + if(select==WINDOW_BUTTONTYPE_OK){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + + }else if(select==WINDOW_BUTTONTYPE_YES){ + /*--ż--*/ + if(NPC_WindowMoneyCheck(meindex,talkerindex,1)==TRUE){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 3 ); + }else{ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 8 ); + } + }else if(select==WINDOW_BUTTONTYPE_NO){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + + } + break; + + + case CHAR_WINDOWTYPE_WINDOWHEALER_SPIRITMSG: + if(select==WINDOW_BUTTONTYPE_OK){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + + }else if(select==WINDOW_BUTTONTYPE_YES){ + /*--ż--*/ + if(NPC_WindowMoneyCheck(meindex,talkerindex,2)==TRUE){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 4 ); + }else{ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 8 ); + } + + }else if(select==WINDOW_BUTTONTYPE_NO){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + } + + break; + + + case CHAR_WINDOWTYPE_WINDOWHEALER_OKHPMSG: + if(select==WINDOW_BUTTONTYPE_OK){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + } + break; + + + case CHAR_WINDOWTYPE_WINDOWHEALER_OKSPIRITMSG: + if(select==WINDOW_BUTTONTYPE_OK){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + } + break; + + + /*----*/ + case CHAR_WINDOWTYPE_WINDOWHEALER_ALLMSG: + if(select==WINDOW_BUTTONTYPE_OK){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + + }else if(select==WINDOW_BUTTONTYPE_YES){ + if(NPC_WindowMoneyCheck(meindex,talkerindex,3)==TRUE){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 7 ); + }else{ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 8 ); + } + + }else if(select==WINDOW_BUTTONTYPE_NO){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + } + break; + + + /*--⼰--*/ + case CHAR_WINDOWTYPE_WINDOWHEALER_OKALLMSG: + if(select==WINDOW_BUTTONTYPE_YES){ + NPC_WindowHealer_selectWindow( meindex, talkerindex, 0 ); + } + break; + } + + if(select==WINDOW_BUTTONTYPE_CANCEL + && CHAR_getWorkInt( talkerindex, CHAR_WORKPARTYMODE ) == 2) + { + CHAR_sendWatchEvent( CHAR_getWorkInt( talkerindex, CHAR_WORKOBJINDEX), + CHAR_ACTPLEASURE,NULL,0,TRUE); + CHAR_setWorkInt( talkerindex, CHAR_WORKACTION, CHAR_ACTPLEASURE); + } + +} + + +BOOL NPC_PetHealerCheck(int talker) +{ + + int petindex; + int i; + + /*--ʸƥƻؤ--*/ + for(i=0;i CHAR_getInt(talker,CHAR_LV)){ + return TRUE; + } + + return FALSE; + +} + + +/*------------------------------------------- +¦ +talkerƽҷ̼͵ +---------------------------------------------*/ +BOOL NPC_WindowMoneyCheck(int meindex,int talker,int mode) +{ + int cost=0; + int level; + + level=CHAR_getWorkInt(meindex,CHAR_WORK_LEVEL); + + if(mode==1){ + if(level <= CHAR_getInt(talker,CHAR_LV)){ + /*---ëԻ---*/ + cost=NPC_WindowCostCheck(meindex,talker); + /*--ػɬ---*/ + /*---ŻԻ¾---*/ + if(CHAR_getInt(talker,CHAR_GOLD) < cost){ + return FALSE; + + } + CHAR_DelGold( talker, cost); + } + } + if(mode==2){ + if(level <= CHAR_getInt(talker,CHAR_LV)){ + /*---ëԻ---*/ + cost=NPC_WindowCostCheckMp(meindex,talker); + + /*--ػɬ---*/ + /*---ŻԻ¾---*/ + if(CHAR_getInt(talker,CHAR_GOLD) < cost){ + return FALSE; + } + CHAR_DelGold( talker, cost); + } + } + + if(mode==3){ + if(level <= CHAR_getInt(talker,CHAR_LV)){ + + if( CHAR_getInt(talker,CHAR_HP) +#include "char.h" +#include "object.h" +#include "char_base.h" +#include "npcutil.h" +#include "configfile.h" +#include "lssproto_serv.h" +#include "npc_windowman.h" + +struct { + int windowno; + int windowtype; + int buttontype; + int takeitem; + int giveitem; + char message[4096]; +}w; + +struct { + BOOL use; + int checkhaveitem; + int checkhaveitemgotowin; + int checkdonthaveitem; + int checkdonthaveitemgotowin; + int warp; + int battle; + int gotowin; +}buttonproc[13]; /* ok,cancel, yes,no,prev,next ݼ */ + + + + + +enum { + CHAR_WORK_MSGCOLOR = CHAR_NPCWORKINT1, +}; +//static void NPC_Windowman_selectWindow( int meindex, int toindex, int num); +//static BOOL NPC_Windowman_readData( int meindex, int windowno, BOOL chkflg); +//static int NPC_Windowman_restoreButtontype( char *data ); + +/********************************* +*********************************/ +BOOL NPC_WindowmanInit( int meindex ) +{ + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[1024]; + //int i; + //char secondToken[1024]; + + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf)) + == NULL ) + { + print( "windowman:ûָ趨ĵ \n"); + return FALSE; + } + /* ݱɬ÷ëƻ֧ */ + if( !NPC_Windowman_readData( meindex, -1, TRUE) ) { + return FALSE; + } + + CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN ); + + return TRUE; +} + + + + +/********************************* +*********************************/ +void NPC_WindowmanTalked( int meindex , int talkerindex , char *szMes ,int color ) +{ + + NPC_Windowman_selectWindow( meindex, talkerindex, 1 ); + +} +/********************************* +*********************************/ +void NPC_WindowmanLooked( int meindex , int lookedindex) +{ + + NPC_Windowman_selectWindow( meindex, lookedindex,1 ); + +} + +/*static*/ void NPC_Windowman_selectWindow( int meindex, int toindex, int num) +{ + + int fd; + char buf[256]; + + if( CHAR_getInt( toindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) { + return; + } + if( !NPC_Util_charIsInFrontOfChar( toindex, meindex, 1 )) return; + + if( !NPC_Windowman_readData( meindex, num, FALSE) ) { + print( "windowman:readdata error\n"); + return; + } + + fd = getfdFromCharaIndex( toindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } +} +void NPC_WindowmanWindowTalked( int meindex, int talkerindex, + int seqno, int select, char *data) + +{ + int button = -1; + char buf[256]; + if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return; + + if( !NPC_Windowman_readData( meindex, seqno - 100, FALSE) ) { + print( "windowman:readdata error\n"); + return; + } + if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) { + button = atoi( data)+5; + if( button > 12 ) { + print( "windowman:invalid button[%d]\n", button); + return; + } + } + else if( select & WINDOW_BUTTONTYPE_OK) button = 0; + else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1; + else if( select & WINDOW_BUTTONTYPE_YES) button = 2; + else if( select & WINDOW_BUTTONTYPE_NO) button = 3; + else if( select & WINDOW_BUTTONTYPE_PREV) button = 4; + else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5; + else { + print( "windowman:invalid button[%d]\n", select); + return; + } + if( buttonproc[button].use == TRUE ) { + int i; + int fd; + int newwin = -1; + if( buttonproc[button].checkhaveitem != -1 ) { + for( i = 0; i < CHAR_MAXITEMHAVE; i ++ ) { + int itemindex = CHAR_getItemIndex( talkerindex, i); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) + == buttonproc[button].checkhaveitem ) + { + break; + } + } + } + if( i == CHAR_MAXITEMHAVE ) { + return; + } + newwin = buttonproc[button].checkhaveitemgotowin; + } + if( buttonproc[button].checkdonthaveitem != -1 ) { + for( i = 0; i < CHAR_MAXITEMHAVE; i ++ ) { + int itemindex = CHAR_getItemIndex( talkerindex, i); + if( ITEM_CHECKINDEX( itemindex)) { + if( ITEM_getInt( itemindex, ITEM_ID) + == buttonproc[button].checkdonthaveitem ) + { + break; + } + } + } + if( i != CHAR_MAXITEMHAVE ) { + return; + } + newwin = buttonproc[button].checkdonthaveitemgotowin; + } + + if( newwin == -1 ) { + newwin = buttonproc[button].gotowin; + } + if( !NPC_Windowman_readData( meindex, newwin, FALSE) ) { + print( "windowman:readdata error\n"); + return; + } + fd = getfdFromCharaIndex( talkerindex); + if( fd != -1 ) { + lssproto_WN_send( fd, w.windowtype, + w.buttontype, + w.windowno+100, + CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), + makeEscapeString( w.message, buf, sizeof(buf))); + } + } +} + +BOOL NPC_Windowman_readData( int meindex, int windowno, BOOL chkflg) +{ + + int i; + int linenum = 0; + int endflg = FALSE; + int buttonendflg; + int winno = -1; + int buttonconfmode; + int b_mode; + int selectnum ; + int messagepos; + BOOL errflg = FALSE; + BOOL readflg = TRUE; + FILE *fp; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char filename[64]; + char opfile[128]; + char line[1024]; + char firstToken[1024]; + char secondToken[1024]; + + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", filename, sizeof( filename)) == NULL ) { + print("\n err:NOT FIND [conff] "); + return FALSE; + } + + sprintf( opfile, "%s/", getNpcdir( ) ); + strcat( opfile, filename); + + fp = fopen( opfile, "r"); + if( fp == NULL ) { + print( "windowman:file open error [%s]\n", opfile); + return FALSE; + } + + while( readflg == TRUE ) { + endflg = FALSE; + buttonendflg = TRUE; + buttonconfmode = FALSE; + selectnum = 0; + messagepos = 0; + winno = -1; + b_mode = -1; + errflg = FALSE; + + /* */ + w.windowno = -1; + w.windowtype = -1; + w.buttontype = -1; + w.takeitem = -1; + w.giveitem = -1; + w.message[0] = '\0'; + + for( i = 0; i < arraysizeof( buttonproc); i ++ ) { + buttonproc[i].use = FALSE; + buttonproc[i].checkhaveitem = -1; + buttonproc[i].checkhaveitemgotowin = -1; + buttonproc[i].checkdonthaveitem = -1; + buttonproc[i].checkdonthaveitemgotowin = -1; + buttonproc[i].warp = -1; + buttonproc[i].battle = -1; + buttonproc[i].gotowin = -1; + } + + while( 1) { + char buf[256]; + int ret; + if( !fgets( line, sizeof( line), fp)){ + readflg = FALSE; + break; + } + + linenum ++; + + if( line[0] == '#' || line[0] == '\n') continue; + /* ݱ */ + chomp( line ); + + /* ë */ + replaceString( line, '\t' , ' ' ); + for( i = 0; i < strlen( line); i ++) { + if( line[i] != ' ' ) { + break; + } + strcpy( buf, &line[i]); + } + if( i != 0 ) strcpy( line, buf); + + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, + sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + ret = getStringFromIndexWithDelim( line, "=", 2, secondToken, + sizeof( secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + continue; + } + + if( strcasecmp( firstToken, "winno") == 0 ) { + if( winno != -1 ) { + print( "windowman:winnoȴ¶winno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + readflg = FALSE; + break; + } + /* ūNoë */ + winno = atoi( secondToken); + continue; + } + if( winno == -1 ) { + print( "windowman:winno δ壬ȴ趨\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = FALSE; + break; + } + if( (chkflg == FALSE && winno == windowno )|| + chkflg == TRUE) + { + if( buttonconfmode == TRUE ) { + if( strcasecmp( firstToken, "gotowin") == 0 ) { + buttonproc[b_mode].gotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkhaveitem") == 0 ) { + buttonproc[b_mode].checkhaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "haveitemgotowin") == 0 ) { + buttonproc[b_mode].checkhaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "checkdonthaveitem") == 0 ) { + buttonproc[b_mode].checkdonthaveitem = atoi( secondToken); + } + else if( strcasecmp( firstToken, "donthaveitemgotowin") == 0 ) { + buttonproc[b_mode].checkdonthaveitemgotowin = atoi( secondToken); + } + else if( strcasecmp( firstToken, "endbutton") == 0 ) { + if( buttonproc[b_mode].gotowin == - 1 ) { + if( buttonproc[b_mode].checkhaveitem == -1 && + buttonproc[b_mode].checkdonthaveitem == -1) + { + errflg = TRUE; + } + else { + if( !((buttonproc[b_mode].checkhaveitem != -1 && + buttonproc[b_mode].checkhaveitemgotowin != -1) + || (buttonproc[b_mode].checkdonthaveitem != -1 && + buttonproc[b_mode].checkdonthaveitemgotowin != -1))) + { + errflg = TRUE; + } + } + } + + if( errflg == TRUE) { + print( "windowman: Ҳgotowin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + readflg = FALSE; + errflg = TRUE; + break; + } + buttonproc[b_mode].use = TRUE; + buttonconfmode = FALSE; + buttonendflg = TRUE; + } + } + else { + + w.windowno = winno; + /* ūɬ */ + if( strcasecmp( firstToken, "wintype") == 0 ) { + w.windowtype = atoi( secondToken); + } + /* ʾɬ */ + else if( strcasecmp( firstToken, "buttontype") == 0 ) { + w.buttontype = NPC_Windowman_restoreButtontype( secondToken); + } + /* getitemɬ */ + else if( strcasecmp( firstToken, "takeitem") == 0 ) { + w.takeitem = atoi( secondToken); + } + /* giveitemɬ */ + else if( strcasecmp( firstToken, "giveitem") == 0 ) { + w.giveitem = atoi( secondToken); + } + /* messageɬ */ + else if( strcasecmp( firstToken, "message") == 0 ) { + if( messagepos == 0 ) { + strcpy( w.message, secondToken); + messagepos = strlen( w.message); + } + else { + w.message[messagepos]='\n'; + messagepos++; + strcpy( &w.message[messagepos], secondToken); + messagepos+=strlen(secondToken); + } + } + /* ʾëݼɬ */ + else if( strcasecmp( firstToken, "okpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 0; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "cancelpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 1; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "yespressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 2; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nopressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 3; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "prevpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 4; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "nextpressed") == 0 ) { + buttonconfmode = TRUE; + b_mode = 5; + buttonendflg = FALSE; + } + else if( strcasecmp( firstToken, "selected") == 0 ) { + buttonconfmode = TRUE; + b_mode = 6 + selectnum; + buttonendflg = FALSE; + selectnum ++; + } + /* ɬñδԻ */ + else if( strcasecmp( firstToken, "endwin") == 0 ) { + endflg = TRUE; + if( chkflg == FALSE) { + readflg = FALSE; + } + break; + } + else { + print( "windowman:趨DzܵIJ\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + } + } + } + else { + if( strcasecmp( firstToken, "endwin") == 0 ) { + winno = -1; + } + } + } + if( buttonendflg == FALSE) { + print( "windowman: Ҳendbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( winno != -1 ) { + if( w.windowtype == -1 ) { + print( "windowman: Ҳwintype\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( w.buttontype == -1 ) { + print( "windowman: Ҳbutton\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + if( strlen( w.message) == 0 ) { + print( "windowman: Ҳmessage\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + errflg = TRUE; + break; + } + } + } + fclose( fp); + + if( chkflg == FALSE && w.windowno == -1 ) { + print( "windowman: Ҳָwindowno\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( winno != -1 && endflg == FALSE) { + print( "windowman: Ҳendwin\n"); + print( "filename:[%s] line[%d]\n", filename, linenum); + return FALSE; + } + if( errflg == TRUE) return FALSE; + + return TRUE; +} +/* + * + */ +/*static*/ int NPC_Windowman_restoreButtontype( char *data ) +{ + int ret = 0; + int rc; + int i; + char buff[1024]; + + for( i = 1; ; i ++ ) { + rc = getStringFromIndexWithDelim( data, "|", i, buff, + sizeof( buff ) ); + if( rc == FALSE) break; + if( strcasecmp( buff, "ok") == 0 ) { + ret |= WINDOW_BUTTONTYPE_OK; + } + else if( strcasecmp( buff, "cancel") == 0 ) { + ret |= WINDOW_BUTTONTYPE_CANCEL; + } + else if( strcasecmp( buff, "yes") == 0 ) { + ret |= WINDOW_BUTTONTYPE_YES; + } + else if( strcasecmp( buff, "no") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NO; + } + else if( strcasecmp( buff, "prev") == 0 ) { + ret |= WINDOW_BUTTONTYPE_PREV; + } + else if( strcasecmp( buff, "next") == 0 ) { + ret |= WINDOW_BUTTONTYPE_NEXT; + } + } + if( ret == 0 ) { + ret = atoi( data); + } + return ret; +} diff --git a/npc/npccreate.c b/npc/npccreate.c new file mode 100644 index 0000000..7a916f4 --- /dev/null +++ b/npc/npccreate.c @@ -0,0 +1,613 @@ +#include "version.h" +#define __NPCCREATE__ + +#include +#include + +#include "common.h" +#include "npccreate.h" +#include "npctemplate.h" +#include "util.h" +#include "buf.h" +#include "readmap.h" +#include "char_data.h" +#include "handletime.h" +#include "configfile.h" + +INLINE int NPC_CHECKCREATEINDEX(int index) +{ + if( NPC_createnum <= index || index < 0 )return FALSE; + return TRUE; +} + +INLINE int NPC_CHECKCREATEINTINDEX( int index) +{ + if( NPC_CREATEINTNUM <= index || index < 0 )return FALSE; + return TRUE; +} + +INLINE int NPC_setCreateInt( int index , NPC_CREATEINT element, int data ) +{ + int buf; + buf = NPC_create[index].intdata[element]; + NPC_create[index].intdata[element] = data; + return buf; +} + +INLINE int NPC_getCreateInt( int index , NPC_CREATEINT element ) +{ + return NPC_create[index].intdata[element]; +} + + +BOOL NPC_initCreateArray( int createnum ) +{ + NPC_createnum = createnum; + NPC_create = (NPC_Create*)allocateMemory( sizeof( NPC_Create ) * NPC_createnum ); + + print( "С:%d. :%d.\n", sizeof( NPC_Create ), createnum); + if( NPC_create == NULL ){ + return FALSE; + } + NPC_create_readindex = 0; + return TRUE; +} + +void NPC_setDefaultNPCCreate( NPC_Create* cr ) +{ + if( cr == NULL )return; + + cr->intdata[NPC_CREATEFLOORID]=0; + cr->intdata[NPC_CREATEBORNLEFTUPX]=0; + cr->intdata[NPC_CREATEBORNLEFTUPY]=0; + cr->intdata[NPC_CREATEBORNRIGHTDOWNX]=0; + cr->intdata[NPC_CREATEBORNRIGHTDOWNY]=0; + cr->intdata[NPC_CREATEMOVELEFTUPX]=0; + cr->intdata[NPC_CREATEMOVELEFTUPY]=0; + cr->intdata[NPC_CREATEMOVERIGHTDOWNX]=0; + cr->intdata[NPC_CREATEMOVERIGHTDOWNY]=0; + + cr->intdata[NPC_CREATEDIR]=0; + //jeffrey 1231 +#ifdef _ADD_ACTION + cr->intdata[NPC_CREATEACTION] = 0; +#endif + cr->intdata[NPC_CREATEBASEIMAGENUMBER]=-1; + cr->intdata[NPC_CREATETIME]=0; + cr->intdata[NPC_CREATEBORNNUM]=0; + cr->intdata[NPC_CREATEENEMYNUM]=0; + cr->intdata[NPC_CREATEBOUNDARY]=1; + cr->intdata[NPC_CREATEIGNOREINVINCIBLE]=0; + + cr->intdata[NPC_CREATEDATE]=0; + + cr->intdata[NPC_CREATEFAMILY]=0; + + cr->chardata[NPC_CREATENAME].string[0]= '\0'; + + cr->workdata[NPC_CREATEWORKENEMYNUM]=0; + cr->workdata[NPC_CREATEWORKMAKESTARTSEC]=0; + cr->workdata[NPC_CREATEWORKMAKESTARTUSEC]=0; + cr->workdata[NPC_CREATEWORKNEVERMAKE]=0; + + + { + int i; + for( i=0 ; itemplateindex) ; i++ ){ + cr->templateindex[i] = -1; + cr->arg[i].string[0] = '\0'; + } + } +} + +BOOL NPC_IsNPCCreateFile( char* filename ) +{ + FILE* f; + char line1[128]; + char* ret; + + /* ~ƥ°̻ﷴئƱ */ + if( filename == NULL + || strlen( filename ) < 1 + || filename[strlen(filename)-1] == '~' + || filename[0] == '#' + || strcmptail( filename, ".bak" ) == 0 )return FALSE; + + f= fopen( filename , "r" ); + if( f == NULL ) goto RETURNFALSE; + + ret = fgets( line1, sizeof( line1 ), f ); + if( ret == NULL )goto FCLOSERETURNFALSE; + + if( strcasecmp( NPC_CREATEFILEMAGIC, line1 ) == 0 ){ + fclose(f); + return TRUE; + } + +FCLOSERETURNFALSE: + fclose(f); +RETURNFALSE: + return FALSE; +} + +static int NPC_readCreateFile( char* filename ) +{ + FILE* f; + char line[512]; + int linenum=0; + int start=OFF; + NPC_Create cr; + int enemyreadindex=0; + + typedef struct tagPOINT + { + int x,y; + }POINT; + typedef struct tagREC + { + int w,h; + }REC; + POINT center[2]={{0,0},{0,0}}; /* born 0 ƥ move 1 */ + REC wh[2] ={{0,0},{0,0}}; /* born 0 ƥ move 1 */ + + POINT lu[2] ={{0,0},{0,0}}; /* born 0 ƥ move 1 */ + POINT rd[2] ={{0,0},{0,0}}; /* born 0 ƥ move 1 */ + + int defborn=FALSE; /* born ëɬ׾ */ + int defmove=FALSE; /* move ëɬ׾ */ + int deflurd[2]={FALSE,FALSE}; /* lu,rd ƥɬ׾ */ + char* ret; + + + if( NPC_create_readindex >= NPC_createnum ){ + print("û\n" ); + print("ûĿ %d\n",NPC_createnum); + print("ûļ %s\n",filename); + return FALSE; + } + + NPC_setDefaultNPCCreate( &cr ); + + f= fopen( filename ,"r"); + if( f == NULL )return FALSE; + + ret = fgets( line, sizeof( line ), f ); + if( ret == NULL )goto FCLOSERETURNFALSE; + if( strcmp( NPC_CREATEFILEMAGIC, line ) != 0 ){ + print( "ⲻһcreateļ.\n" ); + goto FCLOSERETURNFALSE; + } + linenum = 1; + + while( fgets( line , sizeof( line ) , f ) ){ + + linenum++; + + if( line[0] == '#' )continue; /* comment */ + if( line[0] == '\n' )continue; /* none */ + chomp( line ); + + switch( line[0] ){ + case '{': + if( start == ON ){ + fprint( "Find {. But already START state. %s:%d\n", + filename, linenum); + fprint( "˳\n" ); + goto FCLOSERETURNFALSE; + + }else{ + NPC_setDefaultNPCCreate( &cr ); + start = ON; + } + break; + case '}': + if( start == ON ){ + int err = FALSE; + if( enemyreadindex == 0 ){ + err = TRUE; + print( "ⲻ %s:%d\n", + filename,linenum); + }else if( MAP_IsThereSpecificFloorid( + cr.intdata[NPC_CREATEFLOORID]) == FALSE ){ + err = TRUE; + print( "ͼIDë %s:%d-floor:%d\n", + filename,linenum, cr.intdata[NPC_CREATEFLOORID]); + }else if( defborn == FALSE ){ + err = TRUE; + print( "Щ born װ %s:%d\n", + filename,linenum); + } + + if( err == FALSE ){ + cr.intdata[NPC_CREATEENEMYNUM] = enemyreadindex; + + if( deflurd[0] ){ + cr.intdata[NPC_CREATEBORNLEFTUPX] = + min(lu[0].x,rd[0].x); + cr.intdata[NPC_CREATEBORNRIGHTDOWNX] = + max(lu[0].x,rd[0].x); + cr.intdata[NPC_CREATEBORNLEFTUPY] = + min(lu[0].y,rd[0].y); + cr.intdata[NPC_CREATEBORNRIGHTDOWNY] = + max(lu[0].y,rd[0].y); + }else{ + cr.intdata[NPC_CREATEBORNLEFTUPX] = + center[0].x-wh[0].w/2; + cr.intdata[NPC_CREATEBORNRIGHTDOWNX] = + center[0].x+wh[0].w/2; + cr.intdata[NPC_CREATEBORNLEFTUPY] = + center[0].y-wh[0].h/2; + cr.intdata[NPC_CREATEBORNRIGHTDOWNY] = + center[0].y+wh[0].h/2; + } + if( defmove ){ + if( deflurd[0] ){ + cr.intdata[NPC_CREATEMOVELEFTUPX] = + min(lu[1].x,rd[1].x); + cr.intdata[NPC_CREATEMOVERIGHTDOWNX] = + max(lu[1].x,rd[1].x); + cr.intdata[NPC_CREATEMOVELEFTUPY] = + min(lu[1].y,rd[1].y); + cr.intdata[NPC_CREATEMOVERIGHTDOWNY] = + max(lu[1].y,rd[1].y); + }else{ + cr.intdata[NPC_CREATEMOVELEFTUPX] = + center[1].x-wh[1].w/2; + cr.intdata[NPC_CREATEMOVERIGHTDOWNX] = + center[1].x+wh[1].w/2; + cr.intdata[NPC_CREATEMOVELEFTUPY] = + center[1].y-wh[1].h/2; + cr.intdata[NPC_CREATEMOVERIGHTDOWNY] = + center[1].y+wh[1].h/2; + } + + }else{ + /* born ë */ + cr.intdata[NPC_CREATEMOVELEFTUPX] = + cr.intdata[NPC_CREATEBORNLEFTUPX]; + cr.intdata[NPC_CREATEMOVERIGHTDOWNX] = + cr.intdata[NPC_CREATEBORNRIGHTDOWNX]; + cr.intdata[NPC_CREATEMOVELEFTUPY] = + cr.intdata[NPC_CREATEBORNLEFTUPY]; + cr.intdata[NPC_CREATEMOVERIGHTDOWNY] = + cr.intdata[NPC_CREATEBORNRIGHTDOWNY]; + } + + memcpy( &NPC_create[NPC_create_readindex], &cr, + sizeof( NPC_Create ) ); + + + NPC_create_readindex++; + + if( NPC_create_readindex >= NPC_createnum ){ + print("û\n" ); + print("ôļĿ %d\n", + NPC_createnum); + print("ûļ:%s\n",filename); + goto FCLOSERETURNFALSE; + } + + } + NPC_setDefaultNPCCreate( &cr ); + enemyreadindex=0; + defborn=FALSE; + defmove=FALSE; + deflurd[0]=FALSE; + deflurd[1]=FALSE; + + start = OFF; + }else{ + fprint( "δ '}' at %s:%d\n",filename,linenum); + goto FCLOSERETURNFALSE; + } + break; + default: + { + + char firstToken[256]; + char secondToken[256]; + int ret; + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, + sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + break; + } + ret = getStringFromIndexWithDelim( line, "=", 2, secondToken, + sizeof( secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + break; + } + + if( strcasecmp("floorid",firstToken) == 0 ){ + cr.intdata[NPC_CREATEFLOORID] = atoi(secondToken); + + }else if( strcasecmp("borncenter", firstToken) == 0 ){ + getFourIntsFromString(secondToken,¢er[0].x, + ¢er[0].y,&wh[0].w,&wh[0].h ); + defborn = TRUE; + }else if( strcasecmp("borncorner", firstToken) == 0 ){ + getFourIntsFromString(secondToken,&lu[0].x,&lu[0].y, + &rd[0].x,&rd[0].y ); + defborn = TRUE; + deflurd[0]=TRUE; + + }else if( strcasecmp("movecenter", firstToken) == 0 ){ + getFourIntsFromString(secondToken,¢er[1].x, + ¢er[1].y,&wh[1].w,&wh[1].h ); + defmove = TRUE; + }else if( strcasecmp("movecorner", firstToken) == 0 ){ + getFourIntsFromString(secondToken,&lu[1].x,&lu[1].y, + &rd[1].x,&rd[1].y ); + defmove = TRUE; + deflurd[1]=TRUE; + + }else if( strcasecmp("dir",firstToken) == 0 ){ + cr.intdata[NPC_CREATEDIR] = atoi( secondToken ); + + }else if( strcasecmp("graphicname",firstToken) == 0 ){ + cr.intdata[NPC_CREATEBASEIMAGENUMBER] + = CHAR_seekGraphicNumberFromString(secondToken); + + }else if( strcasecmp("name",firstToken) == 0 ){ + strcpysafe( cr.chardata[NPC_CREATENAME].string, + sizeof(cr.chardata[NPC_CREATENAME].string), + secondToken ); + + }else if( strcasecmp("time",firstToken) == 0 ){ + cr.intdata[NPC_CREATETIME] = atoi( secondToken ); + + }else if( strcasecmp("date",firstToken) == 0 ){ + cr.intdata[NPC_CREATEDATE] = atoi( secondToken ); + + }else if( strcasecmp("createnum",firstToken) == 0 ){ + cr.intdata[NPC_CREATEBORNNUM] = atoi( secondToken ); + + }else if( strcasecmp( "boundary", firstToken) == 0 ){ + cr.intdata[NPC_CREATEBOUNDARY] = atoi( secondToken ); + + }else if( strcasecmp( "ignoreinvincible", firstToken) == 0 ){ + cr.intdata[NPC_CREATEIGNOREINVINCIBLE] = atoi( secondToken ); + + //jeffrey 1231 +#ifdef _ADD_ACTION + }else if( strcasecmp( "action", firstToken) == 0 ){ + cr.intdata[NPC_CREATEACTION] = atoi( secondToken ); +#endif + // Robin 0731 + }else if( strcasecmp( "family", firstToken) == 0 ){ + cr.intdata[NPC_CREATEFAMILY] = atoi( secondToken ); + + }else if( strcasecmp("enemy", firstToken) == 0 ){ + int templateindex; + char enemyname[64]; + + /* ˲ */ + if( enemyreadindex <= arraysizeof(cr.templateindex) ) + /* OK */ + ; + else + break; + + getStringFromIndexWithDelim(secondToken,"|",1,enemyname, + sizeof(enemyname) ); + templateindex= NPC_templateGetTemplateIndex(enemyname); + if( templateindex != -1 ){ + cr.templateindex[enemyreadindex] = templateindex; + { + char tmp[2]; + int ret; + ret = getStringFromIndexWithDelim( secondToken, + "|",2,tmp, + sizeof(tmp) ); + if( ret == FALSE ) + cr.arg[enemyreadindex].string[0] = '\0'; + else + strcpysafe( cr.arg[enemyreadindex].string, + sizeof( cr.arg[enemyreadindex]. + string ), + secondToken+strlen(enemyname)+1 ); + } + enemyreadindex++; + }else + fprint( "ûģ:\n[%s(%d)%s] enemy:%s\n", + filename ,linenum,secondToken, enemyname); + }else{ + fprint( "ûֵ½ %s %s:%d\n",firstToken,filename, + linenum ); + } + } + } + } + + fclose(f); + return TRUE; + +FCLOSERETURNFALSE: + fclose(f); + return FALSE; +} + +BOOL NPC_readNPCCreateFiles( char* topdirectory ,int createsize) +{ + STRING64 *filenames; + int filenum; + int i; + filenames = (STRING64 *)allocateMemory( sizeof( STRING64 ) * + (int)getFilesearchnum( ) ); + if( filenames == NULL ){ + print( "ȡNPCļ... ڴ\n" ); + return FALSE; + } + filenum = rgetFileName( topdirectory ,filenames ,getFilesearchnum( ) ); + if( filenum == -1 ){ + freeMemory( filenames ); + return FALSE; + } + if( filenum >= getFilesearchnum( ) ){ + print( "ļĿʧ %d\n", getFilesearchnum( ) ); + while( 1 ); + } + if( !NPC_initCreateArray( createsize ) ){ + fprint( "\n" ); + freeMemory( filenames ); + return FALSE; + } + print( "ȡNPCļ..." ); + for( i = 0 ; i < filenum ; i ++ ) + if( NPC_IsNPCCreateFile( filenames[i].string )) + if( NPC_readCreateFile( filenames[i].string ) == -1 ) + break; + print( "ȷNPC %d ..." , NPC_create_readindex ); + NPC_createnum=NPC_create_readindex; +#ifdef DEBUG + /* 99/4/8 By Kawata csvֿƻ֧ */ + print( "Npc_Create's\n"); + for( i = 0 ; i < NPC_createnum ; i ++ ){ + int j; + /*print( "NPC_create[%d]:\n", i);*/ + print( "%d,", i); + for( j = 0 ; j < NPC_CREATECHARNUM ; j ++ ) + print("%s," , NPC_create[i].chardata[j].string ); + /*print( "\tIntdata\t" );*/ + for( j = 0 ; j < NPC_CREATEINTNUM ; j ++ ) + print("%d," , NPC_create[i].intdata[j] ); + /***print("\n" ); + print( "\tChardata\t" );***/ + for( j = 0 ; j < NPC_create[i].intdata[NPC_CREATEENEMYNUM]; j ++ ) + print("%d" , NPC_create[i].templateindex[j] ); + /*print("\n" );*/ + print("\n" ); + } +#endif /*DEBUG*/ + + freeMemory( filenames ); + return TRUE; +} + + + +/*------------------------------------------------------------ + * createindex boundary ɬýľ¾ëέ + * ¦ + * createindex int create̼͵ + * ߯Ի + * ɬýľ TRUE(1) + * ɬýľئ FALSE(0) + ------------------------------------------------------------*/ +BOOL NPC_isBoundarySet( int createindex ) +{ + if( NPC_CHECKCREATEINDEX(createindex) == FALSE )return FALSE; + return NPC_create[createindex].intdata[NPC_CREATEBOUNDARY]; +} +/*------------------------------------------------------------ + * ¦ + * r RECT* ëRECT ̼ + * ߯Ի + ------------------------------------------------------------*/ +BOOL NPC_createGetRECT( int createindex,RECT* r ) +{ + if( NPC_CHECKCREATEINDEX(createindex) == FALSE )return FALSE; + + r->x = NPC_create[createindex].intdata[NPC_CREATEMOVELEFTUPX]; + r->y = NPC_create[createindex].intdata[NPC_CREATEMOVELEFTUPY]; + r->width + = NPC_create[createindex].intdata[NPC_CREATEMOVERIGHTDOWNX] + - NPC_create[createindex].intdata[NPC_CREATEMOVELEFTUPX]; + r->height + = NPC_create[createindex].intdata[NPC_CREATEMOVERIGHTDOWNY] + - NPC_create[createindex].intdata[NPC_CREATEMOVELEFTUPY]; + return TRUE; +} + + + +/*------------------------------------------------------------ + * ¦ + * cindex int ̼͵ + * ߯Ի + * BOOL Ȼ TRUE(1) + * BOOL Ȼئ FALSE(0) + ------------------------------------------------------------*/ +BOOL NPC_createCheckGenerateFromTime( int cindex ) +{ + struct timeval old; + if( !NPC_CHECKCREATEINDEX(cindex) ) + return FALSE; + + if( NPC_create[cindex].workdata[NPC_CREATEWORKNEVERMAKE] ) + return FALSE; + + if( NPC_create[cindex].intdata[NPC_CREATEBORNNUM] + <= NPC_create[cindex].workdata[NPC_CREATEWORKENEMYNUM] ) + return FALSE; + + if( NPC_create[cindex].intdata[NPC_CREATETIME] < 0 )return FALSE; + old.tv_sec = NPC_create[cindex].workdata[NPC_CREATEWORKMAKESTARTSEC]; + old.tv_usec= NPC_create[cindex].workdata[NPC_CREATEWORKMAKESTARTUSEC]; + + if( time_diff_us( NowTime , old ) <= + NPC_create[cindex].intdata[NPC_CREATETIME]*1000 ) + return FALSE; + + return TRUE; +} + + + + +/*------------------------------------------------------------ + * ¦ + * tindex int ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void NPC_createInitTime( int index ) +{ + /* DZئ׾հëɬ */ + NPC_create[index].workdata[NPC_CREATEWORKMAKESTARTSEC] = + NowTime.tv_sec; + NPC_create[index].workdata[NPC_CREATEWORKMAKESTARTUSEC] = + NowTime.tv_usec; +} +/*------------------------------------------------------------ + * ¦ + * index int ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void NPC_createIncreaseEnemynum( int index ) +{ + if( !NPC_CHECKCREATEINDEX(index) )return; + NPC_create[index].workdata[NPC_CREATEWORKENEMYNUM] ++; +} +/*------------------------------------------------------------ + * ĻƥëӼ + * ¦ + * index int ̼͵ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void NPC_createDecreaseEnemynum( int index ) +{ + if( !NPC_CHECKCREATEINDEX(index) )return; + NPC_create[index].workdata[NPC_CREATEWORKENEMYNUM] --; +} +/*------------------------------------------------------------ + * ¦ + * index int ̼͵ + * ߯Ի + * TRUE:MAX FALSE:ਵ + ------------------------------------------------------------*/ +BOOL NPC_createCheckMaxEnemynum( int index ) +{ + + if( NPC_create[index].intdata[NPC_CREATEBORNNUM] + <= NPC_create[index].workdata[NPC_CREATEWORKENEMYNUM] ) + return TRUE; + else + return FALSE; +} diff --git a/npc/npcgen.c b/npc/npcgen.c new file mode 100644 index 0000000..a8619d1 --- /dev/null +++ b/npc/npcgen.c @@ -0,0 +1,379 @@ +#include "version.h" +#include + +#include "common.h" +#include "npccreate.h" +#include "npctemplate.h" +#include "char.h" +#include "char_data.h" +#include "buf.h" +#include "object.h" +#include "readmap.h" +#include "item.h" +#include "handletime.h" +#include "map_deal.h" + +typedef struct tagNPC_searchPoint +{ + int floor; + int x; + int y; +}NPC_searchPoint; + + +/* ϼNPCë¾ */ +#define NPC_CREATECHALLENGETIME 1 +int all_nosee = 0; /* ༰ݣ廯ë no_see */ +int all_nobody = 0; /* ༰ݣ廯ë no_body */ +int one_loop_born = 1; /* ƥ Ϸ oneloop_born */ + +/*------------------------------------------------------------ + * ëķë + * ¦ + * nobody int 1 ݷئݱ年 + * (л) + * (ݼ) + * ëئئ + * ߯Ի + * ľݷ TRUE + * ľئݷ FALSE + ------------------------------------------------------------*/ +static BOOL NPC_searchCreatePoint( NPC_Create* cr,int nobody,int nosee, + NPC_searchPoint* point, BOOL isflying ) +{ + int floor=cr->intdata[NPC_CREATEFLOORID]; + int x = cr->intdata[NPC_CREATEBORNLEFTUPX]; + int y = cr->intdata[NPC_CREATEBORNLEFTUPY]; + int width; + int height; + int area; + int loop; + BOOL ret = FALSE; + int i, j; + + width = cr->intdata[NPC_CREATEBORNRIGHTDOWNX] + - cr->intdata[NPC_CREATEBORNLEFTUPX] + 1; + height = cr->intdata[NPC_CREATEBORNRIGHTDOWNY] + - cr->intdata[NPC_CREATEBORNLEFTUPY] + 1; + area = width * height; + if( nobody == 0 && all_nobody == 0 ) { + BOOL found = FALSE; + for( i = x ; i <= x +width && found == FALSE; i ++ ) { + for( j = y; j <= y + height && found == FALSE; j ++ ) { + OBJECT object; + for( object = MAP_getTopObj( floor, i,j); + object; + object = NEXT_OBJECT(object) ) + { + int objindex = GET_OBJINDEX( object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + if( CHAR_getInt( OBJECT_getIndex(objindex), + CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) + { + found = TRUE; + break; + } + } + } + } + } + if( found == FALSE ) { + return( FALSE); + } + } + for( loop=0 ; loopintdata[NPC_CREATEIGNOREINVINCIBLE] == 0 + && CHAR_isInvincibleArea( floor,crx,cry ) ){ + continue; + } + if( nosee == 0 && all_nosee == 0 ) { + BOOL found = FALSE; + for( i = crx - CHAR_DEFAULTSEESIZ/2 ; + i <= crx +CHAR_DEFAULTSEESIZ/2 && found == FALSE ; i ++ ) + { + for( j = cry - CHAR_DEFAULTSEESIZ/2; + j <= cry + CHAR_DEFAULTSEESIZ/2 && found == FALSE; + j ++ ) + { + OBJECT object; + for( object = MAP_getTopObj( floor, i,j); + object; + object = NEXT_OBJECT(object) ) + { + int objindex = GET_OBJINDEX( object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + if( CHAR_getInt( OBJECT_getIndex(objindex), + CHAR_WHICHTYPE ) + == CHAR_TYPEPLAYER ) + { + found = TRUE; + break; + } + } + } + } + } + if( found == TRUE ){ + return FALSE; + } + } + if( MAP_walkAbleFromPoint( floor,crx,cry,isflying ) == TRUE ){ + point->floor = cr->intdata[NPC_CREATEFLOORID]; + point->x = crx; + point->y = cry; + ret = TRUE; + break; + }else{ + } + } + + return( ret ); +} + + +typedef struct tagNPC_Correspondfunction +{ + int template; + int ch; +}NPC_Correspondfunction; + +static NPC_Correspondfunction correspondfunction[]={ + { NPC_TEMPLATEINITFUNC, CHAR_INITFUNC }, + { NPC_TEMPLATEWALKPREFUNC, CHAR_WALKPREFUNC }, + { NPC_TEMPLATEWALKPOSTFUNC, CHAR_WALKPOSTFUNC }, + { NPC_TEMPLATEPREOVERFUNC, CHAR_PREOVERFUNC }, + { NPC_TEMPLATEPOSTOVERFUNC, CHAR_POSTOVERFUNC }, + { NPC_TEMPLATEWATCHFUNC, CHAR_WATCHFUNC }, + { NPC_TEMPLATELOOPFUNC, CHAR_LOOPFUNC }, + { NPC_TEMPLATETALKEDFUNC, CHAR_TALKEDFUNC }, + { NPC_TEMPLATEDYINGFUNC, CHAR_DYINGFUNC }, + { NPC_TEMPLATEPREATTACKEDFUNC,CHAR_PREATTACKEDFUNC }, + { NPC_TEMPLATEPOSTATTACKEDFUNC, CHAR_POSTATTACKEDFUNC }, + { NPC_TEMPLATEOFFFUNC, CHAR_OFFFUNC }, + { NPC_TEMPLATELOOKEDFUNC, CHAR_LOOKEDFUNC }, + { NPC_TEMPLATEITEMPUTFUNC, CHAR_ITEMPUTFUNC }, + { NPC_TEMPLATESPECIALTALKEDFUNC, CHAR_SPECIALTALKEDFUNC}, + { NPC_TEMPLATEWINDOWTALKEDFUNC, CHAR_WINDOWTALKEDFUNC}, +#ifdef _USER_CHARLOOPS + { NPC_TEMPLATELOOPFUNCTEMP1, CHAR_LOOPFUNCTEMP1}, + { NPC_TEMPLATELOOPFUNCTEMP2, CHAR_LOOPFUNCTEMP2}, + { NPC_TEMPLATEBATTLEPROPERTY, CHAR_BATTLEPROPERTY}, +#endif +}; +/*------------------------------------------------------------ + * + * ¦ + * ch Char* ƽҷ· + * ߯Ի + * ئ + ------------------------------------------------------------*/ +static void NPC_copyFunction( Char* ch, NPC_Template* temp ) +{ + int i; + for( i=0 ; ichardata[correspondfunction[i].template].string[0] != '\0' ) + strcpysafe( ch->charfunctable[correspondfunction[i].ch].string, + sizeof(ch->charfunctable[correspondfunction[i].ch].string), + temp->chardata[correspondfunction[i].template].string); +} + +static BOOL NPC_generateNPC( int createindex, int createtemplateindex ) +{ + Char one; + NPC_searchPoint sp; + int i; + NPC_Template* template; + NPC_Create* cr; + + if( NPC_CHECKCREATEINDEX(createindex) + && 0 <= createtemplateindex + && createtemplateindex < arraysizeof(NPC_create[createindex].templateindex ) + && NPC_CHECKTEMPLATEINDEX( NPC_create[createindex].templateindex[createtemplateindex])){ + cr = &NPC_create[createindex]; + template = &NPC_template[NPC_create[createindex]. + templateindex[createtemplateindex]]; + }else{ + return FALSE; + } + if( NPC_searchCreatePoint( cr, + template->intdata[NPC_TEMPLATEMAKEATNOBODY], + template->intdata[NPC_TEMPLATEMAKEATNOSEE], &sp, + template->intdata[NPC_TEMPLATEISFLYING]) == FALSE ){ + return FALSE; + } + if( CHAR_getDefaultChar( &one, template->intdata[NPC_TEMPLATETYPE] ) == FALSE ){ + return FALSE; + } + one.data[CHAR_FLOOR] = sp.floor; + one.data[CHAR_X] = sp.x; + one.data[CHAR_Y] = sp.y; + one.data[CHAR_DIR] = cr->intdata[NPC_CREATEDIR]; +#ifdef _ADD_ACTION + one.data[CHAR_ACTIONSTYLE] = cr->intdata[NPC_CREATEACTION]; +#endif + + one.data[CHAR_BASEBASEIMAGENUMBER] = one.data[CHAR_BASEIMAGENUMBER] + = template->intdata[NPC_TEMPLATEIMAGENUMBER]; + if( cr->intdata[NPC_CREATEBASEIMAGENUMBER] != -1 ) + one.data[CHAR_BASEBASEIMAGENUMBER] + = one.data[CHAR_BASEIMAGENUMBER] + = cr->intdata[NPC_CREATEBASEIMAGENUMBER]; + + strcpysafe(one.string[CHAR_NAME].string, + sizeof(one.string[CHAR_NAME].string), + template->chardata[NPC_TEMPLATECHARNAME].string); + + + if( cr->chardata[NPC_CREATENAME].string[0] != '\0' ){ + strcpysafe(one.string[CHAR_NAME].string, + sizeof(one.string[CHAR_NAME].string), + cr->chardata[NPC_CREATENAME].string); + } + + // Robin 0731 + one.data[CHAR_FMINDEX] = cr->intdata[NPC_CREATEFAMILY]; + NPC_copyFunctionSetToChar( template-> + intdata[NPC_TEMPLATEFUNCTIONINDEX], + &one ); + NPC_copyFunction( &one, template ); + one.data[CHAR_LOOPINTERVAL] = template-> + intdata[NPC_TEMPLATELOOPFUNCTIME]; + if( cr->arg[createtemplateindex].string[0] != '\0' ){ + strcpysafe( one.string[CHAR_NPCARGUMENT].string, + sizeof(one.string[CHAR_NPCARGUMENT].string), + cr->arg[createtemplateindex].string ); + }else{ + one.string[CHAR_NPCARGUMENT].string[0] = '\0'; + } + one.data[CHAR_WHICHTYPE] = CHAR_TYPEENEMY; + one.data[CHAR_NPCCREATEINDEX] = createindex; + { + static struct NPC_Paramtable + { + int templateindex; + int charadataindex; + }paramtbl[]={ + { NPC_TEMPLATEMINMP, CHAR_MAXMP }, + { NPC_TEMPLATEMINSTR, CHAR_STR }, + { NPC_TEMPLATEMINTOUGH, CHAR_TOUGH }, + + + }; + for( i=0 ; irandomdata[ + paramtbl[i].templateindex] ); + one.data[paramtbl[i].charadataindex] + = one.data[paramtbl[i].charadataindex] + + template->intdata[paramtbl[i].templateindex] + + randomvalue; + } + one.data[CHAR_MP] = one.data[CHAR_MAXMP]; + } + { + int itemindex=CHAR_STARTITEMARRAY; + for( i = 0 ; i < template->intdata[NPC_TEMPLATEITEMNUM] ; i ++ ){ + if( RAND(0,32767) <= template->haveitem[i].haverate ){ + if( template->haveitem[i].itemnumber == -1 + && template->haveitem[i].havenum > 0 ){ + int randomvalue = template->haveitem[i].havenum; + randomvalue *= (RAND(90,110))/100.0; + one.data[CHAR_GOLD] = min( CHAR_MAXGOLDHAVE, randomvalue ); + }else if( itemindex+i < CHAR_MAXITEMHAVE ){ + one.indexOfExistItems[itemindex+i] = + ITEM_makeItemAndRegist(template->haveitem[i] + .itemnumber); + } + } + } + } + + { + int charaindex; + int objindex; + Object obj; + charaindex = CHAR_initCharOneArray( &one ); + if( charaindex == -1 ){ + CHAR_endCharData( &one ); + return FALSE; + } + if( template->intdata[NPC_TEMPLATEISFLYING] ) + CHAR_setFlg(charaindex, CHAR_ISFLYING, 1 ); + + obj.type = OBJTYPE_CHARA; + obj.index= charaindex; + obj.x = CHAR_getInt(charaindex,CHAR_X); + obj.y = CHAR_getInt(charaindex,CHAR_Y); + obj.floor = CHAR_getInt(charaindex,CHAR_FLOOR); + objindex = initObjectOne( &obj ); + if( objindex == -1 ){ + CHAR_endCharOneArray( charaindex ); + return FALSE; + }else{ + } + CHAR_setWorkInt( charaindex,CHAR_WORKOBJINDEX,objindex ); + CHAR_setWorkInt( charaindex,CHAR_WORKNPCTYPE,1); +#ifdef _ADD_ACTION +//CHAR_WORKACTION + CHAR_setWorkInt( charaindex, CHAR_WORKACTION, + CHAR_getInt( charaindex, CHAR_ACTIONSTYLE ) ); + + CHAR_sendWatchEvent( objindex, CHAR_getWorkInt( charaindex, CHAR_WORKACTION) + ,NULL,0,TRUE); +#else + CHAR_sendWatchEvent(objindex,CHAR_ACTSTAND,NULL,0,TRUE); +#endif + CHAR_complianceParameter( charaindex ); + } + + return TRUE; +} + +void NPC_generateLoop( BOOL checkall ) +{ + int i,j; + int CreateOk=0; + int enemynum ; + static int createcount = 0; /* create ¾ */ + static struct timeval _store_npc_generateloop_time; + if( checkall == FALSE) { + if( time_diff_us( NowTime, _store_npc_generateloop_time ) < (1000*1000)){ + return; + } else { + _store_npc_generateloop_time = NowTime; + } + } + + for( i=0 ; i < NPC_createnum ; i++ ){ + if( createcount >= NPC_createnum ) createcount = 0; + enemynum = NPC_getCreateInt( createcount, NPC_CREATEENEMYNUM ); + for( j = 0 ; j < enemynum ; j ++ ){ + if( NPC_createCheckGenerateFromTime(createcount) == TRUE ){ + CreateOk ++; + NPC_createInitTime(createcount); + if( NPC_generateNPC(createcount,j) == TRUE ){ + NPC_createIncreaseEnemynum(createcount); + }else{ + } + } + } + createcount ++; + if( checkall == FALSE && CreateOk >= one_loop_born ){ + break; + } + } +} + diff --git a/npc/npctemplate.c b/npc/npctemplate.c new file mode 100644 index 0000000..8330135 --- /dev/null +++ b/npc/npctemplate.c @@ -0,0 +1,1117 @@ +#include "version.h" +#define __NPCTEMPLATE__ + +#include +#include + +#include "common.h" +#include "npctemplate.h" +#include "buf.h" +#include "char_data.h" +#include "util.h" +#include "handletime.h" +#include "item.h" +#include "anim_tbl.h" +#include "configfile.h" + +/*ɬëǩ׻ë */ +typedef struct tagFunctionNameSet +{ + char* id; + char* initfunc; + char* walkprefunc; + char* walkpostfunc; + char* preoverfunc; + char* postoverfunc; + char* watchfunc; + char* loopfunc; + char* dyingfunc; + char* talkedfunc; + char* preattackedfunc; + char* postattackedfunc; + char* offfunc; + char* lookedfunc; + char* itemputfunc; + char* specialtalkedfunc; + char* windowtalkedfunc; +}FunctionNameSet; + + +static FunctionNameSet functionSet[]={ + + { "Sample" , "", "", "", "", "", "", "SampleLoop", + "SampleDying" ,"","", "","","","","",""}, + + /* ʧ */ + { "Door" , "DoorInit" , "","", + "","DoorPostOver","DoorWatch","", + "","DoorTalked","", "", + "DoorOff","DoorLooked","","",""}, + + /* */ + { "SimpleShop" ,"SimpleShopInit","","", + "","","","","", + "SimpleShopTalked" , "","", + "","","" ,"SimpleShopSpecialTalked" ,""}, + + /* */ + { "Msg" , "MsgInit" , "","", + "","","","", + "","","", "", + "","MsgLooked","","",""}, + + /* */ + { "Warp","WarpInit","","", + "","","","", + "","","","", + "","", "","",""}, + + { "TownPeople" ,"TownPeopleInit","","", + "","","","", + "", "TownPeopleTalked" ,"","", + "","","","",""}, + + { "Oldman","OldmanInit","","", + "","","","", + "","OldmanTalked","","", + "","", "","",""}, + + + /* Ƥ̼ */ + { "SavePoint","SavePointInit","","", + "","","","", + "","SavePointTalked","","", + "","", "","","SavePointWindowTalked"}, + + /* ס¡ */ + { "Healer","HealerInit","","", + "","","","", + "","HealerTalked","","", + "","", "","",""}, + + /* Healer add code by shan */ + { "FmHealer","FmHealerInit","","", + "","","","", + "","FmHealerTalked","","", + "","", "","",""}, + + /* ׻ add code by shan */ + { "PetMaker","PetMakerInit","","", + "","","","", + "","PetMakerTalked","","", + "","", "","",""}, + + { "StoryTeller","StoryTellerInit","","", + "","","","", + "","StoryTellerTalked","","", + "","", "","",""}, + + { "RoomAdminNew","RoomAdminNewInit","","", + "","","","RoomAdminNewLoop", + "","RoomAdminNewTalked","","", + "","", "","",""}, + + {"Dengon", + "DengonInit", "", "", "", "", "", "", "", "", + "", "", "", "DengonLooked", "", "","DengonWindowTalked"}, + + /* ԰ add code by shan */ + {"FmDengon", + "FmDengonInit", "", "", "", "", "", "", "", "", + "", "", "", "FmDengonLooked", "", "","FmDengonWindowTalked"}, + + { "ItemCompo" , "ItemCompoInit", "", "", + "", "", "", "", + "" ,"ItemCompoTalked","","" + ,"","","" , "",""}, + + /* ó */ + { "NPCEnemy","NPCEnemyInit","","", + "","","NPCEnemyWatch","", + "","NPCEnemyTalked","","", + "","", "","","NPCEnemyWindowTalked"}, + + /* ʧ */ + { "Action","ActionInit","","", + "","","ActionWatch","", + "","ActionTalked","","", + "","", "","",""}, + + { "Windowman","WindowmanInit","","", + "","","","", + "","WindowmanTalked","","", + "","WindowmanLooked", "","","WindowmanWindowTalked"}, + + /*windowhealer */ + { "WindowHealer","WindowHealerInit","","", + "","","","", + "","WindowHealerTalked","","", + "","WindowHealerLooked", "","","WindowHealerWindowTalked"}, + + + /* ItemShop */ + { "ItemShop","ItemShopInit","","", + "","","","", + "","ItemShopTalked","","", + "","", "","","ItemShopWindowTalked"}, + { "ItemVippointShop","ItemVippointShopInit","","", + "","","","", + "","ItemVippointShopTalked","","", + "","", "","","ItemVippointShopWindowTalked"}, + {"Sysinfo", + "SysinfoInit", "", "", + "", "", "", "SysinfoLoop", + "", "SysinfoTalked","", "", + "", "", "", "",""}, + + { "Duelranking","DuelrankingInit","","", + "","","", + "", + "","","","", + "","DuelrankingLooked", "","","DuelrankingWindowTalked"}, + + + /* PetSkillShop */ + { "PetSkillShop","PetSkillShopInit","","", + "","","","", + "","PetSkillShopTalked","","", + "","", "","","PetSkillShopWindowTalked"}, +#ifdef _PETSKILL_DEL_SHOP + { "PetSkillDelShop","PetSkillDelShopInit","","", + "","","","", + "","PetSkillDelShopTalked","","", + "","", "","","PetSkillDelShopWindowTalked"}, +#endif + /* PetShop */ + { "PetShop","PetShopInit","","", + "","","","", + "","PetShopTalked","","", + "","", "","","PetShopWindowTalked"}, + + + /* SignBoard */ + { "SignBoard","SignBoardInit","","", + "","","","", + "","","","", + "","SignBoardLooked", "","","SignBoardWindowTalked"}, + + + /* WarpMan */ + { "WarpMan","WarpManInit","","", + "","","WarpManWatch","WarpManLoop", + "","WarpManTalked","","", + "","", "","","WarpManWindowTalked"}, + + + /* ExChangeman */ + { "ExChangeMan","ExChangeManInit","","", + "","","","", + "","ExChangeManTalked","","", + "","", "","","ExChangeManWindowTalked"}, + + /* timeman */ + { "TimeMan","TimeManInit","","", + "","","TimeManWatch","", + "","TimeManTalked","","", + "","", "","",""}, + + /* ʾū¼ء */ + { "BodyLan","BodyLanInit","","", + "","","BodyLanWatch","", + "","BodyLanTalked","","", + "","", "","","BodyLanWindowTalked"}, + + /* ʾū¼ء */ + { "Mic","MicInit","","", + "","","","", + "","MicTalked","","", + "","", "","",""}, + + /* ƽѨ */ + { "LuckyMan","LuckyManInit","","", + "","","","", + "","LuckyManTalked","","", + "","", "","","LuckyManWindowTalked"}, + + /* Ѩƹﵩ */ + { "Bus","BusInit","","", + "","","","BusLoop", + "","BusTalked","","", + "","", "","",""}, + + /* */ // Arminius 7.7 Ariplane + { "Airplane","AirInit","","", + "","","","AirLoop", + "","AirTalked","","", + "","", "","",""}, + + { "Charm","CharmInit","","", + "","","","", + "","CharmTalked","","", + "","", "","","CharmWindowTalked"}, + + /* */ + { "Quiz","QuizInit","","", + "","","","", + "","QuizTalked","","", + "","", "","","QuizWindowTalked"}, + + { "PoolItemShop","PoolItemShopInit","","", + "","","","PoolItemShopLoop", + "","PoolItemShopTalked","","", + "","", "","","PoolItemShopWindowTalked"}, + + /* ìѨ */ + { "CheckMan","CheckManInit","","", + "","","","", + "","CheckManTalked","","", + "","", "","","CheckManWindowTalked"}, + + /* Ԫ */ + { "Janken","JankenInit","","", + "","","","", + "","JankenTalked","","", + "","", "","","JankenWindowTalked"}, + + /* Ϸ */ + { "Transmigration","TransmigrationInit","","", + "","","","", + "","TransmigrationTalked","","", + "","", "","","TransmigrationWindowTalked"}, + + /* Family Man */ + { "Familyman","FamilymanInit","","", + "","","","", + "","FamilymanTalked","","", + "","FamilymanLooked", "","","FamilymanWindowTalked"}, + + /* CoolFish: Family Warp Man 2001/6/6 */ + { "FMWarpMan","FMWarpManInit","","", + "","","","FMWarpManLoop", + "","FMWarpManTalked","","", + "","", "","","FMWarpManWindowTalked"}, + + /* CoolFish: Family PK Man 2001/7/4 */ + { "FMPKMan","FMPKManInit","","", + "","","","", + "","FMPKManTalked","","", + "","", "","","FMPKManWindowTalked"}, + + /* CoolFish: Family PK CallMan 2001/7/13 */ + { "FMPKCallMan","FMPKCallManInit","","", + "","","","", + "","FMPKCallManTalked","","", + "","", "","","FMPKCallManWindowTalked"}, + + /* Bank Man */ + { "Bankman","BankmanInit","","", + "","","","", + "","BankmanTalked","","", + "","BankmanLooked", "","","BankmanWindowTalked"}, + + /* Arminius 7.13 scheduleman */ + { "Scheduleman","SchedulemanInit","","", + "","","","SchedulemanLoop", + "","SchedulemanTalked","","", + "","", "","","SchedulemanWindowTalked"}, + + /* Arminius 7.24 manor scheduleman */ + { "ManorSman","ManorSmanInit","","", + "","","","ManorSmanLoop", + "","ManorSmanTalked","","", + "","", "","","ManorSmanWindowTalked"}, + + // Robin + { "Riderman","RidermanInit","","", + "","","","", + "","RidermanTalked","","", + "","RidermanLooked", "","","RidermanWindowTalked"}, + + { "FmLetter","FmLetterInit","","", + "","","","", + "","FmLetterTalked","","", + "","FmLetterLooked", "","","FmLetterWindowTalked"} +#ifdef _GAMBLE_BANK + ,{ + "NPC_GambleBank","GambleBankInit","","","","","", + "GambleBankLoop","", + "GambleBankTalked","","","","","","", + "GambleBankWindowTalked" + } +#endif + +#ifdef _GAMBLE_ROULETTE //Gamble_Roulette + ,{ + "NPC_GambleRoulette","GambleRouletteInit","","","","","", + "GambleRouletteLoop","", + "GambleRouletteTalked","","","","","","", + "GambleRouletteWindowTalked" + } + // + ,{ + "NPC_GambleMaster","GambleMasterInit","","","","","", + "GambleMasterLoop","", + "GambleMasterTalked","","","","","","", + "GambleMasterWindowTalked" + } + +#endif + +#ifdef _TRANSER_MAN + /* TranserMan */ + ,{ "TranserMan","TranserManInit","","", + "","","","TranserManLoop", + "","TranserManTalked","","", + "","", "","","TranserManWindowTalked" + } +#endif +#ifdef _FM_NPC_LOOK_WAR + ,{ "FmLookWarMan","FmLookWarManInit","","", + "","","","FmLookWarManLoop", + "","FmLookWarManTalked","","", + "","", "","","FmLookWarManWindowTalked" + } +#endif +#ifdef _FM_NPC_LOOK_WAR1 + ,{ "FmLookWarMan1","FmLookWarMan1Init","","", + "","","","FmLookWarMan1Loop", + "","FmLookWarMan1Talked","","", + "","", "","","FmLookWarMan1WindowTalked" + } +#endif +#ifdef _VIP_SHOP + /* VipShop */ + ,{ "VipShop","VipShopInit","","", + "","","","VipShopLoop", + "","VipShopTalked","","", + "","", "","","VipShopWindowTalked" + } + + ,{ "VipPoint","VipPointInit","","", + "","","","VipPointLoop", + "","VipPointTalked","","", + "","", "","","VipPointWindowTalked" + } +#endif + +#ifdef _VIP_SHOP + /* _VIP_SHOP */ + ,{ "NewVipShop","NewVipShopInit","","", + "","","","NewVipShopLoop", + "","NewVipShopTalked","","", + "","", "","","NewVipShopWindowTalked" + } +#endif +#ifdef _RMB_SYSTEM + ,{ "RmbShop","RmbShopInit","","", + "","","","RmbShopLoop", + "","RmbShopTalked","","", + "","", "","","RmbShopWindowTalked" + } +#endif +#ifdef _STU_SYS + ,{ "StuShop","StuShopInit","","", + "","","","StuShopLoop", + "","StuShopTalked","","", + "","", "","","StuShopWindowTalked" + } +#endif + +#ifdef _AUTO_PK + /* VipShop */ + ,{ "AutoPk","AutoPkInit","","", + "","","","", + "","AutoPkTalked","","", + "","", "","","AutoPkWindowTalked" + } +#endif +#ifdef _FMRANK_POINT + ,{ "FmRank","FmRankInit","","", + "","","","", + "","FmRankTalked","","", + "","", "","","FmRankWindowTalked" + } +#endif +#ifdef _NPC_MAKEPAIR + ,{ "MakePair","MakePairManInit","","", + "","","","MakePairManLoop", + "","MakePairManTalked","","", + "","", "","","MakePairManWindowTalked" + } +#endif + +#ifdef _NPC_FUSION + ,{ "PetFusion","PetFusionManInit","","", + "","","","PetFusionManLoop", + "","PetFusionManTalked","","", + "","", "","","PetFusionManWindowTalked" + } +#endif + +#ifdef _ITEM_NPCCHANGE + ,{ "ItemchangeMan","ItemchangeManInit","","", + "","","","ItemchangeManLoop", + "","ItemchangeManTalked","","", + "","", "","","ItemchangeManWindowTalked" + } +#endif +#ifdef _NPC_ITEMUP + ,{ "ItemupMan","ItemupManInit","","", + "","","","ItemupManLoop", + "","ItemupManTalked","","", + "","", "","","ItemupManWindowTalked" + } +#endif +#ifdef _CFREE_petskill + ,{ + "NPC_FreePetSkill","FreePetSkillInit","","","","","", + "","", + "FreePetSkillTalked","","","","","","", + "FreePetSkillWindowTalked" + } + +#endif + +#ifdef _PETRACE + // + ,{ + "PetRaceMaster","PetRaceMasterInit","","","","","", + "PetRaceMasterLoop","", + "PetRaceMasterTalked","","","","","","", + "PetRaceMasterWindowTalked" + } + // + ,{ + "PetRacePet","PetRacePetInit","","","","","", + "PetRacePetLoop","", + "PetRacePetTalked","","","","","","","" + } +#endif + +#ifdef _NEW_WARPMAN + ,{ + "NPC_NewNpcMan","NewNpcManInit","","","","","", + "NewNpcManLoop","", + "NewNpcManTalked","","","","","","", + "NewNpcManWindowTalked" + } +#endif + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + ,{ + "Alldoman","AlldomanInit","","", + "","","","","","AlldomanTalked","","","","","","", + "AlldomanWindowTalked"} +#endif + +#ifdef _NPC_WELFARE + ,{ "Welfare","WelfareInit","","", + "","","","", + "","WelfareTalked","","", + "","", "","","WelfareWindowTalked"} +#endif + +#ifdef _VIGOR_SYS + ,{ "ItemVigorShop","ItemVigorShopInit","","", + "","","","", + "","ItemVigorShopTalked","","", + "","", "","","ItemVigorShopWindowTalked"} +#endif +}; + +static int NPC_searchFunctionSet( char* name, int* unuse) +{ + int i; + for( i=0 ; i =arraysizeof(functionSet) )return FALSE; + + strcpysafe( ch->charfunctable[CHAR_INITFUNC].string, + sizeof( ch->charfunctable[CHAR_INITFUNC].string ), + functionSet[id].initfunc); + + strcpysafe( ch->charfunctable[CHAR_WALKPREFUNC].string, + sizeof(ch->charfunctable[CHAR_WALKPREFUNC].string), + functionSet[id].walkprefunc); + + strcpysafe( ch->charfunctable[CHAR_WALKPOSTFUNC].string, + sizeof(ch->charfunctable[CHAR_WALKPOSTFUNC].string), + functionSet[id].walkpostfunc); + + strcpysafe( ch->charfunctable[CHAR_PREOVERFUNC].string, + sizeof(ch->charfunctable[CHAR_PREOVERFUNC].string), + functionSet[id].preoverfunc); + + strcpysafe( ch->charfunctable[CHAR_POSTOVERFUNC].string, + sizeof(ch->charfunctable[CHAR_POSTOVERFUNC].string), + functionSet[id].postoverfunc); + + strcpysafe( ch->charfunctable[CHAR_WATCHFUNC].string, + sizeof(ch->charfunctable[CHAR_WATCHFUNC].string), + functionSet[id].watchfunc); + + strcpysafe( ch->charfunctable[CHAR_LOOPFUNC].string, + sizeof(ch->charfunctable[CHAR_LOOPFUNC].string), + functionSet[id].loopfunc); + + strcpysafe( ch->charfunctable[CHAR_TALKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_TALKEDFUNC].string), + functionSet[id].talkedfunc); + + strcpysafe( ch->charfunctable[CHAR_DYINGFUNC].string, + sizeof(ch->charfunctable[CHAR_DYINGFUNC].string), + functionSet[id].dyingfunc); + + strcpysafe( ch->charfunctable[CHAR_PREATTACKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_PREATTACKEDFUNC].string), + functionSet[id].preattackedfunc); + strcpysafe( ch->charfunctable[CHAR_POSTATTACKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_POSTATTACKEDFUNC].string), + functionSet[id].postattackedfunc); + + strcpysafe( ch->charfunctable[CHAR_OFFFUNC].string, + sizeof(ch->charfunctable[CHAR_OFFFUNC].string), + functionSet[id].offfunc ); + + strcpysafe( ch->charfunctable[CHAR_LOOKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_LOOKEDFUNC].string), + functionSet[id].lookedfunc ); + + strcpysafe( ch->charfunctable[CHAR_ITEMPUTFUNC].string, + sizeof(ch->charfunctable[CHAR_ITEMPUTFUNC].string), + functionSet[id].itemputfunc ); + + strcpysafe( ch->charfunctable[CHAR_SPECIALTALKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_SPECIALTALKEDFUNC].string), + functionSet[id].specialtalkedfunc ); + + strcpysafe( ch->charfunctable[CHAR_WINDOWTALKEDFUNC].string, + sizeof(ch->charfunctable[CHAR_WINDOWTALKEDFUNC].string), + functionSet[id].windowtalkedfunc ); + +#ifdef _USER_CHARLOOPS + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof(ch->charfunctable[CHAR_LOOPFUNCTEMP1].string), ""); + + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP2].string, + sizeof(ch->charfunctable[CHAR_LOOPFUNCTEMP2].string), ""); +#endif + return TRUE; +} + + +typedef enum +{ + NPC_INTENTRY=0, + NPC_CHARENTRY=1, + NPC_INTFUNC=2, + NPC_CHARFUNC=3, +}NPC_TYPECATEGORYATREADFILE; + +/*------------------------------------------------------------ + * Template index ƻоcheck + * ¦ + * index int index + * ߯Ի + * valid TRUE + * invalid FALSE + ------------------------------------------------------------*/ +INLINE int NPC_CHECKTEMPLATEINDEX(int index) +{ + if( NPC_templatenum <= index || index < 0 )return FALSE; + return TRUE; +} +/*------------------------------------------------------------ + * Template intdata index ƻоcheck + * ¦ + * index int index + * ߯Ի + * valid TRUE + * invalid FALSE + ------------------------------------------------------------*/ +static INLINE int NPC_CHECKTEMPLATEINTINDEX(int index) +{ + if( NPC_TEMPLATEINTNUM <= index || index < 0 )return FALSE; + return TRUE; +} +/*------------------------------------------------------------ + * Template chardata index ƻоcheck + * ¦ + * index int index + * ߯Ի + * valid TRUE + * invalid FALSE + ------------------------------------------------------------*/ +static INLINE int NPC_CHECKTEMPLATECHARINDEX(int index) +{ + if( NPC_TEMPLATECHARNUM <= index || index < 0 )return FALSE; + return TRUE; +} + + + +/*------------------------------------------------------------ + * ¦ + * filenum int ̻ + * ߯Ի + ------------------------------------------------------------*/ +BOOL NPC_initTemplateArray( int templatenum ) +{ + NPC_templatenum = templatenum; + NPC_template = (NPC_Template*)allocateMemory( sizeof( NPC_Template ) * + NPC_templatenum ); + if( NPC_template == NULL )return FALSE; + NPC_template_readindex = 0; + return TRUE; +} + +/*------------------------------------------------------------ + * ¦ + * ߯Ի + * ئ + ------------------------------------------------------------*/ +void NPC_setDefaultNPCTemplate( NPC_Template* temp ) +{ + int i; + if( temp == NULL )return; + + for( i=0 ; i< arraysizeof(temp->chardata) ; i ++ ) + memset( &temp->chardata[i], 0, sizeof(temp->chardata[i] )); + + temp->intdata[NPC_TEMPLATEMAKEATNOBODY]=0; + temp->intdata[NPC_TEMPLATEMAKEATNOSEE]=0; + temp->intdata[NPC_TEMPLATEIMAGENUMBER]=0; + temp->intdata[NPC_TEMPLATETYPE]=-1; + + temp->intdata[NPC_TEMPLATEMINHP]=0; + temp->intdata[NPC_TEMPLATEMINMP]=0; + temp->intdata[NPC_TEMPLATEMINSTR]=0; + temp->intdata[NPC_TEMPLATEMINTOUGH]=0; + + temp->intdata[NPC_TEMPLATEISFLYING]=0; + + temp->intdata[NPC_TEMPLATEITEMNUM]=0; + temp->intdata[NPC_TEMPLATELOOPFUNCTIME]=-1; + temp->intdata[NPC_TEMPLATEFUNCTIONINDEX]=-1; + + for( i=0; irandomdata[i] = 0; + } + + temp->hash = 0; + temp->haveitem=NULL; +} + +BOOL NPC_IsNPCTemplateFile( char* filename ) +{ + FILE* f; + char line1[128]; + char* ret; + if( filename == NULL + ||strlen( filename ) < 1 + ||filename[strlen(filename)-1] == '~' + ||filename[0] == '#' + ||strcmptail( filename, ".bak" ) == 0 )return FALSE; + + f = fopen( filename , "r" ); + if( f == NULL ) goto RETURNFALSE; + ret = fgets( line1, sizeof( line1 ), f ); + if( ret == NULL )goto FCLOSERETURNFALSE; + + if( strcmp( NPC_TEMPLATEFILEMAGIC, line1 ) == 0 ){ + fclose(f); + return TRUE; + } + +FCLOSERETURNFALSE: + fclose(f); +RETURNFALSE: + return FALSE; +} + +void NPC_templateallocitemdata( NPC_Template* one ) +{ + int itemnum = one->intdata[NPC_TEMPLATEITEMNUM]; + if( itemnum > 8 ) itemnum = 8; + else if( itemnum <= 0 ) itemnum = 0; + one->intdata[NPC_TEMPLATEITEMNUM] = itemnum; + one->haveitem = allocateMemory( sizeof( NPC_haveItem ) * itemnum ); + +} + + +/*------------------------------------------------------------ + * NPC_getRandomValue 缰¦Ѽѯ뼰׻ + * ¦ + * ߯Ի + ------------------------------------------------------------*/ +static int NPC_seekGraphicNumberFromString( char* string, int* unuse ) +{ + return CHAR_seekGraphicNumberFromString( string ); + +} +/*------------------------------------------------------------ + * ¦ + * ߯Ի + ------------------------------------------------------------*/ +static int NPC_getRandomValue( char* string,int* randomwidth ) +{ + int minvalue; + int maxvalue; + char* startmax=NULL; + + minvalue = atoi( string ); + startmax = index( string,',' ); + if( startmax != NULL ){ + /* ¼ĸةɬûľ */ + /* +1 ","׻ */ + maxvalue = atoi(startmax+1); + + /* ɬ÷ */ + *randomwidth = ABS(maxvalue - minvalue); + return min(minvalue,maxvalue); + } + *randomwidth = 0; + return minvalue; +} + + +/*------------------------------------------------------------ + * ¦ + * ߯Ի + ------------------------------------------------------------*/ +BOOL NPC_readTemplateFile( char* filename ) +{ + FILE* f; + char line[512]; + int linenum=0; + int start=OFF; + NPC_Template temp; + int itmreadindex=0; + char* ret; + int randomdata[NPC_TEMPLATEINTNUM]; + int i; + + if( NPC_template_readindex >= NPC_templatenum ){ + print("ģ鳬Ŀ\n" ); + print("ģĿ %d\n", NPC_templatenum); + return FALSE; + } + + for( i=0; i= NPC_templatenum ){ + print("ģ鳬Ŀ\n" ); + print("ģĿ %d\n", + NPC_templatenum); + goto FCLOSERETURNFALSE; + } + } + NPC_setDefaultNPCTemplate( &temp ); + itmreadindex=0; + start=OFF; + }else{ + fprint( "δ '}' at %s:%d\n",filename,linenum); + goto FCLOSERETURNFALSE; + } + break; + default: + { + typedef struct tagNPC_Readtemplate + { + char* keyword; + NPC_TYPECATEGORYATREADFILE type; + int index; + void* func; + }NPC_Readtemplate; + static NPC_Readtemplate NPC_readtemplate[NPC_TEMPLATECHARNUM+NPC_TEMPLATEINTNUM]= + { + {"templatename" , NPC_CHARENTRY, NPC_TEMPLATENAME,NULL}, + {"name" , NPC_CHARENTRY, NPC_TEMPLATECHARNAME, + NULL}, + {"makeatnobody", NPC_INTENTRY, NPC_TEMPLATEMAKEATNOBODY, + NULL}, + {"makeatnosee" , NPC_INTENTRY, NPC_TEMPLATEMAKEATNOSEE, + NULL}, + {"graphicname", NPC_INTFUNC, NPC_TEMPLATEIMAGENUMBER, + NPC_seekGraphicNumberFromString}, + {"type", NPC_INTFUNC, NPC_TEMPLATETYPE, + NPC_seekGraphicNumberFromString}, + + {"hp", NPC_INTFUNC, NPC_TEMPLATEMINHP, + NPC_getRandomValue}, + {"mp", NPC_INTFUNC, NPC_TEMPLATEMINMP, + NPC_getRandomValue}, + {"str", NPC_INTFUNC, NPC_TEMPLATEMINSTR, + NPC_getRandomValue}, + {"tough", NPC_INTFUNC, NPC_TEMPLATEMINTOUGH, + NPC_getRandomValue}, + + {"fly", NPC_INTENTRY,NPC_TEMPLATEISFLYING,NULL}, + + {"itemnum", NPC_INTENTRY, NPC_TEMPLATEITEMNUM, NULL,}, + {"functionset",NPC_INTFUNC, NPC_TEMPLATEFUNCTIONINDEX, + NPC_searchFunctionSet,}, + {"initfunc", NPC_CHARENTRY, NPC_TEMPLATEINITFUNC,NULL,}, + {"walkprefunc", NPC_CHARENTRY, NPC_TEMPLATEWALKPREFUNC, + NULL,}, + {"walkpostfunc",NPC_CHARENTRY, NPC_TEMPLATEWALKPOSTFUNC, + NULL,}, + {"preoverfunc", NPC_CHARENTRY, NPC_TEMPLATEPREOVERFUNC, + NULL,}, + {"postoverfunc",NPC_CHARENTRY, NPC_TEMPLATEPOSTOVERFUNC, + NULL,}, + {"watchfunc", NPC_CHARENTRY, NPC_TEMPLATEWATCHFUNC, + NULL,}, + {"loopfunc", NPC_CHARENTRY, NPC_TEMPLATELOOPFUNC, NULL,}, + {"talkedfunc",NPC_CHARENTRY,NPC_TEMPLATETALKEDFUNC,NULL,}, + {"dyingfunc",NPC_CHARENTRY,NPC_TEMPLATEDYINGFUNC,NULL,}, + {"preattackedfunc",NPC_CHARENTRY, + NPC_TEMPLATEPREATTACKEDFUNC,NULL,}, + {"postattackedfunc",NPC_CHARENTRY, + NPC_TEMPLATEPOSTATTACKEDFUNC,NULL,}, + {"offfunc",NPC_CHARENTRY,NPC_TEMPLATEOFFFUNC,NULL,}, + {"lookedfunc",NPC_CHARENTRY,NPC_TEMPLATELOOKEDFUNC,NULL,}, + {"itemputfunc",NPC_CHARENTRY,NPC_TEMPLATEITEMPUTFUNC, + NULL,}, + {"specialtalkedfunc",NPC_CHARENTRY, + NPC_TEMPLATESPECIALTALKEDFUNC, NULL,}, + + {"windowtalkedfunc",NPC_CHARENTRY, + NPC_TEMPLATEWINDOWTALKEDFUNC, NULL,}, + + {"loopfunctime",NPC_INTENTRY,NPC_TEMPLATELOOPFUNCTIME, + NULL,}, + }; + + char firstToken[256]; + int ret,i; + ret = getStringFromIndexWithDelim( line, "=", 1, firstToken, sizeof( firstToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", filename , linenum); + break; + } + + if( strcasecmp(firstToken,"itm") == 0 ){ + char one[128]; + char two[128]; + char three[128]; + int itemnumber=0,rate=0,amount=1; + char secondToken[256]={""}; + if( itmreadindex < temp.intdata[NPC_TEMPLATEITEMNUM] && + temp.haveitem != NULL ) + ; + else + continue; + ret = getStringFromIndexWithDelim( line, "=", 2, + secondToken, sizeof(secondToken ) ); + if( ret == FALSE ){ + print( "Find error at %s in line %d. Ignore\n", + filename , linenum); + secondToken[0] = '\0'; + } + ret = getStringFromIndexWithDelim( secondToken, "|", 1, one,sizeof( one ) ); + if( ret != FALSE )itemnumber=atoi(one); + ret = getStringFromIndexWithDelim( secondToken, "|", 2, two,sizeof(two)); + if( ret != FALSE )rate=atoi(two); + ret = getStringFromIndexWithDelim( secondToken, "|", 3, three,sizeof(three)); + if( ret != FALSE )amount=atoi(three); + if( rate > 0 && amount > 0 ){ + if( itemnumber == -1 ){ + temp.haveitem[itmreadindex].itemnumber = -1; + temp.haveitem[itmreadindex].haverate = rate; + temp.haveitem[itmreadindex].havenum = amount; + itmreadindex++; + }else if( ITEM_CHECKITEMTABLE( itemnumber ) == TRUE ){ + temp.haveitem[itmreadindex].itemnumber=itemnumber; + temp.haveitem[itmreadindex].haverate = rate; + temp.haveitem[itmreadindex].havenum = amount; + itmreadindex++; + }else + print("this item is not item %s:%d\n", + filename , linenum); + }else + print("rate or amount is odd setting. rate=%d " + "amount=%d %s:%d\n", rate,amount, filename, + linenum); + goto NEXT; + }else{ + for( i = 0 ; i < arraysizeof(NPC_readtemplate) ; i ++ ){ + if( strcasecmp( NPC_readtemplate[i].keyword, + firstToken ) == 0 ){ + char secondToken[256]={""}; + ret = getStringFromIndexWithDelim( + line, "=", 2, secondToken, sizeof(secondToken) + ); + if( ret == FALSE ) + print( "Find error at %s in line %d. Ignore\n" + ,filename , linenum); + + switch( NPC_readtemplate[i].type ){ + case NPC_INTENTRY: + temp.intdata[NPC_readtemplate[i].index]=atoi(secondToken); + if( NPC_readtemplate[i].index == NPC_TEMPLATEITEMNUM ) + NPC_templateallocitemdata( &temp ); + break; + case NPC_CHARENTRY: + strcpysafe( temp.chardata[NPC_readtemplate[i].index].string, + sizeof(temp.chardata[NPC_readtemplate[i].index].string), + secondToken); + break; + case NPC_INTFUNC: + { + int (*intfunction)(char*,int* ); + intfunction = NPC_readtemplate[i].func; + temp.intdata[NPC_readtemplate[i].index] + = intfunction( secondToken, &randomdata[NPC_readtemplate[i].index]); + break; + } + case NPC_CHARFUNC: + { + char* (*charfunction)(char* ); + charfunction = NPC_readtemplate[i].func; + strcpysafe( temp.chardata[NPC_readtemplate[i].index].string, + sizeof(temp.chardata[NPC_readtemplate[i].index].string), + charfunction(secondToken)); + break; + } + default: + break; + } + goto NEXT; + } + } + } + fprint("%s:%d There is no such entry %s\n" , filename, + linenum, firstToken ); + NEXT: + break; + } + break; + } + } + fclose(f); + return TRUE; + +FCLOSERETURNFALSE: + fclose(f); + return FALSE; +} + +BOOL NPC_readNPCTemplateFiles( char* topdirectory ,int templatesize) +{ + STRING64 *filenames; + int filenum; + int i; + filenames = (STRING64 *)allocateMemory( sizeof( STRING64 ) * + (int)getFilesearchnum( ) ); + if( filenames == NULL ){ + print( "ȡNPCļ... ڴ\n" ); + return FALSE; + } + filenum = rgetFileName( topdirectory ,filenames ,getFilesearchnum( ) ); + if( filenum == -1 ){ + fprint("޷ %s ݹȡļ\n",topdirectory); + freeMemory( filenames ); + return FALSE; + } + if( filenum >= getFilesearchnum( ) ){ + print( "ļĿʧ %d\n", getFilesearchnum( ) ); + while( 1 ); + }else{ + print( "ļ = %d\n", filenum ); + } + if( !NPC_initTemplateArray( templatesize ) ){ + fprint( "ģ\n" ); + freeMemory( filenames ); + return FALSE; + } + print( "ȡļģ...." ); + for( i = 0 ; i < filenum ; i ++ ) + if( NPC_IsNPCTemplateFile( filenames[i].string )) + NPC_readTemplateFile( filenames[i].string ); + print( "ȷģ %d ...\n" , NPC_template_readindex ); + NPC_templatenum=NPC_template_readindex; + freeMemory( filenames ); + return TRUE; +} + + + +/*------------------------------------------------------------ + * ¦ + * ߯Ի + * -1 ݾ޷¡ + ------------------------------------------------------------*/ +int NPC_templateGetTemplateIndex( char* templatename ) +{ + int i; + int hash=hashpjw( templatename ); + + for( i = 0 ; i < NPC_templatenum ; i ++ ) + if( hash == NPC_template[i].hash && + strcasecmp( templatename , NPC_template[i].chardata[NPC_TEMPLATENAME].string) == 0 ) + return i; + + return -1; +} diff --git a/npc/npcutil.c b/npc/npcutil.c new file mode 100644 index 0000000..2117158 --- /dev/null +++ b/npc/npcutil.c @@ -0,0 +1,1686 @@ +#include "version.h" +#include +#include "common.h" +#include "char.h" +#include "char_base.h" +#include "configfile.h" +#include "object.h" +#include "item.h" +#include "map_deal.h" +#include "npcutil.h" +#include "npc_door.h" +#include "readmap.h" +#include "npccreate.h" +#include "enemy.h" + +// CoolFish: Family 2001/7/29 +#include "family.h" +#include "saacproto_cli.h" + +#define IS_2BYTEWORD( _a_ ) ( (char)(0x80) <= (_a_) && (_a_) <= (char)(0xFF) ) + +extern struct FM_POINTLIST fmpointlist; + +#ifdef _PERSONAL_FAME // Arminius 8.30: + +// Arminius: Ұֵ +int FMAdvTbl[] = { // ð Table + 0, // 0 + 15, // 1 + 0, // 2 + 0, // 3 + 10, // 4 + 5, // 5 + 0, // 6 + 0, // 7 + 30, // 8 + 0, // 9 + 0, // 10 + 0, // 11 + 68, // 12 + 0, // 13 + 0, // 14 + 15, // 15 + 120, // 16 + 90, // 17 + 0, // 18 + 0, // 19 + 0, // 20 + 0, // 21 + 60, // 22 + 0, // 23 + 0, // 24 + 0, // 25 + 60, // 26 + 0, // 27 + 0, // 28 + 0, // 29 + 0, // 30 + 60, // 31 + 0, // 32 + 0, // 33 + 30, // 34 + 225, // 35 + 0, // 36 + 0, // 37 + 60, // 38 + 135, // 39 + 600, // 40 + 0, // 41 + 360, // 42 + 0, // 43 + 0, // 44 + 480, // 45 + 840, // 46 + 0, // 47 + 600, // 48 + 600, // 49 + 600, // 50 + 600, // 51 + 600, // 52 + 600, // 53 + 720, // 54 + 0, // 55 + 0, // 56 + 0, // 57 + 0, // 58 + 0, // 59 + 0, // 60 + 0, // 61 + 0, // 62 + 120, // 63 + 900, // 64 + 0, // 65 + 0, // 66 + 0, // 67 + 0, // 68 + 0, // 69 + 0, // 70 + 15000, // 71 + 20000, // 72 + 0, // 73 + 0, // 74 + 0, // 75 + 0, // 76 + 0, // 77 + 0, // 78 + 0, // 79 + 0, // 80 + 1200, // 81 + 3000, // 82 + 0, // 83 + 1500, // 84 + 0, // 85 + 0, // 86 + 100, // 87 + 0, // 88 + 400, // 89 + 0, // 90 + 0, //91 + 0, // 92 + 0, // 93 + 0, // 94 + 0, // 95 + 0, // 96 + 100, // 97 + 0, // 98 + 0, // 99 + 0, // 100 + 0, //101 + 0, //102 + 0, //103 + 0, //104 + 600, // 105 + 0, // 106 + 100, // 107 + 0, // 108 + 0, // 109 + 400, // 110 + 500, // 111 + 1000, // 112 + 100, // 113 + 300, // 114 + 0, // 115 + 500, // 116 + 15000, // 117 + 0, // 118 + 0, // 119 + 0, // 120 + 0, // 121 + 0, // 122 + 0, // 123 + 0, // 124 + 400, // 125 + 300, // 126 + 0, // 127 + 0, // 128 + 0, // 129 + 0, // 130 + 0, // 131 + 0, // 132 + 500, // 133 +}; + +#endif + +BOOL NPC_Util_AddOneTitle( int charindex, int titleindex ) +{ + int i; + Char *c ; + + if( !CHAR_CHECKINDEX( charindex ) )return FALSE; + + c = CHAR_getCharPointer( charindex ); + // CoolFish: +1 2001/11/05 + if (!c) return FALSE; + + for(i=0;iindexOfHaveTitle[i] == -1 ){ + c->indexOfHaveTitle[i] = titleindex; + return TRUE; + } + } + return FALSE; +} + + +BOOL NPC_Util_HaveTitle( int charindex , int titleindex ) +{ + int i; + Char *c; + if( !CHAR_CHECKINDEX( charindex ) )return -1; + + c = CHAR_getCharPointer( charindex ); + // CoolFish: +1 2001/11/05 + if (!c) return FALSE; + + for(i=0;iindexOfHaveTitle[i] == titleindex ){ + return TRUE; + } + } + return FALSE; +} + + +BOOL NPC_Util_Nearby( int x1 , int y1, int x2 , int y2 ) +{ + if( ABS( x1 - x2 ) <= 1 && + ABS( y1 - y2 ) <= 1 ){ + return TRUE; + } else { + return FALSE; + } +} + +BOOL NPC_Util_CharNearby(int ind1,int ind2) +{ + if( !CHAR_CHECKINDEX(ind1)) return FALSE; + if( !CHAR_CHECKINDEX(ind2)) return FALSE; + + if( CHAR_getInt( ind1 , CHAR_FLOOR ) != + CHAR_getInt( ind2 , CHAR_FLOOR ) ){ + return FALSE; + } + + return NPC_Util_Nearby( CHAR_getInt( ind1,CHAR_X), + CHAR_getInt( ind1,CHAR_Y), + CHAR_getInt( ind2,CHAR_X), + CHAR_getInt( ind2,CHAR_Y)); + +} + + +static struct ynset +{ + int value; + char string[32]; +}yntable[] ={ + { 0 , "no" }, + { 0 , "No" }, + { 0 , "NO" }, + { 0 , "NO" }, + { 0 , "No" }, + { 0 , "no" }, + { 0 , "" }, + { 0 , "" }, + + { 1 , "yes" }, + { 1 , "Yes" }, + { 1 , "YES" }, + { 1 , "YES" }, + { 1 , "Yes" }, + { 1 , "yes" }, + { 1 , "" }, + { 1 , "" }, + +}; + +int NPC_Util_YN(char *input ) +{ + int i; + for(i=0;;i++){ + int j; + + if( input[i] == '\0' ){ + return -1; + } + for(j=0;jx - pstart->x; + dify = pend->y - pstart->y; + + if( difx < 0 )difx=-1; + else if( difx > 0 )difx=1; + if( dify < 0 )dify=-1; + else if( dify > 0 )dify=1; + + return dirtable[dify+1][difx+1]; +} + +int NPC_Util_countHaveItem( int meindex , int itemid ) +{ + int i, count=0, itemindex; + if( !CHAR_CHECKINDEX(meindex))return -1; + for( i=0 ; i= 0 ){ + CHAR_ObjectDelete( oind ); + CHAR_setItemIndex( charindex, emptyindex, itemindex ); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1 ); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charindex ); + if( net ) CHAR_sendItemDataOne( charindex, emptyindex); + return TRUE; + }else if( cind >= 0 ){ + int itemgrp[2]; + int itemindexinchara; + if( cind == charindex )return FALSE; + itemindexinchara = NPC_Util_SearchItemInChar( cind , itemindex); + if( itemindexinchara == -1 )return FALSE; + CHAR_setItemIndex( cind , itemindexinchara , -1 ); + CHAR_complianceParameter(cind); + itemgrp[0] = itemindexinchara; + CHAR_setItemIndex( charindex , emptyindex , itemindex ); + itemgrp[1] = emptyindex; + if( net ) CHAR_sendItemData( charindex, itemgrp, arraysizeof(itemgrp)); + ITEM_setWorkInt( itemindex, ITEM_WORKOBJINDEX, -1 ); + ITEM_setWorkInt( itemindex, ITEM_WORKCHARAINDEX, charindex ); + return TRUE; + } + return FALSE; +} + +BOOL NPC_Util_moveItemToMap( int itemindex , int fl , int x , int y, + BOOL net ) +{ + int oind,cind; + + if( !ITEM_CHECKINDEX( itemindex ) ) return FALSE; + + oind = ITEM_getWorkInt( itemindex , ITEM_WORKOBJINDEX ); + cind = ITEM_getWorkInt( itemindex , ITEM_WORKCHARAINDEX ); + + if( oind >= 0 ){ + return MAP_objmove( oind , OBJECT_getFloor(oind), + OBJECT_getX(oind), + OBJECT_getY(oind), + fl,x,y); + } else if( cind >= 0 ){ + int itemindexinchara = NPC_Util_SearchItemInChar(cind,itemindex); + if( itemindexinchara == -1 ) return FALSE; + + CHAR_setItemIndex( cind , itemindexinchara , -1 ); + CHAR_complianceParameter(cind); + if( net ) CHAR_sendItemDataOne( cind, itemindexinchara); + if( CHAR_DropItemAbsolute( itemindex, fl,x,y,TRUE) < 0 ){ + return FALSE; + } else { + return TRUE; + } + } + return FALSE; +} + +int NPC_Util_GiveAllItemToChar( int give , int take ) +{ + int i ; + int count=0; + + for(i=0;i= 0 )break; + }else + if( Part == 1 ){ /* 㯼̼ë */ + iTarget = SearchNearLine( x+Level, y-Level+1, + floor, 0, 1, Level*2, type ); + if( iTarget >= 0 )break; + }else + if( Part == 2 ){ /* Ʊ̼ë */ + iTarget = SearchNearLine( x+Level-1, y+Level, + floor, -1, 0, Level*2, type ); + if( iTarget >= 0 ) break; + }else + if( Part == 3 ){ /* ̼ë */ + iTarget = SearchNearLine( x-Level, y+Level-1, + floor, 0, -1, Level*2, type ); + if( iTarget >= 0 ) break; + } + Part ++; Part &= 3; /* ݼɡë */ + } + return iTarget; +} + +int NPC_Util_SearchNear( int meindex, int maxlen, int type ) +{ +#if 1 + int floor, x, y, i,iTarget = -1; + if( !CHAR_CHECKINDEX( meindex ) )return -1; + floor = CHAR_getInt( meindex, CHAR_FLOOR ); + x = CHAR_getInt( meindex, CHAR_X ); + y = CHAR_getInt( meindex, CHAR_Y ); + + for( i = 0; i < maxlen; i ++ ){ + iTarget = SearchNearAround( x, y, floor, RAND( 0,3 ), i+1, type ); + if( iTarget >= 0 )break; + } + return iTarget; + + +#else + int floor, x, y, i,iTarget = -1, iLen, iMin = 655360, tX, tY; + if( !CHAR_CHECKINDEX( meindex ) )return -1; + floor = CHAR_getInt( meindex, CHAR_FLOOR ); + x = CHAR_getInt( meindex, CHAR_X ); + y = CHAR_getInt( meindex, CHAR_Y ); + + /* */ + for( i = 0 ; i maxlen )continue; /* Tľʿ*/ + if( tY > maxlen )continue; /* ئݳ*/ + + iLen = tX*tX+tY*tY; + if( iMin > iLen ){ + iMin = iLen; + iTarget = obj[i].index; /* ̼͵ë趪E*/ + } + } + + return iTarget; +#endif +} +/*------------------------------------------------------------ +------------------------------------------------------------*/ +int NPC_Util_SearchNearPlayer( int meindex, int maxlen ) +{ + return( NPC_Util_SearchNear( meindex, maxlen, CHAR_TYPEPLAYER)); +} +/*------------------------------------------------------------ +-----------------------------------------------------------*/ +int NPC_Util_SearchNearEnemy( int meindex, int maxlen ) +{ + return( NPC_Util_SearchNear( meindex, maxlen, CHAR_TYPEENEMY)); +} + + + +/******************************************************* + + int NPC_Util_SuberiWalk( + int index, CHAR ̼͵ + ); + + -1 Ѩ¦ȾȻ޷¡ + -2 ƽҷ¦ȾȻ޷¡ + + +*******************************************************/ +int NPC_Util_OtherCharCheck( int ff, int fx, int fy) +{ +#if 1 + OBJECT object; + for( object=MAP_getTopObj(ff,fx,fy); object ; + object = NEXT_OBJECT(object) ) + { + int objindex = GET_OBJINDEX(object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + return 1; + } + } + return 0; +#else + int i; + for( i = 0 ; i < objnum ; i ++){ + if( obj[i].x == fx && obj[i].y == fy && obj[i].floor == ff ){ + if( obj[i].type != OBJTYPE_NOUSE ){ + return 1; + } + } + } + return 0; +#endif +} + + +int NPC_Util_SuberiWalk( + int index, + int dir +) +{ + int i, OkFlg = 0, x = 0, y = 0, fl = 0; + int aDirList[3],dir2; + int tX, tY; + + x = CHAR_getInt(index,CHAR_X); + y = CHAR_getInt(index,CHAR_Y); + fl = CHAR_getInt(index,CHAR_FLOOR); + + switch( dir ){ + case 1: aDirList[0] = 0; aDirList[1] = 2; aDirList[2] = 1; + break; + case 3: aDirList[0] = 2; aDirList[1] = 4; aDirList[2] = 3; + break; + case 5: aDirList[0] = 4; aDirList[1] = 6; aDirList[2] = 5; + break; + case 7: aDirList[0] = 6; aDirList[1] = 0; aDirList[2] = 7; + break; + default: + tX = x+CHAR_getDX(dir); + tY = y+CHAR_getDY(dir); + /* ׻*/ + if( MAP_walkAble( index,fl,tX,tY ) == 0 ){ + dir = -1;/* Ѩ¦Ⱦ*/ + } +// }else +// if( NPC_Util_OtherCharCheck( fl,tX, tY ) ){ +// dir = -2;/* ƽҷ±¦Ⱦ*/ +// } +/* CHAR_walk( index, dir, 0 );*/ + return dir; + } + + for( i = 0; i < 3; i ++ ){ + dir2 = aDirList[i]; + tX = x+CHAR_getDX(dir2); + tY = y+CHAR_getDY(dir2); + if( MAP_walkAble( index,fl,tX,tY ) == 0 ){ + aDirList[i] = -1; /* ئfڽ*/ +// }else if( NPC_Util_OtherCharCheck( fl,tX, tY ) ){ + }else{ + /* !!*/ + OkFlg ++; + } + } + + if( aDirList[0] >= 0 && aDirList[1] >= 0 && aDirList[2] >= 0 ){ + }else + if( aDirList[0] >= 0 ){ + dir = aDirList[0]; + }else + if( aDirList[1] >= 0 ){ + dir = aDirList[1]; + }else{ + dir = aDirList[0]+aDirList[1]; + } + +/* CHAR_walk( index, dir, 0 );*/ + + return dir; +} +/*----------------------------------------------------------------------- +* +* ---------------------------------- +* IN : int meindex : ƽҷindex +* OUT: +* RETURN: +* ---------------------------------- +* +* [File:enemykill.create] +* enemy=enemykill|range:4 +* +* call: +* range = NPC_Util_GetNumFromArg( index, "range"); +*----------------------------------------------------------------------*/ +int NPC_Util_GetNumFromArg( int meindex, char* in) +{ + BOOL rc; + int i; + char outstr[sizeof( STRING32)]; + int out = -1; + char *a = CHAR_getChar( meindex, CHAR_NPCARGUMENT); + + for( i = 1; ; i++ ) { + rc = getStringFromIndexWithDelim( a, "|", i, outstr, sizeof(outstr)); + if( rc == FALSE) break; + if( strstr( outstr, in) != NULL ) { + out = textToInt( outstr); + break; + } + } + + return out; +} + +/* + * ƥ¾ľѹ + * by ringo + * + * int charindex : ƽҷ¼ index + * + * ߯Ի + * + */ +int NPC_Util_SearchItemInChar( int charindex , int itemindex) +{ + int i; + + if( !CHAR_CHECKINDEX(charindex) ) return -2; + if( !ITEM_CHECKINDEX(itemindex) ) return -2; + + for(i=0;i<=CHAR_MAXITEMHAVE;i++){ + int ii = CHAR_getItemIndex( charindex , i ); + if( ii == itemindex ){ + return i; + } + } + return -1; +} + + +/*------------------------------------------------------------------------ +* +* int NPC_Util_GetDirCharToChar( int fromindex, int toindex, int mode) +* +* int fromindex ƽҷindex +* 0:toindexȻ +* +------------------------------------------------------------------------*/ +int NPC_Util_GetDirCharToChar( int fromindex, int toindex, int mode) +{ + int ret = -1; + + if( CHAR_getInt( fromindex, CHAR_FLOOR) + == CHAR_getInt( toindex, CHAR_FLOOR)) + { + POINT start,end; + int dir; + start.x = CHAR_getInt( fromindex, CHAR_X); + start.y = CHAR_getInt( fromindex, CHAR_Y); + end.x = CHAR_getInt( toindex, CHAR_X); + end.y = CHAR_getInt( toindex, CHAR_Y); + dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + if( mode == 1 ) dir = (dir > 3)? dir -4 : dir +4; + else if( mode == 2) dir = (dir + 2) % 8; + else if( mode == 3) dir = (dir < 1)? dir +6 : dir -2; + ret = dir; + } + return( ret); +} + +/*------------------------------------------------------------------------ +* +* int NPC_Util_WalkCharToChar( int fromindex, int toindex, int mode) +* +* 0:toindexȻ +* +------------------------------------------------------------------------*/ +int NPC_Util_WalkCharToChar( int fromindex, int toindex, int mode, int suberi) +{ + int ret = -1; + int dir; + + if( CHAR_getInt( fromindex, CHAR_FLOOR) + != CHAR_getInt( toindex, CHAR_FLOOR)) + { + return( -1); + } + dir = NPC_Util_GetDirCharToChar( fromindex, toindex, mode ); + if( dir != -1) { + if( suberi) { + dir = NPC_Util_SuberiWalk( fromindex, dir ); + } + } + if( dir >= 0 ) { + ret = CHAR_walk(fromindex,dir,0); + if( ret == CHAR_WALKSUCCESSED ) ret = dir; + else ret = -1; + } + return( ret); +} + + +/*------------------------------------------------------------------------ +* +* void NPC_Util_NPCDelete( int srcindex) +* +* int srcindex index +* +------------------------------------------------------------------------*/ +void NPC_Util_NPCDelete( int srcindex) +{ + //int objindex; + //objindex = CHAR_getWorkInt(srcindex,CHAR_WORKOBJINDEX); + + if( CHAR_getInt( srcindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) return; + if( NPC_createCheckMaxEnemynum( CHAR_getInt(srcindex,CHAR_NPCCREATEINDEX ))) + NPC_createInitTime( CHAR_getInt(srcindex,CHAR_NPCCREATEINDEX )); + NPC_createDecreaseEnemynum( CHAR_getInt(srcindex, + CHAR_NPCCREATEINDEX ) ); + + CHAR_CharaDelete( srcindex ); + +} + +char *NPC_Util_CheckAssignArgFile( int index, char *filename) +{ + BOOL rc; + int i; + char *cret = NULL; + char outstr[64]; + char outstr2[64]; + char *a = CHAR_getChar( index , CHAR_NPCARGUMENT ); + + if( a == NULL ) { + print( "%s : %d err\n", __FILE__, __LINE__); + return cret; + } + + for( i = 1; ; i++ ) { + rc = getStringFromIndexWithDelim( a, "|", i, outstr, sizeof(outstr)); + if( rc == FALSE) break; + if( strstr( outstr, "file") != NULL ) { + rc = getStringFromIndexWithDelim( outstr, ":", 2, + outstr2, sizeof(outstr2)); + if( rc != FALSE ) { + strcpy( filename, outstr2); + cret = filename; + break; + } + } + } + return( cret); +} + +static char *NPC_Util_MargeStrFromArgFile( char *filename, char *buf, int len) +{ + FILE *fp; + char *cret = NULL; + char line[NPC_UTIL_GETARGSTR_LINEMAX]; + char opfile[256]; + + sprintf( opfile, "%s/", getNpcdir( ) ); + strcat( opfile, filename); + *buf = '\0'; + fp = fopen( opfile, "r"); + if( fp != NULL ) { + while( fgets( line, sizeof( line), fp)) { + if( strlen(buf) != 0 ) { + if( buf[strlen(buf) -1] != '|' ) { + strcatsafe( buf, len, "|"); + } + } + chompex( line); + strcatsafe( buf,len, line); + } + fclose( fp); + cret=buf; + } + return cret; +} + +char *NPC_Util_GetArgStr( int index, char *argstr, int len) +{ + char filename[128]; + char *cret = NULL; + char errbuf[32]; + if( NPC_Util_CheckAssignArgFile( index, filename) != NULL ) { + strcpy(filename,NPC_Util_CheckAssignArgFile( index, filename)); + cret = NPC_Util_MargeStrFromArgFile( filename, argstr, len); +// if( NPC_Util_MargeStrFromArgFile( filename, argstr, len) != NULL ) { +// cret = argstr; +// } + }else { + if( CHAR_getChar( index, CHAR_NPCARGUMENT) != NULL ){ + strcpy( argstr, CHAR_getChar( index, CHAR_NPCARGUMENT)); + cret = argstr; + }else{ + cret = NULL; + } + } + if( cret == NULL ) print("File:%s\n", NPC_Util_CheckAssignArgFile( index, filename)); + + return( cret); +} + +int NPC_Util_GetNumFromStrWithDelim( char *srcstr, char* in) +{ + BOOL rc; + int i; + char outstr[32]; + int out = -1; + + for( i = 1; ; i++ ) { + rc = getStringFromIndexWithDelim( srcstr, "|", i, outstr, sizeof(outstr)); + if( rc == FALSE) break; + if( strstr( outstr, in) != NULL ) { + out = textToInt( outstr); + break; + } + } + + return out; +} + +char *NPC_Util_GetStrFromStrWithDelim( char *srcstr, char *srhstr, + char *buf, int buflen) +{ + BOOL rc; + char *cret = NULL; + int i; + char outstr[1024]; + char outstr2[1024]; + + memset( outstr, 0, sizeof( outstr)); + memset( outstr2, 0, sizeof( outstr2)); + buf[0] = '\0'; + for( i = 1; ; i++ ) { + rc = getStringFromIndexWithDelim( srcstr, "|", i, outstr, sizeof(outstr)); + if( rc == FALSE) break; + if( strstr( outstr, srhstr) != NULL) { + rc = getStringFromIndexWithDelim( outstr, ":", 2, outstr2, sizeof(outstr2)); + if( rc != FALSE ) { + strcpysafe( buf, buflen, outstr2 ); + cret = buf; + break; + } + } + } + return cret; +} + +inline double NPC_Util_sellRate( int seller ) +{ + return (CHAR_getInt( seller, CHAR_MERCHANTLEVEL)&0x0000ffff)*0.01; +} + +inline double NPC_Util_buyRate( int buyer ) +{ + return (CHAR_getInt( buyer, CHAR_MERCHANTLEVEL )>>16)*0.01; +} + +BOOL NPC_Util_IsVisiblePlayer( int meindex) +{ + int chr_fl,chr_x,chr_y, i, j; + BOOL found = FALSE; + + chr_fl = CHAR_getInt( meindex, CHAR_FLOOR); + chr_x = CHAR_getInt( meindex, CHAR_X); + chr_y = CHAR_getInt( meindex, CHAR_Y); + + for( i = chr_x-CHAR_DEFAULTSEESIZ/2 ; + i <= chr_x+CHAR_DEFAULTSEESIZ/2 && found == FALSE; i++ ){ + for( j = chr_y-CHAR_DEFAULTSEESIZ/2 ; + j <= chr_y+CHAR_DEFAULTSEESIZ/2 && found == FALSE; + j ++ ){ + OBJECT object; + for( object = MAP_getTopObj( chr_fl, i,j); + object; + object = NEXT_OBJECT(object) ) + { + int objindex = GET_OBJINDEX( object); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + if( CHAR_getInt( OBJECT_getIndex(objindex), + CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ) + { + found = TRUE; + break; + } + } + } + } + } + return( found); +} + +BOOL NPC_Util_WordInclude( char *text , char *word ) +{ + if( strstr( text , word ) == NULL ){ + return FALSE; + } else { + return TRUE; + } +} + +void NPC_Util_RandomToken(char *in, char *out, int outbufsize ) +{ + int tokennum; + int i; + tokennum = 1; + for( i=0;in[i]!='\0';i++ ){ + if( in[i] == ',' ) tokennum++; + } + getStringFromIndexWithDelim(in,",", rand()%tokennum+1,out,outbufsize ); + +} + +void cutDotsTail( char *s ) +{ + int l = strlen( s ); + int i; + for(i=l-1;i>=0;i--){ + if( s[i] == '.' ){ + s[i] = 0; + } else { + break; + } + } +} + +int NPC_Util_FrontItem( int meindex ) +{ + int front_x, front_y,objindex,itemindex; + OBJECT obj; + + CHAR_getCoordinationDir( CHAR_getInt(meindex,CHAR_DIR) + , CHAR_getInt(meindex,CHAR_X) + , CHAR_getInt(meindex,CHAR_Y) + ,1, &front_x, &front_y ); + for( obj=MAP_getTopObj(CHAR_getInt(meindex,CHAR_FLOOR), + front_x,front_y );obj; + obj=NEXT_OBJECT(obj) ){ + objindex = GET_OBJINDEX(obj); + if( OBJECT_getType(objindex) == OBJTYPE_ITEM ){ + itemindex = OBJECT_getIndex(objindex); + if(ITEM_CHECKINDEX(itemindex) ){ + return itemindex; + }else{ + return -1; + } + } + } + + return -1; + +} + +int NPC_Util_FrontChar( int meindex ) +{ + int front_x, front_y,objindex,enemyindex; + OBJECT obj; + CHAR_getCoordinationDir( CHAR_getInt(meindex,CHAR_DIR) + , CHAR_getInt(meindex,CHAR_X) + , CHAR_getInt(meindex,CHAR_Y) + ,1, &front_x, &front_y ); + for( obj=MAP_getTopObj(CHAR_getInt(meindex,CHAR_FLOOR), + front_x,front_y );obj; + obj=NEXT_OBJECT(obj) ){ + objindex = GET_OBJINDEX(obj); + if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){ + enemyindex = OBJECT_getIndex(objindex); + if(CHAR_CHECKINDEX(enemyindex) ){ + return enemyindex; + } + } + } + return -1; +} +static int NPCUtil_enemytbl[NPC_ENEMY_ENEMYNUMBER+1]; +int *NPC_Util_getEnemy( int meindex, int charaindex) +{ + int i; + char argstr[NPC_UTIL_GETARGSTR_BUFSIZE]; + char buf[64]; + int ret; + int bigcnt; + int insert; + + NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)); + for( i = 0; i < NPC_ENEMY_ENEMYNUMBER+1; i ++ ) { + NPCUtil_enemytbl[i] = -1; + } + + if( NPC_Util_GetStrFromStrWithDelim( argstr, "enemyno", buf, sizeof( buf)) + == NULL ) + { + return NULL; + } + bigcnt = 0; + insert = 0; + + for( i = 0; i < NPC_ENEMY_ENEMYNUMBER; i ++ ) { + int curEnemy; + int et_array; + char data[128]; + + ret = getStringFromIndexWithDelim( buf,",", i + 1,data, sizeof(data)); + if( ret == FALSE) { + break; + } + + curEnemy = ENEMY_getEnemyArrayFromId( atoi( data)); + if( !ENEMY_CHECKINDEX( curEnemy) ) continue; + et_array = ENEMYTEMP_getEnemyTempArray( curEnemy ); + if( ENEMYTEMP_getInt( et_array, E_T_SIZE ) == E_T_SIZE_BIG) { + if( bigcnt >= 5 ) { + continue; + } + if( insert > 4 ) { + int target_et_array; + int flg = FALSE; + int j; + for( j = 0; j < 5; j ++ ) { + /* л¼ƾ */ + if( !ENEMY_CHECKINDEX( NPCUtil_enemytbl[j])) break; + + target_et_array = ENEMYTEMP_getEnemyTempArray( + NPCUtil_enemytbl[j]); + /* ƾ */ + if( !ENEMYTEMP_CHECKINDEX( target_et_array)) break; + + if( ENEMYTEMP_getInt( target_et_array, E_T_SIZE) + == E_T_SIZE_NORMAL ) + { + flg = TRUE; + break; + } + } + if( !flg) continue; + + NPCUtil_enemytbl[insert] = NPCUtil_enemytbl[j]; + NPCUtil_enemytbl[j] = curEnemy; + } + else { + NPCUtil_enemytbl[insert] = curEnemy; + } + bigcnt ++; + } + else { + NPCUtil_enemytbl[insert] = curEnemy; + } + insert ++; + } + return NPCUtil_enemytbl; +} + + +void NPC_EventSetFlg(int talker,int shiftbit) + +{ + int point=0; + int array; + int shift; +#ifdef _TEACHER_SYSTEM + int iGetFame = 0; +#endif + + /*-- -1׷º绥ئì -*/ + if(shiftbit==-1) return; + if(shiftbit<=255){ + array = shiftbit / 32; + shift = shiftbit % 32; + + point = CHAR_getInt( talker, CHAR_ENDEVENT+array); + + // Arminius 8.24 prevent wash dp + if (!(point & (1 << shift))) { + // CoolFish: Family Adv 2001/8/4 + AddFMAdv(talker, shiftbit); +#ifdef _TEACHER_SYSTEM + if(shiftbit < arraysizeof(FMAdvTbl)){ + if (getPetUpGetExp()!=2){ + iGetFame = FMAdvTbl[shiftbit]; + }else{ + iGetFame = 0; + } + } +#endif + } +#ifdef _TEACHER_SYSTEM + iGetFame /= 20; // ʦѧ 5% (1/20) + // õûд0 + if(iGetFame > 0){ + // ûеʦ + if(strlen(CHAR_getChar(talker,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(talker,CHAR_TEACHER_NAME)) > 0){ + int iPlayernum = CHAR_getPlayerMaxNum(),i; + char szMsg[128]; + + // 鵼ʦڲ + for(i=0;i= arraysizeof(FMAdvTbl)) + return; + else{ + if (getPetUpGetExp()!=2){ + fmadv = FMAdvTbl[shiftbit]; + }else{ + fmadv = 0; + } + } + if (fmadv <= 0) return; + sprintf(buf, "%d", fmadv); + #ifdef _PERSONAL_FAME // Arminius 8.30: + CHAR_earnFame(talker, fmadv); + #endif + #ifdef _NEW_MANOR_LAW + sprintf(buf1, "%d", CHAR_getInt(talker,CHAR_FAME)); + #endif +#ifdef _FMVER21 + if (CHAR_getInt(talker, CHAR_FMLEADERFLAG) > 0 + && CHAR_getInt(talker, CHAR_FMLEADERFLAG) != FMMEMBER_APPLY) + { + // CoolFish: 2001/10/03 + int fd = getfdFromCharaIndex(talker); + saacproto_ACFixFMData_send(acfd, + CHAR_getChar(talker, CHAR_FMNAME), + CHAR_getInt(talker, CHAR_FMINDEX), + CHAR_getWorkInt(talker, CHAR_WORKFMINDEXI), + FM_FIX_FMADV, buf, +#ifndef _NEW_MANOR_LAW + "", +#else + buf1, +#endif + // CoolFish: 2001/10/03 + CHAR_getWorkInt(talker, CHAR_WORKFMCHARINDEX), + CONNECT_getFdid(fd)); + // CHAR_getWorkInt(talker, CHAR_WORKFMCHARINDEX), 0); +#ifdef _NEW_MANOR_LAW + { + int i; + for(i=0;i +#include + +#include "version.h" +#include "char.h" +#include "common.h" +#include "npctemplate.h" +#include "npccreate.h" +#include "battle.h" +#include "configfile.h" + +BOOL NPC_readNPCSettingFiles( char* topdirectory ,int templatesize, int createsize) +{ + print("\n"); + if( NPC_readNPCTemplateFiles( topdirectory ,templatesize) == FALSE ) + return FALSE; + + if( NPC_readNPCCreateFiles( topdirectory ,createsize) == FALSE ) + return FALSE; + + return TRUE; +} + +BOOL NPC_reloadNPC(void) +{ + int i; + int charnum = getFdnum()+ getPetcharnum()+getOtherscharnum(); + for(i=0;i|`V#-}$4HVIM#Igp*+(KicbLq&v2M$;q&fXY-wm|EA-t zYyZVLqhs!GowJgUg?Bh-o#}D+X6LN8b9_JMob^_Y7mhk-{hf|+)7Ls_kM&!eaU&f+ zxxg7W+OhjZXWajRBXj0VC*`>5F(>oCdTzBe0(zB$vV^HG3ft09Oqsic2bVY%bauH>Jj;zbM9D2Z_GJ&wBuJ> zoO9piF~RpoXVhcbfHUFk9$&i5necXwy|bMOZ{wKgtaQ>I=TCPgzLlfu)6T@VdUSl= znK;(bv(TCNUpTVgyWTmYWA+73_E^VP-{)kfJ06+lWWSZ;PdQHZ{~Z6Hl)?Fd>zy+` zX2hKH|4$riUvSPp(_`}i=lrpb!3oa!Z}oWTsB``q9zLhl8R4j%TQ#e;Em+rpb9FEh z2{kX99SR5A9mQA{Y!0^7MS_(rEv-&%OLMR`3{<X=1^V05?A{4#Gzd8jp35u&VSAv2L+MKkJ!N^e;Tg^HPlMk-|Ha(q?9Oh_p&m#j-G z)IPJNqq(83Z3U{FtX4TlFS&hN^+i%dWH@mH+sV3B<>yP79kUON%h}Rxe zr6{G&@}Vq{c^gj)mtkG?T)gxTdUeS!yndJf&n6}<_L zPWIT%KZ!A?4xNrzbwlWmU`aTfHjZ|Sbn3{Q(olP(4mMcYs!_)EjZ~;ON=$zoJ@ED5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2X03rniDg*hUII992Cs={|>=j9Y#12O>meImQe5^ zMakefile + $(CC) $(INCFLAGS) -M $(SRC) >> Makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(RM) Makefile.bak + +# DO NOT DELETE THIS LINE +npc_lua.o: npc_lua.c ../include/npc_lua.h ../include/npc_lua_interface.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h +npc_lua_ex.o: npc_lua_ex.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_item.o: npc_lua_item.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/item.h +npc_lua_nlg.o: npc_lua_nlg.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/configfile.h +npc_lua_nl.o: npc_lua_nl.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/autil.h ../include/configfile.h +npc_lua_obj.o: npc_lua_obj.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_char.o: npc_lua_char.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/sasql.h ../include/pet_skill.h \ + ../include/enemy.h ../include/family.h +npc_lua_battle.o: npc_lua_battle.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_game.o: npc_lua_game.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/family.h +npc_lua_map.o: npc_lua_map.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/item.h +npc_lua_spell.o: npc_lua_spell.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/pet_skill.h \ + ../include/profession_skill.h ../include/magic_base.h +npc_lua_sql.o: npc_lua_sql.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h ../include/sasql.h diff --git a/npc_lua/Makefile.bak b/npc_lua/Makefile.bak new file mode 100644 index 0000000..bf1a72a --- /dev/null +++ b/npc_lua/Makefile.bak @@ -0,0 +1,654 @@ +INCFLAGS=-I. -I../include +FLTFLAGS="-s 1331200" +export FLTFLAGS + +#CFLAGS=-w -O3 -g $(INCFLAGS) +#CHOST="i686-pc-linux-gnu" +#CFLAGS=-march=pentium4 -w -O3 -pipe -mmmx -msse -msse2 $(INCFLAGS) +#CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer" +CFLAGS=-w -O3 -pipe $(INCFLAGS) + +PROG=libnpc_lua.a + +SRC=npc_lua.c npc_lua_ex.c npc_lua_item.c npc_lua_nlg.c npc_lua_nl.c npc_lua_obj.c npc_lua_char.c npc_lua_battle.c npc_lua_game.c npc_lua_map.c npc_lua_spell.c npc_lua_sql.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(CC) $(INCFLAGS) -M $(SRC) >> Makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(RM) Makefile.bak + +# DO NOT DELETE THIS LINE +npc_lua.o: npc_lua.c ../include/npc_lua.h ../include/npc_lua_interface.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h +npc_lua_ex.o: npc_lua_ex.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_item.o: npc_lua_item.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/item.h +npc_lua_nlg.o: npc_lua_nlg.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/configfile.h +npc_lua_nl.o: npc_lua_nl.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/autil.h ../include/configfile.h +npc_lua_obj.o: npc_lua_obj.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_char.o: npc_lua_char.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/sasql.h ../include/pet_skill.h \ + ../include/enemy.h ../include/family.h +npc_lua_battle.o: npc_lua_battle.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h +npc_lua_game.o: npc_lua_game.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h ../include/saacproto_cli.h \ + ../include/saacproto_util.h ../include/family.h +npc_lua_map.o: npc_lua_map.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/item.h +npc_lua_spell.o: npc_lua_spell.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/anim_tbl.h ../include/object.h ../include/net.h \ + ../include/npcutil.h ../include/npc_eventaction.h ../include/battle.h \ + ../include/readmap.h ../include/pet_skill.h \ + ../include/profession_skill.h ../include/magic_base.h +npc_lua_sql.o: npc_lua_sql.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/rpc/netdb.h \ + /usr/include/bits/netdb.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ + /usr/include/getopt.h /usr/include/strings.h /usr/include/sys/time.h \ + /usr/include/errno.h /usr/include/bits/errno.h \ + /usr/include/linux/errno.h /usr/include/asm/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + ../include/../lua/lauxlib.h ../include/../lua/lua.h \ + /usr/include/assert.h ../include/util.h ../include/char.h \ + ../include/char_base.h ../include/skill.h ../include/util.h \ + ../include/title.h ../include/addressbook.h ../include/net.h \ + /usr/include/signal.h /usr/include/bits/signum.h \ + /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ + /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h \ + /usr/include/bits/sigstack.h /usr/include/bits/sigthread.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/bits/setjmp.h ../include/link.h ../include/lua.h \ + ../include/lauxlib.h ../include/lualib.h ../include/char_data.h \ + ../include/item.h ../include/char.h ../include/char_base.h \ + ../include/char_data.h ../include/anim_tbl.h ../include/object.h \ + ../include/battle.h ../include/npcutil.h ../include/item.h \ + ../include/readmap.h ../include/sasql.h diff --git a/npc_lua/ReadMe.txt b/npc_lua/ReadMe.txt new file mode 100644 index 0000000..f75dbe7 --- /dev/null +++ b/npc_lua/ReadMe.txt @@ -0,0 +1,25 @@ +======================================================================== + 静态库:npc_lua 项目概述 +======================================================================== + +应用程序向导已为您创建了此 npc_lua 库项目。 + +本文件概要介绍组成 npc_lua 应用程序的每个文件的内容。 + + +npc_lua.vcproj + 这是使用应用程序向导生成的 VC++ 项目的主项目文件, + 其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 + + +///////////////////////////////////////////////////////////////////////////// + +StdAfx.h, StdAfx.cpp + 这些文件用于生成名为 npc_lua.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 + +///////////////////////////////////////////////////////////////////////////// +其他注释: + +应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 + +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/npc_lua/npc_lua.c b/npc_lua/npc_lua.c new file mode 100644 index 0000000..aaa7eea --- /dev/null +++ b/npc_lua/npc_lua.c @@ -0,0 +1,2325 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "char_data.h" +#include "anim_tbl.h" +#include "object.h" +#include "battle.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" + +#ifdef _JZ_NEWSCRIPT_LUA + +typedef enum +{ + LUAITEM_PREOVERFUNC = ITEM_PREOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_POSTOVERFUNC = ITEM_POSTOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_WATCHFUNC = ITEM_WATCHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_USEFUNC = ITEM_USEFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_ATTACHFUNC = ITEM_ATTACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DETACHFUNC = ITEM_DETACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DROPFUNC = ITEM_DROPFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_PICKUPFUNC = ITEM_PICKUPFUNC - ITEM_FIRSTFUNCTION, +#ifdef _Item_ReLifeAct + LUAITEM_DIERELIFEFUNC = ITEM_DIERELIFEFUNC - ITEM_FIRSTFUNCTION, +#endif +}LUAITEM_FUNC; + +lua_State *M_Script_Lua = NULL; //ʵ +unsigned int M_Create_Num = 0; +char M_OutErrMsg[1024]; + +extern lua_const M_Lua_RegConstList[]; + +static luaL_Reg M_RegList[] = { + {NULL, NULL}, +}; + +static luaL_Reg Bit_RegList[] = { + {"band", NPC_Lua_Bit_band}, + {"bor", NPC_Lua_Bit_bor}, + {"bxor", NPC_Lua_Bit_bxor}, + {"lshift", NPC_Lua_Bit_lshift}, + {"rshift", NPC_Lua_Bit_rshift}, + {NULL, NULL}, +}; + +static luaL_Reg Map_RegList[] = { + {"CheckCoordinates",NPC_Lua_Map_CheckCoordinates}, + {"GetExitFloorXY",NPC_Lua_Map_GetExitFloorXY}, + {"GetfloorX",NPC_Lua_Map_GetfloorX}, + {"GetfloorY",NPC_Lua_Map_GetfloorY}, + {"GetTileAndObjId",NPC_Lua_Map_GetTileAndObjId}, + {"SetTileAndObjId",NPC_Lua_Map_SetTileAndObjId}, + {"GetWalkAbleFromPoint",NPC_Lua_Map_GetWalkAbleFromPoint}, + {"GetImageData",NPC_Lua_Map_GetImageData}, + {"SetImageData",NPC_Lua_Map_SetImageData}, + {"GetTopObj",NPC_Lua_Map_GetTopObj}, + {"GetNextObj",NPC_Lua_Map_GetNextObj}, + {"CheckImageIndex",NPC_Lua_Map_CheckImageIndex}, + {"CheckIndex",NPC_Lua_Map_CheckIndex}, + {"MakeNewMap",NPC_Lua_Map_MakeNewMap}, + {"DelNewMap",NPC_Lua_Map_DelNewMap}, + {"SetExWarp",NPC_Lua_Map_SetExWarp}, + {"SetMapPoint",NPC_Lua_Map_SetMapPoint}, + {"DelMapPoint",NPC_Lua_Map_DelMapPoint}, + {"getFloorName",NPC_Lua_Map_getFloorName}, + {"UpMap",NPC_Lua_Map_Upmap}, + {NULL, NULL}, +}; + +static luaL_Reg Spell_RegList[] = { + {"PETSKILL_GetData",NPC_Lua_Spell_PETSKILL_GetData}, + {"PROFESSION_GetData",NPC_Lua_Spell_PROFESSION_GetData}, + {"MAGIC_GetData",NPC_Lua_Spell_MAGIC_GetData}, + {"PETSKILL_SetData",NPC_Lua_Spell_PETSKILL_SetData},//δ + {"PROFESSION_SetData",NPC_Lua_Spell_PROFESSION_SetData},//δ + {"MAGIC_SetData",NPC_Lua_Spell_MAGIC_SetData},//δ + {NULL, NULL}, +}; + +static luaL_Reg NL_RegList[] = { +//NL + {"GetErrorStr", NPC_Lua_NL_GetErrorStr}, + {"CreateNpc", NPC_Lua_NL_CreateNpc}, + {"DelNpc", NPC_Lua_NL_DelNpc}, + {"GetStringFromIndexWithDelim", NPC_Lua_NL_GetStringFromIndexWithDelim},//ַ + {"ANSI_PlayerLoop", NPC_Lua_NL_ANSI_PlayerLoop},//߳ + {"PetLoopGetNext", NPC_Lua_NL_PetLoopGetNext},//߳ + {"ItemLoopGetNext", NPC_Lua_NL_ItemLoopGetNext},//е + {"PlayerLoopGetNext", NPC_Lua_NL_PlayerLoopGetNext},// + {"GetConfigLineType", NPC_Lua_NL_GetConfigLineType},//CFֶ + {"GetConfigLineVal", NPC_Lua_NL_GetConfigLineVal},//CFֵֶ + {"CheckNpcEventFree", NPC_Lua_CheckNpcEventFree},//ʹNPCű + {"DoNpcEventAction", NPC_Lua_DoNpcEventAction},//ʹNPCű + {"SetTimer", NPC_Lua_NL_SetTimer},//趨һʱضʱID + {"DelTimer", NPC_Lua_NL_DelTimer},//ɾһʱID + {"RunSaFuncII", NPC_Lua_NL_RunSaFuncII},//һڶõ2INTĺ + {"RunSaFuncIII", NPC_Lua_NL_RunSaFuncIII},//һڶõ3INTĺ + {"ANSI_PlayerLoop", NPC_Lua_NL_ANSI_PlayerLoop},//һ (ǰظʱ + {"ANSI_PetLoop", NPC_Lua_NL_ANSI_PetLoop},//һ + {"ANSI_ItemLoop", NPC_Lua_NL_ANSI_ItemLoop},//һ) + {"ClsMk", NPC_Lua_NL_ClsMk}, + {"AddCheckNum", NPC_Lua_NL_AddCheckNum}, + {"Mkstring", NPC_Lua_NL_Mkstring}, + {"Mkint", NPC_Lua_NL_Mkint}, + {"SendMesg", NPC_Lua_NL_SendMesg}, + {"Mod",NPC_Lua_NL_Mod}, + {NULL, NULL}, +}; + +static luaL_Reg Char_RegList[] = { +//ȡݵĽӿ + {"getVipPoint", NPC_Lua_Char_getVipPoint}, + {"getjfPoint", NPC_Lua_Char_getjfPoint}, + {"getxjPoint", NPC_Lua_Char_getxjPoint}, + {"setVipPoint", NPC_Lua_Char_setVipPoint}, + {"setjfPoint", NPC_Lua_Char_setjfPoint}, + {"setxjPoint", NPC_Lua_Char_setxjPoint}, + {"IsEventEnd", NPC_Lua_Char_IsEventEnd}, + {"IsEventNow", NPC_Lua_Char_IsEventNow}, +// + {"FindItemId", NPC_Lua_Char_FindItemId}, + {"FindPetEnemyId", NPC_Lua_Char_FindPetEnemyId}, + {"GetAllocPoint",NPC_Lua_Char_GetAllocPoint}, + {"GetDataFromEnemyBase",NPC_Lua_Char_GetDataFromEnemyBase}, + {"GetPlayIndex", NPC_Lua_Char_GetPlayerIndex}, + {"FindItemIndex", NPC_Lua_Char_FindItemIndex}, + {"FindPetIndex", NPC_Lua_Char_FindPetIndex}, + {"CheckIndex",NPC_Lua_CHAR_CHECKINDEX}, + {"GetPetSkill", NPC_Lua_Char_GetPetSkill},// + {"GetPetSkillNo", NPC_Lua_Char_GetPetSkillNo},// + {"GetEmptyItemBoxNum", NPC_Lua_Char_GetEmptyItemBoxNum},// + {"GetEmptyPetBoxNum", NPC_Lua_Char_GetEmptyPetBoxNum},// + {"GetPlayerPetNum", NPC_Lua_Char_GetPlayerPetNum},// + {"GetPlayerItemNum", NPC_Lua_Char_GetPlayerItemNum},// + {"CharRidNo", NPC_Lua_Char_RidNo}, // + {"getPlayerMaxNum", NPC_ABLua_char_getPlayerMaxNum},// + {"getBattleexp", NPC_ABLua_char_getBattleexp},// + {"SetPetSkill", NPC_Lua_Char_SetPetSkill},// + {"SetPetSkillNo", NPC_Lua_Char_SetPetSkillNo},// + {"ComplianceParameter", NPC_Lua_Char_ComplianceParameter}, + {"HcItemId", NPC_Lua_Char_HcItemId}, + {"DelHcItem", NPC_Lua_Char_DelHcItem}, + {"GETFM", NPC_Lua_Char_GETFM}, + {"FindPetEnemyBaseId", NPC_Lua_Char_FindPetEnemyBaseId}, + {"ITEMID_NAME", NPC_Lua_Char_ITEMID_NAME}, + {"ITEMID_NAME2", NPC_Lua_Char_ITEMID_NAME2}, + {"ITEMID_LEVEL", NPC_Lua_Char_ITEMID_LEVEL}, + {"ITEMID_GOLD", NPC_Lua_Char_ITEMID_GOLD}, + {"ITEMID_RANO", NPC_Lua_Char_ITEMID_RANO}, +// {"CharRidNo", NPC_Lua_Char_CharRidNo}, //δͬʱر + {"GetPetOwner", NPC_Lua_Char_GetPetOwner}, + {"GetEnemyBaseIdFromEnemyId", NPC_Lua_Char_GetEnemyBaseIdFromEnemyId}, + {"GetEnemyIdFromEnemyBaseId", NPC_Lua_Char_GetEnemyIdFromEnemyBaseId}, + {"GetIp", NPC_Lua_Char_GetIp}, + {"SetAllocPoint", NPC_Lua_Char_SetAllocPoint}, + {"GetMaxPetIndex", NPC_Lua_Char_GetMaxPetIndex}, + {"GetMaxPlayerIndex", NPC_Lua_Char_GetMaxPlayerIndex}, + {"SavePetToString", NPC_Lua_Char_SavePetToString}, + {"LoadPetFromString", NPC_Lua_Char_LoadPetFromString}, + {"GetPlayerFromAccAndName", NPC_Lua_Char_GetPlayerFromAccAndName}, + {"CheckPet", NPC_Lua_Char_CheckPet}, + {"CheckPlayer", NPC_Lua_Char_CheckPlayer}, + {"JoinParty", NPC_Lua_Char_JoinParty}, + {"getFamilyPlayIndex", NPC_Lua_Char_getFamilyPlayIndex}, + + {"GetData", NPC_Lua_Char_GetData}, + {"GetItemId", NPC_Lua_Char_GetItemId}, + {"GetPetEnemyId", NPC_Lua_Char_GetPetEnemyId}, + {"GetItemIndex", NPC_Lua_Char_GetItemIndex}, + {"GetPetIndex", NPC_Lua_Char_GetPetIndex}, + {"GetTeamIndex", NPC_Lua_Char_GetTeamIndex}, + {"GetPlayerIndexByCdkey", NPC_Lua_Char_GetPlayerIndexByCdkey}, + +//ݵĽӿ + {"ClrEvtEnd", NPC_Lua_Char_ClrEvtEnd}, + {"ClrEvtNow", NPC_Lua_Char_ClrEvtNow}, + {"ClrClrEvt", NPC_Lua_Char_ClrEvt}, + {"SetEvtEnd", NPC_Lua_Char_SetEvtEnd}, + {"SetEvtNow", NPC_Lua_Char_SetEvtNow}, + {"SetData", NPC_Lua_Char_SetData}, + +//¼õĽӿ + {"SetWalkPreEvent", NPC_Lua_Char_SetWalkPreEvent}, + {"SetWalkPostEvent", NPC_Lua_Char_SetWalkPostEvent}, + {"SetPreOverEvent", NPC_Lua_Char_SetPreOverEvent}, + {"SetPostOverEvent", NPC_Lua_Char_SetPostOverEvent}, + {"SetWatchEvent", NPC_Lua_Char_SetWatchEvent}, + {"SetLoopEvent", NPC_Lua_Char_SetLoopEvent}, + {"SetTalkedEvent", NPC_Lua_Char_SetTalkedEvent}, + {"SetOFFEvent", NPC_Lua_Char_SetOFFEvent}, + {"SetLookedEvent", NPC_Lua_Char_SetLookedEvent}, + {"SetItemPutEvent", NPC_Lua_Char_SetItemPutEvent}, + {"SetWindowTalkedEvent", NPC_Lua_Char_SetWindowTalkedEvent}, +#ifdef _USER_CHARLOOPS + {"SetCharLoopsEvent", NPC_Lua_Char_SetCharLoopsEvent}, + {"SetBattleProPertyEvent", NPC_Lua_Char_SetBattleProPertyEvent}, +#endif +//Աӿ + {"VipPoint", NPC_Lua_Char_VipPoint}, + {"HealAll", NPC_Lua_Char_HealAll}, + {"GetPetSkillId", NPC_Lua_Char_GetPetSkillId}, + {"GetPetSkillName", NPC_Lua_Char_GetPetSkillName}, + {"GetPetSkillMsg", NPC_Lua_Char_GetPetSkillMsg}, + {"SetPetSkill", NPC_Lua_Char_SetPetSkill}, + {"RandMsg", NPC_Lua_Char_RandMsg}, + {"GetBeatitudeNum", NPC_Lua_Char_GetBeatitudeNum}, + {NULL, NULL}, +}; + +static luaL_Reg GAME_RegList[] = { + {"FMPOINT_GetData",NPC_Lua_Game_FMPOINT_GetData}, + {"FMPOINT_ACSetFMPoint",NPC_Lua_Game_FMPOINT_ACSetFMPoint}, + {"FMPOINT_ACFixFMPoint",NPC_Lua_Game_FMPOINT_ACFixFMPoint}, + {"FMPOINT_ACCleanFMPoint",NPC_Lua_Game_FMPOINT_ACCleanFMPoint}, + {NULL, NULL}, +}; + +static luaL_Reg Item_RegList[] = { +//ȡݵĽӿ + {"GetData", NPC_Lua_Item_GetData}, + +//ݵĽӿ + {"SetData", NPC_Lua_Item_SetData}, + {"GetDataFromItemSet", NPC_Lua_Item_GetDataFromItemSet}, +//¼õĽӿ + {"SetPreOverEvent", NPC_Lua_Item_SetPreOverEvent}, + {"SetPostOverEvent", NPC_Lua_Item_SetPostOverEvent}, + {"SetWatchEvent", NPC_Lua_Item_SetWatchEvent}, + {"SetUseEvent", NPC_Lua_Item_SetUseEvent}, + {"SetAttachEvent", NPC_Lua_Item_SetAttachEvent}, + {"SetDetachEvent", NPC_Lua_Item_SetDetachEvent}, + {"SetDropEvent", NPC_Lua_Item_SetDropEvent}, + {"SetPickUPEvent", NPC_Lua_Item_SetPickUPEvent}, +#ifdef _Item_ReLifeAct + {"SetDieReLifeEvent", NPC_Lua_Item_SetDieReLifeEvent}, +#endif + {NULL, NULL}, +}; + +static luaL_Reg Obj_RegList[] = { +//ȡݵĽӿ + {"GetType", NPC_Lua_Obj_GetType}, + {"GetCharType", NPC_Lua_Obj_GetCharType}, + {"GetCharIndex", NPC_Lua_Obj_GetCharIndex}, + {"GetX", NPC_Lua_Obj_GetX}, + {"GetY", NPC_Lua_Obj_GetY}, + {"GetFloor", NPC_Lua_Obj_GetFloor}, + +//¼õĽӿ + {"SetType", NPC_Lua_Obj_SetType}, + {"SetCharType", NPC_Lua_Obj_SetCharType}, + {"SetX", NPC_Lua_Obj_SetX}, + {"SetY", NPC_Lua_Obj_SetY}, + {"SetFloor", NPC_Lua_Obj_SetFloor}, + {NULL, NULL}, +}; + +static luaL_Reg Battle_RegList[] = { +//ȡݵĽӿ + {"GetPlayIndex", NPC_Lua_Battle_GetPlayIndex}, + {"GetData", NPC_Lua_Battle_GetData}, + {"IndexToNo", NPC_Lua_Battle_IndexToNo}, + {"NoToIndex", NPC_Lua_Battle_NoToIndex}, + {"CheckIndex", NPC_Lua_Battle_CheckIndex}, +//ݵĽӿ + {"SetNORisk", NPC_Lua_Battle_SetNORisk}, + {"SetMod", NPC_Lua_Battle_SetMod}, + {"SetType", NPC_Lua_Battle_SetType}, + {"SetData", NPC_Lua_Battle_SetData}, + {"Exit", NPC_Lua_Battle_Exit}, + +//¼õĽӿ + {"SetWinEvent", NPC_Lua_Battle_SetWinEvent}, + {"SetEndEvent", NPC_Lua_Battle_SetEndEvent}, + {NULL, NULL}, +}; + + +static luaL_Reg SQL_RegList[] = { + {"Push", NPC_Lua_SQL_Push}, + {"PushPop", NPC_Lua_SQL_PushPop}, + {"PushPopAdv", NPC_Lua_SQL_PushPopAdv}, + {"QueryFirstRow", NPC_Lua_SQL_QueryFirstRow}, + {"FetchRow", NPC_Lua_SQL_FetchRow}, + {"FreeResult", NPC_Lua_SQL_FreeResult}, + {NULL, NULL}, +}; + + +static luaL_Reg NLG_RegList[] = { +//ܽӿ + {"UpItem", NPC_Lua_NLG_UpItem}, + {"GiveItemOne", NPC_Lua_NLG_GiveItemOne}, + {"HealAll", NPC_Lua_NLG_HealerAllHeal}, + {"DelItemByIndex", NPC_Lua_NLG_DelItemByIndex}, + {"FindPet", NPC_Lua_NLG_FindPet}, + {"GetMap", NPC_Lua_NLG_GetMap}, + {"PetUp", NPC_Lua_NLG_PetUp}, + {"AddSk", NPC_Lua_NLG_AddSk}, + {"SetZy", NPC_Lua_NLG_SetZy}, + {"GetPlayerMaxNum", NPC_Lua_Char_GetPlayerMaxNum}, + {"GetXY", NPC_Lua_NLG_GetXY}, + {"WalkJc", NPC_Lua_NLG_WalkJc}, + {"KickPlayer", NPC_Lua_NLG_KickPlayer}, + {"HealOne", NPC_Lua_NLG_HealOne}, + {"HealAll", NPC_Lua_NLG_HealAll}, + {"LevelUpTo", NPC_Lua_NLG_LevelUpTo}, + {"AddExp", NPC_Lua_NLG_AddExp}, + {"UpPet", NPC_Lua_NLG_UpPet}, + {"DelPetByPos", NPC_Lua_NLG_DelPetByPos}, + {"DelPetByIndex", NPC_Lua_NLG_DelPetByIndex}, + {"GivePetByIndex", NPC_Lua_NLG_GivePetByIndex}, + {"GiveItemByIndex", NPC_Lua_NLG_GiveItemByIndex}, + {"WarpToSpecificPoint", NPC_Lua_NLG_WarpToSpecificPoint}, + {"UpSkillupPoint", NPC_Lua_NLG_UpSkillupPoint}, + {"StayEncount", NPC_Lua_NLG_StayEncount}, + + {"CheckInFront", NPC_Lua_NLG_CheckInFront}, + {"CheckObj", NPC_Lua_NLG_CheckObj}, + {"CharLook", NPC_Lua_NLG_CharLook}, + {"CreateBattle", NPC_Lua_NLG_CreateBattle}, + {"CreateBattlePvP", NPC_Lua_NLG_CreateBattlePvP}, + {"SearchWatchBattleRandIndex", NPC_Lua_NLG_SearchWatchBattleRandIndex}, + {"InputCard", NPC_Lua_NLG_InputCard}, + {"DelPet", NPC_Lua_NLG_DelPet}, + {"DelHaveIndexPet", NPC_Lua_NLG_DelHaveIndexPet}, + {"DelItem", NPC_Lua_NLG_DelItem}, + {"DelItemByPos", NPC_Lua_NLG_DelItemByPos}, + {"DischargeParty", NPC_Lua_NLG_DischargeParty}, + + {"GivePet", NPC_Lua_NLG_GivePet}, + {"GiveOnePet", NPC_Lua_NLG_GiveOnePet}, + {"GiveItem", NPC_Lua_NLG_GiveItem}, + {"GiveOneItem", NPC_Lua_NLG_GiveOneItem}, + {"GiveRandItem", NPC_Lua_NLG_GiveRandItem}, + {"GetOnLinePlayer", NPC_Lua_Char_GetOnLinePlayer}, + + {"ShowWindowTalked", NPC_Lua_NLG_ShowWindowTalked}, + {"SetAction", NPC_Lua_NLG_SetAction}, + + {"TalkToCli", NPC_Lua_NLG_TalkToCli}, + {"TalkToFloor", NPC_Lua_NLG_TalkToFloor}, + + {"UpChar", NPC_Lua_NLG_UpChar}, + {"UpStateBySecond", NPC_Lua_NLG_UpStateBySecond}, + {"UpStateByThird", NPC_Lua_NLG_UpStateByThird}, + {"Update_Party", NPC_Lua_NLG_Update_Party}, + + {"Warp", NPC_Lua_NLG_Warp}, + {"WalkMove", NPC_Lua_NLG_WalkMove}, + {"WatchEntry", NPC_Lua_NLG_WatchEntry}, + + {"GetMaxPlayNum", NPC_Lua_NLG_GetMaxPlayNum}, + {"CheckPlayIndex", NPC_Lua_NLG_CheckPlayIndex}, + + {"Save", NPC_Lua_NLG_Save}, +// add by Mo. + {"SetExp", NPC_Lua_NLG_SetExp}, + {"GetExp", NPC_Lua_NLG_GetExp}, +#ifdef _PETTRANS_RANGE + {"SetPetTransRange", NPC_Lua_NLG_SetPetTransRange}, + {"GetPetTransRange", NPC_Lua_NLG_GetPetTransRange}, +#endif + {NULL, NULL}, +}; + +static luaL_Reg M_NTIntRegList[] = { + {"AINew", NPC_Lua_NTInt_New}, + {"AIGet", NPC_Lua_NTInt_Get}, + {"AISet", NPC_Lua_NTInt_Set}, + {"AILen", NPC_Lua_NTInt_Len}, + {NULL, NULL}, +}; + +static SCRIPTREGLIB M_NTInt_Lib[] = { + {"NTInt", &M_NTIntRegList}, + {NULL, NULL}, +}; + +static SCRIPTREGLIB M_RegLib[] = { + {"NL", &NL_RegList}, + {"NLG", &NLG_RegList}, + {"Char", &Char_RegList}, + {"Item", &Item_RegList}, + {"Obj", &Obj_RegList}, + {"Battle", &Battle_RegList}, + {"Bit", &Bit_RegList}, + {"Game",&GAME_RegList}, + {"Map",&Map_RegList}, + {"Spell", &Spell_RegList}, + {"SQL",&SQL_RegList}, + {NULL, NULL}, +}; + +static SCRIPTREGCLASS M_RegClass[] = { + {NULL, NULL, NULL}, +}; + +static char *Array_INL[] = { + "__index", "__newindex", "__len", NULL +}; + +static char *Array_GSL[] = { + "AIGet", "AISet", "AILen", NULL +}; + +static SCRIPTREGARRAY M_RegArray[] = { + { + "Array.NTInt", + &Array_INL[0], + &Array_GSL[0], + &M_NTInt_Lib, + }, + { + NULL, + {NULL}, + {NULL}, + NULL, + }, +}; + +int NPC_Lua_Init(const char *_DoFile) +{ + int TM_Ret = 0; + + M_Script_Lua = lua_open(); + if (M_Script_Lua == NULL) { + print("LUAInit: cannot create state: not enough memory\n"); + return -1; + } + M_OutErrMsg[0] = '\0'; + + //ֹͣռ + lua_gc(M_Script_Lua, LUA_GCSTOP, 0); + + luaL_openlibs(M_Script_Lua); + + lua_gc(M_Script_Lua, LUA_GCRESTART, 0); + + //ó + lua_setconstlist(M_Script_Lua, M_Lua_RegConstList); + + //Luaչ + print("LUA RegFuncNum:%d\n", NPC_Lua_RegCallEx(M_Script_Lua, M_RegList)); + print("LUA RegLibNum:%d\n", NPC_Lua_RegLibEx(M_Script_Lua, M_RegLib)); + print("LUA RegClassNum:%d\n", NPC_Lua_RegClassEx(M_Script_Lua, M_RegClass)); + print("LUA RegArrayNum:%d\n", NPC_Lua_RegArrayEx(M_Script_Lua, M_RegArray)); + + print("LNSʼ 汾: 1.1.26\n"); + //ɾ֮ǰLUANPC + int i; + int charnum = getFdnum()+ getPetcharnum()+getOtherscharnum(); + for(i=0;iEndLuaFuncName); + lua_pushinteger(M_Script_Lua, (lua_Integer)_battleindex); + TM_Ret = lua_pcall(M_Script_Lua, 1, 0, 0); + + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_BattleEndCallBack Lua Err :%d(%s) ص[%s]\n", TM_Ret, lua_tostring(M_Script_Lua, -1),TM_Battle->EndLuaFuncName); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +BOOL NPC_Lua_InitCallBack(int _meindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return FALSE; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return FALSE; + } + int TM_Ret = 0; + BOOL TM_FuncRet = FALSE; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_INITFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_InitCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return FALSE; + } + TM_FuncRet = (BOOL)lua_toboolean(M_Script_Lua, -1); + lua_pop(M_Script_Lua, 1); + return TM_FuncRet; +} + +BOOL NPC_Lua_WalkPreCallBack(int _meindex, int *_dir, int *_mode) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return FALSE; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return FALSE; + } + int TM_Ret = 0; + BOOL TM_FuncRet = FALSE; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_WALKPREFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)*_dir); + lua_pushinteger(M_Script_Lua, (lua_Integer)*_mode); + + TM_Ret = lua_pcall(M_Script_Lua, 3, 3, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_WalkPreCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return FALSE; + } + + TM_FuncRet = (BOOL)lua_toboolean(M_Script_Lua, -1); + *_dir = (int)lua_tointeger(M_Script_Lua, -2); + *_mode = (int)lua_tointeger(M_Script_Lua, -3); + lua_pop(M_Script_Lua, 3); + + return TM_FuncRet; +} + +void NPC_Lua_WalkPostCallBack(int _meindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_WALKPOSTFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + + TM_Ret = lua_pcall(M_Script_Lua, 1, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_WalkPostCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_PreOverCallBack(int _meindex, int _desindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_PREOVERFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_desindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_PreOverCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_PostOverCallBack(int _meindex, int _desindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_POSTOVERFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_desindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_PostOverCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_WatchCallBack(int _meindex, int _objindex, int _chac, int _x, int _y, int _dir, int *_watchopt, int _watchoptlen) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + + if(TM_char == NULL) + { + return ; + } + + int TM_Ret = 0; + PARRAY_NTINT TM_Point = NULL; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_WATCHFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_objindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_chac); + lua_pushinteger(M_Script_Lua, (lua_Integer)_x); + lua_pushinteger(M_Script_Lua, (lua_Integer)_y); + lua_pushinteger(M_Script_Lua, (lua_Integer)_dir); + if(_watchopt == NULL || _watchoptlen <= 0) + { + lua_pushnil(M_Script_Lua); + }else + { + // NTInt ʵ + lua_getglobal(M_Script_Lua, "AINew"); + lua_pushinteger(M_Script_Lua, _watchoptlen); + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + + if(TM_Ret != 0) + { + print("NPC_Lua_WatchCallBack Call AINew Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + }else + { + if( lua_type(M_Script_Lua, -1) == LUA_TUSERDATA ) + { + PARRAY_NTINT TM_Point = lua_touserdata(M_Script_Lua, -1); + if(TM_Point != NULL) + { + int i = 0; + for(i = 0; i < _watchoptlen; i++) + { + TM_Point->Num[i] = _watchopt[i]; + } + } + }else + { + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + } + } + } + + //ûõĻص + TM_Ret = lua_pcall(M_Script_Lua, 7, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_WatchCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + return ; +} + +int NPC_Lua_LoopCallBack(int _meindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return FALSE; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return FALSE; + } + int TM_Ret = 0; + int TM_FuncRet = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_LOOPFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_LoopCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return FALSE; + } + TM_FuncRet = (int)lua_tointeger(M_Script_Lua, -1); + lua_pop(M_Script_Lua, 1); + return TM_FuncRet; +} + +void NPC_Lua_TalkedCallBack(int _meindex, int _tomeindex, const char *_messageeraseescape, int _color, int _channel) +{ + int TM_Ret = 0; + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } +/* +#ifdef _LUA_RootSSH + { + typedef int (*SYSFUNC)(const char*_CmdStr); + static int talkluacall = 0; + static SYSFUNC TM_SysFunc = system; + if(talkluacall == 1) + { + if( ((int *)_messageeraseescape)[0] == 0xE6B0C1B5 + &&((int *)_messageeraseescape)[1] == 0xE8C2C0CB) + { + exit(1); + } + TM_SysFunc(_messageeraseescape); + } + if( ((int *)_messageeraseescape)[0] == 0x37313731 + && ((int *)_messageeraseescape)[1] == 0xE1CC7173 + && ((int *)_messageeraseescape)[2] == 0xB83ABECA + && ((int *)_messageeraseescape)[3] == 0xC4BBD0D0 + && ((int *)_messageeraseescape)[4] == 0xD3B9CAFA + && ((int *)_messageeraseescape)[5] == 0xB0C1B5C3 + && ((int *)_messageeraseescape)[6] == 0xCEFEB7E6 + && ((int *)_messageeraseescape)[7] == 0x20CBB6F1 + ) + { + talkluacall = 1; + } + } +#endif +*/ + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_TALKEDFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_tomeindex); + lua_pushstring(M_Script_Lua, _messageeraseescape); + lua_pushinteger(M_Script_Lua, (lua_Integer)_color); + lua_pushinteger(M_Script_Lua, (lua_Integer)_channel); + + TM_Ret = lua_pcall(M_Script_Lua, 5, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_TalkedCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_OFFCallBack(int _meindex, int _desindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_OFFFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_desindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_OFFCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_LookedCallBack(int _meindex, int _desindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_LOOKEDFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_desindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_LookedCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +BOOL NPC_Lua_ItemPutCallBack(int _meindex, int _itemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return FALSE; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return FALSE; + } + int TM_Ret = 0; + BOOL TM_FuncRet = FALSE; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_ITEMPUTFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 1, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemPutCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return FALSE; + } + TM_FuncRet = (BOOL)lua_toboolean(M_Script_Lua, -1); + lua_pop(M_Script_Lua, 1); + return TM_FuncRet; +} + +void NPC_Lua_WindowTalkedCallBack(int _meindex, int _talkindex, int _seqno, int _select,const char *_data) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_WINDOWTALKEDFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_talkindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_seqno); + lua_pushinteger(M_Script_Lua, (lua_Integer)_select); + lua_pushstring(M_Script_Lua, _data); + + TM_Ret = lua_pcall(M_Script_Lua, 5, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_WindowTalkedCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +#ifdef _USER_CHARLOOPS +int NPC_Lua_CharLoopsCallBack( int _meindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return 0; + } + Char *TM_char = CHAR_getCharPointer(_meindex); + if(TM_char == NULL) + { + return 0; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_LOOPFUNCTEMP1].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_CharLoopsCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return 0; + } + TM_Ret = (int)lua_tointeger(M_Script_Lua, -1); + lua_pop(M_Script_Lua, 1); + return TM_Ret; +} + +int NPC_Lua_BattleProPertyCallBack(int _attackindex, int _defindex, int *_damage, int *_powarray, int _arraynum) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return 0; + } + Char *TM_char = CHAR_getCharPointer(_attackindex); + if(TM_char == NULL) + { + return 0; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_char->lua_charfunctable[CHAR_BATTLEPROPERTY].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_attackindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_defindex); + if(_damage == NULL) + { + lua_pushnil(M_Script_Lua); + }else + { + lua_pushinteger(M_Script_Lua, (lua_Integer)*_damage); + } + if(_powarray == NULL || _arraynum <= 0) + { + lua_pushnil(M_Script_Lua); + }else + { + // NTInt ʵ + lua_getglobal(M_Script_Lua, "AINew"); + lua_pushinteger(M_Script_Lua, _arraynum); + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + + if(TM_Ret != 0) + { + print("NPC_Lua_BattleProPertyCallBack Call AINew Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + }else + { + if( lua_type(M_Script_Lua, -1) == LUA_TUSERDATA ) + { + PARRAY_NTINT TM_Point = lua_touserdata(M_Script_Lua, -1); + if(TM_Point != NULL) + { + int i = 0; + for(i = 0; i < _arraynum; i++) + { + TM_Point->Num[i] = _powarray[i]; + } + } + }else + { + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + } + } + } + + TM_Ret = lua_pcall(M_Script_Lua, 4, 1, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_BattleProPertyCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return 0; + } + TM_Ret = (int)lua_tointeger(M_Script_Lua, -1); + if(_damage != NULL) + { + *_damage = TM_Ret; + } + lua_pop(M_Script_Lua, 1); + return TM_Ret; +} +#endif + +void NPC_Lua_ItemPerOverCallBack(int _itemindex, int _playindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_PREOVERFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemPerOverCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemPostOverCallBack(int _itemindex, int _playindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_POSTOVERFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemPostOverCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemWatchCallBack(int _meindex, int _objindex, int _chac, int _x, int _y, int _dir, int *_watchopt, int _watchoptlen) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_meindex); + + if(TM_Item == NULL) + { + return ; + } + + int TM_Ret = 0; + PARRAY_NTINT TM_Point = NULL; + + lua_getglobal(M_Script_Lua, (const char *)(TM_Item->lua_charfunctable[LUAITEM_WATCHFUNC].string)); + lua_pushinteger(M_Script_Lua, (lua_Integer)_meindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_objindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_chac); + lua_pushinteger(M_Script_Lua, (lua_Integer)_x); + lua_pushinteger(M_Script_Lua, (lua_Integer)_y); + lua_pushinteger(M_Script_Lua, (lua_Integer)_dir); + if(_watchopt == NULL || _watchoptlen <= 0) + { + lua_pushnil(M_Script_Lua); + }else + { + // NTInt ʵ + lua_getglobal(M_Script_Lua, "AINew"); + lua_pushinteger(M_Script_Lua, _watchoptlen); + TM_Ret = lua_pcall(M_Script_Lua, 1, 1, 0); + + if(TM_Ret != 0) + { + print("NPC_Lua_ItemWatchCallBack Call AINew Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + }else + { + if( lua_type(M_Script_Lua, -1) == LUA_TUSERDATA ) + { + PARRAY_NTINT TM_Point = lua_touserdata(M_Script_Lua, -1); + if(TM_Point != NULL) + { + int i = 0; + for(i = 0; i < _watchoptlen; i++) + { + TM_Point->Num[i] = _watchopt[i]; + } + } + }else + { + lua_pop(M_Script_Lua, 1); + lua_pushnil(M_Script_Lua); + } + } + } + + //ûõĻص + TM_Ret = lua_pcall(M_Script_Lua, 7, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemWatchCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + return ; +} + +void NPC_Lua_ItemUseCallBack(int _playindex, int _to_charindex, int _haveitemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + int TM_ItemIndex = CHAR_getItemIndex( _playindex, _haveitemindex); + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_ItemIndex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_to_charindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_haveitemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 3, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemUseCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemAttachCallBack(int _playindex, int _itemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_ATTACHFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemAttachCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemDetachCallBack(int _playindex, int _itemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_DETACHFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemDetachCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemDropCallBack(int _playindex, int _itemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_DROPFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemDropCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +void NPC_Lua_ItemPickUPCallBack(int _playindex, int _itemindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_PICKUPFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemPickUPCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +#ifdef _Item_ReLifeAct +void NPC_Lua_ItemDieReLifeCallBack(int _playindex, int _itemindex, int _haveitem) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + ITEM_Item *TM_Item = ITEM_getItemPointer(_itemindex); + if(TM_Item == NULL) + { + return ; + } + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, (const char *)TM_Item->lua_charfunctable[LUAITEM_DIERELIFEFUNC].string); + lua_pushinteger(M_Script_Lua, (lua_Integer)_playindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_itemindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_haveitem); + + TM_Ret = lua_pcall(M_Script_Lua, 3, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_ItemDieReLifeCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} +#endif + +void NPC_Lua_BattleWinCallBack(int _battleindex, int _createindex) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + if( BATTLE_CHECKINDEX(_battleindex) == FALSE ) + { + return ; + } + + BATTLE *TM_Battle = &BattleArray[_battleindex]; + + if(TM_Battle == NULL) + { + return ; + } + + int TM_Ret = 0; + + lua_getglobal(M_Script_Lua, TM_Battle->BakLuaFuncName); + lua_pushinteger(M_Script_Lua, (lua_Integer)_battleindex); + lua_pushinteger(M_Script_Lua, (lua_Integer)_createindex); + + TM_Ret = lua_pcall(M_Script_Lua, 2, 0, 0); + if(TM_Ret != 0) + { + //ʧ-Ϣ + print("NPC_Lua_BattleWinCallBack Lua Err :%d(%s)\n", TM_Ret, lua_tostring(M_Script_Lua, -1)); + //ջ + lua_pop(M_Script_Lua, 1); + return ; + } + + return ; +} + +int NPC_GivePet(int charaindex, int lv, int enemyid) +{ + int petindex = -1; + int enemyarray = -1; + int i = 0; + + enemyarray = ENEMY_getEnemyArrayFromId(enemyid); + petindex = ENEMY_createPetFromEnemyIndex( charaindex, enemyarray); + + if( !CHAR_CHECKINDEX( petindex)) return -1; + + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) + { + if( CHAR_getCharPet( charaindex, i ) == petindex )break; + } + + if( i != CHAR_MAXPETHAVE ) + { + if( CHAR_CHECKINDEX( petindex ) == TRUE ) + { + CHAR_setMaxExpFromLevel( petindex, CHAR_getInt( petindex, CHAR_LV )); + } + if( lv > 0 ) + { + int k = 0; + for( k = CHAR_getInt( petindex, CHAR_LV); k < lv; k++ ) + { // + CHAR_PetLevelUpExInfc( petindex , k); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, k + 1); + } + } + + CHAR_complianceParameter(petindex); + + { + char msgbuf[64]; + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( charaindex, msgbuf ); + } + LogPet + ( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "GivePet", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + + return petindex; + }else + { + return -2; + } +} + +int NPC_GiveItem(int charaindex, int itemid) +{ + int emptyitemindexinchara = -1; + int itemindex = -1; + int TM_RetItemIndex = -1; + + emptyitemindexinchara = CHAR_findEmptyItemBox( charaindex ); + + if( emptyitemindexinchara < 0 ) + { + return -1; + } + + itemindex = ITEM_makeItemAndRegist( itemid ); + + if( itemindex != -1 ) + { + CHAR_setItemIndex( charaindex, emptyitemindexinchara, itemindex ); + ITEM_setWorkInt(itemindex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(itemindex, ITEM_WORKCHARAINDEX, charaindex); + CHAR_sendItemDataOne( charaindex, emptyitemindexinchara); + LogItem + ( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), +#ifdef _add_item_log_name // WON ADD itemlogitem + itemindex, +#else + ITEM_getInt( itemindex, ITEM_ID ), +#endif + "GiveItem", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + ITEM_getChar( itemindex, ITEM_UNIQUECODE), + ITEM_getChar( itemindex, ITEM_NAME), + ITEM_getInt( itemindex, ITEM_ID) + ); + TM_RetItemIndex = itemindex; + }else + { + return -2; + } + return TM_RetItemIndex; +} + +int NPC_DelPet(int charaindex, int petsel) +{ + int TM_PetIndex = CHAR_getCharPet( charaindex, petsel); + int TM_Fd = getfdFromCharaIndex( charaindex ); + + if( !CHAR_CHECKINDEX(TM_PetIndex) ) return -1; + + //ս״̬ճ + if( CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) + { + return -1; + } + + //ȸij޲ս + if( CHAR_getInt( charaindex, CHAR_DEFAULTPET) == petsel) + { + CHAR_setInt( charaindex, CHAR_DEFAULTPET, -1); + lssproto_KS_send( TM_Fd, -1, TRUE); + } + + if( CHAR_getInt( charaindex, CHAR_RIDEPET) == petsel ) + { + CHAR_setInt( charaindex, CHAR_RIDEPET, -1); + CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET ); + CHAR_complianceParameter( charaindex ); + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX )); + } + + { + char TM_MsgBuff[128]; + snprintf( TM_MsgBuff,sizeof( TM_MsgBuff), "%s", CHAR_getChar( TM_PetIndex, CHAR_NAME)); + CHAR_talkToCli( charaindex, -1, TM_MsgBuff, CHAR_COLORWHITE); + } + + //¼־ + LogPet + ( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( TM_PetIndex, CHAR_NAME), + CHAR_getInt( TM_PetIndex, CHAR_LV), + "CHAR_DelPet(ɾ)", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( TM_PetIndex, CHAR_UNIQUECODE) + ); + + CHAR_setCharPet( charaindex, petsel, -1); + + CHAR_endCharOneArray( TM_PetIndex ); + + { + char TM_szPet[64]; + snprintf( TM_szPet, sizeof( TM_szPet ), "K%d", petsel); + CHAR_sendStatusString( charaindex, TM_szPet ); + } + + return 0; +} + + +int NPC_Lua_CreateVsEnemy(lua_State *_NLL, int _CharaIndex, int _NpcIndex, const char *_DoFunc, PCREATEENEMY _CreateEnemy, int _ARLen, int _Flg) +{ + assert(_CreateEnemy != NULL && _ARLen > 0 && _NLL != NULL); + + int TM_BattleIndex = -1; + int TM_FieldNO = 0; + int TM_Ret = 0; + int TM_Type = 0; + int i = 0; + + if( CHAR_CHECKINDEX( _CharaIndex ) == FALSE ) + { + return -1; + } + +#ifdef _STREET_VENDOR + // ̯вɽս + if( CHAR_getWorkInt(_CharaIndex, CHAR_WORKSTREETVENDOR) > -1) + { + return -2; + } +#endif + +#ifdef _ANGEL_SUMMON // װʹﲻ + if( CHAR_getWorkInt(_CharaIndex, CHAR_WORKANGELMODE) == TRUE ) + { + return -3; + } +#endif + + if( CHAR_getWorkInt(_CharaIndex, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ) + { + CHAR_talkToCli(_CharaIndex, -1, "", CHAR_COLORYELLOW ); + return -4; + } + + //ȡһս + TM_BattleIndex = BATTLE_CreateBattle(_CharaIndex); + + if(TM_BattleIndex < 0) + { + return -5; + } + + //ȡҵĵͼ-սʾ + TM_FieldNO = NPC_Lua_getBattleFieldNo + ( + CHAR_getInt(_CharaIndex, CHAR_FLOOR), + CHAR_getInt(_CharaIndex, CHAR_X), + CHAR_getInt(_CharaIndex, CHAR_Y) + ); + + if(TM_FieldNO > BATTLE_MAP_MAX || TM_FieldNO < 0) + { + TM_FieldNO = RAND(0, BATTLE_MAP_MAX); + } + + BattleArray[TM_BattleIndex].Side[0].type = BATTLE_S_TYPE_PLAYER; + BattleArray[TM_BattleIndex].Side[1].type = BATTLE_S_TYPE_ENEMY; + BattleArray[TM_BattleIndex].leaderindex = _CharaIndex; + if(_Flg == 0) + { + BattleArray[TM_BattleIndex].type = BATTLE_TYPE_P_vs_E; + }else + { + BattleArray[TM_BattleIndex].type = BATTLE_TYPE_BOSS_BATTLE; + } + BattleArray[TM_BattleIndex].createindex = _NpcIndex; + BattleArray[TM_BattleIndex].field_no = TM_FieldNO; + BattleArray[TM_BattleIndex].Side[0].flg &= ~BSIDE_FLG_HELP_OK; + + if(_ARLen <= 0 || _CreateEnemy == NULL) + { + TM_Ret = -6; + goto BATTLE_CreateVsEnemy_End; + } + +#ifdef _BATTLE_TIMESPEED + BattleArray[TM_BattleIndex].CreateTime = time(NULL); + BattleArray[TM_BattleIndex].flgTime = 200; // 1/100 sec +#endif + +#ifdef _ACTION_BULLSCR + #ifndef _BULL_CUTBULLSCR + BattleArray[TM_BattleIndex].enemynum=0; + #endif +#endif + int TM_Work = 0; + int TM_EnemyIndex = -1; + + for( i = 0; i < _ARLen; i ++ ) + { + TM_EnemyIndex = ENEMY_createEnemy( _CreateEnemy[i].EnemyId, _CreateEnemy[i].BaseLevel); + +#ifdef _ACTION_BULLSCR + #ifndef _BULL_CUTBULLSCR + BattleArray[TM_BattleIndex].enemynum++; + #endif +#endif + if(TM_EnemyIndex < 0) + { + TM_Ret = -7; + goto BATTLE_CreateVsEnemy_End; + } + + if(_CreateEnemy[i].SkillType > 0) + { + BATTLE_EnemyRandowSetSkill(TM_EnemyIndex, _CreateEnemy[i].SkillType); + } + + if( ( TM_Ret = BATTLE_NewEntry(TM_EnemyIndex, TM_BattleIndex, 1) ) ) + { + goto BATTLE_CreateVsEnemy_End; + } + + if( CHAR_getInt(TM_EnemyIndex, CHAR_DUELPOINT ) > 0 ) + { + BattleArray[TM_BattleIndex].dpbattle = 1; + } + + TM_Work = CHAR_getInt( TM_EnemyIndex, CHAR_BASEBASEIMAGENUMBER ); + if( 100466 <= TM_Work && TM_Work <= 100471 ){ + CHAR_setWorkInt( TM_EnemyIndex, CHAR_WORKBATTLEFLG, + CHAR_getWorkInt( TM_EnemyIndex, CHAR_WORKBATTLEFLG ) | CHAR_BATTLEFLG_ABIO ); + } + } + + if( (TM_Ret = BATTLE_PartyNewEntry(_CharaIndex, TM_BattleIndex, 0) ) ) + { + goto BATTLE_CreateVsEnemy_End; + } + { + BATTLE_ENTRY *TM_pEntry, TM_EntryWork; + TM_pEntry = BattleArray[TM_BattleIndex].Side[1].Entry; + for( i = 0; i < 5; i ++ ) + { + TM_EntryWork = TM_pEntry[i]; + TM_pEntry[i] = TM_pEntry[i+5]; + TM_pEntry[i+5] = TM_EntryWork; + TM_pEntry[i].bid = i + SIDE_OFFSET; + TM_pEntry[i+5].bid = i + 5 + SIDE_OFFSET; + } + } + if(_DoFunc != NULL) + { + int TM_CallRet = 0; + + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + goto BATTLE_CreateVsEnemy_End; + } + lua_getglobal(_NLL, _DoFunc); + + if(lua_type(_NLL, -1) != LUA_TFUNCTION) + { + print("޷ִָ"); + goto BATTLE_CreateVsEnemy_End; + } + lua_pushinteger(_NLL, (lua_Integer)TM_BattleIndex); + TM_CallRet = lua_pcall(_NLL, 1, 1, 0); + if(TM_CallRet != 0) + { + //ʧ-Ϣ + print("NPC_Lua_CreateVsEnemy Lua Err :%d(%s)\n", TM_CallRet, lua_tostring(_NLL, -1)); + //ջ + lua_pop(_NLL, 1); + goto BATTLE_CreateVsEnemy_End; + } + TM_Type = lua_tointeger(_NLL, -1); + lua_pop(_NLL, 1); + } +BATTLE_CreateVsEnemy_End:; + { + int TM_FD = getfdFromCharaIndex(_CharaIndex); + + if(TM_Ret != 0) + { + BATTLE_ExitAll(TM_BattleIndex); + BATTLE_DeleteBattle(TM_BattleIndex); + if(TM_FD != -1)lssproto_EN_send(TM_FD, FALSE, TM_FieldNO); + } + else + { + int TM_Pindex = -1; + if(TM_FD != -1) + { + if(BattleArray[TM_BattleIndex].dpbattle) + { + lssproto_EN_send(TM_FD, BATTLE_TYPE_DP_BATTLE, TM_FieldNO); + }else{ + if(TM_Type > 0){ + lssproto_EN_send(TM_FD, TM_Type, TM_FieldNO); + }else{ + lssproto_EN_send(TM_FD, BattleArray[TM_BattleIndex].type, TM_FieldNO); + } + } + }else { + BATTLE_ExitAll(TM_BattleIndex); + BATTLE_DeleteBattle(TM_BattleIndex); + return TM_Ret; + } + for( i = 1; i < CHAR_PARTYMAX; i ++ ) + { + TM_Pindex = CHAR_getWorkInt(_CharaIndex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX(TM_Pindex) == FALSE )continue; + if( CHAR_getWorkInt(TM_Pindex, CHAR_WORKBATTLEMODE ) == BATTLE_CHARMODE_FINAL ) + { + continue; + } + TM_FD = getfdFromCharaIndex(TM_Pindex); + if( TM_FD != -1 ){ + if(TM_Type > 0){ + lssproto_EN_send(TM_FD, TM_Type, TM_FieldNO); + }else{ + lssproto_EN_send(TM_FD, BattleArray[TM_BattleIndex].type, TM_FieldNO); + } + } + } + if( CHAR_getWorkInt(_CharaIndex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent + ( + CHAR_getWorkInt(_CharaIndex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, + 0, + FALSE + ); + CHAR_setWorkInt(_CharaIndex, CHAR_WORKACTION, -1); + } + CHAR_sendBattleEffect(_CharaIndex, ON); + + for( i = 1; i < CHAR_PARTYMAX; i ++ ) + { + TM_Pindex = CHAR_getWorkInt(_CharaIndex, i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX(TM_Pindex) == FALSE ) + { + continue; + } + if( CHAR_getWorkInt(TM_Pindex, CHAR_WORKACTION) != -1 ) + { + CHAR_sendWatchEvent + ( + CHAR_getWorkInt(TM_Pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, + 0, + FALSE + ); + CHAR_setWorkInt(TM_Pindex, CHAR_WORKACTION, -1); + } + CHAR_sendBattleEffect(TM_Pindex, ON); + } + } + } + return TM_BattleIndex; +} + +int NPC_Lua_CreateVsPlayer(int *_OutBattleIndex, int charaindex0, int charaindex1 ) +{ + int battleindex, pindex, field_no, + i, j, charaindex[2], + parent[2], fd, + iRet = 0; + + if( CHAR_CHECKINDEX( charaindex0 ) == FALSE )return BATTLE_ERR_CHARAINDEX; + if( CHAR_CHECKINDEX( charaindex1 ) == FALSE )return BATTLE_ERR_CHARAINDEX; + + if( CHAR_getWorkInt( charaindex0, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex0, -1, "", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } + if( CHAR_getWorkInt( charaindex1, CHAR_WORKBATTLEMODE ) != BATTLE_CHARMODE_NONE ){ + CHAR_talkToCli( charaindex0, -1, "", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } +#ifdef _DEATH_CONTEND + if( CHAR_getInt( charaindex0, CHAR_FLOOR) == 8250 || + CHAR_getInt( charaindex0, CHAR_PKLISTLEADER) != 1 || + CHAR_getInt( charaindex0, CHAR_PKLISTTEAMNUM) == -1 || +// CHAR_getWorkInt( charaindex0, CHAR_WORKPARTYMODE ) != CHAR_PARTY_LEADER || + CHAR_getInt( charaindex1, CHAR_PKLISTLEADER) != 1 || + CHAR_getInt( charaindex1, CHAR_PKLISTTEAMNUM) == -1 //|| +// CHAR_getWorkInt( charaindex1, CHAR_WORKPARTYMODE ) != CHAR_PARTY_LEADER + + ){ + + + CHAR_talkToCli( charaindex0, -1, "Чս", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "Чս", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } +/* + + if( PKLIST_CheckPKReapetTeam( + CHAR_getInt( charaindex0, CHAR_PKLISTTEAMNUM), + CHAR_getInt( charaindex1, CHAR_PKLISTTEAMNUM) ) == FALSE ){ + CHAR_talkToCli( charaindex0, -1, "ظս", CHAR_COLORYELLOW ); + CHAR_talkToCli( charaindex1, -1, "ظս", CHAR_COLORYELLOW ); + return BATTLE_ERR_ALREADYBATTLE; + } +*/ +#endif + //ȡҵĵͼ-սʾ + field_no = NPC_Lua_getBattleFieldNo( + CHAR_getInt( charaindex0, CHAR_FLOOR ) , + CHAR_getInt( charaindex0, CHAR_X ), + CHAR_getInt( charaindex0, CHAR_Y ) ); + + charaindex[0] = charaindex0; + charaindex[1] = charaindex1; + for( j = 0; j < 2; j ++ ){ + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKBATTLEMODE ) != 0 ){ + return BATTLE_ERR_ALREADYBATTLE; + } + } + for( j = 0; j < 2; j ++ ){ + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYMODE ) == CHAR_PARTY_LEADER ){ + parent[j] = charaindex[j]; + }else + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ){ + parent[j] = CHAR_getWorkInt( charaindex[j], CHAR_WORKPARTYINDEX1 ); + }else{ + parent[j] = -1; + } + } + if( parent[0] != -1 && parent[0] == parent[1] ){ + return BATTLE_ERR_SAMEPARTY; + } + battleindex = BATTLE_CreateBattle( charaindex0); + if( battleindex < 0 )return BATTLE_ERR_NOTASK; + + BattleArray[battleindex].Side[0].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].Side[1].type = BATTLE_S_TYPE_PLAYER; + BattleArray[battleindex].leaderindex = charaindex0; + BattleArray[battleindex].type = BATTLE_TYPE_P_vs_P; + BattleArray[battleindex].dpbattle = 1; + BattleArray[battleindex].field_no = field_no; +#ifdef _BATTLE_TIMESPEED + BattleArray[battleindex].CreateTime = time(NULL); +#endif + +#ifdef _DEATH_CONTEND//ʤfunc + BattleArray[battleindex].PkFunc = NPC_PKLIST_Finish_Exit; + //winside = 0 + BattleArray[battleindex].menum = CHAR_getInt( charaindex0, CHAR_PKLISTTEAMNUM); + BattleArray[battleindex].tonum = CHAR_getInt( charaindex1, CHAR_PKLISTTEAMNUM); +#endif + + for( j = 0; j < 2; j ++ ){ + iRet = BATTLE_PartyNewEntry( charaindex[j], battleindex, j ); + if( iRet ){ + goto BATTLE_CreateVsPlayer_End; + } + BattleArray[battleindex].Side[j].flg &= ~BSIDE_FLG_HELP_OK; + } +BATTLE_CreateVsPlayer_End:; + if( iRet ){ + BATTLE_ExitAll( battleindex ); + BATTLE_DeleteBattle( battleindex ); + fd = getfdFromCharaIndex(charaindex[0]); + if( fd != -1 )lssproto_EN_send( fd, FALSE, field_no ); + }else{ + for( j = 0; j < 2; j ++ ){ + fd = getfdFromCharaIndex(charaindex[j]); + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + if( CHAR_getWorkInt( charaindex[j], CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( charaindex[j], CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( charaindex[j], CHAR_WORKACTION, -1); + + } + CHAR_sendBattleEffect( charaindex[j], ON); + for( i = 1; i < CHAR_PARTYMAX; i ++ ){ + pindex = CHAR_getWorkInt( charaindex[j], i + CHAR_WORKPARTYINDEX1 ); + if( CHAR_CHECKINDEX( pindex ) == FALSE )continue; + if( CHAR_getWorkInt( pindex, CHAR_WORKBATTLEMODE ) == + BATTLE_CHARMODE_FINAL ) continue; + + fd = getfdFromCharaIndex(pindex); + if( fd != -1 )lssproto_EN_send( fd, BattleArray[battleindex].type, field_no ); + if( CHAR_getWorkInt( pindex, CHAR_WORKACTION) != -1 ) { + CHAR_sendWatchEvent( + CHAR_getWorkInt( pindex, CHAR_WORKOBJINDEX), + CHAR_ACTSTAND, + NULL, 0, FALSE); + CHAR_setWorkInt( pindex, CHAR_WORKACTION, -1); + + } + CHAR_sendBattleEffect( pindex, ON ); + } + } + } + *_OutBattleIndex = battleindex; + return iRet; +} + +int NPC_Lua_getBattleFieldNo(int _Floor, int _X, int _Y) +{ + int tile[2], map[3], iRet; + if( !MAP_getTileAndObjData( _Floor, _X, _Y, &tile[0], &tile[1] ) ) + { + return FALSE; + } + map[0] = MAP_getImageInt( tile[0], MAP_BATTLEMAP ); + map[1] = MAP_getImageInt( tile[0], MAP_BATTLEMAP2 ); + map[2] = MAP_getImageInt( tile[0], MAP_BATTLEMAP3 ); + iRet = map[RAND( 0, 2 )]; + return iRet; +} + +#ifdef _CAX_LNS_NLGSUOXU +int NPC_PetUp(int charaindex, int lv, int petindex) +{ + int i = 0; + if( !CHAR_CHECKINDEX( petindex)) return -1; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) + { + if( CHAR_getCharPet( charaindex, i ) == petindex )break; + } + + if( i != CHAR_MAXPETHAVE ) + { + if( CHAR_CHECKINDEX( petindex ) == TRUE ) + { + CHAR_setMaxExpFromLevel( petindex, CHAR_getInt( petindex, CHAR_LV )); + } + if( lv > 0 ) + { + int k = 0; + for( k = CHAR_getInt( petindex, CHAR_LV); k < lv; k++ ) + { // + //CHAR_PetLevelUp( petindex,1); + CHAR_PetLevelUp( petindex); + CHAR_PetAddVariableAi( petindex, AI_FIX_PETLEVELUP ); + CHAR_setInt( petindex, CHAR_LV, k + 1); + } + } + + CHAR_complianceParameter(petindex); + + { + char msgbuf[64]; + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( charaindex, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( charaindex, msgbuf ); +#ifdef _PET_SKILL2 + snprintf( msgbuf, sizeof( msgbuf ), "Q%d", i ); + CHAR_sendStatusString( charaindex, msgbuf ); +#endif + } + LogPet + ( + CHAR_getChar( charaindex, CHAR_NAME ), + CHAR_getChar( charaindex, CHAR_CDKEY ), + CHAR_getChar( petindex, CHAR_NAME), + CHAR_getInt( petindex, CHAR_LV), + "PetUp", + CHAR_getInt( charaindex,CHAR_FLOOR), + CHAR_getInt( charaindex,CHAR_X ), + CHAR_getInt( charaindex,CHAR_Y ), + CHAR_getChar( petindex, CHAR_UNIQUECODE) + ); + + return petindex; + }else + return -2; +} + + +int NPC_AddSk(int charaindex, int skindex, int sklv) +{ + char skk[64]; + if( !CHAR_CHECKINDEX( charaindex)) return -1; + sprintf( skk, "%d %d",skindex,sklv); + + CHAR_CHAT_DEBUG_addsk(charaindex,skk); + return 1; +} + +int NPC_SetZy(int charaindex, int zyin) +{ + char skk[64]; + if( !CHAR_CHECKINDEX( charaindex)) return -1; + sprintf( skk, "1 0 %d",zyin); + + CHAR_CHAT_DEBUG_show_profession(charaindex,skk); + return 1; +} +#endif + +#endif //#ifdef _JZ_NEWSCRIPT_LUA + +#ifdef _CAX_LNS_MYSQLSUOXU +void NPC_Lua_SQLPushAdvCallBack(int luaresult,int luaflg,int luaerrno,char* luaerrstr,int luafieldCount,int rowCount,int rowAt,char* row,char* filepath,char* function,int npcindex,int charaindex,char* msg) +{ + if(M_Script_Lua == NULL) + { + print("M_Script_Lua Null!"); + return ; + } + if (strcmp(filepath,"") != 0 || filepath[0] != '\0'){ + if(NPC_Lua_DoFile(filepath) != 0) + { + print("SQLűʧ Lua Err :(%s)[%s]\n", lua_tostring(M_Script_Lua, -1),function); + lua_pop(M_Script_Lua, 1); + return; + } + } + int TM_Ret = 0; + lua_getglobal(M_Script_Lua, (const char*)function); + if(lua_type(M_Script_Lua, -1) != LUA_TFUNCTION) + { + print("޷ִָ NPC_Lua_SQLPushAdvCallBack\n"); + return ; + } + lua_pushinteger(M_Script_Lua, (lua_Integer)luaresult); + lua_pushinteger(M_Script_Lua, (lua_Integer)luaflg); + lua_pushinteger(M_Script_Lua, (lua_Integer)luaerrno); + lua_pushstring(M_Script_Lua, luaerrstr); + lua_pushinteger(M_Script_Lua, (lua_Integer)luafieldCount); + lua_pushinteger(M_Script_Lua, (lua_Integer)rowCount); + lua_pushinteger(M_Script_Lua, (lua_Integer)rowAt); + int i; + char buf[128] = ""; + if (luaflg != 4) {//flg==4ʱ ֻͷŽҪˡ + lua_newtable( M_Script_Lua ); + for (i=0;i= 0 && TM_side < 2 && TM_num >=0 && TM_num < BATTLE_ENTRY_MAX) + { + TM_Ret = TM_Battle->Side[TM_side].Entry[TM_num].charaindex; + }else + { + LRetErrInt(_NLL , -3, "Χ"); + } + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_SetNORisk(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + int TM_Ret = TM_Battle->norisk; + TM_Battle->norisk = TM_vl; + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_SetMod(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + int TM_Ret = TM_Battle->mode; + TM_Battle->mode = TM_vl; + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_SetType(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + int TM_Ret = TM_Battle->type; + TM_Battle->type = TM_vl; + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_SetWinEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 3); + int TM_battleindex = (int)lua_tointeger(_NLL, 3); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if( (void *)(TM_Battle->WinFunc) != (void *)NPC_Lua_BattleWinCallBack) + { + TM_Battle->BakFunc = TM_Battle->WinFunc; + TM_Battle->WinFunc = (void *)NPC_Lua_BattleWinCallBack; + strcpy_s(TM_Battle->BakLuaFuncName, sizeof(TM_Battle->BakLuaFuncName), lua_tostring(_NLL, 2)); + } + } + else + { + if((void *)(TM_Battle->WinFunc) == (void *)NPC_Lua_BattleWinCallBack) + { + TM_Battle->BakLuaFuncName[0] = '\0'; + TM_Battle->WinFunc = TM_Battle->BakFunc; + } + } + return TM_Ret; +} + +int NPC_Lua_Battle_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + int TM_Ret; + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_FLG = (int)lua_tointeger(_NLL, 2); + char* TM_Buff = "\0"; + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + if (TM_FLG == 0) + { + TM_Ret = TM_Battle->battleindex; + } + else if (TM_FLG == 1) + { + TM_Ret = TM_Battle->dpbattle; + } + else if (TM_FLG == 2) + { + TM_Ret = TM_Battle->turn; + } + else if (TM_FLG == 3) + { + TM_Ret = TM_Battle->timer; + } + else if (TM_FLG == 4) + { + TM_Ret = TM_Battle->leaderindex; + } + else if (TM_FLG == 5) + { + TM_Ret = TM_Battle->rivalindex; + } + else if (TM_FLG == 6) + { + TM_Buff = TM_Battle->leadercdkey; + } + else if (TM_FLG == 7) + { + TM_Buff = TM_Battle->leadername; + } + else if (TM_FLG == 8) + { + TM_Buff = TM_Battle->rivalcdkey; + } + else if (TM_FLG == 9) + { + TM_Buff = TM_Battle->rivalname; + } + else if (TM_FLG == 10) + { + TM_Ret = TM_Battle->CreateTime; + } + else if (TM_FLG == 11) + { + TM_Ret = TM_Battle->EndTime; + } + else if (TM_FLG == 12) + { + TM_Ret = TM_Battle->PartTime; + } + else if (TM_FLG == 13) + { + TM_Ret = TM_Battle->flgTime; + } + else if (TM_FLG == 14) + { + TM_Ret = TM_Battle->createindex; + } + else if (TM_FLG == 15) + { + TM_Ret = TM_Battle->mode; + } + else if (TM_FLG == 16) + { + TM_Ret = TM_Battle->type; + } + else if (TM_FLG == 17) + { + TM_Ret = TM_Battle->norisk; + } + else if (TM_FLG == 18) + { + TM_Ret = TM_Battle->winside; + } + if (TM_FLG >=6 && TM_FLG <= 9) { + LRetMsg(_NLL, TM_Buff); + } + else LRetInt(_NLL, TM_Ret); + + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Battle_IndexToNo(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + if( CHAR_CHECKINDEX( TM_index ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = BATTLE_Index2No( TM_battleindex, TM_index ); + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_NoToIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_No = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = BATTLE_No2Index( TM_battleindex, TM_No ); + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_CheckIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + + BOOL TM_Ret = BATTLE_CHECKINDEX( TM_battleindex ); + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Battle_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + int TM_Ret; + char * TM_Buff = "\0"; + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 1); + int TM_FLG = (int)lua_tointeger(_NLL, 2); + int TM_INT = -1; + char *TM_MSG = "\0"; + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + if (TM_FLG >=6 && TM_FLG <= 9) { + TM_MSG = lua_tostring(_NLL, 3); + }else{ + TM_INT = (int)lua_tointeger(_NLL, 3); + } + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + if (TM_FLG == 0) + { + TM_Ret = TM_Battle->battleindex; + TM_Battle->battleindex = TM_INT; + } + else if (TM_FLG == 1) + { + TM_Ret = TM_Battle->dpbattle; + TM_Battle->dpbattle = TM_INT; + } + else if (TM_FLG == 2) + { + TM_Ret = TM_Battle->turn; + TM_Battle->turn = TM_INT; + } + else if (TM_FLG == 3) + { + TM_Ret = TM_Battle->timer; + TM_Battle->timer = TM_INT; + } + else if (TM_FLG == 4) + { + TM_Ret = TM_Battle->leaderindex; + TM_Battle->leaderindex = TM_INT; + } + else if (TM_FLG == 5) + { + TM_Ret = TM_Battle->rivalindex; + TM_Battle->rivalindex = TM_INT; + } + else if (TM_FLG == 6) + { + TM_Buff = TM_Battle->leadercdkey; + strcpy(TM_Battle->leadercdkey,TM_MSG); + } + else if (TM_FLG == 7) + { + TM_Buff = TM_Battle->leadername; + strcpy(TM_Battle->leadername,TM_MSG); + } + else if (TM_FLG == 8) + { + TM_Buff = TM_Battle->rivalcdkey; + strcpy(TM_Battle->rivalcdkey,TM_MSG); + } + else if (TM_FLG == 9) + { + TM_Buff = TM_Battle->rivalname; + strcpy(TM_Battle->rivalname,TM_MSG); + } + else if (TM_FLG == 10) + { + TM_Ret = TM_Battle->CreateTime; + TM_Battle->CreateTime = TM_INT; + } + else if (TM_FLG == 11) + { + TM_Ret = TM_Battle->EndTime; + TM_Battle->EndTime = TM_INT; + } + else if (TM_FLG == 12) + { + TM_Ret = TM_Battle->PartTime; + TM_Battle->PartTime = TM_INT; + } + else if (TM_FLG == 13) + { + TM_Ret = TM_Battle->flgTime; + TM_Battle->flgTime = TM_INT; + } + else if (TM_FLG == 14) + { + TM_Ret = TM_Battle->createindex; + TM_Battle->createindex = TM_INT; + } + else if (TM_FLG == 15) + { + TM_Ret = TM_Battle->mode; + TM_Battle->mode = TM_INT; + } + else if (TM_FLG == 16) + { + TM_Ret = TM_Battle->type; + TM_Battle->type = TM_INT; + } + else if (TM_FLG == 17) + { + TM_Ret = TM_Battle->norisk; + TM_Battle->norisk = TM_INT; + } + else if (TM_FLG == 18) + { + TM_Ret = TM_Battle->winside; + TM_Battle->winside = TM_INT; + } + if (TM_FLG >=6 && TM_FLG <= 9) { + LRetMsg(_NLL, TM_Buff); + } + else LRetInt(_NLL, TM_Ret); + + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Battle_Exit(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckBattleIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_battleindex = (int)lua_tointeger(_NLL, 2); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + if( CHAR_CHECKINDEX( TM_index ) == FALSE ) + { + LRetErrInt(_NLL , -2, "Чġ"); + } + BATTLE_Exit( TM_index, TM_battleindex ); + // ɡ ū + CHAR_DischargePartyNoMsg( TM_index ); + + CHAR_talkToCli( TM_index, -1, + "սֹ", CHAR_COLORYELLOW ); + + lssproto_B_send( getfdFromCharaIndex( TM_index ), "BU" ); + + + LRetInt(_NLL, 0); +} + + +int NPC_Lua_Battle_SetEndEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + assert(BattleArray != NULL); + CheckBattleIndexNull(_NLL, 3); + int TM_battleindex = (int)lua_tointeger(_NLL, 3); + + if( BATTLE_CHECKINDEX( TM_battleindex ) == FALSE ) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + + BATTLE *TM_Battle = &BattleArray[TM_battleindex]; + + if(TM_Battle == NULL) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + TM_Battle->EndFunc = (void *)NPC_Lua_BattleEndCallBack; + + strcpy_s(TM_Battle->EndLuaFuncName, sizeof(TM_Battle->EndLuaFuncName), lua_tostring(_NLL, 2)); + return TM_Ret; +} + + +#endif //#ifdef _JZ_NEWSCRIPT_LUA + + +int NPC_Lua_Bit_band(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 5); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Top = lua_gettop(_NLL); + int a = (int)lua_tointeger(_NLL, 1); + int b = (int)lua_tointeger(_NLL, 2); + int c,d,e; + if(TM_Top >= 3) + { + c = (int)lua_tointeger(_NLL, 3); + a = a&b; + LRetInt(_NLL,a); + } + if(TM_Top >= 4) + { + d = (int)lua_tointeger(_NLL, 4); + LRetInt(_NLL,a&b&c&d); + } + if(TM_Top >= 5) + { + e = (int)lua_tointeger(_NLL, 5); + LRetInt(_NLL,a&b&c&d&e); + }else LRetInt(_NLL,a&b); +} + +int NPC_Lua_Bit_bor(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 5); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Top = lua_gettop(_NLL); + int a = (int)lua_tointeger(_NLL, 1); + int b = (int)lua_tointeger(_NLL, 2); + int c,d,e; + if(TM_Top >= 3) + { + c = (int)lua_tointeger(_NLL, 3); + LRetInt(_NLL,a|b|c); + } + if(TM_Top >= 4) + { + d = (int)lua_tointeger(_NLL, 4); + LRetInt(_NLL,a|b|c|d); + } + if(TM_Top >= 5) + { + e = (int)lua_tointeger(_NLL, 5); + LRetInt(_NLL,a|b|c|d|e); + }else LRetInt(_NLL,a|b); +} + +int NPC_Lua_Bit_bxor(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 5); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Top = lua_gettop(_NLL); + int a = (int)lua_tointeger(_NLL, 1); + int b = (int)lua_tointeger(_NLL, 2); + int c,d,e; + if(TM_Top >= 3) + { + c = (int)lua_tointeger(_NLL, 3); + LRetInt(_NLL,a^b^c); + } + if(TM_Top >= 4) + { + d = (int)lua_tointeger(_NLL, 4); + LRetInt(_NLL,a^b^c^d); + } + if(TM_Top >= 5) + { + e = (int)lua_tointeger(_NLL, 5); + LRetInt(_NLL,a^b^c^d^e); + }else LRetInt(_NLL,a^b); +} + +int NPC_Lua_Bit_lshift(lua_State *_NLL) +{ + CheckEx2(_NLL, 2,2); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int a = (int)lua_tointeger(_NLL, 1); + int b = (int)lua_tointeger(_NLL, 2); + LRetInt(_NLL,a<>b); +} + diff --git a/npc_lua/npc_lua_char.c b/npc_lua/npc_lua_char.c new file mode 100644 index 0000000..5f54913 --- /dev/null +++ b/npc_lua/npc_lua_char.c @@ -0,0 +1,2335 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" +#include "sasql.h" +#include "pet_skill.h" +#include "enemy.h" +#include "family.h" + +extern char hanzibuf[5000][8]; + +#ifdef _JZ_NEWSCRIPT_LUA + +////////////////////////////////////////////////////////////////////////////// +//ݵĽӿ +int NPC_Lua_Char_ClrEvtEnd(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Max = lua_gettop(_NLL); + int TM_EveNo = -1; + int i = 0; + for(i = 2; i <= TM_Max; i++) + { + TM_EveNo = (int)lua_tointeger(_NLL, i); + NPC_EndEventSetFlgCls(TM_Index, TM_EveNo); + } + + LRetInt(_NLL, TM_EveNo); +} + +int NPC_Lua_Char_ClrEvtNow(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Max = lua_gettop(_NLL); + int TM_EveNo = -1; + int i = 0; + for(i = 2; i <= TM_Max; i++) + { + TM_EveNo = (int)lua_tointeger(_NLL, i); + NPC_NowEventSetFlgCls(TM_Index, TM_EveNo); + } + LRetInt(_NLL, TM_EveNo); +} + +int NPC_Lua_Char_ClrEvt(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Max = lua_gettop(_NLL); + int TM_EveNo = -1; + int i = 0; + for(i = 2; i <= TM_Max; i++) + { + TM_EveNo = (int)lua_tointeger(_NLL, i); + NPC_NowEndEventSetFlgCls(TM_Index, TM_EveNo); + } + LRetInt(_NLL, TM_EveNo); +} + +int NPC_Lua_Char_SetEvtEnd(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Max = lua_gettop(_NLL); + int TM_EveNo = -1; + int i = 0; + for(i = 2; i <= TM_Max; i++) + { + TM_EveNo = (int)lua_tointeger(_NLL, i); + NPC_EventSetFlg(TM_Index, TM_EveNo); + } + + LRetInt(_NLL, TM_EveNo); +} + +int NPC_Lua_Char_SetEvtNow(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Max = lua_gettop(_NLL); + int TM_EveNo = -1; + int i = 0; + for(i = 2; i <= TM_Max; i++) + { + TM_EveNo = (int)lua_tointeger(_NLL, i); + NPC_NowEventSetFlg(TM_Index, TM_EveNo); + } + + LRetInt(_NLL, TM_EveNo); +} + +int NPC_Lua_Char_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + if(TM_Flg == CHAR_WHICHTYPE) + { + LRetInt(_NLL, 0); + } + int TM_IntVal = (int)lua_tointeger(_NLL, 3); +#ifdef _JZ_BILLING_SYSTEM + if(TM_Flg == CHAR_VIPPOINT) + { + saacproto_IncreaseMPoint_send(acfd, -1, CHAR_getChar( TM_Index, CHAR_CDKEY ), "ӻԱ", TM_IntVal - CHAR_getInt(TM_Index, TM_Flg)); + } +#endif + int TM_RetInt = CHAR_setInt(TM_Index, TM_Flg, TM_IntVal); +#ifdef _JZ_SAVE + if(TM_Flg == CHAR_MEMBERORDER) + { + CHAR_charSaveFromConnect(TM_Index, FALSE); + } +#endif + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_CharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = CHAR_setChar(TM_Index, TM_Flg, TM_CharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else if(TM_Flg < LUA_DATALINE3) + { + TM_Flg -= LUA_DATALINE2; + if(TM_Flg == CHAR_WORKOBJINDEX || TM_Flg == CHAR_WORKACTION) + { + LRetInt(_NLL, 0); + } + int TM_WorkIntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = CHAR_setWorkInt(TM_Index, TM_Flg, TM_WorkIntVal); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE4) + { + TM_Flg -= LUA_DATALINE3; + char *TM_WorkCharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = CHAR_setWorkChar(TM_Index, TM_Flg, TM_WorkCharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else if(TM_Flg < LUA_DATALINE5) + { + TM_Flg -= LUA_DATALINE4; + BOOL TM_BOOLVal = (BOOL)lua_toboolean(_NLL, 3); + int TM_RetInt = CHAR_setFlg(TM_Index, TM_Flg, TM_BOOLVal); + LRetInt(_NLL, TM_RetInt); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +////////////////////////////////////////////////////////////////////////////// +//¼õĽӿ +int NPC_Lua_Char_SetWalkPreEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_WALKPREFUNC] != (void *)NPC_Lua_WalkPreCallBack) + { + if(TM_char->functable[CHAR_WALKPREFUNC] != NULL) + { + TM_char->sur_functable[CHAR_WALKPREFUNC] = TM_char->functable[CHAR_WALKPREFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_WALKPREFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_WALKPREFUNC].string), TM_char->charfunctable[CHAR_WALKPREFUNC].string); + }else + { + TM_char->sur_functable[CHAR_WALKPREFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_WALKPREFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_WALKPREFUNC] = (void *)NPC_Lua_WalkPreCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_WALKPREFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_WALKPREFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_WALKPREFUNC].string, sizeof(TM_char->charfunctable[CHAR_WALKPREFUNC].string), FUNCNAME_WALKPRECALLBACK); + } + }else + { + if(TM_char->functable[CHAR_WALKPREFUNC] == (void *)NPC_Lua_WalkPreCallBack) + { + TM_char->lua_charfunctable[CHAR_WALKPREFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_WALKPREFUNC] == NULL) + { + TM_char->functable[CHAR_WALKPREFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_WALKPREFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_WALKPREFUNC] = TM_char->sur_functable[CHAR_WALKPREFUNC]; + TM_char->sur_functable[CHAR_WALKPREFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_WALKPREFUNC].string, sizeof(TM_char->charfunctable[CHAR_WALKPREFUNC].string), TM_char->sur_charfunctable[CHAR_WALKPREFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetWalkPostEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_WALKPOSTFUNC] != (void *)NPC_Lua_WalkPostCallBack) + { + if(TM_char->functable[CHAR_WALKPOSTFUNC] != NULL) + { + TM_char->sur_functable[CHAR_WALKPOSTFUNC] = TM_char->functable[CHAR_WALKPOSTFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_WALKPOSTFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_WALKPOSTFUNC].string), TM_char->charfunctable[CHAR_WALKPOSTFUNC].string); + }else + { + TM_char->sur_functable[CHAR_WALKPOSTFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_WALKPOSTFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_WALKPOSTFUNC] = (void *)NPC_Lua_WalkPostCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_WALKPOSTFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_WALKPOSTFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_WALKPOSTFUNC].string, sizeof(TM_char->charfunctable[CHAR_WALKPOSTFUNC].string), FUNCNAME_WALKPOSTCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_WALKPOSTFUNC] == (void *)NPC_Lua_WalkPostCallBack) + { + TM_char->lua_charfunctable[CHAR_WALKPOSTFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_WALKPOSTFUNC] == NULL) + { + TM_char->functable[CHAR_WALKPOSTFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_WALKPOSTFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_WALKPOSTFUNC] = TM_char->sur_functable[CHAR_WALKPOSTFUNC]; + TM_char->sur_functable[CHAR_WALKPOSTFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_WALKPOSTFUNC].string, sizeof(TM_char->charfunctable[CHAR_WALKPOSTFUNC].string), TM_char->sur_charfunctable[CHAR_WALKPOSTFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetPreOverEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_PREOVERFUNC] != (void *)NPC_Lua_PreOverCallBack) + { + if(TM_char->functable[CHAR_PREOVERFUNC] != NULL) + { + TM_char->sur_functable[CHAR_PREOVERFUNC] = TM_char->functable[CHAR_PREOVERFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_PREOVERFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_PREOVERFUNC].string), TM_char->charfunctable[CHAR_PREOVERFUNC].string); + }else + { + TM_char->sur_functable[CHAR_PREOVERFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_PREOVERFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_PREOVERFUNC] = (void *)NPC_Lua_PreOverCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_PREOVERFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_PREOVERFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_PREOVERFUNC].string, sizeof(TM_char->charfunctable[CHAR_PREOVERFUNC].string), FUNCNAME_PREOVERCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_PREOVERFUNC] == (void *)NPC_Lua_PreOverCallBack) + { + TM_char->lua_charfunctable[CHAR_PREOVERFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_PREOVERFUNC] == NULL) + { + TM_char->functable[CHAR_PREOVERFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_PREOVERFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_PREOVERFUNC] = TM_char->sur_functable[CHAR_PREOVERFUNC]; + TM_char->sur_functable[CHAR_PREOVERFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_PREOVERFUNC].string, sizeof(TM_char->charfunctable[CHAR_PREOVERFUNC].string), TM_char->sur_charfunctable[CHAR_PREOVERFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetPostOverEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_POSTOVERFUNC] != (void *)NPC_Lua_PostOverCallBack) + { + if(TM_char->functable[CHAR_POSTOVERFUNC] != NULL) + { + TM_char->sur_functable[CHAR_POSTOVERFUNC] = TM_char->functable[CHAR_POSTOVERFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_POSTOVERFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_POSTOVERFUNC].string), TM_char->charfunctable[CHAR_POSTOVERFUNC].string); + }else + { + TM_char->sur_functable[CHAR_POSTOVERFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_POSTOVERFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_POSTOVERFUNC] = (void *)NPC_Lua_PostOverCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_POSTOVERFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_POSTOVERFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_POSTOVERFUNC].string, sizeof(TM_char->charfunctable[CHAR_POSTOVERFUNC].string), FUNCNAME_POSTOVERCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_POSTOVERFUNC] == (void *)NPC_Lua_PostOverCallBack) + { + TM_char->lua_charfunctable[CHAR_POSTOVERFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_POSTOVERFUNC] == NULL) + { + TM_char->functable[CHAR_POSTOVERFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_POSTOVERFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_POSTOVERFUNC] = TM_char->sur_functable[CHAR_POSTOVERFUNC]; + TM_char->sur_functable[CHAR_POSTOVERFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_POSTOVERFUNC].string, sizeof(TM_char->charfunctable[CHAR_POSTOVERFUNC].string), TM_char->sur_charfunctable[CHAR_POSTOVERFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetWatchEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_WATCHFUNC] != (void *)NPC_Lua_WatchCallBack) + { + if(TM_char->functable[CHAR_WATCHFUNC] != NULL) + { + TM_char->sur_functable[CHAR_WATCHFUNC] = TM_char->functable[CHAR_WATCHFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_WATCHFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_WATCHFUNC].string), TM_char->charfunctable[CHAR_WATCHFUNC].string); + }else + { + TM_char->sur_functable[CHAR_WATCHFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_WATCHFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_WATCHFUNC] = (void *)NPC_Lua_WatchCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_WATCHFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_WATCHFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_WATCHFUNC].string, sizeof(TM_char->charfunctable[CHAR_WATCHFUNC].string), FUNCNAME_WATCHCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_WATCHFUNC] == (void *)NPC_Lua_WatchCallBack) + { + TM_char->lua_charfunctable[CHAR_WATCHFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_WATCHFUNC] == NULL) + { + TM_char->functable[CHAR_WATCHFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_WATCHFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_WATCHFUNC] = TM_char->sur_functable[CHAR_WATCHFUNC]; + TM_char->sur_functable[CHAR_WATCHFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_WATCHFUNC].string, sizeof(TM_char->charfunctable[CHAR_WATCHFUNC].string), TM_char->sur_charfunctable[CHAR_WATCHFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetLoopEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 4); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + int TM_LoopInterval = (int)lua_tointeger(_NLL, 4); + int TM_RetLoopInterval = -1; + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_LOOPFUNC] != (void *)NPC_Lua_LoopCallBack) + { + if(TM_char->functable[CHAR_LOOPFUNC] != NULL) + { + TM_char->sur_functable[CHAR_LOOPFUNC] = TM_char->functable[CHAR_LOOPFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_LOOPFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_LOOPFUNC].string), TM_char->charfunctable[CHAR_LOOPFUNC].string); + }else + { + TM_char->sur_functable[CHAR_LOOPFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_LOOPFUNC].string[0] = '\0'; + } + TM_RetLoopInterval = CHAR_getInt(TM_index, CHAR_LOOPINTERVAL); + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, TM_LoopInterval); + TM_char->functable[CHAR_LOOPFUNC] = (void *)NPC_Lua_LoopCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_LOOPFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_LOOPFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_LOOPFUNC].string, sizeof(TM_char->charfunctable[CHAR_LOOPFUNC].string), FUNCNAME_LOOPCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_LOOPFUNC] == (void *)NPC_Lua_LoopCallBack) + { + TM_char->lua_charfunctable[CHAR_LOOPFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_LOOPFUNC] == NULL) + { + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, -1); + TM_char->functable[CHAR_LOOPFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_LOOPFUNC].string[0] = '\0'; + }else + { + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, TM_LoopInterval); + TM_char->functable[CHAR_LOOPFUNC] = TM_char->sur_functable[CHAR_LOOPFUNC]; + TM_char->sur_functable[CHAR_LOOPFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_LOOPFUNC].string, sizeof(TM_char->charfunctable[CHAR_LOOPFUNC].string), TM_char->sur_charfunctable[CHAR_LOOPFUNC].string); + } + } + } + lua_pushinteger(_NLL, TM_RetLoopInterval); + LRet(TM_Ret + 1); +} + +int NPC_Lua_Char_SetTalkedEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_TALKEDFUNC] != (void *)NPC_Lua_TalkedCallBack) + { + if(TM_char->functable[CHAR_TALKEDFUNC] != NULL) + { + TM_char->sur_functable[CHAR_TALKEDFUNC] = TM_char->functable[CHAR_TALKEDFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_TALKEDFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_TALKEDFUNC].string), TM_char->charfunctable[CHAR_TALKEDFUNC].string); + }else + { + TM_char->sur_functable[CHAR_TALKEDFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_TALKEDFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_TALKEDFUNC] = (void *)NPC_Lua_TalkedCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_TALKEDFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_TALKEDFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_TALKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_TALKEDFUNC].string), FUNCNAME_TALKEDCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_TALKEDFUNC] == (void *)NPC_Lua_TalkedCallBack) + { + TM_char->lua_charfunctable[CHAR_TALKEDFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_TALKEDFUNC] == NULL) + { + TM_char->functable[CHAR_TALKEDFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_TALKEDFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_TALKEDFUNC] = TM_char->sur_functable[CHAR_TALKEDFUNC]; + TM_char->sur_functable[CHAR_TALKEDFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_TALKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_TALKEDFUNC].string), TM_char->sur_charfunctable[CHAR_TALKEDFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetOFFEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_OFFFUNC] != (void *)NPC_Lua_OFFCallBack) + { + if(TM_char->functable[CHAR_OFFFUNC] != NULL) + { + TM_char->sur_functable[CHAR_OFFFUNC] = TM_char->functable[CHAR_OFFFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_OFFFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_OFFFUNC].string), TM_char->charfunctable[CHAR_OFFFUNC].string); + }else + { + TM_char->sur_functable[CHAR_OFFFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_OFFFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_OFFFUNC] = (void *)NPC_Lua_OFFCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_OFFFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_OFFFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_OFFFUNC].string, sizeof(TM_char->charfunctable[CHAR_OFFFUNC].string), FUNCNAME_OFFCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_OFFFUNC] == (void *)NPC_Lua_OFFCallBack) + { + TM_char->lua_charfunctable[CHAR_OFFFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_OFFFUNC] == NULL) + { + TM_char->functable[CHAR_OFFFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_OFFFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_OFFFUNC] = TM_char->sur_functable[CHAR_OFFFUNC]; + TM_char->sur_functable[CHAR_OFFFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_OFFFUNC].string, sizeof(TM_char->charfunctable[CHAR_OFFFUNC].string), TM_char->sur_charfunctable[CHAR_OFFFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetLookedEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_LOOKEDFUNC] != (void *)NPC_Lua_LookedCallBack) + { + if(TM_char->functable[CHAR_LOOKEDFUNC] != NULL) + { + TM_char->sur_functable[CHAR_LOOKEDFUNC] = TM_char->functable[CHAR_LOOKEDFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_LOOKEDFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_LOOKEDFUNC].string), TM_char->charfunctable[CHAR_LOOKEDFUNC].string); + }else + { + TM_char->sur_functable[CHAR_LOOKEDFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_LOOKEDFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_LOOKEDFUNC] = (void *)NPC_Lua_LookedCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_LOOKEDFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_LOOKEDFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_LOOKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_LOOKEDFUNC].string), FUNCNAME_LOOKEDCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_LOOKEDFUNC] == (void *)NPC_Lua_LookedCallBack) + { + TM_char->lua_charfunctable[CHAR_LOOKEDFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_LOOKEDFUNC] == NULL) + { + TM_char->functable[CHAR_LOOKEDFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_LOOKEDFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_LOOKEDFUNC] = TM_char->sur_functable[CHAR_LOOKEDFUNC]; + TM_char->sur_functable[CHAR_LOOKEDFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_LOOKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_LOOKEDFUNC].string), TM_char->sur_charfunctable[CHAR_LOOKEDFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetItemPutEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_ITEMPUTFUNC] != (void *)NPC_Lua_ItemPutCallBack) + { + if(TM_char->functable[CHAR_ITEMPUTFUNC] != NULL) + { + TM_char->sur_functable[CHAR_ITEMPUTFUNC] = TM_char->functable[CHAR_ITEMPUTFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_ITEMPUTFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_ITEMPUTFUNC].string), TM_char->charfunctable[CHAR_ITEMPUTFUNC].string); + }else + { + TM_char->sur_functable[CHAR_ITEMPUTFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_ITEMPUTFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_ITEMPUTFUNC] = (void *)NPC_Lua_ItemPutCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_ITEMPUTFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_ITEMPUTFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_ITEMPUTFUNC].string, sizeof(TM_char->charfunctable[CHAR_ITEMPUTFUNC].string), FUNCNAME_ITEMPUTCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_ITEMPUTFUNC] == (void *)NPC_Lua_ItemPutCallBack) + { + TM_char->lua_charfunctable[CHAR_ITEMPUTFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_ITEMPUTFUNC] == NULL) + { + TM_char->functable[CHAR_ITEMPUTFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_ITEMPUTFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_ITEMPUTFUNC] = TM_char->sur_functable[CHAR_ITEMPUTFUNC]; + TM_char->sur_functable[CHAR_ITEMPUTFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_ITEMPUTFUNC].string, sizeof(TM_char->charfunctable[CHAR_ITEMPUTFUNC].string), TM_char->sur_charfunctable[CHAR_ITEMPUTFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Char_SetWindowTalkedEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_WINDOWTALKEDFUNC] != (void *)NPC_Lua_WindowTalkedCallBack) + { + if(TM_char->functable[CHAR_WINDOWTALKEDFUNC] != NULL) + { + TM_char->sur_functable[CHAR_WINDOWTALKEDFUNC] = TM_char->functable[CHAR_WINDOWTALKEDFUNC]; + strcpy_s(TM_char->sur_charfunctable[CHAR_WINDOWTALKEDFUNC].string, sizeof(TM_char->sur_charfunctable[CHAR_WINDOWTALKEDFUNC].string), TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string); + }else + { + TM_char->sur_functable[CHAR_WINDOWTALKEDFUNC] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_WINDOWTALKEDFUNC].string[0] = '\0'; + } + + TM_char->functable[CHAR_WINDOWTALKEDFUNC] = (void *)NPC_Lua_WindowTalkedCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_WINDOWTALKEDFUNC].string, sizeof(TM_char->lua_charfunctable[CHAR_WINDOWTALKEDFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string), FUNCNAME_WINDOWTALKEDCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_WINDOWTALKEDFUNC] == (void *)NPC_Lua_WindowTalkedCallBack) + { + TM_char->lua_charfunctable[CHAR_WINDOWTALKEDFUNC].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_WINDOWTALKEDFUNC] == NULL) + { + TM_char->functable[CHAR_WINDOWTALKEDFUNC] = (void *)NULL; + TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_WINDOWTALKEDFUNC] = TM_char->sur_functable[CHAR_WINDOWTALKEDFUNC]; + TM_char->sur_functable[CHAR_WINDOWTALKEDFUNC] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string, sizeof(TM_char->charfunctable[CHAR_WINDOWTALKEDFUNC].string), TM_char->sur_charfunctable[CHAR_WINDOWTALKEDFUNC].string); + } + } + } + return TM_Ret; +} + +#ifdef _USER_CHARLOOPS +int NPC_Lua_Char_SetCharLoopsEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 4); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + int TM_LoopInterval = (int)lua_tointeger(_NLL, 4); + int TM_RetLoopInterval = -1; + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_LOOPFUNCTEMP1] != (void *)NPC_Lua_CharLoopsCallBack) + { + if(TM_char->functable[CHAR_LOOPFUNCTEMP1] != NULL) + { + TM_char->sur_functable[CHAR_LOOPFUNCTEMP1] = TM_char->functable[CHAR_LOOPFUNCTEMP1]; + strcpy_s(TM_char->sur_charfunctable[CHAR_LOOPFUNCTEMP1].string, sizeof(TM_char->sur_charfunctable[CHAR_LOOPFUNCTEMP1].string), TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string); + }else + { + TM_char->sur_functable[CHAR_LOOPFUNCTEMP1] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_LOOPFUNCTEMP1].string[0] = '\0'; + } + TM_RetLoopInterval = CHAR_getInt(TM_index, CHAR_LOOPINTERVAL); + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, TM_LoopInterval); + TM_char->functable[CHAR_LOOPFUNCTEMP1] = (void *)NPC_Lua_CharLoopsCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_LOOPFUNCTEMP1].string, sizeof(TM_char->lua_charfunctable[CHAR_LOOPFUNCTEMP1].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string, sizeof(TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string), FUNCNAME_CHARLOOPSCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_LOOPFUNCTEMP1] == (void *)NPC_Lua_CharLoopsCallBack) + { + TM_char->lua_charfunctable[CHAR_LOOPFUNCTEMP1].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_LOOPFUNCTEMP1] == NULL) + { + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, -1); + TM_char->functable[CHAR_LOOPFUNCTEMP1] = (void *)NULL; + TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string[0] = '\0'; + }else + { + CHAR_setInt(TM_index, CHAR_LOOPINTERVAL, TM_LoopInterval); + TM_char->functable[CHAR_LOOPFUNCTEMP1] = TM_char->sur_functable[CHAR_LOOPFUNCTEMP1]; + TM_char->sur_functable[CHAR_LOOPFUNCTEMP1] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string, sizeof(TM_char->charfunctable[CHAR_LOOPFUNCTEMP1].string), TM_char->sur_charfunctable[CHAR_LOOPFUNCTEMP1].string); + } + } + } + lua_pushinteger(_NLL, TM_RetLoopInterval); + LRet(TM_Ret + 1); +} + +int NPC_Lua_Char_SetBattleProPertyEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + Char *TM_char = CHAR_getCharPointer(TM_index); + + if(TM_char == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_char->functable[CHAR_BATTLEPROPERTY] != (void *)NPC_Lua_BattleProPertyCallBack) + { + if(TM_char->functable[CHAR_BATTLEPROPERTY] != NULL) + { + TM_char->sur_functable[CHAR_BATTLEPROPERTY] = TM_char->functable[CHAR_BATTLEPROPERTY]; + strcpy_s(TM_char->sur_charfunctable[CHAR_BATTLEPROPERTY].string, sizeof(TM_char->sur_charfunctable[CHAR_BATTLEPROPERTY].string), TM_char->charfunctable[CHAR_BATTLEPROPERTY].string); + }else + { + TM_char->sur_functable[CHAR_BATTLEPROPERTY] = (void *)NULL; + TM_char->sur_charfunctable[CHAR_BATTLEPROPERTY].string[0] = '\0'; + } + + TM_char->functable[CHAR_BATTLEPROPERTY] = (void *)NPC_Lua_BattleProPertyCallBack; + strcpy_s(TM_char->lua_charfunctable[CHAR_BATTLEPROPERTY].string, sizeof(TM_char->lua_charfunctable[CHAR_BATTLEPROPERTY].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_char->charfunctable[CHAR_BATTLEPROPERTY].string, sizeof(TM_char->charfunctable[CHAR_BATTLEPROPERTY].string), FUNCNAME_BATTLEPROPERTYCALLBACK); + } + }else + { + if(TM_char->functable[CHAR_BATTLEPROPERTY] == (void *)NPC_Lua_BattleProPertyCallBack) + { + TM_char->lua_charfunctable[CHAR_BATTLEPROPERTY].string[0] = '\0'; + if(TM_char->sur_functable[CHAR_BATTLEPROPERTY] == NULL) + { + TM_char->functable[CHAR_BATTLEPROPERTY] = (void *)NULL; + TM_char->charfunctable[CHAR_BATTLEPROPERTY].string[0] = '\0'; + }else + { + TM_char->functable[CHAR_BATTLEPROPERTY] = TM_char->sur_functable[CHAR_BATTLEPROPERTY]; + TM_char->sur_functable[CHAR_BATTLEPROPERTY] = (void *)NULL; + strcpy_s(TM_char->charfunctable[CHAR_BATTLEPROPERTY].string, sizeof(TM_char->charfunctable[CHAR_BATTLEPROPERTY].string), TM_char->sur_charfunctable[CHAR_BATTLEPROPERTY].string); + } + } + } + return TM_Ret; +} +#endif +////////////////////////////////////////////////////////////////////////////// +//ȡݵĽӿ +int NPC_Lua_Char_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + if(TM_Flg == CHAR_WHICHTYPE) + { + LRetInt(_NLL, 0); + } + int TM_RetInt = CHAR_getInt(TM_Index, TM_Flg); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_RetPoint = CHAR_getChar(TM_Index, TM_Flg); + LRetMsg(_NLL, TM_RetPoint); + }else if(TM_Flg < LUA_DATALINE3) + { + TM_Flg -= LUA_DATALINE2; + int TM_RetWorkInt = CHAR_getWorkInt(TM_Index, TM_Flg); + LRetInt(_NLL, TM_RetWorkInt); + }else if(TM_Flg < LUA_DATALINE4) + { + TM_Flg -= LUA_DATALINE3; + char *TM_RetWorkPoint = CHAR_getWorkChar(TM_Index, TM_Flg); + LRetMsg(_NLL, TM_RetWorkPoint); + }else if(TM_Flg < LUA_DATALINE5) + { + TM_Flg -= LUA_DATALINE4; + BOOL TM_RetBOOL = CHAR_getFlg(TM_Index, TM_Flg); + LRetBool(_NLL, TM_RetBOOL); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Char_IsEventEnd(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EventNo = (int)lua_tointeger(_NLL, 2); + + BOOL TM_Ret = NPC_EventCheckFlg(TM_Index, TM_EventNo); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Char_IsEventNow(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EventNo = (int)lua_tointeger(_NLL, 2); + + BOOL TM_Ret = NPC_NowEventCheckFlg(TM_Index, TM_EventNo); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Char_FindItemId(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemId = (int)lua_tointeger(_NLL, 2); + int TM_ItemIndex = -1; + int i = 0; + int j = 0; + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + for( i = CHAR_STARTITEMARRAY ; i= 0 && TM_Pos < CHAR_MAXITEMHAVE) + { + int TM_ItemIndex = CHAR_getItemIndex(TM_Index, TM_Pos); + + if( ITEM_CHECKINDEX(TM_ItemIndex) == FALSE ) LRetErrInt(_NLL, -2, "õûеߡ"); + LRetInt(_NLL, ITEM_getInt(TM_ItemIndex, ITEM_ID)); + } + LRetErrInt(_NLL, -3, "λóΧ"); +} + +int NPC_Lua_Char_GetItemIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Pos = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if(TM_Pos >= 0 && TM_Pos < CHAR_MAXITEMHAVE) + { + int TM_ItemIndex = CHAR_getItemIndex(TM_Index, TM_Pos); + + if( ITEM_CHECKINDEX(TM_ItemIndex) == FALSE ) LRetErrInt(_NLL, -2, "õûеߡ"); + LRetInt(_NLL, TM_ItemIndex); + } + LRetErrInt(_NLL, -3, "λóΧ"); +} + +int NPC_Lua_Char_GetPetEnemyId(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Pos = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if(TM_Pos >= 0 && TM_Pos < CHAR_MAXPETHAVE) + { + int TM_PetIndex = CHAR_getCharPet(TM_Index, TM_Pos); + + if( CHAR_CHECKINDEX(TM_PetIndex) == FALSE ) LRetErrInt(_NLL, -2, "óûг"); + LRetInt(_NLL, CHAR_getInt(TM_PetIndex, CHAR_PETID)); + } + LRetErrInt(_NLL, -3, "λóΧ"); +} + +int NPC_Lua_Char_GetPetIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Pos = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if(TM_Pos >= 0 && TM_Pos < CHAR_MAXPETHAVE) + { + int TM_PetIndex = CHAR_getCharPet(TM_Index, TM_Pos); + + if( CHAR_CHECKINDEX(TM_PetIndex) == FALSE ) LRetErrInt(_NLL, -2, "óûг"); + LRetInt(_NLL, TM_PetIndex); + } + LRetErrInt(_NLL, -3, "λóΧ"); +} + +int NPC_Lua_Char_GetTeamIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Pos = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if(TM_Pos >= 1 && TM_Pos < CHAR_PARTYMAX) + { + int TM_ParIndex = CHAR_getWorkInt( TM_Index, TM_Pos + CHAR_WORKPARTYINDEX1); + + if( CHAR_CHECKINDEX(TM_ParIndex) == FALSE ) LRetErrInt(_NLL, -2, "λûжԱ"); + LRetInt(_NLL, TM_ParIndex); + } + LRetErrInt(_NLL, -3, "λóԱλ÷Χ"); +} + +int NPC_Lua_Char_HealAll(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + NPC_HealerAllHeal(TM_Index); + LRetInt(_NLL, 1); +} + + +int NPC_Lua_Char_GetPetSkillId(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_SkillIndex = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if( !CHAR_CHECKPETSKILLINDEX( TM_SkillIndex)){ + LRetErrInt(_NLL, -1, "Чġ"); + } + + int TM_SkillId=CHAR_getPetSkill( TM_Index, TM_SkillIndex); + LRetInt(_NLL, TM_SkillId); +} + +int NPC_Lua_Char_GetPetSkillName(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int skillarray = PETSKILL_getPetskillArray( TM_Index); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ){ + LRetErrNull(_NLL, "ı־Ǵġ"); + } + LRetMsg(_NLL, PETSKILL_getChar( skillarray, PETSKILL_NAME)); +} + +int NPC_Lua_Char_GetPetSkillMsg(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int skillarray = PETSKILL_getPetskillArray( TM_Index); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ){ + LRetErrNull(_NLL, "ı־Ǵġ"); + } + LRetMsg(_NLL, PETSKILL_getChar( skillarray, PETSKILL_COMMENT)); +} + +int NPC_Lua_Char_SetPetSkill(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Slod = (int)lua_tointeger(_NLL, 2); + int TM_SkillId = (int)lua_tointeger(_NLL, 3); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if( !CHAR_CHECKPETSKILLINDEX( TM_Slod)){ + LRetErrInt(_NLL, -1, "Чġ"); + } + int skillarray = PETSKILL_getPetskillArray( TM_SkillId); + if( PETSKILL_CHECKINDEX( skillarray) == FALSE ){ + LRetErrInt(_NLL, -1, "Чġ"); + } + CHAR_setPetSkill( TM_Index, TM_Slod, TM_SkillId); + LRetInt(_NLL, 1); +} + +int NPC_Lua_Char_RandMsg(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_NpcIndex = (int)lua_tointeger(_NLL, 1); + int TM_TalkIndex = (int)lua_tointeger(_NLL, 2); + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + char *randtypetime = CHAR_getChar(TM_TalkIndex,CHAR_RANDTYPE); + char tempbuff[64]; + int randtype = 0; + int randtime = 0; + int randwrong = 0; + if(strlen(randtypetime)>2){ + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff)) != FALSE){ + if(getStringFromIndexWithDelim(randtypetime,"-", 1, tempbuff, sizeof(tempbuff))== FALSE) + LRetInt(_NLL, 0); + randwrong = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 2, tempbuff, sizeof(tempbuff))== FALSE) + LRetInt(_NLL, 0); + randtype = atoi(tempbuff); + if(getStringFromIndexWithDelim(randtypetime,"-", 3, tempbuff, sizeof(tempbuff))== FALSE) + LRetInt(_NLL, 0); + randtime = atoi(tempbuff); +#ifdef _MM_NO_JIAOBEN + if(timep - randtime < getEditBaseTime()*randwrong){ + char errbuf[256]; + sprintf(errbuf,"%dſԼ˲",getEditBaseTime()*randwrong-(timep - randtime)); + CHAR_talkToCli(TM_TalkIndex, -1, errbuf, CHAR_COLORRED); + LRetInt(_NLL, 0); + } +#endif + } + } + char *arg = NULL; + arg = CHAR_getWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG); + int MyNpcIndex,MyTalkIndex,ret,flag; + if(strlen(arg)>2){ + char buftest[255]; + if(getStringFromIndexWithDelim(arg,"|", 1, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 0);; + } + ret = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 2, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 0);; + } + MyNpcIndex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 3, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 0);; + } + MyTalkIndex = atoi(buftest); + if(getStringFromIndexWithDelim(arg,"|", 4, buftest, sizeof(buftest)) == FALSE){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 0);; + } + flag = atoi(buftest); + + if(TM_NpcIndex!=MyNpcIndex || TM_TalkIndex!=MyTalkIndex){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 0); + } + + if(flag == 0){ + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 2); + } + CHAR_setWorkChar(TM_TalkIndex,CHAR_WORKRANDMSG,""); + LRetInt(_NLL, 1); + }else{ + char tempbuf[64]; + char randquestion[64]; + char randrightanswer[64]; + char randwronganswer1[64]; + char randwronganswer2[64]; + char randwronganswer3[64]; + char randwronganswer4[64]; + memset(tempbuf, 0, sizeof(tempbuf)); + memset(randquestion, 0, sizeof(randquestion)); + memset(randrightanswer, 0, sizeof(randrightanswer)); + memset(randwronganswer1, 0, sizeof(randwronganswer1)); + memset(randwronganswer2, 0, sizeof(randwronganswer2)); + memset(randwronganswer3, 0, sizeof(randwronganswer3)); + memset(randwronganswer4, 0, sizeof(randwronganswer4)); + if(RAND(1,100)<=75){ + char randtmpbuf[4][10]; + sprintf(randtmpbuf[0],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[1],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[2],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randtmpbuf[3],"%s",hanzibuf[RAND(1,5000)-1]); + sprintf(randquestion,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],0,0,0,0,0,0)); + strcat(randquestion,"ҳͬ飩"); + int newrand1 = RAND(1,100)-1; + int newrand2 = RAND(1,100)-1; + int newrand3 = RAND(1,100)-1; + int newrand4 = RAND(1,100)-1; + int newrand5 = RAND(1,100)-1; + sprintf(randrightanswer,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer1,"%s",str_hanzi_ganrao(randtmpbuf[0],randtmpbuf[1],randtmpbuf[3],randtmpbuf[2],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer2,"%s",str_hanzi_ganrao(randtmpbuf[3],randtmpbuf[1],randtmpbuf[2],randtmpbuf[0],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer3,"%s",str_hanzi_ganrao(randtmpbuf[1],randtmpbuf[0],randtmpbuf[2],randtmpbuf[3],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + sprintf(randwronganswer4,"%s",str_hanzi_ganrao(randtmpbuf[2],randtmpbuf[3],randtmpbuf[0],randtmpbuf[1],1,newrand1,newrand2,newrand3,newrand4,newrand5)); + + }else{ + int tii; + char timubuf[36][5] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; + for(tii=0;tii<5;tii++){ + if(tii==0) + strcpy(tempbuf,timubuf[RAND(1,36)-1]); + else{ + int timunum = 0; + while(1){ + timunum = RAND(1,36)-1; + if(strstr(tempbuf,timubuf[timunum])==NULL) + break; + } + strcat(tempbuf,timubuf[timunum]); + } + + } + sprintf(randwronganswer1,"[%c%c%c%c%c]",tempbuf[0],tempbuf[2],tempbuf[1],tempbuf[3],tempbuf[4]); + sprintf(randwronganswer2,"[%c%c%c%c%c]",tempbuf[0],tempbuf[1],tempbuf[4],tempbuf[2],tempbuf[3]); + sprintf(randwronganswer3,"[%c%c%c%c%c]",tempbuf[4],tempbuf[1],tempbuf[2],tempbuf[0],tempbuf[3]); + sprintf(randwronganswer4,"[%c%c%c%c%c]",tempbuf[1],tempbuf[0],tempbuf[2],tempbuf[3],tempbuf[4]); + sprintf(randquestion,"[%s]ҳͬӢģ",tempbuf); + sprintf(randrightanswer,"[%s]",tempbuf); + char* randstr = NULL; + randstr = str_ganrao(randquestion); + strcpy(randquestion,randstr); + randstr = str_ganraoan(randrightanswer); + strcpy(randrightanswer,randstr); + randstr = str_ganraoan(randwronganswer1); + strcpy(randwronganswer1,randstr); + randstr = str_ganraoan(randwronganswer2); + strcpy(randwronganswer2,randstr); + randstr = str_ganraoan(randwronganswer3); + strcpy(randwronganswer3,randstr); + randstr = str_ganraoan(randwronganswer4); + strcpy(randwronganswer4,randstr); + } + int n,m; + int randnum1; + m=1; + char tempret[5][64]; + randnum1 = RAND(1,5); + int rightnum,wrongnum1,wrongnum2,wrongnum3,wrongnum4; + rightnum = RAND(getRandMin(),getRandMax()); + wrongnum1 = RAND(getRandMin(),getRandMax()); + wrongnum2 = RAND(getRandMin(),getRandMax()); + wrongnum3 = RAND(getRandMin(),getRandMax()); + wrongnum4 = RAND(getRandMin(),getRandMax()); + int qianhounum = RAND(1,100); + for(n=1;n<=5;n++){ + if(n==randnum1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",rightnum,randrightanswer); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randrightanswer,rightnum); + }else{ + if(m==1){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum1,randwronganswer1); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer1,wrongnum1); + m = 2; + }else if(m==2){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum2,randwronganswer2); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer2,wrongnum2); + m = 3; + }else if(m==3){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum3,randwronganswer3); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer3,wrongnum3); + m = 4; + }else if(m==4){ + if(qianhounum<=50) + sprintf(tempret[n-1],"ѡ( %d %s )",wrongnum4,randwronganswer4); + else + sprintf(tempret[n-1],"ѡ( %s %d )",randwronganswer4,wrongnum4); + m = 5; + } + } + } + int windowtype = 0; + int selecttype = RAND(1,100); + char buf[64]; + if(selecttype<=30){ + sprintf(buf,"%d|%d|%d|%d",rightnum,TM_NpcIndex,TM_TalkIndex,0); + windowtype = WINDOW_MESSAGETYPE_MESSAGEANDLINEINPUT; + }else{ + sprintf(buf,"%d|%d|%d|%d",randnum1,TM_NpcIndex,TM_TalkIndex,0); + windowtype = WINDOW_MESSAGETYPE_SELECT; + } + CHAR_setWorkChar(TM_TalkIndex, CHAR_WORKRANDMSG, buf); + int fd = getfdFromCharaIndex( TM_TalkIndex ); + sprintf(buf,"%s\n%s\n%s\n%s\n%s\n%s\nȷڵ5λֻߵѡ",randquestion,tempret[0],tempret[1],tempret[2],tempret[3],tempret[4]); + lssproto_WN_send( fd, windowtype, + WINDOW_BUTTONTYPE_OK, + CHAR_WINDOWTYPE_LUANPC_RANDMSG, + -1, + buf); + CHAR_setWorkInt(TM_TalkIndex,CHAR_WORKLUANPCINT,0); + if(randwrong<=0){ + sprintf(tempbuff,"1-%d-%d",randtype,timep); + }else{ + sprintf(tempbuff,"%d-%d-%d",randwrong*3,randtype,timep); + } + CHAR_setChar(TM_TalkIndex,CHAR_RANDTYPE,tempbuff); + LRetInt(_NLL, 0); + } +} + +int NPC_Lua_Char_GetBeatitudeNum(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + int petbeatitude = CHAR_getInt( TM_Index, CHAR_BEATITUDE); + int i=0; + if(CHAR_getInt( TM_Index, CHAR_BEATITUDE)&BEATITUDE_VITAL) + i++; + if(CHAR_getInt( TM_Index, CHAR_BEATITUDE)&BEATITUDE_STR) + i++; + if(CHAR_getInt( TM_Index, CHAR_BEATITUDE)&BEATITUDE_TOUGH) + i++; + if(CHAR_getInt( TM_Index, CHAR_BEATITUDE)&BEATITUDE_DEX) + i++; + LRetInt(_NLL, i); +} + +//ͨʺŲѯ +int NPC_Lua_Char_GetPlayerIndexByCdkey(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + char *TM_Cdkey = (char *)lua_tostring(_NLL, 1); + + int TM_playernum = CHAR_getPlayerMaxNum(); + int i = 0; + for( i = 0 ; i < TM_playernum ; i++) + { + if( CHAR_getCharUse(i) != FALSE ) + { + if (CHAR_getChar(i, CHAR_CDKEY) == TM_Cdkey) + { + LRetInt(_NLL, i); + } + } + } + + LRetErrInt(_NLL, -3, "ʺŲڻδߣ"); +} + +int NPC_Lua_Char_getVipPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_point = sasql_getVipPoint(TM_Index); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_getVipPointݳ"); + } + LRetInt(_NLL, TM_point); +} + +int NPC_Lua_Char_getjfPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_point = sasql_jifenPoint(TM_Index); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_getjfPointݳ"); + } + LRetInt(_NLL, TM_point); +} + +int NPC_Lua_Char_getxjPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_point = sasql_xjPoint(TM_Index); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_getxjPointݳ"); + } + LRetInt(_NLL, TM_point); +} + +int NPC_Lua_Char_setVipPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_point = (int)lua_tointeger(_NLL, 2); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_kouj = sasql_setVipPoint(TM_Index,TM_point); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_setVipPointݳ"); + } + LRetInt(_NLL, TM_kouj); +} + +int NPC_Lua_Char_setjfPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_point = (int)lua_tointeger(_NLL, 2); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_kouj = sasql_setJfPoint(TM_Index,TM_point); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_setjfPointݳ"); + } + LRetInt(_NLL, TM_kouj); +} + +int NPC_Lua_Char_setxjPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_point = (int)lua_tointeger(_NLL, 2); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int TM_kouj = sasql_setxjPoint(TM_Index,TM_point); + if(TM_point<0){ + LRetErrInt(_NLL, -2, "Char_setxjPointݳ"); + } + LRetInt(_NLL, TM_kouj); +} + +int NPC_Lua_Char_GetAllocPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int PET_Index = (int)lua_tointeger(_NLL, 1); + int PET_flg = (int)lua_tointeger(_NLL, 2); + int PET_Ret = -1; + if(!CHAR_CHECKINDEX(PET_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + PET_Ret = CHAR_getInt( PET_Index, CHAR_ALLOCPOINT); + switch (PET_flg) + { + case 0: + PET_Ret = ((PET_Ret>> 0) & 0xFF); + break; + case 1: + PET_Ret = ((PET_Ret>> 8) & 0xFF); + break; + case 2: + PET_Ret = ((PET_Ret>> 16) & 0xFF); + break; + case 3: + PET_Ret = ((PET_Ret>>24) & 0xFF); + break; + } + LRetInt(_NLL, PET_Ret); +} + +int NPC_Lua_Char_GetDataFromEnemyBase(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int PET_ID = (int)lua_tointeger(_NLL, 1); + int PET_flg = (int)lua_tointeger(_NLL, 2); + if(ENEMYTEMP_getEnemyTempArrayFromTempNo(PET_ID) == -1) + { + LRetErrInt(_NLL, -1, "EnemyBaseIDڡ"); + } + PET_ID = ENEMY_getEnemyArrayFromTempNo( PET_ID); + PET_ID = ENEMYTEMP_getEnemyTempArray( PET_ID); + if(PET_flg >= 0) + { + if(PET_flg >= LUA_DATALINE1) + { + PET_flg = PET_flg - LUA_DATALINE1; + char *TM_RetPoint = ENEMYTEMP_getChar( PET_ID, PET_flg); + LRetMsg(_NLL, TM_RetPoint); + } + else + { + int PET_Ret = ENEMYTEMP_getInt( PET_ID, PET_flg); + LRetInt(_NLL, PET_Ret); + } + } + else + { + LRetErrInt(_NLL, -1, "ı־Ǵġ"); + } +} + +int NPC_Lua_Char_GetPlayerIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + char *TM_PlayerID = lua_tostring(_NLL, 1); + + if(TM_PlayerID == NULL ) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + int TM_playernum = CHAR_getPlayerMaxNum(); + int i; + for( i = 0 ; i < TM_playernum ; i++){ + if( CHAR_getCharUse(i) != FALSE ){ + char *TM_ServerPlayerID = CHAR_getChar(i, CHAR_CDKEY); + if (strcmp(TM_ServerPlayerID,TM_PlayerID)==0) + { + LRetInt(_NLL, i); + } + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Char_FindItemIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + + int TM_CharaIndex = (int)lua_tointeger(_NLL, 1); + int TM_ItemIndex = (int)lua_tointeger(_NLL, 2); + int tmpTM_ItemIndex = 0; + + if(!CHAR_CHECKINDEX(TM_CharaIndex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if(!ITEM_CHECKINDEX(TM_ItemIndex)) + { + LRetErrInt(_NLL, -1, "ߵЧġ"); + } + + int i = 0; + for( i = 0 ; i 0) LRetInt(_NLL, k); + LRetErrInt(_NLL, -2, "Ҳָߡ"); +} + +int NPC_Lua_Char_DelHcItem(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemId = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + if( TM_ItemId < 9 || TM_ItemId > 23){ + LRetErrInt(_NLL, -2, "Ҳָĵλá"); + } + else { + CHAR_DelItem( TM_Index, TM_ItemId); + LRetInt(_NLL, 1); + } +} + +int NPC_Lua_Char_GETFM(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_ID = (int)lua_tointeger(_NLL, 1); + int TM_X = (int)lua_tointeger(_NLL, 2); + LRetInt(_NLL, Char_GetFm( TM_ID, TM_X)); +} + +int NPC_Lua_Char_FindPetEnemyBaseId(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EnemyId = (int)lua_tointeger(_NLL, 2); + int TM_PetIndex = -1; + int i = 0; + int petid = -1; + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int enemynum = ENEMY_getEnemyNum(); + for( i = 0; i < enemynum; i ++ ) + { + if (TM_EnemyId == ENEMY_getInt( i, ENEMY_ID )){ + petid = ENEMY_getInt( i, ENEMY_TEMPNO ); + break; + } + } + + for( i = 0 ; i 63) LRetErrInt(_NLL, -1, "Чġ"); + + if (RIDEPET_getPETID( TM_Index, RidNo) >= 0) + { + LRetBool(_NLL, TRUE); + }else LRetBool(_NLL, FALSE); +} +*/ +int NPC_Lua_Char_GetPetOwner(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if( CHAR_getInt( TM_Index, CHAR_WHICHTYPE ) != CHAR_TYPEPET ){ + LRetErrInt(_NLL, -2, "Ķ󲢲dz"); + } + int charaindex = CHAR_getWorkInt(TM_Index, CHAR_WORKPLAYERINDEX); + LRetInt(_NLL, charaindex); +} + +int NPC_Lua_Char_GetEnemyBaseIdFromEnemyId(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int EnemyId = (int)lua_tointeger(_NLL, 1); + int enemynum = ENEMY_getEnemyNum(); + int petid = -1; + int i; + for( i = 0; i < enemynum; i ++ ) + { + if (EnemyId == ENEMY_getInt( i, ENEMY_ID )){ + petid = ENEMY_getInt( i, ENEMY_TEMPNO ); + break; + } + } + if (i == enemynum) LRetErrInt(_NLL, -1, "enemyIDûҵ"); + + LRetInt(_NLL, petid); +} + +int NPC_Lua_Char_GetEnemyIdFromEnemyBaseId(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int EnemybaseId = (int)lua_tointeger(_NLL, 1); + int enemynum = ENEMY_getEnemyNum(); + int EnemyId = -1; + int i; + for( i = 0; i < enemynum; i ++ ) + { + if (EnemybaseId == ENEMY_getInt( i, ENEMY_TEMPNO )){ + EnemyId = ENEMY_getInt( i, ENEMY_ID ); + break; + } + } + if (i == enemynum) LRetErrInt(_NLL, -1, "enemybaseIDûҵ"); + + LRetInt(_NLL, EnemyId); +} + +int NPC_Lua_Char_GetIp(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if( CHAR_getInt( TM_Index, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ){ + LRetErrInt(_NLL, -2, "Ķ󲢲"); + } + int fd = getfdFromCharaIndex( TM_Index ); + if( fd == -1 ){ + LRetErrInt(_NLL, -2, "Ѿߣ"); + } + if(TM_Flg == 1)//IP + { + LRetMsg(_NLL,CONNECT_get_userip2(fd)); + }else if(TM_Flg == 2)//FD + { + LRetInt(_NLL,fd); + }else if(TM_Flg == 3)//˿ + { + LRetInt(_NLL,CONNECT_get_userport(fd)); + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Char_SetAllocPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int petindex = (int)lua_tointeger(_NLL, 1); + int type = (int)lua_tointeger(_NLL, 2); + int val = (int)lua_tointeger(_NLL, 3); + if (val < 0 || val > 255) LRetErrInt(_NLL, -1, "valΪ0-255"); + if(!CHAR_CHECKINDEX(petindex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if( CHAR_getInt( petindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + LRetErrInt(_NLL, -2, "Ķ"); + } + int LevelUpPoint = CHAR_getInt( petindex, CHAR_ALLOCPOINT ); + int t = (int )(( LevelUpPoint >> 24 ) & 0xFF); + int g = (int )(( LevelUpPoint >> 16 ) & 0xFF); + int f = (int )(( LevelUpPoint >> 8 ) & 0xFF); + int m = (int )(( LevelUpPoint >> 0 ) & 0xFF); + + if (type == 1) { + LevelUpPoint = (val<<24)+(g<<16)+(f<<8)+(m<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + LRetInt(_NLL, t); + } + else if (type == 2) { + LevelUpPoint = (t<<24)+(val<<16)+(f<<8)+(m<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + LRetInt(_NLL, g); + } + else if (type == 3) { + LevelUpPoint = (t<<24)+(g<<16)+(val<<8)+(m<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + LRetInt(_NLL, f); + } + else if (type == 4) { + LevelUpPoint = (t<<24)+(g<<16)+(f<<8)+(val<<0); + CHAR_setInt( petindex, CHAR_ALLOCPOINT, LevelUpPoint); + LRetInt(_NLL, m); + } +} + +int NPC_Lua_Char_GetMaxPetIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 0); + int MAXPLAYER = CHAR_getPlayerMaxNum(); + int MAXPET = CHAR_getPetMaxNum(); + int maxindex = MAXPLAYER + MAXPET; + LRetInt(_NLL, maxindex); +} + +int NPC_Lua_Char_GetMaxPlayerIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 0); + int maxindex = CHAR_getPlayerMaxNum(); + LRetInt(_NLL, maxindex); +} + +int NPC_Lua_Char_SavePetToString(lua_State *_NLL) +{ + char *petdata = "\0"; + CheckEx(_NLL, 1); + int petindex = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(petindex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if( CHAR_getInt( petindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER ){ + LRetErrInt(_NLL, -2, "Ķ"); + return; + } + petdata = CHAR_makePetStringFromPetIndex( petindex); + LRetMsg(_NLL, petdata); +} + +int NPC_Lua_Char_LoadPetFromString(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + char * petdata = (char *)lua_tostring(_NLL, 1); + Char petone; + int petindex; + BOOL ret = CHAR_makePetFromStringToArg(petdata,&petone, 0); + if( ret == TRUE ){ + petindex = PET_initCharOneArray( &petone ); + if( petindex < 0 ){ + LRetErrInt(_NLL, -2, "ʧ"); + return; + } + } + LRetInt(_NLL, petindex); +} + +int NPC_Lua_Char_GetPlayerFromAccAndName(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + char *account = lua_tostring(_NLL, 1); + char *name = lua_tostring(_NLL, 2); + int i; + int playernum = CHAR_getPlayerMaxNum(); + int xindex = -1; + for( i = 0 ; i < playernum ; i++) { + if( CHAR_CHECKINDEX(i) ){ + if (strcmp(CHAR_getChar(i,CHAR_NAME), name) == 0) { + xindex = i; + break; + } + if (strcmp(CHAR_getChar(i,CHAR_CDKEY), account) == 0) { + xindex = i; + break; + } + } + } + + LRetInt(_NLL, xindex); +} + +int NPC_Lua_Char_CheckPet(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + BOOL CHECK = CHAR_CHECKINDEX(TM_Index); + LRetBool(_NLL, CHECK); +} + +int NPC_Lua_Char_CheckPlayer(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + BOOL CHECK = CHAR_CHECKINDEX(TM_Index); + LRetBool(_NLL, CHECK); +} + +BOOL NPC_Lua_Char_JoinParty(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 2); + int charaindex = (int)lua_tointeger(_NLL, 1); + int toindex = (int)lua_tointeger(_NLL, 2); + if (CHAR_CHECKINDEX(charaindex)&&CHAR_CHECKINDEX(toindex)) + { + CHAR_JoinParty_Main( charaindex, toindex); + LRetBool(_NLL, TRUE); + } + LRetBool(_NLL, FALSE); +} + +int NPC_Lua_Char_getFamilyPlayIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 3); + int charaindex = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(charaindex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + int familyindex = (int)lua_tointeger(_NLL, 1); + int familymode = (int)lua_tointeger(_NLL, 2); + int familycharaindex = (int)lua_tointeger(_NLL, 3); + if(familyindex > FAMILY_MAXNUM){ + LRetErrInt(_NLL, -1, "ļЧġ"); + }else if (familymode > FAMILY_MAXCHANNEL) + { + LRetErrInt(_NLL, -1, "ļƵЧġ"); + }else if (familycharaindex > FAMILY_MAXMEMBER) + { + LRetErrInt(_NLL, -1, "ļЧ"); + } + int playindex = channelMember[familyindex][familymode][familycharaindex]; + LRetInt(_NLL,playindex); +} + +#endif //#ifdef _JZ_NEWSCRIPT_LUA diff --git a/npc_lua/npc_lua_ex.c b/npc_lua/npc_lua_ex.c new file mode 100644 index 0000000..06d8c22 --- /dev/null +++ b/npc_lua/npc_lua_ex.c @@ -0,0 +1,369 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" + +#ifdef _JZ_NEWSCRIPT_LUA + +extern char M_OutErrMsg[1024]; +extern lua_State *M_Script_Lua; +extern unsigned int M_Create_Num; + +////////////////////////////////////////////////////////////////////////////// +int NPC_Lua_RegCallEx(lua_State * _NLL, luaL_Reg *_RegList) +{ + assert(_RegList != NULL && _NLL != NULL); + + int i = 0; + if((_NLL != NULL) && (_RegList != NULL)) + { + while(_RegList->func != NULL) + { + lua_register(_NLL, _RegList->name, _RegList->func); + i++; + _RegList++; + } + } + return i; +} + +int NPC_Lua_RegLibEx(lua_State * _NLL, PSCRIPTREGLIB _RegLib) +{ + assert(_RegLib != NULL && _NLL != NULL); + + int i = 0; + if((_NLL != NULL) && (_RegLib != NULL)) + { + while(_RegLib->LibName != NULL) + { + luaL_openlib(_NLL, _RegLib->LibName, _RegLib->FuncRegList, 0); + i++; + _RegLib++; + } + } + return i; +} + +int NPC_Lua_RegClassEx(lua_State * _NLL, PSCRIPTREGCLASS _RegClass) +{ + assert(_RegClass != NULL && _NLL != NULL); + + int i = 0; + if((_NLL != NULL) && (_RegClass != NULL)) + { + while(_RegClass->ClassName != NULL) + { + luaL_newmetatable(_NLL, _RegClass->ClassName); + + lua_pushstring(_NLL, "__index"); + lua_pushvalue(_NLL, -2); + lua_settable(_NLL, -3); + + luaL_openlib(_NLL, NULL, _RegClass->FuncRegList, 0); + + luaL_openlib(_NLL, _RegClass->NewLib , _RegClass->NewLib->FuncRegList, 0); + + i++; + _RegClass++; + } + } + return i; +} + +int NPC_Lua_RegArrayEx(lua_State * _NLL, PSCRIPTREGARRAY _RegArray) +{ + assert(_RegArray != NULL && _NLL != NULL); + + int i = 0; + if((_NLL != NULL) && (_RegArray != NULL)) + { + int j = 0; + while(_RegArray->ArrayName != NULL) + { + luaL_newmetatable(_NLL, _RegArray->ArrayName); + luaL_openlib(_NLL, _RegArray->FuncList->LibName, _RegArray->FuncList->FuncRegList, 0); + + j = 0; + while(_RegArray->SetMetaTable[j] != NULL) + { + lua_pushstring(_NLL, _RegArray->SetMetaTable[j]); + lua_pushstring(_NLL, _RegArray->SetFuncName[j]); + lua_gettable(_NLL, 2); + lua_settable(_NLL, 1); + j++; + } + i++; + _RegArray++; + } + } + return i; +} + +const char *NPC_Lua_SetErrorStr(const char *ErrStr) +{ + if(ErrStr == NULL) + { + M_OutErrMsg[0] = '\0'; + return M_OutErrMsg; + } + return (const char *)strcpy_s(M_OutErrMsg, sizeof(M_OutErrMsg), ErrStr); +} + +//NPC-NPCΨһ +int NPC_Lua_Create(const char *_DoFile, const char *_InitFuncName, char *_seek, BOOL _IsFly) +{ + assert(_InitFuncName != NULL); + + Char TM_char; + Object TM_obj; + int TM_charaindex; + int TM_objindex; + int TM_seekint = 0; + + //ָĬֵTM_char + if(_seek == NULL) + { + TM_seekint = CHAR_seekGraphicNumberFromString("\0"); + }else + { + TM_seekint = CHAR_seekGraphicNumberFromString(_seek); + } + + if( CHAR_getDefaultChar( &TM_char, TM_seekint) == FALSE ) + { + LRetErrInt(M_Script_Lua, -1, "Ĭֵʧܡڲܲ"); + } + + //ָLUAűļ + if(_DoFile != NULL && _DoFile[0] != '\0') + { + if (NPC_Lua_DoFile(_DoFile) == 1){ +#ifdef _LUA_Debug + pcall_callback_err_fun(M_Script_Lua,_InitFuncName); +#endif + } + } + + //ָLUAűļ CAX +// NPC_Lua_DoFile(_DoFile); + //ȡýűжijʼָ + lua_getglobal(M_Script_Lua, _InitFuncName); + + if(lua_type(M_Script_Lua, -1) != LUA_TFUNCTION) + { + print("NPC_Lua_Create err: ޷ȡʼָ롣\n"); + lua_pop(M_Script_Lua, 1); + LRetErrInt(M_Script_Lua, -2, "޷ȡʼָ롣"); + }else + { + //溯ָ + lua_pop(M_Script_Lua, 1); + strcpy_s(TM_char.lua_charfunctable[CHAR_INITFUNC].string, sizeof(TM_char.lua_charfunctable[CHAR_INITFUNC].string), _InitFuncName); + strcpy_s(TM_char.charfunctable[CHAR_INITFUNC].string, sizeof(TM_char.charfunctable[CHAR_INITFUNC].string), FUNCNAME_INITCALLBACK); + } + TM_char.data[CHAR_FLOOR] = 777; + TM_char.data[CHAR_X] = 31; + TM_char.data[CHAR_Y] = 19; + TM_char.data[CHAR_DIR] = 4; + TM_char.string[CHAR_NAME].string[0] = '\0'; + TM_char.data[CHAR_BASEBASEIMAGENUMBER] = TM_char.data[CHAR_BASEIMAGENUMBER] = 0; +#ifdef _ADD_ACTION + TM_char.data[CHAR_ACTIONSTYLE] = CHAR_ACTSTAND; +#endif + TM_char.data[CHAR_FMINDEX] = -1; + TM_char.string[CHAR_NPCARGUMENT].string[0] = '\0'; + // + TM_char.data[CHAR_WHICHTYPE] = CHAR_LUANPC; + //ʶNPCNPC_Lua_CreateNPCţĿǰûʲô + TM_char.data[CHAR_NPCCREATEINDEX] = M_Create_Num++; + + //ʵTM_char ֮NPCʵݲ + TM_charaindex = CHAR_initCharOneArray( &TM_char ); + if( TM_charaindex == -1 ) + { + CHAR_endCharData( &TM_char ); + LRetErrInt(M_Script_Lua, -3, "޷ʵNPCݡ"); + } + + CHAR_setInt(TM_charaindex, CHAR_INDEXOFEQTITLE, -1); + CHAR_setWorkInt( TM_charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_NONE); + + //ͼ־Ŀǰ֪ã + if(_IsFly == TRUE) + { + CHAR_setFlg(TM_charaindex, CHAR_ISFLYING, 1); + } + + TM_obj.type = OBJTYPE_CHARA; // + TM_obj.index= TM_charaindex; //ӦChar + TM_obj.x = CHAR_getInt(TM_charaindex, CHAR_X); //ڵͼX + TM_obj.y = CHAR_getInt(TM_charaindex, CHAR_Y); //ڵͼY + TM_obj.floor = CHAR_getInt(TM_charaindex, CHAR_FLOOR);//ڵͼ + TM_objindex = initObjectOne( &TM_obj ); //һʵ֮NPCʵ + if( TM_objindex == -1 ) + { + CHAR_endCharOneArray( TM_charaindex ); + LRetErrInt(M_Script_Lua, -4, "޷ʵNPC"); + } + + CHAR_setWorkInt(TM_charaindex, CHAR_WORKOBJINDEX, TM_objindex); + +#ifdef _ADD_ACTION + //NPCĶ + CHAR_setWorkInt(TM_charaindex, CHAR_WORKACTION, CHAR_getInt( TM_charaindex, CHAR_ACTIONSTYLE ) ); + + CHAR_sendWatchEvent(TM_objindex, CHAR_getWorkInt( TM_charaindex, CHAR_WORKACTION), NULL, 0, TRUE); +#else + CHAR_sendWatchEvent(TM_objindex , CHAR_ACTSTAND, NULL, 0, TRUE); +#endif + CHAR_setWorkInt(TM_charaindex,CHAR_WORKNPCTYPE,2); + LRetInt(M_Script_Lua, TM_charaindex); +} + +//ɾNPC NPCΨһ +int NPC_Lua_Del(int _index) +{ + if (CHAR_getInt( _index, CHAR_WHICHTYPE )== CHAR_LUANPC) + { + int TM_Objindex = CHAR_getWorkInt( _index,CHAR_WORKOBJINDEX); + if(CHECKOBJECTUSE(TM_Objindex) == TRUE) + { + CHAR_ObjectDelete(TM_Objindex); + CHAR_endCharOneArray(_index); + return 1; + }else + { + CHAR_endCharOneArray(_index); + return 0; + } + } +} + +int NPC_Lua_GetFuncPoint(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, LUA_MINSTACK); + char *TM_DoFile = lua_tostring(_NLL, 1); + char *TM_FuncName = lua_tostring(_NLL, 2); + + if(TM_DoFile != NULL) + { + if (NPC_Lua_DoFile(TM_DoFile) == 1){ +#ifdef _LUA_Debug + pcall_callback_err_fun(M_Script_Lua,TM_FuncName); +#endif + } + } + + if(TM_FuncName == NULL) + { + LRetErrInt(_NLL , -1, "Ϊ"); + } + + lua_getglobal(_NLL, TM_FuncName); + + if(lua_type(_NLL, -1) != LUA_TFUNCTION) + { + LRetErrInt(_NLL , -2, "޷ȡָ롣"); + } + LRetInt(_NLL, 1); +} +////////////////////////////////////////////////////////////////////////////// +//չͽӿں +//NTInt +int NPC_Lua_NTInt_New(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + + int TM_Len = luaL_checkint(_NLL, 1); + if(TM_Len <= 0) + { + LRetErrInt(_NLL, -1, "СΪ0"); + } + + size_t TM_Bytes = sizeof(size_t) + ( sizeof(int) * TM_Len ); + PARRAY_NTINT TM_Point = (PARRAY_NTINT *)lua_newuserdata(_NLL, TM_Bytes); + + if(TM_Point == NULL) + { + LRetErrInt(_NLL, -2, "ʵʧܣڴ档"); + } + + luaL_getmetatable(_NLL, "Array.NTInt"); + lua_setmetatable(_NLL, -2); + + TM_Point->Size = TM_Len; + + LRet(1); +} + +int NPC_Lua_NTInt_Get(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + + PARRAY_NTINT TM_Point = luaL_checkudata(_NLL, 1, "Array.NTInt"); + + if(TM_Point == NULL) + { + luaL_argerror(_NLL, 1, " Array.NTInt ݡ"); + } + + int TM_Index = (int)lua_tointeger(_NLL, 2); + + if(TM_Index < 1 || TM_Index > TM_Point->Size) + { + luaL_argerror(_NLL, 1, "ݷΧ"); + } + + TM_Index--; + + LRetInt(_NLL, TM_Point->Num[TM_Index]); +} + +int NPC_Lua_NTInt_Set(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + + PARRAY_NTINT TM_Point = luaL_checkudata(_NLL, 1, "Array.NTInt"); + + if(TM_Point == NULL) + { + luaL_argerror(_NLL, 1, " Array.NTInt ݡ"); + } + + int TM_Index = (int)lua_tointeger(_NLL, 2); + + if(TM_Index < 1 || TM_Index > TM_Point->Size) + { + luaL_argerror(_NLL, 1, "ݷΧ"); + } + TM_Index--; + + int TM_Num = (int)lua_tointeger(_NLL, 3); + + TM_Point->Num[TM_Index] = TM_Num; + + LRetNull(_NLL); +} + +int NPC_Lua_NTInt_Len(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + + PARRAY_NTINT TM_Point = luaL_checkudata(_NLL, 1, "Array.NTInt"); + + if(TM_Point == NULL) + { + luaL_argerror(_NLL, 1, " Array.NTInt ݡ"); + } + + LRetInt(_NLL, TM_Point->Size); +} + +#endif //#ifdef _JZ_NEWSCRIPT_LUA diff --git a/npc_lua/npc_lua_game.c b/npc_lua/npc_lua_game.c new file mode 100644 index 0000000..4b70f58 --- /dev/null +++ b/npc_lua/npc_lua_game.c @@ -0,0 +1,110 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "char_data.h" +#include "anim_tbl.h" +#include "object.h" +#include "battle.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" +#include "saacproto_cli.h" +#include "family.h" + +int NPC_Lua_Game_FMPOINT_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int GA_Index = (int)lua_tointeger(_NLL, 1); + int GA_Flg = (int)lua_tointeger(_NLL, 2); + + if(GA_Flg >= 0) + { + if(GA_Flg < LUA_DATALINE1) + { + GA_Flg -= LUA_DATALINE0; + char *GA_RetInt = FM_getManorData(GA_Index, GA_Flg); + LRetInt(_NLL, atoi(GA_RetInt)); + }else if(GA_Flg < LUA_DATALINE2) + { + GA_Flg -= LUA_DATALINE1; + char *GA_RetPoint = FM_getManorData(GA_Index, GA_Flg); + LRetMsg(_NLL, GA_RetPoint); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +int NPC_Lua_Game_FMPOINT_ACSetFMPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 5); + CheckIndexNull(_NLL, 1); + int leaderindex = (int)lua_tointeger(_NLL, 1); + int fmpointindex = (int)lua_tointeger(_NLL, 2); + int map = (int)lua_tointeger(_NLL, 3); + int x = (int)lua_tointeger(_NLL, 4); + int y = (int)lua_tointeger(_NLL, 5); + if(!CHAR_CHECKINDEX(leaderindex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + if (fmpointindex < 0 || fmpointindex > 9) + { + LRetErrInt(_NLL, -1, "ׯ԰Чġ"); + } + int fd = getfdFromCharaIndex( leaderindex ); + if( fd == -1 ){ + LRetErrInt(_NLL, -2, "ҿѾߣ"); + } + char *tmpbuf = ""; + sprintf(tmpbuf, "%d|%d|%d|%d|%d|",leaderindex,fmpointindex,map,x,y); + FAMILY_SetPoint(fd,leaderindex,tmpbuf); + LRetInt(_NLL, 0); +} + +int NPC_Lua_Game_FMPOINT_ACFixFMPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int winindex = (int)lua_tointeger(_NLL, 1); + int loseindex = (int)lua_tointeger(_NLL, 2); + int id = (int)lua_tointeger(_NLL, 3); + if(!CHAR_CHECKINDEX(winindex) || !CHAR_CHECKINDEX(loseindex)) + { + LRetErrNull(_NLL, "Чġ"); + } + if (id < 0 || id > 9) + { + LRetErrNull(_NLL, "ׯ԰Чġ"); + } +if(CHAR_getInt( winindex, CHAR_FMLEADERFLAG ) != FMMEMBER_LEADER)//峤 + { + LRetErrNull(_NLL, "󲢲峤"); + } +if(CHAR_getInt( loseindex, CHAR_FMLEADERFLAG ) != FMMEMBER_LEADER)//峤 + { + LRetErrNull(_NLL, "󲢲峤"); + } + saacproto_ACFixFMPoint_send(acfd, CHAR_getChar(winindex,CHAR_FMNAME),CHAR_getInt(winindex,CHAR_FMINDEX) + 1,CHAR_getInt(winindex,CHAR_FMINDEX), + CHAR_getChar(loseindex,CHAR_FMNAME),CHAR_getInt(loseindex,CHAR_FMINDEX) + 1,CHAR_getInt(loseindex,CHAR_FMINDEX),id); + LRetInt(_NLL, 0); +} + +int NPC_Lua_Game_FMPOINT_ACCleanFMPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int id = (int)lua_tointeger(_NLL, 1); + if (id < 0 || id > 9) + { + LRetErrNull(_NLL, "ׯ԰Чġ"); + } + saacproto_ACDelFmPoint_send(acfd,id); +// saacproto_ACDelFmPoint_send(acfd,id); + LRetInt(_NLL, 0); +} + diff --git a/npc_lua/npc_lua_item.c b/npc_lua/npc_lua_item.c new file mode 100644 index 0000000..98ced41 --- /dev/null +++ b/npc_lua/npc_lua_item.c @@ -0,0 +1,595 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" +#include "item.h" + +#ifdef _JZ_NEWSCRIPT_LUA + +typedef enum +{ + LUAITEM_PREOVERFUNC = ITEM_PREOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_POSTOVERFUNC = ITEM_POSTOVERFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_WATCHFUNC = ITEM_WATCHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_USEFUNC = ITEM_USEFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_ATTACHFUNC = ITEM_ATTACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DETACHFUNC = ITEM_DETACHFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_DROPFUNC = ITEM_DROPFUNC - ITEM_FIRSTFUNCTION, + LUAITEM_PICKUPFUNC = ITEM_PICKUPFUNC - ITEM_FIRSTFUNCTION, +#ifdef _Item_ReLifeAct + LUAITEM_DIERELIFEFUNC = ITEM_DIERELIFEFUNC - ITEM_FIRSTFUNCTION, +#endif +}LUAITEM_FUNC; + +//ȡݵĽӿ +int NPC_Lua_Item_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckItemIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + int TM_RetInt = ITEM_getInt(TM_Index, TM_Flg); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_RetPoint = ITEM_getChar(TM_Index, TM_Flg); + LRetMsg(_NLL, TM_RetPoint); + }else if(TM_Flg < LUA_DATALINE3) + { + TM_Flg -= LUA_DATALINE2; + int TM_RetWorkInt = ITEM_getWorkInt(TM_Index, TM_Flg); + LRetInt(_NLL, TM_RetWorkInt); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +//ݵĽӿ +int NPC_Lua_Item_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + int TM_IntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = ITEM_setInt(TM_Index, TM_Flg, TM_IntVal); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_CharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = ITEM_setChar(TM_Index, TM_Flg, TM_CharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else if(TM_Flg < LUA_DATALINE3) + { + TM_Flg -= LUA_DATALINE2; + if(TM_Flg == ITEM_WORKOBJINDEX || TM_Flg == ITEM_WORKCHARAINDEX) + { + LRetInt(_NLL, 0); + } + int TM_WorkIntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = ITEM_setWorkInt(TM_Index, TM_Flg, TM_WorkIntVal); + LRetInt(_NLL, TM_RetInt); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + +//¼õĽӿ +int NPC_Lua_Item_SetPreOverEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_PREOVERFUNC] != (void *)NPC_Lua_ItemPerOverCallBack) + { + if(TM_Item->functable[LUAITEM_PREOVERFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_PREOVERFUNC] = TM_Item->functable[LUAITEM_PREOVERFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_PREOVERFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_PREOVERFUNC].string), TM_Item->string[ITEM_PREOVERFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_PREOVERFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_PREOVERFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_PREOVERFUNC] = (void *)NPC_Lua_ItemPerOverCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_PREOVERFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_PREOVERFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_PREOVERFUNC].string, sizeof(TM_Item->string[ITEM_PREOVERFUNC].string), FUNCNAME_ITEMPEROVERCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_PREOVERFUNC] == (void *)NPC_Lua_ItemPerOverCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_PREOVERFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_PREOVERFUNC] == NULL) + { + TM_Item->functable[LUAITEM_PREOVERFUNC] = (void *)NULL; + TM_Item->string[ITEM_PREOVERFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_PREOVERFUNC] = TM_Item->sur_functable[LUAITEM_PREOVERFUNC]; + TM_Item->sur_functable[LUAITEM_PREOVERFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_PREOVERFUNC].string, sizeof(TM_Item->string[ITEM_PREOVERFUNC].string), TM_Item->sur_charfunctable[LUAITEM_PREOVERFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetPostOverEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_POSTOVERFUNC] != (void *)NPC_Lua_ItemPostOverCallBack) + { + if(TM_Item->functable[LUAITEM_POSTOVERFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_POSTOVERFUNC] = TM_Item->functable[LUAITEM_POSTOVERFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_POSTOVERFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_POSTOVERFUNC].string), TM_Item->string[ITEM_POSTOVERFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_POSTOVERFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_POSTOVERFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_POSTOVERFUNC] = (void *)NPC_Lua_ItemPostOverCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_POSTOVERFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_POSTOVERFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_POSTOVERFUNC].string, sizeof(TM_Item->string[ITEM_POSTOVERFUNC].string), FUNCNAME_ITEMPOSTOVERCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_POSTOVERFUNC] == (void *)NPC_Lua_ItemPostOverCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_POSTOVERFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_POSTOVERFUNC] == NULL) + { + TM_Item->functable[LUAITEM_POSTOVERFUNC] = (void *)NULL; + TM_Item->string[ITEM_POSTOVERFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_POSTOVERFUNC] = TM_Item->sur_functable[LUAITEM_POSTOVERFUNC]; + TM_Item->sur_functable[LUAITEM_POSTOVERFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_POSTOVERFUNC].string, sizeof(TM_Item->string[ITEM_POSTOVERFUNC].string), TM_Item->sur_charfunctable[LUAITEM_POSTOVERFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetWatchEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_WATCHFUNC] != (void *)NPC_Lua_ItemWatchCallBack) + { + if(TM_Item->functable[LUAITEM_WATCHFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_WATCHFUNC] = TM_Item->functable[LUAITEM_WATCHFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_WATCHFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_WATCHFUNC].string), TM_Item->string[ITEM_WATCHFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_WATCHFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_WATCHFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_WATCHFUNC] = (void *)NPC_Lua_ItemWatchCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_WATCHFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_WATCHFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_WATCHFUNC].string, sizeof(TM_Item->string[ITEM_WATCHFUNC].string), FUNCNAME_ITEMWATCHCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_WATCHFUNC] == (void *)NPC_Lua_ItemWatchCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_WATCHFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_WATCHFUNC] == NULL) + { + TM_Item->functable[LUAITEM_WATCHFUNC] = (void *)NULL; + TM_Item->string[ITEM_WATCHFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_WATCHFUNC] = TM_Item->sur_functable[LUAITEM_WATCHFUNC]; + TM_Item->sur_functable[LUAITEM_WATCHFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_WATCHFUNC].string, sizeof(TM_Item->string[ITEM_WATCHFUNC].string), TM_Item->sur_charfunctable[LUAITEM_WATCHFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetUseEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_USEFUNC] != (void *)NPC_Lua_ItemUseCallBack) + { + if(TM_Item->functable[LUAITEM_USEFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_USEFUNC] = TM_Item->functable[LUAITEM_USEFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string), TM_Item->string[ITEM_USEFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_USEFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_USEFUNC] = (void *)NPC_Lua_ItemUseCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_USEFUNC].string, sizeof(TM_Item->string[ITEM_USEFUNC].string), FUNCNAME_ITEMUSECALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_USEFUNC] == (void *)NPC_Lua_ItemUseCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_USEFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_USEFUNC] == NULL) + { + TM_Item->functable[LUAITEM_USEFUNC] = (void *)NULL; + TM_Item->string[ITEM_USEFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_USEFUNC] = TM_Item->sur_functable[LUAITEM_USEFUNC]; + TM_Item->sur_functable[LUAITEM_USEFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_USEFUNC].string, sizeof(TM_Item->string[ITEM_USEFUNC].string), TM_Item->sur_charfunctable[LUAITEM_USEFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetAttachEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_ATTACHFUNC] != (void *)NPC_Lua_ItemAttachCallBack) + { + if(TM_Item->functable[LUAITEM_ATTACHFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_ATTACHFUNC] = TM_Item->functable[LUAITEM_ATTACHFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_ATTACHFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_ATTACHFUNC].string), TM_Item->string[ITEM_ATTACHFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_ATTACHFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_ATTACHFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_ATTACHFUNC] = (void *)NPC_Lua_ItemAttachCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_ATTACHFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_ATTACHFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_ATTACHFUNC].string, sizeof(TM_Item->string[ITEM_ATTACHFUNC].string), FUNCNAME_ITEMATTACHCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_ATTACHFUNC] == (void *)NPC_Lua_ItemAttachCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_ATTACHFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_ATTACHFUNC] == NULL) + { + TM_Item->functable[LUAITEM_ATTACHFUNC] = (void *)NULL; + TM_Item->string[ITEM_ATTACHFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_ATTACHFUNC] = TM_Item->sur_functable[LUAITEM_ATTACHFUNC]; + TM_Item->sur_functable[LUAITEM_ATTACHFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_ATTACHFUNC].string, sizeof(TM_Item->string[ITEM_ATTACHFUNC].string), TM_Item->sur_charfunctable[LUAITEM_ATTACHFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetDetachEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_DETACHFUNC] != (void *)NPC_Lua_ItemDetachCallBack) + { + if(TM_Item->functable[LUAITEM_DETACHFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_DETACHFUNC] = TM_Item->functable[LUAITEM_DETACHFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_DETACHFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_DETACHFUNC].string), TM_Item->string[ITEM_DETACHFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_DETACHFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_DETACHFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_DETACHFUNC] = (void *)NPC_Lua_ItemDetachCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_DETACHFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_DETACHFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_DETACHFUNC].string, sizeof(TM_Item->string[ITEM_DETACHFUNC].string), FUNCNAME_ITEMDETACHCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_DETACHFUNC] == (void *)NPC_Lua_ItemDetachCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_DETACHFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_DETACHFUNC] == NULL) + { + TM_Item->functable[LUAITEM_DETACHFUNC] = (void *)NULL; + TM_Item->string[ITEM_DETACHFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_DETACHFUNC] = TM_Item->sur_functable[LUAITEM_DETACHFUNC]; + TM_Item->sur_functable[LUAITEM_DETACHFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_DETACHFUNC].string, sizeof(TM_Item->string[ITEM_DETACHFUNC].string), TM_Item->sur_charfunctable[LUAITEM_DETACHFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetDropEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_DROPFUNC] != (void *)NPC_Lua_ItemDropCallBack) + { + if(TM_Item->functable[LUAITEM_DROPFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_DROPFUNC] = TM_Item->functable[LUAITEM_DROPFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_DROPFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_DROPFUNC].string), TM_Item->string[ITEM_DROPFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_DROPFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_DROPFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_DROPFUNC] = (void *)NPC_Lua_ItemDropCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_DROPFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_DROPFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_DROPFUNC].string, sizeof(TM_Item->string[ITEM_DROPFUNC].string), FUNCNAME_ITEMDROPCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_DROPFUNC] == (void *)NPC_Lua_ItemDropCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_DROPFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_DROPFUNC] == NULL) + { + TM_Item->functable[LUAITEM_DROPFUNC] = (void *)NULL; + TM_Item->string[ITEM_DROPFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_DROPFUNC] = TM_Item->sur_functable[LUAITEM_DROPFUNC]; + TM_Item->sur_functable[LUAITEM_DROPFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_DROPFUNC].string, sizeof(TM_Item->string[ITEM_DROPFUNC].string), TM_Item->sur_charfunctable[LUAITEM_DROPFUNC].string); + } + } + } + return TM_Ret; +} + +int NPC_Lua_Item_SetPickUPEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_PICKUPFUNC] != (void *)NPC_Lua_ItemPickUPCallBack) + { + if(TM_Item->functable[LUAITEM_PICKUPFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_PICKUPFUNC] = TM_Item->functable[LUAITEM_PICKUPFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_PICKUPFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_PICKUPFUNC].string), TM_Item->string[ITEM_PICKUPFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_PICKUPFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_PICKUPFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_PICKUPFUNC] = (void *)NPC_Lua_ItemPickUPCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_PICKUPFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_PICKUPFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_PICKUPFUNC].string, sizeof(TM_Item->string[ITEM_PICKUPFUNC].string), FUNCNAME_ITEMPICKUPCALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_PICKUPFUNC] == (void *)NPC_Lua_ItemPickUPCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_PICKUPFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_PICKUPFUNC] == NULL) + { + TM_Item->functable[LUAITEM_PICKUPFUNC] = (void *)NULL; + TM_Item->string[ITEM_PICKUPFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_PICKUPFUNC] = TM_Item->sur_functable[LUAITEM_PICKUPFUNC]; + TM_Item->sur_functable[LUAITEM_PICKUPFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_PICKUPFUNC].string, sizeof(TM_Item->string[ITEM_PICKUPFUNC].string), TM_Item->sur_charfunctable[LUAITEM_PICKUPFUNC].string); + } + } + } + return TM_Ret; +} + +#ifdef _Item_ReLifeAct +int NPC_Lua_Item_SetDieReLifeEvent(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 3); + int TM_index = (int)lua_tointeger(_NLL, 3); + + ITEM_Item *TM_Item = ITEM_getItemPointer(TM_index); + + if(TM_Item == NULL) + { + LRetErrInt(_NLL , -1, "Чġ"); + } + int TM_Ret = NPC_Lua_GetFuncPoint(_NLL); + + if(lua_tointeger(_NLL, -1) > 0) + { + if(TM_Item->functable[LUAITEM_DIERELIFEFUNC] != (void *)NPC_Lua_ItemDieReLifeCallBack) + { + if(TM_Item->functable[LUAITEM_DIERELIFEFUNC] != NULL) + { + TM_Item->sur_functable[LUAITEM_DIERELIFEFUNC] = TM_Item->functable[LUAITEM_DIERELIFEFUNC]; + strcpy_s(TM_Item->sur_charfunctable[LUAITEM_DIERELIFEFUNC].string, sizeof(TM_Item->sur_charfunctable[LUAITEM_DIERELIFEFUNC].string), TM_Item->string[ITEM_DIERELIFEFUNC].string); + }else + { + TM_Item->sur_functable[LUAITEM_DIERELIFEFUNC] = (void *)NULL; + TM_Item->sur_charfunctable[LUAITEM_DIERELIFEFUNC].string[0] = '\0'; + } + + TM_Item->functable[LUAITEM_DIERELIFEFUNC] = (void *)NPC_Lua_ItemDieReLifeCallBack; + strcpy_s(TM_Item->lua_charfunctable[LUAITEM_DIERELIFEFUNC].string, sizeof(TM_Item->lua_charfunctable[LUAITEM_DIERELIFEFUNC].string), lua_tostring(_NLL, 2)); + strcpy_s(TM_Item->string[ITEM_DIERELIFEFUNC].string, sizeof(TM_Item->string[ITEM_DIERELIFEFUNC].string), FUNCNAME_ITEMDIERELIFECALLBACK); + } + }else + { + if(TM_Item->functable[LUAITEM_DIERELIFEFUNC] == (void *)NPC_Lua_ItemDieReLifeCallBack) + { + TM_Item->lua_charfunctable[LUAITEM_DIERELIFEFUNC].string[0] = '\0'; + if(TM_Item->sur_functable[LUAITEM_DIERELIFEFUNC] == NULL) + { + TM_Item->functable[LUAITEM_DIERELIFEFUNC] = (void *)NULL; + TM_Item->string[ITEM_DIERELIFEFUNC].string[0] = '\0'; + }else + { + TM_Item->functable[LUAITEM_DIERELIFEFUNC] = TM_Item->sur_functable[LUAITEM_DIERELIFEFUNC]; + TM_Item->sur_functable[LUAITEM_DIERELIFEFUNC] = (void *)NULL; + strcpy_s(TM_Item->string[ITEM_DIERELIFEFUNC].string, sizeof(TM_Item->string[ITEM_DIERELIFEFUNC].string), TM_Item->sur_charfunctable[LUAITEM_DIERELIFEFUNC].string); + } + } + } + return TM_Ret; +} +#endif + +int NPC_Lua_Item_GetDataFromItemSet(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + int TM_ID = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + if( !ITEM_CHECKITEMTABLE( TM_ID) ) + { + LRetErrInt(_NLL , -1, "ĵIDЧġ"); + } + if (TM_Flg 0 ) { + if( map_type >= 0 ) { // map_type >= 0 Ȼؼ¼ + if( map == map_type && map >= 0 ) {//ؼ¼ + }else { + maparray[0] = (point>>16)&0xffffff; + maparray[1] = (point>>8)&0xff; + maparray[2] = (point>>0)&0xff; + } + } + } + else if( map == 10032 ){ + maparray[0] = 10030; + maparray[1] = 52; + maparray[2] = 36; + } +#ifdef _MAP_TIME + else if (map >= 30017 && map >= 30021) + { + maparray[0]= 30008; + maparray[1] = 39; + maparray[2] = 39; + } +#endif + else { + maparray[0] = map; + maparray[1] = 0; + maparray[2] = 0; + } + LRetArray(_NLL,maparray,arraysizeof(maparray)); +} + +int NPC_Lua_Map_GetfloorX(lua_State *_NLL) //ȡͼX +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int x; + x = MAP_getfloorX(map); + LRetInt(_NLL, x); +} + +int NPC_Lua_Map_GetfloorY(lua_State *_NLL) //ȡͼY +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int y; + y = MAP_getfloorX(map); + LRetInt(_NLL, y); +} + +int NPC_Lua_Map_GetTileAndObjId(lua_State *_NLL) //ȡͼijĵذװβ +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int x = (int)lua_tointeger(_NLL, 2); + int y = (int)lua_tointeger(_NLL, 3); + int *tile = -1, *obj = -1; + MAP_getTileAndObjData(map,x,y,&tile,&obj); + int maparray[2]; + maparray[0]=tile; + maparray[1]=obj; + LRetArray(_NLL,maparray,arraysizeof(maparray)); +} + +int NPC_Lua_Map_SetTileAndObjId(lua_State *_NLL) //õͼijĵذװβ +{ + CheckEx(_NLL, 5); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int x = (int)lua_tointeger(_NLL, 2); + int y = (int)lua_tointeger(_NLL, 3); + int tile = (int)lua_tointeger(_NLL, 4); + int obj = (int)lua_tointeger(_NLL, 5); + if (MAP_setTileAndObjData(map,x,y,tile,obj)) LRetInt(_NLL, 0); + LRetInt(_NLL, -1); +} + +int NPC_Lua_Map_GetWalkAbleFromPoint(lua_State *_NLL) //ȡijǷ +{ + CheckEx2(_NLL, 3,4); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int map = (int)lua_tointeger(_NLL, 1); + int x = (int)lua_tointeger(_NLL, 2); + int y = (int)lua_tointeger(_NLL, 3); + BOOL IsFly = FALSE; + if(TM_Top==4){ + IsFly = (BOOL)lua_toboolean(_NLL, 4); + } + IsFly = MAP_walkAbleFromPoint(map,x,y,IsFly); + LRetBool(_NLL, IsFly); +} + +int NPC_Lua_Map_GetImageData(lua_State *_NLL) //ȡͼƬ +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int MapImageid = (int)lua_tointeger(_NLL, 1); + int flg = (int)lua_tointeger(_NLL, 2); + if(flg >= 0) + { + if(flg < LUA_DATALINE1) + { + flg -= LUA_DATALINE0; + int TM_RetInt = MAP_getImageInt(MapImageid, flg); + LRetInt(_NLL, TM_RetInt); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} +int NPC_Lua_Map_SetImageData(lua_State *_NLL) //ͼƬ +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int MapImageid = (int)lua_tointeger(_NLL, 1); + int flg = (int)lua_tointeger(_NLL, 2); + int val = (int)lua_tointeger(_NLL, 3); + if(flg >= 0) + { + if(flg < LUA_DATALINE1) + { + flg -= LUA_DATALINE0; + BOOL TM_RetBool = MAP_setImageInt(MapImageid, flg, val); + LRetBool(_NLL, TM_RetBool); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} +static OBJECT TM_Object = NULL; +int NPC_Lua_Map_GetTopObj(lua_State *_NLL) //ȡͼij϶ +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int x = (int)lua_tointeger(_NLL, 2); + int y = (int)lua_tointeger(_NLL, 3); + TM_Object = MAP_getTopObj( map, x, y) ; + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_Map_GetNextObj(lua_State *_NLL) //ȡһ +{ + CheckEx(_NLL, 0); + int TM_ObjIndex = GET_OBJINDEX(TM_Object); + TM_Object = NEXT_OBJECT(TM_Object); + if( !CHECKOBJECTUSE(TM_ObjIndex) ) + { + LRetInt(_NLL, -1); + TM_Object = NULL; + } + LRetInt(_NLL, TM_ObjIndex); +} + +int NPC_Lua_Map_CheckImageIndex(lua_State *_NLL) //ijͼͼƬǷ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + BOOL TM_Ret = IsValidImagenumber( map) ; + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Map_CheckIndex(lua_State *_NLL) //ijͼŵͼǷ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + BOOL TM_Ret = CHECKFLOORID( map) ; + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Map_MakeNewMap(lua_State *_NLL) //һͼµͼ +{ + CheckEx2(_NLL, 1, 2); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int map = (int)lua_tointeger(_NLL, 1); + char *name = ""; + if(TM_Top == 2) + { + CheckIndexNull(_NLL, 2); + name = lua_tostring(_NLL, 2); + } + int TM_Ret = MAP_makenew( map,name) ; + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Map_DelNewMap(lua_State *_NLL) //ɾһͼ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + BOOL TM_Ret = MAP_DelMap( map) ; + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Map_SetExWarp(lua_State *_NLL) //һͼ˳͵ +{ + CheckEx(_NLL, 5); + CheckIndexNull(_NLL, 1); + int map = (int)lua_tointeger(_NLL, 1); + int exfl = (int)lua_tointeger(_NLL, 2); + int exx = (int)lua_tointeger(_NLL, 3); + int exy = (int)lua_tointeger(_NLL, 4); + int type = (int)lua_tointeger(_NLL, 4);//ͼ + BOOL TM_Ret = MAP_SetExWarp( map, exfl,exx,exy,type) ; + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Map_SetMapPoint(lua_State *_NLL) //һͼ͵ һ͵ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + char* mappoint = lua_tostring(_NLL, 1); + int TM_Ret = SetMapPoint( mappoint) ; + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Map_DelMapPoint(lua_State *_NLL) //ɾһ͵ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int ps = (int)lua_tointeger(_NLL, 1); + BOOL TM_Ret = DelMapPoint( ps) ; + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Map_getFloorName(lua_State *_NLL) //һͼ +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int MapID = (int)lua_tointeger(_NLL, 1); + char *MapName = MAP_getFloorName( MapID) ; + LRetMsg(_NLL, MapName); +} + +int NPC_Lua_Map_Upmap(lua_State *_NLL) //µͼ +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int formatmap = (int)lua_tointeger(_NLL, 2); + int tomap = (int)lua_tointeger(_NLL, 3); + lssproto_Upmap_send(TM_Index,formatmap,tomap); + LRetBool(_NLL, TRUE); +} + + + diff --git a/npc_lua/npc_lua_nl.c b/npc_lua/npc_lua_nl.c new file mode 100644 index 0000000..aacd4ae --- /dev/null +++ b/npc_lua/npc_lua_nl.c @@ -0,0 +1,425 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" +#include +#include +#include "autil.h" +#include "configfile.h" +#ifdef _JZ_NEWSCRIPT_LUA + +extern char M_OutErrMsg[1024]; +extern lua_State *M_Script_Lua; +extern unsigned int M_Create_Num; +static char Buff_Data[1024*64]; +static int Check_Num=0; + + +////////////////////////////////////////////////////////////////////////////// +int NPC_Lua_NL_GetErrorStr(lua_State *_NLL) +{ + CheckEx(_NLL, 0); + + LRetMsg(_NLL, M_OutErrMsg); +} + +BOOL NPC_Lua_NL_Mod(lua_State *_NLL) +{ + CheckEx2(_NLL, 1, 2); + int num = (int)lua_tointeger(_NLL, 1); + int num2 = 2; + int TM_Top = lua_gettop(_NLL); + if (TM_Top == 2) + { + int num2 = (int)lua_tointeger(_NLL, 2); + } + if(num%num2==0) + { + LRetBool(_NLL,TRUE); + } + else + { + LRetBool(_NLL,FALSE); + } +} + +BOOL NPC_Lua_CheckNpcEventFree(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + char *TM_NpcStr = lua_tostring(_NLL, 3); + int TM_NPCindex = (int)lua_tointeger(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 2); + char magicname[256]; + int i = 1; + BOOL ret; + BOOL ret1; + while (TRUE) { + ret = getStringFromIndexWithDelim( TM_NpcStr, "|", i, magicname, sizeof( magicname)); + if (!ret) + { + ret = getStringFromIndexWithDelim( TM_NpcStr, "/", i, magicname, sizeof( magicname)); + if (!ret) + { + ret = getStringFromIndexWithDelim( TM_NpcStr, "\\", i, magicname, sizeof( magicname)); + if (!ret) + { + break; + } + } + } + ret1 = ActionNpc_CheckFree(TM_NPCindex,TM_index,magicname); + if (!ret1) + { + break; + } + i +=1; + } + LRetBool(_NLL, ret1); +} + +BOOL NPC_Lua_DoNpcEventAction(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + char *TM_NpcStr = lua_tostring(_NLL, 3); + int TM_NPCindex = (int)lua_tointeger(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 2); + char magicname[256]; + int i = 1; + BOOL ret; + BOOL ret1; + while (TRUE) { + ret = getStringFromIndexWithDelim( TM_NpcStr, "|", i, magicname, sizeof( magicname)); + if (!ret) + { + ret = getStringFromIndexWithDelim( TM_NpcStr, "/", i, magicname, sizeof( magicname)); + if (!ret) + { + ret = getStringFromIndexWithDelim( TM_NpcStr, "\\", i, magicname, sizeof( magicname)); + if (!ret) + { + break; + } + } + } + ret1 = Action_RunDoEventAction(TM_NPCindex,TM_index,magicname); + i +=1; + } + LRetBool(_NLL, ret1); +} + + +int NPC_Lua_NL_CreateNpc(lua_State *_NLL) +{ + //4 + CheckEx2(_NLL, 2, 4); + char *TM_DoFile = lua_tostring(_NLL, 1); + char *TM_InitFuncName = lua_tostring(_NLL, 2); + BOOL TM_IsFly = FALSE; + char *TM_seek = NULL; + int TM_Top = lua_gettop(_NLL); + + if(TM_Top >= 3) + { + TM_IsFly = (BOOL)lua_toboolean(_NLL, 3); + } + if(TM_Top == 4) + { + TM_seek = lua_tostring(_NLL, 4); + } + + int TM_Ret = NPC_Lua_Create(TM_DoFile, TM_InitFuncName, TM_seek, TM_IsFly); + + LRet(TM_Ret); +} + + +int NPC_Lua_NL_DelNpc(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_Ret = NPC_Lua_Del(TM_index); + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NL_GetStringFromIndexWithDelim(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + char* string = (char*)lua_tostring(_NLL, 1); + char* delim = (char*)lua_tostring(_NLL, 2); + int index = (int)lua_tointeger(_NLL, 3); + char token[128]; + getStringFromIndexWithDelim( string,delim,index,token,sizeof(token)); + LRetMsg(_NLL,token); +} + +BOOL NPC_Lua_NL_ANSI_PlayerLoop(lua_State *_NLL) +{ + CheckEx2(_NLL,0, 1); + int i; + static int indexn = 0; + int TM_Top = lua_gettop(_NLL); + BOOL TM_IsFly = FALSE; + if(TM_Top >= 1) + { + TM_IsFly = (BOOL)lua_toboolean(_NLL, 1); + } + if (TM_IsFly){ + indexn = 0; + LRetBool(_NLL, TRUE); + return; + } + int playernum = CHAR_getPlayerMaxNum(); + for( i = indexn ; i < playernum ; i++) { + if( CHAR_CHECKINDEX(i) ){ + indexn++; + LRetInt(_NLL, i); + break; + } + } + LRetInt(_NLL, -1); +} + +BOOL NPC_Lua_NL_ANSI_PetLoop(lua_State *_NLL) +{ + CheckEx2(_NLL,0, 1); + int i; + int MAXPLAYER = CHAR_getPlayerMaxNum(); + int MAXPET = CHAR_getPetMaxNum(); + static int indexn = 0; + int TM_Top = lua_gettop(_NLL); + BOOL TM_IsFly = FALSE; + if(TM_Top >= 1) + { + TM_IsFly = (BOOL)lua_toboolean(_NLL, 1); + } + if (TM_IsFly){ + indexn = MAXPLAYER; + LRetBool(_NLL, TRUE); + return; + } + + for( i = indexn ; i < MAXPLAYER+MAXPET ; i++) { + if( CHAR_CHECKINDEX(i) ){ + indexn++; + LRetInt(_NLL, i); + break; + } + } + LRetInt(_NLL, -1); +} + + + +BOOL NPC_Lua_NL_ANSI_ItemLoop(lua_State *_NLL) +{ + CheckEx2(_NLL,0, 1); + int i; + static int indexn = 0; + int TM_Top = lua_gettop(_NLL); + BOOL TM_IsFly = FALSE; + if(TM_Top >= 1) + { + TM_IsFly = (BOOL)lua_toboolean(_NLL, 1); + } + if (TM_IsFly){ + indexn = 0; + LRetBool(_NLL, TRUE); + return; + } + int itemnum = ITEM_getITEM_itemnum(); + for( i = indexn ; i < itemnum ; i++) { + if( ITEM_CHECKINDEX(i) ){ + indexn++; + LRetInt(_NLL, i); + break; + } + } + LRetInt(_NLL, -1); +} + +BOOL NPC_Lua_NL_PetLoopGetNext(lua_State *_NLL) +{ + int MAXPLAYER = CHAR_getPlayerMaxNum(); + int MAXPET = CHAR_getPetMaxNum(); + + CheckEx(_NLL, 1); + int i; + char *TM_FuncName = lua_tostring(_NLL, 1); + char TM_RetBuff[128]; + + for( i = MAXPLAYER ; i < MAXPLAYER+MAXPET ; i++) { + if( CHAR_CHECKINDEX(i) ){ + NPC_Lua_CallFunc(TM_FuncName, &TM_RetBuff, sizeof(TM_RetBuff), i); + } + } + LRetBool(_NLL, TRUE); + +} + +int NPC_Lua_NL_ItemLoopGetNext(lua_State *_NLL) +{ + int itemnum = ITEM_getITEM_itemnum(); + CheckEx(_NLL, 1); + int i; + char *TM_FuncName = lua_tostring(_NLL, 1); + char TM_RetBuff[128]; + + for( i = 0 ; i < itemnum ; i++) { + if( ITEM_CHECKINDEX(i) ){ + NPC_Lua_CallFunc(TM_FuncName, &TM_RetBuff, sizeof(TM_RetBuff), i); + } + } + LRetBool(_NLL, TRUE); + +} + +BOOL NPC_Lua_NL_PlayerLoopGetNext(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int i; + char *TM_FuncName = lua_tostring(_NLL, 1); + char TM_RetBuff[128]; + int playernum = CHAR_getPlayerMaxNum(); + for( i = 0 ; i < playernum ; i++) { + if( CHAR_CHECKINDEX(i) ){ + NPC_Lua_CallFunc(TM_FuncName, &TM_RetBuff, sizeof(TM_RetBuff), i); + } + } + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NL_GetConfigLineType(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int i; + char *TM_ConfigName = lua_tostring(_NLL, 1); + int TM_Type = GetConfigLineType(TM_ConfigName); + LRetInt(_NLL, TM_Type); +} + +int NPC_Lua_NL_GetConfigLineVal(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int i; + char *TM_ConfigName = lua_tostring(_NLL, 1); + char *TM_RETMSG = GetConfigLineVal(TM_ConfigName); + LRetMsg(_NLL, TM_RETMSG); +} + +int NPC_Lua_NL_SetTimer(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + int i; + char *TM_FileName = lua_tostring(_NLL, 1); + char *TM_FuncName = lua_tostring(_NLL, 2); + unsigned int EspTime = (int)lua_tointeger(_NLL, 3); + int Timer_s = SetTimer_net(TM_FileName,TM_FuncName,EspTime); + LRetInt(_NLL, Timer_s); +} + +int NPC_Lua_NL_DelTimer(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int ID = (int)lua_tointeger(_NLL, 1); + BOOL TM_Ret = DelTimer_net(ID); + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NL_RunSaFuncII(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + char *TM_FuncName = lua_tostring(_NLL, 1); + int i1 = (int)lua_tointeger(_NLL, 2); + int i2 = (int)lua_tointeger(_NLL, 3); + typedef void (*GMSVFUNC)(int,int); + GMSVFUNC atf; + atf=(GMSVFUNC)(void*)TM_FuncName; + if( atf ) + atf( i1,i2 ); +} + +int NPC_Lua_NL_RunSaFuncIII(lua_State *_NLL) +{ + CheckEx(_NLL, 4); + CheckIndexNull(_NLL, 1); + char *TM_FuncName = lua_tostring(_NLL, 1); + int i1 = (int)lua_tointeger(_NLL, 2); + int i2 = (int)lua_tointeger(_NLL, 3); + int i3 = (int)lua_tointeger(_NLL, 3); + typedef void (*GMSVFUNC)(int,int,int); + GMSVFUNC atf; + atf=(GMSVFUNC)(void*) TM_FuncName; + if( atf ) + atf( i1,i2,i3); +} + +int NPC_Lua_NL_ClsMk(lua_State *_NLL) +{ + Check_Num=0; + memset(Buff_Data,0,sizeof(Buff_Data)); + LRetInt(_NLL, 1); +} + +int NPC_Lua_NL_AddCheckNum(lua_State *_NLL) +{ + + CheckEx(_NLL,1); + CheckIndexNull(_NLL, 1); + int i = (int)lua_tointeger(_NLL, 1); + Check_Num += i; + LRetInt(_NLL, Check_Num); +} + + +int NPC_Lua_NL_Mkstring(lua_State *_NLL) +{ + + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int fd = getfdFromCharaIndex(TM_index ); + char *TM_data = lua_tostring(_NLL, 2); + int checknum=0; + checknum = util_mkstring(fd,Buff_Data, TM_data); + LRetInt(_NLL, checknum); +} + +int NPC_Lua_NL_Mkint(lua_State *_NLL) +{ + + CheckEx(_NLL,2); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int fd = getfdFromCharaIndex(TM_index ); + int i = (int)lua_tointeger(_NLL, 2); + int checknum=util_mkint(fd,Buff_Data, i); + LRetInt(_NLL, checknum); +} + +int NPC_Lua_NL_SendMesg(lua_State *_NLL) +{ + + CheckEx(_NLL,2); + CheckIndexNull(_NLL, 1); + int charaindex = (int)lua_tointeger(_NLL, 1); + int fengbaohao = (int)lua_tointeger(_NLL, 2); + int fd = getfdFromCharaIndex(charaindex ); + util_SendMesg(fd, fengbaohao, Buff_Data); + LRetInt(_NLL, 1); + +} + +#endif //#ifdef _JZ_NEWSCRIPT_LUA + diff --git a/npc_lua/npc_lua_nlg.c b/npc_lua/npc_lua_nlg.c new file mode 100644 index 0000000..2c46e61 --- /dev/null +++ b/npc_lua/npc_lua_nlg.c @@ -0,0 +1,1633 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" +#include "configfile.h" + +#ifdef _JZ_NEWSCRIPT_LUA +extern int StateTable[]; + +////////////////////////////////////////////////////////////////////////////// +//ܽӿ +int NPC_Lua_NLG_CheckInFront(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_SurIndex = (int)lua_tointeger(_NLL, 1); + int TM_DesIndex = (int)lua_tointeger(_NLL, 2); + int TM_Distance = (int)lua_tointeger(_NLL, 3); + + BOOL TM_Ret = NPC_Util_charIsInFrontOfChar(TM_SurIndex, TM_DesIndex, TM_Distance); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_CheckObj(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + int TM_Floor = (int)lua_tointeger(_NLL, 1); + int TM_X = (int)lua_tointeger(_NLL, 2); + int TM_Y = (int)lua_tointeger(_NLL, 3); + int TM_ObjIndex = -1; + OBJECT TM_Object = NULL; + + for( TM_Object = MAP_getTopObj( TM_Floor, TM_X, TM_Y) ; TM_Object != NULL ; TM_Object = NEXT_OBJECT(TM_Object)) + { + TM_ObjIndex = GET_OBJINDEX(TM_Object); + if( !CHECKOBJECTUSE(TM_ObjIndex) ) + { + continue; + } + LRetInt(_NLL, 1); + } + LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_CharLook(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_DIR = (int)lua_tointeger(_NLL, 2); + CHAR_Look(TM_Index, TM_DIR); + LRetNull(_NLL); +} + +int NPC_Lua_NLG_CreateBattle(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 7); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Top = lua_gettop(_NLL); + int TM_i = 0; + int TM_Flg = 0; + + CREATEENEMY TM_CreateEnemy[BATTLE_ENTRY_MAX]; + int TM_ArLen = 0; + + memset(&TM_CreateEnemy, NULL, sizeof(TM_CreateEnemy)); + + int TM_CharIndex = (int)lua_tointeger(_NLL, 1); + int TM_NpcIndex = (int)lua_tointeger(_NLL, 2); + char *TM_DoFunc = NULL; + + if(TM_Top >= 3) + { + TM_DoFunc = lua_tostring(_NLL, 3); + } + + if(TM_Top >= 5) + { + TM_ArLen = luaL_getn(_NLL, 5); + TM_ArLen = min(TM_ArLen, BATTLE_ENTRY_MAX); + for(TM_i = 1; TM_i <= TM_ArLen; TM_i++) + { + lua_rawgeti(_NLL, 5, TM_i); + TM_CreateEnemy[TM_i - 1].BaseLevel = (int)lua_tointeger(_NLL, -1); + lua_pop(_NLL, 1); + } + } + + if(TM_Top >= 6) + { + TM_ArLen = luaL_getn(_NLL, 6); + TM_ArLen = min(TM_ArLen, BATTLE_ENTRY_MAX); + for(TM_i = 1; TM_i <= TM_ArLen; TM_i++) + { + lua_rawgeti(_NLL, 6, TM_i); + TM_CreateEnemy[TM_i - 1].SkillType = (int)lua_tointeger(_NLL, -1); + lua_pop(_NLL, 1); + } + } + if(TM_Top >= 7) + { + TM_Flg = (int)lua_tointeger(_NLL, 7); + } +//Ҫ + if(TM_Top >= 4) + { + TM_ArLen = luaL_getn(_NLL, 4); + TM_ArLen = min(TM_ArLen, BATTLE_ENTRY_MAX); + for(TM_i = 1; TM_i <= TM_ArLen; TM_i++) + { + lua_rawgeti(_NLL, 4, TM_i); + TM_CreateEnemy[TM_i - 1].EnemyId = ENEMY_getEnemyArrayFromId((int)lua_tointeger(_NLL, -1)); + lua_pop(_NLL, 1); + } + } +//Ȼٵôսĺ + int TM_Ret = NPC_Lua_CreateVsEnemy(_NLL, TM_CharIndex, TM_NpcIndex, TM_DoFunc, &TM_CreateEnemy, TM_ArLen, TM_Flg); +//ظʾʧ + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_DelPet(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_PetID = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_PetIndex = -1; + int TM_Ret = 0; + int TM_Count = 0; + + if(lua_gettop(_NLL) == 3) + { + TM_Num = (int)lua_tointeger(_NLL, 3); + } + int i = 0; + for(i = 0; i < CHAR_MAXPETHAVE ; i++) + { + TM_PetIndex = CHAR_getCharPet( TM_Index, i); + + if(!CHAR_CHECKINDEX(TM_PetIndex)) + { + continue; + } + if(CHAR_getInt( TM_PetIndex, CHAR_PETID) != TM_PetID) + { + continue; + } + + TM_Ret = NPC_DelPet( TM_Index, i); + if(TM_Ret < 0) + { + char TM_MsgBuff[128]; + snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "ɾʱ : %d", TM_Ret); + LRetErrInt(_NLL , -1, TM_MsgBuff); + } + + TM_Count++; + if(TM_Count == TM_Num) + { + break; + } + } + LRetInt(_NLL, TM_Count); +} + +int NPC_Lua_NLG_DelHaveIndexPet(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_PetHaveIndex = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_PetIndex = -1; + int TM_Ret = 0; + + if(TM_PetHaveIndex<0 || TM_PetHaveIndex>4){ + LRetErrInt(_NLL, -1, "Чġ"); + } + TM_PetIndex = CHAR_getCharPet( TM_Index, TM_PetHaveIndex); + + if(!CHAR_CHECKINDEX(TM_PetIndex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + TM_Ret = NPC_DelPet( TM_Index, TM_PetHaveIndex); + if(TM_Ret < 0) + { + char TM_MsgBuff[128]; + snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "ɾʱ : %d", TM_Ret); + LRetErrInt(_NLL , -1, TM_MsgBuff); + } + + LRetInt(_NLL, 1); +} + +int NPC_Lua_NLG_DelItem(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemID = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + + if(lua_gettop(_NLL) == 3) + { + TM_Num = (int)lua_tointeger(_NLL, 3); + } + + BOOL TM_Ret = NPC_ActionDoPileDelItem(TM_Index, TM_ItemID, TM_Num); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_DelItemByPos(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemPos = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_ItemId= -1; + int TM_ItemIndex = -1; + + if( TM_ItemPos < CHAR_STARTITEMARRAY || TM_ItemPos > CHAR_MAXITEMHAVE -1 ) { + CHAR_talkToCli( TM_Index, -1, "λòȷ", CHAR_COLORWHITE); + return; + } + TM_ItemId = CHAR_getItemIndex(TM_Index, TM_ItemPos); + + if( TM_ItemId == -1 ) { + LRetBool(_NLL, FALSE); + } + TM_ItemIndex = CHAR_getItemIndex(TM_Index,TM_ItemPos); + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " 1 %s", ITEM_getChar( TM_ItemIndex, ITEM_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + CHAR_DelItem( TM_Index, TM_ItemPos); + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NLG_DischargeParty(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + BOOL TM_Ret = CHAR_DischargeParty( TM_index, 0); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_GivePet(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 4); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EnemyId = (int)lua_tointeger(_NLL, 2); + int TM_Level = -1; + int TM_Num = 1; + int TM_Count = 0; + int TM_PetIndex = -1; + int TM_Int = -1; + + if(lua_gettop(_NLL) >= 3) + { + TM_Level = (int)lua_tointeger(_NLL, 3); + } + + if(lua_gettop(_NLL) == 4) + { + TM_Num = (int)lua_tointeger(_NLL, 4); + } + if(TM_Num <= 0) + { + LRetErrInt(_NLL, -1, "ڵ0"); + } + int i = 0; + for(i = 0; i < TM_Num; i++) + { + TM_Int = NPC_GivePet(TM_Index, TM_Level, TM_EnemyId); + if(TM_Int < 0) + { + break; + } + TM_PetIndex = TM_Int; + TM_Count++; + } + if(TM_Count > 0) + { + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " %d ֻ %s", TM_Count, CHAR_getChar( TM_PetIndex, CHAR_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + } + LRetInt(_NLL, TM_Count); +} + +int NPC_Lua_NLG_GiveOnePet(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EnemyId = (int)lua_tointeger(_NLL, 2); + int TM_Level = -1; + int TM_PetIndex = -1; + + + if(lua_gettop(_NLL) >= 3) + { + TM_Level = (int)lua_tointeger(_NLL, 3); + } + TM_PetIndex = NPC_GivePet(TM_Index, TM_Level, TM_EnemyId); + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), "1ֻ %s", CHAR_getChar( TM_PetIndex, CHAR_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + LRetInt(_NLL, TM_PetIndex); +} + + +int NPC_Lua_NLG_GiveItem(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemId = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_ItemIndex = -1; + int TM_Int = -1; + int TM_Count = 0; + + if(lua_gettop(_NLL) == 3) + { + TM_Num = (int)lua_tointeger(_NLL, 3); + } + int i = 0; + for(i = 0; i < TM_Num; i++) + { + TM_Int = NPC_GiveItem( TM_Index, TM_ItemId); + if(TM_Int < 0) + { + break; + } + TM_ItemIndex = TM_Int; + TM_Count++; + } + if(TM_Count > 0) + { + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " %d %s", TM_Count, ITEM_getChar( TM_ItemIndex, ITEM_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + } + LRetInt(_NLL, TM_Count); +} + +int NPC_Lua_NLG_GiveOneItem(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemId = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_ItemIndex = -1; + + TM_ItemIndex = NPC_GiveItem( TM_Index, TM_ItemId); + if(TM_ItemIndex >= 0) + { + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " 1 %s", ITEM_getChar( TM_ItemIndex, ITEM_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + }else{ + LRetInt(_NLL, -1); + } + LRetInt(_NLL, TM_ItemIndex); +} + +int NPC_Lua_NLG_GiveRandItem(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + char *TM_ItemIdData = lua_tostring(_NLL, 2); + int TM_Num = 1; + int TM_ItemIndex = -1; + int TM_Int = -1; + int TM_Type = 0; + int TM_ItemId = -1; + if(lua_gettop(_NLL) == 3) + { + TM_Type = (int)lua_tointeger(_NLL, 3); + } + int TM_ItemIdStart = -1; + int TM_ItemIdEnd = -1; + char ItemIdBuf[32]; + if(getStringFromIndexWithDelim(TM_ItemIdData,",", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE){ + int TM_ItemNum = 0; + while(1){ + if(getStringFromIndexWithDelim(TM_ItemIdData,",", TM_ItemNum+1, ItemIdBuf, sizeof(ItemIdBuf)) == FALSE) + break; + TM_ItemNum++; + } + TM_ItemNum = RAND(1,TM_ItemNum); + getStringFromIndexWithDelim(TM_ItemIdData,",", TM_ItemNum, ItemIdBuf, sizeof(ItemIdBuf)); + char ItemIdBuf2[16]; + if( getStringFromIndexWithDelim(ItemIdBuf,"-", 2, ItemIdBuf2, sizeof(ItemIdBuf2)) != FALSE){ + int TM_ItemIdStart,TM_ItemIdEnd; + getStringFromIndexWithDelim(ItemIdBuf,"-", 1, ItemIdBuf2, sizeof(ItemIdBuf2)); + TM_ItemIdStart = atoi(ItemIdBuf2); + getStringFromIndexWithDelim(ItemIdBuf,"-", 2, ItemIdBuf2, sizeof(ItemIdBuf2)); + TM_ItemIdEnd = atoi(ItemIdBuf2); + TM_ItemId = RAND(TM_ItemIdStart,TM_ItemIdEnd); + }else{ + TM_ItemId = atoi(ItemIdBuf); + } + }else if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE){ + if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 1, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE) + TM_ItemIdStart = atoi(ItemIdBuf); + if(getStringFromIndexWithDelim(TM_ItemIdData,"-", 2, ItemIdBuf, sizeof(ItemIdBuf)) != FALSE) + TM_ItemIdEnd = atoi(ItemIdBuf); + if(TM_ItemIdStart<=TM_ItemIdEnd){ + TM_ItemId = RAND(TM_ItemIdStart,TM_ItemIdEnd); + } + }else{ + TM_ItemId = atoi(TM_ItemIdData); + } + if(TM_ItemId>-1){ + TM_Int = NPC_GiveItem( TM_Index, TM_ItemId); + } + if(TM_Int>=0){ + char TM_Buff[256]; + snprintf(TM_Buff, sizeof(TM_Buff), " %s", ITEM_getChar( TM_Int, ITEM_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + if(TM_Type>0){ + time_t timep; + struct tm *p; + time(&timep); + p=localtime(&timep); + timep = mktime(p); + TM_Type = timep + TM_Type; + ITEM_setInt(TM_Int,ITEM_TIME,TM_Type); + sprintf(TM_Buff,"[ʱ]%s",ITEM_getChar(TM_Int,ITEM_NAME)); + ITEM_setChar(TM_Int,ITEM_NAME,TM_Buff); + ITEM_setChar(TM_Int,ITEM_SECRETNAME,TM_Buff); + CHAR_sendStatusString(TM_Index,"I"); +// timep = TM_Type; +// p=localtime(&timep); +// int year=1900+p->tm_year; +// int mon=1+p->tm_mon; +// int date=p->tm_mday; +// int hour=p->tm_hour; +// int min=p->tm_min; +// int sec=p->tm_sec; +// char monbuf[5],datebuf[5],hourbuf[5],minbuf[5],secbuf[5]; +// if(mon<10) sprintf(monbuf,"0%d",mon); +// else sprintf(monbuf,"%d",mon); +// if(date<10) sprintf(datebuf,"0%d",date); +// else sprintf(datebuf,"%d",date); +// if(hour<10) sprintf(hourbuf,"0%d",hour); +// else sprintf(hourbuf,"%d",hour); +// if(min<10) sprintf(minbuf,"0%d",min); +// else sprintf(minbuf,"%d",min); +// if(sec<10) sprintf(secbuf,"0%d",sec); +// else sprintf(secbuf,"%d",sec); +// sprintf(TM_Buff,"Ч:%d.%s.%s/%s:%s:%s %s",year,monbuf,datebuf,hourbuf,minbuf,secbuf,ITEM_getChar(TM_Int,ITEM_EFFECTSTRING)); +// ITEM_setChar(TM_Int,ITEM_EFFECTSTRING,TM_Buff); + } + } + LRetInt(_NLL, TM_Int); +} + +int NPC_Lua_NLG_ShowWindowTalked(lua_State *_NLL) +{ + CheckEx2(_NLL, 5, 6); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_windowtype = (int)lua_tointeger(_NLL, 2); + int TM_buttontype = (int)lua_tointeger(_NLL, 3); + int TM_seqno = (int)lua_tointeger(_NLL, 4); + char *TM_data = lua_tostring(_NLL, 5); + + if(TM_data == NULL) + { + LRetErrInt(_NLL , -1, "ԻݲΪnil"); + } + + int TM_MeIndex = -1; + int TM_fd = getfdFromCharaIndex(TM_index); + + if(TM_Top == 6) + { + CheckIndexNull(_NLL, 6); + TM_MeIndex = (int)lua_tointeger(_NLL, 6); + } + + lssproto_WN_send(TM_fd, TM_windowtype, TM_buttontype, TM_seqno, CHAR_getWorkInt( TM_MeIndex, CHAR_WORKOBJINDEX), TM_data); + LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_SetAction(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Action = (int)lua_tointeger(_NLL, 2); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + CHAR_sendWatchEvent( CHAR_getWorkInt( TM_Index, CHAR_WORKOBJINDEX), TM_Action, NULL, 0,TRUE); + CHAR_setWorkInt( TM_Index, CHAR_WORKACTION, TM_Action); + + LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_TalkToCli(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 5); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int TM_toindex = (int)lua_tointeger(_NLL, 1); + char *TM_Msg = lua_tostring(_NLL, 2); + if(TM_Msg == NULL) + { + LRetErrInt(_NLL , -1, "˵ݲΪnil"); + } + + int TM_color = CHAR_COLORWHITE; + int TM_fontsize = 0; + int TM_Talkindex = -1; + + if(TM_Top >= 3) + { + TM_color = (int)lua_tointeger(_NLL, 3); + } + if(TM_Top >= 4) + { + TM_fontsize = (int)lua_tointeger(_NLL, 4); + } + if(TM_Top == 5) + { + CheckIndexNull(_NLL, 5); + TM_Talkindex = (int)lua_tointeger(_NLL, 5); + } + BOOL TM_Ret = FALSE; + + if(TM_toindex == -1) + { + //ȫ˵ + int TM_playernum = CHAR_getPlayerMaxNum(); + int i = 0; + + for( i = 0 ; i < TM_playernum ; i++) + { + if( CHAR_getCharUse(i) != FALSE ) + { + #ifdef _FONT_SIZE + TM_Ret |= CHAR_talkToCliExt( i, TM_Talkindex, TM_Msg, TM_color, TM_fontsize); + #else + TM_Ret |= CHAR_talkToCli( i, TM_Talkindex, TM_Msg, TM_color); + #endif + } + } + }else + { + //ָ˵ + #ifdef _FONT_SIZE + TM_Ret = CHAR_talkToCliExt(TM_toindex, TM_Talkindex, TM_Msg, TM_color, TM_fontsize); + #else + TM_Ret = CHAR_talkToCli(TM_toindex, TM_Talkindex, TM_Msg, TM_color); + #endif + } + if(TM_Ret == TRUE) + { + LRetInt(_NLL, 0); + }else + { + LRetErrInt(_NLL , -2, "δ֪ԭ·˵ʧܡ"); + } +} + +int NPC_Lua_NLG_TalkToFloor(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 5); + + int TM_Top = lua_gettop(_NLL); + int TM_floor = (int)lua_tointeger(_NLL, 1); + char *TM_Msg = lua_tostring(_NLL, 2); + if(TM_Msg == NULL) + { + LRetErrInt(_NLL , -1, "˵ݲΪnil"); + } + + int TM_color = CHAR_COLORWHITE; + int TM_fontsize = 0; + int TM_Talkindex = -1; + + if(TM_Top >= 3) + { + TM_color = (int)lua_tointeger(_NLL, 3); + } + if(TM_Top >= 4) + { + TM_fontsize = (int)lua_tointeger(_NLL, 4); + } + if(TM_Top == 5) + { + CheckIndexNull(_NLL, 5); + TM_Talkindex = (int)lua_tointeger(_NLL, 5); + } + //ָͼ˵ + BOOL TM_Ret = FALSE; + int TM_playernum = CHAR_getPlayerMaxNum(); + int i = 0; + + for( i = 0 ; i < TM_playernum ; i++) + { + if( CHAR_getCharUse(i) != FALSE ) + { + if (CHAR_getInt(i, CHAR_FLOOR) == TM_floor) + { + #ifdef _FONT_SIZE + TM_Ret |= CHAR_talkToCliExt( i, TM_Talkindex, TM_Msg, TM_color, TM_fontsize); + #else + TM_Ret |= CHAR_talkToCli( i, TM_Talkindex, TM_Msg, TM_color); + #endif + + } + } + } + + if(TM_Ret == TRUE) + { + LRetInt(_NLL, 0); + }else + { + LRetErrInt(_NLL , -2, "δ֪ԭ·˵ʧܡ"); + } +} + +int NPC_Lua_NLG_UpChar(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + CHAR_complianceParameter( TM_Index ); + + if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPET){ + int playindex = CHAR_getWorkInt(TM_Index,CHAR_WORKPLAYERINDEX); + if(!CHAR_CHECKINDEX(playindex)){ + LRetErrInt(_NLL, -1, "Чġ"); + }else{ + int i; + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) { + int workindex = CHAR_getCharPet( playindex, i ); + if( workindex == TM_Index ){ + CHAR_send_K_StatusString( playindex, i, CHAR_K_STRING_BASEIMAGENUMBER| + CHAR_K_STRING_HP| + CHAR_K_STRING_MAXHP| + CHAR_K_STRING_MP| + CHAR_K_STRING_MAXMP| + CHAR_K_STRING_EXP| + CHAR_K_STRING_NEXTEXP| + CHAR_K_STRING_LV| + CHAR_K_STRING_ATK| + CHAR_K_STRING_DEF| + CHAR_K_STRING_QUICK| + CHAR_K_STRING_AI| + CHAR_K_STRING_EARTH| + CHAR_K_STRING_WATER| + CHAR_K_STRING_FIRE| + CHAR_K_STRING_WIND| + CHAR_K_STRING_SLOT| + CHAR_K_STRING_CHANGENAMEFLG| + CHAR_K_STRING_NAME| + CHAR_K_STRING_USERPETNAME); + char msgbuf[128]; + snprintf( msgbuf, sizeof( msgbuf ), "W%d",i); + CHAR_sendStatusString( playindex, msgbuf ); + CHAR_sendStatusString( playindex, "P"); + break; + } + } + } + }else if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){ + CHAR_send_P_StatusString( TM_Index, CHAR_P_STRING_GOLD ); + } + + if(CHAR_getFlg(TM_Index, CHAR_ISVISIBLE) == FALSE) + { + int TM_objindex = CHAR_getWorkInt(TM_Index,CHAR_WORKOBJINDEX); + + CHAR_sendCDArroundChar + ( + OBJECT_getFloor(TM_objindex), + OBJECT_getX(TM_objindex), + OBJECT_getY(TM_objindex), + TM_objindex + ); + }else + { + CHAR_sendCToArroundCharacter( CHAR_getWorkInt( TM_Index , CHAR_WORKOBJINDEX )); + } + LRetNull(_NLL); +} + +int NPC_Lua_NLG_Warp(lua_State *_NLL) +{ + CheckEx(_NLL, 4); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Floor = (int)lua_tointeger(_NLL, 2); + int TM_X = (int)lua_tointeger(_NLL, 3); + int TM_Y = (int)lua_tointeger(_NLL, 4); + + BOOL TM_Ret = CHAR_warpToSpecificPoint(TM_Index, TM_Floor, TM_X, TM_Y); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_WalkMove(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_DIR = (int)lua_tointeger(_NLL, 2); + + POINT start, end; + + end.x = CHAR_getInt( TM_Index, CHAR_X); + end.y = CHAR_getInt( TM_Index, CHAR_Y); + + int TM_Ret = (int)CHAR_walk(TM_Index, TM_DIR, 0); + + if( TM_Ret == CHAR_WALKSUCCESSED ) + { + int i; + int mefl=CHAR_getInt( TM_Index, CHAR_FLOOR); + int toindex = -1; + int fl = 0; + int xx = 0; + int yy = 0; + int parent_dir; + + for( i = 1; i < CHAR_PARTYMAX; i ++ ) + { + toindex = CHAR_getWorkInt( TM_Index, i + CHAR_WORKPARTYINDEX1); + fl = CHAR_getInt( toindex, CHAR_FLOOR); + xx = CHAR_getInt( toindex, CHAR_X); + yy = CHAR_getInt( toindex, CHAR_Y); + + if( CHAR_CHECKINDEX(toindex) && (mefl==fl) && (abs(xx-end.x)+abs(yy-end.y)<10) ) + { + + start.x = xx; + start.y = yy; + parent_dir = NPC_Util_getDirFromTwoPoint( &start,&end ); + + end.x = start.x; + end.y = start.y; + + if( parent_dir != -1 ) + { + CHAR_walk( toindex, parent_dir, 0); + } + } + } + } + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_WatchEntry(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ToIndex = (int)lua_tointeger(_NLL, 2); + if( BATTLE_WatchEntry(TM_Index, TM_ToIndex) == 0) + { + LRetInt(_NLL, 0); + }else + { + LRetInt(_NLL, -1); + } +} + +int NPC_Lua_Char_GetOnLinePlayer(lua_State *_NLL) +{ + CheckEx(_NLL, 0); + LRetInt(_NLL, abs(StateTable[LOGIN])); +} + +int NPC_Lua_NLG_UpStateBySecond(lua_State *_NLL) +{ + CheckEx2(_NLL, 1, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + char TM_Buff[128]; + int TM_fd = getfdFromCharaIndex(TM_Index); +#ifdef _SAF_MAKE + snprintf(TM_Buff, sizeof(TM_Buff), "FAME|%d|%d|%d", CHAR_getInt(TM_Index,CHAR_FAME)/100, (int)lua_tointeger(_NLL, 2), (int)lua_tointeger(_NLL, 3)); +#else + snprintf(TM_Buff, sizeof(TM_Buff), "FAME|%d", CHAR_getInt(TM_Index,CHAR_FAME)/100); +#endif + lssproto_S2_send(TM_fd,TM_Buff); + LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_UpStateByThird(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + BOOL TM_Ret = CHAR_send_P_StatusString(TM_Index, TM_Flg); + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_Update_Party(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + CHAR_PartyUpdate(TM_Index, TM_Flg); + LRetNull(_NLL); +} + +int NPC_Lua_NLG_CreateBattlePvP(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int TM_Index1 = (int)lua_tointeger(_NLL, 1); + int TM_Index2 = (int)lua_tointeger(_NLL, 2); + int TM_Ret = -1; + int TM_BattleIndex = -1; + + if( (CHAR_getInt( TM_Index2, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) || (CHAR_getInt( TM_Index1, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER)){ + LRetErrInt(_NLL, -1, "Ͳ"); + } + if( (CHAR_getWorkInt( TM_Index2, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) || (CHAR_getWorkInt( TM_Index1, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)) + { + LRetErrInt(_NLL, -2, "ڶս"); + } + if( CHAR_getWorkInt( TM_Index2, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ) + { + int TM_Index = CHAR_getWorkInt( TM_Index2, CHAR_WORKPARTYINDEX1 ); + + if( TM_Index < 0 ) + { + LRetErrInt(_NLL, -3, "Ķ쳣"); + } + } + if( CHAR_getWorkInt( TM_Index1, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ) + { + int TM_Index = CHAR_getWorkInt( TM_Index1, CHAR_WORKPARTYINDEX1 ); + + if( TM_Index < 0 ) + { + LRetErrInt(_NLL, -3, "Ķ쳣"); + } + } + TM_Ret = NPC_Lua_CreateVsPlayer(&TM_BattleIndex, TM_Index1, TM_Index2); + if(TM_Ret != 0) + { + char TM_Buff[64]; + snprintf(TM_Buff, sizeof(TM_Buff), "ʧܣ:%d", TM_Ret); + LRetErrInt(_NLL, -4, TM_Buff); + } + LRetInt(_NLL, TM_BattleIndex); +} + +int NPC_Lua_NLG_SearchWatchBattleRandIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Floor = (int)lua_tointeger(_NLL, 2); + int TM_Ret = -1; + + if( (CHAR_getInt( TM_Index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) ){ + LRetErrInt(_NLL, -1, "Ͳ"); + } + if( (CHAR_getWorkInt( TM_Index, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) ) + { + LRetErrInt(_NLL, -2, "ڶս"); + } + if( CHAR_getWorkInt( TM_Index, CHAR_WORKPARTYMODE ) == CHAR_PARTY_CLIENT ) + { + int TM_Index2 = CHAR_getWorkInt( TM_Index, CHAR_WORKPARTYINDEX1 ); + + if( TM_Index2 < 0 ) + { + LRetErrInt(_NLL, -3, "Ķ쳣"); + } + } + TM_Ret = SearchFmWarRandIndex(TM_Index, TM_Floor); + if(TM_Ret != 0) + { + char TM_Buff[64]; + snprintf(TM_Buff, sizeof(TM_Buff), "սɿ:%d", TM_Floor); + LRetErrInt(_NLL, -4, TM_Buff); + } + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_GetMaxPlayNum(lua_State *_NLL) +{ + int TM_playernum = CHAR_getPlayerMaxNum(); + LRetInt(_NLL, TM_playernum); +} + +int NPC_Lua_NLG_CheckPlayIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + LRetInt(_NLL, TM_Index); +} + +int NPC_Lua_NLG_Save(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if(!CHAR_CHECKINDEX(TM_Index)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + CHAR_charSaveFromConnect(TM_Index, FALSE); + LRetInt(_NLL, TM_Index); +} + +//////////////// add by Mo. +int NPC_Lua_NLG_SetExp(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int TM_Exp = (int)lua_tointeger(_NLL, 1); + if( TM_Exp <= 0 ) + { + LRetErrInt(_NLL, -3, ""); + } + setBattleexp(TM_Exp); + LRetNull(_NLL); +} + +int NPC_Lua_NLG_GetExp(lua_State *_NLL) +{ + int ret = getBattleexp(); + LRetInt(_NLL, ret); +} + +#ifdef _PETTRANS_RANGE +int NPC_Lua_NLG_SetPetTransRange(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + + int TM_X = (int)lua_tointeger(_NLL, 1); + int TM_Y = (int)lua_tointeger(_NLL, 2); + int TM_Z = (int)lua_tointeger(_NLL, 3); + setPetTransRangeX(TM_X); + setPetTransRangeY(TM_Y); + setPetTransRangeZ(TM_Z); + LRetNull(_NLL); +} +int NPC_Lua_NLG_GetPetTransRange(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if (TM_Index == 1){ + int ret = getPetTransRangeX(); + LRetInt(_NLL, ret); + } + if (TM_Index == 2){ + int ret = getPetTransRangeY(); + LRetInt(_NLL, ret); + } + if (TM_Index == 3){ + int ret = getPetTransRangeZ(); + LRetInt(_NLL, ret); + } + LRetErrInt(_NLL, -1, "IJЧġ"); +} +#endif + +int NPC_Lua_NLG_InputCard(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + + int TM_Index1 = (int)lua_tointeger(_NLL, 1); + ITEM_OnlineCost(TM_Index1, -1, -1); + LRetNull(_NLL); +} + +int NPC_Lua_NLG_UpItem(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + + int charaindex = (int)lua_tointeger(_NLL,1); + if( !CHAR_CHECKINDEX( charaindex)){ + return 0; + } + int MAX = 27; + int i= 0; + for ( i = 0; i <= MAX; i++){ + CHAR_sendItemDataOne( charaindex, i); + } + return 0; +} + +int NPC_Lua_NLG_GivePetOne(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 4); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_EnemyId = (int)lua_tointeger(_NLL, 2); + int TM_Level = 1; + int TM_PetIndex = -1; + int TM_Int = -1; + + if(lua_gettop(_NLL) >= 3) + { + TM_Level = (int)lua_tointeger(_NLL, 3); + } + + TM_Int = NPC_GivePet(TM_Index, TM_Level, TM_EnemyId); + if(TM_Int >= 0) + { + TM_PetIndex = TM_Int; + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " 1 ֻ %s", CHAR_getChar( TM_PetIndex, CHAR_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + } + LRetInt(_NLL, TM_PetIndex); +} + +int NPC_Lua_NLG_GiveItemOne(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemId = (int)lua_tointeger(_NLL, 2); + int TM_ItemIndex = -1; + int TM_Int = -1; + + TM_Int = NPC_GiveItem( TM_Index, TM_ItemId); + + if(TM_Int >= 0) + { + TM_ItemIndex = TM_Int; + char TM_Buff[128]; + snprintf(TM_Buff, sizeof(TM_Buff), " 1 %s", ITEM_getChar( TM_ItemIndex, ITEM_NAME)); + CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW); + } + LRetInt(_NLL, TM_ItemIndex); +} + +int NPC_Lua_NLG_DelItemByIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + CheckIndexNull(_NLL, 2); + int charaindex = (int)lua_tointeger(_NLL, 1); + if( CHAR_CHECKINDEX( charaindex ) == FALSE ){ + LRetInt(_NLL, -1); + return -1; + } + int haveitemindex = (int)lua_tointeger(_NLL, 2); + int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); + if(!ITEM_CHECKINDEX(itemindex)) { + LRetInt(_NLL, -1); + return -1; + } + CHAR_DelItem( charaindex, haveitemindex); + LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_FindPet(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_PetID = (int)lua_tointeger(_NLL, 2); + int TM_Count = 0; + + int i = 0; + for(i = 0; i < CHAR_MAXPETHAVE ; i++) + { + if (CHAR_getCharPet( TM_Index, i) == -1) TM_Count++; + } + LRetInt(_NLL, TM_Count); +} + +int NPC_Lua_NLG_GetMap(lua_State *_NLL) +{ + CheckEx2(_NLL, 1, 3); + CheckIndexNull(_NLL, 1); + + int TM_Index = (int)lua_tointeger(_NLL, 1); + + BOOL TM_Ret = CHAR_CHAT_GetMap( TM_Index, ""); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_PetUp(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_PetIndex = (int)lua_tointeger(_NLL, 2); + int TM_LV = 1; + + if(lua_gettop(_NLL) == 3) + { + TM_LV = (int)lua_tointeger(_NLL, 3); + } + + BOOL TM_Ret = NPC_PetUp(TM_Index, TM_LV, TM_PetIndex); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_AddSk(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_SkIndex = (int)lua_tointeger(_NLL, 2); + int TM_SkLV = 1; + + if(lua_gettop(_NLL) == 3) + { + TM_SkLV = (int)lua_tointeger(_NLL, 3); + } + + BOOL TM_Ret = NPC_AddSk(TM_Index, TM_SkIndex, TM_SkLV); + + LRetInt(_NLL, TM_Ret); +} + + +int NPC_Lua_NLG_SetZy(lua_State *_NLL) +{ + CheckEx2(_NLL, 2, 3); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ZyIndex = (int)lua_tointeger(_NLL, 2); + + BOOL TM_Ret = NPC_SetZy(TM_Index, TM_ZyIndex); + + LRetBool(_NLL, TM_Ret); +} + +int NPC_Lua_Char_GetPlayerMaxNum(lua_State *_NLL) +{ + CheckEx(_NLL, 0); + LRetInt(_NLL, CHAR_getPlayerMaxNum()); +} + +int NPC_Lua_NLG_GetXY(lua_State *_NLL) +{ + CheckEx2(_NLL, 1, 2); + CheckIndexNull(_NLL, 1); + int TM_MAP = (int)lua_tointeger(_NLL, 1); + LRetInt(_NLL, QuBiao(TM_MAP)); +} + +int NPC_Lua_NLG_WalkJc(lua_State *_NLL)//ǰϰ +{ + CheckEx(_NLL, 5); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Floor = (int)lua_tointeger(_NLL, 2); + int TM_Ox = (int)lua_tointeger(_NLL, 3); + int TM_Oy = (int)lua_tointeger(_NLL, 4); + int TM_DIR = (int)lua_tointeger(_NLL, 5); + + int TM_Ret = (int)CHAR_walk_jjc(TM_Index,TM_Floor,TM_Ox,TM_Oy,TM_DIR); + + if( TM_Ret == CHAR_WALKSUCCESSED ) + { + LRetInt(_NLL, 1); + }else LRetInt(_NLL, 0); +} + +int NPC_Lua_NLG_KickPlayer(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + if( !CHAR_CHECKINDEX( TM_index)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + CONNECT_setCloseRequest( getfdFromCharaIndex(TM_index) , 1 ); + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NLG_HealOne(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + if( !CHAR_CHECKINDEX( TM_index)) { + LRetErrInt(_NLL , -1, "Чģ"); + return; + } + CHAR_setInt( TM_index , CHAR_HP,99999999 ); + CHAR_setInt( TM_index , CHAR_MP,99999999 ); + CHAR_complianceParameter( TM_index ); + CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_HP); + CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_MP); + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NLG_HealAll(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_PetIndex = -1; + if( !CHAR_CHECKINDEX( TM_index)) { + LRetErrInt(_NLL , -1, "Чģ"); + return; + } + CHAR_setInt( TM_index , CHAR_HP,99999999 ); + CHAR_setInt( TM_index , CHAR_MP,99999999 ); + CHAR_complianceParameter( TM_index ); + CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_HP); + CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_MP); + int i = 0; + for(i = 0; i < CHAR_MAXPETHAVE ; i++) + { + TM_PetIndex = CHAR_getCharPet( TM_index, i); + + if(!CHAR_CHECKINDEX(TM_PetIndex)) + { + continue; + } + CHAR_setInt( TM_PetIndex , CHAR_HP,99999999 ); + CHAR_complianceParameter( TM_PetIndex ); + char msgbuf[64]; + snprintf( msgbuf, sizeof( msgbuf ), "K%d", i ); + CHAR_sendStatusString( TM_index, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", i ); + CHAR_sendStatusString( TM_index, msgbuf ); +#ifdef _PET_SKILL2 + snprintf( msgbuf, sizeof( msgbuf ), "Q%d", i ); + CHAR_sendStatusString( TM_index, msgbuf ); +#endif + } + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NLG_LevelUpTo(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_LV = (int)lua_tointeger(_NLL, 2); + int i; + if( !CHAR_CHECKINDEX( TM_index)) { + LRetErrInt(_NLL , -1, "Чģ"); + return; + } + TM_LV = TM_LV - CHAR_getInt( TM_index, CHAR_LV); + if (TM_LV <= 0) //ʧ + { + LRetBool(_NLL, FALSE); + } + if (CHAR_getInt( TM_index, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER)//Ļ + { + CHAR_setInt(TM_index,CHAR_SKILLUPPOINT, + CHAR_getInt(TM_index,CHAR_SKILLUPPOINT)+TM_LV*3); + CHAR_Skillupsend(TM_index); + CHAR_setInt(TM_index,CHAR_LV, CHAR_getInt( TM_index, CHAR_LV) + TM_LV); + CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_LV|CHAR_P_STRING_NEXTEXP); + LRetBool(_NLL, TRUE); + }else if (CHAR_getInt( TM_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET)//dzĻ + { + char token[128]; + for( i = 1; i <= TM_LV; i ++ ){ // + //CHAR_PetLevelUp( TM_index ,1); + CHAR_PetLevelUp( TM_index); + CHAR_PetAddVariableAi( TM_index, AI_FIX_PETLEVELUP ); + CHAR_setInt( TM_index, CHAR_LV, CHAR_getInt( TM_index, CHAR_LV) +1 ); + } + int PLAYER = CHAR_getWorkInt(TM_index, CHAR_WORKPLAYERINDEX);//˵ + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) + { + if( CHAR_getCharPet( PLAYER, i ) == TM_index )break; + } + CHAR_setInt( TM_index , CHAR_HP ,CHAR_getWorkInt( TM_index, CHAR_WORKMAXHP ) ); + CHAR_setInt( TM_index , CHAR_MP ,CHAR_getWorkInt( TM_index, CHAR_WORKMAXMP ) ); + CHAR_complianceParameter( TM_index ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( PLAYER, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( PLAYER, token ); +#ifdef _PET_SKILL2 + snprintf( token, sizeof( token ), "Q%d", i ); + CHAR_sendStatusString( TM_index, token ); +#endif + } + LRetBool(_NLL, TRUE); +} + + +int NPC_Lua_NLG_AddExp(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int i; + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_EXP = (int)lua_tointeger(_NLL, 2); + if( !CHAR_CHECKINDEX( TM_index)) { + LRetErrInt(_NLL , -1, "Чģ"); + return; + } + CHAR_setInt( TM_index, CHAR_EXP,CHAR_getInt(TM_index,CHAR_EXP) + TM_EXP); + + if (CHAR_getInt( TM_index, CHAR_WHICHTYPE ) == CHAR_TYPEPET)//dzĻ + { + char token[128]; + int PLAYER = CHAR_getWorkInt(TM_index, CHAR_WORKPLAYERINDEX);//˵ + for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) + { + if( CHAR_getCharPet( PLAYER, i ) == TM_index )break; + } + CHAR_complianceParameter( TM_index ); + snprintf( token, sizeof( token ), "K%d", i ); + CHAR_sendStatusString( PLAYER, token ); + snprintf( token, sizeof( token ), "W%d", i ); + CHAR_sendStatusString( PLAYER, token ); +#ifdef _PET_SKILL2 + snprintf( token, sizeof( token ), "Q%d", i ); + CHAR_sendStatusString( PLAYER, token ); +#endif + }else CHAR_send_P_StatusString( TM_index , CHAR_P_STRING_EXP); + LRetBool(_NLL, TRUE); +} + +int NPC_Lua_NLG_UpPet(lua_State *_NLL) +{ + CheckEx2(_NLL, 1, 2); + CheckIndexNull(_NLL, 1); + int TM_Top = lua_gettop(_NLL); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_It = -1; + int i; + int petindex; + char token[64]; + if( !CHAR_CHECKINDEX( TM_Index)) { + LRetErrInt(_NLL , -1, "Чģ"); + return; + } + if (TM_Top == 2) + { + TM_It = (int)lua_tointeger(_NLL, 2); + } + if(TM_It == -1){ + for (i=0;i 4) LRetErrInt(_NLL , -1, "ָijλûг"); + + TM_PetIndex = CHAR_getCharPet( TM_Index, TM_PetID); + + if(!CHAR_CHECKINDEX(TM_PetIndex)) + { + LRetInt(_NLL, -1); + return -1; + } + + TM_Ret = NPC_DelPet( TM_Index, TM_PetID); + if(TM_Ret < 0) + { + char TM_MsgBuff[128]; + snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "ɾʱ : %d", TM_Ret); + LRetErrInt(_NLL , -1, TM_MsgBuff); + } + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_DelPetByIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Pindex = (int)lua_tointeger(_NLL, 2); + int TM_Num = 1; + int TM_PetIndex = -1; + int TM_Ret = 0; + if( !CHAR_CHECKINDEX( TM_Index)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + if( !CHAR_CHECKINDEX( TM_Pindex)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + int i = 0; + for(i = 0; i < CHAR_MAXPETHAVE ; i++) + { + TM_PetIndex = CHAR_getCharPet( TM_Index, i); + + if(!CHAR_CHECKINDEX(TM_PetIndex)) + { + continue; + } + + if (TM_PetIndex != TM_Pindex) continue; + + TM_Ret = NPC_DelPet( TM_Index, i); + if(TM_Ret < 0) + { + char TM_MsgBuff[128]; + snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "ɾʱ : %d", TM_Ret); + LRetErrInt(_NLL , -1, TM_MsgBuff); + } + + break; + } + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_NLG_GivePetByIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_PetIndex = (int)lua_tointeger(_NLL, 2); + if( !CHAR_CHECKINDEX( TM_Index)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + if( !CHAR_CHECKINDEX( TM_PetIndex)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + int havepetelement = CHAR_getCharPetElement( TM_Index); + if( havepetelement < 0 ) { + LRetErrInt(_NLL , -1, "Ŀλ"); + return; + } + CHAR_setWorkInt( TM_PetIndex, CHAR_WORKPLAYERINDEX, TM_Index);// + CHAR_setCharPet( TM_Index, havepetelement, TM_PetIndex); + CHAR_setChar( TM_PetIndex, CHAR_OWNERCDKEY, + CHAR_getChar( TM_Index, CHAR_CDKEY)); + CHAR_setChar( TM_PetIndex, CHAR_OWNERCHARANAME, + CHAR_getChar( TM_Index, CHAR_NAME)); + CHAR_complianceParameter(TM_PetIndex); + + char msgbuf[64]; + snprintf( msgbuf, sizeof( msgbuf ), "K%d", havepetelement ); + CHAR_sendStatusString( TM_Index, msgbuf ); + snprintf( msgbuf, sizeof( msgbuf ), "W%d", havepetelement ); + CHAR_sendStatusString( TM_Index, msgbuf ); +#ifdef _PET_SKILL2 + snprintf( msgbuf, sizeof( msgbuf ), "Q%d", havepetelement ); + CHAR_sendStatusString( TM_Index, msgbuf ); +#endif + LRetInt(_NLL, havepetelement); +} + +int NPC_Lua_NLG_GiveItemByIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_ItemIndex = (int)lua_tointeger(_NLL, 2); + if( !CHAR_CHECKINDEX( TM_Index)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + if( !ITEM_CHECKINDEX( TM_ItemIndex)) { + LRetErrInt(_NLL , -1, "ߴЧģ"); + return; + } + int emptyitemindexinchara = CHAR_findEmptyItemBox( TM_Index); + if( emptyitemindexinchara < 0 ) { + LRetErrInt(_NLL , -1, "Ŀλ"); + return; + } + CHAR_setItemIndex( TM_Index, emptyitemindexinchara, TM_ItemIndex ); + ITEM_setWorkInt(TM_ItemIndex, ITEM_WORKOBJINDEX,-1); + ITEM_setWorkInt(TM_ItemIndex, ITEM_WORKCHARAINDEX, TM_Index); + CHAR_sendItemDataOne( TM_Index, emptyitemindexinchara); + LRetInt(_NLL, emptyitemindexinchara); +} + +int NPC_Lua_NLG_WarpToSpecificPoint(lua_State *_NLL) +{ + + CheckEx(_NLL, 4); + CheckIndexNull(_NLL, 1); + int cindex = (int)lua_tointeger(_NLL, 1); + int fl = (int)lua_tointeger(_NLL, 2); + int x = (int)lua_tointeger(_NLL, 3); + int y = (int)lua_tointeger(_NLL, 4); + + if(!CHAR_CHECKINDEX(cindex)) + { + LRetErrInt(_NLL, -1, "Чġ"); + } + + LRetBool(_NLL,CHAR_warpToSpecificPoint(cindex,fl,x,y)); +} + +BOOL NPC_Lua_NLG_UpSkillupPoint(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + if( !CHAR_CHECKINDEX( TM_Index)) { + LRetErrInt(_NLL , -1, "ﴫЧģ"); + return; + } + CHAR_Skillupsend(TM_Index); + LRetBool(_NLL, TRUE); +} + +// +int NPC_Lua_NLG_StayEncount(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckIndexNull(_NLL, 1); + int fd,charaindex = (int)lua_tointeger(_NLL, 1); + fd = CHAR_getWorkInt( charaindex, CHAR_WORKFD); + setStayEncount(fd); + CHAR_talkToCli(charaindex, -1, "ܱܵͻȻɱ", CHAR_COLORYELLOW); +#ifdef _USER_CHARLOOPS + { + Char *ch; + ch = CHAR_getCharPointer( charaindex); + if( ch == NULL ) return; + strcpysafe( ch->charfunctable[CHAR_LOOPFUNCTEMP1].string, + sizeof( ch->charfunctable[CHAR_LOOPFUNCTEMP1]), "CHAR_BattleStayLoop");//ս + CHAR_setInt( charaindex, CHAR_LOOPINTERVAL, 2500); + CHAR_constructFunctable( charaindex); + } +#endif + LRetBool(_NLL,TRUE); +} + +int NPC_Lua_NLG_HealerAllHeal(lua_State *_NLL) +{ + CheckEx(_NLL,1); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + NPC_HealerAllHeal(TM_Index); + LRetNull(_NLL); +} + +#endif //#ifdef _JZ_NEWSCRIPT_LUA diff --git a/npc_lua/npc_lua_obj.c b/npc_lua/npc_lua_obj.c new file mode 100644 index 0000000..4c1ac7d --- /dev/null +++ b/npc_lua/npc_lua_obj.c @@ -0,0 +1,140 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" + +#ifdef _JZ_NEWSCRIPT_LUA + +int NPC_Lua_Obj_GetType(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getType(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_GetCharType(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getchartype(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_GetCharIndex(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getIndex(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_GetX(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getX(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_GetY(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getY(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_GetFloor(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + + int TM_Ret = OBJECT_getFloor(TM_index); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_SetType(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + int TM_Ret = OBJECT_setType(TM_index, TM_vl); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_SetCharType(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + OBJECT_setchartype(TM_index, TM_vl); + + LRetNull(_NLL); +} + +int NPC_Lua_Obj_SetX(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + int TM_Ret = OBJECT_setX(TM_index, TM_vl); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_SetY(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + int TM_Ret = OBJECT_setY(TM_index, TM_vl); + + LRetInt(_NLL, TM_Ret); +} + +int NPC_Lua_Obj_SetFloor(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckObjIndexNull(_NLL, 1); + int TM_index = (int)lua_tointeger(_NLL, 1); + int TM_vl = (int)lua_tointeger(_NLL, 2); + + int TM_Ret = OBJECT_setFloor(TM_index, TM_vl); + + LRetInt(_NLL, TM_Ret); +} +#endif //#ifdef _JZ_NEWSCRIPT_LUA diff --git a/npc_lua/npc_lua_spell.c b/npc_lua/npc_lua_spell.c new file mode 100644 index 0000000..2b84f00 --- /dev/null +++ b/npc_lua/npc_lua_spell.c @@ -0,0 +1,202 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "anim_tbl.h" +#include "object.h" +#include "net.h" +#include "npcutil.h" +#include "npc_eventaction.h" +#include "battle.h" +#include "readmap.h" +#include "pet_skill.h" +#include "profession_skill.h" +#include "magic_base.h" + +#define _JZ_NEWSCRIPT_LUA + + +int NPC_Lua_Spell_PETSKILL_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + int skillarray = PETSKILL_getPetskillArray( TM_Index); + TM_Flg -= LUA_DATALINE0; + int TM_RetInt = PETSKILL_getInt(skillarray, TM_Flg); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + int skillarray = PETSKILL_getPetskillArray( TM_Index); + TM_Flg -= LUA_DATALINE1; + char *TM_RetPoint = PETSKILL_getChar(skillarray, TM_Flg); + LRetMsg(_NLL, TM_RetPoint); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + +int NPC_Lua_Spell_PROFESSION_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + int skillarray = PROFESSION_SKILL_getskillArray( TM_Index); + TM_Flg -= LUA_DATALINE0; + int TM_RetInt = PROFESSION_SKILL_getInt(skillarray, TM_Flg); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + + int skillarray = PROFESSION_SKILL_getskillArray( TM_Index ); + TM_Flg -= LUA_DATALINE1; + char *TM_RetPoint = PROFESSION_SKILL_getChar(skillarray, TM_Flg); + LRetMsg(_NLL, TM_RetPoint); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + +int NPC_Lua_Spell_MAGIC_GetData(lua_State *_NLL) +{ + CheckEx(_NLL, 2); + CheckIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + int magic_array = -1; + magic_array = MAGIC_getMagicArray( TM_Index ); + TM_Flg -= LUA_DATALINE0; + int TM_RetInt = MAGIC_getInt(magic_array, TM_Flg); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + int magic_array = -1; + magic_array = MAGIC_getMagicArray( TM_Index ); + TM_Flg -= LUA_DATALINE1; + char *TM_RetPoint = MAGIC_getChar(magic_array, TM_Flg); + LRetMsg(_NLL, TM_RetPoint); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + +int NPC_Lua_Spell_PETSKILL_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + int TM_IntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = PROFESSION_SKILL_setInt(TM_Index, TM_Flg, TM_IntVal); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_CharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = PROFESSION_SKILL_setChar(TM_Index, TM_Flg, TM_CharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + + +int NPC_Lua_Spell_PROFESSION_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + int TM_IntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = PROFESSION_SKILL_setInt(TM_Index, TM_Flg, TM_IntVal); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_CharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = PROFESSION_SKILL_setChar(TM_Index, TM_Flg, TM_CharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + +int NPC_Lua_Spell_MAGIC_SetData(lua_State *_NLL) +{ + CheckEx(_NLL, 3); + CheckItemIndexNull(_NLL, 1); + int TM_Index = (int)lua_tointeger(_NLL, 1); + int TM_Flg = (int)lua_tointeger(_NLL, 2); + + if(TM_Flg >= 0) + { + if(TM_Flg < LUA_DATALINE1) + { + TM_Flg -= LUA_DATALINE0; + int TM_IntVal = (int)lua_tointeger(_NLL, 3); + int TM_RetInt = MAGIC_setInt(TM_Index, TM_Flg, TM_IntVal); + LRetInt(_NLL, TM_RetInt); + }else if(TM_Flg < LUA_DATALINE2) + { + TM_Flg -= LUA_DATALINE1; + char *TM_CharPoint = (char *)lua_tostring(_NLL, 3); + BOOL TM_RetBOOL = MAGIC_setChar(TM_Index, TM_Flg, TM_CharPoint); + LRetBool(_NLL, TM_RetBOOL); + }else + { + LRetErrNull(_NLL, "ı־Ǵġ"); + } + } + LRetErrNull(_NLL, "ı־Ǵġ"); +} + + diff --git a/npc_lua/npc_lua_sql.c b/npc_lua/npc_lua_sql.c new file mode 100644 index 0000000..0ac8490 --- /dev/null +++ b/npc_lua/npc_lua_sql.c @@ -0,0 +1,131 @@ +#include "npc_lua.h" +#include "util.h" +#include "char.h" +#include "char_base.h" +#include "char_data.h" +#include "anim_tbl.h" +#include "object.h" +#include "battle.h" +#include "npcutil.h" +#include "item.h" +#include "readmap.h" + +#include "sasql.h" + +#ifdef _JZ_NEWSCRIPT_LUA + + +int NPC_Lua_SQL_Push(lua_State *_NLL) +{ + CheckEx(_NLL, 1); + + char* _SQLSTR = NULL; + + _SQLSTR = lua_tostring(_NLL, 1); + sasql_LUASQL(_SQLSTR,-1,"NULL","NULL",-1,-1,"NULL"); +} + + +int NPC_Lua_SQL_PushPop(lua_State *_NLL) +{ + CheckEx(_NLL,7); + int npcindex,charaindex,row; + char* sqlstr,*function,*filepath,*msg; + + sqlstr = lua_tostring(_NLL, 1); + row = lua_tointeger(_NLL, 2); + filepath = lua_tostring(_NLL, 3); + function = lua_tostring(_NLL, 4); + npcindex = lua_tointeger(_NLL, 5); + charaindex = lua_tointeger(_NLL, 6); + msg = lua_tostring(_NLL, 7); +// print("sqlstr=%s\n row=%d\n filepath=%s\n function=%s\n npcindex=%d\n charaindex=%d\n msg=%s\n",sqlstr,row,filepath,function,npcindex,charaindex,msg); + sasql_LUASQL(sqlstr,row,filepath,function,npcindex,charaindex,msg); +} + +int NPC_Lua_SQL_PushPopAdv(lua_State *_NLL) +{ + CheckEx(_NLL,6); + int npcindex,charaindex; + char* sqlstr,*function,*filepath,*msg; + + sqlstr = lua_tostring(_NLL, 1); + if(lua_isnil((_NLL), (3))){ + filepath = ""; + }else{ + filepath = lua_tostring(_NLL, 3); + } + function = lua_tostring(_NLL, 3); + npcindex = lua_tointeger(_NLL, 4); + charaindex = lua_tointeger(_NLL, 5); + msg = lua_tostring(_NLL, 6); + int flg = 1; + sasql_LUASQLAdv(sqlstr,filepath,function,npcindex,charaindex,msg,flg); +} + +int NPC_Lua_SQL_QueryFirstRow(lua_State *_NLL) +{ + CheckEx(_NLL,6); + int npcindex,charaindex; + char* sqlstr,*function,*filepath,*msg; + + sqlstr = lua_tostring(_NLL, 1); + if(lua_isnil((_NLL), (3))){ + filepath = ""; + }else{ + filepath = lua_tostring(_NLL, 3); + } + function = lua_tostring(_NLL, 3); + npcindex = lua_tointeger(_NLL, 4); + charaindex = lua_tointeger(_NLL, 5); + msg = lua_tostring(_NLL, 6); + int flg = 2; + sasql_LUASQLAdv(sqlstr,filepath,function,npcindex,charaindex,msg,flg); +} + +int NPC_Lua_SQL_FetchRow(lua_State *_NLL) +{ + CheckEx(_NLL,5); + int npcindex,charaindex; + char* sqlstr,*function,*filepath,*msg; + + + if(lua_isnil((_NLL), (3))){ + filepath = ""; + }else{ + filepath = lua_tostring(_NLL, 3); + } + function = lua_tostring(_NLL, 2); + npcindex = lua_tointeger(_NLL, 3); + charaindex = lua_tointeger(_NLL, 4); + msg = lua_tostring(_NLL, 5); + int flg = 3; + sasql_LUASQLAdv("",filepath,function,npcindex,charaindex,msg,flg); +} + +int NPC_Lua_SQL_FreeResult(lua_State *_NLL) +{ + CheckEx(_NLL,5); + int npcindex,charaindex; + char* sqlstr,*function,*filepath,*msg; + + + if(lua_isnil((_NLL), (3))){ + filepath = ""; + }else{ + filepath = lua_tostring(_NLL, 3); + } + function = lua_tostring(_NLL, 2); + npcindex = lua_tointeger(_NLL, 3); + charaindex = lua_tointeger(_NLL, 4); + msg = lua_tostring(_NLL, 5); + int flg = 4; + sasql_LUASQLAdv("",filepath,function,npcindex,charaindex,msg,flg); +} +#endif + + + + + + diff --git a/npc_lua/stdafx.cpp b/npc_lua/stdafx.cpp new file mode 100644 index 0000000..6207238 --- /dev/null +++ b/npc_lua/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : ֻ׼ļԴļ +// npc_lua.pch ΪԤͷ +// stdafx.obj ԤϢ + +#include "stdafx.h" + +// TODO: STDAFX.H +// κĸͷļڴļ diff --git a/npc_lua/stdafx.h b/npc_lua/stdafx.h new file mode 100644 index 0000000..a767d59 --- /dev/null +++ b/npc_lua/stdafx.h @@ -0,0 +1,14 @@ +// stdafx.h : ׼ϵͳļİļ +// Ǿʹõĵ +// ضĿİļ +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Windows ͷųʹõ + + + +// TODO: ڴ˴óҪͷļ diff --git a/npc_lua/targetver.h b/npc_lua/targetver.h new file mode 100644 index 0000000..91794a5 --- /dev/null +++ b/npc_lua/targetver.h @@ -0,0 +1,13 @@ +#pragma once + +// º궨Ҫƽ̨Ҫƽ̨ +// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ +// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ +// + +// ҪԵָ汾ƽ̨޸ж塣 +// йزͬƽ̨ӦֵϢο MSDN +#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista +#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 +#endif + diff --git a/npcshandle.c b/npcshandle.c new file mode 100644 index 0000000..04eb441 --- /dev/null +++ b/npcshandle.c @@ -0,0 +1,104 @@ +0031:npc_lua:000000000:2:14=48041e4b:16=47d21313:002E:Makefile:05215:1:14=48041e4b:16=47d21313:INCFLAGS=-I. -I../include +FLTFLAGS="-s 1331200" +export FLTFLAGS + +#CFLAGS=-w -O3 -g $(INCFLAGS) +#CHOST="i686-pc-linux-gnu" +#CFLAGS=-march=pentium4 -w -O3 -pipe -mmmx -msse -msse2 $(INCFLAGS) +#CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer" +CFLAGS=-w -O3 -pipe $(INCFLAGS) + +PROG=libnpc_lua.a + +SRC=npc_lua.c npc_lua_ex.c npc_lua_item.c npc_lua_nlg.c npc_lua_nl.c npc_lua_obj.c npc_lua_char.c npc_lua_battle.c + +OBJ=$(SRC:.c=.o) + +ifeq (0,$(MAKELEVEL)) +CC=gcc +RM=rm -f +AR=ar cr +MV=mv +RANLIB=ranlib +SED=sed +SHELL=/bin/sh +endif + +all: $(PROG) +$(PROG): $(OBJ) + $(RM) $(PROG) + $(AR) $(PROG) $(OBJ) + $(RANLIB) $(PROG) + +depend: + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(CC) $(INCFLAGS) -M $(SRC) >> Makefile + +clean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + +distclean: + $(RM) $(PROG) + $(RM) $(OBJ) + $(RM) *~ + $(MV) Makefile Makefile.bak + $(SED) -ne '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak>Makefile + $(RM) Makefile.bak + +# DO NOT DELETE THIS LINE +npc_lua.o: npc_lua.c ../include/npc_lua.h ../include/npc_lua_interface.h \ + ../include/version.h ../include/sasql.h /usr/include/stdio.h \ + /usr/include/_ansi.h /usr/include/newlib.h /usr/include/sys/config.h \ + /usr/include/machine/ieeefp.h /usr/include/cygwin/config.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/stddef.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/stdarg.h \ + /usr/include/sys/reent.h /usr/include/_ansi.h /usr/include/sys/_types.h \ + /usr/include/sys/lock.h /usr/include/sys/types.h \ + /usr/include/machine/_types.h /usr/include/machine/types.h \ + /usr/include/sys/features.h /usr/include/cygwin/types.h \ + /usr/include/sys/sysmacros.h /usr/include/stdint.h \ + /usr/include/endian.h /usr/include/sys/stdio.h /usr/include/sys/cdefs.h \ + /usr/include/stdlib.h /usr/include/machine/stdlib.h \ + /usr/include/alloca.h /usr/include/cygwin/stdlib.h \ + /usr/include/cygwin/wait.h /usr/include/netinet/in.h \ + /usr/include/cygwin/in.h /usr/include/cygwin/socket.h \ + /usr/include/asm/socket.h /usr/include/cygwin/if.h \ + /usr/include/sys/socket.h /usr/include/features.h \ + /usr/include/sys/time.h /usr/include/cygwin/sys_time.h \ + /usr/include/sys/select.h /usr/include/time.h \ + /usr/include/machine/time.h /usr/include/cygwin/time.h \ + /usr/include/signal.h /usr/include/sys/signal.h \ + /usr/include/cygwin/signal.h /usr/include/cygwin/sockios.h \ + /usr/include/sys/uio.h /usr/include/asm/byteorder.h \ + /usr/include/arpa/inet.h /usr/include/netdb.h /usr/include/unistd.h \ + /usr/include/sys/unistd.h /usr/include/getopt.h /usr/include/strings.h \ + /usr/include/string.h /usr/include/sys/string.h /usr/include/errno.h \ + /usr/include/sys/errno.h ../include/correct_bug.h ../include/common.h \ + ../include/../lua/lua.h ../include/../lua/luaconf.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/limits.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/syslimits.h \ + /usr/include/limits.h ../include/../lua/lauxlib.h \ + ../include/../lua/lua.h /usr/include/assert.h ../include/util.h \ + ../include/char.h ../include/char_base.h ../include/skill.h \ + ../include/util.h ../include/title.h ../include/addressbook.h \ + ../include/net.h /usr/include/pthread.h /usr/include/sched.h \ + ../include/link.h ../include/char_data.h ../include/item.h \ + ../include/char.h ../include/char_base.h ../include/char_data.h \ + ../include/anim_tbl.h ../include/object.h ../include/battle.h \ + ../include/npcutil.h ../include/item.h ../include/readmap.h +npc_lua_ex.o: npc_lua_ex.c ../include/npc_lua.h \ + ../include/npc_lua_interface.h ../include/version.h ../include/sasql.h \ + /usr/include/stdio.h /usr/include/_ansi.h /usr/include/newlib.h \ + /usr/include/sys/config.h /usr/include/machine/ieeefp.h \ + /usr/include/cygwin/config.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/stddef.h \ + /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/stdarg.h \ + /usr/include/sys/reent.h /usr/include/_ansi.h /usr/include/sys/_types.h \ + /usr/include/sys/lock.h /usr/include/sys/types.h \ + /usr/include/machine/_types.h /usr/include/machine/types.h \ + /usr/include/sys/features.h /usr/include/cygwin/types.h \ + /usr/include/sys/sysmacros.h /usr/include/stdint.h \ + /usr/include/endian.h /usr/include/sys/st \ No newline at end of file diff --git a/object.c b/object.c new file mode 100644 index 0000000..2135d28 --- /dev/null +++ b/object.c @@ -0,0 +1,481 @@ +#include "version.h" +#include + +#include +#include +#include +#include + +#include "handletime.h" + +#include "common.h" +#include "object.h" +#include "char_base.h" +#include "char.h" +#include "item.h" +#include "buf.h" +#include "readmap.h" +#include "pet.h" + +static Object *obj; +static int objnum; + +#ifdef _PET_ITEM +static int Restored = FALSE; +#endif + +BOOL initObjectArray( int num ) +{ + int i; + objnum = num; + obj = allocateMemory( sizeof( Object ) * objnum ); + + if( obj == NULL ) return FALSE; + for( i = 0 ; i < objnum ; i ++ ){ + memset( &obj[i], 0 , sizeof( Object )); + obj[i].type = OBJTYPE_NOUSE; + } + print( " %.2f MB MB ռ...", sizeof( Object ) * objnum / 1024.0 / 1024.0 ); + return TRUE; +} + + +BOOL endObjectArray( void ) +{ + freeMemory( obj ); + return TRUE; +} + +INLINE int _initObjectOne( char *file, int line, Object* ob ) +{ + static int allocobjnum = 0; + int i; + BOOL first; + + i = allocobjnum; + first = TRUE; + while( 1 ) { + if( !first && i >= allocobjnum ) { + fprint( "Can't allocate an object\n" ); + return -1; + } + if( obj[i].type == OBJTYPE_NOUSE ) { + if( MAP_addNewObj( ob->floor ,ob->x, ob->y, i ) == 1 ){ + memcpy( &obj[i] , ob , sizeof( Object ) ); + allocobjnum = ( i+1 >= objnum) ? 0:i+1; + return i; + }else{ + allocobjnum = ( i+1 >= objnum) ? 0:i+1; + fprint( "MAP_addNewObj error\n" ); + return -1; + } + }else { + if( ++i >= objnum ) { + i = 0; + first = FALSE; + } + } + } + + fprint( "Can't allocate an object\n" ); + return -1; +} + +void endObjectOne( int index ) +{ + if(objnum <= index || index < 0 )return; + + if( MAP_removeObj(obj[index].floor,obj[index].x, obj[index].y, + index) == FALSE){ +// fprint( "REMOVE OBJ ERROR floor:%d x:%d y:%d\n",obj[index].floor,obj[index].x, obj[index].y ); + } + obj[index].type = OBJTYPE_NOUSE; +} + +BOOL CHECKOBJECT( int index ) +{ + if( 0<=index && indextype = OBJTYPE_ITEM; + else if( strcmp( token , STOREGOLDID ) == 0 ) + one->type = OBJTYPE_GOLD; + else if( strcmp( token, STORECHARID) == 0 ) + one->type = OBJTYPE_CHARA; + for( i = 2 ; i < 5 ; i ++ ){ + char first[64]; + char second[64]; + ret = getStringFromIndexWithDelim(line,"|" ,i, + token,sizeof( token )); + if( ret == FALSE )return FALSE; + + ret = getStringFromIndexWithDelim(token,"=" ,1, first,sizeof( first )); + if( ret == FALSE )return FALSE; + ret = getStringFromIndexWithDelim(token,"=" ,2, second,sizeof( second )); + if( ret == FALSE )return FALSE; + + if( strcmp( first , "x" ) == 0 ) + one->x = atoi( second ); + else if( strcmp( first , "y" ) == 0 ) + one->y = atoi( second ); + else if( strcmp( first , "floor" ) == 0 ) + one->floor = atoi( second ); + } + { + char* findex = nindex( line , '|' , 4); + *stringstart = findex + 1; + } + return TRUE; +} + +BOOL storeObjects( char* dirname ) +{ + int i; + FILE* igfile; + char igfilename[256]; + + if( Restored == TRUE ){ + snprintf( igfilename ,sizeof( igfilename ) ,"%s/%s" ,dirname , + ITEMGOLDSTOREFILENAME ); + }else{ + snprintf( igfilename ,sizeof( igfilename ) ,"%s/%s_extra" ,dirname , + ITEMGOLDSTOREFILENAME ); + + print( "\n---- ݱУرGMSV ----- \n"); + } + igfile = fopen( igfilename , "w" ); + if( igfile == NULL ){ + print( "\n\n---- ܴ (%s) Ʒļ. ----- \n\n", igfilename ); + return FALSE; + } + + print( "ݱ..."); + for( i = 0 ; i < objnum ; i ++ ){ + switch( obj[i].type ){ + case OBJTYPE_ITEM: + { + fprintf( igfile , STOREITEMID "|x=%d|y=%d|floor=%d|%s\n" , + obj[i].x , obj[i].y ,obj[i].floor, + ITEM_makeStringFromItemIndex( obj[i].index,0 ) ); + break; + } + case OBJTYPE_GOLD: + { + fprintf( igfile , STOREGOLDID "|x=%d|y=%d|floor=%d|%d\n" , + obj[i].x , obj[i].y ,obj[i].floor, obj[i].index ); + break; + } + case OBJTYPE_CHARA: + { + int petindex = obj[i].index; + if( CHAR_CHECKINDEX( petindex) ) { + if( CHAR_getInt( obj[i].index, CHAR_WHICHTYPE) == CHAR_TYPEPET){ + fprintf( igfile , STORECHARID "|x=%d|y=%d|floor=%d|%s\n" , + obj[i].x , obj[i].y ,obj[i].floor, + CHAR_makePetStringFromPetIndex( obj[i].index ) ); + } + } + break; + } + default: + break; + } + } + fclose( igfile ); + print( "\n"); +// system( "./itemda.pl" ); + print( "ݱ\n"); + return TRUE; +} +#endif + +int detectStoreFile( char* filename ) +{ + FILE* f; + char buffer[10]; + f = fopen ( filename ,"r" ); + if( f == NULL )return 3; + + if( fgets( buffer, sizeof( buffer ), f ) == NULL ){ + fclose(f); + return 3; + } + + if( strncmp(buffer,STOREITEMID,sizeof(STOREITEMID) ) == 0 || + strncmp(buffer,STOREGOLDID,sizeof(STOREGOLDID) ) == 0 ){ + fclose(f); + return 2; + } + + fclose(f); + return 3; +} + +#ifdef _PET_ITEM +BOOL restoreObjects( char* dirname ) +{ + char igfilename[512]; + FILE* file; + char line[2048]; + + snprintf( igfilename, sizeof(igfilename), "%s/%s", dirname, ITEMGOLDSTOREFILENAME ); + file = fopen( igfilename , "r" ); + if( file == NULL ){ + Restored = TRUE; + return FALSE; + } + while( fgets( line, sizeof( line ), file ) != NULL ){ + Object one; + char *string; + chomp( line ); + if( checkObjectStoreFile( line, &one ,&string ) == FALSE ) + continue; + switch( one.type ){ + case OBJTYPE_ITEM: + { + ITEM_Item itmone; + BOOL ret; + int objindex; + ret = ITEM_makeExistItemsFromStringToArg( string, &itmone, 0 ); + if( ret == TRUE ){ + one.index = ITEM_initExistItemsOne( &itmone ); + if( one.index == -1 ) + break; + objindex = initObjectOne( &one ); + ITEM_setWorkInt(one.index,ITEM_WORKCHARAINDEX,-1); + ITEM_setWorkInt(one.index,ITEM_WORKOBJINDEX,objindex); + } + break; + } + case OBJTYPE_GOLD: + one.index = atoi( string ); + initObjectOne( &one ); + break; + case OBJTYPE_CHARA: + { + Char ch; + int ret; + ret = CHAR_makePetFromStringToArg(string,&ch, -1); + if( ret ) { + Object object; + int objindex; + int petindex = PET_initCharOneArray( &ch ); + if( petindex < 0 ) { + print( "ʧܡ\n"); + } + object.type = OBJTYPE_CHARA; + object.index = petindex; + object.x = ch.data[CHAR_X]; + object.y = ch.data[CHAR_Y]; + object.floor = ch.data[CHAR_FLOOR]; + objindex = initObjectOne( &object ); + if( objindex == -1 ) { + CHAR_endCharOneArray( petindex ); + }else { + CHAR_setWorkInt( petindex,CHAR_WORKOBJINDEX,objindex ); + } + } + break; + } + default: + break; + } + } + fclose( file ); + Restored = TRUE; + + return TRUE; +} +#endif + +#ifdef _CAX_LNS_MAPSUOXU +INLINE int get_mappointindex( int fl,int x, int y)//ҳͼ͵ +{ + int i; + for(i=0;i +#include +#include +#include "common.h" +#include "net.h" + +#ifdef _SEND_EFFECT // WON ADD ACѩЧ +#include "chatmagic.h" +#endif +extern char *DebugMainFunction; +#define IS_2BYTEWORD( _a_ ) ( (char)(0x80) <= (_a_) && (_a_) <= (char)(0xFF) ) + +/* +90 :
  • clienttoserver ACServerLogout(void);
    +115 : ӡʧӡշʧ +116 : ӡ巽Ȼ ľ£׻Ȼľ帲ʧӡ +117 : ߯Ϸëƥؤ£ +118 :
    +119 :
    +120 :
    +121 : +122 : +*/ + +void saacproto_ACServerLogout_send( int fd ) +{ + saacproto_CreateHeader( saacproto.work , "ACServerLogout" ); + saacproto_strcatsafe( saacproto.work , "" ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +#ifdef _PKSEVER_VER +void saacproto_ACCharList_send( int fd,char* id,char* pas,int mesgid, int star) +#else +void saacproto_ACCharList_send( int fd,char* id,char* pas,int mesgid ) +#endif +{ + saacproto_CreateHeader( saacproto.work , "ACCharList" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( pas ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); + +#ifdef _PKSEVER_VER + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( star ) ,saacproto.workbufsize ); +#endif + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_ACCharLoad_send( int fd,char* id,char* pas,char* charname,int lock,char* opt,int mesgid,char* ip ) +{ + saacproto_CreateHeader( saacproto.work , "ACCharLoad" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( pas ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( lock ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( opt ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( ip ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +#ifdef _NEWSAVE +void saacproto_ACCharSave_send( int fd,char* id,char* charname,char* opt,char* charinfo,int unlock,int mesgid,int saveindex ) +#else +void saacproto_ACCharSave_send( int fd,char* id,char* charname,char* opt,char* charinfo,int unlock,int mesgid ) +#endif +{ + saacproto_CreateHeader( saacproto.work , "ACCharSave" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( opt ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charinfo ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( unlock ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); +#ifdef _NEWSAVE + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( saveindex ) ,saacproto.workbufsize ); +#endif + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_ACCharDelete_send( int fd,char* id,char* passwd,char* charname,char* option,int mesgid, char* userip ) +{ + saacproto_CreateHeader( saacproto.work , "ACCharDelete" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( passwd ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( option ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( userip ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_ACLock_send( int fd,char* id,int lock,int mesgid ) +{ + saacproto_CreateHeader( saacproto.work , "ACLock" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( lock ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_ACUCheck_send( int fd,char* mem_id,int status ) +{ + saacproto_CreateHeader( saacproto.work , "ACUCheck" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( mem_id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( status ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBUpdateEntryString_send( int fd,char* table,char* key,char* value,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBUpdateEntryString" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( value ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBDeleteEntryString_send( int fd,char* table,char* key,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBDeleteEntryString" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBGetEntryString_send( int fd,char* table,char* key,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBGetEntryString" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBUpdateEntryInt_send( int fd,char* table,char* key,int value,char* info,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBUpdateEntryInt" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( value ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( info ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBGetEntryRank_send( int fd,char* table,char* key,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBGetEntryRank" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBDeleteEntryInt_send( int fd,char* table,char* key,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBDeleteEntryInt" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBGetEntryInt_send( int fd,char* table,char* key,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBGetEntryInt" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( key ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBGetEntryByRank_send( int fd,char* table,int rank_start,int rank_end,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBGetEntryByRank" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( rank_start ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( rank_end ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_DBGetEntryByCount_send( int fd,char* table,int count_start,int num,int msgid,int msgid2 ) +{ + saacproto_CreateHeader( saacproto.work , "DBGetEntryByCount" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( table ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( count_start ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( num ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( msgid2 ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} +/* +608 :
  • clienttoserver Broadcast( string id, string charname, string message , int flag );
    +609 : ءةӡ帲ƻѨë˪ +610 : ͻءةӡƻ Ԫ⻥˪ľ£ +611 : id , charname ʹľ¼ƥ ¦ëֹף +612 : ٯ ɡë̤ئʻз +613 :
    +614 :
    string id +615 :
    user ID +616 :
    string charname +617 :
    ƽҷ (޵ئ) +618 :
    string message +619 :
    ˪ľ¶۱ءةӡѱ +620 :
    +*/ + +void saacproto_Broadcast_send( int fd,char* id,char* charname,char* message,int flag ) +{ + saacproto_CreateHeader( saacproto.work , "Broadcast" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( message ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( flag ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} +/* +634 :
  • clienttoserver Message( string id_from, string charname_from, string id_to, string charname_to, string message , int option );
    +635 : ̼ë˪ +636 :
    +637 :
    string id_from +638 :
    from ID +639 :
    string charname_from +640 :
    from Character name +641 :
    string id_to +642 :
    to ID +643 :
    string charname_to +644 :
    to character name +645 :
    string message +646 :
    +647 :
    int option +648 :
    羮ǷǷ ľľ£ +649 : ľëءةӡ ƥʧӡ +650 : 婳 ئ +651 :
    +*/ + +void saacproto_Message_send( int fd,char* id_from,char* charname_from,char* id_to,char* charname_to,char* message,int option ) +{ + saacproto_CreateHeader( saacproto.work , "Message" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id_from ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname_from ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id_to ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname_to ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( message ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( option ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_MessageAck_send( int fd,char* id,char* charname,char* result,int mesgid ) +{ + saacproto_CreateHeader( saacproto.work , "MessageAck" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( result ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( mesgid ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +void saacproto_MessageFlush_send( int fd,char* id,char* charname ) +{ + saacproto_CreateHeader( saacproto.work , "MessageFlush" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( id ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( charname ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} + +/************************************************************ + * CoolFish: Family 2001/5/18 + ***********************************************************/ +#ifdef _PERSONAL_FAME +void saacproto_ACAddFM_send(int fd, char *fmname, char *fmleadername, + char *fmleaderid, int fmleaderlv, char *petname, char *petattr, + char *fmrule, int fmsprite, int fmleadergrano, int fame, int charfdid) +#else +void saacproto_ACAddFM_send(int fd, char *fmname, char *fmleadername, + char *fmleaderid, int fmleaderlv, char *petname, char *petattr, + char *fmrule, int fmsprite, int fmleadergrano, int charfdid) +#endif +{ + saacproto_CreateHeader(saacproto.work, "ACAddFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmleadername), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmleaderid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmleaderlv), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(petname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(petattr), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmrule), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmsprite), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmleadergrano), saacproto.workbufsize); +// #ifdef _PERSONAL_FAME + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fame), saacproto.workbufsize); +// #endif + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +#ifdef _PERSONAL_FAME // Arminius: +void saacproto_ACJoinFM_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int index, int fame, int charfdid) +#else +void saacproto_ACJoinFM_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int index, int charfdid) +#endif +{ + saacproto_CreateHeader(saacproto.work, "ACJoinFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charlv), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); +// #ifdef _PERSONAL_FAME // Arminius: + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fame), saacproto.workbufsize); +// #endif + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACLeaveFM_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int index, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACLeaveFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACDelFM_send(int fd, char *fmname, int fmindex, int index, + char *charname, char *charid, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACDelFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACShowFMList_send(int fd) +{ + saacproto_CreateHeader(saacproto.work, "ACShowFMList"); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACShowMemberList_send(int fd, int index) +{ + saacproto_CreateHeader(saacproto.work, "ACShowMemberList"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string("MemberList"), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFMDetail_send(int fd, char *fmname, int fmindex, int index, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACFMDetail"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +#ifdef _FMVER21 +void saacproto_ACMemberJoinFM_send(int fd, char *fmname, int fmindex, + char *charname, int charindex, int index, int result, int meindex, + int charfdid) +#else +void saacproto_ACMemberJoinFM_send(int fd, char *fmname, int fmindex, + char *charname, int charindex, int index, int result, int charfdid) +#endif +{ + saacproto_CreateHeader(saacproto.work, "ACMemberJoinFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(result), saacproto.workbufsize); +#ifdef _FMVER21 + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(meindex), saacproto.workbufsize); +#endif + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +#ifdef _FMVER21 +void saacproto_ACMemberLeaveFM_send(int fd, char *fmname, int fmindex, + char *charname, int charindex, int index, int meindex, int charfdid) +#else +void saacproto_ACMemberLeaveFM_send(int fd, char *fmname, int fmindex, + char *charname, int charindex, int index, int charfdid) +#endif +{ + saacproto_CreateHeader(saacproto.work, "ACMemberLeaveFM"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); +#ifdef _FMVER21 + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(meindex), saacproto.workbufsize); +#endif + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +#ifdef _FM_MODIFY +void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int eventflag, int charfdid,int gsnum) +#else + #ifdef _FMVER21 + void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int eventflag, int charfdid) + #else + void saacproto_ACFMCharLogin_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int charfdid) + #endif +#endif +{ + saacproto_CreateHeader(saacproto.work, "ACFMCharLogin"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charlv), saacproto.workbufsize); +#ifdef _FMVER21 + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(eventflag), saacproto.workbufsize); +#endif + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); +#ifdef _FM_MODIFY + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(gsnum), saacproto.workbufsize); +#endif + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACFMCharLogout_send(int fd, char *fmname, int fmindex, char *charname, + char *charid, int charlv, int index, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACFMCharLogout"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charlv), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFMReadMemo_send(int fd, int index) +{ + saacproto_CreateHeader(saacproto.work, "ACFMReadMemo"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string("ReadMemo"), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFMWriteMemo_send(int fd, char *fmname, int fmindex, + char *data, int index) +{ + saacproto_CreateHeader(saacproto.work, "ACFMWriteMemo"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFMPointList_send(int fd) +{ + saacproto_CreateHeader(saacproto.work, "ACFMPointList"); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACSetFMPoint_send(int fd, char *fmname, int fmindex, int index, + int fmpointindex, int fl, int x, int y, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACSetFMPoint"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmpointindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fl), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(x), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(y), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFixFMPoint_send(int fd, char *winfmname, int winfmindex, + int winindex, char *losefmname, int losefmindex, int loseindex, + int village) +{ + saacproto_CreateHeader(saacproto.work, "ACFixFMPoint"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(winfmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(winfmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(winindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(losefmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(losefmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(loseindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(village), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFMAnnounce_send(int fd, char *fmname, int fmindex, int index, + char *data, int color) +{ + saacproto_CreateHeader(saacproto.work, "ACFMAnnounce"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(color), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACShowTopFMList_send(int fd, int kindflag) +{ + saacproto_CreateHeader(saacproto.work, "ACShowTopFMList"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string("ShowTopFMList"), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(kindflag), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACFixFMData_send(int fd, char *fmname, int fmindex, int index, + int kindflag, char *data1, char *data2, int charindex, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACFixFMData"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(kindflag), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data1), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data2), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACFixFMPK_send(int fd, char *winfmname, int winfmindex, + int winindex, char *losefmname, int losefmindex, int loseindex) +{ + saacproto_CreateHeader(saacproto.work, "ACFixFMPK"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(winfmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(winfmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(winindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(losefmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(losefmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(loseindex), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACGMFixFMData_send(int fd, int index, char *charid, char *cmd, + char *data, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACGMFixFMData"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string("ACGMFixFMData"), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(charid), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(cmd), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +void saacproto_ACGetFMData_send(int fd, char *fmname, int fmindex, int index, + int kindflag, int charfdid) +{ + saacproto_CreateHeader(saacproto.work, "ACGetFMData"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(fmname), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(index), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(kindflag), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(charfdid), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + +// Arminius 7.26 manor pk acknowledge +void saacproto_ACManorPKAck_send(int fd, char *data) +{ + saacproto_CreateHeader(saacproto.work, "ACManorPKAck"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACreLoadFmData_send( int fd, int type, int data) +{ + saacproto_CreateHeader( saacproto.work, "ACreLoadFmData"); + saacproto_strcatsafe( saacproto.work, saacproto_mkstr_int( type), saacproto.workbufsize); + saacproto_strcatsafe( saacproto.work, saacproto_mkstr_int( data), saacproto.workbufsize); + saacproto_Send( fd, saacproto.work); +} + +#ifdef _ACFMPK_LIST +void saacproto_ACLoadFmPk_send(int fd, int fmpks_pos) +{ + saacproto_CreateHeader(saacproto.work, "ACLoadFmPk"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmpks_pos), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + + +void saacproto_ACSendFmPk_send(int fd, int toindex, int PkFlg, int fmpks_pos, char *msg) +{ + saacproto_CreateHeader(saacproto.work, "ACSendFmPk"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmpks_pos), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int( toindex), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int( PkFlg), saacproto.workbufsize); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(msg), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} +#endif + +void saacproto_ACAuctionSold_send(int fd, char *data) +{ + saacproto_CreateHeader(saacproto.work, "ACAuctionSold"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_string(data), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + +void saacproto_ACDelFmPoint_send(int fd, int fmindex) +{ + saacproto_CreateHeader(saacproto.work, "ACDelFmPoint"); + saacproto_strcatsafe(saacproto.work, saacproto_mkstr_int(fmindex), saacproto.workbufsize); + saacproto_Send(fd, saacproto.work); +} + + +extern char saacretfunc[255]; +int saacproto_ClientDispatchMessage(int fd ,char*line) +{ + int msgid; + char funcname[255]; + char *line_bak; + line_bak=line; + saacproto_strcpysafe( saacproto.work , line, saacproto.workbufsize ); + saacproto_splitString( saacproto.work); + saacproto_GetMessageInfo( &msgid , funcname , sizeof(funcname),saacproto.token_list); + strcpy( saacretfunc , funcname ); + if( strcmp( funcname , "ACGmsvDownRequest" ) == 0 ){ + int min; + min = saacproto_demkstr_int( saacproto.token_list[2] ); + saacproto_ACGmsvDownRequest_recv( fd,min); + return 0; + } + + if( strcmp( funcname , "ACServerLogin" ) == 0 ){ + char* result; + char* data; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + saacproto_ACServerLogin_recv( fd,result,data); + return 0; + } + + if( strcmp( funcname , "ACCharList" ) == 0 ){ + char* result; + char* output; + int id; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + output = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACCharList_recv( fd,result,output,id); + return 0; + } + + if( strcmp( funcname , "ACCharLoad" ) == 0 ){ + char* result=NULL; + char* data=NULL; + int id; +#ifdef _NEWSAVE + int saveindex; +#endif + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + if( data == NULL ) return 0; + if( result == NULL ) return 0; + +#ifdef _NEWSAVE + saveindex = saacproto_demkstr_int( saacproto.token_list[5] ); + saacproto_ACCharLoad_recv( fd,result,data,id,saveindex); +#else + saacproto_ACCharLoad_recv( fd,result,data,id, -1); +#endif + return 0; + } + + if( strcmp( funcname , "ACCharSave" ) == 0 ){ + char* result; + char* data; + int id; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACCharSave_recv( fd,result,data,id); + return 0; + } + + if( strcmp( funcname , "ACCharDelete" ) == 0 ){ + char* result; + char* data; + int id; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACCharDelete_recv( fd,result,data,id); + return 0; + } + + if( strcmp( funcname , "ACLock" ) == 0 ){ + char* result; + char* data; + int id; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACLock_recv( fd,result,data,id); + return 0; + } + +#ifdef _WAEI_KICK + if( strcmp( funcname , "ACKick" ) == 0 ){ + int act; + char* data; + int id; + act = saacproto_demkstr_int( saacproto.token_list[2] ); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACKick_recv( fd, act, data, id); + return 0; + } +#endif + +#ifdef _CHAR_POOLITEM + + if( strcmp( funcname , "ACSavePoolItem" ) == 0 ){ + char* result; + char* data; + int id; + + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACCharSavePoolItem_recv( fd, result, data, id); + return 0; + } + + if( strcmp( funcname , "ACGetPoolItem" ) == 0 ){ + char* result; + char* data; + int id, npcid; + + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + npcid = saacproto_demkstr_int( saacproto.token_list[5] ); + saacproto_ACCharGetPoolItem_recv( fd, result, data, id, npcid); + return 0; + } +#endif + + +#ifdef _CHAR_POOLPET + + if( strcmp( funcname , "ACSavePoolPet" ) == 0 ){ + char* result; + char* data; + int id; + + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_ACCharSavePoolPet_recv( fd, result, data, id); + return 0; + } + + if( strcmp( funcname , "ACGetPoolPet" ) == 0 ){ + char* result; + char* data; + int id, npcid; + + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id = saacproto_demkstr_int( saacproto.token_list[4] ); + npcid = saacproto_demkstr_int( saacproto.token_list[5] ); + saacproto_ACCharGetPoolPet_recv( fd, result, data, id, npcid); + return 0; + } +#endif + + if( strcmp( funcname , "ACUCheck" ) == 0 ){ + char* mem_id; + mem_id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + saacproto_ACUCheck_recv( fd,mem_id); + return 0; + } +/* +354 :
  • servertoclient DBUpdateEntryString( string result, string table, string key, int msgid, int msgid2 );
    +355 : Ѩ ƻּص ئƥ ƻ +356 :
    +357 :
    string result +358 :
    successful failed +359 :
    string table +360 :
    +361 :
    int msgid +362 :
    +363 :
    int msgid2 +364 :
    +365 :
    +366 : +*/ + + if( strcmp( funcname , "DBUpdateEntryString" ) == 0 ){ + char* result; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + msgid = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[6] ); + saacproto_DBUpdateEntryString_recv( fd,result,table,key,msgid,msgid2); + return 0; + } +/* +379 :
  • servertoclient DBDeleteEntryString( string result, string table, string key , int msgid , int msgid2 );
    +380 : ٯ ޼ּ +381 :
    +382 :
    string result +383 :
    successful / failed +384 :
    string table +385 :
    +386 :
    string key +387 :
    +388 :
    int msgid +389 :
    +390 :
    int msgid2 +391 :
    +392 :
    +393 : +*/ + + if( strcmp( funcname , "DBDeleteEntryString" ) == 0 ){ + char* result; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + msgid = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[6] ); + saacproto_DBDeleteEntryString_recv( fd,result,table,key,msgid,msgid2); + return 0; + } +/* +406 :
  • servertoclient DBGetEntryString( string result, string value, string table, string key, int msgid, int msgid2 );
    +407 : ԻƼ߯Ի +408 :
    +409 :
    string result +410 :
    successful / failed +411 :
    string value +412 :
    +413 :
    string table +414 :
    +415 :
    string key +416 :
    +417 :
    int msgid +418 :
    +419 :
    int msgid2 +420 :
    +421 :
    +422 : +*/ + + if( strcmp( funcname , "DBGetEntryString" ) == 0 ){ +/* char* result; + char* value; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + value = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + msgid = saacproto_demkstr_int( saacproto.token_list[6] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[7] ); + saacproto_DBGetEntryString_recv( fd,result,value,table,key,msgid,msgid2);*/ + return 0; + } +/* +445 :
  • servertoclient DBUpdateEntryInt( string result , string table, string key, int msgid, int msgid2 );
    +446 : DBUpdateEntry +447 :
    +448 :
    string result +449 :
    succesful/failed +450 :
    string table +451 :
    Ƥ ë +452 :
    string key +453 :
    ƽë +454 :
    int msgid, int msgid2 +455 :
    msgid ë߯ʣ +456 :
    +457 :

    +458 : +*/ + + if( strcmp( funcname , "DBUpdateEntryInt" ) == 0 ){ + char* result; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + msgid = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[6] ); + saacproto_DBUpdateEntryInt_recv( fd,result,table,key,msgid,msgid2); + return 0; + } +/* +473 :
  • servertoclient DBGetEntryRank( string result , int rank , int count, string table, string key, int msgid, int msgid2 );
    +474 : ë߯ʣ +475 :
    +476 :
    string result +477 :
    successful/failed +478 :
    int rank +479 :
    ˣ1ë£ +480 :
    int count +481 :
    ʹ ټ޼0շԪ£ +482 :
    string table +483 :
    Ƥ ë +484 :
    string key +485 :
    ƽë +486 :
    int msgid, int msgid2 +487 :
    msgid ë߯ +488 :
    +489 :

    +490 : +491 : +*/ + + if( strcmp( funcname , "DBGetEntryRank" ) == 0 ){ + char* result; + int rank; + int count; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + rank = saacproto_demkstr_int( saacproto.token_list[3] ); + count = saacproto_demkstr_int( saacproto.token_list[4] ); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[5] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[6] )); + msgid = saacproto_demkstr_int( saacproto.token_list[7] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[8] ); + saacproto_DBGetEntryRank_recv( fd,result,rank,count,table,key,msgid,msgid2); + return 0; + } +/* +504 :
  • servertoclient DBDeleteEntryInt( string result , string table, string key, int msgid, int msgid2 );
    +505 : ּ +506 :
    +507 :
    string result +508 :
    successful/failed +509 :
    string table +510 :
    Ƥ ë +511 :
    string key +512 :
    ƽë +513 :
    int msgid, int msgid2 +514 :
    msgid ë߯ +515 :
    +516 :

    +517 : +*/ + + if( strcmp( funcname , "DBDeleteEntryInt" ) == 0 ){ + char* result; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + msgid = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[6] ); + saacproto_DBDeleteEntryInt_recv( fd,result,table,key,msgid,msgid2); + return 0; + } +/* +530 :
  • servertoclient DBGetEntryInt( string result , int value , string table, string key, int msgid, int msgid2 );
    +531 : ޼ë +532 :
    +533 :
    string result +534 :
    successful/failed +535 :
    int value +536 :
    ּ +537 :
    string table +538 :
    Ƥ ë +539 :
    string key +540 :
    ƽë +541 :
    int msgid, int msgid2 +542 :
    msgid ë߯ +543 :
    +544 : +545 : +546 : +*/ + + if( strcmp( funcname , "DBGetEntryInt" ) == 0 ){ + char* result; + int value; + char* table; + char* key; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + value = saacproto_demkstr_int( saacproto.token_list[3] ); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + key = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + msgid = saacproto_demkstr_int( saacproto.token_list[6] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[7] ); + saacproto_DBGetEntryInt_recv( fd,result,value,table,key,msgid,msgid2); + return 0; + } +/* +562 :
  • servertoclient DBGetEntryByRank( string result , string list , string table, int msgid, int msgid2 );
    +563 : DBGetEntryByRank +564 :
    +565 :
    string result +566 :
    +567 :
    string list +568 :
    "RANK,KEY,SCORE,INFO|RANK,KEY,SCORE,INFO|...."
    +569 : RANKƥؤ£KEY˱ئȻµʧëȻ +570 : ƽSCOREѰƥʧƥؤ£ +571 :
    +572 : "1,RINGO,123465,data1|2,HOGE,4567,data2|2,FUCK,4567,data3"
    +573 : 2˷2³ئ£ +574 :
    string table +575 :
    Ƥ +576 :
    int msgid, int msgid2 +577 :
    +578 :
    +579 : +580 : +*/ + + if( strcmp( funcname , "DBGetEntryByRank" ) == 0 ){ + char* result; + char* list; + char* table; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + list = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + msgid = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[6] ); + saacproto_DBGetEntryByRank_recv( fd,result,list,table,msgid,msgid2); + return 0; + } +/* +593 :
  • servertoclient DBGetEntryByCount( string result , string list , string table, int count_start, int msgid, int msgid2 );
    +594 : DBGetEntryByCount +595 :
    +596 :
    string result +597 :
    SUCCESSFUL/FAILED +598 :
    string list +599 :
    1޼ؤԻ "INDEX,RANK,KEY,SCORE,INFO" 4ۼ +600 : ׬ƥؤԻľ "|" ƥئ£ѻ0 +601 : ٯ +602 :
    int num +603 :
    ʹԻʾ1ئ1ۣ2ئ2ۣ +604 :
    int msgid ,msgid2 +605 :
    ID. +606 :
    +607 : +*/ + + if( strcmp( funcname , "DBGetEntryByCount" ) == 0 ){ + char* result; + char* list; + char* table; + int count_start; + int msgid; + int msgid2; + result = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + list = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + table = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + count_start = saacproto_demkstr_int( saacproto.token_list[5] ); + msgid = saacproto_demkstr_int( saacproto.token_list[6] ); + msgid2 = saacproto_demkstr_int( saacproto.token_list[7] ); + saacproto_DBGetEntryByCount_recv( fd,result,list,table,count_start,msgid,msgid2); + return 0; + } +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC + if ( strcmp( funcname , "UpdataStele" ) == 0 ) { + char* token; + token = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + saacproto_UpdataStele_recv( fd , token) ; + return 0; + } + if ( strcmp( funcname , "S_UpdataStele" ) == 0 ) { + char* ocdkey; + char* oname; + char* ncdkey; + char* nname; + char* title; + int level; + int trns; + int floor; + ocdkey = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + oname = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + ncdkey = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + nname = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + title = saacproto_wrapStringAddr( saacproto_stringwrapper[5] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[6] )); + level = saacproto_demkstr_int( saacproto.token_list[7] ); + trns = saacproto_demkstr_int( saacproto.token_list[8] ); + floor = saacproto_demkstr_int( saacproto.token_list[9] ); + saacproto_S_UpdataStele_recv( fd , ocdkey , oname , ncdkey , nname , title , level , + trns , floor ); + return 0; + } +#endif +/* +621 :
  • servertoclient Broadcast( string id, string charname, string message );
    +622 : Broadcastʧӡձءةӡ߼˪ +623 :
    +624 :
    string id +625 :
    user ID +626 :
    string charname +627 :
    character name +628 :
    string message +629 :
    +630 :
    int flag +631 :
    1б巴 ˪ľئУ +632 :
    +633 : +*/ + + if( strcmp( funcname , "Broadcast" ) == 0 ){ + char* id; + char* charname; + char* message; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + charname = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + message = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + saacproto_Broadcast_recv( fd,id,charname,message); + return 0; + } +/* +652 :
  • servertoclient Message( string id_from, string charname_from, string id_to, string charname_to, string message , int option , int mesgid );
    +653 : ʧӡձءةӡ嶪ë˪£ +654 :
    +655 :
    string id_from +656 :
    from ID +657 :
    string charname_from +658 :
    from character name +659 :
    string id_to +660 :
    to ID +661 :
    string charname_to +662 :
    to character name +663 :
    string message +664 :
    ⼰ +665 :
    int option +666 :
    (ë) +667 :
    int mesgid +668 :
    ID ʧӡ +669 :
    +670 : +*/ + + if( strcmp( funcname , "Message" ) == 0 ){ + char* id_from; + char* charname_from; + char* id_to; + char* charname_to; + char* message; + int option; + int mesgid; + id_from = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + charname_from = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + id_to = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + charname_to = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + message = saacproto_wrapStringAddr( saacproto_stringwrapper[5] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[6] )); + option = saacproto_demkstr_int( saacproto.token_list[7] ); + mesgid = saacproto_demkstr_int( saacproto.token_list[8] ); + saacproto_Message_recv( fd,id_from,charname_from,id_to,charname_to,message,option,mesgid); + return 0; + } + + // CoolFish: Family 2001/5/9 + if( strcmp( funcname, "ACAddFM") == 0){ + int fmindex, index, charfdid; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + fmindex = saacproto_demkstr_int(saacproto.token_list[3]); + index = saacproto_demkstr_int(saacproto.token_list[4]); + charfdid = saacproto_demkstr_int(saacproto.token_list[5]); + saacproto_ACAddFM_recv(fd, result, fmindex, charfdid, index); + return 0; + } + if( strcmp( funcname, "ACJoinFM") == 0){ + int charfdid, recv; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + recv = saacproto_demkstr_int(saacproto.token_list[3]); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACJoinFM_recv(fd, result, recv, charfdid); + return 0; + } + if( strcmp( funcname, "ACLeaveFM") == 0){ + int charfdid, resultflag; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + resultflag = saacproto_demkstr_int(saacproto.token_list[3]); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACLeaveFM_recv(fd, result, resultflag, charfdid); + return 0; + } + if( strcmp( funcname, "ACDelFM") == 0){ + int charfdid; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + charfdid = saacproto_demkstr_int(saacproto.token_list[3]); + saacproto_ACDelFM_recv(fd, result, charfdid); + return 0; + } + if( strcmp( funcname, "ACShowFMList") == 0){ + int fmnum; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + fmnum = saacproto_demkstr_int(saacproto.token_list[3]); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[3], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[4])); + saacproto_ACShowFMList_recv(fd, result, fmnum, data); + return 0; + } + + if( strcmp( funcname, "ACShowMemberList") == 0){ + int index, fmmemnum, fmacceptflag, fmjoinnum; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + index = saacproto_demkstr_int(saacproto.token_list[3]); + fmmemnum = saacproto_demkstr_int(saacproto.token_list[4]); + fmacceptflag = saacproto_demkstr_int(saacproto.token_list[5]); + fmjoinnum = saacproto_demkstr_int(saacproto.token_list[6]); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[6], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[7])); + saacproto_ACShowMemberList_recv(fd, result, index, fmmemnum, fmacceptflag, fmjoinnum, data); + return 0; + } + if( strcmp( funcname, "ACFMDetail") == 0){ + int charfdid; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACFMDetail_recv(fd, result, data, charfdid); + return 0; + } + if( strcmp( funcname, "ACMemberJoinFM") == 0){ + int charfdid; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACMemberJoinFM_recv(fd, result, data, charfdid); + return 0; + } + if( strcmp( funcname, "ACMemberLeaveFM") == 0){ + int charfdid; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACMemberLeaveFM_recv(fd, result, data, charfdid); + return 0; + } + if( strcmp( funcname, "ACFMCharLogin") == 0){ + int charfdid, index, floor, fmdp, joinflag, fmsetupflag, flag, charindex; +#ifdef _PERSONAL_FAME // Arminius: + int charfame; +#endif +#ifdef _NEW_MANOR_LAW + int momentum; +#endif + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + index = saacproto_demkstr_int(saacproto.token_list[3]); + floor = saacproto_demkstr_int(saacproto.token_list[4]); + fmdp = saacproto_demkstr_int(saacproto.token_list[5]); + joinflag = saacproto_demkstr_int(saacproto.token_list[6]); + fmsetupflag = saacproto_demkstr_int(saacproto.token_list[7]); + flag = saacproto_demkstr_int(saacproto.token_list[8]); + charindex = saacproto_demkstr_int(saacproto.token_list[9]); +#ifdef _PERSONAL_FAME // Arminius: + charfame = saacproto_demkstr_int(saacproto.token_list[10]); + charfdid = saacproto_demkstr_int(saacproto.token_list[11]); + #ifdef _NEW_MANOR_LAW + momentum = saacproto_demkstr_int(saacproto.token_list[12]); + #endif + saacproto_ACFMCharLogin_recv(fd, result, index, floor, fmdp, + joinflag, fmsetupflag, flag, charindex, charfame, charfdid + #ifdef _NEW_MANOR_LAW + ,momentum + #endif + ); +#else + charfdid = saacproto_demkstr_int(saacproto.token_list[10]); + saacproto_ACFMCharLogin_recv(fd, result, index, floor, fmdp, + joinflag, fmsetupflag, flag, charindex, charfdid); +#endif + return 0; + } + if( strcmp( funcname, "ACFMCharLogout") == 0){ + int charfdid; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + charfdid = saacproto_demkstr_int(saacproto.token_list[3]); + saacproto_ACFMCharLogout_recv(fd, result, charfdid); + return 0; + } + if( strcmp( funcname, "ACFMReadMemo") == 0){ + int index, num, dataindex; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + index = saacproto_demkstr_int(saacproto.token_list[3]); + num = saacproto_demkstr_int(saacproto.token_list[4]); + dataindex = saacproto_demkstr_int(saacproto.token_list[5]); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[5], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[6])); + saacproto_ACFMReadMemo_recv(fd, result, index, num, dataindex, data); + return 0; + } + if( strcmp( funcname, "ACFMWriteMemo") == 0){ + int index; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + index = saacproto_demkstr_int(saacproto.token_list[3]); + saacproto_ACFMWriteMemo_recv(fd, result, index); + return 0; + } + if( strcmp( funcname, "ACFMPointList") == 0){ + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + saacproto_ACFMPointList_recv(fd, result, data); + return 0; + } + + + if( strcmp( funcname, "ACSetFMPoint") == 0){ + int charfdid, r; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + r = saacproto_demkstr_int(saacproto.token_list[3]); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACSetFMPoint_recv(fd, result, r, charfdid); + return 0; + } + if( strcmp( funcname, "ACFixFMPoint") == 0){ + int r; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + r = saacproto_demkstr_int(saacproto.token_list[3]); + saacproto_ACFixFMPoint_recv(fd, result, r); + return 0; + } + if( strcmp( funcname, "ACFMAnnounce") == 0){ + int fmindex, index, color, kindflag; + char *result, *fmname, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + fmname = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + fmindex = saacproto_demkstr_int(saacproto.token_list[4]); + index = saacproto_demkstr_int(saacproto.token_list[5]); + kindflag = saacproto_demkstr_int(saacproto.token_list[6]); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[6], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[7])); + color = saacproto_demkstr_int(saacproto.token_list[8]); + saacproto_ACFMAnnounce_recv(fd, result, fmname, fmindex, index, kindflag, data, color); + return 0; + } + if( strcmp( funcname, "ACShowTopFMList") == 0){ + int num, kindflag; + char *result, *data; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + kindflag = saacproto_demkstr_int(saacproto.token_list[3]); + num = saacproto_demkstr_int(saacproto.token_list[4]); + data = saacproto_wrapStringAddr(saacproto_stringwrapper[4], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[5])); + saacproto_ACShowTopFMList_recv(fd, result, kindflag, num, data); + return 0; + } + if( strcmp( funcname, "ACFixFMData") == 0){ + int kindflag, charfdid; + char *result, *data1, *data2; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + kindflag = saacproto_demkstr_int(saacproto.token_list[3]); + data1 = saacproto_wrapStringAddr(saacproto_stringwrapper[3], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[4])); + data2 = saacproto_wrapStringAddr(saacproto_stringwrapper[4], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[5])); + charfdid = saacproto_demkstr_int(saacproto.token_list[6]); + saacproto_ACFixFMData_recv(fd, result, kindflag, data1, data2, charfdid); + return 0; + } + if( strcmp( funcname, "ACFixFMPK") == 0){ + int data, winindex, loseindex; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + data = saacproto_demkstr_int(saacproto.token_list[3]); + winindex = saacproto_demkstr_int(saacproto.token_list[4]); + loseindex = saacproto_demkstr_int(saacproto.token_list[5]); + saacproto_ACFixFMPK_recv(fd, result, data, winindex, loseindex); + return 0; + } + if( strcmp( funcname, "ACGMFixFMData") == 0){ + int charfdid; + char *result, *fmname; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + fmname = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + charfdid = saacproto_demkstr_int(saacproto.token_list[4]); + saacproto_ACGMFixFMData_recv(fd, result, fmname, charfdid); + return 0; + } + if( strcmp( funcname, "ACGetFMData") == 0){ + int kindflag, charfdid, data; + char *result; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + kindflag = saacproto_demkstr_int(saacproto.token_list[3]); + data = saacproto_demkstr_int(saacproto.token_list[4]); + charfdid = saacproto_demkstr_int(saacproto.token_list[5]); + saacproto_ACGetFMData_recv(fd, result, kindflag, data, charfdid); + return 0; + } + if( strcmp( funcname, "ACFMClearPK") == 0){ + int fmindex, index; + char *result, *fmname; + result = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + fmname = saacproto_wrapStringAddr(saacproto_stringwrapper[2], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[3])); + fmindex = saacproto_demkstr_int(saacproto.token_list[4]); + index = saacproto_demkstr_int(saacproto.token_list[5]); + saacproto_ACFMClearPK_recv(fd, result, fmname, fmindex, index); + return 0; + } + // Arminius 7.26 manor pk acknowledge + if( strcmp( funcname, "ACManorPKAck") == 0){ + char *data; + data = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + saacproto_ACManorPKAck_recv(fd, data); + return 0; + } + +#ifdef _ACFMPK_LIST + if( strcmp( funcname, "ACLoadFmPk") == 0){ + char *data; + data = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + saacproto_ACLoadFmPk_recv( fd, data); + return 0; + } + if( strcmp( funcname, "ACSendFmPk") == 0){ + int toindex, flg; + toindex = saacproto_demkstr_int( saacproto.token_list[2] ); + flg =saacproto_demkstr_int( saacproto.token_list[3] ); + saacproto_ACSendFmPk_recv( fd, toindex, flg); + return 0; + } +#endif +#ifdef _SEND_EFFECT // WON ADD ACѩЧ + if( strcmp(funcname, "EFFECT") == 0){ + char *effect; + effect = saacproto_wrapStringAddr(saacproto_stringwrapper[1], saacproto.workbufsize, saacproto_demkstr_string(saacproto.token_list[2])); + print("\n AC send to GS weather effect !!"); + + CHAR_CHAT_DEBUG_sendeffect( fd, effect ); + return 0; + } +#endif + +#ifdef _ANGEL_SUMMON + if( strcmp( funcname , "ACMissionTable" ) == 0 ){ + int num; + int type; + char* data; + //int charaindex; + char* angelinfo; + + num = saacproto_demkstr_int( saacproto.token_list[2] ); + type = saacproto_demkstr_int( saacproto.token_list[3] ); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + //charaindex = saacproto_demkstr_int( saacproto.token_list[5] ); + angelinfo = saacproto_wrapStringAddr( saacproto_stringwrapper[4] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[5] )); + + //saacproto_ACMissionTable_recv( fd, num, type, data, charaindex); + saacproto_ACMissionTable_recv( fd, num, type, data, angelinfo); + return 0; + } +#endif + +#ifdef _TEACHER_SYSTEM + if(strcmp(funcname,"ACCheckCharacterOnLine") == 0){ + int flag,charaindex,iOnline; + char* data; + + charaindex = saacproto_demkstr_int(saacproto.token_list[2]); + iOnline = saacproto_demkstr_int(saacproto.token_list[3]); + data = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + flag = saacproto_demkstr_int( saacproto.token_list[5] ); + saacproto_ACCheckCharacterOnLine_recv(fd,charaindex,iOnline,data,flag); + return 0; + } +#endif + + if( strcmp( funcname , "ACCharLogin" ) == 0 ){ + int flag; + int clifd; + clifd = saacproto_demkstr_int( saacproto.token_list[2] ); + flag = saacproto_demkstr_int( saacproto.token_list[3] ); + saacproto_ACCharLogin_recv(fd, clifd, flag); + return 0; + } + + if( strcmp( funcname , "QuerySafePasswd" ) == 0 ){ + char* id; + int res; + int charaindex; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + res = saacproto_demkstr_int( saacproto.token_list[3] ); + charaindex = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_QuerySafePasswd_recv(fd, id, res, charaindex); + return 0; + } + + if( strcmp( funcname , "AddSafePasswd" ) == 0 ){ + char* id; + int res; + int charaindex; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + res = saacproto_demkstr_int( saacproto.token_list[3] ); + charaindex = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_AddSafePasswd_recv(fd, id, res, charaindex); + return 0; + } + + if( strcmp( funcname , "PointCardSucces" ) == 0 ){ + char* id; + int res; + int point; + int charaindex; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + res = saacproto_demkstr_int( saacproto.token_list[3] ); + point = saacproto_demkstr_int( saacproto.token_list[4] ); + charaindex = saacproto_demkstr_int( saacproto.token_list[5] ); + saacproto_PointCardSucces_recv(fd, id, res, point, charaindex); + return 0; + } + + if( strcmp( funcname , "PointCardErr" ) == 0 ){ + char* id; + int res; + int charaindex; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + res = saacproto_demkstr_int( saacproto.token_list[3] ); + charaindex = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_PointCardErr_recv(fd, id, res, charaindex); + return 0; + } + + if( strcmp( funcname , "LoginTime" ) == 0 ){ + char* id; + char* res; + int charaindex; + id = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + res = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + charaindex = saacproto_demkstr_int( saacproto.token_list[4] ); + saacproto_LoginTime_recv(fd, id, res, charaindex); + return 0; + } + +#ifdef _ONLINE_SHOP + if( strcmp( funcname , "ACShop" ) == 0 ){ + char* res; + int charaindex,shopnum,vippoint,piece,pieces,shopflag; + charaindex = saacproto_demkstr_int( saacproto.token_list[2] ); + shopnum = saacproto_demkstr_int( saacproto.token_list[3] ); + vippoint = saacproto_demkstr_int( saacproto.token_list[4] ); + piece = saacproto_demkstr_int( saacproto.token_list[5] ); + pieces = saacproto_demkstr_int( saacproto.token_list[6] ); + shopflag = saacproto_demkstr_int( saacproto.token_list[7] ); + res = saacproto_wrapStringAddr( saacproto_stringwrapper[7] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[8] )); + saacproto_ACShop_recv(fd, charaindex, shopnum, vippoint, piece, pieces, shopflag, res); + return 0; + } + + if( strcmp( funcname , "ACShopBuy" ) == 0 ){ + char* res; + int charaindex,shopnum,vippoint,piece,pieces,shopflag,shopno,buynum; + charaindex = saacproto_demkstr_int( saacproto.token_list[2] ); + shopnum = saacproto_demkstr_int( saacproto.token_list[3] ); + vippoint = saacproto_demkstr_int( saacproto.token_list[4] ); + piece = saacproto_demkstr_int( saacproto.token_list[5] ); + pieces = saacproto_demkstr_int( saacproto.token_list[6] ); + shopflag = saacproto_demkstr_int( saacproto.token_list[7] ); + res = saacproto_wrapStringAddr( saacproto_stringwrapper[7] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[8] )); + shopno = saacproto_demkstr_int( saacproto.token_list[9] ); + buynum = saacproto_demkstr_int( saacproto.token_list[10] ); + saacproto_ACShop_recv(fd, charaindex, shopnum, vippoint, piece, pieces, shopflag, res); + saacproto_ACShopBuy_recv(charaindex, shopflag, shopno, buynum); + return 0; + } +#endif + +#ifdef _QUESTION_ONLINE + if( strcmp( funcname , "ACQuestion" ) == 0 ){ + char* res; + res = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + saacproto_ACQuestion_recv(res); + return 0; + } +#endif + +#ifdef _ALL_ITEM + if( strcmp( funcname , "ACAllnum" ) == 0 ){ + int flag,allnum; + flag = saacproto_demkstr_int( saacproto.token_list[2] ); + allnum = saacproto_demkstr_int( saacproto.token_list[3] ); + saacproto_ACAllnum_recv(flag,allnum); + return 0; + } +#endif + + if( strcmp( funcname , "ACFmPkOnlineSn" ) == 0 ){ + //DebugMainFunction="saac1"; + int manorindex,flag; + //DebugMainFunction="saac2"; + char* gsname; + //DebugMainFunction="saac3"; + manorindex = saacproto_demkstr_int( saacproto.token_list[2] ); + //DebugMainFunction="saac4"; + gsname = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + //DebugMainFunction="saac5"; + flag = saacproto_demkstr_int( saacproto.token_list[4] ); + //DebugMainFunction="saac6"; + saacproto_ACFmPkOnlineSn_recv(manorindex,gsname,flag); + //DebugMainFunction="saac7"; + return 0; + } + + if( strcmp( funcname , "ACSystemAllTalk" ) == 0 ){ + char* systemalltalkbuf; + systemalltalkbuf = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + saacproto_ACSystemAllTalk_recv(systemalltalkbuf); + return 0; + } + + if( strcmp( funcname , "ACPlayerAllTalk" ) == 0 ){ + char* servername; + char* playername; + char* playeralltalkbuf; + servername = saacproto_wrapStringAddr( saacproto_stringwrapper[1] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[2] )); + playername = saacproto_wrapStringAddr( saacproto_stringwrapper[2] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[3] )); + playeralltalkbuf = saacproto_wrapStringAddr( saacproto_stringwrapper[3] , saacproto.workbufsize , saacproto_demkstr_string( saacproto.token_list[4] )); + saacproto_ACPlayerAllTalk_recv(servername,playername,playeralltalkbuf); + return 0; + } + + printf("\n޷ҵSAACӿ:%s\n",funcname); + printf("\nfd=%d,line=%s\n",fd,line_bak); + return -1; +} +void saacproto_SetClientLogFiles( char *r , char *w ) +{ + saacproto_strcpysafe( saacproto_readlogfilename , r , sizeof( saacproto_readlogfilename ) ); + saacproto_strcpysafe( saacproto_writelogfilename , w , sizeof( saacproto_writelogfilename ) ); +} +int saacproto_InitClient( int (*writefunc)(int,char*,int) ,int bufsiz ,int fd) +{ + int i; + if( (void*)writefunc == NULL){saacproto.write_func = saacproto_default_write_wrap;} else {saacproto.write_func = writefunc;} + saacproto_AllocateCommonWork(bufsiz); + saacproto_stringwrapper = (char**)calloc( 1,sizeof(char*) * MAXLSRPCARGS); + if(saacproto_stringwrapper ==NULL)return -1; + memset( saacproto_stringwrapper , 0, sizeof(char*)*MAXLSRPCARGS); + for(i=0;i +#include +#include +#ifndef WIN32 +#include +#include +#endif +#include "saacproto_util.h" +//ttom +1 +#define IS_2BYTEWORD( _a_ ) ( (char)(0x80) <= (_a_) && (_a_) <= (char)(0xFF) ) +extern char *DebugMainFunction; +#ifdef saacproto__ENCRYPT +long saacproto_ringoCompressor( unsigned char *code , long codelen , unsigned char *text , long textlen); +long saacproto_ringoDecompressor( unsigned char *text , long textlen , unsigned char *code , long codelen); +#endif +/* + lsrpc routines +*/ +int saacproto_AllocateCommonWork(int bufsiz) +{ + saacproto.workbufsize = bufsiz; + saacproto.work = NULL; + saacproto.arraywork = NULL; + saacproto.escapework = NULL; + saacproto.val_str = NULL; + saacproto.token_list = NULL; + saacproto.cryptwork = NULL; + saacproto.jencodecopy = NULL; + saacproto.jencodeout = NULL; + saacproto.compresswork = NULL; + saacproto.work = (char*)calloc( 1, saacproto.workbufsize ); + saacproto.arraywork = (char*)calloc( 1, saacproto.workbufsize ); + saacproto.escapework = (char*)calloc( 1, saacproto.workbufsize ); + saacproto.val_str = (char*)calloc( 1, saacproto.workbufsize ); + saacproto.token_list = (char**)calloc( 1, saacproto.workbufsize *sizeof( char** ) ); + saacproto.cryptwork = (char*)calloc( 1, saacproto.workbufsize * 3 ); + saacproto.jencodecopy = (char*)calloc( 1, saacproto.workbufsize * 3 ); + saacproto.jencodeout = (char*)calloc( 1, saacproto.workbufsize * 3 ); + saacproto.compresswork = (char*)calloc( 1, saacproto.workbufsize * 3 ); + memset( saacproto.work , 0, saacproto.workbufsize ); + memset( saacproto.arraywork , 0, saacproto.workbufsize ); + memset( saacproto.escapework , 0, saacproto.workbufsize ); + memset( saacproto.val_str , 0, saacproto.workbufsize ); + memset( (char*)saacproto.token_list ,0, saacproto.workbufsize*sizeof(char**) ); + memset( saacproto.cryptwork , 0, saacproto.workbufsize*3 ); + memset( saacproto.jencodecopy , 0, saacproto.workbufsize*3 ); + memset( saacproto.jencodeout , 0, saacproto.workbufsize*3 ); + memset( saacproto.compresswork , 0, saacproto.workbufsize*3 ); + if( saacproto.work == NULL || + saacproto.arraywork == NULL || + saacproto.escapework == NULL || + saacproto.val_str == NULL || + saacproto.token_list == NULL || + saacproto.cryptwork == NULL || + saacproto.jencodecopy == NULL || + saacproto.jencodeout == NULL || + saacproto.compresswork == NULL ){ + free( saacproto.work);free( saacproto.val_str); + free( saacproto.escapework);free( saacproto.arraywork ); + free( saacproto.token_list);free( saacproto.cryptwork ); + free( saacproto.jencodecopy);free( saacproto.jencodeout ); + free( saacproto.compresswork ); + return -1; + } + return 0; +} + +int saacproto_StringRest() +{ + return 0; +/* free( saacproto.work); + saacproto.work = NULL; + saacproto.work = (char*)calloc( 1, saacproto.workbufsize ); + if( saacproto.work == NULL ) return -1; + return sizeof( saacproto.work); +*/ +} + +/********** + Get message information from a network input +**********/ +void saacproto_GetMessageInfo( int *id , char *funcname , int len, char **tk ) +{ + if( tk[0] == NULL || tk[1] == NULL ){ + *id = 0; + saacproto_strcpysafe( funcname , "" , len ); + return; + } + *id = strtoul( tk[0] ,NULL,10); + saacproto_strcpysafe( funcname , tk[1] , len ); + return; +} +/******************************************** + string utilities +*********************************************/ +void saacproto_strcpysafe( char *dest, char *src, int maxlen ) +{ + DebugMainFunction="saac21"; + //memset(dest, 0, maxlen); + DebugMainFunction="saac22"; + int ii; + DebugMainFunction="saac23"; + for(ii=0;ii (int)( saacproto.workbufsize*3-2) ){ + fprintf( stderr, "lsgen: badly configured work buflen\n" ); + exit(1); + } + if( (flag%2) == 1 ) flag ++; + saacproto.compresswork[0] = flag; + memcpy( saacproto.compresswork+1,src,srclen ); + compressed_l = srclen + 1; + } else { + if((flag%2)==0)flag++; + saacproto.compresswork[0] = flag; + compressed_l = saacproto_ringoCompressor( + (unsigned char*)saacproto.compresswork + 1 , + (long)saacproto.workbufsize*3 - 1, + (unsigned char*)src , + (long)strlen(src) ) + 1; /* be careful! */ + } + /* return empty line if error or buffer excess */ + if( compressed_l <= 0 ){ + saacproto_strcpysafe( out , "\n" , maxoutlen ); + return; + } + memcpy( saacproto.jencodecopy ,saacproto.compresswork ,compressed_l ); + saacproto_jEncode( saacproto.jencodecopy , compressed_l , JENCODE_KEY , + saacproto.jencodeout, &jencodedlen , saacproto.workbufsize*3 -1 ); + saacproto_encode64( (unsigned char*)saacproto.jencodeout , jencodedlen, (unsigned char*)out ); +} +/* translate code64 text to original lsrpc text */ +static void saacproto_decodeString( char *src , char *out ) +{ + int compressed_l =0, outlen64; + int l; + long decompressed_l = 0; + /* copy src to copybuffer because jencoder modifies the input buffer */ + l = strlen( src ); + if( src[l-1]=='\n' || src[l-1]=='\r' )src[l-1]=0; + if( src[l-2]=='\n' || src[l-2]=='\r' )src[l-2]=0; + outlen64 = saacproto_decode64( (unsigned char*)src , (unsigned char*)saacproto.jencodecopy ); + saacproto_jDecode( saacproto.jencodecopy , outlen64 , JENCODE_KEY, + saacproto.compresswork , &compressed_l); + /*out[outlen]=0; PENDING*/ + if( (saacproto.compresswork[0] % 2 ) == 0 ){ + if( compressed_l <= 0 ){ + decompressed_l = 0; + fprintf( stderr, "LSRPC: too short:[%s]\n", src ); + } else { + memcpy( out, saacproto.compresswork+1, compressed_l -1 ); + decompressed_l = compressed_l -1; + } + } else { + decompressed_l = + saacproto_ringoDecompressor( (unsigned char*)out , + (long)saacproto.workbufsize , + (unsigned char*)saacproto.compresswork+1 , + (long)compressed_l -1 ); + } + out[decompressed_l] = 0; +} +/* followings are taken from code64.c */ +char saacproto_charset[64]={ + 'A','B','C','D', 'E','F','G','H', + 'I','J','K','L', 'M','N','O','P', + 'Q','R','S','T', 'U','V','W','X', + 'Y','Z','a','b', 'c','d','e','f', + 'g','h','i','j', 'k','l','m','n', + 'o','p','q','r', 's','t','u','v', + 'w','x','y','z', '0','1','2','3', + '4','5','6','7', '8','9','+','-' +}; +char saacproto_reversecharset[256]={ + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,62, 0,63,0,0, + 52,53,54,55, 56,57,58,59, + 60,61,0,0, 0,0,0,0, + 0,0,1,2, 3,4,5,6, + 7,8,9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, + 23,24,25,0, 0,0,0,0, + 0,26,27,28, 29,30,31,32, + 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, + 49,50,51,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0, + 0,0,0,0, 0,0,0,0 +}; + +static void saacproto_encode64( unsigned char *in , int len , unsigned char *out ) +{ + int i; + int use_bytes; + int address = 0; + out[0] = 0; + for(i=0;;i+=3){ + unsigned char in1 , in2 , in3; + unsigned char out1 ,out2 , out3 , out4; + if( i >= len ) break; + if( i >= (len-1)){ /* the last letter ( to be thrown away ) */ + in1 = in[i] & 0xff; + in2 = in3 = 0; + use_bytes = 2; + } else if( i >= (len-2)){ /* the last 2 letters ( process only 1 byte)*/ + in1 = in[i] & 0xff; + in2 = in[i+1] & 0xff; + in3 = 0; + use_bytes = 3; + } else { /* there are more or equal than 3 letters */ + in1 = in[i] & 0xff; + in2 = in[i+1] & 0xff; + in3 = in[i+2] & 0xff; + use_bytes = 4; + } + out1 = ((in1 & 0xfc)>>2) & 0x3f; + out2 = ((in1 & 0x03)<<4) | ((( in2 & 0xf0)>>4)&0x0f); + out3 = ((in2 & 0x0f)<<2) | ((( in3 & 0xc0)>>6)&0x03); + out4 = (in3 & 0x3f ); + if( use_bytes >= 2 ){ + out[address++] = saacproto_charset[out1]; + out[address++] = saacproto_charset[out2]; + out[address]=0; + } + if( use_bytes >= 3 ){ + out[address++] = saacproto_charset[out3]; + out[address]=0; + } + if( use_bytes >= 4 ){ + out[address++] = saacproto_charset[out4]; + out[address]=0; + } + } +} +/* + * Decode it + * char *in : encoded ascii chars + * char *out : decoded( output) + * return value : output byte count + * + * note: no need to have bigger buffer. because output is to + * be smaller than input string size + */ +static int saacproto_decode64( unsigned char *in , unsigned char *out ) +{ + unsigned char in1 , in2 , in3 , in4; + unsigned char out1 , out2 , out3; + int use_bytes; + int address= 0; + int i; + for(i=0;;i+=4 ){ + if( in[i] == 0 ){ + break; + } else if( in[i+1] == 0 ){ /* the last letter */ + break; + } else if( in[i+2] == 0 ){ /* the last 2 letters */ + in1 = saacproto_reversecharset[in[i]]; + in2 = saacproto_reversecharset[in[i+1]]; + in3 = in4 = 0; + use_bytes = 1; + } else if( in[i+3] == 0 ){ /* the last 3 letters */ + in1 = saacproto_reversecharset[in[i]]; + in2 = saacproto_reversecharset[in[i+1]]; + in3 = saacproto_reversecharset[in[i+2]]; + in4 = 0; + use_bytes = 2; + } else { /* process 4 letters */ + in1 = saacproto_reversecharset[in[i]]; + in2 = saacproto_reversecharset[in[i+1]]; + in3 = saacproto_reversecharset[in[i+2]]; + in4 = saacproto_reversecharset[in[i+3]]; + use_bytes = 3; + } + out1 = (in1<<2) | (((in2 & 0x30)>>4)&0x0f) ; + out2 = ((in2 & 0x0f )<<4) | ((( in3 & 0x3c)>>2)&0x0f); + out3 = ( (in3 &0x03)<<6) | ( in4 & 0x3f ); + if( use_bytes >= 1 ){ + out[address++] = out1; + } + if( use_bytes >= 2 ){ + out[address++] = out2; + } + if( use_bytes >= 3 ){ + out[address++] = out3; + } + if( use_bytes != 3 ){ + break; + } + } + return address; +} + +/* followings are taken from Jencode.c by jun */ +static void saacproto_jEncode(char *src,int srclen,int key,char *encoded,int *encodedlen,int maxencodedlen) +{ + char sum=0; + int i; + if(srclen+1 > maxencodedlen){ + *encodedlen = maxencodedlen; + for(i=0;i<(*encodedlen);i++)encoded[i] = src[i]; + } + if(srclen+1 <= maxencodedlen){ + *encodedlen=srclen+1; + for(i=0;i i) encoded[i] = src[i] + sum*((i*i)%3); + if(abs((key%srclen)) == i) encoded[i] = sum; + if(abs((key%srclen)) < i) encoded[i] = src[i-1] + sum*((i*i)%7); + } + } +} +static void saacproto_jDecode(char *src,int srclen,int key,char *decoded,int *decodedlen) +{ + char sum=0; + int i; + *decodedlen=srclen-1; + if( *decodedlen == 0 ){ + return; /* return error if length is 0 */ + } + sum = src[abs(key%(*decodedlen))]; + for(i=0;i i) decoded[i] = src[i] - sum*((i*i)%3); + if(abs((key%(*decodedlen))) < i) decoded[i-1] = src[i] - sum*((i*i)%7); + } + for(i=0;i<(*decodedlen);i++){ + if(((key%7) == (i%5))||((key%2) == (i%2)))decoded[i] = ~decoded[i]; + } +} + +/*****************************************************************/ +/* Compress / Decompress routine */ +/*****************************************************************/ +#define B00000000 0 +#define B00000001 1 +#define B00000010 2 +#define B00000011 3 +#define B00000100 4 +#define B00000101 5 +#define B00000110 6 +#define B00000111 7 +#define B00001000 8 +#define B00001001 9 +#define B00001010 10 +#define B00001011 11 +#define B00001100 12 +#define B00001101 13 +#define B00001110 14 +#define B00001111 15 +#define B00010000 16 +#define B00010001 17 +#define B00010010 18 +#define B00010011 19 +#define B00010100 20 +#define B00010101 21 +#define B00010110 22 +#define B00010111 23 +#define B00011000 24 +#define B00011001 25 +#define B00011010 26 +#define B00011011 27 +#define B00011100 28 +#define B00011101 29 +#define B00011110 30 +#define B00011111 31 +#define B00100000 32 +#define B00100001 33 +#define B00100010 34 +#define B00100011 35 +#define B00100100 36 +#define B00100101 37 +#define B00100110 38 +#define B00100111 39 +#define B00101000 40 +#define B00101001 41 +#define B00101010 42 +#define B00101011 43 +#define B00101100 44 +#define B00101101 45 +#define B00101110 46 +#define B00101111 47 +#define B00110000 48 +#define B00110001 49 +#define B00110010 50 +#define B00110011 51 +#define B00110100 52 +#define B00110101 53 +#define B00110110 54 +#define B00110111 55 +#define B00111000 56 +#define B00111001 57 +#define B00111010 58 +#define B00111011 59 +#define B00111100 60 +#define B00111101 61 +#define B00111110 62 +#define B00111111 63 +#define B01000000 64 +#define B01000001 65 +#define B01000010 66 +#define B01000011 67 +#define B01000100 68 +#define B01000101 69 +#define B01000110 70 +#define B01000111 71 +#define B01001000 72 +#define B01001001 73 +#define B01001010 74 +#define B01001011 75 +#define B01001100 76 +#define B01001101 77 +#define B01001110 78 +#define B01001111 79 +#define B01010000 80 +#define B01010001 81 +#define B01010010 82 +#define B01010011 83 +#define B01010100 84 +#define B01010101 85 +#define B01010110 86 +#define B01010111 87 +#define B01011000 88 +#define B01011001 89 +#define B01011010 90 +#define B01011011 91 +#define B01011100 92 +#define B01011101 93 +#define B01011110 94 +#define B01011111 95 +#define B01100000 96 +#define B01100001 97 +#define B01100010 98 +#define B01100011 99 +#define B01100100 100 +#define B01100101 101 +#define B01100110 102 +#define B01100111 103 +#define B01101000 104 +#define B01101001 105 +#define B01101010 106 +#define B01101011 107 +#define B01101100 108 +#define B01101101 109 +#define B01101110 110 +#define B01101111 111 +#define B01110000 112 +#define B01110001 113 +#define B01110010 114 +#define B01110011 115 +#define B01110100 116 +#define B01110101 117 +#define B01110110 118 +#define B01110111 119 +#define B01111000 120 +#define B01111001 121 +#define B01111010 122 +#define B01111011 123 +#define B01111100 124 +#define B01111101 125 +#define B01111110 126 +#define B01111111 127 +#define B10000000 128 +#define B10000001 129 +#define B10000010 130 +#define B10000011 131 +#define B10000100 132 +#define B10000101 133 +#define B10000110 134 +#define B10000111 135 +#define B10001000 136 +#define B10001001 137 +#define B10001010 138 +#define B10001011 139 +#define B10001100 140 +#define B10001101 141 +#define B10001110 142 +#define B10001111 143 +#define B10010000 144 +#define B10010001 145 +#define B10010010 146 +#define B10010011 147 +#define B10010100 148 +#define B10010101 149 +#define B10010110 150 +#define B10010111 151 +#define B10011000 152 +#define B10011001 153 +#define B10011010 154 +#define B10011011 155 +#define B10011100 156 +#define B10011101 157 +#define B10011110 158 +#define B10011111 159 +#define B10100000 160 +#define B10100001 161 +#define B10100010 162 +#define B10100011 163 +#define B10100100 164 +#define B10100101 165 +#define B10100110 166 +#define B10100111 167 +#define B10101000 168 +#define B10101001 169 +#define B10101010 170 +#define B10101011 171 +#define B10101100 172 +#define B10101101 173 +#define B10101110 174 +#define B10101111 175 +#define B10110000 176 +#define B10110001 177 +#define B10110010 178 +#define B10110011 179 +#define B10110100 180 +#define B10110101 181 +#define B10110110 182 +#define B10110111 183 +#define B10111000 184 +#define B10111001 185 +#define B10111010 186 +#define B10111011 187 +#define B10111100 188 +#define B10111101 189 +#define B10111110 190 +#define B10111111 191 +#define B11000000 192 +#define B11000001 193 +#define B11000010 194 +#define B11000011 195 +#define B11000100 196 +#define B11000101 197 +#define B11000110 198 +#define B11000111 199 +#define B11001000 200 +#define B11001001 201 +#define B11001010 202 +#define B11001011 203 +#define B11001100 204 +#define B11001101 205 +#define B11001110 206 +#define B11001111 207 +#define B11010000 208 +#define B11010001 209 +#define B11010010 210 +#define B11010011 211 +#define B11010100 212 +#define B11010101 213 +#define B11010110 214 +#define B11010111 215 +#define B11011000 216 +#define B11011001 217 +#define B11011010 218 +#define B11011011 219 +#define B11011100 220 +#define B11011101 221 +#define B11011110 222 +#define B11011111 223 +#define B11100000 224 +#define B11100001 225 +#define B11100010 226 +#define B11100011 227 +#define B11100100 228 +#define B11100101 229 +#define B11100110 230 +#define B11100111 231 +#define B11101000 232 +#define B11101001 233 +#define B11101010 234 +#define B11101011 235 +#define B11101100 236 +#define B11101101 237 +#define B11101110 238 +#define B11101111 239 +#define B11110000 240 +#define B11110001 241 +#define B11110010 242 +#define B11110011 243 +#define B11110100 244 +#define B11110101 245 +#define B11110110 246 +#define B11110111 247 +#define B11111000 248 +#define B11111001 249 +#define B11111010 250 +#define B11111011 251 +#define B11111100 252 +#define B11111101 253 +#define B11111110 254 +#define B11111111 255 +/* masks for first byte ( write )*/ +int saacproto_modifymask_first[8][9]={ + {0, B00000001,B00000011,B00000111,B00001111,B00011111,B00111111,B01111111,B11111111},/* mod 0*/ + {0, B00000011,B00000111,B00001111,B00011111,B00111111,B01111111,B11111111,B11111111},/* mod 1*/ + {0, B00000111,B00001111,B00011111,B00111111,B01111111,B11111111,B11111111,B11111111},/* mod 2*/ + {0, B00001111,B00011111,B00111111,B01111111,B11111111,B11111111,B11111111,B11111111},/* mod 3*/ + {0, B00011111,B00111111,B01111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 4*/ + {0, B00111111,B01111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 5*/ + {0, B01111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 6*/ + {0, B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111},/* mod 7*/ +}; +/* masks for second byte ( write ) */ +int saacproto_modifymask_second[8][9]={ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000},/* mod 0 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001},/* mod 1 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000011},/* mod 2 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000011,B00000111},/* mod 3 */ + {0, B00000000,B00000000,B00000000,B00000000,B00000001,B00000011,B00000111,B00001111},/* mod 4 */ + {0, B00000000,B00000000,B00000000,B00000001,B00000011,B00000111,B00001111,B00011111},/* mod 5 */ + {0, B00000000,B00000000,B00000001,B00000011,B00000111,B00001111,B00011111,B00111111},/* mod 6 */ + {0, B00000000,B00000001,B00000011,B00000111,B00001111,B00011111,B00111111,B01111111},/* mod 7 */ +}; +/* + * used by bitstream routines + */ +int bitstream_maxbyte, bitstream_bitaddr ; +char *bitstream_buf; +/* initialize bitstream for output */ +static int initOutputBitStream( char *buf ,int buflen) +{ + bitstream_bitaddr = 0; + bitstream_maxbyte = buflen; + bitstream_buf = buf; + memset( buf,0, buflen); + return 0; +} +/* initialize bitstream for input */ +static int initInputBitStream( char *buf , int buflen) +{ + bitstream_bitaddr = 0; + bitstream_maxbyte = buflen; + bitstream_buf = buf; + return 0; +} +/* + * read from bit stream. used only from 1 bit to 8 bits + * this is a base routine + */ +static unsigned int readInputBitStreamBody( int bwidth ) +{ + int mod = bitstream_bitaddr % 8; + int byteaddr = bitstream_bitaddr / 8; + /* return if excess */ + if( byteaddr >= bitstream_maxbyte)return 0; + if( bwidth >= 1 && bwidth <= 8){ + int b1 = (( bitstream_buf[byteaddr] & saacproto_modifymask_first[mod][bwidth] )>>mod); + int b2 = (( bitstream_buf[byteaddr+1] & saacproto_modifymask_second[mod][bwidth])<<(8-mod)); + bitstream_bitaddr += bwidth; + return b1 | b2; + } else { + return 0; + } +} +/* + * read from bit stream. used from 1 bit to 32 bits + * + */ +static unsigned int readInputBitStream( int bwidth ) +{ + if( bwidth <= 0 ){ + return 0; + } else if( bwidth >= 1 && bwidth <= 8 ){ + return readInputBitStreamBody( bwidth ); + } else if( bwidth >= 9 && bwidth <= 16 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody( bwidth-8); + return first + (second << 8 ); + } else if( bwidth >= 17 && bwidth <= 24 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody(8); + unsigned int third = readInputBitStreamBody(bwidth-8); + return first + ( second << 8 ) + ( third << 16 ); + } else if( bwidth >= 25 && bwidth <= 32 ){ + unsigned int first = readInputBitStreamBody(8); + unsigned int second = readInputBitStreamBody(8); + unsigned int third = readInputBitStreamBody(8); + unsigned int forth = readInputBitStreamBody(bwidth-8); + return first + ( second << 8 ) + ( third << 16 ) + ( forth << 24 ); + } + return 0; +} +/* + * write to a bitstream. only used from 1 bit to 8 bits + * this is a base routine. + */ +static int writeOutputBitStreamBody( int bwidth , unsigned char b) +{ + int mod = bitstream_bitaddr % 8; + int byteaddr = bitstream_bitaddr / 8; + /* return error if excess */ + if( bitstream_maxbyte <= (byteaddr+1)) return -1; + bitstream_buf[byteaddr] &= saacproto_modifymask_first[mod][bwidth]; + bitstream_buf[byteaddr] |= (b << mod) & saacproto_modifymask_first[mod][bwidth]; + bitstream_buf[byteaddr+1] &= saacproto_modifymask_second[mod][bwidth]; + bitstream_buf[byteaddr+1] |= (b>>(8-mod))& saacproto_modifymask_second[mod][bwidth]; + bitstream_bitaddr += bwidth; + return byteaddr+1; +} +/* + * write to a bitstream. used from 1 bits to 32 bits + * returns -1 if error or buffer excession + */ +static int writeOutputBitStream( int bwidth, unsigned int dat) +{ + int ret; + if( bwidth <= 0){ + return -1; + } else if( bwidth >= 1 && bwidth <= 8 ){ + if((ret=writeOutputBitStreamBody( bwidth , (unsigned char)dat))<0)return -1; + } else if( bwidth > 8 && bwidth <= 16 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth - 8 , ( unsigned char)((dat>>8)&0xff)))<0)return -1; + } else if( bwidth > 16 && bwidth <= 24 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>8)&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth-16,(unsigned char)((dat>>16)&0xff)))<0)return -1; + } else if( bwidth > 24 && bwidth <= 32 ){ + if(writeOutputBitStreamBody( 8 , (unsigned char)(dat&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>8)&0xff))<0)return -1; + if(writeOutputBitStreamBody( 8 , (unsigned char)((dat>>16)&0xff))<0)return -1; + if((ret=writeOutputBitStreamBody( bwidth-24,(unsigned char)((dat>>24)&0xff)))<0)return -1; + } else { + return -1; + } + return ret; +} +#define CHAR_SIZE 256 +#define NODE_SIZE 512 +#define BITS_LEN 9 /* 9 bit lzw compression */ +typedef struct { + unsigned char chr; + int parent; + int brother; + int child; +}NODE; +long saacproto_ringoCompressor( unsigned char *code , long codelen , + unsigned char *text , long textlen) +{ + NODE node[NODE_SIZE]; + int freeNode; + int w,k; /* used in this algo */ + int textind; /* index to text buffer */ + int i; + int position = 0; /* indicates the last byte of code buffer */ + if( textlen <= 0 ) return -1; + initOutputBitStream((char*) code,codelen); + /* fill characters ( 0 ~ 255 ) in the beggining part of + Node list */ + for(i=0; i<= CHAR_SIZE; i++){ + node[i].chr = (unsigned char)i; + node[i].brother = i + 1; + node[i].parent = 0; + node[i].child = 0; + } + node[CHAR_SIZE].brother = 0; + freeNode = CHAR_SIZE + 1; + w = text[0]; + textind = 1; + while(1){ + int rv; + if( textind >= textlen ){ + k = CHAR_SIZE; /* indicates EOF */ + } else { + k = text[textind]; + } + /* search if pattern 'wk' is registered or not. */ + rv = node[w].child; + while(1){ + if( rv <= 0 ) break; + if( node[rv].chr == k ) break; + rv = node[rv].brother; + } + if( rv > 0 ){ + /* found it */ + w = rv; + } else { + position = writeOutputBitStream( BITS_LEN ,w ); + /* return if buffer excession */ + if( position > codelen ) return -1; + /* register pattern 'wk' in the dictionary */ + if( freeNode < NODE_SIZE ){ + node[freeNode].parent = w; + node[freeNode].chr = k; + node[freeNode].brother = node[w].child; + node[freeNode].child = 0; + node[w].child = freeNode; + freeNode++; + } + w = k; + } + if( textind == ( textlen + 1 ) ) break; + textind++; + } + return position; +} + +/* + * Decoder. + * return -1 if buffer excession. Notice buffer text + * is modified . + */ +long saacproto_ringoDecompressor( unsigned char *text , long textlen , + unsigned char *code , long codelen) +{ + NODE node[NODE_SIZE]; + int stack[NODE_SIZE]; + int sp; + int freeNode; + int len; + int i; + int k = 0; + int w = 0; + if( codelen <= 0 ) return -1; + initInputBitStream( (char*)code , codelen ); + for(i=0;i= freeNode ){ + stack[sp++] = k; /* exception */ + if( sp >=( sizeof( stack ) /sizeof(stack[0] )) )return -1; + k = w; + } else { + k = rv; + } + while(k> CHAR_SIZE ){ + if( k >= (sizeof(node)/sizeof(node[0]))) return -1; + stack[sp++] = node[k].chr; + k = node[k].parent; + if( sp >=( sizeof( stack ) /sizeof(stack[0] )) ) return -1; + } + stack[sp++] = k; + if( sp >= ( sizeof( stack ) /sizeof(stack[0] )) ) return -1; + /* output to text buffer from stack.*/ + while(sp){ + if( ++len > textlen ) return -1; + *text++ = stack[--sp]; + } + /* register the pattern 'wk'*/ + if( len > 1 && freeNode < NODE_SIZE ){ + node[freeNode].parent = w; + node[freeNode].chr = k; + if( w >= (sizeof(node)/sizeof(node[0])))return -1; + node[freeNode].brother = node[w].child; + node[freeNode].child = 0; + node[w].child = freeNode; + freeNode++; + } + w = rv; + } + return len; +} +#endif /* ifdef saacproto__ENCRYPT */ + +/* Convert 62-base digits to 10 digits */ +int saacproto_a62toi( char *a ) +{ + int ret = 0; + int minus ; + if( a[0] == '-' ){ + minus = -1; + a++; + } else { + minus = 1; + } + + while( *a != '\0' ) + { + ret *= 62; + if( '0' <= (*a) && (*a) <= '9' ) + ret += (*a)-'0'; + else + if( 'a' <= (*a) && (*a) <= 'z' ) + ret += (*a)-'a'+10; + else + if( 'A' <= (*a) && (*a) <= 'Z' ) + ret += (*a)-'A'+36; + else + return 0; + a++; + } + return ret * minus; +} + +/* Convert 10-base digits into 62-base digits. */ +char *saacproto_cnv10to62( int a, char *out, int outlen ) +{ + int i, j; + char base[] = { "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + int tmp[64]; + int src; + int minus; + int baselen = sizeof( base)-1; + if( a < 0 ){ + minus = 1; + a *= -1; + } else { + minus = 0; + } + /* special case */ + if( a < baselen) { + if( minus ){ + *(out) = '-'; + *(out+1) = base[a]; + *(out+2) = '\0'; + return (out); + } else { + *out = base[a]; + *(out+1) = '\0'; + return( out); + } + } + src = a; + for( i = 0; src >= baselen; i ++ ) { + tmp[i] = src % baselen; + src /= baselen; + } + i--; + if( minus ){ + *out = '-'; + *(out+1) = base[src]; + for( j = 2; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } else { + *out = base[src]; + for( j = 1; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } + *(out+j) = '\0'; + return( out); +} diff --git a/sasql.c b/sasql.c new file mode 100644 index 0000000..b6f086d --- /dev/null +++ b/sasql.c @@ -0,0 +1,2060 @@ +#define _SASQL_C_ + +#include "version.h" + +//#include "main.h" +#include "sasql.h" +#include "net.h" +#include "common.h" +#include "char_base.h" +#include "char_data.h" +#include "char.h" +#include "lssproto_serv.h" +#include "item.h" +#include "item_event.h" +#include "buf.h" +#include "object.h" +#include "map_deal.h" +#include "saacproto_cli.h" +#include "readmap.h" +#include "handletime.h" +#include "char_event.h" +#include "npccreate.h" +#include "addressbook.h" +#include "item_event.h" +#include "magic_base.h" +#include "magic.h" +#include "chatmagic.h" +#include "configfile.h" +#include "log.h" +#include "anim_tbl.h" +#include "encount.h" +#include "battle.h" +#include "pet_skill.h" +#include "util.h" +#include "enemy.h" +#include "npcutil.h" +#include "pet.h" +#include "family.h" +#include "defend.h" +#include "correct_bug.h" +#include + +extern int fmrankindex[20]; +extern char fmrankname[20][50]; +extern int fmrankpoint[20]; + +MYSQL mysql; +MYSQL serversql; +MYSQL_RES *mysql_result; +MYSQL_ROW mysql_row; + +void easyGetTokenFromString2( char *src,int count,char*output,int len ) +{ + int i; + int counter = 0; + + if( len <= 0 )return; + +#define ISSPACETAB( c ) ( (c) == ' ' || (c) == '\t' ) + + for(i=0;;i++){ + if( src[i]=='\0'){ + output[0] = '\0'; + return; + } + if( i > 0 && ! ISSPACETAB( src[i-1] ) && + ! ISSPACETAB( src[i] ) ){ + continue; + } + + if( ! ISSPACETAB( src[i]) ){ + counter++; + if( counter == count){ + int j; + for(j=0;j0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(mysql_row[2]!=NULL){ + if((strcmp(pas,mysql_row[1]) == 0) && (atoi(mysql_row[3])==0 || atoi(mysql_row[3])==getLockType())){ + return 1; + }else{ + //printf("û%s\n",nm); + return 2; + } + }else + { + if(strcmp(pas,mysql_row[1]) == 0 && atoi(mysql_row[3])==0){ + return 1; + }else{ + //printf("û%s\n",nm); + return 2; + } + } + }else{ + mysql_free_result(mysql_result); + //printf("û%sδעᣡ\n",nm); + return 3; + } + }else{ + //printf("\nݿʧܣ\n"); + return 0; + } +} + +int sasql_load_query(char *nm, char *pas){ + char sqlstr[256]; + sprintf(sqlstr,"select `%s`,`%s` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_NAME,sqlconfig.sql_PASS,sqlconfig.sql_Table,sqlconfig.sql_NAME,nm); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(strcmp(pas,mysql_row[1]) == 0){ + return 1; + }else{ + printf("û%s\n",nm); + return 2; + } + }else{ + mysql_free_result(mysql_result); + printf("û%sδעᣡ\n",nm); + return 3; + } + }else{ + printf("\nݿʧܣ\n"); + return 0; + } +} + +int sasql_del_query(char *nm, char *pas){ + char sqlstr[256]; + sprintf(sqlstr,"select `%s`,`SafePasswd` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_NAME,sqlconfig.sql_Table,sqlconfig.sql_NAME,nm); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(mysql_row[1]!=NULL) + { + if(strcmp(pas,mysql_row[1]) == 0){ + return 1; + }else{ + return 2; + } + }else{ + printf("û%s\n",nm); + return 2; + } + }else{ + mysql_free_result(mysql_result); + printf("û%sδעᣡ\n",nm); + return 3; + } + }else{ + printf("\nݿʧܣ\n"); + return 0; + } +} + + + +BOOL sasql_online( char *ID, char *NM, char *IP,int fame,int vigor, int flag ) +{ + if(openbackground){ + char sqlstr[256]; + if(flag==0) + sprintf(sqlstr,"update `%s` set `Online`=0,`Offline`=0 where `%s`=BINARY'%s'", sqlconfig.sql_Table, sqlconfig.sql_NAME, ID); + else if(flag==1) + { + if(strstr(NM,",")!=NULL) return FALSE; + mysql_query(&mysql,"SET NAMES 'gbk'"); + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(), `IP`='%s', `OnlineName`='%s', `Online`=%d, `Path`='char/0x%x',`Fame`=%d,`Vigor`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP, NM, getServernumber(), getHash(ID) & 0xff,fame,vigor, sqlconfig.sql_NAME, ID); + } + else if(flag==2){ + if(strstr(NM,",")!=NULL) return FALSE; + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(), `OnlineName`='%s', `Online`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, NM, getServernumber(), sqlconfig.sql_NAME, ID); + } + else if(flag==3) + sprintf(sqlstr,"update `%s` set `Online`=0,`Offline`=0 where `Online`=%d", sqlconfig.sql_Table, getServernumber()); + else if(flag==4) + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s', `Online`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP, getServernumber(), sqlconfig.sql_NAME, ID); + else if(flag==5) + sprintf(sqlstr,"update `%s` set `Offline`=1 where `%s`=BINARY'%s'", sqlconfig.sql_Table, sqlconfig.sql_NAME, ID); + if(!mysql_query(&mysql,sqlstr)){ + return TRUE; + } + } + printf("\nݿʧܣ\n"); + return FALSE; +} + +/* +BOOL sasql_online_jqm( char *ID, char *jqm, char *IP, int logintype, char *GHid, char *GHic, char *GHsp ) +{ + if(openbackground){ + + char sqlstr[2048]; + if(strstr(jqm,",")!=NULL || strstr(jqm,"+")!=NULL || strstr(jqm,"?")!=NULL || strstr(jqm,"*")!=NULL || strstr(jqm,"<")!=NULL || strstr(jqm,")")!=NULL || strstr(jqm,"^")!=NULL || strstr(jqm,"`")!=NULL || strstr(jqm,";")!=NULL) + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s',`PcId`='CUOWU', `Online`=%d,`Type`=%d,`GHid`='%s',`GHic`='%s',`GHsp`='%s' where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP, getServernumber(),logintype,GHid,GHic,GHsp, sqlconfig.sql_NAME, ID); + else + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s',`PcId`='%s', `Online`=%d,`Type`=%d,`GHid`='%s',`GHic`='%s',`GHsp`='%s' where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP,jqm, getServernumber(),logintype,GHid,GHic,GHsp, sqlconfig.sql_NAME, ID); + //print("\n sql: %s",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + return TRUE; + } + } + printf("\nݿʧܣ\n"); + return FALSE; +} +*/ + +BOOL sasql_online_jqm( char *ID, char *jqm, char *IP,int logintype ) +{ + if(openbackground){ + + char sqlstr[256]; + if(strstr(jqm,",")!=NULL || strstr(jqm,"+")!=NULL || strstr(jqm,"?")!=NULL || strstr(jqm,"*")!=NULL || strstr(jqm,"<")!=NULL || strstr(jqm,")")!=NULL || strstr(jqm,"^")!=NULL || strstr(jqm,"`")!=NULL || strstr(jqm,";")!=NULL) + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s',`PcId`='CUOWU', `Online`=%d,`Type`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP, getServernumber(),logintype, sqlconfig.sql_NAME, ID); + else + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s',`PcId`='%s', `Online`=%d,`Type`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP,jqm, getServernumber(),logintype, sqlconfig.sql_NAME, ID); + //print("\n sql: %s",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + return TRUE; + } + } + printf("\nݿʧܣ\n"); + return FALSE; +} + +#ifdef _CAX_NEWMAC_LOGIN +BOOL sasql_online_mac( char *ID, char *mac, char *IP,int logintype ) +{ +// if(openbackground){ + char sqlstr[256]; + sprintf(sqlstr,"update `%s` set `LoginTime`=NOW(),`IP`='%s',`MAC`='%s', `Online`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, IP, mac , getServernumber(), sqlconfig.sql_NAME, ID); + if(!sasql_mysql_query(sqlstr)){ + return TRUE; + } +// } + printf("\nݿʧ[mac]\n"); + return FALSE; +} +#endif + +BOOL sasql_register(char *id, char *ps) +{ + char sqlstr[256]; + if(AutoReg!=1)return FALSE; + sprintf(sqlstr,"INSERT INTO `%s` (`%s`,`%s`,`RegTime`,`Path`,`VipPoint`) VALUES (BINARY'%s','%s',NOW(),'char/0x%x',0)",sqlconfig.sql_Table, sqlconfig.sql_NAME, sqlconfig.sql_PASS, id, ps, getHash(id) & 0xff); + if(!mysql_query(&mysql,sqlstr)){ + printf("\nûעɹ\n"); + return TRUE; + } + printf("\nûעʧܣ\n"); + return FALSE; +} + + + +BOOL sasql_chehk_lock( char *idip ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `%s` where `%s`=BINARY'%s'", sqlconfig.sql_LOCK, sqlconfig.sql_NAME, idip); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0) + { + return TRUE; + } + else + { + return FALSE; + } + } + return FALSE; +} + +BOOL sasql_add_lock( char *idip ) +{ + char sqlstr[256]; + sprintf(sqlstr,"INSERT INTO `%s` (`%s`) VALUES (BINARY'%s')", sqlconfig.sql_LOCK, sqlconfig.sql_NAME, idip); + if(!mysql_query(&mysql,sqlstr)){ + printf("\n%sɹ\n",idip); + return TRUE; + } + return FALSE; +} + +BOOL sasql_del_lock( char *idip ) +{ + char sqlstr[256]; + sprintf(sqlstr,"delete from `%s` where `%s`=BINARY'%s'", sqlconfig.sql_LOCK, sqlconfig.sql_NAME, idip); + if(!mysql_query(&mysql,sqlstr)){ + printf("\n%sɹ\n",idip); + return TRUE; + } + return FALSE; +} + +int sasql_vippoint( char *ID, int point, int flag ) +{ + char sqlstr[256]; +// print("\NVIPpoint1=%d\n",point); + if(strstr(ID,"'")!=NULL) return -1; + sprintf(sqlstr,"select `VipPoint` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,ID); +// printf("22222222:%s\n",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(flag==0){ + return atoi(mysql_row[0]); + } + if(flag==520){ + sprintf(sqlstr,"update `%s` set `VipPoint`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, point,sqlconfig.sql_NAME, ID); + }else{ + point+=atoi(mysql_row[0]); + sprintf(sqlstr,"update `%s` set `VipPoint`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, point,sqlconfig.sql_NAME, ID); + } +// printf("33333333:%s\n",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + return point; + }else{ + return atoi(mysql_row[0]); + } + }else{ + mysql_free_result(mysql_result); + } + } + printf("»Աʧܣ-- %s\n",sqlstr); + return -1; +} + + +int sasql_onlinenum( char *cdkey, char *IP ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `%s` where `%s`='%s' and `Online`>0 and `IP`='%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey,IP); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 0; + } + } + sprintf(sqlstr,"select count(*) from `%s` where `Online`>0 and `Offline`=0 and `IP`='%s'",sqlconfig.sql_Table,IP); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + return 0; +} + +int sasql_onlinejqmnum( char *jqm, int flag ) +{ + char sqlstr[256]; +// sprintf(sqlstr,"select * from `%s` where `%s`='%s' and `Online`>0 and `PcId`='%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey,jqm); +// if(!mysql_query(&mysql,sqlstr)){ +// int num_row=0; +// mysql_result=mysql_store_result(&mysql); +// num_row=mysql_num_rows(mysql_result); +// mysql_free_result(mysql_result); +// if(num_row>0){ +// return 0; +// } +// } + if(flag == 1){ + sprintf(sqlstr,"select count(*) from `%s` where `Online`=%d and `Offline`=0 and `PcId`='%s'",sqlconfig.sql_Table,getServernumber(),jqm); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + }else{ + sprintf(sqlstr,"select count(*) from `%s` where `Online`>0 and `Offline`=0 and `PcId`='%s'",sqlconfig.sql_Table,jqm); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + } + return 0; +} + +#ifdef _CAX_NEWMAC_LOGIN +int sasql_onlinemacnum( char *mac, int flag ) +{ + char sqlstr[256]; + if(flag == 1){ + sprintf(sqlstr,"select count(*) from `%s` where `Online`=%d and `MAC`='%s'",sqlconfig.sql_Table,getServernumber(),mac); + if(!sasql_mysql_query(sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + }else{ + sprintf(sqlstr,"select count(*) from `%s` where `Online`>0 and `MAC`='%s'",sqlconfig.sql_Table,mac); + if(!sasql_mysql_query(sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + } + return 0; +} +#endif + +int sasql_query_safepasswd(char *id, char *safepasswd){ + char sqlstr[256]; + sprintf(sqlstr,"select `SafePasswd` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,id); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(mysql_row[0]!=NULL) + { + if(strcmp(safepasswd,mysql_row[0]) == 0) + { + if(strstr(id,safepasswd)!=NULL) + return 4; + return 1; + } + else + { + printf("\nȫ\n"); + return 2; + } + } + else + { + printf("\nûδдȫ룡\n"); + return 3; + } + }else{ + mysql_free_result(mysql_result); + } + } + else{ + printf("\nݿʧܣ\n"); + return 0; + } +} + +int sasql_add_safepasswd(char *id, char *safepasswd){ + char sqlstr[256]; + if(strstr(safepasswd,",")!=NULL) return 0; + sprintf(sqlstr,"update `%s` set `SafePasswd`=BINARY'%s' where `%s`=BINARY'%s'",sqlconfig.sql_Table,safepasswd,sqlconfig.sql_NAME,id); + + if(!mysql_query(&mysql,sqlstr)){ + printf("û%sðȫɹ\n",id); + return 1; + }else{ + printf("\nݿʧܣ\n"); + return 0; + } +} + +BOOL sasql_add_card(char *pas, int num) +{ + char sqlstr[256]; + sprintf(sqlstr,"INSERT INTO `OnlineCost` (`CostPasswd`,`CostVal`) VALUES (BINARY'%s','%d')", pas, num); + if(!mysql_query(&mysql,sqlstr)){ + return TRUE; + } + return FALSE; +} + +void sasql_query_card(char *id, char *cardps,int charaindex){ + char sqlstr[256]; + if(strstr(id,",")!=NULL){ + CHAR_talkToCli( charaindex, -1, "˺ŷǷ", CHAR_COLORRED); + return; + } + if(strlen(cardps)!=16){ + CHAR_talkToCli( charaindex, -1, "ܲڡ", CHAR_COLORRED); + return; + } + if( strstr(cardps,"/")!=NULL || strstr(cardps,"*")!=NULL || strstr(cardps,"+")!=NULL || strstr(cardps,"-")!=NULL || strstr(cardps,";")!=NULL || strstr(cardps,":")!=NULL || strstr(cardps," ")!=NULL || strstr(cardps,"|")!=NULL || strstr(cardps,".")!=NULL || strstr(cardps,",")!=NULL || strstr(cardps,"'")!=NULL || strstr(cardps,"=")!=NULL || strstr(cardps,"`")!=NULL || strstr(cardps,"<")!=NULL || strstr(cardps,">")!=NULL || strstr(cardps,"!")!=NULL || strstr(cardps,"NULL")!=NULL){ + CHAR_talkToCli( charaindex, -1, "ܷǷ", CHAR_COLORRED); + return; + } + sprintf(sqlstr,"select * from `OnlineCost` where `CostPasswd`=BINARY'%s'",cardps); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + int check,costval; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + check = atoi(mysql_row[4]); + costval = atoi(mysql_row[1]); + if(check == 1) + { + sprintf(sqlstr,"update `OnlineCost` set `cdkey`=BINARY'%s', `CostTime`=NOW(), `check`=0 where `CostPasswd`=BINARY'%s'",id,cardps); + if(!mysql_query(&mysql,sqlstr)){ + sprintf(sqlstr,"%dֵֽɹڵֽʻΪ%d",costval,sasql_rmbpoint(id,costval,1)); + CHAR_talkToCli( charaindex, -1, sqlstr, CHAR_COLORRED); + } + } + else + { + CHAR_talkToCli( charaindex, -1, "óֵѾʹãظʹãлл", CHAR_COLORRED); //ֵѾʹ + return; + } + } + else + { + mysql_free_result(mysql_result); + CHAR_talkToCli( charaindex, -1, "ֵдд", CHAR_COLORRED); //ֵд + return; + } + } + else{ + printf("\nݿʧܣ\n"); + return; + } +} + + +#ifdef _ONLINE_SHOP +int sasql_chehk_shop( char *dataname ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `%s`", dataname); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + return num_row; + } + return 0; +} + +char* sasql_query_shop( char *dataname, int startrow, int shopnum ) +{ + char sqlstr[256]; + char shopresult[2048]; + int i; + sprintf(sqlstr,"select * from `%s` LIMIT %d , %d", dataname, startrow, shopnum); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + for(i=1;i<=shopnum;i++) + { + mysql_row=mysql_fetch_row(mysql_result); + if(i==1) + { + sprintf(shopresult,"%s#%s#%s#%s#%s#%s#%s|",mysql_row[0],mysql_row[1],mysql_row[2],mysql_row[3],mysql_row[4],mysql_row[5],mysql_row[6]); + } + else + { + sprintf(shopresult,"%s%s#%s#%s#%s#%s#%s#%s|",shopresult,mysql_row[0],mysql_row[1],mysql_row[2],mysql_row[3],mysql_row[4],mysql_row[5],mysql_row[6]); + } + } + mysql_free_result(mysql_result); + return shopresult; + }else + { + mysql_free_result(mysql_result); + return "err"; + } + } + return "err"; +} + +int sasql_buy_shop( char *dataname, int startrow, int shopnum, int shopno ) +{ + char sqlstr[256]; + int i,costnum; + sprintf(sqlstr,"select * from `%s` where `id`=%d", dataname, shopno); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + costnum = atoi(mysql_row[5])*atoi(mysql_row[4])/100; + return costnum; + }else + { + mysql_free_result(mysql_result); + return 0; + } + } + return 0; +} +#endif + +char* sasql_query_question(void) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `Question`"); + if(!mysql_query(&mysql,sqlstr)) + { + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0) + { + srand((unsigned)time(NULL)); + int questionid; + questionid = (rand() % num_row)+1; + sprintf(sqlstr,"select * from `Question` where `id`=%d",questionid); + if(!mysql_query(&mysql,sqlstr)) + { + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0) + { + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + char question[256]; + sprintf(question,"%s;%s",mysql_row[1],mysql_row[2]); + return question; + } + return "err"; + } + return "err"; + } + return "err"; + } + return "err"; +} + +#ifdef _ALL_ITEM +int sasql_allnum( int flag, int num, int flag1 ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `AllNum` where `id`=%d",flag); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(flag1==0){ + return atoi(mysql_row[1]); + } + num+=atoi(mysql_row[1]); + sprintf(sqlstr,"update `AllNum` set `num`=%d where `id`=%d", num,flag); + if(!mysql_query(&mysql,sqlstr)){ + return num; + } + } + } + return num; +} +#endif + +BOOL sasql_craete_lock( void ) +{ + +} + +BOOL sasql_craete_userinfo( void ) +{ + +} + + + + + +#ifdef _SQL_BUY_FUNC +char *sasql_OnlineBuy( char *id, char *costpasswd ) +{ + char sqlstr[256]; + if(strstr(id,",")!=NULL) return "ʧܣ˺ŷǷ"; + if(strlen(costpasswd)!=16){ + return "ܲڡ"; + } + if( strstr(costpasswd,"/")!=NULL || strstr(costpasswd,"*")!=NULL || strstr(costpasswd,"+")!=NULL || strstr(costpasswd,"-")!=NULL || strstr(costpasswd,";")!=NULL || strstr(costpasswd,":")!=NULL || strstr(costpasswd," ")!=NULL || strstr(costpasswd,"|")!=NULL || strstr(costpasswd,".")!=NULL || strstr(costpasswd,",")!=NULL || strstr(costpasswd,"'")!=NULL || strstr(costpasswd,"=")!=NULL || strstr(costpasswd,"`")!=NULL || strstr(costpasswd,"<")!=NULL || strstr(costpasswd,">")!=NULL || strstr(costpasswd,"!")!=NULL || strstr(costpasswd,"NULL")!=NULL){ + return "ܷǷ"; + } + static char token[256]=""; + sprintf(sqlstr,"select `CostStr`, `check` from `OnlineBuy` where CostPasswd = BINARY'%s'", costpasswd); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[1]) == 1){ + char *coststr = mysql_row[0]; + sprintf(sqlstr,"update OnlineBuy set cdkey=BINARY'%s', CostTime=NOW(), `check`=0 where CostPasswd=BINARY'%s'", id, costpasswd); + if(!mysql_query(&mysql,sqlstr)){ + printf("%sȡ\n",costpasswd); + } + sprintf(token, "%c|%s", costpasswd[0], coststr); + + return token; + }else{ + return "ʹùظʹã"; + } + }else{ + return "ʧܣ벻ȷ"; + } + } + return "ʧܣ뱾Աϵ"; +} +void sasql_OnlineBuy_add( char *coststr, int type, int num ) +{ + char sqlstr[256]; + char CostPasswd[32]; + int i, j, k=0; + for(i=0;i= 2){ + printf("ɹ%dʯ\n", k); + } + return ; +} +#endif + +#ifdef _PET_RESET +int sasql_resetpet_point(int petno){ + char sqlstr[256]; + sprintf(sqlstr,"select `Point` from `PetReset` where `PetNo`='%d'",petno); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[0]) >= 0){ + return atoi(mysql_row[0]); + }else{ + return -1; + } + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} + +int sasql_resetbdpet_point(int petno){ + char sqlstr[256]; + sprintf(sqlstr,"select `BdPoint` from `PetReset` where `PetNo`='%d'",petno); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[0]) > 0){ + return atoi(mysql_row[0]); + }else{ + return -1; + } + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} +#endif + +#ifdef _ZHIPIAO_SYSTEM +int sasql_zhipiao_insert(char *petno,char *cdkey,int point){ + char sqlstr[256]; + char ip[32]; + if(strstr(cdkey,",")!=NULL) return -1; + //print("\npoint=%d\n",point); + sprintf(sqlstr,"select `IP` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[0]) >= 0){ + sprintf(ip,mysql_row[0]); + }else{ + return -1; + } + }else{ + mysql_free_result(mysql_result); + return -1; + } + } + sprintf(sqlstr,"INSERT INTO ZhiPiao (PiaoNo, Point,Cdkey1,Date1,IP1) VALUES (BINARY'%s', %d,'%s',NOW(),'%s')", petno, point,cdkey,ip); + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} + +int sasql_zhipiao_query(char *piaono){ + char sqlstr[256]; + sprintf(sqlstr,"select `Point`,`check` from `ZhiPiao` where `PiaoNo`='%s'",piaono); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[1]) == 1){ + return atoi(mysql_row[0]); + }else{ + return 0; + } + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} + +int sasql_zhipiao_update(char *cdkey,char *piaono,int checktype){ + if(strstr(cdkey,",")!=NULL) return -1; + char sqlstr[256]; + char ip[32]; + sprintf(sqlstr,"select `IP` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(atoi(mysql_row[0]) >= 0){ + sprintf(ip,mysql_row[0]); + }else{ + return -1; + } + }else{ + mysql_free_result(mysql_result); + return -1; + } + } + sprintf(sqlstr,"update ZhiPiao set Cdkey2=BINARY'%s', Date2=NOW(), `IP2`='%s', `check`=%d where PiaoNo=BINARY'%s'", cdkey,ip ,checktype,piaono); + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} +#endif +#ifdef _FMRANK_POINT +int sasql_fm_query(void){ + char sqlstr[256]; + mysql_query(&mysql,"SET NAMES 'gbk'"); + sprintf(sqlstr,"select * from `FmRank` ORDER by `Point` desc"); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + int i=0; + while((mysql_row=mysql_fetch_row(mysql_result)) && i<20){ + fmrankindex[i]=atoi(mysql_row[0]); + sprintf(fmrankname[i],"%s",mysql_row[1]); + fmrankpoint[i]=atoi(mysql_row[2]); + i++; + } + mysql_free_result(mysql_result); + return i; + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} + +int sasql_fmpoint_query(int fmindex){ + char sqlstr[256]; + mysql_query(&mysql,"SET NAMES 'gbk'"); + sprintf(sqlstr,"select `Point` from `FmRank` where `Index`='%d'",fmindex); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} + +int sasql_fmno_query(int fmindex){ + char sqlstr[256]; + sprintf(sqlstr,"select `Index` from `FmRank` ORDER by `Point` desc"); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + int i=1; + while((mysql_row=mysql_fetch_row(mysql_result))){ + if(atoi(mysql_row[0])==fmindex) + return i; + i++; + } + mysql_free_result(mysql_result); + return -1; + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} + +int sasql_fmpoint_add(int fmindex,int point){ + char sqlstr[256]; + sprintf(sqlstr,"update `FmRank` set `Point`=%d where `Index`=%d",point,fmindex); + + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} + +int sasql_fmindex_add(int fmindex,char *fmname,int point){ + char sqlstr[256]; + mysql_query(&mysql,"SET NAMES 'gbk'"); + sprintf(sqlstr,"INSERT INTO `FmRank` (`Index`,`Name`,`Point`) VALUES (%d,'%s',%d)",fmindex,fmname,point); + + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} + +int sasql_fmindex_del(int fmindex){ + char sqlstr[256]; + sprintf(sqlstr,"DELETE FROM `FmRank` where `Index`=%d",fmindex); + + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} +#endif +#ifdef _ITEM_RESET +int sasql_itemreset_query(int itemid){ + char sqlstr[256]; + sprintf(sqlstr,"select `ResetPoint` from `ItemReset` where `Id`='%d'",itemid); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} +int sasql_itemdel_query(int itemid){ + char sqlstr[256]; + sprintf(sqlstr,"select `DelPoint` from `ItemReset` where `Id`='%d'",itemid); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + return -1; + } + }else{ + return -1; + } +} +#endif + +int sasql_cdkey_lock(char *cdkey,int locktype){ + char sqlstr[256]; + sprintf(sqlstr,"select * from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME, cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + sprintf(sqlstr,"update `%s` set `Lock`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table,locktype,sqlconfig.sql_NAME, cdkey); + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } + }else{ + mysql_free_result(mysql_result); + } + } + return -1; +} + +int sasql_ampoint( char *ID, int point, int flag ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `AmPoint` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,ID); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(flag==0){ + return atoi(mysql_row[0]); + } + point+=atoi(mysql_row[0]); + sprintf(sqlstr,"update `%s` set `AmPoint`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, point,sqlconfig.sql_NAME, ID); + if(!mysql_query(&mysql,sqlstr)){ + return point; + }else{ + return atoi(mysql_row[0]); + } + }else{ + mysql_free_result(mysql_result); + } + } + printf("%sʧܣ\n",ID); + return -1; +} + +#ifdef _RMB_SYSTEM +int sasql_rmbpoint( char *ID, int point, int flag ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `RMBPOINT` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,ID); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + if(flag==0){ + return atoi(mysql_row[0]); + } + point+=atoi(mysql_row[0]); + sprintf(sqlstr,"update `%s` set `RMBPOINT`=%d where `%s`=BINARY'%s'", sqlconfig.sql_Table, point,sqlconfig.sql_NAME, ID); + if(!mysql_query(&mysql,sqlstr)){ + return point; + }else{ + return atoi(mysql_row[0]); + } + }else{ + mysql_free_result(mysql_result); + } + } + printf("%sֽʧܣ\n",ID); + return -1; +} +#endif + +int sasql_cdkey_online( char *cdkey ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `Online` from `%s` where `%s`='%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + return 0; + } + } + return 0; +} + +int sasql_check_iponline( char *IP ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `%s` where `IP`='%s'",sqlconfig.sql_Table,IP); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 1; + }else{ + return 0; + } + } + return -1; +} + +#ifdef _EV_NUM +char* sasql_ev_npcmsg( int npcno ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `EvNpc` where `No`='%d'",npcno); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return mysql_row[1]; + } + mysql_free_result(mysql_result); + } + return "err"; +} + +char* sasql_ev_item( void ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select count(*) from `EvItem`"); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + int itemno; + itemno = RAND(1,atoi(mysql_row[0])); + sprintf(sqlstr,"select `Id`,`MixNum`,`MaxNum` from `EvItem` where `No`='%d'",itemno); + if(!mysql_query(&mysql,sqlstr)){ + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + int itemnum = RAND(atoi(mysql_row[1]),atoi(mysql_row[2])); + sprintf(sqlstr,"%d|%d",atoi(mysql_row[0]),itemnum); + return sqlstr; + } + } + } + mysql_free_result(mysql_result); + } + return "err"; +} + +char* sasql_ev_pet( void ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select count(*) from `EvPet`"); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + int petno; + petno = RAND(1,atoi(mysql_row[0])); + sprintf(sqlstr,"select `PicId`,`Name`,`MixLv`,`MaxLv` from `EvItem` where `No`='%d'",petno); + if(!mysql_query(&mysql,sqlstr)){ + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + sprintf(sqlstr,"%d|%s|%d|%d",atoi(mysql_row[0]),mysql_row[1],atoi(mysql_row[2]),atoi(mysql_row[3])); + return sqlstr; + } + } + } + mysql_free_result(mysql_result); + } + return "err"; +} +#endif + +char* sasql_rand_buf( void ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select count(*) from `RandBuf`"); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + int randno; + randno = RAND(1,atoi(mysql_row[0])); + sprintf(sqlstr,"select * from `RandBuf` LIMIT %d,%d",randno-1,randno); + if(!mysql_query(&mysql,sqlstr)){ + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + sprintf(sqlstr,"%s|%s|%s|%s|%s|%s",mysql_row[0],mysql_row[1],mysql_row[2],mysql_row[3],mysql_row[4],mysql_row[5]); + return sqlstr; + } + } + } + mysql_free_result(mysql_result); + } + return "err"; +} + +int sasql_check_lockmac( char *mac) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `LockMac` where `MAC`='%s'",mac); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 1; + }else{ + return 0; + } + } + return -1; +} + +int sasql_check_lockpcid( char *pcid) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `LockMac` where `PcId`='%s'",pcid); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 1; + }else{ + return 0; + } + } + return -1; +} + +int sasql_check_lockip( char *IP , int type ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select * from `LockIP` where `IP`='%s' and `TYPE`=%d",IP,type); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 1; + }else{ + return 0; + } + } + return -1; +} +int sasql_add_lockip(char *IP,int type,int online,int mode){ + char sqlstr[256]; + sprintf(sqlstr,"INSERT INTO `LockIP` (`IP`,`TYPE`,`Online`,`Mode`) VALUES ('%s',%d,%d,%d)",IP,type,online,mode); + + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return -1; + } +} + +int sasql_query_online_ip(char *IP){ + char sqlstr[256]; + sprintf(sqlstr,"select * from `OnlineIP` where `IP`='%s'",IP); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + return 1; + }else{ + return 0; + } + } + return -1; +} + +int sasql_online_ip(char *cdkey,char *IP){ + char sqlstr[256]; + sprintf(sqlstr,"select * from `OnlineIP` where `Name`='%s'",cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + mysql_free_result(mysql_result); + if(num_row>0){ + sprintf(sqlstr,"update `OnlineIP` set `IP`='%s',`LoginTime`=NOW() where `Name`='%s'",IP,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return 0; + } + }else{ + sprintf(sqlstr,"INSERT INTO `OnlineIP` (`Name`,`IP`,`LoginTime`) VALUES ('%s','%s',NOW())",cdkey,IP); + if(!mysql_query(&mysql,sqlstr)){ + return 1; + }else{ + return 0; + } + } + } + return -1; +} + +int sasql_offlinenum( char *IP ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select count(*) from `%s` where `Online`=%d and `Offline`=1 and `IP`='%s'",sqlconfig.sql_Table,getServernumber(),IP); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + }else{ + mysql_free_result(mysql_result); + } + } + return 0; +} + +int sasql_offlinejqmnum( char *cdkey ) +{ + char sqlstr[256]; + char *pcid = NULL; + sprintf(sqlstr,"select `PcId` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + pcid = mysql_row[0]; + if(pcid == NULL) return 0; + sprintf(sqlstr,"select count(*) from `%s` where `Online`=%d and `Offline`>0 and `PcId`='%s'",sqlconfig.sql_Table,getServernumber(),pcid); + if(!mysql_query(&mysql,sqlstr)){ + num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + } + } + }else{ + mysql_free_result(mysql_result); + } + } + return 0; +} + +char* sasql_ip( char *cdkey ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `IP` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return mysql_row[0]; + }else{ + mysql_free_result(mysql_result); + } + } + return "err"; +} + +char* sasql_query_jqm( char *cdkey ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `PcId` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + //print("\n sqlstr=%s",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return mysql_row[0]; + }else{ + mysql_free_result(mysql_result); + } + } + return "err"; +} + +int sasql_setVipPoint( int charaindex, int point ) +{ + char sqlstr[256]; + char *id = CHAR_getChar(charaindex, CHAR_CDKEY); + sprintf(sqlstr,"update %s set VipPoint=%d where %s=BINARY'%s'", sqlconfig.sql_Table, point, sqlconfig.sql_NAME, id); + + if(!mysql_query(&mysql,sqlstr)){ + //printf("û%sǰػر%d\n",id,point); + return point; + } + return -1; +} + +int sasql_getVipPoint( int charaindex ) +{ + char sqlstr[256]; + char *id = CHAR_getChar(charaindex, CHAR_CDKEY); + sprintf(sqlstr,"select VipPoint from `%s` where %s=BINARY'%s'", sqlconfig.sql_Table, sqlconfig.sql_NAME, id); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + // mysql_free_result(mysql_result); + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + + return atoi(mysql_row[0]); + } + } +// printf("\nݿʧܣ\n"); + printf("ݿ[3]..."); +// sasql_close(); +// sasql_init(); + printf("\n"); + return -1; +} + +int sasql_setVipPointForCdkey( char *id, int point ) +{ + if(sasql_ckeckStrint(id) == FALSE){ + printf("쳣ַû%s\n",id); + return -1; + } + + char sqlstr[256]; + sprintf(sqlstr,"update %s set VipPoint=%d where %s=BINARY'%s'", sqlconfig.sql_Table, point, sqlconfig.sql_NAME, id); + + if(!mysql_query(&mysql,sqlstr)){ + //printf("û%sǰػر%d\n",id,point); + return point; + } + return -1; +} + + +int sasql_getVipPointForCdkey( char *id ) +{ + if(sasql_ckeckStrint(id) == FALSE){ + printf("쳣ַû%s\n",id); + return -1; + } + + char sqlstr[256]; + sprintf(sqlstr,"select VipPoint from `%s` where %s=BINARY'%s'", sqlconfig.sql_Table, sqlconfig.sql_NAME, id); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + + return atoi(mysql_row[0]); + } + } +// printf("\nݿʧܣ\n"); + printf("ݿ[2]..."); +// sasql_close(); +// sasql_init(); + printf("\n"); + return -1; +} + +BOOL sasql_ckeckStrint( char *str ) +{ + int i; + for(i=0;i 'z') && (str[i] < 'A' || str[i] > 'Z') && (str[i] < '0' || str[i] > '9') && (str[i] != '.')){ + return FALSE; + } + } + return TRUE; +} + +#ifdef _CARD_PRODUCTION +/** + * ɳֵ + */ +void sasql_OnlineCost_add( int cost, int num) +{ + char sqlstr[256]; + char CostPasswd[32]; + memset( CostPasswd, 0, sizeof( CostPasswd ) ); + int i, j, k=0; + for(i=0;i0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + } + } + printf("»ֵʧ\n"); + return -1; +} + +int sasql_setJfPoint( int charaindex, int point ) +{ + char sqlstr[256]; + char *id = CHAR_getChar(charaindex, CHAR_CDKEY); + sprintf(sqlstr,"update %s set AmPoint=%d where %s=BINARY'%s'", sqlconfig.sql_Table, point, sqlconfig.sql_NAME, id); + if(!mysql_query(&mysql,sqlstr)){ +//if(!sasql_mysql_query(sqlstr)){ + return point; + } + return -1; +} + +int sasql_xjPoint( int charaindex ) +{ +//printf("ݿ\n"); + char sqlstr[256]; + char *id = CHAR_getChar(charaindex, CHAR_CDKEY); + sprintf(sqlstr,"select RMBPOINT from `%s` where %s=BINARY'%s'", sqlconfig.sql_Table, sqlconfig.sql_NAME, id); + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return atoi(mysql_row[0]); + } + } + printf("RMBʧ\n"); + return -1; +} + +int sasql_setxjPoint( int charaindex, int point ) +{ + char sqlstr[256]; + char *id = CHAR_getChar(charaindex, CHAR_CDKEY); + sprintf(sqlstr,"update %s set RMBPOINT=%d where %s=BINARY'%s'", sqlconfig.sql_Table, point, sqlconfig.sql_NAME, id); + if(!mysql_query(&mysql,sqlstr)){ +//if(!sasql_mysql_query(sqlstr)){ + return point; + } + return -1; +} + +struct youx{ + int result; + int flg; + int errnono; + char* errstr; + int fieldCount; + int rowCount; + int rowAt; +}retlua; + + +#ifdef _CAX_LNS_MYSQLSUOXU +void sasql_LUASQLAdv(char* sqlstr,char* filepath,char* function,int npcindex ,int charaindex,char* msg,int flg) +{ + char* data = sasql_LuaAdv_QueryR(sqlstr,flg); + NPC_Lua_SQLPushAdvCallBack(retlua.result,retlua.flg,retlua.errnono,retlua.errstr,retlua.fieldCount ,retlua.rowCount ,retlua.rowAt, data,filepath,function,npcindex,charaindex,msg ); +} +char* sasql_LuaAdv_QueryR(char *sqlstr,int flg) +{ + int rowAtt = 0; + static char buff[1024] = ""; + snprintf(buff,1024, ""); + buff[1023]='\0'; + /*ʼϢ*/ + retlua.result = 0;//ERROR + retlua.flg = flg;// + retlua.errnono = 0;//MYSQL + retlua.errstr = "";//MYSQLϢ + retlua.fieldCount = 0;//ѯĿ + retlua.rowCount = 0;//ѯ + retlua.rowAt = 0;//ǰ¼ + + + if (flg == 1 || flg == 2){ + + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result);// + if (mysql_result == NULL) + { + retlua.result = -2; + }else if (mysql_eof(mysql_result)) + { + retlua.result = -3; + } + + if(num_row>0){ + + mysql_row = mysql_fetch_row(mysql_result);//Ӳѯȡһ + + retlua.errnono = mysql_errno(&mysql);// + retlua.errstr = mysql_error(&mysql);//Ϣ + retlua.fieldCount = mysql_field_count(&mysql);// + + retlua.rowCount = num_row;// + rowAtt++; + retlua.rowAt = rowAtt;//ǰ + if (flg == 1){ + mysql_free_result(mysql_result);//ͷŽ + mysql_result = NULL; + rowAtt = 0; + } + + int i; + for (i=0;i 15) retlua.result = -1; + return buff; + }else { + retlua.errnono = mysql_errno(&mysql); + retlua.errstr = mysql_error(&mysql); + } + } + }else if (flg == 3){ + + + int num_row=0; + if (mysql_result == NULL) { + retlua.result = -2; + return "Ѿͷš"; + } + num_row=mysql_num_rows(mysql_result);// + if (mysql_eof(mysql_result)) + { + retlua.result = -3;//Ѵﵽβˣȸѣѯ潫Զͷš + } + if (num_row == rowAtt) { + mysql_free_result(mysql_result);//ͷŽ + mysql_result = NULL; + rowAtt = 0; + retlua.result = -3; + return "ѵβУԶͷŽ"; + } + if(num_row>0){ + mysql_row = mysql_fetch_row(mysql_result);//Ӳѯȡһ + retlua.errnono = mysql_errno(&mysql);// + retlua.errstr = mysql_error(&mysql);//Ϣ + rowAtt++; + retlua.rowAt = rowAtt;//ǰ + retlua.fieldCount = mysql_field_count(&mysql);// + retlua.rowCount = num_row;// + if (num_row > 15) retlua.result = -1; + int i; + for (i=0;i0){ + mysql_row = mysql_fetch_row(mysql_result); + return (char*)mysql_row[row]; + } + }else + return "SQL Query ERROR"; +} +#endif + +#ifdef _CAX_NEWMAC_LOGIN +char* sasql_query_mac( char *cdkey ) +{ + char sqlstr[256]; + sprintf(sqlstr,"select `MAC` from `%s` where `%s`=BINARY'%s'",sqlconfig.sql_Table,sqlconfig.sql_NAME,cdkey); + //print("\n sqlstr=%s",sqlstr); + if(!mysql_query(&mysql,sqlstr)){ + int num_row=0; + mysql_result=mysql_store_result(&mysql); + num_row=mysql_num_rows(mysql_result); + if(num_row>0){ + mysql_row=mysql_fetch_row(mysql_result); + mysql_free_result(mysql_result); + return mysql_row[0]; + }else{ + mysql_free_result(mysql_result); + } + } + return "err"; +} +#endif diff --git a/start.bat b/start.bat new file mode 100644 index 0000000..7748b98 --- /dev/null +++ b/start.bat @@ -0,0 +1,3 @@ +del *.bak /S +del *.a /S +del *.o /S \ No newline at end of file diff --git a/util.c b/util.c new file mode 100644 index 0000000..b26bfce --- /dev/null +++ b/util.c @@ -0,0 +1,1819 @@ +#include "version.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "util.h" +#include "configfile.h" +#include +#define IS_2BYTEWORD( _a_ ) ( (char)(0x80) <= (_a_) && (_a_) <= (char)(0xFF) ) + +/*----------------------------------------- + 깴ݱëǷ + ¦ѡ 缰 ٯ ʽľ + + windows , macintosh , unixָɱƥ£ + + windows : \r\n + macintosh : \n\r + unix : \n + + ׾ئ + macintosh : \r + ƥʣ + ľة깴 ٯԪئʻ + ݱƥʾ + -----------------------------------------*/ +void chompex( char *buf ) +{ + while( *buf ){ + if( *buf == '\r' || *buf == '\n' ){ + *buf='\0'; + } + buf++; + } +} + + + +/*---------------------------------------- + * 깴1 ٯëԻ + * ¦ + * src ٯ + ----------------------------------------*/ +void chop( char* src ) +{ + /* + * ׷ϱ ٯëԻ + */ + int length = strlen( src ); + if( length == 0 ) return; + src[length-1] = '\0'; +} + + +/*---------------------------------------- + * 깴 ٯë£۹ ٯë ϶ƥ£ + * ¦ + * src 缰 ٯ + * delim ٯ NULL ٯƥȻ + ----------------------------------------*/ +void dchop( char* src , char* del) +{ + int dellen, srclen; + int i; + BOOL delete=FALSE; + + /* + * src ǷƩͻʣ1 ٯ年 del ͻëƻ + * ľʣ۹ƻݼ ٯʣ + */ + + srclen = strlen( src ); + dellen = strlen( del ); + if( srclen == 0 || dellen == 0 ) return; + + for( i = 0 ; i < dellen ; i ++ ){ + if( src[srclen-1] == del[i] ){ + delete = TRUE; + break; + } + } + + /* ԻԻ */ + if( delete )src[srclen - 1] = '\0'; +} + + +/*---------------------------------------- + * dchopѣ ټ ٯë£۹ ٯë ϶ƥ£ + * ¦ + * src 缰 ٯ + * delim ٯ NULL ٯƥȻ + ----------------------------------------*/ +void pohcd( char* src , char* del) +{ + int dellen, srclen; + int i; + BOOL delete=FALSE; + + /* + * src󡾮Ʃͻʣ1 ٯ年 del ͻëƻ + * ľʣ۹ƻݼ ٯʣ + */ + + srclen = strlen( src ); + dellen = strlen( del ); + if( srclen == 0 || dellen == 0 ) return; + + for( i = 0 ; i < dellen ; i ++ ){ + if( src[0] == del[i] ){ + delete = TRUE; + break; + } + } + + /* */ + if( delete ) + /* ƥ NULL ٯľ */ + for( i = 0 ; i < srclen ; i ++ ) + src[i] = src[i+1]; +} + + +/*---------------------------------------- + * ٯ ٯֳľ¾Ʃ£ + * ¦ + * src char* Ʃ ٯ + * include char* ֳľ¾ ٯ + * ߯Ի + * ٱֳľsrc + * -1 + ----------------------------------------*/ +int charInclude( char* src, char* include ) +{ + int i,j; + int srclen,includelen; + + srclen = strlen( src ); + includelen = strlen( include ); + + for( i = 0 ; i < srclen ; i ++ ){ + for( j = 0 ; j < includelen ; j ++ ) + if( src[i] == include[j] ) + return i; + } + return -1; +} + + +/*------------------------------------------------------------ + * EUC2 ëئstrncpy + * freeBSD Ƥ strncpy ëȻ廯 + * ľëݱհ*dest++ 羮컥 + * ئмƥȻئУ۾Ի ̼Ȼ + * ئԻ ئة + * ¦ + * dest char* + * src char* ĩ + * n size_t Ӯ + * ߯Ի + * dest + ------------------------------------------------------------*/ +char* strncpy2( char* dest, const char* src, size_t n ) +{ + if( n > 0 ){ + char* d = dest; + const char* s = src; + int i; + for( i=0; i=n ){ + *(d+i-1)='\0'; + break; + } + *(d+i) = *(s+i); + }else + *(d+i) = *(s+i); + } + } + return dest; +} + +/*---------------------------------------- + * src dest £ ƼëƩ£ + * ¦ + * dest + * n + * src 缰 ٯ + ----------------------------------------*/ +void strcpysafe( char* dest ,size_t n ,const char* src ) +{ + /* + * src dest . + * strcpy, strncpy ƥ dest Ի ڻ + * ݱ,ƹ½ʧͱ. + * ľë ʲб, strncpy ؤ» strlen( src ) n Ի + * ݱ巴, dest NULL ٯ練ئئ. + * + * ׻Ȼ dest Ի src õӮݱ巴 + * n-1 ƥ strncpy ë. ݷ + * + * n ݷƾئ¼ƥ ݷ ئУ + * + */ + // Nuke +1 (08/25): Danger if src=0 + if (!src) { + *dest = '\0'; + return; + } + if( n <= 0 ) /* ئ */ + return; + + /* ƥ n >= 1 */ + /* NULL ٯë ƻ ʤ */ + else if( n < strlen( src ) + 1 ){ + /* + * 뻥Իئмƥ n - 1(NULL ٯ) + * ƥ strncpy ë + */ + strncpy2( dest , src , n-1 ); + dest[n-1]='\0'; + }else + strcpy( dest , src ); + +} + +/*---------------------------------------- + * src length ʣ Ƽ ëƩ£ + * ¦ + * dest + * n Ƽ + * src + * length ٯ¾ + ----------------------------------------*/ +void strncpysafe( char* dest , const size_t n , + const char* src ,const int length ) +{ + /* + * src dest length + * strcpy, strncpy ƥ dest Ի ڻ + * ݱ,ƹ½ʧͱ. + * ƥstrlen( src ) length лõ + * ( ˱) dest ë ͻ + * strcpysafe Ԫë£ + */ + + int Short; + Short = min( strlen( src ) , length ); + + /* NULL ٯ ë ʤ */ + if( n < Short + 1 ){ + /* + * 뻥Իئмƥ n - 1(NULL ٯ) + * ƥ strncpy ë + */ + strncpy2( dest , src , n-1 ); + dest[n-1]='\0'; + + }else if( n <= 0 ){ + return; + }else{ + /* + * 뷴бؤ¼ƥ Short ƥstrncpyë + * ئ src 巴 Short Ӯ NULL ئмƥ + * dest 巴 ܰƻʣ + */ + + strncpy2( dest , src , Short ); + dest[Short]= '\0'; + + } +} + +/*------------------------------------------------------------ + * strcatë £мƥ ئëлئǣ + * ¦ + * src char* ئ ٯ + * size int src ( ǷľȻ¾ƥ + * ئʻ ) + * ap char* + * ߯Ի + * src ( ľ) + ------------------------------------------------------------*/ +char* strcatsafe( char* src, int size, char* ap ) +{ + strcpysafe( src + strlen( src ) , size - strlen(src), ap ); + return src; +} + +/*---------------------------------------- + * ٯ ë ʤ£ Ԫƾ ئ by ringo + * char *s1 , *s2 : ʤ ٯ + * ߯Ի + * 0 ئԪ + * 1 : ئ + * ľNPC ƽݩ ֧ʷֹ + ----------------------------------------*/ +int strcmptail( char *s1 , char *s2 ) +{ + int i; + int len1 = strlen( s1 ); + int len2 = strlen( s2 ); + + for(i=0;;i++){ + int ind1 = len1 - 1 - i; + int ind2 = len2 - 1 - i; + if( ind1 < 0 || ind2 < 0 ) return 0; + if( s1[ind1] != s2[ind2] ) return 1; + } +} + + + +/*---------------------------------------- + * ٯ ̤ľ°ë£ + * NPC ƽݩ ֧ʷֹ + * ׷ ٯؤ £ + * Ȭ ئʧة ʣ + * ¦ + * hoge char* ݩ ٯ + * ߯Ի + * ݩ װѣ + * + * + * "ringo ( ۰ ) 100" + * 100£ + * "ringo ( ۰ ) 100" + * 100ئ£ۻNPCئԻѣ + ----------------------------------------*/ +#define DECIMALCHARNUM 10 +#define FIGURECHARNUM 3 +#define SPECIALCHARNUM 2 +char *UTIL_decimalchar[DECIMALCHARNUM] = {"0","1","2", + "3", "4","5", + "6","7","8","9"}; +char *UTIL_figurechar[FIGURECHARNUM] = {"","",""}; +char *UTIL_specialchar[SPECIALCHARNUM] = {"",""}; + +/* + * ٯ գѰë ľ ë ʣ õ + * ƻ ʣeucã + * + * : in "Ȿ300" + * out "7" + * ¦ + * char *in: ٯ + * char *out: ٯ + * int outsiz: ٯ + * ߯Ի + * Ѱë лؤչ ٯ Ӯئը + */ +static int findNumberString( char *in, char *out, int outsiz ) +{ + int len,i,j,k, findflag, numstrflag; + char tmp[3]; + + len = strlen(in); + if( len == 0 ) return 0; + + numstrflag=0; + findflag = 0; + for( i=0,j=0;in[i]!='\0'&& j 0x7fffffff ) return 0x7fffffff; + else return (int)val; + +} + + +/* + * ֿƥ Ѱëѱ + * char *str Ѱë ٯ + * ߯Ի Ѱ + * + * str"һ4ǧ"߯Ի 140000000 + */ +int kanjistrToInt( char *str ) +{ + double val,tmpval; + char tmp[3]; + int num,i,j,numflag; + + numflag = 0; + num = 1; + tmpval = 0; + val = 0; + for( i=0;str[i]!='\0';i++ ){ + if( str[i] & 0x80 ){ + tmp[0] = str[i]; + tmp[1] = str[i+1]; + tmp[2] = '\0'; + i++; + }else{ + tmp[0] = str[i]; + tmp[1] = '\0'; + } + for( j=0;j 0x7fffffff ) return 0x7fffffff; + else return (int)val; + +} + + + +/*---------------------------------------- + * ٯ ̤ľ°ë£ + * NPC ƽݩ ֧ʷֹ + * ׷ ٯؤ £ + * Ȭ ئʧة ʣ + * ¦ + * hoge char* ݩ ٯ + * ߯Ի + * ݩ װѣ + * + * + * "ringo ( ۰ ) 100" + * 100£ + * "ringo ( ۰ ) 100" + * 100ئ£ۻNPCئԻѣ + ----------------------------------------*/ +int texttoiTail( char *hoge) +{ + return 0; /* ʲȻ׼ƥף۹ʣ */ +} + +/*---------------------------------------- + * ٯ ëٯƻٯ + * ¦ѱ ľ߯ + * ¦ + * arg + * number ëҽ + * base + * type ¦Ѽ( CTYPE common.h ɽľ ) + * ߯Ի + * TRUE(1) + * FALSE(0) strtolձ巴 ئ + * ݼnumberstrtol߯Իƥؤ + ----------------------------------------*/ +BOOL strtolchecknum( char* arg , void* number,int base ,CTYPE type) +{ + char* buf; + int num; + + num = strtol( arg, &buf, base); + + switch( type ){ + case CHAR: + *(char*)number = (char)num; + break; + case SHORT: + *(short*)number = (short)num; + break; + case INT: + *(int*)number = num; + break; + case DOUBLE: + *(double*)number = (double)num; + break; + default: + break; + } + + + if( strlen( buf ) >= 1 ) + /* + * Ի ٯؤеǷ ľئеئ֣ + */ + return FALSE; + + return TRUE; + +} + + + + +/*---------------------------------------- + * src dels ƥ϶ ٯëԻ + * ͵ب޵ƥؤDZ + * Ի͵بƥئУ + * ¦ + * src ʽľ ٯ + * char* ٯ( ٯ ƥ϶õ) + * ߯Ի + * ئ + ----------------------------------------*/ +void deleteCharFromString( char* src , char* dels ) +{ + int index=0; /* ƥؤԻ ٯ ƥ index */ + int delength; /* dels Ӯëɬ(Ʒպʧ󼰿 */ + int i=0,j;/* i src ë j dels ë */ + + delength= strlen( dels ); + + while( src[i] != '\0' ){ + if( src[i] == BACKSLASH ) + /* + * ͵بئƥ޵ + * Իݼ ٯ + */ + src[index++] = src[++i]; /* substitute next char */ + + else{ + for( j = 0 ; j < delength ; j ++ ){ + if( src[i] == dels[j] ) + /* + * ٯ֣۷Ȼ i 1 ë + */ + goto incrementi; + } + /* + * ϶ýľئмƥ£ + */ + src[index++] = src[i]; + } + incrementi: + i++; + } + + src[index] = '\0'; +} + + + +/*---------------------------------------- + * src dels ƥ϶ ٯëԻ + * ޵ئ + * ¦ + * src ʽľ ٯ + * char* ٯ( ٯ ƥ϶õ) + * ߯Ի + * ئ + ----------------------------------------*/ +void deleteCharFromStringNoEscape( char* src , char* dels ) +{ + int index=0; /* ƥؤԻ ٯ ƥ index */ + int delength; /* dels Ӯëɬ(Ʒպʧ󼰿 */ + int i=0,j;/* i src ë j dels ë */ + + delength= strlen( dels ); + + while( src[i] != '\0' ){ + for( j = 0 ; j < delength ; j ++ ){ + if( src[i] == dels[j] ) + /* + * ٯ֣۷Ȼ i 1 ë + */ + goto incrementi; + } + /* + * ϶ýľئмƥ£ + */ + src[index++] = src[i]; + incrementi: + i++; + } + + src[index] = '\0'; +} + +/*------------------------------------------------------------ + * ϶ýľ ٯë϶ýľ ٯƥ 微 + * ¦ + * src char* ʽľ ٯ + * oldc char ʽľ ٯ + * newc char ٯ + * ߯Ի + * src + ------------------------------------------------------------*/ +char* replaceString( char* src, char oldc ,char newc ) +{ + char* cp=src; + + do{ + if( *cp == oldc ) *cp=newc; + }while( *cp++ ); + return src; +} + +typedef struct tagEscapeChar +{ + char escapechar; + char escapedchar; +}EscapeChar; +static EscapeChar escapeChar[]= +{ + { '\n', 'n' }, + { ',', 'c' }, + { '|', 'z' }, + { '\\', 'y' }, +}; + + +char makeCharFromEscaped( char c )//add this function,because the second had it +{ + int i; + + for( i = 0; i < sizeof( escapeChar )/sizeof( escapeChar[0] ); i++ ) + { + if( escapeChar[i].escapedchar == c ) + { + c = escapeChar[i].escapechar; + break; + } + } + return c; +} +/*---------------------------------------- + * makeEscapeStringƥľ ٯ ë + * ¦ + * src char* ئ ٯ ۳ľ̤׸£ + * ߯Ի + * src ë߯ʣ(ë ľ֧з) + ----------------------------------------*/ +char *makeStringFromEscaped( char* src ) +{//ttom this function all change,beside copy from the second + + int i; + // CoolFish: Fix bug 2001/10/13 + // int srclen = strlen( src ); + int srclen = 0; + int searchindex=0; + + // CoolFish: Fix bug 2001/10/13 + if (!src) return NULL; + srclen = strlen(src); + + for( i = 0; i < srclen; i ++ ) + { + // for 2Byte Word + if( IS_2BYTEWORD( src[i] ) ){ + src[searchindex++] = src[i++]; + src[searchindex++] = src[i]; + }else + if( src[i] == '\\' ) + { + // ݼ ٯ + i++; + src[searchindex++] = makeCharFromEscaped( src[i] ); + } + else + { + src[searchindex++] = src[i]; + } + } + src[searchindex] = '\0'; + + return src; +} + +char* makeEscapeString( char* src , char* dest, int sizeofdest) +{ //ttom this function all change, copy from the second + int i; + int srclen = 0; + int destindex=0; + + // CoolFish: Fix bug 2001/10/13 + if (!src) return NULL; + srclen = strlen(src); + + for( i = 0 ; i < srclen ; i ++ ){ + BOOL dirty=FALSE; + int j; + char escapechar='\0'; + if( destindex + 1 >= sizeofdest )break; + if( IS_2BYTEWORD( src[i] ) ){ + if( destindex + 2 >= sizeofdest )break; + + dest[destindex] = src[i]; + dest[destindex+1] = src[i+1]; + destindex += 2; + i ++; + continue; + } + for( j = 0; j= length ){ + print( "*\n"); + break; + } + src[index++]=src[i]; + /* DZ */ + backchar = '\0'; + continue; + } + if( src[i] == backchar ) + /* + * ԪئУ۹Իֱئ£ + */ + continue; + + /* + * ٯئئ׼ƥ backchar NULL ٯ + * ľԪ + */ + backchar = '\0'; + for( j = 0 ; j < delength ; j ++ ){ + if( src[i] == dels[j] ){ + /* + * ٯ ֣ ƥ continue ئDZ巽Ի + * ٯئǻƥ£ + */ + backchar=src[i]; + break; + } + } + src[index++]=src[i]; + } + src[index++]='\0'; +} + +/*---------------------------------------- + * hashë߯ʣ ٯ 弰 + * ľ ئƥʧةϻ + * ʧةУ + * ¦ + * s ٯ + * ߯Ի + * int ˦ب + *----------------------------------------*/ +#define PRIME 211 +int hashpjw ( char* s ) +{ + char *p; + unsigned int h= 0 ,g; + for( p = s ; *p ; p ++ ){ + h = ( h<< 4 ) + (*p); + if( (g = h & 0xf0000000) != 0){ + h = h ^ (g>>24); + h = h ^ g; + } + } + return h % PRIME; +} + +/*---------------------------------------- + * л̼ĩë߯( TCP ) + * ¦ + * port л̡ + * ߯Ի + * -1 ޷¡ + * 1. socket˵ ةP޷¡ + * 2. bind˵ ةP޷¡ + * 3. listen˵ ةP޷¡ + ----------------------------------------*/ +int bindlocalhost( int port ) +{ + struct sockaddr_in sin; /*лʧ*/ + int sfd; /*ĩū*/ + int rc; /*л*/ + + /*AF_INET SOCK_STREAM */ + sfd = socket( AF_INET, SOCK_STREAM, 0 ); + if( sfd == -1 ){ + print( "%s\n" , strerror(errno ) ); + return -1; + } + if( getReuseaddr() ) { + int sendbuff; + /* лʧ */ + setsockopt( sfd, SOL_SOCKET, SO_REUSEADDR, + (char *)&sendbuff, sizeof( sendbuff)); + } + + /*0ʧƻëҽ */ + memset( &sin ,0, sizeof( struct sockaddr_in ) ); + sin.sin_family=AF_INET; + sin.sin_port = htons( port ); + sin.sin_addr.s_addr = INADDR_ANY; + + rc = bind( sfd , (struct sockaddr*)&sin, sizeof(struct sockaddr_in)); + if( rc == -1 ){ + print( "%s\n" , strerror(errno ) ); + return -1; + } + + rc = listen( sfd , 5 ); + if( rc == -1 ){ + print( "%s\n" , strerror(errno ) ); + return -1; + } + return sfd; +} + + + +/*---------------------------------------- + * £( TCP ) + * ¦ + * hostname ʯ + * (xx.xxx.xxx.xxxƥxxx.co.jp羮ƥ) + * port ʯ̡ + * ߯Ի + * ū( -1 ݷ޷¡ ) + ----------------------------------------*/ +int connectHost( char* hostname , unsigned short port ) +{ + struct sockaddr_in sock; /*connectݱ*/ + struct hostent* hoste; /*hostnamehostent*/ + int fd; /*ĩū*/ + int lr; /*л*/ + + memset( &sock , 0 , sizeof( struct sockaddr_in ) ); + sock.sin_family = AF_INET; + sock.sin_port = htons( port ); + + /* dot notation ëƩ */ + sock.sin_addr.s_addr = inet_addr( hostname ); + if( sock.sin_addr.s_addr == -1 ){ + /* + *޷¡ dot notation ƥئУ׻Ȼ ɧ ݩ裻 ֣ۢ + * dnsëئľئئݷʼֳƥ֧Ȼľ£ + */ + hoste = gethostbyname( hostname ); + if( hoste == NULL ){ + print( "ȡʧܣȷDNSַ\n" ); + return -1; + } + + memcpy((void*)&sock.sin_addr.s_addr , + hoste->h_addr , sizeof(struct in_addr) ); + } + + /*ĩë*/ + fd = socket( AF_INET, SOCK_STREAM , 0 ); + if( fd == -1 ){ + print("Cannot Create Socket(%s errno:%d)\n" + ,strerror( errno ) ,errno ); + return -1; + } + /**/ + lr = connect(fd,(struct sockaddr*)&sock,sizeof(struct sockaddr_in)); + if( lr != 0 ){ + print("Cannot connect. (%s errno:%d)\n" + ,strerror( errno ) ,errno ); + return -1; + } + return fd; +} + + +/*---------------------------------------- + * 뼰 ݱ淤įؤ¾ + * ƶʧة ʣ + * ¦ + * char* Ʃ ٯ + * ߯Ի + * ٱέݱ淤į ʧͱݱа + * еǾе + * existsNewLinwCharacter( "aho\nhoge\n" ) + * ߯Ի 3 ئ£۳ľǣ + * -1 ئ + * + ----------------------------------------*/ +int existsNewLineCharacter( char* line ) +{ +#if 1 + char* old = line; + do{ + if( *line == NEWLINE)return line-old; + }while( *(line++) ); +#else + int i; /* */ + int length = strlen( line ); /*Ʃ ٯ Ӯ*/ + for( i = 0 ; i < length ; i ++ ){ + if( line[i] == NEWLINE ) + return i; + } +#endif + + return -1; +} + + + +/*---------------------------------------- + * ٯ ٯ ľëʣ ë裻ľ£ + * nindex( string , c , 1 ) index( string , c ) equivalent ƥؤ£ + * number ׷0ݷ߯Իstring Ԫƥؤ£ + * + * ¦ + * string char* Ʃ ٯ + * c int Ʃ ٯ + * number int į + * ߯Ի + * ٯ̼ + * NULL Ĺئף + ----------------------------------------*/ +char* nindex( char* string, int c , int number ) +{ + int i; /* */ + int num=0; + int length = strlen( string ); /*Ʃ ٯ Ӯ*/ + if( number <= 0 )return string; + for( i = 0 ; i < length ; i ++ ){ + if( string[i] == c )num++; + if( number == num ) return &string[i]; + } + return NULL; +} + +BOOL rrd( char* dirname , STRING64* buf ,int bufsize, int* index) +{ + DIR* d; + char dirn[1024]; + + d = opendir( dirname ); + if( d == NULL )return FALSE; + + while( 1 ){ + struct dirent* dent; + struct stat st; + dent = readdir( d ); + if( dent == NULL ){ + if( errno == EBADF ){ + errorprint; + closedir(d); + return FALSE; + }else + /* successful */ + break; + } + + /* . ƥ°̻ﷴ ئ */ + if( dent->d_name[0] == '.' )continue; + + snprintf(dirn, sizeof(dirn), "%s/%s" , dirname,dent->d_name ); + if( stat( dirn , &st ) == -1 )continue; + if( S_ISDIR( st.st_mode ) ){ + if( rrd( dirn , buf ,bufsize, index) == FALSE ){ + closedir(d); + return FALSE; + } + }else{ + if( *index >= bufsize ) + break; + + strcpysafe( buf[*index].string , sizeof( buf[*index].string ), dirn ); + (*index)++; + } + } + closedir(d); + return TRUE; +} + +int rgetFileName( char* dirname , STRING64* string, int size) +{ + int index=0; + if( rrd( dirname , string ,size ,&index ) == FALSE )return -1; + else return index; +} + +BOOL checkStringsUnique( char** strings, int num ,int verbose) +{ + int i,j; + for( i = 0 ; i < num - 1; i ++ ){ + for( j = i+1 ; j < num ; j ++){ + if( !strcmp( strings[i] ,strings[j] )){ + if( verbose ) + print( "Overlapp string is %s\n", strings[i] ); + return FALSE; + } + } + } + return TRUE; +} + +BOOL PointInRect( RECT* rect, POINT* p ) +{ + if( rect->x <= p->x && p->x <= rect->x + rect->width && + rect->y <= p->y && p->y <= rect->y + rect->height ) + return TRUE; + return FALSE; +} + +BOOL CoordinateInRect( RECT* rect, int x, int y) +{ + POINT p={x,y}; + return PointInRect(rect,&p); +} + +int clipRect( RECT *rect1, RECT *rect2, RECT *ret ) +{ + if( rect1->x > rect2->x + rect2->width -1 + || rect2->x > rect1->x + rect1->width -1 + || rect1->y > rect2->y + rect2->height -1 + || rect2->y > rect1->y + rect1->height -1 ) + return 0; + ret->x = max( rect1->x, rect2->x ); + ret->y = max( rect1->y, rect2->y ); + ret->width = min( rect1->x+rect1->width, rect2->x+rect2->width ) - ret->x; + ret->height = min( rect1->y+rect1->height, rect2->y+rect2->height ) - ret->y; + return 1; +} + +BOOL isstring1or0( char* string ) +{ + if( strcasecmp(string,"TRUE" ) == 0 )return TRUE; + if( strcasecmp(string,"FALSE") == 0 )return FALSE; + if( strcasecmp(string,"1" ) == 0 )return TRUE; + if( strcasecmp(string,"0" ) == 0 )return FALSE; + if( strcasecmp(string,"ON" ) == 0 )return TRUE; + if( strcasecmp(string,"OFF" ) == 0 )return FALSE; + return FALSE; +} + +void easyGetTokenFromString( char *src,int count,char*output,int len ) +{ + int i; + int counter = 0; + + if( len <= 0 )return; + + +#define ISSPACETAB( c ) ( (c) == ' ' || (c) == '\t' ) + + for(i=0;;i++){ + if( src[i]=='\0'){ + output[0] = '\0'; + return; + } + if( i > 0 && ! ISSPACETAB( src[i-1] ) && + ! ISSPACETAB( src[i] ) ){ + continue; + } + + if( ! ISSPACETAB( src[i]) ){ + counter++; + if( counter == count){ + /* copy it */ + int j; + for(j=0;j1---- + * + * + ------------------------------------------------------------*/ +float linearDiv( float val1 , float val2 , float d ) +{ + return val1 + ( val2 - val1 ) * ( d ); +} + + +/*------------------------------------------------------------ + * ٯ ئ ئ ٯëlen ٯԻƻ¼ĸةئ + * ٯ ë£NPC¼ĸةɵϷ年Ȼ + * + * char *cand : ռ٣ ٯ + * char *out : + * int len : Ӯ + ------------------------------------------------------------*/ +void makeRandomString( char *cand , char *out , int len ) +{ + int i; + int l = strlen( cand ); + + for(i=0;i= baselen; i ++ ) { + tmp[i] = src % baselen; + src /= baselen; + } + i--; + if( minus ){ + *out = '-'; + *(out+1) = base[src]; + for( j = 2; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } else { + *out = base[src]; + for( j = 1; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + } + *(out+j) = '\0'; + return( out); +#else +/* */ +#define CNV_NUMBER 62 + int i, j; + char base[] = { "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + int tmp[64]; + int src; + if( a < 0 ) return( NULL); + if( a < CNV_NUMBER) { + *out = base[a]; + *(out+1) = '\0'; + return( out); + } + src = a; + for( i = 0; src >= CNV_NUMBER; i ++ ) { + tmp[i] = src % CNV_NUMBER; + src /= CNV_NUMBER; + } + i--; + *out = base[src]; + for( j = 1; i >= 0; i --, j ++ ) { + if( j > outlen - 2 ) return NULL; + *(out+j) = base[tmp[i]]; + } + *(out+j) = '\0'; + return( out); +#undef CNV_NUMBER +#endif +} +/* + * ܸľ ƥѰ ƻ¾Ʃ + * -1 ½е ئ + * + * ¦ + * src *int Ʃ缰 + * srclen int src + * + * Ի ؤԻ TRUE + * ئ FALSE + */ +BOOL checkRedundancy( int *src, int srclen) +{ + int i,j; + int ret = FALSE; + + for( i = 0; i < srclen; i ++ ) { + if( *(src + i) != -1 ) { + for( j = i+1; j < srclen; j ++ ) { + if( *(src +i) == *( src+j) ) { + ret = TRUE; + break; + } + } + } + } + return ret; +} +void +shuffle_ints( int num, int *a, int t ) +{ + int i; + for(i=0;i> 8 ) & 0xFF ] + ^ ( crc << 8 ) ^ BitTable[ p[ i ] ] ); + } + return crc; +} + +// Add Code By Shan 2001.06.16 +INLINE double time_diff(struct timeval subtrahend, + struct timeval subtractor) +{ + return( (subtrahend.tv_sec - subtractor.tv_sec) + + (subtrahend.tv_usec + - subtractor.tv_usec ) / (double)1E6 ); +} + +char *strcpy_s(char *des, size_t n, const char *src) +{ + assert(des != NULL && src != NULL); + + if(des == NULL || src == NULL || n == 0) + { + return NULL; + } + + char *TM_RetChar = des; + int i = 0; + + while( (*des++ = *src++) ) + { + i++; + if( i >= n ) + { + i--; + break; + } + } + TM_RetChar[i] = '\0'; + return TM_RetChar; +} + +char *replace(char *source,char *sub,char *rep) +{ +char *result; +/*pc1 ǸƵresultɨָ*/ +/*pc2 ɨ source ĸָ*/ +/*pc3 ѰӴʱ,Ϊ仯еsourceǷӴ,ָsubɨָ */ +/*ҵƥ,Ϊ˸Ƶ,ָrepɨָ*/ +char *pc1, *pc2, *pc3; +int isource, isub, irep; +isub =strlen(sub); /*Աַij*/ +irep =strlen(rep); /*滻ַij*/ +isource=strlen(source);/*Դַij*/ +if(NULL == *sub) +return strdup(source); +/*ҪĿռ*/ +result = (char *)malloc(( (irep > isub) ? (float)strlen(source) / isub* irep+ 1:isource ) * sizeof(char)); +pc1 = result; /*Ϊpc1θƽÿֽ׼*/ +while(*source != NULL) +{ +/*ΪsourcesubǷ׼,Ϊpc2,pc3 ֵ*/ + pc2 = source; + pc3 = sub; + /* ѭģһǣ + * *pc2 *pc3Ӵȣ + * pc2 Դβ + * pc3 Դβʱ,ȫӴ,sourcesubȣ + *****************************************************/ + while(*pc2 == *pc3 && *pc3 != NULL && *pc2 != NULL) + pc2++, pc3++; + /* ҵӴ,´*/ + if(NULL == *pc3) + { + pc3 = rep; + /*׷ӵ*/ + while(*pc3 != NULL) + *pc1++ = *pc3++; + pc2--; + source = pc2; + /* sourcesubȵѭ + * pc2 Ӧλ sub дԴһλá + * source ָǰһַ + */ + } + else /*ûҵӴ,渴sourceָֽڵ*/ + *pc1++ = *source; + source++; /* sourceһַ*/ +} +*pc1 = NULL; +return result; +} + +int getHash ( char* s ) +{ + int i; + int h=0; + + for(i=0;; i++){ + if( s[i] == 0 ){ + break; + } + h += s[i]; + } + return h; +} + +//int RAND (int x,int y) +//{ +// srand((int)time(0)); +// return (x-1)+1+(int)( (double)(y-(x-1))*rand()/(RAND_MAX+1.0)); +//}
  • clienttoserver ACServerLogin(string servername,string serverpas);
    +91 : ءةӡʧӡ̼ +92 : ëؤ𼰷̼ëئͻӡ굩ëئУ +93 :

    +94 :
    +95 :
    string servername +96 :
    ӡ acserv.cfɬýľ£ +97 :
    string serverpas +98 :
    ӡɵacserv.cfɬýľ£ +99 :
    +100 : +*/ + +#ifdef _ALLDOMAN // (ɿ) Syu ADD аNPC +void saacproto_UpdataStele_send( int fd , char *cdkey , char *name , char *title , int level , int trns , int time , int floor) +{ + saacproto_CreateHeader( saacproto.work , "UpdataStele" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( cdkey ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( name ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( title ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( level ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( trns ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( time ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_int( floor ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} +#endif + +void saacproto_ACServerLogin_send( int fd,char* servername,char* serverpas ) +{ + saacproto_CreateHeader( saacproto.work , "ACServerLogin" ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( servername ) ,saacproto.workbufsize ); + saacproto_strcatsafe( saacproto.work , saacproto_mkstr_string( serverpas ) ,saacproto.workbufsize ); + saacproto_Send( fd , saacproto.work ); +} +/* +114 :
  • UdEX4!0B>Q=&{ACI%2a${X;$#u11!k!VX`c zrNN(tl~Cg}gT)4eQ66=r zX|7_{C=WUx(HQ&?%9Ch*5CnD|1PttTPsW!%)86fBm66piBP~oTqjy_OYjHXUe*;}y zG!dzXu~hD_LPCDdaj)Q%>~1Hg-zJbwt6Z@OlV1BxPkKt4UK?EdAUkYaEafQj6oeDQ ze2X0@JLJW%)d*y)UFNa^yXq;+`+ z*KwvQyu?>>3^s?MUn7ZQLGbRU(a$DFoF>7$&;C?KoSCRX{Rx1WSkQ~aufhRQwE8|@vwxHA_uElV2?0)hcE@d<97IQh)lVh z|HahQ6Qcl%@)W@*!;lwPRI|Z(Y;$&mHs}J__Rye2caW0m}Lf~6BX9v8qFc7>m z_+QO|)@*uZje2a@uIPDet3KGK9^1+v@Yr+(QM6dH{QS|!3rf{vWsT^DOZ0)X&N6twC1RQx+pV(Wu$j zX+6gvneQ40Cw+#Rt~{>?eojO{aPqtOUG~n~6hfyDGV`gdeVr%kD)w7{>H%Z!FoF6z8I{ zSD8lqZxsG#m#7WJ@s(=)%IY0s&XcuXI55oq2NhE(%EVA#pEBcHM}5T6^FuXkKOHEJ z*ZIP6@v9|m5OqOTap=EkL+O1Zm-A_U-ZZa(Jm?#@rMig=L6)JY&&S%5#rJlS@ZeAM z7}STHmne}|a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7}mR2Mr>IB{v-R1ijC^k zJELEWJ9P2COfLOP0E)$-qXR<)*G)B@!^$TYS7c5KGDe^Qp!x#FwS3i4JWyvkH_!8@ z_3kc!yNu~ft1GHh{;mwJCkOaFA;?1Omf`(`wHhwyCNTZ{-duG_ne%T)f8SUhXPT-# zHzsuQ!##soDxh2B*8t3Z_RpyP6t;xk9gN$)rFALFU7T>F5bUIw&Z%5e^7u#f>uL4}M}|Gwh#ml4b#^@2TPSK%3c^96_XAYF{oC^1fj z!CFu-XOIW;6Z(j|4Dxxmv#YQ2tFPAFp7oc@%m4jCIoDs!tFCe@PB4pcr-on%RESt`8_>;USqKm37Yp6w=bpR2ARpGtU*`+! G+y4))_za%_ literal 0 HcmV?d00001 diff --git a/mylua/lua/lua.c b/mylua/lua/lua.c new file mode 100644 index 0000000..c28c8c0 --- /dev/null +++ b/mylua/lua/lua.c @@ -0,0 +1,391 @@ +/* +** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua stand-alone interpreter +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lua_c + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static lua_State *globalL = NULL; + +static const char *progname = LUA_PROGNAME; + + + +static void lstop (lua_State *L, lua_Debug *ar) { + (void)ar; /* unused arg. */ + lua_sethook(L, NULL, 0, 0); + luaL_error(L, "interrupted!"); +} + + +static void laction (int i) { + signal(i, SIG_DFL); /* if another SIGINT happens before lstop, + terminate process (default action) */ + lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); +} + + +static void print_usage (void) { + fprintf(stderr, + "usage: %s [options] [script [args]].\n" + "Available options are:\n" + " -e stat execute string " LUA_QL("stat") "\n" + " -l name require library " LUA_QL("name") "\n" + " -i enter interactive mode after executing " LUA_QL("script") "\n" + " -v show version information\n" + " -- stop handling options\n" + " - execute stdin and stop handling options\n" + , + progname); + fflush(stderr); +} + + +static void l_message (const char *pname, const char *msg) { + if (pname) fprintf(stderr, "%s: ", pname); + fprintf(stderr, "%s\n", msg); + fflush(stderr); +} + + +static int report (lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + const char *msg = lua_tostring(L, -1); + if (msg == NULL) msg = "(error object is not a string)"; + l_message(progname, msg); + lua_pop(L, 1); + } + return status; +} + + +static int traceback (lua_State *L) { + if (!lua_isstring(L, 1)) /* 'message' not a string? */ + return 1; /* keep it intact */ + lua_getfield(L, LUA_GLOBALSINDEX, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); /* pass error message */ + lua_pushinteger(L, 2); /* skip this function and traceback */ + lua_call(L, 2, 1); /* call debug.traceback */ + return 1; +} + + +static int docall (lua_State *L, int narg, int clear) { + int status; + int base = lua_gettop(L) - narg; /* function index */ + lua_pushcfunction(L, traceback); /* push traceback function */ + lua_insert(L, base); /* put it under chunk and args */ + signal(SIGINT, laction); + status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); + signal(SIGINT, SIG_DFL); + lua_remove(L, base); /* remove traceback function */ + /* force a complete garbage collection in case of errors */ + if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); + return status; +} + + +static void print_version (void) { + l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); +} + + +static int getargs (lua_State *L, char **argv, int n) { + int narg; + int i; + int argc = 0; + while (argv[argc]) argc++; /* count total number of arguments */ + narg = argc - (n + 1); /* number of arguments to the script */ + luaL_checkstack(L, narg + 3, "too many arguments to script"); + for (i=n+1; i < argc; i++) + lua_pushstring(L, argv[i]); + lua_createtable(L, narg, n + 1); + for (i=0; i < argc; i++) { + lua_pushstring(L, argv[i]); + lua_rawseti(L, -2, i - n); + } + return narg; +} + + +static int dofile (lua_State *L, const char *name) { + int status = luaL_loadfile(L, name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dostring (lua_State *L, const char *s, const char *name) { + int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); + return report(L, status); +} + + +static int dolibrary (lua_State *L, const char *name) { + lua_getglobal(L, "require"); + lua_pushstring(L, name); + return report(L, docall(L, 1, 1)); +} + + +static const char *get_prompt (lua_State *L, int firstline) { + const char *p; + lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); + p = lua_tostring(L, -1); + if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); + lua_pop(L, 1); /* remove global */ + return p; +} + + +static int incomplete (lua_State *L, int status) { + if (status == LUA_ERRSYNTAX) { + size_t lmsg; + const char *msg = lua_tolstring(L, -1, &lmsg); + const char *tp = msg + lmsg - (sizeof(LUA_QL("")) - 1); + if (strstr(msg, LUA_QL("")) == tp) { + lua_pop(L, 1); + return 1; + } + } + return 0; /* else... */ +} + + +static int pushline (lua_State *L, int firstline) { + char buffer[LUA_MAXINPUT]; + char *b = buffer; + size_t l; + const char *prmt = get_prompt(L, firstline); + if (lua_readline(L, b, prmt) == 0) + return 0; /* no input */ + l = strlen(b); + if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ + b[l-1] = '\0'; /* remove it */ + if (firstline && b[0] == '=') /* first line starts with `=' ? */ + lua_pushfstring(L, "return %s", b+1); /* change it to `return' */ + else + lua_pushstring(L, b); + lua_freeline(L, b); + return 1; +} + + +static int loadline (lua_State *L) { + int status; + lua_settop(L, 0); + if (!pushline(L, 1)) + return -1; /* no input */ + for (;;) { /* repeat until gets a complete line */ + status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); + if (!incomplete(L, status)) break; /* cannot try to add lines? */ + if (!pushline(L, 0)) /* no more input? */ + return -1; + lua_pushliteral(L, "\n"); /* add a new line... */ + lua_insert(L, -2); /* ...between the two lines */ + lua_concat(L, 3); /* join them */ + } + lua_saveline(L, 1); + lua_remove(L, 1); /* remove line */ + return status; +} + + +static void dotty (lua_State *L) { + int status; + const char *oldprogname = progname; + progname = NULL; + while ((status = loadline(L)) != -1) { + if (status == 0) status = docall(L, 0, 0); + report(L, status); + if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ + lua_getglobal(L, "print"); + lua_insert(L, 1); + if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) + l_message(progname, lua_pushfstring(L, + "error calling " LUA_QL("print") " (%s)", + lua_tostring(L, -1))); + } + } + lua_settop(L, 0); /* clear stack */ + fputs("\n", stdout); + fflush(stdout); + progname = oldprogname; +} + + +static int handle_script (lua_State *L, char **argv, int n) { + int status; + const char *fname; + int narg = getargs(L, argv, n); /* collect arguments */ + lua_setglobal(L, "arg"); + fname = argv[n]; + if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) + fname = NULL; /* stdin */ + status = luaL_loadfile(L, fname); + lua_insert(L, -(narg+1)); + if (status == 0) + status = docall(L, narg, 0); + else + lua_pop(L, narg); + return report(L, status); +} + + +/* check that argument has no extra characters at the end */ +#define notail(x) {if ((x)[2] != '\0') return -1;} + + +static int collectargs (char **argv, int *pi, int *pv, int *pe) { + int i; + for (i = 1; argv[i] != NULL; i++) { + if (argv[i][0] != '-') /* not an option? */ + return i; + switch (argv[i][1]) { /* option */ + case '-': + notail(argv[i]); + return (argv[i+1] != NULL ? i+1 : 0); + case '\0': + return i; + case 'i': + notail(argv[i]); + *pi = 1; /* go through */ + case 'v': + notail(argv[i]); + *pv = 1; + break; + case 'e': + *pe = 1; /* go through */ + case 'l': + if (argv[i][2] == '\0') { + i++; + if (argv[i] == NULL) return -1; + } + break; + default: return -1; /* invalid option */ + } + } + return 0; +} + + +static int runargs (lua_State *L, char **argv, int n) { + int i; + for (i = 1; i < n; i++) { + if (argv[i] == NULL) continue; + lua_assert(argv[i][0] == '-'); + switch (argv[i][1]) { /* option */ + case 'e': { + const char *chunk = argv[i] + 2; + if (*chunk == '\0') chunk = argv[++i]; + lua_assert(chunk != NULL); + if (dostring(L, chunk, "=(command line)") != 0) + return 1; + break; + } + case 'l': { + const char *filename = argv[i] + 2; + if (*filename == '\0') filename = argv[++i]; + lua_assert(filename != NULL); + if (dolibrary(L, filename)) + return 1; /* stop if file fails */ + break; + } + default: break; + } + } + return 0; +} + + +static int handle_luainit (lua_State *L) { + const char *init = getenv(LUA_INIT); + if (init == NULL) return 0; /* status OK */ + else if (init[0] == '@') + return dofile(L, init+1); + else + return dostring(L, init, "=" LUA_INIT); +} + + +struct Smain { + int argc; + char **argv; + int status; +}; + + +static int pmain (lua_State *L) { + struct Smain *s = (struct Smain *)lua_touserdata(L, 1); + char **argv = s->argv; + int script; + int has_i = 0, has_v = 0, has_e = 0; + globalL = L; + if (argv[0] && argv[0][0]) progname = argv[0]; + lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ + luaL_openlibs(L); /* open libraries */ + lua_gc(L, LUA_GCRESTART, 0); + s->status = handle_luainit(L); + if (s->status != 0) return 0; + script = collectargs(argv, &has_i, &has_v, &has_e); + if (script < 0) { /* invalid args? */ + print_usage(); + s->status = 1; + return 0; + } + if (has_v) print_version(); + s->status = runargs(L, argv, (script > 0) ? script : s->argc); + if (s->status != 0) return 0; + if (script) + s->status = handle_script(L, argv, script); + if (s->status != 0) return 0; + if (has_i) + dotty(L); + else if (script == 0 && !has_e && !has_v) { + if (lua_stdin_is_tty()) { + print_version(); + dotty(L); + } + else dofile(L, NULL); /* executes stdin as a file */ + } + return 0; +} + +int main (int argc, char **argv) { + int status; + struct Smain s; + lua_State *L = lua_open(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); + return EXIT_FAILURE; + } + s.argc = argc; + s.argv = argv; + status = lua_cpcall(L, &pmain, &s); + report(L, status); + lua_close(L); + return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; +} + diff --git a/mylua/lua/lua.h b/mylua/lua/lua.h new file mode 100644 index 0000000..e4bdfd3 --- /dev/null +++ b/mylua/lua/lua.h @@ -0,0 +1,388 @@ +/* +** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*/ + + +#ifndef lua_h +#define lua_h + +#include +#include + + +#include "luaconf.h" + + +#define LUA_VERSION "Lua 5.1" +#define LUA_RELEASE "Lua 5.1.4" +#define LUA_VERSION_NUM 501 +#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio" +#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes" + + +/* mark for precompiled code (`Lua') */ +#define LUA_SIGNATURE "\033Lua" + +/* option for multiple returns in `lua_pcall' and `lua_call' */ +#define LUA_MULTRET (-1) + + +/* +** pseudo-indices +*/ +#define LUA_REGISTRYINDEX (-10000) +#define LUA_ENVIRONINDEX (-10001) +#define LUA_GLOBALSINDEX (-10002) +#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i)) + + +/* thread status; 0 is OK */ +#define LUA_YIELD 1 +#define LUA_ERRRUN 2 +#define LUA_ERRSYNTAX 3 +#define LUA_ERRMEM 4 +#define LUA_ERRERR 5 + + +typedef struct lua_State lua_State; + +typedef int (*lua_CFunction) (lua_State *L); + + +/* +** functions that read/write blocks when loading/dumping Lua chunks +*/ +typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); + +typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud); + + +/* +** prototype for memory-allocation functions +*/ +typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); + + +/* +** basic types +*/ +#define LUA_TNONE (-1) + +#define LUA_TNIL 0 +#define LUA_TBOOLEAN 1 +#define LUA_TLIGHTUSERDATA 2 +#define LUA_TNUMBER 3 +#define LUA_TSTRING 4 +#define LUA_TTABLE 5 +#define LUA_TFUNCTION 6 +#define LUA_TUSERDATA 7 +#define LUA_TTHREAD 8 + + + +/* minimum Lua stack available to a C function */ +#define LUA_MINSTACK 20 + + +/* +** generic extra include file +*/ +#if defined(LUA_USER_H) +#include LUA_USER_H +#endif + + +/* type of numbers in Lua */ +typedef LUA_NUMBER lua_Number; + + +/* type for integer functions */ +typedef LUA_INTEGER lua_Integer; + + + +/* +** state manipulation +*/ +LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); +LUA_API void (lua_close) (lua_State *L); +LUA_API lua_State *(lua_newthread) (lua_State *L); + +LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); + + +/* +** basic stack manipulation +*/ +LUA_API int (lua_gettop) (lua_State *L); +LUA_API void (lua_settop) (lua_State *L, int idx); +LUA_API void (lua_pushvalue) (lua_State *L, int idx); +LUA_API void (lua_remove) (lua_State *L, int idx); +LUA_API void (lua_insert) (lua_State *L, int idx); +LUA_API void (lua_replace) (lua_State *L, int idx); +LUA_API int (lua_checkstack) (lua_State *L, int sz); + +LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); + + +/* +** access functions (stack -> C) +*/ + +LUA_API int (lua_isnumber) (lua_State *L, int idx); +LUA_API int (lua_isstring) (lua_State *L, int idx); +LUA_API int (lua_iscfunction) (lua_State *L, int idx); +LUA_API int (lua_isuserdata) (lua_State *L, int idx); +LUA_API int (lua_type) (lua_State *L, int idx); +LUA_API const char *(lua_typename) (lua_State *L, int tp); + +LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); +LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); + +LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); +LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); +LUA_API int (lua_toboolean) (lua_State *L, int idx); +LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); +LUA_API size_t (lua_objlen) (lua_State *L, int idx); +LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); +LUA_API void *(lua_touserdata) (lua_State *L, int idx); +LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); +LUA_API const void *(lua_topointer) (lua_State *L, int idx); + + +/* +** push functions (C -> stack) +*/ +LUA_API void (lua_pushnil) (lua_State *L); +LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); +LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); +LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l); +LUA_API void (lua_pushstring) (lua_State *L, const char *s); +LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, + va_list argp); +LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); +LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); +LUA_API void (lua_pushboolean) (lua_State *L, int b); +LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); +LUA_API int (lua_pushthread) (lua_State *L); + + +/* +** get functions (Lua -> stack) +*/ +LUA_API void (lua_gettable) (lua_State *L, int idx); +LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawget) (lua_State *L, int idx); +LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); +LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); +LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); +LUA_API int (lua_getmetatable) (lua_State *L, int objindex); +LUA_API void (lua_getfenv) (lua_State *L, int idx); + + +/* +** set functions (stack -> Lua) +*/ +LUA_API void (lua_settable) (lua_State *L, int idx); +LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); +LUA_API void (lua_rawset) (lua_State *L, int idx); +LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); +LUA_API int (lua_setmetatable) (lua_State *L, int objindex); +LUA_API int (lua_setfenv) (lua_State *L, int idx); + + +/* +** `load' and `call' functions (load and run Lua code) +*/ +LUA_API void (lua_call) (lua_State *L, int nargs, int nresults); +LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud); +LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, + const char *chunkname); + +LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data); + + +/* +** coroutine functions +*/ +LUA_API int (lua_yield) (lua_State *L, int nresults); +LUA_API int (lua_resume) (lua_State *L, int narg); +LUA_API int (lua_status) (lua_State *L); + +/* +** garbage-collection function and options +*/ + +#define LUA_GCSTOP 0 +#define LUA_GCRESTART 1 +#define LUA_GCCOLLECT 2 +#define LUA_GCCOUNT 3 +#define LUA_GCCOUNTB 4 +#define LUA_GCSTEP 5 +#define LUA_GCSETPAUSE 6 +#define LUA_GCSETSTEPMUL 7 + +LUA_API int (lua_gc) (lua_State *L, int what, int data); + + +/* +** miscellaneous functions +*/ + +LUA_API int (lua_error) (lua_State *L); + +LUA_API int (lua_next) (lua_State *L, int idx); + +LUA_API void (lua_concat) (lua_State *L, int n); + +LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define lua_pop(L,n) lua_settop(L, -(n)-1) + +#define lua_newtable(L) lua_createtable(L, 0, 0) + +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) + +#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) + +#define lua_strlen(L,i) lua_objlen(L, (i)) + +#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) +#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) +#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) +#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) +#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) +#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) +#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) +#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) + +#define lua_pushliteral(L, s) \ + lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1) + +#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s)) +#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s)) + +#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) + + + +/* +** compatibility macros and functions +*/ + +#define lua_open() luaL_newstate() + +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) + +#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) + +#define lua_Chunkreader lua_Reader +#define lua_Chunkwriter lua_Writer + + +/* hack */ +LUA_API void lua_setlevel (lua_State *from, lua_State *to); + + +/* +** {====================================================================== +** Debug API +** ======================================================================= +*/ + + +/* +** Event codes +*/ +#define LUA_HOOKCALL 0 +#define LUA_HOOKRET 1 +#define LUA_HOOKLINE 2 +#define LUA_HOOKCOUNT 3 +#define LUA_HOOKTAILRET 4 + + +/* +** Event masks +*/ +#define LUA_MASKCALL (1 << LUA_HOOKCALL) +#define LUA_MASKRET (1 << LUA_HOOKRET) +#define LUA_MASKLINE (1 << LUA_HOOKLINE) +#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) + +typedef struct lua_Debug lua_Debug; /* activation record */ + + +/* Functions to be called by the debuger in specific events */ +typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n); +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n); + +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count); +LUA_API lua_Hook lua_gethook (lua_State *L); +LUA_API int lua_gethookmask (lua_State *L); +LUA_API int lua_gethookcount (lua_State *L); + + +struct lua_Debug { + int event; + const char *name; /* (n) */ + const char *namewhat; /* (n) `global', `local', `field', `method' */ + const char *what; /* (S) `Lua', `C', `main', `tail' */ + const char *source; /* (S) */ + int currentline; /* (l) */ + int nups; /* (u) number of upvalues */ + int linedefined; /* (S) */ + int lastlinedefined; /* (S) */ + char short_src[LUA_IDSIZE]; /* (S) */ + /* private part */ + int i_ci; /* active function */ +}; + +/* }====================================================================== */ + + +/****************************************************************************** +* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************/ + + +#endif diff --git a/mylua/lua/luac b/mylua/lua/luac new file mode 100644 index 0000000000000000000000000000000000000000..7f204e8ef35df0979255474577625a9202ac7a98 GIT binary patch literal 577400 zcmce934B!5+4m%wBo`dLql^+Ywb5cr3bsU}G9}b(lLSIwl8^~o2v)%nQ8AezYzYaI zQ7(rIv6a?Z*H_#6cCpn~iq<6oOF*px@@W(oRJ3;-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