Skip to content

Commit

Permalink
Scripts Changelog 4.02 vs 4.03
Browse files Browse the repository at this point in the history
  • Loading branch information
ElementaryLewis committed May 11, 2023
1 parent 303b421 commit 4ae83ef
Show file tree
Hide file tree
Showing 25 changed files with 592 additions and 54 deletions.
1 change: 1 addition & 0 deletions scripts/engine/game.ws
Expand Up @@ -274,6 +274,7 @@ import class CGame extends CObject
import final function GetDLSSEnabled() : bool;
import final function GetFSREnabled() : bool;
import final function GetTAAEnabled() : bool;
import final function GetXESSEnabled() : bool;
import final function GetRTAOEnabled() : bool;
import final function GetRTREnabled() : bool;
import final function GetDLSSGEnabled() : bool;
Expand Down
2 changes: 2 additions & 0 deletions scripts/game/commonGame.ws
Expand Up @@ -306,6 +306,8 @@ import class CCommonGame extends CGame

import final function GetIsDLSSSupported() : bool;

import final function GetIsXESSSupported() : bool;

import final function VisitWeibo();

import final function RequestVoiceLangDownload( lockName : string ) : void;
Expand Down
21 changes: 19 additions & 2 deletions scripts/game/gameplay/alchemy/alchemyManager.ws
Expand Up @@ -214,7 +214,7 @@ class W3AlchemyManager
var i, j, quantity, removedIngQuantity, maxAmmo : int;
var recipe : SAlchemyRecipe;
var dm : CDefinitionsManagerAccessor;
var crossbowID : SItemUniqueId;
var crossbowID, sword : SItemUniqueId;
var min, max : SAbilityAttributeValue;
var uiStateAlchemy : W3TutorialManagerUIHandlerStateAlchemy;
var uiStateAlchemyMutagens : W3TutorialManagerUIHandlerStateAlchemyMutagens;
Expand All @@ -227,6 +227,8 @@ class W3AlchemyManager

GetRecipe(recipeName, recipe);

witcher = GetWitcherPlayer();


equippedOnSlot = EES_InvalidSlot;
dm = theGame.GetDefinitionsManager();
Expand Down Expand Up @@ -273,7 +275,6 @@ class W3AlchemyManager
{
removedIngQuantity = 0;
alchIngs = thePlayer.inv.GetItemsByName(itemName);
witcher = GetWitcherPlayer();

for(j=0; j<alchIngs.Size(); j+=1)
{
Expand All @@ -296,6 +297,22 @@ class W3AlchemyManager

thePlayer.inv.RemoveItemByName(itemName, recipe.requiredIngredients[i].quantity);
}


if(recipe.cookedItemType == EACIT_Oil && recipe.level > 1 && thePlayer.inv.IsItemOil(ids[0]))
{
if( witcher.IsEquippedSwordUpgradedWithOil( false, recipe.requiredIngredients[i].itemName ) )
{
sword = thePlayer.GetEquippedSword( false );
thePlayer.ApplyOil(ids[0], sword);
}
else if( witcher.IsEquippedSwordUpgradedWithOil( true, recipe.requiredIngredients[i].itemName ) )
{
sword = thePlayer.GetEquippedSword( true );
thePlayer.ApplyOil(ids[0], sword);
}
}

}

RemoveLowerLevelItems(recipe);
Expand Down
53 changes: 46 additions & 7 deletions scripts/game/gameplay/crafting/craftingManager.ws
Expand Up @@ -168,7 +168,13 @@ class W3CraftingManager
var tutStateSet : W3TutorialManagerUIHandlerStateCraftingSet;
var craftsman : CGameplayEntity;
var upgrades, temp : array<name>;


var wasEnchanted : bool;
var wasDyed : bool;
var enchantName, colorName : name;
var maxSlots : int;
var dye_ids : array<SItemUniqueId>;

error = CanCraftSchematic(schemName, true);
if(error != ECE_NoException)
{
Expand All @@ -182,7 +188,11 @@ class W3CraftingManager

craftsman = (CGameplayEntity)craftMasterComp.GetEntity();
thePlayer.inv.GiveMoneyTo(craftsman.GetInventory(), GetCraftingCost(schemName), false);


maxSlots = 0;
wasEnchanted = false;
wasDyed = false;


equipAfterCrafting = false;
for(i=0; i<schem.ingredients.Size(); i+=1)
Expand All @@ -195,29 +205,58 @@ class W3CraftingManager
equipAfterCrafting = true;
}
}

maxSlots = Max(maxSlots, thePlayer.inv.GetItemEnhancementSlotsCount( itemsingr[0] ));


thePlayer.inv.GetItemEnhancementItems(itemsingr[0], temp);
ArrayOfNamesAppend(upgrades, temp);
temp.Clear();


if ( thePlayer.inv.IsItemEnchanted( itemsingr[0] ) )
{
wasEnchanted = true;
enchantName = thePlayer.inv.GetEnchantment( itemsingr[0] );
}
if (thePlayer.inv.IsItemColored( itemsingr[0] ))
{
wasDyed = true;
colorName = thePlayer.inv.GetItemColor( itemsingr[0] );
}

thePlayer.inv.RemoveItemByName(schem.ingredients[i].itemName, schem.ingredients[i].quantity);
}


items = thePlayer.inv.AddAnItem(schem.craftedItemName, schem.craftedItemCount);
item = items[0];

if ( equipAfterCrafting )
thePlayer.EquipItem( item );


maxSlots = Min(maxSlots, thePlayer.inv.GetSlotItemsLimit( item ));
while (thePlayer.inv.GetItemEnhancementSlotsCount(item) < maxSlots)
thePlayer.inv.AddSlot(item);


size = Min(thePlayer.inv.GetItemEnhancementSlotsCount(item), upgrades.Size());
for(i=0; i<size; i+=1)
{
upgradeItem = thePlayer.inv.AddAnItem(upgrades[i], 1, true, true);
thePlayer.inv.EnhanceItemScript(item, upgradeItem[0]);
}

if ( wasEnchanted )
{
thePlayer.inv.EnchantItem( item, enchantName, getEnchamtmentStatName(enchantName) );
}
if ( wasDyed )
{
dye_ids = thePlayer.inv.AddAnItem( colorName, 1, true, true, false );
thePlayer.inv.ColorItem( item, dye_ids[0] );
thePlayer.inv.RemoveItem( dye_ids[0], 1 );
}

if ( equipAfterCrafting )
thePlayer.EquipItem( item );

LogCrafting("Item <<" + schem.craftedItemName + ">> crafted successfully");

if(thePlayer.inv.IsItemSetItem(item) && ShouldProcessTutorial('TutorialCraftingSets'))
Expand Down
29 changes: 25 additions & 4 deletions scripts/game/gameplay/damage/damageManagerProcessor.ws
Expand Up @@ -47,6 +47,13 @@ class W3DamageManagerProcessor extends CObject
InitializeActionVars(act);


if( ((CNewNPC)actorAttacker).IsHorse() && actorVictim.HasAbility('mon_werewolf_base'))
{
action.SetHitReactionType(EHRT_Light);
}




if(playerVictim && attackAction && attackAction.IsActionMelee() && !attackAction.CanBeParried() && attackAction.IsParried())
{
Expand Down Expand Up @@ -532,15 +539,29 @@ class W3DamageManagerProcessor extends CObject
if(playerAttacker && actorVictim)
{

if(playerAttacker.inv.ItemHasAnyActiveOilApplied(weaponId) && (!playerAttacker.CanUseSkill(S_Alchemy_s06) || (playerAttacker.GetSkillLevel(S_Alchemy_s06) < 3)) )
if( playerAttacker.inv.ItemHasAnyActiveOilApplied(weaponId) )
{
playerAttacker.ReduceAllOilsAmmo( weaponId );
if( !playerAttacker.CanUseSkill(S_Alchemy_s06) || playerAttacker.GetSkillLevel(S_Alchemy_s06) < 3 )
{
playerAttacker.ReduceAllOilsAmmo( weaponId );

if(ShouldProcessTutorial('TutorialOilAmmo'))
{
FactsAdd("tut_used_oil_in_combat");
}
}

if(ShouldProcessTutorial('TutorialOilAmmo'))

if( !playerAttacker.inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) )
{
FactsAdd("tut_used_oil_in_combat");
thePlayer.ShouldAutoApplyOilImmediately( actorVictim );
}
}
else
{
thePlayer.ShouldAutoApplyOilImmediately( actorVictim );
}



playerAttacker.inv.ReduceItemRepairObjectBonusCharge(weaponId);
Expand Down
2 changes: 2 additions & 0 deletions scripts/game/gameplay/effects/effects/other/oil.ws
Expand Up @@ -173,6 +173,8 @@ class W3Effect_Oil extends CBaseGameplayEffect
if( currCount == 1 )
{
Show( false );

thePlayer.ShouldAutoApplyOil();
}

currCount = Max( 0, currCount - 1 );
Expand Down
Expand Up @@ -14,7 +14,8 @@ class W3GuiDisassembleInventoryComponent extends W3GuiPlayerInventoryComponent
super.SetInventoryFlashObjectForItem( item, flashObject );

addRecyclingPartsList( item, flashObject );
addSocketsListInfo( item, flashObject );
if ( !_inv.IsItemEnchanted( item ) )
addSocketsListInfo( item, flashObject );
flashObject.SetMemberFlashBool( "enableComparison", _inv.CanBeCompared(item) );
flashObject.SetMemberFlashInt( "gridPosition", -1 );

Expand Down
Expand Up @@ -367,6 +367,14 @@ class W3GuiPlayerInventoryComponent extends W3GuiBaseInventoryComponent
{
playerInv.GetItemStats(equipedItemId, equipedItemStats);
playerInv.GetItemPrimaryStat(equipedItemId, eqPrimaryStatLabel, eqPrimaryStatValue);

if( playerInv.ItemHasTag( equipedItemId, 'Aerondight' ) )
{
if( playerInv.GetItemModifierFloat( equipedItemId, 'PermDamageBoost' ) >= 0.f )
{
eqPrimaryStatValue += playerInv.GetItemModifierFloat( equipedItemId, 'PermDamageBoost' );
}
}
}

dontCompare = itemCategory == 'potion' || itemCategory == 'petard' || itemCategory == 'oil';
Expand Down
15 changes: 11 additions & 4 deletions scripts/game/gui/_old/components/guiTooltipComponent.ws
Expand Up @@ -310,6 +310,13 @@ class W3TooltipComponent
else
{
compareItemInv.GetItemPrimaryStat(equipedItem, eqPrimaryStatLabel, eqPrimaryStatValue);
if( compareItemInv.ItemHasTag( equipedItem, 'Aerondight' ) )
{
if( compareItemInv.GetItemModifierFloat( equipedItem, 'PermDamageBoost' ) >= 0.f )
{
eqPrimaryStatValue += compareItemInv.GetItemModifierFloat( equipedItem, 'PermDamageBoost' );
}
}
}

canBeCompared = isArmorOrWeapon;
Expand Down Expand Up @@ -445,7 +452,7 @@ class W3TooltipComponent

if( itemInvComponent.ItemHasTag( item, 'Aerondight' ) )
{
uniqueDescription = GetAerondightTooltipDescription( item );
uniqueDescription = GetAerondightTooltipDescription( itemInvComponent, item );
}


Expand Down Expand Up @@ -1999,7 +2006,7 @@ class W3TooltipComponent
return rec;
}

public function GetAerondightTooltipDescription( sword : SItemUniqueId ) : string
public function GetAerondightTooltipDescription( itemInvComponent : CInventoryComponent, sword : SItemUniqueId ) : string
{
var uniqueDesc : string;
var argsString : array<string>;
Expand All @@ -2014,7 +2021,7 @@ class W3TooltipComponent
argsString.Clear();


val_1 = thePlayer.inv.GetItemModifierFloat( sword, 'PermDamageBoost' );
val_1 = itemInvComponent.GetItemModifierFloat( sword, 'PermDamageBoost' );


if( val_1 > 0 )
Expand All @@ -2027,7 +2034,7 @@ class W3TooltipComponent
}


val_2 = thePlayer.GetLevel() - thePlayer.inv.GetItemLevel( sword ) + 1;
val_2 = thePlayer.GetLevel() - itemInvComponent.GetItemLevel( sword ) + 1;

dm.GetAbilityAttributeValue( 'AerondightEffect', 'stacks_per_level', min, max );
val_2 *= min.valueAdditive;
Expand Down
2 changes: 1 addition & 1 deletion scripts/game/gui/hud/modules/hudModuleBuffs.ws
Expand Up @@ -351,7 +351,7 @@ class CR4HudModuleBuffs extends CR4HudModuleBase
{
l_flashObject.SetMemberFlashNumber("duration", oilEffect.GetAmmoMaxCount() * 1.0 );
l_flashObject.SetMemberFlashNumber("initialDuration", oilEffect.GetAmmoMaxCount() * 1.0 );
l_flashObject.SetMemberFlashInt("format", 3);
l_flashObject.SetMemberFlashInt("format", 0);
}

else
Expand Down
15 changes: 11 additions & 4 deletions scripts/game/gui/hud/modules/hudModuleItemInfo.ws
Expand Up @@ -54,6 +54,8 @@ class CR4HudModuleItemInfo extends CR4HudModuleBase

private var m_previousShowButtonHints : int; default m_previousShowButtonHints = -1;
private var m_previousSetItemInfo : array< SHudItemInfo >;
private var m_fPlayerSwitchForceHideTime : float;
default m_fPlayerSwitchForceHideTime = 0.0f;

event OnConfigUI()
{
Expand Down Expand Up @@ -110,11 +112,14 @@ class CR4HudModuleItemInfo extends CR4HudModuleBase
if( m_IsPlayerCiri != thePlayer.IsCiri() )
{
m_IsPlayerCiri = thePlayer.IsCiri();
if( m_IsPlayerCiri )
{
ClearItems();
}
ClearItems();
m_fPlayerSwitchForceHideTime = 1.f;
}

if (m_fPlayerSwitchForceHideTime > 0.f)
{
m_fxHideSlotsSFF.InvokeSelfOneArg(FlashArgBool(!m_IsPlayerCiri));
m_fPlayerSwitchForceHideTime -= timeDelta;
}

if( m_IsPlayerCiri )
Expand Down Expand Up @@ -325,6 +330,8 @@ class CR4HudModuleItemInfo extends CR4HudModuleBase
m_currentItemSelected = dummy;
m_currentItemOnSlot1 = dummy;
m_currentItemOnSlot2 = dummy;
m_currentItemOnSlot3 = dummy;
m_currentItemOnSlot4 = dummy;
}

public function UpdateItemData(item : SItemUniqueId, bindingID : HudItemInfoBinding)
Expand Down
10 changes: 7 additions & 3 deletions scripts/game/gui/hud/modules/hudModuleWolfHead.ws
Expand Up @@ -57,12 +57,14 @@ class CR4HudModuleWolfHead extends CR4HudModuleBase
private var m_lockedToxicity : float;
private var m_curVitality : float;
private var m_maxVitality : float;
private var m_bForceToxicityUpdate : bool;



default m_iCurrentPositiveEffectsSize = 0;
default m_iCurrentNegativeEffectsSize = 0;
default m_IsPlayerCiri = false;
default m_bForceToxicityUpdate = false;

event OnConfigUI()
{
Expand Down Expand Up @@ -233,10 +235,10 @@ class CR4HudModuleWolfHead extends CR4HudModuleBase
m_curToxicity = curToxicity;
m_lockedToxicity = curLockedToxicity;

if ( m_LastToxicity != curToxicity || m_LastMaxToxicity != curMaxToxicity || m_LastLockedToxicity != curLockedToxicity )
if ( m_bForceToxicityUpdate || m_LastToxicity != curToxicity || m_LastMaxToxicity != curMaxToxicity || m_LastLockedToxicity != curLockedToxicity )
{

if( m_LastLockedToxicity != curLockedToxicity || m_LastMaxToxicity != curMaxToxicity)
if( m_bForceToxicityUpdate || m_LastLockedToxicity != curLockedToxicity || m_LastMaxToxicity != curMaxToxicity)
{
m_fxSetLockedToxicity.InvokeSelfOneArg( FlashArgNumber( ( curLockedToxicity )/ curMaxToxicity ) );
m_LastLockedToxicity = curLockedToxicity;
Expand All @@ -247,12 +249,13 @@ class CR4HudModuleWolfHead extends CR4HudModuleBase

damageThreshold = GetWitcherPlayer().GetToxicityDamageThreshold();
curDeadlyToxicity = ( (curToxicity + curLockedToxicity) >= damageThreshold * curMaxToxicity );
if( m_bLastDeadlyToxicity != curDeadlyToxicity )
if( m_bForceToxicityUpdate || m_bLastDeadlyToxicity != curDeadlyToxicity )
{
m_fxSetDeadlyToxicity.InvokeSelfOneArg( FlashArgBool( curDeadlyToxicity ) );
m_bLastDeadlyToxicity = curDeadlyToxicity;
}

m_bForceToxicityUpdate = false;

}
}
Expand Down Expand Up @@ -356,6 +359,7 @@ class CR4HudModuleWolfHead extends CR4HudModuleBase
if( thePlayer.IsCiri() != m_IsPlayerCiri )
{
m_IsPlayerCiri = thePlayer.IsCiri();
m_bForceToxicityUpdate = true;
m_fxSetCiriAsMainCharacter.InvokeSelfOneArg(FlashArgBool(m_IsPlayerCiri));
DisplayNewLevelIndicator();
}
Expand Down

0 comments on commit 4ae83ef

Please sign in to comment.