1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
ZO_TRADE_BOP_ICON = "EsoUI/Art/Inventory/inventory_Tradable_icon.dds"
return sharedInventoryManager
end
end
end
end )
{
-- with the addition of Craft Bags the bank bag could be modified by the automatic transfer
-- of bank contents to the Craft Bag on joining a region
end ,
end ,
} )
{
end ,
} )
{
end ,
end ,
} )
end
local function OnInventorySlotUpdated ( eventCode , bagId , slotIndex , isNewItem , itemSoundCategory , updateReason )
if updateReason == INVENTORY_UPDATE_REASON_DURABILITY_CHANGE then
if newCondition == 100 then
end
end
self . refresh : RefreshSingle ( "inventory" , bagId , slotIndex , isNewItem , itemSoundCategory , updateReason )
if bagId == BAG_BACKPACK or bagId == BAG_VIRTUAL then
if isNewItem and GetCraftingInteractionType ( ) == CRAFTING_TYPE_INVALID and not SYSTEMS : IsShowing ( "crownCrate" ) then
end
end
if bagId == BAG_WORN and eventCode == EVENT_INVENTORY_SINGLE_SLOT_UPDATE then
if updateReason == INVENTORY_UPDATE_REASON_DEFAULT then
if slotHasItem then
else
end
end
if updateReason == INVENTORY_UPDATE_REASON_DURABILITY_CHANGE then
if effectivenessReduced then
end
end
end
end
end
EVENT_MANAGER : RegisterForEvent ( namespace , EVENT_INVENTORY_SINGLE_SLOT_UPDATE , OnInventorySlotUpdated )
end
EVENT_MANAGER : RegisterForEvent ( namespace , EVENT_GUILD_BANK_ITEM_ADDED , OnGuildBankInventorySlotUpdated )
EVENT_MANAGER : RegisterForEvent ( namespace , EVENT_GUILD_BANK_ITEM_REMOVED , OnGuildBankInventorySlotUpdated )
EVENT_MANAGER : RegisterForEvent ( namespace , EVENT_GUILD_BANK_UPDATED_QUANTITY , OnGuildBankInventorySlotUpdated )
end
end
end
EVENT_MANAGER : RegisterForEvent ( namespace , EVENT_QUEST_CONDITION_COUNTER_CHANGED , OnSingleQuestUpdated )
local wasInitialize = ( reason == CURRENCY_CHANGE_REASON_PLAYER_INIT )
local wasItemPurchased = ( reason == CURRENCY_CHANGE_REASON_VENDOR ) and ( newMoney < oldMoney )
if ( not ( wasItemPurchased or wasInitialize ) ) then
end
end
local isExcludedReason = changeReason == CURRENCY_CHANGE_REASON_PLAYER_INIT or
changeReason == CURRENCY_CHANGE_REASON_LOOT or
changeReason == CURRENCY_CHANGE_REASON_PVP_KILL_TRANSFER or
changeReason == CURRENCY_CHANGE_REASON_DEATH or
changeReason == CURRENCY_CHANGE_REASON_BANK_FEE or
( changeReason == CURRENCY_CHANGE_REASON_VENDOR and newTelvarStones < oldTelvarStones )
if ( not isExcludedReason ) then
end
end
end
end
end
function ZO_SharedInventoryManager : RefreshSingleSlot ( bagId , slotIndex , isNewItem , itemSoundCategory , updateReason )
end
end
-- where ... are bag ids to combined into a single data table
local filteredItems = { }
filteredItems [ # filteredItems + 1 ] = itemData
end
end
end
return filteredItems
end
if bagCache [ slotIndex ] then
return bagCache [ slotIndex ]
end
end
for i = 1 , numBagIds do
return false
end
end
end
return true
end
--Quest Items
end
end
if singleQuestCache then
return singleQuestCache
end
end
for questIndex = 1 , MAX_JOURNAL_QUESTS do
end
end
-- Helper functions for new items
return true
end
end
end
return false
end
if slotData then
slotData . age = 0
end
end
if slotData then
end
return false
end
if slotData then
return slotData . uniqueId
end
end
--[[ Shared Guild Bank functions ]] --
local validId
for i = 1 , numGuilds do
local bankPermission = DoesPlayerHaveGuildPermission ( guildId , GUILD_PERMISSION_BANK_DEPOSIT ) or DoesPlayerHaveGuildPermission ( guildId , GUILD_PERMISSION_BANK_WITHDRAW ) or DoesPlayerHaveGuildPermission ( guildId , GUILD_PERMISSION_BANK_WITHDRAW_GOLD )
if ( bankPermission ) then
if ( lastSuccessfulGuildBankId == guildId ) then
return
elseif ( validId == nil ) then
validId = guildId
end
end
end
if ( validId ) then
elseif ( numGuilds > 0 ) then
end
end
--[[ Private API ]] --
end
end
end
end
while slotIndex do
end
end
local SHARED_INVENTORY_SLOT_RESULT_REMOVED = 1
local SHARED_INVENTORY_SLOT_RESULT_ADDED = 2
local SHARED_INVENTORY_SLOT_RESULT_UPDATED = 3
local SHARED_INVENTORY_SLOT_RESULT_NO_CHANGE = 4
local SHARED_INVENTORY_SLOT_RESULT_REMOVE_AND_ADD = 5
function ZO_SharedInventoryManager : HandleSlotCreationOrUpdate ( bagCache , bagId , slotIndex , isNewItem )
local existingSlotData = bagCache [ slotIndex ]
bagCache [ slotIndex ] = slotData
if result == SHARED_INVENTORY_SLOT_RESULT_REMOVED then
elseif result == SHARED_INVENTORY_SLOT_RESULT_ADDED then
elseif result == SHARED_INVENTORY_SLOT_RESULT_UPDATED then
elseif result == SHARED_INVENTORY_SLOT_RESULT_REMOVE_AND_ADD then
end
end
function ZO_SharedInventoryManager : CreateOrUpdateSlotData ( existingSlotData , bagId , slotIndex , isNewItem )
local icon , stackCount , sellPrice , meetsUsageRequirement , locked , equipType , _ , quality = GetItemInfo ( bagId , slotIndex )
local hadItemInSlotBefore = false
local wasSameItemInSlotBefore = false
local hasItemInSlotNow = ( stackCount > 0 )
local slot = existingSlotData
if not slot then
if hasItemInSlotNow then
slot = { }
end
else
hadItemInSlotBefore = slot . stackCount > 0
wasSameItemInSlotBefore = hadItemInSlotBefore and hasItemInSlotNow and slot . itemInstanceId == newItemInstanceId
end
if not hasItemInSlotNow then
if hadItemInSlotBefore then
return nil , SHARED_INVENTORY_SLOT_RESULT_REMOVED
end
return nil , SHARED_INVENTORY_SLOT_RESULT_NO_CHANGE
end
local rawNameBefore = slot . rawName ;
if rawNameBefore ~= slot . rawName then
end
if not wasSameItemInSlotBefore then
end
slot . iconFile = icon
slot . stackCount = stackCount
slot . sellPrice = sellPrice
slot . launderPrice = launderPrice
slot . stackSellPrice = stackCount * sellPrice
slot . stackLaunderPrice = stackCount * launderPrice
slot . bagId = bagId
slot . slotIndex = slotIndex
slot . meetsUsageRequirement = meetsUsageRequirement or ( bagId == BAG_WORN ) --Items flagged equipped unique can only have one equipped, which means once they are
slot . locked = locked --equipped they are no longer equippable, but we don't want to color these items red
slot . quality = quality --in GamepadInventory once they are equipped, because that doesn't make any sense.
slot . equipType = equipType
slot . itemInstanceId = newItemInstanceId
if wasSameItemInSlotBefore and slot . age ~= 0 then
-- don't modify the age, keep it the same relative sort - for now?
elseif isNewItem then
else
slot . age = 0
end
if hadItemInSlotBefore then
if isNewItem then
return slot , SHARED_INVENTORY_SLOT_RESULT_REMOVE_AND_ADD
else
return slot , SHARED_INVENTORY_SLOT_RESULT_UPDATED
end
end
return slot , SHARED_INVENTORY_SLOT_RESULT_ADDED
end
--Quest Items Private API--
end
end
for questIndex = 1 , MAX_JOURNAL_QUESTS do
end
end
-- First update all the tools for the quest...
self : CreateQuestData ( icon , stack , questIndex , toolIndex , QUEST_MAIN_STEP_INDEX , nil , name , questItemId , SEARCH_TYPE_QUEST_TOOL )
end
-- Then update all the collectable items...
self : CreateQuestData ( icon , stack , questIndex , nil , stepIndex , conditionIndex , name , questItemId , SEARCH_TYPE_QUEST_ITEM )
end
end
end
end
function ZO_SharedInventoryManager : CreateQuestData ( iconFile , stackCount , questIndex , toolIndex , stepIndex , conditionIndex , name , questItemId , searchType )
if ( stackCount > 0 ) then
--store all tools and items in a subtable under the questIndex for faster access
if ( not questCache [ questIndex ] ) then
questCache [ questIndex ] = { }
end
local questItems = questCache [ questIndex ]
local questItem =
{
iconFile = iconFile ,
stackCount = stackCount ,
questIndex = questIndex ,
toolIndex = toolIndex ,
stepIndex = stepIndex ,
conditionIndex = conditionIndex ,
sellPrice = 0 ,
stackSellPrice = 0 ,
filterData = { ITEMFILTERTYPE_QUEST } ,
questItemId = questItemId ,
age = 0 , -- 0 for now, probably need to come up with a way to make these appear new when appropriate. maybe diffing what was there before with what's being added?
}
questItems [ questItemId ] = questItem
end
end
do
ZO_CurrencyControl_SetSimpleCurrency ( currencyLabel , CURT_MONEY , GetCarriedCurrencyAmount ( CURT_MONEY ) , currencyOptions )
end
ZO_CurrencyControl_SetSimpleCurrency ( alliancePointsLabel , CURT_ALLIANCE_POINTS , GetAlliancePoints ( ) , alliancePointsOptions )
end
end
ZO_CurrencyControl_SetSimpleCurrency ( currencyLabel , CURT_MONEY , GetGuildBankedMoney ( ) , currencyOptions )
end
local dirty = true
dirty = true
else
dirty = false
end
end )
if dirty then
dirty = false
end
end
end
end
end
function ZO_SharedInventory_ConnectPlayerAlliancePointsLabel ( alliancePointsLabel , alliancePointsOptions )
ConnectPlayerLabel ( alliancePointsLabel , alliancePointsOptions , EVENT_ALLIANCE_POINT_UPDATE , UpdateAlliancePoints )
end
end
ConnectPlayerLabel ( currencyLabel , currencyOptions , EVENT_GUILD_BANKED_MONEY_UPDATE , UpdateGuildBankedMoney )
end
end
-- Globals --
ZO_INVENTORY_STAT_GROUPS =
{
{
STAT_MAGICKA_MAX ,
STAT_MAGICKA_REGEN_COMBAT ,
STAT_HEALTH_MAX ,
STAT_HEALTH_REGEN_COMBAT ,
STAT_STAMINA_MAX ,
STAT_STAMINA_REGEN_COMBAT ,
} ,
{
STAT_SPELL_POWER ,
STAT_SPELL_CRITICAL ,
STAT_POWER ,
STAT_CRITICAL_STRIKE ,
} ,
{
STAT_SPELL_RESIST ,
STAT_PHYSICAL_RESIST ,
STAT_CRITICAL_RESISTANCE ,
} ,
}
--Used to take the variable returns from CompareBagItemToCurrentlyEquipped or CompareItemLinkToCurrentlyEquipped
-- and put them in a hash table for more covenient lookups
local statDeltaLookup = { }
statDeltaLookup [ changedStat ] = changeAmount
end
return statDeltaLookup
end
local EQUIP_SLOTS =
{
EQUIP_SLOT_HEAD ,
EQUIP_SLOT_NECK ,
EQUIP_SLOT_CHEST ,
EQUIP_SLOT_SHOULDERS ,
EQUIP_SLOT_MAIN_HAND ,
EQUIP_SLOT_OFF_HAND ,
EQUIP_SLOT_WAIST ,
EQUIP_SLOT_LEGS ,
EQUIP_SLOT_FEET ,
EQUIP_SLOT_COSTUME ,
EQUIP_SLOT_RING1 ,
EQUIP_SLOT_RING2 ,
EQUIP_SLOT_HAND ,
EQUIP_SLOT_BACKUP_MAIN ,
EQUIP_SLOT_BACKUP_OFF ,
}
if ( result ~= nil ) then
return result
end
end
end |