Initial work on gifting (still broken right now), and sry zach

This commit is contained in:
DenialMC 2015-05-16 13:23:30 +03:00
parent 87a77a8740
commit 0f4521a19e
14 changed files with 45 additions and 168 deletions

View file

@ -295,7 +295,6 @@ from toontown.estate import DistributedEstate/AI
from toontown.estate import DistributedHouse/AI from toontown.estate import DistributedHouse/AI
from toontown.estate import DistributedHouseInterior/AI from toontown.estate import DistributedHouseInterior/AI
from toontown.estate import DistributedGarden/AI from toontown.estate import DistributedGarden/AI
from toontown.shtiker import DeleteManager/AI
from toontown.groups import GroupManager/AI/UD from toontown.groups import GroupManager/AI/UD
from toontown.ai import NewsManager/AI from toontown.ai import NewsManager/AI
from toontown.shtiker import PurchaseManager/AI from toontown.shtiker import PurchaseManager/AI
@ -303,7 +302,6 @@ from toontown.shtiker import NewbiePurchaseManager/AI
from toontown.safezone import SafeZoneManager/AI from toontown.safezone import SafeZoneManager/AI
from toontown.tutorial import TutorialManager/AI from toontown.tutorial import TutorialManager/AI
from toontown.catalog import CatalogManager/AI from toontown.catalog import CatalogManager/AI
from toontown.catalog import AccountDate/AI
from toontown.safezone import DistributedTreasure/AI from toontown.safezone import DistributedTreasure/AI
from toontown.coghq import DistributedCashbotBossTreasure/AI from toontown.coghq import DistributedCashbotBossTreasure/AI
from toontown.building import DistributedTrophyMgr/AI from toontown.building import DistributedTrophyMgr/AI
@ -1545,10 +1543,6 @@ dclass DistributedPartyTugOfWarActivity : DistributedPartyTeamActivity {
updateToonPositions(int16/1000) broadcast; updateToonPositions(int16/1000) broadcast;
}; };
dclass DeleteManager : DistributedObject {
setInventory(blob) airecv clsend;
};
dclass GroupManager : DistributedObject { dclass GroupManager : DistributedObject {
setChildId() clsend airecv; setChildId() clsend airecv;
isPlayerGrouped(uint32); isPlayerGrouped(uint32);
@ -1659,11 +1653,6 @@ dclass CatalogManager : DistributedObject {
startCatalog() airecv clsend; startCatalog() airecv clsend;
}; };
dclass AccountDate : DistributedObject {
requestDate() airecv clsend;
requestDateResult(string);
};
dclass DistributedTreasure : DistributedObject { dclass DistributedTreasure : DistributedObject {
setTreasureType(uint16) required broadcast ram; setTreasureType(uint16) required broadcast ram;
setPosition(int16/10, int16/10, int16/10) required broadcast ram; setPosition(int16/10, int16/10, int16/10) required broadcast ram;

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import * from pandac.PandaModules import *
hashVal = 2005027427 hashVal = 3860069384L
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
@ -11,7 +11,7 @@ from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, Dis
from toontown.uberdog.DistributedPartyManager import DistributedPartyManager from toontown.uberdog.DistributedPartyManager import DistributedPartyManager
from otp.friends import FriendManager from otp.friends import FriendManager
from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity
from toontown.shtiker import DeleteManager, PurchaseManager, NewbiePurchaseManager from toontown.shtiker import PurchaseManager, NewbiePurchaseManager
from toontown.groups import GroupManager from toontown.groups import GroupManager
from toontown.uberdog.ClientServicesManager import ClientServicesManager from toontown.uberdog.ClientServicesManager import ClientServicesManager
from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedReportMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedJorElCam from toontown.ai import WelcomeValleyManager, NewsManager, DistributedAprilToonsMgr, DistributedBlackCatMgr, DistributedReportMgr, DistributedPolarPlaceEffectMgr, DistributedGreenToonEffectMgr, DistributedResistanceEmoteMgr, DistributedScavengerHuntTarget, DistributedTrickOrTreatTarget, DistributedWinterCarolingTarget, DistributedJorElCam
@ -25,7 +25,7 @@ from toontown.safezone import DistributedTrolley, DistributedPartyGate, Distribu
from toontown.fishing import DistributedFishingPond, DistributedFishingTarget, DistributedPondBingoManager from toontown.fishing import DistributedFishingPond, DistributedFishingTarget, DistributedPondBingoManager
from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame
from toontown.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile from toontown.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile
from toontown.catalog import CatalogManager, AccountDate from toontown.catalog import CatalogManager
from toontown.parties import DistributedParty, DistributedPartyActivity, DistributedPartyTeamActivity, DistributedPartyCannon, DistributedPartyCannonActivity, DistributedPartyCatchActivity, DistributedPartyWinterCatchActivity, DistributedPartyCogActivity, DistributedPartyWinterCogActivity, DistributedPartyFireworksActivity, DistributedPartyDanceActivityBase, DistributedPartyDanceActivity, DistributedPartyDance20Activity, DistributedPartyValentineDanceActivity, DistributedPartyValentineDance20Activity, DistributedPartyTrampolineActivity, DistributedPartyValentineTrampolineActivity, DistributedPartyVictoryTrampolineActivity, DistributedPartyWinterTrampolineActivity, DistributedPartyTugOfWarActivity, DistributedPartyJukeboxActivityBase, DistributedPartyJukeboxActivity, DistributedPartyJukebox40Activity, DistributedPartyValentineJukeboxActivity, DistributedPartyValentineJukebox40Activity from toontown.parties import DistributedParty, DistributedPartyActivity, DistributedPartyTeamActivity, DistributedPartyCannon, DistributedPartyCannonActivity, DistributedPartyCatchActivity, DistributedPartyWinterCatchActivity, DistributedPartyCogActivity, DistributedPartyWinterCogActivity, DistributedPartyFireworksActivity, DistributedPartyDanceActivityBase, DistributedPartyDanceActivity, DistributedPartyDance20Activity, DistributedPartyValentineDanceActivity, DistributedPartyValentineDance20Activity, DistributedPartyTrampolineActivity, DistributedPartyValentineTrampolineActivity, DistributedPartyVictoryTrampolineActivity, DistributedPartyWinterTrampolineActivity, DistributedPartyTugOfWarActivity, DistributedPartyJukeboxActivityBase, DistributedPartyJukeboxActivity, DistributedPartyJukebox40Activity, DistributedPartyValentineJukeboxActivity, DistributedPartyValentineJukebox40Activity
from toontown.pets.DistributedPet import * from toontown.pets.DistributedPet import *
from toontown.friends import TTUFriendsManager from toontown.friends import TTUFriendsManager

View file

@ -16,7 +16,6 @@ from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.ai.QuestManagerAI import QuestManagerAI from toontown.ai.QuestManagerAI import QuestManagerAI
from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI
from toontown.ai.DistributedReportMgrAI import DistributedReportMgrAI from toontown.ai.DistributedReportMgrAI import DistributedReportMgrAI
from toontown.catalog.AccountDateAI import AccountDateAI
from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI from toontown.building.DistributedBuildingQueryMgrAI import DistributedBuildingQueryMgrAI
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI from toontown.catalog.CatalogManagerAI import CatalogManagerAI
@ -121,8 +120,6 @@ class ToontownAIRepository(ToontownInternalRepository):
self.holidayManager = HolidayManagerAI(self) self.holidayManager = HolidayManagerAI(self)
self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self) self.codeRedemptionMgr = TTCodeRedemptionMgrAI(self)
self.codeRedemptionMgr.generateWithRequired(2) self.codeRedemptionMgr.generateWithRequired(2)
self.accountDateMgr = AccountDateAI(self)
self.accountDateMgr.generateWithRequired(2)
self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self) self.buildingQueryMgr = DistributedBuildingQueryMgrAI(self)
self.buildingQueryMgr.generateWithRequired(2) self.buildingQueryMgr.generateWithRequired(2)
self.groupManager.generateWithRequired(2) self.groupManager.generateWithRequired(2)

View file

@ -1,39 +0,0 @@
from direct.distributed.DistributedObject import DistributedObject
from direct.directnotify.DirectNotifyGlobal import directNotify
from datetime import datetime
class AccountDate(DistributedObject):
neverDisable = 1
notify = directNotify.newCategory('AccountDate')
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.accountDays = 0
def announceGenerate(self):
DistributedObject.announceGenerate(self)
base.cr.accountDateMgr = self
taskMgr.doMethodLater(10, self.requestDate, 'request-task')
def delete(self):
if hasattr(base.cr, 'accountDateMgr'):
if base.cr.accountDateMgr is self:
del base.cr.accountDateMgr
DistributedObject.delete(self)
def getAccountDays(self):
return self.accountDays
def requestDate(self, task=None):
self.sendUpdate('requestDate')
if task is not None:
return task.done
def requestDateResult(self, result):
if result is None:
notify.warning('Invalid response from server.')
self.accountDays = 0
else:
date = datetime.strptime(result, "%a %b %d %H:%M:%S %Y")
self.accountDays = (datetime.now() - date).days

View file

@ -1,23 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class AccountDateAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("AccountDateAI")
def announceGenerate(self):
DistributedObjectAI.announceGenerate(self)
def requestDate(self):
avId = self.air.getAvatarIdFromSender()
av = self.air.doId2do.get(avId)
if not av:
return
def callback(dclass, fields):
if dclass is not None and dclass == self.air.dclassesByName['AccountAI'] and fields.has_key('CREATED'):
self.sendUpdateToAvatarId(avId, 'requestDateResult', [fields.get('CREATED')])
else:
self.sendUpdateToAvatarId(avId, 'requestDateResult', [None])
self.air.dbInterface.queryObject(self.air.dbId, av.DISLid, callback)

View file

@ -363,9 +363,6 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem):
dg.addUint16(self.accessoryType) dg.addUint16(self.accessoryType)
dg.addBool(self.isSpecial) dg.addBool(self.isSpecial)
def isGift(self):
return not self.getEmblemPrices()
def getAllAccessories(*accessoryTypes): def getAllAccessories(*accessoryTypes):
list = [] list = []
for accessoryType in accessoryTypes: for accessoryType in accessoryTypes:

View file

@ -548,9 +548,6 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
dg.addUint8(self.colorIndex) dg.addUint8(self.colorIndex)
dg.addBool(self.isSpecial) dg.addBool(self.isSpecial)
def isGift(self):
return not self.getEmblemPrices()
def getAllClothes(*clothingTypes): def getAllClothes(*clothingTypes):
list = [] list = []
for clothingType in clothingTypes: for clothingType in clothingTypes:

View file

@ -122,6 +122,3 @@ class CatalogEmoteItem(CatalogItem.CatalogItem):
CatalogItem.CatalogItem.encodeDatagram(self, dg, store) CatalogItem.CatalogItem.encodeDatagram(self, dg, store)
dg.addUint8(self.emoteIndex) dg.addUint8(self.emoteIndex)
dg.addBool(self.isSpecial) dg.addBool(self.isSpecial)
def isGift(self):
return not self.getEmblemPrices()

View file

@ -115,9 +115,7 @@ class CatalogItem:
return self.saleItem return self.saleItem
def isGift(self): def isGift(self):
if self.getEmblemPrices(): return not self.getEmblemPrices()
return 0
return 1
def isRental(self): def isRental(self):
return 0 return 0

View file

@ -45,11 +45,10 @@ class CatalogScreen(DirectFrame):
DirectFrame.__init__(self, parent) DirectFrame.__init__(self, parent)
self.friendGiftIndex = 0 self.friendGiftIndex = 0
self.friendGiftHandle = None self.friendGiftHandle = None
self.frienddoId = None self.friendDoId = None
self.receiverName = 'Error Nameless Toon' self.receiverName = 'Error Nameless Toon'
self.friends = {} self.friends = {}
self.family = {} self.friendList = []
self.ffList = []
self.textRolloverColor = Vec4(1, 1, 0, 1) self.textRolloverColor = Vec4(1, 1, 0, 1)
self.textDownColor = Vec4(0.5, 0.9, 1, 1) self.textDownColor = Vec4(0.5, 0.9, 1, 1)
self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1) self.textDisabledColor = Vec4(0.4, 0.8, 0.4, 1)
@ -92,7 +91,7 @@ class CatalogScreen(DirectFrame):
taskMgr.doMethodLater(12.0, clarabelleHelpText1, 'clarabelleHelpText1') taskMgr.doMethodLater(12.0, clarabelleHelpText1, 'clarabelleHelpText1')
if hasattr(self, 'giftToggle'): if hasattr(self, 'giftToggle'):
self.giftToggle['state'] = DGG.NORMAL self.giftToggle['state'] = DGG.NORMAL
self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOn self.giftToggle['text'] = TTLocalizer.CatalogGiftToggleOff
def hide(self): def hide(self):
self.ignore('CatalogItemPurchaseRequest') self.ignore('CatalogItemPurchaseRequest')
@ -542,8 +541,8 @@ class CatalogScreen(DirectFrame):
-2.0, -2.0,
-1.45), image_scale=(1.0, 1.0, smash), image_pos=(0.0, 0.0, -1.9 + lift), image=backDown, pressEffect=0, command=self.showEmblemItems, text=TTLocalizer.CatalogEmblem, text_font=ToontownGlobals.getSignFont(), text_pos=(1.75, 0.132), text_scale=0.065, text_fg=(0.353, 0.627, 0.627, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0)) -1.45), image_scale=(1.0, 1.0, smash), image_pos=(0.0, 0.0, -1.9 + lift), image=backDown, pressEffect=0, command=self.showEmblemItems, text=TTLocalizer.CatalogEmblem, text_font=ToontownGlobals.getSignFont(), text_pos=(1.75, 0.132), text_scale=0.065, text_fg=(0.353, 0.627, 0.627, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0))
self.emblemCatalogButton2.hide() self.emblemCatalogButton2.hide()
self.__makeFFlist() self.__makeFriendList()
if len(self.ffList) > 0: if len(self.friendList) > 0:
if config.GetBool('want-gifting', True): if config.GetBool('want-gifting', True):
self.giftToggle = DirectButton(self.base, relief=None, pressEffect=0, image=(giftToggleUp, giftToggleDown, giftToggleUp), image_scale=(1.0, 1, 0.7), command=self.__giftToggle, text=TTLocalizer.CatalogGiftToggleOff, text_font=ToontownGlobals.getSignFont(), text_pos=TTLocalizer.CSgiftTogglePos, text_scale=TTLocalizer.CSgiftToggle, text_fg=(0.353, 0.627, 0.627, 1.0), text3_fg=(0.15, 0.3, 0.3, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0), image_color=Vec4(1.0, 1.0, 0.2, 1.0), image1_color=Vec4(0.9, 0.85, 0.2, 1.0), image2_color=Vec4(0.9, 0.85, 0.2, 1.0), image3_color=Vec4(0.5, 0.45, 0.2, 1.0)) self.giftToggle = DirectButton(self.base, relief=None, pressEffect=0, image=(giftToggleUp, giftToggleDown, giftToggleUp), image_scale=(1.0, 1, 0.7), command=self.__giftToggle, text=TTLocalizer.CatalogGiftToggleOff, text_font=ToontownGlobals.getSignFont(), text_pos=TTLocalizer.CSgiftTogglePos, text_scale=TTLocalizer.CSgiftToggle, text_fg=(0.353, 0.627, 0.627, 1.0), text3_fg=(0.15, 0.3, 0.3, 1.0), text2_fg=(0.353, 0.427, 0.427, 1.0), image_color=Vec4(1.0, 1.0, 0.2, 1.0), image1_color=Vec4(0.9, 0.85, 0.2, 1.0), image2_color=Vec4(0.9, 0.85, 0.2, 1.0), image3_color=Vec4(0.5, 0.45, 0.2, 1.0))
self.giftToggle.setPos(0.0, 0, -0.035) self.giftToggle.setPos(0.0, 0, -0.035)
@ -569,8 +568,8 @@ class CatalogScreen(DirectFrame):
clipNP = self.scrollList.attachNewNode(clipper) clipNP = self.scrollList.attachNewNode(clipper)
self.scrollList.setClipPlane(clipNP) self.scrollList.setClipPlane(clipNP)
self.__makeScrollList() self.__makeScrollList()
friendId = self.ffList[0] friendId = self.friendList[0]
self.__chooseFriend(self.ffList[0][0], self.ffList[0][1]) self.__chooseFriend(self.friendList[0][0], self.friendList[0][1])
self.update() self.update()
self.createdGiftGui = 1 self.createdGiftGui = 1
for i in range(4): for i in range(4):
@ -865,11 +864,7 @@ class CatalogScreen(DirectFrame):
if self.responseDialog: if self.responseDialog:
self.responseDialog.cleanup() self.responseDialog.cleanup()
self.responseDialog = None self.responseDialog = None
if self.giftAvatar: self.unloadFriend()
if hasattr(self.giftAvatar, 'doId'):
self.giftAvatar.delete()
else:
self.giftAvatar = None
return return
def unloadClarabelle(self): def unloadClarabelle(self):
@ -933,7 +928,7 @@ class CatalogScreen(DirectFrame):
taskMgr.remove('clarabelleAskAnythingElse') taskMgr.remove('clarabelleAskAnythingElse')
def __handleGiftPurchaseRequest(self, item): def __handleGiftPurchaseRequest(self, item):
item.requestGiftPurchase(self['phone'], self.frienddoId, self.__handleGiftPurchaseResponse) item.requestGiftPurchase(self['phone'], self.friendDoId, self.__handleGiftPurchaseResponse)
taskMgr.remove('clarabelleAskAnythingElse') taskMgr.remove('clarabelleAskAnythingElse')
def __handlePurchaseResponse(self, retCode, item): def __handlePurchaseResponse(self, retCode, item):
@ -1015,61 +1010,61 @@ class CatalogScreen(DirectFrame):
self.silverLabel.hide() self.silverLabel.hide()
self.goldLabel.hide() self.goldLabel.hide()
def checkFamily(self, doId): def __makeFriendList(self):
test = 0 for av in base.cr.avList:
for familyMember in base.cr.avList: if localAvatar.doId == av.id:
if familyMember.id == doId: continue
test = 1 self.friendList.append((av.id, av.name, NametagGlobals.CCNormal))
return test
def __makeFFlist(self):
for id, handle in base.cr.friendsMap.items(): for id, handle in base.cr.friendsMap.items():
self.ffList.append((id, handle.getName(), NametagGlobals.CCFreeChat)) self.friendList.append((id, handle.getName(), NametagGlobals.getFriendColor(handle.commonChatFlags)))
def __makeScrollList(self): def __makeScrollList(self):
for ff in self.ffList: for friend in self.friendList:
ffbutton = self.makeFamilyButton(ff[0], ff[1], ff[2]) friendButton = self.makeFriendButton(friend[0], friend[1], friend[2])
if ffbutton: if friendButton:
self.scrollList.addItem(ffbutton, refresh=0) self.scrollList.addItem(friendButton, refresh=0)
self.friends[ff] = ffbutton self.friends[friend] = friendButton
self.scrollList.refresh() self.scrollList.refresh()
def makeFamilyButton(self, familyId, familyName, colorCode): def makeFriendButton(self, avId, avName, colorCode):
# fg = NametagGlobals.getNameFg(colorCode, PGButton.SInactive)
return DirectButton( return DirectButton(
relief=None, relief=None,
text=familyName, text=avName,
text_scale=0.04, text_scale=0.04,
text_align=TextNode.ALeft, text_align=TextNode.ALeft,
# text_fg=fg, text_fg=NametagGlobals.NametagColors[colorCode][0][0],
text1_bg=self.textDownColor, text1_bg=self.textDownColor,
text2_bg=self.textRolloverColor, text2_bg=self.textRolloverColor,
text3_fg=self.textDisabledColor, text3_fg=self.textDisabledColor,
textMayChange=0, textMayChange=0,
command=self.__chooseFriend, command=self.__chooseFriend,
extraArgs=[familyId, familyName] extraArgs=[avId, avName]
) )
def __chooseFriend(self, friendId, friendName): def __chooseFriend(self, friendId, friendName):
if self.friendDoId and self.friendDoId == friendId:
return
messenger.send('wakeup') messenger.send('wakeup')
self.frienddoId = friendId self.friendDoId = friendId
self.receiverName = friendName self.receiverName = friendName
self.friendLabel['text'] = TTLocalizer.CatalogGiftTo % self.receiverName self.friendLabel['text'] = TTLocalizer.CatalogGiftTo % self.receiverName
self.__loadFriend() self.__loadFriend()
def unloadFriend(self):
if self.giftAvatar:
if hasattr(self.giftAvatar, 'doId'):
self.giftAvatar.disable()
self.giftAvatar.delete()
self.giftAvatar = None
def __loadFriend(self): def __loadFriend(self):
if self.allowGetDetails == 0: if self.allowGetDetails == 0:
CatalogScreen.notify.warning('smashing requests') CatalogScreen.notify.warning('smashing requests')
if self.frienddoId and self.allowGetDetails: if self.friendDoId and self.allowGetDetails:
if self.giftAvatar: self.unloadFriend()
if hasattr(self.giftAvatar, 'doId'):
self.giftAvatar.disable()
self.giftAvatar.delete()
self.giftAvatar = None
self.giftAvatar = DistributedToon.DistributedToon(base.cr) self.giftAvatar = DistributedToon.DistributedToon(base.cr)
self.giftAvatar.doId = self.frienddoId self.giftAvatar.doId = self.friendDoId
self.giftAvatar.forceAllowDelayDelete() self.giftAvatar.forceAllowDelayDelete()
self.giftAvatar.generate() self.giftAvatar.generate()
base.cr.getAvatarDetails(self.giftAvatar, self.__handleAvatarDetails, 'DistributedToon') base.cr.getAvatarDetails(self.giftAvatar, self.__handleAvatarDetails, 'DistributedToon')

View file

@ -135,6 +135,8 @@ def getModelWidthHeight(model):
height = maxPoint.getZ() - minPoint.getZ() height = maxPoint.getZ() - minPoint.getZ()
return (width, height) return (width, height)
def getFriendColor(flag):
return CCNormal if flag == 1 and settings['trueFriends'] else CCFreeChat
# Foreground, background: # Foreground, background:
NametagColors = { NametagColors = {

View file

@ -1,21 +0,0 @@
from pandac.PandaModules import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
class DeleteManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DeleteManager')
neverDisable = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
def generate(self):
DistributedObject.DistributedObject.generate(self)
self.accept('deleteItems', self.d_setInventory)
def disable(self):
self.ignore('deleteItems')
DistributedObject.DistributedObject.disable(self)
def d_setInventory(self, newInventoryString):
self.sendUpdate('setInventory', [newInventoryString])

View file

@ -1,9 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DeleteManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DeleteManagerAI")
def setInventory(self, todo0):
pass

View file

@ -1688,9 +1688,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
DistributedToon.DistributedToon.setPinkSlips(self, pinkSlips) DistributedToon.DistributedToon.setPinkSlips(self, pinkSlips)
self.inventory.updateTotalPropsText() self.inventory.updateTotalPropsText()
def getAccountDays(self):
return base.cr.accountDateMgr.getAccountDays()
def hasActiveBoardingGroup(self): def hasActiveBoardingGroup(self):
if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty: if hasattr(localAvatar, 'boardingParty') and localAvatar.boardingParty:
return localAvatar.boardingParty.hasActiveGroup(localAvatar.doId) return localAvatar.boardingParty.hasActiveGroup(localAvatar.doId)