nefthon

Untitled

Jan 9th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 14.03 KB | None | 0 0
  1. Index: 0.56.b/graysvr/CChar.cpp
  2. ===================================================================
  3. --- 0.56.b/graysvr/CChar.cpp    (revision 1758)
  4. +++ 0.56.b/graysvr/CChar.cpp    (working copy)
  5. @@ -64,6 +64,7 @@
  6.     "@itemDropOn_Ground",   // I dropped an item on the ground
  7.     "@itemDropOn_Item",     // I have been dropped on this item
  8.     "@itemDropOn_Self",     // An item has been dropped on
  9. +   "@ItemDropOn_Trade",
  10.     "@itemEQUIP",           // I have equipped an item
  11.     "@itemEQUIPTEST",
  12.     "@itemPICKUP_GROUND",
  13. @@ -151,6 +152,8 @@
  14.     "@StepStealth",     //+Made a step in stealth mode
  15.     "@ToolTip",         // someone did tool tips on me.
  16.     "@TradeAccepted",   // Everything went well, and we are about to exchange trade items
  17. +   "@TradeClose",
  18. +   "@TradeCreate",
  19.  
  20.     "@UserBugReport",
  21.     "@UserChatButton",
  22. @@ -306,7 +309,7 @@
  23.  {
  24.     ADDTOCALLSTACK("CChar::ClientDetach");
  25.     // Client is detaching from this CChar.
  26. -
  27. +  
  28.     // remove all trade windows.
  29.     for ( CItem *pItem = GetContentHead(); pItem ; )
  30.     {
  31. @@ -315,7 +318,6 @@
  32.             pItem->Delete();
  33.         pItem = pItemNext;
  34.     }
  35. -
  36.     if ( !IsClient() )
  37.         return;
  38.  
  39. @@ -2036,6 +2038,9 @@
  40.         case CHC_MANA:
  41.             sVal.FormatVal( Stat_GetVal(STAT_INT) );
  42.             break;
  43. +       case CHC_MAXFOOD:
  44. +           sVal.FormatVal( Stat_GetMax( STAT_FOOD ) );
  45. +           break;
  46.         case CHC_MAXHITS:
  47.             sVal.FormatVal( Stat_GetMax(STAT_STR) );
  48.             break;
  49. @@ -2242,6 +2247,9 @@
  50.                 SetDefStr(s.GetKey(), s.GetArgStr( &fQuoted ), fQuoted);
  51.             }
  52.             break;
  53. +       case CHC_MAXFOOD:
  54. +           Stat_SetMax(STAT_FOOD, s.GetArgVal());
  55. +           break;
  56.         case CHC_MAXHITS:
  57.             Stat_SetMax(STAT_STR, s.HasArgs() ? s.GetArgVal() : 0 );
  58.             break;
  59. Index: 0.56.b/graysvr/CCharFight.cpp
  60. ===================================================================
  61. --- 0.56.b/graysvr/CCharFight.cpp   (revision 1758)
  62. +++ 0.56.b/graysvr/CCharFight.cpp   (working copy)
  63. @@ -1179,6 +1179,11 @@
  64.         return( true );
  65.  
  66.     ASSERT( pItem->IsItem());
  67. +   ASSERT( pItem->GetContainer() );
  68. +   CItem * pCItem = static_cast <CItem *> (pItem->GetContainer());
  69. +   ASSERT( pCItem );
  70. +   if ( pCItem->IsType(IT_EQ_TRADE_WINDOW)  && g_Cfg.m_iTradeWindowSnooping == false )
  71. +       return( false );
  72.  
  73.     if ( ! IsPriv(PRIV_GM))
  74.     switch ( pItem->GetType())
  75. Index: 0.56.b/graysvr/CClientUse.cpp
  76. ===================================================================
  77. --- 0.56.b/graysvr/CClientUse.cpp   (revision 1758)
  78. +++ 0.56.b/graysvr/CClientUse.cpp   (working copy)
  79. @@ -40,37 +40,43 @@
  80.             {
  81.                 // protect from ,snoop - disallow picking from not opened containers
  82.                 bool isInOpenedContainer = false;
  83. -               CClient::OpenedContainerMap_t::iterator itContainerFound = m_openedContainers.find( container->GetUID().GetPrivateUID() );
  84. -               if ( itContainerFound != m_openedContainers.end() )
  85. +               IT_TYPE type = container->GetType();
  86. +               if ( type == IT_EQ_TRADE_WINDOW)
  87.                 {
  88. -                   DWORD dwTopContainerUID = (((*itContainerFound).second).first).first;
  89. -                   DWORD dwTopMostContainerUID = (((*itContainerFound).second).first).second;
  90. -                   CPointMap ptOpenedContainerPosition = ((*itContainerFound).second).second;
  91. -                   const CObjBaseTemplate * pObjTop = pItem->GetTopLevelObj();
  92. +                   isInOpenedContainer = true;
  93. +               } else {
  94. +                   CClient::OpenedContainerMap_t::iterator itContainerFound = m_openedContainers.find( container->GetUID().GetPrivateUID() );
  95. +                   if ( itContainerFound != m_openedContainers.end() )
  96. +                   {
  97. +                       DWORD dwTopContainerUID = (((*itContainerFound).second).first).first;
  98. +                       DWORD dwTopMostContainerUID = (((*itContainerFound).second).first).second;
  99. +                       CPointMap ptOpenedContainerPosition = ((*itContainerFound).second).second;
  100. +                       const CObjBaseTemplate * pObjTop = pItem->GetTopLevelObj();
  101.                    
  102. -                   DWORD dwTopContainerUID_ToCheck = 0;
  103. -                   if ( container->GetContainer() )
  104. -                       dwTopContainerUID_ToCheck = container->GetContainer()->GetUID().GetPrivateUID();
  105. -                   else
  106. -                       dwTopContainerUID_ToCheck = pObjTop->GetUID().GetPrivateUID();
  107. +                       DWORD dwTopContainerUID_ToCheck = 0;
  108. +                       if ( container->GetContainer() )
  109. +                           dwTopContainerUID_ToCheck = container->GetContainer()->GetUID().GetPrivateUID();
  110. +                       else
  111. +                           dwTopContainerUID_ToCheck = pObjTop->GetUID().GetPrivateUID();
  112.  
  113. -                   if ( ( dwTopMostContainerUID == pObjTop->GetUID().GetPrivateUID() ) && ( dwTopContainerUID == dwTopContainerUID_ToCheck ) )
  114. -                   {
  115. -                       if ( pObjTop->IsChar() )
  116. +                       if ( ( dwTopMostContainerUID == pObjTop->GetUID().GetPrivateUID() ) && ( dwTopContainerUID == dwTopContainerUID_ToCheck ) )
  117.                         {
  118. -                           isInOpenedContainer = true;
  119. -                           // probably a pickup check from pack if pCharTop != this?
  120. -                       }
  121. -                       else
  122. -                       {
  123. -                           const CItem * pItemTop = dynamic_cast<const CItem *>(pObjTop);
  124. -                           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)) )
  125. +                           if ( pObjTop->IsChar() )
  126.                             {
  127.                                 isInOpenedContainer = true;
  128. +                               // probably a pickup check from pack if pCharTop != this?
  129.                             }
  130. -                           else if ( ptOpenedContainerPosition.GetDist( pObjTop->GetTopPoint() ) <= 3 )
  131. +                           else
  132.                             {
  133. -                               isInOpenedContainer = true;
  134. +                               const CItem * pItemTop = dynamic_cast<const CItem *>(pObjTop);
  135. +                               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)) )
  136. +                               {
  137. +                                   isInOpenedContainer = true;
  138. +                               }
  139. +                               else if ( ptOpenedContainerPosition.GetDist( pObjTop->GetTopPoint() ) <= 3 )
  140. +                               {
  141. +                                   isInOpenedContainer = true;
  142. +                               }
  143.                             }
  144.                         }
  145.                     }
  146. @@ -1449,10 +1455,23 @@
  147.             continue;
  148.         CItemContainer * pCont = dynamic_cast <CItemContainer *>( pItemCont );
  149.         ASSERT(pCont);
  150. +       if (IsTrigUsed(TRIGGER_DROPON_TRADE))
  151. +       {
  152. +           CScriptTriggerArgs Args1( pChar );
  153. +           if ( pItem->OnTrigger( ITRIG_DROPON_TRADE, this , &Args1 ) == TRIGRET_RET_TRUE ) //m_pChar, &Args1
  154. +               return( false );
  155. +       }
  156.         pCont->ContentAdd( pItem );
  157.         return( true );
  158.     }
  159. -
  160. +   if (IsTrigUsed(TRIGGER_TRADECREATE))
  161. +   {
  162. +       CScriptTriggerArgs Args( pItem );
  163. +       if ( (m_pChar->OnTrigger(CTRIG_TradeCreate, pChar, &Args) == TRIGRET_RET_TRUE ) || (pChar->OnTrigger(CTRIG_TradeCreate, m_pChar, &Args) == TRIGRET_RET_TRUE ) )
  164. +       {
  165. +           return ( false );
  166. +       }
  167. +   }
  168.     // Open a new one.
  169.     CItem* pItem1 = CItem::CreateBase( ITEMID_Bulletin1 );
  170.     if ( !pItem1 )
  171. @@ -1463,7 +1482,7 @@
  172.     {
  173.         DEBUG_ERR(("Item 0%x must be a container type to enable player trading.\n", ITEMID_Bulletin1));
  174.         pItem1->Delete();
  175. -       return( false );
  176. +       return( false );
  177.     }
  178.  
  179.     pCont1->SetType( IT_EQ_TRADE_WINDOW );
  180. @@ -1492,6 +1511,16 @@
  181.     pChar->GetClient()->LogOpenedContainer(pCont1);
  182.  
  183.     CPointMap pt( 30, 30, 9 );
  184. +   if (IsTrigUsed(TRIGGER_DROPON_TRADE))
  185. +   {
  186. +       CScriptTriggerArgs Args1( pChar );
  187. +       if ( pItem->OnTrigger( ITRIG_DROPON_TRADE, this , &Args1 ) == TRIGRET_RET_TRUE ) //m_pChar, &Args1
  188. +       {
  189. +           pCont1->Delete();
  190. +           pCont2->Delete();
  191. +           return( false );
  192. +       }
  193. +   }
  194.     pCont1->ContentAdd( pItem, pt );
  195.     return( true );
  196.  }
  197. Index: 0.56.b/graysvr/CContain.cpp
  198. ===================================================================
  199. --- 0.56.b/graysvr/CContain.cpp (revision 1758)
  200. +++ 0.56.b/graysvr/CContain.cpp (working copy)
  201. @@ -706,6 +706,14 @@
  202.     CChar * pChar = dynamic_cast <CChar*> (GetParent());
  203.     if ( pChar == NULL )
  204.         return;
  205. +  
  206. +   pChar->SysMessagef("TradeClose");
  207. +   if ( IsTrigUsed(TRIGGER_TRADECLOSE) )
  208. +   {
  209. +       CChar * pChar2 = dynamic_cast <CChar*> (GetParent());
  210. +       CScriptTriggerArgs Args( pChar2 );
  211. +       pChar->OnTrigger( CTRIG_TradeClose,  pChar , &Args );
  212. +   }
  213.  
  214.     if ( pChar->IsClient())
  215.     {
  216. @@ -714,7 +722,7 @@
  217.         cmd.prepareClose(this);
  218.         cmd.send(pChar->GetClient());
  219.     }
  220. -
  221. +  
  222.     // Drop items back in my pack.
  223.     CItem * pItemNext;
  224.     for ( CItem* pItem = GetContentHead(); pItem!=NULL; pItem=pItemNext)
  225. @@ -722,7 +730,7 @@
  226.         pItemNext = pItem->GetNext();
  227.         pChar->ItemBounce( pItem );
  228.     }
  229. -
  230. +  
  231.     // Kill my trading partner.
  232.     CItemContainer * pPartner = dynamic_cast <CItemContainer *> ( m_uidLink.ItemFind());
  233.     if ( pPartner == NULL )
  234. Index: 0.56.b/graysvr/CItem.cpp
  235. ===================================================================
  236. --- 0.56.b/graysvr/CItem.cpp    (revision 1758)
  237. +++ 0.56.b/graysvr/CItem.cpp    (working copy)
  238. @@ -32,6 +32,7 @@
  239.     "@DropOn_Ground",       // I have been dropped on the ground here
  240.     "@DropOn_Item",         // I have been dropped on this item
  241.     "@DropOn_Self",         // An item has been dropped here
  242. +   "@DropOn_Trade",
  243.     "@EQUIP",       // I have been unequipped
  244.      "@EQUIPTEST",
  245.     "@PICKUP_GROUND",   // I was picked up off the ground.
  246. Index: 0.56.b/graysvr/CObjBase.h
  247. ===================================================================
  248. --- 0.56.b/graysvr/CObjBase.h   (revision 1758)
  249. +++ 0.56.b/graysvr/CObjBase.h   (working copy)
  250. @@ -318,6 +318,7 @@
  251.     ITRIG_DROPON_GROUND,        // I have been dropped on the ground here
  252.     ITRIG_DROPON_ITEM,      // An item has been
  253.     ITRIG_DROPON_SELF,      // An item has been dropped upon me
  254. +   ITRIG_DROPON_TRADE,     // Droping an item in a trade window
  255.     ITRIG_EQUIP,        // I have been equipped.
  256.     ITRIG_EQUIPTEST,
  257.     ITRIG_PICKUP_GROUND,
  258. @@ -2325,6 +2326,7 @@
  259.     CTRIG_itemDROPON_GROUND,    // I dropped an item on the ground
  260.     CTRIG_itemDROPON_ITEM,      // I have been dropped on this item
  261.     CTRIG_itemDROPON_SELF,      // I have been dropped on this item
  262. +   CTRIG_itemDROPON_TRADE,
  263.     CTRIG_itemEQUIP,        // I have equipped an item
  264.     CTRIG_itemEQUIPTEST,
  265.     CTRIG_itemPICKUP_GROUND,
  266. @@ -2413,6 +2415,8 @@
  267.     CTRIG_StepStealth,      //+Made a step while being in stealth mode
  268.     CTRIG_ToolTip,          // someone did tool tips on me.
  269.     CTRIG_TradeAccepted,    // Everything went well, and we are about to exchange trade items
  270. +   CTRIG_TradeClose,       // Fired when a Trade Window is being deleted, no returns
  271. +   CTRIG_TradeCreate,      // Trade window is going to be created
  272.  
  273.     // Packet related triggers
  274.     CTRIG_UserBugReport,
  275. Index: 0.56.b/graysvr/CResource.cpp
  276. ===================================================================
  277. --- 0.56.b/graysvr/CResource.cpp    (revision 1758)
  278. +++ 0.56.b/graysvr/CResource.cpp    (working copy)
  279. @@ -81,6 +81,7 @@
  280.     m_iBankWMax     = 400 * WEIGHT_UNITS;
  281.     m_fGuardsInstantKill    = true;
  282.     m_iSnoopCriminal    = 500;
  283. +   m_iTradeWindowSnooping = true;
  284.     m_iTrainSkillPercent    = 50;
  285.     m_iTrainSkillMax    = 500;
  286.     m_fDeadCannotSeeLiving = 0;
  287. @@ -551,6 +552,7 @@
  288.     RC_TIMEUP,
  289.     RC_TOOLTIPCACHE,            // m_iTooltipCache
  290.     RC_TOOLTIPMODE,             // m_iTooltipMode
  291. +   RC_TRADEWINDOWSNOOPING,     // m_iTradeWindowSnooping
  292.     RC_UOGSTATUS,               // m_fUOGStatus
  293.     RC_USEASYNCNETWORK,         // m_fUseAsyncNetwork
  294.     RC_USEAUTHID,               // m_fUseAuthID
  295. @@ -771,6 +773,7 @@
  296.     { "TIMEUP",                 { ELEM_VOID,    0,                                          0 }},
  297.     { "TOOLTIPCACHE",           { ELEM_INT,     OFFSETOF(CResource,m_iTooltipCache),        0 }},
  298.     { "TOOLTIPMODE",            { ELEM_INT,     OFFSETOF(CResource,m_iTooltipMode),         0 }},
  299. +   { "TRADEWINDOWSNOOPING",    { ELEM_BOOL,    OFFSETOF(CResource,m_iTradeWindowSnooping), 0 }},
  300.     { "UOGSTATUS",              { ELEM_BOOL,    OFFSETOF(CResource,m_fUOGStatus),           0 }},
  301.     { "USEASYNCNETWORK",        { ELEM_INT,     OFFSETOF(CResource,m_fUseAsyncNetwork),     0 }},
  302.     { "USEAUTHID",              { ELEM_BOOL,    OFFSETOF(CResource,m_fUseAuthID),           0 }},   // we use authid like osi
  303. Index: 0.56.b/graysvr/CResource.h
  304. ===================================================================
  305. --- 0.56.b/graysvr/CResource.h  (revision 1758)
  306. +++ 0.56.b/graysvr/CResource.h  (working copy)
  307. @@ -807,6 +807,7 @@
  308.     bool m_fGuardsInstantKill;  // Will guards kill instantly or follow normal combat rules?
  309.     int  m_iGuardLingerTime;    // How long do guards linger about.
  310.     int  m_iSnoopCriminal;      // 1 in # chance of getting criminalflagged when succesfully snooping.
  311. +   bool m_iTradeWindowSnooping;// 1 means opening a container in trade window needs to use snooping, 0 direct open.
  312.     int  m_iMurderMinCount;     // amount of murders before we get title.
  313.     int  m_iMurderDecayTime;    // (minutes) Roll murder counts off this often.
  314.     bool m_fHelpingCriminalsIsACrime;// If I help (rez, heal, etc) a criminal, do I become one too?
  315. Index: 0.56.b/Sphere.ini
  316. ===================================================================
  317. --- 0.56.b/Sphere.ini   (revision 1758)
  318. +++ 0.56.b/Sphere.ini   (working copy)
  319. @@ -443,6 +443,9 @@
  320.  // Times a player can snoop before becoming a criminal
  321.  SnoopCriminal=20
  322.  
  323. +// Set if opening a container in a trade window needs to be open using Snooping skill or not (1=true,0=false)
  324. +TradeWindowSnooping=1
  325. +
  326.  // Seconds time to decay a murder count (default 8*60*60 is 8 hours)
  327.  MurderDecayTime=8*60*60
  328.  
  329. Index: 0.56.b/tables/CChar_props.tbl
  330. ===================================================================
  331. --- 0.56.b/tables/CChar_props.tbl   (revision 1758)
  332. +++ 0.56.b/tables/CChar_props.tbl   (working copy)
  333. @@ -80,6 +80,7 @@
  334.  ADD(LUCK,                  "LUCK")
  335.  ADD(MANA,                  "MANA")
  336.  ADD(MAXFOLLOWER,           "MAXFOLLOWER")
  337. +ADD(MAXFOOD,               "MAXFOOD")
  338.  ADD(MAXHITS,               "MAXHITS")
  339.  ADD(MAXMANA,               "MAXMANA")
  340.  ADD(MAXSTAM,               "MAXSTAM")
  341. Index: 0.56.b/tables/triggers.tbl
  342. ===================================================================
  343. --- 0.56.b/tables/triggers.tbl  (revision 1758)
  344. +++ 0.56.b/tables/triggers.tbl  (working copy)
  345. @@ -32,6 +32,7 @@
  346.  ADD(DROPON_GROUND,         "@DropOn_Ground")
  347.  ADD(DROPON_ITEM,           "@DropOn_Item")
  348.  ADD(DROPON_SELF,           "@DropOn_Self")
  349. +ADD(DROPON_TRADE,          "@DropOn_Trade")
  350.  ADD(EFFECT,                    "@EFFECT")
  351.  ADD(ENTER,                 "@Enter")
  352.  ADD(ENVIRONCHANGE,         "@EnvironChange")
  353. @@ -64,6 +65,7 @@
  354.  ADD(ITEMDROPON_GROUND,     "@itemDropOn_Ground")
  355.  ADD(ITEMDROPON_ITEM,       "@itemDropOn_Item")
  356.  ADD(ITEMDROPON_SELF,       "@itemDropOn_Self")
  357. +ADD(ITEMDROPON_TRADE,      "@itemDropOn_Trade")
  358.  ADD(ITEMEQUIP,             "@itemEQUIP")
  359.  ADD(ITEMEQUIPTEST,         "@itemEQUIPTEST")
  360.  ADD(ITEMFIRE,              "@itemFIRE")
  361. @@ -161,6 +163,8 @@
  362.  ADD(TIMER,                 "@Timer")
  363.  ADD(TOOLTIP,               "@ToolTip")
  364.  ADD(TRADEACCEPTED,         "@TradeAccepted")
  365. +ADD(TRADECLOSE,                "@TradeClose")
  366. +ADD(TRADECREATE,           "@TradeCreate")
  367.  ADD(UNEQUIP,               "@UnEquip")
  368.  ADD(USEQUICK,              "@UseQuick")
  369.  ADD(USERBUGREPORT,         "@UserBugReport")
Advertisement
Add Comment
Please, Sign In to add comment