[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: An unknown line type was found in line 188

From: Flex <flex_at_datecs.bg>
Date: 2006-09-22 19:10:30 CEST

I haven't made the patch, but the author is not responding. His first
version patches okay, it has the same block of lines around but it
passes... so I though they are fine? I'm attaching the working ver

Stefan Küng wrote:
> Simon Large wrote:
>> Flex wrote:
>>> Hi all. I got this error every time I try to apply this patch. Being
>>> over 188 many times but can't see anything wrong. Tried the latest
>>> nighty - TortoiseSVN 1.4.0, Build 7547 too with same error. Is there
>>> something wrong with it?
>>>
>>> ------------------------------------------------------------------------
>>>
>>> Index: src/game/QuestHandler.cpp
>>> ===================================================================
>>> --- src/game/QuestHandler.cpp (revision 2264)
>>> +++ src/game/QuestHandler.cpp (working copy)
>>> @@ -87,6 +87,35 @@
>>> sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST
>>> npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
>>>
>> --^
>> This line (155) should have a single space (as opposed to the special
>> characters '+', '-' and '@'. I guess this means the line is discarded
>> from the hunk, which is then 1 line too short. If it doesn't
>> increment the line count either, then line 188 appears to be the next
>> @@ entry.
>
> Correct, that's the reason.
> What program did you use to create the patch? Because there are some
> other lines in there which seem a little bit strange to me.
>
> Stefan
>

Index: src/game/ItemHandler.cpp
===================================================================
--- src/game/ItemHandler.cpp (revision 2233)
+++ src/game/ItemHandler.cpp (working copy)
@@ -353,7 +353,7 @@
     sLog.outDetail( "WORLD: Received CMSG_BUY_ITEM_IN_SLOT" );
     uint64 vendorguid, bagguid;
     uint32 item;
- uint8 bag, slot, count, vendorslot;
+ uint8 bag, slot, count, vendorslot=0;
 
     recv_data >> vendorguid >> item >> bagguid >> slot >> count;
     recv_data.hexlike();
@@ -364,8 +364,7 @@
         Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, vendorguid);
         if( pCreature )
         {
- vendorslot = 0;
- for(int i = 0; i < pCreature->GetItemCount(); i++)
+ for(int i = 0; i < pCreature->GetItemCount(); i++)
             {
                 if ( pCreature->GetItemId(i) == item )
                 {
@@ -373,10 +372,36 @@
                     break;
                 }
             }
+ if( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && (count == 0 || !vendorslot) )
+ {
+ sLog.outError("CHEAT: player '%s' tried to buy item '%d'!", _player->GetName(), item);
+ if ( _player->GetSession()->GetSecurity() == 0 )
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to cheat item #" << item;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(7);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ }
+ return;
+ }
             if( !vendorslot )
             {
- _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
- return;
+ _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
+ return;
             }
             else
                 vendorslot -= 1;
@@ -440,7 +465,7 @@
     sLog.outDetail( "WORLD: Received CMSG_BUY_ITEM" );
     uint64 vendorguid;
     uint32 item;
- uint8 count, unk1, vendorslot;
+ uint8 count, unk1, vendorslot=0;
 
     recv_data >> vendorguid >> item >> count >> unk1;
     recv_data.hexlike();
@@ -451,8 +476,7 @@
         Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, vendorguid);
         if( pCreature )
         {
- vendorslot = 0;
- for(int i = 0; i < pCreature->GetItemCount(); i++)
+ for(int i = 0; i < pCreature->GetItemCount(); i++)
             {
                 if ( pCreature->GetItemId(i) == item )
                 {
@@ -460,6 +484,32 @@
                     break;
                 }
             }
+ if( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) && (count == 0 || !vendorslot) )
+ {
+ sLog.outError("CHEAT: player '%s' tried to buy item '%d!", _player->GetName(), item);
+ if ( _player->GetSession()->GetSecurity() == 0 )
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to cheat item #" << item;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(7);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ }
+ return;
+ }
             if( !vendorslot )
             {
                 _player->SendBuyError( BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0);
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp (revision 2233)
+++ src/game/Player.cpp (working copy)
@@ -5395,6 +5395,16 @@
     GetSession()->SendPacket( &data );
 }
 
+void Player::SetBindPointInDB(uint32 mapId, uint32 zoneId, float x, float y, float z)
+{
+ sDatabase.PExecute("UPDATE `character_homebind` SET `map` = %d,`zone` = %d,`position_x` = %f,`position_y` = %f,`position_z` = %f WHERE `guid` = '%u'", mapId, zoneId, x, y, z, GetGUIDLow());
+}
+
+void Player::BanAccount(uint8 num)
+{
+ loginDatabase.PExecute("UPDATE `account` SET `banned` = %u WHERE `id` = %d", num, GetSession()->GetAccountId() );
+}
+
 /*********************************************************/
 /*** STORAGE SYSTEM ***/
 /*********************************************************/
@@ -9635,4 +9645,4 @@
             if (m_TotemSlot[i])
                 Member->RemoveAreaAurasByOthers(m_TotemSlot[i]);
     }
-}
\ No newline at end of file
+}
Index: src/game/Player.h
===================================================================
--- src/game/Player.h (revision 2233)
+++ src/game/Player.h (working copy)
@@ -586,6 +586,8 @@
         void SavePet();
 
         void SetBindPoint(uint64 guid);
+ void SetBindPointInDB(uint32 mapId, uint32 zoneId, float x, float y, float z);
+ void BanAccount(uint8 num);
         void CalcRage( uint32 damage,bool attacker );
         void RegenerateAll();
         void Regenerate(Powers power);
Index: src/game/QuestHandler.cpp
===================================================================
--- src/game/QuestHandler.cpp (revision 2233)
+++ src/game/QuestHandler.cpp (working copy)
@@ -87,6 +87,35 @@
     sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
 
     QuestInfo const* qInfo = objmgr.GetQuestInfo(quest);
+
+ Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, guid);
+ if( pCreature && !pCreature->hasQuest(quest) && sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ sLog.outError("CHEAT: player '%s' tried to spoof accept of quest '%d'", _player->GetName(), quest);
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed reward of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(8);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ }
+ return;
+ }
+
     if ( qInfo )
     {
         if( _player->GetDivider() != 0 )
@@ -107,7 +136,6 @@
             if ( _player->CanCompleteQuest( quest ) )
                 _player->CompleteQuest( quest );
 
- Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, guid);
             if( pCreature )
                 Script->QuestAccept(_player, pCreature, pQuest );
             else
@@ -222,11 +250,48 @@
     Quest *pQuest = objmgr.NewQuest(quest);
     if( pQuest )
     {
+
+ Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, guid);
+
+ if ( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ // choose quest reward spoof anticheat:
+ if ( pCreature && (!pCreature->hasInvolvedQuest(quest)) )
+ {
+ sLog.outError("CHEAT: player '%s' tried to spoof reward of quest '%d'", _player->GetName(), quest);
+ _player->PlayerTalkClass->CloseGossip();
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed reward of quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(8);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+
+ }
+ delete pQuest;
+ return; // do not complete quest
+ }
+ }
+
         if( _player->CanRewardQuest( pQuest, reward, true ) )
         {
             _player->RewardQuest( pQuest, reward );
 
- if(Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, guid))
+ if(pCreature)
             {
                 _player->CalculateReputation( pQuest, guid );
                 if( !(Script->ChooseReward( _player, pCreature, pQuest, reward )) )
@@ -348,8 +413,43 @@
     sLog.outString( "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest );
 
     Quest *pQuest = objmgr.NewQuest( quest );
+
     if( pQuest )
     {
+ if ( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ // basic quest spoof protection:
+ Creature *pCreature = ObjectAccessor::Instance().GetCreature(*_player, guid);
+ if ( !pCreature->hasInvolvedQuest(quest) )
+ {
+ sLog.outError("CHEAT: player '%s' tried to spoof quest '%d'", _player->GetName(), quest);
+ if ( _player->GetSession()->GetSecurity() == 0)
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' spoofed quest #" << quest;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(8);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ }
+ delete pQuest;
+ return; // do not complete quest
+ }
+ }
+
+
         if( _player->GetQuestStatus( quest ) != QUEST_STATUS_COMPLETE )
             _player->PlayerTalkClass->SendRequestedItems(pQuest, guid, false, false);
         else
Index: src/game/SpellHandler.cpp
===================================================================
--- src/game/SpellHandler.cpp (revision 2233)
+++ src/game/SpellHandler.cpp (working copy)
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -253,6 +253,78 @@
         return;
     }
 
+
+ // for basic spell anticheat:
+ if ( sWorld.getConfig(CONFIG_CHEAT_ENABLEPROTECTION) )
+ {
+ bool isSpellCheat = false;
+ uint32 req_GM, req_Level, req_Class;
+ std::string desc;
+ // check if the player owns the spell. this blocks cheats like WoWc or Wpe pro spell packet editing
+ if (
+ ((!_player->HasSpell(spellId)) && _player->GetSession()->GetSecurity() == 0) && // only GMs may cast spells they don't own
+ _player->IsInWorld() // the player has to be in the world to be treated as cheater. (on login spell 836 is casted, another one is casted on char enum, forgot the id.)
+ )
+ {
+ isSpellCheat = true;
+ }
+
+ if( (!isSpellCheat) && _player->IsInWorld() && sWorld.getConfig(CONFIG_CHEAT_CHECKSPELLDB) ) // player has spell, now lets check if the player may cast it
+ {
+ QueryResult *result = sDatabase.PQuery("SELECT `Req_GM`,`Req_Level`,`Req_Class`,`Description` FROM `Spell_Anticheat` WHERE `SpellID` = %d", spellId);
+ if (result)
+ {
+ req_GM = (*result)[0].GetUInt32();
+ req_Level = (*result)[1].GetUInt32();
+ req_Class = (*result)[2].GetUInt32();
+ desc = (*result)[3].GetString();
+
+ if ( _player->GetSession()->GetSecurity() < req_GM )
+ {
+ isSpellCheat = true;
+ }
+
+ if ( _player->getLevel() < req_Level && _player->GetSession()->GetSecurity() == 0 )
+ {
+ isSpellCheat = true;
+ }
+
+ if ( req_Class != 0 && req_Class != _player->getClass() && _player->GetSession()->GetSecurity() == 0 )
+ {
+ isSpellCheat = true;
+ }
+ delete result;
+ }
+
+ }
+ if ( isSpellCheat )
+ {
+ sLog.outError("CHEAT: Player '%s' casted Spell '%d'", _player->GetName(),spellId);
+ if ( _player->GetSession()->GetSecurity() == 0 ) // prevent GMs from beeing banned
+ {
+ if( sWorld.getConfig(CONFIG_CHEAT_REMOVEMONEY) )
+ _player->SetMoney(0);
+ if( sWorld.getConfig(CONFIG_CHEAT_JAIL) )
+ {
+ _player->SetBindPointInDB(13,_player->GetZoneId(),0,0,0);
+ _player->TeleportTo(13,0,0,0,0); // put player in "the box" :)
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BROADCAST) )
+ {
+ std::stringstream wmsg;
+ wmsg << "|cffff0000[CHEAT]:|r Player '" << _player->GetName() << "' tried to spoof spell #" << spellId;
+ sWorld.SendWorldText(wmsg.str().c_str(), NULL);
+ }
+ if( sWorld.getConfig(CONFIG_CHEAT_BAN) )
+ {
+ _player->BanAccount(9);
+ _player->GetSession()->Terminate(true); // this must be the last call (session is invalid after)
+ }
+ }
+ return; // spell is not beeing cast
+ }
+ }
+
     Spell *spell ;
     spell = new Spell(_player, spellInfo, false, 0);
 
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp (revision 2233)
+++ src/game/World.cpp (working copy)
@@ -225,9 +225,18 @@
     m_configs[CONFIG_SIGHT_GUARDER] = sConfig.GetIntDefault("GuarderSight", 500);
     m_configs[CONFIG_GAME_TYPE] = sConfig.GetIntDefault("GameType", 0);
     m_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = sConfig.GetIntDefault("AllowTwoSideAccounts", 0);
+ m_configs[CONFIG_ALLOW_TWO_SIDE_WHISPERS] = sConfig.GetBoolDefault("AllowTwoSideWhispers", 0);
+ m_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfig.GetBoolDefault("AllowTwoSideTrade", 0);
     m_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfig.GetIntDefault("MaxPlayerLevel", 60);
     m_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfig.GetIntDefault("MaxPrimaryTradeSkill", 2);
     m_configs[CONFIG_WISPERING_TO_GM] = sConfig.GetIntDefault("WhisperingToGM",0);
+ m_configs[CONFIG_CHEAT_BROADCAST] = sConfig.GetBoolDefault("Cheat.Broadcast",1);
+ m_configs[CONFIG_CHEAT_BAN] = sConfig.GetBoolDefault("Cheat.Ban",1);
+ m_configs[CONFIG_CHEAT_JAIL] = sConfig.GetBoolDefault("Cheat.Jail",0);
+ m_configs[CONFIG_CHEAT_REMOVEMONEY] = sConfig.GetBoolDefault("Cheat.RemoveMoney",0);
+ m_configs[CONFIG_CHEAT_ENABLEPROTECTION] = sConfig.GetBoolDefault("Cheat.EnableProtection",1);
+ m_configs[CONFIG_CHEAT_CHECKSPELLDB] = sConfig.GetBoolDefault("Cheat.CheckSpellDB",0);
+ m_configs[CONFIG_CHANNEL_DEFAULTLANG] = sConfig.GetBoolDefault("Channel.DefaultLang",0);
 
     m_gameTime = (3600*atoi(hour))+(atoi(minute)*60)+(atoi(second));
 
Index: src/game/World.h
===================================================================
--- src/game/World.h (revision 2233)
+++ src/game/World.h (working copy)
@@ -58,9 +58,18 @@
     CONFIG_SIGHT_GUARDER,
     CONFIG_GAME_TYPE,
     CONFIG_ALLOW_TWO_SIDE_ACCOUNTS,
+ CONFIG_ALLOW_TWO_SIDE_WHISPERS,
+ CONFIG_ALLOW_TWO_SIDE_TRADE,
     CONFIG_MAX_PLAYER_LEVEL,
     CONFIG_MAX_PRIMARY_TRADE_SKILL,
     CONFIG_WISPERING_TO_GM,
+ CONFIG_CHANNEL_DEFAULTLANG,
+ CONFIG_CHEAT_ENABLEPROTECTION,
+ CONFIG_CHEAT_BAN,
+ CONFIG_CHEAT_BROADCAST,
+ CONFIG_CHEAT_JAIL,
+ CONFIG_CHEAT_REMOVEMONEY,
+ CONFIG_CHEAT_CHECKSPELLDB,
     CONFIG_VALUE_COUNT
 };
 
Index: src/game/WorldSession.cpp
===================================================================
--- src/game/WorldSession.cpp (revision 2233)
+++ src/game/WorldSession.cpp (working copy)
@@ -502,3 +502,9 @@
     uint32 spellid;
     recv_data >> spellid;
 }
+
+void WorldSession::Terminate( bool save )
+{
+ LogoutPlayer(save);
+ _socket->Close();
+}
Index: src/game/WorldSession.h
===================================================================
--- src/game/WorldSession.h (revision 2233)
+++ src/game/WorldSession.h (working copy)
@@ -75,6 +75,7 @@
 
         void QueuePacket(WorldPacket& packet);
         bool Update(uint32 diff);
+ void Terminate(bool save);
 
         void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue );
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Fri Sep 22 19:10:46 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.