int g_community_goodwill(LPCSTR _community, int _entity_id)
 {
	 CHARACTER_COMMUNITY c;
	 c.set					(_community);

 	return RELATION_REGISTRY().GetCommunityGoodwill(c.index(), u16(_entity_id));
 }
void CScriptGameObject::SetCommunityGoodwill_obj( LPCSTR community, int goodwill )
{
	CInventoryOwner* pInventoryOwner = smart_cast<CInventoryOwner*>(&object());

	if (!pInventoryOwner) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"SetCommunityGoodwill available only for InventoryOwner");
		return;
	}
	CHARACTER_COMMUNITY c;
	c.set( community );

	RELATION_REGISTRY().SetCommunityGoodwill( c.index(), pInventoryOwner->object_id(), goodwill );
}
void CScriptGameObject::SetCharacterCommunity	(LPCSTR comm, int squad, int group)
{
	CInventoryOwner*	pInventoryOwner = smart_cast<CInventoryOwner*>(&object());
	CEntity*			entity			= smart_cast<CEntity*>(&object());

	if (!pInventoryOwner || !entity) {
		ai().script_engine().script_log		(ScriptStorage::eLuaMessageTypeError,"SetCharacterCommunity available only for InventoryOwner");
		return;
	}
	CHARACTER_COMMUNITY	community;
	community.set(comm);
	pInventoryOwner->SetCommunity(community.index());
	entity->ChangeTeam(community.team(), squad, group);
}
示例#4
0
void	CUIActorInfoWnd::FillReputationDetails(CUIXml* xml, LPCSTR path)
{
	XML_NODE* _list_node					= xml->NavigateToNode	("relation_communities_list",0);
	int cnt = xml->GetNodesNum				("relation_communities_list",0,"r");

	CHARACTER_COMMUNITY						comm;


	CHARACTER_REPUTATION					rep_actor, rep_neutral;
	rep_actor.set							(Actor()->Reputation());
	rep_neutral.set							(NEUTAL_REPUTATION);

	CHARACTER_GOODWILL d_neutral			= CHARACTER_REPUTATION::relation(rep_actor.index(), rep_neutral.index());


	string64 buff;
	for(int i=0;i<cnt;++i)
	{
		CUIActorStaticticDetail* itm		= xr_new<CUIActorStaticticDetail>();
		itm->Init							(xml, path, 0);
		comm.set							(xml->Read(_list_node,"r",i,"unknown_community"));
		itm->m_text1->SetTextST				(*(comm.id()));
		
		CHARACTER_GOODWILL	gw				= RELATION_REGISTRY().GetCommunityGoodwill(comm.index(), Actor()->ID());
		gw									+= CHARACTER_COMMUNITY::relation(Actor()->Community(),comm.index());
		gw									+= d_neutral;

		itm->m_text2->SetTextST				(InventoryUtilities::GetGoodwillAsText(gw));
		itm->m_text2->SetTextColor			(InventoryUtilities::GetGoodwillColor(gw));

		sprintf_s							(buff,"%d", gw);
		itm->m_text3->SetTextST				(buff);

		UIDetailList->AddWindow				(itm, true);
	}
}
void g_change_community_goodwill(LPCSTR _community, int _entity_id, int val)
{
	 CHARACTER_COMMUNITY	c;
	 c.set					(_community);
	RELATION_REGISTRY().ChangeCommunityGoodwill(c.index(), u16(_entity_id), val);
}