Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: 0.56.b/graysvr/CChar.cpp
- ===================================================================
- --- 0.56.b/graysvr/CChar.cpp (revision 1758)
- +++ 0.56.b/graysvr/CChar.cpp (working copy)
- @@ -64,6 +64,7 @@
- "@itemDropOn_Ground", // I dropped an item on the ground
- "@itemDropOn_Item", // I have been dropped on this item
- "@itemDropOn_Self", // An item has been dropped on
- + "@ItemDropOn_Trade",
- "@itemEQUIP", // I have equipped an item
- "@itemEQUIPTEST",
- "@itemPICKUP_GROUND",
- @@ -151,6 +152,8 @@
- "@StepStealth", //+Made a step in stealth mode
- "@ToolTip", // someone did tool tips on me.
- "@TradeAccepted", // Everything went well, and we are about to exchange trade items
- + "@TradeClose",
- + "@TradeCreate",
- "@UserBugReport",
- "@UserChatButton",
- @@ -306,7 +309,7 @@
- {
- ADDTOCALLSTACK("CChar::ClientDetach");
- // Client is detaching from this CChar.
- -
- +
- // remove all trade windows.
- for ( CItem *pItem = GetContentHead(); pItem ; )
- {
- @@ -315,7 +318,6 @@
- pItem->Delete();
- pItem = pItemNext;
- }
- -
- if ( !IsClient() )
- return;
- @@ -2036,6 +2038,9 @@
- case CHC_MANA:
- sVal.FormatVal( Stat_GetVal(STAT_INT) );
- break;
- + case CHC_MAXFOOD:
- + sVal.FormatVal( Stat_GetMax( STAT_FOOD ) );
- + break;
- case CHC_MAXHITS:
- sVal.FormatVal( Stat_GetMax(STAT_STR) );
- break;
- @@ -2242,6 +2247,9 @@
- SetDefStr(s.GetKey(), s.GetArgStr( &fQuoted ), fQuoted);
- }
- break;
- + case CHC_MAXFOOD:
- + Stat_SetMax(STAT_FOOD, s.GetArgVal());
- + break;
- case CHC_MAXHITS:
- Stat_SetMax(STAT_STR, s.HasArgs() ? s.GetArgVal() : 0 );
- break;
- Index: 0.56.b/graysvr/CCharFight.cpp
- ===================================================================
- --- 0.56.b/graysvr/CCharFight.cpp (revision 1758)
- +++ 0.56.b/graysvr/CCharFight.cpp (working copy)
- @@ -1179,6 +1179,11 @@
- return( true );
- ASSERT( pItem->IsItem());
- + ASSERT( pItem->GetContainer() );
- + CItem * pCItem = static_cast <CItem *> (pItem->GetContainer());
- + ASSERT( pCItem );
- + if ( pCItem->IsType(IT_EQ_TRADE_WINDOW) && g_Cfg.m_iTradeWindowSnooping == false )
- + return( false );
- if ( ! IsPriv(PRIV_GM))
- switch ( pItem->GetType())
- Index: 0.56.b/graysvr/CClientUse.cpp
- ===================================================================
- --- 0.56.b/graysvr/CClientUse.cpp (revision 1758)
- +++ 0.56.b/graysvr/CClientUse.cpp (working copy)
- @@ -40,37 +40,43 @@
- {
- // protect from ,snoop - disallow picking from not opened containers
- bool isInOpenedContainer = false;
- - CClient::OpenedContainerMap_t::iterator itContainerFound = m_openedContainers.find( container->GetUID().GetPrivateUID() );
- - if ( itContainerFound != m_openedContainers.end() )
- + IT_TYPE type = container->GetType();
- + if ( type == IT_EQ_TRADE_WINDOW)
- {
- - DWORD dwTopContainerUID = (((*itContainerFound).second).first).first;
- - DWORD dwTopMostContainerUID = (((*itContainerFound).second).first).second;
- - CPointMap ptOpenedContainerPosition = ((*itContainerFound).second).second;
- - const CObjBaseTemplate * pObjTop = pItem->GetTopLevelObj();
- + isInOpenedContainer = true;
- + } else {
- + CClient::OpenedContainerMap_t::iterator itContainerFound = m_openedContainers.find( container->GetUID().GetPrivateUID() );
- + if ( itContainerFound != m_openedContainers.end() )
- + {
- + DWORD dwTopContainerUID = (((*itContainerFound).second).first).first;
- + DWORD dwTopMostContainerUID = (((*itContainerFound).second).first).second;
- + CPointMap ptOpenedContainerPosition = ((*itContainerFound).second).second;
- + const CObjBaseTemplate * pObjTop = pItem->GetTopLevelObj();
- - DWORD dwTopContainerUID_ToCheck = 0;
- - if ( container->GetContainer() )
- - dwTopContainerUID_ToCheck = container->GetContainer()->GetUID().GetPrivateUID();
- - else
- - dwTopContainerUID_ToCheck = pObjTop->GetUID().GetPrivateUID();
- + DWORD dwTopContainerUID_ToCheck = 0;
- + if ( container->GetContainer() )
- + dwTopContainerUID_ToCheck = container->GetContainer()->GetUID().GetPrivateUID();
- + else
- + dwTopContainerUID_ToCheck = pObjTop->GetUID().GetPrivateUID();
- - if ( ( dwTopMostContainerUID == pObjTop->GetUID().GetPrivateUID() ) && ( dwTopContainerUID == dwTopContainerUID_ToCheck ) )
- - {
- - if ( pObjTop->IsChar() )
- + if ( ( dwTopMostContainerUID == pObjTop->GetUID().GetPrivateUID() ) && ( dwTopContainerUID == dwTopContainerUID_ToCheck ) )
- {
- - isInOpenedContainer = true;
- - // probably a pickup check from pack if pCharTop != this?
- - }
- - else
- - {
- - const CItem * pItemTop = dynamic_cast<const CItem *>(pObjTop);
- - if ( pItemTop && (pItemTop->IsType(IT_SHIP_HOLD) || pItemTop->IsType(IT_SHIP_HOLD_LOCK)) && (pItemTop->GetTopPoint().GetRegion(REGION_TYPE_MULTI) == m_pChar->GetTopPoint().GetRegion(REGION_TYPE_MULTI)) )
- + if ( pObjTop->IsChar() )
- {
- isInOpenedContainer = true;
- + // probably a pickup check from pack if pCharTop != this?
- }
- - else if ( ptOpenedContainerPosition.GetDist( pObjTop->GetTopPoint() ) <= 3 )
- + else
- {
- - isInOpenedContainer = true;
- + const CItem * pItemTop = dynamic_cast<const CItem *>(pObjTop);
- + if ( pItemTop && (pItemTop->IsType(IT_SHIP_HOLD) || pItemTop->IsType(IT_SHIP_HOLD_LOCK)) && (pItemTop->GetTopPoint().GetRegion(REGION_TYPE_MULTI) == m_pChar->GetTopPoint().GetRegion(REGION_TYPE_MULTI)) )
- + {
- + isInOpenedContainer = true;
- + }
- + else if ( ptOpenedContainerPosition.GetDist( pObjTop->GetTopPoint() ) <= 3 )
- + {
- + isInOpenedContainer = true;
- + }
- }
- }
- }
- @@ -1449,10 +1455,23 @@
- continue;
- CItemContainer * pCont = dynamic_cast <CItemContainer *>( pItemCont );
- ASSERT(pCont);
- + if (IsTrigUsed(TRIGGER_DROPON_TRADE))
- + {
- + CScriptTriggerArgs Args1( pChar );
- + if ( pItem->OnTrigger( ITRIG_DROPON_TRADE, this , &Args1 ) == TRIGRET_RET_TRUE ) //m_pChar, &Args1
- + return( false );
- + }
- pCont->ContentAdd( pItem );
- return( true );
- }
- -
- + if (IsTrigUsed(TRIGGER_TRADECREATE))
- + {
- + CScriptTriggerArgs Args( pItem );
- + if ( (m_pChar->OnTrigger(CTRIG_TradeCreate, pChar, &Args) == TRIGRET_RET_TRUE ) || (pChar->OnTrigger(CTRIG_TradeCreate, m_pChar, &Args) == TRIGRET_RET_TRUE ) )
- + {
- + return ( false );
- + }
- + }
- // Open a new one.
- CItem* pItem1 = CItem::CreateBase( ITEMID_Bulletin1 );
- if ( !pItem1 )
- @@ -1463,7 +1482,7 @@
- {
- DEBUG_ERR(("Item 0%x must be a container type to enable player trading.\n", ITEMID_Bulletin1));
- pItem1->Delete();
- - return( false );
- + return( false );
- }
- pCont1->SetType( IT_EQ_TRADE_WINDOW );
- @@ -1492,6 +1511,16 @@
- pChar->GetClient()->LogOpenedContainer(pCont1);
- CPointMap pt( 30, 30, 9 );
- + if (IsTrigUsed(TRIGGER_DROPON_TRADE))
- + {
- + CScriptTriggerArgs Args1( pChar );
- + if ( pItem->OnTrigger( ITRIG_DROPON_TRADE, this , &Args1 ) == TRIGRET_RET_TRUE ) //m_pChar, &Args1
- + {
- + pCont1->Delete();
- + pCont2->Delete();
- + return( false );
- + }
- + }
- pCont1->ContentAdd( pItem, pt );
- return( true );
- }
- Index: 0.56.b/graysvr/CContain.cpp
- ===================================================================
- --- 0.56.b/graysvr/CContain.cpp (revision 1758)
- +++ 0.56.b/graysvr/CContain.cpp (working copy)
- @@ -706,6 +706,14 @@
- CChar * pChar = dynamic_cast <CChar*> (GetParent());
- if ( pChar == NULL )
- return;
- +
- + pChar->SysMessagef("TradeClose");
- + if ( IsTrigUsed(TRIGGER_TRADECLOSE) )
- + {
- + CChar * pChar2 = dynamic_cast <CChar*> (GetParent());
- + CScriptTriggerArgs Args( pChar2 );
- + pChar->OnTrigger( CTRIG_TradeClose, pChar , &Args );
- + }
- if ( pChar->IsClient())
- {
- @@ -714,7 +722,7 @@
- cmd.prepareClose(this);
- cmd.send(pChar->GetClient());
- }
- -
- +
- // Drop items back in my pack.
- CItem * pItemNext;
- for ( CItem* pItem = GetContentHead(); pItem!=NULL; pItem=pItemNext)
- @@ -722,7 +730,7 @@
- pItemNext = pItem->GetNext();
- pChar->ItemBounce( pItem );
- }
- -
- +
- // Kill my trading partner.
- CItemContainer * pPartner = dynamic_cast <CItemContainer *> ( m_uidLink.ItemFind());
- if ( pPartner == NULL )
- Index: 0.56.b/graysvr/CItem.cpp
- ===================================================================
- --- 0.56.b/graysvr/CItem.cpp (revision 1758)
- +++ 0.56.b/graysvr/CItem.cpp (working copy)
- @@ -32,6 +32,7 @@
- "@DropOn_Ground", // I have been dropped on the ground here
- "@DropOn_Item", // I have been dropped on this item
- "@DropOn_Self", // An item has been dropped here
- + "@DropOn_Trade",
- "@EQUIP", // I have been unequipped
- "@EQUIPTEST",
- "@PICKUP_GROUND", // I was picked up off the ground.
- Index: 0.56.b/graysvr/CObjBase.h
- ===================================================================
- --- 0.56.b/graysvr/CObjBase.h (revision 1758)
- +++ 0.56.b/graysvr/CObjBase.h (working copy)
- @@ -318,6 +318,7 @@
- ITRIG_DROPON_GROUND, // I have been dropped on the ground here
- ITRIG_DROPON_ITEM, // An item has been
- ITRIG_DROPON_SELF, // An item has been dropped upon me
- + ITRIG_DROPON_TRADE, // Droping an item in a trade window
- ITRIG_EQUIP, // I have been equipped.
- ITRIG_EQUIPTEST,
- ITRIG_PICKUP_GROUND,
- @@ -2325,6 +2326,7 @@
- CTRIG_itemDROPON_GROUND, // I dropped an item on the ground
- CTRIG_itemDROPON_ITEM, // I have been dropped on this item
- CTRIG_itemDROPON_SELF, // I have been dropped on this item
- + CTRIG_itemDROPON_TRADE,
- CTRIG_itemEQUIP, // I have equipped an item
- CTRIG_itemEQUIPTEST,
- CTRIG_itemPICKUP_GROUND,
- @@ -2413,6 +2415,8 @@
- CTRIG_StepStealth, //+Made a step while being in stealth mode
- CTRIG_ToolTip, // someone did tool tips on me.
- CTRIG_TradeAccepted, // Everything went well, and we are about to exchange trade items
- + CTRIG_TradeClose, // Fired when a Trade Window is being deleted, no returns
- + CTRIG_TradeCreate, // Trade window is going to be created
- // Packet related triggers
- CTRIG_UserBugReport,
- Index: 0.56.b/graysvr/CResource.cpp
- ===================================================================
- --- 0.56.b/graysvr/CResource.cpp (revision 1758)
- +++ 0.56.b/graysvr/CResource.cpp (working copy)
- @@ -81,6 +81,7 @@
- m_iBankWMax = 400 * WEIGHT_UNITS;
- m_fGuardsInstantKill = true;
- m_iSnoopCriminal = 500;
- + m_iTradeWindowSnooping = true;
- m_iTrainSkillPercent = 50;
- m_iTrainSkillMax = 500;
- m_fDeadCannotSeeLiving = 0;
- @@ -551,6 +552,7 @@
- RC_TIMEUP,
- RC_TOOLTIPCACHE, // m_iTooltipCache
- RC_TOOLTIPMODE, // m_iTooltipMode
- + RC_TRADEWINDOWSNOOPING, // m_iTradeWindowSnooping
- RC_UOGSTATUS, // m_fUOGStatus
- RC_USEASYNCNETWORK, // m_fUseAsyncNetwork
- RC_USEAUTHID, // m_fUseAuthID
- @@ -771,6 +773,7 @@
- { "TIMEUP", { ELEM_VOID, 0, 0 }},
- { "TOOLTIPCACHE", { ELEM_INT, OFFSETOF(CResource,m_iTooltipCache), 0 }},
- { "TOOLTIPMODE", { ELEM_INT, OFFSETOF(CResource,m_iTooltipMode), 0 }},
- + { "TRADEWINDOWSNOOPING", { ELEM_BOOL, OFFSETOF(CResource,m_iTradeWindowSnooping), 0 }},
- { "UOGSTATUS", { ELEM_BOOL, OFFSETOF(CResource,m_fUOGStatus), 0 }},
- { "USEASYNCNETWORK", { ELEM_INT, OFFSETOF(CResource,m_fUseAsyncNetwork), 0 }},
- { "USEAUTHID", { ELEM_BOOL, OFFSETOF(CResource,m_fUseAuthID), 0 }}, // we use authid like osi
- Index: 0.56.b/graysvr/CResource.h
- ===================================================================
- --- 0.56.b/graysvr/CResource.h (revision 1758)
- +++ 0.56.b/graysvr/CResource.h (working copy)
- @@ -807,6 +807,7 @@
- bool m_fGuardsInstantKill; // Will guards kill instantly or follow normal combat rules?
- int m_iGuardLingerTime; // How long do guards linger about.
- int m_iSnoopCriminal; // 1 in # chance of getting criminalflagged when succesfully snooping.
- + bool m_iTradeWindowSnooping;// 1 means opening a container in trade window needs to use snooping, 0 direct open.
- int m_iMurderMinCount; // amount of murders before we get title.
- int m_iMurderDecayTime; // (minutes) Roll murder counts off this often.
- bool m_fHelpingCriminalsIsACrime;// If I help (rez, heal, etc) a criminal, do I become one too?
- Index: 0.56.b/Sphere.ini
- ===================================================================
- --- 0.56.b/Sphere.ini (revision 1758)
- +++ 0.56.b/Sphere.ini (working copy)
- @@ -443,6 +443,9 @@
- // Times a player can snoop before becoming a criminal
- SnoopCriminal=20
- +// Set if opening a container in a trade window needs to be open using Snooping skill or not (1=true,0=false)
- +TradeWindowSnooping=1
- +
- // Seconds time to decay a murder count (default 8*60*60 is 8 hours)
- MurderDecayTime=8*60*60
- Index: 0.56.b/tables/CChar_props.tbl
- ===================================================================
- --- 0.56.b/tables/CChar_props.tbl (revision 1758)
- +++ 0.56.b/tables/CChar_props.tbl (working copy)
- @@ -80,6 +80,7 @@
- ADD(LUCK, "LUCK")
- ADD(MANA, "MANA")
- ADD(MAXFOLLOWER, "MAXFOLLOWER")
- +ADD(MAXFOOD, "MAXFOOD")
- ADD(MAXHITS, "MAXHITS")
- ADD(MAXMANA, "MAXMANA")
- ADD(MAXSTAM, "MAXSTAM")
- Index: 0.56.b/tables/triggers.tbl
- ===================================================================
- --- 0.56.b/tables/triggers.tbl (revision 1758)
- +++ 0.56.b/tables/triggers.tbl (working copy)
- @@ -32,6 +32,7 @@
- ADD(DROPON_GROUND, "@DropOn_Ground")
- ADD(DROPON_ITEM, "@DropOn_Item")
- ADD(DROPON_SELF, "@DropOn_Self")
- +ADD(DROPON_TRADE, "@DropOn_Trade")
- ADD(EFFECT, "@EFFECT")
- ADD(ENTER, "@Enter")
- ADD(ENVIRONCHANGE, "@EnvironChange")
- @@ -64,6 +65,7 @@
- ADD(ITEMDROPON_GROUND, "@itemDropOn_Ground")
- ADD(ITEMDROPON_ITEM, "@itemDropOn_Item")
- ADD(ITEMDROPON_SELF, "@itemDropOn_Self")
- +ADD(ITEMDROPON_TRADE, "@itemDropOn_Trade")
- ADD(ITEMEQUIP, "@itemEQUIP")
- ADD(ITEMEQUIPTEST, "@itemEQUIPTEST")
- ADD(ITEMFIRE, "@itemFIRE")
- @@ -161,6 +163,8 @@
- ADD(TIMER, "@Timer")
- ADD(TOOLTIP, "@ToolTip")
- ADD(TRADEACCEPTED, "@TradeAccepted")
- +ADD(TRADECLOSE, "@TradeClose")
- +ADD(TRADECREATE, "@TradeCreate")
- ADD(UNEQUIP, "@UnEquip")
- ADD(USEQUICK, "@UseQuick")
- ADD(USERBUGREPORT, "@UserBugReport")
Advertisement
Add Comment
Please, Sign In to add comment