Jump to content

Anti Drop Methode for Character


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Germany:

Hallo leute,
ich hab heute Gm-Items erstellt und diese sollte man nicht handeln (Lösbar per Antiflag), 
Nun wollte ich aber das der ganze Charakter nicht handeln kann, Idee per Game dies zu regeln.
Nach kurzen überlegen kamm dies hierbei raus:
 
Ordner: game/src/
 
char.cpp (Zeile: 584) -> void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
 

void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
{
	if (GetPart(PART_MAIN) > 2)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù."));
		return;
	}

	if (GetMyShop())	// ÀÌ¹Ì ¼¥ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý´Â´Ù.
	{
		CloseMyShop();
		return;
	}

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 
char_battle.cpp (Zeile: 985) -> void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
 

void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
{
	// °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» µå·ÓÇÏÁö ¾Ê´Â´Ù.
	if (GetMyShop())
		return;

	if (false == LC_IsYMIR())
	{
		if (GetLevel() < 50)
			return;
	}
	
	if (CBattleArena::instance().IsBattleArenaMap(GetMapIndex()) == true)
	{
		return;
	}

	struct TItemDropPenalty * table = &aItemDropPenalty_kor[0];

	if (GetLevel() < 10)
		return;
	
	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		//ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 
char_item.cpp (Zeile: 5437) -> bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)

bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)
{
	LPITEM item = NULL; 

	if (!CanHandleItem())
	{
		if (NULL != DragonSoul_RefineWindow_GetOpener())
			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
		return false;
	}

	if (IsDead())
		return false;

	if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell)))
		return false;

	if (item->IsExchanging())
		return false;

	if (true == item->isLocked())
		return false;

	if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
		return false;

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

exchange.cpp (Zeile: 139) -> bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)

bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)
{
	assert(m_pOwner != NULL && GetCompany());

	if (!item_pos.IsValidItemPosition())
		return false;

	// Àåºñ´Â ±³È¯ÇÒ ¼ö ¾øÀ½
	if (item_pos.IsEquipPosition())
		return false;

	LPITEM item;

	if (!(item = m_pOwner->GetItem(item_pos)))
		return false;
	
	if ( int(m_pOwner->GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		m_pOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

 
Quest:

--[[
-- BlockItems
-- lvl 1+
-- Copyright ©Zymos/Risan
-- Version 1.0
-- Create: 14.09.2014
]]
quest BlockItem begin
state start begin
	when 9010.chat."BlockItems Manager" begin
		local f = "BlockItem"
		say("Status: ".. pc.getf(f,"Enable") .."")
		if select("Disable","Enable") == 1 then
			pc.setf(f,"Enable",0)
			chat("BlockItems is now Disabled")
		else
			pc.setf(f,"Enable",1)
			chat("BlockItems is now Enabled")
		end
	end
end
end

 
Info:
Wenn aktiviert kann der Charakter nichts mehr Fallen lassen, handeln oder verkaufen im Shop.
 
Mfg Risan

English:
Hello, People,

I have created GM_items today but this items should not be tradable. (With Antiflag)
Now, however, I did not want the whole character can act.

So i wrote this:

char.cpp (Line: 584) -> void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
 

void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
{
	if (GetPart(PART_MAIN) > 2)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù."));
		return;
	}

	if (GetMyShop())	// ÀÌ¹Ì ¼¥ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý´Â´Ù.
	{
		CloseMyShop();
		return;
	}

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 
char_battle.cpp (Line: 985) -> void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
 

void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
{
	// °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» µå·ÓÇÏÁö ¾Ê´Â´Ù.
	if (GetMyShop())
		return;

	if (false == LC_IsYMIR())
	{
		if (GetLevel() < 50)
			return;
	}
	
	if (CBattleArena::instance().IsBattleArenaMap(GetMapIndex()) == true)
	{
		return;
	}

	struct TItemDropPenalty * table = &aItemDropPenalty_kor[0];

	if (GetLevel() < 10)
		return;
	
	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		//ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 
char_item.cpp (Line: 5437) -> bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)

bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)
{
	LPITEM item = NULL; 

	if (!CanHandleItem())
	{
		if (NULL != DragonSoul_RefineWindow_GetOpener())
			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
		return false;
	}

	if (IsDead())
		return false;

	if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell)))
		return false;

	if (item->IsExchanging())
		return false;

	if (true == item->isLocked())
		return false;

	if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
		return false;

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

exchange.cpp (Line: 139) -> bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)

bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)
{
	assert(m_pOwner != NULL && GetCompany());

	if (!item_pos.IsValidItemPosition())
		return false;

	// Àåºñ´Â ±³È¯ÇÒ ¼ö ¾øÀ½
	if (item_pos.IsEquipPosition())
		return false;

	LPITEM item;

	if (!(item = m_pOwner->GetItem(item_pos)))
		return false;
	
	if ( int(m_pOwner->GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		m_pOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

 
Quest:

--[[
-- BlockItems
-- lvl 1+
-- Copyright ©Zymos/Risan
-- Version 1.0
-- Create: 14.09.2014
]]
quest BlockItem begin
state start begin
	when 9010.chat."BlockItems Manager" begin
		local f = "BlockItem"
		say("Status: ".. pc.getf(f,"Enable") .."")
		if select("Disable","Enable") == 1 then
			pc.setf(f,"Enable",0)
			chat("BlockItems is now Disabled")
		else
			pc.setf(f,"Enable",1)
			chat("BlockItems is now Enabled")
		end
	end
end
end

 
Info:
If enable the chrakater can`t drop or trade Items!

Best Regards, Risan

heave a idea on create Spoiler?

  • Love 13
Link to comment
Share on other sites

  • Honorable Member

heave a idea on create Spoiler?

[ spoiler ] [ / spoiler]

It's the same on every kind of board.

 

    if ( int(m_pOwner->GetQuestFlag("BlockItem.Enable")) == 1 )

This is really disturbing:
  • GetQuestFlag is already int so you don't need an extra "int()"

    int CHARACTER::GetQuestFlag

  • This should be enough: (non-zero value true, zero value false)

    if (m_pOwner->GetQuestFlag("BlockItem.Enable"))

  • Ymir has good fame about highering letters

    "block_item.enable" could be preferable

There's no need to rewrite the thread twice to translate 2 sentences.
  • Love 4
Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

Germany:

Hallo leute,

ich hab heute Gm-Items erstellt und diese sollte man nicht handeln (Lösbar per Antiflag), 

Nun wollte ich aber das der ganze Charakter nicht handeln kann, Idee per Game dies zu regeln.

Nach kurzen überlegen kamm dies hierbei raus:

 

Ordner: game/src/

 

char.cpp (Zeile: 584) -> void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)

 

void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
{
	if (GetPart(PART_MAIN) > 2)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù."));
		return;
	}

	if (GetMyShop())	// ÀÌ¹Ì ¼¥ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý´Â´Ù.
	{
		CloseMyShop();
		return;
	}

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 

char_battle.cpp (Zeile: 985) -> void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)

 

void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
{
	// °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» µå·ÓÇÏÁö ¾Ê´Â´Ù.
	if (GetMyShop())
		return;

	if (false == LC_IsYMIR())
	{
		if (GetLevel() < 50)
			return;
	}
	
	if (CBattleArena::instance().IsBattleArenaMap(GetMapIndex()) == true)
	{
		return;
	}

	struct TItemDropPenalty * table = &aItemDropPenalty_kor[0];

	if (GetLevel() < 10)
		return;
	
	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		//ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 

char_item.cpp (Zeile: 5437) -> bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)

bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)
{
	LPITEM item = NULL; 

	if (!CanHandleItem())
	{
		if (NULL != DragonSoul_RefineWindow_GetOpener())
			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
		return false;
	}

	if (IsDead())
		return false;

	if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell)))
		return false;

	if (item->IsExchanging())
		return false;

	if (true == item->isLocked())
		return false;

	if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
		return false;

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

exchange.cpp (Zeile: 139) -> bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)

bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)
{
	assert(m_pOwner != NULL && GetCompany());

	if (!item_pos.IsValidItemPosition())
		return false;

	// Àåºñ´Â ±³È¯ÇÒ ¼ö ¾øÀ½
	if (item_pos.IsEquipPosition())
		return false;

	LPITEM item;

	if (!(item = m_pOwner->GetItem(item_pos)))
		return false;
	
	if ( int(m_pOwner->GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		m_pOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

 

Quest:

--[[
-- BlockItems
-- lvl 1+
-- Copyright ©Zymos/Risan
-- Version 1.0
-- Create: 14.09.2014
]]
quest BlockItem begin
state start begin
	when 9010.chat."BlockItems Manager" begin
		local f = "BlockItem"
		say("Status: ".. pc.getf(f,"Enable") .."")
		if select("Disable","Enable") == 1 then
			pc.setf(f,"Enable",0)
			chat("BlockItems is now Disabled")
		else
			pc.setf(f,"Enable",1)
			chat("BlockItems is now Enabled")
		end
	end
end
end

 

Info:

Wenn aktiviert kann der Charakter nichts mehr Fallen lassen, handeln oder verkaufen im Shop.

 

Mfg Risan

English:

Hello, People,

I have created GM_items today but this items should not be tradable. (With Antiflag)

Now, however, I did not want the whole character can act.

So i wrote this:

char.cpp (Line: 584) -> void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)

 

void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, WORD bItemCount)
{
	if (GetPart(PART_MAIN) > 2)
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù."));
		return;
	}

	if (GetMyShop())	// ÀÌ¹Ì ¼¥ÀÌ ¿­·Á ÀÖÀ¸¸é ´Ý´Â´Ù.
	{
		CloseMyShop();
		return;
	}

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 

char_battle.cpp (Line: 985) -> void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)

 

void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
{
	// °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» µå·ÓÇÏÁö ¾Ê´Â´Ù.
	if (GetMyShop())
		return;

	if (false == LC_IsYMIR())
	{
		if (GetLevel() < 50)
			return;
	}
	
	if (CBattleArena::instance().IsBattleArenaMap(GetMapIndex()) == true)
	{
		return;
	}

	struct TItemDropPenalty * table = &aItemDropPenalty_kor[0];

	if (GetLevel() < 10)
		return;
	
	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		//ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return;
	}

 

char_item.cpp (Line: 5437) -> bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)

bool CHARACTER::DropItem(TItemPos Cell, WORD bCount)
{
	LPITEM item = NULL; 

	if (!CanHandleItem())
	{
		if (NULL != DragonSoul_RefineWindow_GetOpener())
			ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
		return false;
	}

	if (IsDead())
		return false;

	if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell)))
		return false;

	if (item->IsExchanging())
		return false;

	if (true == item->isLocked())
		return false;

	if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
		return false;

	if ( int(GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

exchange.cpp (Line: 139) -> bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)

bool CExchange::AddItem(TItemPos item_pos, WORD display_pos)
{
	assert(m_pOwner != NULL && GetCompany());

	if (!item_pos.IsValidItemPosition())
		return false;

	// Àåºñ´Â ±³È¯ÇÒ ¼ö ¾øÀ½
	if (item_pos.IsEquipPosition())
		return false;

	LPITEM item;

	if (!(item = m_pOwner->GetItem(item_pos)))
		return false;
	
	if ( int(m_pOwner->GetQuestFlag("BlockItem.Enable")) == 1 )
	{
		m_pOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("DENIED! You cannot Drop this Item. You Char is blocked!"));
		return false;
	}

 

Quest:

--[[
-- BlockItems
-- lvl 1+
-- Copyright ©Zymos/Risan
-- Version 1.0
-- Create: 14.09.2014
]]
quest BlockItem begin
state start begin
	when 9010.chat."BlockItems Manager" begin
		local f = "BlockItem"
		say("Status: ".. pc.getf(f,"Enable") .."")
		if select("Disable","Enable") == 1 then
			pc.setf(f,"Enable",0)
			chat("BlockItems is now Disabled")
		else
			pc.setf(f,"Enable",1)
			chat("BlockItems is now Enabled")
		end
	end
end
end

 

Info:

If enable the chrakater can`t drop or trade Items!

Best Regards, Risan

heave a idea on create Spoiler?

 locked and unlocked only item ?

Link to comment
Share on other sites

  • 6 months later...
  • 3 months later...
  • 3 weeks 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.