diff options
author | DracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-17 00:17:15 +0000 |
---|---|---|
committer | DracoRPG <DracoRPG@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-17 00:17:15 +0000 |
commit | 069d63bc755e5a9335946eb70ba610956c307386 (patch) | |
tree | fee4369a71d481a44244289cd8c2e5d36eaad86b /src/map | |
parent | 1e3c956244764b331c8bf1fd89ada37eb4d505da (diff) | |
download | hercules-069d63bc755e5a9335946eb70ba610956c307386.tar.gz hercules-069d63bc755e5a9335946eb70ba610956c307386.tar.bz2 hercules-069d63bc755e5a9335946eb70ba610956c307386.tar.xz hercules-069d63bc755e5a9335946eb70ba610956c307386.zip |
Massive at+charcommand cleanup, big thanks to HiddenDragon
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10272 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 2425 | ||||
-rw-r--r-- | src/map/atcommand.h | 59 | ||||
-rw-r--r-- | src/map/charcommand.c | 3174 | ||||
-rw-r--r-- | src/map/charcommand.h | 56 |
4 files changed, 3718 insertions, 1996 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3f2c8ffea..b6fe0e20c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -64,7 +64,6 @@ ACMD_FUNC(whozeny); // [Valaris] ACMD_FUNC(save); ACMD_FUNC(load); ACMD_FUNC(speed); -ACMD_FUNC(charspeed); ACMD_FUNC(storage); ACMD_FUNC(guildstorage); ACMD_FUNC(option); @@ -99,7 +98,7 @@ ACMD_FUNC(refine); ACMD_FUNC(produce); ACMD_FUNC(memo); ACMD_FUNC(gat); -ACMD_FUNC(packet); +ACMD_FUNC(displaystatus); ACMD_FUNC(statuspoint); ACMD_FUNC(skillpoint); ACMD_FUNC(zeny); @@ -112,7 +111,6 @@ ACMD_FUNC(pethungry); ACMD_FUNC(petrename); ACMD_FUNC(recall); ACMD_FUNC(recallall); -ACMD_FUNC(revive); ACMD_FUNC(night); ACMD_FUNC(day); ACMD_FUNC(doom); @@ -151,7 +149,6 @@ 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] @@ -163,19 +160,14 @@ 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(jailfor); // Alias Meruru ACMD_FUNC(jailtime); // Coltaro -ACMD_FUNC(charjailtime); // Coltaro 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 @@ -183,14 +175,11 @@ 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(displayskill); // by MouseJstr +ACMD_FUNC(displayskill); //[Skotlex] ACMD_FUNC(summon); ACMD_FUNC(rain); ACMD_FUNC(snow); @@ -222,43 +211,14 @@ ACMD_FUNC(pettalk); ACMD_FUNC(users); ACMD_FUNC(reset); 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); @@ -266,12 +226,9 @@ ACMD_FUNC(changelook); ACMD_FUNC(mobinfo); //by Lupus ACMD_FUNC(exp); // by Skotlex ACMD_FUNC(adopt); // by Veider - ACMD_FUNC(version); // by Ancyker - ACMD_FUNC(mutearea); // by MouseJstr ACMD_FUNC(rates); // by MouseJstr - ACMD_FUNC(iteminfo); // Lupus ACMD_FUNC(whodrops); //Skotlex ACMD_FUNC(mapflag); // Lupus @@ -286,23 +243,19 @@ ACMD_FUNC(autotrade);// durf ACMD_FUNC(changeleader);// [Skotlex] ACMD_FUNC(partyoption);// [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] ACMD_FUNC(tonpc); // LuzZza ACMD_FUNC(commands); // [Skotlex] ACMD_FUNC(noask); //LuzZza ACMD_FUNC(request); //[Skotlex] - ACMD_FUNC(homlevel); //[orn] ACMD_FUNC(homevolution); //[orn] ACMD_FUNC(makehomun); //[orn] @@ -313,6 +266,21 @@ ACMD_FUNC(hominfo); //[Toms] ACMD_FUNC(homstats); //[Skotlex] ACMD_FUNC(homshuffle); //[Skotlex] ACMD_FUNC(showmobs); //KarLaeda +ACMD_FUNC(feelreset); //[HiddenDragon] +#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 +#ifdef DMALLOC +ACMD_FUNC(dmstart); // by MouseJstr +ACMD_FUNC(dmtick); // by MouseJstr +#endif /*========================================== *AtCommandInfo atcommand_info[] structure definition @@ -322,327 +290,302 @@ ACMD_FUNC(showmobs); //KarLaeda // 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_MapMove, "@mapmove", 40, atcommand_rura }, // /mm command - { 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_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_CharSpeed, "@charspeed", 40, atcommand_charspeed }, - { 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_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_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_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, "@serverdate", 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_JailFor, "@jailfor", 60, atcommand_jailfor }, //Meruru - { AtCommand_JailTime, "@jailtime", 1, atcommand_jailtime }, - { AtCommand_CharJailTime, "@charjailtime", 60, atcommand_charjailtime }, - { 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", 80, 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", 60, atcommand_chardropall }, // MouseJstr - { AtCommand_Storeall, "@storeall", 40, atcommand_storeall }, // MouseJstr - { AtCommand_Charstoreall, "@charstoreall", 60, atcommand_charstoreall }, // MouseJstr - { AtCommand_Skillid, "@skillid", 40, atcommand_skillid }, // MouseJstr - { AtCommand_Useskill, "@useskill", 40, atcommand_useskill }, // MouseJstr - { AtCommand_DisplaySkill, "@displayskill", 99, atcommand_displayskill }, // MouseJstr -// { AtCommand_Rain, "@rain", 99, atcommand_rain }, //Client no longer supports 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", 99, atcommand_send }, - { AtCommand_SetBattleFlag, "@setbattleflag", 99, atcommand_setbattleflag }, - { AtCommand_UnMute, "@unmute", 80, atcommand_unmute }, // [Valaris] - { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity - { AtCommand_UpTime, "@uptime", 1, atcommand_uptime }, // by MC Cameri - { AtCommand_ChangeSex, "@changesex", 60, atcommand_changesex }, // by MC Cameri - { AtCommand_Mute, "@mute", 80, atcommand_mute }, // [celest] - { AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [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, atcommand_reset }, - + { AtCommand_Rura, "@rura", 40, atcommand_rura }, + { AtCommand_Warp, "@warp", 40, atcommand_rura }, + { AtCommand_MapMove, "@mapmove", 40, atcommand_rura }, // /mm command + { 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_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_BaseLevelUp, "@baselvl", 60, atcommand_baselevelup }, + { AtCommand_BaseLevelUp, "@baselevel", 60, atcommand_baselevelup }, + { AtCommand_BaseLevelUp, "@blevel", 60, atcommand_baselevelup }, + { AtCommand_BaseLevelUp, "@blvl", 60, atcommand_baselevelup }, + { AtCommand_JobLevelUp, "@jlvl", 60, atcommand_joblevelup }, + { AtCommand_JobLevelUp, "@jlevel", 60, atcommand_joblevelup }, + { AtCommand_JobLevelUp, "@joblvl", 60, atcommand_joblevelup }, + { AtCommand_JobLevelUp, "@joblevel", 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 }, + { AtCommand_DisplayStatus, "@displaystatus", 99, atcommand_displaystatus }, + { 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, "@glvl", 60, atcommand_guildlevelup }, + { AtCommand_GuildLevelUp, "@glevel", 60, atcommand_guildlevelup }, + { AtCommand_GuildLevelUp, "@guildlvl", 60, atcommand_guildlevelup }, + { AtCommand_GuildLevelUp, "@guildlevel", 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_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_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, "@mount", 20, atcommand_mount_peco }, // by Valaris + { AtCommand_MountPeco, "@mountpeco", 20, atcommand_mount_peco }, // by Valaris + { 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, "@serverdate", 1, atcommand_servertime }, // by Yor + { AtCommand_ServerTime, "@servertime", 1, atcommand_servertime }, // 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_JailFor, "@jailfor", 60, atcommand_jailfor }, //Meruru + { AtCommand_JailTime, "@jailtime", 1, atcommand_jailtime }, //Change this to 0 in atcommand_conf.txt if you want it accessible to players (you most likely will ;)) + { AtCommand_Disguise, "@disguise", 20, atcommand_disguise }, // [Valaris] + { AtCommand_UnDisguise, "@undisguise", 20, atcommand_undisguise }, // by Yor + { AtCommand_EMail, "@email", 1, atcommand_email }, // by Yor + { AtCommand_Effect, "@effect", 40, atcommand_effect }, // by Apple + { 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", 80, atcommand_npcmove }, // by MouseJstr + { AtCommand_Killable, "@killable", 40, atcommand_killable }, // by MouseJstr + { AtCommand_Dropall, "@dropall", 40, atcommand_dropall }, // MouseJstr + { AtCommand_Storeall, "@storeall", 40, atcommand_storeall }, // MouseJstr + { AtCommand_Skillid, "@skillid", 40, atcommand_skillid }, // MouseJstr + { AtCommand_Useskill, "@useskill", 40, atcommand_useskill }, // MouseJstr + { 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", 99, atcommand_send }, + { AtCommand_SetBattleFlag, "@setbattleflag", 99, atcommand_setbattleflag }, + { AtCommand_UnMute, "@unmute", 80, atcommand_unmute }, // [Valaris] + { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity + { AtCommand_UpTime, "@uptime", 1, atcommand_uptime }, // by MC Cameri + { AtCommand_ChangeSex, "@changesex", 60, atcommand_changesex }, // by MC Cameri <- do we still need this? [Foruken] <- why not? [Skotlex] + { AtCommand_Mute, "@mute", 80, atcommand_mute }, // [celest] + { AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [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, atcommand_reset }, + { AtCommand_SkillTree, "@skilltree", 40, atcommand_skilltree }, // [MouseJstr] + { AtCommand_Marry, "@marry", 40, atcommand_marry }, // [MouseJstr] + { AtCommand_Divorce, "@divorce", 40, atcommand_divorce }, // [MouseJstr] + { AtCommand_JumpToId2, "@jumptoid2", 20, atcommand_jumptoid2 }, // [Dino9021] + { AtCommand_JumpToId2, "@warptoid2", 20, atcommand_jumptoid2 }, // [Dino9021] + { AtCommand_JumpToId2, "@gotoid2", 20, atcommand_jumptoid2 }, // [Dino9021] + { AtCommand_RecallId2, "@recallid2", 60, atcommand_recallid2 }, // [Dino9021] + { AtCommand_KickId2, "@kickid2", 99, atcommand_kickid2 }, // [Dino9021] + { AtCommand_ReviveId2, "@reviveid2", 60, atcommand_reviveid2 }, // [Dino9021] + { AtCommand_KillId2, "@killid2", 60, atcommand_killid2 }, // [Dino9021] + { AtCommand_Sound, "@sound", 40, atcommand_sound }, + { AtCommand_UndisguiseAll, "@undisguiseall", 99, atcommand_undisguiseall }, + { AtCommand_DisguiseAll, "@disguiseall", 99, atcommand_disguiseall }, + { AtCommand_ChangeLook, "@changelook", 60, 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_Exp, "@exp", 1, atcommand_exp }, // [Skotlex] + { 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_Rates, "@rates", 1, atcommand_rates }, // MouseJstr + { AtCommand_ItemInfo, "@iteminfo", 1, atcommand_iteminfo }, // [Lupus] + { AtCommand_ItemInfo, "@ii", 1, atcommand_iteminfo }, // [Lupus] + { AtCommand_WhoDrops, "@whodrops", 1, atcommand_whodrops }, // [Skotlex] + { 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_MonsterIgnore, "@battleignore", 99, atcommand_monsterignore }, + { 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_PartyOption, "@partyoption", 10, atcommand_partyoption}, // 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] + { AtCommand_ToNPC, "@tonpc", 40, atcommand_tonpc }, // LuzZza + { AtCommand_Commands, "@commands", 1, atcommand_commands }, // [Skotlex] + { AtCommand_NoAsk, "@noask", 1, atcommand_noask }, // [LuzZza] + { AtCommand_Request, "@request", 20, atcommand_request }, // [Skotlex] + { AtCommand_HomLevel, "@hlvl", 60, atcommand_homlevel }, + { AtCommand_HomLevel, "@hlevel", 60, atcommand_homlevel }, + { AtCommand_HomLevel, "@homlvl", 60, atcommand_homlevel }, + { AtCommand_HomLevel, "@homlevel", 60, atcommand_homlevel }, + { AtCommand_HomEvolution, "@homevolution", 60, atcommand_homevolution }, + { AtCommand_MakeHomun, "@makehomun", 60, atcommand_makehomun }, + { AtCommand_HomFriendly, "@homfriendly", 60, atcommand_homfriendly }, + { AtCommand_HomHungry, "@homhungry", 60, atcommand_homhungry }, + { AtCommand_HomTalk, "@homtalk", 10, atcommand_homtalk }, + { AtCommand_HomInfo, "@hominfo", 1, atcommand_hominfo }, + { AtCommand_HomStats, "@homstats", 1, atcommand_homstats }, + { AtCommand_HomShuffle, "@homshuffle", 60, atcommand_homshuffle }, + { AtCommand_ShowMobs, "@showmobs", 10, atcommand_showmobs }, //KarLaeda + { AtCommand_FeelReset, "@feelreset", 10, atcommand_feelreset }, //[HiddenDragon] #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] - + { 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 #ifdef DMALLOC - { AtCommand_DMStart, "@dmstart", 99, atcommand_dmstart }, // [MouseJstr] - { AtCommand_DMTick, "@dmtick", 99, atcommand_dmtick }, // [MouseJstr] + { 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", 60, 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_Exp, "@exp", 1, atcommand_exp }, // [Skotlex] - { 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_Rates, "@rates", 1, atcommand_rates }, // MouseJstr - - { AtCommand_ItemInfo, "@iteminfo", 1, atcommand_iteminfo }, // [Lupus] - { AtCommand_ItemInfo, "@ii", 1, atcommand_iteminfo }, // [Lupus] - { AtCommand_WhoDrops, "@whodrops", 1, atcommand_whodrops }, // [Skotlex] - { 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_MonsterIgnore, "@battleignore", 99, atcommand_monsterignore }, - { 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_PartyOption, "@partyoption", 10, atcommand_partyoption}, // 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] - { AtCommand_ToNPC, "@tonpc", 40, atcommand_tonpc }, // LuzZza - { AtCommand_Commands, "@commands", 1, atcommand_commands }, // [Skotlex] - { AtCommand_NoAsk, "@noask", 1, atcommand_noask }, // [LuzZza] - { AtCommand_Request, "@request", 20, atcommand_request }, // [Skotlex] - - { AtCommand_HomLevel, "@homlvup", 60, atcommand_homlevel }, - { AtCommand_HomEvolution, "@homevolution", 60, atcommand_homevolution }, - { AtCommand_MakeHomun, "@makehomun", 60, atcommand_makehomun }, - { AtCommand_HomFriendly, "@homfriendly", 60, atcommand_homfriendly }, - { AtCommand_HomHungry, "@homhungry", 60, atcommand_homhungry }, - { AtCommand_HomTalk, "@homtalk", 10, atcommand_homtalk }, - { AtCommand_HomInfo, "@hominfo", 1, atcommand_hominfo }, - { AtCommand_HomStats, "@homstats", 1, atcommand_homstats }, - { AtCommand_HomShuffle, "@homshuffle", 60, atcommand_homshuffle }, - { AtCommand_ShowMobs, "@showmobs", 10, atcommand_showmobs }, //KarLaeda // add new commands before this line - { AtCommand_Unknown, NULL, 1, NULL } + { AtCommand_Unknown, NULL, 1, NULL } }; /*========================================= @@ -650,7 +593,7 @@ static AtCommandInfo atcommand_info[] = { *----------------------------------------- */ char atcmd_output[200]; -char atcmd_player_name[100]; +char atcmd_player_name[NAME_LENGTH]; char atcmd_temp[100]; /*========================================== @@ -670,13 +613,13 @@ char *estr_lower(char *str) // compare function for sorting high to lowest int hightolow_compare (const void * a, const void * b) { - return ( *(int*)b - *(int*)a ); + 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 ( *(int*)a - *(int*)b ); } //----------------------------------------------------------- @@ -1046,9 +989,9 @@ int atcommand_send(const int fd, struct map_session_data* sd, const char* comman || sscanf(message, "%x", &type)==1) ) { clif_displaymessage(fd, "Usage:"); - clif_displaymessage(fd, " @send len <packet hex number>"); - clif_displaymessage(fd, " @send <packet hex number> {<value>}*"); - clif_displaymessage(fd, " Value: <type=B(default),W,L><number> or S<length>\"<string>\""); + clif_displaymessage(fd, " @send len <packet hex number>"); + clif_displaymessage(fd, " @send <packet hex number> {<value>}*"); + clif_displaymessage(fd, " Value: <type=B(default),W,L><number> or S<length>\"<string>\""); return -1; } @@ -1311,13 +1254,12 @@ int atcommand_rura( const int fd, struct map_session_data* sd, const char* comma clif_displaymessage(fd, msg_txt(248)); return -1; } - if (pc_setpos(sd, mapindex, x, y, 3) == 0) - clif_displaymessage(fd, msg_txt(0)); // Warped. - else { + if (pc_setpos(sd, mapindex, x, y, 3) != 0) { clif_displaymessage(fd, msg_txt(1)); // Map not found. return -1; } + clif_displaymessage(fd, msg_txt(0)); // Warped. return 0; } @@ -1328,7 +1270,6 @@ int atcommand_rura( const int fd, struct map_session_data* sd, const char* comma 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; nullpo_retr(-1, sd); memset(atcmd_player_name, '\0', sizeof atcmd_player_name); @@ -1337,20 +1278,23 @@ int atcommand_where(const int fd, struct map_session_data* sd, const char* comma clif_displaymessage(fd, "Please, enter a player name (usage: @where <char name>)."); return -1; } - pl_sd = map_nick2sd(atcmd_player_name); - - if (pl_sd == NULL) + + if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; + } if(strncmp(pl_sd->status.name,atcmd_player_name,NAME_LENGTH)!=0) + { + clif_displaymessage(fd, "You already know where you are..."); 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 && GM_level >= battle_config.who_display_aid)) { + if(pc_isGM(sd) < pc_isGM(pl_sd)) { + if (!(battle_config.who_display_aid && pc_isGM(sd) >= battle_config.who_display_aid)) { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } } @@ -1373,30 +1317,38 @@ int atcommand_jumpto(const int fd, struct map_session_data* sd, const char* comm nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @jumpto/@warpto/@goto <char name>)."); + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @jumpto/@warpto/@goto <player name/id>)."); 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_txt(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_txt(248)); - return -1; - } - pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); - sprintf(atcmd_output, msg_txt(4), atcmd_player_name); // Jump to %s - clif_displaymessage(fd, atcmd_output); - } else { + if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + + if (pl_sd == sd) + { + clif_displaymessage(fd, "But you are already where you are..."); + return -1; + } + + 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_txt(247)); // You are not authorized to warp to this map. + 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_txt(248)); // You are not authorized to warp from your current map. + return -1; + } + + pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); + sprintf(atcmd_output, msg_txt(4), atcmd_player_name); // Jumped to %s + clif_displaymessage(fd, atcmd_output); return 0; } @@ -1420,11 +1372,11 @@ int atcommand_jump(const int fd, struct map_session_data* sd, const char* comman 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_txt(248)); + clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. return -1; } pc_setpos(sd, sd->mapindex, x, y, 3); - sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jump to %d %d + sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d clif_displaymessage(fd, atcmd_output); return 0; } @@ -2023,11 +1975,11 @@ int atcommand_load(const int fd, struct map_session_data* sd, const char* comman 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_txt(249)); + clif_displaymessage(fd, msg_txt(249)); // You are not authorized to warp to your save map. 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_txt(248)); + clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. return -1; } @@ -2056,61 +2008,18 @@ int atcommand_speed(const int fd, struct map_session_data* sd, const char* comma } speed = atoi(message); - if (speed >= MIN_WALK_SPEED && speed <= MAX_WALK_SPEED) { - sd->base_status.speed = speed; - status_calc_bl(&sd->bl, SCB_SPEED); - clif_displaymessage(fd, msg_txt(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_charspeed(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd; - int speed; - - nullpo_retr(-1, sd); - - memset(atcmd_output, '\0', sizeof(atcmd_output)); - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - - if (!message || !*message || sscanf(message, "%d %23[^\n]", &speed, atcmd_player_name) < 2) { - sprintf(atcmd_output, "Please, enter a speed and a player name (usage: @charspeed <speed <%d-%d>> <char name>).", MIN_WALK_SPEED, MAX_WALK_SPEED); - clif_displaymessage(fd, atcmd_output); - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) - { //GM level check - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; + if (speed < MIN_WALK_SPEED) + { + speed = MIN_WALK_SPEED; } - - if (speed >= MIN_WALK_SPEED && speed <= MAX_WALK_SPEED) { - pl_sd->base_status.speed = speed; - status_calc_bl(&pl_sd->bl, SCB_SPEED); - clif_displaymessage(fd, msg_txt(8)); // Speed changed. - if(pl_sd->fd) - clif_displaymessage(pl_sd->fd, msg_txt(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; + else if (speed > MAX_WALK_SPEED) + { + speed = MAX_WALK_SPEED; } + + sd->base_status.speed = speed; + status_calc_bl(&sd->bl, SCB_SPEED); + clif_displaymessage(fd, msg_txt(8)); // Speed changed. return 0; } @@ -2126,10 +2035,13 @@ int atcommand_storage(const int fd, struct map_session_data* sd, const char* com return -1; if (storage_storageopen(sd) == 1) - { //Already open. + { //Already open. clif_displaymessage(fd, msg_txt(250)); return -1; } + + clif_displaymessage(fd, "Storage opened."); + return 0; } @@ -2161,6 +2073,7 @@ int atcommand_guildstorage(const int fd, struct map_session_data* sd, const char return -1; } storage_guild_storageopen(sd); + clif_displaymessage(fd, "Guild storage opened."); return 0; } @@ -2310,7 +2223,29 @@ int atcommand_jobchange(const int fd, struct map_session_data* sd, const char* c } if (!found) { - clif_displaymessage(fd, "Please, enter job ID (usage: @job/@jobchange <job ID>)."); + clif_displaymessage(fd, "Please, enter job ID (usage: @job/@jobchange <job name/ID>)."); + clif_displaymessage(fd, " 0 Novice 7 Knight 14 Crusader 21 Peco Crusader"); + clif_displaymessage(fd, " 1 Swordman 8 Priest 15 Monk 22 N/A"); + clif_displaymessage(fd, " 2 Mage 9 Wizard 16 Sage 23 Super Novice"); + clif_displaymessage(fd, " 3 Archer 10 Blacksmith 17 Rogue 24 Gunslinger"); + clif_displaymessage(fd, " 4 Acolyte 11 Hunter 18 Alchemist 25 Ninja"); + clif_displaymessage(fd, " 5 Merchant 12 Assassin 19 Bard 26 N/A"); + clif_displaymessage(fd, " 6 Thief 13 Peco Knight 20 Dancer"); + clif_displaymessage(fd, "4001 Novice High 4008 Lord Knight 4015 Paladin 4022 Peco Paladin"); + clif_displaymessage(fd, "4002 Swordman High 4009 High Priest 4016 Champion"); + clif_displaymessage(fd, "4003 Mage High 4010 High Wizard 4017 Professor"); + clif_displaymessage(fd, "4004 Archer High 4011 Whitesmith 4018 Stalker"); + clif_displaymessage(fd, "4005 Acolyte High 4012 Sniper 4019 Creator"); + clif_displaymessage(fd, "4006 Merchant High 4013 Assassin Cross 4020 Clown"); + clif_displaymessage(fd, "4007 Thief High 4014 Peco Lord Knight 4021 Gypsy"); + clif_displaymessage(fd, "4023 Baby Novice 4030 Baby Knight 4037 Baby Crusader 4044 Baby Peco Crusader"); + clif_displaymessage(fd, "4024 Baby Swordsman 4031 Baby Priest 4038 Baby Monk 4045 Super Baby"); + clif_displaymessage(fd, "4025 Baby Mage 4032 Baby Wizard 4039 Baby Sage 4046 Taekwon Kid"); + clif_displaymessage(fd, "4026 Baby Archer 4033 Baby Blacksmith 4040 Baby Rogue 4047 Taekwon Master"); + clif_displaymessage(fd, "4027 Baby Acolyte 4034 Baby Hunter 4041 Baby Alchemist 4048 N/A"); + clif_displaymessage(fd, "4028 Baby Merchant 4035 Baby Assassin 4042 Baby Bard 4049 Soul Linker"); + clif_displaymessage(fd, "4029 Baby Thief 4036 Baby Peco-Knight 4043 Baby Dancer"); + clif_displaymessage(fd, "[upper]: -1 (default) to automatically determine the 'level', 0 to force normal job, 1 to force high job."); return -1; } } @@ -2333,7 +2268,29 @@ int atcommand_jobchange(const int fd, struct map_session_data* sd, const char* c return -1; } } else { - clif_displaymessage(fd, "Please, enter a valid job ID (usage: @job/@jobchange <job ID>)."); + clif_displaymessage(fd, "Please, enter a valid job ID (usage: @job/@jobchange <job name/ID>)."); + clif_displaymessage(fd, " 0 Novice 7 Knight 14 Crusader 21 Peco Crusader"); + clif_displaymessage(fd, " 1 Swordman 8 Priest 15 Monk 22 N/A"); + clif_displaymessage(fd, " 2 Mage 9 Wizard 16 Sage 23 Super Novice"); + clif_displaymessage(fd, " 3 Archer 10 Blacksmith 17 Rogue 24 Gunslinger"); + clif_displaymessage(fd, " 4 Acolyte 11 Hunter 18 Alchemist 25 Ninja"); + clif_displaymessage(fd, " 5 Merchant 12 Assassin 19 Bard 26 N/A"); + clif_displaymessage(fd, " 6 Thief 13 Peco Knight 20 Dancer"); + clif_displaymessage(fd, "4001 Novice High 4008 Lord Knight 4015 Paladin 4022 Peco Paladin"); + clif_displaymessage(fd, "4002 Swordman High 4009 High Priest 4016 Champion"); + clif_displaymessage(fd, "4003 Mage High 4010 High Wizard 4017 Professor"); + clif_displaymessage(fd, "4004 Archer High 4011 Whitesmith 4018 Stalker"); + clif_displaymessage(fd, "4005 Acolyte High 4012 Sniper 4019 Creator"); + clif_displaymessage(fd, "4006 Merchant High 4013 Assassin Cross 4020 Clown"); + clif_displaymessage(fd, "4007 Thief High 4014 Peco Lord Knight 4021 Gypsy"); + clif_displaymessage(fd, "4023 Baby Novice 4030 Baby Knight 4037 Baby Crusader 4044 Baby Peco Crusader"); + clif_displaymessage(fd, "4024 Baby Swordsman 4031 Baby Priest 4038 Baby Monk 4045 Super Baby"); + clif_displaymessage(fd, "4025 Baby Mage 4032 Baby Wizard 4039 Baby Sage 4046 Taekwon Kid"); + clif_displaymessage(fd, "4026 Baby Archer 4033 Baby Blacksmith 4040 Baby Rogue 4047 Taekwon Master"); + clif_displaymessage(fd, "4027 Baby Acolyte 4034 Baby Hunter 4041 Baby Alchemist 4048 N/A"); + clif_displaymessage(fd, "4028 Baby Merchant 4035 Baby Assassin 4042 Baby Bard 4049 Soul Linker"); + clif_displaymessage(fd, "4029 Baby Thief 4036 Baby Peco-Knight 4043 Baby Dancer"); + clif_displaymessage(fd, "[upper]: -1 (default) to automatically determine the 'level', 0 to force normal job, 1 to force high job."); return -1; } @@ -2365,23 +2322,27 @@ int atcommand_kill(const int fd, struct map_session_data* sd, const char* comman 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 <char name>)."); + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @kill <player name/id>)."); 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 - status_kill(&pl_sd->bl); - clif_displaymessage(fd, msg_txt(14)); // Character killed. - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { + if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + + if (pc_isGM(sd) < pc_isGM(pl_sd)) + { // you can kill only lower or same level + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + status_kill(&pl_sd->bl); + clif_displaymessage(pl_sd->fd, msg_txt(13)); // A pity! You've died. + if (fd != pl_sd->fd) + clif_displaymessage(fd, msg_txt(14)); // Character killed. return 0; } @@ -2394,7 +2355,10 @@ int atcommand_alive(const int fd, struct map_session_data* sd, const char* comma { nullpo_retr(-1, sd); if (!status_revive(&sd->bl, 100, 100)) + { + clif_displaymessage(fd, "You're not dead."); return -1; + } clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); clif_displaymessage(fd, msg_txt(16)); // You've been revived! It's a miracle! return 0; @@ -2911,10 +2875,10 @@ int atcommand_pvpoff(const int fd, struct map_session_data* sd, const char* comm { nullpo_retr(-1, sd); - if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] - clif_displaymessage(fd, msg_txt(52)); // This option cannot be used in PK Mode. - return -1; - } + //if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] + // clif_displaymessage(fd, msg_txt(52)); // This option cannot be used in PK Mode. + // return -1; + //} if (!map[sd->bl.m].flag.pvp) { clif_displaymessage(fd, msg_txt(160)); // PvP is already Off. @@ -2922,7 +2886,9 @@ int atcommand_pvpoff(const int fd, struct map_session_data* sd, const char* comm } map[sd->bl.m].flag.pvp = 0; - clif_send0199(sd->bl.m, 0); + + if (!battle_config.pk_mode) + clif_send0199(sd->bl.m, 0); map_foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC); map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0); clif_displaymessage(fd, msg_txt(31)); // PvP: Off. @@ -2939,23 +2905,26 @@ int atcommand_pvpon(const int fd, struct map_session_data* sd, const char* comma 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_txt(52)); // This option cannot be used in PK Mode. - return -1; - } + //if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] + // clif_displaymessage(fd, msg_txt(52)); // This option cannot be used in PK Mode. + // return -1; + //} if (!map[sd->bl.m].flag.pvp) { 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; + if (!battle_config.pk_mode) + { + 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_txt(32)); // PvP: On. @@ -3456,7 +3425,7 @@ int atcommand_monstersmall(const int fd, struct map_session_data* sd, const char } if (mob_id == MOBID_EMPERIUM) { - clif_displaymessage(fd, msg_txt(83)); + clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium return -1; } @@ -3532,7 +3501,7 @@ int atcommand_monsterbig(const int fd, struct map_session_data* sd, const char* } if (mob_id == MOBID_EMPERIUM) { - clif_displaymessage(fd, msg_txt(83)); + clif_displaymessage(fd, msg_txt(83)); // Cannot spawn emperium return -1; } @@ -3653,6 +3622,26 @@ int atcommand_refine(const int fd, struct map_session_data* sd, const char* comm if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) { clif_displaymessage(fd, "Please, enter a position and a amount (usage: @refine <equip position> <+/- amount>)."); + sprintf(atcmd_output, "%d: Left Accessory", EQI_ACC_L); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Right Accessory", EQI_ACC_R); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Shoes", EQI_SHOES); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Garment", EQI_GARMENT); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Lower Headgear", EQI_HEAD_LOW); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Mid Headgear", EQI_HEAD_MID); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Top Headgear", EQI_HEAD_TOP); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Body Armor", EQI_ARMOR); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Left Hand", EQI_HAND_L); + clif_displaymessage(fd, atcmd_output); + sprintf(atcmd_output, "%d: Right Hand", EQI_HAND_R); + clif_displaymessage(fd, atcmd_output); return -1; } @@ -3863,47 +3852,18 @@ int atcommand_gat(const int fd, struct map_session_data* sd, const char* command * *------------------------------------------ */ -int atcommand_packet(const int fd, struct map_session_data* sd, const char* command, const char* message) +int atcommand_displaystatus(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; + int i, type, flag; 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 <status type> <flag>)."); + if (!message || !*message || (i = sscanf(message, "%d %d", &type, &flag)) < 1) { + clif_displaymessage(fd, "Please, enter a status type/flag (usage: @displaystatus <status type> <flag>)."); return -1; } - if (i == 1) y = 1; + if (i == 1) flag = 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 - } + clif_status_change(&sd->bl, type, flag); return 0; } @@ -4029,7 +3989,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma 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>)."); + sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustment>)."); clif_displaymessage(fd, atcmd_output); return -1; } @@ -4039,7 +3999,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma break; if (param[i] == NULL || i > MAX_STATUS_TYPE) { // normally impossible... - sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustement>)."); + sprintf(atcmd_output, "Please, enter a valid value (usage: @str,@agi,@vit,@int,@dex,@luk <+/-adjustment>)."); clif_displaymessage(fd, atcmd_output); return -1; } @@ -4051,7 +4011,7 @@ int atcommand_param(const int fd, struct map_session_data* sd, const char* comma status[4] = &sd->status.dex; status[5] = &sd->status.luk; - max = pc_maxparameter(sd); + max = SHRT_MAX; new_value = cap_value(*status[i] + value, 1, max); if (new_value != (int)*status[i]) { @@ -4093,7 +4053,7 @@ int atcommand_stat_all(const int fd, struct map_session_data* sd, const char* co value = pc_maxparameter(sd); count = 0; - max = pc_maxparameter(sd); + max = SHRT_MAX; for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) { if (value > 0 && *status[index] > max - value) @@ -4145,10 +4105,10 @@ int atcommand_guildlevelup(const int fd, struct map_session_data* sd, const char clif_displaymessage(fd, msg_txt(43)); // You're not in a guild. return -1; } - if (strcmp(sd->status.name, guild_info->master) != 0) { - clif_displaymessage(fd, msg_txt(44)); // You're not the master of your guild. - return -1; - } + //if (strcmp(sd->status.name, guild_info->master) != 0) { + // clif_displaymessage(fd, msg_txt(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 @@ -4331,67 +4291,41 @@ int atcommand_recall(const int fd, struct map_session_data* sd, const char* comm 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 <char name>)."); + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @recall <player name/id>)."); 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_txt(46), atcmd_player_name); // %s recalled! - clif_displaymessage(fd, atcmd_output); - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { + if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + + if (pl_sd == sd) + { + clif_displaymessage(fd, "You are already where you are..."); + 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 <char name>)."); + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } - pl_sd = map_nick2sd(atcmd_player_name); - - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. + 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 (!status_revive(&pl_sd->bl, 100, 0)) + 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; - - clif_skill_nodamage(&sd->bl,&pl_sd->bl,ALL_RESURRECTION,4,1); - clif_displaymessage(fd, msg_txt(51)); // Character revived. + } + pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2); + sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled! + clif_displaymessage(fd, atcmd_output); + return 0; } @@ -4451,7 +4385,7 @@ int atcommand_char_ban(const int fd, struct map_session_data* sd, const char* co memset(atcmd_output, '\0', sizeof(atcmd_output)); memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - if (!message || !*message || sscanf(message, "%199s %99[^\n]", atcmd_output, atcmd_player_name) < 2) { + if (!message || !*message || sscanf(message, "%s %23[^\n]", atcmd_output, atcmd_player_name) < 2) { clif_displaymessage(fd, "Please, enter ban time and a player name (usage: @charban/@ban/@banish/@charbanish <time> <name>)."); return -1; } @@ -4522,7 +4456,7 @@ int atcommand_char_unblock(const int fd, struct map_session_data* sd, const char memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - if (!message || !*message || sscanf(message, "%99[^\n]", atcmd_player_name) < 1) { + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @charunblock <player_name>)."); return -1; } @@ -4553,7 +4487,7 @@ int atcommand_char_unban(const int fd, struct map_session_data* sd, const char* memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - if (!message || !*message || sscanf(message, "%99[^\n]", atcmd_player_name) < 1) { + if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @charunban <player_name>)."); return -1; } @@ -4726,23 +4660,25 @@ int atcommand_kick(const int fd, struct map_session_data* sd, const char* comman 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: @kick <charname>)."); + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @kick <player name/id>)."); return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) // you can kick only lower or same gm level - clif_GM_kick(sd, pl_sd, 1); - else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { + if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + clif_GM_kick(sd, pl_sd, 1); + return 0; } @@ -5598,13 +5534,20 @@ int atcommand_mount_peco(const int fd, struct map_session_data* sd, const char* nullpo_retr(-1, sd); if (!pc_isriding(sd)) { // if actually no peco - if (pc_checkskill(sd, KN_RIDING)) { - pc_setoption(sd, sd->sc.option | OPTION_RIDING); - clif_displaymessage(fd, msg_txt(102)); // Mounted Peco. - } else { + if (!pc_checkskill(sd, KN_RIDING)) + { clif_displaymessage(fd, msg_txt(213)); // You can not mount a peco with your job. return -1; } + + if (sd->disguise) + { + clif_displaymessage(fd, msg_txt(212)); // Cannot mount a Peco while in disguise. + return -1; + } + + pc_setoption(sd, sd->sc.option | OPTION_RIDING); + clif_displaymessage(fd, msg_txt(102)); // Mounted Peco. } else { //Dismount pc_setoption(sd, sd->sc.option & ~OPTION_RIDING); clif_displaymessage(fd, msg_txt(214)); // Unmounted Peco. @@ -5614,44 +5557,6 @@ int atcommand_mount_peco(const int fd, struct map_session_data* sd, const char* } /*========================================== - * - *------------------------------------------ - */ -int atcommand_char_mount_peco(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: @charmountpeco <char_name>)."); - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - - if (!pc_isriding(pl_sd)) { // if actually no peco - if (pc_checkskill(pl_sd, KN_RIDING)) { - pc_setoption(pl_sd, pl_sd->sc.option | OPTION_RIDING); - clif_displaymessage(fd, msg_txt(216)); // Mounted Peco. - } else { - clif_displaymessage(fd, msg_txt(217)); // You can not mount a peco with your job. - return -1; - } - } else { //Dismount - pc_setoption(pl_sd, pl_sd->sc.option & ~OPTION_RIDING); - clif_displaymessage(fd, msg_txt(218)); // Unmounted Peco. - } - } else { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - return 0; -} - -/*========================================== *Spy Commands by Syrus22 *------------------------------------------ */ @@ -5872,14 +5777,13 @@ int atcommand_hidenpc(const int fd, struct map_session_data* sd, const char* com return -1; } - if (npc_name2id(NPCname) != NULL) { - npc_enable(NPCname, 0); - clif_displaymessage(fd, msg_txt(112)); // Npc Disabled. - } else { + if (npc_name2id(NPCname) == NULL) { clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } + npc_enable(NPCname, 0); + clif_displaymessage(fd, msg_txt(112)); // Npc Disabled. return 0; } @@ -5922,15 +5826,14 @@ int atcommand_unloadnpc(const int fd, struct map_session_data* sd, const char* c return -1; } - if ((nd = npc_name2id(NPCname)) != NULL) { - npc_unload_duplicates(nd); - npc_unload(nd); - clif_displaymessage(fd, msg_txt(112)); // Npc Disabled. - } else { + if ((nd = npc_name2id(NPCname)) == NULL) { clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. return -1; } + npc_unload_duplicates(nd); + npc_unload(nd); + clif_displaymessage(fd, msg_txt(112)); // Npc Disabled. return 0; } @@ -5975,7 +5878,7 @@ char * txt_time(unsigned int duration) } /*========================================== - * @time/@date/@server_date/@serverdate/@server_time/@servertime: Display the date/time of the server (by [Yor] + * @time/@date/@serverdate/@servertime: Display the date/time of the server (by [Yor] * Calculation management of GM modification (@day/@night GM commands) is done *------------------------------------------ */ @@ -6048,81 +5951,6 @@ int atcommand_servertime(const int fd, struct map_session_data* sd, const char* return 0; } -/*========================================== - * @chardelitem <item_name_or_ID> <quantity> <player> (by [Yor] - * removes <quantity> item from a character - * item can be equiped or not. - * Inspired from a old command created by RoVeRT - *------------------------------------------ - */ -int atcommand_chardelitem(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd; - char item_name[100]; - int i, number = 0, item_id, item_position, count; - struct item_data *item_data; - nullpo_retr(-1, sd); - - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - memset(item_name, '\0', sizeof(item_name)); - memset(atcmd_output, '\0', sizeof(atcmd_output)); - - if (!message || !*message || ( - sscanf(message, "\"%99[^\"]\" %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 && - sscanf(message, "%99s %d %99[^\n]", item_name, &number, atcmd_player_name) < 3 - ) || number < 1) { - clif_displaymessage(fd, "Please, enter an item name/id, a quantity and a player name (usage: @chardelitem <item_name_or_ID> <quantity> <player>)."); - 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 (item_id > 500) { - 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 - item_position = pc_search_inventory(pl_sd, item_id); - if (item_position >= 0) { - count = 0; - for(i = 0; i < number && item_position >= 0; i++) { - - //Logs (A)dmins items [Lupus] - if(log_config.enable_logs&0x400) - log_pick_pc(pl_sd, "A", pl_sd->status.inventory[item_position].nameid, -1, &pl_sd->status.inventory[item_position]); - - pc_delitem(pl_sd, item_position, 1, 0); - count++; - item_position = pc_search_inventory(pl_sd, item_id); // for next loop - } - sprintf(atcmd_output, msg_txt(113), count); // %d item(s) removed by a GM. - clif_displaymessage(pl_sd->fd, atcmd_output); - if (number == count) - sprintf(atcmd_output, msg_txt(114), count); // %d item(s) removed from the player. - else - sprintf(atcmd_output, msg_txt(115), count, count, number); // %d item(s) removed. Player had only %d on %d items. - clif_displaymessage(fd, atcmd_output); - } else { - clif_displaymessage(fd, msg_txt(116)); // Character does not have the item. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. - return -1; - } - - return 0; -} - //Added by Coltaro //We're using this function here instead of using time_t so that it only counts player's jail time when he/she's online (and since the idea is to reduce the amount of minutes one by one in status_change_timer...). //Well, using time_t could still work but for some reason that looks like more coding x_x @@ -6256,8 +6084,8 @@ int atcommand_jailfor(const int fd, struct map_session_data* sd, const char* com short m_index = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%199s %99[^\n]",atcmd_output,atcmd_player_name) < 2) { - clif_displaymessage(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> + if (!message || !*message || sscanf(message, "%s %23[^\n]",atcmd_output,atcmd_player_name) < 2) { + clif_displaymessage(fd, msg_txt(400)); //Usage: @jailfor <time> <character name> return -1; } @@ -6387,47 +6215,6 @@ int atcommand_jailtime(const int fd, struct map_session_data* sd, const char* co return 0; } -//By Coltaro -int atcommand_charjailtime(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data* pl_sd; - int year, month, day, hour, minute; - - nullpo_retr(-1, sd); - - if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @charjailtime <character name>)."); - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - if (pc_isGM(pl_sd) >= pc_isGM(sd)) { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player. - return -1; - } - if (!pl_sd->sc.count || pl_sd->sc.data[SC_JAILED].timer == -1 ) { - clif_displaymessage(fd, "This player is not in jail."); // You are not in jail. - return -1; - } - if (pl_sd->sc.data[SC_JAILED].val2) { - clif_displaymessage(fd, "This player has been jailed indefinitely."); - return 0; - } - - if (pl_sd->sc.data[SC_JAILED].val1 <= 0) { // Was not jailed with @jailfor (maybe @jail?) - clif_displaymessage(fd, "This player has been jailed for an unknown amount of time."); - return -1; - } - //Get remaining jail time - get_jail_time(pl_sd->sc.data[SC_JAILED].val1,&year,&month,&day,&hour,&minute); - sprintf(atcmd_output,msg_txt(402),"This player will remain",year,month,day,hour,minute); - clif_displaymessage(fd, atcmd_output); - return 0; -} - /*========================================== * @disguise <mob_id> by [Valaris] (simplified by [Yor]) *------------------------------------------ @@ -6456,8 +6243,14 @@ int atcommand_disguise(const int fd, struct map_session_data* sd, const char* co } if (id == 0) - { // Monster/NPC name/id hasn't been found. - clif_displaymessage(fd, msg_txt(123)); + { + clif_displaymessage(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. + return -1; + } + + if(pc_isriding(sd)) + { + clif_displaymessage(fd, msg_txt(227)); // Character cannot wear disguise while riding a PecoPeco. return -1; } @@ -6478,24 +6271,25 @@ int atcommand_disguiseall(const int fd, struct map_session_data* sd, const char* nullpo_retr(-1, sd); if (!message || !*message) { - clif_displaymessage(fd, "Please, enter a Monster/NPC name/id (usage: @disguiseall <monster_name_or_monster_ID>)."); + clif_displaymessage(fd, "Please, enter a Monster/NPC name/id (usage: @disguiseall <monster name or monster ID>)."); return -1; } if ((mob_id = mobdb_searchname(message)) == 0) // check name first (to avoid possible name begining by a number) mob_id = atoi(message); - if (mobdb_checkid(mob_id) || npcdb_checkid(mob_id)) { //if mob or npc... - pl_allsd = map_getallusers(&users); - for(i=0; i < users; i++) { - if((pl_sd = pl_allsd[i])) - pc_disguise(pl_sd, mob_id); - } - clif_displaymessage(fd, msg_txt(122)); // Disguise applied. - } else { + if (!mobdb_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc... + clif_displaymessage(fd, msg_txt(123)); // Monster/NPC name/id not found. return -1; } + pl_allsd = map_getallusers(&users); + for(i=0; i < users; i++) + { + if((pl_sd = pl_allsd[i])) + pc_disguise(pl_sd, mob_id); + } + clif_displaymessage(fd, msg_txt(122)); // Disguise applied. return 0; } @@ -6578,7 +6372,7 @@ int atcommand_broadcast(const int fd, struct map_session_data* sd, const char* c return -1; } - sprintf(atcmd_output, "%s : %s", sd->status.name, message); + sprintf(atcmd_output, "%s: %s", sd->status.name, message); intif_GMmessage(atcmd_output, strlen(atcmd_output) + 1, 0); return 0; @@ -6599,7 +6393,7 @@ int atcommand_localbroadcast(const int fd, struct map_session_data* sd, const ch return -1; } - sprintf(atcmd_output, "%s : %s", sd->status.name, message); + sprintf(atcmd_output, "%s: %s", sd->status.name, message); clif_GMmessage(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, 1); // 1: ALL_SAMEMAP @@ -6607,96 +6401,6 @@ int atcommand_localbroadcast(const int fd, struct map_session_data* sd, const ch } /*========================================== - * @chardisguise <mob_id> <character> by Kalaspuff (based off Valaris' and Yor's work) - *------------------------------------------ - */ -int atcommand_chardisguise(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int mob_id; - char mob_name[NAME_LENGTH]; - struct map_session_data* pl_sd; - nullpo_retr(-1, sd); - - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - memset(mob_name, '\0', sizeof(mob_name)); - - if (!message || !*message || sscanf(message, "%23s %23[^\n]", mob_name, atcmd_player_name) < 2) { - clif_displaymessage(fd, "Please, enter a Monster/NPC name/id and a player name (usage: @chardisguise <monster_name_or_monster_ID> <char name>)."); - return -1; - } - - if ((mob_id = atoi(mob_name)) > 0) - { //Acquired an ID - if (!mobdb_checkid(mob_id) && !npcdb_checkid(mob_id)) - mob_id = 0; //Invalid id for either mobs or npcs. - } else { //Acquired a Name - if ((mob_id = mobdb_searchname(mob_name)) == 0) - { - struct npc_data* nd = npc_name2id(mob_name); - if (nd != NULL) - mob_id = nd->n; - } - } - - if (mob_id == 0) - { - clif_displaymessage(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can disguise only lower or same level - pc_disguise(pl_sd, mob_id); - clif_displaymessage(fd, msg_txt(140)); // Character's disguise applied. - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - return 0; -} - -/*========================================== - * @charundisguise <character> by Kalaspuff (based off Yor's work) - *------------------------------------------ - */ -int atcommand_charundisguise(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: @charundisguise <char name>)."); - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can undisguise only lower or same level - if (pl_sd->disguise) - pc_disguise(pl_sd, 0); - else { - clif_displaymessage(fd, msg_txt(142)); // Character is not disguised. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - return 0; -} - -/*========================================== * @email <actual@email> <new@email> by [Yor] *------------------------------------------ */ @@ -6726,11 +6430,10 @@ int atcommand_email(const int fd, struct map_session_data* sd, const char* comma } else if (strcmpi(actual_email, new_email) == 0) { clif_displaymessage(fd, msg_txt(147)); // New email must be different of the actual e-mail. return -1; - } else { - chrif_changeemail(sd->status.account_id, actual_email, new_email); - clif_displaymessage(fd, msg_txt(148)); // Information sended to login-server via char-server. } + chrif_changeemail(sd->status.account_id, actual_email, new_email); + clif_displaymessage(fd, msg_txt(148)); // Information sended to login-server via char-server. return 0; } @@ -6743,90 +6446,13 @@ int atcommand_effect(const int fd, struct map_session_data* sd, const char* comm int type = 0, flag = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %d", &type,&flag) < 2) { - clif_displaymessage(fd, "Please, enter a type and a send flag (usage: @effect <type> <flag>)."); + if (!message || !*message || sscanf(message, "%d", &type) < 1) { + clif_displaymessage(fd, "Please, enter an effect number (usage: @effect <effect number>)."); return -1; } clif_specialeffect(&sd->bl, type, flag); clif_displaymessage(fd, msg_txt(229)); // Your effect has changed. - - return 0; -} - -/*========================================== - * @charcartlist <character>: Displays the items list of a player's cart. - *------------------------------------------ - */ -int atcommand_character_cart_list(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - char outputtmp[200]; - struct map_session_data *pl_sd; - struct item_data *item_data, *item_temp; - int i, j, count, counter, counter2; - nullpo_retr(-1, sd); - - memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - memset(atcmd_output, '\0', sizeof(atcmd_output)); - memset(outputtmp, '\0', sizeof(outputtmp)); - - if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: @cartlist <char name>)."); - return -1; - } - - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level - counter = 0; - count = 0; - for (i = 0; i < MAX_CART; i++) { - if (pl_sd->status.cart[i].nameid > 0 && (item_data = itemdb_search(pl_sd->status.cart[i].nameid)) != NULL) { - counter = counter + pl_sd->status.cart[i].amount; - count++; - if (count == 1) { - sprintf(atcmd_output, "------ Cart items list of '%s' ------", pl_sd->status.name); - clif_displaymessage(fd, atcmd_output); - } - if (pl_sd->status.cart[i].refine) - sprintf(atcmd_output, "%d %s %+d (%s %+d, id: %d)", pl_sd->status.cart[i].amount, item_data->name, pl_sd->status.cart[i].refine, item_data->jname, pl_sd->status.cart[i].refine, pl_sd->status.cart[i].nameid); - else - sprintf(atcmd_output, "%d %s (%s, id: %d)", pl_sd->status.cart[i].amount, item_data->name, item_data->jname, pl_sd->status.cart[i].nameid); - clif_displaymessage(fd, atcmd_output); - memset(atcmd_output, '\0', sizeof(atcmd_output)); - counter2 = 0; - for (j = 0; j < item_data->slot; j++) { - if (pl_sd->status.cart[i].card[j]) { - if ( (item_temp = itemdb_search(pl_sd->status.cart[i].card[j])) != NULL) { - if (atcmd_output[0] == '\0') - sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - else - sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - strcat(atcmd_output, outputtmp); - } - } - } - if (atcmd_output[0] != '\0') { - atcmd_output[strlen(atcmd_output) - 2] = ')'; - atcmd_output[strlen(atcmd_output) - 1] = '\0'; - clif_displaymessage(fd, atcmd_output); - } - } - } - if (count == 0) - clif_displaymessage(fd, "No item found in the cart of this player."); - else { - sprintf(atcmd_output, "%d item(s) found in %d kind(s) of items.", counter, count); - clif_displaymessage(fd, atcmd_output); - } - } else { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - return 0; } @@ -6869,32 +6495,6 @@ int atcommand_killable(const int fd, struct map_session_data* sd, const char* co } /*========================================== - * @charkillable by MouseJstr - * enable another player to be killed - *------------------------------------------ - */ -int atcommand_charkillable(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) - return -1; - - if((pl_sd=map_nick2sd((char *) message)) == NULL) - return -1; - - pl_sd->state.killable = !pl_sd->state.killable; - - if(pl_sd->state.killable) - clif_displaymessage(fd, msg_txt(289)); - else - clif_displaymessage(fd, msg_txt(290)); - - return 0; -} - -/*========================================== * @skillon by MouseJstr * turn skills on for the map *------------------------------------------ @@ -6930,14 +6530,9 @@ int atcommand_npcmove(const int fd, struct map_session_data* sd, const char* com int x = 0, y = 0, m; struct npc_data *nd = 0; nullpo_retr(-1, sd); - - - if (!message || !*message) - return -1; - memset(atcmd_player_name, '\0', sizeof atcmd_player_name); - if (sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) { + if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) { clif_displaymessage(fd, "Usage: @npcmove <X> <Y> <npc_name>"); return -1; } @@ -6946,10 +6541,16 @@ int atcommand_npcmove(const int fd, struct map_session_data* sd, const char* com // nullpo_retr(-1, (nd = npc_name2id(atcmd_player_name))); if ((nd = npc_name2id(atcmd_player_name)) == NULL) + { + clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist. return -1; + } if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL) + { + clif_displaymessage(fd, "NPC is not on this map."); return -1; //Not on a map. + } if (x < 0) x = 0; else if (x >= map[m].xs) x = map[m].xs-1; @@ -6958,6 +6559,7 @@ int atcommand_npcmove(const int fd, struct map_session_data* sd, const char* com map_foreachinrange(clif_outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); map_moveblock(&nd->bl, x, y, gettick()); map_foreachinrange(clif_insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); + clif_displaymessage(fd, "NPC moved."); return 0; } @@ -6973,11 +6575,10 @@ int atcommand_addwarp(const int fd, struct map_session_data* sd, const char* com int x,y,ret; nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - - if (sscanf(message, "%23s %d %d[^\n]", atcmd_player_name, &x, &y ) < 3) + if (!message || !*message || sscanf(message, "%23s %d %d[^\n]", atcmd_player_name, &x, &y) < 3) { + clif_displaymessage(fd, "usage: @addwarp <mapname (without .gat)> <X> <Y>."); return -1; + } sprintf(w1,"%s,%d,%d", mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); sprintf(w3,"%s%d%d%d%d", atcmd_player_name,sd->bl.x, sd->bl.y, x, y); @@ -7010,21 +6611,22 @@ int atcommand_follow(const int fd, struct map_session_data* sd, const char* comm clif_displaymessage(fd, "Follow mode OFF."); return 0; } - if ((pl_sd = map_nick2sd((char *) message)) != NULL) { - if (sd->followtarget == pl_sd->bl.id) { - pc_stop_following (sd); - clif_displaymessage(fd, "Follow mode OFF."); - } else { - pc_follow(sd, pl_sd->bl.id); - clif_displaymessage(fd, "Follow mode ON."); - } - return 0; - } else { - clif_displaymessage(fd, "Character not found."); + + if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + + if (sd->followtarget == pl_sd->bl.id) { + pc_stop_following (sd); + clif_displaymessage(fd, "Follow mode OFF."); + } else { + pc_follow(sd, pl_sd->bl.id); + clif_displaymessage(fd, "Follow mode ON."); + } - return 1; + return 0; } @@ -7048,34 +6650,6 @@ int atcommand_dropall(const int fd, struct map_session_data* sd, const char* com } /*========================================== - * @chardropall by [MouseJstr] - * Drop all of the target's possessions on the ground - *------------------------------------------ - */ -int atcommand_chardropall(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int i; - struct map_session_data *pl_sd = NULL; - nullpo_retr(-1, sd); - - if (!message || !*message) - return -1; - if((pl_sd=map_nick2sd((char *) message)) == NULL) - return -1; - for (i = 0; i < MAX_INVENTORY; i++) { - if (pl_sd->status.inventory[i].amount) { - if(pl_sd->status.inventory[i].equip != 0) - pc_unequipitem(pl_sd, i, 3); - pc_dropitem(pl_sd, i, pl_sd->status.inventory[i].amount); - } - } - - clif_displaymessage(pl_sd->fd, "Ever play 52 card pickup?"); - clif_displaymessage(fd, "It is done"); - - return 0; -} -/*========================================== * @storeall by [MouseJstr] * Put everything into storage *------------------------------------------ @@ -7108,52 +6682,7 @@ int atcommand_storeall(const int fd, struct map_session_data* sd, const char* co clif_displaymessage(fd, "It is done"); return 0; } -/*========================================== - * @charstoreall by [MouseJstr] - * A way to screw with players who piss you off - *------------------------------------------ - */ -int atcommand_charstoreall(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int i; - struct map_session_data *pl_sd = NULL; - nullpo_retr(-1, sd); - - if (!message || !*message) - return -1; - if((pl_sd=map_nick2sd((char *) message)) == NULL) - return -1; - if (pl_sd->state.storage_flag != 1) - { //Open storage. - switch (storage_storageopen(pl_sd)) { - case 2: //Try again - clif_displaymessage(fd, "Had to open the characters storage window..."); - clif_displaymessage(fd, "run this command again.."); - return 0; - case 1: //Failure - clif_displaymessage(fd, "The character currently can't use the storage."); - return 1; - } - } - - for (i = 0; i < MAX_INVENTORY; i++) { - if (pl_sd->status.inventory[i].amount) { - if(pl_sd->status.inventory[i].equip != 0) - pc_unequipitem(pl_sd, i, 3); - storage_storageadd(pl_sd, i, sd->status.inventory[i].amount); - } - } - storage_storageclose(pl_sd); - - clif_displaymessage(pl_sd->fd, "Everything you own has been put away for safe keeping."); - clif_displaymessage(pl_sd->fd, "go to the nearest kafka to retrieve it.."); - clif_displaymessage(pl_sd->fd, " -- the management"); - - clif_displaymessage(fd, "It is done"); - - return 0; -} /*========================================== * @skillid by [MouseJstr] * lookup a skill by name @@ -7165,7 +6694,11 @@ int atcommand_skillid(const int fd, struct map_session_data* sd, const char* com nullpo_retr(-1, sd); if (!message || !*message) + { + clif_displaymessage(fd, "Please enter a skill name to look up (usage: @skillid <skill name>)."); return -1; + } + skillen = strlen(message); for (idx = 0; idx < MAX_SKILL_DB; idx++) { @@ -7194,13 +6727,20 @@ int atcommand_useskill(const int fd, struct map_session_data* sd, const char* co char target[100]; nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - if(sscanf(message, "%d %d %99[^\n]", &skillnum, &skilllv, target) != 3) { + if(!message || !*message || sscanf(message, "%d %d %23[^\n]", &skillnum, &skilllv, target) != 3) { clif_displaymessage(fd, "Usage: @useskill <skillnum> <skillv> <target>"); return -1; } - if((pl_sd=map_nick2sd(target)) == NULL) { + + if ( (pl_sd = map_nick2sd(target)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } @@ -7232,8 +6772,7 @@ int atcommand_displayskill(const int fd, struct map_session_data* sd, const char int skilllv = 1; nullpo_retr(-1, sd); - if (!message || !*message || - sscanf(message, "%d %d", &skillnum, &skilllv) < 1) + if (!message || !*message || sscanf(message, "%d %d", &skillnum, &skilllv) < 1) { clif_displaymessage(fd, "Usage: @displayskill <skillnum> {<skillv>}>"); return -1; @@ -7261,15 +6800,16 @@ int atcommand_skilltree(const int fd, struct map_session_data* sd, const char* c struct skill_tree_entry *ent; nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - - if(sscanf(message, "%d %23[^\r\n]", &skillnum, target) != 2) { + if(!message || !*message || sscanf(message, "%d %23[^\r\n]", &skillnum, target) != 2) { clif_displaymessage(fd, "Usage: @skilltree <skillnum> <target>"); return -1; } - if((pl_sd=map_nick2sd(target)) == NULL) + + if ( (pl_sd = map_nick2sd(target)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; + } c = pc_calc_skilltree_normalize_job(pl_sd); c = pc_mapid2jobid(c, pl_sd->status.sex); @@ -7380,7 +6920,9 @@ int atcommand_marry(const int fd, struct map_session_data* sd, const char* comma getring (pl_sd2); return 0; } - return -1; + + clif_displaymessage(fd, "The two cannot wed because one of them is either a baby or is already married."); + return -1; } /*========================================== @@ -7399,20 +6941,21 @@ int atcommand_divorce(const int fd, struct map_session_data* sd, const char* com return -1; } - if((pl_sd=map_nick2sd((char *) atcmd_player_name)) != NULL) { + if ( (pl_sd = map_nick2sd(atcmd_player_name)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + if (pc_divorce(pl_sd) != 0) { sprintf(atcmd_output, "The divorce has failed.. Cannot find player '%s' or his(her) partner online.", atcmd_player_name); clif_displaymessage(fd, atcmd_output); return -1; - } else { - sprintf(atcmd_output, "'%s' and his(her) partner are now divorced.", atcmd_player_name); - clif_displaymessage(fd, atcmd_output); - return 0; } - } - sprintf(atcmd_output, "Cannot find player '%s' online", atcmd_player_name); - clif_displaymessage(fd, atcmd_output); - return -1; + + sprintf(atcmd_output, "'%s' and his(her) partner are now divorced.", atcmd_player_name); + clif_displaymessage(fd, atcmd_output); + return 0; } @@ -7438,61 +6981,6 @@ int atcommand_dmtick(const int fd, struct map_session_data* sd, const char* comm #endif /*========================================== - * @grind by [MouseJstr] - *------------------------------------------ - */ -int atcommand_grind(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd = NULL; - int skillnum; - int inf; - char target[NAME_LENGTH]; - nullpo_retr(-1, sd); - - if (!message || !*message) - return -1; - if(sscanf(message, "%23s", target) != 1) { - clif_displaymessage(fd, "Usage: @grind <target>"); - return -1; - } - if((pl_sd=map_nick2sd(target)) == NULL) - return -1; - - for (skillnum = 1; skillnum < 500; skillnum++) { - sd->status.sp = sd->status.max_sp; - atcommand_alive(fd, sd, command, message); - - inf = skill_get_inf(skillnum); - - if (inf & INF_GROUND_SKILL) - unit_skilluse_pos(&sd->bl, pl_sd->bl.x, pl_sd->bl.y, skillnum, 1); - else if (!(inf & INF_SUPPORT_SKILL)) - unit_skilluse_id(&sd->bl, pl_sd->bl.id, skillnum, 1); - } - - return 0; -} - -/*========================================== - * @grind2 by [MouseJstr] - *------------------------------------------ - */ -int atcommand_grind2(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int i; - short x, y; - - for (i = 1000; i < MAX_MOB_DB; i++) { - if (!mobdb_checkid(i)) - continue; - map_search_freecell(&sd->bl, 0, &x, &y, 5, 5, 0); - mob_once_spawn(sd, "this", x, y, "--ja--", i, 1, ""); - } - - return 0; -} - -/*========================================== * @changelook by [Celest] *------------------------------------------ */ @@ -7898,15 +7386,13 @@ int atcommand_sound(const int fd, struct map_session_data *sd, const char *comma { char sound_file[100]; - if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) { + memset(sound_file, '\0', sizeof(sound_file)); + + if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) { clif_displaymessage(fd, "Please, enter a sound filename. (usage: @sound <filename>)"); return -1; } - memset(sound_file, '\0', sizeof(sound_file)); - if(sscanf(message, "%99[^\n]", sound_file) < 1) - return -1; - if(strstr(sound_file, ".wav") == NULL) strcat(sound_file, ".wav"); @@ -7951,15 +7437,17 @@ int atcommand_mobsearch(const int fd, struct map_session_data* sd, const char* c nullpo_retr(-1, sd); - if (sscanf(message, "%99[^\n]", mob_name) < 0) + if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) { + clif_displaymessage(fd, "Please, enter a monster name (usage: @mobsearch <monster name>)."); return -1; + } if ((mob_id = atoi(mob_name)) == 0) mob_id = mobdb_searchname(mob_name); if(mob_id > 0 && mobdb_checkid(mob_id) == 0){ snprintf(atcmd_output, sizeof atcmd_output, "Invalid mob id %s!",mob_name); clif_displaymessage(fd, atcmd_output); - return 0; + return -1; } if(mob_id == atoi(mob_name) && mob_db(mob_id)->jname) strcpy(mob_name,mob_db(mob_id)->jname); // --ja-- @@ -8008,13 +7496,23 @@ int atcommand_npctalk(const int fd, struct map_session_data* sd, const char* com char name[NAME_LENGTH],mes[100],temp[100]; struct npc_data *nd; - if (sscanf(message, "%23[^,],%99[^\n]", name, mes) < 2) + if (sd->sc.count && //no "chatting" while muted. + (sd->sc.data[SC_BERSERK].timer!=-1 || + (sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT))) + return -1; + + if (!message || !*message || sscanf(message, "%23[^,],%99[^\n]", name, mes) < 2) { + clif_displaymessage(fd, "Please, enter the correct info (usage: @npctalk <npc name> <message>)."); return -1; + } if (!(nd = npc_name2id(name))) + { + clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist return -1; + } - snprintf(temp, sizeof temp ,"%s : %s",name,mes); + snprintf(temp, sizeof temp ,"%s: %s",name,mes); clif_message(&nd->bl, temp); return 0; @@ -8024,21 +7522,42 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com { char mes[100],temp[100]; struct pet_data *pd; + const char* emo[] = { "/!", "/?", "/ho", "/lv", "/swt", "/ic", "/an", "/ag", "/$", "/...", + "/scissors", "/rock", "/paper", "/korea", "/lv2", "/thx", "/wah", "/sry", "/heh", "/swt2", + "/hmm", "/no1", "/??", "/omg", "/O", "/X", "/hlp", "/go", "/sob", "/gg", + "/kis", "/kis2", "/pif", "/ok", "-?-", "-?-", "/bzz", "/rice", "/awsm", "/meh", + "/shy", "/pat", "/mp", "/slur", "/com", "/yawn", "/grat", "/hp", "/philippines", "/usa", + "/indonesia", "/brazil", "/fsh", "/spin", "/sigh", "/dum", "/crwd", "/desp", "/dice", NULL }; nullpo_retr(-1, sd); if(!sd->status.pet_id || !(pd=sd->pd)) + { + clif_displaymessage(fd, msg_txt(184)); return -1; + } if (sd->sc.count && //no "chatting" while muted. (sd->sc.data[SC_BERSERK].timer!=-1 || (sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT))) return -1; - if (sscanf(message, "%99[^\n]", mes) < 1) + if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { + clif_displaymessage(fd, "Please, enter a message (usage: @pettalk <message>"); return -1; + } + + if (message[0] == '/') { + int i; + for (i = 0; emo[i] != NULL; i++) { + if (!stricmp(message, emo[i])) { + clif_emotion(&pd->bl, i); + return 0; + } + } + } - snprintf(temp, sizeof temp ,"%s : %s",pd->pet.name,mes); + snprintf(temp, sizeof temp ,"%s: %s",pd->pet.name,mes); clif_message(&pd->bl, temp); return 0; @@ -8064,7 +7583,7 @@ static int atcommand_users_sub2(DBKey key,void* val,va_list va) { char buf[256]; struct map_session_data* sd = va_arg(va,struct map_session_data*); - sprintf(buf,"%s : %d (%d%%)",mapindex_id2name(key.i),(int)val,(int)val * 100 / users_all); + sprintf(buf,"%s: %d (%d%%)",mapindex_id2name(key.i),(int)val,(int)val * 100 / users_all); clif_displaymessage(sd->fd,buf); return 0; } @@ -8077,7 +7596,7 @@ int atcommand_users(const int fd, struct map_session_data* sd, const char* comma users_db->clear(users_db, NULL); clif_foreachclient(atcommand_users_sub1); users_db->foreach(users_db,atcommand_users_sub2,sd); - sprintf(buf,"all : %d",users_all); + sprintf(buf,"all: %d",users_all); clif_displaymessage(fd,buf); return 0; } @@ -8109,10 +7628,11 @@ int atcommand_summon(const int fd, struct map_session_data* sd, const char* comm nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - if (sscanf(message, "%23s %d", name, &duration) < 1) + if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1) + { + clif_displaymessage(fd, "Please, enter a monster name (usage: @summon <monster name> [duration]"); return -1; + } if (duration < 1) duration =1; @@ -8122,20 +7642,25 @@ int atcommand_summon(const int fd, struct map_session_data* sd, const char* comm if ((mob_id = atoi(name)) == 0) mob_id = mobdb_searchname(name); if(mob_id == 0 || mobdb_checkid(mob_id) == 0) + { + clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name. return -1; + } md = mob_once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, ""); - if(md){ - md->master_id=sd->bl.id; - md->special_state.ai=1; - md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0); - clif_misceffect2(&md->bl,344); - mob_spawn(md); - sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); - clif_skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); - } - + if(!md) + return -1; + + md->master_id=sd->bl.id; + md->special_state.ai=1; + md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0); + clif_misceffect2(&md->bl,344); + mob_spawn(md); + sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); + clif_skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); + clif_displaymessage(fd, msg_txt(39)); // All monster summoned! + return 0; } @@ -8200,8 +7725,11 @@ int atcommand_adjgmlvl(const int fd, struct map_session_data* sd, const char* co return -1; } - if((pl_sd=map_nick2sd((char *) user)) == NULL) - return -1; + if ( (pl_sd = map_nick2sd(user)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } pc_set_gm_level(pl_sd->status.account_id, newlev); @@ -8218,13 +7746,19 @@ int atcommand_trade(const int fd, struct map_session_data* sd, const char* comma struct map_session_data *pl_sd = NULL; nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - if((pl_sd=map_nick2sd((char *) message)) != NULL) { - trade_traderequest(sd, pl_sd); - return 0; - } - return -1; + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @trade <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + trade_traderequest(sd, pl_sd); + return 0; } /*========================================== @@ -8242,9 +7776,12 @@ int atcommand_setbattleflag(const int fd, struct map_session_data* sd, const cha } if (battle_set_value(flag, value) == 0) - clif_displaymessage(fd, "unknown battle_config flag"); - else - clif_displaymessage(fd, "battle_config set as requested"); + { + clif_displaymessage(fd, "unknown battle_config flag"); + return -1; + } + + clif_displaymessage(fd, "battle_config set as requested"); return 0; } @@ -8258,19 +7795,26 @@ int atcommand_unmute(const int fd, struct map_session_data* sd, const char* comm struct map_session_data *pl_sd = NULL; nullpo_retr(-1, sd); - if (!message || !*message) - return -1; + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a player name (usage: @unmute <player>)."); + return -1; + } - if((pl_sd=map_nick2sd((char *) message)) != NULL) { - if(pl_sd->sc.data[SC_NOCHAT].timer!=-1) { - pl_sd->status.manner = 0; - status_change_end(&pl_sd->bl,SC_NOCHAT,-1); - clif_displaymessage(sd->fd,"Player unmuted"); - } - else - clif_displaymessage(sd->fd,"Player is not muted"); + if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; } + if(pl_sd->sc.data[SC_NOCHAT].timer == -1) { + clif_displaymessage(sd->fd,"Player is not muted"); + return -1; + } + + pl_sd->status.manner = 0; + status_change_end(&pl_sd->bl,SC_NOCHAT,-1); + clif_displaymessage(sd->fd,"Player unmuted"); + return 0; } @@ -8325,21 +7869,23 @@ int atcommand_mute(const int fd, struct map_session_data* sd, const char* comman return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) { - if (pc_isGM(pl_sd) > pc_isGM(sd)) { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - clif_GM_silence(sd, pl_sd, 0); - pl_sd->status.manner -= manner; - if(pl_sd->status.manner < 0) - sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0); - } - else { + if ( (pl_sd = map_nick2sd(atcmd_player_name)) == NULL ) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + clif_GM_silence(sd, pl_sd, 0); + pl_sd->status.manner -= manner; + if(pl_sd->status.manner < 0) + sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0); + return 0; } @@ -8368,10 +7914,12 @@ int atcommand_petid(const int fd, struct map_session_data* sd, const char* comma nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - if (sscanf(message, "%99s", searchtext) < 1) + if (!message || !*message || sscanf(message, "%99s", searchtext) < 1) + { + clif_displaymessage(fd, "Please, enter a player name (usage: @petid <monster name>)."); return -1; + } + estr_lower(searchtext); snprintf(temp0, sizeof(temp0), "Search results for: %s", searchtext); clif_displaymessage(fd,temp0); @@ -8435,6 +7983,8 @@ int atcommand_gmotd(const int fd, struct map_session_data* sd, const char* comma if( (fp = fopen(motd_txt, "r"))!=NULL){ while (fgets(buf, 250, fp) != NULL){ int i; + if (buf[0] == '/' && buf[1] == '/') + continue; for( i=0; buf[i]; i++){ if( buf[i]=='\r' || buf[i]=='\n'){ buf[i]=0; @@ -8467,41 +8017,6 @@ int atcommand_misceffect(const int fd, struct map_session_data* sd, const char* * Added in by nsstrunks *------------------------------------------ */ -int atcommand_jumptoid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int cid=0; - struct map_session_data *pl_sd; - - memset(atcmd_output, '\0', sizeof(atcmd_output)); - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID (usage: @jumptoid/@warptoid/@gotoid <char id>)."); - return -1; - } - - pl_sd = map_charid2sd(cid); - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(154)); // Character not found. - return -1; - } - if (map[pl_sd->bl.m].flag.nowarpto && - battle_config.any_warp_GM_min_level > pc_isGM(sd)) - { - clif_displaymessage(fd, msg_txt(247)); - return -1; - } - if (map[sd->bl.m].flag.nowarp && - battle_config.any_warp_GM_min_level > pc_isGM(sd)) - { - clif_displaymessage(fd, msg_txt(248)); - return -1; - } - - pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); - sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jump to %s - clif_displaymessage(fd, atcmd_output); - return 0; -} /*========================================== * Jump to a player by PID number @@ -8551,48 +8066,6 @@ int atcommand_jumptoid2(const int fd, struct map_session_data* sd, const char* c * Added in by nsstrunks *------------------------------------------ */ -int atcommand_recallid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int cid=0; - struct map_session_data *pl_sd; - - memset(atcmd_output, '\0', sizeof(atcmd_output)); - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID (usage: @recallid <char id>)."); - return -1; - } - - pl_sd = map_charid2sd(cid); - - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(154)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) { // you can recall only lower or same level - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - - if (map[pl_sd->bl.m].flag.nowarpto && - battle_config.any_warp_GM_min_level > pc_isGM(sd)) - { - clif_displaymessage(fd, msg_txt(247)); - return -1; - } - if (map[sd->bl.m].flag.nowarp && - battle_config.any_warp_GM_min_level > pc_isGM(sd)) - { - clif_displaymessage(fd, msg_txt(248)); - return -1; - } - - pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2); - sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // Jump to %s - clif_displaymessage(fd, atcmd_output); - return 0; -} /*========================================== * Recall a player by PID number @@ -8648,31 +8121,6 @@ int atcommand_recallid2(const int fd, struct map_session_data* sd, const char* c * Added in by nsstrunks *------------------------------------------ */ -int atcommand_kickid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd; - int cid=0; - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID (usage: @kickid <char id>)."); - return -1; - } - - pl_sd = map_charid2sd(cid); - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) - { // you can kick only lower or same gm level - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - - clif_GM_kick(sd, pl_sd, 1); - return 0; -} /*========================================== * Kick a player by PID number @@ -8710,28 +8158,6 @@ int atcommand_kickid2(const int fd, struct map_session_data* sd, const char* com * Added in by nsstrunks *------------------------------------------ */ -int atcommand_reviveid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int cid=0; - struct map_session_data *pl_sd; - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID (usage: @reviveid <char id>)."); - return -1; - } - - pl_sd = map_charid2sd(cid); - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - if(!status_revive(&pl_sd->bl, 100, 100)) - return -1; - - clif_skill_nodamage(&pl_sd->bl,&pl_sd->bl,ALL_RESURRECTION,4,1); - clif_displaymessage(fd, msg_txt(51)); // Character revived. - return 0; -} /*========================================== * Revive a player by PID number @@ -8770,33 +8196,6 @@ int atcommand_reviveid2(const int fd, struct map_session_data* sd, const char* c * Added in by nsstrunks *------------------------------------------ */ -int atcommand_killid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - int cid=0; - struct map_session_data *pl_sd; - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID (usage: @killid <char id>)."); - return -1; - } - - pl_sd = map_charid2sd(cid); - - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) - { // you can kill only lower or same level - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - - status_kill(&pl_sd->bl); - clif_displaymessage(fd, msg_txt(14)); // Character killed. - return 0; -} /*========================================== * Kill a player by PID number @@ -8831,83 +8230,6 @@ int atcommand_killid2(const int fd, struct map_session_data* sd, const char* com return 0; } -/*========================================== - * Make a player killable, by PID - * Original by Dino9021 - * Added in by nsstrunks - *------------------------------------------ - */ -int atcommand_charkillableid(const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd = NULL; - int cid=0; - - if (!message || (cid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player CID."); - return -1; - } - - pl_sd = map_charid2sd(cid); - - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) - { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - - pl_sd->state.killable = !pl_sd->state.killable; - if(pl_sd->state.killable) - clif_displaymessage(fd, msg_txt(289)); - else - clif_displaymessage(fd, msg_txt(290)); - return 0; -} - - -/*========================================== - * Make a player killable, by PID - * Original by Dino9021 - * Added in by nsstrunks - *------------------------------------------ - */ -int atcommand_charkillableid2( const int fd, struct map_session_data* sd, const char* command, const char* message) -{ - struct map_session_data *pl_sd = NULL; - int aid=0; - - if (!message || (aid = atoi(message)) == 0) { - clif_displaymessage(fd, "Please, enter a player AID."); - return -1; - } - - pl_sd = map_id2sd(aid); - - if (!pl_sd) { - clif_displaymessage(fd, msg_txt(3)); // Character not found. - return -1; - } - - if (pc_isGM(sd) < pc_isGM(pl_sd)) - { - clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. - return -1; - } - - pl_sd->state.killable = !pl_sd->state.killable; - - if(pl_sd->state.killable) - clif_displaymessage(fd, msg_txt(289)); - else - clif_displaymessage(fd, msg_txt(290)); - - return 0; -} - #ifndef TXT_ONLY /* Begin SQL-Only commands */ /*========================================== @@ -9204,11 +8526,15 @@ int atcommand_homlevel(const int fd, struct map_session_data* sd, const char* co nullpo_retr(-1, sd); - if (!message || !*message) + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a level adjustment: (usage: @homlevel <+/- # of levels>."); return -1; + } - if ( !merc_is_hom_active(sd->hd) ) - return 1 ; + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); + return -1; + } level = atoi(message); hd = sd->hd; @@ -9231,11 +8557,19 @@ int atcommand_homevolution(const int fd, struct map_session_data* sd, const char { nullpo_retr(-1, sd); - if (sd->hd && sd->hd->homunculusDB->evo_class) + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); + return -1; + } + + if (sd->hd->homunculusDB->evo_class) { merc_hom_evolution(sd->hd) ; + return 0; } - return 0; + + clif_displaymessage(fd, "Your homunculus doesn't evove."); + return -1; } /*========================================== @@ -9246,44 +8580,56 @@ int atcommand_makehomun(const int fd, struct map_session_data* sd, const char* c { int homunid; nullpo_retr(-1, sd); - if(sscanf(message, "%d", &homunid)<1) + + if ( merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, msg_txt(450)); return -1; - if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 ) + } + + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a homunculus id: (usage: @makehomun <homunculus id>."); return -1; - if(sd->status.hom_id == 0) - { - merc_create_homunculus_request(sd,homunid); } - else + + homunid = atoi(message); + if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 ) { - clif_displaymessage(fd,msg_txt(450)); + clif_displaymessage(fd, "Invalid Homunculus id."); + return -1; } + + merc_create_homunculus_request(sd,homunid); return 0; } /*========================================== * modify homunculus intimacy [orn] *------------------------------------------ - */ +ho */ int atcommand_homfriendly(const int fd, struct map_session_data* sd, const char* command, const char* message) { int friendly = 0; nullpo_retr(-1, sd); - if (!message || !*message) + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); return -1; + } - friendly = atoi(message); - if (merc_is_hom_active(sd->hd)) { - if (friendly > 0 && friendly <= 1000) { - sd->hd->homunculus.intimacy = friendly * 100 ; - clif_send_homdata(sd,SP_INTIMATE,friendly); - } else { - return -1; - } + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a friendly value: (usage: @homfriendly <friendly value[0-1000]>."); + return -1; } + friendly = atoi(message); + if (friendly < 0) + friendly = 0; + else if (friendly > 1000) + friendly = 1000; + + sd->hd->homunculus.intimacy = friendly * 100 ; + clif_send_homdata(sd,SP_INTIMATE,friendly); return 0; } @@ -9297,20 +8643,24 @@ int atcommand_homhungry(const int fd, struct map_session_data* sd, const char* c nullpo_retr(-1, sd); - if (!message || !*message) + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); return -1; + } - hungry = atoi(message); - if (sd->status.hom_id > 0 && sd->hd) { - struct homun_data *hd = sd->hd; - if (hungry >= 0 && hungry <= 100) { - hd->homunculus.hunger = hungry; - clif_send_homdata(sd,SP_HUNGRY,hd->homunculus.hunger); - } else { - return -1; - } + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a hunger value: (usage: @homhungry <hunger value[0-100]>."); + return -1; } + hungry = atoi(message); + if (hungry < 0) + hungry = 0; + else if (hungry > 100) + hungry = 100; + + sd->hd->homunculus.hunger = hungry; + clif_send_homdata(sd,SP_HUNGRY,hungry); return 0; } @@ -9324,13 +8674,22 @@ int atcommand_homtalk(const int fd, struct map_session_data* sd, const char* com nullpo_retr(-1, sd); - if(!merc_is_hom_active(sd->hd)) + if (sd->sc.count && //no "chatting" while muted. + (sd->sc.data[SC_BERSERK].timer!=-1 || + (sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT))) + return -1; + + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); return -1; + } - if (sscanf(message, "%99[^\n]", mes) < 1) + if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) { + clif_displaymessage(fd, "Please, enter a message (usage: @homtalk <message>"); return -1; + } - snprintf(temp, sizeof temp ,"%s : %s",sd->hd->homunculus.name,mes); + snprintf(temp, sizeof temp ,"%s: %s",sd->hd->homunculus.name,mes); clif_message(&sd->hd->bl, temp); return 0; @@ -9346,8 +8705,11 @@ int atcommand_hominfo(const int fd, struct map_session_data* sd, const char* com struct status_data *status; nullpo_retr(-1, sd); - if(!merc_is_hom_active(sd->hd)) + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); return -1; + } + hd = sd->hd; status = status_get_status_data(&hd->bl); clif_displaymessage(fd, "Homunculus stats :"); @@ -9382,8 +8744,11 @@ int atcommand_homstats(const int fd, struct map_session_data* sd, const char* co nullpo_retr(-1, sd); - if(!merc_is_hom_active(sd->hd)) + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, "You do not have a homunculus."); return -1; + } + hd = sd->hd; hom = &hd->homunculus; @@ -9500,19 +8865,19 @@ int atcommand_iteminfo(const int fd, struct map_session_data* sd, const char* co int i, count = 1; if (!message || !*message) { - clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @iteminfo <item_name_or_ID>)."); + clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @ii/@iteminfo <item name or ID>)."); return -1; } if ((item_array[0] = itemdb_exists(atoi(message))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (!count) { - clif_displaymessage(fd, "Item not found."); + clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. return -1; } if (count > MAX_SEARCH) { - sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); + sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches clif_displaymessage(fd, atcmd_output); count = MAX_SEARCH; } @@ -9550,19 +8915,19 @@ int atcommand_whodrops(const int fd, struct map_session_data* sd, const char* co int i,j, count = 1; if (!message || !*message) { - clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @whodrops <item_name_or_ID>)."); + clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @whodrops <item name or ID>)."); return -1; } if ((item_array[0] = itemdb_exists(atoi(message))) == NULL) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (!count) { - clif_displaymessage(fd, "Item not found."); + clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. return -1; } if (count > MAX_SEARCH) { - sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); + sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches clif_displaymessage(fd, atcmd_output); count = MAX_SEARCH; } @@ -9604,13 +8969,10 @@ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* comma nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - - if (sscanf(message, "%23[^,],%23[^,],%23[^\r\n]", player1, player2, player3) != 3) { - clif_displaymessage(fd, "usage: @adopt <player1>,<player2>,<player3>."); - return -1; - } + if (!message || !*message || sscanf(message, "%23[^,],%23[^,],%23[^\r\n]", player1, player2, player3) < 3) { + clif_displaymessage(fd, "usage: @adopt <player1>,<player2>,<player3>."); + return -1; + } if (battle_config.etc_log) printf("Adopting: --%s--%s--%s--\n",player1,player2,player3); @@ -9633,17 +8995,12 @@ int atcommand_adopt(const int fd, struct map_session_data* sd, const char* comma return -1; } - if((pl_sd1->status.base_level < 70) || (pl_sd2->status.base_level < 70)){ - clif_displaymessage(fd, "They are too young to be parents!"); - return -1; - } - - if (pc_adoption(pl_sd1, pl_sd2, pl_sd3) == 0) { - clif_displaymessage(fd, "They are family.. wish them luck"); - return 0; - } - else - return -1; + if (pc_adoption(pl_sd1, pl_sd2, pl_sd3) == 0) { + clif_displaymessage(fd, "They are family.. wish them luck"); + return 0; + } + else + return -1; } int atcommand_version(const int fd, struct map_session_data* sd, const char* command, const char* message) @@ -9689,9 +9046,13 @@ int atcommand_mutearea(const int fd, struct map_session_data* sd, const char* co int time; nullpo_retr(0, sd); + if (!message || !*message) { + clif_displaymessage(fd, "Please, enter a time in minutes (usage: @mutearea/@stfu <time in minutes>."); + return -1; + } + time = atoi(message); - if (!time) - time = 15; // 15 minutes default + map_foreachinarea(atcommand_mutearea_sub,sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time); @@ -9723,7 +9084,7 @@ int atcommand_me(const int fd, struct map_session_data* sd, const char* command, { char tempmes[200]; nullpo_retr(-1, sd); - + memset(tempmes, '\0', sizeof(tempmes)); memset(atcmd_output, '\0', sizeof(atcmd_output)); @@ -9732,15 +9093,14 @@ int atcommand_me(const int fd, struct map_session_data* sd, const char* command, (sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCHAT))) return -1; - if (!message || !*message) { + if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) { clif_displaymessage(fd, "Please, enter a message (usage: @me <message>)."); return -1; } - sscanf(message, "%199[^\n]", tempmes); - sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); - clif_disp_overhead(sd, atcmd_output); - + sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s* + clif_disp_overhead(sd, atcmd_output); + return 0; } @@ -9756,12 +9116,7 @@ int atcommand_size(const int fd, struct map_session_data* sd, const char* comman nullpo_retr(-1, sd); - if (!message || !*message) - return -1; - - if (sscanf(message,"%d", &size) < 1) - return -1; - + size = atoi(message); if(sd->state.size) { sd->state.size=0; pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, 3); @@ -9814,19 +9169,14 @@ int atcommand_fakename(const int fd, struct map_session_data* sd, const char* co return 0; } - if (!message || !*message) { + if (!message || !*message || sscanf(message, "%23[^\n]", name) < 1) { clif_displaymessage(sd->fd,"You must enter a name."); - return 0; + return -1; } - - if (sscanf(message, "%23[^\n]", name) < 1) { - return 0; - } - if(strlen(name) < 2) { clif_displaymessage(sd->fd,"Fake name must be at least two characters."); - return 0; + return -1; } memcpy(sd->fakename,name,NAME_LENGTH); @@ -10095,12 +9445,12 @@ int atcommand_clone(const int fd, struct map_session_data* sd, const char* comma } if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) { - clif_displaymessage(fd, msg_txt(3)); + clif_displaymessage(fd, msg_txt(3)); // Character not found. return 0; } if(pc_isGM(pl_sd) > pc_isGM(sd)) { - clif_displaymessage(fd, msg_txt(126)); + clif_displaymessage(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself. return 0; } @@ -10111,7 +9461,7 @@ int atcommand_clone(const int fd, struct map_session_data* sd, const char* comma master = sd->bl.id; if (battle_config.atc_slave_clone_limit && mob_countslave(&sd->bl) >= battle_config.atc_slave_clone_limit) { - clif_displaymessage(fd, msg_txt(127)); + clif_displaymessage(fd, msg_txt(127)); // You've reached your slave clones limit. return 0; } } @@ -10127,10 +9477,10 @@ int atcommand_clone(const int fd, struct map_session_data* sd, const char* comma } if((x = mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) { - clif_displaymessage(fd, msg_txt(128+flag*2)); + clif_displaymessage(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned. return 0; } - clif_displaymessage(fd, msg_txt(129+flag*2)); + clif_displaymessage(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone. return 0; } @@ -10211,17 +9561,30 @@ int atcommand_noask(const int fd, struct map_session_data* sd, const char* comma int atcommand_request(const int fd, struct map_session_data* sd, const char* command, const char* message) { if (!message || !*message) { - clif_displaymessage(sd->fd,msg_txt(277)); + clif_displaymessage(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>. return -1; } - sprintf(atcmd_output, msg_txt(278), message); + sprintf(atcmd_output, msg_txt(278), message); // (@request): %s intif_wis_message_to_gm(sd->status.name, lowest_gm_level, atcmd_output); clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output)); - clif_displaymessage(sd->fd,msg_txt(279)); + clif_displaymessage(sd->fd,msg_txt(279)); // @request sent. return 0; } +/*========================================== + * Feel (SG save map) Reset [HiddenDragon] + *------------------------------------------ + */ +int atcommand_feelreset( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + pc_resetfeel(sd); + clif_displaymessage(fd, "Reset 'Feeling' maps."); + + return 0; +} void do_init_atcommand() { diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 9d4880cb3..3dd8fc838 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -73,7 +73,7 @@ enum AtCommandType { AtCommand_Produce, AtCommand_Memo, AtCommand_GAT, - AtCommand_Packet, + AtCommand_DisplayStatus, AtCommand_StatusPoint, AtCommand_SkillPoint, AtCommand_Zeny, @@ -90,9 +90,6 @@ enum AtCommandType { AtCommand_PetHungry, AtCommand_PetRename, AtCommand_Recall, - AtCommand_Revive, - AtCommand_CharacterStatsAll, - AtCommand_CharacterLoad, AtCommand_Night, AtCommand_Day, AtCommand_Doom, @@ -132,7 +129,6 @@ enum AtCommandType { AtCommand_CharUnBlock, // by Yor AtCommand_CharUnBan, // by Yor AtCommand_MountPeco, // by Valaris - AtCommand_CharMountPeco, // by Yor AtCommand_GuildSpy, // [Syrus22] AtCommand_PartySpy, // [Syrus22] AtCommand_RepairAll, // [Valaris] @@ -144,20 +140,15 @@ enum AtCommandType { AtCommand_Loadnpc, AtCommand_Unloadnpc, AtCommand_ServerTime, // by Yor - AtCommand_CharDelItem, // by Yor AtCommand_Jail, // by Yor AtCommand_UnJail, // by Yor AtCommand_JailFor, // Meruru AtCommand_JailTime, // Coltaro - AtCommand_CharJailTime, // Coltaro AtCommand_Disguise, // [Valaris] AtCommand_UnDisguise, // by Yor - AtCommand_CharDisguise, // Kalaspuff - AtCommand_CharUnDisguise, // Kalaspuff AtCommand_EMail, // by Yor AtCommand_Hatch, AtCommand_Effect, // by Apple - AtCommand_Char_Cart_List, // by Yor AtCommand_AddWarp, // by MouseJstr AtCommand_Follow, // by MouseJstr AtCommand_SkillOn, // by MouseJstr @@ -165,11 +156,8 @@ enum AtCommandType { AtCommand_Killer, // by MouseJstr AtCommand_NpcMove, // by MouseJstr AtCommand_Killable, // by MouseJstr - AtCommand_CharKillable, // by MouseJstr AtCommand_Dropall, // by MouseJstr - AtCommand_Chardropall, // by MouseJstr AtCommand_Storeall, // by MouseJstr - AtCommand_Charstoreall, // by MouseJstr AtCommand_Skillid, // by MouseJstr AtCommand_Useskill, // by MouseJstr AtCommand_DisplaySkill, @@ -203,41 +191,17 @@ enum AtCommandType { AtCommand_NpcTalk, AtCommand_PetTalk, AtCommand_Users, - // SQL-only commands start -#ifndef TXT_ONLY - AtCommand_CheckMail, // [Valaris] - AtCommand_ListMail, // [Valaris] - AtCommand_ListNewMail, // [Valaris] - AtCommand_ReadMail, // [Valaris] - AtCommand_SendMail, // [Valaris] - AtCommand_DeleteMail, // [Valaris] - AtCommand_SendPriorityMail, // [Valaris] - AtCommand_RefreshOnline, // [Valaris] - // SQL-only commands end -#endif AtCommand_SkillTree, // by MouseJstr AtCommand_Marry, // by MouseJstr AtCommand_Divorce, // by MouseJstr - AtCommand_Grind, // by MouseJstr - AtCommand_Grind2, // by MouseJstr - AtCommand_Me, //added by massdriller, code by lordalfa - AtCommand_DMStart, // by MouseJstr AtCommand_DMTick, // by MouseJstr - - AtCommand_JumpToId, // by Dino9021 AtCommand_JumpToId2, // by Dino9021 - AtCommand_RecallId, // by Dino9021 AtCommand_RecallId2, // by Dino9021 - AtCommand_KickId, // by Dino9021 AtCommand_KickId2, // by Dino9021 - AtCommand_ReviveId, // by Dino9021 AtCommand_ReviveId2, // by Dino9021 - AtCommand_KillId, // by Dino9021 AtCommand_KillId2, // by Dino9021 - AtCommand_CharKillableId, // by Dino9021 - AtCommand_CharKillableId2, // by Dino9021 AtCommand_Sound, AtCommand_UndisguiseAll, AtCommand_DisguiseAll, @@ -247,10 +211,8 @@ enum AtCommandType { AtCommand_Exp, // by Skotlex AtCommand_Adopt, // by Veider AtCommand_Version, // by Ancyker - AtCommand_MuteArea, // MouseJstr AtCommand_Rates, // MouseJstr - AtCommand_ItemInfo, // Lupus AtCommand_WhoDrops, // Skotlex AtCommand_MapFlag, // Lupus @@ -264,16 +226,13 @@ enum AtCommandType { AtCommand_ChangeGM,//durf AtCommand_ChangeLeader, AtCommand_PartyOption, - AtCommand_Invite, // By LuzZza AtCommand_Duel, // By LuzZza AtCommand_Leave, // By LuzZza AtCommand_Accept, // By LuzZza AtCommand_Reject, // By LuzZza - AtCommand_Away, // LuzZza AtCommand_Main, // LuzZza - AtCommand_Clone, // [Valaris] AtCommand_ToNPC, // LuzZza AtCommand_Commands, // [Skotlex] @@ -289,7 +248,21 @@ enum AtCommandType { AtCommand_HomStats, //[Skotlex] AtCommand_HomShuffle, //[Skotlex] AtCommand_ShowMobs, //KarLaeda - // end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex] + AtCommand_FeelReset, //[HiddenDragon] + AtCommand_HappyHappyJoyJoy, + // SQL-only commands start +#ifndef TXT_ONLY + AtCommand_CheckMail, // [Valaris] + AtCommand_ListMail, // [Valaris] + AtCommand_ListNewMail, // [Valaris] + AtCommand_ReadMail, // [Valaris] + AtCommand_SendMail, // [Valaris] + AtCommand_DeleteMail, // [Valaris] + AtCommand_SendPriorityMail, // [Valaris] + AtCommand_RefreshOnline, // [Valaris] + // SQL-only commands end +#endif + // No more commands after this line AtCommand_Unknown, AtCommand_MAX }; diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 209116bc4..756fc4943 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -23,9 +23,16 @@ #include "skill.h" #include "mob.h" #include "pet.h" +#include "mercenary.h" //[orn] #include "battle.h" #include "charcommand.h" #include "atcommand.h" +#include "party.h" +#include "guild.h" +#include "script.h" +#include "npc.h" +#include "trade.h" +#include "unit.h" char charcommand_symbol = '#'; @@ -60,7 +67,43 @@ CCMD_FUNC(skpoint); CCMD_FUNC(changesex); CCMD_FUNC(feelreset); CCMD_FUNC(help); - +CCMD_FUNC(load); +CCMD_FUNC(speed); +CCMD_FUNC(storage); +CCMD_FUNC(guildstorage); +CCMD_FUNC(hide); +CCMD_FUNC(alive); +CCMD_FUNC(heal); +CCMD_FUNC(item2); +CCMD_FUNC(itemreset); +CCMD_FUNC(refine); +CCMD_FUNC(produce); +CCMD_FUNC(param); +CCMD_FUNC(guildlevelup); +CCMD_FUNC(hatch); +CCMD_FUNC(pethungry); +CCMD_FUNC(allskill); +CCMD_FUNC(dye); +CCMD_FUNC(hair_style); +CCMD_FUNC(hair_color); +CCMD_FUNC(allstats); +CCMD_FUNC(mount_peco); +CCMD_FUNC(delitem); +CCMD_FUNC(jailtime); +CCMD_FUNC(disguise); +CCMD_FUNC(undisguise); +CCMD_FUNC(cart_list); +CCMD_FUNC(killer); +CCMD_FUNC(killable); +CCMD_FUNC(refresh); +CCMD_FUNC(exp); +CCMD_FUNC(monsterignore); +CCMD_FUNC(size); +CCMD_FUNC(homlevel); +CCMD_FUNC(homevolution); +CCMD_FUNC(homfriendly); +CCMD_FUNC(homhungry); +CCMD_FUNC(hominfo); /*========================================== *CharCommandInfo charcommand_info[]\‘¢‘Ì‚Ì’è‹` @@ -70,43 +113,101 @@ CCMD_FUNC(help); // First char of commands is configured in charcommand_athena.conf. Leave # in this list for default value. // to set default level, read charcommand_athena.conf first please. static CharCommandInfo charcommand_info[] = { - { CharCommandJobChange, "#job", 60, charcommand_jobchange }, - { CharCommandJobChange, "#jobchange", 60, charcommand_jobchange }, - { CharCommandPetRename, "#petrename", 50, charcommand_petrename }, - { CharCommandPetFriendly, "#petfriendly", 50, charcommand_petfriendly }, + { CharCommandJobChange, "#job", 60, charcommand_jobchange }, + { CharCommandJobChange, "#jobchange", 60, charcommand_jobchange }, + { CharCommandPetRename, "#petrename", 50, charcommand_petrename }, + { CharCommandPetFriendly, "#petfriendly", 50, charcommand_petfriendly }, { CharCommandStats, "#stats", 40, charcommand_stats }, - { CharCommandOption, "#option", 60, charcommand_option }, + { CharCommandOption, "#option", 60, charcommand_option }, { CharCommandReset, "#reset", 60, charcommand_reset }, { CharCommandSave, "#save", 60, charcommand_save }, - { CharCommandStatsAll, "#statsall", 40, charcommand_stats_all }, - { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, - { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, - { CharCommandEffect, "#effect", 40, charcommand_effect }, - { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, + { CharCommandSpiritball, "#spiritball", 40, charcommand_spiritball }, + { CharCommandItemList, "#itemlist", 40, charcommand_itemlist }, + { CharCommandEffect, "#effect", 40, charcommand_effect }, + { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, { CharCommandItem, "#item", 60, charcommand_item }, { CharCommandWarp, "#warp", 60, charcommand_warp }, { CharCommandWarp, "#rura", 60, charcommand_warp }, { CharCommandWarp, "#rura+", 60, charcommand_warp }, { CharCommandZeny, "#zeny", 60, charcommand_zeny }, - { CharCommandFakeName, "#fakename", 20, charcommand_fakename}, - - //*********************************Recently added commands********************************************* - { CharCommandBaseLevel, "#baselvl", 20, charcommand_baselevel}, - { CharCommandBaseLevel, "#blvl", 60, charcommand_baselevel}, - { CharCommandBaseLevel, "#baselvlup", 60, charcommand_baselevel}, - { CharCommandJobLevel, "#joblvl", 60, charcommand_joblevel}, - { CharCommandJobLevel, "#jlvl", 60, charcommand_joblevel}, - { CharCommandJobLevel, "#joblvlup", 60, charcommand_joblevel}, - { CharCommandQuestSkill, "#questskill", 60, charcommand_questskill }, - { CharCommandLostSkill, "#lostskill", 60, charcommand_lostskill }, - { CharCommandSkReset, "#skreset", 60, charcommand_skreset }, - { CharCommandStReset, "#streset", 60, charcommand_streset }, + { CharCommandFakeName, "#fakename", 50, charcommand_fakename}, + { CharCommandBaseLevel, "#baselvl", 60, charcommand_baselevel}, + { CharCommandBaseLevel, "#baselevel", 60, charcommand_baselevel}, + { CharCommandBaseLevel, "#blvl", 60, charcommand_baselevel}, + { CharCommandBaseLevel, "#blevel", 60, charcommand_baselevel}, + { CharCommandJobLevel, "#joblvl", 60, charcommand_joblevel}, + { CharCommandJobLevel, "#joblevel", 60, charcommand_joblevel}, + { CharCommandJobLevel, "#jlvl", 60, charcommand_joblevel}, + { CharCommandJobLevel, "#jlevel", 60, charcommand_joblevel}, + { CharCommandQuestSkill, "#questskill", 60, charcommand_questskill }, + { CharCommandLostSkill, "#lostskill", 60, charcommand_lostskill }, + { CharCommandSkReset, "#skreset", 60, charcommand_skreset }, + { CharCommandStReset, "#streset", 60, charcommand_streset }, { CharCommandModel, "#model", 50, charcommand_model }, - { CharCommandSKPoint, "#skpoint", 60, charcommand_skpoint }, - { CharCommandSTPoint, "#stpoint", 60, charcommand_stpoint }, - { CharCommandChangeSex, "#changesex", 60, charcommand_changesex }, - { CharCommandFeelReset, "#feelreset", 60, charcommand_feelreset }, - { CharCommandHelp, "#help", 20, charcommand_help }, + { CharCommandSKPoint, "#skpoint", 60, charcommand_skpoint }, + { CharCommandSTPoint, "#stpoint", 60, charcommand_stpoint }, + { CharCommandChangeSex, "#changesex", 60, charcommand_changesex }, + { CharCommandFeelReset, "#feelreset", 60, charcommand_feelreset }, + { CharCommandHelp, "#help", 20, charcommand_help }, + { CharCommandLoad, "#load", 60, charcommand_load }, + { CharCommandSpeed, "#speed", 60, charcommand_speed }, + { CharCommandStorage, "#storage", 60, charcommand_storage }, + { CharCommandGStorage, "#gstorage", 60, charcommand_guildstorage }, + { CharCommandHide, "#hide", 60, charcommand_hide }, + { CharCommandAlive, "#alive", 60, charcommand_alive }, + { CharCommandHeal, "#heal", 60, charcommand_heal }, + { CharCommandItem2, "#item2", 60, charcommand_item2 }, + { CharCommandItemReset, "#itemreset", 60, charcommand_itemreset }, + { CharCommandRefine, "#refine", 60, charcommand_refine }, + { CharCommandProduce, "#produce", 60, charcommand_produce }, + { CharCommandStrength, "#str", 60, charcommand_param }, + { CharCommandAgility, "#agi", 60, charcommand_param }, + { CharCommandVitality, "#vit", 60, charcommand_param }, + { CharCommandIntelligence, "#int", 60, charcommand_param }, + { CharCommandDexterity, "#dex", 60, charcommand_param }, + { CharCommandLuck, "#luk", 60, charcommand_param }, + { CharCommandGuildLevelUp, "#glvl", 60, charcommand_guildlevelup }, + { CharCommandGuildLevelUp, "#glevel", 60, charcommand_guildlevelup }, + { CharCommandGuildLevelUp, "#guildlvl", 60, charcommand_guildlevelup }, + { CharCommandGuildLevelUp, "#guildlevel", 60, charcommand_guildlevelup }, + { CharCommandHatch, "#hatch", 50, charcommand_hatch }, + { CharCommandPetHungry, "#pethungry", 60, charcommand_pethungry }, + { CharCommandAllSkill, "#allskill", 60, charcommand_allskill }, + { CharCommandAllSkill, "#allskills", 60, charcommand_allskill }, + { CharCommandAllSkill, "#skillall", 60, charcommand_allskill }, + { CharCommandAllSkill, "#skillsall", 60, charcommand_allskill }, + { CharCommandDye, "#dye", 50, charcommand_dye }, + { CharCommandHStyle, "#hairstyle", 50, charcommand_hair_style }, + { CharCommandHStyle, "#hstyle", 50, charcommand_hair_style }, + { CharCommandHColor, "#haircolor", 50, charcommand_hair_color }, + { CharCommandHColor, "#hcolor", 50, charcommand_hair_color }, + { CharCommandAllStats, "#allstat", 60, charcommand_allstats }, + { CharCommandAllStats, "#allstats", 60, charcommand_allstats }, + { CharCommandAllStats, "#statall", 60, charcommand_allstats }, + { CharCommandAllStats, "#statsall", 60, charcommand_allstats }, + { CharCommandMountPeco, "#mount", 50, charcommand_mount_peco }, + { CharCommandMountPeco, "#mountpeco", 50, charcommand_mount_peco }, + { CharCommandDelItem, "#delitem", 60, charcommand_delitem }, + { CharCommandJailTime, "#jailtime", 40, charcommand_jailtime }, + { CharCommandDisguie, "#disguise", 60, charcommand_disguise }, + { CharCommandUnDisguise, "#undisguise", 60, charcommand_undisguise }, + { CharCommandCartList, "#cartlist", 40, charcommand_cart_list }, + { CharCommandKiller, "#killer", 60, charcommand_killer }, + { CharCommandKillable, "#killable", 60, charcommand_killable }, + { CharCommandRefresh, "#refresh", 40, charcommand_refresh }, + { CharCommandExp, "#exp", 1, charcommand_exp }, + { CharCommandMonsterIgnore, "#monsterignore", 60, charcommand_monsterignore }, + { CharCommandSize, "#size", 50, charcommand_size }, + { CharCommandHomLevel, "#hlvl", 60, charcommand_homlevel }, + { CharCommandHomLevel, "#hlevel", 60, charcommand_homlevel }, + { CharCommandHomLevel, "#homlvl", 60, charcommand_homlevel }, + { CharCommandHomLevel, "#homlevel", 60, charcommand_homlevel }, + { CharCommandHomEvolve, "#homevolve", 60, charcommand_homevolution }, + { CharCommandHomEvolve, "#homevolvution", 60, charcommand_homevolution }, + { CharCommandHomFriendly, "#homfriendly", 60, charcommand_homfriendly }, + { CharCommandHomHungry, "#homhungry", 60, charcommand_homhungry }, + { CharCommandHomInfo, "#hominfo", 40, charcommand_hominfo }, + // add new commands before this line { CharCommand_Unknown, NULL, 1, NULL } }; @@ -121,8 +222,7 @@ int get_charcommand_level(const CharCommandType type) { return 100; // 100: command can not be used } -CharCommandType -is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl) { +CharCommandType is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl) { CharCommandInfo info; CharCommandType type; @@ -173,8 +273,7 @@ is_charcommand_sub(const int fd, struct map_session_data* sd, const char* str, i *is_charcommand @ƒRƒ}ƒ“ƒh‚É‘¶Ý‚·‚é‚©‚Ç‚¤‚©Šm”F‚·‚é *------------------------------------------ */ -CharCommandType -is_charcommand(const int fd, struct map_session_data* sd, const char* message) { +CharCommandType is_charcommand(const int fd, struct map_session_data* sd, const char* message) { const char* str = message; int s_flag = 0; @@ -318,50 +417,62 @@ int charcommand_jobchange( { char character[100]; struct map_session_data* pl_sd; - int job = 0, upper = -1; + int job = 0, upper = -1, j = 0; memset(character, '\0', sizeof(character)); - if (!message || !*message) { - clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange <job ID> <char name>)."); + if (!message || !*message || sscanf(message, "%d %23[^\n]", &job, character) < 2) { + clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange <job ID> <player>)."); + clif_displaymessage(fd, " 0 Novice 7 Knight 14 Crusader 21 Peco Crusader"); + clif_displaymessage(fd, " 1 Swordman 8 Priest 15 Monk 22 N/A"); + clif_displaymessage(fd, " 2 Mage 9 Wizard 16 Sage 23 Super Novice"); + clif_displaymessage(fd, " 3 Archer 10 Blacksmith 17 Rogue 24 Gunslinger"); + clif_displaymessage(fd, " 4 Acolyte 11 Hunter 18 Alchemist 25 Ninja"); + clif_displaymessage(fd, " 5 Merchant 12 Assassin 19 Bard 26 N/A"); + clif_displaymessage(fd, " 6 Thief 13 Peco Knight 20 Dancer"); + clif_displaymessage(fd, "4001 Novice High 4008 Lord Knight 4015 Paladin 4022 Peco Paladin"); + clif_displaymessage(fd, "4002 Swordman High 4009 High Priest 4016 Champion"); + clif_displaymessage(fd, "4003 Mage High 4010 High Wizard 4017 Professor"); + clif_displaymessage(fd, "4004 Archer High 4011 Whitesmith 4018 Stalker"); + clif_displaymessage(fd, "4005 Acolyte High 4012 Sniper 4019 Creator"); + clif_displaymessage(fd, "4006 Merchant High 4013 Assassin Cross 4020 Clown"); + clif_displaymessage(fd, "4007 Thief High 4014 Peco Lord Knight 4021 Gypsy"); + clif_displaymessage(fd, "4023 Baby Novice 4030 Baby Knight 4037 Baby Crusader 4044 Baby Peco Crusader"); + clif_displaymessage(fd, "4024 Baby Swordsman 4031 Baby Priest 4038 Baby Monk 4045 Super Baby"); + clif_displaymessage(fd, "4025 Baby Mage 4032 Baby Wizard 4039 Baby Sage 4046 Taekwon Kid"); + clif_displaymessage(fd, "4026 Baby Archer 4033 Baby Blacksmith 4040 Baby Rogue 4047 Taekwon Master"); + clif_displaymessage(fd, "4027 Baby Acolyte 4034 Baby Hunter 4041 Baby Alchemist 4048 N/A"); + clif_displaymessage(fd, "4028 Baby Merchant 4035 Baby Assassin 4042 Baby Bard 4049 Soul Linker"); + clif_displaymessage(fd, "4029 Baby Thief 4036 Baby Peco-Knight 4043 Baby Dancer"); return -1; } - if (sscanf(message, "%d %d %99[^\n]", &job, &upper, character) < 3) { //upperŽw’肵‚Ä‚ ‚é - upper = -1; - if (sscanf(message, "%d %99[^\n]", &job, character) < 2) { //upperŽw’肵‚Ä‚È‚¢ã‚ɉ½‚©‘«‚è‚È‚¢ - clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange <job ID> <char name>)."); - return -1; - } + if ((pl_sd = map_nick2sd(character)) == NULL) { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - int j; - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change job only to lower or same level - if ((job >= 0 && job < MAX_PC_CLASS)) { - for (j=0; j < MAX_INVENTORY; j++) { - if(pl_sd->status.inventory[j].nameid>0 && pl_sd->status.inventory[j].equip!=0) - pc_unequipitem(pl_sd, j, 3); - } - if (pc_jobchange(pl_sd, job, upper) == 0) - clif_displaymessage(fd, msg_table[48]); // Character's job changed. - else { - clif_displaymessage(fd, msg_table[192]); // Impossible to change the character's job. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[49]); // Invalid job ID. - return -1; - } - } 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. + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (job < 0 || job > MAX_PC_CLASS) { + clif_displaymessage(fd, msg_txt(49)); // Invalid job ID. + return -1; + } + + for (j=0; j < MAX_INVENTORY; j++) { + if(pl_sd->status.inventory[j].nameid>0 && pl_sd->status.inventory[j].equip!=0) + pc_unequipitem(pl_sd, j, 3); + } + if (pc_jobchange(pl_sd, job, upper) != 0) { + clif_displaymessage(fd, msg_txt(192)); // Impossible to change the character's job. return -1; } + clif_displaymessage(fd, msg_txt(48)); // Character's job changed. return 0; } @@ -380,7 +491,7 @@ int charcommand_petrename( memset(character, '\0', sizeof(character)); if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: #petrename <char name>)."); + clif_displaymessage(fd, "Please, enter a player name (usage: #petrename <player>)."); return -1; } @@ -390,20 +501,20 @@ int charcommand_petrename( } if (!pl_sd->status.pet_id || !pl_sd->pd) { - clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet. + clif_displaymessage(fd, msg_txt(191)); // Sorry, but this player has no pet. return -1; } pd = pl_sd->pd; if (pd->pet.rename_flag) { - clif_displaymessage(fd, msg_table[190]); // This player can already rename his/her pet. + clif_displaymessage(fd, msg_txt(190)); // This player can already rename his/her pet. return -1; } pd->pet.rename_flag = 0; intif_save_petdata(pl_sd->status.account_id, &pd->pet); clif_send_petstatus(pl_sd); - clif_displaymessage(fd, msg_table[189]); // This player can now rename his/her pet. + clif_displaymessage(fd, msg_txt(189)); // This player can now rename his/her pet. return 0; } @@ -423,38 +534,43 @@ int charcommand_petfriendly( memset(character, '\0', sizeof(character)); if (!message || !*message || sscanf(message,"%d %23s",&friendly,character) < 2) { - clif_displaymessage(fd, "Please, enter a valid value (usage: " - "#petfriendly <0-1000> <player>)."); + clif_displaymessage(fd, "Please, enter a valid value (usage: #petfriendly <0-1000> <player>)."); return -1; } - if (((pl_sd = map_nick2sd(character)) == NULL) || - pc_isGM(sd)<pc_isGM(pl_sd)) { + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } - if (!pl_sd->status.pet_id || !pl_sd->pd) { - clif_displaymessage(fd, msg_table[191]); // Sorry, but this player has no pet. + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } - if (friendly < 0 || friendly > 1000) { - clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. + if (!pl_sd->status.pet_id || !pl_sd->pd) { + clif_displaymessage(fd, msg_txt(191)); // Sorry, but this player has no pet. return -1; } + if (friendly < 0) + friendly = 0; + else if (friendly > 1000) + friendly = 1000; + pd = pl_sd->pd; if (friendly == pd->pet.intimate) { - clif_displaymessage(fd, msg_table[183]); // Pet friendly is already the good value. + clif_displaymessage(fd, msg_txt(183)); // Pet friendly is already the good value. return -1; } pd->pet.intimate = friendly; clif_send_petstatus(pl_sd); clif_pet_emotion(pd,0); - clif_displaymessage(pl_sd->fd, msg_table[182]); // Pet friendly value changed! - clif_displaymessage(sd->fd, msg_table[182]); // Pet friendly value changed! + clif_displaymessage(pl_sd->fd, msg_txt(182)); // Pet friendly value changed! + clif_displaymessage(sd->fd, msg_txt(182)); // Pet friendly value changed! return 0; } @@ -471,63 +587,67 @@ int charcommand_stats( char output[200]; struct map_session_data *pl_sd; int i; + struct { + const char* format; + int value; + } output_table[] = { + { "Base Level - %d", 0 }, + { NULL, 0 }, + { "Hp - %d", 0 }, + { "MaxHp - %d", 0 }, + { "Sp - %d", 0 }, + { "MaxSp - %d", 0 }, + { "Str - %3d", 0 }, + { "Agi - %3d", 0 }, + { "Vit - %3d", 0 }, + { "Int - %3d", 0 }, + { "Dex - %3d", 0 }, + { "Luk - %3d", 0 }, + { "Zeny - %d", 0 }, + { NULL, 0 } + }; memset(character, '\0', sizeof(character)); memset(job_jobname, '\0', sizeof(job_jobname)); memset(output, '\0', sizeof(output)); if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: #stats <char name>)."); + clif_displaymessage(fd, "Please, enter a player name (usage: #stats <player>)."); return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - struct { - const char* format; - int value; - } output_table[] = { - { "Base Level - %d", 0 }, - { NULL, 0 }, - { "Hp - %d", 0 }, - { "MaxHp - %d", 0 }, - { "Sp - %d", 0 }, - { "MaxSp - %d", 0 }, - { "Str - %3d", 0 }, - { "Agi - %3d", 0 }, - { "Vit - %3d", 0 }, - { "Int - %3d", 0 }, - { "Dex - %3d", 0 }, - { "Luk - %3d", 0 }, - { "Zeny - %d", 0 }, - { NULL, 0 } - }; - //direct array initialization with variables is not standard C compliant. - output_table[0].value = pl_sd->status.base_level; - output_table[1].format = job_jobname; - output_table[1].value = pl_sd->status.job_level; - output_table[2].value = pl_sd->status.hp; - output_table[3].value = pl_sd->status.max_hp; - output_table[4].value = pl_sd->status.sp; - output_table[5].value = pl_sd->status.max_sp; - output_table[6].value = pl_sd->status.str; - output_table[7].value = pl_sd->status.agi; - output_table[8].value = pl_sd->status.vit; - output_table[9].value = pl_sd->status.int_; - output_table[10].value = pl_sd->status.dex; - output_table[11].value = pl_sd->status.luk; - output_table[12].value = pl_sd->status.zeny; - sprintf(job_jobname, "Job - %s %s", job_name(pl_sd->status.class_), "(level %d)"); - sprintf(output, msg_table[53], pl_sd->status.name); // '%s' stats: - clif_displaymessage(fd, output); - for (i = 0; output_table[i].format != NULL; i++) { - sprintf(output, output_table[i].format, output_table[i].value); - clif_displaymessage(fd, output); - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + //direct array initialization with variables is not standard C compliant. + output_table[0].value = pl_sd->status.base_level; + output_table[1].format = job_jobname; + output_table[1].value = pl_sd->status.job_level; + output_table[2].value = pl_sd->status.hp; + output_table[3].value = pl_sd->status.max_hp; + output_table[4].value = pl_sd->status.sp; + output_table[5].value = pl_sd->status.max_sp; + output_table[6].value = pl_sd->status.str; + output_table[7].value = pl_sd->status.agi; + output_table[8].value = pl_sd->status.vit; + output_table[9].value = pl_sd->status.int_; + output_table[10].value = pl_sd->status.dex; + output_table[11].value = pl_sd->status.luk; + output_table[12].value = pl_sd->status.zeny; + + sprintf(job_jobname, "Job - %s %s", job_name(pl_sd->status.class_), "(level %d)"); + sprintf(output, msg_txt(53), pl_sd->status.name); // '%s' stats: + + clif_displaymessage(fd, output); + + for (i = 0; output_table[i].format != NULL; i++) { + sprintf(output, output_table[i].format, output_table[i].value); + clif_displaymessage(fd, output); + } + return 0; } @@ -547,25 +667,27 @@ int charcommand_reset( memset(output, '\0', sizeof(output)); if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: #reset <charname>)."); + clif_displaymessage(fd, "Please, enter a player name (usage: #reset <player>)."); return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset a character only for lower or same GM level - pc_resetstate(pl_sd); - pc_resetskill(pl_sd,1); - sprintf(output, msg_table[208], character); // '%s' skill and stats points reseted! - clif_displaymessage(fd, 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. + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } + pc_resetstate(pl_sd); + pc_resetskill(pl_sd,1); + sprintf(output, msg_txt(208), character); // '%s' skill and stats points reseted! + clif_displaymessage(fd, output); + return 0; } @@ -586,25 +708,27 @@ int charcommand_option( if (!message || !*message || sscanf(message, "%d %d %d %23[^\n]", &opt1, &opt2, &opt3, character) < 4 || opt1 < 0 || opt2 < 0 || opt3 < 0) { - clif_displaymessage(fd, "Please, enter valid options and a player name (usage: #option <param1> <param2> <param3> <charname>)."); + clif_displaymessage(fd, "Please, enter valid options and a player name (usage: #option <param1> <param2> <param3> <player>)."); return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change option only to lower or same level - pl_sd->sc.opt1 = opt1; - pl_sd->sc.opt2 = opt2; - pc_setoption(pl_sd, opt3); - clif_displaymessage(fd, msg_table[58]); // Character's options changed. - } 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. + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + pl_sd->sc.opt1 = opt1; + pl_sd->sc.opt2 = opt2; + pc_setoption(pl_sd, opt3); + clif_displaymessage(fd, msg_txt(58)); // Character's options changed. + return 0; } @@ -626,37 +750,40 @@ int charcommand_save( memset(character, '\0', sizeof(character)); if (!message || !*message || sscanf(message, "%15s %d %d %23[^\n]", map_name, &x, &y, character) < 4 || x < 0 || y < 0) { - clif_displaymessage(fd, "Please, enter a valid save point and a player name (usage: #save <map> <x> <y> <charname>)."); + clif_displaymessage(fd, "Please, enter a valid save point and a player name (usage: #save <map> <x> <y> <player>)."); return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change save point only to lower or same gm level - m = map_mapname2mapid(map_name); - if (m < 0 && !mapindex_name2id(map_name)) { - clif_displaymessage(fd, msg_table[1]); // Map not found. - return -1; - } else { - //FIXME: What do you do if the map is in another map server with the nowarpto flag? - if (m>=0 && map[m].flag.nosave && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to set this map as a save map."); - return -1; - } - if (m>=0) - pc_setsavepoint(pl_sd, map[m].index, x, y); - else - pc_setsavepoint(pl_sd, mapindex_name2id(map_name), x, y); - clif_displaymessage(fd, msg_table[57]); // Character's respawn point changed. - } - } 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. + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + m = map_mapname2mapid(map_name); + if (m < 0 && !mapindex_name2id(map_name)) { + clif_displaymessage(fd, msg_txt(1)); // Map not found. + return -1; + } + + //FIXME: What do you do if the map is in another map server with the nowarpto flag? + if (m>=0 && map[m].flag.nosave && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, "You are not authorised to set this map as a save map."); + return -1; + } + + if (m>=0) + pc_setsavepoint(pl_sd, map[m].index, x, y); + else + pc_setsavepoint(pl_sd, mapindex_name2id(map_name), x, y); + clif_displaymessage(fd, msg_txt(57)); // Character's respawn point changed. + return 0; } @@ -695,11 +822,11 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char* } if (count == 0) - clif_displaymessage(fd, msg_table[28]); // No player found. + clif_displaymessage(fd, msg_txt(28)); // No player found. else if (count == 1) - clif_displaymessage(fd, msg_table[29]); // 1 player found. + clif_displaymessage(fd, msg_txt(29)); // 1 player found. else { - sprintf(output, msg_table[30], count); // %d players found. + sprintf(output, msg_txt(30), count); // %d players found. clif_displaymessage(fd, output); } @@ -719,32 +846,31 @@ int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* memset(character, '\0', sizeof(character)); if(!message || !*message || sscanf(message, "%d %23[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) { - clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000>) <CHARACTER_NAME>."); + clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000> <player>."); return -1; } - if((pl_sd = map_nick2sd(character)) != NULL) { - if (spirit >= 0 && spirit <= 0x7FFF) { - if (pl_sd->spiritball != spirit || spirit > 999) { - if (pl_sd->spiritball > 0) - pc_delspiritball(pl_sd, pl_sd->spiritball, 1); - pl_sd->spiritball = spirit; - clif_spiritball(pl_sd); - // no message, player can look the difference - if (spirit > 1000) - clif_displaymessage(fd, msg_table[204]); // WARNING: more than 1000 spiritballs can CRASH your server and/or client! - } else { - clif_displaymessage(fd, msg_table[205]); // You already have this number of spiritballs. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. - return -1; + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if (spirit >= 0 && spirit <= 0x7FFF) { + if (pl_sd->spiritball != spirit || spirit > 999) { + if (pl_sd->spiritball > 0) + pc_delspiritball(pl_sd, pl_sd->spiritball, 1); } + pl_sd->spiritball = spirit; + clif_spiritball(pl_sd); + // no message, player can look the difference + if (spirit > 1000) + clif_displaymessage(fd, msg_txt(204)); // WARNING: more than 1000 spiritballs can CRASH your server and/or client! } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(205)); // You already have this number of spiritballs. return -1; } + return 0; } @@ -752,8 +878,7 @@ int charcommand_spiritball(const int fd, struct map_session_data* sd,const char* * #itemlist <character>: Displays the list of a player's items. *------------------------------------------ */ -int -charcommand_itemlist( +int charcommand_itemlist( const int fd, struct map_session_data* sd, const char* command, const char* message) { @@ -770,112 +895,109 @@ charcommand_itemlist( memset(outputtmp, '\0', sizeof(outputtmp)); if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { - clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <char name>)."); + clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <player>)."); return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level - counter = 0; - count = 0; - for (i = 0; i < MAX_INVENTORY; i++) { - i_item = &pl_sd->status.inventory[i]; - if (pl_sd->status.inventory[i].nameid > 0 && (item_data = itemdb_exists(i_item->nameid)) != NULL) { - counter = counter + i_item->amount; - count++; - if (count == 1) { - sprintf(output, "------ Items list of '%s' ------", pl_sd->status.name); - clif_displaymessage(fd, output); - } - if ((equip = i_item->equip)) { - strcpy(equipstr, "| equiped: "); - if (equip & EQP_GARMENT) - strcat(equipstr, "robe/gargment, "); - if (equip & EQP_ACC_L) - strcat(equipstr, "left accessory, "); - if (equip & EQP_ARMOR) - strcat(equipstr, "body/armor, "); - if ((equip & EQP_ARMS) == EQP_HAND_R) - strcat(equipstr, "right hand, "); - if ((equip & EQP_ARMS) == EQP_HAND_L) - strcat(equipstr, "left hand, "); - if ((equip & EQP_ARMS) == EQP_ARMS) - strcat(equipstr, "both hands, "); - if (equip & EQP_SHOES) - strcat(equipstr, "feet, "); - if (equip & EQP_ACC_R) - strcat(equipstr, "right accessory, "); - if ((equip & EQP_HELM) == EQP_HEAD_LOW) - strcat(equipstr, "lower head, "); - if ((equip & EQP_HELM) == EQP_HEAD_TOP) - strcat(equipstr, "top head, "); - if ((equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_TOP)) - strcat(equipstr, "lower/top head, "); - if ((equip & EQP_HELM) == EQP_HEAD_MID) - strcat(equipstr, "mid head, "); - if ((equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_MID)) - strcat(equipstr, "lower/mid head, "); - if ((equip & EQP_HELM) == EQP_HELM) - strcat(equipstr, "lower/mid/top head, "); - // remove final ', ' - equipstr[strlen(equipstr) - 2] = '\0'; - } else - memset(equipstr, '\0', sizeof(equipstr)); - if (i_item->refine) - sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", i_item->amount, item_data->name, i_item->refine, item_data->jname, i_item->refine, i_item->nameid, equipstr); - else - sprintf(output, "%d %s (%s, id: %d) %s", i_item->amount, item_data->name, item_data->jname, i_item->nameid, equipstr); - clif_displaymessage(fd, output); - memset(output, '\0', sizeof(output)); - counter2 = 0; + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + counter = 0; + count = 0; + for (i = 0; i < MAX_INVENTORY; i++) { + i_item = &pl_sd->status.inventory[i]; + if (pl_sd->status.inventory[i].nameid > 0 && (item_data = itemdb_exists(i_item->nameid)) != NULL) { + counter = counter + i_item->amount; + count++; + if (count == 1) { + sprintf(output, "------ Items list of '%s' ------", pl_sd->status.name); + clif_displaymessage(fd, output); + } + if ((equip = i_item->equip)) { + strcpy(equipstr, "| equiped: "); + if (equip & EQP_GARMENT) + strcat(equipstr, "robe/gargment, "); + if (equip & EQP_ACC_L) + strcat(equipstr, "left accessory, "); + if (equip & EQP_ARMOR) + strcat(equipstr, "body/armor, "); + if ((equip & EQP_ARMS) == EQP_HAND_R) + strcat(equipstr, "right hand, "); + if ((equip & EQP_ARMS) == EQP_HAND_L) + strcat(equipstr, "left hand, "); + if ((equip & EQP_ARMS) == EQP_ARMS) + strcat(equipstr, "both hands, "); + if (equip & EQP_SHOES) + strcat(equipstr, "feet, "); + if (equip & EQP_ACC_R) + strcat(equipstr, "right accessory, "); + if ((equip & EQP_HELM) == EQP_HEAD_LOW) + strcat(equipstr, "lower head, "); + if ((equip & EQP_HELM) == EQP_HEAD_TOP) + strcat(equipstr, "top head, "); + if ((equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_TOP)) + strcat(equipstr, "lower/top head, "); + if ((equip & EQP_HELM) == EQP_HEAD_MID) + strcat(equipstr, "mid head, "); + if ((equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_MID)) + strcat(equipstr, "lower/mid head, "); + if ((equip & EQP_HELM) == EQP_HELM) + strcat(equipstr, "lower/mid/top head, "); + // remove final ', ' + equipstr[strlen(equipstr) - 2] = '\0'; + } else + memset(equipstr, '\0', sizeof(equipstr)); + if (i_item->refine) + sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", i_item->amount, item_data->name, i_item->refine, item_data->jname, i_item->refine, i_item->nameid, equipstr); + else + sprintf(output, "%d %s (%s, id: %d) %s", i_item->amount, item_data->name, item_data->jname, i_item->nameid, equipstr); + clif_displaymessage(fd, output); + memset(output, '\0', sizeof(output)); + counter2 = 0; - if(i_item->card[0]==CARD0_PET) { //pet eggs - if (i_item->card[3]) - sprintf(outputtmp, " -> (pet egg, pet id: %u, named)", (unsigned int)MakeDWord(i_item->card[1], i_item->card[2])); + if(i_item->card[0]==CARD0_PET) { //pet eggs + if (i_item->card[3]) + sprintf(outputtmp, " -> (pet egg, pet id: %u, named)", (unsigned int)MakeDWord(i_item->card[1], i_item->card[2])); + else + sprintf(outputtmp, " -> (pet egg, pet id: %u, unnamed)", (unsigned int)MakeDWord(i_item->card[1], i_item->card[2])); + strcat(output, outputtmp); + } else + if(i_item->card[0]==CARD0_FORGE) { //forged items. + sprintf(outputtmp, " -> (crafted item, creator id: %u, star crumbs %d, element %d)", (unsigned int)MakeDWord(i_item->card[2], i_item->card[3]), i_item->card[1]>>8, i_item->card[1]&0x0f); + } else + if(i_item->card[0]==CARD0_CREATE) { //created items. + sprintf(outputtmp, " -> (produced item, creator id: %u)", (unsigned int)MakeDWord(i_item->card[2], i_item->card[3])); + strcat(output, outputtmp); + } else //Normal slots + for (j = 0; j < item_data->slot; j++) { + if (pl_sd->status.inventory[i].card[j]) { + if ((item_temp = itemdb_exists(i_item->card[j])) != NULL) { + if (output[0] == '\0') + sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); else - sprintf(outputtmp, " -> (pet egg, pet id: %u, unnamed)", (unsigned int)MakeDWord(i_item->card[1], i_item->card[2])); + sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); strcat(output, outputtmp); - } else - if(i_item->card[0]==CARD0_FORGE) { //forged items. - sprintf(outputtmp, " -> (crafted item, creator id: %u, star crumbs %d, element %d)", (unsigned int)MakeDWord(i_item->card[2], i_item->card[3]), i_item->card[1]>>8, i_item->card[1]&0x0f); - } else - if(i_item->card[0]==CARD0_CREATE) { //created items. - sprintf(outputtmp, " -> (produced item, creator id: %u)", (unsigned int)MakeDWord(i_item->card[2], i_item->card[3])); - strcat(output, outputtmp); - } else //Normal slots - for (j = 0; j < item_data->slot; j++) { - if (pl_sd->status.inventory[i].card[j]) { - if ((item_temp = itemdb_exists(i_item->card[j])) != NULL) { - if (output[0] == '\0') - sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - else - sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - strcat(output, outputtmp); - } - } - } - if (output[0] != '\0') { - output[strlen(output) - 2] = ')'; - output[strlen(output) - 1] = '\0'; - clif_displaymessage(fd, output); } } } - if (count == 0) - clif_displaymessage(fd, "No item found on this player."); - else { - sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + if (output[0] != '\0') { + output[strlen(output) - 2] = ')'; + output[strlen(output) - 1] = '\0'; clif_displaymessage(fd, 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. + } + if (count == 0) + { + clif_displaymessage(fd, "No item found on this player."); return -1; } + sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + clif_displaymessage(fd, output); return 0; } @@ -885,25 +1007,27 @@ charcommand_itemlist( * Create a effect localized on another character *------------------------------------------ */ -int -charcommand_effect(const int fd, struct map_session_data* sd, +int charcommand_effect(const int fd, struct map_session_data* sd, const char* command, const char* message) { struct map_session_data *pl_sd = NULL; - char target[NAME_LENGTH]; + char character[NAME_LENGTH]; int type = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %23s", &type, target) != 2) { + if (!message || !*message || sscanf(message, "%d %23[^\n]", &type, character) != 2) { clif_displaymessage(fd, "usage: #effect <type+> <target>."); return -1; } - if((pl_sd=map_nick2sd(target)) == NULL) + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; + } clif_specialeffect(&pl_sd->bl, type, AREA); - clif_displaymessage(fd, msg_table[229]); // Your effect has changed. + clif_displaymessage(fd, msg_txt(229)); // Your effect has changed. return 0; } @@ -933,61 +1057,63 @@ charcommand_storagelist( return -1; } - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can look items only lower or same level - if((stor = account2storage2(pl_sd->status.account_id)) != NULL) { - counter = 0; - count = 0; - for (i = 0; i < MAX_STORAGE; i++) { - if (stor->storage_[i].nameid > 0 && (item_data = itemdb_search(stor->storage_[i].nameid)) != NULL) { - counter = counter + stor->storage_[i].amount; - count++; - if (count == 1) { - sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name); - clif_displaymessage(fd, output); - } - if (stor->storage_[i].refine) - sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->storage_[i].amount, item_data->name, stor->storage_[i].refine, item_data->jname, stor->storage_[i].refine, stor->storage_[i].nameid); - else - sprintf(output, "%d %s (%s, id: %d)", stor->storage_[i].amount, item_data->name, item_data->jname, stor->storage_[i].nameid); - clif_displaymessage(fd, output); - memset(output, '\0', sizeof(output)); - counter2 = 0; - for (j = 0; j < item_data->slot; j++) { - if (stor->storage_[i].card[j]) { - if ((item_temp = itemdb_search(stor->storage_[i].card[j])) != NULL) { - if (output[0] == '\0') - sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - else - sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); - strcat(output, outputtmp); - } - } - } - if (output[0] != '\0') { - output[strlen(output) - 2] = ')'; - output[strlen(output) - 1] = '\0'; - clif_displaymessage(fd, output); + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if((stor = account2storage2(pl_sd->status.account_id)) != NULL) { + counter = 0; + count = 0; + for (i = 0; i < MAX_STORAGE; i++) { + if (stor->storage_[i].nameid > 0 && (item_data = itemdb_search(stor->storage_[i].nameid)) != NULL) { + counter = counter + stor->storage_[i].amount; + count++; + if (count == 1) { + sprintf(output, "------ Storage items list of '%s' ------", pl_sd->status.name); + clif_displaymessage(fd, output); + } + if (stor->storage_[i].refine) + sprintf(output, "%d %s %+d (%s %+d, id: %d)", stor->storage_[i].amount, item_data->name, stor->storage_[i].refine, item_data->jname, stor->storage_[i].refine, stor->storage_[i].nameid); + else + sprintf(output, "%d %s (%s, id: %d)", stor->storage_[i].amount, item_data->name, item_data->jname, stor->storage_[i].nameid); + clif_displaymessage(fd, output); + memset(output, '\0', sizeof(output)); + counter2 = 0; + for (j = 0; j < item_data->slot; j++) { + if (stor->storage_[i].card[j]) { + if ((item_temp = itemdb_search(stor->storage_[i].card[j])) != NULL) { + if (output[0] == '\0') + sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + else + sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + strcat(output, outputtmp); } } } - if (count == 0) - clif_displaymessage(fd, "No item found in the storage of this player."); - else { - sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + if (output[0] != '\0') { + output[strlen(output) - 2] = ')'; + output[strlen(output) - 1] = '\0'; clif_displaymessage(fd, output); } - } else { - clif_displaymessage(fd, "This player has no storage."); - return 0; } - } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. - return -1; + } + if (count == 0) + clif_displaymessage(fd, "No item found in the storage of this player."); + else { + sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + clif_displaymessage(fd, output); } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; + clif_displaymessage(fd, "This player has no storage."); + return 0; } return 0; @@ -1091,9 +1217,9 @@ int charcommand_item( if(log_config.enable_logs&0x400) log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp); - clif_displaymessage(fd, msg_table[18]); // Item created. + clif_displaymessage(fd, msg_txt(18)); // Item created. } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } } else if(/* from jA's @giveitem */strcmpi(character,"all")==0 || strcmpi(character,"everyone")==0){ @@ -1110,11 +1236,11 @@ int charcommand_item( snprintf(tmp_cmdoutput, sizeof(tmp_cmdoutput), "%s received %s %d.","Everyone",item_name,number); clif_displaymessage(fd, tmp_cmdoutput); } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } } else { - clif_displaymessage(fd, msg_table[19]); // Invalid item ID or name. + clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. return -1; } @@ -1146,20 +1272,20 @@ int charcommand_warp( } if ((pl_sd = map_nick2sd(character)) == NULL) { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } if (pc_isGM(sd) < pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } m = map_mapname2mapid(map_name); if (m < 0) { - clif_displaymessage(fd, msg_table[1]); // Map not found. + clif_displaymessage(fd, msg_txt(1)); // Map not found. return -1; } if ((x || y) && map_getcell(m, x, y, CELL_CHKNOREACH)) { - clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. + clif_displaymessage(fd, msg_txt(2)); // Coordinates out of range. x = y = 0; } if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { @@ -1171,8 +1297,9 @@ int charcommand_warp( return -1; } if (pc_setpos(pl_sd, map[m].index, x, y, 3) == 0) { - clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped. - clif_displaymessage(fd, msg_table[15]); // Player warped (message sent to player too). + clif_displaymessage(pl_sd->fd, msg_txt(0)); // Warped. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(15)); // Player warped (message sends to player too). return 0; } //No error message specified...? @@ -1208,16 +1335,16 @@ int charcommand_zeny( if (new_zeny != pl_sd->status.zeny) { pl_sd->status.zeny = new_zeny; clif_updatestatus(pl_sd, SP_ZENY); - clif_displaymessage(fd, msg_table[211]); // Character's number of zenys changed! + clif_displaymessage(fd, msg_txt(211)); // Character's number of zenys changed! } else { if (zeny < 0) - clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. + clif_displaymessage(fd, msg_txt(41)); // Impossible to decrease the number/value. else - clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. + clif_displaymessage(fd, msg_txt(149)); // Impossible to increase the number/value. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1290,7 +1417,7 @@ int charcommand_baselevel( nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d %23[^\n]", &level, player) < 2 || level == 0) { - clif_displaymessage(fd, "Please, enter a level adjustement and a player name (usage: #baselvl <#> <nickname>)."); + clif_displaymessage(fd, "Please, enter a level adjustment and a player name (usage: #baselvl <#> <nickname>)."); return -1; } @@ -1319,10 +1446,6 @@ int charcommand_baselevel( else pl_sd->status.status_point += status_point; pl_sd->status.base_level += (unsigned int)level; - clif_updatestatus(pl_sd, SP_BASELEVEL); - clif_updatestatus(pl_sd, SP_NEXTBASEEXP); - clif_updatestatus(pl_sd, SP_STATUSPOINT); - status_calc_pc(pl_sd, 0); status_percent_heal(&pl_sd->bl, 100, 100); clif_misceffect(&pl_sd->bl, 0); clif_displaymessage(fd, msg_table[65]); // Character's base level raised. @@ -1342,14 +1465,15 @@ int charcommand_baselevel( pl_sd->status.status_point = 0; else pl_sd->status.status_point -= status_point; - clif_updatestatus(pl_sd, SP_STATUSPOINT); pl_sd->status.base_level -= (unsigned int)level; - clif_updatestatus(pl_sd, SP_BASELEVEL); - clif_updatestatus(pl_sd, SP_NEXTBASEEXP); - status_calc_pc(pl_sd, 0); clif_displaymessage(fd, msg_table[66]); // Character's base level lowered. } - + clif_updatestatus(pl_sd, SP_BASELEVEL); + clif_updatestatus(pl_sd, SP_NEXTBASEEXP); + clif_updatestatus(pl_sd, SP_STATUSPOINT); + status_calc_pc(pl_sd, 0); + if(pl_sd->status.party_id) + party_send_levelup(pl_sd); return 0; //³íI—¹ } @@ -1369,7 +1493,7 @@ int charcommand_joblevel( nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%d %23[^\n]", &level, player) < 2 || level == 0) { - clif_displaymessage(fd, "Please, enter a level adjustement and a player name (usage: #joblvl <#> <nickname>)."); + clif_displaymessage(fd, "Please, enter a level adjustment and a player name (usage: #joblvl <#> <nickname>)."); return -1; } @@ -1377,7 +1501,7 @@ int charcommand_joblevel( if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change job level only lower or same gm level if (level > 0) { if (pl_sd->status.job_level == pc_maxjoblv(pl_sd)) { - clif_displaymessage(fd, msg_table[67]); // Character's job level can't go any higher. + clif_displaymessage(fd, msg_txt(67)); // Character's job level can't go any higher. return -1; } if ((unsigned int)level > pc_maxjoblv(pl_sd) || @@ -1394,10 +1518,10 @@ int charcommand_joblevel( clif_updatestatus(pl_sd, SP_SKILLPOINT); status_calc_pc(pl_sd, 0); clif_misceffect(&pl_sd->bl, 1); - clif_displaymessage(fd, msg_table[68]); // character's job level raised. + clif_displaymessage(fd, msg_txt(68)); // character's job level raised. } else { if (pl_sd->status.job_level == 1) { - clif_displaymessage(fd, msg_table[194]); // Character's job level can't go any lower. + clif_displaymessage(fd, msg_txt(194)); // Character's job level can't go any lower. return -1; } level*=-1; @@ -1414,14 +1538,14 @@ int charcommand_joblevel( pl_sd->status.skill_point -= level; clif_updatestatus(pl_sd, SP_SKILLPOINT); status_calc_pc(pl_sd, 0); - clif_displaymessage(fd, msg_table[69]); // Character's job level lowered. + clif_displaymessage(fd, msg_txt(69)); // Character's job level lowered. } } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(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. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1453,21 +1577,21 @@ int charcommand_questskill( if ((pl_sd = map_nick2sd(player)) != NULL) { if (pc_checkskill(pl_sd, skill_id) == 0) { pc_skill(pl_sd, skill_id, 1, 0); - clif_displaymessage(fd, msg_table[199]); // This player has learned the skill. + clif_displaymessage(fd, msg_txt(199)); // This player has learned the skill. } else { - clif_displaymessage(fd, msg_table[200]); // This player already has this quest skill. + clif_displaymessage(fd, msg_txt(200)); // This player already has this quest skill. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } } else { - clif_displaymessage(fd, msg_table[197]); // This skill number doesn't exist or isn't a quest skill. + clif_displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } } else { - clif_displaymessage(fd, msg_table[198]); // This skill number doesn't exist. + clif_displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } @@ -1501,21 +1625,21 @@ int charcommand_lostskill( pl_sd->status.skill[skill_id].lv = 0; pl_sd->status.skill[skill_id].flag = 0; clif_skillinfoblock(pl_sd); - clif_displaymessage(fd, msg_table[202]); // This player has forgotten the skill. + clif_displaymessage(fd, msg_txt(202)); // This player has forgotten the skill. } else { - clif_displaymessage(fd, msg_table[203]); // This player doesn't have this quest skill. + clif_displaymessage(fd, msg_txt(203)); // This player doesn't have this quest skill. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } } else { - clif_displaymessage(fd, msg_table[197]); // This skill number doesn't exist or isn't a quest skill. + clif_displaymessage(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill. return -1; } } else { - clif_displaymessage(fd, msg_table[198]); // This skill number doesn't exist. + clif_displaymessage(fd, msg_txt(198)); // This skill number doesn't exist. return -1; } @@ -1543,14 +1667,14 @@ int charcommand_skreset( if ((pl_sd = map_nick2sd(player)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset skill points only lower or same gm level pc_resetskill(pl_sd,1); - sprintf(tmp_cmdoutput, msg_table[206], player); // '%s' skill points reseted! + sprintf(tmp_cmdoutput, msg_txt(206), player); // '%s' skill points reseted! clif_displaymessage(fd, tmp_cmdoutput); } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(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. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1578,14 +1702,14 @@ int charcommand_streset( if ((pl_sd = map_nick2sd(player)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset stats points only lower or same gm level pc_resetstate(pl_sd); - sprintf(tmp_cmdoutput, msg_table[207], player); // '%s' stats points reseted! + sprintf(tmp_cmdoutput, msg_txt(207), player); // '%s' stats points reseted! clif_displaymessage(fd, tmp_cmdoutput); } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(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. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1621,21 +1745,21 @@ int charcommand_model( if (cloth_color != 0 && pl_sd->status.sex == 1 && (pl_sd->status.class_ == JOB_ASSASSIN || pl_sd->status.class_ == JOB_ROGUE)) { - clif_displaymessage(fd, msg_table[35]); // You can't use this command with this class. + clif_displaymessage(fd, msg_txt(35)); // You can't use this command with this class. return -1; } else { */ pc_changelook(pl_sd, LOOK_HAIR, hair_style); pc_changelook(pl_sd, LOOK_HAIR_COLOR, hair_color); pc_changelook(pl_sd, LOOK_CLOTHES_COLOR, cloth_color); - clif_displaymessage(fd, msg_table[36]); // Appearence changed. + clif_displaymessage(fd, msg_txt(36)); // Appearence changed. // } } else { - clif_displaymessage(fd, msg_table[37]); // An invalid number was specified. + clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1671,16 +1795,16 @@ int charcommand_skpoint( if (new_skill_point != (int)pl_sd->status.skill_point) { pl_sd->status.skill_point = new_skill_point; clif_updatestatus(pl_sd, SP_SKILLPOINT); - clif_displaymessage(fd, msg_table[209]); // Character's number of skill points changed! + clif_displaymessage(fd, msg_txt(209)); // Character's number of skill points changed! } else { if (point < 0) - clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. + clif_displaymessage(fd, msg_txt(41)); // Impossible to decrease the number/value. else - clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. + clif_displaymessage(fd, msg_txt(149)); // Impossible to increase the number/value. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1716,16 +1840,16 @@ int charcommand_stpoint( if (new_status_point != (int)pl_sd->status.status_point) { pl_sd->status.status_point = new_status_point; clif_updatestatus(pl_sd, SP_STATUSPOINT); - clif_displaymessage(fd, msg_table[210]); // Character's number of status points changed! + clif_displaymessage(fd, msg_txt(210)); // Character's number of status points changed! } else { if (point < 0) - clif_displaymessage(fd, msg_table[41]); // Impossible to decrease the number/value. + clif_displaymessage(fd, msg_txt(41)); // Impossible to decrease the number/value. else - clif_displaymessage(fd, msg_table[149]); // Impossible to increase the number/value. + clif_displaymessage(fd, msg_txt(149)); // Impossible to increase the number/value. return -1; } } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1786,14 +1910,14 @@ int charcommand_feelreset( if ((pl_sd = map_nick2sd(character)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset a character only for lower or same GM level pc_resetfeel(pl_sd); - sprintf(output, msg_table[267], character); // '%s' designated maps reseted! + sprintf(output, msg_txt(267), character); // '%s' designated maps reseted! clif_displaymessage(fd, output); } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + clif_displaymessage(fd, msg_txt(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. + clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } @@ -1816,7 +1940,7 @@ int charcommand_help( memset(buf, '\0', sizeof(buf)); if ((fp = fopen(charhelp_txt, "r")) != NULL) { - clif_displaymessage(fd, msg_table[26]); /* Help commands: */ + clif_displaymessage(fd, msg_txt(26)); /* Help commands: */ gm_level = pc_isGM(sd); while(fgets(buf, sizeof(buf) - 1, fp) != NULL) { if (buf[0] == '/' && buf[1] == '/') @@ -1834,9 +1958,2241 @@ int charcommand_help( } fclose(fp); } else { - clif_displaymessage(fd, msg_table[27]); /* File help.txt not found. */ + clif_displaymessage(fd, msg_txt(27)); /* File help.txt not found. */ + return -1; + } + + return 0; +} + +/*========================================== + * Loads a character back to their save point [HiddenDragon] + *------------------------------------------ + */ +int charcommand_load( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int m; + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #load <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + m = map_mapindex2mapid(pl_sd->status.save_point.map); + if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(pl_sd)) { + clif_displaymessage(fd, "Not authorized to warp to target 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(pl_sd)) { + clif_displaymessage(fd, "Not authorized to warp from current map."); + return -1; + } + + pc_setpos(pl_sd, pl_sd->status.save_point.map, pl_sd->status.save_point.x, pl_sd->status.save_point.y, 0); + clif_displaymessage(pl_sd->fd, msg_txt(7)); // Warping to respawn point. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(7)); // Warping to respawn point. + + return 0; +} + +/*========================================== + * Changes the targets speed [HiddenDragon] + *------------------------------------------ + */ +int charcommand_speed( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int speed; + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &speed, character) < 2) { + sprintf(output, "Please, enter proper values (usage: #speed <%d-%d> <player>).", MIN_WALK_SPEED, MAX_WALK_SPEED); + clif_displaymessage(fd, output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (speed < MIN_WALK_SPEED) + { + speed = MIN_WALK_SPEED; + } + else if (speed > MAX_WALK_SPEED) + { + speed = MAX_WALK_SPEED; + } + + pl_sd->base_status.speed = speed; + status_calc_bl(&pl_sd->bl, SCB_SPEED); + clif_displaymessage(pl_sd->fd, msg_txt(8)); // Speed changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(8)); // Speed changed. + return 0; +} + +/*========================================== + * Opens their storage [HiddenDragon] + *------------------------------------------ + */ +int charcommand_storage( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #storage <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->npc_id || pl_sd->vender_id || pl_sd->state.trading || pl_sd->state.storage_flag) + return -1; + + if (storage_storageopen(pl_sd) == 1) + { //Already open. + clif_displaymessage(fd, "Players storage already open."); + return -1; + } + + clif_displaymessage(pl_sd->fd, "Storage opened."); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player's storage opened."); + + return 0; +} + + +/*========================================== + * Opens their guild storage + *------------------------------------------ + */ +int charcommand_guildstorage( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct storage *stor; //changes from Freya/Yor + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #gstorage <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->npc_id || pl_sd->vender_id || pl_sd->state.trading || pl_sd->state.storage_flag) + return -1; + + if (pl_sd->status.guild_id > 0) { + if (pl_sd->state.storage_flag) { + clif_displaymessage(fd, "Guild storage is currently in use."); + return -1; + } + if ((stor = account2storage2(pl_sd->status.account_id)) != NULL && stor->storage_status == 1) { + clif_displaymessage(fd, "Guild storage is currently in use."); + return -1; + } + storage_guild_storageopen(pl_sd); + } else { + clif_displaymessage(fd, "Target player is not in a guild."); + return -1; + } + + clif_displaymessage(pl_sd->fd, "Guild storage opened."); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player's guild storage opened."); + + return 0; +} + +/*========================================== + * Applies GM Hide to a character [HiddenDragon] + *------------------------------------------ + */ +int charcommand_hide( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #hide <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->sc.option & OPTION_INVISIBLE) { + pl_sd->sc.option &= ~OPTION_INVISIBLE; + if (pl_sd->disguise) + status_set_viewdata(&pl_sd->bl, pl_sd->disguise); + else + status_set_viewdata(&pl_sd->bl, pl_sd->status.class_); + clif_changeoption(&pl_sd->bl); + clif_displaymessage(pl_sd->fd, msg_txt(10)); // Invisible: Off + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(10)); // Invisible: Off + } else { + pl_sd->sc.option |= OPTION_INVISIBLE; + pl_sd->vd.class_ = INVISIBLE_CLASS; + clif_changeoption(&pl_sd->bl); + clif_displaymessage(pl_sd->fd, msg_txt(11)); // Invisible: On + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(11)); // Invisible: On + } + + return 0; +} + +/*========================================== + * Resurrects a dead character [HiddenDragon] + *------------------------------------------ + */ +int charcommand_alive( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #alive <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (!status_revive(&pl_sd->bl, 100, 100)) + { + clif_displaymessage(fd, "Target player is not dead."); + return -1; + } + clif_skill_nodamage(&pl_sd->bl,&pl_sd->bl,ALL_RESURRECTION,4,1); + clif_displaymessage(pl_sd->fd, msg_txt(16)); // You've been revived! It's a miracle! + return 0; +} + +/*========================================== + * Heals someone's HP and SP [HiddenDragon] + *------------------------------------------ + */ +int charcommand_heal( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int hp = 0, sp = 0; // [Valaris] thanks to fov + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &hp, &sp, character) < 3) { + clif_displaymessage(fd, "Please, enter proper values (usage: #heal <hp> <sp> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (hp == 0 && sp == 0) { + if (!status_percent_heal(&pl_sd->bl, 100, 100)) + clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value. + else + { + clif_displaymessage(pl_sd->fd, msg_txt(17)); // HP, SP recovered. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(17)); // HP, SP recovered. + } + return 0; + } + + if(hp > 0 && sp >= 0) { + if(!status_heal(&pl_sd->bl, hp, sp, 2)) + clif_displaymessage(fd, msg_txt(157)); // HP and SP are already with the good value. + else + { + clif_displaymessage(pl_sd->fd, msg_txt(17)); // HP, SP recovered. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(17)); // HP, SP recovered. + } + return 0; + } + + if(hp < 0 && sp <= 0) { + status_damage(NULL, &pl_sd->bl, -hp, -sp, 0, 0); + clif_damage(&pl_sd->bl,&pl_sd->bl, gettick(), 0, 0, -hp, 0 , 4, 0); + clif_displaymessage(pl_sd->fd, msg_txt(156)); // HP or/and SP modified. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified. + return 0; + } + + //Opposing signs. + if (hp) { + if (hp > 0) + status_heal(&pl_sd->bl, hp, 0, 2); + else { + status_damage(NULL, &pl_sd->bl, -hp, 0, 0, 0); + clif_damage(&pl_sd->bl,&pl_sd->bl, gettick(), 0, 0, -hp, 0 , 4, 0); + } + } + + if (sp) { + if (sp > 0) + status_heal(&pl_sd->bl, 0, sp, 2); + else + status_damage(NULL, &pl_sd->bl, 0, -sp, 0, 0); + } + + clif_displaymessage(pl_sd->fd, msg_txt(156)); // HP or/and SP modified. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(156)); // HP or/and SP modified. + return 0; +} + +/*========================================== + * Creates items as specified [HiddenDragon] + *------------------------------------------ + */ +int charcommand_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; + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d %23[^\n]", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, character) < 10 && + sscanf(message, "%99s %d %d %d %d %d %d %d %d %23[^\n]", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, character) < 10 + )) { + clif_displaymessage(fd, "Please, enter all informations (usage: @item2 <item name or ID> <quantity>"); + clif_displaymessage(fd, " <Identify_flag[1|0]> <refine> <attribut> <Card1> <Card2> <Card3> <Card4> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + 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(pl_sd, &item_tmp, get_count))) + clif_additem(pl_sd, 0, 0, flag); + } + + //Logs (A)dmins items [Lupus] + if(log_config.enable_logs&0x400) + log_pick_pc(pl_sd, "A", item_tmp.nameid, number, &item_tmp); + + clif_displaymessage(pl_sd->fd, msg_txt(18)); // Item created. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(18)); // Item created. + } else { + clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + return -1; + } + + return 0; +} + +/*========================================== + * Reset a character's items [HiddenDragon] + *------------------------------------------ + */ +int charcommand_itemreset( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int i, count = 0; + char character[NAME_LENGTH]; + char output[200]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #itemreset <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + for (i = 0; i < MAX_INVENTORY; i++) { + if (pl_sd->status.inventory[i].amount && pl_sd->status.inventory[i].equip == 0) { + + //Logs (A)dmins items [Lupus] + if(log_config.enable_logs&0x400) + log_pick_pc(pl_sd, "A", pl_sd->status.inventory[i].nameid, -pl_sd->status.inventory[i].amount, &pl_sd->status.inventory[i]); + + pc_delitem(pl_sd, i, pl_sd->status.inventory[i].amount, 0); + count++; + } + } + + sprintf(output, msg_txt(114), count); + if (pl_sd->fd != fd) + clif_displaymessage(pl_sd->fd, output); // %d item(s) removed from the player. + clif_displaymessage(fd, msg_txt(20)); // All of your items have been removed. + + return 0; +} + +/*========================================== + * Refine their items [HiddenDragon] + *------------------------------------------ + */ +int charcommand_refine( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int i,j, position = 0, refine = 0, current_position, final_refine; + int count; + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%d %d %s", &position, &refine, character) < 3) { + clif_displaymessage(fd, "Please, enter a position and a amount (usage: #refine <equip position> <+/- amount> <player>)."); + sprintf(output, "%d: Left Accessory", EQI_ACC_L); + clif_displaymessage(fd, output); + sprintf(output, "%d: Right Accessory", EQI_ACC_R); + clif_displaymessage(fd, output); + sprintf(output, "%d: Shoes", EQI_SHOES); + clif_displaymessage(fd, output); + sprintf(output, "%d: Garment", EQI_GARMENT); + clif_displaymessage(fd, output); + sprintf(output, "%d: Lower Headgear", EQI_HEAD_LOW); + clif_displaymessage(fd, output); + sprintf(output, "%d: Mid Headgear", EQI_HEAD_MID); + clif_displaymessage(fd, output); + sprintf(output, "%d: Top Headgear", EQI_HEAD_TOP); + clif_displaymessage(fd, output); + sprintf(output, "%d: Body Armor", EQI_ARMOR); + clif_displaymessage(fd, output); + sprintf(output, "%d: Left Hand", EQI_HAND_L); + clif_displaymessage(fd, output); + sprintf(output, "%d: Right Hand", EQI_HAND_R); + clif_displaymessage(fd, output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (refine < -MAX_REFINE) + refine = -MAX_REFINE; + else if (refine > MAX_REFINE) + refine = MAX_REFINE; + else if (refine == 0) + refine = 1; + + count = 0; + for (j = 0; j < EQI_MAX-1; j++) { + if ((i = pl_sd->equip_index[j]) < 0) + continue; + if(j == EQI_HAND_R && pl_sd->equip_index[EQI_HAND_L] == i) + continue; + if(j == EQI_HEAD_MID && pl_sd->equip_index[EQI_HEAD_LOW] == i) + continue; + if(j == EQI_HEAD_TOP && (pl_sd->equip_index[EQI_HEAD_MID] == i || pl_sd->equip_index[EQI_HEAD_LOW] == i)) + continue; + + if(position && !(pl_sd->status.inventory[i].equip & position)) + continue; + + final_refine = pl_sd->status.inventory[i].refine + refine; + if (final_refine > MAX_REFINE) + final_refine = MAX_REFINE; + else if (final_refine < 0) + final_refine = 0; + if (pl_sd->status.inventory[i].refine != final_refine) { + pl_sd->status.inventory[i].refine = final_refine; + current_position = pl_sd->status.inventory[i].equip; + pc_unequipitem(sd, i, 3); + clif_refine(fd, 0, i, pl_sd->status.inventory[i].refine); + clif_delitem(pl_sd, i, 1); + clif_additem(pl_sd, i, 1, 0); + pc_equipitem(pl_sd, i, current_position); + clif_misceffect(&pl_sd->bl, 3); + count++; + } + } + + if (count == 0) + clif_displaymessage(fd, msg_txt(166)); // No item has been refined! + else if (count == 1) + { + clif_displaymessage(pl_sd->fd, msg_txt(167)); // 1 item has been refined! + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(167)); // 1 item has been refined! + } + else { + sprintf(output, msg_txt(168), count); // %d items have been refined! + clif_displaymessage(pl_sd->fd, output); + if (pl_sd->fd != fd) + clif_displaymessage(fd, output); + } + + return 0; +} + +/*========================================== + * Produce a manufactured item in their inventory [HiddenDragon] + *------------------------------------------ + */ +int charcommand_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; + char character[NAME_LENGTH]; + char output[200]; + + struct map_session_data *pl_sd; + + nullpo_retr(-1, sd); + + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %d %23[^\n]", item_name, &attribute, &star, character) < 4 && + sscanf(message, "%99s %d %d %23[^\n]", item_name, &attribute, &star, character) < 4 + )) { + clif_displaymessage(fd, "Please, enter at least an item name/id (usage: #produce <equip name or equip ID> <element> <# of very's> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + item_id = 0; + if ((item_data = itemdb_searchname(item_name)) == NULL && + (item_data = itemdb_exists(atoi(item_name))) == NULL) + { + sprintf(output, msg_txt(170)); // This item is not an equipment. + clif_displaymessage(fd, output); + return -1; + } + item_id = item_data->nameid; + if (itemdb_isequip2(item_data)) { + 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] = CARD0_FORGE; + tmp_item.card[1] = item_data->type==IT_WEAPON? + ((star*5) << 8) + attribute:0; + tmp_item.card[2] = GetWord(pl_sd->status.char_id, 0); + tmp_item.card[3] = GetWord(pl_sd->status.char_id, 1); + clif_produceeffect(pl_sd, 0, item_id); + clif_misceffect(&pl_sd->bl, 3); + + //Logs (A)dmins items [Lupus] + if(log_config.enable_logs&0x400) + log_pick_pc(pl_sd, "A", tmp_item.nameid, 1, &tmp_item); + + if ((flag = pc_additem(pl_sd, &tmp_item, 1))) + { + clif_additem(pl_sd, 0, 0, flag); + clif_displaymessage(fd, msg_txt(18)); + } + } else { + sprintf(output, msg_txt(169), item_id, item_data->name); // This item (%d: '%s') is not an equipment. + clif_displaymessage(fd, output); + return -1; + } + + return 0; +} + +/*========================================== + * Changes a character's stats [HiddenDragon + *------------------------------------------ + */ +int charcommand_param( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int index, value = 0, new_value; + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + const char* param[] = { "#str", "#agi", "#vit", "#int", "#dex", "#luk", NULL }; + short* status[6]; + + + if (!message || !*message || sscanf(message, "%d %s", &value, character) < 2 || value == 0) { + sprintf(output, "Please, enter a valid value (usage: #str,#agi,#vit,#int,#dex,#luk <+/-adjustment> <player>)."); + clif_displaymessage(fd, output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + status[0] = &pl_sd->status.str; + status[1] = &pl_sd->status.agi; + status[2] = &pl_sd->status.vit; + status[3] = &pl_sd->status.int_; + status[4] = &pl_sd->status.dex; + status[5] = &pl_sd->status.luk; + + index = -1; + for (index = 0; index < sizeof(param)/sizeof(param[0]); index++) { + if (strcmpi(command, param[index]) == 0) + break; + } + if (index == sizeof(param)/sizeof(param[0]) || index > MAX_STATUS_TYPE) { + // normaly impossible... + sprintf(output, "Please, enter a valid value (usage: #str,#agi,#vit,#int,#dex,#luk <+/-adjustment> <player>)."); + clif_displaymessage(fd, output); + return -1; + } + + if (value > 0 && *status[index] > 999 - value) + new_value = 999; + else if (value < 0 && *status[index] <= -value) + new_value = 1; + else + new_value = *status[index] + value; + + if (new_value != (int)*status[index]) { + *status[index] = new_value; + clif_updatestatus(pl_sd, SP_STR + index); + clif_updatestatus(pl_sd, SP_USTR + index); + status_calc_pc(pl_sd, 0); + clif_displaymessage(pl_sd->fd, msg_txt(42)); // Stat changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(42)); // Stat changed. + } else { + if (value < 0) + clif_displaymessage(fd, msg_txt(41)); // Impossible to decrease the number/value. + else + clif_displaymessage(fd, msg_txt(149)); // Impossible to increase the number/value. + return -1; + } + + return 0; +} + +/*========================================== + * Levels up a character's guild [HiddenDragon] + *------------------------------------------ + */ +int charcommand_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; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + nullpo_retr(-1, sd); + + if (!message || !*message || sscanf(message, "%d %s", &level, character) < 2 || level == 0) { + clif_displaymessage(fd, "Please, enter a valid level and player (usage: #guildlvup/@guildlvlup <# of levels> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->status.guild_id <= 0 || (guild_info = guild_search(pl_sd->status.guild_id)) == NULL) { + clif_displaymessage(fd, "Target player is not in a guild"); // You're not in a guild. + return -1; + } + //if (strcmp(sd->status.name, guild_info->master) != 0) { + // clif_displaymessage(fd, msg_txt(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(pl_sd->fd, msg_txt(179)); // Guild level changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(179)); + } else { + clif_displaymessage(fd, msg_txt(45)); // Guild level change failed. + return -1; + } + + return 0; +} + +/*========================================== + * Opens a hatch window for them [HiddenDragon] + *------------------------------------------ + */ +int charcommand_hatch( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #hatch <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->status.pet_id <= 0) + clif_sendegg(sd); + else { + clif_displaymessage(fd, "Target player already has a pet"); // You already have a pet. + return -1; + } + + return 0; +} + +/*========================================== + * Change target pet's hunger [HiddenDragon] + *------------------------------------------ + */ +int charcommand_pethungry( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int hungry; + struct pet_data *pd; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + + nullpo_retr(-1, sd); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &hungry, character) < 2) { + clif_displaymessage(fd, "Please, enter a valid number and player (usage: #pethungry <0-100> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + pd = pl_sd->pd; + if (!pl_sd->status.pet_id || !pd) { + clif_displaymessage(fd, "Target has no pet"); // Sorry, but you have no pet. + return -1; + } + if (hungry < 0 || hungry > 100) { + clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. + return -1; + } + if (hungry == pd->pet.hungry) { + clif_displaymessage(fd, msg_txt(186)); // Pet hungry is already the good value. + return -1; + } + + pd->pet.hungry = hungry; + clif_send_petstatus(pl_sd); + clif_displaymessage(pl_sd->fd, msg_txt(185)); // Pet hungry value changed! + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(185)); // Pet hungry value changed! + + return 0; +} + +/*========================================== + * Give all skills to target [HiddenDragon] + *------------------------------------------ + */ +int charcommand_allskill( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #allskill <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + pc_allskillup(pl_sd); // all skills + pl_sd->status.skill_point = 0; // 0 skill points + clif_updatestatus(pl_sd, SP_SKILLPOINT); // update + clif_displaymessage(pl_sd->fd, msg_txt(76)); // You have received all skills. + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player has received all skills for his/her class."); + + return 0; +} + + +/*========================================== + * Change target's clothing color [HiddenDragon] + *------------------------------------------ + */ +int charcommand_dye(const int fd, struct map_session_data* sd, const char* command, const char* message) +{ + int cloth_color = 0; + char character[NAME_LENGTH]; + char output[200]; + + struct map_session_data *pl_sd; + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &cloth_color, character) < 2) { + sprintf(output, "Please, enter a clothes color (usage: #dye/@ccolor <clothes color: %d-%d> <player>).", MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); + clif_displaymessage(fd,output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { + pc_changelook(pl_sd, LOOK_CLOTHES_COLOR, cloth_color); + clif_displaymessage(pl_sd->fd, msg_txt(36)); // Appearence changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(36)); // Appearence changed. + } else { + clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. + return -1; + } + + return 0; +} + +/*========================================== + * Change target's hair style [HiddenDragon] + *------------------------------------------ + */ +int charcommand_hair_style(const int fd, struct map_session_data* sd, const char* command, const char* message) +{ + int hair_style = 0; + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + nullpo_retr(-1, sd); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &hair_style, character) < 2) { + sprintf(output, "Please, enter a hair style (usage: #hairstyle/#hstyle <hair ID: %d-%d> <player>.", MIN_HAIR_STYLE, MAX_HAIR_STYLE); + clif_displaymessage(fd, output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + 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_txt(35)); // You can't use this command with this class. + return -1; + } else { + */ + pc_changelook(pl_sd, LOOK_HAIR, hair_style); + clif_displaymessage(pl_sd->fd, msg_txt(36)); // Appearence changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(36)); // Appearence changed. +// } + } else { + clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. + return -1; + } + + return 0; +} + +/*========================================== + * Change target's hair color [HiddenDragon] + *------------------------------------------ + */ +int charcommand_hair_color(const int fd, struct map_session_data* sd, const char* command, const char* message) +{ + int hair_color = 0; + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + nullpo_retr(-1, sd); + + memset(output, '\0', sizeof(output)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &hair_color, character) < 2) { + sprintf(output, "Please, enter a hair color (usage: #haircolor/#hcolor <hair color: %d-%d> <player>).", MIN_HAIR_COLOR, MAX_HAIR_COLOR); + clif_displaymessage(fd, output); return -1; } + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + 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_txt(35)); // You can't use this command with this class. + return -1; + } else { + */ + pc_changelook(pl_sd, LOOK_HAIR_COLOR, hair_color); + clif_displaymessage(pl_sd->fd, msg_txt(36)); // Appearence changed. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(36)); // Appearence changed. +// } + } else { + clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. + return -1; + } + + return 0; +} + +/*========================================== + * Change all target's stats [HiddenDragon] + *------------------------------------------ + */ +int charcommand_allstats( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int index, count, value = 0, max, new_value; + short* status[6]; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + + //we don't use direct initialization because it isn't part of the c standard. + nullpo_retr(-1, sd); + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #statall/#statsall/#allstat/#allstats <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + status[0] = &pl_sd->status.str; + status[1] = &pl_sd->status.agi; + status[2] = &pl_sd->status.vit; + status[3] = &pl_sd->status.int_; + status[4] = &pl_sd->status.dex; + status[5] = &pl_sd->status.luk; + + count = 0; + max = pc_maxparameter(pl_sd); + for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) { + + if (value > 0 && *status[index] > max - value) + new_value = max; + else if (value < 0 && *status[index] <= -value) + new_value = 1; + else + new_value = *status[index] +value; + + if (new_value != (int)*status[index]) { + *status[index] = new_value; + clif_updatestatus(pl_sd, SP_STR + index); + clif_updatestatus(pl_sd, SP_USTR + index); + status_calc_pc(pl_sd, 0); + count++; + } + } + + if (count > 0) // if at least 1 stat modified + { + clif_displaymessage(pl_sd->fd, msg_txt(84)); // All stats changed! + if (fd != pl_sd->fd) + clif_displaymessage(fd, "Player's stats changed"); // All stats changed! + } + else { + if (value < 0) + clif_displaymessage(fd, msg_txt(177)); // Impossible to decrease a stat. + else + clif_displaymessage(fd, msg_txt(178)); // Impossible to increase a stat. + return -1; + } + + return 0; +} + +/*========================================== + * Gives/Removes a peco from a player [HiddenDragon] + *------------------------------------------ + */ +int charcommand_mount_peco( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[NAME_LENGTH]; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #mount/#mountpeco <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (!pc_isriding(pl_sd)) + { // if actually no peco + if (!pc_checkskill(pl_sd, KN_RIDING)) + { + clif_displaymessage(fd, msg_txt(217)); // Player cannot mount a PecoePeco with his/her job. + return -1; + } + + if (pl_sd->disguise) + { + clif_displaymessage(fd, msg_txt(215)); // Player cannot mount a PecoPeco while in disguise. + return -1; + } + + pc_setoption(pl_sd, pl_sd->sc.option | OPTION_RIDING); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player mounted a peco."); + clif_displaymessage(pl_sd->fd, msg_txt(216)); // Mounted Peco. + } + else + { //Dismount + pc_setoption(pl_sd, pl_sd->sc.option & ~OPTION_RIDING); + clif_displaymessage(pl_sd->fd, msg_txt(218)); // Unmounted Peco. + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player unmounted a peco."); + } + + return 0; +} + +/*========================================== + * Remove items from a player (now a char command) [HiddenDragon] + *------------------------------------------ + */ +int charcommand_delitem(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char item_name[100]; + int i, number = 0, item_id, item_position, count; + struct item_data *item_data; + char character[NAME_LENGTH]; + char output[200]; + + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + memset(item_name, '\0', sizeof(item_name)); + memset(output, '\0', sizeof(output)); + + if (!message || !*message || ( + sscanf(message, "\"%99[^\"]\" %d %23[^\n]", item_name, &number, character) < 3 && + sscanf(message, "%s %d %23[^\n]", item_name, &number, character) < 3 + ) || number < 1) { + clif_displaymessage(fd, "Please, enter an item name/id, a quantity and a player name (usage: #delitem <item_name_or_ID> <quantity> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + 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 (item_id > 500) { + item_position = pc_search_inventory(pl_sd, item_id); + if (item_position >= 0) { + count = 0; + for(i = 0; i < number && item_position >= 0; i++) { + + //Logs (A)dmins items [Lupus] + if(log_config.enable_logs&0x400) + log_pick_pc(pl_sd, "A", pl_sd->status.inventory[item_position].nameid, -1, &pl_sd->status.inventory[item_position]); + + pc_delitem(pl_sd, item_position, 1, 0); + count++; + item_position = pc_search_inventory(pl_sd, item_id); // for next loop + } + sprintf(output, msg_txt(113), count); // %d item(s) removed by a GM. + clif_displaymessage(pl_sd->fd, output); + if (number == count) + sprintf(output, msg_txt(114), count); // %d item(s) removed from the player. + else + sprintf(output, msg_txt(115), count, count, number); // %d item(s) removed. Player had only %d on %d items. + clif_displaymessage(fd, output); + } else { + clif_displaymessage(fd, msg_txt(116)); // Character does not have the item. + return -1; + } + } + else + { + clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. + return -1; + } + + return 0; +} + +//Added by Coltaro +//We're using this function here instead of using time_t so that it only counts player's jail time when he/she's online (and since the idea is to reduce the amount of minutes one by one in status_change_timer...). +//Well, using time_t could still work but for some reason that looks like more coding x_x +static void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int* minute) { + const int factor_year = 518400; //12*30*24*60 = 518400 + const int factor_month = 43200; //30*24*60 = 43200 + const int factor_day = 1440; //24*60 = 1440 + const int factor_hour = 60; + + *year = jailtime/factor_year; + jailtime -= *year*factor_year; + *month = jailtime/factor_month; + jailtime -= *month*factor_month; + *day = jailtime/factor_day; + jailtime -= *day*factor_day; + *hour = jailtime/factor_hour; + jailtime -= *hour*factor_hour; + *minute = jailtime; + + *year = *year > 0? *year : 0; + *month = *month > 0? *month : 0; + *day = *day > 0? *day : 0; + *hour = *hour > 0? *hour : 0; + *minute = *minute > 0? *minute : 0; + return; +} + +/*========================================== + * Jail a player for a certain amount of time [Coltaro] + *------------------------------------------ + */ +int charcommand_jailtime( + const int fd, struct map_session_data* sd, + const char* command, const char* message) + { + struct map_session_data* pl_sd; + int year, month, day, hour, minute; + char character[NAME_LENGTH]; + char output[200]; + memset(character, '\0', sizeof(character)); + + nullpo_retr(-1, sd); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #jailtime <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->sc.data[SC_JAILED].val1 == INT_MAX) { + clif_displaymessage(fd, "You have been jailed indefinitely."); + return 0; + } + + if (pl_sd->sc.data[SC_JAILED].val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?) + clif_displaymessage(fd, "This player has been jailed for an unknown amount of time."); + return -1; + } + //Get remaining jail time + get_jail_time(pl_sd->sc.data[SC_JAILED].val1,&year,&month,&day,&hour,&minute); + sprintf(output,msg_txt(402),"This player will remain",year,month,day,hour,minute); + clif_displaymessage(fd, output); + + return 0; +} + +/*========================================== + * Disguises a player [HiddenDragon] + *------------------------------------------ + */ +int charcommand_disguise( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int mob_id; + char mob_name[NAME_LENGTH]; + struct map_session_data* pl_sd; + char character[NAME_LENGTH]; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + memset(mob_name, '\0', sizeof(mob_name)); + + if (!message || !*message || sscanf(message, "%s %23[^\n]", mob_name, character) < 2) { + clif_displaymessage(fd, "Please, enter a Monster/NPC name/id and a player name (usage: #disguise <monster_name_or_monster_ID> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if ((mob_id = atoi(mob_name)) > 0) + { //Acquired an ID + if (!mobdb_checkid(mob_id) && !npcdb_checkid(mob_id)) + mob_id = 0; //Invalid id for either mobs or npcs. + } else { //Acquired a Name + if ((mob_id = mobdb_searchname(mob_name)) == 0) + { + struct npc_data* nd = npc_name2id(mob_name); + if (nd != NULL) + mob_id = nd->n; + } + } + + if (mob_id == 0) + { + clif_displaymessage(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found. + return -1; + } + + if(pc_isriding(pl_sd)) + { + clif_displaymessage(fd, msg_txt(228)); // Character cannot wear disguise while riding a PecoPeco. + return -1; + } + + pc_disguise(pl_sd, mob_id); + clif_displaymessage(pl_sd->fd, msg_txt(122)); // Disguise applied. + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(140)); // Character's disguise applied. + + + return 0; +} + +/*========================================== + * Undisguises a player [HiddenDragon] + *------------------------------------------ + */ +int charcommand_undisguise( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data* pl_sd; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #undisguise <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->disguise) + { + pc_disguise(pl_sd, 0); + clif_displaymessage(pl_sd->fd, msg_txt(124)); // Disguise removed from character + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(141)); // Undisguise applied + } + else { + clif_displaymessage(fd, msg_txt(142)); // Character is not disguised. + return -1; + } + + return 0; +} + +/*========================================== + * Displays contents of target's cart [HiddenDragon] + *------------------------------------------ + */ +int charcommand_cart_list( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char outputtmp[200]; + char output[200]; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + struct item_data *item_data, *item_temp; + int i, j, count = 0, counter = 0, counter2; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + memset(outputtmp, '\0', sizeof(outputtmp)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #cartlist <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + for (i = 0; i < MAX_CART; i++) { + if (pl_sd->status.cart[i].nameid > 0 && (item_data = itemdb_search(pl_sd->status.cart[i].nameid)) != NULL) { + counter = counter + pl_sd->status.cart[i].amount; + count++; + if (count == 1) { + sprintf(output, "------ Cart items list of '%s' ------", pl_sd->status.name); + clif_displaymessage(fd, output); + } + if (pl_sd->status.cart[i].refine) + sprintf(output, "%d %s %+d (%s %+d, id: %d)", pl_sd->status.cart[i].amount, item_data->name, pl_sd->status.cart[i].refine, item_data->jname, pl_sd->status.cart[i].refine, pl_sd->status.cart[i].nameid); + else + sprintf(output, "%d %s (%s, id: %d)", pl_sd->status.cart[i].amount, item_data->name, item_data->jname, pl_sd->status.cart[i].nameid); + clif_displaymessage(fd, output); + memset(output, '\0', sizeof(output)); + counter2 = 0; + for (j = 0; j < item_data->slot; j++) { + if (pl_sd->status.cart[i].card[j]) { + if ( (item_temp = itemdb_search(pl_sd->status.cart[i].card[j])) != NULL) { + if (output[0] == '\0') + sprintf(outputtmp, " -> (card(s): #%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + else + sprintf(outputtmp, "#%d %s (%s), ", ++counter2, item_temp->name, item_temp->jname); + strcat(output, outputtmp); + } + } + } + if (output[0] != '\0') { + output[strlen(output) - 2] = ')'; + output[strlen(output) - 1] = '\0'; + clif_displaymessage(fd, output); + } + } + } + if (count == 0) + clif_displaymessage(fd, "No item found in the cart of this player."); + else { + sprintf(output, "%d item(s) found in %d kind(s) of items.", counter, count); + clif_displaymessage(fd, output); + } + + return 0; +} + +static int charcommand_stopattack(struct block_list *bl,va_list ap) +{ + struct unit_data *ud = unit_bl2ud(bl); + int id = va_arg(ap, int); + if (ud && ud->attacktimer != INVALID_TIMER && (!id || id == ud->target)) + { + unit_stop_attack(bl); + return 1; + } + return 0; +} + +/*========================================== + * Enable a player to kill players even when not in pvp [HiddenDragon] + *------------------------------------------ + */ +int charcommand_killer( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #killer <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + pl_sd->state.killer = !pl_sd->state.killer; + + if(pl_sd->state.killer) + { + clif_displaymessage(pl_sd->fd, msg_txt(241)); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Target player can now kill anybody."); + } + else + { + clif_displaymessage(pl_sd->fd, msg_txt(287)); + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(287)); + pc_stop_attack(pl_sd); + } + + return 0; +} + +/*========================================== + * Enable other players to kill target even when not in pvp [HiddenDragon] + *------------------------------------------ + */ +int charcommand_killable( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #killable <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + pl_sd->state.killable = !pl_sd->state.killable; + + if(pl_sd->state.killable) + { + clif_displaymessage(pl_sd->fd, msg_txt(242)); + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(289)); + } + else + { + clif_displaymessage(pl_sd->fd, msg_txt(288)); + if (pl_sd->fd != fd) + clif_displaymessage(fd, msg_txt(290)); + map_foreachinrange(charcommand_stopattack,&pl_sd->bl, AREA_SIZE, BL_CHAR, pl_sd->bl.id); + } + + return 0; +} + +/*========================================== + * Refreshes target [HiddenDragon] + *------------------------------------------ + */ +int charcommand_refresh( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #refresh <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + clif_refresh(pl_sd); + return 0; +} + + +/*========================================== + * View target's exp [HiddenDragon] + *------------------------------------------ + */ +int charcommand_exp( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char output[200]; + double nextb, nextj; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #exp <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + nextb = pc_nextbaseexp(pl_sd); + if (nextb) + nextb = pl_sd->status.base_exp*100.0/nextb; + + nextj = pc_nextjobexp(pl_sd); + if (nextj) + nextj = pl_sd->status.job_exp*100.0/nextj; + + sprintf(output, "Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%)", pl_sd->status.base_level, nextb, pl_sd->status.job_level, nextj); + clif_displaymessage(fd, output); + return 0; +} + +/*========================================== + * Makes monsters ignore target [HiddenDragon] + *------------------------------------------ + */ + +int charcommand_monsterignore( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #monsterignore/#battleignore <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (!pl_sd->state.monster_ignore) { + pl_sd->state.monster_ignore = 1; + clif_displaymessage(pl_sd->fd, "You are now inmune to attacks."); + if (fd != pl_sd->fd) + clif_displaymessage(pl_sd->fd, "Target player is now immune to attacks."); + } else { + sd->state.monster_ignore = 0; + clif_displaymessage(sd->fd, "You are no longer immune to attacks."); + if (fd != pl_sd->fd) + clif_displaymessage(pl_sd->fd, "Target player is no longer immune to attacks."); + + } + + return 0; +} + +/*========================================== + * Change target's size [HiddenDragon] + *------------------------------------------ + */ +int charcommand_size( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int size=0; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &size, character) < 2) { + clif_displaymessage(fd, "Please, enter a player name (usage: #size <0-2> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if(pl_sd->state.size) { + pl_sd->state.size=0; + pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, 3); + } + + if(size==1) { + pl_sd->state.size=1; + clif_specialeffect(&pl_sd->bl,420,AREA); + clif_displaymessage(fd, "Size changed."); + if (fd != pl_sd->fd) + clif_displaymessage(pl_sd->fd, "Size changed."); + } else if(size==2) { + pl_sd->state.size=2; + clif_specialeffect(&pl_sd->bl,422,AREA); + clif_displaymessage(fd, "Size changed."); + if (fd != pl_sd->fd) + clif_displaymessage(pl_sd->fd, "Size changed."); + } + else + { + clif_displaymessage(fd, "Size restored."); + if (fd != pl_sd->fd) + clif_displaymessage(pl_sd->fd, "Size restored."); + } + + + return 0; +} + +/*========================================== + * Level up target's homunculus [HiddenDragon] + *------------------------------------------ + */ +int charcommand_homlevel( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + TBL_HOM * hd; + int level = 0, i = 0; + + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &level, character) < 2) { + clif_displaymessage(fd, "Please, enter a player name and level (usage: #homlevel <# of levels> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if ( !merc_is_hom_active(pl_sd->hd) ) + { + clif_displaymessage(fd, "Target player does not have a homunculus."); + return 1; + } + + hd = pl_sd->hd; + + for (i = 1; i <= level && hd->exp_next; i++){ + hd->homunculus.exp += hd->exp_next; + merc_hom_levelup(hd); + } + status_calc_homunculus(hd,0); + status_percent_heal(&hd->bl, 100, 100); + clif_misceffect2(&hd->bl,568); + clif_displaymessage(pl_sd->fd, "Homunculus level changed."); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Player's homunculus level changed."); + + return 0; +} + +/*========================================== + * Evolve target's homunculus [HiddenDragon] + *------------------------------------------ + */ +int charcommand_homevolution( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #homevolution <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->hd) + { + if (pl_sd->hd->homunculusDB->evo_class) + { + merc_hom_evolution(pl_sd->hd); + clif_displaymessage(pl_sd->fd, "Homunculus evolution initiated."); + if (pl_sd->fd != fd) + clif_displaymessage(fd, "Homunculus evolution initiated."); + return 0; + } + clif_displaymessage(fd, "Target homunculus cannot evolve."); + return -1; + } + else + { + clif_displaymessage(fd, "Target player does not have a homunculus."); + } + return -1; +} + +/*========================================== + * Create a homunculus for target [HiddenDragon] + *------------------------------------------ + */ +int charcommand_makehomun( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int homunid; + + char character[NAME_LENGTH]; + char output[200]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &homunid, character) < 2) { + sprintf(output, "Please, enter a player name (usage: #makehomun <homunculus id: %d-%d> <player>).", HM_CLASS_BASE, HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1); + clif_displaymessage(fd, output); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 ) + { + clif_displaymessage(fd, "Invalid homunculus ID."); + return -1; + } + + if(pl_sd->status.hom_id == 0) + { + merc_create_homunculus_request(pl_sd,homunid); + } + else + { + clif_displaymessage(fd, "Target player already has a homunculus."); + } + return 0; +} + +/*========================================== + * Change Target's homunculus' friendlyness [HiddenDragon] + *------------------------------------------ + */ +int charcommand_homfriendly( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int friendly = 0; + + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &friendly, character) < 2) { + clif_displaymessage(fd, "Please, enter a player name and friendly value (usage: #homfriendly <0-1000> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (merc_is_hom_active(pl_sd->hd)) { + if (friendly > 0 && friendly <= 1000) { + pl_sd->hd->homunculus.intimacy = friendly * 100 ; + clif_send_homdata(pl_sd,SP_INTIMATE,friendly); + clif_displaymessage(pl_sd->fd, "Homunculus friendly value changed."); + if (fd != pl_sd->fd) + clif_displaymessage(fd, "Homunculus friendly value changed."); + } else { + clif_displaymessage(fd, "Invalid friendly value."); + } + } + else + { + clif_displaymessage(fd, "Target player's homunculus does not exist."); + return -1; + } + + return 0; +} + +/*========================================== + * Modify target's homunculus hunger [HiddenDragon] + *------------------------------------------ + */ +int charcommand_homhungry( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int hungry = 0; + + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%d %23[^\n]", &hungry, character) < 2) { + clif_displaymessage(fd, "Please, enter a player name (usage: #homhungry <0-100> <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if (pl_sd->status.hom_id > 0 && pl_sd->hd) { + struct homun_data *hd = pl_sd->hd; + if (hungry >= 0 && hungry <= 100) { + hd->homunculus.hunger = hungry; + clif_send_homdata(pl_sd,SP_HUNGRY,hd->homunculus.hunger); + clif_displaymessage(pl_sd->fd, "Homunculus hungry value changed."); + if (fd != pl_sd->fd) + clif_displaymessage(fd, "Homunculus hungry value changed."); + } else { + clif_displaymessage(fd, "Invalid hungry value."); + return -1; + } + } + else + { + clif_displaymessage(fd, "Target player does not have a homunculus."); + return -1; + } + + + return 0; +} + +/*========================================== + * Show target's homunculus stats [HiddenDragon] + *------------------------------------------ + */ +int charcommand_hominfo( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct homun_data *hd; + struct status_data *status; + char output[200]; + char character[NAME_LENGTH]; + struct map_session_data *pl_sd; + memset(character, '\0', sizeof(character)); + memset(output, '\0', sizeof(output)); + + if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) { + clif_displaymessage(fd, "Please, enter a player name (usage: #hominfo <player>)."); + return -1; + } + + if ( (pl_sd = map_nick2sd(character)) == NULL ) + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + if ( pc_isGM(sd) < pc_isGM(pl_sd) ) + { + clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. + return -1; + } + + if(!merc_is_hom_active(pl_sd->hd)) + return -1; + hd = pl_sd->hd; + status = status_get_status_data(&hd->bl); + clif_displaymessage(fd, "Homunculus stats :"); + + snprintf(output, sizeof(output) ,"HP : %d/%d - SP : %d/%d", + status->hp, status->max_hp, status->sp, status->max_sp); + clif_displaymessage(fd, output); + + snprintf(output, sizeof(output) ,"ATK : %d - MATK : %d~%d", + status->rhw.atk2 +status->batk, status->matk_min, status->matk_max); + clif_displaymessage(fd, output); + + snprintf(output, sizeof(output) ,"Hungry : %d - Intimacy : %u", + hd->homunculus.hunger, hd->homunculus.intimacy/100); + clif_displaymessage(fd, output); + + snprintf(output, sizeof(output) , + "Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d", + status->str, status->agi, status->vit, + status->int_, status->dex, status->luk); + clif_displaymessage(fd, output); + return 0; } diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 979594251..754989d4b 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -13,7 +13,6 @@ enum CharCommandType { CharCommandStats, CharCommandOption, CharCommandSave, - CharCommandStatsAll, CharCommandSpiritball, CharCommandItemList, CharCommandEffect, @@ -34,18 +33,49 @@ enum CharCommandType { CharCommandChangeSex, CharCommandFeelReset, // Komurka CharCommandHelp, - -#ifdef TXT_ONLY -/* TXT_ONLY */ - -/* TXT_ONLY */ -#else -/* SQL-only */ - -/* SQL Only */ -#endif - - // End. No more commans after this line. + CharCommandLoad, + CharCommandSpeed, + CharCommandStorage, + CharCommandGStorage, + CharCommandHide, + CharCommandAlive, + CharCommandHeal, + CharCommandItem2, + CharCommandItemReset, + CharCommandRefine, + CharCommandProduce, + CharCommandStrength, + CharCommandAgility, + CharCommandVitality, + CharCommandIntelligence, + CharCommandDexterity, + CharCommandLuck, + CharCommandGuildLevelUp, + CharCommandHatch, + CharCommandPetHungry, + CharCommandAllSkill, + CharCommandDye, + CharCommandHStyle, + CharCommandHColor, + CharCommandAllStats, + CharCommandMountPeco, + CharCommandDelItem, + CharCommandJailTime, + CharCommandDisguie, + CharCommandUnDisguise, + CharCommandCartList, + CharCommandKiller, + CharCommandKillable, + CharCommandRefresh, + CharCommandExp, + CharCommandMonsterIgnore, + CharCommandSize, + CharCommandHomLevel, + CharCommandHomEvolve, + CharCommandHomFriendly, + CharCommandHomHungry, + CharCommandHomInfo, + // No more commands after this line CharCommand_Unknown, CharCommand_MAX }; |