Example #1
0
	//--------------------------------------------------------------------------------
	std::string Serializer::ReadLevel()
	{
		LoadFirstItem();
		
		std::string levelscript;

		do {
			if(CheckAttribute("type", "gameobject") || CheckAttribute("type", "archetype"))
				g_FACTORY->Create(*this, GetElementName());
			else if(CheckAttribute("type", "script"))
				levelscript = GetAttributeString("name");
		} while(NextNode());

		return levelscript;
	}
Example #2
0
void Substance::RMove(const int x, const int y)
{
	if (CheckAttribute(GEAttribute::UserLock)) return;

	m_pos.x += x;
	m_pos.y += y;
}
Example #3
0
void CalculateInfoData()
{
	int i,cn,crewQ;
	ref mchref,chref;

	crewQ = 0;
	mchref = GetMainCharacter();
	for(i=0; i<4; i++)
	{
		cn = GetCompanionIndex(mchref,i);
		if( cn>=0 && GetRemovable(&Characters[cn]) )
		{
			chref = GetCharacter(cn);
			crewQ += GetCrewQuantity(chref);
		}
	}

	int nLeaderShip = GetSummonSkillFromName(mchref,SKILL_LEADERSHIP);
	nPaymentQ = 5 + crewQ*(16-nLeaderShip);
	if( CheckAttribute(mchref,"CrewPayment") ) {
		nPaymentQ += makeint( stf(mchref.CrewPayment)*(11.0-SKILL_LEADERSHIP)/10.0 );
	}

	nMoraleDecreaseQ = 30-nLeaderShip;
	if( CheckCharacterPerk(mchref,"IronWill") ) nMoraleDecreaseQ /= 2;

	CreateString(true,"payment",""+nPaymentQ,FONT_NORMAL,COLOR_NORMAL,320,258,SCRIPT_ALIGN_CENTER,1.0);

	if( sti(mchref.Money) < nPaymentQ )
	{
		SetSelectable("B_OK",false);
		SetCurrentNode("B_CANCEL");
	}
}
Example #4
0
void Substance::Draw(const Graphics& g) const
{
	//描画状態でない場合、帰る
	if (!CheckAttribute(GEAttribute::Visible)) return;

	D3DXMATRIX matWorld; //これをメンバにすれば省略できるがさてさて
	D3DXMatrixIdentity(&matWorld);
	//移動
	//ここからピクセル座標(int)よりスクリーン座標(float)へ変換をする
	matWorld._41 = static_cast<float>(m_pos.x);
	matWorld._42 = static_cast<float>(m_pos.y);
	//回転
	float radian = m_angle * M_PI / 180;
	matWorld._11 = std::cosf(radian);
	matWorld._12 = std::sinf(radian);
	matWorld._21 = -std::sinf(radian);
	matWorld._22 = std::cosf(radian);

	//値をセット
	g.GetSprite()->SetTransform(&matWorld);

	g.DrawSprite(m_idea->GetTexture()->GetTexture(),
		Vec2<float>( static_cast<float>(m_idea->GetDrawBase().x),static_cast<float>(m_idea->GetDrawBase().y) ),
		m_alpha
		);
}
Example #5
0
void SkipSailorPayment()
{
	ref mchref = GetMainCharacter();
	int morale = 45;
	if( CheckAttribute(mchref,"Ship.Crew.Morale") ) morale = sti(mchref.Ship.Crew.Morale);
	morale -= nMoraleDecreaseQ;
	if(morale<0)	morale = 0;

	mchref.CrewPayment = nPaymentQ;

	int cn;
	for(int i=0; i<4; i++)
	{
		cn = GetCompanionIndex(mchref,i);
		if(cn>=0)
		{
			Characters[cn].Ship.Crew.Morale = morale;
		}
	}

	if(morale<MORALE_NORMAL)
	{
		if(morale<=I_MIN_MORALE) {
			PostEvent("ievent_GameOver",1,"s","mutiny");
		}
	}
}
Example #6
0
void CheckAREA( TidyDocImpl* doc, Node *node )
{
    Bool HasAlt = no;
    Bool HasHref = no;
    AttVal *attval;

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        const Attribute* dict = CheckAttribute( doc, node, attval );
        if ( dict )
        {
          if ( dict->id == TidyAttr_ALT )
              HasAlt = yes;
          else if ( dict->id == TidyAttr_HREF )
              HasHref = yes;
        }
    }

    if ( !HasAlt )
    {
        if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 )
        {
            doc->badAccess |= MISSING_LINK_ALT;
            ReportMissingAttr( doc, node, "alt" );
        }
    }

    if ( !HasHref )
        ReportMissingAttr( doc, node, "href" );
}
Example #7
0
void CheckHTML( TidyDocImpl* doc, Node *node )
{
    AttVal *attval;
    AttVal *xmlns;

    xmlns = GetAttrByName(node, "xmlns");

    if ( xmlns != null && tmbstrcmp(xmlns->value, XHTML_NAMESPACE) == 0 )
    {
        Bool htmlOut = cfgBool( doc, TidyHtmlOut );
        doc->lexer->isvoyager = yes;                  /* Unless plain HTML */
        SetOptionBool( doc, TidyXhtmlOut, !htmlOut ); /* is specified, output*/
        SetOptionBool( doc, TidyXmlOut, !htmlOut );   /* will be XHTML. */

        /* adjust other config options, just as in config.c */
        if ( !htmlOut )
        {
            SetOptionBool( doc, TidyUpperCaseTags, no );
            SetOptionBool( doc, TidyUpperCaseAttrs, no );
        }
    }

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        CheckAttribute( doc, node, attval );
    }
}
Example #8
0
 void
 Expressions::CheckAttribute(const std::string& name, bool result, const std::string& value, std::vector<std::string>& validValues)
 {
   CheckAttribute(name, result);
   for (unsigned int i= 0; i < validValues.size(); i++)
   {
     if (value == validValues[i])
       return;
   }
   throw CoreException("Wrong attribute value", value);
 }
Example #9
0
void ProcessCancelExit()
{
	interfaceResultCommand = RC_INTERFACE_CHARACTER_EXIT;
	if( CheckAttribute(&InterfaceStates,"InstantExit") && sti(InterfaceStates.InstantExit)==true )
	{
		CharInterfaceExit(true);
	}
	else
	{
		PostEvent("LaunchIAfterFrame",1,"sl", "I_SELECTMENU", 1);
		CharInterfaceExit(false);
	}
}
Example #10
0
void CheckIMG( TidyDocImpl* doc, Node *node )
{
    Bool HasAlt = no;
    Bool HasSrc = no;
    Bool HasUseMap = no;
    Bool HasIsMap = no;
    Bool HasDataFld = no;

    AttVal *attval;
    for ( attval = node->attributes; attval != null; attval = attval->next )
    {
        const Attribute* dict = CheckAttribute( doc, node, attval );
        if ( dict )
        {
            TidyAttrId id = dict->id;
            if ( id == TidyAttr_ALT )
                HasAlt = yes;
            else if ( id == TidyAttr_SRC )
                HasSrc = yes;
            else if ( id == TidyAttr_USEMAP )
                HasUseMap = yes;
            else if ( id == TidyAttr_ISMAP )
                HasIsMap = yes;
            else if ( id == TidyAttr_DATAFLD )
                HasDataFld = yes;
            else if ( id == TidyAttr_WIDTH || id == TidyAttr_HEIGHT )
                ConstrainVersion( doc, ~VERS_HTML20 );
        }
    }

    if ( !HasAlt )
    {
        if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 )
        {
            doc->badAccess |= MISSING_IMAGE_ALT;
            ReportMissingAttr( doc, node, "alt" );
        }
  
        if ( cfgStr(doc, TidyAltText) )
            AddAttribute( doc, node, "alt", cfgStr(doc, TidyAltText) );
    }

    if ( !HasSrc && !HasDataFld )
        ReportMissingAttr( doc, node, "src" );

    if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 )
    {
        if ( HasIsMap && !HasUseMap )
            ReportMissingAttr( doc, node, "ismap" );
    }
}
Example #11
0
bool LAi_tmpl_follow_InitTemplate(aref chr)
{
	SendMessage(&chr, "lsl", MSG_CHARACTER_EX_MSG, "LockFightMode", false);
	CharacterPlayAction(chr, "");
	bool isNew = false;
	if(CheckAttribute(chr, "chr_ai.tmpl"))
	{
		if(chr.chr_ai.tmpl != LAI_TMPL_FOLLOW) isNew = true;
	}else{
		isNew = true;
	}
	if(isNew)
	{
		DeleteAttribute(chr, "chr_ai.tmpl");
		chr.chr_ai.tmpl = LAI_TMPL_FOLLOW;
		chr.chr_ai.tmpl.follow = "";
		chr.chr_ai.tmpl.state = "wait";
		chr.chr_ai.tmpl.time = "0";
		chr.chr_ai.tmpl.wait = "0";
		chr.chr_ai.tmpl.timeout = "-1";
		if(LAi_IsInitedAI) SetCharacterTask_Stay(chr);
	}else{
		chr.chr_ai.tmpl.wait = "0";
		if(!CheckAttribute(chr, "chr_ai.tmpl.state")) chr.chr_ai.tmpl.state = "wait";
		if(chr.chr_ai.tmpl.state == "falure") chr.chr_ai.tmpl.state = "wait";
		if(!CheckAttribute(chr, "chr_ai.tmpl.time")) chr.chr_ai.tmpl.time = "0";
		if(!CheckAttribute(chr, "chr_ai.tmpl.timeout")) chr.chr_ai.tmpl.timeout = "-1";
		if(!CheckAttribute(chr, "chr_ai.tmpl.follow"))
		{
			chr.chr_ai.tmpl.follow = "";
			chr.chr_ai.tmpl.state = "wait";
		}else{
			if(chr.chr_ai.tmpl.follow == "") chr.chr_ai.tmpl.state = "wait";
		}
		LAi_tmpl_follow_updatetemplate(chr);
	}
	return true;
}
Example #12
0
void IDoExit(int exitCode)
{
	DelEventHandler("InterfaceBreak","ProcessExitCancel");
	DelEventHandler("exitCancel","ProcessExitCancel");
	interfaceResultCommand = exitCode;
	if( CheckAttribute(&InterfaceStates,"InstantExit") && sti(InterfaceStates.InstantExit)==true )
	{
		EndCancelInterface(true);
	}
	else
	{
		PostEvent("LaunchIAfterFrame",1,"sl", "I_SELECTMENU", 1);
		EndCancelInterface(false);
	}
}
Example #13
0
void CheckTABLE( TidyDocImpl* doc, Node *node )
{
    Bool HasSummary = no;
    AttVal *attval;

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        const Attribute* dict = CheckAttribute( doc, node, attval );
        if ( dict && dict->id == TidyAttr_SUMMARY )
            HasSummary = yes;
    }

    /* suppress warning for missing summary for HTML 2.0 and HTML 3.2 */
    if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 )
    {
        Lexer* lexer = doc->lexer;
        if ( !HasSummary 
             && lexer->doctype != VERS_HTML20
             && lexer->doctype != VERS_HTML32 )
        {
            doc->badAccess |= MISSING_SUMMARY;
            ReportMissingAttr( doc, node, "summary");
        }
    }

    /* convert <table border> to <table border="1"> */
    if ( cfgBool(doc, TidyXmlOut) && (attval = GetAttrByName(node, "border")) )
    {
        if (attval->value == null)
            attval->value = tmbstrdup("1");
    }

    /* <table height="..."> is proprietary */
    if ( attval = GetAttrByName(node, "height") )
    {
        ReportAttrError( doc, node, attval, PROPRIETARY_ATTRIBUTE );
        ConstrainVersion( doc, VERS_PROPRIETARY );
    }
}
Example #14
0
//Инициализация
void LAi_type_guardian_Init(aref chr)
{
	DeleteAttribute(chr, "location.follower");
	bool isNew = false;
	if(CheckAttribute(chr, "chr_ai.type") == false)
	{
		isNew = true;
	}else{
		if(chr.chr_ai.type != LAI_TYPE_GUARDIAN) isNew = true;
	}
	if(isNew == true)
	{
		//Новый тип
		DeleteAttribute(chr, "chr_ai.type");
		chr.chr_ai.type = LAI_TYPE_GUARDIAN;
		chr.chr_ai.type.enemy = "";
		chr.chr_ai.type.etime = "0";
		chr.chr_ai.type.wait = "";
		//Установим шаблон стояния
		LAi_tmpl_stay_InitTemplate(chr);
	}else{
		//Востанавливаем состояние
		if(chr.chr_ai.type.wait == "attack")
		{
			LAi_type_guardian_CmdAttack(chr);
		}else{
			if(chr.chr_ai.type.wait == "return")
			{
				LAi_type_guardian_Return(chr);
			}
		}
	}
	//Установим анимацию персонажу
	LAi_SetDefaultStayAnimation(chr);
	SendMessage(&chr, "lsl", MSG_CHARACTER_EX_MSG, "SetFightWOWeapon", false);
	//Сохраним адрес как точку охраны
	chr.chr_ai.type.group = chr.location.group;
	chr.chr_ai.type.locator = chr.location.locator;
}
Example #15
0
bool textureAtlas::load(const std::string &path, bool smooth)
{
    _log::out("Loading texture atlas : %s\n", path.c_str());
    XMLDocument document;

    if(document.LoadFile(path.c_str()))
        return 0;
    free();

    XMLElement *element = document.FirstChildElement("data");
    uint elCount = 0;
    element->QueryAttribute("size", &elCount);
    elements.reserve(elCount);

    if(!texture::load(path.substr(0,path.rfind('/')+1)+element->Attribute("source"), smooth))
        return 0;
    parameteri(GL_TEXTURE_WRAP_S, GL_CLAMP);
    parameteri(GL_TEXTURE_WRAP_T, GL_CLAMP);
    element = element->FirstChildElement("sprite");

    for(int i = 0;element; i++, element = element->NextSiblingElement())
    {
        textureAtlasNode temp;
        temp.angle = 0;
        temp.scale = vec2f(1);
        temp.color = rgba(1);


        CheckAttribute("x", &temp.pos.x, element);
        CheckAttribute("y", &temp.pos.y, element);
        CheckAttribute("w", &temp.size.x, element);
        CheckAttribute("h", &temp.size.y, element);
        CheckAttribute("pX", &temp.center.x, element);
        CheckAttribute("pY", &temp.center.y, element);

        const char *name = element->Attribute("n");
        if(name)
            temp.name = name;
        else _log::out("[WARNING] Can't find attribute \"n\"\n");

        temp.size += vec2f(1);
        elements.push_back(temp);
    }
    _log::out("Elements count: %d\n", elements.size());
    return 1;
}
Example #16
0
bool ProcessConfigFile (RFile aConfigFile,CConsoleBase* iConsole, LDDConfigPtr * LDDPtrPtr)
	{
	TUSB_PRINT ("Processing Configuration File");
	OstTrace0 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS, "Processing Configuration File");

	TBuf8<100> configBuf;
	TBuf<101> stringBuf;
	bool done = false;
	bool error = false;
	TInt rStatus;
	XMLState state = EEmpty;
	TChar nextChar(' ');
	TChar lastChar(' ');
	TBuf<50> keyString;
	TBuf<50> endkeyString;
	TBuf<50> attributeString;
	TBuf<50> valueString;
	TInt level = -1;
	TInt levelKeys[KMaxXMLNesting+1];

	* LDDPtrPtr = NULL;
	ConfigPtrsPtr cpPtr = new ConfigPtrs (LDDPtrPtr);

	while (!done && !error)
		{
		rStatus = aConfigFile.Read((TDes8&)configBuf);
		if (rStatus != KErrNone)
			{
			error = true;
			TUSB_PRINT1("Config file error %d", rStatus);
			OstTrace1(TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP01, "Config file error %d", rStatus);
			}
		else
			{
			if (configBuf.Length() == 0)
				{
				done = true;
				}
			else
				{
				stringBuf.Copy(configBuf);
				for (TInt i = 0; i < stringBuf.Length() && !error; i++)
					{
					lastChar = nextChar;
					nextChar = stringBuf[i];
					if (((nextChar == '<') && !((state == EEmpty) || (state == EValue))) ||
						((nextChar == '>') && ((state == EEmpty) || (state == EValue))) ||
						((nextChar == '/') && (lastChar != '<')))
						{
						error = true;
						TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
						OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP02, "Config File Syntax Error at index %d of %S",i,stringBuf);
						}
					switch (state)
						{
						case EEmpty:
							if (nextChar == '<')
								{
								state = EStartKey;
								}
							else
								if (!nextChar.IsSpace())
									{
									error = true;
									TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
									OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP03, "Config File Syntax Error at index %d of %S",i,stringBuf);
									}
							break;

						case EStartKey:
							if (nextChar == '/')
								{
								state = EEndKey;
								endkeyString.SetLength(0);
								}
							else
								{
								if (nextChar == '>')
									{
									level++;
									if (level > KMaxXMLNesting)
										{
										error = true;
										TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ());
										OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP04, "Config File Too Many levels %S",stringBuf);
										}
									else
										{
										levelKeys[level] = CheckXmlKey (keyString,level);
										if (levelKeys[level] < 0)
											{
											error = true;
											TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ());
											OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP05, "Invalid XML key %S",keyString);
											}
										else
											{
											if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString))
												{
												state = EValue;
												TUSB_VERBOSE_PRINT2 ("Start key: %s level %d",keyString.PtrZ(),level);
												if(gVerbose)
												    {
												    OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP06, "Start key: %S level %d",keyString,level);
												    }
												}
											else
												{
												error = true;
												TUSB_PRINT1 ("No attribute for XML key %s",keyString.PtrZ());
												OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP07, "No attribute for XML key %S",keyString);
												}
											}
										}
									}
								else
									{
									if (lastChar == '<')
										{
										keyString.SetLength(0);
										valueString.SetLength(0);
										attributeString.SetLength(0);
										if (nextChar.IsSpace())
											{
											error = true;
											TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
											OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP08, "Config File Syntax Error at index %d of %S",i,stringBuf);
											}
										}
									if (nextChar.IsSpace())
										{
										state = EAttribute;
										}
									else
										{
										keyString.Append(nextChar);
										}
									}
								}
							break;

						case EEndKey:
							if (nextChar == '>')
								{
								if (levelKeys[level] != CheckXmlKey (endkeyString,level))
									{
									error = true;
									TUSB_PRINT1 ("Invalid XML end key %s",endkeyString.PtrZ());
									OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP09, "Invalid XML end key %S",endkeyString);
									}
								else
									{
									if (CheckValue(iConsole,cpPtr,levelKeys[level],valueString))
										{
										state = EEmpty;
										TUSB_VERBOSE_PRINT2 ("End Key: %s value %s",endkeyString.PtrZ(),valueString.PtrZ());
										if(gVerbose)
										    {
										    OstTraceExt2 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP10, "End Key: %S value %S",endkeyString,valueString);
										    }
										level--;
										valueString.SetLength(0);
										}
									else
										{
										error = true;
										TUSB_PRINT2 ("Incorrect value string %s for XML key %s",valueString.PtrZ(),endkeyString.PtrZ());
										OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP11, "Incorrect value string %S for XML key %S",valueString,endkeyString);
										}
									}
								}
							if (nextChar.IsSpace())
								{
									error = true;
									TUSB_PRINT2 ("Config File Syntax Error at index %d of %s",i,stringBuf.PtrZ());
									OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP12, "Config File Syntax Error at index %d of %S",i,stringBuf);
								}
							else
								{
								endkeyString.Append(nextChar);
								}
							break;

						case EAttribute:
							if (nextChar == '>')
								{
								level++;
								if (level > KMaxXMLNesting)
									{
									error = true;
									TUSB_PRINT1 ("Config File Too Many levels %s",stringBuf.PtrZ());
									OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP13, "Config File Too Many levels %s",stringBuf);
									}
								else
									{
									levelKeys[level] = CheckXmlKey (keyString,level);
									if (levelKeys[level] < 0)
										{
										error = true;
										TUSB_PRINT1 ("Invalid XML key %s",keyString.PtrZ());
										OstTraceExt1 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP14, "Invalid XML key %s",keyString);
										}
									else
										{
										if (CheckAttribute(iConsole,cpPtr,levelKeys[level],attributeString))
											{
											state = EValue;
											TUSB_VERBOSE_PRINT3 ("Start key: %s level %d attribute %s",keyString.PtrZ(),level,attributeString.PtrZ());
											if(gVerbose)
											    {
											    OstTraceExt3 (TRACE_VERBOSE, CONFIGPTRS_CONFIGPTRS_DUP15, "Start key: %S level %d attribute %S",keyString,level,attributeString);
											    }
											}
										else
											{
											error = true;
											TUSB_PRINT2 ("Incorrect attribute %s for XML key %s",attributeString.PtrZ(),keyString.PtrZ());
											OstTraceExt2 (TRACE_NORMAL, CONFIGPTRS_CONFIGPTRS_DUP16, "Incorrect attribute %s for XML key %s",attributeString,keyString);
											}
										}
									}
								}
							else
								{
								attributeString.Append(nextChar);
								}
							break;

						case EValue:
							if (nextChar == '<')
								{
								state = EStartKey;
								}
							else
								{
								// Don't add any leading spaces
								if (!nextChar.IsSpace() || valueString.Length() != 0)
									{
									valueString.Append(nextChar);
									}
								}
							break;
						}
					}
				}
			}
		}

	delete cpPtr;

	return !error;
	}
Example #17
0
//左上座標で位置を指定
void Substance::SetPosofULCorner(const int x, const int y)
{
	if (CheckAttribute(GEAttribute::UserLock)) return;
	m_pos.x = x + m_idea->GetWidth()/2;
	m_pos.y = y + m_idea->GetHeight()/2;
}
Example #18
0
// check attack task for Group
void AIAttack_CheckTask(string sGroupID)
{
	ref rG1 = Group_GetGroupByID(sGroupID);
	ref rG2 = Group_GetGroupByID(rG1.Task.Target);

	string sGroupType1 = Group_GetTypeR(rG1);

	ref rCharacter1 = Group_GetGroupCommanderR(rG1);

	// skip if group is player group
	if (sGroupID == PLAYER_GROUP) { return; }
	
	// if group task is lock, check for task complete, if not - continue task
	float fAng = frnd() * PIm2;
	if (Group_isDeadR(rG2))
	{
		switch (sGroupType1)
		{
			case "trade":
				Group_SetTaskMove(sGroupID, stf(rG1.Task.Target.Pos.x), stf(rG1.Task.Target.Pos.z));
			break;
			case "war":
				Group_SetTaskMove(sGroupID, 10000.0 * sin(fAng) , 10000.0 * cos(fAng));
			break;
			case "pirate":
				Group_SetTaskMove(sGroupID, 10000.0 * sin(fAng) , 10000.0 * cos(fAng));
			break;
		}
		// find new task
		return;
	}

	if (!Group_isTaskLockR(rG1))
	{
		float fHP1 = Group_GetPowerHP_R(rG1);
		float fHP2 = Group_GetPowerHP_R(rG2);
		float fAHP1 = Group_GetAttackHPDistance_R(rG1, 300.0);

		float fAHPRatio1 = fHP1 / (fAHP1 + 0.0001);
		float fHPRatio1 = fHP1 / (fHP2 + 0.0001);

		float fLeadership = MakeFloat(GetSummonSkillFromName(rCharacter1, SKILL_LEADERSHIP)) / SKILL_MAX;

		float fTmp = fAHPRatio1;// * Clampf(fLeadership + 0.01);

		switch (AIAttack_SelectTask(sGroupType1, fTmp))
		{
			case AITASK_RUNAWAY:
				Group_SetTaskRunaway(sGroupID);
				return;
			break;
		}
	}

	// check attack task for dead targets
	int iIndex = 0;

	int iCharactersNum2 = Group_GetCharactersNumR(rG2);
	
	// find targets for rG1
	int i = 0;
	while (true)
	{
		int iCharacterIndex = Group_GetCharacterIndexR(rG1, i); i++;
		if (iCharacterIndex < 0) { break; }
		ref rCharacter = GetCharacter(iCharacterIndex);
		if (LAi_IsDead(rCharacter)) { continue; }
		if (CheckAttribute(rCharacter, "SeaAI.Task"))
		{
			if (sti(rCharacter.SeaAI.Task) != AITASK_ATTACK) { continue; }
			if (!LAi_IsDead(&Characters[sti(rCharacter.SeaAI.Task.Target)])) { continue; }
		}

		int iCharacterVictim = -1;
		while (iCharacterVictim < 0)
		{
			iCharacterVictim = Group_GetCharacterIndexR(rG2, iIndex); 
			if (iCharacterVictim < 0) { iIndex = 0; continue; }
			if (LAi_IsDead(&Characters[iCharacterVictim])) { iCharacterVictim = -1; }
			iIndex++;
		}
    
		Ship_SetTaskAttack(SECONDARY_TASK, iCharacterIndex, iCharacterVictim);
	}		
}      	
Example #19
0
	HRESULT BMaxObject::Draw(SceneState * sceneState)
	{
		if (!m_pAnimatedMesh)
			return E_FAIL;
		if (GetPrimaryTechniqueHandle() < 0)
		{
			// try loading the asset if it has not been done before. 
			m_pAnimatedMesh->LoadAsset();
			if (m_pAnimatedMesh->IsLoaded())
			{
				SetPrimaryTechniqueHandle(m_pAnimatedMesh->GetPrimaryTechniqueHandle());
				UpdateGeometry();
			}
			return E_FAIL;
		}

		if (!CGlobals::GetEffectManager()->IsCurrentEffectValid())
		{
			return E_FAIL;
		}
		sceneState->SetCurrentSceneObject(this);

		int nIndex = (sceneState && sceneState->IsLODEnabled()) ?
			m_pAnimatedMesh->GetLodIndex(sceneState->GetCameraToCurObjectDistance()/*, GetScaling()*/) : 0;
		CParaXModel* pModel = m_pAnimatedMesh->GetModel(nIndex);
		if (pModel == NULL)
			return E_FAIL;
		
		int nRestoreSpecialTextures = -1;
		for (auto const & tex : mReplaceTextures)
		{
			if(pModel->specialTextures[tex.first] >= 0)
				pModel->replaceTextures[pModel->specialTextures[tex.first]] = tex.second;
			else
			{
				// if there is only one texture, we will force replace it even there is no special replaceable id redefined.
				if (pModel->GetObjectNum().nTextures <= 1 && nRestoreSpecialTextures<0)
				{
					nRestoreSpecialTextures = tex.first;
					pModel->specialTextures[tex.first] = tex.first;
					pModel->replaceTextures[pModel->specialTextures[tex.first]] = tex.second;
					break;
				}
			}
		}

		sceneState->SetCurrentSceneObject(this);
		SetFrameNumber(sceneState->m_nRenderCount);
		// get world transform matrix
		Matrix4 mxWorld;
		GetRenderMatrix(mxWorld);


		RenderDevicePtr pd3dDevice = sceneState->m_pd3dDevice;
		EffectManager* pEffectManager = CGlobals::GetEffectManager();
		pEffectManager->applyObjectLocalLighting(this);

		CEffectFile* pEffectFile = pEffectManager->GetCurrentEffectFile();
		CGlobals::GetWorldMatrixStack().push(mxWorld);

		ApplyBlockLighting(sceneState);

		
		CApplyObjectLevelParamBlock p(GetEffectParamBlock());

		if (pEffectFile == 0)
		{
			// TODO: Fixed Function. 
		}
		else
		{
			bool bUsePointTextureFilter = false;

			// apply block space lighting for object whose size is comparable to a single block size
			if (CheckAttribute(MESH_USE_LIGHT) && !(sceneState->IsShadowPass()))
			{
				BlockWorldClient* pBlockWorldClient = BlockWorldClient::GetInstance();
				if (pBlockWorldClient && pBlockWorldClient->IsInBlockWorld())
				{
					Vector3 vPos = GetPosition();
					vPos.y += 0.1f;
					Uint16x3 blockId_ws(0, 0, 0);
					BlockCommon::ConvertToBlockIndex(vPos.x, vPos.y, vPos.z, blockId_ws.x, blockId_ws.y, blockId_ws.z);
					DWORD dwPositionHash = blockId_ws.GetHashCode();
					uint8_t brightness[2];
					pBlockWorldClient->GetBlockMeshBrightness(blockId_ws, brightness, 2);
					// block light
					float fBlockLightness = Math::Max(pBlockWorldClient->GetLightBrightnessLinearFloat(brightness[0]), 0.1f);
					sceneState->GetCurrentLightStrength().y = fBlockLightness;
					// sun light
					float fSunLightness = Math::Max(pBlockWorldClient->GetLightBrightnessLinearFloat(brightness[1]), 0.1f);
					sceneState->GetCurrentLightStrength().x = fSunLightness;

					float fLightness = Math::Max(fBlockLightness, fSunLightness*pBlockWorldClient->GetSunIntensity());
					if (m_fLastBlockLight != fLightness)
					{
						float fMaxStep = (float)(sceneState->dTimeDelta*0.5f);
						if (dwPositionHash == m_dwLastBlockHash || m_dwLastBlockHash == 0)
							m_fLastBlockLight = fLightness;
						else
							Math::SmoothMoveFloat1(m_fLastBlockLight, fLightness, fMaxStep);

						fLightness = m_fLastBlockLight;
					}
					else
					{
						m_dwLastBlockHash = dwPositionHash;
					}
					sceneState->GetLocalMaterial().Ambient = (LinearColor(fLightness*0.7f, fLightness*0.7f, fLightness*0.7f, 1.f));
					sceneState->GetLocalMaterial().Diffuse = (LinearColor(fLightness*0.4f, fLightness*0.4f, fLightness*0.4f, 1.f));

					sceneState->EnableLocalMaterial(true);
					bUsePointTextureFilter = bUsePointTextureFilter || pBlockWorldClient->GetUsePointTextureFiltering();
				}
			}

			if (bUsePointTextureFilter)
			{
				pEffectManager->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
				pEffectManager->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
			}
			else
			{
				pEffectManager->SetSamplerState(0, D3DSAMP_MINFILTER, pEffectManager->GetDefaultSamplerState(0, D3DSAMP_MINFILTER));
				pEffectManager->SetSamplerState(0, D3DSAMP_MAGFILTER, pEffectManager->GetDefaultSamplerState(0, D3DSAMP_MAGFILTER));
			}

			// just a single standing animation is supported now and looped. 
			UpdateModel(sceneState);
			pModel->draw(sceneState, p.GetParamsBlock()); 
		}

		if (nRestoreSpecialTextures >= 0)
		{
			pModel->specialTextures[nRestoreSpecialTextures] = -1;
			pModel->replaceTextures[nRestoreSpecialTextures] = nullptr;
		}

		CGlobals::GetWorldMatrixStack().pop();
		return S_OK;
	}
Example #20
0
void InitInterface_R(string iniName,ref pCharacter)
{
	int i;
	curOfficer = 0;
	xi_refMainChar = pCharacter;
    xi_refCharacter = pCharacter;
	AddCharacterExp(xi_refCharacter,0);

    GameInterface.title = "titleCharacter";
    GameInterface.SkillChanger.current = 0;

    GameInterface.StatusLine.EXP.Max = CalculateExperienceFromRank(sti(xi_refCharacter.rank)+1);
    GameInterface.StatusLine.EXP.Min = CalculateExperienceFromRank(sti(xi_refCharacter.rank));
    GameInterface.StatusLine.EXP.Value = xi_refCharacter.Experience;

	if( CheckAttribute(&InterfaceStack,"CharacterView_pos") ) GameInterface.skillchanger.current = InterfaceStack.CharacterView_pos;
    SendMessage(&GameInterface,"ls",MSG_INTERFACE_INIT,iniName);

	for(i=1;i<4;i++)	{if( GetOfficersIndex(pCharacter,i)>=0 || GetCompanionIndex(pCharacter,i)>=0 ) break;}
	if(i==4)
	{
// boal -->	
//		bBeParty = false;
		bBeParty = true;
//		SetNodeUsing("LEFTCHANGE_CHARACTER",false);
//		SetNodeUsing("RIGHTCHANGE_CHARACTER",false);
// boal <--
	}
	else
	{
		bBeParty = true;
	}
	SetNodeUsing("B_SKILLUP",false);
	SetNodeUsing("B_ABILITIES",false);

    CreateString(true,"CurrentExperience","",FONT_NORMAL,COLOR_NORMAL,175,376,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(true,"NextExperience","",FONT_NORMAL,COLOR_NORMAL,175,407,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(true,"Money","",FONT_NORMAL,COLOR_MONEY,175,438,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(true,"CharacterName","",FONT_NORMAL,COLOR_NORMAL,156,48,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(true,"Reputation","",FONT_NORMAL,COLOR_NORMAL,156,80,SCRIPT_ALIGN_CENTER,1.0);
    CreateString(true,"FreeAbilitiesPoints","",FONT_BOLD_NUMBERS,COLOR_NORMAL,444,416,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"FreeSkillPoints","",FONT_BOLD_NUMBERS,COLOR_NORMAL,610,416,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"Rank","",FONT_BOLD_NUMBERS,COLOR_NORMAL,268,324,SCRIPT_ALIGN_RIGHT,1.0);

    CreateString(true,"SkillLeadership","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,46,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillFencing","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,80,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillSailing","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,114,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillAccuracy","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,148,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillCannons","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,182,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillGrappling","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,216,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillRepair","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,250,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillDefence","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,284,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillCommerce","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,318,SCRIPT_ALIGN_RIGHT,1.0);
    CreateString(true,"SkillSneak","",FONT_BOLD_NUMBERS,COLOR_NORMAL,587,352,SCRIPT_ALIGN_RIGHT,1.0);

    CreateString(true,"MaxHP","",FONT_NORMAL,COLOR_NORMAL,66,331,SCRIPT_ALIGN_LEFT,1.0);

	SetVariable();

	SetEventHandler("InterfaceBreak","ProcessCancelExit",0);
    SetEventHandler("exitCancel","ProcessCancelExit",0);
	SetEventHandler("ievnt_command","ProcessCommandExecute",0);
	SetEventHandler("frame","ProcessFrame",1);
}
Example #21
0
void ProcessDialogEvent()
{
	ref NPChar;
	
	DeleteAttribute(&Dialog,"Links");
	aref Link, NextDiag;
	makeref(NPChar,CharacterRef);
	makearef(Link, Dialog.Links);
	makearef(NextDiag, NPChar.Dialog);
	int iTest;

	string iDay, iMonth;
	iDay = environment.date.day;
	iMonth = environment.date.month;
	string lastspeak_date = iday + " " + iMonth;

	ref PChar;
	PChar = GetMainCharacter();


	switch(Dialog.CurrentNode)
	{
		// -----------------------------------Диалог первый - первая встреча
		case "First time":
			Dialog.defAni = "dialog_stay1";
			Dialog.defCam = "1";
			Dialog.defSnd = "dialogs\0\017";
			Dialog.defLinkAni = "dialog_1";
			Dialog.defLinkCam = "1";
			Dialog.defLinkSnd = "dialogs\woman\024";
			Dialog.ani = "dialog_stay2";
			Dialog.cam = "1";
			
			dialog.snd = "Voice\ARMA\ARMA001";
			dialog.text = DLG_TEXT[0];
			link.l1 = pcharrepphrase(DLG_TEXT[1], DLG_TEXT[2]);
			link.l1.go = "exit";
			
			if ((characters[GetCharacterIndex("Sabine Matton")].quest.hire != "ransom") && (characters[GetCharacterIndex("Sabine Matton")].quest.hire != "enemy_forever") && (pchar.location == "Falaise_de_Fleur_store"))
			{
				dialog.snd1 = "Voice\ARMA\ARMA002";
				dialog.snd2 = "Voice\ARMA\ARMA003";
				dialog.snd3 = "Voice\ARMA\ARMA004";
				Dialog.Text = randphrase(DLG_TEXT[3] + Address_form.Fra + DLG_TEXT[4], DLG_TEXT[5] + Address_Form.Fra + DLG_TEXT[6], DLG_TEXT[7], &dialog, dialog.snd1, dialog.snd2, dialog.snd3);
				Link.l1 = DLG_TEXT[8];
				Link.l1.go = "market"; 
				link.l2 = DLG_TEXT[9];
				link.l2.go = "exit";
				if (characters[GetCharacterIndex("Sabine Matton")].quest.hire != "was_captured_done")
				{
					link.l3 = DLG_TEXT[10];
					link.l3.go = "quests";
				}
			}
			if ((characters[GetCharacterIndex("Sabine Matton")].quest.hire == "ransom_1")&&(pchar.location == "Falaise_De_Fleur_shore")) // разговор на пляже
			{
				dialog.snd = "Voice\ARMA\ARMA005";
				dialog.text = DLG_TEXT[11] + Characters[GetCharacterIndex(DLG_TEXT[12])].name + DLG_TEXT[13];
				link.l1 = pcharrepphrase(DLG_TEXT[14], DLG_TEXT[15]);
				link.l1.go = "ransom_money";
				link.l2 = pcharrepphrase(DLG_TEXT[16], DLG_TEXT[17]);
				link.l2.go = "ransom_bad";
			}
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "enemy_forever_1")
			{
				dialog.snd = "Voice\ARMA\ARMA006";
				dialog.text = DLG_TEXT[18];
				link.l1 = pcharrepphrase(DLG_TEXT[19], DLG_TEXT[20]);
				link.l1.go = "exit";
			}
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "danielle_on_ship_1")
			{
				dialog.snd = "Voice\ARMA\ARMA007";
				dialog.text = DLG_TEXT[21];
				link.l3 = pcharrepphrase(DLG_TEXT[22], DLG_TEXT[23]);
				link.l3.go = "exit";
				link.l4 = pcharrepphrase(DLG_TEXT[24], DLG_TEXT[25]);
				link.l4.go = "danielle_daughter_1";
			}
			NextDiag.TempNode = "First time";
		break;

		case "quests":
			iTest = 0;
			dialog.snd = "Voice\ARMA\ARMA008";
			Dialog.text = DLG_TEXT[26];
			//////////////////////////////
			// Выдача квестов
			//////////////////////////////
			if (npchar.quest_begin == "100")
			{
				Link.l1 = DLG_TEXT[27];
				if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "blaze_begin_1" && makeint(pchar.reputation) > 40)
				{
					link.l1.go = "daughter";
				}
				if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire == "10000")
				{
					link.l1.go = "baldewyn";
				}
				if (npchar.quest.to_redmond_1 == "0" && !(GetNationRelation2MainCharacter(FRANCE) == RELATION_ENEMY))
				{
					link.l1.go = "node_1";
				}
				
			}
			if (CheckAttribute(pchar, "quest.iQuantityGoods"))
			{
				int iQuantityShipGoods = pchar.quest.iQuantityGoods;
				int iQuestTradeGoods = pchar.quest.iTradeGoods;
			}
			if (CheckQuestAttribute("generate_trade_quest_progress", "begin") || CheckQuestAttribute("generate_trade_quest_progress",  "failed"))
			{
				if (CheckQuestAttribute("iTradeNation", npchar.nation) &&  GetSquadronGoods(pchar, iQuestTradeGoods) >= iQuantityShipGoods)
				{
					dialog.snd = "Voice\ARMA\ARMA009";
					dialog.text = DLG_TEXT[28];
					link.l1 = DLG_TEXT[29];
					link.l1.go = "generate_quest_2";
				}
			}
			else
			{
				if (!CheckQuestAttribute("generate_trade_quest_progress", "begin"))
				{
					link.l2 = DLG_TEXT[30];
					link.l2.go = "generate_quest";
				}
			}
			
			//////////////////////////////
			// ПРИЕМ КВЕСТОВ
			//////////////////////////////
			//////////////////////////////
			// Квест балдуина Кофье
			//////////////////////////////
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "not_money" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[31], DLG_TEXT[32]);
				link.l2.go = "baldewyn_done";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "not_money_2" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[33], DLG_TEXT[34] + characters[GetCharacterIndex(DLG_TEXT[35])].name + DLG_TEXT[36]);
				link.l2.go = "baldewyn_done";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "not_money_3" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[37], DLG_TEXT[38]);
				link.l2.go = "money_1";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "money_1" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[39], DLG_TEXT[40]);
				link.l2.go = "baldewyn_work_done";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "money_4" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[41] + Characters[GetCharacterIndex(DLG_TEXT[42])].name + " " + Characters[GetCharacterIndex(DLG_TEXT[43])].lastname + DLG_TEXT[44], DLG_TEXT[45] + characters[GetCharacterIndex(DLG_TEXT[46])].name + DLG_TEXT[47]);
				link.l2.go = "baldewyn_work_done_one";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire ==  "money_2" && iTest < QUEST_COUNTER)
			{
				link.l2 = pcharrepphrase(DLG_TEXT[48], DLG_TEXT[49] + characters[GetCharacterIndex(DLG_TEXT[50])] + DLG_TEXT[51]);
				link.l2.go = "baldewyn_guard";
				iTest = iTest + 1;
			}
			//////////////////////////////
			// Конец квеста балдуина Кофье
			//////////////////////////////
			if (npchar.quest.to_redmond_1 ==  "cargo_done_1" && iTest < QUEST_COUNTER)
			{
				link.l3 = pcharrepphrase(DLG_TEXT[52], DLG_TEXT[53] + npchar.name + DLG_TEXT[54]);
				link.l3.go = "redmond_done";
				iTest = iTest + 1;
			}
			if (npchar.quest.to_redmond_1 ==  "cargo_not_done_1" && iTest < QUEST_COUNTER)
			{
				Link.l3 = pcharrepphrase(DLG_TEXT[55], DLG_TEXT[56]);
				link.l3.go = "redmond_quest";
				iTest = iTest + 1;
			}
			if (Characters[GetCharacterIndex("Thomas O'Reily")].quest.first_job == "100" && GetSquadronGoods(PChar,GOOD_SILK)>= 200 && iTest < QUEST_COUNTER)
			{	
				Link.l4 = pcharrepphrase(DLG_TEXT[57] + Characters[GetCharacterIndex(DLG_TEXT[58])].name + Characters[GetCharacterIndex(DLG_TEXT[59])].lastname + DLG_TEXT[60], characters[GetCharacterIndex(DLG_TEXT[61])].name + DLG_TEXT[62]);
				Link.l4.go = "First_job_done";
				iTest = iTest + 1;
			}
			//////////////////////////////
			// Квест про дочку Арно Маттона
			//////////////////////////////
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire ==  "almost_done_1" && iTest < QUEST_COUNTER)
			{
				link.l5 = DLG_TEXT[63];
				link.l5.go = "daughter_done";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "almost_done_ransom_1" && iTest < QUEST_COUNTER)
			{
				link.l5 = DLG_TEXT[64];
				link.l5.go = "daughter_done_1";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "almost_done_ransom_free_1" && iTest < QUEST_COUNTER)
			{
				link.l5 = pcharrepphrase(DLG_TEXT[65], DLG_TEXT[66]);
				link.l5.go = "daughter_done_1";
				iTest = iTest + 1;
			}
			if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "captured_by_blaze_1" || characters[GetCharacterIndex("Sabine Matton")].quest.hire == "captured_by_blaze_again" && iTest < QUEST_COUNTER)
			{
				Link.l5 = pcharrepphrase(DLG_TEXT[67], DLG_TEXT[68]);
				Link.l5.go = "ransom";
			}
			//////////////////////////////
			// Конец квеста про дочку Арно маттона
			//////////////////////////////
			Link.l99 = DLG_TEXT[69];
			Link.l99.go = "exit";
		break;

		case "danielle_daughter_1":
			dialog.snd = "Voice\ARMA\ARMA010";
			dialog.text = DLG_TEXT[70];
			link.l1 = pcharrepphrase(DLG_TEXT[71], DLG_TEXT[72]);
			link.l1.go = "danielle_daughter_2";
			link.l2 = pcharrepphrase(DLG_TEXT[73], DLG_TEXT[74]);
			link.l2.go = "ransom_1";
		break;

		case "danielle_daughter_2":
			dialog.snd = "Voice\ARMA\ARMA011";
			dialog.text = DLG_TEXT[75];
			link.l1 = pcharrepphrase(DLG_TEXT[76], DLG_TEXT[77]);
			link.l1.go = "danielle_daughter_3";
		break;

		case "danielle_daughter_3":
			dialog.snd = "Voice\ARMA\ARMA012";
			dialog.text = DLG_TEXT[78];
			link.l1 = pcharrepphrase(DLG_TEXT[79], DLG_TEXT[80]);
			link.l1.go = "exit";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "done";
			RemovePassenger(pchar, &characters[GetCharacterIndex("Sabine Matton")]);
			pchar.experience = makeint(pchar.experience) + 100;
		break;

		case "ransom_bad":
			dialog.snd = "Voice\ARMA\ARMA013";
			dialog.text = DLG_TEXT[81];
			link.l1 = pcharrepphrase(DLG_TEXT[82], DLG_TEXT[83]);
			link.l1.go = "exit";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "enemy_forever";
			ChangeCharacterReputation(pchar, -2);
			///////////////////////////////////////////////////////////////////////////
			// Арно уходит, а за нами начинается охотиться 1 фрегат и 2 наемных убийцы, плюс Франция становится враждебной.
			///////////////////////////////////////////////////////////////////////////
		break;

		case "ransom_money":
			dialog.snd = "Voice\ARMA\ARMA014";
			dialog.text = DLG_TEXT[84];
			link.l1 = pcharrepphrase(DLG_TEXT[85], DLG_TEXT[86]);
			link.l1.go = "ransom_money_1";
			link.l2 = pcharrepphrase(DLG_TEXT[87], DLG_TEXT[88]);
			link.l2.go = "ransom_bad";
		break;

		case "ransom_money_1":
			dialog.snd = "Voice\ARMA\ARMA015";
			dialog.text = DLG_TEXT[89];
			link.l1 = pcharrepphrase(DLG_TEXT[90], DLG_TEXT[91]);
			link.l1.go = "exit";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "was_captured_done";
			ChangeCharacterReputation(pchar, -1);
			AddMoneyToCharacter(pchar, 5000);
			RemovePassenger(pchar, Characters[GetCharacterIndex("Sabine Matton")]);
			//fading();
			ChangeCharacterAddress(&characters[GetCharacterIndex("Sabine Matton")], "shore1","citizen06"); //появление девушки.
			npchar.location	= "Falaise_de_Fleur_store";
			npchar.location.locator = "locator4";
			characters[GetCharacterIndex("Sabine Matton")].location = "none";
		break;

		case "ransom":
			dialog.snd = "Voice\ARMA\ARMA016";
			dialog.text = DLG_TEXT[92];
			link.l1 = pcharrepphrase(DLG_TEXT[93], DLG_TEXT[94]);
			link.l1.go = "ransom_1";
		break;

		case "ransom_1":
			dialog.snd = "Voice\ARMA\ARMA017";
			dialog.text = DLG_TEXT[95];
			link.l1 = pcharrepphrase(DLG_TEXT[96], DLG_TEXT[97]);
			link.l1.go = "ransom_stupid";
			link.l2 = pcharrepphrase(DLG_TEXT[98], DLG_TEXT[99]);
			link.l2.go = "ransom_2";
		break;

		case "ransom_2":
			dialog.snd = "Voice\ARMA\ARMA018";
			dialog.text = DLG_TEXT[100];
			link.l1 = pcharrepphrase(DLG_TEXT[101], DLG_TEXT[102]);
			link.l1.go = "exit";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "ransom";
			npchar.location = "shore1";
			npchar.location.locator = "citizen05";
		break;

		case "ransom_stupid":
			dialog.snd = "Voice\ARMA\ARMA019";
			dialog.text = DLG_TEXT[103];
			link.l1 = DLG_TEXT[104];
			link.l1.go = "exit";
			///////////////////////////////////////////////////////////////////////
			// Появление девушки, перезагрузка локейшена. Франция враждебна. Драка. 
			///////////////////////////////////////////////////////////////////////
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "enemy_forever";
			ChangeCharacterReputation(pchar, -1);
		break;

		case "daughter_done":
			dialog.snd = "Voice\ARMA\ARMA020";
			dialog.text = DLG_TEXT[105];
			link.l1 = pcharrepphrase(DLG_TEXT[106], DLG_TEXT[107]);
			link.l1.go = "trade_guild";
			link.l2 = pcharrepphrase(DLG_TEXT[108], DLG_TEXT[109]);
			link.l2.go = "exit";
			npchar.quest_begin = "0";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "done";
			characters[GetCharacterIndex("Sabine Matton")].quest.love = "1";
		break;

		case "daughter_done_1":
			dialog.snd = "Voice\ARMA\ARMA021";
			dialog.text = DLG_TEXT[110];
			link.l1 = pcharrepphrase(DLG_TEXT[111], DLG_TEXT[112]);
			link.l1.go = "exit";
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "was_captured_done";
			npchar.quest_begin = "0";
			npchar.skill.commerce = makeint(npchar.skill.commerce) + 2;
		break;

		////////////////////////////////////////////////
		// TRADE GUILD QUEST
		////////////////////////////////////////////////
		case "trade_guild":
			link.l1 = DLG_TEXT[113];
			link.l1.go = "exit";
		break;
		////////////////////////////////////////////////
		// END OF TRADE GUILD QUEST
		////////////////////////////////////////////////

		case "daughter":
			dialog.snd = "Voice\ARMA\ARMA022";
			dialog.text = DLG_TEXT[114];
			link.l1 = DLG_TEXT[115];
			link.l1.go = "daughter_1";
		break;

		case "daughter_1":
			dialog.snd = "Voice\ARMA\ARMA023";
			dialog.text = DLG_TEXT[116];
			link.l1 = DLG_TEXT[117];
			link.l1.go = "daughter_2";
		break;

		case "daughter_2":
			dialog.snd = "Voice\ARMA\ARMA024";
			dialog.text = DLG_TEXT[118];
			link.l1 = DLG_TEXT[119];
			link.l1.go = "daughter_3";
		break;

		case "daughter_3":
			dialog.snd = "Voice\ARMA\ARMA025";
			dialog.text = DLG_TEXT[120];
			link.l1 = DLG_TEXT[121];
			link.l1.go = "daughter_4";
		break;

		case "daughter_4":
			dialog.snd = "Voice\ARMA\ARMA026";
			dialog.text = DLG_TEXT[122];
			link.l1 = DLG_TEXT[123];
			link.l1.go = "daughter_5";
		break;

		case "daughter_5":
			dialog.snd = "Voice\ARMA\ARMA027";
			dialog.text = DLG_TEXT[124];
			link.l1 = DLG_TEXT[125];
			link.l1.go = "daughter_6";
		break;

		case "daughter_6":
			dialog.snd = "Voice\ARMA\ARMA028";
			dialog.text = DLG_TEXT[126] + Characters[GetCharacterIndex(DLG_TEXT[127])].name + " " + Characters[GetCharacterIndex(DLG_TEXT[128])].lastname + DLG_TEXT[129];
			link.l1 = DLG_TEXT[130];
			link.l1.go = "daughter_9";
			link.l2 = DLG_TEXT[131];
			link.l2.go = "daughter_7";
			link.l3 = DLG_TEXT[132];
			link.l3.go = "daughter_denied";
		break;

		case "daughter_7":
			dialog.snd = "Voice\ARMA\ARMA029";
			dialog.text = DLG_TEXT[133];
			link.l1 = DLG_TEXT[134];
			link.l1.go = "daughter_8";
			link.l2 = DLG_TEXT[135];
			link.l2.go = "daughter_denied";
		break;

		case "daughter_8":
			dialog.snd = "Voice\ARMA\ARMA030";
			dialog.text = DLG_TEXT[136];
			link.l1 = DLG_TEXT[137];
			link.l1.go = "daughter_9";
			AddMoneyToCharacter(pchar, 1500);
		break;

		case "daughter_9":
			dialog.snd = "Voice\ARMA\ARMA031";
			dialog.text = DLG_TEXT[138] + characters[GetCharacterIndex(DLG_TEXT[139])].name + " " + characters[GetCharacterIndex(DLG_TEXT[140])].lastname + DLG_TEXT[141];
			link.l1 = DLG_TEXT[142];
			link.l1.go = "daughter_10";
		break;

		case "daughter_10":
			dialog.snd = "Voice\ARMA\ARMA032";
			dialog.text = DLG_TEXT[143];
			link.l1 = DLG_TEXT[144] + pchar.ship.name + DLG_TEXT[145];
			link.l1.go = "exit";
			//////////////////////////////////
			//ADD_LETTER
			//////////////////////////////////
			characters[GetCharacterIndex("Sabine Matton")].quest.hire = "blaze_on_ship";
			npchar.quest_begin = "1";
			AddPassenger(pchar, &characters[GetCharacterIndex("Sabine Matton")], 0);
			ChangeCharacterAddress(&characters[GetCharacterIndex("Sabine Matton")], "none", "none");
		break;

		case "daughter_denied":
			dialog.snd = "Voice\ARMA\ARMA033";
			dialog.text = DLG_TEXT[146];
			link.l1 = DLG_TEXT[147];
			link.l1.go = "exit";
			link.l2 = DLG_TEXT[148];
			link.l2.go = "First time";
			characters[GetCharacterIndex("Sabine Matton")].quest = "done";
		break;

		case "baldewyn_work_done":
			AddMoneyToCharacter(pchar, -2500));
			dialog.snd = "Voice\ARMA\ARMA034";
			dialog.text = DLG_TEXT[149];
			link.l1 = pcharrepphrase(DLG_TEXT[150], DLG_TEXT[151]);
			link.l1.go = "arnaud_bad_guy";
			link.l2 = pcharrepphrase(DLG_TEXT[152], DLG_TEXT[153]);
			link.l2.go = "exit";
			link.l3 = pcharrepphrase(DLG_TEXT[154], DLG_TEXT[155]);
			link.l3.go = "First time";
			AddMoneyToCharacter(pchar, makeint(npchar.money.quest));
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "almost_done_1";
			npchar.quest_begin = "0";
			npchar.quest.money = "0";
			Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
		break;

		case "baldewyn_work_done_one":
			dialog.snd = "Voice\ARMA\ARMA035";
			dialog.text = DLG_TEXT[156];
			link.l2 = pcharrepphrase(DLG_TEXT[157], DLG_TEXT[158]);
			link.l2.go = "exit";
			link.l3 = pcharrepphrase(DLG_TEXT[159], DLG_TEXT[160]);
			link.l3.go = "First time";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "almost_done_1";
			AddMoneyToCharacter(pchar, -2000);
			Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
		break;

		case "money_1":
			dialog.snd = "Voice\ARMA\ARMA036";
			dialog.text = DLG_TEXT[161];
			link.l1 = DLG_TEXT[162];
			link.l1.go = "money_2";
			link.l2 = DLG_TEXT[163];
			link.l2.go = "arnaud_bad_guy";
		break;

		case "arnaud_bad_guy":
			dialog.snd = "Voice\ARMA\ARMA037";
			dialog.text = DLG_TEXT[164];
			link.l1 = DLG_TEXT[165];
			link.l1.go = "arnaud_bad_guy_1";
			link.l2 = DLG_TEXT[166];
			link.l2.go = "exit";
		break;

		case "arnaud_bad_guy_1":
			dialog.snd = "Voice\ARMA\ARMA038";
			dialog.text = DLG_TEXT[167];
			link.l1 = DLG_TEXT[168];
			link.l1.go = "exit";
			link.l2 = DLG_TEXT[169];
			link.l2.go = "First Time";
		break;

		case "money_2":
			dialog.snd = "Voice\ARMA\ARMA039";
			dialog.text = DLG_TEXT[170];
			link.l1 = DLG_TEXT[171];
			link.l1.go = "exit";
			link.l2 = DLG_TEXT[172];
			link.l2.go = "First time";
			AddMoneyToCharacter(pchar, makeint(npchar.money.quest));
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "money_3";
			npchar.quest_begin = "0";
			npchar.quest.money = "0";
			Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
		break;

		case "baldewyn_guard":
			dialog.snd = "Voice\ARMA\ARMA040";
			dialog.text = DLG_TEXT[173] + Address_Form.fra + DLG_TEXT[174];
			link.l1 = DLG_TEXT[175];
			link.l1.go = "exit";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "done";
			npchar.quest_begin = "0";
			npchar.quest.money = "0";
			Rumour[4].state = "active";
			characters[GetCharacterIndex("Sabine Matton")].location = "none";
		break;

		case "first_job_done":
			Characters[GetCharacterIndex("Thomas O'Reily")].quest.first_job = "complete";
			dialog.snd = "Voice\ARMA\ARMA041";
			dialog.Text = DLG_TEXT[176];
			Link.l1 = DLG_TEXT[177];
			Link.l1.go = "First_job_done_1";
		break;

		case "First_job_done_1":
			dialog.snd = "Voice\ARMA\ARMA042";
			dialog.Text = DLG_TEXT[178] + address_form.fra + DLG_TEXT[179];
			Link.l1 = DLG_TEXT[180];
			Link.l1.go = "First_job_done_2";
		break;

		case "First_job_done_2":
			RemoveCharacterGoods(PChar,GOOD_SILK, 100);
			RemoveCharacterGoods(PChar,GOOD_RUM, 100);
			RemoveCharacterGoods(PChar,GOOD_PAPRIKA, 100);
			dialog.snd = "Voice\ARMA\ARMA043";
			dialog.Text = DLG_TEXT[181] + address_form.fra + " " + PChar.name + DLG_TEXT[182];
			Link.l1 = DLG_TEXT[183];
			Link.l1.go = "exit";
		break;

		case "redmond_quest":
			dialog.snd = "Voice\ARMA\ARMA044";
			Dialog.text = DLG_TEXT[184];
			link.l1 = DLG_TEXT[185];
			link.l1.go = "redmond_not_done";
			link.l2 = DLG_TEXT[186];
			link.l2.go = "redmond_not_done_1";
		break;

		case "generate_quest":
			if (npchar.quest.trade_date != lastspeak_date)
			{
				npchar.quest.trade_date = lastspeak_date;
				//проверка враждебности нам страны торговца
				if (GetNationRelation2MainCharacter(FRANCE) == RELATION_ENEMY)
				{
					dialog.snd = "Voice\ARMA\ARMA045";
					dialog.text = DLG_TEXT[187];
					link.l1 = DLG_TEXT[188];
					link.l1.go = "exit";
				}
				else
				{
					int iTradeNation = GenerateNationTrade(FRANCE);
					if (iTradeNation < 0)
					{
						dialog.snd = "Voice\ARMA\ARMA046";
						dialog.text = DLG_TEXT[189];
						link.l1 = DLG_TEXT[190];
						link.l1.go = "exit";
					}
					else
					{
						//проверяем импорт/экспорт
						int iTradeGoods = rand(22) + 4;
						//проверяем свободное место (при этом должно вмещаться по меньшей мере 100 единиц выбранного груза
						if (GetSquadronFreeSpace(pchar, iTradeGoods) < 100)
						{
							dialog.snd = "Voice\ARMA\ARMA047";
							dialog.text = DLG_TEXT[191];
							link.l1 = DLG_TEXT[192];
							link.l1.go = "exit";
						}
						else
						{
							int iQuantityGoods = GetSquadronFreeSpace(pchar, iTradeGoods) - 20;
							int iMoney = ((iQuantityGoods *10+99)/100)*100;
							int iDaysExpired = 30;

							pchar.quest.iTradeGoods = iTradeGoods;
							pchar.quest.iQuantityGoods = iQuantityGoods;
							pchar.quest.iMoney = iMoney;
							pchar.quest.iTradeNation = iTradeNation;
							
							string sNation;

							switch (iTradeNation)
							{
								case FRANCE: sNation = FRA_COLONY; break;
								case SPAIN: sNation = SPA_COLONY; break;
								case HOLLAND: sNation = HOL_COLONY; break;
								case PORTUGAL: sNation = POR_COLONY; break;
								case ENGLAND: 
									int iColony = rand(2);
									if (iColony == 2 && CheckAttribute(Pchar, "Quest.Story_OxbayCaptured"))
									{
										iColony = rand(1);
									}
									switch (iColony)
									{
										case 0: sNation = RED_COLONY; pchar.quest.iTradeColony = "Redmond_store"; break;
										case 1: sNation = GREEN_COLONY; pchar.quest.iTradeColony = "Greenford_store"; break;
										case 2: sNation = OX_COLONY; pchar.quest.iTradeColony = "Oxbay_store"; break;
									}
								break;
							}
							dialog.snd = "Voice\ARMA\ARMA048";
							dialog.text = DLG_TEXT[193] + sNation + DLG_TEXT[194] + pchar.quest.iMoney + DLG_TEXT[195];
							link.l1 = DLG_TEXT[196];
							link.l1.go = "exit_trade";
							link.l2  = DLG_TEXT[197];
							link.l2.go = "exit";
						}
					}
				}
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA049";
				dialog.text = DLG_TEXT[198];
				link.l1 = DLG_TEXT[199];
				link.l1.go = "exit";
			}
		break;
		
		case "exit_trade":
			AddDialogExitQuest("trade_quest_open");
			NextDiag.CurrentNode = NextDiag.TempNode;
			DialogExit();
		break;

		case "generate_quest_2":
			if (CheckQuestAttribute("generate_trade_quest_progress", "failed"))
			{
				dialog.snd = "Voice\ARMA\ARMA050";
				dialog.text = DLG_TEXT[200];
				link.l1 = DLG_TEXT[201];
				link.l1.go = "exit";
				ChangeCharacterReputation(pchar, -1);
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA051";
				dialog.text = DLG_TEXT[202];
				link.l1 = DLG_TEXT[203];
				link.l1.go = "exit";
				ChangeCharacterReputation(pchar, 1);
				AddPartyExp(pchar, (makeint(pchar.quest.iMoney)/2));
				AddMoneyToCharacter(pchar, makeint(pchar.quest.iMoney));
				pchar.quest.generate_trade_quest_progress = "";
				pchar.quest.generate_trade_quest.over = "yes";
				RemoveCharacterGoods(pchar, makeint(pchar.quest.iTradeGoods), makeint(pchar.quest.iQuantityGoods));
			}
			AddDialogExitQuest("close_trade_quest");
		break;

		case "no_quests":
			if (npchar.quest_begin == "0")
			{
				dialog.snd = "Voice\ARMA\ARMA052";
				dialog.text = DLG_TEXT[204];
				link.l1 = DLG_TEXT[205];
				link.l1.go = "exit";
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA053";
				dialog.text = DLG_TEXT[206];
				link.l1 = DLG_TEXT[207];
				link.l1.go = "exit";
			}
		break;

		case "redmond_not_done":
			dialog.snd = "Voice\ARMA\ARMA054";
			dialog.text = DLG_TEXT[208] + Characters[GetCharacterIndex(DLG_TEXT[209])].name + DLG_TEXT[210];
			link.l1 = DLG_TEXT[211];
			link.l1.go = "redmond_not_done_2";
			ChangeCharacterReputation(pchar, -1);
		break;

		case "redmond_not_done_1":
			dialog.snd = "Voice\ARMA\ARMA055";
			dialog.text = DLG_TEXT[212] + characters[GetCharacterIndex(DLG_TEXT[213])].name + DLG_TEXT[214];
			link.l1 = DLG_TEXT[215];
			link.l1.go = "redmond_not_done_2";
		break;

		case "redmond_not_done_2":
			dialog.snd = "Voice\ARMA\ARMA056";
			dialog.text = DLG_TEXT[216];
			link.l1 = DLG_TEXT[217];
			link.l1.go = "redmond_not_done_3";
			if (makeint(pchar.money) >= 1500)
			{
				link.l2 = DLG_TEXT[218];
				link.l2.go = "redmond_not_done_4";
			}
		break;

		case "redmond_not_done_3":
			dialog.snd = "Voice\ARMA\ARMA057";
			dialog.text = DLG_TEXT[219];
			link.l1 = DLG_TEXT[220];
			link.l1.go = "exit";
			ChangeCharacterReputation(pchar, -10);
		break;

		case "redmond_not_done_4":
			dialog.snd = "Voice\ARMA\ARMA058";
			dialog.text = DLG_TEXT[221];
			link.l1 = DLG_TEXT[222] + Address_Form.Fra + DLG_TEXT[223];
			link.l1.go = "exit";
			AddMoneyToCharacter(pchar, -1500);
		break;

		case "node_1":
			if (GetSquadronFreeSpace(pchar, GOOD_CHOCOLATE) >= 100)
			{
				dialog.snd = "Voice\ARMA\ARMA059";
				dialog.text = DLG_TEXT[224];
				link.l1 = DLG_TEXT[225];
				link.l1.go = "war";
				link.l2 = DLG_TEXT[226] + Address_Form.Fra + DLG_TEXT[227];
				link.l2.go = "access";
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA060";
				dialog.text = DLG_TEXT[228];
				link.l1 = DLG_TEXT[229];
				link.l1.go = "exit";
				npchar.money.quest = "0";
			}
		break;

		case "war":
			dialog.snd = "Voice\ARMA\ARMA061";
			dialog.text = DLG_TEXT[230];
			link.l1 = DLG_TEXT[231];
			link.l1.go = "access";
			link.l2 = DLG_TEXT[232];
			link.l2.go = "war_1";
		break;

		case "war_1":
			if (makeint(pchar.skill.commerce) > 5)
			{
				dialog.snd = "Voice\ARMA\ARMA062";
				dialog.text = DLG_TEXT[233];
				link.l1 = DLG_TEXT[234];
				link.l1.go = "access_1";
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA063";
				dialog.text = DLG_TEXT[235];
				link.l1 = DLG_TEXT[236];
				link.l1.go = "access";
				link.l2 = DLG_TEXT[237];
				link.l2.go = "exit";
			}
		break;

		case "access":
			dialog.snd = "Voice\ARMA\ARMA064";
			dialog.text = DLG_TEXT[238] + npchar.name + " " + npchar.lastname + DLG_TEXT[239];
			link.l1 = DLG_TEXT[240] + pchar.name + " " + pchar.lastname + DLG_TEXT[241];
			link.l1.go = "to_redmond_1";
			npchar.money.quest = "600";
		break;

		case "access_1":
			dialog.snd = "Voice\ARMA\ARMA065";
			dialog.text = DLG_TEXT[242] + npchar.name + " " + npchar.lastname + DLG_TEXT[243];
			link.l1 = DLG_TEXT[244] + pchar.name + " " + pchar.lastname + DLG_TEXT[245];
			link.l1.go = "to_redmond_1";
			npchar.money.quest = "800";
		break;

		case "to_redmond_1":
			dialog.snd = "Voice\ARMA\ARMA066";
			dialog.text = DLG_TEXT[246];
			link.l1 = DLG_TEXT[247];
			link.l1.go = "exit";
			npchar.quest.to_redmond_1 = "1";
			npchar.quest_begin = "1";
			AddCharacterGoods(pchar, GOOD_CHOCOLATE, 100);
		break;

		case "market":
			dialog.snd = "Voice\ARMA\ARMA067";
			dialog.Text = DLG_TEXT[248];
			Link.l1 = DLG_TEXT[249];
			Link.l1.go = "trade_1";
			Link.l2 = DLG_TEXT[250];
			Link.l2.go = "items";
			Link.l3 = DLG_TEXT[251];
			Link.l3.go = "exit";
		break;

		case "trade_1":
			NextDiag.CurrentNode = NextDiag.TempNode;
			//NPChar.quest.meeting = NPC_Meeting;
			DialogExit();
			LaunchStore(FALAISE_DE_FLEUR_STORE);
		break;

		case "items":
			if (npchar.quest.item_date != lastspeak_date)
			{
				GiveItemToTrader(npchar);
				npchar.quest.item_date = lastspeak_date;
			}
			
			NextDiag.CurrentNode = NextDiag.TempNode;
			DialogExit();
			LaunchItemsTrade(NPChar);
		break;

		case "redmond_done":
			dialog.snd = "Voice\ARMA\ARMA068";
			Dialog.text = DLG_TEXT[252];
			link.l1 = DLG_TEXT[253];
			link.l1.go = "redmond_done_1";
		break;

		case "redmond_done_1":
			dialog.snd = "Voice\ARMA\ARMA069";
			Dialog.text = DLG_TEXT[254];
			link.l1 = DLG_TEXT[255];
			link.l1.go = "exit";
			AddMoneyToCharacter(pchar, makeint(npchar.money.quest));
			AddPartyExp(pchar, 700);
			npchar.money.quest = "0";
			npchar.quest_begin = "0";
		break;

		case "baldewyn":
			dialog.snd = "Voice\ARMA\ARMA070";
			dialog.text = DLG_TEXT[256];
			link.l1 = DLG_TEXT[257];
			link.l1.go = "baldewyn_1";
		break;

		case "baldewyn_1":
			dialog.snd = "Voice\ARMA\ARMA071";
			dialog.text = DLG_TEXT[258] + Address_Form.Fra + DLG_TEXT[259];
			link.l1 = DLG_TEXT[260];
			link.l1.go = "baldewyn_2";
		break;

		case "baldewyn_2":
			dialog.snd = "Voice\ARMA\ARMA072";
			dialog.text = DLG_TEXT[261] + Characters[GetCharacterIndex(DLG_TEXT[262])].name + " " + Characters[GetCharacterIndex(DLG_TEXT[263])].lastname + DLG_TEXT[264];
			link.l1 = DLG_TEXT[265];
			link.l1.go = "baldewyn_3";
		break;

		case "baldewyn_3":
			dialog.snd = "Voice\ARMA\ARMA073";
			dialog.text = DLG_TEXT[266] + Address_Form.Fra + DLG_TEXT[267];
			link.l1 = DLG_TEXT[268];
			link.l1.go = "baldewyn_6";
			npchar.quest.money = "500";
			link.l2 = DLG_TEXT[269] + npchar.name + DLG_TEXT[270];
			link.l2.go = "baldewyn_4";
		break;

		case "baldewyn_4":
			if (makeint(pchar.skill.commerce) > 3)
			{
				dialog.snd = "Voice\ARMA\ARMA074";
				dialog.text = DLG_TEXT[271];
				link.l1 = DLG_TEXT[272];
				link.l1.go = "baldewyn_6";
				npchar.quest.money = "750";
			}
			else
			{
				if (pchar.reputation > 50)
				{
					dialog.snd = "Voice\ARMA\ARMA075";
					dialog.text = DLG_TEXT[273];
				}
				else
				{
					dialog.snd = "Voice\ARMA\ARMA076";
					dialog.text = DLG_TEXT[274];
				}
				link.l1 = DLG_TEXT[275];
				link.l1.go = "baldewyn_6";
				npchar.quest.money = "500";
			}
			link.l2 = DLG_TEXT[276];
			link.l2.go = "baldewyn_5";
		break;

		case "baldewyn_5":
			dialog.snd = "Voice\ARMA\ARMA077";
			dialog.text = DLG_TEXT[277];
			link.l1 = DLG_TEXT[278];
			link.l1.go = "exit";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "arno_denied";
			link.l2 = DLG_TEXT[279];
			link.l2.go = "baldewyn_6";
		break;

		case "baldewyn_6":
			dialog.snd = "Voice\ARMA\ARMA078";
			dialog.text = DLG_TEXT[280];
			link.l1 = DLG_TEXT[281];
			link.l1.go = "exit";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "arno";
			npchar.quest_begin = "1";
		break;

		case "baldewyn_done":
			dialog.snd = "Voice\ARMA\ARMA079";
			dialog.text = DLG_TEXT[282];
			link.l1 = DLG_TEXT[283];
			link.l1.go = "baldewyn_done_1";
			link.l2 = DLG_TEXT[284];
			link.l2.go = "baldewyn_done_2";
		break;

		case "baldewyn_done_1":
			dialog.snd = "Voice\ARMA\ARMA080";
			dialog.text = DLG_TEXT[285];
			link.l1 = DLG_TEXT[286];
			link.l1.go = "baldewyn_done_2";
			link.l2 = DLG_TEXT[287];
			link.l2.go = "exit";
		break;

		case "baldewyn_done_2":
			dialog.snd = "Voice\ARMA\ARMA081";
			dialog.text = DLG_TEXT[288];
			link.l1 = DLG_TEXT[289];
			link.l1.go = "baldewyn_bye";
			link.l2 = DLG_TEXT[290];
			link.l2.go = "baldewyn_done_3";
		break;

		case "baldewyn_done_3":
			dialog.snd = "Voice\ARMA\ARMA082";
			dialog.text = DLG_TEXT[291];
			link.l1 = DLG_TEXT[292];
			link.l1.go = "baldewyn_bye_2";
			link.l2 = DLG_TEXT[293];
			link.l2.go = "baldewyn_bye_3";
		break;

		case "baldewyn_bye":
			dialog.snd = "Voice\ARMA\ARMA083";
			dialog.text = DLG_TEXT[294];
			link.l1 = DLG_TEXT[295] + Address_Form.Fra + DLG_TEXT[296];
			link.l1.go = "exit";
			link.l2 = DLG_TEXT[297];
			link.l2.go = "First Time";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "done";
			npchar.quest_begin = "0";
			npchar.quest.money = "0";
			Rumour[4].state = "active";
			characters[GetCharacterIndex("Baldewyn Coffier")].location = "none";
			Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
		break;

		case "baldewyn_bye_2":
			dialog.snd = "Voice\ARMA\ARMA084";
			dialog.text = DLG_TEXT[298];
			link.l1 = DLG_TEXT[299];
			link.l1.go = "exit";
			link.l2 = DLG_TEXT[300];
			link.l2.go = "First Time";
			characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "done";
			npchar.quest_begin = "0";
			AddMoneyToCharacter(pchar, makeint(npchar.money.quest));
			ChangeCharacterReputation(pchar, -1);
			AddPartyExp(pchar, 700);
			npchar.quest.money = "0";
			Rumour[4].state = "active";
			characters[GetCharacterIndex("Baldewyn Coffier")].location = "none";
			Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
		break;

		case "baldewyn_bye_3":
			if (makeint(pchar.skill.commerce) > 5)
			{
				dialog.snd = "Voice\ARMA\ARMA085";
				dialog.text = DLG_TEXT[301] + makeint(npchar.quest.money) * 2 + DLG_TEXT[302];
				link.l1 = DLG_TEXT[303];
				link.l1.go = "exit";
				link.l2 = DLG_TEXT[304];
				link.l2.go = "First Time";
				characters[GetCharacterIndex("Baldewyn Coffier")].quest.hire = "done";
				npchar.quest_begin = "0";
				AddMoneyToCharacter(pchar, makeint(npchar.money.quest)*2);
				ChangeCharacterReputation(pchar, -1);
				AddPartyExp(pchar, 700);
				npchar.quest.money = "0";
				Rumour[4].state = "active";
				characters[GetCharacterIndex("Baldewyn Coffier")].location = "none";
				Characters[GetCharacterIndex("Sabine Matton")].location = "Falaise_De_Fleur_store";
			}
			else
			{
				dialog.snd = "Voice\ARMA\ARMA086";
				dialog.text = DLG_TEXT[305];
				link.l1 = DLG_TEXT[306] + Address_Form.Fra + DLG_TEXT[307];
				link.l1.go = "exit";
				link.l2 = DLG_TEXT[308];
				link.l2.go = "baldewyn_bye_2";
			}
		break;

		case "Exit":
			NextDiag.CurrentNode = NextDiag.TempNode;
			DialogExit();
		break;
	}
}
void ProcessDialogEvent()
{
	ref NPChar;
	aref Link, NextDiag;

	DeleteAttribute(&Dialog,"Links");

	makeref(NPChar,CharacterRef);
	makearef(Link, Dialog.Links);
	makearef(NextDiag, NPChar.Dialog);

	ref PChar;
	PChar = GetMainCharacter();

	
	switch(Dialog.CurrentNode)
	{
		// ----------------------------------- Диалог первый - первая встреча
		case "First time":
			Dialog.defAni = "dialog_stay1";
			Dialog.defCam = "1";
			Dialog.defSnd = "dialogs\0\017";
			Dialog.defLinkAni = "dialog_1";
			Dialog.defLinkCam = "1";
			Dialog.defLinkSnd = "dialogs\woman\024";
			Dialog.ani = "dialog_stay2";
			Dialog.cam = "1";
			Dialog.snd = "dialogs\0\009";

			if (npchar.quest.meeting == "0")
			{
				dialog.text = DLG_TEXT[0] + npchar.name + " " + npchar.middlename + " " + npchar.lastname + DLG_TEXT[1] + address_form.spa + DLG_TEXT[2];
				Link.l1 = DLG_TEXT[3] + pchar.name + " " + pchar.lastname + DLG_TEXT[4];
				Link.l1.go = "node_1";
				npchar.quest.meeting = "1";
			}
			else
			{
				dialog.text = DLG_TEXT[5];
				link.l1 = DLG_TEXT[6];
				link.l1.go = "quests";
				link.l2 = DLG_TEXT[7];
				link.l2.go = "exit";
			}
			NextDiag.TempNode = "First time";
		break;

		case "node_1":
			dialog.text = DLG_TEXT[8];
			link.l1 = DLG_TEXT[9];
			link.l1.go = "quests";
			link.l2 = DLG_TEXT[10];
			link.l2.go = "node_2";
		break;

		case "node_2":
			dialog.text = DLG_TEXT[11];
			link.l1 = DLG_TEXT[12];
			link.l1.go = "exit";
		break;

		case "quests":
			dialog.text = DLG_TEXT[13] + address_form.spa + DLG_TEXT[14];
			if (CheckQuestAttribute("nigel_con_parri_checker", "win_win") || CheckQuestAttribute("nigel_con_parri_checker", "win"))
			{
				link.l1 = DLG_TEXT[15];
				link.l1.go = "garri";
			}		
			if (!CheckAttribute(pchar, "quest.generate_kill_quest") && GetNationRelation2MainCharacter(PORTUGAL) != RELATION_ENEMY)
			{
				dialog.text = DLG_TEXT[16];
				link.l1 = DLG_TEXT[17];
				link.l1.go = "kill_pirate";
			}			
			if (CheckQuestAttribute("generate_kill_quest", "completed"))
			{
				dialog.text = DLG_TEXT[18];
				link.l1 = DLG_TEXT[19];
				link.l1.go = "kill_pirate_completed";
			}	
			link.l99 = DLG_TEXT[20];
			link.l99.go = "exit";
		break;
		
		case "kill_pirate":
			GeneratePirateQuest("Conceicao");
			dialog.text = DLG_TEXT[21] + characters[GetCharacterIndex(DLG_TEXT[22])].ship.name + DLG_TEXT[23] + pchar.quest.killdestination + DLG_TEXT[24] + pchar.quest.killmoney + DLG_TEXT[25];
			link.l1 = DLG_TEXT[26];
			link.l1.go = "kill_pirate_agree";
			link.l2 = DLG_TEXT[27];
			link.l2.go = "kill_pirate_refused";
		break;
		
		case "kill_pirate_agree":
			DialogExit();
			NextDiag.CurrentNode = NextDiag.TempNode;
			AddDialogExitQuest("kill_pirate_agree");
		break;
		
		case "kill_pirate_refused":
			DialogExit();
			NextDiag.CurrentNode = NextDiag.TempNode;
			AddDialogExitQuest("kill_pirate_refused");
		break;
		
		case "kill_pirate_completed":
			AddPartyExp(pchar, 1500);
			AddMoneyToCharacter(pchar, makeint(pchar.quest.killmoney));
			AddDialogExitQuest("kill_pirate_refused_2");
			ChangeCharacterReputation(pchar, 1);
			DialogExit();
			NextDiag.CurrentNode = NextDiag.TempNode;
			pchar.quest.generate_kill_quest = "wait_timer";
		break;
		
		case "garri":
			dialog.text = DLG_TEXT[28];
			link.l1 = DLG_TEXT[29];
			link.l1.go = "garri_2";
		break;
		
		case "garri_2":
			dialog.text = DLG_TEXT[30];
			link.l1 = DLG_TEXT[31];
			if (CheckQuestAttribute("nigel_con_parri_checker", "win_win"))
			{
				link.l1.go = "garri_3";
			}
			else
			{
				link.l1.go = "exit";
			}
			AddQuestrecord("nigel", "15");
			DeleteAttribute(PChar, "quest.nigel_con_parri_checker");
			PChar.quest.con_parri_expired.over = "yes";
			AddMoneyToCharacter(pchar, 3000);
			ChangeCharacterReputation(pchar, 1);
			AddDialogExitQuest("nigel_third_encounter");
		break;
		
		case "garri_3":
			dialog.text = DLG_TEXT[32];
			link.l1 = DLG_TEXT[33];
			link.l1.go = "garri_4";
		break;
		
		case "garri_4":
			dialog.text = DLG_TEXT[34];
			link.l1 = DLG_TEXT[35];
			link.l1.go = "exit";
			AddMoneyToCharacter(pchar, 6000);
			ChangeCharacterReputation(pchar, 1);
		break;
						
		case "Exit":
			DialogExit();
			NextDiag.CurrentNode = NextDiag.TempNode;
		break;

		case "j_day":
			dialog.text = Pchar.name + " " + Pchar.lastname + DLG_TEXT[36]; 
			link.l1 = DLG_TEXT[37];
			link.l1.go = "continue1";
		break;

		case "continue1":
			LAi_QuestDelay("ex_dialog", 2);
			DialogExit();
			NextDiag.CurrentNode = "j_day2";
		break;

		case "j_day2":
			dialog.text = Pchar.name + " " + Pchar.lastname + DLG_TEXT[38]; 
			link.l1 = DLG_TEXT[39];
			link.l1.go = "exit";
		break;

	}
}
Example #23
0
void SetVariable()
{
    sPlayerName = xi_refCharacter.name;

    nPlayerMoney = sti(xi_refCharacter.Money);
    nCurrentExperience = sti(xi_refCharacter.Experience);
    nNextExperience = CalculateExperienceFromRank(sti(xi_refCharacter.rank)+1);
    nFreeSkillPoints = sti(xi_refCharacter.Skill.FreeSkill);
	int nFreeAbilities = 0;
	if( CheckAttribute(xi_refCharacter,"perks.FreePoints") )
		nFreeAbilities = sti(xi_refCharacter.perks.FreePoints);

    nLeadership = sti(xi_refCharacter.Skill.Leadership);
    nFencing = sti(xi_refCharacter.Skill.Fencing);
    nSailing = sti(xi_refCharacter.Skill.Sailing);
    nAccuracy = sti(xi_refCharacter.Skill.Accuracy);
    nCannons = sti(xi_refCharacter.Skill.Cannons);
    nGrappling = sti(xi_refCharacter.Skill.Grappling);
    nRepair = sti(xi_refCharacter.Skill.Repair);
    nDefence = sti(xi_refCharacter.Skill.Defence);
    nCommerce = sti(xi_refCharacter.Skill.Commerce);
    nSneak = sti(xi_refCharacter.Skill.Sneak);

    GameInterface.StatusLine.EXP.Max = nNextExperience;
    GameInterface.StatusLine.EXP.Min = CalculateExperienceFromRank(sti(xi_refCharacter.rank));
    GameInterface.StatusLine.EXP.Value = nCurrentExperience;

    GameInterface.strings.CurrentExperience = nCurrentExperience;
    GameInterface.strings.NextExperience = nNextExperience;
    GameInterface.strings.Money = MakeMoneyShow(nPlayerMoney,MONEY_SIGN,MONEY_DELIVER);
    GameInterface.strings.CharacterName = xi_refCharacter.name+" "+xi_refCharacter.lastname;
    GameInterface.strings.Reputation = XI_ConvertString(GetReputationName(sti(xi_refCharacter.reputation)));
	GameInterface.strings.FreeAbilitiesPoints = nFreeAbilities;
    GameInterface.strings.FreeSkillPoints = nFreeSkillPoints;
    GameInterface.strings.Rank = xi_refCharacter.rank;
	GameInterface.strings.MaxHP = MakeInt(LAi_GetCharacterHP(xi_refCharacter)) + "/" + MakeInt(LAi_GetCharacterMaxHP(xi_refCharacter));

	SetSkillShow("SkillLeadership",nLeadership);
	SetSkillShow("SkillFencing",nFencing);
	SetSkillShow("SkillSailing",nSailing);
	SetSkillShow("SkillAccuracy",nAccuracy);
	SetSkillShow("SkillCannons",nCannons);
	SetSkillShow("SkillGrappling",nGrappling);
	SetSkillShow("SkillRepair",nRepair);
	SetSkillShow("SkillDefence",nDefence);
	SetSkillShow("SkillCommerce",nCommerce);
	SetSkillShow("SkillSneak",nSneak);

	SetNewPicture("FACEPICT", "interfaces\portraits\256\face_" + xi_refCharacter.FaceId + ".tga");
	if( xi_refCharacter.id == xi_refMainChar.id ) {
		SetNewPicture("TYPEPICT", "");
	} else {
		switch( FindFellowtravellers(xi_refMainChar,xi_refCharacter) )
		{
		case FELLOWTRAVEL_COMPANION:
			SetNewPicture("TYPEPICT", "interfaces\IsCompanion.tga");
		break;
		case FELLOWTRAVEL_OFFICER:
			SetNewPicture("TYPEPICT", "");
			//SetNewPicture("TYPEPICT", "interfaces\IsOfficer.tga");
		break;
		}
	}

	SendMessage(&GameInterface,"lsl",MSG_INTERFACE_MSG_TO_NODE,"exp",0);
	oldIndex = -1;
}
Example #24
0
/* default method for checking an element's attributes */
void CheckAttributes( TidyDocImpl* doc, Node *node )
{
    AttVal *attval;
    for ( attval = node->attributes; attval != null; attval = attval->next )
        CheckAttribute( doc, node, attval );
}
Example #25
0
bool LAi_tmpl_follow_IsGo(aref chr)
{
	if(!CheckAttribute(chr, "chr_ai.tmpl.state")) return false;
	if(chr.chr_ai.tmpl.state == "go") return true;
	return false;
}
Example #26
0
//Начать загрузку монстров в локацию
bool LEnc_MonstersLoginStart(ref location)
{
	float monkeys, skeletons;
	LEnc_MonstersLoginObject.type = "dungeon";
	if(CheckAttribute(location, "type"))
	{
		if(location.type == "jungle")
		{
			LEnc_MonstersLoginObject.type = "jungle";
		}
	}
	LEnc_MonstersLoginObject.current = "";
	if(LEnc_MonstersLoginObject.type == "jungle")
	{
		if(IsDay())
		{
			//Днём либо бандиты, либо олухи, либо никто
			if(rand(100) > 20)
			{
				if(rand(100) < 30)
				{
					//Выбрали олухов
					LEnc_MonstersLoginObject.bandit = "0";
					LEnc_MonstersLoginObject.skeleton = "0";
					LEnc_MonstersLoginObject.monkey = "0";
					LEnc_MonstersLoginObject.mummy = "0";
					LEnc_MonstersLoginObject.vagabond = "1";
				}else{
					return false;
				}
			}else{
				LEnc_MonstersLoginObject.bandit = "1";
				LEnc_MonstersLoginObject.skeleton = "0";
				LEnc_MonstersLoginObject.monkey = "0";
				LEnc_MonstersLoginObject.mummy = "0";
				LEnc_MonstersLoginObject.vagabond = "0";
			}
		}else{
			//Ночью либо бандиты, либо скелеты, либо олухи, либо никто
			if(rand(100) < 40)
			{
				if(rand(100) < 20)
				{
					//Выбрали олухов
					LEnc_MonstersLoginObject.bandit = "0";
					LEnc_MonstersLoginObject.skeleton = "0";
					LEnc_MonstersLoginObject.monkey = "0";
					LEnc_MonstersLoginObject.mummy = "0";
					LEnc_MonstersLoginObject.vagabond = "1";
				}else{
					return false;
				}
			}else{
				if(rand(100) < 40)
				{
					//Выбрали бандитов
					LEnc_MonstersLoginObject.bandit = "1";
					LEnc_MonstersLoginObject.skeleton = "0";
					LEnc_MonstersLoginObject.monkey = "0";
					LEnc_MonstersLoginObject.mummy = "0";
					LEnc_MonstersLoginObject.vagabond = "0";
				}else{
					//Выбрали скелетов
					LEnc_MonstersLoginObject.bandit = "0";
					monkeys = 0.4 + (rand(100)*0.01)*0.6;
					skeletons = 1.0 - monkeys;
					LEnc_MonstersLoginObject.skeleton = skeletons;
					LEnc_MonstersLoginObject.monkey = monkeys;
					LEnc_MonstersLoginObject.mummy = "0";
					LEnc_MonstersLoginObject.vagabond = "0";
				}
			}
		}
	}else{
		if(LEnc_MonstersLoginObject.type == "inca_temple")
		{
				LEnc_MonstersLoginObject.bandit = "0";
				LEnc_MonstersLoginObject.skeleton = "0.2";
				LEnc_MonstersLoginObject.monkey = "0.3";
				LEnc_MonstersLoginObject.mummy = "0.5";
				LEnc_MonstersLoginObject.vagabond = "0";
		}else{
			if(rand(100) < 90)
			{
				LEnc_MonstersLoginObject.bandit = "0";
				LEnc_MonstersLoginObject.skeleton = "1";
				LEnc_MonstersLoginObject.monkey = "0";
				LEnc_MonstersLoginObject.mummy = "0";
				LEnc_MonstersLoginObject.vagabond = "0";
			}else{
				skeletons = 0.8 + (rand(100)*0.01)*0.2;
				monkeys = 1.0 - skeletons;
				LEnc_MonstersLoginObject.bandit = "0";
				LEnc_MonstersLoginObject.skeleton = skeletons;
				LEnc_MonstersLoginObject.monkey = monkeys;
				LEnc_MonstersLoginObject.mummy = "0";
				LEnc_MonstersLoginObject.vagabond = "0";
			}
		}
	}
	return true;
}