示例#1
0
void __fastcall TWOWFisherMain::lvFishResultData(TObject *Sender, TListItem *Item)
{
	shared_ptr<DataObject> curObj = GetGameWorld()->GetDataByKey("fish_results")->GetAt(Item->Index);
	DWORD itemID = curObj->GetKeyName().ToIntDef(0);
	DWORD cnt = curObj->AsInt();
	Item->Caption = GetGameWorld()->GetItemNameByID(itemID);
	Item->SubItems->Add(cnt);
	Item->SubItems->Add(FormatStr("%s%%", curObj->GetDataObject("percent")->AsString()));
}
示例#2
0
void __fastcall TWOWFisherMain::miNoAutoPickupClick(TObject *Sender)
{
	shared_ptr<DataObject> curObj = GetGameWorld()->GetDataByKey("fish_results")->GetAt(lvFishResult->ItemIndex);
	if(curObj.get() == NULL)
		return;

	DWORD itemID = curObj->GetKeyName().ToIntDef(0);
	GetGameWorld()->AddItemPickupList(itemID);
	this->Refresh();
}
示例#3
0
FText AFlareGame::PickCapitalShipName()
{
	if (BaseImmatriculationNameList.Num() == 0)
	{
		InitCapitalShipNameDatabase();
	}
	int32 PickIndex = FMath::RandRange(0,BaseImmatriculationNameList.Num()-1);

	FText BaseName = BaseImmatriculationNameList[PickIndex];

	// Check unicity
	bool Unique;
	int32 NameIncrement = 1;
	FText CandidateName;
	do
	{
		Unique = true;
		FString Suffix;
		if (NameIncrement > 1)
		{
			FString Roman = ConvertToRoman(NameIncrement);
			Suffix = FString(" ") + Roman;
		}
		else
		{
			Suffix = FString("");
		}

		CandidateName = FText::FromString(BaseName.ToString() + Suffix);

		// Browse all existing ships the check if the name is unique
		for (int i = 0; i < GetGameWorld()->GetCompanies().Num(); i++)
		{
			UFlareCompany* Company = GetGameWorld()->GetCompanies()[i];

			// Ships
			for (int32 ShipIndex = 0 ; ShipIndex < Company->GetCompanyShips().Num(); ShipIndex++)
			{
				UFlareSimulatedSpacecraft* SpacecraftCandidate = Company->GetCompanyShips()[ShipIndex];
				if (SpacecraftCandidate && SpacecraftCandidate->GetNickName().ToString() == CandidateName.ToString())
				{
					FLOGV("Not unique %s", *CandidateName.ToString());
					Unique = false;
					break;
				}
			}
		}
		NameIncrement++;
	} while(!Unique);

	FLOGV("OK for %s", *CandidateName.ToString());

	return CandidateName;
}
示例#4
0
void			TWOWFisherMain::Refresh()
{
	ListView_SetItemCountEx(lvFishResult->Handle, GetGameWorld()->GetDataByKey("fish_results")->GetChildCount(), LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL);
	lvFishResult->Refresh();

	ListView_SetItemCountEx(lvFishFilter->Handle, GetGameWorld()->GetItemPickupListCount(), LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL);
	lvFishFilter->Refresh();

	int pickCnt = GetGameWorld()->GetDataInt("fish_result_count/pick");
	int nopickCnt = GetGameWorld()->GetDataInt("fish_result_count/nopick");
	gbFishResult->Caption = FormatStr(GBText("钓鱼记录.拾取数(%d).丢弃数(%d).总数(%d)"), pickCnt, nopickCnt, pickCnt + nopickCnt);
}
示例#5
0
//---------------------------------------------------------------------------
void __fastcall TWOWFisherMain::FormCreate(TObject *Sender)
{
	if(!IsWin2k())
	{
		ShowMessage(GBText("你的操作系统版本过低, 需要win2000及以后的操作系统"));
		Application->Terminate();
		return;
	}
	PageControl1->ActivePageIndex = 0;
	ExtractDllFromExe();
	#ifndef _DEBUG
	tsDebug->TabVisible = false;
	#endif
	GetLog()->SetEnableLog(true);
	GetSharedMemInfo()->CreateMapping();
	String filePath = ExtractFilePath(Application->ExeName) + "Log\\";
    GetLog()->SetPath(filePath);
	GetLog()->SetFileName(filePath + "WOWFisher.log");
    GetLog()->SetGUIWindow(this->Handle);
    GetLog()->Warn("Proc Init");
	GetLog()->Info("Current ThreadID = %d", GetCurrentThreadId());
	int  listenPort = HOST_PORT;
	WOWHookViewInfo * view = GetSharedMemInfo()->CreateEmpty(listenPort);
	if(!view)
	{
		ShowMessage("FULL!");
		return;
	}
	listenPort = view->HostPortNumber;
	String dllName = GetGameWorld()->GetDllFileName();
	if(dllName == "")
	{
		dllName = ExtractFilePath(Application->ExeName) + "wowgo.dll";
	}
	GetGameWorld()->InjectDll(dllName, typeid(*this).name());
	if(!GetWOWProxyManager()->Start(listenPort))
	{
		return;
	}

	GetWOWProxyManager()->fpOnUserAuthPacket = OnUserAuthPacket;
	GetThreadManager()->StartAll();
	GetGameWorld()->InitFiberProcesser();
	GetGameWorld()->LoadItemNameData();
	GetGameWorld()->LoadFishData();

	GetFiberManager()->Process();
	#ifdef _DEBUG
	GetFiberManager()->Awake(FWC_REACTION_START);
	InitDebugFrms();
	#endif
}
示例#6
0
void        FishAI::SendStartFish()
{
    if(GetTickCount() - m_ActiveTick >= KEEP_ACTIVE_TICK)
    {
        m_ActiveTick = GetTickCount();
		SendMessage(GetGameWorld()->GetWOWWindowHandle(), WM_KEYDOWN, VK_SPACE, 0);
        SendMessage(GetGameWorld()->GetWOWWindowHandle(), WM_KEYUP, VK_SPACE, 0);
        this->FiberSleep(2000);
    }
    
    int spell_id = GetFishSpellID();
    //使用钓鱼技能
    GetGameWorld()->GetPackSender()->SendCastSpell(spell_id);
}
示例#7
0
    void Door::OnUpdate()
    {
        // TODO: move this
        static const float MoveSpeed = 50.0f;

        auto gameObject = _gameObject.lock();
        if (gameObject)
        {
            Vector3 toTarget = _targetPosition - gameObject->GetTransform().GetPosition();
            if (toTarget.LengthSquared() > Math::Epsilon)
            {
                float dist = toTarget.Length();
                Vector3 dir = Vector3::Normalize(toTarget);

                float movementDist = MoveSpeed * gameObject->GetGameWorld()->GetTime().deltaTime;
                if (movementDist > dist)
                {
                    movementDist = dist;
                }

                gameObject->GetTransform().SetPosition(gameObject->GetTransform().GetPosition() + dir * movementDist);
            }
        }

        // Always try to close the door, unless overridden by OnActivate()
        _targetPosition = _closedPosition;
    }
示例#8
0
    void SimpleAction::OnActivate()
    {
        auto gameObject = _gameObject.lock();
        auto gameWorld = gameObject->GetGameWorld();

        if (!_actionComplete)
        {
            //_actionComplete = true;

            switch(_type)
            {
            case SimpleAction::Type::PlaySound:
                // Play sound
                DebugOut("PLAY SOUND: %S",_data.c_str());
                gameWorld->GetDeviceContext().audioDevice->PlayClip(Quake2Game::GetContentCache()->GetAudioClip(_data));
                break;
            case SimpleAction::Type::PrintText:
                // Print text to window
                // _data is the text to output
                DebugOut("TEXT MESSAGE: %S",_data.c_str());
                break;
            default:
                break;
            }
        }
    }
示例#9
0
void __fastcall TWOWFisherMain::btVisualCreatureClick(TObject *Sender)
{
	uint64 guid = GetGameWorld()->GetSelfGUID();
	if(guid == 0)
		return;

	#ifndef _DEBUG
	VM_START
	if(GetGameWorld()->GetFishAI()->GetIsStop())
	{
		ShowMessage(GBText("你的使用期限已过, 请续费!"));
		frmChargeFrm->ShowFrm();
		return;
	}
	VM_END
	#endif
	GetGameWorld()->GetPackSender()->SendVisible(guid, PLAYER_TRACK_CREATURES, 1);
	GetGameWorld()->GetPackSender()->SendVisible(guid, PLAYER_TRACK_RESOURCES, 0);
}
示例#10
0
int         FishAI::GetFishSpellID()
{
	shared_ptr<DataObject>  dataObj = GetGameWorld()->GetDataByKey("self/spell");
	for (int i=0; i<dataObj->GetChildCount(); i++)
	{
		int spellID = dataObj->GetAt(i)->GetKeyName().ToIntDef(0);
		if(IsFishSpellID(spellID))
		{
			return spellID;
		}
	}
    return  0;
}
示例#11
0
void AFlareGame::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);

	for (FConstPawnIterator Iterator = GetWorld()->GetPawnIterator(); Iterator; ++Iterator)
	{
		// This should never fail
		APawn* Pawn = *Iterator;
		check(Pawn);
	}

	if (QuestManager)
	{
		QuestManager->OnTick(DeltaSeconds);
	}

	if(GetActiveSector() != NULL)
	{
		for (int CompanyIndex = 0; CompanyIndex < GetGameWorld()->GetCompanies().Num(); CompanyIndex++)
		{
			GetGameWorld()->GetCompanies()[CompanyIndex]->TickAI();
		}
	}
}
示例#12
0
void __fastcall TWOWFisherMain::miCopyFishResultClick(TObject *Sender)
{
	auto_ptr<TStringList>	copyStr(new TStringList);
	String str = "-";
	String resultStr;
	for(int i=0; i<61; i++)
	{
		resultStr += str;
	}
	copyStr->Add(resultStr);
	for(int i=0; i<GetGameWorld()->GetDataByKey("fish_results")->GetChildCount(); i++)
	{
		shared_ptr<DataObject> curObj = GetGameWorld()->GetDataByKey("fish_results")->GetAt(i);
		DWORD itemID = curObj->GetKeyName().ToIntDef(0);
		AnsiString itemName = GetGameWorld()->GetItemNameByID(itemID);
		AnsiString cnt = curObj->AsString();
		AnsiString percent = FormatStr("%s%%", curObj->GetDataObject("percent")->AsString());
		AnsiString itemResult;
		itemResult.sprintf("*%-30s%-15s%-15s*", itemName.c_str(), cnt.c_str(), percent.c_str());
		copyStr->Add(itemResult);
	}
	copyStr->Add(resultStr);
	Clipboard()->AsText = copyStr->Text;
}
示例#13
0
void __fastcall TWOWFisherMain::Timer1Timer(TObject *Sender)
{

	GetPackageContainerManager()->PopQueue(GetWOWProxyManager()->GetAllQueue());

    GetPackageContainerManager()->ProcessClientMessage();

	GetFiberManager()->Process();

	PackageContainer * curPackageContainer = GetPackageContainerManager()->GetWorldPackageContainer();
	if(curPackageContainer)
	{
		#ifdef _DEBUG
		int removeNum = 10000;
		#else
		int removeNum = 100;
		#endif
		if(removeNum != 0 && curPackageContainer->GetAll()->Count() > removeNum)
		{
			GetPackageContainerManager()->ClearAllPackage();
		}
	}

	GetWOWProxyManager()->ProcessRemoveProxyList();
	GetThreadManager()->ProcessDeletedThread();
	GetGameWorld()->CheckWOWClosedRefresh();

	String result;
	while(GetThreadManager()->GetGUIMessageCount())
	{
		if(!GetThreadManager()->PopGUIMessage(&result))
		{
			continue;
		}
		if(result == "REQ_CHARGE")
		{
			//弹出注册页面
			frmChargeFrm->ShowFrm();
			continue;
		}
		LogMsg(result);
		frmChargeFrm->AddLog(result);
	}
}
示例#14
0
void __fastcall TWOWFisherMain::WndProcs(Messages::TMessage &Message)
{
    if(Message.Msg == WM_COPYDATA)
    {
        COPYDATASTRUCT * sendData = (COPYDATASTRUCT *)Message.LParam;
		String msg = String((TCHAR *)sendData->lpData, sendData->cbData / sizeof(TCHAR));

		#ifdef _DEBUG
		if(WOWReviewerMainFrm)
			WOWReviewerMainFrm->LogMsg(msg);
		#endif
        if(sendData->dwData == MSG_CONNECT)
        {
            GetWOWProxyManager()->SetDestAddress(msg);
        }
        else if(sendData->dwData == MSG_TOP_WINDOW)
        {
            this->SetFocus();
            this->BringToFront();
            this->Show();
            Application->BringToFront();
        }
        else if(sendData->dwData == MSG_SESSIONKEY)
        {
            //得到了SessionKey
			//颠倒一下
			GetGameWorld()->SetClientSessionKey(msg);
        }
	}
	else if(Message.Msg == WM_CLOSE)
	{
		ApplicationEvents1Minimize(this);
		return;
	}
    this->WndProc(Message);
}
示例#15
0
void AFlareGame::ActivateSector(UFlareSimulatedSector* Sector)
{
	if (!Sector)
	{
		// No sector to activate
		return;
	}

	// Load the sector level - Will call OnLevelLoaded()
	LoadStreamingLevel(Sector->GetDescription()->LevelName);

	// Check if we should really activate
	FLOGV("AFlareGame::ActivateSector : %s", *Sector->GetSectorName().ToString());
	if (ActiveSector)
	{
		FLOG("AFlareGame::ActivateSector : There is already an active sector");
		if (ActiveSector->GetSimulatedSector()->GetIdentifier() == Sector->GetIdentifier())
		{
			// Sector to activate is already active
			return;
		}

		// Deactivate the sector
		DeactivateSector();
	}

	// Ships
	FLOGV("AFlareGame::ActivateSector : Ship count = %d", Sector->GetSectorShips().Num());
	bool PlayerHasShip = false;
	for (int ShipIndex = 0; ShipIndex < Sector->GetSectorShips().Num(); ShipIndex++)
	{
		UFlareSimulatedSpacecraft* Ship = Sector->GetSectorShips()[ShipIndex];
		FLOGV("AFlareGame::ActivateSector : Found ship %s", *Ship->GetImmatriculation().ToString());
		if (Ship->GetCompany()->GetPlayerHostility()  == EFlareHostility::Owned)
		{
			PlayerHasShip = true;
			break;
		}
	}

	// Planetarium & sector setup
	FLOGV("AFlareGame::ActivateSector : PlayerHasShip = %d", PlayerHasShip);
	if (PlayerHasShip)
	{
		// Create the new sector
		ActiveSector = NewObject<UFlareSector>(this, UFlareSector::StaticClass());
		FFlareSectorSave* SectorData = Sector->Save();
		if ((SectorData->LocalTime / UFlareGameTools::SECONDS_IN_DAY)  < GetGameWorld()->GetDate())
		{
			// TODO Find time with light
			SectorData->LocalTime = GetGameWorld()->GetDate() * UFlareGameTools::SECONDS_IN_DAY;
		}

		// Load and setup the sector
		Planetarium->ResetTime();
		Planetarium->SkipNight(UFlareGameTools::SECONDS_IN_DAY);
		ActiveSector->Load(Sector);
		DebrisFieldSystem->Setup(this, Sector);

		GetPC()->OnSectorActivated(ActiveSector);
	}
	GetQuestManager()->OnSectorActivation(Sector);
}
示例#16
0
void        FishAI::OnProcess()
{
	int ret = 0;
	if(!this->WaitFor(FWC_FISH_AI_START, "FWC_FISH_AI_START", 0))
	{
		//如果是用户触发钓鱼的话, 不发出第一个钓鱼封包
		ret = this->GetErrorCode();
	}
	if(!m_IsStop)
	{
		GetThreadManager()->AddGUIMessage(GBText("开始自动钓鱼!"));
	}
	else
	{
		return;
	}
    m_ActiveTick = GetTickCount();
    this->SetActive(1);
	int failTime = 0;
    while(this->GetActive())
	{
		if(ret != FEC_USER_USE_SKILL)
		{
			SendStartFish();
		}
		ret = 0;
		if(!this->WaitFor(FWC_FISH_HOOK, "FWC_FISH_HOOK"))
		{
			if(failTime > 3)
			{
				//3次失败强制中断
				this->SetActive(0);
			}
			if(this->GetErrorCode() == FEC_SPELL_FAIL)
			{
				this->FiberSleep(2000);
				failTime++;
			}
			continue;
		}
		failTime = 0;
        uint64 guid = GetGameWorld()->GetDataGUID("self/fish/fishobjl", "self/fish/fishobjh");
        GetGameWorld()->GetPackSender()->SendUseGameObject(guid);
        GetGameWorld()->GetPackSender()->SendReportUseGameObject(guid);
        if(!this->WaitFor(FWC_WAIT_LOOT, "FWC_WAIT_LOOT"))
            continue;
        for(int i=0; i<GetGameWorld()->GetDataInt("self/loot/count"); i++)
        {
            int itemid = GetGameWorld()->GetDataInt(FormatStr("self/loot/items/%d/itemid", i));
			int itemcount = GetGameWorld()->GetDataInt(FormatStr("self/loot/items/%d/count", i));
			int itemIndex = GetGameWorld()->GetDataInt(FormatStr("self/loot/items/%d/index", i));
//            String name = GetGameWorld()->GetItemNameByID(itemid);
            if(GetGameWorld()->FindItemInPickupList(itemid))
			{
    	        String key = FormatStr("fish_no_pick/%d", itemid);
				GetGameWorld()->SetData(key, GetGameWorld()->GetDataInt(key) + itemcount);
                continue;
            }

			String key = FormatStr("fish_results/%d", itemid);
            GetGameWorld()->SetData(key, GetGameWorld()->GetDataInt(key) + itemcount);
            GetGameWorld()->GetPackSender()->SendAutoStoreLootItem(itemIndex);
        }
		GetGameWorld()->RefreshFishResult();
//        this->WaitFor(FWC_WAIT_LOOT_PICK, "FWC_WAIT_LOOT_PICK");
	}
	if(!m_IsStop)
	{
		GetThreadManager()->AddGUIMessage(GBText("结束自动钓鱼!"));
	}
}
示例#17
0
void __fastcall TWOWFisherMain::miClearFishFilterClick(TObject *Sender)
{
	GetGameWorld()->ClearItemPickupList();
	this->Refresh();
}
示例#18
0
void __fastcall TWOWFisherMain::miDeleteFishFiterClick(TObject *Sender)
{
	GetGameWorld()->DeleteItemPickupList(lvFishFilter->ItemIndex);
	this->Refresh();
}
示例#19
0
void __fastcall TWOWFisherMain::lvFishFilterData(TObject *Sender, TListItem *Item)
{
	DWORD itemID = GetGameWorld()->GetItemPickupListAt(Item->Index);
	Item->Caption = GetGameWorld()->GetItemNameByID(itemID);
}