Jump to content

How To Check Wrong Items


Recommended Posts

  • Premium

Copyright

Spoiler

Somewhere from internet.... i realy cant remember where i found it.

 

What it does?

Everytime player login in game, this function will look in all itens from player inventory. If server detect any item with more bonus then normal (from item_attr table).... the server will replace all bonus from this system.

I hope u understand and sorry for my english!

 

//#input_login.cpp

Spoiler

//1. Search: 
	d->SetPhase(PHASE_GAME);
//1. Add after:
	ch->CheckWrongItems();


 

// #char.cpp

Spoiler

//1. Search: 
int	CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const
{
	return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob);
}

//1. Add after:
void CHARACTER::CheckWrongItems()
{
	
	for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
	{
		LPITEM item;
		
		if (!(item = GetInventoryItem(i)))
			continue;
		
		for (int ia = 0; ia < ITEM_ATTRIBUTE_MAX_NUM; ia++)
		{
			const TPlayerItemAttribute& attr = item->GetAttribute(ia);
			const TItemAttrTable & r = g_map_itemAttr[attr.bType];
			
			if(item->GetAttributeSetIndex() != -1 && attr.sValue > r.lValues[r.bMaxLevelBySet[item->GetAttributeSetIndex()] - 1])
			{
				ChatPacket(CHAT_TYPE_INFO, "Wrong item found : %s, pos = %d, value = %d, max_value = %d", 
											item->GetName(), i, attr.sValue, r.lValues[r.bMaxLevelBySet[item->GetAttributeSetIndex()] - 1]);
				
				DBManager::instance().DirectQuery("INSERT INTO log.wrong_items(player_id, item_id, date, w_b_value) VALUES(%d, %d, NOW(), '%d|%d')", 
													GetPlayerID(), item->GetID(), attr.bType, attr.sValue);
					
				item->ChangeAttribute();
				//item->RemoveFromCharacter();
													
				break;
			}
		}
		
		continue;
	}
}

 

//#char.h

Spoiler

//1. Search: 
		int		GetSkillPowerByLevel(int level, bool bMob = false) const;
//1. Add after:
		void 	CheckWrongItems();

 

 

//#sql to logs

Spoiler

/*
Navicat MySQL Data Transfer

Source Server         : VPS_RANSOM
Source Server Version : 50552
Source Host           : 188.212.103.221:3306
Source Database       : log

Target Server Type    : MYSQL
Target Server Version : 50552
File Encoding         : 65001

Date: 2017-08-06 09:43:37
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `wrong_items`
-- ----------------------------
DROP TABLE IF EXISTS `wrong_items`;
CREATE TABLE `wrong_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `date` datetime NOT NULL,
  `w_b_value` char(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of wrong_items
-- ----------------------------

 

 

//#Know bugs

items with SKILL_DAMAGE_BONUS or NORMAL_HIT_DAMAGE_BONUS will see bonus replace

this sistem dont detect itens with bónus 6/7

this system will replace bónus from sash system etc....

 

 

If anyone know how to solve this small bugs, reply pleace. Its a nice and simple system to help in Fair Play

  • Sad 1
if pc.get_sex() == true and npc.get_sex() == false then
	npc.purge()
end

 

Link to comment
Share on other sites

LogManager::instance().WrongItemsLog(GetPlayerID(), item->GetID(), attr.bType, attr.sValue);

-----------------

void LogManager::WrongItemsLog(DWORD dwPlayerID, DWORD dwItemID, BYTE bType, BYTE bValue)
{
    Query("INSERT INTO wrong_items_log%s (player_id, item_id, date, w_b_value) VALUES(%d, %d, NOW(), '%d|%d')", get_table_postfix(), dwPlayerID, dwItemID, bType, bValue);
}

void WrongItemsLog(DWORD dwPlayerID, DWORD dwItemID, BYTE bType, BYTE bValue);

 

Link to comment
Share on other sites

  • 2 months later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.