481 lines
17 KiB
Plaintext
481 lines
17 KiB
Plaintext
const int NEXT_DIRECTION = 1;
|
|
const int PREVIOUS_DIRECTION = 2;
|
|
|
|
const int ITEM_VISUAL_NONE = -999;
|
|
const string CURRENT_WEAPON_GLOW = "weaponGlow";
|
|
|
|
|
|
void mdg_RemoveCurrentWeaponGlow(object oItem)
|
|
{
|
|
itemproperty ipItemProp = GetFirstItemProperty(oItem);
|
|
int nVisualEffect = ITEM_VISUAL_NONE;
|
|
|
|
while(GetIsItemPropertyValid(ipItemProp))
|
|
{
|
|
if( GetItemPropertyType(ipItemProp) == ITEM_PROPERTY_VISUALEFFECT )
|
|
{
|
|
RemoveItemProperty(oItem, ipItemProp);
|
|
}
|
|
|
|
ipItemProp = GetNextItemProperty(oItem);
|
|
}
|
|
}
|
|
|
|
|
|
int mdg_GetWeaponGlowNeighbour(int nVisualEffect, int nDirection)
|
|
{
|
|
if( nVisualEffect == ITEM_VISUAL_ACID )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_COLD;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_NONE;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_COLD )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_ELECTRICAL;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_ACID;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_ELECTRICAL )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_EVIL;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_COLD;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_EVIL )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_FIRE;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_ELECTRICAL;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_FIRE )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_HOLY;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_EVIL;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_HOLY )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_SONIC;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_FIRE;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_SONIC )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_NONE;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_HOLY;
|
|
}
|
|
}
|
|
else if( nVisualEffect == ITEM_VISUAL_NONE )
|
|
{
|
|
if(nDirection == NEXT_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_ACID;
|
|
}
|
|
else if(nDirection == PREVIOUS_DIRECTION)
|
|
{
|
|
return ITEM_VISUAL_SONIC;
|
|
}
|
|
}
|
|
|
|
return ITEM_VISUAL_NONE;
|
|
}
|
|
|
|
|
|
|
|
|
|
int lcs_GetWeaponModelLowerBound(object oItem, int nPart)
|
|
{
|
|
int nWeaponType = GetBaseItemType(oItem);
|
|
if(nPart == ITEM_APPR_WEAPON_MODEL_TOP)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 6;
|
|
case BASE_ITEM_BATTLEAXE : return 8;
|
|
case BASE_ITEM_CLUB : return 4;
|
|
case BASE_ITEM_DAGGER : return 6;
|
|
case BASE_ITEM_DIREMACE : return 4;
|
|
case BASE_ITEM_DOUBLEAXE : return 3;
|
|
case BASE_ITEM_DWARVENWARAXE : return 8;
|
|
case BASE_ITEM_GREATAXE : return 4;
|
|
case BASE_ITEM_GREATSWORD : return 4;
|
|
case BASE_ITEM_HALBERD : return 4;
|
|
case BASE_ITEM_HANDAXE : return 4;
|
|
case BASE_ITEM_HEAVYCROSSBOW : return 4;
|
|
case BASE_ITEM_HEAVYFLAIL : return 4;
|
|
//case BASE_ITEM_KAMA : return ;
|
|
case BASE_ITEM_KATANA : return 4;
|
|
//case BASE_ITEM_KUKRI : return ;
|
|
case BASE_ITEM_LIGHTCROSSBOW : return 4;
|
|
case BASE_ITEM_LIGHTFLAIL : return 4;
|
|
case BASE_ITEM_LIGHTHAMMER : return 4;
|
|
case BASE_ITEM_LIGHTMACE : return 4;
|
|
case BASE_ITEM_LONGBOW : return 8;
|
|
case BASE_ITEM_LONGSWORD : return 8;
|
|
case BASE_ITEM_MAGICSTAFF : return 6;
|
|
case BASE_ITEM_MORNINGSTAR : return 4;
|
|
case BASE_ITEM_QUARTERSTAFF : return 4;
|
|
case BASE_ITEM_RAPIER : return 4;
|
|
case BASE_ITEM_SCIMITAR : return 5;
|
|
// case BASE_ITEM_SCYTHE : return 4;
|
|
case BASE_ITEM_SCYTHE : return 3;
|
|
case BASE_ITEM_SHORTBOW : return 6;
|
|
case BASE_ITEM_SHORTSPEAR : return 4;
|
|
case BASE_ITEM_SHORTSWORD : return 6;
|
|
//case BASE_ITEM_SICKLE : return ;
|
|
//case BASE_ITEM_SLING : return ;
|
|
case BASE_ITEM_THROWINGAXE : return 4;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 3;
|
|
case BASE_ITEM_WARHAMMER : return 6;
|
|
}
|
|
}
|
|
else if(nPart == ITEM_APPR_WEAPON_MODEL_MIDDLE)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 6;
|
|
case BASE_ITEM_BATTLEAXE : return 6;
|
|
case BASE_ITEM_CLUB : return 4;
|
|
case BASE_ITEM_DAGGER : return 6;
|
|
case BASE_ITEM_DIREMACE : return 4;
|
|
case BASE_ITEM_DOUBLEAXE : return 3;
|
|
case BASE_ITEM_DWARVENWARAXE : return 6;
|
|
case BASE_ITEM_GREATAXE : return 4;
|
|
case BASE_ITEM_GREATSWORD : return 4;
|
|
case BASE_ITEM_HALBERD : return 4;
|
|
case BASE_ITEM_HANDAXE : return 4;
|
|
case BASE_ITEM_HEAVYCROSSBOW : return 4;
|
|
case BASE_ITEM_HEAVYFLAIL : return 4;
|
|
//case BASE_ITEM_KAMA : return ;
|
|
case BASE_ITEM_KATANA : return 4;
|
|
//case BASE_ITEM_KUKRI : return ;
|
|
case BASE_ITEM_LIGHTCROSSBOW : return 4;
|
|
case BASE_ITEM_LIGHTFLAIL : return 4;
|
|
case BASE_ITEM_LIGHTHAMMER : return 4;
|
|
case BASE_ITEM_LIGHTMACE : return 4;
|
|
case BASE_ITEM_LONGBOW : return 8;
|
|
case BASE_ITEM_LONGSWORD : return 8;
|
|
// case BASE_ITEM_MAGICSTAFF : return 8;
|
|
case BASE_ITEM_MAGICSTAFF : return 6;
|
|
case BASE_ITEM_MORNINGSTAR : return 4;
|
|
case BASE_ITEM_QUARTERSTAFF : return 4;
|
|
case BASE_ITEM_RAPIER : return 4;
|
|
case BASE_ITEM_SCIMITAR : return 5;
|
|
// case BASE_ITEM_SCYTHE : return 4;
|
|
case BASE_ITEM_SCYTHE : return 3;
|
|
case BASE_ITEM_SHORTBOW : return 6;
|
|
case BASE_ITEM_SHORTSPEAR : return 4;
|
|
case BASE_ITEM_SHORTSWORD : return 6;
|
|
//case BASE_ITEM_SICKLE : return ;
|
|
//case BASE_ITEM_SLING : return ;
|
|
case BASE_ITEM_THROWINGAXE : return 4;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 3;
|
|
case BASE_ITEM_WARHAMMER : return 6;
|
|
}
|
|
}
|
|
else if(nPart == ITEM_APPR_WEAPON_MODEL_BOTTOM)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 6;
|
|
case BASE_ITEM_BATTLEAXE : return 6;
|
|
case BASE_ITEM_CLUB : return 4;
|
|
case BASE_ITEM_DAGGER : return 6;
|
|
case BASE_ITEM_DIREMACE : return 4;
|
|
case BASE_ITEM_DOUBLEAXE : return 3;
|
|
case BASE_ITEM_DWARVENWARAXE : return 6;
|
|
case BASE_ITEM_GREATAXE : return 4;
|
|
case BASE_ITEM_GREATSWORD : return 4;
|
|
case BASE_ITEM_HALBERD : return 4;
|
|
case BASE_ITEM_HANDAXE : return 4;
|
|
case BASE_ITEM_HEAVYCROSSBOW : return 4;
|
|
case BASE_ITEM_HEAVYFLAIL : return 4;
|
|
//case BASE_ITEM_KAMA : return ;
|
|
case BASE_ITEM_KATANA : return 4;
|
|
//case BASE_ITEM_KUKRI : return ;
|
|
case BASE_ITEM_LIGHTCROSSBOW : return 4;
|
|
case BASE_ITEM_LIGHTFLAIL : return 4;
|
|
case BASE_ITEM_LIGHTHAMMER : return 4;
|
|
case BASE_ITEM_LIGHTMACE : return 4;
|
|
case BASE_ITEM_LONGBOW : return 8;
|
|
case BASE_ITEM_LONGSWORD : return 8;
|
|
case BASE_ITEM_MAGICSTAFF : return 6;
|
|
case BASE_ITEM_MORNINGSTAR : return 4;
|
|
case BASE_ITEM_QUARTERSTAFF : return 4;
|
|
case BASE_ITEM_RAPIER : return 4;
|
|
case BASE_ITEM_SCIMITAR : return 5;
|
|
// case BASE_ITEM_SCYTHE : return 4;
|
|
case BASE_ITEM_SCYTHE : return 3;
|
|
case BASE_ITEM_SHORTBOW : return 6;
|
|
case BASE_ITEM_SHORTSPEAR : return 4;
|
|
case BASE_ITEM_SHORTSWORD : return 6;
|
|
//case BASE_ITEM_SICKLE : return ;
|
|
//case BASE_ITEM_SLING : return ;
|
|
case BASE_ITEM_THROWINGAXE : return 4;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 3;
|
|
case BASE_ITEM_WARHAMMER : return 6;
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
//For Shadowhawk Weapons Hak use ONLY
|
|
int lcs_GetWeaponModelUpperBound(object oItem, int nPart)
|
|
{
|
|
int nWeaponType = GetBaseItemType(oItem);
|
|
if(nPart == ITEM_APPR_WEAPON_MODEL_TOP)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 22;
|
|
case BASE_ITEM_BATTLEAXE : return 25;
|
|
case BASE_ITEM_DOUBLEAXE : return 14;
|
|
case BASE_ITEM_GREATAXE : return 22;
|
|
case BASE_ITEM_GREATSWORD : return 15;
|
|
case BASE_ITEM_KATANA : return 12;
|
|
case BASE_ITEM_LIGHTMACE : return 22;
|
|
case BASE_ITEM_LONGBOW : return 11;
|
|
case BASE_ITEM_LONGSWORD : return 21;
|
|
case BASE_ITEM_RAPIER : return 13;
|
|
case BASE_ITEM_SCIMITAR : return 18;
|
|
case BASE_ITEM_SHORTSWORD : return 19;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 16;
|
|
case BASE_ITEM_WARHAMMER : return 20;
|
|
}
|
|
}
|
|
else if(nPart == ITEM_APPR_WEAPON_MODEL_MIDDLE)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 24;
|
|
case BASE_ITEM_BATTLEAXE : return 25;
|
|
case BASE_ITEM_DOUBLEAXE : return 12;
|
|
case BASE_ITEM_GREATAXE : return 13;
|
|
case BASE_ITEM_GREATSWORD : return 18;
|
|
case BASE_ITEM_KATANA : return 13;
|
|
case BASE_ITEM_LIGHTMACE : return 18;
|
|
case BASE_ITEM_LONGBOW : return 20;
|
|
case BASE_ITEM_LONGSWORD : return 22;
|
|
case BASE_ITEM_RAPIER : return 24;
|
|
case BASE_ITEM_SCIMITAR : return 15;
|
|
case BASE_ITEM_SHORTSWORD : return 20;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 16;
|
|
case BASE_ITEM_WARHAMMER : return 16;
|
|
}
|
|
}
|
|
else if(nPart == ITEM_APPR_WEAPON_MODEL_BOTTOM)
|
|
{
|
|
switch(nWeaponType)
|
|
{
|
|
case BASE_ITEM_BASTARDSWORD : return 20;
|
|
case BASE_ITEM_BATTLEAXE : return 16;
|
|
case BASE_ITEM_DOUBLEAXE : return 18;
|
|
case BASE_ITEM_GREATAXE : return 18;
|
|
case BASE_ITEM_GREATSWORD : return 15;
|
|
case BASE_ITEM_KATANA : return 13;
|
|
case BASE_ITEM_LIGHTMACE : return 11;
|
|
case BASE_ITEM_LONGSWORD : return 22;
|
|
case BASE_ITEM_RAPIER : return 16;
|
|
case BASE_ITEM_SCIMITAR : return 15;
|
|
case BASE_ITEM_SHORTSWORD : return 13;
|
|
case BASE_ITEM_TWOBLADEDSWORD : return 18;
|
|
case BASE_ITEM_WARHAMMER : return 21;
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int lcs_GetNextValidWeaponModel(object oItem, int nPart)
|
|
{
|
|
int nLowerBound = lcs_GetWeaponModelLowerBound(oItem, nPart);
|
|
//int nUpperBound = lcs_GetWeaponModelUpperBound(oItem, nPart);
|
|
int nUpperBound = 1;
|
|
|
|
int nCurrentAppearance = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart);
|
|
|
|
if(nCurrentAppearance == nLowerBound)
|
|
{
|
|
if(nUpperBound >= 11)
|
|
{
|
|
return 11;
|
|
}
|
|
else
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
else if((nCurrentAppearance == nUpperBound) && (nUpperBound >= 11))
|
|
{
|
|
return 1;
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_DOUBLEAXE) && (nPart == ITEM_APPR_WEAPON_MODEL_TOP)) && (nCurrentAppearance == 11))
|
|
{
|
|
return 13;
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_BASTARDSWORD) && (nPart == ITEM_APPR_WEAPON_MODEL_TOP)) && (nCurrentAppearance == 19))
|
|
{
|
|
return 21;
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_LONGSWORD) && (nPart == ITEM_APPR_WEAPON_MODEL_BOTTOM)) && (nCurrentAppearance == 17))
|
|
{
|
|
return 20;
|
|
}
|
|
else
|
|
{
|
|
return nCurrentAppearance + 1;
|
|
}
|
|
}
|
|
|
|
int lcs_GetPreviousValidWeaponModel(object oItem, int nPart)
|
|
{
|
|
int nLowerBound = lcs_GetWeaponModelLowerBound(oItem, nPart);
|
|
//int nUpperBound = lcs_GetWeaponModelUpperBound(oItem, nPart);
|
|
int nUpperBound = 1;
|
|
|
|
int nCurrentAppearance = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart);
|
|
|
|
if(nCurrentAppearance == 11)
|
|
{
|
|
return nLowerBound;
|
|
}
|
|
else if(nCurrentAppearance == 1)
|
|
{
|
|
if(nUpperBound >= 11)
|
|
{
|
|
return nUpperBound;
|
|
}
|
|
else
|
|
{
|
|
return nLowerBound;
|
|
}
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_DOUBLEAXE) && (nPart == ITEM_APPR_WEAPON_MODEL_TOP)) && (nCurrentAppearance == 13))
|
|
{
|
|
return 11;
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_BASTARDSWORD) && (nPart == ITEM_APPR_WEAPON_MODEL_TOP)) && (nCurrentAppearance == 21))
|
|
{
|
|
return 19;
|
|
}
|
|
else if(((GetBaseItemType(oItem) == BASE_ITEM_LONGSWORD) && (nPart == ITEM_APPR_WEAPON_MODEL_BOTTOM)) && (nCurrentAppearance == 20))
|
|
{
|
|
return 17;
|
|
}
|
|
else
|
|
{
|
|
return nCurrentAppearance - 1;
|
|
}
|
|
}
|
|
|
|
int lcs_GetNextValidWeaponColor(object oItem, int nPart)
|
|
{
|
|
int nAppearance = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart);
|
|
if(nAppearance == 4)
|
|
{
|
|
nAppearance = 1;
|
|
}
|
|
else
|
|
{
|
|
nAppearance = nAppearance + 1;
|
|
}
|
|
return nAppearance;
|
|
}
|
|
|
|
int lcs_GetPreviousValidWeaponColor(object oItem, int nPart)
|
|
{
|
|
int nAppearance = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart);
|
|
if(nAppearance == 1)
|
|
{
|
|
nAppearance = 4;
|
|
}
|
|
else
|
|
{
|
|
nAppearance = nAppearance - 1;
|
|
}
|
|
return nAppearance;
|
|
}
|
|
|
|
|
|
void mdg_GetNextValidWeaponGlow(object oItem)
|
|
{
|
|
int nWeaponGlow = GetLocalInt(oItem, CURRENT_WEAPON_GLOW);
|
|
|
|
mdg_RemoveCurrentWeaponGlow( oItem );
|
|
int nNewVisualType = mdg_GetWeaponGlowNeighbour(nWeaponGlow, NEXT_DIRECTION);
|
|
itemproperty ipNewVisual = ItemPropertyVisualEffect(nNewVisualType);
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ipNewVisual, oItem);
|
|
SetLocalInt(oItem, CURRENT_WEAPON_GLOW,nNewVisualType);
|
|
}
|
|
|
|
void mdg_GetPreviousValidWeaponGlow(object oItem)
|
|
{
|
|
int nWeaponGlow = GetLocalInt(oItem, CURRENT_WEAPON_GLOW);
|
|
|
|
mdg_RemoveCurrentWeaponGlow( oItem );
|
|
int nNewVisualType = mdg_GetWeaponGlowNeighbour(nWeaponGlow, PREVIOUS_DIRECTION);
|
|
itemproperty ipNewVisual = ItemPropertyVisualEffect(nNewVisualType);
|
|
AddItemProperty(DURATION_TYPE_PERMANENT, ipNewVisual, oItem);
|
|
SetLocalInt(oItem, CURRENT_WEAPON_GLOW,nNewVisualType);
|
|
}
|
|
|
|
void lcs_ModifyColorandEquipNewWeapon(object oItem, int nPart, int nAppearance)
|
|
{
|
|
object oPC = GetItemPossessor(oItem);
|
|
object oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart, nAppearance);
|
|
DestroyObject(oItem);
|
|
SetCommandable(TRUE, oPC);
|
|
AssignCommand(oPC, ActionEquipItem(oNewItem, INVENTORY_SLOT_RIGHTHAND));
|
|
}
|
|
|
|
void lcs_ModifyandEquipNewWeapon(object oItem, int nPart, int nAppearance)
|
|
{
|
|
object oPC = GetItemPossessor(oItem);
|
|
|
|
//int nColorAppearance = GetItemAppearance(oItem, ITEM_APPR_TYPE_WEAPON_COLOR, nPart);
|
|
//if(nColorAppearance > 3)
|
|
//{
|
|
//SendMessageToPC(oPC, ("Your current weapon color is " + IntToString(nAppearance) + ". Please change the color to be set to 3 or lower before changing the weapon model."));
|
|
//return;
|
|
//}
|
|
object oNewItem = CopyItemAndModify(oItem, ITEM_APPR_TYPE_WEAPON_MODEL, nPart, nAppearance);
|
|
DestroyObject(oItem);
|
|
SetCommandable(TRUE, oPC);
|
|
AssignCommand(oPC, ActionEquipItem(oNewItem, INVENTORY_SLOT_RIGHTHAND));
|
|
}
|