· 8 years ago · Mar 07, 2018, 12:46 PM
1//#input_login.cpp
2
3//1. Search:
4 d->SetPhase(PHASE_GAME);
5//1. Add after:
6 ch->CheckWrongItems();
7
8// #char.cpp
9
10//1. Search:
11int CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const
12{
13 return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob);
14}
15
16//1. Add after:
17void CHARACTER::CheckWrongItems()
18{
19
20 for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
21 {
22 LPITEM item;
23
24 if (!(item = GetInventoryItem(i)))
25 continue;
26
27 for (int ia = 0; ia < ITEM_ATTRIBUTE_MAX_NUM; ia++)
28 {
29 const TPlayerItemAttribute& attr = item->GetAttribute(ia);
30 const TItemAttrTable & r = g_map_itemAttr[attr.bType];
31
32 if(item->GetAttributeSetIndex() != -1 && attr.sValue > r.lValues[r.bMaxLevelBySet[item->GetAttributeSetIndex()] - 1])
33 {
34 ChatPacket(CHAT_TYPE_INFO, "Wrong item found : %s, pos = %d, value = %d, max_value = %d",
35 item->GetName(), i, attr.sValue, r.lValues[r.bMaxLevelBySet[item->GetAttributeSetIndex()] - 1]);
36
37 DBManager::instance().DirectQuery("INSERT INTO log.wrong_items(player_id, item_id, date, w_b_value) VALUES(%d, %d, NOW(), '%d|%d')",
38 GetPlayerID(), item->GetID(), attr.bType, attr.sValue);
39
40 item->ChangeAttribute();
41 //item->RemoveFromCharacter();
42
43 break;
44 }
45 }
46
47 continue;
48 }
49}
50
51//#char.h
52
53//1. Search:
54 int GetSkillPowerByLevel(int level, bool bMob = false) const;
55//1. Add after:
56 void CheckWrongItems();
57
58//#Correr isto no Navicat para criar a tabela de logs dos files alterados
59
60/*
61Navicat MySQL Data Transfer
62
63Source Server : VPS_RANSOM
64Source Server Version : 50552
65Source Host : 188.212.103.221:3306
66Source Database : log
67
68Target Server Type : MYSQL
69Target Server Version : 50552
70File Encoding : 65001
71
72Date: 2017-08-06 09:43:37
73*/
74
75SET FOREIGN_KEY_CHECKS=0;
76
77-- ----------------------------
78-- Table structure for `wrong_items`
79-- ----------------------------
80DROP TABLE IF EXISTS `wrong_items`;
81CREATE TABLE `wrong_items` (
82 `id` int(11) NOT NULL AUTO_INCREMENT,
83 `player_id` int(11) NOT NULL,
84 `item_id` int(11) NOT NULL,
85 `date` datetime NOT NULL,
86 `w_b_value` char(100) NOT NULL,
87 PRIMARY KEY (`id`)
88) ENGINE=MyISAM DEFAULT CHARSET=latin1;
89
90-- ----------------------------
91-- Records of wrong_items
92-- ----------------------------