Sari la conținut

JUST4METIN.COM CAUTA STAFF ACTIV - PM Bogdan

Robot

[C++] CheckWrongItems

Postări Recomandate

Copyright

  Hide contents

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

  Hide contents

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

 

// #char.cpp

  Hide contents

//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

  Hide contents

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

 

 

//#sql to logs

  Hide contents

/*
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

Editat de Robot

Partajează acest post


Link spre post
Distribuie pe alte site-uri

Creează un cont sau autentifică-te pentru a adăuga comentariu

Trebuie să fi un membru pentru a putea lăsa un comentariu.

Creează un cont

Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!

Înregistrează un nou cont

Autentificare

Ai deja un cont? Autentifică-te aici.

Autentifică-te acum

×