コード例 #1
0
ファイル: SBTracker.cpp プロジェクト: leappx/FCBondage
void FCBondage::SBTracker::PrintInfoToConsole(unsigned __int16 itemID, float SB)
{
	// Same process as above.
	auto itemName = GetItemName(itemID);
	if (itemName.empty())
	{
		Sleep(500);
		itemName = GetItemName(itemID);
	}
	std::cout << ++pcount <<". Item: ~" << (!itemName.empty() ? itemName : "Item Not Found") << "~ || New SB: " << (!RawView ? SB : SB*100.0f) << (!RawView ? " %" : "") << "\n";
}
コード例 #2
0
ファイル: SBTracker.cpp プロジェクト: leappx/FCBondage
void FCBondage::SBTracker::PrintInfoToChat(unsigned __int16 itemID, float SB)
{
	// Attempt to retrieve an info structure of the given item.
	auto itemName = GetItemName(itemID);
	if (itemName.empty())
	{
		// Most likely a new item. Wait for transfer to complete.
		Sleep(500);
		itemName = GetItemName(itemID);
	}
	std::stringstream ss;
	ss << "/echo ~" << (!itemName.empty() ? itemName : "Item Not Found") << "~ || SB: " << (!RawView ? SB : SB*100.0f) << (!RawView ? " %" : "");
	SendCommand(ss.str().c_str());
}
コード例 #3
0
HRESULT CNktDvDbObjectNoRef::BuilldFunctionChildDefStr(__inout CNktStringW &cStrDeclW, __in SIZE_T nIndex)
{
  CNktDvDbObjectNoRef *lpChildDbObj;
  HRESULT hRes;

  cStrDeclW.Empty();
  if (nIndex == nChildsCount-1)
  {
    //result
    lpChildDbObj = GetFunctionReturn();
    hRes = BuildArgumentStr(cStrDeclW, lpChildDbObj);
    if (FAILED(hRes))
      return hRes;
  }
  else {
    lpChildDbObj = GetItem(nIndex);
    hRes = BuildArgumentStr(cStrDeclW, lpChildDbObj);
    if (FAILED(hRes))
      return hRes;
    if (AddItemFlags(cStrDeclW, GetItemFlags(nIndex)) == FALSE ||
        ReplaceX01OrAdd(cStrDeclW, GetItemName(nIndex)) == FALSE)
      return E_OUTOFMEMORY;
  }
  return S_OK;
}
コード例 #4
0
ファイル: xmlplistSerializer.cpp プロジェクト: Olti/mythtv
void XmlPListSerializer::RenderList(const QString &sName,
                                    const QVariantList &list)
{
    bool array = true;
    if (!list.isEmpty())
    {
        QVariant::Type t = list[0].type();
        QListIterator<QVariant> it(list);
        while (it.hasNext())
        {
            if (it.next().type() != t)
            {
                array = false;
                break;
            }
        }
    }

    QString sItemName = GetItemName(sName);
    m_pXmlWriter->writeTextElement("key", sName);
    m_pXmlWriter->writeStartElement(array ? "array" : "dict");

    QListIterator<QVariant> it(list);
    while (it.hasNext())
        RenderValue(sItemName, it.next(), !array);

    m_pXmlWriter->writeEndElement();
}
コード例 #5
0
void __fastcall TfrmMain::LoadTimer(TObject *Sender)
{
	LoadSetting();
	if (FileExists(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat"))
	{
		TStringList *list = new TStringList();
		list->LoadFromFile(String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Items.dat");
		for (int i = 0; i < list->Count; i++)
		{
			unsigned int ItemID;
			ItemID = _wtoi(list->Strings[i].w_str());
			AnsiString name = String(GetItemName(ItemID));
			if (name.IsEmpty())
			{
				name.sprintf(TEXT("未知物品(編號:%d)"), ItemID);
			}
			int index = list_drop->Items->IndexOfObject((TObject *)ItemID);
			if (index > -1)
				list_drop->Items->Delete(index);
			index = list_filter->Items->IndexOfObject((TObject *)ItemID);
			if (index < 0)
				list_filter->Items->AddObject(name, (TObject *)ItemID);
		}

		delete list;
	}
	Load->Enabled = false;

}
コード例 #6
0
//---------------------------------------------------------------------------
unsigned int __fastcall TfrmMain::CheckItem(bool isMoney ,unsigned long ItemID)
{
		if( isMoney )
		{
            return ItemID;
        }
		if (list_filter->Items->IndexOfObject((TObject *)ItemID) > -1)
		{
			return 0; // 物品在過濾清單
		}
		else if (list_drop->Items->IndexOfObject((TObject *)ItemID) > -1)
		{
			return ItemID; // 物品在掉落清單
		}
		else // 物品不在掉落清單
		{
			String name = String(GetItemName(ItemID));
			if (name.IsEmpty())
			{
				name.sprintf(TEXT(L"未知物品(編號:%d)"), ItemID);
			}
			list_drop->Items->AddObject(name, (TObject *)ItemID);
			return ItemID;
		}
}
コード例 #7
0
HRESULT CNktDvDbObjectNoRef::BuilldEnumChildDefStr(__inout CNktStringW &cStrDeclW, __in SIZE_T nIndex)
{
  if (cStrDeclW.Concat(GetItemName(nIndex)) == FALSE ||
      cStrDeclW.Concat(L"=") == FALSE ||
      cStrDeclW.Concat(GetItemEnumValue(nIndex)) == FALSE)
    return E_OUTOFMEMORY;
  return S_OK;
}
コード例 #8
0
ファイル: Items.c プロジェクト: unwiredben/ColorDungeon
void ShowAllItemCounts(void)
{
	int i;
	ShowMainWindowRow(0, "Items", "");
	for(i = 0; i < ITEM_TYPE_COUNT; ++i)
	{
		ShowMainWindowRow(i + 1, GetItemName(i), UpdateItemCountText(i));
	}
}
コード例 #9
0
ファイル: PanelSelect.cpp プロジェクト: ismail/7-zip
void CPanel::SelectSpec(bool selectMode)
{
  CComboDialog dlg;
  LangString(selectMode ? IDS_SELECT : IDS_DESELECT, dlg.Title );
  LangString(IDS_SELECT_MASK, dlg.Static);
  dlg.Value = L'*';
  if (dlg.Create(GetParent()) != IDOK)
    return;
  const UString &mask = dlg.Value;
  FOR_VECTOR (i, _selectedStatusVector)
    if (DoesWildcardMatchName(mask, GetItemName(i)))
       _selectedStatusVector[i] = selectMode;
  UpdateSelection();
}
コード例 #10
0
ファイル: xmlplistSerializer.cpp プロジェクト: Olti/mythtv
void XmlPListSerializer::RenderMap(const QString &sName,
                                   const QVariantMap &map)
{
    QString sItemName = GetItemName(sName);
    m_pXmlWriter->writeTextElement("key", sItemName);
    m_pXmlWriter->writeStartElement("dict");

    QMapIterator<QString,QVariant> it(map);
    while (it.hasNext())
    {
        it.next();
        RenderValue(it.key(), it.value());
    }

    m_pXmlWriter->writeEndElement();
}
コード例 #11
0
ファイル: PanelSelect.cpp プロジェクト: ismail/7-zip
void CPanel::SelectByType(bool selectMode)
{
  int focusedItem = _listView.GetFocusedItem();
  if (focusedItem < 0)
    return;
  int realIndex = GetRealItemIndex(focusedItem);
  UString name = GetItemName(realIndex);
  bool isItemFolder = IsItem_Folder(realIndex);

  if (isItemFolder)
  {
    FOR_VECTOR (i, _selectedStatusVector)
      if (IsItem_Folder(i) == isItemFolder)
        _selectedStatusVector[i] = selectMode;
  }
  else
  {
コード例 #12
0
HRESULT CNktDvDbObjectNoRef::BuilldStructChildDefStr(__inout CNktStringW &cStrDeclW, __in SIZE_T nIndex)
{
  CNktStringW cStrTempW;
  CNktDvDbObjectNoRef *lpChildDbObj;
  HRESULT hRes;

  lpChildDbObj = GetItem(nIndex);
  hRes = BuildArgumentStr(cStrTempW, lpChildDbObj);
  if (FAILED(hRes))
    return hRes;
  if (AddItemFlags(cStrTempW, GetItemFlags(nIndex)) == FALSE ||
      ReplaceX01OrAdd(cStrTempW, GetItemName(nIndex)) == FALSE ||
      InsertTabInEachLine(cStrTempW) == FALSE ||
      cStrDeclW.Concat((LPWSTR)cStrTempW) == FALSE)
    return E_OUTOFMEMORY;
  return S_OK;
}
コード例 #13
0
STDMETHODIMP ItemFactory_Processes::GetItemData( int theIndex, MenuSetItemData * theOut )
{
	if (theIndex != 0)
		return E_INVALIDARG;

	HRESULT aRes = GetItemName(theOut, theOut->Name, theOut->NameSize);

	if ( FAILED(aRes) )
		return aRes;

	theOut->Type = MenuSetItemData::ITEM;
	theOut->ObjectID = OBJ_ProcItem;
	theOut->Param = 0;
	theOut->ParamSize = 0;
	theOut->IconIndex = -1;

	return S_OK;
}
コード例 #14
0
ファイル: xmlplistSerializer.cpp プロジェクト: Olti/mythtv
void XmlPListSerializer::SerializePListObjectProperties(const QString &sName,
                                                        const QObject *pObject,
                                                        bool          needKey )
{
    if (!pObject)
        return;

    if (needKey)
    {
        QString sItemName = GetItemName(sName);
        m_pXmlWriter->writeTextElement("key", sItemName);
    }
    m_pXmlWriter->writeStartElement("dict");

    const QMetaObject *pMetaObject = pObject->metaObject();

    int nCount = pMetaObject->propertyCount();

    for (int nIdx=0; nIdx < nCount; ++nIdx)
    {
        QMetaProperty metaProperty = pMetaObject->property(nIdx);

        if (metaProperty.isDesignable(pObject))
        {
            const char *pszPropName = metaProperty.name();
            QString     sPropName(pszPropName);

            if (sPropName.compare("objectName") == 0)
                continue;

            QVariant value(pObject->property(pszPropName));

            AddProperty(sPropName, value, pMetaObject, &metaProperty);
        }
    }

    m_pXmlWriter->writeEndElement();
}
コード例 #15
0
ファイル: a_game.c プロジェクト: darkshade9/aq2-jmod
void ParseSayText(edict_t *ent, char *text)
{
        static unsigned char buf[10240], infobuf[10240];
        char *p, *pbuf;

        p = text;
        pbuf = buf;
        *pbuf = 0;

        while (*p != 0)
        {
                if (((ptrdiff_t)pbuf - (ptrdiff_t)buf) > 300)
                {
                        break;
                }
                if (*p == '%')
                {

					/*
//%A                       %B%C%D   %E%F%G %H %I              %J%K                     %L                      %M%N%O%P%Q%R%S                      %T    %U%V%W         %X%Y%Z
//12 rounds (0 extra clips)%B%CNorth%E%F800100Stealth Slippers%Jsome guy I just fondledon Street below top roof%M%N%O%P%Q%Ron Street below top roofnobody%U%VMK23 Pistol%X%Y%Z 

  
	*/
	  
		
		  switch (*(p+1))
                        {
							/*       
								case 'H':
                                        GetHealth(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
                                case 'A':
                                        GetAmmo(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
							*/
								case 'I':
                                        GetItemName(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
							
                                case 'W':
                                        GetWeaponName(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;

                                case 'T':
                                        GetNearbyTeammates(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
                         
								//case 'N':
                                //        GetIDView(ent, infobuf);
                                //        strcpy(pbuf, infobuf);
                                //        pbuf = SeekBufEnd(pbuf);
                                //        p += 2;
                                //        continue;
								case 'M':
                                        GetMarkerColor(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
								case 'J':
                                        GetJumpModes(ent, infobuf);
                                        strcpy(pbuf, infobuf);
                                        pbuf = SeekBufEnd(pbuf);
                                        p += 2;
                                        continue;
										

case 'P':
sprintf(pbuf, "%d,%d,%d", ent->client->ps.pmove.origin[0]/8,ent->client->ps.pmove.origin[1]/8,ent->client->ps.pmove.origin[2]/8-24);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'D':
sprintf(pbuf,"%d",ent->client->resp.falldmg);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'S':
sprintf(pbuf,"%d",ent->client->ps.stats[STAT_SPEEDX]);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'H':
sprintf(pbuf,"%d",ent->client->resp.highspeed);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'C':
sprintf(pbuf,"%d",ent->client->resp.fallcount);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'L':
sprintf(pbuf,"%d",ent->client->resp.falldmglast);
pbuf = SeekBufEnd(pbuf);p += 2;continue;

case 'G':
sprintf(pbuf,"%d",ent->client->resp.cgravity);//ps.stats[STAT_GRAVITY]);
pbuf = SeekBufEnd(pbuf);p += 2;continue;


/*
%P - Announces your current position on the map		+
%N - Announces the player's name you are looking at	+
%C - Announces your fall Count						+
%D - Announces your falling damage					+
%L - Announces your last falling damage				+
%H - Announces your highspeed						+
%S - Announces your current speed					+
%M - Announces your marker color					+
%T - Announces the names of people near you			+
%W - Announces your current weapon					+
%I - Announces your active items					+
%J - Announces your jump modes						+
%G - Announces your gravity							+
*/
                        }
                }
                *pbuf++ = *p++;
        }

        *pbuf = 0;

        strncpy(text, buf, 300);
        text[300] = 0; // in case it's 300
}
コード例 #16
0
ファイル: Items.c プロジェクト: unwiredben/ColorDungeon
void ItemGainMenuAppear(Window *window)
{
	MenuAppear(window);
	ShowMainWindowRow(0, "Item Gained", "");
	ShowMainWindowRow(1, GetItemName(typeGained), UpdateItemCountText(typeGained));
}
コード例 #17
0
ファイル: a_xgame.c プロジェクト: tomas-edwardsson/aq2tng
void
ParseSayText (edict_t * ent, char *text)
{
  static unsigned char buf[10240], infobuf[10240];
  char *p, *pbuf;

  p = text;
  pbuf = buf;
  *pbuf = 0;

  while (*p != 0)
    {
      if (((ptrdiff_t) pbuf - (ptrdiff_t) buf) > 225)
	{
	  break;
	}

      if (*p == '%')
	{
	  switch (*(p + 1))
	    {
	    case 'H':
	      GetHealth (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'A':
	      GetAmmo (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'W':
	      GetWeaponName (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'I':
	      GetItemName (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'T':
	      GetNearbyTeammates (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'M':
	      GetViewedTeammateName (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'E':
	      GetViewedEnemyName (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'F':
	      GetViewedEnemyWeapon (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'G':
	      GetEnemyPosition (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'K':
	      GetLastKilledTarget (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
//AQ2:TNG Slicer - New Location Code
	      /*
	         case 'L':
	         GetOwnPosition (ent, infobuf);
	         strcpy (pbuf, infobuf);
	         pbuf = SeekBufEnd (pbuf);
	         p += 2;
	         continue;
	         case 'S':
	         GetViewedPosition (ent, infobuf);
	         strcpy (pbuf, infobuf);
	         pbuf = SeekBufEnd (pbuf);
	         p += 2;
	         continue;
	       */
	    case 'S':
	      GetSightedLocation (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	    case 'L':
	      GetPlayerLocation (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	      //AQ2:TNG Slicer Last Damage Location
	    case 'D':
	      GetLastDamagedPart (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	      //AQ2:TNG END
	      //AQ2:TNG Freud Last Player Damaged
	    case 'P':
	      GetLastDamagedPlayers (ent, infobuf);
	      strcpy (pbuf, infobuf);
	      pbuf = SeekBufEnd (pbuf);
	      p += 2;
	      continue;
	      //AQ2:TNG END
	    }
	}
      *pbuf++ = *p++;
    }

  *pbuf = 0;

  strncpy (text, buf, 225);
  text[225] = 0;		// in case it's 225

}
コード例 #18
0
void CGameStateRecorder::OnGameplayEvent(IEntity *pEntity, const GameplayEvent &event)
{
	EntityId id;
	if(!pEntity || !(id = pEntity->GetId()))
	{
		GameWarning("TimeDemo:GameState::OnGamePlayEvent: Entity not found");
		return;
	}
	CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(id));
	if(!pActor)
	{
		GameWarning("TimeDemo:GameState::OnGamePlayEvent: Entity %s has no actor", pEntity->GetName());
		return;
	}

	GameplayEvent  event2 = event;
	event2.extra = 0;// event2 is the forwarded event, extra either will be not used by the listener or re-set as a string
	uint8 eType = event.event;

	bool bPlayer = (pActor->IsPlayer() && m_mode);
	if(bPlayer || m_mode==GPM_AllActors)
	{
		//items
		switch(eType)
		{
			case eGE_ItemPickedUp:
				{
					CheckInventory(pActor,0);//,*m_pRecordGameEventFtor);
				}
				break;

			case eGE_ItemDropped:
				{
					TItemName itemName = GetItemName(EntityId(event.extra));
					if(!itemName ) //if(itemIdx < 0)
						break;
					event2.description = itemName;
					SendGamePlayEvent(pEntity,event2);
					IEntity* pItemEntity = gEnv->pEntitySystem->FindEntityByName(itemName);
					if(!pItemEntity)
						break;
					IItem* pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pItemEntity->GetId());
					if(!pItem)
						break;

					IEntityClass* pItemClass = pItem->GetEntity()->GetClass();
					if(pItemClass && !strcmpi(pItemClass->GetName(),"SOCOM"))
					{
						IItem* pCurrentItem = pActor->GetCurrentItem();
						if(pCurrentItem)
						{
							IEntityClass* pCurrentItemClass = pCurrentItem->GetEntity()->GetClass();
							if(pCurrentItemClass && !strcmpi(pCurrentItemClass->GetName(),"SOCOM"))
							{
								GameplayEvent event3;
								event3.event = eGE_ItemSelected;
								TItemName itemName = GetItemName(pCurrentItem->GetEntity()->GetId());
								if(!itemName)
									break;
								event3.value = 0;
								event3.description = (const char*)itemName;
								SendGamePlayEvent(pEntity,event3);
							}
						}
					}
				}
				break;

			case eGE_WeaponFireModeChanged:
				{
					TItemName itemIdx = GetItemName(EntityId(event.extra));
					if(!itemIdx)//if(itemIdx < 0)
						break;
					event2.description = (const char*)itemIdx;
					SendGamePlayEvent(pEntity,event2);
				}
				break;

			case eGE_ItemSelected:
				{
					EntityId itemId = EntityId(event.extra);
					TItemName itemIdx = GetItemName(itemId);
					if(itemId && !itemIdx)
						break;
					event2.value = 0;
					event2.description = (const char*)itemIdx;
					SendGamePlayEvent(pEntity,event2);
				}
				break;

			case eGE_AttachedAccessory:
				{
					if(!IsGrenade(event.description)) // NOT OffHandGrenade
						SendGamePlayEvent(pEntity,event2);
				}
				break;

			case eGE_AmmoCount:
				{
					const char* itemIdx = event.description;
					if(!itemIdx)
						break;

					TGameStates::iterator itGS;
					/*if(pActor->IsPlayer())
						itGS = m_itSingleActorGameState;
					else */if(pActor->GetEntity())
						itGS = m_GameStates.find(pActor->GetEntity()->GetId());
					else
						break;

					if(itGS == m_GameStates.end())
						break;

					SActorGameState& gstate = itGS->second;

					IEntity* pItemEntity = gEnv->pEntitySystem->FindEntityByName(itemIdx);
					if(!pItemEntity)
						break;
					IItem* pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pItemEntity->GetId());
					if(!pItem)
						break;

					CWeapon* pWeapon = (CWeapon*)(pItem->GetIWeapon());
					if(pWeapon && pWeapon->GetEntity())
					{
						TItemContainer::iterator it = gstate.Items.find(itemIdx);
						if(it==gstate.Items.end())
							break;
						SItemProperties& recItem = it->second;
						
						SWeaponAmmo weaponAmmo = pWeapon->GetFirstAmmo();
						bool bGrenade = false;
						if(!weaponAmmo.pAmmoClass)
						{
							// special case for grenades
							if(IsAmmoGrenade((const char*)(event.extra)))
							{
								weaponAmmo.pAmmoClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass((const char*)event.extra);
								weaponAmmo.count = (int)event.value;
								bGrenade = true;
							}
						}
						
						for(; weaponAmmo.pAmmoClass ; weaponAmmo = pWeapon->GetNextAmmo())
						{
							int ammoCount = weaponAmmo.count;
							const char* ammoClass;
							if(weaponAmmo.pAmmoClass && (ammoClass = weaponAmmo.pAmmoClass->GetName()))
							{
								TAmmoContainer& recAmmo = bGrenade? gstate.AmmoMags : recItem.Ammo;
								if(recAmmo.find(ammoClass) == recAmmo.end())
									recAmmo.insert(std::make_pair(ammoClass,0));
								if(ammoCount != recAmmo[ammoClass])
								{
									event2.event = eGE_AmmoCount;
									event2.value = (float)ammoCount;
									if(event2.value < 0)
										event2.value = 0;
									event2.extra = (void*)ammoClass;
									event2.description = (const char*)itemIdx;
									SendGamePlayEvent(pEntity,event2);
								}
							}
						}
					}

				}
				break;

			case eGE_EntityGrabbed:
				{
					EntityId entityId = EntityId(event.extra);
					IEntity * pGrabbedEntity = gEnv->pEntitySystem->GetEntity(entityId);
					if(pGrabbedEntity)
					{
						event2.description = pGrabbedEntity->GetName();
						SendGamePlayEvent(pEntity,event2);
					}
				}
				break;

			case eGE_WeaponReload:
			case eGE_ZoomedIn:
			case eGE_ZoomedOut:			
			case eGE_HealthChanged:
			case eGE_ItemExchanged:
				SendGamePlayEvent(pEntity,event2);
				break;

			default:
				break;
		}

	}
}
コード例 #19
0
void CGameStateRecorder::DumpWholeGameState(const CActor* pActor)
{
	GameplayEvent event;
	IEntity* pEntity = pActor->GetEntity();
	
	// health
	float health = (float)pActor->GetHealth();
	event.event = eGE_HealthChanged;
	event.value = health;
	SendGamePlayEvent(pEntity,event);
	
	// Inventory
	CInventory *pInventory = (CInventory*)(pActor->GetInventory());
	if(!pInventory)
		return;

	int count = pInventory->GetCount();
	for(int i=0; i<count; ++i)
	{
		EntityId itemId = pInventory->GetItem(i);
		
		CItem* pItem=NULL;
		TItemName itemName = GetItemName(itemId,&pItem);
		if(pItem && itemName)	
		{
			event.event = eGE_ItemPickedUp;
			event.description = itemName;
			SendGamePlayEvent(pEntity,event);

			if(pActor->GetCurrentItem() == pItem)
			{
				event.event = eGE_ItemSelected;
				event.description = itemName;
				event.value = 1; // for initialization
				SendGamePlayEvent(pEntity,event);
			}
			
			CWeapon* pWeapon = (CWeapon*)(pItem->GetIWeapon());
			if(pWeapon)
			{
				IEntityClass* pItemClass = pWeapon->GetEntity()->GetClass();
				if(pItemClass && !strcmpi(pItemClass->GetName(),"binoculars"))
					continue; // no fire mode or ammo recorded for binocular (which is a weapon)

				// fire mode
				int fireModeIdx = pWeapon->GetCurrentFireMode();

				event.event = eGE_WeaponFireModeChanged;
				event.value = (float)fireModeIdx;
				event.description = itemName;
				SendGamePlayEvent(pEntity,event);
				// count ammo
				for(SWeaponAmmo weaponAmmo = pWeapon->GetFirstAmmo(); weaponAmmo.pAmmoClass ; weaponAmmo = pWeapon->GetNextAmmo())
				{
					const char* ammoClass;
					if(weaponAmmo.pAmmoClass && (ammoClass = weaponAmmo.pAmmoClass->GetName()))
					{
						event.event = eGE_AmmoCount;
						event.value = (float)weaponAmmo.count;
						event.extra = (void*)ammoClass;
						event.description = (const char*)itemName;
						SendGamePlayEvent(pEntity,event);
					}
				}
			}
		}
	}

	count = pInventory->GetAccessoryCount();

	for(int i=0; i< count; i++)
	{
		const char* accessory = pInventory->GetAccessory(i);
		if(accessory && strlen(accessory))	
		{
			IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(accessory);
			if(pClass)
			{
				TItemName classItem = pClass->GetName();
				event.event = eGE_AccessoryPickedUp;
				//event.value = classIdx;
				event.description = classItem;
				SendGamePlayEvent(pEntity,event);
			}
		}
	}

	int nInvAmmo = pInventory->GetAmmoPackCount();
	pInventory->AmmoIteratorFirst();
	for(int j=0 ; !pInventory->AmmoIteratorEnd(); j++, pInventory->AmmoIteratorNext())
	{
		const IEntityClass* pAmmoClass = pInventory->AmmoIteratorGetClass();
		if(pAmmoClass)
		{
			const char* ammoClassName = pAmmoClass->GetName();
			int ammoCount = pInventory->AmmoIteratorGetCount();
			GameplayEvent event;
			event.event = eGE_AmmoPickedUp;
			event.description = ammoClassName;
			event.value = (float)ammoCount;
			SendGamePlayEvent(pEntity,event);
		}
	}

}
コード例 #20
0
/*template <class EventHandlerFunc> */void CGameStateRecorder::CheckInventory(CActor* pActor, IItem *pItem)//, EventHandlerFunc eventHandler)
{

	if(pActor)
	{
		TGameStates::iterator itGS;
		if(pActor->IsPlayer())
			itGS = m_itSingleActorGameState;
		else if(pActor->GetEntity())
			itGS = m_GameStates.find(pActor->GetEntity()->GetId());
		else
			return;

		if(itGS != m_GameStates.end())
		{
			SActorGameState& gstate = itGS->second;

			// items

			CInventory *pInventory = (CInventory*)(pActor->GetInventory());
			if(pInventory)
			{
				bool bSingleItem = (pItem!=0);
				int nInvItems = (bSingleItem ? 1 : pInventory->GetCount());
				TItemContainer& Items = gstate.Items;
				
				for(int i=0; i< nInvItems; i++)
				{
					if(!bSingleItem) 
						pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pInventory->GetItem(i));

					if(pItem)
					{
						TItemName szItemName = GetItemName(pItem->GetEntityId());

						TItemContainer::iterator it = Items.find(szItemName);
						if(it==Items.end())
						{
							it = (Items.insert(std::make_pair(szItemName,SItemProperties()))).first;

							GameplayEvent event;
							event.event = eGE_ItemPickedUp;
							event.description = szItemName;
							//eventHandler(pActor,event);
							SendGamePlayEvent(pActor->GetEntity(),event);

							SItemProperties& recItem = it->second;
							CWeapon *pWeapon = (CWeapon*)(pItem->GetIWeapon());
							if(pWeapon)
							{
								// ammo
								for(SWeaponAmmo weaponAmmo = pWeapon->GetFirstAmmo(); weaponAmmo.pAmmoClass ; weaponAmmo = pWeapon->GetNextAmmo())
								{
									int ammoCount = weaponAmmo.count;
									string ammoClass;
									if(weaponAmmo.pAmmoClass && (ammoClass = weaponAmmo.pAmmoClass->GetName()))
									{
										TAmmoContainer& recAmmo = recItem.Ammo;

										if(recAmmo.find(ammoClass) == recAmmo.end())
											recAmmo.insert(std::make_pair(ammoClass,0));
										int recAmmoCount = recAmmo[ammoClass];
										if(ammoCount!=recAmmoCount)
										{
											GameplayEvent event;
											event.event = eGE_AmmoCount;
											event.value = (float)ammoCount;
											event.extra = (void*)(ammoClass.c_str());
											event.description = (const char*)szItemName;
											//eventHandler(pActor,event);
											SendGamePlayEvent(pActor->GetEntity(),event);

										}
									}
								}
								// current fire mode
								int curFireModeIdx = pWeapon->GetCurrentFireMode();
								int recFireModeIdx = recItem.fireMode;
								if(curFireModeIdx!= recFireModeIdx)
								{
									GameplayEvent event;
									event.event = eGE_WeaponFireModeChanged;
									event.value = (float)curFireModeIdx;
									event.description = (const char*)szItemName;
									//eventHandler(pActor,event);
									SendGamePlayEvent(pActor->GetEntity(),event);
								}
							}
						}
					}
				}

				/// Accessories

				int nInvAccessories = pInventory->GetAccessoryCount();

				TAccessoryContainer& Accessories = gstate.Accessories;
				int nRecAccessories = Accessories.size();

				for(int j=0 ; j< nInvAccessories; j++)
				{
					const char* accessory = pInventory->GetAccessory(j);
					if(accessory && strlen(accessory))	
					{
						IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(accessory);
						if(pClass)
						{
							TItemName itemClass = pClass->GetName();
							TAccessoryContainer::iterator it = Accessories.find(itemClass);
							if(it==Accessories.end())
							{
								GameplayEvent event;
								event.event = eGE_AccessoryPickedUp;
								//event.value = accIdx;
								event.description = itemClass;
//								eventHandler(pActor,event);
								SendGamePlayEvent(pActor->GetEntity(),event);
							}
						}
					}
				}

				/// Ammo

				TAmmoContainer& Ammo = gstate.AmmoMags;
				int nRecAmmo = Ammo.size();
				int nInvAmmo = pInventory->GetAmmoPackCount();
				pInventory->AmmoIteratorFirst();
				for(int j=0 ; !pInventory->AmmoIteratorEnd(); j++, pInventory->AmmoIteratorNext())
				{
					TAmmoContainer& Mags = gstate.AmmoMags;
					const IEntityClass* pAmmoClass = pInventory->AmmoIteratorGetClass();
					if(pAmmoClass)
					{
						const char* ammoClassName = pAmmoClass->GetName();
						int ammoCount = pInventory->AmmoIteratorGetCount();
						if(Mags.find(ammoClassName) == Mags.end() || ammoCount!= Mags[ammoClassName])
						{
							GameplayEvent event;
							event.event = eGE_AmmoPickedUp;
							event.description = ammoClassName;
							event.value = (float)ammoCount;
//							eventHandler(pActor,event);
							SendGamePlayEvent(pActor->GetEntity(),event);
						}
					}
				}
			}
		}
	}
}
コード例 #21
0
float CGameStateRecorder::RenderInfo(float y, bool bRecording)
{
	float retY = 0;

	IRenderer *pRenderer = gEnv->pRenderer;

	if (bRecording)
	{
		float fColor[4] = {1,0,0,1};
		pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," Recording game state");
		retY +=15;
	}
	else 
	{
		const float xp = 300;
		const float xr = 400;
		const float xri = 600;

		float fColor[4] = {0,1,0,1};
		float fColorWarning[4] = {1,1,0,1};

		const char* actorName = m_demo_actorInfo->GetString();
		CActor *pActor = GetActorOfName(actorName);
		if(pActor)
		{
			pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," Game state - Actor: %s --------------------------------------------------",pActor->GetEntity()? pActor->GetEntity()->GetName(): "(no entity)");
			retY +=15;

			if(m_itSingleActorGameState != m_GameStates.end() && pActor->GetEntity() && m_itSingleActorGameState->first == pActor->GetEntity()->GetId())
			{
				ICVar *pVar = gEnv->pConsole->GetCVar( "demo_force_game_state" );
				if(pVar)
				{
					int demo_forceGameState = pVar->GetIVal();
					if(demo_forceGameState)
					{
						pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false,demo_forceGameState==1 ? 
							" Override mode = (health, suit energy)" : " Override mode = (all)");
						retY +=15;
					}
				}

				pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColor,false,"Current");
				pRenderer->Draw2dLabel( xr,y+retY, 1.3f, fColor,false,"Recorded");
				retY +=15;

				SActorGameState& gstate = m_itSingleActorGameState->second;
				float recordedHealth = (float)gstate.health;
				float health = (float)pActor->GetHealth();
				bool bError = CHECK_MISMATCH(health, recordedHealth,10);

				pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," Health:");
				pRenderer->Draw2dLabel( xp,y+retY, 1.3f, bError? fColorWarning : fColor, false,"%d",(int)health);
				pRenderer->Draw2dLabel( xr,y+retY, 1.3f, bError? fColorWarning : fColor, false,"%d",(int)recordedHealth);
				retY +=15;
				
				// items
				pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," Inventory ---------------------------------------------------------------------------------------");
				retY +=15;
				pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColor,false,"Current");
				pRenderer->Draw2dLabel( xri,y+retY, 1.3f, fColor,false,"Recorded");
				retY +=15;

				CInventory *pInventory = (CInventory*)(pActor->GetInventory());
				if(pInventory)
				{
					int nInvItems = pInventory->GetCount();
						
					TItemContainer& Items = gstate.Items;
					int nRecItems = Items.size();
					int maxItems = max(nRecItems,nInvItems);

					int i=0;
					EntityId curSelectedId = pActor->GetCurrentItemId();
					TItemName curSelClass = GetItemName(curSelectedId);
					bool bSelectedError = !equal_strings(gstate.itemSelected,curSelClass);

					for(; i< nInvItems; i++)
					{
						IItem *pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pInventory->GetItem(i));
						if(pItem)	
						{
							TItemName szItemName = GetItemName(pItem->GetEntityId());

							TItemContainer::iterator it = Items.find(szItemName);
							bError = it==Items.end();
							pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," %2d)",i+1);

							EntityId curId = pItem->GetEntityId();
							TItemName curClass = GetItemName(curId);
							if(equal_strings(curClass,curSelClass) )
								pRenderer->Draw2dLabel( xp-16,y+retY, 1.3f,bSelectedError ? fColorWarning:fColor, false, "[]");

							if(equal_strings(szItemName, gstate.itemSelected))
								pRenderer->Draw2dLabel( xri-16,y+retY, 1.3f,bSelectedError ? fColorWarning:fColor, false, "[]");

							char itemName[32];
							const char* originalItemName = pItem->GetEntity() ? pItem->GetEntity()->GetName():"(null)";
							int length = strlen(originalItemName);
							length = min(length,31);
							strncpy(itemName,originalItemName,length);
							itemName[length]=0;
							pRenderer->Draw2dLabel( 1,y+retY, 1.3f, bError? fColorWarning : fColor, false,"     %s",itemName);

							if(bError)
								pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColorWarning, false, "Missing");
							else
							{
								SItemProperties& recItem = it->second;
								CWeapon *pWeapon = (CWeapon*)(pItem->GetIWeapon());

								IEntityClass* pItemClass = pItem->GetEntity()->GetClass();
								if(pItemClass && !strcmpi(pItemClass->GetName(),"binoculars"))
									pWeapon = NULL; // no fire mode or ammo recorded for binocular (which is a weapon)

								if(pWeapon)
								{
									int idx = 0;
									// ammo
									float xa = 0;
									for(SWeaponAmmo weaponAmmo = pWeapon->GetFirstAmmo(); weaponAmmo.pAmmoClass ; weaponAmmo = pWeapon->GetNextAmmo())
									{
										int ammoCount = weaponAmmo.count;
										const char* ammoClass;
										if(weaponAmmo.pAmmoClass && (ammoClass = weaponAmmo.pAmmoClass->GetName()))
										{
											TAmmoContainer::iterator it = recItem.Ammo.find(ammoClass);
											if(it!=recItem.Ammo.end())
											{
												int recAmmoCount = recItem.Ammo[ammoClass];
												bool bError2 = ammoCount!=recAmmoCount;
												pRenderer->Draw2dLabel( xp+xa,y+retY, 1.3f, bError2? fColorWarning : fColor, false,"Am%d:%d",idx,ammoCount);
												pRenderer->Draw2dLabel( xri+xa,y+retY, 1.3f, bError2? fColorWarning : fColor, false,"Am%d:%d",idx,recAmmoCount);
												xa += 50;
												++idx;
												if(idx%5 ==0)
												{
													xa=0;
													retY+=15;
												}
											}
										}
									}

									// current fire mode
									int curFireModeIdx = pWeapon->GetCurrentFireMode();
									int recFireModeIdx = recItem.fireMode;
									bool bError3 = curFireModeIdx!= recFireModeIdx;
									pRenderer->Draw2dLabel( xp+xa,y+retY, 1.3f, bError3? fColorWarning : fColor, false,"FMode:%d",curFireModeIdx);
									pRenderer->Draw2dLabel( xri+xa,y+retY, 1.3f, bError3? fColorWarning : fColor, false,"FMode:%d",recFireModeIdx);
								}
								else
								{
									pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColor, false, "Ok");
								}
							}

						}
						retY +=15;
					}

					/// Accessories

					int nInvAccessories = pInventory->GetAccessoryCount();

					TAccessoryContainer& Accessories = gstate.Accessories;
					int nRecAccessories = Accessories.size();
					if(nRecAccessories)
					{
						pRenderer->Draw2dLabel( 1,y+retY, 1.3f, bError? fColorWarning : fColor, false," Accessories");
						retY +=15;
					}

					for(int j=0 ; j< nInvAccessories; j++,i++)
					{
						const char* accessory = pInventory->GetAccessory(j);
						if(accessory && strlen(accessory))	
						{

							IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(accessory);
							if(pClass)
							{
								TItemName szItemName = pClass->GetName();
								TAccessoryContainer::iterator it = Accessories.find(szItemName);
								bError = it==Accessories.end();
								pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false," %2d)",i+1);

								char itemName[32];
								int length = strlen(accessory);
								length = min(length,31);
								strncpy(itemName,accessory,length);
								itemName[length]=0;
								pRenderer->Draw2dLabel( 1,y+retY, 1.3f, bError? fColorWarning : fColor, false,"     %s",itemName);

								if(bError)
									pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColorWarning, false, "Missing");
								else
									pRenderer->Draw2dLabel( xp,y+retY, 1.3f, fColor, false, "Ok");

								retY +=15;
							}
						}

					}
					/// Ammo Mags
					TAmmoContainer& Ammo = gstate.AmmoMags;
					int nRecAmmo = Ammo.size();
					int nInvAmmo = pInventory->GetAmmoPackCount();
					if(nInvAmmo)
					{
						pRenderer->Draw2dLabel( 1,y+retY, 1.3f, bError? fColorWarning : fColor, false," Ammo Packs");
						retY +=15;
					}

					pInventory->AmmoIteratorFirst();
					for(int j=0 ; !pInventory->AmmoIteratorEnd(); j++, pInventory->AmmoIteratorNext())
					{
						TAmmoContainer& Mags = gstate.AmmoMags;
						const IEntityClass* pAmmoClass = pInventory->AmmoIteratorGetClass();
						if(pAmmoClass)
						{
							int invAmmoCount = pInventory->AmmoIteratorGetCount();
							const char* ammoClassName = pAmmoClass->GetName();
							bool bNotFound = Mags.find(ammoClassName) == Mags.end();
							int recAmmoCount = bNotFound ? 0 :Mags[ammoClassName];
							bool bError =  bNotFound || invAmmoCount!= recAmmoCount;

							pRenderer->Draw2dLabel( 1,y+retY, 1.3f, bError? fColorWarning : fColor, false,"  %s:",ammoClassName);
							pRenderer->Draw2dLabel( xp,y+retY, 1.3f, bError? fColorWarning : fColor, false,"%d",invAmmoCount);
							if(bNotFound)
								pRenderer->Draw2dLabel( xr,y+retY, 1.3f, fColorWarning, false,"NotRecd");
							else
								pRenderer->Draw2dLabel( xr,y+retY, 1.3f, bError? fColorWarning : fColor, false,"%d",recAmmoCount);
							retY +=15;

						}
					}
				}
			}
			else // m_itSingleActorGameState != m_GameStates.end()
			{
				pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false, "<<Not Recorded>>");
				retY +=15;
			}
		}
		else // pActor
		{
			pRenderer->Draw2dLabel( 1,y+retY, 1.3f, fColor,false, "<<Actor %s not in the map>>",actorName ? actorName:"(no name)");
			retY +=15;		
		}

	}
	return retY;
}
コード例 #22
0
ファイル: a_xgame.c プロジェクト: DusteDdk/aq2-tng-bk
void ParseSayText (edict_t * ent, char *text, size_t size)
{
	char buf[PARSE_BUFSIZE + 256] = "\0"; //Parsebuf + chatpuf size
	char *p, *pbuf;

	p = text;
	pbuf = buf;

	while (*p != 0)
	{
		if (*p == '%')
		{
			switch (*(p + 1))
			{
			case 'H':
				GetHealth (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'A':
				GetAmmo (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'W':
				GetWeaponName (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'I':
				GetItemName (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'T':
				GetNearbyTeammates (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'M':
				GetViewedTeammateName (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'E':
				GetViewedEnemyName (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'F':
				GetViewedEnemyWeapon (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'G':
				GetEnemyPosition (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'K':
				GetLastKilledTarget (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			//AQ2:TNG Slicer - New Location Code
			/*
			case 'L':
				GetOwnPosition (ent, infobuf);
				strcpy (pbuf, infobuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'S':
				GetViewedPosition (ent, infobuf);
				strcpy (pbuf, infobuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			*/
			case 'S':
				GetSightedLocation (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			case 'L':
				GetPlayerLocation (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			//AQ2:TNG Slicer Last Damage Location
			case 'D':
				GetLastDamagedPart (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			//AQ2:TNG END
			//AQ2:TNG Freud Last Player Damaged
			case 'P':
				GetLastDamagedPlayers (ent, pbuf);
				pbuf = SeekBufEnd (pbuf);
				p += 2;
				break;
			//AQ2:TNG END
			default:
				*pbuf++ = *p++;
				break;
			}
		}
		else
		{
			*pbuf++ = *p++;
		}

		if (buf[size-1])
		{
			buf[size-1] = 0;
			break;
		}
	}

	*pbuf = 0;
	strcpy(text, buf);
}
コード例 #23
0
ファイル: CoListBox.cpp プロジェクト: Hreinnjons/guayadeque
// -------------------------------------------------------------------------------- //
wxString guCoListBox::GetSearchText( int item ) const
{
    return GetItemName( item );
}
コード例 #24
0
    bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 uiAction)
    {
        WorldSession* session = player->GetSession();
        player->PlayerTalkClass->ClearMenus();
        switch(sender)
        {
        case EQUIPMENT_SLOT_END: // Show items you can use
            {
                if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
                {
                    uint32 lowGUID = player->GetGUIDLow();
                    _items[lowGUID].clear();
                    uint32 limit = 0;
                    uint32 price = 0;
                    switch (sTransmogrification->GetRequireGold())
                    {
                    case 1: { price = (unsigned int)(GetFakePrice(oldItem)*sTransmogrification->GetGoldModifier()); } break;
                    case 2: { price = (unsigned int)sTransmogrification->GetGoldCost(); } break;
                    }
                    char tokenCost[250] = "\n";
                    if(sTransmogrification->GetRequireToken())
                        snprintf(tokenCost, 250, "\n\n%u x %s", sTransmogrification->GetTokenAmount(), GetItemName(sObjectMgr->GetItemTemplate(sTransmogrification->GetTokenEntry()), session).c_str());

                    for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
                    {
                        if (limit > 30)
                            break;
                        if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
                        {
                            uint32 display = newItem->GetTemplate()->DisplayInfoID;
                            if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                            {
                                if (_items[lowGUID].find(display) == _items[lowGUID].end())
                                {
                                    limit++;
                                    _items[lowGUID][display] = newItem;
                                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
                                }
                            }
                        }
                    }

                    for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
                    {
                        if (Bag* bag = player->GetBagByPos(i))
                        {
                            for (uint32 j = 0; j < bag->GetBagSize(); j++)
                            {
                                if (limit > 30)
                                    break;
                                if (Item* newItem = player->GetItemByPos(i, j))
                                {
                                    uint32 display = newItem->GetTemplate()->DisplayInfoID;
                                    if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                                    {
                                        if (_items[lowGUID].find(display) == _items[lowGUID].end())
                                        {
                                            limit++;
                                            _items[lowGUID][display] = newItem;
                                            player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    char removeOnePopup[250];
                    snprintf(removeOnePopup, 250, session->GetTrinityString(LANG_POPUP_REMOVE_ONE), GetSlotName(uiAction, session));
                    player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetTrinityString(LANG_OPTION_REMOVE_ONE), EQUIPMENT_SLOT_END+3, uiAction, removeOnePopup, 0, false);
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetTrinityString(LANG_OPTION_BACK), EQUIPMENT_SLOT_END+1, 0);
                    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
                }
                else
                    OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+1: // Back
            {
                OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
            {
                bool removed = false;
                for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
                {
                    if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
                    {
                        if (newItem->DeleteFakeEntry() && !removed)
                            removed = true;
                    }
                }
                if (removed)
                {
                    session->SendAreaTriggerMessage(session->GetTrinityString(LANG_REM_TRANSMOGRIFICATIONS_ITEMS));
                    player->PlayDirectSound(3337);
                }
                else
                    session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATIONS));
                OnGossipHello(player, creature);
            } break;
        case EQUIPMENT_SLOT_END+3: // Remove Transmogrification from single item
            {
                if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
                {
                    if (newItem->DeleteFakeEntry())
                    {
                        session->SendAreaTriggerMessage(session->GetTrinityString(LANG_REM_TRANSMOGRIFICATION_ITEM), GetSlotName(uiAction, session));
                        player->PlayDirectSound(3337);
                    }
                    else
                        session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATION), GetSlotName(uiAction, session));
                }
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, uiAction);
            } break;
        default: // Transmogrify
            {
                uint32 lowGUID = player->GetGUIDLow();
                if(!sTransmogrification->GetRequireToken() || player->GetItemCount(sTransmogrification->GetTokenEntry()) >= sTransmogrification->GetTokenAmount())
                {
                    if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, sender))
                    {
                        if (_items[lowGUID].find(uiAction) != _items[lowGUID].end() && _items[lowGUID][uiAction]->IsInWorld())
                        {
                            Item* newItem = _items[lowGUID][uiAction];
                            if (newItem->GetOwnerGUID() == player->GetGUIDLow() && (newItem->IsInBag() || newItem->GetBagSlot() == INVENTORY_SLOT_BAG_0) && player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
                            {
                                switch(sTransmogrification->GetRequireGold())
                                {
                                case 1: { player->ModifyMoney(-1*(uint32)(GetFakePrice(oldItem)*sTransmogrification->GetGoldModifier())); } break;
                                case 2: { player->ModifyMoney(-1*(unsigned int)sTransmogrification->GetGoldCost()); } break;
                                }
                                if(sTransmogrification->GetRequireToken())
                                    player->DestroyItemCount(sTransmogrification->GetTokenEntry(), sTransmogrification->GetTokenAmount(), true);
                                oldItem->SetFakeEntry(newItem->GetEntry());
                                newItem->SetNotRefundable(player);
                                newItem->SetBinding(true);
                                player->PlayDirectSound(3337);
                                session->SendAreaTriggerMessage(session->GetTrinityString(LANG_ITEM_TRANSMOGRIFIED), GetSlotName(sender, session));
                            }
                            else
                                session->SendNotification(session->GetTrinityString(LANG_ERR_NO_ITEM_SUITABLE));
                        }
                        else
                            session->SendNotification(session->GetTrinityString(LANG_ERR_NO_ITEM_EXISTS));
                    }
                    else
                        session->SendNotification(session->GetTrinityString(LANG_ERR_EQUIP_SLOT_EMPTY));
                }
                else
                    session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TOKEN), GetItemName(sObjectMgr->GetItemTemplate(sTransmogrification->GetTokenEntry()), session).c_str());
                _items[lowGUID].clear();
                OnGossipSelect(player, creature, EQUIPMENT_SLOT_END, sender);
            } break;
        }
        return true;
    }