// Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder #include #include #include #include #include #include "../common/socket.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/mmo.h" #include "../common/core.h" #include "../common/showmsg.h" #include "log.h" #include "clif.h" #include "chrif.h" #include "intif.h" #include "itemdb.h" #include "map.h" #include "pc.h" #include "status.h" #include "skill.h" #include "mob.h" #include "pet.h" #include "battle.h" #include "party.h" #include "guild.h" #include "atcommand.h" #include "script.h" #include "npc.h" #include "trade.h" #ifndef TXT_ONLY #include "mail.h" #endif static char command_symbol = '@'; // first char of the commands (by [Yor]) char *msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) #define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) ACMD_FUNC(broadcast); ACMD_FUNC(localbroadcast); ACMD_FUNC(rura); ACMD_FUNC(where); ACMD_FUNC(jumpto); ACMD_FUNC(jump); ACMD_FUNC(who); ACMD_FUNC(who2); ACMD_FUNC(who3); ACMD_FUNC(whomap); ACMD_FUNC(whomap2); ACMD_FUNC(whomap3); ACMD_FUNC(whogm); // by Yor ACMD_FUNC(whozeny); // [Valaris] ACMD_FUNC(happyhappyjoyjoy); // [Valaris] ACMD_FUNC(save); ACMD_FUNC(load); ACMD_FUNC(speed); ACMD_FUNC(storage); ACMD_FUNC(guildstorage); ACMD_FUNC(option); ACMD_FUNC(hide); ACMD_FUNC(jobchange); ACMD_FUNC(die); ACMD_FUNC(kill); ACMD_FUNC(alive); ACMD_FUNC(kami); ACMD_FUNC(heal); ACMD_FUNC(item); ACMD_FUNC(item2); ACMD_FUNC(itemreset); ACMD_FUNC(itemcheck); ACMD_FUNC(baselevelup); ACMD_FUNC(joblevelup); ACMD_FUNC(help); ACMD_FUNC(help2); ACMD_FUNC(gm); ACMD_FUNC(pvpoff); ACMD_FUNC(pvpon); ACMD_FUNC(gvgoff); ACMD_FUNC(gvgon); ACMD_FUNC(model); ACMD_FUNC(go); ACMD_FUNC(monster); ACMD_FUNC(monstersmall); ACMD_FUNC(monsterbig); ACMD_FUNC(spawn); ACMD_FUNC(killmonster); ACMD_FUNC(killmonster2); ACMD_FUNC(refine); ACMD_FUNC(produce); ACMD_FUNC(memo); ACMD_FUNC(gat); ACMD_FUNC(packet); ACMD_FUNC(waterlevel); ACMD_FUNC(statuspoint); ACMD_FUNC(skillpoint); ACMD_FUNC(zeny); ACMD_FUNC(param); ACMD_FUNC(guildlevelup); ACMD_FUNC(makeegg); ACMD_FUNC(hatch); ACMD_FUNC(petfriendly); ACMD_FUNC(pethungry); ACMD_FUNC(petrename); ACMD_FUNC(recall); ACMD_FUNC(recallall); ACMD_FUNC(revive); ACMD_FUNC(night); ACMD_FUNC(day); ACMD_FUNC(doom); ACMD_FUNC(doommap); ACMD_FUNC(raise); ACMD_FUNC(raisemap); ACMD_FUNC(kick); ACMD_FUNC(kickall); ACMD_FUNC(allskill); ACMD_FUNC(questskill); ACMD_FUNC(lostskill); ACMD_FUNC(spiritball); ACMD_FUNC(party); ACMD_FUNC(guild); ACMD_FUNC(agitstart); ACMD_FUNC(agitend); ACMD_FUNC(reloaditemdb); ACMD_FUNC(reloadmobdb); ACMD_FUNC(reloadskilldb); ACMD_FUNC(reloadscript); ACMD_FUNC(reloadgmdb); // by Yor ACMD_FUNC(reloadatcommand); ACMD_FUNC(reloadbattleconf); ACMD_FUNC(reloadstatusdb); ACMD_FUNC(reloadpcdb); ACMD_FUNC(reloadmotd); // [Valaris] ACMD_FUNC(mapexit); ACMD_FUNC(idsearch); ACMD_FUNC(mapinfo); ACMD_FUNC(dye); //** by fritz ACMD_FUNC(hair_style); //** by fritz ACMD_FUNC(hair_color); //** by fritz ACMD_FUNC(stat_all); //** by fritz ACMD_FUNC(char_block); // by Yor ACMD_FUNC(char_ban); // by Yor ACMD_FUNC(char_unblock); // by Yor ACMD_FUNC(char_unban); // by Yor ACMD_FUNC(mount_peco); // by Valaris ACMD_FUNC(char_mount_peco); // by Yor ACMD_FUNC(guildspy); // [Syrus22] ACMD_FUNC(partyspy); // [Syrus22] ACMD_FUNC(repairall); // [Valaris] ACMD_FUNC(guildrecall); // by Yor ACMD_FUNC(partyrecall); // by Yor ACMD_FUNC(nuke); // [Valaris] ACMD_FUNC(shownpc); ACMD_FUNC(hidenpc); ACMD_FUNC(loadnpc); ACMD_FUNC(unloadnpc); ACMD_FUNC(servertime); // by Yor ACMD_FUNC(chardelitem); // by Yor ACMD_FUNC(jail); // by Yor ACMD_FUNC(unjail); // by Yor ACMD_FUNC(disguise); // [Valaris] ACMD_FUNC(undisguise); // by Yor ACMD_FUNC(chardisguise); // Kalaspuff ACMD_FUNC(charundisguise); // Kalaspuff ACMD_FUNC(email); // by Yor ACMD_FUNC(effect);//by Apple ACMD_FUNC(character_cart_list); // by Yor ACMD_FUNC(addwarp); // by MouseJstr ACMD_FUNC(follow); // by MouseJstr ACMD_FUNC(skillon); // by MouseJstr ACMD_FUNC(skilloff); // by MouseJstr ACMD_FUNC(killer); // by MouseJstr ACMD_FUNC(npcmove); // by MouseJstr ACMD_FUNC(killable); // by MouseJstr ACMD_FUNC(charkillable); // by MouseJstr ACMD_FUNC(dropall); // by MouseJstr ACMD_FUNC(chardropall); // by MouseJstr ACMD_FUNC(storeall); // by MouseJstr ACMD_FUNC(charstoreall); // by MouseJstr ACMD_FUNC(skillid); // by MouseJstr ACMD_FUNC(useskill); // by MouseJstr ACMD_FUNC(summon); ACMD_FUNC(rain); ACMD_FUNC(snow); ACMD_FUNC(sakura); ACMD_FUNC(clouds); ACMD_FUNC(clouds2); // [Valaris] ACMD_FUNC(fog); ACMD_FUNC(fireworks); ACMD_FUNC(leaves); ACMD_FUNC(adjgmlvl); // by MouseJstr ACMD_FUNC(adjcmdlvl); // by MouseJstr ACMD_FUNC(trade); // by MouseJstr ACMD_FUNC(send); // by davidsiaw ACMD_FUNC(setbattleflag); // by MouseJstr ACMD_FUNC(unmute); // [Valaris] ACMD_FUNC(clearweather); // Dexity ACMD_FUNC(uptime); // by MC Cameri ACMD_FUNC(changesex); // by MC Cameri ACMD_FUNC(mute); // celest ACMD_FUNC(refresh); // by MC Cameri ACMD_FUNC(petid); // by MC Cameri ACMD_FUNC(identify); // by MC Cameri ACMD_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw ACMD_FUNC(misceffect); // by MC Cameri ACMD_FUNC(mobsearch); ACMD_FUNC(cleanmap); ACMD_FUNC(npctalk); ACMD_FUNC(pettalk); ACMD_FUNC(users); ACMD_FUNC(autoloot); // Improved version imported from Freya. #ifndef TXT_ONLY ACMD_FUNC(checkmail); // [Valaris] ACMD_FUNC(listmail); // [Valaris] ACMD_FUNC(listnewmail); // [Valaris] ACMD_FUNC(readmail); // [Valaris] ACMD_FUNC(sendmail); // [Valaris] ACMD_FUNC(sendprioritymail); // [Valaris] ACMD_FUNC(deletemail); // [Valaris] ACMD_FUNC(refreshonline); // [Valaris] #endif /* TXT_ONLY */ ACMD_FUNC(skilltree); // by MouseJstr ACMD_FUNC(marry); // by MouseJstr ACMD_FUNC(divorce); // by MouseJstr ACMD_FUNC(grind); // by MouseJstr ACMD_FUNC(grind2); // by MouseJstr #ifdef DMALLOC ACMD_FUNC(dmstart); // by MouseJstr ACMD_FUNC(dmtick); // by MouseJstr #endif ACMD_FUNC(jumptoid); // by Dino9021 ACMD_FUNC(jumptoid2); // by Dino9021 ACMD_FUNC(recallid); // by Dino9021 ACMD_FUNC(recallid2); // by Dino9021 ACMD_FUNC(kickid); // by Dino9021 ACMD_FUNC(kickid2); // by Dino9021 ACMD_FUNC(reviveid); // by Dino9021 ACMD_FUNC(reviveid2); // by Dino9021 ACMD_FUNC(killid); // by Dino9021 ACMD_FUNC(killid2); // by Dino9021 ACMD_FUNC(charkillableid); // by Dino9021 ACMD_FUNC(charkillableid2); // by Dino9021 ACMD_FUNC(sound); ACMD_FUNC(undisguiseall); ACMD_FUNC(disguiseall); ACMD_FUNC(changelook); ACMD_FUNC(mobinfo); //by Lupus ACMD_FUNC(adopt); // by Veider ACMD_FUNC(version); // by Ancyker ACMD_FUNC(mutearea); // by MouseJstr ACMD_FUNC(shuffle); // by MouseJstr ACMD_FUNC(rates); // by MouseJstr ACMD_FUNC(iteminfo); // Lupus ACMD_FUNC(mapflag); // Lupus ACMD_FUNC(me); //added by massdriller, code by lordalfa ACMD_FUNC(monsterignore); // [Valaris] ACMD_FUNC(fakename); //[Valaris] ACMD_FUNC(size); //[Valaris] ACMD_FUNC(showexp); //moved from charcommand [Kevin] ACMD_FUNC(showzeny); ACMD_FUNC(showdelay); //moved from charcommand [Kevin] ACMD_FUNC(autotrade);// durf ACMD_FUNC(changeleader);// [Skotlex] ACMD_FUNC(changegm);// durf // Duel [LuzZza] ACMD_FUNC(invite); ACMD_FUNC(duel); ACMD_FUNC(leave); ACMD_FUNC(accept); ACMD_FUNC(reject); ACMD_FUNC(away); // LuzZza ACMD_FUNC(main); // LuzZza ACMD_FUNC(clone); // [Valaris] /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 *------------------------------------------ */ // First char of commands is configured in atcommand_athena.conf. Leave @ in this list for default value. // to set default level, read atcommand_athena.conf first please. static AtCommandInfo atcommand_info[] = { { AtCommand_Rura, "@rura", 40, atcommand_rura }, { AtCommand_Warp, "@warp", 40, atcommand_rura }, { AtCommand_Where, "@where", 1, atcommand_where }, { AtCommand_JumpTo, "@jumpto", 20, atcommand_jumpto }, // + /shift { AtCommand_JumpTo, "@warpto", 20, atcommand_jumpto }, { AtCommand_JumpTo, "@goto", 20, atcommand_jumpto }, { AtCommand_Jump, "@jump", 40, atcommand_jump }, { AtCommand_Who, "@who", 20, atcommand_who }, { AtCommand_Who, "@whois", 20, atcommand_who }, { AtCommand_Who, "@w", 20, atcommand_who }, { AtCommand_Who2, "@who2", 20, atcommand_who2 }, { AtCommand_Who3, "@who3", 20, atcommand_who3 }, { AtCommand_WhoMap, "@whomap", 20, atcommand_whomap }, { AtCommand_WhoMap2, "@whomap2", 20, atcommand_whomap2 }, { AtCommand_WhoMap3, "@whomap3", 20, atcommand_whomap3 }, { AtCommand_WhoGM, "@whogm", 20, atcommand_whogm }, // by Yor { AtCommand_Save, "@save", 40, atcommand_save }, { AtCommand_Load, "@return", 40, atcommand_load }, { AtCommand_Load, "@load", 40, atcommand_load }, { AtCommand_Speed, "@speed", 40, atcommand_speed }, { AtCommand_Storage, "@storage", 1, atcommand_storage }, { AtCommand_GuildStorage, "@gstorage", 50, atcommand_guildstorage }, { AtCommand_Option, "@option", 40, atcommand_option }, { AtCommand_Hide, "@hide", 40, atcommand_hide }, // + /hide { AtCommand_JobChange, "@jobchange", 40, atcommand_jobchange }, { AtCommand_JobChange, "@job", 40, atcommand_jobchange }, { AtCommand_Die, "@die", 1, atcommand_die }, { AtCommand_Kill, "@kill", 60, atcommand_kill }, { AtCommand_Alive, "@alive", 60, atcommand_alive }, { AtCommand_Kami, "@kami", 40, atcommand_kami }, { AtCommand_KamiB, "@kamib", 40, atcommand_kami }, { AtCommand_KamiC, "@kamic", 40, atcommand_kami }, //[LuzZza] { AtCommand_Heal, "@heal", 40, atcommand_heal }, { AtCommand_Item, "@item", 60, atcommand_item }, { AtCommand_Item2, "@item2", 60, atcommand_item2 }, { AtCommand_ItemReset, "@itemreset", 40, atcommand_itemreset }, { AtCommand_ItemCheck, "@itemcheck", 60, atcommand_itemcheck }, { AtCommand_BaseLevelUp, "@lvup", 60, atcommand_baselevelup }, { AtCommand_BaseLevelUp, "@blevel", 60, atcommand_baselevelup }, { AtCommand_BaseLevelUp, "@baselvlup", 60, atcommand_baselevelup }, { AtCommand_JobLevelUp, "@jlevel", 60, atcommand_joblevelup }, { AtCommand_JobLevelUp, "@joblvup", 60, atcommand_joblevelup }, { AtCommand_JobLevelUp, "@joblvlup", 60, atcommand_joblevelup }, { AtCommand_H, "@h", 20, atcommand_help }, { AtCommand_Help, "@help", 20, atcommand_help }, { AtCommand_H2, "@h2", 20, atcommand_help2 }, { AtCommand_Help2, "@help2", 20, atcommand_help2 }, { AtCommand_GM, "@gm", 100,atcommand_gm }, { AtCommand_PvPOff, "@pvpoff", 40, atcommand_pvpoff }, { AtCommand_PvPOn, "@pvpon", 40, atcommand_pvpon }, { AtCommand_GvGOff, "@gvgoff", 40, atcommand_gvgoff }, { AtCommand_GvGOff, "@gpvpoff", 40, atcommand_gvgoff }, { AtCommand_GvGOn, "@gvgon", 40, atcommand_gvgon }, { AtCommand_GvGOn, "@gpvpon", 40, atcommand_gvgon }, { AtCommand_Model, "@model", 20, atcommand_model }, { AtCommand_Go, "@go", 10, atcommand_go }, { AtCommand_Spawn, "@monster", 50, atcommand_monster }, { AtCommand_Spawn, "@spawn", 50, atcommand_monster }, { AtCommand_MonsterSmall, "@monstersmall", 50, atcommand_monstersmall }, { AtCommand_MonsterBig, "@monsterbig", 50, atcommand_monsterbig }, { AtCommand_KillMonster, "@killmonster", 60, atcommand_killmonster }, { AtCommand_KillMonster2, "@killmonster2", 40, atcommand_killmonster2 }, { AtCommand_Refine, "@refine", 60, atcommand_refine }, { AtCommand_Produce, "@produce", 60, atcommand_produce }, { AtCommand_Memo, "@memo", 40, atcommand_memo }, { AtCommand_GAT, "@gat", 99, atcommand_gat }, // debug function { AtCommand_Packet, "@packet", 99, atcommand_packet }, // debug function { AtCommand_Packet, "@packetmode", 99, atcommand_packet }, // debug function { AtCommand_WaterLevel, "@waterlevel", 99, atcommand_waterlevel }, // debug function { AtCommand_StatusPoint, "@stpoint", 60, atcommand_statuspoint }, { AtCommand_SkillPoint, "@skpoint", 60, atcommand_skillpoint }, { AtCommand_Zeny, "@zeny", 60, atcommand_zeny }, { AtCommand_Strength, "@str", 60, atcommand_param }, { AtCommand_Agility, "@agi", 60, atcommand_param }, { AtCommand_Vitality, "@vit", 60, atcommand_param }, { AtCommand_Intelligence, "@int", 60, atcommand_param }, { AtCommand_Dexterity, "@dex", 60, atcommand_param }, { AtCommand_Luck, "@luk", 60, atcommand_param }, { AtCommand_GuildLevelUp, "@guildlvup", 60, atcommand_guildlevelup }, { AtCommand_GuildLevelUp, "@guildlvlup", 60, atcommand_guildlevelup }, { AtCommand_MakeEgg, "@makeegg", 60, atcommand_makeegg }, { AtCommand_Hatch, "@hatch", 60, atcommand_hatch }, { AtCommand_PetFriendly, "@petfriendly", 40, atcommand_petfriendly }, { AtCommand_PetHungry, "@pethungry", 40, atcommand_pethungry }, { AtCommand_PetRename, "@petrename", 1, atcommand_petrename }, { AtCommand_Recall, "@recall", 60, atcommand_recall }, // + /recall { AtCommand_Revive, "@revive", 60, atcommand_revive }, { AtCommand_Night, "@night", 80, atcommand_night }, { AtCommand_Day, "@day", 80, atcommand_day }, { AtCommand_Doom, "@doom", 80, atcommand_doom }, { AtCommand_DoomMap, "@doommap", 80, atcommand_doommap }, { AtCommand_Raise, "@raise", 80, atcommand_raise }, { AtCommand_RaiseMap, "@raisemap", 80, atcommand_raisemap }, { AtCommand_Kick, "@kick", 20, atcommand_kick }, // + right click menu for GM "(name) force to quit" { AtCommand_KickAll, "@kickall", 99, atcommand_kickall }, { AtCommand_AllSkill, "@allskill", 60, atcommand_allskill }, { AtCommand_AllSkill, "@allskills", 60, atcommand_allskill }, { AtCommand_AllSkill, "@skillall", 60, atcommand_allskill }, { AtCommand_AllSkill, "@skillsall", 60, atcommand_allskill }, { AtCommand_QuestSkill, "@questskill", 40, atcommand_questskill }, { AtCommand_LostSkill, "@lostskill", 40, atcommand_lostskill }, { AtCommand_SpiritBall, "@spiritball", 40, atcommand_spiritball }, { AtCommand_Party, "@party", 1, atcommand_party }, { AtCommand_Guild, "@guild", 50, atcommand_guild }, { AtCommand_AgitStart, "@agitstart", 60, atcommand_agitstart }, { AtCommand_AgitEnd, "@agitend", 60, atcommand_agitend }, { AtCommand_MapExit, "@mapexit", 99, atcommand_mapexit }, { AtCommand_IDSearch, "@idsearch", 60, atcommand_idsearch }, { AtCommand_MapMove, "@mapmove", 40, atcommand_rura }, // /mm command { AtCommand_Broadcast, "@broadcast", 40, atcommand_broadcast }, // /b and /nb command { AtCommand_LocalBroadcast, "@localbroadcast", 40, atcommand_localbroadcast }, // /lb and /nlb command { AtCommand_RecallAll, "@recallall", 80, atcommand_recallall }, { AtCommand_ReloadItemDB, "@reloaditemdb", 99, atcommand_reloaditemdb }, // admin command { AtCommand_ReloadMobDB, "@reloadmobdb", 99, atcommand_reloadmobdb }, // admin command { AtCommand_ReloadSkillDB, "@reloadskilldb", 99, atcommand_reloadskilldb }, // admin command { AtCommand_ReloadScript, "@reloadscript", 99, atcommand_reloadscript }, // admin command { AtCommand_ReloadGMDB, "@reloadgmdb", 99, atcommand_reloadgmdb }, // admin command { AtCommand_ReloadAtcommand, "@reloadatcommand", 99, atcommand_reloadatcommand }, { AtCommand_ReloadBattleConf, "@reloadbattleconf", 99, atcommand_reloadbattleconf }, { AtCommand_ReloadStatusDB, "@reloadstatusdb", 99, atcommand_reloadstatusdb }, { AtCommand_ReloadPcDB, "@reloadpcdb", 99, atcommand_reloadpcdb }, { AtCommand_ReloadMOTD, "@reloadmotd", 99, atcommand_reloadmotd }, // [Valaris] { AtCommand_MapInfo, "@mapinfo", 99, atcommand_mapinfo }, { AtCommand_Dye, "@dye", 40, atcommand_dye }, // by fritz { AtCommand_Dye, "@ccolor", 40, atcommand_dye }, // by fritz { AtCommand_Hstyle, "@hairstyle", 40, atcommand_hair_style }, // by fritz { AtCommand_Hstyle, "@hstyle", 40, atcommand_hair_style }, // by fritz { AtCommand_Hcolor, "@haircolor", 40, atcommand_hair_color }, // by fritz { AtCommand_Hcolor, "@hcolor", 40, atcommand_hair_color }, // by fritz { AtCommand_StatAll, "@statall", 60, atcommand_stat_all }, // by fritz { AtCommand_StatAll, "@statsall", 60, atcommand_stat_all }, { AtCommand_StatAll, "@allstats", 60, atcommand_stat_all }, // by fritz { AtCommand_StatAll, "@allstat", 60, atcommand_stat_all }, // by fritz { AtCommand_CharBlock, "@block", 60, atcommand_char_block }, // by Yor { AtCommand_CharBlock, "@charblock", 60, atcommand_char_block }, // by Yor { AtCommand_CharBan, "@ban", 60, atcommand_char_ban }, // by Yor { AtCommand_CharBan, "@banish", 60, atcommand_char_ban }, // by Yor { AtCommand_CharBan, "@charban", 60, atcommand_char_ban }, // by Yor { AtCommand_CharBan, "@charbanish", 60, atcommand_char_ban }, // by Yor { AtCommand_CharUnBlock, "@unblock", 60, atcommand_char_unblock }, // by Yor { AtCommand_CharUnBlock, "@charunblock", 60, atcommand_char_unblock }, // by Yor { AtCommand_CharUnBan, "@unban", 60, atcommand_char_unban }, // by Yor { AtCommand_CharUnBan, "@unbanish", 60, atcommand_char_unban }, // by Yor { AtCommand_CharUnBan, "@charunban", 60, atcommand_char_unban }, // by Yor { AtCommand_CharUnBan, "@charunbanish", 60, atcommand_char_unban }, // by Yor { AtCommand_MountPeco, "@mountpeco", 20, atcommand_mount_peco }, // by Valaris { AtCommand_CharMountPeco, "@charmountpeco", 50, atcommand_char_mount_peco }, // by Yor { AtCommand_GuildSpy, "@guildspy", 60, atcommand_guildspy }, // [Syrus22] { AtCommand_PartySpy, "@partyspy", 60, atcommand_partyspy }, // [Syrus22] { AtCommand_RepairAll, "@repairall", 60, atcommand_repairall }, // [Valaris] { AtCommand_GuildRecall, "@guildrecall", 60, atcommand_guildrecall }, // by Yor { AtCommand_PartyRecall, "@partyrecall", 60, atcommand_partyrecall }, // by Yor { AtCommand_Nuke, "@nuke", 60, atcommand_nuke }, // [Valaris] { AtCommand_Shownpc, "@shownpc", 80, atcommand_shownpc }, // [] { AtCommand_Hidenpc, "@hidenpc", 80, atcommand_hidenpc }, // [] { AtCommand_Loadnpc, "@loadnpc", 80, atcommand_loadnpc }, // [] { AtCommand_Unloadnpc, "@unloadnpc", 80, atcommand_unloadnpc }, // [] { AtCommand_ServerTime, "@time", 1, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@date", 1, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@server_date", 1, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@serverdate", 1, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@server_time", 1, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@servertime", 1, atcommand_servertime }, // by Yor { AtCommand_CharDelItem, "@chardelitem", 60, atcommand_chardelitem }, // by Yor { AtCommand_Jail, "@jail", 60, atcommand_jail }, // by Yor { AtCommand_UnJail, "@unjail", 60, atcommand_unjail }, // by Yor { AtCommand_UnJail, "@discharge", 60, atcommand_unjail }, // by Yor { AtCommand_Disguise, "@disguise", 20, atcommand_disguise }, // [Valaris] { AtCommand_UnDisguise, "@undisguise", 20, atcommand_undisguise }, // by Yor { AtCommand_CharDisguise, "@chardisguise", 60, atcommand_chardisguise }, // Kalaspuff { AtCommand_CharUnDisguise, "@charundisguise", 60, atcommand_charundisguise }, // Kalaspuff { AtCommand_EMail, "@email", 1, atcommand_email }, // by Yor { AtCommand_Effect, "@effect", 40, atcommand_effect }, // by Apple { AtCommand_Char_Cart_List, "@charcartlist", 40, atcommand_character_cart_list }, // by Yor { AtCommand_Follow, "@follow", 20, atcommand_follow }, // by MouseJstr { AtCommand_AddWarp, "@addwarp", 60, atcommand_addwarp }, // by MouseJstr { AtCommand_SkillOn, "@skillon", 80, atcommand_skillon }, // by MouseJstr { AtCommand_SkillOff, "@skilloff", 80, atcommand_skilloff }, // by MouseJstr { AtCommand_Killer, "@killer", 60, atcommand_killer }, // by MouseJstr { AtCommand_NpcMove, "@npcmove", 20, atcommand_npcmove }, // by MouseJstr { AtCommand_Killable, "@killable", 40, atcommand_killable }, // by MouseJstr { AtCommand_CharKillable, "@charkillable", 40, atcommand_charkillable }, // by MouseJstr { AtCommand_Dropall, "@dropall", 40, atcommand_dropall }, // MouseJstr { AtCommand_Chardropall, "@chardropall", 40, atcommand_chardropall }, // MouseJstr { AtCommand_Storeall, "@storeall", 40, atcommand_storeall }, // MouseJstr { AtCommand_Charstoreall, "@charstoreall", 40, atcommand_charstoreall }, // MouseJstr { AtCommand_Skillid, "@skillid", 40, atcommand_skillid }, // MouseJstr { AtCommand_Useskill, "@useskill", 40, atcommand_useskill }, // MouseJstr { AtCommand_Rain, "@rain", 99, atcommand_rain }, { AtCommand_Snow, "@snow", 99, atcommand_snow }, { AtCommand_Sakura, "@sakura", 99, atcommand_sakura }, { AtCommand_Clouds, "@clouds", 99, atcommand_clouds }, { AtCommand_Clouds2, "@clouds2", 99, atcommand_clouds2 }, { AtCommand_Fog, "@fog", 99, atcommand_fog }, { AtCommand_Fireworks, "@fireworks", 99, atcommand_fireworks }, { AtCommand_Leaves, "@leaves", 99, atcommand_leaves }, { AtCommand_Summon, "@summon", 60, atcommand_summon }, { AtCommand_AdjGmLvl, "@adjgmlvl", 99, atcommand_adjgmlvl }, { AtCommand_AdjCmdLvl, "@adjcmdlvl", 99, atcommand_adjcmdlvl }, { AtCommand_Trade, "@trade", 60, atcommand_trade }, { AtCommand_Send, "@send", 60, atcommand_send }, { AtCommand_SetBattleFlag, "@setbattleflag", 99, atcommand_setbattleflag }, { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity { AtCommand_UpTime, "@uptime", 1, atcommand_uptime }, // by MC Cameri // { AtCommand_ChangeSex, "@changesex", 1, atcommand_changesex }, // by MC Cameri <- do we still need this? [Foruken] { AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest] { AtCommand_Mute, "@red", 99, atcommand_mute }, // [celest] { AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [Valaris] { AtCommand_HappyHappyJoyJoy, "@happyhappyjoyjoy", 40, atcommand_happyhappyjoyjoy }, // [Valaris] { AtCommand_Refresh, "@refresh", 1, atcommand_refresh }, // by MC Cameri { AtCommand_PetId, "@petid", 40, atcommand_petid }, // by MC Cameri { AtCommand_Identify, "@identify", 40, atcommand_identify }, // by MC Cameri { AtCommand_Gmotd, "@gmotd", 20, atcommand_gmotd }, // Added by MC Cameri, created by davidsiaw { AtCommand_MiscEffect, "@misceffect", 50, atcommand_misceffect }, // by MC Cameri { AtCommand_MobSearch, "@mobsearch", 10, atcommand_mobsearch }, { AtCommand_CleanMap, "@cleanmap", 40, atcommand_cleanmap }, { AtCommand_NpcTalk, "@npctalk", 20, atcommand_npctalk }, { AtCommand_PetTalk, "@pettalk", 10, atcommand_pettalk }, { AtCommand_Users, "@users", 40, atcommand_users }, { AtCommand_ResetState, "/reset", 40, NULL }, #ifndef TXT_ONLY // sql-only commands { AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris] { AtCommand_ListMail, "@listmail", 1, atcommand_listmail }, // [Valaris] { AtCommand_ListNewMail, "@listnewmail", 1, atcommand_listmail }, // [Valaris] { AtCommand_ReadMail, "@readmail", 1, atcommand_readmail }, // [Valaris] { AtCommand_DeleteMail, "@deletemail", 1, atcommand_readmail }, // [Valaris] { AtCommand_SendMail, "@sendmail", 1, atcommand_sendmail }, // [Valaris] { AtCommand_SendPriorityMail, "@sendprioritymail", 80, atcommand_sendmail }, // [Valaris] { AtCommand_RefreshOnline, "@refreshonline", 99, atcommand_refreshonline }, // [Valaris] #endif /* TXT_ONLY */ { AtCommand_SkillTree, "@skilltree", 40, atcommand_skilltree }, // [MouseJstr] { AtCommand_Marry, "@marry", 40, atcommand_marry }, // [MouseJstr] { AtCommand_Divorce, "@divorce", 40, atcommand_divorce }, // [MouseJstr] { AtCommand_Grind, "@grind", 99, atcommand_grind }, // [MouseJstr] { AtCommand_Grind2, "@grind2", 99, atcommand_grind2 }, // [MouseJstr] #ifdef DMALLOC { AtCommand_DMStart, "@dmstart", 99, atcommand_dmstart }, // [MouseJstr] { AtCommand_DMTick, "@dmtick", 99, atcommand_dmtick }, // [MouseJstr] #endif { AtCommand_JumpToId, "@jumptoid", 20, atcommand_jumptoid }, // [Dino9021] { AtCommand_JumpToId, "@warptoid", 20, atcommand_jumptoid }, // [Dino9021] { AtCommand_JumpToId, "@gotoid", 20, atcommand_jumptoid }, // [Dino9021] { AtCommand_JumpToId2, "@jumptoid2", 20, atcommand_jumptoid2 }, // [Dino9021] { AtCommand_JumpToId2, "@warptoid2", 20, atcommand_jumptoid2 }, // [Dino9021] { AtCommand_JumpToId2, "@gotoid2", 20, atcommand_jumptoid2 }, // [Dino9021] { AtCommand_RecallId, "@recallid", 60, atcommand_recallid }, // [Dino9021] { AtCommand_RecallId2, "@recallid2", 60, atcommand_recallid2 }, // [Dino9021] { AtCommand_KickId, "@kickid", 99, atcommand_kickid }, // [Dino9021] { AtCommand_KickId2, "@kickid2", 99, atcommand_kickid2 }, // [Dino9021] { AtCommand_ReviveId, "@reviveid", 60, atcommand_reviveid }, // [Dino9021] { AtCommand_ReviveId2, "@reviveid2", 60, atcommand_reviveid2 }, // [Dino9021] { AtCommand_KillId, "@killid", 60, atcommand_killid }, // [Dino9021] { AtCommand_KillId2, "@killid2", 60, atcommand_killid2 }, // [Dino9021] { AtCommand_CharKillableId, "@charkillableid", 40, atcommand_charkillableid }, // [Dino9021] { AtCommand_CharKillableId2, "@charkillableid2", 40, atcommand_charkillableid2 }, // [Dino9021] { AtCommand_Sound, "@sound", 40, atcommand_sound }, { AtCommand_UndisguiseAll, "@undisguiseall", 99, atcommand_undisguiseall }, { AtCommand_DisguiseAll, "@disguiseall", 99, atcommand_disguiseall }, { AtCommand_ChangeLook, "@changelook", 99, atcommand_changelook }, { AtCommand_AutoLoot, "@autoloot", 10, atcommand_autoloot }, // Upa-Kun { AtCommand_MobInfo, "@mobinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@monsterinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@mi", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_Adopt, "@adopt", 40, atcommand_adopt }, // [Veider] { AtCommand_Version, "@version", 1, atcommand_version }, { AtCommand_MuteArea, "@mutearea", 99, atcommand_mutearea }, // MouseJstr { AtCommand_MuteArea, "@stfu", 99, atcommand_mutearea }, // MouseJstr { AtCommand_Shuffle, "@shuffle", 40, atcommand_shuffle }, // MouseJstr { AtCommand_Rates, "@rates", 1, atcommand_rates }, // MouseJstr { AtCommand_ItemInfo, "@iteminfo", 1, atcommand_iteminfo }, // [Lupus] { AtCommand_ItemInfo, "@ii", 1, atcommand_iteminfo }, // [Lupus] { AtCommand_MapFlag, "@mapflag", 99, atcommand_mapflag }, // [Lupus] { AtCommand_Me, "@me", 20, atcommand_me }, //added by massdriller, code by lordalfa { AtCommand_MonsterIgnore, "@monsterignore", 99, atcommand_monsterignore }, // [Valaris] { AtCommand_FakeName, "@fakename", 20, atcommand_fakename }, // [Valaris] { AtCommand_Size, "@size", 20, atcommand_size }, { AtCommand_ShowExp, "@showexp", 10, atcommand_showexp}, { AtCommand_ShowZeny, "@showzeny", 10, atcommand_showzeny}, { AtCommand_ShowDelay, "@showdelay", 1, atcommand_showdelay}, { AtCommand_AutoTrade, "@autotrade", 10, atcommand_autotrade }, // durf { AtCommand_AutoTrade, "@at", 10, atcommand_autotrade }, { AtCommand_ChangeGM, "@changegm", 10, atcommand_changegm }, // durf { AtCommand_ChangeLeader, "@changeleader", 10, atcommand_changeleader }, // durf { AtCommand_Invite, "@invite", 1, atcommand_invite }, // By LuzZza { AtCommand_Duel, "@duel", 1, atcommand_duel }, // By LuzZza { AtCommand_Leave, "@leave", 1, atcommand_leave }, // By LuzZza { AtCommand_Accept, "@accept", 1, atcommand_accept }, // By LuzZza { AtCommand_Reject, "@reject", 1, atcommand_reject }, // By LuzZza { AtCommand_Away, "@away", 1, atcommand_away }, // [LuzZza] { AtCommand_Away, "@aw", 1, atcommand_away }, // [LuzZza] { AtCommand_Main, "@main", 1, atcommand_main }, // [LuzZza] { AtCommand_Clone, "@clone", 50, atcommand_clone }, { AtCommand_Clone, "@slaveclone", 50, atcommand_clone }, { AtCommand_Clone, "@evilclone", 50, atcommand_clone }, // [Valaris] // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } }; /*========================================= * Generic variables *----------------------------------------- */ char atcmd_output[200]; char atcmd_player_name[100]; char atcmd_temp[100]; /*========================================== * estr_lower (replace strlwr, non ANSI function that doesn't exist in all C compilator) *------------------------------------------ */ char *estr_lower(char *str) { int i; for (i=0; str[i]; i++) if ((str[i] >= 65) && (str[i] <= 90)) str[i] += 32; return str; } // compare function for sorting high to lowest int hightolow_compare (const void * a, const void * b) { return ( *(int*)b - *(int*)a ); } // compare function for sorting lowest to highest int lowtohigh_compare (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } //----------------------------------------------------------- // Return the message string of the specified number by [Yor] //----------------------------------------------------------- char * msg_txt(int msg_number) { if (msg_number >= 0 && msg_number < MAX_MSG && msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') return msg_table[msg_number]; return "??"; } //----------------------------------------------------------- // Returns Players title (from msg_athena.conf) [Lupus] //----------------------------------------------------------- char * player_title_txt(int level) { if (level < battle_config.title_lvl1) return ""; //w/o any titles if (level >= battle_config.title_lvl8) sprintf(atcmd_temp, msg_table[332], level); else if (level >= battle_config.title_lvl7) sprintf(atcmd_temp, msg_table[331], level); else if (level >= battle_config.title_lvl6) sprintf(atcmd_temp, msg_table[330], level); else if (level >= battle_config.title_lvl5) sprintf(atcmd_temp, msg_table[329], level); else if (level >= battle_config.title_lvl4) sprintf(atcmd_temp, msg_table[328], level); else if (level >= battle_config.title_lvl3) sprintf(atcmd_temp, msg_table[327], level); else if (level >= battle_config.title_lvl2) sprintf(atcmd_temp, msg_table[326], level); else sprintf(atcmd_temp, msg_table[325], level); //lvl1 return atcmd_temp; } //------------------------------------------------------------ // E-mail check: return 0 (not correct) or 1 (valid). by [Yor] //------------------------------------------------------------ int e_mail_check(char *email) { char ch; char* last_arobas; // athena limits if (strlen(email) < 3 || strlen(email) > 39) return 0; // part of RFC limits (official reference of e-mail description) if (strchr(email, '@') == NULL || email[strlen(email)-1] == '@') return 0; if (email[strlen(email)-1] == '.') return 0; last_arobas = strrchr(email, '@'); if (strstr(last_arobas, "@.") != NULL || strstr(last_arobas, "..") != NULL) return 0; for(ch = 1; ch < 32; ch++) { if (strchr(last_arobas, ch) != NULL) { return 0; break; } } if (strchr(last_arobas, ' ') != NULL || strchr(last_arobas, ';') != NULL) return 0; // all correct return 1; } /*========================================== * get_atcommand_level @コマンドの必要レベルを取得 *------------------------------------------ */ int get_atcommand_level(const AtCommandType type) { int i; for (i = 0; atcommand_info[i].type != AtCommand_None; i++) if (atcommand_info[i].type == type) return atcommand_info[i].level; return 100; // 100: command can not be used } /*========================================== *is_atcommand @コマンドに存在するかどうか確認する *------------------------------------------ */ AtCommandType is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl) { const char* str = message; int s_flag = 0; AtCommandInfo info; AtCommandType type; nullpo_retr(AtCommand_None, sd); if (!battle_config.allow_atcommand_when_mute && sd->sc.count && sd->sc.data[SC_NOCHAT].timer != -1) { return AtCommand_Unknown; } if (!message || !*message) return AtCommand_None; memset(&info, 0, sizeof(info)); str += strlen(sd->status.name); while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) { if (*str == ':') s_flag = 1; str++; } if (!*str) return AtCommand_None; type = atcommand(sd, gmlvl > 0 ? gmlvl : pc_isGM(sd), str, &info); if (type != AtCommand_None) { char command[100]; const char* p = str; memset(command, '\0', sizeof(command)); memset(atcmd_output, '\0', sizeof(atcmd_output)); while (*p && !isspace(*p)) p++; if (p - str >= sizeof(command)) // too long return AtCommand_Unknown; strncpy(command, str, p - str); while (isspace(*p)) p++; if (type == AtCommand_Unknown || info.proc == NULL) { sprintf(atcmd_output, msg_table[153], command); // %s is Unknown Command. clif_displaymessage(fd, atcmd_output); } else { if (info.proc(fd, sd, command, p) != 0) { // Command can not be executed sprintf(atcmd_output, msg_table[154], command); // %s failed. clif_displaymessage(fd, atcmd_output); } } return info.type; } return AtCommand_None; } /*========================================== * *------------------------------------------ */ AtCommandType atcommand(struct map_session_data* sd, const int level, const char* message, struct AtCommandInfo* info) { char* p = (char *)message; // it's 'char' and not 'const char' to have possibility to modify the first character if necessary if (!info) return AtCommand_None; if (battle_config.atc_gmonly != 0 && !level) // level = pc_isGM(sd) return AtCommand_None; if (!p || !*p) { ShowError("at command message is empty\n"); return AtCommand_None; } if (*p == command_symbol) { // check first char. char command[101]; int i = 0; memset(info, 0, sizeof(AtCommandInfo)); sscanf(p, "%100s", command); command[sizeof(command)-1] = '\0'; while (atcommand_info[i].type != AtCommand_Unknown) { if (strcmpi(command+1, atcommand_info[i].command+1) == 0 && level >= atcommand_info[i].level) { p[0] = atcommand_info[i].command[0]; // set correct first symbol for after. break; } i++; } if (atcommand_info[i].type == AtCommand_Unknown) { // doesn't return Unknown if player is normal player (display the text, not display: unknown command) if (level == 0) return AtCommand_None; else return AtCommand_Unknown; } else if((log_config.gm) && (atcommand_info[i].level >= log_config.gm)) { log_atcommand(sd, message); } memcpy(info, &atcommand_info[i], sizeof atcommand_info[i]); } else { return AtCommand_None; } return info->type; } /*========================================== * Read Message Data *------------------------------------------ */ int msg_config_read(const char *cfgName) { int msg_number; char line[1024], w1[1024], w2[1024]; FILE *fp; static int called = 1; if ((fp = fopen(cfgName, "r")) == NULL) { ShowError("Messages file not found: %s\n", cfgName); return 1; } if ((--called) == 0) memset(&msg_table[0], 0, sizeof(msg_table[0]) * MAX_MSG); while(fgets(line, sizeof(line)-1, fp)) { if (line[0] == '/' && line[1] == '/') continue; if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) { if (strcmpi(w1, "import") == 0) { msg_config_read(w2); } else { msg_number = atoi(w1); if (msg_number >= 0 && msg_number < MAX_MSG) { if (msg_table[msg_number] != NULL) aFree(msg_table[msg_number]); msg_table[msg_number] = (char *)aCalloc(strlen(w2) + 1, sizeof (char)); strcpy(msg_table[msg_number],w2); // printf("message #%d: '%s'.\n", msg_number, msg_table[msg_number]); } } } } fclose(fp); return 0; } /*========================================== * Cleanup Message Data *------------------------------------------ */ void do_final_msg (void) { int i; for (i = 0; i < MAX_MSG; i++) aFree(msg_table[i]); return; } /*========================================== * *------------------------------------------ */ static AtCommandInfo* get_atcommandinfo_byname(const char* name) { int i; for (i = 0; atcommand_info[i].type != AtCommand_Unknown; i++) if (strcmpi(atcommand_info[i].command + 1, name) == 0) return &atcommand_info[i]; return NULL; } /*========================================== * *------------------------------------------ */ int atcommand_config_read(const char *cfgName) { char line[1024], w1[1024], w2[1024]; AtCommandInfo* p; FILE* fp; if ((fp = fopen(cfgName, "r")) == NULL) { ShowError("At commands configuration file not found: %s\n", cfgName); return 1; } while (fgets(line, sizeof(line)-1, fp)) { if (line[0] == '/' && line[1] == '/') continue; if (sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2) continue; p = get_atcommandinfo_byname(w1); if (p != NULL) { p->level = atoi(w2); if (p->level > 100) p->level = 100; else if (p->level < 0) p->level = 0; } if (strcmpi(w1, "import") == 0) atcommand_config_read(w2); else if (strcmpi(w1, "command_symbol") == 0 && w2[0] > 31 && w2[0] != '/' && // symbol of standard ragnarok GM commands w2[0] != '%' && // symbol of party chat speaking w2[0] != '$' && // symbol of guild chat w2[0] != '#') // symbol of charcommand command_symbol = w2[0]; } fclose(fp); return 0; } /*========================================== * Duel organizing functions [LuzZza] *------------------------------------------ */ void duel_msg_foreach_sameduel_wos( const unsigned int did, struct map_session_data* sd, char *output) { int i; struct map_session_data* msg_sd; for(i=0; isession_data) && msg_sd->state.auth && msg_sd->duel_group == did && msg_sd != sd) clif_disp_onlyself(msg_sd, output, strlen(output)); return; } void duel_savetime(struct map_session_data* sd) { time_t timer; struct tm *t; time(&timer); t = localtime(&timer); pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min); return; } int duel_checktime(struct map_session_data* sd) { int diff; time_t timer; struct tm *t; time(&timer); t = localtime(&timer); diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME"); return !(diff >= 0 && diff < battle_config.duel_time_interval); } int duel_showinfo( const unsigned int did, struct map_session_data* sd) { int i, p=0; char output[256]; struct map_session_data* msg_sd; if(duel_list[did].max_players_limit > 0) sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --" did, duel_count, duel_list[did].members_count, duel_list[did].members_count + duel_list[did].invites_count, duel_list[did].max_players_limit); else sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --" did, duel_count, duel_list[did].members_count, duel_list[did].members_count + duel_list[did].invites_count); clif_disp_onlyself(sd, output, strlen(output)); for(i=0; isession_data) && msg_sd->state.auth && msg_sd->duel_group == did) { sprintf(output, " %d. %s", ++p, (unsigned char *) msg_sd->status.name); clif_disp_onlyself(sd, output, strlen(output)); } return 0; } int duel_create( struct map_session_data* sd, const unsigned int maxpl) { int i=1; char output[256]; while(duel_list[i].members_count > 0 && i < MAX_DUEL) i++; if(i == MAX_DUEL) return 0; duel_count++; sd->duel_group = i; duel_list[i].members_count++; duel_list[i].invites_count = 0; duel_list[i].max_players_limit = maxpl; strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --" clif_disp_onlyself(sd, output, strlen(output)); clif_set0199(sd->fd, 1); //clif_misceffect2(&sd->bl, 159); return i; } int duel_invite( const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd) { char output[256]; sprintf(output, msg_txt(373), // " -- Player %s invites %s to duel --" (unsigned char *)sd->status.name, (unsigned char *)target_sd->status.name); duel_msg_foreach_sameduel_wos(did, sd, output); target_sd->duel_invite = did; duel_list[did].invites_count++; // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --" sprintf(output, msg_txt(374), (unsigned char *)sd->status.name); clif_GMmessage((struct block_list *)target_sd, output, strlen(output)+1, 3); return 0; } int duel_leave( const unsigned int did, struct map_session_data* sd) { int i; char output[256]; struct map_session_data* msg_sd; // " <- Player %s has left duel --" sprintf(output, msg_txt(375), (unsigned char *)sd->status.name); duel_msg_foreach_sameduel_wos(did, sd, output); duel_list[did].members_count--; if(duel_list[did].members_count == 0) { for (i=0; isession_data) && msg_sd->state.auth && msg_sd->duel_invite == did && msg_sd != sd) { msg_sd->duel_invite = 0; } duel_count--; } sd->duel_group = 0; duel_savetime(sd); clif_set0199(sd->fd, 0); return 0; } int duel_accept( const unsigned int did, struct map_session_data* sd) { char output[256]; // " -> Player %s has accepted duel --" sprintf(output, msg_txt(376), (unsigned char *)sd->status.name); duel_msg_foreach_sameduel_wos(did, sd, output); duel_list[did].members_count++; sd->duel_group = sd->duel_invite; duel_list[did].invites_count--; sd->duel_invite = 0; clif_set0199(sd->fd, 1); //clif_misceffect2(&sd->bl, 159); return 0; } int duel_reject( const unsigned int did, struct map_session_data* sd) { char output[256]; // " -- Player %s has rejected duel --" sprintf(output, msg_txt(377), (unsigned char *)sd->status.name); duel_msg_foreach_sameduel_wos(did, sd, output); duel_list[did].invites_count--; sd->duel_invite = 0; return 0; } /*========================================== // @ command processing functions *------------------------------------------ */ /*========================================== * @send (used for testing packet sends from the client) *------------------------------------------ */ int atcommand_send( const int fd, struct map_session_data* sd, const char* command, const char* message) { int i,type=0; int info[20]; if (!message || !*message || sscanf(message, "%x %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", &type, &info[1], &info[2], &info[3], &info[4], &info[5], &info[6], &info[7], &info[8], &info[9], &info[10], &info[11], &info[12], &info[13], &info[14], &info[15], &info[16], &info[17], &info[18], &info[19], &info[20]) < 1) { clif_displaymessage(fd, "Please enter a packet number, and - if required - up to 20 additional values."); return -1; } if (type > 0 && type < MAX_PACKET_DB) { switch (type) { case 0x209: { WFIFOHEAD(fd, packet_db[sd->packet_ver][type].len); WFIFOW(fd,0) = 0x209; WFIFOW(fd,2) = 2; memcpy(WFIFOP(fd, 12), sd->status.name, NAME_LENGTH); WFIFOSET(fd, packet_db[sd->packet_ver][type].len); break; } case 0x1b1: case 0x1c2: //case xxx: // add others here // break; default: { WFIFOHEAD(fd, packet_db[sd->packet_ver][type].len); WFIFOW(fd,0) = type; for(i=1;i<=sizeof(info);i++) if(info[i]) WFIFOW(fd,i) = info[i]; WFIFOSET(fd, packet_db[sd->packet_ver][type].len); break; } } sprintf (atcmd_output, msg_table[258], type, type); clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_table[259]); } return 0; } // @rura /*========================================== * *------------------------------------------ */ int atcommand_rura( const int fd, struct map_session_data* sd, const char* command, const char* message) { char map_name[MAP_NAME_LENGTH]; unsigned short mapindex; int x = 0, y = 0; int m = -1; nullpo_retr(-1, sd); memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || sscanf(message, "%15s %d %d", map_name, &x, &y) < 1) { clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove )."); return -1; } if (x <= 0) x = rand() % 399 + 1; if (y <= 0) y = rand() % 399 + 1; if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); mapindex = mapindex_name2id(map_name); if (mapindex) m = map_mapindex2mapid(mapindex); if (!mapindex || m < 0) { clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } if (x > 0 && x < 400 && y > 0 && y < 400) { if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, mapindex, x, y, 3) == 0) clif_displaymessage(fd, msg_table[0]); // Warped. else { clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } } else { clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. return -1; } return 0; } /*========================================== * Displays where a character is. Corrected version by Silent. [Skotlex] *------------------------------------------ */ int atcommand_where( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd = NULL; int GM_level, pl_GM_level; memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @where )."); return -1; } pl_sd = map_nick2sd(atcmd_player_name); nullpo_retr(-1, sd); if (pl_sd == NULL) return -1; if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) return -1; GM_level = pc_isGM(sd);//also hide gms depending on settings in battle_athena.conf, show if they are aid [Kevin] pl_GM_level = pc_isGM(pl_sd); if (battle_config.hide_GM_session) { if(!(GM_level >= pl_GM_level)) { if (!(battle_config.who_display_aid > 0 && pc_isGM(sd) >= battle_config.who_display_aid)) { return -1; } } } snprintf(atcmd_output, sizeof atcmd_output, "%s %s %d %d", atcmd_player_name, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); clif_displaymessage(fd, atcmd_output); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_jumpto( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd = NULL; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%99[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @jumpto/@warpto/@goto )."); return -1; } memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if (sscanf(message, "%23[^\n]", atcmd_player_name) < 1) return -1; if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) //Yourself mate? Tsk tsk tsk. return -1; if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); sprintf(atcmd_output, msg_table[4], atcmd_player_name); // Jump to %s clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_table[3]); // Character not found. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_jump( const int fd, struct map_session_data* sd, const char* command, const char* message) { int x = 0, y = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); sscanf(message, "%d %d", &x, &y); if (x <= 0) //If coordinates are 'wrong', random jump. x = -1; if (y <= 0) y = -1; if (sd->bl.m >= 0 && (map[sd->bl.m].flag.nowarp || map[sd->bl.m].flag.nowarpto) && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, sd->mapindex, x, y, 3); sprintf(atcmd_output, msg_table[5], sd->bl.x, sd->bl.y); // Jump to %d %d clif_displaymessage(fd, atcmd_output); return 0; } /*========================================== * @who3 = Player name, his location *------------------------------------------ */ int atcommand_who3( const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp0[100]; struct map_session_data *pl_sd, **pl_allsd; int i, j, count, users; int pl_GM_level, GM_level; char match_text[100]; char player_name[NAME_LENGTH]; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = tolower(match_text[j]); count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = tolower(player_name[j]); if (strstr(player_name, match_text) != NULL) { // search with no case sensitive if (battle_config.who_display_aid > 0 && pc_isGM(sd) >= battle_config.who_display_aid) { sprintf(atcmd_output, "(CID:%d/AID:%d) ", pl_sd->status.char_id, pl_sd->status.account_id); } else { atcmd_output[0]=0; } //Player name sprintf(temp0, msg_txt(333), pl_sd->status.name); strcat(atcmd_output,temp0); //Player title, if exists if (pl_GM_level > 0) { //sprintf(temp0, "(%s) ", player_title_txt(pl_GM_level) ); sprintf(temp0, msg_txt(334), player_title_txt(pl_GM_level) ); strcat(atcmd_output,temp0); } //Players Location: map x y sprintf(temp0, msg_txt(338), mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); strcat(atcmd_output,temp0); clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) clif_displaymessage(fd, msg_table[28]); // No player found. else if (count == 1) clif_displaymessage(fd, msg_table[29]); // 1 player found. else { sprintf(atcmd_output, msg_table[30], count); // %d players found. clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * Player name, BLevel, Job, *------------------------------------------ */ int atcommand_who2( const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp0[100]; struct map_session_data *pl_sd, **pl_allsd; int i, j, count, users; int pl_GM_level, GM_level; char match_text[100]; char player_name[NAME_LENGTH]; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = tolower(match_text[j]); count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = tolower(player_name[j]); if (strstr(player_name, match_text) != NULL) { // search with no case sensitive //Players Name //sprintf(atcmd_output, "Name: %s ", pl_sd->status.name); sprintf(atcmd_output, msg_txt(333), pl_sd->status.name); //Player title, if exists if (pl_GM_level > 0) { //sprintf(temp0, "(%s) ", player_title_txt(pl_GM_level) ); sprintf(temp0, msg_txt(334), player_title_txt(pl_GM_level) ); strcat(atcmd_output,temp0); } //Players Base Level / Job name //sprintf(temp0, "| L:%d/%d | Job: %s", pl_sd->status.base_level, pl_sd->status.job_level, job_name(pl_sd->status.class_) ); sprintf(temp0, msg_txt(337), pl_sd->status.base_level, pl_sd->status.job_level, job_name(pl_sd->status.class_) ); strcat(atcmd_output,temp0); clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) clif_displaymessage(fd, msg_txt(28)); // No player found. else if (count == 1) clif_displaymessage(fd, msg_txt(29)); // 1 player found. else { sprintf(atcmd_output, msg_txt(30), count); // %d players found. clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * Player name, Playrs Party / Guild name *------------------------------------------ */ int atcommand_who( const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp0[100]; struct map_session_data *pl_sd, **pl_allsd; int i, j, count, users; int pl_GM_level, GM_level; char match_text[100]; char player_name[NAME_LENGTH]; struct guild *g; struct party *p; nullpo_retr(-1, sd); memset(temp0, '\0', sizeof(temp0)); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = tolower(match_text[j]); count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = tolower(player_name[j]); if (strstr(player_name, match_text) != NULL) { // search with no case sensitive g = guild_search(pl_sd->status.guild_id); p = party_search(pl_sd->status.party_id); //Players Name //sprintf(atcmd_output, "Name: %s ", pl_sd->status.name); sprintf(atcmd_output, msg_txt(333), pl_sd->status.name); //Player title, if exists if (pl_GM_level > 0) { //sprintf(temp0, "(%s) ", player_title_txt(pl_GM_level) ); sprintf(temp0, msg_txt(334), player_title_txt(pl_GM_level) ); strcat(atcmd_output,temp0); } //Players Party if exists if (p != NULL) { //sprintf(temp0," | Party: '%s'", p->name); sprintf(temp0, msg_txt(335), p->name); strcat(atcmd_output,temp0); } //Players Guild if exists if (g != NULL) { //sprintf(temp0," | Guild: '%s'", g->name); sprintf(temp0, msg_txt(336), g->name); strcat(atcmd_output,temp0); } clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) clif_displaymessage(fd, msg_txt(28)); // No player found. else if (count == 1) clif_displaymessage(fd, msg_txt(29)); // 1 player found. else { sprintf(atcmd_output, msg_txt(30), count); // %d players found. clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_whomap3( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i, count, users; int pl_GM_level, GM_level; int map_id; char map_name[MAP_NAME_LENGTH]; memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; else { sscanf(message, "%15s", map_name); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level if (pl_sd->bl.m == map_id) { if (pl_GM_level > 0) sprintf(atcmd_output, "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); else sprintf(atcmd_output, "Name: %s | Location: %s %d %d", pl_sd->status.name, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) sprintf(atcmd_output, msg_txt(54), map[map_id].name); // No player found in map '%s'. else if (count == 1) sprintf(atcmd_output, msg_txt(55), map[map_id].name); // 1 player found in map '%s'. else { sprintf(atcmd_output, msg_txt(56), count, map[map_id].name); // %d players found in map '%s'. } clif_displaymessage(fd, atcmd_output); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_whomap2( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i, count, users; int pl_GM_level, GM_level; int map_id = 0; char map_name[MAP_NAME_LENGTH]; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; else { sscanf(message, "%15s", map_name); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level if (pl_sd->bl.m == map_id) { if (pl_GM_level > 0) sprintf(atcmd_output, "Name: %s (GM:%d) | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_GM_level, pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level); else sprintf(atcmd_output, "Name: %s | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level); clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) sprintf(atcmd_output, msg_table[54], map[map_id].name); // No player found in map '%s'. else if (count == 1) sprintf(atcmd_output, msg_table[55], map[map_id].name); // 1 player found in map '%s'. else { sprintf(atcmd_output, msg_table[56], count, map[map_id].name); // %d players found in map '%s'. } clif_displaymessage(fd, atcmd_output); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_whomap( const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp0[100]; char temp1[100]; struct map_session_data *pl_sd, **pl_allsd; int i, count, users; int pl_GM_level, GM_level; int map_id = 0; char map_name[MAP_NAME_LENGTH]; struct guild *g; struct party *p; nullpo_retr(-1, sd); memset(temp0, '\0', sizeof(temp0)); memset(temp1, '\0', sizeof(temp1)); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) map_id = sd->bl.m; else { sscanf(message, "%15s", map_name); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level if (pl_sd->bl.m == map_id) { g = guild_search(pl_sd->status.guild_id); if (g == NULL) sprintf(temp1, "None"); else sprintf(temp1, "%s", g->name); p = party_search(pl_sd->status.party_id); if (p == NULL) sprintf(temp0, "None"); else sprintf(temp0, "%s", p->name); if (pl_GM_level > 0) sprintf(atcmd_output, "Name: %s (GM:%d) | Party: '%s' | Guild: '%s'", pl_sd->status.name, pl_GM_level, temp0, temp1); else sprintf(atcmd_output, "Name: %s | Party: '%s' | Guild: '%s'", pl_sd->status.name, temp0, temp1); clif_displaymessage(fd, atcmd_output); count++; } } } } if (count == 0) sprintf(atcmd_output, msg_table[54], map[map_id].name); // No player found in map '%s'. else if (count == 1) sprintf(atcmd_output, msg_table[55], map[map_id].name); // 1 player found in map '%s'. else { sprintf(atcmd_output, msg_table[56], count, map[map_id].name); // %d players found in map '%s'. } clif_displaymessage(fd, atcmd_output); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_whogm( const int fd, struct map_session_data* sd, const char* command, const char* message) { char temp0[100]; char temp1[100]; struct map_session_data *pl_sd, **pl_allsd; int i, j, count, users; int pl_GM_level, GM_level; char match_text[100]; char player_name[NAME_LENGTH]; struct guild *g; struct party *p; nullpo_retr(-1, sd); memset(temp0, '\0', sizeof(temp0)); memset(temp1, '\0', sizeof(temp1)); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = tolower(match_text[j]); count = 0; GM_level = pc_isGM(sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { pl_GM_level = pc_isGM(pl_sd); if (pl_GM_level > 0) { if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = tolower(player_name[j]); if (strstr(player_name, match_text) != NULL) { // search with no case sensitive sprintf(atcmd_output, "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y); clif_displaymessage(fd, atcmd_output); sprintf(atcmd_output, " BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level); clif_displaymessage(fd, atcmd_output); g = guild_search(pl_sd->status.guild_id); if (g == NULL) sprintf(temp1, "None"); else sprintf(temp1, "%s", g->name); p = party_search(pl_sd->status.party_id); if (p == NULL) sprintf(temp0, "None"); else sprintf(temp0, "%s", p->name); sprintf(atcmd_output, " Party: '%s' | Guild: '%s'", temp0, temp1); clif_displaymessage(fd, atcmd_output); count++; } } } } } if (count == 0) clif_displaymessage(fd, msg_table[150]); // No GM found. else if (count == 1) clif_displaymessage(fd, msg_table[151]); // 1 GM found. else { sprintf(atcmd_output, msg_table[152], count); // %d GMs found. clif_displaymessage(fd, atcmd_output); } return 0; } int atcommand_whozeny( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i, j, count,c, users; char match_text[100]; char player_name[NAME_LENGTH]; int *zeny; int *counted; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(match_text, '\0', sizeof(match_text)); memset(player_name, '\0', sizeof(player_name)); if (sscanf(message, "%99[^\n]", match_text) < 1) strcpy(match_text, ""); for (j = 0; match_text[j]; j++) match_text[j] = tolower(match_text[j]); count = 0; pl_allsd = map_getallusers(&users); if (users < 1) { clif_displaymessage(fd, msg_table[28]); // No player found. return 0; } zeny = (int *)aCallocA(users, sizeof(int)); counted = (int *)aCallocA(users, sizeof(int)); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { memcpy(player_name, pl_sd->status.name, NAME_LENGTH); for (j = 0; player_name[j]; j++) player_name[j] = tolower(player_name[j]); if (strstr(player_name, match_text) != NULL) { // search with no case sensitive zeny[count]=pl_sd->status.zeny; counted[i]=0; count++; } } } qsort(zeny, count, sizeof(int), hightolow_compare); for (c = 0; c < count && c < 50; c++) { if(!zeny[c]) continue; for (i = 0; i < users; i++) { if(!zeny[c]) continue; if ((pl_sd = pl_allsd[i]) && counted[i]==0) { if(pl_sd->status.zeny==zeny[c]) { sprintf(atcmd_output, "Name: %s | Zeny: %d", pl_sd->status.name, pl_sd->status.zeny); clif_displaymessage(fd, atcmd_output); zeny[c]=0; counted[i]=1; } } } } if (count == 0) clif_displaymessage(fd, msg_table[28]); // No player found. else if (count == 1) clif_displaymessage(fd, msg_table[29]); // 1 player found. else { sprintf(atcmd_output, msg_table[30], count); // %d players found. clif_displaymessage(fd, atcmd_output); } aFree(zeny); aFree(counted); return 0; } // cause random emote on all online players [Valaris] int atcommand_happyhappyjoyjoy( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i,e, users; nullpo_retr(-1, sd); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i])) { e=rand()%40; if(e==34) e = 0; clif_emotion(&pl_sd->bl,e); } } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_save( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); pc_setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y); if (sd->status.pet_id > 0 && sd->pd) intif_save_petdata(sd->status.account_id, &sd->pet); chrif_save(sd,0); clif_displaymessage(fd, msg_table[6]); // Character data respawn point saved. return 0; } /*========================================== * *------------------------------------------ */ int atcommand_load( const int fd, struct map_session_data* sd, const char* command, const char* message) { int m; nullpo_retr(-1, sd); m = map_mapindex2mapid(sd->status.save_point.map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[249]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 0); clif_displaymessage(fd, msg_table[7]); // Warping to respawn point. return 0; } /*========================================== * *------------------------------------------ */ int atcommand_speed( const int fd, struct map_session_data* sd, const char* command, const char* message) { int speed; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { sprintf(atcmd_output, "Please, enter a speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED); clif_displaymessage(fd, atcmd_output); return -1; } speed = atoi(message); if (speed >= MIN_WALK_SPEED && speed <= MAX_WALK_SPEED) { sd->speed = speed; //sd->walktimer = x; //この文を追加 by れ clif_updatestatus(sd, SP_SPEED); clif_displaymessage(fd, msg_table[8]); // Speed changed. } else { sprintf(atcmd_output, "Please, enter a valid speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED); clif_displaymessage(fd, atcmd_output); return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_storage( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct storage *stor; //changes from Freya/Yor nullpo_retr(-1, sd); if (sd->state.storage_flag) { clif_displaymessage(fd, msg_table[250]); return -1; } if ((stor = account2storage2(sd->status.account_id)) != NULL && stor->storage_status == 1) { clif_displaymessage(fd, msg_table[250]); return -1; } storage_storageopen(sd); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_guildstorage( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct storage *stor; //changes from Freya/Yor nullpo_retr(-1, sd); if (sd->status.guild_id > 0) { if (sd->state.storage_flag) { clif_displaymessage(fd, msg_table[251]); return -1; } if ((stor = account2storage2(sd->status.account_id)) != NULL && stor->storage_status == 1) { clif_displaymessage(fd, msg_table[251]); return -1; } storage_guild_storageopen(sd); } else { clif_displaymessage(fd, msg_table[252]); return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_option( const int fd, struct map_session_data* sd, const char* command, const char* message) { int param1 = 0, param2 = 0, param3 = 0; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d %d %d", ¶m1, ¶m2, ¶m3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) { clif_displaymessage(fd, "Please, enter at least a option (usage: @option )."); return -1; } sd->sc.opt1 = param1; sd->sc.opt2 = param2; if (!(sd->sc.option & CART_MASK) && param3 & CART_MASK) { if (sd->status.class_ == JOB_BABY_MERCHANT) clif_cart_itemlist(sd); clif_cart_equiplist(sd); clif_updatestatus(sd, SP_CARTINFO); } pc_setoption(sd, param3); clif_displaymessage(fd, msg_table[9]); // Options changed. return 0; } /*========================================== * *------------------------------------------ */ int atcommand_hide( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (sd->sc.option & OPTION_INVISIBLE) { sd->sc.option &= ~OPTION_INVISIBLE; clif_displaymessage(fd, msg_table[10]); // Invisible: Off } else { sd->sc.option |= OPTION_INVISIBLE; clif_displaymessage(fd, msg_table[11]); // Invisible: On } clif_changeoption(&sd->bl); return 0; } /*========================================== * 転職する upperを指定すると転生や養子にもなれる *------------------------------------------ */ int atcommand_jobchange( const int fd, struct map_session_data* sd, const char* command, const char* message) { int job = 0, upper = 0; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) { int i, found = 0; const struct { char name[16]; int id; } jobs[] = { { "novice", 0 }, { "swordsman", 1 }, { "mage", 2 }, { "archer", 3 }, { "acolyte", 4 }, { "merchant", 5 }, { "thief", 6 }, { "knight", 7 }, { "priest", 8 }, { "priestess", 8 }, { "wizard", 9 }, { "blacksmith", 10 }, { "hunter", 11 }, { "assassin", 12 }, { "crusader", 14 }, { "monk", 15 }, { "sage", 16 }, { "rogue", 17 }, { "alchemist", 18 }, { "bard", 19 }, { "dancer", 20 }, { "super novice", 23 }, { "supernovice", 23 }, { "high novice", 4001 }, { "swordsman high", 4002 }, { "mage high", 4003 }, { "archer high", 4004 }, { "acolyte high", 4005 }, { "merchant high", 4006 }, { "thief high", 4007 }, { "lord knight", 4008 }, { "high priest", 4009 }, { "high priestess", 4009 }, { "high wizard", 4010 }, { "whitesmith", 4011 }, { "sniper", 4012 }, { "assassin cross", 4013 }, { "paladin", 4015 }, { "champion", 4016 }, { "professor", 4017 }, { "stalker", 4018 }, { "creator", 4019 }, { "clown", 4020 }, { "gypsy", 4021 }, { "baby novice", 4023 }, { "baby swordsman", 4024 }, { "baby mage", 4025 }, { "baby archer", 4026 }, { "baby acolyte", 4027 }, { "baby merchant", 4028 }, { "baby thief", 4029 }, { "baby knight", 4030 }, { "baby priest", 4031 }, { "baby priestess", 4031 }, { "baby wizard", 4032 }, { "baby blacksmith",4033 }, { "baby hunter", 4034 }, { "baby assassin", 4035 }, { "baby crusader", 4037 }, { "baby monk", 4038 }, { "baby sage", 4039 }, { "baby rogue", 4040 }, { "baby alchemist", 4041 }, { "baby bard", 4042 }, { "baby dancer", 4043 }, { "super baby", 4045 }, { "taekwon", 4046 }, { "taekwon boy", 4046 }, { "taekwon girl", 4046 }, { "star gladiator", 4047 }, { "soul linker", 4049 }, }; for (i=0; i < (int)(sizeof(jobs) / sizeof(jobs[0])); i++) { if (strncmpi(message, jobs[i].name, 16) == 0) { job = jobs[i].id; upper = 0; found = 1; break; } } if (!found) { clif_displaymessage(fd, "Please, enter job ID (usage: @job/@jobchange )."); return -1; } } if (job == 37 ||job == 45) return 0; if ((job >= 0 && job < MAX_PC_CLASS)) { int j; for (j=0; j < MAX_INVENTORY; j++) { if(sd->status.inventory[j].nameid>0 && sd->status.inventory[j].equip!=0) pc_unequipitem(sd, j, 3); } if (pc_jobchange(sd, job, upper) == 0) clif_displaymessage(fd, msg_table[12]); // Your job has been changed. else { clif_displaymessage(fd, msg_table[155]); // Impossible to change your job. return -1; } } else { clif_displaymessage(fd, "Please, enter a valid job ID (usage: @job/@jobchange )."); return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_die( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); clif_specialeffect(&sd->bl,450,1); pc_damage(NULL, sd, sd->status.hp); clif_displaymessage(fd, msg_table[13]); // A pity! You've died. return 0; } /*========================================== * *------------------------------------------ */ int atcommand_kill( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd; nullpo_retr(-1, sd); memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @kill )."); return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can kill only lower or same level pc_damage(NULL, pl_sd, pl_sd->status.hp); clif_displaymessage(fd, msg_table[14]); // Character killed. } else { clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. return -1; } } else { clif_displaymessage(fd, msg_table[3]); // Character not found. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_alive( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (pc_isdead(sd)) { sd->status.hp = sd->status.max_hp; sd->status.sp = sd->status.max_sp; clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); pc_setstand(sd); if (battle_config.pc_invincible_time > 0) pc_setinvincibletimer(sd, battle_config.pc_invincible_time); clif_updatestatus(sd, SP_HP); clif_updatestatus(sd, SP_SP); clif_resurrection(&sd->bl, 1); clif_displaymessage(fd, msg_table[16]); // You've been revived! It's a miracle! return 0; } return -1; } /*========================================== * +kamic [LuzZza] *------------------------------------------ */ int atcommand_kami( const int fd, struct map_session_data* sd, const char* command, const char* message) { unsigned long color=0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if(*(command + 5) != 'c') { if (!message || !*message) { clif_displaymessage(fd, "Please, enter a message (usage: @kami )."); return -1; } sscanf(message, "%199[^\n]", atcmd_output); intif_GMmessage(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b') ? 0x10 : 0); } else { if(!message || !*message || (sscanf(message, "%lx %199[^\n]", &color, atcmd_output) < 2)) { clif_displaymessage(fd, "Please, enter color and message (usage: @kamic )."); return -1; } if(color < 0 || color > 0xFFFFFF) { clif_displaymessage(fd, "Invalid color."); return -1; } intif_announce(atcmd_output, strlen(atcmd_output) + 1, color, 0); } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_heal( const int fd, struct map_session_data* sd, const char* command, const char* message) { int hp = 0, sp = 0; // [Valaris] thanks to fov nullpo_retr(-1, sd); sscanf(message, "%d %d", &hp, &sp); if (hp == 0 && sp == 0) { hp = sd->status.max_hp - sd->status.hp; sp = sd->status.max_sp - sd->status.sp; } else { if (hp > 0 && (hp > sd->status.max_hp || hp > (sd->status.max_hp - sd->status.hp))) // fix positiv overflow hp = sd->status.max_hp - sd->status.hp; else if (hp < 0 && (hp < -sd->status.max_hp || hp < (1 - sd->status.hp))) // fix negativ overflow hp = 1 - sd->status.hp; if (sp > 0 && (sp > sd->status.max_sp || sp > (sd->status.max_sp - sd->status.sp))) // fix positiv overflow sp = sd->status.max_sp - sd->status.sp; else if (sp < 0 && (sp < -sd->status.max_sp || sp < (1 - sd->status.sp))) // fix negativ overflow sp = 1 - sd->status.sp; } if (hp > 0) // display like heal clif_heal(fd, SP_HP, hp); else if (hp < 0) // display like damage clif_damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0 , 4, 0); if (sp > 0) // no display when we lost SP clif_heal(fd, SP_SP, sp); if (hp != 0 || sp != 0) { pc_heal(sd, hp, sp); if (hp >= 0 && sp >= 0) clif_displaymessage(fd, msg_table[17]); // HP, SP recovered. else clif_displaymessage(fd, msg_table[156]); // HP or/and SP modified. } else { clif_displaymessage(fd, msg_table[157]); // HP and SP are already with the good value. return -1; } return 0; } /*========================================== * @item command (usage: @item ) (modified by [Yor] for pet_egg) *------------------------------------------ */ int atcommand_item( const int fd, struct map_session_data* sd, const char* command, const char* message) { char item_name[100]; int number = 0, item_id, flag; struct item item_tmp; struct item_data *item_data; int get_count, i, pet_id; nullpo_retr(-1, sd); memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d", item_name, &number) < 1) { clif_displaymessage(fd, "Please, enter an item name/id (usage: @item [quantity])."); return -1; } if (number <= 0) number = 1; item_id = 0; if ((item_data = itemdb_searchname(item_name)) != NULL || (item_data = itemdb_exists(atoi(item_name))) != NULL) item_id = item_data->nameid; if (item_id >= 500) { get_count = number; // check pet egg pet_id = search_petDB_index(item_id, PET_EGG); if (item_data->type == 4 || item_data->type == 5 || item_data->type == 7 || item_data->type == 8) { get_count = 1; } for (i = 0; i < number; i += get_count) { // if pet egg if (pet_id >= 0) { sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet(sd->status.account_id, sd->status.char_id, (short)pet_db[pet_id].class_, (short)mob_db(pet_db[pet_id].class_)->lv, (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); // if not pet egg } else { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = 1; if ((flag = pc_additem((struct map_session_data*)sd, &item_tmp, get_count))) clif_additem((struct map_session_data*)sd, 0, 0, flag); } } //Logs (A)dmins items [Lupus] if(log_config.pick > 0 ) { log_pick(sd, "A", 0, item_id, number, NULL); } //Logs clif_displaymessage(fd, msg_table[18]); // Item created. } else { clif_displaymessage(fd, msg_table[19]); // Invalid item ID or name. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_item2( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct item item_tmp; struct item_data *item_data; char item_name[100]; int item_id, number = 0; int identify = 0, refine = 0, attr = 0; int c1 = 0, c2 = 0, c3 = 0, c4 = 0; int flag; int loop, get_count, i; nullpo_retr(-1, sd); memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9) { clif_displaymessage(fd, "Please, enter all informations (usage: @item2 "); clif_displaymessage(fd, " )."); return -1; } if (number <= 0) number = 1; item_id = 0; if ((item_data = itemdb_searchname(item_name)) != NULL || (item_data = itemdb_exists(atoi(item_name))) != NULL) item_id = item_data->nameid; if (item_id > 500) { loop = 1; get_count = number; if (item_data->type == 4 || item_data->type == 5 || item_data->type == 7 || item_data->type == 8) { loop = number; get_count = 1; if (item_data->type == 7) { identify = 1; refine = 0; } if (item_data->type == 8) refine = 0; if (refine > 10) refine = 10; } else { identify = 1; refine = attr = 0; } for (i = 0; i < loop; i++) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = identify; item_tmp.refine = refine; item_tmp.attribute = attr; item_tmp.card[0] = c1; item_tmp.card[1] = c2; item_tmp.card[2] = c3; item_tmp.card[3] = c4; if ((flag = pc_additem(sd, &item_tmp, get_count))) clif_additem(sd, 0, 0, flag); } //Logs (A)dmins items [Lupus] if(log_config.pick > 0 ) { log_pick(sd, "A", 0, item_tmp.nameid, number, &item_tmp); } //Logs clif_displaymessage(fd, msg_table[18]); // Item created. } else { clif_displaymessage(fd, msg_table[19]); // Invalid item ID or name. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_itemreset( const int fd, struct map_session_data* sd, const char* command, const char* message) { int i; nullpo_retr(-1, sd); for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) { //Logs (A)dmins items [Lupus] if(log_config.pick > 0 ) { log_pick(sd, "A", 0, sd->status.inventory[i].nameid, -sd->status.inventory[i].amount, &sd->status.inventory[i]); } //Logs pc_delitem(sd, i, sd->status.inventory[i].amount, 0); } } clif_displaymessage(fd, msg_table[20]); // All of your items have been removed. return 0; } /*========================================== * *------------------------------------------ */ int atcommand_itemcheck( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); pc_checkitem(sd); return 0; } /*========================================== * Atcommand @lvlup *------------------------------------------ */ int atcommand_baselevelup( const int fd, struct map_session_data* sd, const char* command, const char* message) { int level=0, i=0; nullpo_retr(-1, sd); level = atoi(message); if (!message || !*message || !level) { clif_displaymessage(fd, "Please, enter a level adjustement (usage: @lvup/@blevel/@baselvlup )."); return -1; } if (level > 0) { if (sd->status.base_level == pc_maxbaselv(sd)) { /* check for max level by Valaris */ clif_displaymessage(fd, msg_table[47]); /* Base level can't go any higher. */ return -1; } /* End Addition */ if (level > pc_maxbaselv(sd) || level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow level = pc_maxbaselv(sd) - sd->status.base_level; for (i = 1; i <= level; i++) sd->status.status_point += (sd->status.base_level + i + 14) / 5; sd->status.base_level += level; clif_updatestatus(sd, SP_BASELEVEL); clif_updatestatus(sd, SP_NEXTBASEEXP); clif_updatestatus(sd, SP_STATUSPOINT); status_calc_pc(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); clif_misceffect(&sd->bl, 0); clif_displaymessage(fd, msg_table[21]); /* Base level raised. */ } else { if (sd->status.base_level == 1) { clif_displaymessage(fd, msg_table[158]); /* Base level can't go any lower. */ return -1; } level*=-1; if (level >= sd->status.base_level) level = sd->status.base_level-1; if (sd->status.status_point > 0) { for (i = 0; i > -level; i--) sd->status.status_point -= (sd->status.base_level + i + 14) / 5; if (sd->status.status_point < 0) sd->status.status_point = 0; clif_updatestatus(sd, SP_STATUSPOINT); } /* to add: remove status points from stats */ sd->status.base_level += level; clif_updatestatus(sd, SP_BASELEVEL); clif_updatestatus(sd, SP_NEXTBASEEXP); status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[22]); /* Base level lowered. */ } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_joblevelup( const int fd, struct map_session_data* sd, const char* command, const char* message) { int level=0; nullpo_retr(-1, sd); level = atoi(message); if (!message || !*message || !level) { clif_displaymessage(fd, "Please, enter a level adjustement (usage: @joblvup/@jlevel/@joblvlup )."); return -1; } if (level > 0) { if (sd->status.job_level == pc_maxjoblv(sd)) { clif_displaymessage(fd, msg_table[23]); // Job level can't go any higher. return -1; } if (level > pc_maxjoblv(sd) || level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow level = pc_maxjoblv(sd) - sd->status.job_level; sd->status.job_level += level; clif_updatestatus(sd, SP_JOBLEVEL); clif_updatestatus(sd, SP_NEXTJOBEXP); sd->status.skill_point += level; clif_updatestatus(sd, SP_SKILLPOINT); status_calc_pc(sd, 0); clif_misceffect(&sd->bl, 1); clif_displaymessage(fd, msg_table[24]); // Job level raised. } else { if (sd->status.job_level == 1) { clif_displaymessage(fd, msg_table[159]); // Job level can't go any lower. return -1; } level *=-1; if (level >= sd->status.job_level) // fix negativ overflow level = sd->status.job_level-1; sd->status.job_level -= level; clif_updatestatus(sd, SP_JOBLEVEL); clif_updatestatus(sd, SP_NEXTJOBEXP); if (sd->status.skill_point < level) pc_resetskill(sd,0); //Reset skills since we need to substract more points. sd->status.skill_point -= level; if (sd->status.skill_point < 0) sd->status.skill_point = 0; clif_updatestatus(sd, SP_SKILLPOINT); status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[25]); // Job level lowered. } return 0; } /*========================================== * @help *------------------------------------------ */ int atcommand_help( const int fd, struct map_session_data* sd, const char* command, const char* message) { char buf[2048], w1[2048], w2[2048]; int i, gm_level; FILE* fp; nullpo_retr(-1, sd); memset(buf, '\0', sizeof(buf)); if ((fp = fopen(help_txt, "r")) != NULL) { clif_displaymessage(fd, msg_table[26]); /* Help commands: */ gm_level = pc_isGM(sd); while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { if (buf[i] == '\r' || buf[i] == '\n') { buf[i] = '\0'; break; } } if (sscanf(buf, "%2047[^:]:%2047[^\n]", w1, w2) < 2) clif_displaymessage(fd, buf); else if (gm_level >= atoi(w1)) clif_displaymessage(fd, w2); } fclose(fp); } else { clif_displaymessage(fd, msg_table[27]); /* File help.txt not found. */ return -1; } return 0; } /*========================================== * @help2 - Char commands [Kayla] *------------------------------------------ */ int atcommand_help2( const int fd, struct map_session_data* sd, const char* command, const char* message) { char buf[2048], w1[2048], w2[2048]; int i, gm_level; FILE* fp; nullpo_retr(-1, sd); memset(buf, '\0', sizeof(buf)); if ((fp = fopen(help2_txt, "r")) != NULL) { clif_displaymessage(fd, msg_table[26]); /* Help commands: */ gm_level = pc_isGM(sd); while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') continue; for (i = 0; buf[i] != '\0'; i++) { if (buf[i] == '\r' || buf[i] == '\n') { buf[i] = '\0'; break; } } if (sscanf(buf, "%2047[^:]:%2047[^\n]", w1, w2) < 2) clif_displaymessage(fd, buf); else if (gm_level >= atoi(w1)) clif_displaymessage(fd, w2); } fclose(fp); } else { clif_displaymessage(fd, msg_table[27]); /* File help.txt not found. */ return -1; } return 0; } /*========================================== * @gm *------------------------------------------ */ int atcommand_gm( const int fd, struct map_session_data* sd, const char* command, const char* message) { char password[100]; nullpo_retr(-1, sd); memset(password, '\0', sizeof(password)); if (!message || !*message || sscanf(message, "%99[^\n]", password) < 1) { clif_displaymessage(fd, "Please, enter a password (usage: @gm )."); return -1; } if (pc_isGM(sd)) { /* a GM can not use this function. only a normal player (become gm is not for gm!) */ clif_displaymessage(fd, msg_table[50]); /* You already have some GM powers. */ return -1; } else chrif_changegm(sd->status.account_id, password, strlen(password) + 1); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_pvpoff( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i, users; nullpo_retr(-1, sd); if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] clif_displaymessage(fd, msg_table[52]); // This option cannot be used in PK Mode. return -1; } if (map[sd->bl.m].flag.pvp) { map[sd->bl.m].flag.pvp = 0; clif_send0199(sd->bl.m, 0); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { //人数分ループ if ((pl_sd = pl_allsd[i]) && sd->bl.m == pl_sd->bl.m) { clif_pvpset(pl_sd, 0, 0, 2); if (pl_sd->pvp_timer != -1) { delete_timer(pl_sd->pvp_timer, pc_calc_pvprank_timer); pl_sd->pvp_timer = -1; } } } clif_displaymessage(fd, msg_table[31]); // PvP: Off. } else { clif_displaymessage(fd, msg_table[160]); // PvP is already Off. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_pvpon( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd, **pl_allsd; int i, users; nullpo_retr(-1, sd); if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] clif_displaymessage(fd, msg_table[52]); // This option cannot be used in PK Mode. return -1; } if (!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.nopvp) { map[sd->bl.m].flag.pvp = 1; clif_send0199(sd->bl.m, 1); pl_allsd = map_getallusers(&users); for (i = 0; i < users; i++) { if ((pl_sd = pl_allsd[i]) && sd->bl.m == pl_sd->bl.m && pl_sd->pvp_timer == -1) { pl_sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, pl_sd->bl.id, 0); pl_sd->pvp_rank = 0; pl_sd->pvp_lastusers = 0; pl_sd->pvp_point = 5; pl_sd->pvp_won = 0; pl_sd->pvp_lost = 0; } } clif_displaymessage(fd, msg_table[32]); // PvP: On. } else { clif_displaymessage(fd, msg_table[161]); // PvP is already On. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_gvgoff( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (map[sd->bl.m].flag.gvg) { map[sd->bl.m].flag.gvg = 0; clif_send0199(sd->bl.m, 0); clif_displaymessage(fd, msg_table[33]); // GvG: Off. } else { clif_displaymessage(fd, msg_table[162]); // GvG is already Off. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_gvgon( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (!map[sd->bl.m].flag.gvg) { map[sd->bl.m].flag.gvg = 1; clif_send0199(sd->bl.m, 3); clif_displaymessage(fd, msg_table[34]); // GvG: On. } else { clif_displaymessage(fd, msg_table[163]); // GvG is already On. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_model( const int fd, struct map_session_data* sd, const char* command, const char* message) { int hair_style = 0, hair_color = 0, cloth_color = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d %d %d", &hair_style, &hair_color, &cloth_color) < 1) { sprintf(atcmd_output, "Please, enter at least a value (usage: @model ).", MIN_HAIR_STYLE, MAX_HAIR_STYLE, MIN_HAIR_COLOR, MAX_HAIR_COLOR, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); clif_displaymessage(fd, atcmd_output); return -1; } if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE && hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { /* Removed because this check is TOO strange. [Skotlex] //秒フ色変更 if (cloth_color != 0 && sd->status.sex == 1 && (sd->status.class_ == JOB_ASSASSIN || sd->status.class_ == JOB_ROGUE)) { //The hell? Why Rogue/Assassins can't... change their option if they have clothes colors and are males? o.O [Skotlex] //秒フ色未実装職の判定 clif_displaymessage(fd, msg_table[35]); // You can't use this command with this class. return -1; } else { */ pc_changelook(sd, LOOK_HAIR, hair_style); pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); clif_displaymessage(fd, msg_table[36]); // Appearence changed. // } } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } return 0; } /*========================================== * @dye && @ccolor *------------------------------------------ */ int atcommand_dye(const int fd, struct map_session_data* sd, const char* command, const char* message) { int cloth_color = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &cloth_color) < 1) { sprintf(atcmd_output, "Please, enter a clothes color (usage: @dye/@ccolor ).", MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); clif_displaymessage(fd, atcmd_output); return -1; } if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); clif_displaymessage(fd, msg_table[36]); // Appearence changed. } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } return 0; } /*========================================== * @hairstyle && @hstyle *------------------------------------------ */ int atcommand_hair_style(const int fd, struct map_session_data* sd, const char* command, const char* message) { int hair_style = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &hair_style) < 1) { sprintf(atcmd_output, "Please, enter a hair style (usage: @hairstyle/@hstyle ).", MIN_HAIR_STYLE, MAX_HAIR_STYLE); clif_displaymessage(fd, atcmd_output); return -1; } if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) { /* Removed because this check is TOO strange. [Skotlex] if (hair_style != 0 && sd->status.sex == 1 && (sd->status.class_ == JOB_ASSASSIN || sd->status.class_ == JOB_ROGUE)) { //??? clif_displaymessage(fd, msg_table[35]); // You can't use this command with this class. return -1; } else { */ pc_changelook(sd, LOOK_HAIR, hair_style); clif_displaymessage(fd, msg_table[36]); // Appearence changed. // } } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } return 0; } /*========================================== * @charhairstyle by [MouseJstr] *------------------------------------------ */ int atcommand_charhairstyle(const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); return 0; } /*========================================== * @haircolor && @hcolor *------------------------------------------ */ int atcommand_hair_color(const int fd, struct map_session_data* sd, const char* command, const char* message) { int hair_color = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &hair_color) < 1) { sprintf(atcmd_output, "Please, enter a hair color (usage: @haircolor/@hcolor ).", MIN_HAIR_COLOR, MAX_HAIR_COLOR); clif_displaymessage(fd, atcmd_output); return -1; } if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) { /* Removed for being such a strange check. [Skotlex] if (hair_color != 0 && sd->status.sex == 1 && (sd->status.class_ == JOB_ASSASSIN || sd->status.class_ == JOB_ROGUE)) { clif_displaymessage(fd, msg_table[35]); // You can't use this command with this class. return -1; } else { */ pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); clif_displaymessage(fd, msg_table[36]); // Appearence changed. // } } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } return 0; } /*========================================== * @go [city_number or city_name] - Updated by Harbin *------------------------------------------ */ int atcommand_go( const int fd, struct map_session_data* sd, const char* command, const char* message) { int i; int town; char map_name[MAP_NAME_LENGTH]; int m; const struct { char map[MAP_NAME_LENGTH]; int x, y; } data[] = { { MAP_PRONTERA, 156, 191 }, // 0=Prontera { MAP_MORROC, 156, 93 }, // 1=Morroc { MAP_GEFFEN, 119, 59 }, // 2=Geffen { MAP_PAYON, 162, 233 }, // 3=Payon { MAP_ALBERTA, 192, 147 }, // 4=Alberta { MAP_IZLUDE, 128, 114 }, // 5=Izlude { MAP_ALDEBARAN, 140, 131 }, // 6=Al de Baran { MAP_LUTIE, 147, 134 }, // 7=Lutie { MAP_COMODO, 209, 143 }, // 8=Comodo { MAP_YUNO, 157, 51 }, // 9=Yuno { MAP_AMATSU, 198, 84 }, // 10=Amatsu { MAP_GONRYUN, 160, 120 }, // 11=Gon Ryun { MAP_UMBALA, 89, 157 }, // 12=Umbala { MAP_NIFLHEIM, 21, 153 }, // 13=Niflheim { MAP_LOUYANG, 217, 40 }, // 14=Lou Yang { "new_1-1.gat", 53, 111 }, // 15=Training Grounds { MAP_JAIL, 23, 61 }, // 16=Prison { MAP_JAWAII, 249, 127 }, // 17=Jawaii { MAP_AYOTHAYA, 151, 117 }, // 18=Ayothaya { MAP_EINBROCH, 64, 200 }, // 19=Einbroch { MAP_LIGHTHALZEN, 158, 92 }, // 20=Lighthalzen { MAP_EINBECH, 70, 95 }, // 21=Einbech { MAP_HUGEL, 96, 145 }, // 22=Hugel }; nullpo_retr(-1, sd); if(map[sd->bl.m].flag.nogo) { clif_displaymessage(sd->fd,"You can not use @go on this map."); return 0; } memset(map_name, '\0', sizeof(map_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); // get the number town = atoi(message); // if no value, display all value if (!message || !*message || sscanf(message, "%15s", map_name) < 1 || town < -3 || town >= (int)(sizeof(data) / sizeof(data[0]))) { clif_displaymessage(fd, msg_table[38]); // Invalid location number or name. clif_displaymessage(fd, msg_table[82]); // Please, use one of this number/name: clif_displaymessage(fd, " 0=Prontera 1=Morroc 2=Geffen"); clif_displaymessage(fd, " 3=Payon 4=Alberta 5=Izlude"); clif_displaymessage(fd, " 6=Al De Baran 7=Lutie 8=Comodo"); clif_displaymessage(fd, " 9=Yuno 10=Amatsu 11=Gon Ryun"); clif_displaymessage(fd, " 12=Umbala 13=Niflheim 14=Lou Yang"); clif_displaymessage(fd, " 15=Novice Grounds 16=Prison 17=Jawaii"); clif_displaymessage(fd, " 18=Ayothaya 19=Einbroch 20=Lighthalzen"); clif_displaymessage(fd, " 21=Einbech 22=Hugel"); return -1; } else { // get possible name of the city and add .gat if not in the name map_name[MAP_NAME_LENGTH-1] = '\0'; for (i = 0; map_name[i]; i++) map_name[i] = tolower(map_name[i]); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); // try to see if it's a name, and not a number (try a lot of possibilities, write errors and abbreviations too) if (strncmp(map_name, "prontera.gat", 3) == 0) { // 3 first characters town = 0; } else if (strncmp(map_name, "morocc.gat", 3) == 0) { // 3 first characters town = 1; } else if (strncmp(map_name, "geffen.gat", 3) == 0) { // 3 first characters town = 2; } else if (strncmp(map_name, "payon.gat", 3) == 0 || // 3 first characters strncmp(map_name, "paion.gat", 3) == 0) { // writing error (3 first characters) town = 3; } else if (strncmp(map_name, "alberta.gat", 3) == 0) { // 3 first characters town = 4; } else if (strncmp(map_name, "izlude.gat", 3) == 0 || // 3 first characters strncmp(map_name, "islude.gat", 3) == 0) { // writing error (3 first characters) town = 5; } else if (strncmp(map_name, "aldebaran.gat", 3) == 0 || // 3 first characters strcmp(map_name, "al.gat") == 0) { // al (de baran) town = 6; } else if (strncmp(map_name, "lutie.gat", 3) == 0 || // name of the city, not name of the map (3 first characters) strcmp(map_name, "christmas.gat") == 0 || // name of the symbol strncmp(map_name, "xmas.gat", 3) == 0 || // 3 first characters strncmp(map_name, "x-mas.gat", 3) == 0) { // writing error (3 first characters) town = 7; } else if (strncmp(map_name, "comodo.gat", 3) == 0) { // 3 first characters town = 8; } else if (strncmp(map_name, "yuno.gat", 3) == 0) { // 3 first characters town = 9; } else if (strncmp(map_name, "amatsu.gat", 3) == 0 || // 3 first characters strncmp(map_name, "ammatsu.gat", 3) == 0) { // writing error (3 first characters) town = 10; } else if (strncmp(map_name, "gonryun.gat", 3) == 0) { // 3 first characters town = 11; } else if (strncmp(map_name, "umbala.gat", 3) == 0) { // 3 first characters town = 12; } else if (strncmp(map_name, "niflheim.gat", 3) == 0) { // 3 first characters town = 13; } else if (strncmp(map_name, "louyang.gat", 3) == 0) { // 3 first characters town = 14; } else if (strncmp(map_name, "new_1-1.gat", 3) == 0 || // 3 first characters (or "newbies") strncmp(map_name, "startpoint.gat", 3) == 0 || // name of the position (3 first characters) strncmp(map_name, "begining.gat", 3) == 0) { // name of the position (3 first characters) town = 15; } else if (strncmp(map_name, "sec_pri.gat", 3) == 0 || // 3 first characters strncmp(map_name, "prison.gat", 3) == 0 || // name of the position (3 first characters) strncmp(map_name, "jails.gat", 3) == 0) { // name of the position town = 16; } else if (strncmp(map_name, "jawaii.gat", 3) == 0 || // 3 first characters strncmp(map_name, "jawai.gat", 3) == 0) { // writing error (3 first characters) town = 17; } else if (strncmp(map_name, "ayothaya.gat", 2) == 0 || // 2 first characters strncmp(map_name, "ayotaya.gat", 2) == 0) { // writing error (2 first characters) town = 18; } else if (strncmp(map_name, "einbroch.gat", 3) == 0 || // 3 first characters strncmp(map_name, "ainbroch.gat", 3) == 0) { // writing error (3 first characters) town = 19; } else if (strncmp(map_name, "lighthalzen.gat", 3) == 0 || // 3 first characters strncmp(map_name, "reichthalzen.gat", 3) == 0) { // 'alternative' name (3 first characters) town = 20; } else if (strncmp(map_name, "einbech.gat", 5) == 0) { // 5 first characters town = 21; } else if (strncmp(map_name, "hugel.gat", 3) == 0) { // 3 first characters town = 22; } if (town >= -3 && town <= -1) { if (sd->status.memo_point[-town-1].map) { m = map_mapindex2mapid(sd->status.memo_point[-town-1].map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, sd->status.memo_point[-town-1].map, sd->status.memo_point[-town-1].x, sd->status.memo_point[-town-1].y, 3) == 0) { clif_displaymessage(fd, msg_table[0]); // Warped. } else { clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } } else { sprintf(atcmd_output, msg_table[164], -town-1); // Your memo point #%d doesn't exist. clif_displaymessage(fd, atcmd_output); return -1; } } else if (town >= 0 && town < (int)(sizeof(data) / sizeof(data[0]))) { m = map_mapname2mapid((char *)data[town].map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, mapindex_name2id((char *)data[town].map), data[town].x, data[town].y, 3) == 0) { clif_displaymessage(fd, msg_table[0]); // Warped. } else { clif_displaymessage(fd, msg_table[1]); // Map not found. return -1; } } else { // if you arrive here, you have an error in town variable when reading of names clif_displaymessage(fd, msg_table[38]); // Invalid location number or name. return -1; } } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_monster( const int fd, struct map_session_data* sd, const char* command, const char* message) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; int mob_id; int number = 0; int x = 0, y = 0; int count; int i, j, k; int mx, my, range; nullpo_retr(-1, sd); memset(name, '\0', sizeof(name)); memset(monster, '\0', sizeof(monster)); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { clif_displaymessage(fd, msg_table[80]); // Give a display name and monster name/id please. return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %d %d %d", name, monster, &number, &x, &y) > 1 || sscanf(message, "%23s \"%23[^\"]\" %d %d %d", monster, name, &number, &x, &y) > 1) { //All data can be left as it is. } else if ((count=sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y)) > 1) { //Here, it is possible name was not given and we are using monster for it. if (count < 3) //Blank mob's name. name[0] = '\0'; } else if (sscanf(message, "%23s %23s %d %d %d", name, monster, &number, &x, &y) > 1) { //All data can be left as it is. } else if (sscanf(message, "%23s", monster) > 0) { //As before, name may be already filled. name[0] = '\0'; } else { clif_displaymessage(fd, msg_table[80]); // Give a display name and monster name/id please. return -1; } if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = mobdb_checkid(atoi(monster)); if (mob_id == 0) { clif_displaymessage(fd, msg_table[40]); // Invalid monster ID or name. return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_table[83]); // Cannot spawn emperium. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, x, y); count = 0; range = (int)sqrt(number) / 2; range = range * 2 + 5; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { j = 0; k = 0; while(j++ < 8 && k == 0) { // try 8 times to spawn the monster (needed for close area) if (x <= 0) mx = sd->bl.x + (rand() % range - (range / 2)); else mx = x; if (y <= 0) my = sd->bl.y + (rand() % range - (range / 2)); else my = y; k = mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id, 1, ""); } count += (k != 0) ? 1 : 0; } if (count != 0) if (number == count) clif_displaymessage(fd, msg_table[39]); // All monster summoned! else { sprintf(atcmd_output, msg_table[240], count); // %d monster(s) summoned! clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_table[40]); // Invalid monster ID or name. return -1; } return 0; } // small monster spawning [Valaris] int atcommand_monstersmall( const int fd, struct map_session_data* sd, const char* command, const char* message) { char name[NAME_LENGTH] = ""; char monster[NAME_LENGTH] = ""; int mob_id = 0; int number = 0; int x = 0; int y = 0; int count; int i; nullpo_retr(-1, sd); if (!message || !*message) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %d %d %d", name, monster, &number, &x, &y) < 2 && sscanf(message, "%23s \"%23[^\"]\" %d %d %d", monster, name, &number, &x, &y) < 2 && sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } // If monster identifier/name argument is a name if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(monster); if (mob_id == 0) { clif_displaymessage(fd, msg_table[40]); return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_table[83]); return -1; } if (mobdb_checkid(mob_id) == 0) { clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; count = 0; for (i = 0; i < number; i++) { int mx, my; if (x <= 0) mx = sd->bl.x + (rand() % 11 - 5); else mx = x; if (y <= 0) my = sd->bl.y + (rand() % 11 - 5); else my = y; count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id+MAX_MOB_DB, 1, "") != 0) ? 1 : 0; } if (count != 0) clif_displaymessage(fd, msg_table[39]); // Monster Summoned!! else clif_displaymessage(fd, msg_table[40]); // Invalid Monster ID. return 0; } // big monster spawning [Valaris] int atcommand_monsterbig( const int fd, struct map_session_data* sd, const char* command, const char* message) { char name[NAME_LENGTH] = ""; char monster[NAME_LENGTH] = ""; int mob_id = 0; int number = 0; int x = 0; int y = 0; int count; int i; nullpo_retr(-1, sd); if (!message || !*message) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %d %d %d", name, monster, &number, &x, &y) < 2 && sscanf(message, "%23s \"%23[^\"]\" %d %d %d", monster, name, &number, &x, &y) < 2 && sscanf(message, "%23s %d %23s %d %d", monster, &number, name, &x, &y) < 1) { clif_displaymessage(fd, "Give a monster name/id please."); return -1; } // If monster identifier/name argument is a name if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(monster); if (mob_id == 0) { clif_displaymessage(fd, msg_table[40]); return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_table[83]); return -1; } if (mobdb_checkid(mob_id) == 0) { clif_displaymessage(fd, "Invalid monster ID"); // Invalid Monster ID. return -1; } if (number <= 0) number = 1; if (strlen(name) < 1) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit >= 1 && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; count = 0; for (i = 0; i < number; i++) { int mx, my; if (x <= 0) mx = sd->bl.x + (rand() % 11 - 5); else mx = x; if (y <= 0) my = sd->bl.y + (rand() % 11 - 5); else my = y; count += (mob_once_spawn((struct map_session_data*)sd, "this", mx, my, name, mob_id+2*MAX_MOB_DB, 1, "") != 0) ? 1 : 0; } if (count != 0) clif_displaymessage(fd, msg_table[39]); // Monster Summoned!! else clif_displaymessage(fd, msg_table[40]); // Invalid Monster ID. return 0; } /*========================================== * *------------------------------------------ */ static int atkillmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md; int flag; nullpo_retr(0, ap); nullpo_retr(0, md=(struct mob_data *)bl); flag = va_arg(ap, int); if (flag) mob_damage(NULL, md, md->hp, 2); else mob_delete(md); return 0; } void atcommand_killmonster_sub( const int fd, struct map_session_data* sd, const char* message, const int drop) { int map_id; char map_name[MAP_NAME_LENGTH]; if (!sd) return; memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; else { if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, drop); clif_displaymessage(fd, msg_table[165]); // All monsters killed! return; } /*========================================== * *------------------------------------------ */ int atcommand_killmonster( const int fd, struct map_session_data* sd, const char* command, const char* message) { if (!sd) return 0; atcommand_killmonster_sub(fd, sd, message, 1); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_killmonster2( const int fd, struct map_session_data* sd, const char* command, const char* message) { if (!sd) return 0; atcommand_killmonster_sub(fd, sd, message, 0); return 0; } /*========================================== * *------------------------------------------ */ int atcommand_refine( const int fd, struct map_session_data* sd, const char* command, const char* message) { int i, position = 0, refine = 0, current_position, final_refine; int count; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { clif_displaymessage(fd, "Please, enter a position and a amount (usage: @refine <+/- amount>)."); return -1; } if (refine < -10) refine = -10; else if (refine > 10) refine = 10; else if (refine == 0) refine = 1; count = 0; for (i = 0; i < MAX_INVENTORY; i++) { if (sd->status.inventory[i].nameid && // 該当個所の装備を精錬する (sd->status.inventory[i].equip & position || (sd->status.inventory[i].equip && !position))) { final_refine = sd->status.inventory[i].refine + refine; if (final_refine > 10) final_refine = 10; else if (final_refine < 0) final_refine = 0; if (sd->status.inventory[i].refine != final_refine) { sd->status.inventory[i].refine = final_refine; current_position = sd->status.inventory[i].equip; pc_unequipitem(sd, i, 3); clif_refine(fd, sd, 0, i, sd->status.inventory[i].refine); clif_delitem(sd, i, 1); clif_additem(sd, i, 1, 0); pc_equipitem(sd, i, current_position); clif_misceffect((struct block_list*)&sd->bl, 3); count++; } } } if (count == 0) clif_displaymessage(fd, msg_table[166]); // No item has been refined! else if (count == 1) clif_displaymessage(fd, msg_table[167]); // 1 item has been refined! else { sprintf(atcmd_output, msg_table[168], count); // %d items have been refined! clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_produce( const int fd, struct map_session_data* sd, const char* command, const char* message) { char item_name[100]; int item_id, attribute = 0, star = 0; int flag = 0; struct item_data *item_data; struct item tmp_item; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1) { clif_displaymessage(fd, "Please, enter at least an item name/id (usage: @produce <# of very's>)."); return -1; } item_id = 0; if ((item_data = itemdb_searchname(item_name)) != NULL || (item_data = itemdb_exists(atoi(item_name))) != NULL) item_id = item_data->nameid; if (itemdb_exists(item_id) && (item_id <= 500 || item_id > 1099) && (item_id < 4001 || item_id > 4148) && (item_id < 7001 || item_id > 10019) && itemdb_isequip(item_id)) { if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE) attribute = ATTRIBUTE_NORMAL; if (star < MIN_STAR || star > MAX_STAR) star = 0; memset(&tmp_item, 0, sizeof tmp_item); tmp_item.nameid = item_id; tmp_item.amount = 1; tmp_item.identify = 1; tmp_item.card[0] = 0x00ff; tmp_item.card[1] = ((star * 5) << 8) + attribute; tmp_item.card[2] = GetWord(sd->char_id, 0); tmp_item.card[3] = GetWord(sd->char_id, 1); clif_produceeffect(sd, 0, item_id); // 製造エフェクトパケット clif_misceffect(&sd->bl, 3); // 他人にも成功を通知 //Logs (A)dmins items [Lupus] if(log_config.pick > 0 ) { log_pick(sd, "A", 0, tmp_item.nameid, 1, &tmp_item); } //Logs if ((flag = pc_additem(sd, &tmp_item, 1))) clif_additem(sd, 0, 0, flag); } else { if (battle_config.error_log) ShowError("@produce NOT WEAPON [%d]\n", item_id); if (item_id != 0 && itemdb_exists(item_id)) sprintf(atcmd_output, msg_table[169], item_id, item_data->name); // This item (%d: '%s') is not an equipment. else sprintf(atcmd_output, msg_table[170]); // This item is not an equipment. clif_displaymessage(fd, atcmd_output); return -1; } return 0; } /*========================================== * Sub-function to display actual memo points *------------------------------------------ */ void atcommand_memo_sub(struct map_session_data* sd) { int i; if (!sd) return; memset(atcmd_output, '\0', sizeof(atcmd_output)); clif_displaymessage(sd->fd, "Your actual memo positions are (except respawn point):"); for (i = MIN_PORTAL_MEMO; i <= MAX_PORTAL_MEMO; i++) { if (sd->status.memo_point[i].map) sprintf(atcmd_output, "%d - %s (%d,%d)", i, mapindex_id2name(sd->status.memo_point[i].map), sd->status.memo_point[i].x, sd->status.memo_point[i].y); else sprintf(atcmd_output, msg_table[171], i); // %d - void clif_displaymessage(sd->fd, atcmd_output); } return; } /*========================================== * *------------------------------------------ */ int atcommand_memo( const int fd, struct map_session_data* sd, const char* command, const char* message) { int position = 0; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &position) < 1) atcommand_memo_sub(sd); else { if (position >= MIN_PORTAL_MEMO && position <= MAX_PORTAL_MEMO) { if (sd->bl.m >= 0 && (map[sd->bl.m].flag.nowarpto || map[sd->bl.m].flag.nomemo) && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, msg_table[253]); return -1; } if (sd->status.memo_point[position].map) { sprintf(atcmd_output, msg_table[172], position, mapindex_id2name(sd->status.memo_point[position].map), sd->status.memo_point[position].x, sd->status.memo_point[position].y); // You replace previous memo position %d - %s (%d,%d). clif_displaymessage(fd, atcmd_output); } sd->status.memo_point[position].map = map[sd->bl.m].index; sd->status.memo_point[position].x = sd->bl.x; sd->status.memo_point[position].y = sd->bl.y; clif_skill_memo(sd, 0); if (pc_checkskill(sd, AL_WARP) <= (position + 1)) clif_displaymessage(fd, msg_table[173]); // Note: you don't have the 'Warp' skill level to use it. atcommand_memo_sub(sd); } else { sprintf(atcmd_output, "Please, enter a valid position (usage: @memo ).", MIN_PORTAL_MEMO, MAX_PORTAL_MEMO); clif_displaymessage(fd, atcmd_output); atcommand_memo_sub(sd); return -1; } } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_gat( const int fd, struct map_session_data* sd, const char* command, const char* message) { int y; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); for (y = 2; y >= -2; y--) { sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", map[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y, map_getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE), map_getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE), map_getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE), map_getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE), map_getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE)); clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_packet( const int fd, struct map_session_data* sd, const char* command, const char* message) { static int packet_mode = 0; int i, x = 0, y = 0; nullpo_retr(-1, sd); if (strstr(command, "packetmode")) { packet_mode = atoi(message); clif_displaymessage(fd, "Packet mode changed."); return 0; } if (!message || !*message || (i = sscanf(message, "%d %d", &x, &y)) < 1) { clif_displaymessage(fd, "Please, enter a status type/flag (usage: @packet )."); return -1; } if (i == 1) y = 1; switch (packet_mode) { case 0: clif_status_change(&sd->bl, x, y); break; case 1: sd->status.skill[sd->cloneskill_id].id=0; sd->status.skill[sd->cloneskill_id].lv=0; sd->status.skill[sd->cloneskill_id].flag=0; sd->cloneskill_id = x; sd->status.skill[x].id = x; sd->status.skill[x].lv = skill_get_max(x); sd->status.skill[x].flag = 13;//cloneskill flag clif_skillinfoblock(sd); break; case 2: clif_skill_nodamage(&sd->bl,&sd->bl,x,y,1); case 3: clif_skill_poseffect(&sd->bl,x,y,sd->bl.x,sd->bl.y,gettick()); default: break; //added later } return 0; } /*========================================== * @waterlevel [Skotlex] *------------------------------------------ */ int atcommand_waterlevel( const int fd, struct map_session_data* sd, const char* command, const char* message) { int newlevel; if (!message || !*message || sscanf(message, "%d", &newlevel) < 1) { sprintf(atcmd_output, "%s's current water level: %d", map[sd->bl.m].name, map_waterheight(map[sd->bl.m].name)); clif_displaymessage(fd, atcmd_output); return 0; } if (map_setwaterheight(sd->bl.m, map[sd->bl.m].name, newlevel)) { if (newlevel > 0) sprintf(atcmd_output, "%s's water level changed to: %d", map[sd->bl.m].name, newlevel); else sprintf(atcmd_output, "Removed %s's water level information.", map[sd->bl.m].name); clif_displaymessage(fd, atcmd_output); } else { sprintf(atcmd_output, "Failed to change %s's water level.", map[sd->bl.m].name); clif_displaymessage(fd, atcmd_output); } return 0; } /*========================================== * @stpoint (Rewritten by [Yor]) *------------------------------------------ */ int atcommand_statuspoint( const int fd, struct map_session_data* sd, const char* command, const char* message) { int point, new_status_point; if (!message || !*message || (point = atoi(message)) == 0) { clif_displaymessage(fd, "Please, enter a number (usage: @stpoint )."); return -1; } new_status_point = (int)sd->status.status_point + point; if (point > 0 && (point > 0x7FFF || new_status_point > 0x7FFF)) // fix positiv overflow new_status_point = 0x7FFF; else if (point < 0 && (point < -0x7FFF || new_status_point < 0)) // fix negativ overflow new_status_point = 0; if (new_status_point != (int)sd->status.status_point) { sd->status.status_point = (short)new_status_point; clif_updatestatus(sd, SP_STATUSPOINT); clif_displaymessage(fd, msg_table[174]); // Number of status points changed! } else { if (point < 0) clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. else clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. return -1; } return 0; } /*========================================== * @skpoint (Rewritten by [Yor]) *------------------------------------------ */ int atcommand_skillpoint( const int fd, struct map_session_data* sd, const char* command, const char* message) { int point, new_skill_point; nullpo_retr(-1, sd); if (!message || !*message || (point = atoi(message)) == 0) { clif_displaymessage(fd, "Please, enter a number (usage: @skpoint )."); return -1; } new_skill_point = (int)sd->status.skill_point + point; if (point > 0 && (point > 0x7FFF || new_skill_point > 0x7FFF)) // fix positiv overflow new_skill_point = 0x7FFF; else if (point < 0 && (point < -0x7FFF || new_skill_point < 0)) // fix negativ overflow new_skill_point = 0; if (new_skill_point != (int)sd->status.skill_point) { sd->status.skill_point = (short)new_skill_point; clif_updatestatus(sd, SP_SKILLPOINT); clif_displaymessage(fd, msg_table[175]); // Number of skill points changed! } else { if (point < 0) clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. else clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. return -1; } return 0; } /*========================================== * @zeny (Rewritten by [Yor]) *------------------------------------------ */ int atcommand_zeny( const int fd, struct map_session_data* sd, const char* command, const char* message) { int zeny, new_zeny; nullpo_retr(-1, sd); if (!message || !*message || (zeny = atoi(message)) == 0) { clif_displaymessage(fd, "Please, enter an amount (usage: @zeny )."); return -1; } new_zeny = sd->status.zeny + zeny; if (zeny > 0 && (zeny > MAX_ZENY || new_zeny > MAX_ZENY)) // fix positiv overflow new_zeny = MAX_ZENY; else if (zeny < 0 && (zeny < -MAX_ZENY || new_zeny < 0)) // fix negativ overflow new_zeny = 0; if (new_zeny != sd->status.zeny) { sd->status.zeny = new_zeny; clif_updatestatus(sd, SP_ZENY); clif_displaymessage(fd, msg_table[176]); // Number of zenys changed! } else { if (zeny < 0) clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. else clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_param( const int fd, struct map_session_data* sd, const char* command, const char* message) { int i, index, value = 0, new_value; const char* param[] = { "@str", "@agi", "@vit", "@int", "@dex", "@luk", NULL }; short* status[] = { &sd->status.str, &sd->status.agi, &sd->status.vit, &sd->status.int_, &sd->status.dex, &sd->status.luk }; nullpo_retr(-1, sd); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustement>)."); clif_displaymessage(fd, atcmd_output); return -1; } index = -1; for (i = 0; param[i] != NULL; i++) { if (strcmpi(command, param[i]) == 0) { index = i; break; } } if (index < 0 || index > MAX_STATUS_TYPE) { // normaly impossible... sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustement>)."); clif_displaymessage(fd, atcmd_output); return -1; } new_value = (int)*status[index] + value; if (value > 0 && (value > pc_maxparameter(sd) || new_value > pc_maxparameter(sd))) // fix positiv overflow new_value = pc_maxparameter(sd); else if (value < 0 && (value < -(int)pc_maxparameter(sd) || new_value < 1)) // fix negativ overflow new_value = 1; if (new_value != (int)*status[index]) { *status[index] = new_value; clif_updatestatus(sd, SP_STR + index); clif_updatestatus(sd, SP_USTR + index); status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[42]); // Stat changed. } else { if (value < 0) clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. else clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. return -1; } return 0; } /*========================================== * *------------------------------------------ */ //** Stat all by fritz (rewritten by [Yor]) int atcommand_stat_all( const int fd, struct map_session_data* sd, const char* command, const char* message) { int index, count, value = 0, new_value; short* status[] = { &sd->status.str, &sd->status.agi, &sd->status.vit, &sd->status.int_, &sd->status.dex, &sd->status.luk }; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) value = pc_maxparameter(sd); count = 0; for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) { new_value = (int)*status[index] + value; if (value > 0 && (value > pc_maxparameter(sd) || new_value > pc_maxparameter(sd))) // fix positiv overflow new_value = pc_maxparameter(sd); else if (value < 0 && (value < -(int)pc_maxparameter(sd) || new_value < 1)) // fix negative overflow new_value = 1; if (new_value != (int)*status[index]) { *status[index] = new_value; clif_updatestatus(sd, SP_STR + index); clif_updatestatus(sd, SP_USTR + index); status_calc_pc(sd, 0); count++; } } if (count > 0) // if at least 1 stat modified clif_displaymessage(fd, msg_table[84]); // All stats changed! else { if (value < 0) clif_displaymessage(fd, msg_table[177]); // Impossible to decrease a stat. else clif_displaymessage(fd, msg_table[178]); // Impossible to increase a stat. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_guildlevelup( const int fd, struct map_session_data* sd, const char* command, const char* message) { int level = 0; short added_level; struct guild *guild_info; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d", &level) < 1 || level == 0) { clif_displaymessage(fd, "Please, enter a valid level (usage: @guildlvup/@guildlvlup <# of levels>)."); return -1; } if (sd->status.guild_id <= 0 || (guild_info = guild_search(sd->status.guild_id)) == NULL) { clif_displaymessage(fd, msg_table[43]); // You're not in a guild. return -1; } if (strcmp(sd->status.name, guild_info->master) != 0) { clif_displaymessage(fd, msg_table[44]); // You're not the master of your guild. return -1; } added_level = (short)level; if (level > 0 && (level > MAX_GUILDLEVEL || added_level > ((short)MAX_GUILDLEVEL - guild_info->guild_lv))) // fix positiv overflow added_level = (short)MAX_GUILDLEVEL - guild_info->guild_lv; else if (level < 0 && (level < -MAX_GUILDLEVEL || added_level < (1 - guild_info->guild_lv))) // fix negativ overflow added_level = 1 - guild_info->guild_lv; if (added_level != 0) { intif_guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, 2); clif_displaymessage(fd, msg_table[179]); // Guild level changed. } else { clif_displaymessage(fd, msg_table[45]); // Guild level change failed. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_makeegg( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct item_data *item_data; int id, pet_id; nullpo_retr(-1, sd); if (!message || !*message) { clif_displaymessage(fd, "Please, enter a monter/egg name/id (usage: @makeegg )."); return -1; } if ((item_data = itemdb_searchname(message)) != NULL) // for egg name id = item_data->nameid; else if ((id = mobdb_searchname(message)) == 0) // for monster name id = atoi(message); pet_id = search_petDB_index(id, PET_CLASS); if (pet_id < 0) pet_id = search_petDB_index(id, PET_EGG); if (pet_id >= 0) { sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet( sd->status.account_id, sd->status.char_id, (short)pet_db[pet_id].class_, (short)mob_db(pet_db[pet_id].class_)->lv, (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); } else { clif_displaymessage(fd, msg_table[180]); // The monter/egg name/id doesn't exist. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_hatch( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (sd->status.pet_id <= 0) clif_sendegg(sd); else { clif_displaymessage(fd, msg_table[181]); // You already have a pet. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_petfriendly( const int fd, struct map_session_data* sd, const char* command, const char* message) { int friendly; int t; nullpo_retr(-1, sd); if (!message || !*message || (friendly = atoi(message)) < 0) { clif_displaymessage(fd, "Please, enter a valid value (usage: @petfriendly <0-1000>)."); return -1; } if (sd->status.pet_id > 0 && sd->pd) { if (friendly >= 0 && friendly <= 1000) { if (friendly != sd->pet.intimate) { t = sd->pet.intimate; sd->pet.intimate = friendly; clif_send_petstatus(sd); if (battle_config.pet_status_support) { if ((sd->pet.intimate > 0 && t <= 0) || (sd->pet.intimate <= 0 && t > 0)) { if (sd->bl.prev != NULL) status_calc_pc(sd, 0); else status_calc_pc(sd, 2); } } clif_displaymessage(fd, msg_table[182]); // Pet friendly value changed! } else { clif_displaymessage(fd, msg_table[183]); // Pet friendly is already the good value. return -1; } } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } } else { clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_pethungry( const int fd, struct map_session_data* sd, const char* command, const char* message) { int hungry; nullpo_retr(-1, sd); if (!message || !*message || (hungry = atoi(message)) < 0) { clif_displaymessage(fd, "Please, enter a valid number (usage: @pethungry <0-100>)."); return -1; } if (sd->status.pet_id > 0 && sd->pd) { if (hungry >= 0 && hungry <= 100) { if (hungry != sd->pet.hungry) { sd->pet.hungry = hungry; clif_send_petstatus(sd); clif_displaymessage(fd, msg_table[185]); // Pet hungry value changed! } else { clif_displaymessage(fd, msg_table[186]); // Pet hungry is already the good value. return -1; } } else { clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. return -1; } } else { clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_petrename( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); if (sd->status.pet_id > 0 && sd->pd) { if (sd->pet.rename_flag != 0) { sd->pet.rename_flag = 0; intif_save_petdata(sd->status.account_id, &sd->pet); clif_send_petstatus(sd); clif_displaymessage(fd, msg_table[187]); // You can now rename your pet. } else { clif_displaymessage(fd, msg_table[188]); // You can already rename your pet. return -1; } } else { clif_displaymessage(fd, msg_table[184]); // Sorry, but you have no pet. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_recall( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd = NULL; nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @recall )."); return -1; } memset(atcmd_player_name, '\0', sizeof atcmd_player_name); if(sscanf(message, "%23[^\n]", atcmd_player_name) < 1) return -1; if(strncmp(sd->status.name,atcmd_player_name,NAME_LENGTH)==0) return -1; if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can recall only lower or same level if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp somenone to your actual map."); return -1; } if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorized to warp this player from its actual map."); return -1; } pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2); sprintf(atcmd_output, msg_table[46], atcmd_player_name); // %s recalled! clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. return -1; } } else { clif_displaymessage(fd, msg_table[3]); // Character not found. return -1; } return 0; } /*========================================== * *------------------------------------------ */ int atcommand_revive( const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd; nullpo_retr(-1, sd); memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @revive )."); return -1; } if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { if (pc_isdead(pl_sd)) { pl_sd->status.hp = pl_sd->status.max_hp; clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); pc_setstand(pl_sd); if (battle_config.pc_invincible_time > 0) pc_setinvincibletimer(pl_sd, battle_config.pc_invincible_time); clif_updatestatus(pl_sd, SP_HP); clif_updatestatus(pl_sd, SP_SP); clif_resurrection(&pl_sd->bl, 1); clif_displaymessage(fd, msg_table[51]); // Character revived. return 0; } return -1; } else { clif_displaymessage(fd, msg_table[3]); // Character not found. return -1; } return 0; } /*========================================== * charblock command (usage: charblock ) * This command do a definitiv ban on a player *------------------------------------------ */ int atcommand_char_block( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); if (!message || !*message || sscanf(message, "%99[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @charblock/@block )."); return -1; } // check player name if (strlen(atcmd_player_name) < 4) { clif_displaymessage(fd, msg_table[86]); // Sorry, but a player name have at least 4 characters. return -1; } else if (strlen(atcmd_player_name) > 23) { clif_displaymessage(fd, msg_table[87]); // Sorry, but a player name have 23 characters maximum. return -1; } else { chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block clif_displaymessage(fd, msg_table[88]); // Character name sends to char-server to ask it. } return 0; } /*========================================== * charban command (usage: charban