summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-30 22:24:09 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-30 22:24:09 -0300
commitfd657411d1a478c8dfb9568e64b45f4a014a7038 (patch)
tree1d64579861dc1720f6d5dc576e4e7e2c41d9fab8
parent02bb73a4a3c9b52a14da05997efd0381fe9f1403 (diff)
downloadevol-hercules-fd657411d1a478c8dfb9568e64b45f4a014a7038.tar.gz
evol-hercules-fd657411d1a478c8dfb9568e64b45f4a014a7038.tar.bz2
evol-hercules-fd657411d1a478c8dfb9568e64b45f4a014a7038.tar.xz
evol-hercules-fd657411d1a478c8dfb9568e64b45f4a014a7038.zip
Prevent admins from creating strange coins or gifts.
Everyone is now forced to use Lua's System.
-rw-r--r--src/emap/atcommand.c76
-rw-r--r--src/emap/atcommand.h1
-rw-r--r--src/emap/init.c4
3 files changed, 81 insertions, 0 deletions
diff --git a/src/emap/atcommand.c b/src/emap/atcommand.c
index f71698f..8c38a35 100644
--- a/src/emap/atcommand.c
+++ b/src/emap/atcommand.c
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
+#include "common/cbasetypes.h"
#include "common/HPMi.h"
#include "common/memmgr.h"
#include "common/mmo.h"
@@ -16,6 +17,7 @@
#include "map/atcommand.h"
#include "map/clif.h"
#include "map/map.h"
+#include "map/pet.h"
#include "map/pc.h"
#include "map/skill.h"
@@ -289,3 +291,77 @@ ACMD1(getName)
return true;
}
+
+// TMW2
+/*==========================================
+ * @item command (usage: @item <name/id_of_item> <quantity>) (modified by [Yor] for pet_egg)
+ * @itembound command (usage: @itembound <name/id_of_item> <quantity> <bound type>) (revised by [Mhalicot])
+ *------------------------------------------*/
+ACMD0(tmw2item)
+{
+ char item_name[100];
+ int number = 0, item_id, flag = 0, bound = 0;
+ struct item item_tmp;
+ struct item_data *item_data;
+ int get_count, i;
+
+ memset(item_name, '\0', sizeof(item_name));
+
+ if (!*message
+ || ( sscanf(message, "\"%99[^\"]\" %12d", item_name, &number) < 1
+ && sscanf(message, "%99s %12d", item_name, &number) < 1
+ )) {
+ clif->message(fd, msg_fd(fd,983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
+ return false;
+ }
+
+ if (number <= 0)
+ number = 1;
+
+ if ((item_data = itemdb->search_name(item_name)) == NULL &&
+ (item_data = itemdb->exists(atoi(item_name))) == NULL)
+ {
+ clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name.
+ return false;
+ }
+
+ item_id = item_data->nameid;
+ get_count = number;
+
+ // TMW2: Check for restrictions
+ // Strange Coins ; <BronzeGift ~ SupremeGift> ; DeathPenalty
+ if( item_id == 828 ||
+ (item_id >= 589 && item_id <= 593) ||
+ item_id == 7420 ) {
+ clif->message(fd, msg_fd(fd,1999)); // TMW2 Restriction
+ return false;
+ }
+
+ //Check if it's stackable.
+ if (!itemdb->isstackable2(item_data)) {
+ if( bound && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) {
+ clif->message(fd, msg_fd(fd,498)); // Cannot create bounded pet eggs or pet armors.
+ return false;
+ }
+ get_count = 1;
+ }
+
+ for (i = 0; i < number; i += get_count) {
+ // if not pet egg
+ if (!pet->create_egg(sd, item_id)) {
+ memset(&item_tmp, 0, sizeof(item_tmp));
+ item_tmp.nameid = item_id;
+ item_tmp.identify = 1;
+ item_tmp.bound = (unsigned char)bound;
+
+ if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ clif->additem(sd, 0, 0, flag);
+ }
+ }
+
+ if (flag == 0)
+ clif->message(fd, msg_fd(fd,18)); // Item created.
+ return true;
+}
+
+
diff --git a/src/emap/atcommand.h b/src/emap/atcommand.h
index 50a92df..de5a880 100644
--- a/src/emap/atcommand.h
+++ b/src/emap/atcommand.h
@@ -42,5 +42,6 @@ ACMD1(serverExit);
ACMD0(log);
ACMD4(tee);
ACMD4(getName);
+ACMD0(tmw2item);
#endif // EVOL_MAP_ATCOMMAND
diff --git a/src/emap/init.c b/src/emap/init.c
index 3c81adb..5e014d0 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -110,6 +110,7 @@ HPExport void plugin_init (void)
addAtcommand("tee", tee);
addAtcommand("log", log);
addAtcommand("getname", getName);
+ addAtcommand("item", tmw2item);
addCPCommand("serverexit", serverExit);
@@ -343,6 +344,9 @@ HPExport void plugin_init (void)
addHookPre(status, calc_pc_recover_hp, estatus_calc_pc_recover_hp_pre);
addHookPre(homun, gainexp, ehomunculus_gainexp_pre);
+ // TMW2 Custom Pre Hooks
+ //addHookPre(battle, calc_weapon_attack, ebattle_calc_weapon_attack_pre);
+
addHookPost(battle, calc_weapon_attack, ebattle_calc_weapon_attack_post);
addHookPost(battle, calc_magic_attack, ebattle_calc_weapon_attack_post);
addHookPost(battle, calc_misc_attack, ebattle_calc_weapon_attack_post);